| Index: sound/soc/samsung/smartq_wm8987.c
|
| diff --git a/sound/soc/s3c24xx/smartq_wm8987.c b/sound/soc/samsung/smartq_wm8987.c
|
| similarity index 80%
|
| rename from sound/soc/s3c24xx/smartq_wm8987.c
|
| rename to sound/soc/samsung/smartq_wm8987.c
|
| index dd20ca7f46814e3458860931910d18a39bc4508f..0a2c4f22303811b55921452f783ae485fefb3bdd 100644
|
| --- a/sound/soc/s3c24xx/smartq_wm8987.c
|
| +++ b/sound/soc/samsung/smartq_wm8987.c
|
| @@ -1,4 +1,4 @@
|
| -/* sound/soc/s3c24xx/smartq_wm8987.c
|
| +/* sound/soc/samsung/smartq_wm8987.c
|
| *
|
| * Copyright 2010 Maurus Cuelenaere <mcuelenaere@gmail.com>
|
| *
|
| @@ -13,20 +13,14 @@
|
| *
|
| */
|
|
|
| -#include <linux/module.h>
|
| -#include <linux/platform_device.h>
|
| #include <linux/gpio.h>
|
|
|
| -#include <sound/pcm.h>
|
| -#include <sound/pcm_params.h>
|
| -#include <sound/soc-dapm.h>
|
| +#include <sound/soc.h>
|
| #include <sound/jack.h>
|
|
|
| #include <asm/mach-types.h>
|
|
|
| -#include "s3c-dma.h"
|
| -#include "s3c64xx-i2s.h"
|
| -
|
| +#include "i2s.h"
|
| #include "../codecs/wm8750.h"
|
|
|
| /*
|
| @@ -39,15 +33,11 @@ static int smartq_hifi_hw_params(struct snd_pcm_substream *substream,
|
| struct snd_pcm_hw_params *params)
|
| {
|
| struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
| - struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
|
| - struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
|
| - struct s3c_i2sv2_rate_calc div;
|
| + struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
| + struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
| unsigned int clk = 0;
|
| int ret;
|
|
|
| - s3c_i2sv2_iis_calc_rate(&div, NULL, params_rate(params),
|
| - s3c_i2sv2_get_clock(cpu_dai));
|
| -
|
| switch (params_rate(params)) {
|
| case 8000:
|
| case 16000:
|
| @@ -78,20 +68,21 @@ static int smartq_hifi_hw_params(struct snd_pcm_substream *substream,
|
| if (ret < 0)
|
| return ret;
|
|
|
| - /* set the codec system clock for DAC and ADC */
|
| - ret = snd_soc_dai_set_sysclk(codec_dai, WM8750_SYSCLK, clk,
|
| - SND_SOC_CLOCK_IN);
|
| + /* Use PCLK for I2S signal generation */
|
| + ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_RCLKSRC_0,
|
| + 0, SND_SOC_CLOCK_IN);
|
| if (ret < 0)
|
| return ret;
|
|
|
| - /* set MCLK division for sample rate */
|
| - ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C_I2SV2_DIV_RCLK, div.fs_div);
|
| + /* Gate the RCLK output on PAD */
|
| + ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_CDCLK,
|
| + 0, SND_SOC_CLOCK_IN);
|
| if (ret < 0)
|
| return ret;
|
|
|
| - /* set prescaler division for sample rate */
|
| - ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C_I2SV2_DIV_PRESCALER,
|
| - div.clk_div - 1);
|
| + /* set the codec system clock for DAC and ADC */
|
| + ret = snd_soc_dai_set_sysclk(codec_dai, WM8750_SYSCLK, clk,
|
| + SND_SOC_CLOCK_IN);
|
| if (ret < 0)
|
| return ret;
|
|
|
| @@ -156,12 +147,14 @@ static const struct snd_soc_dapm_route audio_map[] = {
|
| {"LINPUT2", NULL, "Mic Bias"},
|
| };
|
|
|
| -static int smartq_wm8987_init(struct snd_soc_codec *codec)
|
| +static int smartq_wm8987_init(struct snd_soc_pcm_runtime *rtd)
|
| {
|
| + struct snd_soc_codec *codec = rtd->codec;
|
| + struct snd_soc_dapm_context *dapm = &codec->dapm;
|
| int err = 0;
|
|
|
| /* Add SmartQ specific widgets */
|
| - snd_soc_dapm_new_controls(codec, wm8987_dapm_widgets,
|
| + snd_soc_dapm_new_controls(dapm, wm8987_dapm_widgets,
|
| ARRAY_SIZE(wm8987_dapm_widgets));
|
|
|
| /* add SmartQ specific controls */
|
| @@ -172,25 +165,25 @@ static int smartq_wm8987_init(struct snd_soc_codec *codec)
|
| return err;
|
|
|
| /* setup SmartQ specific audio path */
|
| - snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
|
| + snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
|
|
|
| /* set endpoints to not connected */
|
| - snd_soc_dapm_nc_pin(codec, "LINPUT1");
|
| - snd_soc_dapm_nc_pin(codec, "RINPUT1");
|
| - snd_soc_dapm_nc_pin(codec, "OUT3");
|
| - snd_soc_dapm_nc_pin(codec, "ROUT1");
|
| + snd_soc_dapm_nc_pin(dapm, "LINPUT1");
|
| + snd_soc_dapm_nc_pin(dapm, "RINPUT1");
|
| + snd_soc_dapm_nc_pin(dapm, "OUT3");
|
| + snd_soc_dapm_nc_pin(dapm, "ROUT1");
|
|
|
| /* set endpoints to default off mode */
|
| - snd_soc_dapm_enable_pin(codec, "Internal Speaker");
|
| - snd_soc_dapm_enable_pin(codec, "Internal Mic");
|
| - snd_soc_dapm_disable_pin(codec, "Headphone Jack");
|
| + snd_soc_dapm_enable_pin(dapm, "Internal Speaker");
|
| + snd_soc_dapm_enable_pin(dapm, "Internal Mic");
|
| + snd_soc_dapm_disable_pin(dapm, "Headphone Jack");
|
|
|
| - err = snd_soc_dapm_sync(codec);
|
| + err = snd_soc_dapm_sync(dapm);
|
| if (err)
|
| return err;
|
|
|
| /* Headphone jack detection */
|
| - err = snd_soc_jack_new(&snd_soc_smartq, "Headphone Jack",
|
| + err = snd_soc_jack_new(codec, "Headphone Jack",
|
| SND_JACK_HEADPHONE, &smartq_jack);
|
| if (err)
|
| return err;
|
| @@ -211,9 +204,9 @@ static struct snd_soc_dai_link smartq_dai[] = {
|
| {
|
| .name = "wm8987",
|
| .stream_name = "SmartQ Hi-Fi",
|
| - .cpu_dai_name = "s3c64xx-i2s.0",
|
| + .cpu_dai_name = "samsung-i2s.0",
|
| .codec_dai_name = "wm8750-hifi",
|
| - .platform_name = "s3c24xx-pcm-audio",
|
| + .platform_name = "samsung-audio",
|
| .codec_name = "wm8750-codec.0-0x1a",
|
| .init = smartq_wm8987_init,
|
| .ops = &smartq_hifi_ops,
|
| @@ -275,6 +268,7 @@ err_unregister_device:
|
|
|
| static void __exit smartq_exit(void)
|
| {
|
| + gpio_free(S3C64XX_GPK(12));
|
| snd_soc_jack_free_gpios(&smartq_jack, ARRAY_SIZE(smartq_jack_gpios),
|
| smartq_jack_gpios);
|
|
|
|
|