diff options
author | Xinyu Chen <b03824@freescale.com> | 2011-12-23 10:34:02 +0800 |
---|---|---|
committer | Xinyu Chen <b03824@freescale.com> | 2011-12-23 10:34:02 +0800 |
commit | c940ff2aed85edb49bdabe675ee8f47d294c6334 (patch) | |
tree | 3f764157c3a8a571974656b0bbb3c5701dfb8523 /sound | |
parent | 49adb1391aca48929080178bd7a78eed64e026e1 (diff) | |
parent | 8bc0b1b87bd7d66a37c45a0a2be2a368ff7127f2 (diff) |
Merge remote branch 'fsl-linux-sdk/imx_2.6.38' into imx_2.6.38_android
Conflicts:
arch/arm/mach-mx6/board-mx6q_arm2.c
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/sgtl5000.c | 19 | ||||
-rw-r--r-- | sound/soc/imx/imx-cs42888.c | 21 | ||||
-rw-r--r-- | sound/soc/imx/imx-ssi.c | 44 |
3 files changed, 74 insertions, 10 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index d7500e7717c6..8cf6761b66b6 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -320,7 +320,7 @@ static int dac_info_volsw(struct snd_kcontrol *kcontrol, uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; uinfo->value.integer.min = 0; - uinfo->value.integer.max = 0xfc - 0x3c; + uinfo->value.integer.max = 0xfc - 0x60; return 0; } @@ -363,9 +363,9 @@ static int dac_get_volsw(struct snd_kcontrol *kcontrol, /* get right channel volume */ r = (reg & SGTL5000_DAC_VOL_RIGHT_MASK) >> SGTL5000_DAC_VOL_RIGHT_SHIFT; - /* make sure value fall in (0x3c,0xfc) */ - l = clamp(l, 0x3c, 0xfc); - r = clamp(r, 0x3c, 0xfc); + /* make sure value fall in (0x60,0xfc) */ + l = clamp(l, 0x60, 0xfc); + r = clamp(r, 0x60, 0xfc); /* invert it and map to userspace value */ l = 0xfc - l; @@ -411,9 +411,9 @@ static int dac_put_volsw(struct snd_kcontrol *kcontrol, l = ucontrol->value.integer.value[0]; r = ucontrol->value.integer.value[1]; - /* make sure userspace volume fall in (0, 0xfc-0x3c) */ - l = clamp(l, 0, 0xfc - 0x3c); - r = clamp(r, 0, 0xfc - 0x3c); + /* make sure userspace volume fall in (0, 0xfc-0x60) */ + l = clamp(l, 0, 0xfc - 0x60); + r = clamp(r, 0, 0xfc - 0x60); /* invert it, get the value can be set to register */ l = 0xfc - l; @@ -1563,6 +1563,11 @@ static int sgtl5000_probe(struct snd_soc_codec *codec) snd_soc_write(codec, SGTL5000_CHIP_MIC_CTRL, 0); + snd_soc_write(codec, SGTL5000_CHIP_DAC_VOL, 0x6060); + snd_soc_write(codec, SGTL5000_CHIP_ANA_ADC_CTRL, + (0xf << SGTL5000_ADC_VOL_LEFT_SHIFT) |\ + (0xf << SGTL5000_ADC_VOL_RIGHT_SHIFT)); + /* * disable DAP * TODO: diff --git a/sound/soc/imx/imx-cs42888.c b/sound/soc/imx/imx-cs42888.c index 4c9ca9857464..4e97ec246792 100644 --- a/sound/soc/imx/imx-cs42888.c +++ b/sound/soc/imx/imx-cs42888.c @@ -40,6 +40,7 @@ struct imx_priv_state { static struct imx_priv_state hw_state; unsigned int mclk_freq; +int rst_gpio; static int imx_3stack_startup(struct snd_pcm_substream *substream) { @@ -48,9 +49,15 @@ static int imx_3stack_startup(struct snd_pcm_substream *substream) if (!cpu_dai->active) { hw_state.hw = 0; - gpio_direction_output(CS42888_RST, 0); - msleep(100); - gpio_direction_output(CS42888_RST, 1); + if (rst_gpio) { + gpio_direction_output(rst_gpio, 0); + msleep(100); + gpio_direction_output(rst_gpio, 1); + } else { + gpio_direction_output(CS42888_RST, 0); + msleep(100); + gpio_direction_output(CS42888_RST, 1); + } } return 0; @@ -254,7 +261,15 @@ static struct snd_soc_card snd_soc_card_imx_3stack = { static int __devinit imx_3stack_cs42888_probe(struct platform_device *pdev) { struct mxc_audio_platform_data *plat_data = pdev->dev.platform_data; + + if (!plat_data) { + dev_err(&pdev->dev, "plat_data is missing\n"); + return -EINVAL; + } mclk_freq = plat_data->sysclk; + rst_gpio = plat_data->rst_gpio; + if (plat_data->codec_name) + imx_3stack_dai[0].codec_name = plat_data->codec_name; return 0; } diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index 559dbfb7319d..a8cd8cc13c4c 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c @@ -359,6 +359,31 @@ static int imx_ssi_trigger(struct snd_pcm_substream *substream, int cmd, return 0; } +static int imx_ssi_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *cpu_dai) +{ + struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai); + + if (cpu_dai->playback_active || cpu_dai->capture_active) + return 0; + + clk_enable(ssi->clk); + + return 0; +} + +static void imx_ssi_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *cpu_dai) +{ + struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai); + + /* shutdown SSI if neither Tx or Rx is active */ + if (cpu_dai->playback_active || cpu_dai->capture_active) + return; + + clk_disable(ssi->clk); +} + static struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = { .hw_params = imx_ssi_hw_params, .set_fmt = imx_ssi_set_dai_fmt, @@ -366,6 +391,8 @@ static struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = { .set_sysclk = imx_ssi_set_dai_sysclk, .set_tdm_slot = imx_ssi_set_dai_tdm_slot, .trigger = imx_ssi_trigger, + .startup = imx_ssi_startup, + .shutdown = imx_ssi_shutdown, }; int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, @@ -470,8 +497,25 @@ static int imx_ssi_dai_probe(struct snd_soc_dai *dai) return 0; } +#ifdef CONFIG_PM +static int imx_ssi_dai_suspend(struct snd_soc_dai *dai) +{ + return 0; +} + +static int imx_ssi_dai_resume(struct snd_soc_dai *dai) +{ + return 0; +} +#else +#define imx_ssi_suspend NULL +#define imx_ssi_resume NULL +#endif + static struct snd_soc_dai_driver imx_ssi_dai = { .probe = imx_ssi_dai_probe, + .suspend = imx_ssi_dai_suspend, + .resume = imx_ssi_dai_resume, .playback = { .channels_min = 1, .channels_max = 2, |