From 1d533de998e2887f23c8cf6c39d5db55f8d202af Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 22 Oct 2011 22:48:27 +0800 Subject: ASoC: wm8400: Fix setting Fout clock divider for FLL Control 4 What we want here is to clear the WM8400_FLL_OUTDIV_MASK bits then OR with factors.outdiv. Signed-off-by: Axel Lin Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/codecs/wm8400.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index dc13be2..f29bc26 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c @@ -1059,7 +1059,7 @@ static int wm8400_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, wm8400_write(codec, WM8400_FLL_CONTROL_3, factors.n); reg = wm8400_read(codec, WM8400_FLL_CONTROL_4); - reg &= WM8400_FLL_OUTDIV_MASK; + reg &= ~WM8400_FLL_OUTDIV_MASK; reg |= factors.outdiv; wm8400_write(codec, WM8400_FLL_CONTROL_4, reg); -- cgit v1.1 From 753ddf52153b60be924109df3bebab0cd60b3297 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 24 Oct 2011 11:31:12 +0800 Subject: ASoC: wm8996: Avoid a redundant i2c_get_clientdata call in wm8996_i2c_remove Signed-off-by: Axel Lin Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/codecs/wm8996.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 645c980..32324c9 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c @@ -3144,7 +3144,7 @@ static __devexit int wm8996_i2c_remove(struct i2c_client *client) snd_soc_unregister_codec(&client->dev); if (wm8996->pdata.ldo_ena > 0) gpio_free(wm8996->pdata.ldo_ena); - kfree(i2c_get_clientdata(client)); + kfree(wm8996); return 0; } -- cgit v1.1 From 49fa4d9b5aeafb985abe8cb8cdf6432690c49ad3 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 24 Oct 2011 11:32:41 +0800 Subject: ASoC: wm8940: Fix setting PLL Output clock division ratio According to the datasheet: The PLL Output clock division ratio is controlled by BIT[5:4] of WM8940_GPIO register(08h). Current code read/write the WM8940_ADDCNTRL(07h) register which is wrong. Signed-off-by: Axel Lin Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/codecs/wm8940.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index a4abfdf..3cc3bce 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c @@ -627,8 +627,8 @@ static int wm8940_set_dai_clkdiv(struct snd_soc_dai *codec_dai, ret = snd_soc_write(codec, WM8940_CLOCK, reg | (div << 5)); break; case WM8940_OPCLKDIV: - reg = snd_soc_read(codec, WM8940_ADDCNTRL) & 0xFFCF; - ret = snd_soc_write(codec, WM8940_ADDCNTRL, reg | (div << 4)); + reg = snd_soc_read(codec, WM8940_GPIO) & 0xFFCF; + ret = snd_soc_write(codec, WM8940_GPIO, reg | (div << 4)); break; } return ret; -- cgit v1.1 From bdb527e9ae038d76917a999108176c5f5be5e35e Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 24 Oct 2011 11:33:55 +0800 Subject: ASoC: wm8940: Fix a typo for the mask of setting WM8940_BCLKDIV The registers are 16 bits, thus remove an extra F for the mask. Signed-off-by: Axel Lin Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/codecs/wm8940.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index 3cc3bce..fec3892 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c @@ -619,7 +619,7 @@ static int wm8940_set_dai_clkdiv(struct snd_soc_dai *codec_dai, switch (div_id) { case WM8940_BCLKDIV: - reg = snd_soc_read(codec, WM8940_CLOCK) & 0xFFEF3; + reg = snd_soc_read(codec, WM8940_CLOCK) & 0xFEF3; ret = snd_soc_write(codec, WM8940_CLOCK, reg | (div << 2)); break; case WM8940_MCLKDIV: -- cgit v1.1 From 9c173d15f99ef182ac4b27e3e03779026d8e6cf1 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 26 Oct 2011 22:13:17 +0800 Subject: ASoC: tlv320aic3x: Use snd_soc_update_bits for read-modify-write Use snd_soc_update_bits for read-modify-write register access instead of open-coding it using snd_soc_read and snd_soc_write Signed-off-by: Axel Lin Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/codecs/tlv320aic3x.c | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 7a49390..a77f6ea 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -833,7 +833,6 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0; u8 data, j, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1; u16 d, pll_d = 1; - u8 reg; int clk; /* select data word length */ @@ -869,14 +868,13 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream, snd_soc_write(codec, AIC3X_PLL_PROGA_REG, pll_q << PLLQ_SHIFT); snd_soc_write(codec, AIC3X_GPIOB_REG, CODEC_CLKIN_CLKDIV); /* disable PLL if it is bypassed */ - reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); - snd_soc_write(codec, AIC3X_PLL_PROGA_REG, reg & ~PLL_ENABLE); + snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, PLL_ENABLE, 0); } else { snd_soc_write(codec, AIC3X_GPIOB_REG, CODEC_CLKIN_PLLDIV); /* enable PLL when it is used */ - reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); - snd_soc_write(codec, AIC3X_PLL_PROGA_REG, reg | PLL_ENABLE); + snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, + PLL_ENABLE, PLL_ENABLE); } /* Route Left DAC to left channel input and @@ -1155,7 +1153,6 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); - u8 reg; switch (level) { case SND_SOC_BIAS_ON: @@ -1164,9 +1161,8 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec, if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY && aic3x->master) { /* enable pll */ - reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); - snd_soc_write(codec, AIC3X_PLL_PROGA_REG, - reg | PLL_ENABLE); + snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, + PLL_ENABLE, PLL_ENABLE); } break; case SND_SOC_BIAS_STANDBY: @@ -1175,9 +1171,8 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec, if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE && aic3x->master) { /* disable pll */ - reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); - snd_soc_write(codec, AIC3X_PLL_PROGA_REG, - reg & ~PLL_ENABLE); + snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, + PLL_ENABLE, 0); } break; case SND_SOC_BIAS_OFF: @@ -1294,7 +1289,6 @@ static int aic3x_resume(struct snd_soc_codec *codec) static int aic3x_init(struct snd_soc_codec *codec) { struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); - int reg; snd_soc_write(codec, AIC3X_PAGE_SELECT, PAGE0_SELECT); snd_soc_write(codec, AIC3X_RESET, SOFT_RESET); @@ -1316,20 +1310,13 @@ static int aic3x_init(struct snd_soc_codec *codec) snd_soc_write(codec, DACR1_2_MONOLOPM_VOL, DEFAULT_VOL | ROUTE_ON); /* unmute all outputs */ - reg = snd_soc_read(codec, LLOPM_CTRL); - snd_soc_write(codec, LLOPM_CTRL, reg | UNMUTE); - reg = snd_soc_read(codec, RLOPM_CTRL); - snd_soc_write(codec, RLOPM_CTRL, reg | UNMUTE); - reg = snd_soc_read(codec, MONOLOPM_CTRL); - snd_soc_write(codec, MONOLOPM_CTRL, reg | UNMUTE); - reg = snd_soc_read(codec, HPLOUT_CTRL); - snd_soc_write(codec, HPLOUT_CTRL, reg | UNMUTE); - reg = snd_soc_read(codec, HPROUT_CTRL); - snd_soc_write(codec, HPROUT_CTRL, reg | UNMUTE); - reg = snd_soc_read(codec, HPLCOM_CTRL); - snd_soc_write(codec, HPLCOM_CTRL, reg | UNMUTE); - reg = snd_soc_read(codec, HPRCOM_CTRL); - snd_soc_write(codec, HPRCOM_CTRL, reg | UNMUTE); + snd_soc_update_bits(codec, LLOPM_CTRL, UNMUTE, UNMUTE); + snd_soc_update_bits(codec, RLOPM_CTRL, UNMUTE, UNMUTE); + snd_soc_update_bits(codec, MONOLOPM_CTRL, UNMUTE, UNMUTE); + snd_soc_update_bits(codec, HPLOUT_CTRL, UNMUTE, UNMUTE); + snd_soc_update_bits(codec, HPROUT_CTRL, UNMUTE, UNMUTE); + snd_soc_update_bits(codec, HPLCOM_CTRL, UNMUTE, UNMUTE); + snd_soc_update_bits(codec, HPRCOM_CTRL, UNMUTE, UNMUTE); /* ADC default volume and unmute */ snd_soc_write(codec, LADC_VOL, DEFAULT_GAIN); -- cgit v1.1 From e50fad4f029c36ed85a71fe7413684cfd3c7d78c Mon Sep 17 00:00:00 2001 From: "ramesh.babu@linux.intel.com" Date: Thu, 27 Oct 2011 12:12:33 +0530 Subject: ASoC: Allow machines to ignore pmdown_time per-link With this flag, each dai_link in machine driver can choose to ignore pmdown_time during DAPM shut down sequence. If the ignore_pmdown_time is set, the DAPM for corresponding DAI will be executed immediately. Signed-off-by: Ramesh Babu K V Signed-off-by: Vinod Koul Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-pcm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index ee15337..52a7259 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -319,7 +319,8 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) cpu_dai->runtime = NULL; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - if (unlikely(codec->ignore_pmdown_time)) { + if (unlikely(codec->ignore_pmdown_time || + rtd->dai_link->ignore_pmdown_time)) { /* powered down playback stream now */ snd_soc_dapm_stream_event(rtd, codec_dai->driver->playback.stream_name, -- cgit v1.1 From 9ce316236b572b437a9a96234a8cc9664927c0c0 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 09:49:11 +0200 Subject: ASoC: Convert wm8995 MICBIASes to supply widgets Signed-off-by: Mark Brown --- sound/soc/codecs/wm8995.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c index 78eeb21..4d109b1 100644 --- a/sound/soc/codecs/wm8995.c +++ b/sound/soc/codecs/wm8995.c @@ -688,8 +688,10 @@ static const struct snd_soc_dapm_widget wm8995_dapm_widgets[] = { SND_SOC_DAPM_MIXER("IN1R PGA", SND_SOC_NOPM, 0, 0, &in1r_pga, 1), - SND_SOC_DAPM_MICBIAS("MICBIAS1", WM8995_POWER_MANAGEMENT_1, 8, 0), - SND_SOC_DAPM_MICBIAS("MICBIAS2", WM8995_POWER_MANAGEMENT_1, 9, 0), + SND_SOC_DAPM_SUPPLY("MICBIAS1", WM8995_POWER_MANAGEMENT_1, 8, 0, + NULL, 0), + SND_SOC_DAPM_SUPPLY("MICBIAS2", WM8995_POWER_MANAGEMENT_1, 9, 0, + NULL, 0), SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8995_AIF1_CLOCKING_1, 0, 0, NULL, 0), SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8995_AIF2_CLOCKING_1, 0, 0, NULL, 0), -- cgit v1.1 From b6406a80278a09d19c31717e68312dbd59dd51fc Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 09:48:39 +0200 Subject: ASoC: Convert wm8991 MICBIAS to a supply widget Signed-off-by: Mark Brown --- sound/soc/codecs/wm8991.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c index c9ab3ba..1d46d59 100644 --- a/sound/soc/codecs/wm8991.c +++ b/sound/soc/codecs/wm8991.c @@ -770,8 +770,8 @@ static const struct snd_soc_dapm_widget wm8991_dapm_widgets[] = { NULL, 0), /* MICBIAS */ - SND_SOC_DAPM_MICBIAS("MICBIAS", WM8991_POWER_MANAGEMENT_1, - WM8991_MICBIAS_ENA_BIT, 0), + SND_SOC_DAPM_SUPPLY("MICBIAS", WM8991_POWER_MANAGEMENT_1, + WM8991_MICBIAS_ENA_BIT, 0, NULL, 0), SND_SOC_DAPM_OUTPUT("LON"), SND_SOC_DAPM_OUTPUT("LOP"), -- cgit v1.1 From e1fc3f21c22023b0bb6859c896f1bca979f5cfcc Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 09:48:09 +0200 Subject: ASoC: Convert wm8990 MICBIAS to a supply widget Signed-off-by: Mark Brown --- sound/soc/codecs/wm8990.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index d29a962..d4cbec6 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c @@ -776,8 +776,8 @@ SND_SOC_DAPM_PGA("ROPGA", WM8990_POWER_MANAGEMENT_3, WM8990_ROPGA_ENA_BIT, 0, NULL, 0), /* MICBIAS */ -SND_SOC_DAPM_MICBIAS("MICBIAS", WM8990_POWER_MANAGEMENT_1, - WM8990_MICBIAS_ENA_BIT, 0), +SND_SOC_DAPM_SUPPLY("MICBIAS", WM8990_POWER_MANAGEMENT_1, + WM8990_MICBIAS_ENA_BIT, 0, NULL, 0), SND_SOC_DAPM_OUTPUT("LON"), SND_SOC_DAPM_OUTPUT("LOP"), -- cgit v1.1 From be48f20d8fe2e4c5998f38dd71c79f97c6fced4c Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 09:47:53 +0200 Subject: ASoC: Convert wm8988 MICBIAS to a supply widget Signed-off-by: Mark Brown --- sound/soc/codecs/wm8988.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index 2e9eba7..514189d 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c @@ -267,7 +267,7 @@ static const struct snd_kcontrol_new wm8988_monomux_controls = SOC_DAPM_ENUM("Route", monomux); static const struct snd_soc_dapm_widget wm8988_dapm_widgets[] = { - SND_SOC_DAPM_MICBIAS("Mic Bias", WM8988_PWR1, 1, 0), + SND_SOC_DAPM_SUPPLY("Mic Bias", WM8988_PWR1, 1, 0, NULL, 0), SND_SOC_DAPM_MUX("Differential Mux", SND_SOC_NOPM, 0, 0, &wm8988_diffmux_controls), -- cgit v1.1 From 812f8a3524b9d369a170428acec79c57786d4670 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 09:47:40 +0200 Subject: ASoC: Convert wm8985 MICBIAS to a supply widget Signed-off-by: Mark Brown --- sound/soc/codecs/wm8985.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c index bae510a..36c4ee0 100644 --- a/sound/soc/codecs/wm8985.c +++ b/sound/soc/codecs/wm8985.c @@ -411,7 +411,8 @@ static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = { SND_SOC_DAPM_PGA("Right Speaker Out", WM8985_POWER_MANAGEMENT_3, 6, 0, NULL, 0), - SND_SOC_DAPM_MICBIAS("Mic Bias", WM8985_POWER_MANAGEMENT_1, 4, 0), + SND_SOC_DAPM_SUPPLY("Mic Bias", WM8985_POWER_MANAGEMENT_1, 4, 0, + NULL, 0), SND_SOC_DAPM_INPUT("LIN"), SND_SOC_DAPM_INPUT("LIP"), -- cgit v1.1 From 605b151ae3e025e69f89db46e878c782fdc6489b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 09:47:24 +0200 Subject: ASoC: Convert wm8983 MICBIAS to a supply widget Signed-off-by: Mark Brown --- sound/soc/codecs/wm8983.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8983.c b/sound/soc/codecs/wm8983.c index 93ee284..58e067b 100644 --- a/sound/soc/codecs/wm8983.c +++ b/sound/soc/codecs/wm8983.c @@ -481,7 +481,8 @@ static const struct snd_soc_dapm_widget wm8983_dapm_widgets[] = { SND_SOC_DAPM_PGA("OUT4 Out", WM8983_POWER_MANAGEMENT_3, 8, 0, NULL, 0), - SND_SOC_DAPM_MICBIAS("Mic Bias", WM8983_POWER_MANAGEMENT_1, 4, 0), + SND_SOC_DAPM_SUPPLY("Mic Bias", WM8983_POWER_MANAGEMENT_1, 4, 0, + NULL, 0), SND_SOC_DAPM_INPUT("LIN"), SND_SOC_DAPM_INPUT("LIP"), -- cgit v1.1 From 48dd231b0bb3a51f5c13e5b53f4e8d798f8d828e Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 09:47:09 +0200 Subject: ASoC: Convert wm8974 MICBIAS to a supply widget Signed-off-by: Mark Brown --- sound/soc/codecs/wm8974.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index 9352f1e..7bd35b8 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c @@ -226,7 +226,7 @@ SND_SOC_DAPM_MIXER("Input PGA", WM8974_POWER2, 2, 0, wm8974_inpga, SND_SOC_DAPM_MIXER("Boost Mixer", WM8974_POWER2, 4, 0, wm8974_boost_mixer, ARRAY_SIZE(wm8974_boost_mixer)), -SND_SOC_DAPM_MICBIAS("Mic Bias", WM8974_POWER1, 4, 0), +SND_SOC_DAPM_SUPPLY("Mic Bias", WM8974_POWER1, 4, 0, NULL, 0), SND_SOC_DAPM_INPUT("MICN"), SND_SOC_DAPM_INPUT("MICP"), -- cgit v1.1 From 20abf088792b2ae5e1c16159aef7d742722f967c Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 09:46:32 +0200 Subject: ASoC: Convert wm8961 MICBIAS to a supply widget Signed-off-by: Mark Brown --- sound/soc/codecs/wm8961.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 9568c8a..7f2df7b 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -531,7 +531,7 @@ SND_SOC_DAPM_PGA("Right Input", WM8961_PWR_MGMT_1, 4, 0, NULL, 0), SND_SOC_DAPM_ADC("ADCL", "HiFi Capture", WM8961_PWR_MGMT_1, 3, 0), SND_SOC_DAPM_ADC("ADCR", "HiFi Capture", WM8961_PWR_MGMT_1, 2, 0), -SND_SOC_DAPM_MICBIAS("MICBIAS", WM8961_PWR_MGMT_1, 1, 0), +SND_SOC_DAPM_SUPPLY("MICBIAS", WM8961_PWR_MGMT_1, 1, 0, NULL, 0), SND_SOC_DAPM_MUX("DACL Sidetone", SND_SOC_NOPM, 0, 0, &dacl_mux), SND_SOC_DAPM_MUX("DACR Sidetone", SND_SOC_NOPM, 0, 0, &dacr_mux), -- cgit v1.1 From 187774cbe3b67a3ea644cfbf9b57e7695ab37558 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 09:46:17 +0200 Subject: ASoC: Convert wm8960 MICBIAS to a supply widget Signed-off-by: Mark Brown --- sound/soc/codecs/wm8960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 2df253c..6e22f9b 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -265,7 +265,7 @@ SND_SOC_DAPM_INPUT("RINPUT2"), SND_SOC_DAPM_INPUT("LINPUT3"), SND_SOC_DAPM_INPUT("RINPUT3"), -SND_SOC_DAPM_MICBIAS("MICB", WM8960_POWER1, 1, 0), +SND_SOC_DAPM_SUPPLY("MICB", WM8960_POWER1, 1, 0, NULL, 0), SND_SOC_DAPM_MIXER("Left Boost Mixer", WM8960_POWER1, 5, 0, wm8960_lin_boost, ARRAY_SIZE(wm8960_lin_boost)), -- cgit v1.1 From dcd658c56b5d40d010a1540aa475fe49260a4c91 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 09:46:01 +0200 Subject: ASoC: Convert wm8904 MICBIAS to a supply widget Signed-off-by: Mark Brown --- sound/soc/codecs/wm8904.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 9fc8f4c..bf325bb 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c @@ -1196,7 +1196,7 @@ SND_SOC_DAPM_INPUT("IN2R"), SND_SOC_DAPM_INPUT("IN3L"), SND_SOC_DAPM_INPUT("IN3R"), -SND_SOC_DAPM_MICBIAS("MICBIAS", WM8904_MIC_BIAS_CONTROL_0, 0, 0), +SND_SOC_DAPM_SUPPLY("MICBIAS", WM8904_MIC_BIAS_CONTROL_0, 0, 0, NULL, 0), SND_SOC_DAPM_MUX("Left Capture Mux", SND_SOC_NOPM, 0, 0, &lin_mux), SND_SOC_DAPM_MUX("Left Capture Inverting Mux", SND_SOC_NOPM, 0, 0, -- cgit v1.1 From 8a709d92c7e0f2015e12b45af506ac64f4c28dda Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 09:45:42 +0200 Subject: ASoC: Convert wm8900 MICBIAS to a supply widget Signed-off-by: Mark Brown --- sound/soc/codecs/wm8900.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index 3d0dc15..17a12c2 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c @@ -513,7 +513,7 @@ SND_SOC_DAPM_MIXER("Right Input Mixer", WM8900_REG_POWER2, 4, 0, wm8900_rinmix_controls, ARRAY_SIZE(wm8900_rinmix_controls)), -SND_SOC_DAPM_MICBIAS("Mic Bias", WM8900_REG_POWER1, 4, 0), +SND_SOC_DAPM_SUPPLY("Mic Bias", WM8900_REG_POWER1, 4, 0, NULL, 0), SND_SOC_DAPM_ADC("ADCL", "Left HiFi Capture", WM8900_REG_POWER2, 1, 0), SND_SOC_DAPM_ADC("ADCR", "Right HiFi Capture", WM8900_REG_POWER2, 0, 0), -- cgit v1.1 From 3ff51c859f086036710b375eb70a84f2efda97f9 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 09:44:59 +0200 Subject: ASoC: Convert wm8400 MICBIAS to a supply widget Signed-off-by: Mark Brown --- sound/soc/codecs/wm8400.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index f29bc26..585def1 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c @@ -766,8 +766,8 @@ SND_SOC_DAPM_PGA("ROPGA", WM8400_POWER_MANAGEMENT_3, WM8400_ROPGA_ENA_SHIFT, 0, NULL, 0), /* MICBIAS */ -SND_SOC_DAPM_MICBIAS("MICBIAS", WM8400_POWER_MANAGEMENT_1, - WM8400_MIC1BIAS_ENA_SHIFT, 0), +SND_SOC_DAPM_SUPPLY("MICBIAS", WM8400_POWER_MANAGEMENT_1, + WM8400_MIC1BIAS_ENA_SHIFT, 0, NULL, 0), SND_SOC_DAPM_OUTPUT("LON"), SND_SOC_DAPM_OUTPUT("LOP"), -- cgit v1.1 From 2a761cde31fddfe5e22f29bc5e241d597204e095 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 1 Nov 2011 15:19:23 +0000 Subject: ASoC: Start WM8962 FLL if SYSCLK is enabled Since we have code to automatically manage the start and stop of the FLL based on the SYSCLK widget if SYSCLK is already enabled and the FLL is configured then we need to start it up. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8962.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index f60dfa1..74ed883 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -3394,6 +3394,7 @@ static int wm8962_set_fll(struct snd_soc_codec *codec, int fll_id, int source, unsigned long timeout; int ret; int fll1 = snd_soc_read(codec, WM8962_FLL_CONTROL_1) & WM8962_FLL_ENA; + int sysclk = snd_soc_read(codec, WM8962_CLOCKING2) & WM8962_SYSCLK_ENA; /* Any change? */ if (source == wm8962->fll_src && Fref == wm8962->fll_fref && @@ -3454,6 +3455,9 @@ static int wm8962_set_fll(struct snd_soc_codec *codec, int fll_id, int source, try_wait_for_completion(&wm8962->fll_lock); + if (sysclk) + fll1 |= WM8962_FLL_ENA; + snd_soc_update_bits(codec, WM8962_FLL_CONTROL_1, WM8962_FLL_FRAC | WM8962_FLL_REFCLK_SRC_MASK | WM8962_FLL_ENA, fll1); -- cgit v1.1 From db0e55438c39c5afa6b7674f5cef86b200bd89ba Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 1 Nov 2011 15:59:03 +0000 Subject: ASoC: Enable SYSCLK last when enabling WM8962 mic detection Ensure everything is set up before we start detecting. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8962.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 74ed883..430bf53 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -3661,6 +3661,9 @@ int wm8962_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) snd_soc_jack_report(wm8962->jack, 0, SND_JACK_MICROPHONE | SND_JACK_BTN_0); + if (jack) + snd_soc_dapm_force_enable_pin(&codec->dapm, "SYSCLK"); + return 0; } EXPORT_SYMBOL_GPL(wm8962_mic_detect); -- cgit v1.1 From a5ef9884088de4ed87ee9490923f277e805b38b2 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 1 Nov 2011 16:00:15 +0000 Subject: ASoC: WM8962 accessory detection requires MICBIAS Force MICBIAS on as well as SYSCLK as the WM8962 accessory detection can't function without both. No point in making machine drivers manually enable it. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8962.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 430bf53..b9c64a8 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -3661,8 +3661,10 @@ int wm8962_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) snd_soc_jack_report(wm8962->jack, 0, SND_JACK_MICROPHONE | SND_JACK_BTN_0); - if (jack) + if (jack) { snd_soc_dapm_force_enable_pin(&codec->dapm, "SYSCLK"); + snd_soc_dapm_force_enable_pin(&codec->dapm, "MICBIAS"); + } return 0; } -- cgit v1.1 From 00ae3b8691e6486895d92de05d7d1d3a70bb5077 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 1 Nov 2011 16:02:01 +0000 Subject: ASoC: Disable MICBIAS and SYSCLK when stopping WM8962 accessory detection They aren't needed any more. If machines need them for other purposes then further changes will be required. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8962.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index b9c64a8..cf7df9e 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -3664,6 +3664,9 @@ int wm8962_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) if (jack) { snd_soc_dapm_force_enable_pin(&codec->dapm, "SYSCLK"); snd_soc_dapm_force_enable_pin(&codec->dapm, "MICBIAS"); + } else { + snd_soc_dapm_disable_pin(&codec->dapm, "SYSCLK"); + snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS"); } return 0; -- cgit v1.1 From 8aafc43556cadc24dd9cf8563c66ab68c8d05748 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 2 Nov 2011 13:05:17 +0000 Subject: ASoC: Sort LM4857 with the CODECs in the Makefile Having a separate list for amps is a little confusing now the official driver model for them is the same as for other CODECs so let's sort them into the CODEC list, but only do this for those that are actual CODEC drivers so it's easier to remember which ones need updating. Signed-off-by: Mark Brown --- sound/soc/codecs/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index a2c7842..d7a5ff3 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -22,6 +22,7 @@ snd-soc-da7210-objs := da7210.o snd-soc-dfbmcs320-objs := dfbmcs320.o snd-soc-dmic-objs := dmic.o snd-soc-l3-objs := l3.o +snd-soc-lm4857-objs := lm4857.o snd-soc-max98088-objs := max98088.o snd-soc-max98095-objs := max98095.o snd-soc-max9850-objs := max9850.o @@ -91,7 +92,6 @@ snd-soc-wm-hubs-objs := wm_hubs.o snd-soc-jz4740-codec-objs := jz4740.o # Amp -snd-soc-lm4857-objs := lm4857.o snd-soc-max9877-objs := max9877.o snd-soc-tpa6130a2-objs := tpa6130a2.o snd-soc-wm2000-objs := wm2000.o @@ -122,6 +122,7 @@ obj-$(CONFIG_SND_SOC_DA7210) += snd-soc-da7210.o obj-$(CONFIG_SND_SOC_DFBMCS320) += snd-soc-dfbmcs320.o obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o +obj-$(CONFIG_SND_SOC_LM4857) += snd-soc-lm4857.o obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o obj-$(CONFIG_SND_SOC_MAX98095) += snd-soc-max98095.o @@ -190,7 +191,6 @@ obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o # Amp -obj-$(CONFIG_SND_SOC_LM4857) += snd-soc-lm4857.o obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o obj-$(CONFIG_SND_SOC_TPA6130A2) += snd-soc-tpa6130a2.o obj-$(CONFIG_SND_SOC_WM2000) += snd-soc-wm2000.o -- cgit v1.1 From 98dd932b6a02b3eea2d6c671b48b2d5d7deb5afe Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 2 Nov 2011 13:28:23 +0000 Subject: ASoC: Fix sort of jz4740 in Makefile Signed-off-by: Mark Brown --- sound/soc/codecs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index d7a5ff3..a7c415d 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -21,6 +21,7 @@ snd-soc-cx20442-objs := cx20442.o snd-soc-da7210-objs := da7210.o snd-soc-dfbmcs320-objs := dfbmcs320.o snd-soc-dmic-objs := dmic.o +snd-soc-jz4740-codec-objs := jz4740.o snd-soc-l3-objs := l3.o snd-soc-lm4857-objs := lm4857.o snd-soc-max98088-objs := max98088.o @@ -89,7 +90,6 @@ snd-soc-wm9705-objs := wm9705.o snd-soc-wm9712-objs := wm9712.o snd-soc-wm9713-objs := wm9713.o snd-soc-wm-hubs-objs := wm_hubs.o -snd-soc-jz4740-codec-objs := jz4740.o # Amp snd-soc-max9877-objs := max9877.o -- cgit v1.1 From 5b6247abc90a94a38c7e7314191871792645aa6a Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 12:11:26 +0200 Subject: ASoC: Remove needless unlikely() There's no point in adding unlikely() annotations outside of hot paths and on systems using these features the annotation will always be wrong (as opposed to being something that only comes up once in a while) so the annotation may even be harmful. Signed-off-by: Mark Brown --- sound/soc/soc-pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 52a7259..49aa71e 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -319,8 +319,8 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) cpu_dai->runtime = NULL; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - if (unlikely(codec->ignore_pmdown_time || - rtd->dai_link->ignore_pmdown_time)) { + if (codec->ignore_pmdown_time || + rtd->dai_link->ignore_pmdown_time) { /* powered down playback stream now */ snd_soc_dapm_stream_event(rtd, codec_dai->driver->playback.stream_name, -- cgit v1.1 From a04e0c868058b6df7cb5b9a92b469ff72288bbc7 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 4 Nov 2011 22:13:36 +0000 Subject: ASoC: Only enable thermal shutdown when required on WM9081 The WM9081 thermal shutdown is only effective when the speaker output is enabled so disable it when that is not in use for a small current saving. Signed-off-by: Mark Brown --- sound/soc/codecs/wm9081.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 3cd35a0..7563a91 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c @@ -737,6 +737,7 @@ SND_SOC_DAPM_SUPPLY("CLK_SYS", WM9081_CLOCK_CONTROL_3, 0, 0, clk_sys_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), SND_SOC_DAPM_SUPPLY("CLK_DSP", WM9081_CLOCK_CONTROL_3, 1, 0, NULL, 0), SND_SOC_DAPM_SUPPLY("TOCLK", WM9081_CLOCK_CONTROL_3, 2, 0, NULL, 0), +SND_SOC_DAPM_SUPPLY("TSENSE", WM9081_POWER_MANAGEMENT, 7, 0, NULL, 0), }; @@ -759,6 +760,7 @@ static const struct snd_soc_dapm_route wm9081_audio_paths[] = { { "Speaker PGA", NULL, "CLK_SYS" }, { "Speaker", NULL, "Speaker PGA" }, + { "Speaker", NULL, "TSENSE" }, { "SPKN", NULL, "Speaker" }, { "SPKP", NULL, "Speaker" }, -- cgit v1.1 From 94b88e647c795b2ba5add6d43dc7a454c6d02356 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 4 Nov 2011 17:48:28 +0000 Subject: ASoC: Manage thermal shutdown for WM8962 Disable the thermal shutdown circuits for headphone and speaker when the relevant outputs are not enabled in order to save current in idle modes. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8962.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index cf7df9e..c9ba826 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -2679,6 +2679,8 @@ SND_SOC_DAPM_SUPPLY("TOCLK", WM8962_ADDITIONAL_CONTROL_1, 0, 0, NULL, 0), SND_SOC_DAPM_SUPPLY_S("DSP2", 1, WM8962_DSP2_POWER_MANAGEMENT, WM8962_DSP2_ENA_SHIFT, 0, dsp2_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), +SND_SOC_DAPM_SUPPLY("TEMP_HP", WM8962_ADDITIONAL_CONTROL_4, 2, 0, NULL, 0), +SND_SOC_DAPM_SUPPLY("TEMP_SPK", WM8962_ADDITIONAL_CONTROL_4, 1, 0, NULL, 0), SND_SOC_DAPM_MIXER("INPGAL", WM8962_LEFT_INPUT_PGA_CONTROL, 4, 0, inpgal, ARRAY_SIZE(inpgal)), @@ -2834,6 +2836,9 @@ static const struct snd_soc_dapm_route wm8962_intercon[] = { { "HPOUTL", NULL, "HPOUT" }, { "HPOUTR", NULL, "HPOUT" }, + + { "HPOUTL", NULL, "TEMP_HP" }, + { "HPOUTR", NULL, "TEMP_HP" }, }; static const struct snd_soc_dapm_route wm8962_spk_mono_intercon[] = { @@ -2850,6 +2855,7 @@ static const struct snd_soc_dapm_route wm8962_spk_mono_intercon[] = { { "Speaker Output", NULL, "Speaker PGA" }, { "Speaker Output", NULL, "SYSCLK" }, { "Speaker Output", NULL, "TOCLK" }, + { "Speaker Output", NULL, "TEMP_SPK" }, { "SPKOUT", NULL, "Speaker Output" }, }; @@ -2878,10 +2884,12 @@ static const struct snd_soc_dapm_route wm8962_spk_stereo_intercon[] = { { "SPKOUTL Output", NULL, "SPKOUTL PGA" }, { "SPKOUTL Output", NULL, "SYSCLK" }, { "SPKOUTL Output", NULL, "TOCLK" }, + { "SPKOUTL Output", NULL, "TEMP_SPK" }, { "SPKOUTR Output", NULL, "SPKOUTR PGA" }, { "SPKOUTR Output", NULL, "SYSCLK" }, { "SPKOUTR Output", NULL, "TOCLK" }, + { "SPKOUTR Output", NULL, "TEMP_SPK" }, { "SPKOUTL", NULL, "SPKOUTL Output" }, { "SPKOUTR", NULL, "SPKOUTR Output" }, -- cgit v1.1 From 03431972ac16bbfcbfb831bb37c419f8f71bf16d Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 4 Nov 2011 17:11:54 +0000 Subject: ASoC: Disable thermal shutdown when not using speakers in wm_hubs The thermal shutdown support in wm_hubs devices is tied to the speaker drivers (which are the only high power subsystems within the device). Ensure minimal current usage when the thermal shutdown support is not required by disabling the circuit when the speaker drivers are powered down. Signed-off-by: Mark Brown --- sound/soc/codecs/wm_hubs.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 84f33d4..f98170e 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c @@ -654,6 +654,7 @@ SND_SOC_DAPM_MIXER("SPKL Boost", SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_MIXER("SPKR Boost", SND_SOC_NOPM, 0, 0, right_speaker_boost, ARRAY_SIZE(right_speaker_boost)), +SND_SOC_DAPM_SUPPLY("TSHUT", WM8993_POWER_MANAGEMENT_2, 14, 0, NULL, 0), SND_SOC_DAPM_PGA("SPKL Driver", WM8993_POWER_MANAGEMENT_1, 12, 0, NULL, 0), SND_SOC_DAPM_PGA("SPKR Driver", WM8993_POWER_MANAGEMENT_1, 13, 0, @@ -789,10 +790,12 @@ static const struct snd_soc_dapm_route analogue_routes[] = { { "SPKL Driver", NULL, "VMID" }, { "SPKL Driver", NULL, "SPKL Boost" }, { "SPKL Driver", NULL, "CLK_SYS" }, + { "SPKL Driver", NULL, "TSHUT" }, { "SPKR Driver", NULL, "VMID" }, { "SPKR Driver", NULL, "SPKR Boost" }, { "SPKR Driver", NULL, "CLK_SYS" }, + { "SPKR Driver", NULL, "TSHUT" }, { "SPKOUTLP", NULL, "SPKL Driver" }, { "SPKOUTLN", NULL, "SPKL Driver" }, -- cgit v1.1 From ea4e7af1221237e7173ede198a817097d99e084b Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 7 Nov 2011 12:23:55 +0100 Subject: ALSA: hda/realtek - Convert alc262 model=tyan to a fixup-list Use the auto-parser for ALC262 model=tyan with a pin-config fix-up and drop the static configuration. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc262_quirks.c | 59 ------------------------------------------- sound/pci/hda/patch_realtek.c | 21 ++++++++++----- 2 files changed, 15 insertions(+), 65 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c index 7894b2b..e53f490 100644 --- a/sound/pci/hda/alc262_quirks.c +++ b/sound/pci/hda/alc262_quirks.c @@ -17,7 +17,6 @@ enum { ALC262_NEC, ALC262_TOSHIBA_S06, ALC262_TOSHIBA_RX1, - ALC262_TYAN, ALC262_MODEL_LAST /* last tag */ }; @@ -177,48 +176,6 @@ static const struct snd_kcontrol_new alc262_benq_t31_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc262_tyan_mixer[] = { - HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), - HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), - { } /* end */ -}; - -static const struct hda_verb alc262_tyan_verbs[] = { - /* Headphone automute */ - {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - - /* P11 AUX_IN, white 4-pin connector */ - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, - {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, - {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, - {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, - - {} -}; - -/* unsolicited event for HP jack sensing */ -static void alc262_tyan_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x1b; - spec->autocfg.speaker_pins[0] = 0x15; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - - #define alc262_capture_mixer alc882_capture_mixer #define alc262_capture_alt_mixer alc882_capture_alt_mixer @@ -686,7 +643,6 @@ static const char * const alc262_models[ALC262_MODEL_LAST] = { [ALC262_ULTRA] = "ultra", [ALC262_LENOVO_3000] = "lenovo-3000", [ALC262_NEC] = "nec", - [ALC262_TYAN] = "tyan", [ALC262_AUTO] = "auto", }; @@ -698,7 +654,6 @@ static const struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), - SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", ALC262_ULTRA), SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), @@ -857,19 +812,5 @@ static const struct alc_config_preset alc262_presets[] = { .setup = alc262_hippo_setup, .init_hook = alc_inithook, }, - [ALC262_TYAN] = { - .mixers = { alc262_tyan_mixer }, - .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, - .num_dacs = ARRAY_SIZE(alc262_dac_nids), - .dac_nids = alc262_dac_nids, - .hp_nid = 0x02, - .dig_out_nid = ALC262_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc262_modes), - .channel_mode = alc262_modes, - .input_mux = &alc262_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc262_tyan_setup, - .init_hook = alc_hp_automute, - }, }; diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 308bb57..013a760 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4339,12 +4339,13 @@ static int alc262_parse_auto_config(struct hda_codec *codec) * Pin config fixes */ enum { - PINFIX_FSC_H270, - PINFIX_HP_Z200, + ALC262_FIXUP_FSC_H270, + ALC262_FIXUP_HP_Z200, + ALC262_FIXUP_TYAN, }; static const struct alc_fixup alc262_fixups[] = { - [PINFIX_FSC_H270] = { + [ALC262_FIXUP_FSC_H270] = { .type = ALC_FIXUP_PINS, .v.pins = (const struct alc_pincfg[]) { { 0x14, 0x99130110 }, /* speaker */ @@ -4353,18 +4354,26 @@ static const struct alc_fixup alc262_fixups[] = { { } } }, - [PINFIX_HP_Z200] = { + [ALC262_FIXUP_HP_Z200] = { .type = ALC_FIXUP_PINS, .v.pins = (const struct alc_pincfg[]) { { 0x16, 0x99130120 }, /* internal speaker */ { } } }, + [ALC262_FIXUP_TYAN] = { + .type = ALC_FIXUP_PINS, + .v.pins = (const struct alc_pincfg[]) { + { 0x14, 0x1993e1f0 }, /* int AUX */ + { } + } + }, }; static const struct snd_pci_quirk alc262_fixup_tbl[] = { - SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", PINFIX_HP_Z200), - SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), + SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200), + SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN), + SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270), {} }; -- cgit v1.1 From 12837c983dc5ec56155b1e95a6fa9a74e4da381f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 7 Nov 2011 12:45:24 +0100 Subject: ALSA: hda/realtek - Convert ALC262 model=toshiba-rx1 to a fixup-list Use the auto-parser for ALC262 model=toshiba-rx1 with the fixed pin- configs. The BIOS table seems incorrect, so many pin entries are overwritten to match with the former quirk. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc262_quirks.c | 46 ------------------------------------------- sound/pci/hda/patch_realtek.c | 13 ++++++++++++ 2 files changed, 13 insertions(+), 46 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c index e53f490..ff7dc7e 100644 --- a/sound/pci/hda/alc262_quirks.c +++ b/sound/pci/hda/alc262_quirks.c @@ -16,7 +16,6 @@ enum { ALC262_LENOVO_3000, ALC262_NEC, ALC262_TOSHIBA_S06, - ALC262_TOSHIBA_RX1, ALC262_MODEL_LAST /* last tag */ }; @@ -465,18 +464,6 @@ static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { - HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), - ALC262_HIPPO_MASTER_SWITCH, - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), - { } /* end */ -}; - /* additional init verbs for Benq laptops */ static const struct hda_verb alc262_EAPD_verbs[] = { {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, @@ -611,23 +598,6 @@ static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { { } /* end */ }; -static const struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { - - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, - - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ - {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ - {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, - {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, - - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, - {} -}; - /* * configuration and preset */ @@ -639,7 +609,6 @@ static const char * const alc262_models[ALC262_MODEL_LAST] = { [ALC262_BENQ_ED8] = "benq", [ALC262_BENQ_T31] = "benq-t31", [ALC262_TOSHIBA_S06] = "toshiba-s06", - [ALC262_TOSHIBA_RX1] = "toshiba-rx1", [ALC262_ULTRA] = "ultra", [ALC262_LENOVO_3000] = "lenovo-3000", [ALC262_NEC] = "nec", @@ -649,8 +618,6 @@ static const char * const alc262_models[ALC262_MODEL_LAST] = { static const struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), - SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", - ALC262_TOSHIBA_RX1), SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), @@ -799,18 +766,5 @@ static const struct alc_config_preset alc262_presets[] = { .setup = alc262_toshiba_s06_setup, .init_hook = alc_inithook, }, - [ALC262_TOSHIBA_RX1] = { - .mixers = { alc262_toshiba_rx1_mixer }, - .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, - .num_dacs = ARRAY_SIZE(alc262_dac_nids), - .dac_nids = alc262_dac_nids, - .hp_nid = 0x03, - .num_channel_mode = ARRAY_SIZE(alc262_modes), - .channel_mode = alc262_modes, - .input_mux = &alc262_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc262_hippo_setup, - .init_hook = alc_inithook, - }, }; diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 013a760..6f344c9 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4342,6 +4342,7 @@ enum { ALC262_FIXUP_FSC_H270, ALC262_FIXUP_HP_Z200, ALC262_FIXUP_TYAN, + ALC262_FIXUP_TOSHIBA_RX1, }; static const struct alc_fixup alc262_fixups[] = { @@ -4368,11 +4369,23 @@ static const struct alc_fixup alc262_fixups[] = { { } } }, + [ALC262_FIXUP_TOSHIBA_RX1] = { + .type = ALC_FIXUP_PINS, + .v.pins = (const struct alc_pincfg[]) { + { 0x14, 0x90170110 }, /* speaker */ + { 0x15, 0x0421101f }, /* HP */ + { 0x1a, 0x40f000f0 }, /* N/A */ + { 0x1b, 0x40f000f0 }, /* N/A */ + { 0x1e, 0x40f000f0 }, /* N/A */ + } + }, }; static const struct snd_pci_quirk alc262_fixup_tbl[] = { SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200), SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN), + SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", + ALC262_FIXUP_TOSHIBA_RX1), SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270), {} }; -- cgit v1.1 From ee0eb25119c2c948b5d30da1a62f6d44020cb636 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 7 Nov 2011 12:50:01 +0100 Subject: ALSA: hda/realtek - Drop ALC262 model=toshiba-s06 This laptop works fine with the current auto-parser and the BIOS setup, so let's drop the static configuration. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc262_quirks.c | 52 ------------------------------------------- 1 file changed, 52 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c index ff7dc7e..ace9d48 100644 --- a/sound/pci/hda/alc262_quirks.c +++ b/sound/pci/hda/alc262_quirks.c @@ -15,7 +15,6 @@ enum { ALC262_ULTRA, ALC262_LENOVO_3000, ALC262_NEC, - ALC262_TOSHIBA_S06, ALC262_MODEL_LAST /* last tag */ }; @@ -283,39 +282,6 @@ static const struct hda_verb alc262_sony_unsol_verbs[] = { {} }; -static const struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { - HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - { } /* end */ -}; - -static const struct hda_verb alc262_toshiba_s06_verbs[] = { - {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, - {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT}, - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, - {} -}; - -static void alc262_toshiba_s06_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x15; - spec->autocfg.speaker_pins[0] = 0x14; - spec->ext_mic_pin = 0x18; - spec->int_mic_pin = 0x12; - spec->auto_mic = 1; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_PIN); -} - /* * nec model * 0x15 = headphone @@ -608,7 +574,6 @@ static const char * const alc262_models[ALC262_MODEL_LAST] = { [ALC262_FUJITSU] = "fujitsu", [ALC262_BENQ_ED8] = "benq", [ALC262_BENQ_T31] = "benq-t31", - [ALC262_TOSHIBA_S06] = "toshiba-s06", [ALC262_ULTRA] = "ultra", [ALC262_LENOVO_3000] = "lenovo-3000", [ALC262_NEC] = "nec", @@ -618,7 +583,6 @@ static const char * const alc262_models[ALC262_MODEL_LAST] = { static const struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), - SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", @@ -750,21 +714,5 @@ static const struct alc_config_preset alc262_presets[] = { .channel_mode = alc262_modes, .input_mux = &alc262_capture_source, }, - [ALC262_TOSHIBA_S06] = { - .mixers = { alc262_toshiba_s06_mixer }, - .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, - alc262_eapd_verbs }, - .num_dacs = ARRAY_SIZE(alc262_dac_nids), - .capsrc_nids = alc262_dmic_capsrc_nids, - .dac_nids = alc262_dac_nids, - .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ - .num_adc_nids = 1, /* single ADC */ - .dig_out_nid = ALC262_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc262_modes), - .channel_mode = alc262_modes, - .unsol_event = alc_sku_unsol_event, - .setup = alc262_toshiba_s06_setup, - .init_hook = alc_inithook, - }, }; -- cgit v1.1 From 80f6b7736615cc7b09fa2a50f40b9773d0f15c6a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 7 Nov 2011 12:57:16 +0100 Subject: ALSA: hda/realtek - Drop ALC262 model=nec quirk This laptop works also fine with the auto-parser and the BIOS setup. A good boy. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc262_quirks.c | 48 ------------------------------------------- 1 file changed, 48 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c index ace9d48..3dc843e 100644 --- a/sound/pci/hda/alc262_quirks.c +++ b/sound/pci/hda/alc262_quirks.c @@ -14,7 +14,6 @@ enum { ALC262_BENQ_T31, ALC262_ULTRA, ALC262_LENOVO_3000, - ALC262_NEC, ALC262_MODEL_LAST /* last tag */ }; @@ -283,41 +282,6 @@ static const struct hda_verb alc262_sony_unsol_verbs[] = { }; /* - * nec model - * 0x15 = headphone - * 0x16 = internal speaker - * 0x18 = external mic - */ - -static const struct snd_kcontrol_new alc262_nec_mixer[] = { - HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), - - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - - HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), - { } /* end */ -}; - -static const struct hda_verb alc262_nec_verbs[] = { - /* Unmute Speaker */ - {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - - /* Headphone */ - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - - /* External mic to headphone */ - {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - /* External mic to speaker */ - {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - {} -}; - -/* * fujitsu model * 0x14 = headphone/spdif-out, 0x15 = internal speaker, * 0x1b = port replicator headphone out @@ -576,13 +540,11 @@ static const char * const alc262_models[ALC262_MODEL_LAST] = { [ALC262_BENQ_T31] = "benq-t31", [ALC262_ULTRA] = "ultra", [ALC262_LENOVO_3000] = "lenovo-3000", - [ALC262_NEC] = "nec", [ALC262_AUTO] = "auto", }; static const struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), - SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", @@ -704,15 +666,5 @@ static const struct alc_config_preset alc262_presets[] = { .setup = alc262_lenovo_3000_setup, .init_hook = alc_inithook, }, - [ALC262_NEC] = { - .mixers = { alc262_nec_mixer }, - .init_verbs = { alc262_nec_verbs }, - .num_dacs = ARRAY_SIZE(alc262_dac_nids), - .dac_nids = alc262_dac_nids, - .hp_nid = 0x03, - .num_channel_mode = ARRAY_SIZE(alc262_modes), - .channel_mode = alc262_modes, - .input_mux = &alc262_capture_source, - }, }; -- cgit v1.1 From c470150c537b76d9776a5434f6f8448db8188bd3 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 7 Nov 2011 14:20:07 +0100 Subject: ALSA: hda/realtek - Convert ALC262 lenovo-3000 quirks to fixup-list The static quirks for ALC262 Lenovo 3000 can be covered by the auto- parser with a fixup of the mic-pin to VREF50 and the additional COEF verb. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc262_quirks.c | 63 ------------------------------------------- sound/pci/hda/patch_realtek.c | 12 +++++++++ 2 files changed, 12 insertions(+), 63 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c index 3dc843e..dc4d1a1 100644 --- a/sound/pci/hda/alc262_quirks.c +++ b/sound/pci/hda/alc262_quirks.c @@ -13,7 +13,6 @@ enum { ALC262_BENQ_ED8, ALC262_BENQ_T31, ALC262_ULTRA, - ALC262_LENOVO_3000, ALC262_MODEL_LAST /* last tag */ }; @@ -295,19 +294,6 @@ static const struct hda_verb alc262_fujitsu_unsol_verbs[] = { {} }; -static const struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { - {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {} -}; - -static const struct hda_verb alc262_lenovo_3000_init_verbs[] = { - /* Front Mic pin: input vref at 50% */ - {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, - {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {} -}; - static const struct hda_input_mux alc262_fujitsu_capture_source = { .num_items = 3, .items = { @@ -363,37 +349,6 @@ static const struct snd_kcontrol_new alc262_fujitsu_mixer[] = { { } /* end */ }; -static void alc262_lenovo_3000_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x1b; - spec->autocfg.speaker_pins[0] = 0x14; - spec->autocfg.speaker_pins[1] = 0x16; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { - HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Master Playback Switch", - .subdevice = HDA_SUBDEV_NID_FLAG | 0x1b, - .info = snd_ctl_boolean_mono_info, - .get = alc262_hp_master_sw_get, - .put = alc262_hp_master_sw_put, - }, - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - /* additional init verbs for Benq laptops */ static const struct hda_verb alc262_EAPD_verbs[] = { {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, @@ -539,7 +494,6 @@ static const char * const alc262_models[ALC262_MODEL_LAST] = { [ALC262_BENQ_ED8] = "benq", [ALC262_BENQ_T31] = "benq-t31", [ALC262_ULTRA] = "ultra", - [ALC262_LENOVO_3000] = "lenovo-3000", [ALC262_AUTO] = "auto", }; @@ -550,7 +504,6 @@ static const struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", ALC262_ULTRA), SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), - SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), @@ -650,21 +603,5 @@ static const struct alc_config_preset alc262_presets[] = { .unsol_event = alc262_ultra_unsol_event, .init_hook = alc262_ultra_automute, }, - [ALC262_LENOVO_3000] = { - .mixers = { alc262_lenovo_3000_mixer }, - .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, - alc262_lenovo_3000_unsol_verbs, - alc262_lenovo_3000_init_verbs }, - .num_dacs = ARRAY_SIZE(alc262_dac_nids), - .dac_nids = alc262_dac_nids, - .hp_nid = 0x03, - .dig_out_nid = ALC262_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc262_modes), - .channel_mode = alc262_modes, - .input_mux = &alc262_fujitsu_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc262_lenovo_3000_setup, - .init_hook = alc_inithook, - }, }; diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6f344c9..ee267be 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4343,6 +4343,7 @@ enum { ALC262_FIXUP_HP_Z200, ALC262_FIXUP_TYAN, ALC262_FIXUP_TOSHIBA_RX1, + ALC262_FIXUP_LENOVO_3000, }; static const struct alc_fixup alc262_fixups[] = { @@ -4379,6 +4380,16 @@ static const struct alc_fixup alc262_fixups[] = { { 0x1e, 0x40f000f0 }, /* N/A */ } }, + [ALC262_FIXUP_LENOVO_3000] = { + .type = ALC_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { + { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, + { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, + {} + } + }, + }; static const struct snd_pci_quirk alc262_fixup_tbl[] = { @@ -4387,6 +4398,7 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = { SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", ALC262_FIXUP_TOSHIBA_RX1), SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270), + SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000), {} }; -- cgit v1.1 From b42590b865cb4358a0c37b2128e303a18d897bf6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 7 Nov 2011 14:41:01 +0100 Subject: ALSA: hda/realtek - Convert ALC262 benq and benq-t31 to fixup-lists The conversion from ALC262 model=benq and model=benq-t31 static configs to auto-parser requires the manual COEF setups for corresponding models. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc262_quirks.c | 50 ------------------------------------------- sound/pci/hda/patch_realtek.c | 21 +++++++++++++++++- 2 files changed, 20 insertions(+), 51 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c index dc4d1a1..bf573bd 100644 --- a/sound/pci/hda/alc262_quirks.c +++ b/sound/pci/hda/alc262_quirks.c @@ -10,8 +10,6 @@ enum { ALC262_HIPPO, ALC262_HIPPO_1, ALC262_FUJITSU, - ALC262_BENQ_ED8, - ALC262_BENQ_T31, ALC262_ULTRA, ALC262_MODEL_LAST /* last tag */ }; @@ -161,17 +159,6 @@ static const struct snd_kcontrol_new alc262_sony_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc262_benq_t31_mixer[] = { - HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - ALC262_HIPPO_MASTER_SWITCH, - HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), - { } /* end */ -}; - #define alc262_capture_mixer alc882_capture_mixer #define alc262_capture_alt_mixer alc882_capture_alt_mixer @@ -356,15 +343,6 @@ static const struct hda_verb alc262_EAPD_verbs[] = { {} }; -static const struct hda_verb alc262_benq_t31_EAPD_verbs[] = { - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, - - {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, - {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, - {} -}; - /* Samsung Q1 Ultra Vista model setup */ static const struct snd_kcontrol_new alc262_ultra_mixer[] = { HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), @@ -491,8 +469,6 @@ static const char * const alc262_models[ALC262_MODEL_LAST] = { [ALC262_HIPPO] = "hippo", [ALC262_HIPPO_1] = "hippo_1", [ALC262_FUJITSU] = "fujitsu", - [ALC262_BENQ_ED8] = "benq", - [ALC262_BENQ_T31] = "benq-t31", [ALC262_ULTRA] = "ultra", [ALC262_AUTO] = "auto", }; @@ -504,8 +480,6 @@ static const struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", ALC262_ULTRA), SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), - SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), - SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), {} }; @@ -564,30 +538,6 @@ static const struct alc_config_preset alc262_presets[] = { .setup = alc262_fujitsu_setup, .init_hook = alc_inithook, }, - [ALC262_BENQ_ED8] = { - .mixers = { alc262_base_mixer }, - .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, - .num_dacs = ARRAY_SIZE(alc262_dac_nids), - .dac_nids = alc262_dac_nids, - .hp_nid = 0x03, - .num_channel_mode = ARRAY_SIZE(alc262_modes), - .channel_mode = alc262_modes, - .input_mux = &alc262_capture_source, - }, - [ALC262_BENQ_T31] = { - .mixers = { alc262_benq_t31_mixer }, - .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, - alc_hp15_unsol_verbs }, - .num_dacs = ARRAY_SIZE(alc262_dac_nids), - .dac_nids = alc262_dac_nids, - .hp_nid = 0x03, - .num_channel_mode = ARRAY_SIZE(alc262_modes), - .channel_mode = alc262_modes, - .input_mux = &alc262_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc262_hippo_setup, - .init_hook = alc_inithook, - }, [ALC262_ULTRA] = { .mixers = { alc262_ultra_mixer }, .cap_mixer = alc262_ultra_capture_mixer, diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ee267be..55bdb73 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4344,6 +4344,8 @@ enum { ALC262_FIXUP_TYAN, ALC262_FIXUP_TOSHIBA_RX1, ALC262_FIXUP_LENOVO_3000, + ALC262_FIXUP_BENQ, + ALC262_FIXUP_BENQ_T31, }; static const struct alc_fixup alc262_fixups[] = { @@ -4384,12 +4386,27 @@ static const struct alc_fixup alc262_fixups[] = { .type = ALC_FIXUP_VERBS, .v.verbs = (const struct hda_verb[]) { { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, + {} + }, + .chained = true, + .chain_id = ALC262_FIXUP_BENQ, + }, + [ALC262_FIXUP_BENQ] = { + .type = ALC_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, {} } }, - + [ALC262_FIXUP_BENQ_T31] = { + .type = ALC_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { + { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, + {} + } + }, }; static const struct snd_pci_quirk alc262_fixup_tbl[] = { @@ -4399,6 +4416,8 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = { ALC262_FIXUP_TOSHIBA_RX1), SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270), SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000), + SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ), + SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31), {} }; -- cgit v1.1 From 3dcd3be33046c9828a6057ee0f14de6e5d3b48a2 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 7 Nov 2011 14:59:40 +0100 Subject: ALSA: hda/realtek - Convert ALC262 model=fujitsu to auto-parser It works well with the auto-parse and the default BIOS setup when an additional COEF setup (for benq) is used. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc262_quirks.c | 95 ------------------------------------------- sound/pci/hda/patch_realtek.c | 2 + 2 files changed, 2 insertions(+), 95 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c index bf573bd..ae10d00 100644 --- a/sound/pci/hda/alc262_quirks.c +++ b/sound/pci/hda/alc262_quirks.c @@ -9,7 +9,6 @@ enum { ALC262_BASIC, ALC262_HIPPO, ALC262_HIPPO_1, - ALC262_FUJITSU, ALC262_ULTRA, ALC262_MODEL_LAST /* last tag */ }; @@ -267,82 +266,6 @@ static const struct hda_verb alc262_sony_unsol_verbs[] = { {} }; -/* - * fujitsu model - * 0x14 = headphone/spdif-out, 0x15 = internal speaker, - * 0x1b = port replicator headphone out - */ - -static const struct hda_verb alc262_fujitsu_unsol_verbs[] = { - {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {} -}; - -static const struct hda_input_mux alc262_fujitsu_capture_source = { - .num_items = 3, - .items = { - { "Mic", 0x0 }, - { "Internal Mic", 0x1 }, - { "CD", 0x4 }, - }, -}; - -static void alc262_fujitsu_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x14; - spec->autocfg.hp_pins[1] = 0x1b; - spec->autocfg.speaker_pins[0] = 0x15; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -/* bind volumes of both NID 0x0c and 0x0d */ -static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { - .ops = &snd_hda_bind_vol, - .values = { - HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), - HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), - 0 - }, -}; - -static const struct snd_kcontrol_new alc262_fujitsu_mixer[] = { - HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Master Playback Switch", - .subdevice = HDA_SUBDEV_NID_FLAG | 0x14, - .info = snd_ctl_boolean_mono_info, - .get = alc262_hp_master_sw_get, - .put = alc262_hp_master_sw_put, - }, - { - .iface = NID_MAPPING, - .name = "Master Playback Switch", - .private_value = 0x1b, - }, - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - -/* additional init verbs for Benq laptops */ -static const struct hda_verb alc262_EAPD_verbs[] = { - {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, - {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, - {} -}; - /* Samsung Q1 Ultra Vista model setup */ static const struct snd_kcontrol_new alc262_ultra_mixer[] = { HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), @@ -468,15 +391,12 @@ static const char * const alc262_models[ALC262_MODEL_LAST] = { [ALC262_BASIC] = "basic", [ALC262_HIPPO] = "hippo", [ALC262_HIPPO_1] = "hippo_1", - [ALC262_FUJITSU] = "fujitsu", [ALC262_ULTRA] = "ultra", [ALC262_AUTO] = "auto", }; static const struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), - SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), - SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", ALC262_ULTRA), SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), @@ -523,21 +443,6 @@ static const struct alc_config_preset alc262_presets[] = { .setup = alc262_hippo1_setup, .init_hook = alc_inithook, }, - [ALC262_FUJITSU] = { - .mixers = { alc262_fujitsu_mixer }, - .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, - alc262_fujitsu_unsol_verbs }, - .num_dacs = ARRAY_SIZE(alc262_dac_nids), - .dac_nids = alc262_dac_nids, - .hp_nid = 0x03, - .dig_out_nid = ALC262_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc262_modes), - .channel_mode = alc262_modes, - .input_mux = &alc262_fujitsu_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc262_fujitsu_setup, - .init_hook = alc_inithook, - }, [ALC262_ULTRA] = { .mixers = { alc262_ultra_mixer }, .cap_mixer = alc262_ultra_capture_mixer, diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 55bdb73..5082070 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4411,6 +4411,8 @@ static const struct alc_fixup alc262_fixups[] = { static const struct snd_pci_quirk alc262_fixup_tbl[] = { SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200), + SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FIXUP_BENQ), + SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ), SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN), SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", ALC262_FIXUP_TOSHIBA_RX1), -- cgit v1.1 From 6fb9c82c47164ac5daa80e9f7979ccfa252ed2b5 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 7 Nov 2011 15:04:23 +0100 Subject: ALSA: hda/realtek - Drop ALC262 model=hippo static quirks This model (actually BenQ Joybook) works fine with the default auto-parser and the BIOS setup. Just drop the static quirks. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc262_quirks.c | 63 ------------------------------------------- 1 file changed, 63 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c index ae10d00..38ff995 100644 --- a/sound/pci/hda/alc262_quirks.c +++ b/sound/pci/hda/alc262_quirks.c @@ -8,7 +8,6 @@ enum { ALC262_AUTO, ALC262_BASIC, ALC262_HIPPO, - ALC262_HIPPO_1, ALC262_ULTRA, ALC262_MODEL_LAST /* last tag */ }; @@ -112,22 +111,6 @@ static const struct snd_kcontrol_new alc262_hippo_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc262_hippo1_mixer[] = { - HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - ALC262_HIPPO_MASTER_SWITCH, - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), - { } /* end */ -}; - /* mute/unmute internal speaker according to the hp jack and mute state */ static void alc262_hippo_setup(struct hda_codec *codec) { @@ -138,16 +121,6 @@ static void alc262_hippo_setup(struct hda_codec *codec) alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); } -static void alc262_hippo1_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x1b; - spec->autocfg.speaker_pins[0] = 0x14; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - - static const struct snd_kcontrol_new alc262_sony_mixer[] = { HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), ALC262_HIPPO_MASTER_SWITCH, @@ -246,26 +219,6 @@ static const struct hda_verb alc262_eapd_verbs[] = { { } }; -static const struct hda_verb alc262_hippo1_unsol_verbs[] = { - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, - {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, - - {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {} -}; - -static const struct hda_verb alc262_sony_unsol_verbs[] = { - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic - - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {} -}; - /* Samsung Q1 Ultra Vista model setup */ static const struct snd_kcontrol_new alc262_ultra_mixer[] = { HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), @@ -390,7 +343,6 @@ static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { static const char * const alc262_models[ALC262_MODEL_LAST] = { [ALC262_BASIC] = "basic", [ALC262_HIPPO] = "hippo", - [ALC262_HIPPO_1] = "hippo_1", [ALC262_ULTRA] = "ultra", [ALC262_AUTO] = "auto", }; @@ -400,7 +352,6 @@ static const struct snd_pci_quirk alc262_cfg_tbl[] = { SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", ALC262_ULTRA), SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), - SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), {} }; @@ -429,20 +380,6 @@ static const struct alc_config_preset alc262_presets[] = { .setup = alc262_hippo_setup, .init_hook = alc_inithook, }, - [ALC262_HIPPO_1] = { - .mixers = { alc262_hippo1_mixer }, - .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, - .num_dacs = ARRAY_SIZE(alc262_dac_nids), - .dac_nids = alc262_dac_nids, - .hp_nid = 0x02, - .dig_out_nid = ALC262_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc262_modes), - .channel_mode = alc262_modes, - .input_mux = &alc262_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc262_hippo1_setup, - .init_hook = alc_inithook, - }, [ALC262_ULTRA] = { .mixers = { alc262_ultra_mixer }, .cap_mixer = alc262_ultra_capture_mixer, -- cgit v1.1 From 46900b5c55ece43b0e6ad7147ffb58e37ff45c82 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 7 Nov 2011 15:18:21 +0100 Subject: ALSA: hda/realtek - Drop ALC262 model=hippo static quirks Both entries for ALC262 model=hippo work well with the auto-parser and the default BIOS setup. No static configs are needed, so drop them. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc262_quirks.c | 104 ------------------------------------------ 1 file changed, 104 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c index 38ff995..fee7202 100644 --- a/sound/pci/hda/alc262_quirks.c +++ b/sound/pci/hda/alc262_quirks.c @@ -7,7 +7,6 @@ enum { ALC262_AUTO, ALC262_BASIC, - ALC262_HIPPO, ALC262_ULTRA, ALC262_MODEL_LAST /* last tag */ }; @@ -51,86 +50,6 @@ static const struct snd_kcontrol_new alc262_base_mixer[] = { { } /* end */ }; -/* bind hp and internal speaker mute (with plug check) as master switch */ - -static int alc262_hippo_master_sw_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct hda_codec *codec = snd_kcontrol_chip(kcontrol); - struct alc_spec *spec = codec->spec; - *ucontrol->value.integer.value = !spec->master_mute; - return 0; -} - -static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct hda_codec *codec = snd_kcontrol_chip(kcontrol); - struct alc_spec *spec = codec->spec; - int val = !*ucontrol->value.integer.value; - - if (val == spec->master_mute) - return 0; - spec->master_mute = val; - update_outputs(codec); - return 1; -} - -#define ALC262_HIPPO_MASTER_SWITCH \ - { \ - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ - .name = "Master Playback Switch", \ - .info = snd_ctl_boolean_mono_info, \ - .get = alc262_hippo_master_sw_get, \ - .put = alc262_hippo_master_sw_put, \ - }, \ - { \ - .iface = NID_MAPPING, \ - .name = "Master Playback Switch", \ - .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ - (SUBDEV_SPEAKER(0) << 16), \ - } - -#define alc262_hp_master_sw_get alc262_hippo_master_sw_get -#define alc262_hp_master_sw_put alc262_hippo_master_sw_put - -static const struct snd_kcontrol_new alc262_hippo_mixer[] = { - ALC262_HIPPO_MASTER_SWITCH, - HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), - { } /* end */ -}; - -/* mute/unmute internal speaker according to the hp jack and mute state */ -static void alc262_hippo_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x15; - spec->autocfg.speaker_pins[0] = 0x14; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -static const struct snd_kcontrol_new alc262_sony_mixer[] = { - HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - ALC262_HIPPO_MASTER_SWITCH, - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), - { } /* end */ -}; - #define alc262_capture_mixer alc882_capture_mixer #define alc262_capture_alt_mixer alc882_capture_alt_mixer @@ -213,12 +132,6 @@ static const struct hda_verb alc262_init_verbs[] = { { } }; -static const struct hda_verb alc262_eapd_verbs[] = { - {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, - {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, - { } -}; - /* Samsung Q1 Ultra Vista model setup */ static const struct snd_kcontrol_new alc262_ultra_mixer[] = { HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), @@ -342,16 +255,13 @@ static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { */ static const char * const alc262_models[ALC262_MODEL_LAST] = { [ALC262_BASIC] = "basic", - [ALC262_HIPPO] = "hippo", [ALC262_ULTRA] = "ultra", [ALC262_AUTO] = "auto", }; static const struct snd_pci_quirk alc262_cfg_tbl[] = { - SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", ALC262_ULTRA), - SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), {} }; @@ -366,20 +276,6 @@ static const struct alc_config_preset alc262_presets[] = { .channel_mode = alc262_modes, .input_mux = &alc262_capture_source, }, - [ALC262_HIPPO] = { - .mixers = { alc262_hippo_mixer }, - .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, - .num_dacs = ARRAY_SIZE(alc262_dac_nids), - .dac_nids = alc262_dac_nids, - .hp_nid = 0x03, - .dig_out_nid = ALC262_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc262_modes), - .channel_mode = alc262_modes, - .input_mux = &alc262_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc262_hippo_setup, - .init_hook = alc_inithook, - }, [ALC262_ULTRA] = { .mixers = { alc262_ultra_mixer }, .cap_mixer = alc262_ultra_capture_mixer, -- cgit v1.1 From 82e14a4754599952f5504c1f696bbc77bdfd6009 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 7 Nov 2011 15:24:17 +0100 Subject: ALSA: hda/realtek - Drop ALC262 model=basic static configs Now most of ALC262 stuff has been moved to the auto-parser, and no longer need for keeping model=basic. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc262_quirks.c | 118 ------------------------------------------ sound/pci/hda/patch_realtek.c | 8 --- 2 files changed, 126 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c index fee7202..813855a 100644 --- a/sound/pci/hda/alc262_quirks.c +++ b/sound/pci/hda/alc262_quirks.c @@ -6,7 +6,6 @@ /* ALC262 models */ enum { ALC262_AUTO, - ALC262_BASIC, ALC262_ULTRA, ALC262_MODEL_LAST /* last tag */ }; @@ -23,115 +22,9 @@ enum { #define alc262_modes alc260_modes #define alc262_capture_source alc882_capture_source -static const hda_nid_t alc262_dmic_adc_nids[1] = { - /* ADC0 */ - 0x09 -}; - -static const hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; - -static const struct snd_kcontrol_new alc262_base_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), - { } /* end */ -}; - #define alc262_capture_mixer alc882_capture_mixer #define alc262_capture_alt_mixer alc882_capture_alt_mixer -/* - * generic initialization of ADC, input mixers and output mixers - */ -static const struct hda_verb alc262_init_verbs[] = { - /* - * Unmute ADC0-2 and set the default input to mic-in - */ - {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - - /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback - * mixer widget - * Note: PASD motherboards uses the Line In 2 as the input for - * front panel mic (mic 2) - */ - /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ - {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, - {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, - {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, - {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, - - /* - * Set up output mixers (0x0c - 0x0e) - */ - /* set vol=0 to output mixers */ - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, - {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, - {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, - /* set up input amps for analog loopback */ - /* Amp Indices: DAC = 0, mixer = 1 */ - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, - {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, - {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, - {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, - - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, - {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, - {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, - {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, - {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, - - {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, - - /* FIXME: use matrix-type input source selection */ - /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ - /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, - /* Input mixer2 */ - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, - /* Input mixer3 */ - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, - - { } -}; - /* Samsung Q1 Ultra Vista model setup */ static const struct snd_kcontrol_new alc262_ultra_mixer[] = { HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), @@ -254,7 +147,6 @@ static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { * configuration and preset */ static const char * const alc262_models[ALC262_MODEL_LAST] = { - [ALC262_BASIC] = "basic", [ALC262_ULTRA] = "ultra", [ALC262_AUTO] = "auto", }; @@ -266,16 +158,6 @@ static const struct snd_pci_quirk alc262_cfg_tbl[] = { }; static const struct alc_config_preset alc262_presets[] = { - [ALC262_BASIC] = { - .mixers = { alc262_base_mixer }, - .init_verbs = { alc262_init_verbs }, - .num_dacs = ARRAY_SIZE(alc262_dac_nids), - .dac_nids = alc262_dac_nids, - .hp_nid = 0x03, - .num_channel_mode = ARRAY_SIZE(alc262_modes), - .channel_mode = alc262_modes, - .input_mux = &alc262_capture_source, - }, [ALC262_ULTRA] = { .mixers = { alc262_ultra_mixer }, .cap_mixer = alc262_ultra_capture_mixer, diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 5082070..1f3d168 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4483,14 +4483,6 @@ static int patch_alc262(struct hda_codec *codec) err = alc262_parse_auto_config(codec); if (err < 0) goto error; -#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS - else if (!err) { - printk(KERN_INFO - "hda_codec: Cannot set up configuration " - "from BIOS. Using base mode...\n"); - board_config = ALC262_BASIC; - } -#endif } if (board_config != ALC_MODEL_AUTO) -- cgit v1.1 From 24de183ed0369d73af89e6752fcc1ecbde59053d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 7 Nov 2011 17:13:39 +0100 Subject: ALSA: hda/realtek - Add the support of shared HP/Mic A machine like Q1-ultra which has only a single HP but no mic-jack, we can re-task the headhpone as an external mic jack. This was done formerly in ALC262 model=ultra quirk, and now the auto-parser supports this mode. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 65 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 1f3d168..ef040ec 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -183,6 +183,7 @@ struct alc_spec { unsigned int single_input_src:1; unsigned int vol_in_capsrc:1; /* use capsrc volume (ADC has no vol) */ unsigned int parse_flags; /* passed to snd_hda_parse_pin_defcfg() */ + unsigned int shared_mic_hp:1; /* HP/Mic-in sharing */ /* auto-mute control */ int automute_mode; @@ -277,6 +278,8 @@ static bool alc_dyn_adc_pcm_resetup(struct hda_codec *codec, int cur) return false; } +static void call_update_outputs(struct hda_codec *codec); + /* select the given imux item; either unmute exclusively or select the route */ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, unsigned int idx, bool force) @@ -298,6 +301,19 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, return 0; spec->cur_mux[adc_idx] = idx; + /* for shared I/O, change the pin-control accordingly */ + if (spec->shared_mic_hp) { + /* NOTE: this assumes that there are only two inputs, the + * first is the real internal mic and the second is HP jack. + */ + snd_hda_codec_write(codec, spec->autocfg.inputs[1].pin, 0, + AC_VERB_SET_PIN_WIDGET_CONTROL, + spec->cur_mux[adc_idx] ? + PIN_VREF80 : PIN_HP); + spec->automute_speaker = !spec->cur_mux[adc_idx]; + call_update_outputs(codec); + } + if (spec->dyn_adc_switch) { alc_dyn_adc_pcm_resetup(codec, idx); adc_idx = spec->dyn_adc_idx[idx]; @@ -547,7 +563,8 @@ static void update_outputs(struct hda_codec *codec) * in general, HP pins/amps control should be enabled in all cases, * but currently set only for master_mute, just to be safe */ - do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), + if (!spec->shared_mic_hp) /* don't change HP-pin when shared with mic */ + do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), spec->autocfg.hp_pins, spec->master_mute, true); if (!spec->automute_speaker) @@ -1115,6 +1132,9 @@ static void alc_init_auto_mic(struct hda_codec *codec) hda_nid_t fixed, ext, dock; int i; + if (spec->shared_mic_hp) + return; /* no auto-mic for the shared I/O */ + spec->ext_mic_idx = spec->int_mic_idx = spec->dock_mic_idx = -1; fixed = ext = dock = 0; @@ -2667,6 +2687,9 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec) int max_nums = ARRAY_SIZE(spec->private_adc_nids); int i, nums = 0; + if (spec->shared_mic_hp) + max_nums = 1; /* no multi streams with the shared HP/mic */ + nid = codec->start_nid; for (i = 0; i < codec->num_nodes; i++, nid++) { hda_nid_t src; @@ -2729,6 +2752,8 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec) continue; label = hda_get_autocfg_input_label(codec, cfg, i); + if (spec->shared_mic_hp && !strcmp(label, "Misc")) + label = "Headphone Mic"; if (prev_label && !strcmp(label, prev_label)) type_idx++; else @@ -2764,6 +2789,39 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec) return 0; } +/* create a shared input with the headphone out */ +static int alc_auto_create_shared_input(struct hda_codec *codec) +{ + struct alc_spec *spec = codec->spec; + struct auto_pin_cfg *cfg = &spec->autocfg; + unsigned int defcfg; + hda_nid_t nid; + + /* only one internal input pin? */ + if (cfg->num_inputs != 1) + return 0; + defcfg = snd_hda_codec_get_pincfg(codec, cfg->inputs[0].pin); + if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT) + return 0; + + if (cfg->hp_outs == 1 && cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) + nid = cfg->hp_pins[0]; /* OK, we have a single HP-out */ + else if (cfg->line_outs == 1 && cfg->line_out_type == AUTO_PIN_HP_OUT) + nid = cfg->line_out_pins[0]; /* OK, we have a single line-out */ + else + return 0; /* both not available */ + + if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_IN)) + return 0; /* no input */ + + cfg->inputs[1].pin = nid; + cfg->inputs[1].type = AUTO_PIN_MIC; + cfg->num_inputs = 2; + spec->shared_mic_hp = 1; + snd_printdd("realtek: Enable shared I/O jack on NID 0x%x\n", nid); + return 0; +} + static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, unsigned int pin_type) { @@ -3654,6 +3712,8 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec) char boost_label[32]; label = hda_get_autocfg_input_label(codec, cfg, i); + if (spec->shared_mic_hp && !strcmp(label, "Misc")) + label = "Headphone Mic"; if (prev_label && !strcmp(label, prev_label)) type_idx++; else @@ -3859,6 +3919,9 @@ static int alc_parse_auto_config(struct hda_codec *codec, err = alc_auto_create_speaker_out(codec); if (err < 0) return err; + err = alc_auto_create_shared_input(codec); + if (err < 0) + return err; err = alc_auto_create_input_ctls(codec); if (err < 0) return err; -- cgit v1.1 From 42399f7a71df817a0aab82dd88dc05521c88385b Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 7 Nov 2011 17:18:44 +0100 Subject: ALSA: hda/realtek - Remove all ALC262-quirk codes Now that model=ultra is supported well by the auto-parser, we can get rid of the whole alc262_quirks.c and its related codes. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc262_quirks.c | 177 ------------------------------------------ sound/pci/hda/patch_realtek.c | 36 ++------- 2 files changed, 7 insertions(+), 206 deletions(-) delete mode 100644 sound/pci/hda/alc262_quirks.c (limited to 'sound') diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c deleted file mode 100644 index 813855a..0000000 --- a/sound/pci/hda/alc262_quirks.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * ALC262 quirk models - * included by patch_realtek.c - */ - -/* ALC262 models */ -enum { - ALC262_AUTO, - ALC262_ULTRA, - ALC262_MODEL_LAST /* last tag */ -}; - -#define ALC262_DIGOUT_NID ALC880_DIGOUT_NID -#define ALC262_DIGIN_NID ALC880_DIGIN_NID - -#define alc262_dac_nids alc260_dac_nids -#define alc262_adc_nids alc882_adc_nids -#define alc262_adc_nids_alt alc882_adc_nids_alt -#define alc262_capsrc_nids alc882_capsrc_nids -#define alc262_capsrc_nids_alt alc882_capsrc_nids_alt - -#define alc262_modes alc260_modes -#define alc262_capture_source alc882_capture_source - -#define alc262_capture_mixer alc882_capture_mixer -#define alc262_capture_alt_mixer alc882_capture_alt_mixer - -/* Samsung Q1 Ultra Vista model setup */ -static const struct snd_kcontrol_new alc262_ultra_mixer[] = { - HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), - { } /* end */ -}; - -static const struct hda_verb alc262_ultra_verbs[] = { - /* output mixer */ - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, - /* speaker */ - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* HP */ - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, - /* internal mic */ - {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, - {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, - /* ADC, choose mic */ - {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, - {} -}; - -/* mute/unmute internal speaker according to the hp jack and mute state */ -static void alc262_ultra_automute(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - unsigned int mute; - - mute = 0; - /* auto-mute only when HP is used as HP */ - if (!spec->cur_mux[0]) { - spec->hp_jack_present = snd_hda_jack_detect(codec, 0x15); - if (spec->hp_jack_present) - mute = HDA_AMP_MUTE; - } - /* mute/unmute internal speaker */ - snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, - HDA_AMP_MUTE, mute); - /* mute/unmute HP */ - snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, - HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); -} - -/* unsolicited event for HP jack sensing */ -static void alc262_ultra_unsol_event(struct hda_codec *codec, - unsigned int res) -{ - if ((res >> 26) != ALC_HP_EVENT) - return; - alc262_ultra_automute(codec); -} - -static const struct hda_input_mux alc262_ultra_capture_source = { - .num_items = 2, - .items = { - { "Mic", 0x1 }, - { "Headphone", 0x7 }, - }, -}; - -static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct hda_codec *codec = snd_kcontrol_chip(kcontrol); - struct alc_spec *spec = codec->spec; - int ret; - - ret = alc_mux_enum_put(kcontrol, ucontrol); - if (!ret) - return 0; - /* reprogram the HP pin as mic or HP according to the input source */ - snd_hda_codec_write_cache(codec, 0x15, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, - spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); - alc262_ultra_automute(codec); /* mute/unmute HP */ - return ret; -} - -static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { - HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Capture Source", - .info = alc_mux_enum_info, - .get = alc_mux_enum_get, - .put = alc262_ultra_mux_enum_put, - }, - { - .iface = NID_MAPPING, - .name = "Capture Source", - .private_value = 0x15, - }, - { } /* end */ -}; - -/* - * configuration and preset - */ -static const char * const alc262_models[ALC262_MODEL_LAST] = { - [ALC262_ULTRA] = "ultra", - [ALC262_AUTO] = "auto", -}; - -static const struct snd_pci_quirk alc262_cfg_tbl[] = { - SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", - ALC262_ULTRA), - {} -}; - -static const struct alc_config_preset alc262_presets[] = { - [ALC262_ULTRA] = { - .mixers = { alc262_ultra_mixer }, - .cap_mixer = alc262_ultra_capture_mixer, - .init_verbs = { alc262_ultra_verbs }, - .num_dacs = ARRAY_SIZE(alc262_dac_nids), - .dac_nids = alc262_dac_nids, - .num_channel_mode = ARRAY_SIZE(alc262_modes), - .channel_mode = alc262_modes, - .input_mux = &alc262_ultra_capture_source, - .adc_nids = alc262_adc_nids, /* ADC0 */ - .capsrc_nids = alc262_capsrc_nids, - .num_adc_nids = 1, /* single ADC */ - .unsol_event = alc262_ultra_unsol_event, - .init_hook = alc262_ultra_automute, - }, -}; - diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ef040ec..afdecd8 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4493,14 +4493,9 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = { /* */ -#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS -#include "alc262_quirks.c" -#endif - static int patch_alc262(struct hda_codec *codec) { struct alc_spec *spec; - int board_config; int err; spec = kzalloc(sizeof(*spec), GFP_KERNEL); @@ -4527,29 +4522,13 @@ static int patch_alc262(struct hda_codec *codec) alc_fix_pll_init(codec, 0x20, 0x0a, 10); - board_config = alc_board_config(codec, ALC262_MODEL_LAST, - alc262_models, alc262_cfg_tbl); - - if (board_config < 0) { - printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", - codec->chip_name); - board_config = ALC_MODEL_AUTO; - } - - if (board_config == ALC_MODEL_AUTO) { - alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); - alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); - } - - if (board_config == ALC_MODEL_AUTO) { - /* automatic parse from the BIOS config */ - err = alc262_parse_auto_config(codec); - if (err < 0) - goto error; - } + alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); + alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); - if (board_config != ALC_MODEL_AUTO) - setup_preset(codec, &alc262_presets[board_config]); + /* automatic parse from the BIOS config */ + err = alc262_parse_auto_config(codec); + if (err < 0) + goto error; if (!spec->no_analog && !spec->adc_nids) { alc_auto_fill_adc_caps(codec); @@ -4572,8 +4551,7 @@ static int patch_alc262(struct hda_codec *codec) spec->vmaster_nid = 0x0c; codec->patch_ops = alc_patch_ops; - if (board_config == ALC_MODEL_AUTO) - spec->init_hook = alc_auto_init_std; + spec->init_hook = alc_auto_init_std; spec->shutup = alc_eapd_shutup; alc_init_jacks(codec); -- cgit v1.1 From 5c0ebfbe56795cce558736e0023ebb85b9f753c6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 7 Nov 2011 17:59:13 +0100 Subject: ALSA: hda/realtek - Rewrite ALC882 model=vaio-tt with auto-parser Providing a pincfg fix for VAIO-TT with ALC889 codec to work with the auto-parser, and drop the static configuration. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 46 ------------------------------------------- sound/pci/hda/patch_realtek.c | 39 ++++++++++++++++++++++-------------- 2 files changed, 24 insertions(+), 61 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index e251514..59c556d 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -55,7 +55,6 @@ enum { ALC888_ASUS_EEE1601, ALC889A_MB31, ALC1200_ASUS_P5Q, - ALC883_SONY_VAIO_TT, ALC882_MODEL_LAST, }; @@ -2255,16 +2254,6 @@ static const struct snd_kcontrol_new alc889A_mb31_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc883_vaiott_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - static const struct hda_bind_ctls alc883_bind_cap_vol = { .ops = &snd_hda_bind_vol, .values = { @@ -2475,17 +2464,6 @@ static const struct hda_verb alc888_6st_dell_verbs[] = { { } }; -static const struct hda_verb alc883_vaiott_verbs[] = { - /* HP */ - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - - /* enable unsolicited event */ - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - - { } /* end */ -}; - static void alc888_3st_hp_setup(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; @@ -2682,16 +2660,6 @@ static void alc888_lenovo_sky_setup(struct hda_codec *codec) alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); } -static void alc883_vaiott_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x15; - spec->autocfg.speaker_pins[0] = 0x14; - spec->autocfg.speaker_pins[1] = 0x17; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - static const struct hda_verb alc888_asus_m90v_verbs[] = { {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, @@ -2832,7 +2800,6 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC889_INTEL] = "intel-x58", [ALC1200_ASUS_P5Q] = "asus-p5q", [ALC889A_MB31] = "mb31", - [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", [ALC882_AUTO] = "auto", }; @@ -2887,7 +2854,6 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), - SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), @@ -3711,18 +3677,6 @@ static const struct alc_config_preset alc882_presets[] = { .unsol_event = alc889A_mb31_unsol_event, .init_hook = alc889A_mb31_automute, }, - [ALC883_SONY_VAIO_TT] = { - .mixers = { alc883_vaiott_mixer }, - .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .input_mux = &alc883_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc883_vaiott_setup, - .init_hook = alc_hp_automute, - }, }; diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index afdecd8..959bda3 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4214,15 +4214,16 @@ static int patch_alc260(struct hda_codec *codec) * Pin config fixes */ enum { - PINFIX_ABIT_AW9D_MAX, - PINFIX_LENOVO_Y530, - PINFIX_PB_M5210, - PINFIX_ACER_ASPIRE_7736, - PINFIX_ASUS_W90V, + ALC882_FIXUP_ABIT_AW9D_MAX, + ALC882_FIXUP_LENOVO_Y530, + ALC882_FIXUP_PB_M5210, + ALC882_FIXUP_ACER_ASPIRE_7736, + ALC882_FIXUP_ASUS_W90V, + ALC889_FIXUP_VAIO_TT, }; static const struct alc_fixup alc882_fixups[] = { - [PINFIX_ABIT_AW9D_MAX] = { + [ALC882_FIXUP_ABIT_AW9D_MAX] = { .type = ALC_FIXUP_PINS, .v.pins = (const struct alc_pincfg[]) { { 0x15, 0x01080104 }, /* side */ @@ -4231,7 +4232,7 @@ static const struct alc_fixup alc882_fixups[] = { { } } }, - [PINFIX_LENOVO_Y530] = { + [ALC882_FIXUP_LENOVO_Y530] = { .type = ALC_FIXUP_PINS, .v.pins = (const struct alc_pincfg[]) { { 0x15, 0x99130112 }, /* rear int speakers */ @@ -4239,32 +4240,40 @@ static const struct alc_fixup alc882_fixups[] = { { } } }, - [PINFIX_PB_M5210] = { + [ALC882_FIXUP_PB_M5210] = { .type = ALC_FIXUP_VERBS, .v.verbs = (const struct hda_verb[]) { { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, {} } }, - [PINFIX_ACER_ASPIRE_7736] = { + [ALC882_FIXUP_ACER_ASPIRE_7736] = { .type = ALC_FIXUP_SKU, .v.sku = ALC_FIXUP_SKU_IGNORE, }, - [PINFIX_ASUS_W90V] = { + [ALC882_FIXUP_ASUS_W90V] = { .type = ALC_FIXUP_PINS, .v.pins = (const struct alc_pincfg[]) { { 0x16, 0x99130110 }, /* fix sequence for CLFE */ { } } }, + [ALC889_FIXUP_VAIO_TT] = { + .type = ALC_FIXUP_PINS, + .v.pins = (const struct alc_pincfg[]) { + { 0x17, 0x90170111 }, /* hidden surround speaker */ + { } + } + }, }; static const struct snd_pci_quirk alc882_fixup_tbl[] = { - SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), - SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", PINFIX_ASUS_W90V), - SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), - SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), - SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), + SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), + SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), + SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), + SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), + SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), + SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), {} }; -- cgit v1.1 From 8918b843aff3236de6301b1137434d3f0bc0a0f5 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 31 Oct 2011 22:11:53 -0700 Subject: ASoC: fsi: fixup compile warning This patch fixup below warning ${linux}/sound/soc/sh/fsi.c:442:3:\ warning: passing argument 1 of '__fsi_reg_read' makes pointer\ from integer without a cast ${linux}/sound/soc/sh/fsi.c:517:3: \ warning: passing argument 1 of '__fsi_reg_write' makes pointer\ from integer without a cast ${linux}/sound/soc/sh/fsi.c:663:3: \ warning: passing argument 1 of '__fsi_reg_mask_set' makes pointer\ from integer without a cast Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/fsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 3d7016e..e620cb1 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -235,13 +235,13 @@ static void __fsi_reg_mask_set(u32 __iomem *reg, u32 mask, u32 data) } #define fsi_reg_write(p, r, d)\ - __fsi_reg_write((u32)(p->base + REG_##r), d) + __fsi_reg_write((p->base + REG_##r), d) #define fsi_reg_read(p, r)\ - __fsi_reg_read((u32)(p->base + REG_##r)) + __fsi_reg_read((p->base + REG_##r)) #define fsi_reg_mask_set(p, r, m, d)\ - __fsi_reg_mask_set((u32)(p->base + REG_##r), m, d) + __fsi_reg_mask_set((p->base + REG_##r), m, d) #define fsi_master_read(p, r) _fsi_master_read(p, MST_##r) #define fsi_core_read(p, r) _fsi_master_read(p, p->core->r) -- cgit v1.1 From 202113912ba117b5c5f36e45529921b4cca4be6a Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Sun, 6 Nov 2011 22:04:53 -0800 Subject: ASoC: ak4642: ak4642 was tested ak4642 was tested by ms7724se board Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/codecs/ak4642.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 12c1bde..b854eb0 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -18,7 +18,7 @@ * This is very simple driver. * It can use headphone output / stereo input only * - * AK4642 is not tested. + * AK4642 is tested. * AK4643 is tested. */ -- cgit v1.1 From 65ff03f4624d12ad6c19a01a0af7385eda09e4a6 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Sun, 6 Nov 2011 22:05:25 -0800 Subject: ASoC: fsi: add valid data position control support FSI2 can control valid data position, like package in front/back or stream mode (16bit x 2). But current fsi driver is assuming it was in-back. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/fsi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sound') diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index e620cb1..99ed610 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -32,7 +32,9 @@ #define REG_DIDT 0x0020 #define REG_DODT 0x0024 #define REG_MUTE_ST 0x0028 +#define REG_OUT_DMAC 0x002C #define REG_OUT_SEL 0x0030 +#define REG_IN_DMAC 0x0038 /* master register */ #define MST_CLK_RST 0x0210 @@ -886,6 +888,8 @@ static int fsi_hw_startup(struct fsi_priv *fsi, int is_play, struct device *dev) { + struct fsi_master *master = fsi_get_master(fsi); + int fsi_ver = master->core->ver; u32 flags = fsi_get_info_flags(fsi); u32 data = 0; @@ -920,6 +924,17 @@ static int fsi_hw_startup(struct fsi_priv *fsi, fsi_reg_mask_set(fsi, OUT_SEL, DMMD, DMMD); } + /* + * FIXME + * + * FSI driver assumed that data package is in-back. + * FSI2 chip can select it. + */ + if (fsi_ver >= 2) { + fsi_reg_write(fsi, OUT_DMAC, (1 << 4)); + fsi_reg_write(fsi, IN_DMAC, (1 << 4)); + } + /* irq clear */ fsi_irq_disable(fsi, is_play); fsi_irq_clear_status(fsi); -- cgit v1.1 From e94de1e864d2d205e4e503b0f083c07f288b45fe Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 1 Nov 2011 15:17:57 +0800 Subject: ASoC: Avoid a redundant read in cs42l51_pdn_event snd_soc_update_bits already does read-modify-write, no need to read the register before calling snd_soc_update_bits. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l51.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 8c3c820..00718b5 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c @@ -175,21 +175,18 @@ static const struct snd_kcontrol_new cs42l51_snd_controls[] = { static int cs42l51_pdn_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { - unsigned long value; - - value = snd_soc_read(w->codec, CS42L51_POWER_CTL1); - value &= ~CS42L51_POWER_CTL1_PDN; - switch (event) { case SND_SOC_DAPM_PRE_PMD: - value |= CS42L51_POWER_CTL1_PDN; + snd_soc_update_bits(w->codec, CS42L51_POWER_CTL1, + CS42L51_POWER_CTL1_PDN, + CS42L51_POWER_CTL1_PDN); break; default: case SND_SOC_DAPM_POST_PMD: + snd_soc_update_bits(w->codec, CS42L51_POWER_CTL1, + CS42L51_POWER_CTL1_PDN, 0); break; } - snd_soc_update_bits(w->codec, CS42L51_POWER_CTL1, - CS42L51_POWER_CTL1_PDN, value); return 0; } -- cgit v1.1 From 79172746827d0579900fa382733f5769d32952eb Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 19 Sep 2011 16:15:58 +0100 Subject: ASoC: Convert WM8996 to direct regmap API usage Signed-off-by: Mark Brown --- sound/soc/codecs/wm8996.c | 699 ++++++++++++++++++++++++++-------------------- 1 file changed, 391 insertions(+), 308 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 32324c9..5671fd3 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -114,297 +115,365 @@ WM8996_REGULATOR_EVENT(0) WM8996_REGULATOR_EVENT(1) WM8996_REGULATOR_EVENT(2) -static const u16 wm8996_reg[WM8996_MAX_REGISTER] = { - [WM8996_SOFTWARE_RESET] = 0x8996, - [WM8996_POWER_MANAGEMENT_7] = 0x10, - [WM8996_DAC1_HPOUT1_VOLUME] = 0x88, - [WM8996_DAC2_HPOUT2_VOLUME] = 0x88, - [WM8996_DAC1_LEFT_VOLUME] = 0x2c0, - [WM8996_DAC1_RIGHT_VOLUME] = 0x2c0, - [WM8996_DAC2_LEFT_VOLUME] = 0x2c0, - [WM8996_DAC2_RIGHT_VOLUME] = 0x2c0, - [WM8996_OUTPUT1_LEFT_VOLUME] = 0x80, - [WM8996_OUTPUT1_RIGHT_VOLUME] = 0x80, - [WM8996_OUTPUT2_LEFT_VOLUME] = 0x80, - [WM8996_OUTPUT2_RIGHT_VOLUME] = 0x80, - [WM8996_MICBIAS_1] = 0x39, - [WM8996_MICBIAS_2] = 0x39, - [WM8996_LDO_1] = 0x3, - [WM8996_LDO_2] = 0x13, - [WM8996_ACCESSORY_DETECT_MODE_1] = 0x4, - [WM8996_HEADPHONE_DETECT_1] = 0x20, - [WM8996_MIC_DETECT_1] = 0x7600, - [WM8996_MIC_DETECT_2] = 0xbf, - [WM8996_CHARGE_PUMP_1] = 0x1f25, - [WM8996_CHARGE_PUMP_2] = 0xab19, - [WM8996_DC_SERVO_5] = 0x2a2a, - [WM8996_CONTROL_INTERFACE_1] = 0x8004, - [WM8996_CLOCKING_1] = 0x10, - [WM8996_AIF_RATE] = 0x83, - [WM8996_FLL_CONTROL_4] = 0x5dc0, - [WM8996_FLL_CONTROL_5] = 0xc84, - [WM8996_FLL_EFS_2] = 0x2, - [WM8996_AIF1_TX_LRCLK_1] = 0x80, - [WM8996_AIF1_TX_LRCLK_2] = 0x8, - [WM8996_AIF1_RX_LRCLK_1] = 0x80, - [WM8996_AIF1TX_DATA_CONFIGURATION_1] = 0x1818, - [WM8996_AIF1RX_DATA_CONFIGURATION] = 0x1818, - [WM8996_AIF1TX_TEST] = 0x7, - [WM8996_AIF2_TX_LRCLK_1] = 0x80, - [WM8996_AIF2_TX_LRCLK_2] = 0x8, - [WM8996_AIF2_RX_LRCLK_1] = 0x80, - [WM8996_AIF2TX_DATA_CONFIGURATION_1] = 0x1818, - [WM8996_AIF2RX_DATA_CONFIGURATION] = 0x1818, - [WM8996_AIF2TX_TEST] = 0x1, - [WM8996_DSP1_TX_LEFT_VOLUME] = 0xc0, - [WM8996_DSP1_TX_RIGHT_VOLUME] = 0xc0, - [WM8996_DSP1_RX_LEFT_VOLUME] = 0xc0, - [WM8996_DSP1_RX_RIGHT_VOLUME] = 0xc0, - [WM8996_DSP1_TX_FILTERS] = 0x2000, - [WM8996_DSP1_RX_FILTERS_1] = 0x200, - [WM8996_DSP1_RX_FILTERS_2] = 0x10, - [WM8996_DSP1_DRC_1] = 0x98, - [WM8996_DSP1_DRC_2] = 0x845, - [WM8996_DSP1_RX_EQ_GAINS_1] = 0x6318, - [WM8996_DSP1_RX_EQ_GAINS_2] = 0x6300, - [WM8996_DSP1_RX_EQ_BAND_1_A] = 0xfca, - [WM8996_DSP1_RX_EQ_BAND_1_B] = 0x400, - [WM8996_DSP1_RX_EQ_BAND_1_PG] = 0xd8, - [WM8996_DSP1_RX_EQ_BAND_2_A] = 0x1eb5, - [WM8996_DSP1_RX_EQ_BAND_2_B] = 0xf145, - [WM8996_DSP1_RX_EQ_BAND_2_C] = 0xb75, - [WM8996_DSP1_RX_EQ_BAND_2_PG] = 0x1c5, - [WM8996_DSP1_RX_EQ_BAND_3_A] = 0x1c58, - [WM8996_DSP1_RX_EQ_BAND_3_B] = 0xf373, - [WM8996_DSP1_RX_EQ_BAND_3_C] = 0xa54, - [WM8996_DSP1_RX_EQ_BAND_3_PG] = 0x558, - [WM8996_DSP1_RX_EQ_BAND_4_A] = 0x168e, - [WM8996_DSP1_RX_EQ_BAND_4_B] = 0xf829, - [WM8996_DSP1_RX_EQ_BAND_4_C] = 0x7ad, - [WM8996_DSP1_RX_EQ_BAND_4_PG] = 0x1103, - [WM8996_DSP1_RX_EQ_BAND_5_A] = 0x564, - [WM8996_DSP1_RX_EQ_BAND_5_B] = 0x559, - [WM8996_DSP1_RX_EQ_BAND_5_PG] = 0x4000, - [WM8996_DSP2_TX_LEFT_VOLUME] = 0xc0, - [WM8996_DSP2_TX_RIGHT_VOLUME] = 0xc0, - [WM8996_DSP2_RX_LEFT_VOLUME] = 0xc0, - [WM8996_DSP2_RX_RIGHT_VOLUME] = 0xc0, - [WM8996_DSP2_TX_FILTERS] = 0x2000, - [WM8996_DSP2_RX_FILTERS_1] = 0x200, - [WM8996_DSP2_RX_FILTERS_2] = 0x10, - [WM8996_DSP2_DRC_1] = 0x98, - [WM8996_DSP2_DRC_2] = 0x845, - [WM8996_DSP2_RX_EQ_GAINS_1] = 0x6318, - [WM8996_DSP2_RX_EQ_GAINS_2] = 0x6300, - [WM8996_DSP2_RX_EQ_BAND_1_A] = 0xfca, - [WM8996_DSP2_RX_EQ_BAND_1_B] = 0x400, - [WM8996_DSP2_RX_EQ_BAND_1_PG] = 0xd8, - [WM8996_DSP2_RX_EQ_BAND_2_A] = 0x1eb5, - [WM8996_DSP2_RX_EQ_BAND_2_B] = 0xf145, - [WM8996_DSP2_RX_EQ_BAND_2_C] = 0xb75, - [WM8996_DSP2_RX_EQ_BAND_2_PG] = 0x1c5, - [WM8996_DSP2_RX_EQ_BAND_3_A] = 0x1c58, - [WM8996_DSP2_RX_EQ_BAND_3_B] = 0xf373, - [WM8996_DSP2_RX_EQ_BAND_3_C] = 0xa54, - [WM8996_DSP2_RX_EQ_BAND_3_PG] = 0x558, - [WM8996_DSP2_RX_EQ_BAND_4_A] = 0x168e, - [WM8996_DSP2_RX_EQ_BAND_4_B] = 0xf829, - [WM8996_DSP2_RX_EQ_BAND_4_C] = 0x7ad, - [WM8996_DSP2_RX_EQ_BAND_4_PG] = 0x1103, - [WM8996_DSP2_RX_EQ_BAND_5_A] = 0x564, - [WM8996_DSP2_RX_EQ_BAND_5_B] = 0x559, - [WM8996_DSP2_RX_EQ_BAND_5_PG] = 0x4000, - [WM8996_OVERSAMPLING] = 0xd, - [WM8996_SIDETONE] = 0x1040, - [WM8996_GPIO_1] = 0xa101, - [WM8996_GPIO_2] = 0xa101, - [WM8996_GPIO_3] = 0xa101, - [WM8996_GPIO_4] = 0xa101, - [WM8996_GPIO_5] = 0xa101, - [WM8996_PULL_CONTROL_2] = 0x140, - [WM8996_INTERRUPT_STATUS_1_MASK] = 0x1f, - [WM8996_INTERRUPT_STATUS_2_MASK] = 0x1ecf, - [WM8996_RIGHT_PDM_SPEAKER] = 0x1, - [WM8996_PDM_SPEAKER_MUTE_SEQUENCE] = 0x69, - [WM8996_PDM_SPEAKER_VOLUME] = 0x66, - [WM8996_WRITE_SEQUENCER_0] = 0x1, - [WM8996_WRITE_SEQUENCER_1] = 0x1, - [WM8996_WRITE_SEQUENCER_3] = 0x6, - [WM8996_WRITE_SEQUENCER_4] = 0x40, - [WM8996_WRITE_SEQUENCER_5] = 0x1, - [WM8996_WRITE_SEQUENCER_6] = 0xf, - [WM8996_WRITE_SEQUENCER_7] = 0x6, - [WM8996_WRITE_SEQUENCER_8] = 0x1, - [WM8996_WRITE_SEQUENCER_9] = 0x3, - [WM8996_WRITE_SEQUENCER_10] = 0x104, - [WM8996_WRITE_SEQUENCER_12] = 0x60, - [WM8996_WRITE_SEQUENCER_13] = 0x11, - [WM8996_WRITE_SEQUENCER_14] = 0x401, - [WM8996_WRITE_SEQUENCER_16] = 0x50, - [WM8996_WRITE_SEQUENCER_17] = 0x3, - [WM8996_WRITE_SEQUENCER_18] = 0x100, - [WM8996_WRITE_SEQUENCER_20] = 0x51, - [WM8996_WRITE_SEQUENCER_21] = 0x3, - [WM8996_WRITE_SEQUENCER_22] = 0x104, - [WM8996_WRITE_SEQUENCER_23] = 0xa, - [WM8996_WRITE_SEQUENCER_24] = 0x60, - [WM8996_WRITE_SEQUENCER_25] = 0x3b, - [WM8996_WRITE_SEQUENCER_26] = 0x502, - [WM8996_WRITE_SEQUENCER_27] = 0x100, - [WM8996_WRITE_SEQUENCER_28] = 0x2fff, - [WM8996_WRITE_SEQUENCER_32] = 0x2fff, - [WM8996_WRITE_SEQUENCER_36] = 0x2fff, - [WM8996_WRITE_SEQUENCER_40] = 0x2fff, - [WM8996_WRITE_SEQUENCER_44] = 0x2fff, - [WM8996_WRITE_SEQUENCER_48] = 0x2fff, - [WM8996_WRITE_SEQUENCER_52] = 0x2fff, - [WM8996_WRITE_SEQUENCER_56] = 0x2fff, - [WM8996_WRITE_SEQUENCER_60] = 0x2fff, - [WM8996_WRITE_SEQUENCER_64] = 0x1, - [WM8996_WRITE_SEQUENCER_65] = 0x1, - [WM8996_WRITE_SEQUENCER_67] = 0x6, - [WM8996_WRITE_SEQUENCER_68] = 0x40, - [WM8996_WRITE_SEQUENCER_69] = 0x1, - [WM8996_WRITE_SEQUENCER_70] = 0xf, - [WM8996_WRITE_SEQUENCER_71] = 0x6, - [WM8996_WRITE_SEQUENCER_72] = 0x1, - [WM8996_WRITE_SEQUENCER_73] = 0x3, - [WM8996_WRITE_SEQUENCER_74] = 0x104, - [WM8996_WRITE_SEQUENCER_76] = 0x60, - [WM8996_WRITE_SEQUENCER_77] = 0x11, - [WM8996_WRITE_SEQUENCER_78] = 0x401, - [WM8996_WRITE_SEQUENCER_80] = 0x50, - [WM8996_WRITE_SEQUENCER_81] = 0x3, - [WM8996_WRITE_SEQUENCER_82] = 0x100, - [WM8996_WRITE_SEQUENCER_84] = 0x60, - [WM8996_WRITE_SEQUENCER_85] = 0x3b, - [WM8996_WRITE_SEQUENCER_86] = 0x502, - [WM8996_WRITE_SEQUENCER_87] = 0x100, - [WM8996_WRITE_SEQUENCER_88] = 0x2fff, - [WM8996_WRITE_SEQUENCER_92] = 0x2fff, - [WM8996_WRITE_SEQUENCER_96] = 0x2fff, - [WM8996_WRITE_SEQUENCER_100] = 0x2fff, - [WM8996_WRITE_SEQUENCER_104] = 0x2fff, - [WM8996_WRITE_SEQUENCER_108] = 0x2fff, - [WM8996_WRITE_SEQUENCER_112] = 0x2fff, - [WM8996_WRITE_SEQUENCER_116] = 0x2fff, - [WM8996_WRITE_SEQUENCER_120] = 0x2fff, - [WM8996_WRITE_SEQUENCER_124] = 0x2fff, - [WM8996_WRITE_SEQUENCER_128] = 0x1, - [WM8996_WRITE_SEQUENCER_129] = 0x1, - [WM8996_WRITE_SEQUENCER_131] = 0x6, - [WM8996_WRITE_SEQUENCER_132] = 0x40, - [WM8996_WRITE_SEQUENCER_133] = 0x1, - [WM8996_WRITE_SEQUENCER_134] = 0xf, - [WM8996_WRITE_SEQUENCER_135] = 0x6, - [WM8996_WRITE_SEQUENCER_136] = 0x1, - [WM8996_WRITE_SEQUENCER_137] = 0x3, - [WM8996_WRITE_SEQUENCER_138] = 0x106, - [WM8996_WRITE_SEQUENCER_140] = 0x61, - [WM8996_WRITE_SEQUENCER_141] = 0x11, - [WM8996_WRITE_SEQUENCER_142] = 0x401, - [WM8996_WRITE_SEQUENCER_144] = 0x50, - [WM8996_WRITE_SEQUENCER_145] = 0x3, - [WM8996_WRITE_SEQUENCER_146] = 0x102, - [WM8996_WRITE_SEQUENCER_148] = 0x51, - [WM8996_WRITE_SEQUENCER_149] = 0x3, - [WM8996_WRITE_SEQUENCER_150] = 0x106, - [WM8996_WRITE_SEQUENCER_151] = 0xa, - [WM8996_WRITE_SEQUENCER_152] = 0x61, - [WM8996_WRITE_SEQUENCER_153] = 0x3b, - [WM8996_WRITE_SEQUENCER_154] = 0x502, - [WM8996_WRITE_SEQUENCER_155] = 0x100, - [WM8996_WRITE_SEQUENCER_156] = 0x2fff, - [WM8996_WRITE_SEQUENCER_160] = 0x2fff, - [WM8996_WRITE_SEQUENCER_164] = 0x2fff, - [WM8996_WRITE_SEQUENCER_168] = 0x2fff, - [WM8996_WRITE_SEQUENCER_172] = 0x2fff, - [WM8996_WRITE_SEQUENCER_176] = 0x2fff, - [WM8996_WRITE_SEQUENCER_180] = 0x2fff, - [WM8996_WRITE_SEQUENCER_184] = 0x2fff, - [WM8996_WRITE_SEQUENCER_188] = 0x2fff, - [WM8996_WRITE_SEQUENCER_192] = 0x1, - [WM8996_WRITE_SEQUENCER_193] = 0x1, - [WM8996_WRITE_SEQUENCER_195] = 0x6, - [WM8996_WRITE_SEQUENCER_196] = 0x40, - [WM8996_WRITE_SEQUENCER_197] = 0x1, - [WM8996_WRITE_SEQUENCER_198] = 0xf, - [WM8996_WRITE_SEQUENCER_199] = 0x6, - [WM8996_WRITE_SEQUENCER_200] = 0x1, - [WM8996_WRITE_SEQUENCER_201] = 0x3, - [WM8996_WRITE_SEQUENCER_202] = 0x106, - [WM8996_WRITE_SEQUENCER_204] = 0x61, - [WM8996_WRITE_SEQUENCER_205] = 0x11, - [WM8996_WRITE_SEQUENCER_206] = 0x401, - [WM8996_WRITE_SEQUENCER_208] = 0x50, - [WM8996_WRITE_SEQUENCER_209] = 0x3, - [WM8996_WRITE_SEQUENCER_210] = 0x102, - [WM8996_WRITE_SEQUENCER_212] = 0x61, - [WM8996_WRITE_SEQUENCER_213] = 0x3b, - [WM8996_WRITE_SEQUENCER_214] = 0x502, - [WM8996_WRITE_SEQUENCER_215] = 0x100, - [WM8996_WRITE_SEQUENCER_216] = 0x2fff, - [WM8996_WRITE_SEQUENCER_220] = 0x2fff, - [WM8996_WRITE_SEQUENCER_224] = 0x2fff, - [WM8996_WRITE_SEQUENCER_228] = 0x2fff, - [WM8996_WRITE_SEQUENCER_232] = 0x2fff, - [WM8996_WRITE_SEQUENCER_236] = 0x2fff, - [WM8996_WRITE_SEQUENCER_240] = 0x2fff, - [WM8996_WRITE_SEQUENCER_244] = 0x2fff, - [WM8996_WRITE_SEQUENCER_248] = 0x2fff, - [WM8996_WRITE_SEQUENCER_252] = 0x2fff, - [WM8996_WRITE_SEQUENCER_256] = 0x60, - [WM8996_WRITE_SEQUENCER_258] = 0x601, - [WM8996_WRITE_SEQUENCER_260] = 0x50, - [WM8996_WRITE_SEQUENCER_262] = 0x100, - [WM8996_WRITE_SEQUENCER_264] = 0x1, - [WM8996_WRITE_SEQUENCER_266] = 0x104, - [WM8996_WRITE_SEQUENCER_267] = 0x100, - [WM8996_WRITE_SEQUENCER_268] = 0x2fff, - [WM8996_WRITE_SEQUENCER_272] = 0x2fff, - [WM8996_WRITE_SEQUENCER_276] = 0x2fff, - [WM8996_WRITE_SEQUENCER_280] = 0x2fff, - [WM8996_WRITE_SEQUENCER_284] = 0x2fff, - [WM8996_WRITE_SEQUENCER_288] = 0x2fff, - [WM8996_WRITE_SEQUENCER_292] = 0x2fff, - [WM8996_WRITE_SEQUENCER_296] = 0x2fff, - [WM8996_WRITE_SEQUENCER_300] = 0x2fff, - [WM8996_WRITE_SEQUENCER_304] = 0x2fff, - [WM8996_WRITE_SEQUENCER_308] = 0x2fff, - [WM8996_WRITE_SEQUENCER_312] = 0x2fff, - [WM8996_WRITE_SEQUENCER_316] = 0x2fff, - [WM8996_WRITE_SEQUENCER_320] = 0x61, - [WM8996_WRITE_SEQUENCER_322] = 0x601, - [WM8996_WRITE_SEQUENCER_324] = 0x50, - [WM8996_WRITE_SEQUENCER_326] = 0x102, - [WM8996_WRITE_SEQUENCER_328] = 0x1, - [WM8996_WRITE_SEQUENCER_330] = 0x106, - [WM8996_WRITE_SEQUENCER_331] = 0x100, - [WM8996_WRITE_SEQUENCER_332] = 0x2fff, - [WM8996_WRITE_SEQUENCER_336] = 0x2fff, - [WM8996_WRITE_SEQUENCER_340] = 0x2fff, - [WM8996_WRITE_SEQUENCER_344] = 0x2fff, - [WM8996_WRITE_SEQUENCER_348] = 0x2fff, - [WM8996_WRITE_SEQUENCER_352] = 0x2fff, - [WM8996_WRITE_SEQUENCER_356] = 0x2fff, - [WM8996_WRITE_SEQUENCER_360] = 0x2fff, - [WM8996_WRITE_SEQUENCER_364] = 0x2fff, - [WM8996_WRITE_SEQUENCER_368] = 0x2fff, - [WM8996_WRITE_SEQUENCER_372] = 0x2fff, - [WM8996_WRITE_SEQUENCER_376] = 0x2fff, - [WM8996_WRITE_SEQUENCER_380] = 0x2fff, - [WM8996_WRITE_SEQUENCER_384] = 0x60, - [WM8996_WRITE_SEQUENCER_386] = 0x601, - [WM8996_WRITE_SEQUENCER_388] = 0x61, - [WM8996_WRITE_SEQUENCER_390] = 0x601, - [WM8996_WRITE_SEQUENCER_392] = 0x50, - [WM8996_WRITE_SEQUENCER_394] = 0x300, - [WM8996_WRITE_SEQUENCER_396] = 0x1, - [WM8996_WRITE_SEQUENCER_398] = 0x304, - [WM8996_WRITE_SEQUENCER_400] = 0x40, - [WM8996_WRITE_SEQUENCER_402] = 0xf, - [WM8996_WRITE_SEQUENCER_404] = 0x1, - [WM8996_WRITE_SEQUENCER_407] = 0x100, +static struct reg_default wm8996_reg[] = { + { WM8996_SOFTWARE_RESET, 0x8996 }, + { WM8996_POWER_MANAGEMENT_1, 0x0 }, + { WM8996_POWER_MANAGEMENT_2, 0x0 }, + { WM8996_POWER_MANAGEMENT_3, 0x0 }, + { WM8996_POWER_MANAGEMENT_4, 0x0 }, + { WM8996_POWER_MANAGEMENT_5, 0x0 }, + { WM8996_POWER_MANAGEMENT_6, 0x0 }, + { WM8996_POWER_MANAGEMENT_7, 0x10 }, + { WM8996_POWER_MANAGEMENT_8, 0x0 }, + { WM8996_LEFT_LINE_INPUT_VOLUME, 0x0 }, + { WM8996_RIGHT_LINE_INPUT_VOLUME, 0x0 }, + { WM8996_LINE_INPUT_CONTROL, 0x0 }, + { WM8996_DAC1_HPOUT1_VOLUME, 0x88 }, + { WM8996_DAC2_HPOUT2_VOLUME, 0x88 }, + { WM8996_DAC1_LEFT_VOLUME, 0x2c0 }, + { WM8996_DAC1_RIGHT_VOLUME, 0x2c0 }, + { WM8996_DAC2_LEFT_VOLUME, 0x2c0 }, + { WM8996_DAC2_RIGHT_VOLUME, 0x2c0 }, + { WM8996_OUTPUT1_LEFT_VOLUME, 0x80 }, + { WM8996_OUTPUT1_RIGHT_VOLUME, 0x80 }, + { WM8996_OUTPUT2_LEFT_VOLUME, 0x80 }, + { WM8996_OUTPUT2_RIGHT_VOLUME, 0x80 }, + { WM8996_MICBIAS_1, 0x39 }, + { WM8996_MICBIAS_2, 0x39 }, + { WM8996_LDO_1, 0x3 }, + { WM8996_LDO_2, 0x13 }, + { WM8996_ACCESSORY_DETECT_MODE_1, 0x4 }, + { WM8996_ACCESSORY_DETECT_MODE_2, 0x0 }, + { WM8996_HEADPHONE_DETECT_1, 0x20 }, + { WM8996_HEADPHONE_DETECT_2, 0x0 }, + { WM8996_MIC_DETECT_1, 0x7600 }, + { WM8996_MIC_DETECT_2, 0xbf }, + { WM8996_CHARGE_PUMP_1, 0x1f25 }, + { WM8996_CHARGE_PUMP_2, 0xab19 }, + { WM8996_DC_SERVO_1, 0x0 }, + { WM8996_DC_SERVO_2, 0x0 }, + { WM8996_DC_SERVO_3, 0x0 }, + { WM8996_DC_SERVO_5, 0x2a2a }, + { WM8996_DC_SERVO_6, 0x0 }, + { WM8996_DC_SERVO_7, 0x0 }, + { WM8996_ANALOGUE_HP_1, 0x0 }, + { WM8996_ANALOGUE_HP_2, 0x0 }, + { WM8996_CONTROL_INTERFACE_1, 0x8004 }, + { WM8996_WRITE_SEQUENCER_CTRL_1, 0x0 }, + { WM8996_WRITE_SEQUENCER_CTRL_2, 0x0 }, + { WM8996_AIF_CLOCKING_1, 0x0 }, + { WM8996_AIF_CLOCKING_2, 0x0 }, + { WM8996_CLOCKING_1, 0x10 }, + { WM8996_CLOCKING_2, 0x0 }, + { WM8996_AIF_RATE, 0x83 }, + { WM8996_FLL_CONTROL_1, 0x0 }, + { WM8996_FLL_CONTROL_2, 0x0 }, + { WM8996_FLL_CONTROL_3, 0x0 }, + { WM8996_FLL_CONTROL_4, 0x5dc0 }, + { WM8996_FLL_CONTROL_5, 0xc84 }, + { WM8996_FLL_EFS_1, 0x0 }, + { WM8996_FLL_EFS_2, 0x2 }, + { WM8996_AIF1_CONTROL, 0x0 }, + { WM8996_AIF1_BCLK, 0x0 }, + { WM8996_AIF1_TX_LRCLK_1, 0x80 }, + { WM8996_AIF1_TX_LRCLK_2, 0x8 }, + { WM8996_AIF1_RX_LRCLK_1, 0x80 }, + { WM8996_AIF1_RX_LRCLK_2, 0x0 }, + { WM8996_AIF1TX_DATA_CONFIGURATION_1, 0x1818 }, + { WM8996_AIF1TX_DATA_CONFIGURATION_2, 0 }, + { WM8996_AIF1RX_DATA_CONFIGURATION, 0x1818 }, + { WM8996_AIF1TX_CHANNEL_0_CONFIGURATION, 0x0 }, + { WM8996_AIF1TX_CHANNEL_1_CONFIGURATION, 0x0 }, + { WM8996_AIF1TX_CHANNEL_2_CONFIGURATION, 0x0 }, + { WM8996_AIF1TX_CHANNEL_3_CONFIGURATION, 0x0 }, + { WM8996_AIF1TX_CHANNEL_4_CONFIGURATION, 0x0 }, + { WM8996_AIF1TX_CHANNEL_5_CONFIGURATION, 0x0 }, + { WM8996_AIF1RX_CHANNEL_0_CONFIGURATION, 0x0 }, + { WM8996_AIF1RX_CHANNEL_1_CONFIGURATION, 0x0 }, + { WM8996_AIF1RX_CHANNEL_2_CONFIGURATION, 0x0 }, + { WM8996_AIF1RX_CHANNEL_3_CONFIGURATION, 0x0 }, + { WM8996_AIF1RX_CHANNEL_4_CONFIGURATION, 0x0 }, + { WM8996_AIF1RX_CHANNEL_5_CONFIGURATION, 0x0 }, + { WM8996_AIF1RX_MONO_CONFIGURATION, 0x0 }, + { WM8996_AIF1TX_TEST, 0x7 }, + { WM8996_AIF2_CONTROL, 0x0 }, + { WM8996_AIF2_BCLK, 0x0 }, + { WM8996_AIF2_TX_LRCLK_1, 0x80 }, + { WM8996_AIF2_TX_LRCLK_2, 0x8 }, + { WM8996_AIF2_RX_LRCLK_1, 0x80 }, + { WM8996_AIF2_RX_LRCLK_2, 0x0 }, + { WM8996_AIF2TX_DATA_CONFIGURATION_1, 0x1818 }, + { WM8996_AIF2RX_DATA_CONFIGURATION, 0x1818 }, + { WM8996_AIF2RX_DATA_CONFIGURATION, 0x0 }, + { WM8996_AIF2TX_CHANNEL_0_CONFIGURATION, 0x0 }, + { WM8996_AIF2TX_CHANNEL_1_CONFIGURATION, 0x0 }, + { WM8996_AIF2RX_CHANNEL_0_CONFIGURATION, 0x0 }, + { WM8996_AIF2RX_CHANNEL_1_CONFIGURATION, 0x0 }, + { WM8996_AIF2RX_MONO_CONFIGURATION, 0x0 }, + { WM8996_AIF2TX_TEST, 0x1 }, + { WM8996_DSP1_TX_LEFT_VOLUME, 0xc0 }, + { WM8996_DSP1_TX_RIGHT_VOLUME, 0xc0 }, + { WM8996_DSP1_RX_LEFT_VOLUME, 0xc0 }, + { WM8996_DSP1_RX_RIGHT_VOLUME, 0xc0 }, + { WM8996_DSP1_TX_FILTERS, 0x2000 }, + { WM8996_DSP1_RX_FILTERS_1, 0x200 }, + { WM8996_DSP1_RX_FILTERS_2, 0x10 }, + { WM8996_DSP1_DRC_1, 0x98 }, + { WM8996_DSP1_DRC_2, 0x845 }, + { WM8996_DSP1_RX_EQ_GAINS_1, 0x6318 }, + { WM8996_DSP1_RX_EQ_GAINS_2, 0x6300 }, + { WM8996_DSP1_RX_EQ_BAND_1_A, 0xfca }, + { WM8996_DSP1_RX_EQ_BAND_1_B, 0x400 }, + { WM8996_DSP1_RX_EQ_BAND_1_PG, 0xd8 }, + { WM8996_DSP1_RX_EQ_BAND_2_A, 0x1eb5 }, + { WM8996_DSP1_RX_EQ_BAND_2_B, 0xf145 }, + { WM8996_DSP1_RX_EQ_BAND_2_C, 0xb75 }, + { WM8996_DSP1_RX_EQ_BAND_2_PG, 0x1c5 }, + { WM8996_DSP1_RX_EQ_BAND_3_A, 0x1c58 }, + { WM8996_DSP1_RX_EQ_BAND_3_B, 0xf373 }, + { WM8996_DSP1_RX_EQ_BAND_3_C, 0xa54 }, + { WM8996_DSP1_RX_EQ_BAND_3_PG, 0x558 }, + { WM8996_DSP1_RX_EQ_BAND_4_A, 0x168e }, + { WM8996_DSP1_RX_EQ_BAND_4_B, 0xf829 }, + { WM8996_DSP1_RX_EQ_BAND_4_C, 0x7ad }, + { WM8996_DSP1_RX_EQ_BAND_4_PG, 0x1103 }, + { WM8996_DSP1_RX_EQ_BAND_5_A, 0x564 }, + { WM8996_DSP1_RX_EQ_BAND_5_B, 0x559 }, + { WM8996_DSP1_RX_EQ_BAND_5_PG, 0x4000 }, + { WM8996_DSP2_TX_LEFT_VOLUME, 0xc0 }, + { WM8996_DSP2_TX_RIGHT_VOLUME, 0xc0 }, + { WM8996_DSP2_RX_LEFT_VOLUME, 0xc0 }, + { WM8996_DSP2_RX_RIGHT_VOLUME, 0xc0 }, + { WM8996_DSP2_TX_FILTERS, 0x2000 }, + { WM8996_DSP2_RX_FILTERS_1, 0x200 }, + { WM8996_DSP2_RX_FILTERS_2, 0x10 }, + { WM8996_DSP2_DRC_1, 0x98 }, + { WM8996_DSP2_DRC_2, 0x845 }, + { WM8996_DSP2_RX_EQ_GAINS_1, 0x6318 }, + { WM8996_DSP2_RX_EQ_GAINS_2, 0x6300 }, + { WM8996_DSP2_RX_EQ_BAND_1_A, 0xfca }, + { WM8996_DSP2_RX_EQ_BAND_1_B, 0x400 }, + { WM8996_DSP2_RX_EQ_BAND_1_PG, 0xd8 }, + { WM8996_DSP2_RX_EQ_BAND_2_A, 0x1eb5 }, + { WM8996_DSP2_RX_EQ_BAND_2_B, 0xf145 }, + { WM8996_DSP2_RX_EQ_BAND_2_C, 0xb75 }, + { WM8996_DSP2_RX_EQ_BAND_2_PG, 0x1c5 }, + { WM8996_DSP2_RX_EQ_BAND_3_A, 0x1c58 }, + { WM8996_DSP2_RX_EQ_BAND_3_B, 0xf373 }, + { WM8996_DSP2_RX_EQ_BAND_3_C, 0xa54 }, + { WM8996_DSP2_RX_EQ_BAND_3_PG, 0x558 }, + { WM8996_DSP2_RX_EQ_BAND_4_A, 0x168e }, + { WM8996_DSP2_RX_EQ_BAND_4_B, 0xf829 }, + { WM8996_DSP2_RX_EQ_BAND_4_C, 0x7ad }, + { WM8996_DSP2_RX_EQ_BAND_4_PG, 0x1103 }, + { WM8996_DSP2_RX_EQ_BAND_5_A, 0x564 }, + { WM8996_DSP2_RX_EQ_BAND_5_B, 0x559 }, + { WM8996_DSP2_RX_EQ_BAND_5_PG, 0x4000 }, + { WM8996_DAC1_MIXER_VOLUMES, 0x0 }, + { WM8996_DAC1_LEFT_MIXER_ROUTING, 0x0 }, + { WM8996_DAC1_RIGHT_MIXER_ROUTING, 0x0 }, + { WM8996_DAC2_MIXER_VOLUMES, 0x0 }, + { WM8996_DAC2_LEFT_MIXER_ROUTING, 0x0 }, + { WM8996_DAC2_RIGHT_MIXER_ROUTING, 0x0 }, + { WM8996_DSP1_TX_LEFT_MIXER_ROUTING, 0x0 }, + { WM8996_DSP1_TX_RIGHT_MIXER_ROUTING, 0x0 }, + { WM8996_DSP2_TX_LEFT_MIXER_ROUTING, 0x0 }, + { WM8996_DSP2_TX_RIGHT_MIXER_ROUTING, 0x0 }, + { WM8996_DSP_TX_MIXER_SELECT, 0x0 }, + { WM8996_DAC_SOFTMUTE, 0x0 }, + { WM8996_OVERSAMPLING, 0xd }, + { WM8996_SIDETONE, 0x1040 }, + { WM8996_GPIO_1, 0xa101 }, + { WM8996_GPIO_2, 0xa101 }, + { WM8996_GPIO_3, 0xa101 }, + { WM8996_GPIO_4, 0xa101 }, + { WM8996_GPIO_5, 0xa101 }, + { WM8996_PULL_CONTROL_1, 0x0 }, + { WM8996_PULL_CONTROL_2, 0x140 }, + { WM8996_INTERRUPT_STATUS_1_MASK, 0x1f }, + { WM8996_INTERRUPT_STATUS_2_MASK, 0x1ecf }, + { WM8996_LEFT_PDM_SPEAKER, 0x0 }, + { WM8996_RIGHT_PDM_SPEAKER, 0x1 }, + { WM8996_PDM_SPEAKER_MUTE_SEQUENCE, 0x69 }, + { WM8996_PDM_SPEAKER_VOLUME, 0x66 }, + { WM8996_WRITE_SEQUENCER_0, 0x1 }, + { WM8996_WRITE_SEQUENCER_1, 0x1 }, + { WM8996_WRITE_SEQUENCER_3, 0x6 }, + { WM8996_WRITE_SEQUENCER_4, 0x40 }, + { WM8996_WRITE_SEQUENCER_5, 0x1 }, + { WM8996_WRITE_SEQUENCER_6, 0xf }, + { WM8996_WRITE_SEQUENCER_7, 0x6 }, + { WM8996_WRITE_SEQUENCER_8, 0x1 }, + { WM8996_WRITE_SEQUENCER_9, 0x3 }, + { WM8996_WRITE_SEQUENCER_10, 0x104 }, + { WM8996_WRITE_SEQUENCER_12, 0x60 }, + { WM8996_WRITE_SEQUENCER_13, 0x11 }, + { WM8996_WRITE_SEQUENCER_14, 0x401 }, + { WM8996_WRITE_SEQUENCER_16, 0x50 }, + { WM8996_WRITE_SEQUENCER_17, 0x3 }, + { WM8996_WRITE_SEQUENCER_18, 0x100 }, + { WM8996_WRITE_SEQUENCER_20, 0x51 }, + { WM8996_WRITE_SEQUENCER_21, 0x3 }, + { WM8996_WRITE_SEQUENCER_22, 0x104 }, + { WM8996_WRITE_SEQUENCER_23, 0xa }, + { WM8996_WRITE_SEQUENCER_24, 0x60 }, + { WM8996_WRITE_SEQUENCER_25, 0x3b }, + { WM8996_WRITE_SEQUENCER_26, 0x502 }, + { WM8996_WRITE_SEQUENCER_27, 0x100 }, + { WM8996_WRITE_SEQUENCER_28, 0x2fff }, + { WM8996_WRITE_SEQUENCER_32, 0x2fff }, + { WM8996_WRITE_SEQUENCER_36, 0x2fff }, + { WM8996_WRITE_SEQUENCER_40, 0x2fff }, + { WM8996_WRITE_SEQUENCER_44, 0x2fff }, + { WM8996_WRITE_SEQUENCER_48, 0x2fff }, + { WM8996_WRITE_SEQUENCER_52, 0x2fff }, + { WM8996_WRITE_SEQUENCER_56, 0x2fff }, + { WM8996_WRITE_SEQUENCER_60, 0x2fff }, + { WM8996_WRITE_SEQUENCER_64, 0x1 }, + { WM8996_WRITE_SEQUENCER_65, 0x1 }, + { WM8996_WRITE_SEQUENCER_67, 0x6 }, + { WM8996_WRITE_SEQUENCER_68, 0x40 }, + { WM8996_WRITE_SEQUENCER_69, 0x1 }, + { WM8996_WRITE_SEQUENCER_70, 0xf }, + { WM8996_WRITE_SEQUENCER_71, 0x6 }, + { WM8996_WRITE_SEQUENCER_72, 0x1 }, + { WM8996_WRITE_SEQUENCER_73, 0x3 }, + { WM8996_WRITE_SEQUENCER_74, 0x104 }, + { WM8996_WRITE_SEQUENCER_76, 0x60 }, + { WM8996_WRITE_SEQUENCER_77, 0x11 }, + { WM8996_WRITE_SEQUENCER_78, 0x401 }, + { WM8996_WRITE_SEQUENCER_80, 0x50 }, + { WM8996_WRITE_SEQUENCER_81, 0x3 }, + { WM8996_WRITE_SEQUENCER_82, 0x100 }, + { WM8996_WRITE_SEQUENCER_84, 0x60 }, + { WM8996_WRITE_SEQUENCER_85, 0x3b }, + { WM8996_WRITE_SEQUENCER_86, 0x502 }, + { WM8996_WRITE_SEQUENCER_87, 0x100 }, + { WM8996_WRITE_SEQUENCER_88, 0x2fff }, + { WM8996_WRITE_SEQUENCER_92, 0x2fff }, + { WM8996_WRITE_SEQUENCER_96, 0x2fff }, + { WM8996_WRITE_SEQUENCER_100, 0x2fff }, + { WM8996_WRITE_SEQUENCER_104, 0x2fff }, + { WM8996_WRITE_SEQUENCER_108, 0x2fff }, + { WM8996_WRITE_SEQUENCER_112, 0x2fff }, + { WM8996_WRITE_SEQUENCER_116, 0x2fff }, + { WM8996_WRITE_SEQUENCER_120, 0x2fff }, + { WM8996_WRITE_SEQUENCER_124, 0x2fff }, + { WM8996_WRITE_SEQUENCER_128, 0x1 }, + { WM8996_WRITE_SEQUENCER_129, 0x1 }, + { WM8996_WRITE_SEQUENCER_131, 0x6 }, + { WM8996_WRITE_SEQUENCER_132, 0x40 }, + { WM8996_WRITE_SEQUENCER_133, 0x1 }, + { WM8996_WRITE_SEQUENCER_134, 0xf }, + { WM8996_WRITE_SEQUENCER_135, 0x6 }, + { WM8996_WRITE_SEQUENCER_136, 0x1 }, + { WM8996_WRITE_SEQUENCER_137, 0x3 }, + { WM8996_WRITE_SEQUENCER_138, 0x106 }, + { WM8996_WRITE_SEQUENCER_140, 0x61 }, + { WM8996_WRITE_SEQUENCER_141, 0x11 }, + { WM8996_WRITE_SEQUENCER_142, 0x401 }, + { WM8996_WRITE_SEQUENCER_144, 0x50 }, + { WM8996_WRITE_SEQUENCER_145, 0x3 }, + { WM8996_WRITE_SEQUENCER_146, 0x102 }, + { WM8996_WRITE_SEQUENCER_148, 0x51 }, + { WM8996_WRITE_SEQUENCER_149, 0x3 }, + { WM8996_WRITE_SEQUENCER_150, 0x106 }, + { WM8996_WRITE_SEQUENCER_151, 0xa }, + { WM8996_WRITE_SEQUENCER_152, 0x61 }, + { WM8996_WRITE_SEQUENCER_153, 0x3b }, + { WM8996_WRITE_SEQUENCER_154, 0x502 }, + { WM8996_WRITE_SEQUENCER_155, 0x100 }, + { WM8996_WRITE_SEQUENCER_156, 0x2fff }, + { WM8996_WRITE_SEQUENCER_160, 0x2fff }, + { WM8996_WRITE_SEQUENCER_164, 0x2fff }, + { WM8996_WRITE_SEQUENCER_168, 0x2fff }, + { WM8996_WRITE_SEQUENCER_172, 0x2fff }, + { WM8996_WRITE_SEQUENCER_176, 0x2fff }, + { WM8996_WRITE_SEQUENCER_180, 0x2fff }, + { WM8996_WRITE_SEQUENCER_184, 0x2fff }, + { WM8996_WRITE_SEQUENCER_188, 0x2fff }, + { WM8996_WRITE_SEQUENCER_192, 0x1 }, + { WM8996_WRITE_SEQUENCER_193, 0x1 }, + { WM8996_WRITE_SEQUENCER_195, 0x6 }, + { WM8996_WRITE_SEQUENCER_196, 0x40 }, + { WM8996_WRITE_SEQUENCER_197, 0x1 }, + { WM8996_WRITE_SEQUENCER_198, 0xf }, + { WM8996_WRITE_SEQUENCER_199, 0x6 }, + { WM8996_WRITE_SEQUENCER_200, 0x1 }, + { WM8996_WRITE_SEQUENCER_201, 0x3 }, + { WM8996_WRITE_SEQUENCER_202, 0x106 }, + { WM8996_WRITE_SEQUENCER_204, 0x61 }, + { WM8996_WRITE_SEQUENCER_205, 0x11 }, + { WM8996_WRITE_SEQUENCER_206, 0x401 }, + { WM8996_WRITE_SEQUENCER_208, 0x50 }, + { WM8996_WRITE_SEQUENCER_209, 0x3 }, + { WM8996_WRITE_SEQUENCER_210, 0x102 }, + { WM8996_WRITE_SEQUENCER_212, 0x61 }, + { WM8996_WRITE_SEQUENCER_213, 0x3b }, + { WM8996_WRITE_SEQUENCER_214, 0x502 }, + { WM8996_WRITE_SEQUENCER_215, 0x100 }, + { WM8996_WRITE_SEQUENCER_216, 0x2fff }, + { WM8996_WRITE_SEQUENCER_220, 0x2fff }, + { WM8996_WRITE_SEQUENCER_224, 0x2fff }, + { WM8996_WRITE_SEQUENCER_228, 0x2fff }, + { WM8996_WRITE_SEQUENCER_232, 0x2fff }, + { WM8996_WRITE_SEQUENCER_236, 0x2fff }, + { WM8996_WRITE_SEQUENCER_240, 0x2fff }, + { WM8996_WRITE_SEQUENCER_244, 0x2fff }, + { WM8996_WRITE_SEQUENCER_248, 0x2fff }, + { WM8996_WRITE_SEQUENCER_252, 0x2fff }, + { WM8996_WRITE_SEQUENCER_256, 0x60 }, + { WM8996_WRITE_SEQUENCER_258, 0x601 }, + { WM8996_WRITE_SEQUENCER_260, 0x50 }, + { WM8996_WRITE_SEQUENCER_262, 0x100 }, + { WM8996_WRITE_SEQUENCER_264, 0x1 }, + { WM8996_WRITE_SEQUENCER_266, 0x104 }, + { WM8996_WRITE_SEQUENCER_267, 0x100 }, + { WM8996_WRITE_SEQUENCER_268, 0x2fff }, + { WM8996_WRITE_SEQUENCER_272, 0x2fff }, + { WM8996_WRITE_SEQUENCER_276, 0x2fff }, + { WM8996_WRITE_SEQUENCER_280, 0x2fff }, + { WM8996_WRITE_SEQUENCER_284, 0x2fff }, + { WM8996_WRITE_SEQUENCER_288, 0x2fff }, + { WM8996_WRITE_SEQUENCER_292, 0x2fff }, + { WM8996_WRITE_SEQUENCER_296, 0x2fff }, + { WM8996_WRITE_SEQUENCER_300, 0x2fff }, + { WM8996_WRITE_SEQUENCER_304, 0x2fff }, + { WM8996_WRITE_SEQUENCER_308, 0x2fff }, + { WM8996_WRITE_SEQUENCER_312, 0x2fff }, + { WM8996_WRITE_SEQUENCER_316, 0x2fff }, + { WM8996_WRITE_SEQUENCER_320, 0x61 }, + { WM8996_WRITE_SEQUENCER_322, 0x601 }, + { WM8996_WRITE_SEQUENCER_324, 0x50 }, + { WM8996_WRITE_SEQUENCER_326, 0x102 }, + { WM8996_WRITE_SEQUENCER_328, 0x1 }, + { WM8996_WRITE_SEQUENCER_330, 0x106 }, + { WM8996_WRITE_SEQUENCER_331, 0x100 }, + { WM8996_WRITE_SEQUENCER_332, 0x2fff }, + { WM8996_WRITE_SEQUENCER_336, 0x2fff }, + { WM8996_WRITE_SEQUENCER_340, 0x2fff }, + { WM8996_WRITE_SEQUENCER_344, 0x2fff }, + { WM8996_WRITE_SEQUENCER_348, 0x2fff }, + { WM8996_WRITE_SEQUENCER_352, 0x2fff }, + { WM8996_WRITE_SEQUENCER_356, 0x2fff }, + { WM8996_WRITE_SEQUENCER_360, 0x2fff }, + { WM8996_WRITE_SEQUENCER_364, 0x2fff }, + { WM8996_WRITE_SEQUENCER_368, 0x2fff }, + { WM8996_WRITE_SEQUENCER_372, 0x2fff }, + { WM8996_WRITE_SEQUENCER_376, 0x2fff }, + { WM8996_WRITE_SEQUENCER_380, 0x2fff }, + { WM8996_WRITE_SEQUENCER_384, 0x60 }, + { WM8996_WRITE_SEQUENCER_386, 0x601 }, + { WM8996_WRITE_SEQUENCER_388, 0x61 }, + { WM8996_WRITE_SEQUENCER_390, 0x601 }, + { WM8996_WRITE_SEQUENCER_392, 0x50 }, + { WM8996_WRITE_SEQUENCER_394, 0x300 }, + { WM8996_WRITE_SEQUENCER_396, 0x1 }, + { WM8996_WRITE_SEQUENCER_398, 0x304 }, + { WM8996_WRITE_SEQUENCER_400, 0x40 }, + { WM8996_WRITE_SEQUENCER_402, 0xf }, + { WM8996_WRITE_SEQUENCER_404, 0x1 }, + { WM8996_WRITE_SEQUENCER_407, 0x100 }, }; static const DECLARE_TLV_DB_SCALE(inpga_tlv, 0, 100, 0); @@ -1413,8 +1482,7 @@ static const struct snd_soc_dapm_route wm8996_dapm_routes[] = { { "SPKDAT", NULL, "SPKR PGA" }, }; -static int wm8996_readable_register(struct snd_soc_codec *codec, - unsigned int reg) +static bool wm8996_readable_register(struct device *dev, unsigned int reg) { /* Due to the sparseness of the register map the compiler * output from an explicit switch statement ends up being much @@ -1621,8 +1689,7 @@ static int wm8996_readable_register(struct snd_soc_codec *codec, } } -static int wm8996_volatile_register(struct snd_soc_codec *codec, - unsigned int reg) +static bool wm8996_volatile_register(struct device *dev, unsigned int reg) { switch (reg) { case WM8996_SOFTWARE_RESET: @@ -1723,13 +1790,13 @@ static int wm8996_set_bias_level(struct snd_soc_codec *codec, msleep(5); } - codec->cache_only = false; - snd_soc_cache_sync(codec); + regcache_cache_only(codec->control_data, false); + regcache_sync(codec->control_data); } break; case SND_SOC_BIAS_OFF: - codec->cache_only = true; + regcache_cache_only(codec->control_data, true); if (wm8996->pdata.ldo_ena >= 0) gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), @@ -2692,6 +2759,18 @@ static void wm8996_retune_mobile_pdata(struct snd_soc_codec *codec) "Failed to add ReTune Mobile controls: %d\n", ret); } +static const struct regmap_config wm8996_regmap = { + .reg_bits = 16, + .val_bits = 16, + + .max_register = WM8996_MAX_REGISTER, + .reg_defaults = wm8996_reg, + .num_reg_defaults = ARRAY_SIZE(wm8996_reg), + .volatile_reg = wm8996_volatile_register, + .readable_reg = wm8996_readable_register, + .cache_type = REGCACHE_RBTREE, +}; + static int wm8996_probe(struct snd_soc_codec *codec) { int ret; @@ -2707,10 +2786,17 @@ static int wm8996_probe(struct snd_soc_codec *codec) dapm->idle_bias_off = true; - ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_I2C); + codec->control_data = regmap_init_i2c(i2c, &wm8996_regmap); + if (IS_ERR(codec->control_data)) { + ret = PTR_ERR(codec->control_data); + dev_err(codec->dev, "regmap_init() failed: %d\n", ret); + goto err; + } + + ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); if (ret != 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); - goto err; + goto err_regmap; } for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) @@ -2720,7 +2806,7 @@ static int wm8996_probe(struct snd_soc_codec *codec) wm8996->supplies); if (ret != 0) { dev_err(codec->dev, "Failed to request supplies: %d\n", ret); - goto err; + goto err_regmap; } wm8996->disable_nb[0].notifier_call = wm8996_regulator_event_0; @@ -2788,7 +2874,7 @@ static int wm8996_probe(struct snd_soc_codec *codec) } } - codec->cache_only = true; + regcache_cache_only(codec->control_data, true); /* Apply platform data settings */ snd_soc_update_bits(codec, WM8996_LINE_INPUT_CONTROL, @@ -2996,6 +3082,8 @@ err_cpvdd: regulator_put(wm8996->cpvdd); err_get: regulator_bulk_free(ARRAY_SIZE(wm8996->supplies), wm8996->supplies); +err_regmap: + regmap_exit(codec->control_data); err: return ret; } @@ -3019,6 +3107,7 @@ static int wm8996_remove(struct snd_soc_codec *codec) &wm8996->disable_nb[i]); regulator_put(wm8996->cpvdd); regulator_bulk_free(ARRAY_SIZE(wm8996->supplies), wm8996->supplies); + regmap_exit(codec->control_data); return 0; } @@ -3028,12 +3117,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8996 = { .remove = wm8996_remove, .set_bias_level = wm8996_set_bias_level, .seq_notifier = wm8996_seq_notifier, - .reg_cache_size = WM8996_MAX_REGISTER + 1, - .reg_word_size = sizeof(u16), - .reg_cache_default = wm8996_reg, - .volatile_register = wm8996_volatile_register, - .readable_register = wm8996_readable_register, - .compress_type = SND_SOC_RBTREE_COMPRESSION, .controls = wm8996_snd_controls, .num_controls = ARRAY_SIZE(wm8996_snd_controls), .dapm_widgets = wm8996_dapm_widgets, -- cgit v1.1 From ee5f387226d13535f41bda0e8a2cf3843fc4c080 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 19 Sep 2011 19:51:07 +0100 Subject: ASoC: Move most WM8996 resource acquisition to I2C probe Now that the WM8996 driver is using the regmap API for register I/O we no longer need the ASoC card to be active in order to interact with the chip. In order to be more idiomatic for Linux move most of the existing probe() function out into the I2C probe() function prior to registration with ASoC. The IRQ and GPIO init will be moved separately as these are slightly more involved. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8996.c | 183 ++++++++++++++++++++++++---------------------- 1 file changed, 96 insertions(+), 87 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 5671fd3..cb9709a 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c @@ -50,6 +50,7 @@ static const char *wm8996_supply_names[WM8996_NUM_SUPPLIES] = { }; struct wm8996_priv { + struct regmap *regmap; struct snd_soc_codec *codec; int ldo1ena; @@ -106,7 +107,7 @@ static int wm8996_regulator_event_##n(struct notifier_block *nb, \ struct wm8996_priv *wm8996 = container_of(nb, struct wm8996_priv, \ disable_nb[n]); \ if (event & REGULATOR_EVENT_DISABLE) { \ - wm8996->codec->cache_sync = 1; \ + regcache_cache_only(wm8996->regmap, true); \ } \ return 0; \ } @@ -1713,9 +1714,15 @@ static bool wm8996_volatile_register(struct device *dev, unsigned int reg) } } -static int wm8996_reset(struct snd_soc_codec *codec) +static int wm8996_reset(struct wm8996_priv *wm8996) { - return snd_soc_write(codec, WM8996_SOFTWARE_RESET, 0x8915); + if (wm8996->pdata.ldo_ena > 0) { + gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); + return 0; + } else { + return regmap_write(wm8996->regmap, WM8996_SOFTWARE_RESET, + 0x8915); + } } static const int bclk_divs[] = { @@ -2786,40 +2793,18 @@ static int wm8996_probe(struct snd_soc_codec *codec) dapm->idle_bias_off = true; - codec->control_data = regmap_init_i2c(i2c, &wm8996_regmap); - if (IS_ERR(codec->control_data)) { - ret = PTR_ERR(codec->control_data); - dev_err(codec->dev, "regmap_init() failed: %d\n", ret); - goto err; - } + codec->control_data = wm8996->regmap; ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); if (ret != 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); - goto err_regmap; - } - - for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) - wm8996->supplies[i].supply = wm8996_supply_names[i]; - - ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8996->supplies), - wm8996->supplies); - if (ret != 0) { - dev_err(codec->dev, "Failed to request supplies: %d\n", ret); - goto err_regmap; + goto err; } wm8996->disable_nb[0].notifier_call = wm8996_regulator_event_0; wm8996->disable_nb[1].notifier_call = wm8996_regulator_event_1; wm8996->disable_nb[2].notifier_call = wm8996_regulator_event_2; - wm8996->cpvdd = regulator_get(&i2c->dev, "CPVDD"); - if (IS_ERR(wm8996->cpvdd)) { - ret = PTR_ERR(wm8996->cpvdd); - dev_err(&i2c->dev, "Failed to get CPVDD: %d\n", ret); - goto err_get; - } - /* This should really be moved into the regulator core */ for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) { ret = regulator_register_notifier(wm8996->supplies[i].consumer, @@ -2831,49 +2816,6 @@ static int wm8996_probe(struct snd_soc_codec *codec) } } - ret = regulator_bulk_enable(ARRAY_SIZE(wm8996->supplies), - wm8996->supplies); - if (ret != 0) { - dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); - goto err_cpvdd; - } - - if (wm8996->pdata.ldo_ena >= 0) { - gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 1); - msleep(5); - } - - ret = snd_soc_read(codec, WM8996_SOFTWARE_RESET); - if (ret < 0) { - dev_err(codec->dev, "Failed to read ID register: %d\n", ret); - goto err_enable; - } - if (ret != 0x8915) { - dev_err(codec->dev, "Device is not a WM8996, ID %x\n", ret); - ret = -EINVAL; - goto err_enable; - } - - ret = snd_soc_read(codec, WM8996_CHIP_REVISION); - if (ret < 0) { - dev_err(codec->dev, "Failed to read device revision: %d\n", - ret); - goto err_enable; - } - - dev_info(codec->dev, "revision %c\n", - (ret & WM8996_CHIP_REV_MASK) + 'A'); - - if (wm8996->pdata.ldo_ena >= 0) { - gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); - } else { - ret = wm8996_reset(codec); - if (ret < 0) { - dev_err(codec->dev, "Failed to issue reset\n"); - goto err_enable; - } - } - regcache_cache_only(codec->control_data, true); /* Apply platform data settings */ @@ -3032,8 +2974,6 @@ static int wm8996_probe(struct snd_soc_codec *codec) WM8996_AIF2TX_LRCLK_MODE, WM8996_AIF2TX_LRCLK_MODE); - regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies); - wm8996_init_gpio(codec); if (i2c->irq) { @@ -3073,17 +3013,6 @@ static int wm8996_probe(struct snd_soc_codec *codec) return 0; -err_enable: - if (wm8996->pdata.ldo_ena >= 0) - gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); - - regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies); -err_cpvdd: - regulator_put(wm8996->cpvdd); -err_get: - regulator_bulk_free(ARRAY_SIZE(wm8996->supplies), wm8996->supplies); -err_regmap: - regmap_exit(codec->control_data); err: return ret; } @@ -3107,7 +3036,6 @@ static int wm8996_remove(struct snd_soc_codec *codec) &wm8996->disable_nb[i]); regulator_put(wm8996->cpvdd); regulator_bulk_free(ARRAY_SIZE(wm8996->supplies), wm8996->supplies); - regmap_exit(codec->control_data); return 0; } @@ -3181,7 +3109,8 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct wm8996_priv *wm8996; - int ret; + int ret, i; + unsigned int reg; wm8996 = kzalloc(sizeof(struct wm8996_priv), GFP_KERNEL); if (wm8996 == NULL) @@ -3203,14 +3132,89 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c, } } + for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) + wm8996->supplies[i].supply = wm8996_supply_names[i]; + + ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8996->supplies), + wm8996->supplies); + if (ret != 0) { + dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); + goto err_gpio; + } + + wm8996->cpvdd = regulator_get(&i2c->dev, "CPVDD"); + if (IS_ERR(wm8996->cpvdd)) { + ret = PTR_ERR(wm8996->cpvdd); + dev_err(&i2c->dev, "Failed to get CPVDD: %d\n", ret); + goto err_get; + } + + ret = regulator_bulk_enable(ARRAY_SIZE(wm8996->supplies), + wm8996->supplies); + if (ret != 0) { + dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret); + goto err_cpvdd; + } + + if (wm8996->pdata.ldo_ena > 0) { + gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 1); + msleep(5); + } + + wm8996->regmap = regmap_init_i2c(i2c, &wm8996_regmap); + if (IS_ERR(wm8996->regmap)) { + ret = PTR_ERR(wm8996->regmap); + dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret); + goto err_enable; + } + + ret = regmap_read(wm8996->regmap, WM8996_SOFTWARE_RESET, ®); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to read ID register: %d\n", ret); + goto err_regmap; + } + if (reg != 0x8915) { + dev_err(&i2c->dev, "Device is not a WM8996, ID %x\n", ret); + ret = -EINVAL; + goto err_regmap; + } + + ret = regmap_read(wm8996->regmap, WM8996_CHIP_REVISION, ®); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to read device revision: %d\n", + ret); + goto err_regmap; + } + + dev_info(&i2c->dev, "revision %c\n", + (reg & WM8996_CHIP_REV_MASK) + 'A'); + + regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies); + + ret = wm8996_reset(wm8996); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to issue reset\n"); + goto err_regmap; + } + ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8996, wm8996_dai, ARRAY_SIZE(wm8996_dai)); if (ret < 0) - goto err_gpio; + goto err_regmap; return ret; +err_regmap: + regmap_exit(wm8996->regmap); +err_enable: + if (wm8996->pdata.ldo_ena > 0) + gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); + regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies); +err_cpvdd: + regulator_put(wm8996->cpvdd); +err_get: + regulator_bulk_free(ARRAY_SIZE(wm8996->supplies), wm8996->supplies); err_gpio: if (wm8996->pdata.ldo_ena > 0) gpio_free(wm8996->pdata.ldo_ena); @@ -3225,8 +3229,13 @@ static __devexit int wm8996_i2c_remove(struct i2c_client *client) struct wm8996_priv *wm8996 = i2c_get_clientdata(client); snd_soc_unregister_codec(&client->dev); - if (wm8996->pdata.ldo_ena > 0) + regulator_put(wm8996->cpvdd); + regulator_bulk_free(ARRAY_SIZE(wm8996->supplies), wm8996->supplies); + regmap_exit(wm8996->regmap); + if (wm8996->pdata.ldo_ena > 0) { + gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); gpio_free(wm8996->pdata.ldo_ena); + } kfree(wm8996); return 0; } -- cgit v1.1 From b2d1e23373fde66d5532ffdfd0f1e650174b83f6 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 19 Sep 2011 23:04:06 +0100 Subject: ASoC: Convert WM8996 gpiolib to regmap Actually pretty straightforward. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8996.c | 56 +++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 29 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index cb9709a..fd5bb1a 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c @@ -50,6 +50,7 @@ static const char *wm8996_supply_names[WM8996_NUM_SUPPLIES] = { }; struct wm8996_priv { + struct device *dev; struct regmap *regmap; struct snd_soc_codec *codec; @@ -2325,48 +2326,45 @@ static inline struct wm8996_priv *gpio_to_wm8996(struct gpio_chip *chip) static void wm8996_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { struct wm8996_priv *wm8996 = gpio_to_wm8996(chip); - struct snd_soc_codec *codec = wm8996->codec; - snd_soc_update_bits(codec, WM8996_GPIO_1 + offset, - WM8996_GP1_LVL, !!value << WM8996_GP1_LVL_SHIFT); + regmap_update_bits(wm8996->regmap, WM8996_GPIO_1 + offset, + WM8996_GP1_LVL, !!value << WM8996_GP1_LVL_SHIFT); } static int wm8996_gpio_direction_out(struct gpio_chip *chip, unsigned offset, int value) { struct wm8996_priv *wm8996 = gpio_to_wm8996(chip); - struct snd_soc_codec *codec = wm8996->codec; int val; val = (1 << WM8996_GP1_FN_SHIFT) | (!!value << WM8996_GP1_LVL_SHIFT); - return snd_soc_update_bits(codec, WM8996_GPIO_1 + offset, - WM8996_GP1_FN_MASK | WM8996_GP1_DIR | - WM8996_GP1_LVL, val); + return regmap_update_bits(wm8996->regmap, WM8996_GPIO_1 + offset, + WM8996_GP1_FN_MASK | WM8996_GP1_DIR | + WM8996_GP1_LVL, val); } static int wm8996_gpio_get(struct gpio_chip *chip, unsigned offset) { struct wm8996_priv *wm8996 = gpio_to_wm8996(chip); - struct snd_soc_codec *codec = wm8996->codec; + unsigned int reg; int ret; - ret = snd_soc_read(codec, WM8996_GPIO_1 + offset); + ret = regmap_read(wm8996->regmap, WM8996_GPIO_1 + offset, ®); if (ret < 0) return ret; - return (ret & WM8996_GP1_LVL) != 0; + return (reg & WM8996_GP1_LVL) != 0; } static int wm8996_gpio_direction_in(struct gpio_chip *chip, unsigned offset) { struct wm8996_priv *wm8996 = gpio_to_wm8996(chip); - struct snd_soc_codec *codec = wm8996->codec; - return snd_soc_update_bits(codec, WM8996_GPIO_1 + offset, - WM8996_GP1_FN_MASK | WM8996_GP1_DIR, - (1 << WM8996_GP1_FN_SHIFT) | - (1 << WM8996_GP1_DIR_SHIFT)); + return regmap_update_bits(wm8996->regmap, WM8996_GPIO_1 + offset, + WM8996_GP1_FN_MASK | WM8996_GP1_DIR, + (1 << WM8996_GP1_FN_SHIFT) | + (1 << WM8996_GP1_DIR_SHIFT)); } static struct gpio_chip wm8996_template_chip = { @@ -2379,14 +2377,13 @@ static struct gpio_chip wm8996_template_chip = { .can_sleep = 1, }; -static void wm8996_init_gpio(struct snd_soc_codec *codec) +static void wm8996_init_gpio(struct wm8996_priv *wm8996) { - struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); int ret; wm8996->gpio_chip = wm8996_template_chip; wm8996->gpio_chip.ngpio = 5; - wm8996->gpio_chip.dev = codec->dev; + wm8996->gpio_chip.dev = wm8996->dev; if (wm8996->pdata.gpio_base) wm8996->gpio_chip.base = wm8996->pdata.gpio_base; @@ -2395,24 +2392,23 @@ static void wm8996_init_gpio(struct snd_soc_codec *codec) ret = gpiochip_add(&wm8996->gpio_chip); if (ret != 0) - dev_err(codec->dev, "Failed to add GPIOs: %d\n", ret); + dev_err(wm8996->dev, "Failed to add GPIOs: %d\n", ret); } -static void wm8996_free_gpio(struct snd_soc_codec *codec) +static void wm8996_free_gpio(struct wm8996_priv *wm8996) { - struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); int ret; ret = gpiochip_remove(&wm8996->gpio_chip); if (ret != 0) - dev_err(codec->dev, "Failed to remove GPIOs: %d\n", ret); + dev_err(wm8996->dev, "Failed to remove GPIOs: %d\n", ret); } #else -static void wm8996_init_gpio(struct snd_soc_codec *codec) +static void wm8996_init_gpio(struct wm8996_priv *wm8996) { } -static void wm8996_free_gpio(struct snd_soc_codec *codec) +static void wm8996_free_gpio(struct wm8996_priv *wm8996) { } #endif @@ -2974,8 +2970,6 @@ static int wm8996_probe(struct snd_soc_codec *codec) WM8996_AIF2TX_LRCLK_MODE, WM8996_AIF2TX_LRCLK_MODE); - wm8996_init_gpio(codec); - if (i2c->irq) { if (wm8996->pdata.irq_flags) irq_flags = wm8996->pdata.irq_flags; @@ -3029,8 +3023,6 @@ static int wm8996_remove(struct snd_soc_codec *codec) if (i2c->irq) free_irq(i2c->irq, codec); - wm8996_free_gpio(codec); - for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) regulator_unregister_notifier(wm8996->supplies[i].consumer, &wm8996->disable_nb[i]); @@ -3117,6 +3109,7 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c, return -ENOMEM; i2c_set_clientdata(i2c, wm8996); + wm8996->dev = &i2c->dev; if (dev_get_platdata(&i2c->dev)) memcpy(&wm8996->pdata, dev_get_platdata(&i2c->dev), @@ -3197,14 +3190,18 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c, goto err_regmap; } + wm8996_init_gpio(wm8996); + ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8996, wm8996_dai, ARRAY_SIZE(wm8996_dai)); if (ret < 0) - goto err_regmap; + goto err_gpiolib; return ret; +err_gpiolib: + wm8996_free_gpio(wm8996); err_regmap: regmap_exit(wm8996->regmap); err_enable: @@ -3229,6 +3226,7 @@ static __devexit int wm8996_i2c_remove(struct i2c_client *client) struct wm8996_priv *wm8996 = i2c_get_clientdata(client); snd_soc_unregister_codec(&client->dev); + wm8996_free_gpio(wm8996); regulator_put(wm8996->cpvdd); regulator_bulk_free(ARRAY_SIZE(wm8996->supplies), wm8996->supplies); regmap_exit(wm8996->regmap); -- cgit v1.1 From 7b16f5601295d0dfd0d48753b9253d41957587fe Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 1 Nov 2011 19:32:25 +0000 Subject: ASoC: Convert WM8962 to direct regmap usage This initial conversion just moves the register init, regulator acquisition and device verification out to the I2C probe(). Movement of other parts of the driver like the GPIO and beep generation code will follow. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8962.c | 1593 +++++++++++++++++++++++---------------------- 1 file changed, 802 insertions(+), 791 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 3fc9d2f..6d82b35 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -50,6 +51,7 @@ static const char *wm8962_supply_names[WM8962_NUM_SUPPLIES] = { /* codec private data */ struct wm8962_priv { + struct regmap *regmap; struct snd_soc_codec *codec; int sysclk; @@ -95,7 +97,7 @@ static int wm8962_regulator_event_##n(struct notifier_block *nb, \ struct wm8962_priv *wm8962 = container_of(nb, struct wm8962_priv, \ disable_nb[n]); \ if (event & REGULATOR_EVENT_DISABLE) { \ - wm8962->codec->cache_sync = 1; \ + regcache_cache_only(wm8962->regmap, true); \ } \ return 0; \ } @@ -109,691 +111,691 @@ WM8962_REGULATOR_EVENT(5) WM8962_REGULATOR_EVENT(6) WM8962_REGULATOR_EVENT(7) -static const u16 wm8962_reg[WM8962_MAX_REGISTER + 1] = { - [0] = 0x009F, /* R0 - Left Input volume */ - [1] = 0x049F, /* R1 - Right Input volume */ - [2] = 0x0000, /* R2 - HPOUTL volume */ - [3] = 0x0000, /* R3 - HPOUTR volume */ - [4] = 0x0020, /* R4 - Clocking1 */ - [5] = 0x0018, /* R5 - ADC & DAC Control 1 */ - [6] = 0x2008, /* R6 - ADC & DAC Control 2 */ - [7] = 0x000A, /* R7 - Audio Interface 0 */ - [8] = 0x01E4, /* R8 - Clocking2 */ - [9] = 0x0300, /* R9 - Audio Interface 1 */ - [10] = 0x00C0, /* R10 - Left DAC volume */ - [11] = 0x00C0, /* R11 - Right DAC volume */ - - [14] = 0x0040, /* R14 - Audio Interface 2 */ - [15] = 0x6243, /* R15 - Software Reset */ - - [17] = 0x007B, /* R17 - ALC1 */ - [18] = 0x0000, /* R18 - ALC2 */ - [19] = 0x1C32, /* R19 - ALC3 */ - [20] = 0x3200, /* R20 - Noise Gate */ - [21] = 0x00C0, /* R21 - Left ADC volume */ - [22] = 0x00C0, /* R22 - Right ADC volume */ - [23] = 0x0160, /* R23 - Additional control(1) */ - [24] = 0x0000, /* R24 - Additional control(2) */ - [25] = 0x0000, /* R25 - Pwr Mgmt (1) */ - [26] = 0x0000, /* R26 - Pwr Mgmt (2) */ - [27] = 0x0010, /* R27 - Additional Control (3) */ - [28] = 0x0000, /* R28 - Anti-pop */ - - [30] = 0x005E, /* R30 - Clocking 3 */ - [31] = 0x0000, /* R31 - Input mixer control (1) */ - [32] = 0x0145, /* R32 - Left input mixer volume */ - [33] = 0x0145, /* R33 - Right input mixer volume */ - [34] = 0x0009, /* R34 - Input mixer control (2) */ - [35] = 0x0003, /* R35 - Input bias control */ - [37] = 0x0008, /* R37 - Left input PGA control */ - [38] = 0x0008, /* R38 - Right input PGA control */ - - [40] = 0x0000, /* R40 - SPKOUTL volume */ - [41] = 0x0000, /* R41 - SPKOUTR volume */ - - [47] = 0x0000, /* R47 - Thermal Shutdown Status */ - [48] = 0x8027, /* R48 - Additional Control (4) */ - [49] = 0x0010, /* R49 - Class D Control 1 */ - - [51] = 0x0003, /* R51 - Class D Control 2 */ - - [56] = 0x0506, /* R56 - Clocking 4 */ - [57] = 0x0000, /* R57 - DAC DSP Mixing (1) */ - [58] = 0x0000, /* R58 - DAC DSP Mixing (2) */ - - [60] = 0x0300, /* R60 - DC Servo 0 */ - [61] = 0x0300, /* R61 - DC Servo 1 */ - - [64] = 0x0810, /* R64 - DC Servo 4 */ - - [66] = 0x0000, /* R66 - DC Servo 6 */ - - [68] = 0x001B, /* R68 - Analogue PGA Bias */ - [69] = 0x0000, /* R69 - Analogue HP 0 */ - - [71] = 0x01FB, /* R71 - Analogue HP 2 */ - [72] = 0x0000, /* R72 - Charge Pump 1 */ - - [82] = 0x0004, /* R82 - Charge Pump B */ - - [87] = 0x0000, /* R87 - Write Sequencer Control 1 */ - - [90] = 0x0000, /* R90 - Write Sequencer Control 2 */ - - [93] = 0x0000, /* R93 - Write Sequencer Control 3 */ - [94] = 0x0000, /* R94 - Control Interface */ - - [99] = 0x0000, /* R99 - Mixer Enables */ - [100] = 0x0000, /* R100 - Headphone Mixer (1) */ - [101] = 0x0000, /* R101 - Headphone Mixer (2) */ - [102] = 0x013F, /* R102 - Headphone Mixer (3) */ - [103] = 0x013F, /* R103 - Headphone Mixer (4) */ - - [105] = 0x0000, /* R105 - Speaker Mixer (1) */ - [106] = 0x0000, /* R106 - Speaker Mixer (2) */ - [107] = 0x013F, /* R107 - Speaker Mixer (3) */ - [108] = 0x013F, /* R108 - Speaker Mixer (4) */ - [109] = 0x0003, /* R109 - Speaker Mixer (5) */ - [110] = 0x0002, /* R110 - Beep Generator (1) */ - - [115] = 0x0006, /* R115 - Oscillator Trim (3) */ - [116] = 0x0026, /* R116 - Oscillator Trim (4) */ - - [119] = 0x0000, /* R119 - Oscillator Trim (7) */ - - [124] = 0x0011, /* R124 - Analogue Clocking1 */ - [125] = 0x004B, /* R125 - Analogue Clocking2 */ - [126] = 0x000D, /* R126 - Analogue Clocking3 */ - [127] = 0x0000, /* R127 - PLL Software Reset */ - - [129] = 0x0000, /* R129 - PLL2 */ - - [131] = 0x0000, /* R131 - PLL 4 */ - - [136] = 0x0067, /* R136 - PLL 9 */ - [137] = 0x001C, /* R137 - PLL 10 */ - [138] = 0x0071, /* R138 - PLL 11 */ - [139] = 0x00C7, /* R139 - PLL 12 */ - [140] = 0x0067, /* R140 - PLL 13 */ - [141] = 0x0048, /* R141 - PLL 14 */ - [142] = 0x0022, /* R142 - PLL 15 */ - [143] = 0x0097, /* R143 - PLL 16 */ - - [155] = 0x000C, /* R155 - FLL Control (1) */ - [156] = 0x0039, /* R156 - FLL Control (2) */ - [157] = 0x0180, /* R157 - FLL Control (3) */ - - [159] = 0x0032, /* R159 - FLL Control (5) */ - [160] = 0x0018, /* R160 - FLL Control (6) */ - [161] = 0x007D, /* R161 - FLL Control (7) */ - [162] = 0x0008, /* R162 - FLL Control (8) */ - - [252] = 0x0005, /* R252 - General test 1 */ - - [256] = 0x0000, /* R256 - DF1 */ - [257] = 0x0000, /* R257 - DF2 */ - [258] = 0x0000, /* R258 - DF3 */ - [259] = 0x0000, /* R259 - DF4 */ - [260] = 0x0000, /* R260 - DF5 */ - [261] = 0x0000, /* R261 - DF6 */ - [262] = 0x0000, /* R262 - DF7 */ - - [264] = 0x0000, /* R264 - LHPF1 */ - [265] = 0x0000, /* R265 - LHPF2 */ - - [268] = 0x0000, /* R268 - THREED1 */ - [269] = 0x0000, /* R269 - THREED2 */ - [270] = 0x0000, /* R270 - THREED3 */ - [271] = 0x0000, /* R271 - THREED4 */ - - [276] = 0x000C, /* R276 - DRC 1 */ - [277] = 0x0925, /* R277 - DRC 2 */ - [278] = 0x0000, /* R278 - DRC 3 */ - [279] = 0x0000, /* R279 - DRC 4 */ - [280] = 0x0000, /* R280 - DRC 5 */ - - [285] = 0x0000, /* R285 - Tloopback */ - - [335] = 0x0004, /* R335 - EQ1 */ - [336] = 0x6318, /* R336 - EQ2 */ - [337] = 0x6300, /* R337 - EQ3 */ - [338] = 0x0FCA, /* R338 - EQ4 */ - [339] = 0x0400, /* R339 - EQ5 */ - [340] = 0x00D8, /* R340 - EQ6 */ - [341] = 0x1EB5, /* R341 - EQ7 */ - [342] = 0xF145, /* R342 - EQ8 */ - [343] = 0x0B75, /* R343 - EQ9 */ - [344] = 0x01C5, /* R344 - EQ10 */ - [345] = 0x1C58, /* R345 - EQ11 */ - [346] = 0xF373, /* R346 - EQ12 */ - [347] = 0x0A54, /* R347 - EQ13 */ - [348] = 0x0558, /* R348 - EQ14 */ - [349] = 0x168E, /* R349 - EQ15 */ - [350] = 0xF829, /* R350 - EQ16 */ - [351] = 0x07AD, /* R351 - EQ17 */ - [352] = 0x1103, /* R352 - EQ18 */ - [353] = 0x0564, /* R353 - EQ19 */ - [354] = 0x0559, /* R354 - EQ20 */ - [355] = 0x4000, /* R355 - EQ21 */ - [356] = 0x6318, /* R356 - EQ22 */ - [357] = 0x6300, /* R357 - EQ23 */ - [358] = 0x0FCA, /* R358 - EQ24 */ - [359] = 0x0400, /* R359 - EQ25 */ - [360] = 0x00D8, /* R360 - EQ26 */ - [361] = 0x1EB5, /* R361 - EQ27 */ - [362] = 0xF145, /* R362 - EQ28 */ - [363] = 0x0B75, /* R363 - EQ29 */ - [364] = 0x01C5, /* R364 - EQ30 */ - [365] = 0x1C58, /* R365 - EQ31 */ - [366] = 0xF373, /* R366 - EQ32 */ - [367] = 0x0A54, /* R367 - EQ33 */ - [368] = 0x0558, /* R368 - EQ34 */ - [369] = 0x168E, /* R369 - EQ35 */ - [370] = 0xF829, /* R370 - EQ36 */ - [371] = 0x07AD, /* R371 - EQ37 */ - [372] = 0x1103, /* R372 - EQ38 */ - [373] = 0x0564, /* R373 - EQ39 */ - [374] = 0x0559, /* R374 - EQ40 */ - [375] = 0x4000, /* R375 - EQ41 */ - - [513] = 0x0000, /* R513 - GPIO 2 */ - [514] = 0x0000, /* R514 - GPIO 3 */ - - [516] = 0x8100, /* R516 - GPIO 5 */ - [517] = 0x8100, /* R517 - GPIO 6 */ - - [560] = 0x0000, /* R560 - Interrupt Status 1 */ - [561] = 0x0000, /* R561 - Interrupt Status 2 */ - - [568] = 0x0030, /* R568 - Interrupt Status 1 Mask */ - [569] = 0xFFED, /* R569 - Interrupt Status 2 Mask */ - - [576] = 0x0000, /* R576 - Interrupt Control */ - - [584] = 0x002D, /* R584 - IRQ Debounce */ - - [586] = 0x0000, /* R586 - MICINT Source Pol */ - - [768] = 0x1C00, /* R768 - DSP2 Power Management */ - - [1037] = 0x0000, /* R1037 - DSP2_ExecControl */ - - [8192] = 0x0000, /* R8192 - DSP2 Instruction RAM 0 */ - - [9216] = 0x0030, /* R9216 - DSP2 Address RAM 2 */ - [9217] = 0x0000, /* R9217 - DSP2 Address RAM 1 */ - [9218] = 0x0000, /* R9218 - DSP2 Address RAM 0 */ - - [12288] = 0x0000, /* R12288 - DSP2 Data1 RAM 1 */ - [12289] = 0x0000, /* R12289 - DSP2 Data1 RAM 0 */ - - [13312] = 0x0000, /* R13312 - DSP2 Data2 RAM 1 */ - [13313] = 0x0000, /* R13313 - DSP2 Data2 RAM 0 */ - - [14336] = 0x0000, /* R14336 - DSP2 Data3 RAM 1 */ - [14337] = 0x0000, /* R14337 - DSP2 Data3 RAM 0 */ - - [15360] = 0x000A, /* R15360 - DSP2 Coeff RAM 0 */ - - [16384] = 0x0000, /* R16384 - RETUNEADC_SHARED_COEFF_1 */ - [16385] = 0x0000, /* R16385 - RETUNEADC_SHARED_COEFF_0 */ - [16386] = 0x0000, /* R16386 - RETUNEDAC_SHARED_COEFF_1 */ - [16387] = 0x0000, /* R16387 - RETUNEDAC_SHARED_COEFF_0 */ - [16388] = 0x0000, /* R16388 - SOUNDSTAGE_ENABLES_1 */ - [16389] = 0x0000, /* R16389 - SOUNDSTAGE_ENABLES_0 */ - - [16896] = 0x0002, /* R16896 - HDBASS_AI_1 */ - [16897] = 0xBD12, /* R16897 - HDBASS_AI_0 */ - [16898] = 0x007C, /* R16898 - HDBASS_AR_1 */ - [16899] = 0x586C, /* R16899 - HDBASS_AR_0 */ - [16900] = 0x0053, /* R16900 - HDBASS_B_1 */ - [16901] = 0x8121, /* R16901 - HDBASS_B_0 */ - [16902] = 0x003F, /* R16902 - HDBASS_K_1 */ - [16903] = 0x8BD8, /* R16903 - HDBASS_K_0 */ - [16904] = 0x0032, /* R16904 - HDBASS_N1_1 */ - [16905] = 0xF52D, /* R16905 - HDBASS_N1_0 */ - [16906] = 0x0065, /* R16906 - HDBASS_N2_1 */ - [16907] = 0xAC8C, /* R16907 - HDBASS_N2_0 */ - [16908] = 0x006B, /* R16908 - HDBASS_N3_1 */ - [16909] = 0xE087, /* R16909 - HDBASS_N3_0 */ - [16910] = 0x0072, /* R16910 - HDBASS_N4_1 */ - [16911] = 0x1483, /* R16911 - HDBASS_N4_0 */ - [16912] = 0x0072, /* R16912 - HDBASS_N5_1 */ - [16913] = 0x1483, /* R16913 - HDBASS_N5_0 */ - [16914] = 0x0043, /* R16914 - HDBASS_X1_1 */ - [16915] = 0x3525, /* R16915 - HDBASS_X1_0 */ - [16916] = 0x0006, /* R16916 - HDBASS_X2_1 */ - [16917] = 0x6A4A, /* R16917 - HDBASS_X2_0 */ - [16918] = 0x0043, /* R16918 - HDBASS_X3_1 */ - [16919] = 0x6079, /* R16919 - HDBASS_X3_0 */ - [16920] = 0x0008, /* R16920 - HDBASS_ATK_1 */ - [16921] = 0x0000, /* R16921 - HDBASS_ATK_0 */ - [16922] = 0x0001, /* R16922 - HDBASS_DCY_1 */ - [16923] = 0x0000, /* R16923 - HDBASS_DCY_0 */ - [16924] = 0x0059, /* R16924 - HDBASS_PG_1 */ - [16925] = 0x999A, /* R16925 - HDBASS_PG_0 */ - - [17048] = 0x0083, /* R17408 - HPF_C_1 */ - [17049] = 0x98AD, /* R17409 - HPF_C_0 */ - - [17920] = 0x007F, /* R17920 - ADCL_RETUNE_C1_1 */ - [17921] = 0xFFFF, /* R17921 - ADCL_RETUNE_C1_0 */ - [17922] = 0x0000, /* R17922 - ADCL_RETUNE_C2_1 */ - [17923] = 0x0000, /* R17923 - ADCL_RETUNE_C2_0 */ - [17924] = 0x0000, /* R17924 - ADCL_RETUNE_C3_1 */ - [17925] = 0x0000, /* R17925 - ADCL_RETUNE_C3_0 */ - [17926] = 0x0000, /* R17926 - ADCL_RETUNE_C4_1 */ - [17927] = 0x0000, /* R17927 - ADCL_RETUNE_C4_0 */ - [17928] = 0x0000, /* R17928 - ADCL_RETUNE_C5_1 */ - [17929] = 0x0000, /* R17929 - ADCL_RETUNE_C5_0 */ - [17930] = 0x0000, /* R17930 - ADCL_RETUNE_C6_1 */ - [17931] = 0x0000, /* R17931 - ADCL_RETUNE_C6_0 */ - [17932] = 0x0000, /* R17932 - ADCL_RETUNE_C7_1 */ - [17933] = 0x0000, /* R17933 - ADCL_RETUNE_C7_0 */ - [17934] = 0x0000, /* R17934 - ADCL_RETUNE_C8_1 */ - [17935] = 0x0000, /* R17935 - ADCL_RETUNE_C8_0 */ - [17936] = 0x0000, /* R17936 - ADCL_RETUNE_C9_1 */ - [17937] = 0x0000, /* R17937 - ADCL_RETUNE_C9_0 */ - [17938] = 0x0000, /* R17938 - ADCL_RETUNE_C10_1 */ - [17939] = 0x0000, /* R17939 - ADCL_RETUNE_C10_0 */ - [17940] = 0x0000, /* R17940 - ADCL_RETUNE_C11_1 */ - [17941] = 0x0000, /* R17941 - ADCL_RETUNE_C11_0 */ - [17942] = 0x0000, /* R17942 - ADCL_RETUNE_C12_1 */ - [17943] = 0x0000, /* R17943 - ADCL_RETUNE_C12_0 */ - [17944] = 0x0000, /* R17944 - ADCL_RETUNE_C13_1 */ - [17945] = 0x0000, /* R17945 - ADCL_RETUNE_C13_0 */ - [17946] = 0x0000, /* R17946 - ADCL_RETUNE_C14_1 */ - [17947] = 0x0000, /* R17947 - ADCL_RETUNE_C14_0 */ - [17948] = 0x0000, /* R17948 - ADCL_RETUNE_C15_1 */ - [17949] = 0x0000, /* R17949 - ADCL_RETUNE_C15_0 */ - [17950] = 0x0000, /* R17950 - ADCL_RETUNE_C16_1 */ - [17951] = 0x0000, /* R17951 - ADCL_RETUNE_C16_0 */ - [17952] = 0x0000, /* R17952 - ADCL_RETUNE_C17_1 */ - [17953] = 0x0000, /* R17953 - ADCL_RETUNE_C17_0 */ - [17954] = 0x0000, /* R17954 - ADCL_RETUNE_C18_1 */ - [17955] = 0x0000, /* R17955 - ADCL_RETUNE_C18_0 */ - [17956] = 0x0000, /* R17956 - ADCL_RETUNE_C19_1 */ - [17957] = 0x0000, /* R17957 - ADCL_RETUNE_C19_0 */ - [17958] = 0x0000, /* R17958 - ADCL_RETUNE_C20_1 */ - [17959] = 0x0000, /* R17959 - ADCL_RETUNE_C20_0 */ - [17960] = 0x0000, /* R17960 - ADCL_RETUNE_C21_1 */ - [17961] = 0x0000, /* R17961 - ADCL_RETUNE_C21_0 */ - [17962] = 0x0000, /* R17962 - ADCL_RETUNE_C22_1 */ - [17963] = 0x0000, /* R17963 - ADCL_RETUNE_C22_0 */ - [17964] = 0x0000, /* R17964 - ADCL_RETUNE_C23_1 */ - [17965] = 0x0000, /* R17965 - ADCL_RETUNE_C23_0 */ - [17966] = 0x0000, /* R17966 - ADCL_RETUNE_C24_1 */ - [17967] = 0x0000, /* R17967 - ADCL_RETUNE_C24_0 */ - [17968] = 0x0000, /* R17968 - ADCL_RETUNE_C25_1 */ - [17969] = 0x0000, /* R17969 - ADCL_RETUNE_C25_0 */ - [17970] = 0x0000, /* R17970 - ADCL_RETUNE_C26_1 */ - [17971] = 0x0000, /* R17971 - ADCL_RETUNE_C26_0 */ - [17972] = 0x0000, /* R17972 - ADCL_RETUNE_C27_1 */ - [17973] = 0x0000, /* R17973 - ADCL_RETUNE_C27_0 */ - [17974] = 0x0000, /* R17974 - ADCL_RETUNE_C28_1 */ - [17975] = 0x0000, /* R17975 - ADCL_RETUNE_C28_0 */ - [17976] = 0x0000, /* R17976 - ADCL_RETUNE_C29_1 */ - [17977] = 0x0000, /* R17977 - ADCL_RETUNE_C29_0 */ - [17978] = 0x0000, /* R17978 - ADCL_RETUNE_C30_1 */ - [17979] = 0x0000, /* R17979 - ADCL_RETUNE_C30_0 */ - [17980] = 0x0000, /* R17980 - ADCL_RETUNE_C31_1 */ - [17981] = 0x0000, /* R17981 - ADCL_RETUNE_C31_0 */ - [17982] = 0x0000, /* R17982 - ADCL_RETUNE_C32_1 */ - [17983] = 0x0000, /* R17983 - ADCL_RETUNE_C32_0 */ - - [18432] = 0x0020, /* R18432 - RETUNEADC_PG2_1 */ - [18433] = 0x0000, /* R18433 - RETUNEADC_PG2_0 */ - [18434] = 0x0040, /* R18434 - RETUNEADC_PG_1 */ - [18435] = 0x0000, /* R18435 - RETUNEADC_PG_0 */ - - [18944] = 0x007F, /* R18944 - ADCR_RETUNE_C1_1 */ - [18945] = 0xFFFF, /* R18945 - ADCR_RETUNE_C1_0 */ - [18946] = 0x0000, /* R18946 - ADCR_RETUNE_C2_1 */ - [18947] = 0x0000, /* R18947 - ADCR_RETUNE_C2_0 */ - [18948] = 0x0000, /* R18948 - ADCR_RETUNE_C3_1 */ - [18949] = 0x0000, /* R18949 - ADCR_RETUNE_C3_0 */ - [18950] = 0x0000, /* R18950 - ADCR_RETUNE_C4_1 */ - [18951] = 0x0000, /* R18951 - ADCR_RETUNE_C4_0 */ - [18952] = 0x0000, /* R18952 - ADCR_RETUNE_C5_1 */ - [18953] = 0x0000, /* R18953 - ADCR_RETUNE_C5_0 */ - [18954] = 0x0000, /* R18954 - ADCR_RETUNE_C6_1 */ - [18955] = 0x0000, /* R18955 - ADCR_RETUNE_C6_0 */ - [18956] = 0x0000, /* R18956 - ADCR_RETUNE_C7_1 */ - [18957] = 0x0000, /* R18957 - ADCR_RETUNE_C7_0 */ - [18958] = 0x0000, /* R18958 - ADCR_RETUNE_C8_1 */ - [18959] = 0x0000, /* R18959 - ADCR_RETUNE_C8_0 */ - [18960] = 0x0000, /* R18960 - ADCR_RETUNE_C9_1 */ - [18961] = 0x0000, /* R18961 - ADCR_RETUNE_C9_0 */ - [18962] = 0x0000, /* R18962 - ADCR_RETUNE_C10_1 */ - [18963] = 0x0000, /* R18963 - ADCR_RETUNE_C10_0 */ - [18964] = 0x0000, /* R18964 - ADCR_RETUNE_C11_1 */ - [18965] = 0x0000, /* R18965 - ADCR_RETUNE_C11_0 */ - [18966] = 0x0000, /* R18966 - ADCR_RETUNE_C12_1 */ - [18967] = 0x0000, /* R18967 - ADCR_RETUNE_C12_0 */ - [18968] = 0x0000, /* R18968 - ADCR_RETUNE_C13_1 */ - [18969] = 0x0000, /* R18969 - ADCR_RETUNE_C13_0 */ - [18970] = 0x0000, /* R18970 - ADCR_RETUNE_C14_1 */ - [18971] = 0x0000, /* R18971 - ADCR_RETUNE_C14_0 */ - [18972] = 0x0000, /* R18972 - ADCR_RETUNE_C15_1 */ - [18973] = 0x0000, /* R18973 - ADCR_RETUNE_C15_0 */ - [18974] = 0x0000, /* R18974 - ADCR_RETUNE_C16_1 */ - [18975] = 0x0000, /* R18975 - ADCR_RETUNE_C16_0 */ - [18976] = 0x0000, /* R18976 - ADCR_RETUNE_C17_1 */ - [18977] = 0x0000, /* R18977 - ADCR_RETUNE_C17_0 */ - [18978] = 0x0000, /* R18978 - ADCR_RETUNE_C18_1 */ - [18979] = 0x0000, /* R18979 - ADCR_RETUNE_C18_0 */ - [18980] = 0x0000, /* R18980 - ADCR_RETUNE_C19_1 */ - [18981] = 0x0000, /* R18981 - ADCR_RETUNE_C19_0 */ - [18982] = 0x0000, /* R18982 - ADCR_RETUNE_C20_1 */ - [18983] = 0x0000, /* R18983 - ADCR_RETUNE_C20_0 */ - [18984] = 0x0000, /* R18984 - ADCR_RETUNE_C21_1 */ - [18985] = 0x0000, /* R18985 - ADCR_RETUNE_C21_0 */ - [18986] = 0x0000, /* R18986 - ADCR_RETUNE_C22_1 */ - [18987] = 0x0000, /* R18987 - ADCR_RETUNE_C22_0 */ - [18988] = 0x0000, /* R18988 - ADCR_RETUNE_C23_1 */ - [18989] = 0x0000, /* R18989 - ADCR_RETUNE_C23_0 */ - [18990] = 0x0000, /* R18990 - ADCR_RETUNE_C24_1 */ - [18991] = 0x0000, /* R18991 - ADCR_RETUNE_C24_0 */ - [18992] = 0x0000, /* R18992 - ADCR_RETUNE_C25_1 */ - [18993] = 0x0000, /* R18993 - ADCR_RETUNE_C25_0 */ - [18994] = 0x0000, /* R18994 - ADCR_RETUNE_C26_1 */ - [18995] = 0x0000, /* R18995 - ADCR_RETUNE_C26_0 */ - [18996] = 0x0000, /* R18996 - ADCR_RETUNE_C27_1 */ - [18997] = 0x0000, /* R18997 - ADCR_RETUNE_C27_0 */ - [18998] = 0x0000, /* R18998 - ADCR_RETUNE_C28_1 */ - [18999] = 0x0000, /* R18999 - ADCR_RETUNE_C28_0 */ - [19000] = 0x0000, /* R19000 - ADCR_RETUNE_C29_1 */ - [19001] = 0x0000, /* R19001 - ADCR_RETUNE_C29_0 */ - [19002] = 0x0000, /* R19002 - ADCR_RETUNE_C30_1 */ - [19003] = 0x0000, /* R19003 - ADCR_RETUNE_C30_0 */ - [19004] = 0x0000, /* R19004 - ADCR_RETUNE_C31_1 */ - [19005] = 0x0000, /* R19005 - ADCR_RETUNE_C31_0 */ - [19006] = 0x0000, /* R19006 - ADCR_RETUNE_C32_1 */ - [19007] = 0x0000, /* R19007 - ADCR_RETUNE_C32_0 */ - - [19456] = 0x007F, /* R19456 - DACL_RETUNE_C1_1 */ - [19457] = 0xFFFF, /* R19457 - DACL_RETUNE_C1_0 */ - [19458] = 0x0000, /* R19458 - DACL_RETUNE_C2_1 */ - [19459] = 0x0000, /* R19459 - DACL_RETUNE_C2_0 */ - [19460] = 0x0000, /* R19460 - DACL_RETUNE_C3_1 */ - [19461] = 0x0000, /* R19461 - DACL_RETUNE_C3_0 */ - [19462] = 0x0000, /* R19462 - DACL_RETUNE_C4_1 */ - [19463] = 0x0000, /* R19463 - DACL_RETUNE_C4_0 */ - [19464] = 0x0000, /* R19464 - DACL_RETUNE_C5_1 */ - [19465] = 0x0000, /* R19465 - DACL_RETUNE_C5_0 */ - [19466] = 0x0000, /* R19466 - DACL_RETUNE_C6_1 */ - [19467] = 0x0000, /* R19467 - DACL_RETUNE_C6_0 */ - [19468] = 0x0000, /* R19468 - DACL_RETUNE_C7_1 */ - [19469] = 0x0000, /* R19469 - DACL_RETUNE_C7_0 */ - [19470] = 0x0000, /* R19470 - DACL_RETUNE_C8_1 */ - [19471] = 0x0000, /* R19471 - DACL_RETUNE_C8_0 */ - [19472] = 0x0000, /* R19472 - DACL_RETUNE_C9_1 */ - [19473] = 0x0000, /* R19473 - DACL_RETUNE_C9_0 */ - [19474] = 0x0000, /* R19474 - DACL_RETUNE_C10_1 */ - [19475] = 0x0000, /* R19475 - DACL_RETUNE_C10_0 */ - [19476] = 0x0000, /* R19476 - DACL_RETUNE_C11_1 */ - [19477] = 0x0000, /* R19477 - DACL_RETUNE_C11_0 */ - [19478] = 0x0000, /* R19478 - DACL_RETUNE_C12_1 */ - [19479] = 0x0000, /* R19479 - DACL_RETUNE_C12_0 */ - [19480] = 0x0000, /* R19480 - DACL_RETUNE_C13_1 */ - [19481] = 0x0000, /* R19481 - DACL_RETUNE_C13_0 */ - [19482] = 0x0000, /* R19482 - DACL_RETUNE_C14_1 */ - [19483] = 0x0000, /* R19483 - DACL_RETUNE_C14_0 */ - [19484] = 0x0000, /* R19484 - DACL_RETUNE_C15_1 */ - [19485] = 0x0000, /* R19485 - DACL_RETUNE_C15_0 */ - [19486] = 0x0000, /* R19486 - DACL_RETUNE_C16_1 */ - [19487] = 0x0000, /* R19487 - DACL_RETUNE_C16_0 */ - [19488] = 0x0000, /* R19488 - DACL_RETUNE_C17_1 */ - [19489] = 0x0000, /* R19489 - DACL_RETUNE_C17_0 */ - [19490] = 0x0000, /* R19490 - DACL_RETUNE_C18_1 */ - [19491] = 0x0000, /* R19491 - DACL_RETUNE_C18_0 */ - [19492] = 0x0000, /* R19492 - DACL_RETUNE_C19_1 */ - [19493] = 0x0000, /* R19493 - DACL_RETUNE_C19_0 */ - [19494] = 0x0000, /* R19494 - DACL_RETUNE_C20_1 */ - [19495] = 0x0000, /* R19495 - DACL_RETUNE_C20_0 */ - [19496] = 0x0000, /* R19496 - DACL_RETUNE_C21_1 */ - [19497] = 0x0000, /* R19497 - DACL_RETUNE_C21_0 */ - [19498] = 0x0000, /* R19498 - DACL_RETUNE_C22_1 */ - [19499] = 0x0000, /* R19499 - DACL_RETUNE_C22_0 */ - [19500] = 0x0000, /* R19500 - DACL_RETUNE_C23_1 */ - [19501] = 0x0000, /* R19501 - DACL_RETUNE_C23_0 */ - [19502] = 0x0000, /* R19502 - DACL_RETUNE_C24_1 */ - [19503] = 0x0000, /* R19503 - DACL_RETUNE_C24_0 */ - [19504] = 0x0000, /* R19504 - DACL_RETUNE_C25_1 */ - [19505] = 0x0000, /* R19505 - DACL_RETUNE_C25_0 */ - [19506] = 0x0000, /* R19506 - DACL_RETUNE_C26_1 */ - [19507] = 0x0000, /* R19507 - DACL_RETUNE_C26_0 */ - [19508] = 0x0000, /* R19508 - DACL_RETUNE_C27_1 */ - [19509] = 0x0000, /* R19509 - DACL_RETUNE_C27_0 */ - [19510] = 0x0000, /* R19510 - DACL_RETUNE_C28_1 */ - [19511] = 0x0000, /* R19511 - DACL_RETUNE_C28_0 */ - [19512] = 0x0000, /* R19512 - DACL_RETUNE_C29_1 */ - [19513] = 0x0000, /* R19513 - DACL_RETUNE_C29_0 */ - [19514] = 0x0000, /* R19514 - DACL_RETUNE_C30_1 */ - [19515] = 0x0000, /* R19515 - DACL_RETUNE_C30_0 */ - [19516] = 0x0000, /* R19516 - DACL_RETUNE_C31_1 */ - [19517] = 0x0000, /* R19517 - DACL_RETUNE_C31_0 */ - [19518] = 0x0000, /* R19518 - DACL_RETUNE_C32_1 */ - [19519] = 0x0000, /* R19519 - DACL_RETUNE_C32_0 */ - - [19968] = 0x0020, /* R19968 - RETUNEDAC_PG2_1 */ - [19969] = 0x0000, /* R19969 - RETUNEDAC_PG2_0 */ - [19970] = 0x0040, /* R19970 - RETUNEDAC_PG_1 */ - [19971] = 0x0000, /* R19971 - RETUNEDAC_PG_0 */ - - [20480] = 0x007F, /* R20480 - DACR_RETUNE_C1_1 */ - [20481] = 0xFFFF, /* R20481 - DACR_RETUNE_C1_0 */ - [20482] = 0x0000, /* R20482 - DACR_RETUNE_C2_1 */ - [20483] = 0x0000, /* R20483 - DACR_RETUNE_C2_0 */ - [20484] = 0x0000, /* R20484 - DACR_RETUNE_C3_1 */ - [20485] = 0x0000, /* R20485 - DACR_RETUNE_C3_0 */ - [20486] = 0x0000, /* R20486 - DACR_RETUNE_C4_1 */ - [20487] = 0x0000, /* R20487 - DACR_RETUNE_C4_0 */ - [20488] = 0x0000, /* R20488 - DACR_RETUNE_C5_1 */ - [20489] = 0x0000, /* R20489 - DACR_RETUNE_C5_0 */ - [20490] = 0x0000, /* R20490 - DACR_RETUNE_C6_1 */ - [20491] = 0x0000, /* R20491 - DACR_RETUNE_C6_0 */ - [20492] = 0x0000, /* R20492 - DACR_RETUNE_C7_1 */ - [20493] = 0x0000, /* R20493 - DACR_RETUNE_C7_0 */ - [20494] = 0x0000, /* R20494 - DACR_RETUNE_C8_1 */ - [20495] = 0x0000, /* R20495 - DACR_RETUNE_C8_0 */ - [20496] = 0x0000, /* R20496 - DACR_RETUNE_C9_1 */ - [20497] = 0x0000, /* R20497 - DACR_RETUNE_C9_0 */ - [20498] = 0x0000, /* R20498 - DACR_RETUNE_C10_1 */ - [20499] = 0x0000, /* R20499 - DACR_RETUNE_C10_0 */ - [20500] = 0x0000, /* R20500 - DACR_RETUNE_C11_1 */ - [20501] = 0x0000, /* R20501 - DACR_RETUNE_C11_0 */ - [20502] = 0x0000, /* R20502 - DACR_RETUNE_C12_1 */ - [20503] = 0x0000, /* R20503 - DACR_RETUNE_C12_0 */ - [20504] = 0x0000, /* R20504 - DACR_RETUNE_C13_1 */ - [20505] = 0x0000, /* R20505 - DACR_RETUNE_C13_0 */ - [20506] = 0x0000, /* R20506 - DACR_RETUNE_C14_1 */ - [20507] = 0x0000, /* R20507 - DACR_RETUNE_C14_0 */ - [20508] = 0x0000, /* R20508 - DACR_RETUNE_C15_1 */ - [20509] = 0x0000, /* R20509 - DACR_RETUNE_C15_0 */ - [20510] = 0x0000, /* R20510 - DACR_RETUNE_C16_1 */ - [20511] = 0x0000, /* R20511 - DACR_RETUNE_C16_0 */ - [20512] = 0x0000, /* R20512 - DACR_RETUNE_C17_1 */ - [20513] = 0x0000, /* R20513 - DACR_RETUNE_C17_0 */ - [20514] = 0x0000, /* R20514 - DACR_RETUNE_C18_1 */ - [20515] = 0x0000, /* R20515 - DACR_RETUNE_C18_0 */ - [20516] = 0x0000, /* R20516 - DACR_RETUNE_C19_1 */ - [20517] = 0x0000, /* R20517 - DACR_RETUNE_C19_0 */ - [20518] = 0x0000, /* R20518 - DACR_RETUNE_C20_1 */ - [20519] = 0x0000, /* R20519 - DACR_RETUNE_C20_0 */ - [20520] = 0x0000, /* R20520 - DACR_RETUNE_C21_1 */ - [20521] = 0x0000, /* R20521 - DACR_RETUNE_C21_0 */ - [20522] = 0x0000, /* R20522 - DACR_RETUNE_C22_1 */ - [20523] = 0x0000, /* R20523 - DACR_RETUNE_C22_0 */ - [20524] = 0x0000, /* R20524 - DACR_RETUNE_C23_1 */ - [20525] = 0x0000, /* R20525 - DACR_RETUNE_C23_0 */ - [20526] = 0x0000, /* R20526 - DACR_RETUNE_C24_1 */ - [20527] = 0x0000, /* R20527 - DACR_RETUNE_C24_0 */ - [20528] = 0x0000, /* R20528 - DACR_RETUNE_C25_1 */ - [20529] = 0x0000, /* R20529 - DACR_RETUNE_C25_0 */ - [20530] = 0x0000, /* R20530 - DACR_RETUNE_C26_1 */ - [20531] = 0x0000, /* R20531 - DACR_RETUNE_C26_0 */ - [20532] = 0x0000, /* R20532 - DACR_RETUNE_C27_1 */ - [20533] = 0x0000, /* R20533 - DACR_RETUNE_C27_0 */ - [20534] = 0x0000, /* R20534 - DACR_RETUNE_C28_1 */ - [20535] = 0x0000, /* R20535 - DACR_RETUNE_C28_0 */ - [20536] = 0x0000, /* R20536 - DACR_RETUNE_C29_1 */ - [20537] = 0x0000, /* R20537 - DACR_RETUNE_C29_0 */ - [20538] = 0x0000, /* R20538 - DACR_RETUNE_C30_1 */ - [20539] = 0x0000, /* R20539 - DACR_RETUNE_C30_0 */ - [20540] = 0x0000, /* R20540 - DACR_RETUNE_C31_1 */ - [20541] = 0x0000, /* R20541 - DACR_RETUNE_C31_0 */ - [20542] = 0x0000, /* R20542 - DACR_RETUNE_C32_1 */ - [20543] = 0x0000, /* R20543 - DACR_RETUNE_C32_0 */ - - [20992] = 0x008C, /* R20992 - VSS_XHD2_1 */ - [20993] = 0x0200, /* R20993 - VSS_XHD2_0 */ - [20994] = 0x0035, /* R20994 - VSS_XHD3_1 */ - [20995] = 0x0700, /* R20995 - VSS_XHD3_0 */ - [20996] = 0x003A, /* R20996 - VSS_XHN1_1 */ - [20997] = 0x4100, /* R20997 - VSS_XHN1_0 */ - [20998] = 0x008B, /* R20998 - VSS_XHN2_1 */ - [20999] = 0x7D00, /* R20999 - VSS_XHN2_0 */ - [21000] = 0x003A, /* R21000 - VSS_XHN3_1 */ - [21001] = 0x4100, /* R21001 - VSS_XHN3_0 */ - [21002] = 0x008C, /* R21002 - VSS_XLA_1 */ - [21003] = 0xFEE8, /* R21003 - VSS_XLA_0 */ - [21004] = 0x0078, /* R21004 - VSS_XLB_1 */ - [21005] = 0x0000, /* R21005 - VSS_XLB_0 */ - [21006] = 0x003F, /* R21006 - VSS_XLG_1 */ - [21007] = 0xB260, /* R21007 - VSS_XLG_0 */ - [21008] = 0x002D, /* R21008 - VSS_PG2_1 */ - [21009] = 0x1818, /* R21009 - VSS_PG2_0 */ - [21010] = 0x0020, /* R21010 - VSS_PG_1 */ - [21011] = 0x0000, /* R21011 - VSS_PG_0 */ - [21012] = 0x00F1, /* R21012 - VSS_XTD1_1 */ - [21013] = 0x8340, /* R21013 - VSS_XTD1_0 */ - [21014] = 0x00FB, /* R21014 - VSS_XTD2_1 */ - [21015] = 0x8300, /* R21015 - VSS_XTD2_0 */ - [21016] = 0x00EE, /* R21016 - VSS_XTD3_1 */ - [21017] = 0xAEC0, /* R21017 - VSS_XTD3_0 */ - [21018] = 0x00FB, /* R21018 - VSS_XTD4_1 */ - [21019] = 0xAC40, /* R21019 - VSS_XTD4_0 */ - [21020] = 0x00F1, /* R21020 - VSS_XTD5_1 */ - [21021] = 0x7F80, /* R21021 - VSS_XTD5_0 */ - [21022] = 0x00F4, /* R21022 - VSS_XTD6_1 */ - [21023] = 0x3B40, /* R21023 - VSS_XTD6_0 */ - [21024] = 0x00F5, /* R21024 - VSS_XTD7_1 */ - [21025] = 0xFB00, /* R21025 - VSS_XTD7_0 */ - [21026] = 0x00EA, /* R21026 - VSS_XTD8_1 */ - [21027] = 0x10C0, /* R21027 - VSS_XTD8_0 */ - [21028] = 0x00FC, /* R21028 - VSS_XTD9_1 */ - [21029] = 0xC580, /* R21029 - VSS_XTD9_0 */ - [21030] = 0x00E2, /* R21030 - VSS_XTD10_1 */ - [21031] = 0x75C0, /* R21031 - VSS_XTD10_0 */ - [21032] = 0x0004, /* R21032 - VSS_XTD11_1 */ - [21033] = 0xB480, /* R21033 - VSS_XTD11_0 */ - [21034] = 0x00D4, /* R21034 - VSS_XTD12_1 */ - [21035] = 0xF980, /* R21035 - VSS_XTD12_0 */ - [21036] = 0x0004, /* R21036 - VSS_XTD13_1 */ - [21037] = 0x9140, /* R21037 - VSS_XTD13_0 */ - [21038] = 0x00D8, /* R21038 - VSS_XTD14_1 */ - [21039] = 0xA480, /* R21039 - VSS_XTD14_0 */ - [21040] = 0x0002, /* R21040 - VSS_XTD15_1 */ - [21041] = 0x3DC0, /* R21041 - VSS_XTD15_0 */ - [21042] = 0x00CF, /* R21042 - VSS_XTD16_1 */ - [21043] = 0x7A80, /* R21043 - VSS_XTD16_0 */ - [21044] = 0x00DC, /* R21044 - VSS_XTD17_1 */ - [21045] = 0x0600, /* R21045 - VSS_XTD17_0 */ - [21046] = 0x00F2, /* R21046 - VSS_XTD18_1 */ - [21047] = 0xDAC0, /* R21047 - VSS_XTD18_0 */ - [21048] = 0x00BA, /* R21048 - VSS_XTD19_1 */ - [21049] = 0xF340, /* R21049 - VSS_XTD19_0 */ - [21050] = 0x000A, /* R21050 - VSS_XTD20_1 */ - [21051] = 0x7940, /* R21051 - VSS_XTD20_0 */ - [21052] = 0x001C, /* R21052 - VSS_XTD21_1 */ - [21053] = 0x0680, /* R21053 - VSS_XTD21_0 */ - [21054] = 0x00FD, /* R21054 - VSS_XTD22_1 */ - [21055] = 0x2D00, /* R21055 - VSS_XTD22_0 */ - [21056] = 0x001C, /* R21056 - VSS_XTD23_1 */ - [21057] = 0xE840, /* R21057 - VSS_XTD23_0 */ - [21058] = 0x000D, /* R21058 - VSS_XTD24_1 */ - [21059] = 0xDC40, /* R21059 - VSS_XTD24_0 */ - [21060] = 0x00FC, /* R21060 - VSS_XTD25_1 */ - [21061] = 0x9D00, /* R21061 - VSS_XTD25_0 */ - [21062] = 0x0009, /* R21062 - VSS_XTD26_1 */ - [21063] = 0x5580, /* R21063 - VSS_XTD26_0 */ - [21064] = 0x00FE, /* R21064 - VSS_XTD27_1 */ - [21065] = 0x7E80, /* R21065 - VSS_XTD27_0 */ - [21066] = 0x000E, /* R21066 - VSS_XTD28_1 */ - [21067] = 0xAB40, /* R21067 - VSS_XTD28_0 */ - [21068] = 0x00F9, /* R21068 - VSS_XTD29_1 */ - [21069] = 0x9880, /* R21069 - VSS_XTD29_0 */ - [21070] = 0x0009, /* R21070 - VSS_XTD30_1 */ - [21071] = 0x87C0, /* R21071 - VSS_XTD30_0 */ - [21072] = 0x00FD, /* R21072 - VSS_XTD31_1 */ - [21073] = 0x2C40, /* R21073 - VSS_XTD31_0 */ - [21074] = 0x0009, /* R21074 - VSS_XTD32_1 */ - [21075] = 0x4800, /* R21075 - VSS_XTD32_0 */ - [21076] = 0x0003, /* R21076 - VSS_XTS1_1 */ - [21077] = 0x5F40, /* R21077 - VSS_XTS1_0 */ - [21078] = 0x0000, /* R21078 - VSS_XTS2_1 */ - [21079] = 0x8700, /* R21079 - VSS_XTS2_0 */ - [21080] = 0x00FA, /* R21080 - VSS_XTS3_1 */ - [21081] = 0xE4C0, /* R21081 - VSS_XTS3_0 */ - [21082] = 0x0000, /* R21082 - VSS_XTS4_1 */ - [21083] = 0x0B40, /* R21083 - VSS_XTS4_0 */ - [21084] = 0x0004, /* R21084 - VSS_XTS5_1 */ - [21085] = 0xE180, /* R21085 - VSS_XTS5_0 */ - [21086] = 0x0001, /* R21086 - VSS_XTS6_1 */ - [21087] = 0x1F40, /* R21087 - VSS_XTS6_0 */ - [21088] = 0x00F8, /* R21088 - VSS_XTS7_1 */ - [21089] = 0xB000, /* R21089 - VSS_XTS7_0 */ - [21090] = 0x00FB, /* R21090 - VSS_XTS8_1 */ - [21091] = 0xCBC0, /* R21091 - VSS_XTS8_0 */ - [21092] = 0x0004, /* R21092 - VSS_XTS9_1 */ - [21093] = 0xF380, /* R21093 - VSS_XTS9_0 */ - [21094] = 0x0007, /* R21094 - VSS_XTS10_1 */ - [21095] = 0xDF40, /* R21095 - VSS_XTS10_0 */ - [21096] = 0x00FF, /* R21096 - VSS_XTS11_1 */ - [21097] = 0x0700, /* R21097 - VSS_XTS11_0 */ - [21098] = 0x00EF, /* R21098 - VSS_XTS12_1 */ - [21099] = 0xD700, /* R21099 - VSS_XTS12_0 */ - [21100] = 0x00FB, /* R21100 - VSS_XTS13_1 */ - [21101] = 0xAF40, /* R21101 - VSS_XTS13_0 */ - [21102] = 0x0010, /* R21102 - VSS_XTS14_1 */ - [21103] = 0x8A80, /* R21103 - VSS_XTS14_0 */ - [21104] = 0x0011, /* R21104 - VSS_XTS15_1 */ - [21105] = 0x07C0, /* R21105 - VSS_XTS15_0 */ - [21106] = 0x00E0, /* R21106 - VSS_XTS16_1 */ - [21107] = 0x0800, /* R21107 - VSS_XTS16_0 */ - [21108] = 0x00D2, /* R21108 - VSS_XTS17_1 */ - [21109] = 0x7600, /* R21109 - VSS_XTS17_0 */ - [21110] = 0x0020, /* R21110 - VSS_XTS18_1 */ - [21111] = 0xCF40, /* R21111 - VSS_XTS18_0 */ - [21112] = 0x0030, /* R21112 - VSS_XTS19_1 */ - [21113] = 0x2340, /* R21113 - VSS_XTS19_0 */ - [21114] = 0x00FD, /* R21114 - VSS_XTS20_1 */ - [21115] = 0x69C0, /* R21115 - VSS_XTS20_0 */ - [21116] = 0x0028, /* R21116 - VSS_XTS21_1 */ - [21117] = 0x3500, /* R21117 - VSS_XTS21_0 */ - [21118] = 0x0006, /* R21118 - VSS_XTS22_1 */ - [21119] = 0x3300, /* R21119 - VSS_XTS22_0 */ - [21120] = 0x00D9, /* R21120 - VSS_XTS23_1 */ - [21121] = 0xF6C0, /* R21121 - VSS_XTS23_0 */ - [21122] = 0x00F3, /* R21122 - VSS_XTS24_1 */ - [21123] = 0x3340, /* R21123 - VSS_XTS24_0 */ - [21124] = 0x000F, /* R21124 - VSS_XTS25_1 */ - [21125] = 0x4200, /* R21125 - VSS_XTS25_0 */ - [21126] = 0x0004, /* R21126 - VSS_XTS26_1 */ - [21127] = 0x0C80, /* R21127 - VSS_XTS26_0 */ - [21128] = 0x00FB, /* R21128 - VSS_XTS27_1 */ - [21129] = 0x3F80, /* R21129 - VSS_XTS27_0 */ - [21130] = 0x00F7, /* R21130 - VSS_XTS28_1 */ - [21131] = 0x57C0, /* R21131 - VSS_XTS28_0 */ - [21132] = 0x0003, /* R21132 - VSS_XTS29_1 */ - [21133] = 0x5400, /* R21133 - VSS_XTS29_0 */ - [21134] = 0x0000, /* R21134 - VSS_XTS30_1 */ - [21135] = 0xC6C0, /* R21135 - VSS_XTS30_0 */ - [21136] = 0x0003, /* R21136 - VSS_XTS31_1 */ - [21137] = 0x12C0, /* R21137 - VSS_XTS31_0 */ - [21138] = 0x00FD, /* R21138 - VSS_XTS32_1 */ - [21139] = 0x8580, /* R21139 - VSS_XTS32_0 */ +static struct reg_default wm8962_reg[] = { + { 0, 0x009F }, /* R0 - Left Input volume */ + { 1, 0x049F }, /* R1 - Right Input volume */ + { 2, 0x0000 }, /* R2 - HPOUTL volume */ + { 3, 0x0000 }, /* R3 - HPOUTR volume */ + { 4, 0x0020 }, /* R4 - Clocking1 */ + { 5, 0x0018 }, /* R5 - ADC & DAC Control 1 */ + { 6, 0x2008 }, /* R6 - ADC & DAC Control 2 */ + { 7, 0x000A }, /* R7 - Audio Interface 0 */ + { 8, 0x01E4 }, /* R8 - Clocking2 */ + { 9, 0x0300 }, /* R9 - Audio Interface 1 */ + { 10, 0x00C0 }, /* R10 - Left DAC volume */ + { 11, 0x00C0 }, /* R11 - Right DAC volume */ + + { 14, 0x0040 }, /* R14 - Audio Interface 2 */ + { 15, 0x6243 }, /* R15 - Software Reset */ + + { 17, 0x007B }, /* R17 - ALC1 */ + { 18, 0x0000 }, /* R18 - ALC2 */ + { 19, 0x1C32 }, /* R19 - ALC3 */ + { 20, 0x3200 }, /* R20 - Noise Gate */ + { 21, 0x00C0 }, /* R21 - Left ADC volume */ + { 22, 0x00C0 }, /* R22 - Right ADC volume */ + { 23, 0x0160 }, /* R23 - Additional control(1) */ + { 24, 0x0000 }, /* R24 - Additional control(2) */ + { 25, 0x0000 }, /* R25 - Pwr Mgmt (1) */ + { 26, 0x0000 }, /* R26 - Pwr Mgmt (2) */ + { 27, 0x0010 }, /* R27 - Additional Control (3) */ + { 28, 0x0000 }, /* R28 - Anti-pop */ + + { 30, 0x005E }, /* R30 - Clocking 3 */ + { 31, 0x0000 }, /* R31 - Input mixer control (1) */ + { 32, 0x0145 }, /* R32 - Left input mixer volume */ + { 33, 0x0145 }, /* R33 - Right input mixer volume */ + { 34, 0x0009 }, /* R34 - Input mixer control (2) */ + { 35, 0x0003 }, /* R35 - Input bias control */ + { 37, 0x0008 }, /* R37 - Left input PGA control */ + { 38, 0x0008 }, /* R38 - Right input PGA control */ + + { 40, 0x0000 }, /* R40 - SPKOUTL volume */ + { 41, 0x0000 }, /* R41 - SPKOUTR volume */ + + { 47, 0x0000 }, /* R47 - Thermal Shutdown Status */ + { 48, 0x8027 }, /* R48 - Additional Control (4) */ + { 49, 0x0010 }, /* R49 - Class D Control 1 */ + + { 51, 0x0003 }, /* R51 - Class D Control 2 */ + + { 56, 0x0506 }, /* R56 - Clocking 4 */ + { 57, 0x0000 }, /* R57 - DAC DSP Mixing (1) */ + { 58, 0x0000 }, /* R58 - DAC DSP Mixing (2) */ + + { 60, 0x0300 }, /* R60 - DC Servo 0 */ + { 61, 0x0300 }, /* R61 - DC Servo 1 */ + + { 64, 0x0810 }, /* R64 - DC Servo 4 */ + + { 66, 0x0000 }, /* R66 - DC Servo 6 */ + + { 68, 0x001B }, /* R68 - Analogue PGA Bias */ + { 69, 0x0000 }, /* R69 - Analogue HP 0 */ + + { 71, 0x01FB }, /* R71 - Analogue HP 2 */ + { 72, 0x0000 }, /* R72 - Charge Pump 1 */ + + { 82, 0x0004 }, /* R82 - Charge Pump B */ + + { 87, 0x0000 }, /* R87 - Write Sequencer Control 1 */ + + { 90, 0x0000 }, /* R90 - Write Sequencer Control 2 */ + + { 93, 0x0000 }, /* R93 - Write Sequencer Control 3 */ + { 94, 0x0000 }, /* R94 - Control Interface */ + + { 99, 0x0000 }, /* R99 - Mixer Enables */ + { 100, 0x0000 }, /* R100 - Headphone Mixer (1) */ + { 101, 0x0000 }, /* R101 - Headphone Mixer (2) */ + { 102, 0x013F }, /* R102 - Headphone Mixer (3) */ + { 103, 0x013F }, /* R103 - Headphone Mixer (4) */ + + { 105, 0x0000 }, /* R105 - Speaker Mixer (1) */ + { 106, 0x0000 }, /* R106 - Speaker Mixer (2) */ + { 107, 0x013F }, /* R107 - Speaker Mixer (3) */ + { 108, 0x013F }, /* R108 - Speaker Mixer (4) */ + { 109, 0x0003 }, /* R109 - Speaker Mixer (5) */ + { 110, 0x0002 }, /* R110 - Beep Generator (1) */ + + { 115, 0x0006 }, /* R115 - Oscillator Trim (3) */ + { 116, 0x0026 }, /* R116 - Oscillator Trim (4) */ + + { 119, 0x0000 }, /* R119 - Oscillator Trim (7) */ + + { 124, 0x0011 }, /* R124 - Analogue Clocking1 */ + { 125, 0x004B }, /* R125 - Analogue Clocking2 */ + { 126, 0x000D }, /* R126 - Analogue Clocking3 */ + { 127, 0x0000 }, /* R127 - PLL Software Reset */ + + { 129, 0x0000 }, /* R129 - PLL2 */ + + { 131, 0x0000 }, /* R131 - PLL 4 */ + + { 136, 0x0067 }, /* R136 - PLL 9 */ + { 137, 0x001C }, /* R137 - PLL 10 */ + { 138, 0x0071 }, /* R138 - PLL 11 */ + { 139, 0x00C7 }, /* R139 - PLL 12 */ + { 140, 0x0067 }, /* R140 - PLL 13 */ + { 141, 0x0048 }, /* R141 - PLL 14 */ + { 142, 0x0022 }, /* R142 - PLL 15 */ + { 143, 0x0097 }, /* R143 - PLL 16 */ + + { 155, 0x000C }, /* R155 - FLL Control (1) */ + { 156, 0x0039 }, /* R156 - FLL Control (2) */ + { 157, 0x0180 }, /* R157 - FLL Control (3) */ + + { 159, 0x0032 }, /* R159 - FLL Control (5) */ + { 160, 0x0018 }, /* R160 - FLL Control (6) */ + { 161, 0x007D }, /* R161 - FLL Control (7) */ + { 162, 0x0008 }, /* R162 - FLL Control (8) */ + + { 252, 0x0005 }, /* R252 - General test 1 */ + + { 256, 0x0000 }, /* R256 - DF1 */ + { 257, 0x0000 }, /* R257 - DF2 */ + { 258, 0x0000 }, /* R258 - DF3 */ + { 259, 0x0000 }, /* R259 - DF4 */ + { 260, 0x0000 }, /* R260 - DF5 */ + { 261, 0x0000 }, /* R261 - DF6 */ + { 262, 0x0000 }, /* R262 - DF7 */ + + { 264, 0x0000 }, /* R264 - LHPF1 */ + { 265, 0x0000 }, /* R265 - LHPF2 */ + + { 268, 0x0000 }, /* R268 - THREED1 */ + { 269, 0x0000 }, /* R269 - THREED2 */ + { 270, 0x0000 }, /* R270 - THREED3 */ + { 271, 0x0000 }, /* R271 - THREED4 */ + + { 276, 0x000C }, /* R276 - DRC 1 */ + { 277, 0x0925 }, /* R277 - DRC 2 */ + { 278, 0x0000 }, /* R278 - DRC 3 */ + { 279, 0x0000 }, /* R279 - DRC 4 */ + { 280, 0x0000 }, /* R280 - DRC 5 */ + + { 285, 0x0000 }, /* R285 - Tloopback */ + + { 335, 0x0004 }, /* R335 - EQ1 */ + { 336, 0x6318 }, /* R336 - EQ2 */ + { 337, 0x6300 }, /* R337 - EQ3 */ + { 338, 0x0FCA }, /* R338 - EQ4 */ + { 339, 0x0400 }, /* R339 - EQ5 */ + { 340, 0x00D8 }, /* R340 - EQ6 */ + { 341, 0x1EB5 }, /* R341 - EQ7 */ + { 342, 0xF145 }, /* R342 - EQ8 */ + { 343, 0x0B75 }, /* R343 - EQ9 */ + { 344, 0x01C5 }, /* R344 - EQ10 */ + { 345, 0x1C58 }, /* R345 - EQ11 */ + { 346, 0xF373 }, /* R346 - EQ12 */ + { 347, 0x0A54 }, /* R347 - EQ13 */ + { 348, 0x0558 }, /* R348 - EQ14 */ + { 349, 0x168E }, /* R349 - EQ15 */ + { 350, 0xF829 }, /* R350 - EQ16 */ + { 351, 0x07AD }, /* R351 - EQ17 */ + { 352, 0x1103 }, /* R352 - EQ18 */ + { 353, 0x0564 }, /* R353 - EQ19 */ + { 354, 0x0559 }, /* R354 - EQ20 */ + { 355, 0x4000 }, /* R355 - EQ21 */ + { 356, 0x6318 }, /* R356 - EQ22 */ + { 357, 0x6300 }, /* R357 - EQ23 */ + { 358, 0x0FCA }, /* R358 - EQ24 */ + { 359, 0x0400 }, /* R359 - EQ25 */ + { 360, 0x00D8 }, /* R360 - EQ26 */ + { 361, 0x1EB5 }, /* R361 - EQ27 */ + { 362, 0xF145 }, /* R362 - EQ28 */ + { 363, 0x0B75 }, /* R363 - EQ29 */ + { 364, 0x01C5 }, /* R364 - EQ30 */ + { 365, 0x1C58 }, /* R365 - EQ31 */ + { 366, 0xF373 }, /* R366 - EQ32 */ + { 367, 0x0A54 }, /* R367 - EQ33 */ + { 368, 0x0558 }, /* R368 - EQ34 */ + { 369, 0x168E }, /* R369 - EQ35 */ + { 370, 0xF829 }, /* R370 - EQ36 */ + { 371, 0x07AD }, /* R371 - EQ37 */ + { 372, 0x1103 }, /* R372 - EQ38 */ + { 373, 0x0564 }, /* R373 - EQ39 */ + { 374, 0x0559 }, /* R374 - EQ40 */ + { 375, 0x4000 }, /* R375 - EQ41 */ + + { 513, 0x0000 }, /* R513 - GPIO 2 */ + { 514, 0x0000 }, /* R514 - GPIO 3 */ + + { 516, 0x8100 }, /* R516 - GPIO 5 */ + { 517, 0x8100 }, /* R517 - GPIO 6 */ + + { 560, 0x0000 }, /* R560 - Interrupt Status 1 */ + { 561, 0x0000 }, /* R561 - Interrupt Status 2 */ + + { 568, 0x0030 }, /* R568 - Interrupt Status 1 Mask */ + { 569, 0xFFED }, /* R569 - Interrupt Status 2 Mask */ + + { 576, 0x0000 }, /* R576 - Interrupt Control */ + + { 584, 0x002D }, /* R584 - IRQ Debounce */ + + { 586, 0x0000 }, /* R586 - MICINT Source Pol */ + + { 768, 0x1C00 }, /* R768 - DSP2 Power Management */ + + { 1037, 0x0000 }, /* R1037 - DSP2_ExecControl */ + + { 8192, 0x0000 }, /* R8192 - DSP2 Instruction RAM 0 */ + + { 9216, 0x0030 }, /* R9216 - DSP2 Address RAM 2 */ + { 9217, 0x0000 }, /* R9217 - DSP2 Address RAM 1 */ + { 9218, 0x0000 }, /* R9218 - DSP2 Address RAM 0 */ + + { 12288, 0x0000 }, /* R12288 - DSP2 Data1 RAM 1 */ + { 12289, 0x0000 }, /* R12289 - DSP2 Data1 RAM 0 */ + + { 13312, 0x0000 }, /* R13312 - DSP2 Data2 RAM 1 */ + { 13313, 0x0000 }, /* R13313 - DSP2 Data2 RAM 0 */ + + { 14336, 0x0000 }, /* R14336 - DSP2 Data3 RAM 1 */ + { 14337, 0x0000 }, /* R14337 - DSP2 Data3 RAM 0 */ + + { 15360, 0x000A }, /* R15360 - DSP2 Coeff RAM 0 */ + + { 16384, 0x0000 }, /* R16384 - RETUNEADC_SHARED_COEFF_1 */ + { 16385, 0x0000 }, /* R16385 - RETUNEADC_SHARED_COEFF_0 */ + { 16386, 0x0000 }, /* R16386 - RETUNEDAC_SHARED_COEFF_1 */ + { 16387, 0x0000 }, /* R16387 - RETUNEDAC_SHARED_COEFF_0 */ + { 16388, 0x0000 }, /* R16388 - SOUNDSTAGE_ENABLES_1 */ + { 16389, 0x0000 }, /* R16389 - SOUNDSTAGE_ENABLES_0 */ + + { 16896, 0x0002 }, /* R16896 - HDBASS_AI_1 */ + { 16897, 0xBD12 }, /* R16897 - HDBASS_AI_0 */ + { 16898, 0x007C }, /* R16898 - HDBASS_AR_1 */ + { 16899, 0x586C }, /* R16899 - HDBASS_AR_0 */ + { 16900, 0x0053 }, /* R16900 - HDBASS_B_1 */ + { 16901, 0x8121 }, /* R16901 - HDBASS_B_0 */ + { 16902, 0x003F }, /* R16902 - HDBASS_K_1 */ + { 16903, 0x8BD8 }, /* R16903 - HDBASS_K_0 */ + { 16904, 0x0032 }, /* R16904 - HDBASS_N1_1 */ + { 16905, 0xF52D }, /* R16905 - HDBASS_N1_0 */ + { 16906, 0x0065 }, /* R16906 - HDBASS_N2_1 */ + { 16907, 0xAC8C }, /* R16907 - HDBASS_N2_0 */ + { 16908, 0x006B }, /* R16908 - HDBASS_N3_1 */ + { 16909, 0xE087 }, /* R16909 - HDBASS_N3_0 */ + { 16910, 0x0072 }, /* R16910 - HDBASS_N4_1 */ + { 16911, 0x1483 }, /* R16911 - HDBASS_N4_0 */ + { 16912, 0x0072 }, /* R16912 - HDBASS_N5_1 */ + { 16913, 0x1483 }, /* R16913 - HDBASS_N5_0 */ + { 16914, 0x0043 }, /* R16914 - HDBASS_X1_1 */ + { 16915, 0x3525 }, /* R16915 - HDBASS_X1_0 */ + { 16916, 0x0006 }, /* R16916 - HDBASS_X2_1 */ + { 16917, 0x6A4A }, /* R16917 - HDBASS_X2_0 */ + { 16918, 0x0043 }, /* R16918 - HDBASS_X3_1 */ + { 16919, 0x6079 }, /* R16919 - HDBASS_X3_0 */ + { 16920, 0x0008 }, /* R16920 - HDBASS_ATK_1 */ + { 16921, 0x0000 }, /* R16921 - HDBASS_ATK_0 */ + { 16922, 0x0001 }, /* R16922 - HDBASS_DCY_1 */ + { 16923, 0x0000 }, /* R16923 - HDBASS_DCY_0 */ + { 16924, 0x0059 }, /* R16924 - HDBASS_PG_1 */ + { 16925, 0x999A }, /* R16925 - HDBASS_PG_0 */ + + { 17048, 0x0083 }, /* R17408 - HPF_C_1 */ + { 17049, 0x98AD }, /* R17409 - HPF_C_0 */ + + { 17920, 0x007F }, /* R17920 - ADCL_RETUNE_C1_1 */ + { 17921, 0xFFFF }, /* R17921 - ADCL_RETUNE_C1_0 */ + { 17922, 0x0000 }, /* R17922 - ADCL_RETUNE_C2_1 */ + { 17923, 0x0000 }, /* R17923 - ADCL_RETUNE_C2_0 */ + { 17924, 0x0000 }, /* R17924 - ADCL_RETUNE_C3_1 */ + { 17925, 0x0000 }, /* R17925 - ADCL_RETUNE_C3_0 */ + { 17926, 0x0000 }, /* R17926 - ADCL_RETUNE_C4_1 */ + { 17927, 0x0000 }, /* R17927 - ADCL_RETUNE_C4_0 */ + { 17928, 0x0000 }, /* R17928 - ADCL_RETUNE_C5_1 */ + { 17929, 0x0000 }, /* R17929 - ADCL_RETUNE_C5_0 */ + { 17930, 0x0000 }, /* R17930 - ADCL_RETUNE_C6_1 */ + { 17931, 0x0000 }, /* R17931 - ADCL_RETUNE_C6_0 */ + { 17932, 0x0000 }, /* R17932 - ADCL_RETUNE_C7_1 */ + { 17933, 0x0000 }, /* R17933 - ADCL_RETUNE_C7_0 */ + { 17934, 0x0000 }, /* R17934 - ADCL_RETUNE_C8_1 */ + { 17935, 0x0000 }, /* R17935 - ADCL_RETUNE_C8_0 */ + { 17936, 0x0000 }, /* R17936 - ADCL_RETUNE_C9_1 */ + { 17937, 0x0000 }, /* R17937 - ADCL_RETUNE_C9_0 */ + { 17938, 0x0000 }, /* R17938 - ADCL_RETUNE_C10_1 */ + { 17939, 0x0000 }, /* R17939 - ADCL_RETUNE_C10_0 */ + { 17940, 0x0000 }, /* R17940 - ADCL_RETUNE_C11_1 */ + { 17941, 0x0000 }, /* R17941 - ADCL_RETUNE_C11_0 */ + { 17942, 0x0000 }, /* R17942 - ADCL_RETUNE_C12_1 */ + { 17943, 0x0000 }, /* R17943 - ADCL_RETUNE_C12_0 */ + { 17944, 0x0000 }, /* R17944 - ADCL_RETUNE_C13_1 */ + { 17945, 0x0000 }, /* R17945 - ADCL_RETUNE_C13_0 */ + { 17946, 0x0000 }, /* R17946 - ADCL_RETUNE_C14_1 */ + { 17947, 0x0000 }, /* R17947 - ADCL_RETUNE_C14_0 */ + { 17948, 0x0000 }, /* R17948 - ADCL_RETUNE_C15_1 */ + { 17949, 0x0000 }, /* R17949 - ADCL_RETUNE_C15_0 */ + { 17950, 0x0000 }, /* R17950 - ADCL_RETUNE_C16_1 */ + { 17951, 0x0000 }, /* R17951 - ADCL_RETUNE_C16_0 */ + { 17952, 0x0000 }, /* R17952 - ADCL_RETUNE_C17_1 */ + { 17953, 0x0000 }, /* R17953 - ADCL_RETUNE_C17_0 */ + { 17954, 0x0000 }, /* R17954 - ADCL_RETUNE_C18_1 */ + { 17955, 0x0000 }, /* R17955 - ADCL_RETUNE_C18_0 */ + { 17956, 0x0000 }, /* R17956 - ADCL_RETUNE_C19_1 */ + { 17957, 0x0000 }, /* R17957 - ADCL_RETUNE_C19_0 */ + { 17958, 0x0000 }, /* R17958 - ADCL_RETUNE_C20_1 */ + { 17959, 0x0000 }, /* R17959 - ADCL_RETUNE_C20_0 */ + { 17960, 0x0000 }, /* R17960 - ADCL_RETUNE_C21_1 */ + { 17961, 0x0000 }, /* R17961 - ADCL_RETUNE_C21_0 */ + { 17962, 0x0000 }, /* R17962 - ADCL_RETUNE_C22_1 */ + { 17963, 0x0000 }, /* R17963 - ADCL_RETUNE_C22_0 */ + { 17964, 0x0000 }, /* R17964 - ADCL_RETUNE_C23_1 */ + { 17965, 0x0000 }, /* R17965 - ADCL_RETUNE_C23_0 */ + { 17966, 0x0000 }, /* R17966 - ADCL_RETUNE_C24_1 */ + { 17967, 0x0000 }, /* R17967 - ADCL_RETUNE_C24_0 */ + { 17968, 0x0000 }, /* R17968 - ADCL_RETUNE_C25_1 */ + { 17969, 0x0000 }, /* R17969 - ADCL_RETUNE_C25_0 */ + { 17970, 0x0000 }, /* R17970 - ADCL_RETUNE_C26_1 */ + { 17971, 0x0000 }, /* R17971 - ADCL_RETUNE_C26_0 */ + { 17972, 0x0000 }, /* R17972 - ADCL_RETUNE_C27_1 */ + { 17973, 0x0000 }, /* R17973 - ADCL_RETUNE_C27_0 */ + { 17974, 0x0000 }, /* R17974 - ADCL_RETUNE_C28_1 */ + { 17975, 0x0000 }, /* R17975 - ADCL_RETUNE_C28_0 */ + { 17976, 0x0000 }, /* R17976 - ADCL_RETUNE_C29_1 */ + { 17977, 0x0000 }, /* R17977 - ADCL_RETUNE_C29_0 */ + { 17978, 0x0000 }, /* R17978 - ADCL_RETUNE_C30_1 */ + { 17979, 0x0000 }, /* R17979 - ADCL_RETUNE_C30_0 */ + { 17980, 0x0000 }, /* R17980 - ADCL_RETUNE_C31_1 */ + { 17981, 0x0000 }, /* R17981 - ADCL_RETUNE_C31_0 */ + { 17982, 0x0000 }, /* R17982 - ADCL_RETUNE_C32_1 */ + { 17983, 0x0000 }, /* R17983 - ADCL_RETUNE_C32_0 */ + + { 18432, 0x0020 }, /* R18432 - RETUNEADC_PG2_1 */ + { 18433, 0x0000 }, /* R18433 - RETUNEADC_PG2_0 */ + { 18434, 0x0040 }, /* R18434 - RETUNEADC_PG_1 */ + { 18435, 0x0000 }, /* R18435 - RETUNEADC_PG_0 */ + + { 18944, 0x007F }, /* R18944 - ADCR_RETUNE_C1_1 */ + { 18945, 0xFFFF }, /* R18945 - ADCR_RETUNE_C1_0 */ + { 18946, 0x0000 }, /* R18946 - ADCR_RETUNE_C2_1 */ + { 18947, 0x0000 }, /* R18947 - ADCR_RETUNE_C2_0 */ + { 18948, 0x0000 }, /* R18948 - ADCR_RETUNE_C3_1 */ + { 18949, 0x0000 }, /* R18949 - ADCR_RETUNE_C3_0 */ + { 18950, 0x0000 }, /* R18950 - ADCR_RETUNE_C4_1 */ + { 18951, 0x0000 }, /* R18951 - ADCR_RETUNE_C4_0 */ + { 18952, 0x0000 }, /* R18952 - ADCR_RETUNE_C5_1 */ + { 18953, 0x0000 }, /* R18953 - ADCR_RETUNE_C5_0 */ + { 18954, 0x0000 }, /* R18954 - ADCR_RETUNE_C6_1 */ + { 18955, 0x0000 }, /* R18955 - ADCR_RETUNE_C6_0 */ + { 18956, 0x0000 }, /* R18956 - ADCR_RETUNE_C7_1 */ + { 18957, 0x0000 }, /* R18957 - ADCR_RETUNE_C7_0 */ + { 18958, 0x0000 }, /* R18958 - ADCR_RETUNE_C8_1 */ + { 18959, 0x0000 }, /* R18959 - ADCR_RETUNE_C8_0 */ + { 18960, 0x0000 }, /* R18960 - ADCR_RETUNE_C9_1 */ + { 18961, 0x0000 }, /* R18961 - ADCR_RETUNE_C9_0 */ + { 18962, 0x0000 }, /* R18962 - ADCR_RETUNE_C10_1 */ + { 18963, 0x0000 }, /* R18963 - ADCR_RETUNE_C10_0 */ + { 18964, 0x0000 }, /* R18964 - ADCR_RETUNE_C11_1 */ + { 18965, 0x0000 }, /* R18965 - ADCR_RETUNE_C11_0 */ + { 18966, 0x0000 }, /* R18966 - ADCR_RETUNE_C12_1 */ + { 18967, 0x0000 }, /* R18967 - ADCR_RETUNE_C12_0 */ + { 18968, 0x0000 }, /* R18968 - ADCR_RETUNE_C13_1 */ + { 18969, 0x0000 }, /* R18969 - ADCR_RETUNE_C13_0 */ + { 18970, 0x0000 }, /* R18970 - ADCR_RETUNE_C14_1 */ + { 18971, 0x0000 }, /* R18971 - ADCR_RETUNE_C14_0 */ + { 18972, 0x0000 }, /* R18972 - ADCR_RETUNE_C15_1 */ + { 18973, 0x0000 }, /* R18973 - ADCR_RETUNE_C15_0 */ + { 18974, 0x0000 }, /* R18974 - ADCR_RETUNE_C16_1 */ + { 18975, 0x0000 }, /* R18975 - ADCR_RETUNE_C16_0 */ + { 18976, 0x0000 }, /* R18976 - ADCR_RETUNE_C17_1 */ + { 18977, 0x0000 }, /* R18977 - ADCR_RETUNE_C17_0 */ + { 18978, 0x0000 }, /* R18978 - ADCR_RETUNE_C18_1 */ + { 18979, 0x0000 }, /* R18979 - ADCR_RETUNE_C18_0 */ + { 18980, 0x0000 }, /* R18980 - ADCR_RETUNE_C19_1 */ + { 18981, 0x0000 }, /* R18981 - ADCR_RETUNE_C19_0 */ + { 18982, 0x0000 }, /* R18982 - ADCR_RETUNE_C20_1 */ + { 18983, 0x0000 }, /* R18983 - ADCR_RETUNE_C20_0 */ + { 18984, 0x0000 }, /* R18984 - ADCR_RETUNE_C21_1 */ + { 18985, 0x0000 }, /* R18985 - ADCR_RETUNE_C21_0 */ + { 18986, 0x0000 }, /* R18986 - ADCR_RETUNE_C22_1 */ + { 18987, 0x0000 }, /* R18987 - ADCR_RETUNE_C22_0 */ + { 18988, 0x0000 }, /* R18988 - ADCR_RETUNE_C23_1 */ + { 18989, 0x0000 }, /* R18989 - ADCR_RETUNE_C23_0 */ + { 18990, 0x0000 }, /* R18990 - ADCR_RETUNE_C24_1 */ + { 18991, 0x0000 }, /* R18991 - ADCR_RETUNE_C24_0 */ + { 18992, 0x0000 }, /* R18992 - ADCR_RETUNE_C25_1 */ + { 18993, 0x0000 }, /* R18993 - ADCR_RETUNE_C25_0 */ + { 18994, 0x0000 }, /* R18994 - ADCR_RETUNE_C26_1 */ + { 18995, 0x0000 }, /* R18995 - ADCR_RETUNE_C26_0 */ + { 18996, 0x0000 }, /* R18996 - ADCR_RETUNE_C27_1 */ + { 18997, 0x0000 }, /* R18997 - ADCR_RETUNE_C27_0 */ + { 18998, 0x0000 }, /* R18998 - ADCR_RETUNE_C28_1 */ + { 18999, 0x0000 }, /* R18999 - ADCR_RETUNE_C28_0 */ + { 19000, 0x0000 }, /* R19000 - ADCR_RETUNE_C29_1 */ + { 19001, 0x0000 }, /* R19001 - ADCR_RETUNE_C29_0 */ + { 19002, 0x0000 }, /* R19002 - ADCR_RETUNE_C30_1 */ + { 19003, 0x0000 }, /* R19003 - ADCR_RETUNE_C30_0 */ + { 19004, 0x0000 }, /* R19004 - ADCR_RETUNE_C31_1 */ + { 19005, 0x0000 }, /* R19005 - ADCR_RETUNE_C31_0 */ + { 19006, 0x0000 }, /* R19006 - ADCR_RETUNE_C32_1 */ + { 19007, 0x0000 }, /* R19007 - ADCR_RETUNE_C32_0 */ + + { 19456, 0x007F }, /* R19456 - DACL_RETUNE_C1_1 */ + { 19457, 0xFFFF }, /* R19457 - DACL_RETUNE_C1_0 */ + { 19458, 0x0000 }, /* R19458 - DACL_RETUNE_C2_1 */ + { 19459, 0x0000 }, /* R19459 - DACL_RETUNE_C2_0 */ + { 19460, 0x0000 }, /* R19460 - DACL_RETUNE_C3_1 */ + { 19461, 0x0000 }, /* R19461 - DACL_RETUNE_C3_0 */ + { 19462, 0x0000 }, /* R19462 - DACL_RETUNE_C4_1 */ + { 19463, 0x0000 }, /* R19463 - DACL_RETUNE_C4_0 */ + { 19464, 0x0000 }, /* R19464 - DACL_RETUNE_C5_1 */ + { 19465, 0x0000 }, /* R19465 - DACL_RETUNE_C5_0 */ + { 19466, 0x0000 }, /* R19466 - DACL_RETUNE_C6_1 */ + { 19467, 0x0000 }, /* R19467 - DACL_RETUNE_C6_0 */ + { 19468, 0x0000 }, /* R19468 - DACL_RETUNE_C7_1 */ + { 19469, 0x0000 }, /* R19469 - DACL_RETUNE_C7_0 */ + { 19470, 0x0000 }, /* R19470 - DACL_RETUNE_C8_1 */ + { 19471, 0x0000 }, /* R19471 - DACL_RETUNE_C8_0 */ + { 19472, 0x0000 }, /* R19472 - DACL_RETUNE_C9_1 */ + { 19473, 0x0000 }, /* R19473 - DACL_RETUNE_C9_0 */ + { 19474, 0x0000 }, /* R19474 - DACL_RETUNE_C10_1 */ + { 19475, 0x0000 }, /* R19475 - DACL_RETUNE_C10_0 */ + { 19476, 0x0000 }, /* R19476 - DACL_RETUNE_C11_1 */ + { 19477, 0x0000 }, /* R19477 - DACL_RETUNE_C11_0 */ + { 19478, 0x0000 }, /* R19478 - DACL_RETUNE_C12_1 */ + { 19479, 0x0000 }, /* R19479 - DACL_RETUNE_C12_0 */ + { 19480, 0x0000 }, /* R19480 - DACL_RETUNE_C13_1 */ + { 19481, 0x0000 }, /* R19481 - DACL_RETUNE_C13_0 */ + { 19482, 0x0000 }, /* R19482 - DACL_RETUNE_C14_1 */ + { 19483, 0x0000 }, /* R19483 - DACL_RETUNE_C14_0 */ + { 19484, 0x0000 }, /* R19484 - DACL_RETUNE_C15_1 */ + { 19485, 0x0000 }, /* R19485 - DACL_RETUNE_C15_0 */ + { 19486, 0x0000 }, /* R19486 - DACL_RETUNE_C16_1 */ + { 19487, 0x0000 }, /* R19487 - DACL_RETUNE_C16_0 */ + { 19488, 0x0000 }, /* R19488 - DACL_RETUNE_C17_1 */ + { 19489, 0x0000 }, /* R19489 - DACL_RETUNE_C17_0 */ + { 19490, 0x0000 }, /* R19490 - DACL_RETUNE_C18_1 */ + { 19491, 0x0000 }, /* R19491 - DACL_RETUNE_C18_0 */ + { 19492, 0x0000 }, /* R19492 - DACL_RETUNE_C19_1 */ + { 19493, 0x0000 }, /* R19493 - DACL_RETUNE_C19_0 */ + { 19494, 0x0000 }, /* R19494 - DACL_RETUNE_C20_1 */ + { 19495, 0x0000 }, /* R19495 - DACL_RETUNE_C20_0 */ + { 19496, 0x0000 }, /* R19496 - DACL_RETUNE_C21_1 */ + { 19497, 0x0000 }, /* R19497 - DACL_RETUNE_C21_0 */ + { 19498, 0x0000 }, /* R19498 - DACL_RETUNE_C22_1 */ + { 19499, 0x0000 }, /* R19499 - DACL_RETUNE_C22_0 */ + { 19500, 0x0000 }, /* R19500 - DACL_RETUNE_C23_1 */ + { 19501, 0x0000 }, /* R19501 - DACL_RETUNE_C23_0 */ + { 19502, 0x0000 }, /* R19502 - DACL_RETUNE_C24_1 */ + { 19503, 0x0000 }, /* R19503 - DACL_RETUNE_C24_0 */ + { 19504, 0x0000 }, /* R19504 - DACL_RETUNE_C25_1 */ + { 19505, 0x0000 }, /* R19505 - DACL_RETUNE_C25_0 */ + { 19506, 0x0000 }, /* R19506 - DACL_RETUNE_C26_1 */ + { 19507, 0x0000 }, /* R19507 - DACL_RETUNE_C26_0 */ + { 19508, 0x0000 }, /* R19508 - DACL_RETUNE_C27_1 */ + { 19509, 0x0000 }, /* R19509 - DACL_RETUNE_C27_0 */ + { 19510, 0x0000 }, /* R19510 - DACL_RETUNE_C28_1 */ + { 19511, 0x0000 }, /* R19511 - DACL_RETUNE_C28_0 */ + { 19512, 0x0000 }, /* R19512 - DACL_RETUNE_C29_1 */ + { 19513, 0x0000 }, /* R19513 - DACL_RETUNE_C29_0 */ + { 19514, 0x0000 }, /* R19514 - DACL_RETUNE_C30_1 */ + { 19515, 0x0000 }, /* R19515 - DACL_RETUNE_C30_0 */ + { 19516, 0x0000 }, /* R19516 - DACL_RETUNE_C31_1 */ + { 19517, 0x0000 }, /* R19517 - DACL_RETUNE_C31_0 */ + { 19518, 0x0000 }, /* R19518 - DACL_RETUNE_C32_1 */ + { 19519, 0x0000 }, /* R19519 - DACL_RETUNE_C32_0 */ + + { 19968, 0x0020 }, /* R19968 - RETUNEDAC_PG2_1 */ + { 19969, 0x0000 }, /* R19969 - RETUNEDAC_PG2_0 */ + { 19970, 0x0040 }, /* R19970 - RETUNEDAC_PG_1 */ + { 19971, 0x0000 }, /* R19971 - RETUNEDAC_PG_0 */ + + { 20480, 0x007F }, /* R20480 - DACR_RETUNE_C1_1 */ + { 20481, 0xFFFF }, /* R20481 - DACR_RETUNE_C1_0 */ + { 20482, 0x0000 }, /* R20482 - DACR_RETUNE_C2_1 */ + { 20483, 0x0000 }, /* R20483 - DACR_RETUNE_C2_0 */ + { 20484, 0x0000 }, /* R20484 - DACR_RETUNE_C3_1 */ + { 20485, 0x0000 }, /* R20485 - DACR_RETUNE_C3_0 */ + { 20486, 0x0000 }, /* R20486 - DACR_RETUNE_C4_1 */ + { 20487, 0x0000 }, /* R20487 - DACR_RETUNE_C4_0 */ + { 20488, 0x0000 }, /* R20488 - DACR_RETUNE_C5_1 */ + { 20489, 0x0000 }, /* R20489 - DACR_RETUNE_C5_0 */ + { 20490, 0x0000 }, /* R20490 - DACR_RETUNE_C6_1 */ + { 20491, 0x0000 }, /* R20491 - DACR_RETUNE_C6_0 */ + { 20492, 0x0000 }, /* R20492 - DACR_RETUNE_C7_1 */ + { 20493, 0x0000 }, /* R20493 - DACR_RETUNE_C7_0 */ + { 20494, 0x0000 }, /* R20494 - DACR_RETUNE_C8_1 */ + { 20495, 0x0000 }, /* R20495 - DACR_RETUNE_C8_0 */ + { 20496, 0x0000 }, /* R20496 - DACR_RETUNE_C9_1 */ + { 20497, 0x0000 }, /* R20497 - DACR_RETUNE_C9_0 */ + { 20498, 0x0000 }, /* R20498 - DACR_RETUNE_C10_1 */ + { 20499, 0x0000 }, /* R20499 - DACR_RETUNE_C10_0 */ + { 20500, 0x0000 }, /* R20500 - DACR_RETUNE_C11_1 */ + { 20501, 0x0000 }, /* R20501 - DACR_RETUNE_C11_0 */ + { 20502, 0x0000 }, /* R20502 - DACR_RETUNE_C12_1 */ + { 20503, 0x0000 }, /* R20503 - DACR_RETUNE_C12_0 */ + { 20504, 0x0000 }, /* R20504 - DACR_RETUNE_C13_1 */ + { 20505, 0x0000 }, /* R20505 - DACR_RETUNE_C13_0 */ + { 20506, 0x0000 }, /* R20506 - DACR_RETUNE_C14_1 */ + { 20507, 0x0000 }, /* R20507 - DACR_RETUNE_C14_0 */ + { 20508, 0x0000 }, /* R20508 - DACR_RETUNE_C15_1 */ + { 20509, 0x0000 }, /* R20509 - DACR_RETUNE_C15_0 */ + { 20510, 0x0000 }, /* R20510 - DACR_RETUNE_C16_1 */ + { 20511, 0x0000 }, /* R20511 - DACR_RETUNE_C16_0 */ + { 20512, 0x0000 }, /* R20512 - DACR_RETUNE_C17_1 */ + { 20513, 0x0000 }, /* R20513 - DACR_RETUNE_C17_0 */ + { 20514, 0x0000 }, /* R20514 - DACR_RETUNE_C18_1 */ + { 20515, 0x0000 }, /* R20515 - DACR_RETUNE_C18_0 */ + { 20516, 0x0000 }, /* R20516 - DACR_RETUNE_C19_1 */ + { 20517, 0x0000 }, /* R20517 - DACR_RETUNE_C19_0 */ + { 20518, 0x0000 }, /* R20518 - DACR_RETUNE_C20_1 */ + { 20519, 0x0000 }, /* R20519 - DACR_RETUNE_C20_0 */ + { 20520, 0x0000 }, /* R20520 - DACR_RETUNE_C21_1 */ + { 20521, 0x0000 }, /* R20521 - DACR_RETUNE_C21_0 */ + { 20522, 0x0000 }, /* R20522 - DACR_RETUNE_C22_1 */ + { 20523, 0x0000 }, /* R20523 - DACR_RETUNE_C22_0 */ + { 20524, 0x0000 }, /* R20524 - DACR_RETUNE_C23_1 */ + { 20525, 0x0000 }, /* R20525 - DACR_RETUNE_C23_0 */ + { 20526, 0x0000 }, /* R20526 - DACR_RETUNE_C24_1 */ + { 20527, 0x0000 }, /* R20527 - DACR_RETUNE_C24_0 */ + { 20528, 0x0000 }, /* R20528 - DACR_RETUNE_C25_1 */ + { 20529, 0x0000 }, /* R20529 - DACR_RETUNE_C25_0 */ + { 20530, 0x0000 }, /* R20530 - DACR_RETUNE_C26_1 */ + { 20531, 0x0000 }, /* R20531 - DACR_RETUNE_C26_0 */ + { 20532, 0x0000 }, /* R20532 - DACR_RETUNE_C27_1 */ + { 20533, 0x0000 }, /* R20533 - DACR_RETUNE_C27_0 */ + { 20534, 0x0000 }, /* R20534 - DACR_RETUNE_C28_1 */ + { 20535, 0x0000 }, /* R20535 - DACR_RETUNE_C28_0 */ + { 20536, 0x0000 }, /* R20536 - DACR_RETUNE_C29_1 */ + { 20537, 0x0000 }, /* R20537 - DACR_RETUNE_C29_0 */ + { 20538, 0x0000 }, /* R20538 - DACR_RETUNE_C30_1 */ + { 20539, 0x0000 }, /* R20539 - DACR_RETUNE_C30_0 */ + { 20540, 0x0000 }, /* R20540 - DACR_RETUNE_C31_1 */ + { 20541, 0x0000 }, /* R20541 - DACR_RETUNE_C31_0 */ + { 20542, 0x0000 }, /* R20542 - DACR_RETUNE_C32_1 */ + { 20543, 0x0000 }, /* R20543 - DACR_RETUNE_C32_0 */ + + { 20992, 0x008C }, /* R20992 - VSS_XHD2_1 */ + { 20993, 0x0200 }, /* R20993 - VSS_XHD2_0 */ + { 20994, 0x0035 }, /* R20994 - VSS_XHD3_1 */ + { 20995, 0x0700 }, /* R20995 - VSS_XHD3_0 */ + { 20996, 0x003A }, /* R20996 - VSS_XHN1_1 */ + { 20997, 0x4100 }, /* R20997 - VSS_XHN1_0 */ + { 20998, 0x008B }, /* R20998 - VSS_XHN2_1 */ + { 20999, 0x7D00 }, /* R20999 - VSS_XHN2_0 */ + { 21000, 0x003A }, /* R21000 - VSS_XHN3_1 */ + { 21001, 0x4100 }, /* R21001 - VSS_XHN3_0 */ + { 21002, 0x008C }, /* R21002 - VSS_XLA_1 */ + { 21003, 0xFEE8 }, /* R21003 - VSS_XLA_0 */ + { 21004, 0x0078 }, /* R21004 - VSS_XLB_1 */ + { 21005, 0x0000 }, /* R21005 - VSS_XLB_0 */ + { 21006, 0x003F }, /* R21006 - VSS_XLG_1 */ + { 21007, 0xB260 }, /* R21007 - VSS_XLG_0 */ + { 21008, 0x002D }, /* R21008 - VSS_PG2_1 */ + { 21009, 0x1818 }, /* R21009 - VSS_PG2_0 */ + { 21010, 0x0020 }, /* R21010 - VSS_PG_1 */ + { 21011, 0x0000 }, /* R21011 - VSS_PG_0 */ + { 21012, 0x00F1 }, /* R21012 - VSS_XTD1_1 */ + { 21013, 0x8340 }, /* R21013 - VSS_XTD1_0 */ + { 21014, 0x00FB }, /* R21014 - VSS_XTD2_1 */ + { 21015, 0x8300 }, /* R21015 - VSS_XTD2_0 */ + { 21016, 0x00EE }, /* R21016 - VSS_XTD3_1 */ + { 21017, 0xAEC0 }, /* R21017 - VSS_XTD3_0 */ + { 21018, 0x00FB }, /* R21018 - VSS_XTD4_1 */ + { 21019, 0xAC40 }, /* R21019 - VSS_XTD4_0 */ + { 21020, 0x00F1 }, /* R21020 - VSS_XTD5_1 */ + { 21021, 0x7F80 }, /* R21021 - VSS_XTD5_0 */ + { 21022, 0x00F4 }, /* R21022 - VSS_XTD6_1 */ + { 21023, 0x3B40 }, /* R21023 - VSS_XTD6_0 */ + { 21024, 0x00F5 }, /* R21024 - VSS_XTD7_1 */ + { 21025, 0xFB00 }, /* R21025 - VSS_XTD7_0 */ + { 21026, 0x00EA }, /* R21026 - VSS_XTD8_1 */ + { 21027, 0x10C0 }, /* R21027 - VSS_XTD8_0 */ + { 21028, 0x00FC }, /* R21028 - VSS_XTD9_1 */ + { 21029, 0xC580 }, /* R21029 - VSS_XTD9_0 */ + { 21030, 0x00E2 }, /* R21030 - VSS_XTD10_1 */ + { 21031, 0x75C0 }, /* R21031 - VSS_XTD10_0 */ + { 21032, 0x0004 }, /* R21032 - VSS_XTD11_1 */ + { 21033, 0xB480 }, /* R21033 - VSS_XTD11_0 */ + { 21034, 0x00D4 }, /* R21034 - VSS_XTD12_1 */ + { 21035, 0xF980 }, /* R21035 - VSS_XTD12_0 */ + { 21036, 0x0004 }, /* R21036 - VSS_XTD13_1 */ + { 21037, 0x9140 }, /* R21037 - VSS_XTD13_0 */ + { 21038, 0x00D8 }, /* R21038 - VSS_XTD14_1 */ + { 21039, 0xA480 }, /* R21039 - VSS_XTD14_0 */ + { 21040, 0x0002 }, /* R21040 - VSS_XTD15_1 */ + { 21041, 0x3DC0 }, /* R21041 - VSS_XTD15_0 */ + { 21042, 0x00CF }, /* R21042 - VSS_XTD16_1 */ + { 21043, 0x7A80 }, /* R21043 - VSS_XTD16_0 */ + { 21044, 0x00DC }, /* R21044 - VSS_XTD17_1 */ + { 21045, 0x0600 }, /* R21045 - VSS_XTD17_0 */ + { 21046, 0x00F2 }, /* R21046 - VSS_XTD18_1 */ + { 21047, 0xDAC0 }, /* R21047 - VSS_XTD18_0 */ + { 21048, 0x00BA }, /* R21048 - VSS_XTD19_1 */ + { 21049, 0xF340 }, /* R21049 - VSS_XTD19_0 */ + { 21050, 0x000A }, /* R21050 - VSS_XTD20_1 */ + { 21051, 0x7940 }, /* R21051 - VSS_XTD20_0 */ + { 21052, 0x001C }, /* R21052 - VSS_XTD21_1 */ + { 21053, 0x0680 }, /* R21053 - VSS_XTD21_0 */ + { 21054, 0x00FD }, /* R21054 - VSS_XTD22_1 */ + { 21055, 0x2D00 }, /* R21055 - VSS_XTD22_0 */ + { 21056, 0x001C }, /* R21056 - VSS_XTD23_1 */ + { 21057, 0xE840 }, /* R21057 - VSS_XTD23_0 */ + { 21058, 0x000D }, /* R21058 - VSS_XTD24_1 */ + { 21059, 0xDC40 }, /* R21059 - VSS_XTD24_0 */ + { 21060, 0x00FC }, /* R21060 - VSS_XTD25_1 */ + { 21061, 0x9D00 }, /* R21061 - VSS_XTD25_0 */ + { 21062, 0x0009 }, /* R21062 - VSS_XTD26_1 */ + { 21063, 0x5580 }, /* R21063 - VSS_XTD26_0 */ + { 21064, 0x00FE }, /* R21064 - VSS_XTD27_1 */ + { 21065, 0x7E80 }, /* R21065 - VSS_XTD27_0 */ + { 21066, 0x000E }, /* R21066 - VSS_XTD28_1 */ + { 21067, 0xAB40 }, /* R21067 - VSS_XTD28_0 */ + { 21068, 0x00F9 }, /* R21068 - VSS_XTD29_1 */ + { 21069, 0x9880 }, /* R21069 - VSS_XTD29_0 */ + { 21070, 0x0009 }, /* R21070 - VSS_XTD30_1 */ + { 21071, 0x87C0 }, /* R21071 - VSS_XTD30_0 */ + { 21072, 0x00FD }, /* R21072 - VSS_XTD31_1 */ + { 21073, 0x2C40 }, /* R21073 - VSS_XTD31_0 */ + { 21074, 0x0009 }, /* R21074 - VSS_XTD32_1 */ + { 21075, 0x4800 }, /* R21075 - VSS_XTD32_0 */ + { 21076, 0x0003 }, /* R21076 - VSS_XTS1_1 */ + { 21077, 0x5F40 }, /* R21077 - VSS_XTS1_0 */ + { 21078, 0x0000 }, /* R21078 - VSS_XTS2_1 */ + { 21079, 0x8700 }, /* R21079 - VSS_XTS2_0 */ + { 21080, 0x00FA }, /* R21080 - VSS_XTS3_1 */ + { 21081, 0xE4C0 }, /* R21081 - VSS_XTS3_0 */ + { 21082, 0x0000 }, /* R21082 - VSS_XTS4_1 */ + { 21083, 0x0B40 }, /* R21083 - VSS_XTS4_0 */ + { 21084, 0x0004 }, /* R21084 - VSS_XTS5_1 */ + { 21085, 0xE180 }, /* R21085 - VSS_XTS5_0 */ + { 21086, 0x0001 }, /* R21086 - VSS_XTS6_1 */ + { 21087, 0x1F40 }, /* R21087 - VSS_XTS6_0 */ + { 21088, 0x00F8 }, /* R21088 - VSS_XTS7_1 */ + { 21089, 0xB000 }, /* R21089 - VSS_XTS7_0 */ + { 21090, 0x00FB }, /* R21090 - VSS_XTS8_1 */ + { 21091, 0xCBC0 }, /* R21091 - VSS_XTS8_0 */ + { 21092, 0x0004 }, /* R21092 - VSS_XTS9_1 */ + { 21093, 0xF380 }, /* R21093 - VSS_XTS9_0 */ + { 21094, 0x0007 }, /* R21094 - VSS_XTS10_1 */ + { 21095, 0xDF40 }, /* R21095 - VSS_XTS10_0 */ + { 21096, 0x00FF }, /* R21096 - VSS_XTS11_1 */ + { 21097, 0x0700 }, /* R21097 - VSS_XTS11_0 */ + { 21098, 0x00EF }, /* R21098 - VSS_XTS12_1 */ + { 21099, 0xD700 }, /* R21099 - VSS_XTS12_0 */ + { 21100, 0x00FB }, /* R21100 - VSS_XTS13_1 */ + { 21101, 0xAF40 }, /* R21101 - VSS_XTS13_0 */ + { 21102, 0x0010 }, /* R21102 - VSS_XTS14_1 */ + { 21103, 0x8A80 }, /* R21103 - VSS_XTS14_0 */ + { 21104, 0x0011 }, /* R21104 - VSS_XTS15_1 */ + { 21105, 0x07C0 }, /* R21105 - VSS_XTS15_0 */ + { 21106, 0x00E0 }, /* R21106 - VSS_XTS16_1 */ + { 21107, 0x0800 }, /* R21107 - VSS_XTS16_0 */ + { 21108, 0x00D2 }, /* R21108 - VSS_XTS17_1 */ + { 21109, 0x7600 }, /* R21109 - VSS_XTS17_0 */ + { 21110, 0x0020 }, /* R21110 - VSS_XTS18_1 */ + { 21111, 0xCF40 }, /* R21111 - VSS_XTS18_0 */ + { 21112, 0x0030 }, /* R21112 - VSS_XTS19_1 */ + { 21113, 0x2340 }, /* R21113 - VSS_XTS19_0 */ + { 21114, 0x00FD }, /* R21114 - VSS_XTS20_1 */ + { 21115, 0x69C0 }, /* R21115 - VSS_XTS20_0 */ + { 21116, 0x0028 }, /* R21116 - VSS_XTS21_1 */ + { 21117, 0x3500 }, /* R21117 - VSS_XTS21_0 */ + { 21118, 0x0006 }, /* R21118 - VSS_XTS22_1 */ + { 21119, 0x3300 }, /* R21119 - VSS_XTS22_0 */ + { 21120, 0x00D9 }, /* R21120 - VSS_XTS23_1 */ + { 21121, 0xF6C0 }, /* R21121 - VSS_XTS23_0 */ + { 21122, 0x00F3 }, /* R21122 - VSS_XTS24_1 */ + { 21123, 0x3340 }, /* R21123 - VSS_XTS24_0 */ + { 21124, 0x000F }, /* R21124 - VSS_XTS25_1 */ + { 21125, 0x4200 }, /* R21125 - VSS_XTS25_0 */ + { 21126, 0x0004 }, /* R21126 - VSS_XTS26_1 */ + { 21127, 0x0C80 }, /* R21127 - VSS_XTS26_0 */ + { 21128, 0x00FB }, /* R21128 - VSS_XTS27_1 */ + { 21129, 0x3F80 }, /* R21129 - VSS_XTS27_0 */ + { 21130, 0x00F7 }, /* R21130 - VSS_XTS28_1 */ + { 21131, 0x57C0 }, /* R21131 - VSS_XTS28_0 */ + { 21132, 0x0003 }, /* R21132 - VSS_XTS29_1 */ + { 21133, 0x5400 }, /* R21133 - VSS_XTS29_0 */ + { 21134, 0x0000 }, /* R21134 - VSS_XTS30_1 */ + { 21135, 0xC6C0 }, /* R21135 - VSS_XTS30_0 */ + { 21136, 0x0003 }, /* R21136 - VSS_XTS31_1 */ + { 21137, 0x12C0 }, /* R21137 - VSS_XTS31_0 */ + { 21138, 0x00FD }, /* R21138 - VSS_XTS32_1 */ + { 21139, 0x8580 }, /* R21139 - VSS_XTS32_0 */ }; static const struct wm8962_reg_access { @@ -802,7 +804,7 @@ static const struct wm8962_reg_access { u16 vol; } wm8962_reg_access[WM8962_MAX_REGISTER + 1] = { [0] = { 0x00FF, 0x01FF, 0x0000 }, /* R0 - Left Input volume */ - [1] = { 0xFEFF, 0x01FF, 0xFFFF }, /* R1 - Right Input volume */ + [1] = { 0xFEFF, 0x01FF, 0x0000 }, /* R1 - Right Input volume */ [2] = { 0x00FF, 0x01FF, 0x0000 }, /* R2 - HPOUTL volume */ [3] = { 0x00FF, 0x01FF, 0x0000 }, /* R3 - HPOUTR volume */ [4] = { 0x07FE, 0x07FE, 0xFFFF }, /* R4 - Clocking1 */ @@ -1943,7 +1945,7 @@ static const struct wm8962_reg_access { [21139] = { 0xFFFF, 0xFFFF, 0x0000 }, /* R21139 - VSS_XTS32_0 */ }; -static int wm8962_volatile_register(struct snd_soc_codec *codec, unsigned int reg) +static bool wm8962_volatile_register(struct device *dev, unsigned int reg) { if (wm8962_reg_access[reg].vol) return 1; @@ -1951,7 +1953,7 @@ static int wm8962_volatile_register(struct snd_soc_codec *codec, unsigned int re return 0; } -static int wm8962_readable_register(struct snd_soc_codec *codec, unsigned int reg) +static bool wm8962_readable_register(struct device *dev, unsigned int reg) { if (wm8962_reg_access[reg].read) return 1; @@ -1959,15 +1961,15 @@ static int wm8962_readable_register(struct snd_soc_codec *codec, unsigned int re return 0; } -static int wm8962_reset(struct snd_soc_codec *codec) +static int wm8962_reset(struct wm8962_priv *wm8962) { int ret; - ret = snd_soc_write(codec, WM8962_SOFTWARE_RESET, 0x6243); + ret = regmap_write(wm8962->regmap, WM8962_SOFTWARE_RESET, 0x6243); if (ret != 0) return ret; - return snd_soc_write(codec, WM8962_PLL_SOFTWARE_RESET, 0); + return regmap_write(wm8962->regmap, WM8962_PLL_SOFTWARE_RESET, 0); } static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0); @@ -2345,6 +2347,10 @@ static int sysclk_event(struct snd_soc_dapm_widget *w, int src; int fll; + /* Ignore attempts to run the event during startup */ + if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) + return 0; + src = snd_soc_read(codec, WM8962_CLOCKING2) & WM8962_SYSCLK_SRC_MASK; switch (src) { @@ -2939,33 +2945,6 @@ static int wm8962_add_widgets(struct snd_soc_codec *codec) return 0; } -static void wm8962_sync_cache(struct snd_soc_codec *codec) -{ - u16 *reg_cache = codec->reg_cache; - int i; - - if (!codec->cache_sync) - return; - - dev_dbg(codec->dev, "Syncing cache\n"); - - codec->cache_only = 0; - - /* Sync back cached values if they're different from the - * hardware default. - */ - for (i = 1; i < codec->driver->reg_cache_size; i++) { - if (i == WM8962_SOFTWARE_RESET) - continue; - if (reg_cache[i] == wm8962_reg[i]) - continue; - - snd_soc_write(codec, i, reg_cache[i]); - } - - codec->cache_sync = 0; -} - /* -1 for reserved values */ static const int bclk_divs[] = { 1, -1, 2, 3, 4, -1, 6, 8, -1, 12, 16, 24, -1, 32, 32, 32 @@ -3093,7 +3072,8 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec, return ret; } - wm8962_sync_cache(codec); + regcache_cache_only(wm8962->regmap, false); + regcache_sync(wm8962->regmap); snd_soc_update_bits(codec, WM8962_ANTI_POP, WM8962_STARTUP_BIAS_ENA | @@ -3966,26 +3946,12 @@ static int wm8962_probe(struct snd_soc_codec *codec) bool dmicclk, dmicdat; wm8962->codec = codec; - INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work); - init_completion(&wm8962->fll_lock); - - codec->cache_sync = 1; - codec->dapm.idle_bias_off = 1; + codec->control_data = wm8962->regmap; - ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_I2C); + ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); if (ret != 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); - goto err; - } - - for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++) - wm8962->supplies[i].supply = wm8962_supply_names[i]; - - ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8962->supplies), - wm8962->supplies); - if (ret != 0) { - dev_err(codec->dev, "Failed to request supplies: %d\n", ret); - goto err; + return ret; } wm8962->disable_nb[0].notifier_call = wm8962_regulator_event_0; @@ -4008,43 +3974,6 @@ static int wm8962_probe(struct snd_soc_codec *codec) } } - ret = regulator_bulk_enable(ARRAY_SIZE(wm8962->supplies), - wm8962->supplies); - if (ret != 0) { - dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); - goto err_get; - } - - ret = snd_soc_read(codec, WM8962_SOFTWARE_RESET); - if (ret < 0) { - dev_err(codec->dev, "Failed to read ID register\n"); - goto err_enable; - } - if (ret != wm8962_reg[WM8962_SOFTWARE_RESET]) { - dev_err(codec->dev, "Device is not a WM8962, ID %x != %x\n", - ret, wm8962_reg[WM8962_SOFTWARE_RESET]); - ret = -EINVAL; - goto err_enable; - } - - ret = snd_soc_read(codec, WM8962_RIGHT_INPUT_VOLUME); - if (ret < 0) { - dev_err(codec->dev, "Failed to read device revision: %d\n", - ret); - goto err_enable; - } - - dev_info(codec->dev, "customer id %x revision %c\n", - (ret & WM8962_CUST_ID_MASK) >> WM8962_CUST_ID_SHIFT, - ((ret & WM8962_CHIP_REV_MASK) >> WM8962_CHIP_REV_SHIFT) - + 'A'); - - ret = wm8962_reset(codec); - if (ret < 0) { - dev_err(codec->dev, "Failed to issue reset\n"); - goto err_enable; - } - /* SYSCLK defaults to on; make sure it is off so we can safely * write to registers if the device is declocked. */ @@ -4059,8 +3988,6 @@ static int wm8962_probe(struct snd_soc_codec *codec) WM8962_OSC_ENA | WM8962_PLL2_ENA | WM8962_PLL3_ENA, 0); - regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); - if (pdata) { /* Apply static configuration for GPIOs */ for (i = 0; i < ARRAY_SIZE(pdata->gpio_init); i++) @@ -4170,13 +4097,6 @@ static int wm8962_probe(struct snd_soc_codec *codec) } return 0; - -err_enable: - regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); -err_get: - regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); -err: - return ret; } static int wm8962_remove(struct snd_soc_codec *codec) @@ -4194,7 +4114,6 @@ static int wm8962_remove(struct snd_soc_codec *codec) for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++) regulator_unregister_notifier(wm8962->supplies[i].consumer, &wm8962->disable_nb[i]); - regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); return 0; } @@ -4203,20 +4122,28 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8962 = { .probe = wm8962_probe, .remove = wm8962_remove, .set_bias_level = wm8962_set_bias_level, - .reg_cache_size = WM8962_MAX_REGISTER + 1, - .reg_word_size = sizeof(u16), - .reg_cache_default = wm8962_reg, - .volatile_register = wm8962_volatile_register, - .readable_register = wm8962_readable_register, .set_pll = wm8962_set_fll, }; +static const struct regmap_config wm8962_regmap = { + .reg_bits = 16, + .val_bits = 16, + + .max_register = WM8962_MAX_REGISTER, + .reg_defaults = wm8962_reg, + .num_reg_defaults = ARRAY_SIZE(wm8962_reg), + .volatile_reg = wm8962_volatile_register, + .readable_reg = wm8962_readable_register, + .cache_type = REGCACHE_RBTREE, +}; + #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) static __devinit int wm8962_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct wm8962_priv *wm8962; - int ret; + unsigned int reg; + int ret, i; wm8962 = kzalloc(sizeof(struct wm8962_priv), GFP_KERNEL); if (wm8962 == NULL) @@ -4224,19 +4151,103 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, wm8962); + INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work); + init_completion(&wm8962->fll_lock); wm8962->irq = i2c->irq; + for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++) + wm8962->supplies[i].supply = wm8962_supply_names[i]; + + ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8962->supplies), + wm8962->supplies); + if (ret != 0) { + dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); + goto err_alloc; + } + + ret = regulator_bulk_enable(ARRAY_SIZE(wm8962->supplies), + wm8962->supplies); + if (ret != 0) { + dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret); + goto err_get; + } + + wm8962->regmap = regmap_init_i2c(i2c, &wm8962_regmap); + if (IS_ERR(wm8962->regmap)) { + ret = PTR_ERR(wm8962->regmap); + dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); + goto err_enable; + } + + /* + * We haven't marked the chip revision as volatile due to + * sharing a register with the right input volume; explicitly + * bypass the cache to read it. + */ + regcache_cache_bypass(wm8962->regmap, true); + + ret = regmap_read(wm8962->regmap, WM8962_SOFTWARE_RESET, ®); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to read ID register\n"); + goto err_regmap; + } + if (reg != 0x6243) { + dev_err(&i2c->dev, + "Device is not a WM8962, ID %x != 0x6243\n", ret); + ret = -EINVAL; + goto err_regmap; + } + + ret = regmap_read(wm8962->regmap, WM8962_RIGHT_INPUT_VOLUME, ®); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to read device revision: %d\n", + ret); + goto err_regmap; + } + + dev_info(&i2c->dev, "customer id %x revision %c\n", + (reg & WM8962_CUST_ID_MASK) >> WM8962_CUST_ID_SHIFT, + ((reg & WM8962_CHIP_REV_MASK) >> WM8962_CHIP_REV_SHIFT) + + 'A'); + + regcache_cache_bypass(wm8962->regmap, false); + + ret = wm8962_reset(wm8962); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to issue reset\n"); + goto err_regmap; + } + + regcache_cache_only(wm8962->regmap, true); + ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8962, &wm8962_dai, 1); if (ret < 0) - kfree(wm8962); + goto err_regmap; + + /* The drivers should power up as needed */ + regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); + + return 0; +err_regmap: + regmap_exit(wm8962->regmap); +err_enable: + regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); +err_get: + regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); +err_alloc: + kfree(wm8962); return ret; } static __devexit int wm8962_i2c_remove(struct i2c_client *client) { + struct wm8962_priv *wm8962 = dev_get_drvdata(&client->dev); + snd_soc_unregister_codec(&client->dev); + regmap_exit(wm8962->regmap); + regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From bd132ec585c498ee27d7eedf8569703606743928 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 23 Oct 2011 11:10:45 +0100 Subject: ASoC: Convert wm5100 to direct regmap API usage Signed-off-by: Mark Brown --- sound/soc/codecs/wm5100-tables.c | 1488 +++++++++++++++++++------------------- sound/soc/codecs/wm5100.c | 49 +- sound/soc/codecs/wm5100.h | 7 +- 3 files changed, 786 insertions(+), 758 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm5100-tables.c b/sound/soc/codecs/wm5100-tables.c index e9ce81a..6b2ab65 100644 --- a/sound/soc/codecs/wm5100-tables.c +++ b/sound/soc/codecs/wm5100-tables.c @@ -13,7 +13,7 @@ #include "wm5100.h" -int wm5100_volatile_register(struct snd_soc_codec *codec, unsigned int reg) +bool wm5100_volatile_register(struct device *dev, unsigned int reg) { switch (reg) { case WM5100_SOFTWARE_RESET: @@ -36,7 +36,7 @@ int wm5100_volatile_register(struct snd_soc_codec *codec, unsigned int reg) } } -int wm5100_readable_register(struct snd_soc_codec *codec, unsigned int reg) +bool wm5100_readable_register(struct device *dev, unsigned int reg) { switch (reg) { case WM5100_SOFTWARE_RESET: @@ -786,746 +786,746 @@ int wm5100_readable_register(struct snd_soc_codec *codec, unsigned int reg) } } -u16 wm5100_reg_defaults[WM5100_MAX_REGISTER + 1] = { - [0x0000] = 0x0000, /* R0 - software reset */ - [0x0001] = 0x0000, /* R1 - Device Revision */ - [0x0010] = 0x0801, /* R16 - Ctrl IF 1 */ - [0x0020] = 0x0000, /* R32 - Tone Generator 1 */ - [0x0030] = 0x0000, /* R48 - PWM Drive 1 */ - [0x0031] = 0x0100, /* R49 - PWM Drive 2 */ - [0x0032] = 0x0100, /* R50 - PWM Drive 3 */ - [0x0100] = 0x0002, /* R256 - Clocking 1 */ - [0x0101] = 0x0000, /* R257 - Clocking 3 */ - [0x0102] = 0x0011, /* R258 - Clocking 4 */ - [0x0103] = 0x0011, /* R259 - Clocking 5 */ - [0x0104] = 0x0011, /* R260 - Clocking 6 */ - [0x0107] = 0x0000, /* R263 - Clocking 7 */ - [0x0108] = 0x0000, /* R264 - Clocking 8 */ - [0x0120] = 0x0000, /* R288 - ASRC_ENABLE */ - [0x0121] = 0x0000, /* R289 - ASRC_STATUS */ - [0x0122] = 0x0000, /* R290 - ASRC_RATE1 */ - [0x0141] = 0x8000, /* R321 - ISRC 1 CTRL 1 */ - [0x0142] = 0x0000, /* R322 - ISRC 1 CTRL 2 */ - [0x0143] = 0x8000, /* R323 - ISRC 2 CTRL1 */ - [0x0144] = 0x0000, /* R324 - ISRC 2 CTRL 2 */ - [0x0182] = 0x0000, /* R386 - FLL1 Control 1 */ - [0x0183] = 0x0000, /* R387 - FLL1 Control 2 */ - [0x0184] = 0x0000, /* R388 - FLL1 Control 3 */ - [0x0186] = 0x0177, /* R390 - FLL1 Control 5 */ - [0x0187] = 0x0001, /* R391 - FLL1 Control 6 */ - [0x0188] = 0x0000, /* R392 - FLL1 EFS 1 */ - [0x01A2] = 0x0000, /* R418 - FLL2 Control 1 */ - [0x01A3] = 0x0000, /* R419 - FLL2 Control 2 */ - [0x01A4] = 0x0000, /* R420 - FLL2 Control 3 */ - [0x01A6] = 0x0177, /* R422 - FLL2 Control 5 */ - [0x01A7] = 0x0001, /* R423 - FLL2 Control 6 */ - [0x01A8] = 0x0000, /* R424 - FLL2 EFS 1 */ - [0x0200] = 0x0020, /* R512 - Mic Charge Pump 1 */ - [0x0201] = 0xB084, /* R513 - Mic Charge Pump 2 */ - [0x0202] = 0xBBDE, /* R514 - HP Charge Pump 1 */ - [0x0211] = 0x20D4, /* R529 - LDO1 Control */ - [0x0215] = 0x0062, /* R533 - Mic Bias Ctrl 1 */ - [0x0216] = 0x0062, /* R534 - Mic Bias Ctrl 2 */ - [0x0217] = 0x0062, /* R535 - Mic Bias Ctrl 3 */ - [0x0280] = 0x0004, /* R640 - Accessory Detect Mode 1 */ - [0x0288] = 0x0020, /* R648 - Headphone Detect 1 */ - [0x0289] = 0x0000, /* R649 - Headphone Detect 2 */ - [0x0290] = 0x1100, /* R656 - Mic Detect 1 */ - [0x0291] = 0x009F, /* R657 - Mic Detect 2 */ - [0x0292] = 0x0000, /* R658 - Mic Detect 3 */ - [0x0301] = 0x0000, /* R769 - Input Enables */ - [0x0302] = 0x0000, /* R770 - Input Enables Status */ - [0x0310] = 0x2280, /* R784 - Status */ - [0x0311] = 0x0080, /* R785 - IN1R Control */ - [0x0312] = 0x2280, /* R786 - IN2L Control */ - [0x0313] = 0x0080, /* R787 - IN2R Control */ - [0x0314] = 0x2280, /* R788 - IN3L Control */ - [0x0315] = 0x0080, /* R789 - IN3R Control */ - [0x0316] = 0x2280, /* R790 - IN4L Control */ - [0x0317] = 0x0080, /* R791 - IN4R Control */ - [0x0318] = 0x0000, /* R792 - RXANC_SRC */ - [0x0319] = 0x0022, /* R793 - Input Volume Ramp */ - [0x0320] = 0x0180, /* R800 - ADC Digital Volume 1L */ - [0x0321] = 0x0180, /* R801 - ADC Digital Volume 1R */ - [0x0322] = 0x0180, /* R802 - ADC Digital Volume 2L */ - [0x0323] = 0x0180, /* R803 - ADC Digital Volume 2R */ - [0x0324] = 0x0180, /* R804 - ADC Digital Volume 3L */ - [0x0325] = 0x0180, /* R805 - ADC Digital Volume 3R */ - [0x0326] = 0x0180, /* R806 - ADC Digital Volume 4L */ - [0x0327] = 0x0180, /* R807 - ADC Digital Volume 4R */ - [0x0401] = 0x0000, /* R1025 - Output Enables 2 */ - [0x0402] = 0x0000, /* R1026 - Output Status 1 */ - [0x0403] = 0x0000, /* R1027 - Output Status 2 */ - [0x0408] = 0x0000, /* R1032 - Channel Enables 1 */ - [0x0410] = 0x0080, /* R1040 - Out Volume 1L */ - [0x0411] = 0x0080, /* R1041 - Out Volume 1R */ - [0x0412] = 0x0080, /* R1042 - DAC Volume Limit 1L */ - [0x0413] = 0x0080, /* R1043 - DAC Volume Limit 1R */ - [0x0414] = 0x0080, /* R1044 - Out Volume 2L */ - [0x0415] = 0x0080, /* R1045 - Out Volume 2R */ - [0x0416] = 0x0080, /* R1046 - DAC Volume Limit 2L */ - [0x0417] = 0x0080, /* R1047 - DAC Volume Limit 2R */ - [0x0418] = 0x0080, /* R1048 - Out Volume 3L */ - [0x0419] = 0x0080, /* R1049 - Out Volume 3R */ - [0x041A] = 0x0080, /* R1050 - DAC Volume Limit 3L */ - [0x041B] = 0x0080, /* R1051 - DAC Volume Limit 3R */ - [0x041C] = 0x0080, /* R1052 - Out Volume 4L */ - [0x041D] = 0x0080, /* R1053 - Out Volume 4R */ - [0x041E] = 0x0080, /* R1054 - DAC Volume Limit 5L */ - [0x041F] = 0x0080, /* R1055 - DAC Volume Limit 5R */ - [0x0420] = 0x0080, /* R1056 - DAC Volume Limit 6L */ - [0x0421] = 0x0080, /* R1057 - DAC Volume Limit 6R */ - [0x0440] = 0x0000, /* R1088 - DAC AEC Control 1 */ - [0x0441] = 0x0022, /* R1089 - Output Volume Ramp */ - [0x0480] = 0x0180, /* R1152 - DAC Digital Volume 1L */ - [0x0481] = 0x0180, /* R1153 - DAC Digital Volume 1R */ - [0x0482] = 0x0180, /* R1154 - DAC Digital Volume 2L */ - [0x0483] = 0x0180, /* R1155 - DAC Digital Volume 2R */ - [0x0484] = 0x0180, /* R1156 - DAC Digital Volume 3L */ - [0x0485] = 0x0180, /* R1157 - DAC Digital Volume 3R */ - [0x0486] = 0x0180, /* R1158 - DAC Digital Volume 4L */ - [0x0487] = 0x0180, /* R1159 - DAC Digital Volume 4R */ - [0x0488] = 0x0180, /* R1160 - DAC Digital Volume 5L */ - [0x0489] = 0x0180, /* R1161 - DAC Digital Volume 5R */ - [0x048A] = 0x0180, /* R1162 - DAC Digital Volume 6L */ - [0x048B] = 0x0180, /* R1163 - DAC Digital Volume 6R */ - [0x04C0] = 0x0069, /* R1216 - PDM SPK1 CTRL 1 */ - [0x04C1] = 0x0000, /* R1217 - PDM SPK1 CTRL 2 */ - [0x04C2] = 0x0069, /* R1218 - PDM SPK2 CTRL 1 */ - [0x04C3] = 0x0000, /* R1219 - PDM SPK2 CTRL 2 */ - [0x0500] = 0x000C, /* R1280 - Audio IF 1_1 */ - [0x0501] = 0x0008, /* R1281 - Audio IF 1_2 */ - [0x0502] = 0x0000, /* R1282 - Audio IF 1_3 */ - [0x0503] = 0x0000, /* R1283 - Audio IF 1_4 */ - [0x0504] = 0x0000, /* R1284 - Audio IF 1_5 */ - [0x0505] = 0x0300, /* R1285 - Audio IF 1_6 */ - [0x0506] = 0x0300, /* R1286 - Audio IF 1_7 */ - [0x0507] = 0x1820, /* R1287 - Audio IF 1_8 */ - [0x0508] = 0x1820, /* R1288 - Audio IF 1_9 */ - [0x0509] = 0x0000, /* R1289 - Audio IF 1_10 */ - [0x050A] = 0x0001, /* R1290 - Audio IF 1_11 */ - [0x050B] = 0x0002, /* R1291 - Audio IF 1_12 */ - [0x050C] = 0x0003, /* R1292 - Audio IF 1_13 */ - [0x050D] = 0x0004, /* R1293 - Audio IF 1_14 */ - [0x050E] = 0x0005, /* R1294 - Audio IF 1_15 */ - [0x050F] = 0x0006, /* R1295 - Audio IF 1_16 */ - [0x0510] = 0x0007, /* R1296 - Audio IF 1_17 */ - [0x0511] = 0x0000, /* R1297 - Audio IF 1_18 */ - [0x0512] = 0x0001, /* R1298 - Audio IF 1_19 */ - [0x0513] = 0x0002, /* R1299 - Audio IF 1_20 */ - [0x0514] = 0x0003, /* R1300 - Audio IF 1_21 */ - [0x0515] = 0x0004, /* R1301 - Audio IF 1_22 */ - [0x0516] = 0x0005, /* R1302 - Audio IF 1_23 */ - [0x0517] = 0x0006, /* R1303 - Audio IF 1_24 */ - [0x0518] = 0x0007, /* R1304 - Audio IF 1_25 */ - [0x0519] = 0x0000, /* R1305 - Audio IF 1_26 */ - [0x051A] = 0x0000, /* R1306 - Audio IF 1_27 */ - [0x0540] = 0x000C, /* R1344 - Audio IF 2_1 */ - [0x0541] = 0x0008, /* R1345 - Audio IF 2_2 */ - [0x0542] = 0x0000, /* R1346 - Audio IF 2_3 */ - [0x0543] = 0x0000, /* R1347 - Audio IF 2_4 */ - [0x0544] = 0x0000, /* R1348 - Audio IF 2_5 */ - [0x0545] = 0x0300, /* R1349 - Audio IF 2_6 */ - [0x0546] = 0x0300, /* R1350 - Audio IF 2_7 */ - [0x0547] = 0x1820, /* R1351 - Audio IF 2_8 */ - [0x0548] = 0x1820, /* R1352 - Audio IF 2_9 */ - [0x0549] = 0x0000, /* R1353 - Audio IF 2_10 */ - [0x054A] = 0x0001, /* R1354 - Audio IF 2_11 */ - [0x0551] = 0x0000, /* R1361 - Audio IF 2_18 */ - [0x0552] = 0x0001, /* R1362 - Audio IF 2_19 */ - [0x0559] = 0x0000, /* R1369 - Audio IF 2_26 */ - [0x055A] = 0x0000, /* R1370 - Audio IF 2_27 */ - [0x0580] = 0x000C, /* R1408 - Audio IF 3_1 */ - [0x0581] = 0x0008, /* R1409 - Audio IF 3_2 */ - [0x0582] = 0x0000, /* R1410 - Audio IF 3_3 */ - [0x0583] = 0x0000, /* R1411 - Audio IF 3_4 */ - [0x0584] = 0x0000, /* R1412 - Audio IF 3_5 */ - [0x0585] = 0x0300, /* R1413 - Audio IF 3_6 */ - [0x0586] = 0x0300, /* R1414 - Audio IF 3_7 */ - [0x0587] = 0x1820, /* R1415 - Audio IF 3_8 */ - [0x0588] = 0x1820, /* R1416 - Audio IF 3_9 */ - [0x0589] = 0x0000, /* R1417 - Audio IF 3_10 */ - [0x058A] = 0x0001, /* R1418 - Audio IF 3_11 */ - [0x0591] = 0x0000, /* R1425 - Audio IF 3_18 */ - [0x0592] = 0x0001, /* R1426 - Audio IF 3_19 */ - [0x0599] = 0x0000, /* R1433 - Audio IF 3_26 */ - [0x059A] = 0x0000, /* R1434 - Audio IF 3_27 */ - [0x0640] = 0x0000, /* R1600 - PWM1MIX Input 1 Source */ - [0x0641] = 0x0080, /* R1601 - PWM1MIX Input 1 Volume */ - [0x0642] = 0x0000, /* R1602 - PWM1MIX Input 2 Source */ - [0x0643] = 0x0080, /* R1603 - PWM1MIX Input 2 Volume */ - [0x0644] = 0x0000, /* R1604 - PWM1MIX Input 3 Source */ - [0x0645] = 0x0080, /* R1605 - PWM1MIX Input 3 Volume */ - [0x0646] = 0x0000, /* R1606 - PWM1MIX Input 4 Source */ - [0x0647] = 0x0080, /* R1607 - PWM1MIX Input 4 Volume */ - [0x0648] = 0x0000, /* R1608 - PWM2MIX Input 1 Source */ - [0x0649] = 0x0080, /* R1609 - PWM2MIX Input 1 Volume */ - [0x064A] = 0x0000, /* R1610 - PWM2MIX Input 2 Source */ - [0x064B] = 0x0080, /* R1611 - PWM2MIX Input 2 Volume */ - [0x064C] = 0x0000, /* R1612 - PWM2MIX Input 3 Source */ - [0x064D] = 0x0080, /* R1613 - PWM2MIX Input 3 Volume */ - [0x064E] = 0x0000, /* R1614 - PWM2MIX Input 4 Source */ - [0x064F] = 0x0080, /* R1615 - PWM2MIX Input 4 Volume */ - [0x0680] = 0x0000, /* R1664 - OUT1LMIX Input 1 Source */ - [0x0681] = 0x0080, /* R1665 - OUT1LMIX Input 1 Volume */ - [0x0682] = 0x0000, /* R1666 - OUT1LMIX Input 2 Source */ - [0x0683] = 0x0080, /* R1667 - OUT1LMIX Input 2 Volume */ - [0x0684] = 0x0000, /* R1668 - OUT1LMIX Input 3 Source */ - [0x0685] = 0x0080, /* R1669 - OUT1LMIX Input 3 Volume */ - [0x0686] = 0x0000, /* R1670 - OUT1LMIX Input 4 Source */ - [0x0687] = 0x0080, /* R1671 - OUT1LMIX Input 4 Volume */ - [0x0688] = 0x0000, /* R1672 - OUT1RMIX Input 1 Source */ - [0x0689] = 0x0080, /* R1673 - OUT1RMIX Input 1 Volume */ - [0x068A] = 0x0000, /* R1674 - OUT1RMIX Input 2 Source */ - [0x068B] = 0x0080, /* R1675 - OUT1RMIX Input 2 Volume */ - [0x068C] = 0x0000, /* R1676 - OUT1RMIX Input 3 Source */ - [0x068D] = 0x0080, /* R1677 - OUT1RMIX Input 3 Volume */ - [0x068E] = 0x0000, /* R1678 - OUT1RMIX Input 4 Source */ - [0x068F] = 0x0080, /* R1679 - OUT1RMIX Input 4 Volume */ - [0x0690] = 0x0000, /* R1680 - OUT2LMIX Input 1 Source */ - [0x0691] = 0x0080, /* R1681 - OUT2LMIX Input 1 Volume */ - [0x0692] = 0x0000, /* R1682 - OUT2LMIX Input 2 Source */ - [0x0693] = 0x0080, /* R1683 - OUT2LMIX Input 2 Volume */ - [0x0694] = 0x0000, /* R1684 - OUT2LMIX Input 3 Source */ - [0x0695] = 0x0080, /* R1685 - OUT2LMIX Input 3 Volume */ - [0x0696] = 0x0000, /* R1686 - OUT2LMIX Input 4 Source */ - [0x0697] = 0x0080, /* R1687 - OUT2LMIX Input 4 Volume */ - [0x0698] = 0x0000, /* R1688 - OUT2RMIX Input 1 Source */ - [0x0699] = 0x0080, /* R1689 - OUT2RMIX Input 1 Volume */ - [0x069A] = 0x0000, /* R1690 - OUT2RMIX Input 2 Source */ - [0x069B] = 0x0080, /* R1691 - OUT2RMIX Input 2 Volume */ - [0x069C] = 0x0000, /* R1692 - OUT2RMIX Input 3 Source */ - [0x069D] = 0x0080, /* R1693 - OUT2RMIX Input 3 Volume */ - [0x069E] = 0x0000, /* R1694 - OUT2RMIX Input 4 Source */ - [0x069F] = 0x0080, /* R1695 - OUT2RMIX Input 4 Volume */ - [0x06A0] = 0x0000, /* R1696 - OUT3LMIX Input 1 Source */ - [0x06A1] = 0x0080, /* R1697 - OUT3LMIX Input 1 Volume */ - [0x06A2] = 0x0000, /* R1698 - OUT3LMIX Input 2 Source */ - [0x06A3] = 0x0080, /* R1699 - OUT3LMIX Input 2 Volume */ - [0x06A4] = 0x0000, /* R1700 - OUT3LMIX Input 3 Source */ - [0x06A5] = 0x0080, /* R1701 - OUT3LMIX Input 3 Volume */ - [0x06A6] = 0x0000, /* R1702 - OUT3LMIX Input 4 Source */ - [0x06A7] = 0x0080, /* R1703 - OUT3LMIX Input 4 Volume */ - [0x06A8] = 0x0000, /* R1704 - OUT3RMIX Input 1 Source */ - [0x06A9] = 0x0080, /* R1705 - OUT3RMIX Input 1 Volume */ - [0x06AA] = 0x0000, /* R1706 - OUT3RMIX Input 2 Source */ - [0x06AB] = 0x0080, /* R1707 - OUT3RMIX Input 2 Volume */ - [0x06AC] = 0x0000, /* R1708 - OUT3RMIX Input 3 Source */ - [0x06AD] = 0x0080, /* R1709 - OUT3RMIX Input 3 Volume */ - [0x06AE] = 0x0000, /* R1710 - OUT3RMIX Input 4 Source */ - [0x06AF] = 0x0080, /* R1711 - OUT3RMIX Input 4 Volume */ - [0x06B0] = 0x0000, /* R1712 - OUT4LMIX Input 1 Source */ - [0x06B1] = 0x0080, /* R1713 - OUT4LMIX Input 1 Volume */ - [0x06B2] = 0x0000, /* R1714 - OUT4LMIX Input 2 Source */ - [0x06B3] = 0x0080, /* R1715 - OUT4LMIX Input 2 Volume */ - [0x06B4] = 0x0000, /* R1716 - OUT4LMIX Input 3 Source */ - [0x06B5] = 0x0080, /* R1717 - OUT4LMIX Input 3 Volume */ - [0x06B6] = 0x0000, /* R1718 - OUT4LMIX Input 4 Source */ - [0x06B7] = 0x0080, /* R1719 - OUT4LMIX Input 4 Volume */ - [0x06B8] = 0x0000, /* R1720 - OUT4RMIX Input 1 Source */ - [0x06B9] = 0x0080, /* R1721 - OUT4RMIX Input 1 Volume */ - [0x06BA] = 0x0000, /* R1722 - OUT4RMIX Input 2 Source */ - [0x06BB] = 0x0080, /* R1723 - OUT4RMIX Input 2 Volume */ - [0x06BC] = 0x0000, /* R1724 - OUT4RMIX Input 3 Source */ - [0x06BD] = 0x0080, /* R1725 - OUT4RMIX Input 3 Volume */ - [0x06BE] = 0x0000, /* R1726 - OUT4RMIX Input 4 Source */ - [0x06BF] = 0x0080, /* R1727 - OUT4RMIX Input 4 Volume */ - [0x06C0] = 0x0000, /* R1728 - OUT5LMIX Input 1 Source */ - [0x06C1] = 0x0080, /* R1729 - OUT5LMIX Input 1 Volume */ - [0x06C2] = 0x0000, /* R1730 - OUT5LMIX Input 2 Source */ - [0x06C3] = 0x0080, /* R1731 - OUT5LMIX Input 2 Volume */ - [0x06C4] = 0x0000, /* R1732 - OUT5LMIX Input 3 Source */ - [0x06C5] = 0x0080, /* R1733 - OUT5LMIX Input 3 Volume */ - [0x06C6] = 0x0000, /* R1734 - OUT5LMIX Input 4 Source */ - [0x06C7] = 0x0080, /* R1735 - OUT5LMIX Input 4 Volume */ - [0x06C8] = 0x0000, /* R1736 - OUT5RMIX Input 1 Source */ - [0x06C9] = 0x0080, /* R1737 - OUT5RMIX Input 1 Volume */ - [0x06CA] = 0x0000, /* R1738 - OUT5RMIX Input 2 Source */ - [0x06CB] = 0x0080, /* R1739 - OUT5RMIX Input 2 Volume */ - [0x06CC] = 0x0000, /* R1740 - OUT5RMIX Input 3 Source */ - [0x06CD] = 0x0080, /* R1741 - OUT5RMIX Input 3 Volume */ - [0x06CE] = 0x0000, /* R1742 - OUT5RMIX Input 4 Source */ - [0x06CF] = 0x0080, /* R1743 - OUT5RMIX Input 4 Volume */ - [0x06D0] = 0x0000, /* R1744 - OUT6LMIX Input 1 Source */ - [0x06D1] = 0x0080, /* R1745 - OUT6LMIX Input 1 Volume */ - [0x06D2] = 0x0000, /* R1746 - OUT6LMIX Input 2 Source */ - [0x06D3] = 0x0080, /* R1747 - OUT6LMIX Input 2 Volume */ - [0x06D4] = 0x0000, /* R1748 - OUT6LMIX Input 3 Source */ - [0x06D5] = 0x0080, /* R1749 - OUT6LMIX Input 3 Volume */ - [0x06D6] = 0x0000, /* R1750 - OUT6LMIX Input 4 Source */ - [0x06D7] = 0x0080, /* R1751 - OUT6LMIX Input 4 Volume */ - [0x06D8] = 0x0000, /* R1752 - OUT6RMIX Input 1 Source */ - [0x06D9] = 0x0080, /* R1753 - OUT6RMIX Input 1 Volume */ - [0x06DA] = 0x0000, /* R1754 - OUT6RMIX Input 2 Source */ - [0x06DB] = 0x0080, /* R1755 - OUT6RMIX Input 2 Volume */ - [0x06DC] = 0x0000, /* R1756 - OUT6RMIX Input 3 Source */ - [0x06DD] = 0x0080, /* R1757 - OUT6RMIX Input 3 Volume */ - [0x06DE] = 0x0000, /* R1758 - OUT6RMIX Input 4 Source */ - [0x06DF] = 0x0080, /* R1759 - OUT6RMIX Input 4 Volume */ - [0x0700] = 0x0000, /* R1792 - AIF1TX1MIX Input 1 Source */ - [0x0701] = 0x0080, /* R1793 - AIF1TX1MIX Input 1 Volume */ - [0x0702] = 0x0000, /* R1794 - AIF1TX1MIX Input 2 Source */ - [0x0703] = 0x0080, /* R1795 - AIF1TX1MIX Input 2 Volume */ - [0x0704] = 0x0000, /* R1796 - AIF1TX1MIX Input 3 Source */ - [0x0705] = 0x0080, /* R1797 - AIF1TX1MIX Input 3 Volume */ - [0x0706] = 0x0000, /* R1798 - AIF1TX1MIX Input 4 Source */ - [0x0707] = 0x0080, /* R1799 - AIF1TX1MIX Input 4 Volume */ - [0x0708] = 0x0000, /* R1800 - AIF1TX2MIX Input 1 Source */ - [0x0709] = 0x0080, /* R1801 - AIF1TX2MIX Input 1 Volume */ - [0x070A] = 0x0000, /* R1802 - AIF1TX2MIX Input 2 Source */ - [0x070B] = 0x0080, /* R1803 - AIF1TX2MIX Input 2 Volume */ - [0x070C] = 0x0000, /* R1804 - AIF1TX2MIX Input 3 Source */ - [0x070D] = 0x0080, /* R1805 - AIF1TX2MIX Input 3 Volume */ - [0x070E] = 0x0000, /* R1806 - AIF1TX2MIX Input 4 Source */ - [0x070F] = 0x0080, /* R1807 - AIF1TX2MIX Input 4 Volume */ - [0x0710] = 0x0000, /* R1808 - AIF1TX3MIX Input 1 Source */ - [0x0711] = 0x0080, /* R1809 - AIF1TX3MIX Input 1 Volume */ - [0x0712] = 0x0000, /* R1810 - AIF1TX3MIX Input 2 Source */ - [0x0713] = 0x0080, /* R1811 - AIF1TX3MIX Input 2 Volume */ - [0x0714] = 0x0000, /* R1812 - AIF1TX3MIX Input 3 Source */ - [0x0715] = 0x0080, /* R1813 - AIF1TX3MIX Input 3 Volume */ - [0x0716] = 0x0000, /* R1814 - AIF1TX3MIX Input 4 Source */ - [0x0717] = 0x0080, /* R1815 - AIF1TX3MIX Input 4 Volume */ - [0x0718] = 0x0000, /* R1816 - AIF1TX4MIX Input 1 Source */ - [0x0719] = 0x0080, /* R1817 - AIF1TX4MIX Input 1 Volume */ - [0x071A] = 0x0000, /* R1818 - AIF1TX4MIX Input 2 Source */ - [0x071B] = 0x0080, /* R1819 - AIF1TX4MIX Input 2 Volume */ - [0x071C] = 0x0000, /* R1820 - AIF1TX4MIX Input 3 Source */ - [0x071D] = 0x0080, /* R1821 - AIF1TX4MIX Input 3 Volume */ - [0x071E] = 0x0000, /* R1822 - AIF1TX4MIX Input 4 Source */ - [0x071F] = 0x0080, /* R1823 - AIF1TX4MIX Input 4 Volume */ - [0x0720] = 0x0000, /* R1824 - AIF1TX5MIX Input 1 Source */ - [0x0721] = 0x0080, /* R1825 - AIF1TX5MIX Input 1 Volume */ - [0x0722] = 0x0000, /* R1826 - AIF1TX5MIX Input 2 Source */ - [0x0723] = 0x0080, /* R1827 - AIF1TX5MIX Input 2 Volume */ - [0x0724] = 0x0000, /* R1828 - AIF1TX5MIX Input 3 Source */ - [0x0725] = 0x0080, /* R1829 - AIF1TX5MIX Input 3 Volume */ - [0x0726] = 0x0000, /* R1830 - AIF1TX5MIX Input 4 Source */ - [0x0727] = 0x0080, /* R1831 - AIF1TX5MIX Input 4 Volume */ - [0x0728] = 0x0000, /* R1832 - AIF1TX6MIX Input 1 Source */ - [0x0729] = 0x0080, /* R1833 - AIF1TX6MIX Input 1 Volume */ - [0x072A] = 0x0000, /* R1834 - AIF1TX6MIX Input 2 Source */ - [0x072B] = 0x0080, /* R1835 - AIF1TX6MIX Input 2 Volume */ - [0x072C] = 0x0000, /* R1836 - AIF1TX6MIX Input 3 Source */ - [0x072D] = 0x0080, /* R1837 - AIF1TX6MIX Input 3 Volume */ - [0x072E] = 0x0000, /* R1838 - AIF1TX6MIX Input 4 Source */ - [0x072F] = 0x0080, /* R1839 - AIF1TX6MIX Input 4 Volume */ - [0x0730] = 0x0000, /* R1840 - AIF1TX7MIX Input 1 Source */ - [0x0731] = 0x0080, /* R1841 - AIF1TX7MIX Input 1 Volume */ - [0x0732] = 0x0000, /* R1842 - AIF1TX7MIX Input 2 Source */ - [0x0733] = 0x0080, /* R1843 - AIF1TX7MIX Input 2 Volume */ - [0x0734] = 0x0000, /* R1844 - AIF1TX7MIX Input 3 Source */ - [0x0735] = 0x0080, /* R1845 - AIF1TX7MIX Input 3 Volume */ - [0x0736] = 0x0000, /* R1846 - AIF1TX7MIX Input 4 Source */ - [0x0737] = 0x0080, /* R1847 - AIF1TX7MIX Input 4 Volume */ - [0x0738] = 0x0000, /* R1848 - AIF1TX8MIX Input 1 Source */ - [0x0739] = 0x0080, /* R1849 - AIF1TX8MIX Input 1 Volume */ - [0x073A] = 0x0000, /* R1850 - AIF1TX8MIX Input 2 Source */ - [0x073B] = 0x0080, /* R1851 - AIF1TX8MIX Input 2 Volume */ - [0x073C] = 0x0000, /* R1852 - AIF1TX8MIX Input 3 Source */ - [0x073D] = 0x0080, /* R1853 - AIF1TX8MIX Input 3 Volume */ - [0x073E] = 0x0000, /* R1854 - AIF1TX8MIX Input 4 Source */ - [0x073F] = 0x0080, /* R1855 - AIF1TX8MIX Input 4 Volume */ - [0x0740] = 0x0000, /* R1856 - AIF2TX1MIX Input 1 Source */ - [0x0741] = 0x0080, /* R1857 - AIF2TX1MIX Input 1 Volume */ - [0x0742] = 0x0000, /* R1858 - AIF2TX1MIX Input 2 Source */ - [0x0743] = 0x0080, /* R1859 - AIF2TX1MIX Input 2 Volume */ - [0x0744] = 0x0000, /* R1860 - AIF2TX1MIX Input 3 Source */ - [0x0745] = 0x0080, /* R1861 - AIF2TX1MIX Input 3 Volume */ - [0x0746] = 0x0000, /* R1862 - AIF2TX1MIX Input 4 Source */ - [0x0747] = 0x0080, /* R1863 - AIF2TX1MIX Input 4 Volume */ - [0x0748] = 0x0000, /* R1864 - AIF2TX2MIX Input 1 Source */ - [0x0749] = 0x0080, /* R1865 - AIF2TX2MIX Input 1 Volume */ - [0x074A] = 0x0000, /* R1866 - AIF2TX2MIX Input 2 Source */ - [0x074B] = 0x0080, /* R1867 - AIF2TX2MIX Input 2 Volume */ - [0x074C] = 0x0000, /* R1868 - AIF2TX2MIX Input 3 Source */ - [0x074D] = 0x0080, /* R1869 - AIF2TX2MIX Input 3 Volume */ - [0x074E] = 0x0000, /* R1870 - AIF2TX2MIX Input 4 Source */ - [0x074F] = 0x0080, /* R1871 - AIF2TX2MIX Input 4 Volume */ - [0x0780] = 0x0000, /* R1920 - AIF3TX1MIX Input 1 Source */ - [0x0781] = 0x0080, /* R1921 - AIF3TX1MIX Input 1 Volume */ - [0x0782] = 0x0000, /* R1922 - AIF3TX1MIX Input 2 Source */ - [0x0783] = 0x0080, /* R1923 - AIF3TX1MIX Input 2 Volume */ - [0x0784] = 0x0000, /* R1924 - AIF3TX1MIX Input 3 Source */ - [0x0785] = 0x0080, /* R1925 - AIF3TX1MIX Input 3 Volume */ - [0x0786] = 0x0000, /* R1926 - AIF3TX1MIX Input 4 Source */ - [0x0787] = 0x0080, /* R1927 - AIF3TX1MIX Input 4 Volume */ - [0x0788] = 0x0000, /* R1928 - AIF3TX2MIX Input 1 Source */ - [0x0789] = 0x0080, /* R1929 - AIF3TX2MIX Input 1 Volume */ - [0x078A] = 0x0000, /* R1930 - AIF3TX2MIX Input 2 Source */ - [0x078B] = 0x0080, /* R1931 - AIF3TX2MIX Input 2 Volume */ - [0x078C] = 0x0000, /* R1932 - AIF3TX2MIX Input 3 Source */ - [0x078D] = 0x0080, /* R1933 - AIF3TX2MIX Input 3 Volume */ - [0x078E] = 0x0000, /* R1934 - AIF3TX2MIX Input 4 Source */ - [0x078F] = 0x0080, /* R1935 - AIF3TX2MIX Input 4 Volume */ - [0x0880] = 0x0000, /* R2176 - EQ1MIX Input 1 Source */ - [0x0881] = 0x0080, /* R2177 - EQ1MIX Input 1 Volume */ - [0x0882] = 0x0000, /* R2178 - EQ1MIX Input 2 Source */ - [0x0883] = 0x0080, /* R2179 - EQ1MIX Input 2 Volume */ - [0x0884] = 0x0000, /* R2180 - EQ1MIX Input 3 Source */ - [0x0885] = 0x0080, /* R2181 - EQ1MIX Input 3 Volume */ - [0x0886] = 0x0000, /* R2182 - EQ1MIX Input 4 Source */ - [0x0887] = 0x0080, /* R2183 - EQ1MIX Input 4 Volume */ - [0x0888] = 0x0000, /* R2184 - EQ2MIX Input 1 Source */ - [0x0889] = 0x0080, /* R2185 - EQ2MIX Input 1 Volume */ - [0x088A] = 0x0000, /* R2186 - EQ2MIX Input 2 Source */ - [0x088B] = 0x0080, /* R2187 - EQ2MIX Input 2 Volume */ - [0x088C] = 0x0000, /* R2188 - EQ2MIX Input 3 Source */ - [0x088D] = 0x0080, /* R2189 - EQ2MIX Input 3 Volume */ - [0x088E] = 0x0000, /* R2190 - EQ2MIX Input 4 Source */ - [0x088F] = 0x0080, /* R2191 - EQ2MIX Input 4 Volume */ - [0x0890] = 0x0000, /* R2192 - EQ3MIX Input 1 Source */ - [0x0891] = 0x0080, /* R2193 - EQ3MIX Input 1 Volume */ - [0x0892] = 0x0000, /* R2194 - EQ3MIX Input 2 Source */ - [0x0893] = 0x0080, /* R2195 - EQ3MIX Input 2 Volume */ - [0x0894] = 0x0000, /* R2196 - EQ3MIX Input 3 Source */ - [0x0895] = 0x0080, /* R2197 - EQ3MIX Input 3 Volume */ - [0x0896] = 0x0000, /* R2198 - EQ3MIX Input 4 Source */ - [0x0897] = 0x0080, /* R2199 - EQ3MIX Input 4 Volume */ - [0x0898] = 0x0000, /* R2200 - EQ4MIX Input 1 Source */ - [0x0899] = 0x0080, /* R2201 - EQ4MIX Input 1 Volume */ - [0x089A] = 0x0000, /* R2202 - EQ4MIX Input 2 Source */ - [0x089B] = 0x0080, /* R2203 - EQ4MIX Input 2 Volume */ - [0x089C] = 0x0000, /* R2204 - EQ4MIX Input 3 Source */ - [0x089D] = 0x0080, /* R2205 - EQ4MIX Input 3 Volume */ - [0x089E] = 0x0000, /* R2206 - EQ4MIX Input 4 Source */ - [0x089F] = 0x0080, /* R2207 - EQ4MIX Input 4 Volume */ - [0x08C0] = 0x0000, /* R2240 - DRC1LMIX Input 1 Source */ - [0x08C1] = 0x0080, /* R2241 - DRC1LMIX Input 1 Volume */ - [0x08C2] = 0x0000, /* R2242 - DRC1LMIX Input 2 Source */ - [0x08C3] = 0x0080, /* R2243 - DRC1LMIX Input 2 Volume */ - [0x08C4] = 0x0000, /* R2244 - DRC1LMIX Input 3 Source */ - [0x08C5] = 0x0080, /* R2245 - DRC1LMIX Input 3 Volume */ - [0x08C6] = 0x0000, /* R2246 - DRC1LMIX Input 4 Source */ - [0x08C7] = 0x0080, /* R2247 - DRC1LMIX Input 4 Volume */ - [0x08C8] = 0x0000, /* R2248 - DRC1RMIX Input 1 Source */ - [0x08C9] = 0x0080, /* R2249 - DRC1RMIX Input 1 Volume */ - [0x08CA] = 0x0000, /* R2250 - DRC1RMIX Input 2 Source */ - [0x08CB] = 0x0080, /* R2251 - DRC1RMIX Input 2 Volume */ - [0x08CC] = 0x0000, /* R2252 - DRC1RMIX Input 3 Source */ - [0x08CD] = 0x0080, /* R2253 - DRC1RMIX Input 3 Volume */ - [0x08CE] = 0x0000, /* R2254 - DRC1RMIX Input 4 Source */ - [0x08CF] = 0x0080, /* R2255 - DRC1RMIX Input 4 Volume */ - [0x0900] = 0x0000, /* R2304 - HPLP1MIX Input 1 Source */ - [0x0901] = 0x0080, /* R2305 - HPLP1MIX Input 1 Volume */ - [0x0902] = 0x0000, /* R2306 - HPLP1MIX Input 2 Source */ - [0x0903] = 0x0080, /* R2307 - HPLP1MIX Input 2 Volume */ - [0x0904] = 0x0000, /* R2308 - HPLP1MIX Input 3 Source */ - [0x0905] = 0x0080, /* R2309 - HPLP1MIX Input 3 Volume */ - [0x0906] = 0x0000, /* R2310 - HPLP1MIX Input 4 Source */ - [0x0907] = 0x0080, /* R2311 - HPLP1MIX Input 4 Volume */ - [0x0908] = 0x0000, /* R2312 - HPLP2MIX Input 1 Source */ - [0x0909] = 0x0080, /* R2313 - HPLP2MIX Input 1 Volume */ - [0x090A] = 0x0000, /* R2314 - HPLP2MIX Input 2 Source */ - [0x090B] = 0x0080, /* R2315 - HPLP2MIX Input 2 Volume */ - [0x090C] = 0x0000, /* R2316 - HPLP2MIX Input 3 Source */ - [0x090D] = 0x0080, /* R2317 - HPLP2MIX Input 3 Volume */ - [0x090E] = 0x0000, /* R2318 - HPLP2MIX Input 4 Source */ - [0x090F] = 0x0080, /* R2319 - HPLP2MIX Input 4 Volume */ - [0x0910] = 0x0000, /* R2320 - HPLP3MIX Input 1 Source */ - [0x0911] = 0x0080, /* R2321 - HPLP3MIX Input 1 Volume */ - [0x0912] = 0x0000, /* R2322 - HPLP3MIX Input 2 Source */ - [0x0913] = 0x0080, /* R2323 - HPLP3MIX Input 2 Volume */ - [0x0914] = 0x0000, /* R2324 - HPLP3MIX Input 3 Source */ - [0x0915] = 0x0080, /* R2325 - HPLP3MIX Input 3 Volume */ - [0x0916] = 0x0000, /* R2326 - HPLP3MIX Input 4 Source */ - [0x0917] = 0x0080, /* R2327 - HPLP3MIX Input 4 Volume */ - [0x0918] = 0x0000, /* R2328 - HPLP4MIX Input 1 Source */ - [0x0919] = 0x0080, /* R2329 - HPLP4MIX Input 1 Volume */ - [0x091A] = 0x0000, /* R2330 - HPLP4MIX Input 2 Source */ - [0x091B] = 0x0080, /* R2331 - HPLP4MIX Input 2 Volume */ - [0x091C] = 0x0000, /* R2332 - HPLP4MIX Input 3 Source */ - [0x091D] = 0x0080, /* R2333 - HPLP4MIX Input 3 Volume */ - [0x091E] = 0x0000, /* R2334 - HPLP4MIX Input 4 Source */ - [0x091F] = 0x0080, /* R2335 - HPLP4MIX Input 4 Volume */ - [0x0940] = 0x0000, /* R2368 - DSP1LMIX Input 1 Source */ - [0x0941] = 0x0080, /* R2369 - DSP1LMIX Input 1 Volume */ - [0x0942] = 0x0000, /* R2370 - DSP1LMIX Input 2 Source */ - [0x0943] = 0x0080, /* R2371 - DSP1LMIX Input 2 Volume */ - [0x0944] = 0x0000, /* R2372 - DSP1LMIX Input 3 Source */ - [0x0945] = 0x0080, /* R2373 - DSP1LMIX Input 3 Volume */ - [0x0946] = 0x0000, /* R2374 - DSP1LMIX Input 4 Source */ - [0x0947] = 0x0080, /* R2375 - DSP1LMIX Input 4 Volume */ - [0x0948] = 0x0000, /* R2376 - DSP1RMIX Input 1 Source */ - [0x0949] = 0x0080, /* R2377 - DSP1RMIX Input 1 Volume */ - [0x094A] = 0x0000, /* R2378 - DSP1RMIX Input 2 Source */ - [0x094B] = 0x0080, /* R2379 - DSP1RMIX Input 2 Volume */ - [0x094C] = 0x0000, /* R2380 - DSP1RMIX Input 3 Source */ - [0x094D] = 0x0080, /* R2381 - DSP1RMIX Input 3 Volume */ - [0x094E] = 0x0000, /* R2382 - DSP1RMIX Input 4 Source */ - [0x094F] = 0x0080, /* R2383 - DSP1RMIX Input 4 Volume */ - [0x0950] = 0x0000, /* R2384 - DSP1AUX1MIX Input 1 Source */ - [0x0958] = 0x0000, /* R2392 - DSP1AUX2MIX Input 1 Source */ - [0x0960] = 0x0000, /* R2400 - DSP1AUX3MIX Input 1 Source */ - [0x0968] = 0x0000, /* R2408 - DSP1AUX4MIX Input 1 Source */ - [0x0970] = 0x0000, /* R2416 - DSP1AUX5MIX Input 1 Source */ - [0x0978] = 0x0000, /* R2424 - DSP1AUX6MIX Input 1 Source */ - [0x0980] = 0x0000, /* R2432 - DSP2LMIX Input 1 Source */ - [0x0981] = 0x0080, /* R2433 - DSP2LMIX Input 1 Volume */ - [0x0982] = 0x0000, /* R2434 - DSP2LMIX Input 2 Source */ - [0x0983] = 0x0080, /* R2435 - DSP2LMIX Input 2 Volume */ - [0x0984] = 0x0000, /* R2436 - DSP2LMIX Input 3 Source */ - [0x0985] = 0x0080, /* R2437 - DSP2LMIX Input 3 Volume */ - [0x0986] = 0x0000, /* R2438 - DSP2LMIX Input 4 Source */ - [0x0987] = 0x0080, /* R2439 - DSP2LMIX Input 4 Volume */ - [0x0988] = 0x0000, /* R2440 - DSP2RMIX Input 1 Source */ - [0x0989] = 0x0080, /* R2441 - DSP2RMIX Input 1 Volume */ - [0x098A] = 0x0000, /* R2442 - DSP2RMIX Input 2 Source */ - [0x098B] = 0x0080, /* R2443 - DSP2RMIX Input 2 Volume */ - [0x098C] = 0x0000, /* R2444 - DSP2RMIX Input 3 Source */ - [0x098D] = 0x0080, /* R2445 - DSP2RMIX Input 3 Volume */ - [0x098E] = 0x0000, /* R2446 - DSP2RMIX Input 4 Source */ - [0x098F] = 0x0080, /* R2447 - DSP2RMIX Input 4 Volume */ - [0x0990] = 0x0000, /* R2448 - DSP2AUX1MIX Input 1 Source */ - [0x0998] = 0x0000, /* R2456 - DSP2AUX2MIX Input 1 Source */ - [0x09A0] = 0x0000, /* R2464 - DSP2AUX3MIX Input 1 Source */ - [0x09A8] = 0x0000, /* R2472 - DSP2AUX4MIX Input 1 Source */ - [0x09B0] = 0x0000, /* R2480 - DSP2AUX5MIX Input 1 Source */ - [0x09B8] = 0x0000, /* R2488 - DSP2AUX6MIX Input 1 Source */ - [0x09C0] = 0x0000, /* R2496 - DSP3LMIX Input 1 Source */ - [0x09C1] = 0x0080, /* R2497 - DSP3LMIX Input 1 Volume */ - [0x09C2] = 0x0000, /* R2498 - DSP3LMIX Input 2 Source */ - [0x09C3] = 0x0080, /* R2499 - DSP3LMIX Input 2 Volume */ - [0x09C4] = 0x0000, /* R2500 - DSP3LMIX Input 3 Source */ - [0x09C5] = 0x0080, /* R2501 - DSP3LMIX Input 3 Volume */ - [0x09C6] = 0x0000, /* R2502 - DSP3LMIX Input 4 Source */ - [0x09C7] = 0x0080, /* R2503 - DSP3LMIX Input 4 Volume */ - [0x09C8] = 0x0000, /* R2504 - DSP3RMIX Input 1 Source */ - [0x09C9] = 0x0080, /* R2505 - DSP3RMIX Input 1 Volume */ - [0x09CA] = 0x0000, /* R2506 - DSP3RMIX Input 2 Source */ - [0x09CB] = 0x0080, /* R2507 - DSP3RMIX Input 2 Volume */ - [0x09CC] = 0x0000, /* R2508 - DSP3RMIX Input 3 Source */ - [0x09CD] = 0x0080, /* R2509 - DSP3RMIX Input 3 Volume */ - [0x09CE] = 0x0000, /* R2510 - DSP3RMIX Input 4 Source */ - [0x09CF] = 0x0080, /* R2511 - DSP3RMIX Input 4 Volume */ - [0x09D0] = 0x0000, /* R2512 - DSP3AUX1MIX Input 1 Source */ - [0x09D8] = 0x0000, /* R2520 - DSP3AUX2MIX Input 1 Source */ - [0x09E0] = 0x0000, /* R2528 - DSP3AUX3MIX Input 1 Source */ - [0x09E8] = 0x0000, /* R2536 - DSP3AUX4MIX Input 1 Source */ - [0x09F0] = 0x0000, /* R2544 - DSP3AUX5MIX Input 1 Source */ - [0x09F8] = 0x0000, /* R2552 - DSP3AUX6MIX Input 1 Source */ - [0x0A80] = 0x0000, /* R2688 - ASRC1LMIX Input 1 Source */ - [0x0A88] = 0x0000, /* R2696 - ASRC1RMIX Input 1 Source */ - [0x0A90] = 0x0000, /* R2704 - ASRC2LMIX Input 1 Source */ - [0x0A98] = 0x0000, /* R2712 - ASRC2RMIX Input 1 Source */ - [0x0B00] = 0x0000, /* R2816 - ISRC1DEC1MIX Input 1 Source */ - [0x0B08] = 0x0000, /* R2824 - ISRC1DEC2MIX Input 1 Source */ - [0x0B10] = 0x0000, /* R2832 - ISRC1DEC3MIX Input 1 Source */ - [0x0B18] = 0x0000, /* R2840 - ISRC1DEC4MIX Input 1 Source */ - [0x0B20] = 0x0000, /* R2848 - ISRC1INT1MIX Input 1 Source */ - [0x0B28] = 0x0000, /* R2856 - ISRC1INT2MIX Input 1 Source */ - [0x0B30] = 0x0000, /* R2864 - ISRC1INT3MIX Input 1 Source */ - [0x0B38] = 0x0000, /* R2872 - ISRC1INT4MIX Input 1 Source */ - [0x0B40] = 0x0000, /* R2880 - ISRC2DEC1MIX Input 1 Source */ - [0x0B48] = 0x0000, /* R2888 - ISRC2DEC2MIX Input 1 Source */ - [0x0B50] = 0x0000, /* R2896 - ISRC2DEC3MIX Input 1 Source */ - [0x0B58] = 0x0000, /* R2904 - ISRC2DEC4MIX Input 1 Source */ - [0x0B60] = 0x0000, /* R2912 - ISRC2INT1MIX Input 1 Source */ - [0x0B68] = 0x0000, /* R2920 - ISRC2INT2MIX Input 1 Source */ - [0x0B70] = 0x0000, /* R2928 - ISRC2INT3MIX Input 1 Source */ - [0x0B78] = 0x0000, /* R2936 - ISRC2INT4MIX Input 1 Source */ - [0x0C00] = 0xA001, /* R3072 - GPIO CTRL 1 */ - [0x0C01] = 0xA001, /* R3073 - GPIO CTRL 2 */ - [0x0C02] = 0xA001, /* R3074 - GPIO CTRL 3 */ - [0x0C03] = 0xA001, /* R3075 - GPIO CTRL 4 */ - [0x0C04] = 0xA001, /* R3076 - GPIO CTRL 5 */ - [0x0C05] = 0xA001, /* R3077 - GPIO CTRL 6 */ - [0x0C23] = 0x4003, /* R3107 - Misc Pad Ctrl 1 */ - [0x0C24] = 0x0000, /* R3108 - Misc Pad Ctrl 2 */ - [0x0C25] = 0x0000, /* R3109 - Misc Pad Ctrl 3 */ - [0x0C26] = 0x0000, /* R3110 - Misc Pad Ctrl 4 */ - [0x0C27] = 0x0000, /* R3111 - Misc Pad Ctrl 5 */ - [0x0C28] = 0x0000, /* R3112 - Misc GPIO 1 */ - [0x0D00] = 0x0000, /* R3328 - Interrupt Status 1 */ - [0x0D01] = 0x0000, /* R3329 - Interrupt Status 2 */ - [0x0D02] = 0x0000, /* R3330 - Interrupt Status 3 */ - [0x0D03] = 0x0000, /* R3331 - Interrupt Status 4 */ - [0x0D04] = 0x0000, /* R3332 - Interrupt Raw Status 2 */ - [0x0D05] = 0x0000, /* R3333 - Interrupt Raw Status 3 */ - [0x0D06] = 0x0000, /* R3334 - Interrupt Raw Status 4 */ - [0x0D07] = 0xFFFF, /* R3335 - Interrupt Status 1 Mask */ - [0x0D08] = 0xFFFF, /* R3336 - Interrupt Status 2 Mask */ - [0x0D09] = 0xFFFF, /* R3337 - Interrupt Status 3 Mask */ - [0x0D0A] = 0xFFFF, /* R3338 - Interrupt Status 4 Mask */ - [0x0D1F] = 0x0000, /* R3359 - Interrupt Control */ - [0x0D20] = 0xFFFF, /* R3360 - IRQ Debounce 1 */ - [0x0D21] = 0xFFFF, /* R3361 - IRQ Debounce 2 */ - [0x0E00] = 0x0000, /* R3584 - FX_Ctrl */ - [0x0E10] = 0x6318, /* R3600 - EQ1_1 */ - [0x0E11] = 0x6300, /* R3601 - EQ1_2 */ - [0x0E12] = 0x0FC8, /* R3602 - EQ1_3 */ - [0x0E13] = 0x03FE, /* R3603 - EQ1_4 */ - [0x0E14] = 0x00E0, /* R3604 - EQ1_5 */ - [0x0E15] = 0x1EC4, /* R3605 - EQ1_6 */ - [0x0E16] = 0xF136, /* R3606 - EQ1_7 */ - [0x0E17] = 0x0409, /* R3607 - EQ1_8 */ - [0x0E18] = 0x04CC, /* R3608 - EQ1_9 */ - [0x0E19] = 0x1C9B, /* R3609 - EQ1_10 */ - [0x0E1A] = 0xF337, /* R3610 - EQ1_11 */ - [0x0E1B] = 0x040B, /* R3611 - EQ1_12 */ - [0x0E1C] = 0x0CBB, /* R3612 - EQ1_13 */ - [0x0E1D] = 0x16F8, /* R3613 - EQ1_14 */ - [0x0E1E] = 0xF7D9, /* R3614 - EQ1_15 */ - [0x0E1F] = 0x040A, /* R3615 - EQ1_16 */ - [0x0E20] = 0x1F14, /* R3616 - EQ1_17 */ - [0x0E21] = 0x058C, /* R3617 - EQ1_18 */ - [0x0E22] = 0x0563, /* R3618 - EQ1_19 */ - [0x0E23] = 0x4000, /* R3619 - EQ1_20 */ - [0x0E26] = 0x6318, /* R3622 - EQ2_1 */ - [0x0E27] = 0x6300, /* R3623 - EQ2_2 */ - [0x0E28] = 0x0FC8, /* R3624 - EQ2_3 */ - [0x0E29] = 0x03FE, /* R3625 - EQ2_4 */ - [0x0E2A] = 0x00E0, /* R3626 - EQ2_5 */ - [0x0E2B] = 0x1EC4, /* R3627 - EQ2_6 */ - [0x0E2C] = 0xF136, /* R3628 - EQ2_7 */ - [0x0E2D] = 0x0409, /* R3629 - EQ2_8 */ - [0x0E2E] = 0x04CC, /* R3630 - EQ2_9 */ - [0x0E2F] = 0x1C9B, /* R3631 - EQ2_10 */ - [0x0E30] = 0xF337, /* R3632 - EQ2_11 */ - [0x0E31] = 0x040B, /* R3633 - EQ2_12 */ - [0x0E32] = 0x0CBB, /* R3634 - EQ2_13 */ - [0x0E33] = 0x16F8, /* R3635 - EQ2_14 */ - [0x0E34] = 0xF7D9, /* R3636 - EQ2_15 */ - [0x0E35] = 0x040A, /* R3637 - EQ2_16 */ - [0x0E36] = 0x1F14, /* R3638 - EQ2_17 */ - [0x0E37] = 0x058C, /* R3639 - EQ2_18 */ - [0x0E38] = 0x0563, /* R3640 - EQ2_19 */ - [0x0E39] = 0x4000, /* R3641 - EQ2_20 */ - [0x0E3C] = 0x6318, /* R3644 - EQ3_1 */ - [0x0E3D] = 0x6300, /* R3645 - EQ3_2 */ - [0x0E3E] = 0x0FC8, /* R3646 - EQ3_3 */ - [0x0E3F] = 0x03FE, /* R3647 - EQ3_4 */ - [0x0E40] = 0x00E0, /* R3648 - EQ3_5 */ - [0x0E41] = 0x1EC4, /* R3649 - EQ3_6 */ - [0x0E42] = 0xF136, /* R3650 - EQ3_7 */ - [0x0E43] = 0x0409, /* R3651 - EQ3_8 */ - [0x0E44] = 0x04CC, /* R3652 - EQ3_9 */ - [0x0E45] = 0x1C9B, /* R3653 - EQ3_10 */ - [0x0E46] = 0xF337, /* R3654 - EQ3_11 */ - [0x0E47] = 0x040B, /* R3655 - EQ3_12 */ - [0x0E48] = 0x0CBB, /* R3656 - EQ3_13 */ - [0x0E49] = 0x16F8, /* R3657 - EQ3_14 */ - [0x0E4A] = 0xF7D9, /* R3658 - EQ3_15 */ - [0x0E4B] = 0x040A, /* R3659 - EQ3_16 */ - [0x0E4C] = 0x1F14, /* R3660 - EQ3_17 */ - [0x0E4D] = 0x058C, /* R3661 - EQ3_18 */ - [0x0E4E] = 0x0563, /* R3662 - EQ3_19 */ - [0x0E4F] = 0x4000, /* R3663 - EQ3_20 */ - [0x0E52] = 0x6318, /* R3666 - EQ4_1 */ - [0x0E53] = 0x6300, /* R3667 - EQ4_2 */ - [0x0E54] = 0x0FC8, /* R3668 - EQ4_3 */ - [0x0E55] = 0x03FE, /* R3669 - EQ4_4 */ - [0x0E56] = 0x00E0, /* R3670 - EQ4_5 */ - [0x0E57] = 0x1EC4, /* R3671 - EQ4_6 */ - [0x0E58] = 0xF136, /* R3672 - EQ4_7 */ - [0x0E59] = 0x0409, /* R3673 - EQ4_8 */ - [0x0E5A] = 0x04CC, /* R3674 - EQ4_9 */ - [0x0E5B] = 0x1C9B, /* R3675 - EQ4_10 */ - [0x0E5C] = 0xF337, /* R3676 - EQ4_11 */ - [0x0E5D] = 0x040B, /* R3677 - EQ4_12 */ - [0x0E5E] = 0x0CBB, /* R3678 - EQ4_13 */ - [0x0E5F] = 0x16F8, /* R3679 - EQ4_14 */ - [0x0E60] = 0xF7D9, /* R3680 - EQ4_15 */ - [0x0E61] = 0x040A, /* R3681 - EQ4_16 */ - [0x0E62] = 0x1F14, /* R3682 - EQ4_17 */ - [0x0E63] = 0x058C, /* R3683 - EQ4_18 */ - [0x0E64] = 0x0563, /* R3684 - EQ4_19 */ - [0x0E65] = 0x4000, /* R3685 - EQ4_20 */ - [0x0E80] = 0x0018, /* R3712 - DRC1 ctrl1 */ - [0x0E81] = 0x0933, /* R3713 - DRC1 ctrl2 */ - [0x0E82] = 0x0018, /* R3714 - DRC1 ctrl3 */ - [0x0E83] = 0x0000, /* R3715 - DRC1 ctrl4 */ - [0x0E84] = 0x0000, /* R3716 - DRC1 ctrl5 */ - [0x0EC0] = 0x0000, /* R3776 - HPLPF1_1 */ - [0x0EC1] = 0x0000, /* R3777 - HPLPF1_2 */ - [0x0EC4] = 0x0000, /* R3780 - HPLPF2_1 */ - [0x0EC5] = 0x0000, /* R3781 - HPLPF2_2 */ - [0x0EC8] = 0x0000, /* R3784 - HPLPF3_1 */ - [0x0EC9] = 0x0000, /* R3785 - HPLPF3_2 */ - [0x0ECC] = 0x0000, /* R3788 - HPLPF4_1 */ - [0x0ECD] = 0x0000, /* R3789 - HPLPF4_2 */ - [0x4000] = 0x0000, /* R16384 - DSP1 DM 0 */ - [0x4001] = 0x0000, /* R16385 - DSP1 DM 1 */ - [0x4002] = 0x0000, /* R16386 - DSP1 DM 2 */ - [0x4003] = 0x0000, /* R16387 - DSP1 DM 3 */ - [0x41FC] = 0x0000, /* R16892 - DSP1 DM 508 */ - [0x41FD] = 0x0000, /* R16893 - DSP1 DM 509 */ - [0x41FE] = 0x0000, /* R16894 - DSP1 DM 510 */ - [0x41FF] = 0x0000, /* R16895 - DSP1 DM 511 */ - [0x4800] = 0x0000, /* R18432 - DSP1 PM 0 */ - [0x4801] = 0x0000, /* R18433 - DSP1 PM 1 */ - [0x4802] = 0x0000, /* R18434 - DSP1 PM 2 */ - [0x4803] = 0x0000, /* R18435 - DSP1 PM 3 */ - [0x4804] = 0x0000, /* R18436 - DSP1 PM 4 */ - [0x4805] = 0x0000, /* R18437 - DSP1 PM 5 */ - [0x4DFA] = 0x0000, /* R19962 - DSP1 PM 1530 */ - [0x4DFB] = 0x0000, /* R19963 - DSP1 PM 1531 */ - [0x4DFC] = 0x0000, /* R19964 - DSP1 PM 1532 */ - [0x4DFD] = 0x0000, /* R19965 - DSP1 PM 1533 */ - [0x4DFE] = 0x0000, /* R19966 - DSP1 PM 1534 */ - [0x4DFF] = 0x0000, /* R19967 - DSP1 PM 1535 */ - [0x5000] = 0x0000, /* R20480 - DSP1 ZM 0 */ - [0x5001] = 0x0000, /* R20481 - DSP1 ZM 1 */ - [0x5002] = 0x0000, /* R20482 - DSP1 ZM 2 */ - [0x5003] = 0x0000, /* R20483 - DSP1 ZM 3 */ - [0x57FC] = 0x0000, /* R22524 - DSP1 ZM 2044 */ - [0x57FD] = 0x0000, /* R22525 - DSP1 ZM 2045 */ - [0x57FE] = 0x0000, /* R22526 - DSP1 ZM 2046 */ - [0x57FF] = 0x0000, /* R22527 - DSP1 ZM 2047 */ - [0x6000] = 0x0000, /* R24576 - DSP2 DM 0 */ - [0x6001] = 0x0000, /* R24577 - DSP2 DM 1 */ - [0x6002] = 0x0000, /* R24578 - DSP2 DM 2 */ - [0x6003] = 0x0000, /* R24579 - DSP2 DM 3 */ - [0x61FC] = 0x0000, /* R25084 - DSP2 DM 508 */ - [0x61FD] = 0x0000, /* R25085 - DSP2 DM 509 */ - [0x61FE] = 0x0000, /* R25086 - DSP2 DM 510 */ - [0x61FF] = 0x0000, /* R25087 - DSP2 DM 511 */ - [0x6800] = 0x0000, /* R26624 - DSP2 PM 0 */ - [0x6801] = 0x0000, /* R26625 - DSP2 PM 1 */ - [0x6802] = 0x0000, /* R26626 - DSP2 PM 2 */ - [0x6803] = 0x0000, /* R26627 - DSP2 PM 3 */ - [0x6804] = 0x0000, /* R26628 - DSP2 PM 4 */ - [0x6805] = 0x0000, /* R26629 - DSP2 PM 5 */ - [0x6DFA] = 0x0000, /* R28154 - DSP2 PM 1530 */ - [0x6DFB] = 0x0000, /* R28155 - DSP2 PM 1531 */ - [0x6DFC] = 0x0000, /* R28156 - DSP2 PM 1532 */ - [0x6DFD] = 0x0000, /* R28157 - DSP2 PM 1533 */ - [0x6DFE] = 0x0000, /* R28158 - DSP2 PM 1534 */ - [0x6DFF] = 0x0000, /* R28159 - DSP2 PM 1535 */ - [0x7000] = 0x0000, /* R28672 - DSP2 ZM 0 */ - [0x7001] = 0x0000, /* R28673 - DSP2 ZM 1 */ - [0x7002] = 0x0000, /* R28674 - DSP2 ZM 2 */ - [0x7003] = 0x0000, /* R28675 - DSP2 ZM 3 */ - [0x77FC] = 0x0000, /* R30716 - DSP2 ZM 2044 */ - [0x77FD] = 0x0000, /* R30717 - DSP2 ZM 2045 */ - [0x77FE] = 0x0000, /* R30718 - DSP2 ZM 2046 */ - [0x77FF] = 0x0000, /* R30719 - DSP2 ZM 2047 */ - [0x8000] = 0x0000, /* R32768 - DSP3 DM 0 */ - [0x8001] = 0x0000, /* R32769 - DSP3 DM 1 */ - [0x8002] = 0x0000, /* R32770 - DSP3 DM 2 */ - [0x8003] = 0x0000, /* R32771 - DSP3 DM 3 */ - [0x81FC] = 0x0000, /* R33276 - DSP3 DM 508 */ - [0x81FD] = 0x0000, /* R33277 - DSP3 DM 509 */ - [0x81FE] = 0x0000, /* R33278 - DSP3 DM 510 */ - [0x81FF] = 0x0000, /* R33279 - DSP3 DM 511 */ - [0x8800] = 0x0000, /* R34816 - DSP3 PM 0 */ - [0x8801] = 0x0000, /* R34817 - DSP3 PM 1 */ - [0x8802] = 0x0000, /* R34818 - DSP3 PM 2 */ - [0x8803] = 0x0000, /* R34819 - DSP3 PM 3 */ - [0x8804] = 0x0000, /* R34820 - DSP3 PM 4 */ - [0x8805] = 0x0000, /* R34821 - DSP3 PM 5 */ - [0x8DFA] = 0x0000, /* R36346 - DSP3 PM 1530 */ - [0x8DFB] = 0x0000, /* R36347 - DSP3 PM 1531 */ - [0x8DFC] = 0x0000, /* R36348 - DSP3 PM 1532 */ - [0x8DFD] = 0x0000, /* R36349 - DSP3 PM 1533 */ - [0x8DFE] = 0x0000, /* R36350 - DSP3 PM 1534 */ - [0x8DFF] = 0x0000, /* R36351 - DSP3 PM 1535 */ - [0x9000] = 0x0000, /* R36864 - DSP3 ZM 0 */ - [0x9001] = 0x0000, /* R36865 - DSP3 ZM 1 */ - [0x9002] = 0x0000, /* R36866 - DSP3 ZM 2 */ - [0x9003] = 0x0000, /* R36867 - DSP3 ZM 3 */ - [0x97FC] = 0x0000, /* R38908 - DSP3 ZM 2044 */ - [0x97FD] = 0x0000, /* R38909 - DSP3 ZM 2045 */ - [0x97FE] = 0x0000, /* R38910 - DSP3 ZM 2046 */ - [0x97FF] = 0x0000 /* R38911 - DSP3 ZM 2047 */ +struct reg_default wm5100_reg_defaults[WM5100_REGISTER_COUNT] = { + { 0x0000, 0x0000 }, /* R0 - software reset */ + { 0x0001, 0x0000 }, /* R1 - Device Revision */ + { 0x0010, 0x0801 }, /* R16 - Ctrl IF 1 */ + { 0x0020, 0x0000 }, /* R32 - Tone Generator 1 */ + { 0x0030, 0x0000 }, /* R48 - PWM Drive 1 */ + { 0x0031, 0x0100 }, /* R49 - PWM Drive 2 */ + { 0x0032, 0x0100 }, /* R50 - PWM Drive 3 */ + { 0x0100, 0x0002 }, /* R256 - Clocking 1 */ + { 0x0101, 0x0000 }, /* R257 - Clocking 3 */ + { 0x0102, 0x0011 }, /* R258 - Clocking 4 */ + { 0x0103, 0x0011 }, /* R259 - Clocking 5 */ + { 0x0104, 0x0011 }, /* R260 - Clocking 6 */ + { 0x0107, 0x0000 }, /* R263 - Clocking 7 */ + { 0x0108, 0x0000 }, /* R264 - Clocking 8 */ + { 0x0120, 0x0000 }, /* R288 - ASRC_ENABLE */ + { 0x0121, 0x0000 }, /* R289 - ASRC_STATUS */ + { 0x0122, 0x0000 }, /* R290 - ASRC_RATE1 */ + { 0x0141, 0x8000 }, /* R321 - ISRC 1 CTRL 1 */ + { 0x0142, 0x0000 }, /* R322 - ISRC 1 CTRL 2 */ + { 0x0143, 0x8000 }, /* R323 - ISRC 2 CTRL1 */ + { 0x0144, 0x0000 }, /* R324 - ISRC 2 CTRL 2 */ + { 0x0182, 0x0000 }, /* R386 - FLL1 Control 1 */ + { 0x0183, 0x0000 }, /* R387 - FLL1 Control 2 */ + { 0x0184, 0x0000 }, /* R388 - FLL1 Control 3 */ + { 0x0186, 0x0177 }, /* R390 - FLL1 Control 5 */ + { 0x0187, 0x0001 }, /* R391 - FLL1 Control 6 */ + { 0x0188, 0x0000 }, /* R392 - FLL1 EFS 1 */ + { 0x01A2, 0x0000 }, /* R418 - FLL2 Control 1 */ + { 0x01A3, 0x0000 }, /* R419 - FLL2 Control 2 */ + { 0x01A4, 0x0000 }, /* R420 - FLL2 Control 3 */ + { 0x01A6, 0x0177 }, /* R422 - FLL2 Control 5 */ + { 0x01A7, 0x0001 }, /* R423 - FLL2 Control 6 */ + { 0x01A8, 0x0000 }, /* R424 - FLL2 EFS 1 */ + { 0x0200, 0x0020 }, /* R512 - Mic Charge Pump 1 */ + { 0x0201, 0xB084 }, /* R513 - Mic Charge Pump 2 */ + { 0x0202, 0xBBDE }, /* R514 - HP Charge Pump 1 */ + { 0x0211, 0x20D4 }, /* R529 - LDO1 Control */ + { 0x0215, 0x0062 }, /* R533 - Mic Bias Ctrl 1 */ + { 0x0216, 0x0062 }, /* R534 - Mic Bias Ctrl 2 */ + { 0x0217, 0x0062 }, /* R535 - Mic Bias Ctrl 3 */ + { 0x0280, 0x0004 }, /* R640 - Accessory Detect Mode 1 */ + { 0x0288, 0x0020 }, /* R648 - Headphone Detect 1 */ + { 0x0289, 0x0000 }, /* R649 - Headphone Detect 2 */ + { 0x0290, 0x1100 }, /* R656 - Mic Detect 1 */ + { 0x0291, 0x009F }, /* R657 - Mic Detect 2 */ + { 0x0292, 0x0000 }, /* R658 - Mic Detect 3 */ + { 0x0301, 0x0000 }, /* R769 - Input Enables */ + { 0x0302, 0x0000 }, /* R770 - Input Enables Status */ + { 0x0310, 0x2280 }, /* R784 - Status */ + { 0x0311, 0x0080 }, /* R785 - IN1R Control */ + { 0x0312, 0x2280 }, /* R786 - IN2L Control */ + { 0x0313, 0x0080 }, /* R787 - IN2R Control */ + { 0x0314, 0x2280 }, /* R788 - IN3L Control */ + { 0x0315, 0x0080 }, /* R789 - IN3R Control */ + { 0x0316, 0x2280 }, /* R790 - IN4L Control */ + { 0x0317, 0x0080 }, /* R791 - IN4R Control */ + { 0x0318, 0x0000 }, /* R792 - RXANC_SRC */ + { 0x0319, 0x0022 }, /* R793 - Input Volume Ramp */ + { 0x0320, 0x0180 }, /* R800 - ADC Digital Volume 1L */ + { 0x0321, 0x0180 }, /* R801 - ADC Digital Volume 1R */ + { 0x0322, 0x0180 }, /* R802 - ADC Digital Volume 2L */ + { 0x0323, 0x0180 }, /* R803 - ADC Digital Volume 2R */ + { 0x0324, 0x0180 }, /* R804 - ADC Digital Volume 3L */ + { 0x0325, 0x0180 }, /* R805 - ADC Digital Volume 3R */ + { 0x0326, 0x0180 }, /* R806 - ADC Digital Volume 4L */ + { 0x0327, 0x0180 }, /* R807 - ADC Digital Volume 4R */ + { 0x0401, 0x0000 }, /* R1025 - Output Enables 2 */ + { 0x0402, 0x0000 }, /* R1026 - Output Status 1 */ + { 0x0403, 0x0000 }, /* R1027 - Output Status 2 */ + { 0x0408, 0x0000 }, /* R1032 - Channel Enables 1 */ + { 0x0410, 0x0080 }, /* R1040 - Out Volume 1L */ + { 0x0411, 0x0080 }, /* R1041 - Out Volume 1R */ + { 0x0412, 0x0080 }, /* R1042 - DAC Volume Limit 1L */ + { 0x0413, 0x0080 }, /* R1043 - DAC Volume Limit 1R */ + { 0x0414, 0x0080 }, /* R1044 - Out Volume 2L */ + { 0x0415, 0x0080 }, /* R1045 - Out Volume 2R */ + { 0x0416, 0x0080 }, /* R1046 - DAC Volume Limit 2L */ + { 0x0417, 0x0080 }, /* R1047 - DAC Volume Limit 2R */ + { 0x0418, 0x0080 }, /* R1048 - Out Volume 3L */ + { 0x0419, 0x0080 }, /* R1049 - Out Volume 3R */ + { 0x041A, 0x0080 }, /* R1050 - DAC Volume Limit 3L */ + { 0x041B, 0x0080 }, /* R1051 - DAC Volume Limit 3R */ + { 0x041C, 0x0080 }, /* R1052 - Out Volume 4L */ + { 0x041D, 0x0080 }, /* R1053 - Out Volume 4R */ + { 0x041E, 0x0080 }, /* R1054 - DAC Volume Limit 5L */ + { 0x041F, 0x0080 }, /* R1055 - DAC Volume Limit 5R */ + { 0x0420, 0x0080 }, /* R1056 - DAC Volume Limit 6L */ + { 0x0421, 0x0080 }, /* R1057 - DAC Volume Limit 6R */ + { 0x0440, 0x0000 }, /* R1088 - DAC AEC Control 1 */ + { 0x0441, 0x0022 }, /* R1089 - Output Volume Ramp */ + { 0x0480, 0x0180 }, /* R1152 - DAC Digital Volume 1L */ + { 0x0481, 0x0180 }, /* R1153 - DAC Digital Volume 1R */ + { 0x0482, 0x0180 }, /* R1154 - DAC Digital Volume 2L */ + { 0x0483, 0x0180 }, /* R1155 - DAC Digital Volume 2R */ + { 0x0484, 0x0180 }, /* R1156 - DAC Digital Volume 3L */ + { 0x0485, 0x0180 }, /* R1157 - DAC Digital Volume 3R */ + { 0x0486, 0x0180 }, /* R1158 - DAC Digital Volume 4L */ + { 0x0487, 0x0180 }, /* R1159 - DAC Digital Volume 4R */ + { 0x0488, 0x0180 }, /* R1160 - DAC Digital Volume 5L */ + { 0x0489, 0x0180 }, /* R1161 - DAC Digital Volume 5R */ + { 0x048A, 0x0180 }, /* R1162 - DAC Digital Volume 6L */ + { 0x048B, 0x0180 }, /* R1163 - DAC Digital Volume 6R */ + { 0x04C0, 0x0069 }, /* R1216 - PDM SPK1 CTRL 1 */ + { 0x04C1, 0x0000 }, /* R1217 - PDM SPK1 CTRL 2 */ + { 0x04C2, 0x0069 }, /* R1218 - PDM SPK2 CTRL 1 */ + { 0x04C3, 0x0000 }, /* R1219 - PDM SPK2 CTRL 2 */ + { 0x0500, 0x000C }, /* R1280 - Audio IF 1_1 */ + { 0x0501, 0x0008 }, /* R1281 - Audio IF 1_2 */ + { 0x0502, 0x0000 }, /* R1282 - Audio IF 1_3 */ + { 0x0503, 0x0000 }, /* R1283 - Audio IF 1_4 */ + { 0x0504, 0x0000 }, /* R1284 - Audio IF 1_5 */ + { 0x0505, 0x0300 }, /* R1285 - Audio IF 1_6 */ + { 0x0506, 0x0300 }, /* R1286 - Audio IF 1_7 */ + { 0x0507, 0x1820 }, /* R1287 - Audio IF 1_8 */ + { 0x0508, 0x1820 }, /* R1288 - Audio IF 1_9 */ + { 0x0509, 0x0000 }, /* R1289 - Audio IF 1_10 */ + { 0x050A, 0x0001 }, /* R1290 - Audio IF 1_11 */ + { 0x050B, 0x0002 }, /* R1291 - Audio IF 1_12 */ + { 0x050C, 0x0003 }, /* R1292 - Audio IF 1_13 */ + { 0x050D, 0x0004 }, /* R1293 - Audio IF 1_14 */ + { 0x050E, 0x0005 }, /* R1294 - Audio IF 1_15 */ + { 0x050F, 0x0006 }, /* R1295 - Audio IF 1_16 */ + { 0x0510, 0x0007 }, /* R1296 - Audio IF 1_17 */ + { 0x0511, 0x0000 }, /* R1297 - Audio IF 1_18 */ + { 0x0512, 0x0001 }, /* R1298 - Audio IF 1_19 */ + { 0x0513, 0x0002 }, /* R1299 - Audio IF 1_20 */ + { 0x0514, 0x0003 }, /* R1300 - Audio IF 1_21 */ + { 0x0515, 0x0004 }, /* R1301 - Audio IF 1_22 */ + { 0x0516, 0x0005 }, /* R1302 - Audio IF 1_23 */ + { 0x0517, 0x0006 }, /* R1303 - Audio IF 1_24 */ + { 0x0518, 0x0007 }, /* R1304 - Audio IF 1_25 */ + { 0x0519, 0x0000 }, /* R1305 - Audio IF 1_26 */ + { 0x051A, 0x0000 }, /* R1306 - Audio IF 1_27 */ + { 0x0540, 0x000C }, /* R1344 - Audio IF 2_1 */ + { 0x0541, 0x0008 }, /* R1345 - Audio IF 2_2 */ + { 0x0542, 0x0000 }, /* R1346 - Audio IF 2_3 */ + { 0x0543, 0x0000 }, /* R1347 - Audio IF 2_4 */ + { 0x0544, 0x0000 }, /* R1348 - Audio IF 2_5 */ + { 0x0545, 0x0300 }, /* R1349 - Audio IF 2_6 */ + { 0x0546, 0x0300 }, /* R1350 - Audio IF 2_7 */ + { 0x0547, 0x1820 }, /* R1351 - Audio IF 2_8 */ + { 0x0548, 0x1820 }, /* R1352 - Audio IF 2_9 */ + { 0x0549, 0x0000 }, /* R1353 - Audio IF 2_10 */ + { 0x054A, 0x0001 }, /* R1354 - Audio IF 2_11 */ + { 0x0551, 0x0000 }, /* R1361 - Audio IF 2_18 */ + { 0x0552, 0x0001 }, /* R1362 - Audio IF 2_19 */ + { 0x0559, 0x0000 }, /* R1369 - Audio IF 2_26 */ + { 0x055A, 0x0000 }, /* R1370 - Audio IF 2_27 */ + { 0x0580, 0x000C }, /* R1408 - Audio IF 3_1 */ + { 0x0581, 0x0008 }, /* R1409 - Audio IF 3_2 */ + { 0x0582, 0x0000 }, /* R1410 - Audio IF 3_3 */ + { 0x0583, 0x0000 }, /* R1411 - Audio IF 3_4 */ + { 0x0584, 0x0000 }, /* R1412 - Audio IF 3_5 */ + { 0x0585, 0x0300 }, /* R1413 - Audio IF 3_6 */ + { 0x0586, 0x0300 }, /* R1414 - Audio IF 3_7 */ + { 0x0587, 0x1820 }, /* R1415 - Audio IF 3_8 */ + { 0x0588, 0x1820 }, /* R1416 - Audio IF 3_9 */ + { 0x0589, 0x0000 }, /* R1417 - Audio IF 3_10 */ + { 0x058A, 0x0001 }, /* R1418 - Audio IF 3_11 */ + { 0x0591, 0x0000 }, /* R1425 - Audio IF 3_18 */ + { 0x0592, 0x0001 }, /* R1426 - Audio IF 3_19 */ + { 0x0599, 0x0000 }, /* R1433 - Audio IF 3_26 */ + { 0x059A, 0x0000 }, /* R1434 - Audio IF 3_27 */ + { 0x0640, 0x0000 }, /* R1600 - PWM1MIX Input 1 Source */ + { 0x0641, 0x0080 }, /* R1601 - PWM1MIX Input 1 Volume */ + { 0x0642, 0x0000 }, /* R1602 - PWM1MIX Input 2 Source */ + { 0x0643, 0x0080 }, /* R1603 - PWM1MIX Input 2 Volume */ + { 0x0644, 0x0000 }, /* R1604 - PWM1MIX Input 3 Source */ + { 0x0645, 0x0080 }, /* R1605 - PWM1MIX Input 3 Volume */ + { 0x0646, 0x0000 }, /* R1606 - PWM1MIX Input 4 Source */ + { 0x0647, 0x0080 }, /* R1607 - PWM1MIX Input 4 Volume */ + { 0x0648, 0x0000 }, /* R1608 - PWM2MIX Input 1 Source */ + { 0x0649, 0x0080 }, /* R1609 - PWM2MIX Input 1 Volume */ + { 0x064A, 0x0000 }, /* R1610 - PWM2MIX Input 2 Source */ + { 0x064B, 0x0080 }, /* R1611 - PWM2MIX Input 2 Volume */ + { 0x064C, 0x0000 }, /* R1612 - PWM2MIX Input 3 Source */ + { 0x064D, 0x0080 }, /* R1613 - PWM2MIX Input 3 Volume */ + { 0x064E, 0x0000 }, /* R1614 - PWM2MIX Input 4 Source */ + { 0x064F, 0x0080 }, /* R1615 - PWM2MIX Input 4 Volume */ + { 0x0680, 0x0000 }, /* R1664 - OUT1LMIX Input 1 Source */ + { 0x0681, 0x0080 }, /* R1665 - OUT1LMIX Input 1 Volume */ + { 0x0682, 0x0000 }, /* R1666 - OUT1LMIX Input 2 Source */ + { 0x0683, 0x0080 }, /* R1667 - OUT1LMIX Input 2 Volume */ + { 0x0684, 0x0000 }, /* R1668 - OUT1LMIX Input 3 Source */ + { 0x0685, 0x0080 }, /* R1669 - OUT1LMIX Input 3 Volume */ + { 0x0686, 0x0000 }, /* R1670 - OUT1LMIX Input 4 Source */ + { 0x0687, 0x0080 }, /* R1671 - OUT1LMIX Input 4 Volume */ + { 0x0688, 0x0000 }, /* R1672 - OUT1RMIX Input 1 Source */ + { 0x0689, 0x0080 }, /* R1673 - OUT1RMIX Input 1 Volume */ + { 0x068A, 0x0000 }, /* R1674 - OUT1RMIX Input 2 Source */ + { 0x068B, 0x0080 }, /* R1675 - OUT1RMIX Input 2 Volume */ + { 0x068C, 0x0000 }, /* R1676 - OUT1RMIX Input 3 Source */ + { 0x068D, 0x0080 }, /* R1677 - OUT1RMIX Input 3 Volume */ + { 0x068E, 0x0000 }, /* R1678 - OUT1RMIX Input 4 Source */ + { 0x068F, 0x0080 }, /* R1679 - OUT1RMIX Input 4 Volume */ + { 0x0690, 0x0000 }, /* R1680 - OUT2LMIX Input 1 Source */ + { 0x0691, 0x0080 }, /* R1681 - OUT2LMIX Input 1 Volume */ + { 0x0692, 0x0000 }, /* R1682 - OUT2LMIX Input 2 Source */ + { 0x0693, 0x0080 }, /* R1683 - OUT2LMIX Input 2 Volume */ + { 0x0694, 0x0000 }, /* R1684 - OUT2LMIX Input 3 Source */ + { 0x0695, 0x0080 }, /* R1685 - OUT2LMIX Input 3 Volume */ + { 0x0696, 0x0000 }, /* R1686 - OUT2LMIX Input 4 Source */ + { 0x0697, 0x0080 }, /* R1687 - OUT2LMIX Input 4 Volume */ + { 0x0698, 0x0000 }, /* R1688 - OUT2RMIX Input 1 Source */ + { 0x0699, 0x0080 }, /* R1689 - OUT2RMIX Input 1 Volume */ + { 0x069A, 0x0000 }, /* R1690 - OUT2RMIX Input 2 Source */ + { 0x069B, 0x0080 }, /* R1691 - OUT2RMIX Input 2 Volume */ + { 0x069C, 0x0000 }, /* R1692 - OUT2RMIX Input 3 Source */ + { 0x069D, 0x0080 }, /* R1693 - OUT2RMIX Input 3 Volume */ + { 0x069E, 0x0000 }, /* R1694 - OUT2RMIX Input 4 Source */ + { 0x069F, 0x0080 }, /* R1695 - OUT2RMIX Input 4 Volume */ + { 0x06A0, 0x0000 }, /* R1696 - OUT3LMIX Input 1 Source */ + { 0x06A1, 0x0080 }, /* R1697 - OUT3LMIX Input 1 Volume */ + { 0x06A2, 0x0000 }, /* R1698 - OUT3LMIX Input 2 Source */ + { 0x06A3, 0x0080 }, /* R1699 - OUT3LMIX Input 2 Volume */ + { 0x06A4, 0x0000 }, /* R1700 - OUT3LMIX Input 3 Source */ + { 0x06A5, 0x0080 }, /* R1701 - OUT3LMIX Input 3 Volume */ + { 0x06A6, 0x0000 }, /* R1702 - OUT3LMIX Input 4 Source */ + { 0x06A7, 0x0080 }, /* R1703 - OUT3LMIX Input 4 Volume */ + { 0x06A8, 0x0000 }, /* R1704 - OUT3RMIX Input 1 Source */ + { 0x06A9, 0x0080 }, /* R1705 - OUT3RMIX Input 1 Volume */ + { 0x06AA, 0x0000 }, /* R1706 - OUT3RMIX Input 2 Source */ + { 0x06AB, 0x0080 }, /* R1707 - OUT3RMIX Input 2 Volume */ + { 0x06AC, 0x0000 }, /* R1708 - OUT3RMIX Input 3 Source */ + { 0x06AD, 0x0080 }, /* R1709 - OUT3RMIX Input 3 Volume */ + { 0x06AE, 0x0000 }, /* R1710 - OUT3RMIX Input 4 Source */ + { 0x06AF, 0x0080 }, /* R1711 - OUT3RMIX Input 4 Volume */ + { 0x06B0, 0x0000 }, /* R1712 - OUT4LMIX Input 1 Source */ + { 0x06B1, 0x0080 }, /* R1713 - OUT4LMIX Input 1 Volume */ + { 0x06B2, 0x0000 }, /* R1714 - OUT4LMIX Input 2 Source */ + { 0x06B3, 0x0080 }, /* R1715 - OUT4LMIX Input 2 Volume */ + { 0x06B4, 0x0000 }, /* R1716 - OUT4LMIX Input 3 Source */ + { 0x06B5, 0x0080 }, /* R1717 - OUT4LMIX Input 3 Volume */ + { 0x06B6, 0x0000 }, /* R1718 - OUT4LMIX Input 4 Source */ + { 0x06B7, 0x0080 }, /* R1719 - OUT4LMIX Input 4 Volume */ + { 0x06B8, 0x0000 }, /* R1720 - OUT4RMIX Input 1 Source */ + { 0x06B9, 0x0080 }, /* R1721 - OUT4RMIX Input 1 Volume */ + { 0x06BA, 0x0000 }, /* R1722 - OUT4RMIX Input 2 Source */ + { 0x06BB, 0x0080 }, /* R1723 - OUT4RMIX Input 2 Volume */ + { 0x06BC, 0x0000 }, /* R1724 - OUT4RMIX Input 3 Source */ + { 0x06BD, 0x0080 }, /* R1725 - OUT4RMIX Input 3 Volume */ + { 0x06BE, 0x0000 }, /* R1726 - OUT4RMIX Input 4 Source */ + { 0x06BF, 0x0080 }, /* R1727 - OUT4RMIX Input 4 Volume */ + { 0x06C0, 0x0000 }, /* R1728 - OUT5LMIX Input 1 Source */ + { 0x06C1, 0x0080 }, /* R1729 - OUT5LMIX Input 1 Volume */ + { 0x06C2, 0x0000 }, /* R1730 - OUT5LMIX Input 2 Source */ + { 0x06C3, 0x0080 }, /* R1731 - OUT5LMIX Input 2 Volume */ + { 0x06C4, 0x0000 }, /* R1732 - OUT5LMIX Input 3 Source */ + { 0x06C5, 0x0080 }, /* R1733 - OUT5LMIX Input 3 Volume */ + { 0x06C6, 0x0000 }, /* R1734 - OUT5LMIX Input 4 Source */ + { 0x06C7, 0x0080 }, /* R1735 - OUT5LMIX Input 4 Volume */ + { 0x06C8, 0x0000 }, /* R1736 - OUT5RMIX Input 1 Source */ + { 0x06C9, 0x0080 }, /* R1737 - OUT5RMIX Input 1 Volume */ + { 0x06CA, 0x0000 }, /* R1738 - OUT5RMIX Input 2 Source */ + { 0x06CB, 0x0080 }, /* R1739 - OUT5RMIX Input 2 Volume */ + { 0x06CC, 0x0000 }, /* R1740 - OUT5RMIX Input 3 Source */ + { 0x06CD, 0x0080 }, /* R1741 - OUT5RMIX Input 3 Volume */ + { 0x06CE, 0x0000 }, /* R1742 - OUT5RMIX Input 4 Source */ + { 0x06CF, 0x0080 }, /* R1743 - OUT5RMIX Input 4 Volume */ + { 0x06D0, 0x0000 }, /* R1744 - OUT6LMIX Input 1 Source */ + { 0x06D1, 0x0080 }, /* R1745 - OUT6LMIX Input 1 Volume */ + { 0x06D2, 0x0000 }, /* R1746 - OUT6LMIX Input 2 Source */ + { 0x06D3, 0x0080 }, /* R1747 - OUT6LMIX Input 2 Volume */ + { 0x06D4, 0x0000 }, /* R1748 - OUT6LMIX Input 3 Source */ + { 0x06D5, 0x0080 }, /* R1749 - OUT6LMIX Input 3 Volume */ + { 0x06D6, 0x0000 }, /* R1750 - OUT6LMIX Input 4 Source */ + { 0x06D7, 0x0080 }, /* R1751 - OUT6LMIX Input 4 Volume */ + { 0x06D8, 0x0000 }, /* R1752 - OUT6RMIX Input 1 Source */ + { 0x06D9, 0x0080 }, /* R1753 - OUT6RMIX Input 1 Volume */ + { 0x06DA, 0x0000 }, /* R1754 - OUT6RMIX Input 2 Source */ + { 0x06DB, 0x0080 }, /* R1755 - OUT6RMIX Input 2 Volume */ + { 0x06DC, 0x0000 }, /* R1756 - OUT6RMIX Input 3 Source */ + { 0x06DD, 0x0080 }, /* R1757 - OUT6RMIX Input 3 Volume */ + { 0x06DE, 0x0000 }, /* R1758 - OUT6RMIX Input 4 Source */ + { 0x06DF, 0x0080 }, /* R1759 - OUT6RMIX Input 4 Volume */ + { 0x0700, 0x0000 }, /* R1792 - AIF1TX1MIX Input 1 Source */ + { 0x0701, 0x0080 }, /* R1793 - AIF1TX1MIX Input 1 Volume */ + { 0x0702, 0x0000 }, /* R1794 - AIF1TX1MIX Input 2 Source */ + { 0x0703, 0x0080 }, /* R1795 - AIF1TX1MIX Input 2 Volume */ + { 0x0704, 0x0000 }, /* R1796 - AIF1TX1MIX Input 3 Source */ + { 0x0705, 0x0080 }, /* R1797 - AIF1TX1MIX Input 3 Volume */ + { 0x0706, 0x0000 }, /* R1798 - AIF1TX1MIX Input 4 Source */ + { 0x0707, 0x0080 }, /* R1799 - AIF1TX1MIX Input 4 Volume */ + { 0x0708, 0x0000 }, /* R1800 - AIF1TX2MIX Input 1 Source */ + { 0x0709, 0x0080 }, /* R1801 - AIF1TX2MIX Input 1 Volume */ + { 0x070A, 0x0000 }, /* R1802 - AIF1TX2MIX Input 2 Source */ + { 0x070B, 0x0080 }, /* R1803 - AIF1TX2MIX Input 2 Volume */ + { 0x070C, 0x0000 }, /* R1804 - AIF1TX2MIX Input 3 Source */ + { 0x070D, 0x0080 }, /* R1805 - AIF1TX2MIX Input 3 Volume */ + { 0x070E, 0x0000 }, /* R1806 - AIF1TX2MIX Input 4 Source */ + { 0x070F, 0x0080 }, /* R1807 - AIF1TX2MIX Input 4 Volume */ + { 0x0710, 0x0000 }, /* R1808 - AIF1TX3MIX Input 1 Source */ + { 0x0711, 0x0080 }, /* R1809 - AIF1TX3MIX Input 1 Volume */ + { 0x0712, 0x0000 }, /* R1810 - AIF1TX3MIX Input 2 Source */ + { 0x0713, 0x0080 }, /* R1811 - AIF1TX3MIX Input 2 Volume */ + { 0x0714, 0x0000 }, /* R1812 - AIF1TX3MIX Input 3 Source */ + { 0x0715, 0x0080 }, /* R1813 - AIF1TX3MIX Input 3 Volume */ + { 0x0716, 0x0000 }, /* R1814 - AIF1TX3MIX Input 4 Source */ + { 0x0717, 0x0080 }, /* R1815 - AIF1TX3MIX Input 4 Volume */ + { 0x0718, 0x0000 }, /* R1816 - AIF1TX4MIX Input 1 Source */ + { 0x0719, 0x0080 }, /* R1817 - AIF1TX4MIX Input 1 Volume */ + { 0x071A, 0x0000 }, /* R1818 - AIF1TX4MIX Input 2 Source */ + { 0x071B, 0x0080 }, /* R1819 - AIF1TX4MIX Input 2 Volume */ + { 0x071C, 0x0000 }, /* R1820 - AIF1TX4MIX Input 3 Source */ + { 0x071D, 0x0080 }, /* R1821 - AIF1TX4MIX Input 3 Volume */ + { 0x071E, 0x0000 }, /* R1822 - AIF1TX4MIX Input 4 Source */ + { 0x071F, 0x0080 }, /* R1823 - AIF1TX4MIX Input 4 Volume */ + { 0x0720, 0x0000 }, /* R1824 - AIF1TX5MIX Input 1 Source */ + { 0x0721, 0x0080 }, /* R1825 - AIF1TX5MIX Input 1 Volume */ + { 0x0722, 0x0000 }, /* R1826 - AIF1TX5MIX Input 2 Source */ + { 0x0723, 0x0080 }, /* R1827 - AIF1TX5MIX Input 2 Volume */ + { 0x0724, 0x0000 }, /* R1828 - AIF1TX5MIX Input 3 Source */ + { 0x0725, 0x0080 }, /* R1829 - AIF1TX5MIX Input 3 Volume */ + { 0x0726, 0x0000 }, /* R1830 - AIF1TX5MIX Input 4 Source */ + { 0x0727, 0x0080 }, /* R1831 - AIF1TX5MIX Input 4 Volume */ + { 0x0728, 0x0000 }, /* R1832 - AIF1TX6MIX Input 1 Source */ + { 0x0729, 0x0080 }, /* R1833 - AIF1TX6MIX Input 1 Volume */ + { 0x072A, 0x0000 }, /* R1834 - AIF1TX6MIX Input 2 Source */ + { 0x072B, 0x0080 }, /* R1835 - AIF1TX6MIX Input 2 Volume */ + { 0x072C, 0x0000 }, /* R1836 - AIF1TX6MIX Input 3 Source */ + { 0x072D, 0x0080 }, /* R1837 - AIF1TX6MIX Input 3 Volume */ + { 0x072E, 0x0000 }, /* R1838 - AIF1TX6MIX Input 4 Source */ + { 0x072F, 0x0080 }, /* R1839 - AIF1TX6MIX Input 4 Volume */ + { 0x0730, 0x0000 }, /* R1840 - AIF1TX7MIX Input 1 Source */ + { 0x0731, 0x0080 }, /* R1841 - AIF1TX7MIX Input 1 Volume */ + { 0x0732, 0x0000 }, /* R1842 - AIF1TX7MIX Input 2 Source */ + { 0x0733, 0x0080 }, /* R1843 - AIF1TX7MIX Input 2 Volume */ + { 0x0734, 0x0000 }, /* R1844 - AIF1TX7MIX Input 3 Source */ + { 0x0735, 0x0080 }, /* R1845 - AIF1TX7MIX Input 3 Volume */ + { 0x0736, 0x0000 }, /* R1846 - AIF1TX7MIX Input 4 Source */ + { 0x0737, 0x0080 }, /* R1847 - AIF1TX7MIX Input 4 Volume */ + { 0x0738, 0x0000 }, /* R1848 - AIF1TX8MIX Input 1 Source */ + { 0x0739, 0x0080 }, /* R1849 - AIF1TX8MIX Input 1 Volume */ + { 0x073A, 0x0000 }, /* R1850 - AIF1TX8MIX Input 2 Source */ + { 0x073B, 0x0080 }, /* R1851 - AIF1TX8MIX Input 2 Volume */ + { 0x073C, 0x0000 }, /* R1852 - AIF1TX8MIX Input 3 Source */ + { 0x073D, 0x0080 }, /* R1853 - AIF1TX8MIX Input 3 Volume */ + { 0x073E, 0x0000 }, /* R1854 - AIF1TX8MIX Input 4 Source */ + { 0x073F, 0x0080 }, /* R1855 - AIF1TX8MIX Input 4 Volume */ + { 0x0740, 0x0000 }, /* R1856 - AIF2TX1MIX Input 1 Source */ + { 0x0741, 0x0080 }, /* R1857 - AIF2TX1MIX Input 1 Volume */ + { 0x0742, 0x0000 }, /* R1858 - AIF2TX1MIX Input 2 Source */ + { 0x0743, 0x0080 }, /* R1859 - AIF2TX1MIX Input 2 Volume */ + { 0x0744, 0x0000 }, /* R1860 - AIF2TX1MIX Input 3 Source */ + { 0x0745, 0x0080 }, /* R1861 - AIF2TX1MIX Input 3 Volume */ + { 0x0746, 0x0000 }, /* R1862 - AIF2TX1MIX Input 4 Source */ + { 0x0747, 0x0080 }, /* R1863 - AIF2TX1MIX Input 4 Volume */ + { 0x0748, 0x0000 }, /* R1864 - AIF2TX2MIX Input 1 Source */ + { 0x0749, 0x0080 }, /* R1865 - AIF2TX2MIX Input 1 Volume */ + { 0x074A, 0x0000 }, /* R1866 - AIF2TX2MIX Input 2 Source */ + { 0x074B, 0x0080 }, /* R1867 - AIF2TX2MIX Input 2 Volume */ + { 0x074C, 0x0000 }, /* R1868 - AIF2TX2MIX Input 3 Source */ + { 0x074D, 0x0080 }, /* R1869 - AIF2TX2MIX Input 3 Volume */ + { 0x074E, 0x0000 }, /* R1870 - AIF2TX2MIX Input 4 Source */ + { 0x074F, 0x0080 }, /* R1871 - AIF2TX2MIX Input 4 Volume */ + { 0x0780, 0x0000 }, /* R1920 - AIF3TX1MIX Input 1 Source */ + { 0x0781, 0x0080 }, /* R1921 - AIF3TX1MIX Input 1 Volume */ + { 0x0782, 0x0000 }, /* R1922 - AIF3TX1MIX Input 2 Source */ + { 0x0783, 0x0080 }, /* R1923 - AIF3TX1MIX Input 2 Volume */ + { 0x0784, 0x0000 }, /* R1924 - AIF3TX1MIX Input 3 Source */ + { 0x0785, 0x0080 }, /* R1925 - AIF3TX1MIX Input 3 Volume */ + { 0x0786, 0x0000 }, /* R1926 - AIF3TX1MIX Input 4 Source */ + { 0x0787, 0x0080 }, /* R1927 - AIF3TX1MIX Input 4 Volume */ + { 0x0788, 0x0000 }, /* R1928 - AIF3TX2MIX Input 1 Source */ + { 0x0789, 0x0080 }, /* R1929 - AIF3TX2MIX Input 1 Volume */ + { 0x078A, 0x0000 }, /* R1930 - AIF3TX2MIX Input 2 Source */ + { 0x078B, 0x0080 }, /* R1931 - AIF3TX2MIX Input 2 Volume */ + { 0x078C, 0x0000 }, /* R1932 - AIF3TX2MIX Input 3 Source */ + { 0x078D, 0x0080 }, /* R1933 - AIF3TX2MIX Input 3 Volume */ + { 0x078E, 0x0000 }, /* R1934 - AIF3TX2MIX Input 4 Source */ + { 0x078F, 0x0080 }, /* R1935 - AIF3TX2MIX Input 4 Volume */ + { 0x0880, 0x0000 }, /* R2176 - EQ1MIX Input 1 Source */ + { 0x0881, 0x0080 }, /* R2177 - EQ1MIX Input 1 Volume */ + { 0x0882, 0x0000 }, /* R2178 - EQ1MIX Input 2 Source */ + { 0x0883, 0x0080 }, /* R2179 - EQ1MIX Input 2 Volume */ + { 0x0884, 0x0000 }, /* R2180 - EQ1MIX Input 3 Source */ + { 0x0885, 0x0080 }, /* R2181 - EQ1MIX Input 3 Volume */ + { 0x0886, 0x0000 }, /* R2182 - EQ1MIX Input 4 Source */ + { 0x0887, 0x0080 }, /* R2183 - EQ1MIX Input 4 Volume */ + { 0x0888, 0x0000 }, /* R2184 - EQ2MIX Input 1 Source */ + { 0x0889, 0x0080 }, /* R2185 - EQ2MIX Input 1 Volume */ + { 0x088A, 0x0000 }, /* R2186 - EQ2MIX Input 2 Source */ + { 0x088B, 0x0080 }, /* R2187 - EQ2MIX Input 2 Volume */ + { 0x088C, 0x0000 }, /* R2188 - EQ2MIX Input 3 Source */ + { 0x088D, 0x0080 }, /* R2189 - EQ2MIX Input 3 Volume */ + { 0x088E, 0x0000 }, /* R2190 - EQ2MIX Input 4 Source */ + { 0x088F, 0x0080 }, /* R2191 - EQ2MIX Input 4 Volume */ + { 0x0890, 0x0000 }, /* R2192 - EQ3MIX Input 1 Source */ + { 0x0891, 0x0080 }, /* R2193 - EQ3MIX Input 1 Volume */ + { 0x0892, 0x0000 }, /* R2194 - EQ3MIX Input 2 Source */ + { 0x0893, 0x0080 }, /* R2195 - EQ3MIX Input 2 Volume */ + { 0x0894, 0x0000 }, /* R2196 - EQ3MIX Input 3 Source */ + { 0x0895, 0x0080 }, /* R2197 - EQ3MIX Input 3 Volume */ + { 0x0896, 0x0000 }, /* R2198 - EQ3MIX Input 4 Source */ + { 0x0897, 0x0080 }, /* R2199 - EQ3MIX Input 4 Volume */ + { 0x0898, 0x0000 }, /* R2200 - EQ4MIX Input 1 Source */ + { 0x0899, 0x0080 }, /* R2201 - EQ4MIX Input 1 Volume */ + { 0x089A, 0x0000 }, /* R2202 - EQ4MIX Input 2 Source */ + { 0x089B, 0x0080 }, /* R2203 - EQ4MIX Input 2 Volume */ + { 0x089C, 0x0000 }, /* R2204 - EQ4MIX Input 3 Source */ + { 0x089D, 0x0080 }, /* R2205 - EQ4MIX Input 3 Volume */ + { 0x089E, 0x0000 }, /* R2206 - EQ4MIX Input 4 Source */ + { 0x089F, 0x0080 }, /* R2207 - EQ4MIX Input 4 Volume */ + { 0x08C0, 0x0000 }, /* R2240 - DRC1LMIX Input 1 Source */ + { 0x08C1, 0x0080 }, /* R2241 - DRC1LMIX Input 1 Volume */ + { 0x08C2, 0x0000 }, /* R2242 - DRC1LMIX Input 2 Source */ + { 0x08C3, 0x0080 }, /* R2243 - DRC1LMIX Input 2 Volume */ + { 0x08C4, 0x0000 }, /* R2244 - DRC1LMIX Input 3 Source */ + { 0x08C5, 0x0080 }, /* R2245 - DRC1LMIX Input 3 Volume */ + { 0x08C6, 0x0000 }, /* R2246 - DRC1LMIX Input 4 Source */ + { 0x08C7, 0x0080 }, /* R2247 - DRC1LMIX Input 4 Volume */ + { 0x08C8, 0x0000 }, /* R2248 - DRC1RMIX Input 1 Source */ + { 0x08C9, 0x0080 }, /* R2249 - DRC1RMIX Input 1 Volume */ + { 0x08CA, 0x0000 }, /* R2250 - DRC1RMIX Input 2 Source */ + { 0x08CB, 0x0080 }, /* R2251 - DRC1RMIX Input 2 Volume */ + { 0x08CC, 0x0000 }, /* R2252 - DRC1RMIX Input 3 Source */ + { 0x08CD, 0x0080 }, /* R2253 - DRC1RMIX Input 3 Volume */ + { 0x08CE, 0x0000 }, /* R2254 - DRC1RMIX Input 4 Source */ + { 0x08CF, 0x0080 }, /* R2255 - DRC1RMIX Input 4 Volume */ + { 0x0900, 0x0000 }, /* R2304 - HPLP1MIX Input 1 Source */ + { 0x0901, 0x0080 }, /* R2305 - HPLP1MIX Input 1 Volume */ + { 0x0902, 0x0000 }, /* R2306 - HPLP1MIX Input 2 Source */ + { 0x0903, 0x0080 }, /* R2307 - HPLP1MIX Input 2 Volume */ + { 0x0904, 0x0000 }, /* R2308 - HPLP1MIX Input 3 Source */ + { 0x0905, 0x0080 }, /* R2309 - HPLP1MIX Input 3 Volume */ + { 0x0906, 0x0000 }, /* R2310 - HPLP1MIX Input 4 Source */ + { 0x0907, 0x0080 }, /* R2311 - HPLP1MIX Input 4 Volume */ + { 0x0908, 0x0000 }, /* R2312 - HPLP2MIX Input 1 Source */ + { 0x0909, 0x0080 }, /* R2313 - HPLP2MIX Input 1 Volume */ + { 0x090A, 0x0000 }, /* R2314 - HPLP2MIX Input 2 Source */ + { 0x090B, 0x0080 }, /* R2315 - HPLP2MIX Input 2 Volume */ + { 0x090C, 0x0000 }, /* R2316 - HPLP2MIX Input 3 Source */ + { 0x090D, 0x0080 }, /* R2317 - HPLP2MIX Input 3 Volume */ + { 0x090E, 0x0000 }, /* R2318 - HPLP2MIX Input 4 Source */ + { 0x090F, 0x0080 }, /* R2319 - HPLP2MIX Input 4 Volume */ + { 0x0910, 0x0000 }, /* R2320 - HPLP3MIX Input 1 Source */ + { 0x0911, 0x0080 }, /* R2321 - HPLP3MIX Input 1 Volume */ + { 0x0912, 0x0000 }, /* R2322 - HPLP3MIX Input 2 Source */ + { 0x0913, 0x0080 }, /* R2323 - HPLP3MIX Input 2 Volume */ + { 0x0914, 0x0000 }, /* R2324 - HPLP3MIX Input 3 Source */ + { 0x0915, 0x0080 }, /* R2325 - HPLP3MIX Input 3 Volume */ + { 0x0916, 0x0000 }, /* R2326 - HPLP3MIX Input 4 Source */ + { 0x0917, 0x0080 }, /* R2327 - HPLP3MIX Input 4 Volume */ + { 0x0918, 0x0000 }, /* R2328 - HPLP4MIX Input 1 Source */ + { 0x0919, 0x0080 }, /* R2329 - HPLP4MIX Input 1 Volume */ + { 0x091A, 0x0000 }, /* R2330 - HPLP4MIX Input 2 Source */ + { 0x091B, 0x0080 }, /* R2331 - HPLP4MIX Input 2 Volume */ + { 0x091C, 0x0000 }, /* R2332 - HPLP4MIX Input 3 Source */ + { 0x091D, 0x0080 }, /* R2333 - HPLP4MIX Input 3 Volume */ + { 0x091E, 0x0000 }, /* R2334 - HPLP4MIX Input 4 Source */ + { 0x091F, 0x0080 }, /* R2335 - HPLP4MIX Input 4 Volume */ + { 0x0940, 0x0000 }, /* R2368 - DSP1LMIX Input 1 Source */ + { 0x0941, 0x0080 }, /* R2369 - DSP1LMIX Input 1 Volume */ + { 0x0942, 0x0000 }, /* R2370 - DSP1LMIX Input 2 Source */ + { 0x0943, 0x0080 }, /* R2371 - DSP1LMIX Input 2 Volume */ + { 0x0944, 0x0000 }, /* R2372 - DSP1LMIX Input 3 Source */ + { 0x0945, 0x0080 }, /* R2373 - DSP1LMIX Input 3 Volume */ + { 0x0946, 0x0000 }, /* R2374 - DSP1LMIX Input 4 Source */ + { 0x0947, 0x0080 }, /* R2375 - DSP1LMIX Input 4 Volume */ + { 0x0948, 0x0000 }, /* R2376 - DSP1RMIX Input 1 Source */ + { 0x0949, 0x0080 }, /* R2377 - DSP1RMIX Input 1 Volume */ + { 0x094A, 0x0000 }, /* R2378 - DSP1RMIX Input 2 Source */ + { 0x094B, 0x0080 }, /* R2379 - DSP1RMIX Input 2 Volume */ + { 0x094C, 0x0000 }, /* R2380 - DSP1RMIX Input 3 Source */ + { 0x094D, 0x0080 }, /* R2381 - DSP1RMIX Input 3 Volume */ + { 0x094E, 0x0000 }, /* R2382 - DSP1RMIX Input 4 Source */ + { 0x094F, 0x0080 }, /* R2383 - DSP1RMIX Input 4 Volume */ + { 0x0950, 0x0000 }, /* R2384 - DSP1AUX1MIX Input 1 Source */ + { 0x0958, 0x0000 }, /* R2392 - DSP1AUX2MIX Input 1 Source */ + { 0x0960, 0x0000 }, /* R2400 - DSP1AUX3MIX Input 1 Source */ + { 0x0968, 0x0000 }, /* R2408 - DSP1AUX4MIX Input 1 Source */ + { 0x0970, 0x0000 }, /* R2416 - DSP1AUX5MIX Input 1 Source */ + { 0x0978, 0x0000 }, /* R2424 - DSP1AUX6MIX Input 1 Source */ + { 0x0980, 0x0000 }, /* R2432 - DSP2LMIX Input 1 Source */ + { 0x0981, 0x0080 }, /* R2433 - DSP2LMIX Input 1 Volume */ + { 0x0982, 0x0000 }, /* R2434 - DSP2LMIX Input 2 Source */ + { 0x0983, 0x0080 }, /* R2435 - DSP2LMIX Input 2 Volume */ + { 0x0984, 0x0000 }, /* R2436 - DSP2LMIX Input 3 Source */ + { 0x0985, 0x0080 }, /* R2437 - DSP2LMIX Input 3 Volume */ + { 0x0986, 0x0000 }, /* R2438 - DSP2LMIX Input 4 Source */ + { 0x0987, 0x0080 }, /* R2439 - DSP2LMIX Input 4 Volume */ + { 0x0988, 0x0000 }, /* R2440 - DSP2RMIX Input 1 Source */ + { 0x0989, 0x0080 }, /* R2441 - DSP2RMIX Input 1 Volume */ + { 0x098A, 0x0000 }, /* R2442 - DSP2RMIX Input 2 Source */ + { 0x098B, 0x0080 }, /* R2443 - DSP2RMIX Input 2 Volume */ + { 0x098C, 0x0000 }, /* R2444 - DSP2RMIX Input 3 Source */ + { 0x098D, 0x0080 }, /* R2445 - DSP2RMIX Input 3 Volume */ + { 0x098E, 0x0000 }, /* R2446 - DSP2RMIX Input 4 Source */ + { 0x098F, 0x0080 }, /* R2447 - DSP2RMIX Input 4 Volume */ + { 0x0990, 0x0000 }, /* R2448 - DSP2AUX1MIX Input 1 Source */ + { 0x0998, 0x0000 }, /* R2456 - DSP2AUX2MIX Input 1 Source */ + { 0x09A0, 0x0000 }, /* R2464 - DSP2AUX3MIX Input 1 Source */ + { 0x09A8, 0x0000 }, /* R2472 - DSP2AUX4MIX Input 1 Source */ + { 0x09B0, 0x0000 }, /* R2480 - DSP2AUX5MIX Input 1 Source */ + { 0x09B8, 0x0000 }, /* R2488 - DSP2AUX6MIX Input 1 Source */ + { 0x09C0, 0x0000 }, /* R2496 - DSP3LMIX Input 1 Source */ + { 0x09C1, 0x0080 }, /* R2497 - DSP3LMIX Input 1 Volume */ + { 0x09C2, 0x0000 }, /* R2498 - DSP3LMIX Input 2 Source */ + { 0x09C3, 0x0080 }, /* R2499 - DSP3LMIX Input 2 Volume */ + { 0x09C4, 0x0000 }, /* R2500 - DSP3LMIX Input 3 Source */ + { 0x09C5, 0x0080 }, /* R2501 - DSP3LMIX Input 3 Volume */ + { 0x09C6, 0x0000 }, /* R2502 - DSP3LMIX Input 4 Source */ + { 0x09C7, 0x0080 }, /* R2503 - DSP3LMIX Input 4 Volume */ + { 0x09C8, 0x0000 }, /* R2504 - DSP3RMIX Input 1 Source */ + { 0x09C9, 0x0080 }, /* R2505 - DSP3RMIX Input 1 Volume */ + { 0x09CA, 0x0000 }, /* R2506 - DSP3RMIX Input 2 Source */ + { 0x09CB, 0x0080 }, /* R2507 - DSP3RMIX Input 2 Volume */ + { 0x09CC, 0x0000 }, /* R2508 - DSP3RMIX Input 3 Source */ + { 0x09CD, 0x0080 }, /* R2509 - DSP3RMIX Input 3 Volume */ + { 0x09CE, 0x0000 }, /* R2510 - DSP3RMIX Input 4 Source */ + { 0x09CF, 0x0080 }, /* R2511 - DSP3RMIX Input 4 Volume */ + { 0x09D0, 0x0000 }, /* R2512 - DSP3AUX1MIX Input 1 Source */ + { 0x09D8, 0x0000 }, /* R2520 - DSP3AUX2MIX Input 1 Source */ + { 0x09E0, 0x0000 }, /* R2528 - DSP3AUX3MIX Input 1 Source */ + { 0x09E8, 0x0000 }, /* R2536 - DSP3AUX4MIX Input 1 Source */ + { 0x09F0, 0x0000 }, /* R2544 - DSP3AUX5MIX Input 1 Source */ + { 0x09F8, 0x0000 }, /* R2552 - DSP3AUX6MIX Input 1 Source */ + { 0x0A80, 0x0000 }, /* R2688 - ASRC1LMIX Input 1 Source */ + { 0x0A88, 0x0000 }, /* R2696 - ASRC1RMIX Input 1 Source */ + { 0x0A90, 0x0000 }, /* R2704 - ASRC2LMIX Input 1 Source */ + { 0x0A98, 0x0000 }, /* R2712 - ASRC2RMIX Input 1 Source */ + { 0x0B00, 0x0000 }, /* R2816 - ISRC1DEC1MIX Input 1 Source */ + { 0x0B08, 0x0000 }, /* R2824 - ISRC1DEC2MIX Input 1 Source */ + { 0x0B10, 0x0000 }, /* R2832 - ISRC1DEC3MIX Input 1 Source */ + { 0x0B18, 0x0000 }, /* R2840 - ISRC1DEC4MIX Input 1 Source */ + { 0x0B20, 0x0000 }, /* R2848 - ISRC1INT1MIX Input 1 Source */ + { 0x0B28, 0x0000 }, /* R2856 - ISRC1INT2MIX Input 1 Source */ + { 0x0B30, 0x0000 }, /* R2864 - ISRC1INT3MIX Input 1 Source */ + { 0x0B38, 0x0000 }, /* R2872 - ISRC1INT4MIX Input 1 Source */ + { 0x0B40, 0x0000 }, /* R2880 - ISRC2DEC1MIX Input 1 Source */ + { 0x0B48, 0x0000 }, /* R2888 - ISRC2DEC2MIX Input 1 Source */ + { 0x0B50, 0x0000 }, /* R2896 - ISRC2DEC3MIX Input 1 Source */ + { 0x0B58, 0x0000 }, /* R2904 - ISRC2DEC4MIX Input 1 Source */ + { 0x0B60, 0x0000 }, /* R2912 - ISRC2INT1MIX Input 1 Source */ + { 0x0B68, 0x0000 }, /* R2920 - ISRC2INT2MIX Input 1 Source */ + { 0x0B70, 0x0000 }, /* R2928 - ISRC2INT3MIX Input 1 Source */ + { 0x0B78, 0x0000 }, /* R2936 - ISRC2INT4MIX Input 1 Source */ + { 0x0C00, 0xA001 }, /* R3072 - GPIO CTRL 1 */ + { 0x0C01, 0xA001 }, /* R3073 - GPIO CTRL 2 */ + { 0x0C02, 0xA001 }, /* R3074 - GPIO CTRL 3 */ + { 0x0C03, 0xA001 }, /* R3075 - GPIO CTRL 4 */ + { 0x0C04, 0xA001 }, /* R3076 - GPIO CTRL 5 */ + { 0x0C05, 0xA001 }, /* R3077 - GPIO CTRL 6 */ + { 0x0C23, 0x4003 }, /* R3107 - Misc Pad Ctrl 1 */ + { 0x0C24, 0x0000 }, /* R3108 - Misc Pad Ctrl 2 */ + { 0x0C25, 0x0000 }, /* R3109 - Misc Pad Ctrl 3 */ + { 0x0C26, 0x0000 }, /* R3110 - Misc Pad Ctrl 4 */ + { 0x0C27, 0x0000 }, /* R3111 - Misc Pad Ctrl 5 */ + { 0x0C28, 0x0000 }, /* R3112 - Misc GPIO 1 */ + { 0x0D00, 0x0000 }, /* R3328 - Interrupt Status 1 */ + { 0x0D01, 0x0000 }, /* R3329 - Interrupt Status 2 */ + { 0x0D02, 0x0000 }, /* R3330 - Interrupt Status 3 */ + { 0x0D03, 0x0000 }, /* R3331 - Interrupt Status 4 */ + { 0x0D04, 0x0000 }, /* R3332 - Interrupt Raw Status 2 */ + { 0x0D05, 0x0000 }, /* R3333 - Interrupt Raw Status 3 */ + { 0x0D06, 0x0000 }, /* R3334 - Interrupt Raw Status 4 */ + { 0x0D07, 0xFFFF }, /* R3335 - Interrupt Status 1 Mask */ + { 0x0D08, 0xFFFF }, /* R3336 - Interrupt Status 2 Mask */ + { 0x0D09, 0xFFFF }, /* R3337 - Interrupt Status 3 Mask */ + { 0x0D0A, 0xFFFF }, /* R3338 - Interrupt Status 4 Mask */ + { 0x0D1F, 0x0000 }, /* R3359 - Interrupt Control */ + { 0x0D20, 0xFFFF }, /* R3360 - IRQ Debounce 1 */ + { 0x0D21, 0xFFFF }, /* R3361 - IRQ Debounce 2 */ + { 0x0E00, 0x0000 }, /* R3584 - FX_Ctrl */ + { 0x0E10, 0x6318 }, /* R3600 - EQ1_1 */ + { 0x0E11, 0x6300 }, /* R3601 - EQ1_2 */ + { 0x0E12, 0x0FC8 }, /* R3602 - EQ1_3 */ + { 0x0E13, 0x03FE }, /* R3603 - EQ1_4 */ + { 0x0E14, 0x00E0 }, /* R3604 - EQ1_5 */ + { 0x0E15, 0x1EC4 }, /* R3605 - EQ1_6 */ + { 0x0E16, 0xF136 }, /* R3606 - EQ1_7 */ + { 0x0E17, 0x0409 }, /* R3607 - EQ1_8 */ + { 0x0E18, 0x04CC }, /* R3608 - EQ1_9 */ + { 0x0E19, 0x1C9B }, /* R3609 - EQ1_10 */ + { 0x0E1A, 0xF337 }, /* R3610 - EQ1_11 */ + { 0x0E1B, 0x040B }, /* R3611 - EQ1_12 */ + { 0x0E1C, 0x0CBB }, /* R3612 - EQ1_13 */ + { 0x0E1D, 0x16F8 }, /* R3613 - EQ1_14 */ + { 0x0E1E, 0xF7D9 }, /* R3614 - EQ1_15 */ + { 0x0E1F, 0x040A }, /* R3615 - EQ1_16 */ + { 0x0E20, 0x1F14 }, /* R3616 - EQ1_17 */ + { 0x0E21, 0x058C }, /* R3617 - EQ1_18 */ + { 0x0E22, 0x0563 }, /* R3618 - EQ1_19 */ + { 0x0E23, 0x4000 }, /* R3619 - EQ1_20 */ + { 0x0E26, 0x6318 }, /* R3622 - EQ2_1 */ + { 0x0E27, 0x6300 }, /* R3623 - EQ2_2 */ + { 0x0E28, 0x0FC8 }, /* R3624 - EQ2_3 */ + { 0x0E29, 0x03FE }, /* R3625 - EQ2_4 */ + { 0x0E2A, 0x00E0 }, /* R3626 - EQ2_5 */ + { 0x0E2B, 0x1EC4 }, /* R3627 - EQ2_6 */ + { 0x0E2C, 0xF136 }, /* R3628 - EQ2_7 */ + { 0x0E2D, 0x0409 }, /* R3629 - EQ2_8 */ + { 0x0E2E, 0x04CC }, /* R3630 - EQ2_9 */ + { 0x0E2F, 0x1C9B }, /* R3631 - EQ2_10 */ + { 0x0E30, 0xF337 }, /* R3632 - EQ2_11 */ + { 0x0E31, 0x040B }, /* R3633 - EQ2_12 */ + { 0x0E32, 0x0CBB }, /* R3634 - EQ2_13 */ + { 0x0E33, 0x16F8 }, /* R3635 - EQ2_14 */ + { 0x0E34, 0xF7D9 }, /* R3636 - EQ2_15 */ + { 0x0E35, 0x040A }, /* R3637 - EQ2_16 */ + { 0x0E36, 0x1F14 }, /* R3638 - EQ2_17 */ + { 0x0E37, 0x058C }, /* R3639 - EQ2_18 */ + { 0x0E38, 0x0563 }, /* R3640 - EQ2_19 */ + { 0x0E39, 0x4000 }, /* R3641 - EQ2_20 */ + { 0x0E3C, 0x6318 }, /* R3644 - EQ3_1 */ + { 0x0E3D, 0x6300 }, /* R3645 - EQ3_2 */ + { 0x0E3E, 0x0FC8 }, /* R3646 - EQ3_3 */ + { 0x0E3F, 0x03FE }, /* R3647 - EQ3_4 */ + { 0x0E40, 0x00E0 }, /* R3648 - EQ3_5 */ + { 0x0E41, 0x1EC4 }, /* R3649 - EQ3_6 */ + { 0x0E42, 0xF136 }, /* R3650 - EQ3_7 */ + { 0x0E43, 0x0409 }, /* R3651 - EQ3_8 */ + { 0x0E44, 0x04CC }, /* R3652 - EQ3_9 */ + { 0x0E45, 0x1C9B }, /* R3653 - EQ3_10 */ + { 0x0E46, 0xF337 }, /* R3654 - EQ3_11 */ + { 0x0E47, 0x040B }, /* R3655 - EQ3_12 */ + { 0x0E48, 0x0CBB }, /* R3656 - EQ3_13 */ + { 0x0E49, 0x16F8 }, /* R3657 - EQ3_14 */ + { 0x0E4A, 0xF7D9 }, /* R3658 - EQ3_15 */ + { 0x0E4B, 0x040A }, /* R3659 - EQ3_16 */ + { 0x0E4C, 0x1F14 }, /* R3660 - EQ3_17 */ + { 0x0E4D, 0x058C }, /* R3661 - EQ3_18 */ + { 0x0E4E, 0x0563 }, /* R3662 - EQ3_19 */ + { 0x0E4F, 0x4000 }, /* R3663 - EQ3_20 */ + { 0x0E52, 0x6318 }, /* R3666 - EQ4_1 */ + { 0x0E53, 0x6300 }, /* R3667 - EQ4_2 */ + { 0x0E54, 0x0FC8 }, /* R3668 - EQ4_3 */ + { 0x0E55, 0x03FE }, /* R3669 - EQ4_4 */ + { 0x0E56, 0x00E0 }, /* R3670 - EQ4_5 */ + { 0x0E57, 0x1EC4 }, /* R3671 - EQ4_6 */ + { 0x0E58, 0xF136 }, /* R3672 - EQ4_7 */ + { 0x0E59, 0x0409 }, /* R3673 - EQ4_8 */ + { 0x0E5A, 0x04CC }, /* R3674 - EQ4_9 */ + { 0x0E5B, 0x1C9B }, /* R3675 - EQ4_10 */ + { 0x0E5C, 0xF337 }, /* R3676 - EQ4_11 */ + { 0x0E5D, 0x040B }, /* R3677 - EQ4_12 */ + { 0x0E5E, 0x0CBB }, /* R3678 - EQ4_13 */ + { 0x0E5F, 0x16F8 }, /* R3679 - EQ4_14 */ + { 0x0E60, 0xF7D9 }, /* R3680 - EQ4_15 */ + { 0x0E61, 0x040A }, /* R3681 - EQ4_16 */ + { 0x0E62, 0x1F14 }, /* R3682 - EQ4_17 */ + { 0x0E63, 0x058C }, /* R3683 - EQ4_18 */ + { 0x0E64, 0x0563 }, /* R3684 - EQ4_19 */ + { 0x0E65, 0x4000 }, /* R3685 - EQ4_20 */ + { 0x0E80, 0x0018 }, /* R3712 - DRC1 ctrl1 */ + { 0x0E81, 0x0933 }, /* R3713 - DRC1 ctrl2 */ + { 0x0E82, 0x0018 }, /* R3714 - DRC1 ctrl3 */ + { 0x0E83, 0x0000 }, /* R3715 - DRC1 ctrl4 */ + { 0x0E84, 0x0000 }, /* R3716 - DRC1 ctrl5 */ + { 0x0EC0, 0x0000 }, /* R3776 - HPLPF1_1 */ + { 0x0EC1, 0x0000 }, /* R3777 - HPLPF1_2 */ + { 0x0EC4, 0x0000 }, /* R3780 - HPLPF2_1 */ + { 0x0EC5, 0x0000 }, /* R3781 - HPLPF2_2 */ + { 0x0EC8, 0x0000 }, /* R3784 - HPLPF3_1 */ + { 0x0EC9, 0x0000 }, /* R3785 - HPLPF3_2 */ + { 0x0ECC, 0x0000 }, /* R3788 - HPLPF4_1 */ + { 0x0ECD, 0x0000 }, /* R3789 - HPLPF4_2 */ + { 0x4000, 0x0000 }, /* R16384 - DSP1 DM 0 */ + { 0x4001, 0x0000 }, /* R16385 - DSP1 DM 1 */ + { 0x4002, 0x0000 }, /* R16386 - DSP1 DM 2 */ + { 0x4003, 0x0000 }, /* R16387 - DSP1 DM 3 */ + { 0x41FC, 0x0000 }, /* R16892 - DSP1 DM 508 */ + { 0x41FD, 0x0000 }, /* R16893 - DSP1 DM 509 */ + { 0x41FE, 0x0000 }, /* R16894 - DSP1 DM 510 */ + { 0x41FF, 0x0000 }, /* R16895 - DSP1 DM 511 */ + { 0x4800, 0x0000 }, /* R18432 - DSP1 PM 0 */ + { 0x4801, 0x0000 }, /* R18433 - DSP1 PM 1 */ + { 0x4802, 0x0000 }, /* R18434 - DSP1 PM 2 */ + { 0x4803, 0x0000 }, /* R18435 - DSP1 PM 3 */ + { 0x4804, 0x0000 }, /* R18436 - DSP1 PM 4 */ + { 0x4805, 0x0000 }, /* R18437 - DSP1 PM 5 */ + { 0x4DFA, 0x0000 }, /* R19962 - DSP1 PM 1530 */ + { 0x4DFB, 0x0000 }, /* R19963 - DSP1 PM 1531 */ + { 0x4DFC, 0x0000 }, /* R19964 - DSP1 PM 1532 */ + { 0x4DFD, 0x0000 }, /* R19965 - DSP1 PM 1533 */ + { 0x4DFE, 0x0000 }, /* R19966 - DSP1 PM 1534 */ + { 0x4DFF, 0x0000 }, /* R19967 - DSP1 PM 1535 */ + { 0x5000, 0x0000 }, /* R20480 - DSP1 ZM 0 */ + { 0x5001, 0x0000 }, /* R20481 - DSP1 ZM 1 */ + { 0x5002, 0x0000 }, /* R20482 - DSP1 ZM 2 */ + { 0x5003, 0x0000 }, /* R20483 - DSP1 ZM 3 */ + { 0x57FC, 0x0000 }, /* R22524 - DSP1 ZM 2044 */ + { 0x57FD, 0x0000 }, /* R22525 - DSP1 ZM 2045 */ + { 0x57FE, 0x0000 }, /* R22526 - DSP1 ZM 2046 */ + { 0x57FF, 0x0000 }, /* R22527 - DSP1 ZM 2047 */ + { 0x6000, 0x0000 }, /* R24576 - DSP2 DM 0 */ + { 0x6001, 0x0000 }, /* R24577 - DSP2 DM 1 */ + { 0x6002, 0x0000 }, /* R24578 - DSP2 DM 2 */ + { 0x6003, 0x0000 }, /* R24579 - DSP2 DM 3 */ + { 0x61FC, 0x0000 }, /* R25084 - DSP2 DM 508 */ + { 0x61FD, 0x0000 }, /* R25085 - DSP2 DM 509 */ + { 0x61FE, 0x0000 }, /* R25086 - DSP2 DM 510 */ + { 0x61FF, 0x0000 }, /* R25087 - DSP2 DM 511 */ + { 0x6800, 0x0000 }, /* R26624 - DSP2 PM 0 */ + { 0x6801, 0x0000 }, /* R26625 - DSP2 PM 1 */ + { 0x6802, 0x0000 }, /* R26626 - DSP2 PM 2 */ + { 0x6803, 0x0000 }, /* R26627 - DSP2 PM 3 */ + { 0x6804, 0x0000 }, /* R26628 - DSP2 PM 4 */ + { 0x6805, 0x0000 }, /* R26629 - DSP2 PM 5 */ + { 0x6DFA, 0x0000 }, /* R28154 - DSP2 PM 1530 */ + { 0x6DFB, 0x0000 }, /* R28155 - DSP2 PM 1531 */ + { 0x6DFC, 0x0000 }, /* R28156 - DSP2 PM 1532 */ + { 0x6DFD, 0x0000 }, /* R28157 - DSP2 PM 1533 */ + { 0x6DFE, 0x0000 }, /* R28158 - DSP2 PM 1534 */ + { 0x6DFF, 0x0000 }, /* R28159 - DSP2 PM 1535 */ + { 0x7000, 0x0000 }, /* R28672 - DSP2 ZM 0 */ + { 0x7001, 0x0000 }, /* R28673 - DSP2 ZM 1 */ + { 0x7002, 0x0000 }, /* R28674 - DSP2 ZM 2 */ + { 0x7003, 0x0000 }, /* R28675 - DSP2 ZM 3 */ + { 0x77FC, 0x0000 }, /* R30716 - DSP2 ZM 2044 */ + { 0x77FD, 0x0000 }, /* R30717 - DSP2 ZM 2045 */ + { 0x77FE, 0x0000 }, /* R30718 - DSP2 ZM 2046 */ + { 0x77FF, 0x0000 }, /* R30719 - DSP2 ZM 2047 */ + { 0x8000, 0x0000 }, /* R32768 - DSP3 DM 0 */ + { 0x8001, 0x0000 }, /* R32769 - DSP3 DM 1 */ + { 0x8002, 0x0000 }, /* R32770 - DSP3 DM 2 */ + { 0x8003, 0x0000 }, /* R32771 - DSP3 DM 3 */ + { 0x81FC, 0x0000 }, /* R33276 - DSP3 DM 508 */ + { 0x81FD, 0x0000 }, /* R33277 - DSP3 DM 509 */ + { 0x81FE, 0x0000 }, /* R33278 - DSP3 DM 510 */ + { 0x81FF, 0x0000 }, /* R33279 - DSP3 DM 511 */ + { 0x8800, 0x0000 }, /* R34816 - DSP3 PM 0 */ + { 0x8801, 0x0000 }, /* R34817 - DSP3 PM 1 */ + { 0x8802, 0x0000 }, /* R34818 - DSP3 PM 2 */ + { 0x8803, 0x0000 }, /* R34819 - DSP3 PM 3 */ + { 0x8804, 0x0000 }, /* R34820 - DSP3 PM 4 */ + { 0x8805, 0x0000 }, /* R34821 - DSP3 PM 5 */ + { 0x8DFA, 0x0000 }, /* R36346 - DSP3 PM 1530 */ + { 0x8DFB, 0x0000 }, /* R36347 - DSP3 PM 1531 */ + { 0x8DFC, 0x0000 }, /* R36348 - DSP3 PM 1532 */ + { 0x8DFD, 0x0000 }, /* R36349 - DSP3 PM 1533 */ + { 0x8DFE, 0x0000 }, /* R36350 - DSP3 PM 1534 */ + { 0x8DFF, 0x0000 }, /* R36351 - DSP3 PM 1535 */ + { 0x9000, 0x0000 }, /* R36864 - DSP3 ZM 0 */ + { 0x9001, 0x0000 }, /* R36865 - DSP3 ZM 1 */ + { 0x9002, 0x0000 }, /* R36866 - DSP3 ZM 2 */ + { 0x9003, 0x0000 }, /* R36867 - DSP3 ZM 3 */ + { 0x97FC, 0x0000 }, /* R38908 - DSP3 ZM 2044 */ + { 0x97FD, 0x0000 }, /* R38909 - DSP3 ZM 2045 */ + { 0x97FE, 0x0000 }, /* R38910 - DSP3 ZM 2046 */ + { 0x97FF, 0x0000 }, /* R38911 - DSP3 ZM 2047 */ }; diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index 42d9039..b2d1f80 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -51,6 +51,7 @@ struct wm5100_fll { /* codec private data */ struct wm5100_priv { + struct regmap *regmap; struct snd_soc_codec *codec; struct regulator_bulk_data core_supplies[WM5100_NUM_CORE_SUPPLIES]; @@ -1375,7 +1376,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec, msleep(2); } - codec->cache_only = false; + regcache_cache_only(wm5100->regmap, false); switch (wm5100->rev) { case 0: @@ -1993,6 +1994,9 @@ static int wm5100_set_fll(struct snd_soc_codec *codec, int fll_id, int source, else timeout = 50; + snd_soc_update_bits(codec, WM5100_CLOCKING_3, WM5100_SYSCLK_ENA, + WM5100_SYSCLK_ENA); + /* Poll for the lock; will use interrupt when we can test */ for (i = 0; i < timeout; i++) { if (i2c->irq) { @@ -2453,8 +2457,9 @@ static int wm5100_probe(struct snd_soc_codec *codec) int ret, i, irq_flags; wm5100->codec = codec; + codec->control_data = wm5100->regmap; - ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_I2C); + ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); if (ret != 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); return ret; @@ -2552,7 +2557,7 @@ static int wm5100_probe(struct snd_soc_codec *codec) goto err_reset; } - codec->cache_only = true; + regcache_cache_only(wm5100->regmap, true); wm5100_init_gpio(codec); @@ -2733,14 +2738,18 @@ static struct snd_soc_codec_driver soc_codec_dev_wm5100 = { .num_dapm_widgets = ARRAY_SIZE(wm5100_dapm_widgets), .dapm_routes = wm5100_dapm_routes, .num_dapm_routes = ARRAY_SIZE(wm5100_dapm_routes), +}; - .reg_cache_size = ARRAY_SIZE(wm5100_reg_defaults), - .reg_word_size = sizeof(u16), - .compress_type = SND_SOC_RBTREE_COMPRESSION, - .reg_cache_default = wm5100_reg_defaults, +static const struct regmap_config wm5100_regmap = { + .reg_bits = 16, + .val_bits = 16, - .volatile_register = wm5100_volatile_register, - .readable_register = wm5100_readable_register, + .max_register = WM5100_MAX_REGISTER, + .reg_defaults = wm5100_reg_defaults, + .num_reg_defaults = ARRAY_SIZE(wm5100_reg_defaults), + .volatile_reg = wm5100_volatile_register, + .readable_reg = wm5100_readable_register, + .cache_type = REGCACHE_RBTREE, }; static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, @@ -2754,6 +2763,14 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, if (wm5100 == NULL) return -ENOMEM; + wm5100->regmap = regmap_init_i2c(i2c, &wm5100_regmap); + if (IS_ERR(wm5100->regmap)) { + ret = PTR_ERR(wm5100->regmap); + dev_err(&i2c->dev, "Failed to allocate register map: %d\n", + ret); + goto err_alloc; + } + for (i = 0; i < ARRAY_SIZE(wm5100->fll); i++) init_completion(&wm5100->fll[i].lock); @@ -2767,16 +2784,26 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, ARRAY_SIZE(wm5100_dai)); if (ret < 0) { dev_err(&i2c->dev, "Failed to register WM5100: %d\n", ret); - kfree(wm5100); + goto err_regmap; } return ret; + +err_regmap: + regmap_exit(wm5100->regmap); +err_alloc: + kfree(wm5100); + return ret; } static __devexit int wm5100_i2c_remove(struct i2c_client *client) { + struct wm5100_priv *wm5100 = i2c_get_clientdata(client); + snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); + regmap_exit(wm5100->regmap); + kfree(wm5100); + return 0; } diff --git a/sound/soc/codecs/wm5100.h b/sound/soc/codecs/wm5100.h index 9707596..25cb601 100644 --- a/sound/soc/codecs/wm5100.h +++ b/sound/soc/codecs/wm5100.h @@ -15,6 +15,7 @@ #define WM5100_ASOC_H #include +#include int wm5100_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack); @@ -5147,9 +5148,9 @@ int wm5100_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack); #define WM5100_DSP3_ZM_END_SHIFT 0 /* DSP3_ZM_END - [15:0] */ #define WM5100_DSP3_ZM_END_WIDTH 16 /* DSP3_ZM_END - [15:0] */ -int wm5100_readable_register(struct snd_soc_codec *codec, unsigned int reg); -int wm5100_volatile_register(struct snd_soc_codec *codec, unsigned int reg); +bool wm5100_readable_register(struct device *dev, unsigned int reg); +bool wm5100_volatile_register(struct device *dev, unsigned int reg); -extern u16 wm5100_reg_defaults[WM5100_MAX_REGISTER + 1]; +extern struct reg_default wm5100_reg_defaults[WM5100_REGISTER_COUNT]; #endif -- cgit v1.1 From 7cfa467b74bb252cc3b74a1a1995c54fe43f90d5 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 18 Oct 2011 19:49:03 +0100 Subject: ASoC: Convert WM9081 to direct regmap API usage Signed-off-by: Mark Brown --- sound/soc/codecs/wm9081.c | 278 ++++++++++++++++++++++++++++++---------------- 1 file changed, 180 insertions(+), 98 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 7563a91..a8fc065 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -30,69 +31,61 @@ #include #include "wm9081.h" -static u16 wm9081_reg_defaults[] = { - 0x0000, /* R0 - Software Reset */ - 0x0000, /* R1 */ - 0x00B9, /* R2 - Analogue Lineout */ - 0x00B9, /* R3 - Analogue Speaker PGA */ - 0x0001, /* R4 - VMID Control */ - 0x0068, /* R5 - Bias Control 1 */ - 0x0000, /* R6 */ - 0x0000, /* R7 - Analogue Mixer */ - 0x0000, /* R8 - Anti Pop Control */ - 0x01DB, /* R9 - Analogue Speaker 1 */ - 0x0018, /* R10 - Analogue Speaker 2 */ - 0x0180, /* R11 - Power Management */ - 0x0000, /* R12 - Clock Control 1 */ - 0x0038, /* R13 - Clock Control 2 */ - 0x4000, /* R14 - Clock Control 3 */ - 0x0000, /* R15 */ - 0x0000, /* R16 - FLL Control 1 */ - 0x0200, /* R17 - FLL Control 2 */ - 0x0000, /* R18 - FLL Control 3 */ - 0x0204, /* R19 - FLL Control 4 */ - 0x0000, /* R20 - FLL Control 5 */ - 0x0000, /* R21 */ - 0x0000, /* R22 - Audio Interface 1 */ - 0x0002, /* R23 - Audio Interface 2 */ - 0x0008, /* R24 - Audio Interface 3 */ - 0x0022, /* R25 - Audio Interface 4 */ - 0x0000, /* R26 - Interrupt Status */ - 0x0006, /* R27 - Interrupt Status Mask */ - 0x0000, /* R28 - Interrupt Polarity */ - 0x0000, /* R29 - Interrupt Control */ - 0x00C0, /* R30 - DAC Digital 1 */ - 0x0008, /* R31 - DAC Digital 2 */ - 0x09AF, /* R32 - DRC 1 */ - 0x4201, /* R33 - DRC 2 */ - 0x0000, /* R34 - DRC 3 */ - 0x0000, /* R35 - DRC 4 */ - 0x0000, /* R36 */ - 0x0000, /* R37 */ - 0x0000, /* R38 - Write Sequencer 1 */ - 0x0000, /* R39 - Write Sequencer 2 */ - 0x0002, /* R40 - MW Slave 1 */ - 0x0000, /* R41 */ - 0x0000, /* R42 - EQ 1 */ - 0x0000, /* R43 - EQ 2 */ - 0x0FCA, /* R44 - EQ 3 */ - 0x0400, /* R45 - EQ 4 */ - 0x00B8, /* R46 - EQ 5 */ - 0x1EB5, /* R47 - EQ 6 */ - 0xF145, /* R48 - EQ 7 */ - 0x0B75, /* R49 - EQ 8 */ - 0x01C5, /* R50 - EQ 9 */ - 0x169E, /* R51 - EQ 10 */ - 0xF829, /* R52 - EQ 11 */ - 0x07AD, /* R53 - EQ 12 */ - 0x1103, /* R54 - EQ 13 */ - 0x1C58, /* R55 - EQ 14 */ - 0xF373, /* R56 - EQ 15 */ - 0x0A54, /* R57 - EQ 16 */ - 0x0558, /* R58 - EQ 17 */ - 0x0564, /* R59 - EQ 18 */ - 0x0559, /* R60 - EQ 19 */ - 0x4000, /* R61 - EQ 20 */ +static struct reg_default wm9081_reg[] = { + { 0, 0x9081 }, /* R0 - Software Reset */ + { 2, 0x00B9 }, /* R2 - Analogue Lineout */ + { 3, 0x00B9 }, /* R3 - Analogue Speaker PGA */ + { 4, 0x0001 }, /* R4 - VMID Control */ + { 5, 0x0068 }, /* R5 - Bias Control 1 */ + { 7, 0x0000 }, /* R7 - Analogue Mixer */ + { 8, 0x0000 }, /* R8 - Anti Pop Control */ + { 9, 0x01DB }, /* R9 - Analogue Speaker 1 */ + { 10, 0x0018 }, /* R10 - Analogue Speaker 2 */ + { 11, 0x0180 }, /* R11 - Power Management */ + { 12, 0x0000 }, /* R12 - Clock Control 1 */ + { 13, 0x0038 }, /* R13 - Clock Control 2 */ + { 14, 0x4000 }, /* R14 - Clock Control 3 */ + { 16, 0x0000 }, /* R16 - FLL Control 1 */ + { 17, 0x0200 }, /* R17 - FLL Control 2 */ + { 18, 0x0000 }, /* R18 - FLL Control 3 */ + { 19, 0x0204 }, /* R19 - FLL Control 4 */ + { 20, 0x0000 }, /* R20 - FLL Control 5 */ + { 22, 0x0000 }, /* R22 - Audio Interface 1 */ + { 23, 0x0002 }, /* R23 - Audio Interface 2 */ + { 24, 0x0008 }, /* R24 - Audio Interface 3 */ + { 25, 0x0022 }, /* R25 - Audio Interface 4 */ + { 27, 0x0006 }, /* R27 - Interrupt Status Mask */ + { 28, 0x0000 }, /* R28 - Interrupt Polarity */ + { 29, 0x0000 }, /* R29 - Interrupt Control */ + { 30, 0x00C0 }, /* R30 - DAC Digital 1 */ + { 31, 0x0008 }, /* R31 - DAC Digital 2 */ + { 32, 0x09AF }, /* R32 - DRC 1 */ + { 33, 0x4201 }, /* R33 - DRC 2 */ + { 34, 0x0000 }, /* R34 - DRC 3 */ + { 35, 0x0000 }, /* R35 - DRC 4 */ + { 38, 0x0000 }, /* R38 - Write Sequencer 1 */ + { 39, 0x0000 }, /* R39 - Write Sequencer 2 */ + { 40, 0x0002 }, /* R40 - MW Slave 1 */ + { 42, 0x0000 }, /* R42 - EQ 1 */ + { 43, 0x0000 }, /* R43 - EQ 2 */ + { 44, 0x0FCA }, /* R44 - EQ 3 */ + { 45, 0x0400 }, /* R45 - EQ 4 */ + { 46, 0x00B8 }, /* R46 - EQ 5 */ + { 47, 0x1EB5 }, /* R47 - EQ 6 */ + { 48, 0xF145 }, /* R48 - EQ 7 */ + { 49, 0x0B75 }, /* R49 - EQ 8 */ + { 50, 0x01C5 }, /* R50 - EQ 9 */ + { 51, 0x169E }, /* R51 - EQ 10 */ + { 52, 0xF829 }, /* R52 - EQ 11 */ + { 53, 0x07AD }, /* R53 - EQ 12 */ + { 54, 0x1103 }, /* R54 - EQ 13 */ + { 55, 0x1C58 }, /* R55 - EQ 14 */ + { 56, 0xF373 }, /* R56 - EQ 15 */ + { 57, 0x0A54 }, /* R57 - EQ 16 */ + { 58, 0x0558 }, /* R58 - EQ 17 */ + { 59, 0x0564 }, /* R59 - EQ 18 */ + { 60, 0x0559 }, /* R60 - EQ 19 */ + { 61, 0x4000 }, /* R61 - EQ 20 */ }; static struct { @@ -156,7 +149,7 @@ static struct { }; struct wm9081_priv { - enum snd_soc_control_type control_type; + struct regmap *regmap; int sysclk_source; int mclk_rate; int sysclk_rate; @@ -169,20 +162,84 @@ struct wm9081_priv { struct wm9081_pdata pdata; }; -static int wm9081_volatile_register(struct snd_soc_codec *codec, unsigned int reg) +static bool wm9081_volatile_register(struct device *dev, unsigned int reg) { switch (reg) { case WM9081_SOFTWARE_RESET: case WM9081_INTERRUPT_STATUS: - return 1; + return true; default: - return 0; + return false; } } -static int wm9081_reset(struct snd_soc_codec *codec) +static bool wm9081_readable_register(struct device *dev, unsigned int reg) { - return snd_soc_write(codec, WM9081_SOFTWARE_RESET, 0); + switch (reg) { + case WM9081_SOFTWARE_RESET: + case WM9081_ANALOGUE_LINEOUT: + case WM9081_ANALOGUE_SPEAKER_PGA: + case WM9081_VMID_CONTROL: + case WM9081_BIAS_CONTROL_1: + case WM9081_ANALOGUE_MIXER: + case WM9081_ANTI_POP_CONTROL: + case WM9081_ANALOGUE_SPEAKER_1: + case WM9081_ANALOGUE_SPEAKER_2: + case WM9081_POWER_MANAGEMENT: + case WM9081_CLOCK_CONTROL_1: + case WM9081_CLOCK_CONTROL_2: + case WM9081_CLOCK_CONTROL_3: + case WM9081_FLL_CONTROL_1: + case WM9081_FLL_CONTROL_2: + case WM9081_FLL_CONTROL_3: + case WM9081_FLL_CONTROL_4: + case WM9081_FLL_CONTROL_5: + case WM9081_AUDIO_INTERFACE_1: + case WM9081_AUDIO_INTERFACE_2: + case WM9081_AUDIO_INTERFACE_3: + case WM9081_AUDIO_INTERFACE_4: + case WM9081_INTERRUPT_STATUS: + case WM9081_INTERRUPT_STATUS_MASK: + case WM9081_INTERRUPT_POLARITY: + case WM9081_INTERRUPT_CONTROL: + case WM9081_DAC_DIGITAL_1: + case WM9081_DAC_DIGITAL_2: + case WM9081_DRC_1: + case WM9081_DRC_2: + case WM9081_DRC_3: + case WM9081_DRC_4: + case WM9081_WRITE_SEQUENCER_1: + case WM9081_WRITE_SEQUENCER_2: + case WM9081_MW_SLAVE_1: + case WM9081_EQ_1: + case WM9081_EQ_2: + case WM9081_EQ_3: + case WM9081_EQ_4: + case WM9081_EQ_5: + case WM9081_EQ_6: + case WM9081_EQ_7: + case WM9081_EQ_8: + case WM9081_EQ_9: + case WM9081_EQ_10: + case WM9081_EQ_11: + case WM9081_EQ_12: + case WM9081_EQ_13: + case WM9081_EQ_14: + case WM9081_EQ_15: + case WM9081_EQ_16: + case WM9081_EQ_17: + case WM9081_EQ_18: + case WM9081_EQ_19: + case WM9081_EQ_20: + return true; + default: + return false; + } +} + +static int wm9081_reset(struct regmap *map) +{ + return regmap_write(map, WM9081_SOFTWARE_RESET, 0x9081); } static const DECLARE_TLV_DB_SCALE(drc_in_tlv, -4500, 75, 0); @@ -1215,25 +1272,14 @@ static int wm9081_probe(struct snd_soc_codec *codec) int ret; u16 reg; - ret = snd_soc_codec_set_cache_io(codec, 8, 16, wm9081->control_type); + codec->control_data = wm9081->regmap; + + ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP); if (ret != 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); return ret; } - reg = snd_soc_read(codec, WM9081_SOFTWARE_RESET); - if (reg != 0x9081) { - dev_err(codec->dev, "Device is not a WM9081: ID=0x%x\n", reg); - ret = -EINVAL; - return ret; - } - - ret = wm9081_reset(codec); - if (ret < 0) { - dev_err(codec->dev, "Failed to issue reset\n"); - return ret; - } - reg = 0; if (wm9081->pdata.irq_high) reg |= WM9081_IRQ_POL; @@ -1277,15 +1323,9 @@ static int wm9081_suspend(struct snd_soc_codec *codec, pm_message_t state) static int wm9081_resume(struct snd_soc_codec *codec) { - u16 *reg_cache = codec->reg_cache; - int i; - - for (i = 0; i < codec->driver->reg_cache_size; i++) { - if (i == WM9081_SOFTWARE_RESET) - continue; + struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); - snd_soc_write(codec, i, reg_cache[i]); - } + regcache_sync(wm9081->regmap); wm9081_set_bias_level(codec, SND_SOC_BIAS_STANDBY); @@ -1305,11 +1345,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm9081 = { .set_sysclk = wm9081_set_sysclk, .set_bias_level = wm9081_set_bias_level, - .reg_cache_size = ARRAY_SIZE(wm9081_reg_defaults), - .reg_word_size = sizeof(u16), - .reg_cache_default = wm9081_reg_defaults, - .volatile_register = wm9081_volatile_register, - .controls = wm9081_snd_controls, .num_controls = ARRAY_SIZE(wm9081_snd_controls), .dapm_widgets = wm9081_dapm_widgets, @@ -1318,11 +1353,24 @@ static struct snd_soc_codec_driver soc_codec_dev_wm9081 = { .num_dapm_routes = ARRAY_SIZE(wm9081_audio_paths), }; +static const struct regmap_config wm9081_regmap = { + .reg_bits = 8, + .val_bits = 16, + + .max_register = WM9081_MAX_REGISTER, + .reg_defaults = wm9081_reg, + .num_reg_defaults = ARRAY_SIZE(wm9081_reg), + .volatile_reg = wm9081_volatile_register, + .readable_reg = wm9081_readable_register, + .cache_type = REGCACHE_RBTREE, +}; + #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) static __devinit int wm9081_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct wm9081_priv *wm9081; + unsigned int reg; int ret; wm9081 = kzalloc(sizeof(struct wm9081_priv), GFP_KERNEL); @@ -1330,7 +1378,30 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c, return -ENOMEM; i2c_set_clientdata(i2c, wm9081); - wm9081->control_type = SND_SOC_I2C; + + wm9081->regmap = regmap_init_i2c(i2c, &wm9081_regmap); + if (IS_ERR(wm9081->regmap)) { + ret = PTR_ERR(wm9081->regmap); + dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret); + goto err; + } + + ret = regmap_read(wm9081->regmap, WM9081_SOFTWARE_RESET, ®); + if (ret != 0) { + dev_err(&i2c->dev, "Failed to read chip ID: %d\n", ret); + goto err_regmap; + } + if (reg != 0x9081) { + dev_err(&i2c->dev, "Device is not a WM9081: ID=0x%x\n", reg); + ret = -EINVAL; + goto err_regmap; + } + + ret = wm9081_reset(wm9081->regmap); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to issue reset\n"); + goto err_regmap; + } if (dev_get_platdata(&i2c->dev)) memcpy(&wm9081->pdata, dev_get_platdata(&i2c->dev), @@ -1339,13 +1410,24 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm9081, &wm9081_dai, 1); if (ret < 0) - kfree(wm9081); + goto err_regmap; + + return 0; + +err_regmap: + regmap_exit(wm9081->regmap); +err: + kfree(wm9081); + return ret; } static __devexit int wm9081_i2c_remove(struct i2c_client *client) { + struct wm9081_priv *wm9081 = i2c_get_clientdata(client); + snd_soc_unregister_codec(&client->dev); + regmap_exit(wm9081->regmap); kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From 0469e7b98cde0579d16ce5868eccccfec1bc043e Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 8 Nov 2011 15:22:09 +0000 Subject: ASoC: Disable debounce on some WM8962 interrupts Allow them to work when the device is unclocked. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8962.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 6d82b35..2ae04ba 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -4038,6 +4038,12 @@ static int wm8962_probe(struct snd_soc_codec *codec) /* Stereo control for EQ */ snd_soc_update_bits(codec, WM8962_EQ1, WM8962_EQ_SHARED_COEFF, 0); + /* Don't debouce interrupts so we don't need SYSCLK */ + snd_soc_update_bits(codec, WM8962_IRQ_DEBOUNCE, + WM8962_FLL_LOCK_DB | WM8962_PLL3_LOCK_DB | + WM8962_PLL2_LOCK_DB | WM8962_TEMP_SHUT_DB, + 0); + wm8962_add_widgets(codec); /* Save boards having to disable DMIC when not in use */ -- cgit v1.1 From 7d6f6b0f39c41f681e152cd9b1e54246ddb73028 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 27 Oct 2011 09:46:53 +0200 Subject: ASoC: Convert wm8971 MICBIAS to a supply widget Signed-off-by: Mark Brown --- sound/soc/codecs/wm8971.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index b444b29..3a06a95 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c @@ -224,7 +224,7 @@ static const struct snd_soc_dapm_widget wm8971_dapm_widgets[] = { SND_SOC_DAPM_DAC("Left DAC", "Left Playback", WM8971_PWR2, 8, 0), SND_SOC_DAPM_PGA("Mono Out 1", WM8971_PWR2, 2, 0, NULL, 0), - SND_SOC_DAPM_MICBIAS("Mic Bias", WM8971_PWR1, 1, 0), + SND_SOC_DAPM_SUPPLY("Mic Bias", WM8971_PWR1, 1, 0, NULL, 0), SND_SOC_DAPM_ADC("Right ADC", "Right Capture", WM8971_PWR1, 2, 0), SND_SOC_DAPM_ADC("Left ADC", "Left Capture", WM8971_PWR1, 3, 0), -- cgit v1.1 From 6fdfa361282a69fc9bfea4dd7d6303adc9e4d6df Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 12:32:50 +0100 Subject: ALSA: hda/realtek - Drop ALC882 model=asus-p5q static config It works well with the auto-parser and the default BIOS setup. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index 59c556d..7f2a3a7 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -54,7 +54,6 @@ enum { ALC888_ASUS_M90V, ALC888_ASUS_EEE1601, ALC889A_MB31, - ALC1200_ASUS_P5Q, ALC882_MODEL_LAST, }; @@ -2798,7 +2797,6 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", [ALC889A_INTEL] = "intel-alc889a", [ALC889_INTEL] = "intel-x58", - [ALC1200_ASUS_P5Q] = "asus-p5q", [ALC889A_MB31] = "mb31", [ALC882_AUTO] = "auto", }; @@ -2851,7 +2849,6 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), @@ -3649,18 +3646,6 @@ static const struct alc_config_preset alc882_presets[] = { .unsol_event = alc_sku_unsol_event, .init_hook = alc883_eee1601_inithook, }, - [ALC1200_ASUS_P5Q] = { - .mixers = { alc883_base_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC1200_DIGOUT_NID, - .dig_in_nid = ALC883_DIGIN_NID, - .slave_dig_outs = alc1200_slave_dig_outs, - .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), - .channel_mode = alc883_sixstack_modes, - .input_mux = &alc883_capture_source, - }, [ALC889A_MB31] = { .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, -- cgit v1.1 From 0e7cc2e745450daa0aec8f32d663f7811cfac0f3 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 12:42:48 +0100 Subject: ALSA: hda/realtek - Move ALC888 ASUS EEE1601 config to auto-parser The ASUS EEE1601 works almost fine with the auto-parser but the static configuration has a certain specific COEF verb. Add this to the fix-up list so that we can drop the whole EEE1601 static config from alc882_quirks.c. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 74 ------------------------------------------- sound/pci/hda/patch_realtek.c | 10 ++++++ 2 files changed, 10 insertions(+), 74 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index 7f2a3a7..2be5e07 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -52,7 +52,6 @@ enum { ALC889A_INTEL, ALC889_INTEL, ALC888_ASUS_M90V, - ALC888_ASUS_EEE1601, ALC889A_MB31, ALC882_MODEL_LAST, }; @@ -625,14 +624,6 @@ static const struct hda_input_mux alc883_lenovo_sky_capture_source = { }, }; -static const struct hda_input_mux alc883_asus_eee1601_capture_source = { - .num_items = 2, - .items = { - { "Mic", 0x0 }, - { "Line", 0x2 }, - }, -}; - static const struct hda_input_mux alc889A_mb31_capture_source = { .num_items = 2, .items = { @@ -2271,33 +2262,6 @@ static const struct hda_bind_ctls alc883_bind_cap_switch = { }, }; -static const struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - { } /* end */ -}; - -static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { - HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), - HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - /* .name = "Capture Source", */ - .name = "Input Source", - .count = 1, - .info = alc_mux_enum_info, - .get = alc_mux_enum_get, - .put = alc_mux_enum_put, - }, - { } /* end */ -}; - static const struct snd_kcontrol_new alc883_chmode_mixer[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -2683,28 +2647,6 @@ static void alc883_mode2_setup(struct hda_codec *codec) alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); } -static const struct hda_verb alc888_asus_eee1601_verbs[] = { - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, - {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, - {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, - /* enable unsolicited event */ - {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - { } /* end */ -}; - -static void alc883_eee1601_inithook(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x14; - spec->autocfg.speaker_pins[0] = 0x1b; - alc_hp_automute(codec); -} - static const struct hda_verb alc889A_mb31_verbs[] = { /* Init rear pin (used as headphone output) */ {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ @@ -2849,7 +2791,6 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), @@ -3631,21 +3572,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc883_mode2_setup, .init_hook = alc_inithook, }, - [ALC888_ASUS_EEE1601] = { - .mixers = { alc883_asus_eee1601_mixer }, - .cap_mixer = alc883_asus_eee1601_cap_mixer, - .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .dig_in_nid = ALC883_DIGIN_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .need_dac_fix = 1, - .input_mux = &alc883_asus_eee1601_capture_source, - .unsol_event = alc_sku_unsol_event, - .init_hook = alc883_eee1601_inithook, - }, [ALC889A_MB31] = { .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 959bda3..75f739b 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4220,6 +4220,7 @@ enum { ALC882_FIXUP_ACER_ASPIRE_7736, ALC882_FIXUP_ASUS_W90V, ALC889_FIXUP_VAIO_TT, + ALC888_FIXUP_EEE1601, }; static const struct alc_fixup alc882_fixups[] = { @@ -4265,11 +4266,20 @@ static const struct alc_fixup alc882_fixups[] = { { } } }, + [ALC888_FIXUP_EEE1601] = { + .type = ALC_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { + { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 }, + { } + } + } }; static const struct snd_pci_quirk alc882_fixup_tbl[] = { SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), + SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), -- cgit v1.1 From b402735883c95c270ac42c40370a2663c2c81371 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 9 Nov 2011 17:00:05 +0800 Subject: ASoC: wm9081: Use snd_soc_update_bits for read-modify-write Use snd_soc_update_bits for read-modify-write register access instead of open-coding it using snd_soc_read and snd_soc_write Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/wm9081.c | 81 ++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 46 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index b491ae1..f7c0738 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c @@ -826,84 +826,74 @@ static const struct snd_soc_dapm_route wm9081_audio_paths[] = { static int wm9081_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { - u16 reg; - switch (level) { case SND_SOC_BIAS_ON: break; case SND_SOC_BIAS_PREPARE: /* VMID=2*40k */ - reg = snd_soc_read(codec, WM9081_VMID_CONTROL); - reg &= ~WM9081_VMID_SEL_MASK; - reg |= 0x2; - snd_soc_write(codec, WM9081_VMID_CONTROL, reg); + snd_soc_update_bits(codec, WM9081_VMID_CONTROL, + WM9081_VMID_SEL_MASK, 0x2); /* Normal bias current */ - reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); - reg &= ~WM9081_STBY_BIAS_ENA; - snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg); + snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1, + WM9081_STBY_BIAS_ENA, 0); break; case SND_SOC_BIAS_STANDBY: /* Initial cold start */ if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { /* Disable LINEOUT discharge */ - reg = snd_soc_read(codec, WM9081_ANTI_POP_CONTROL); - reg &= ~WM9081_LINEOUT_DISCH; - snd_soc_write(codec, WM9081_ANTI_POP_CONTROL, reg); + snd_soc_update_bits(codec, WM9081_ANTI_POP_CONTROL, + WM9081_LINEOUT_DISCH, 0); /* Select startup bias source */ - reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); - reg |= WM9081_BIAS_SRC | WM9081_BIAS_ENA; - snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg); + snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1, + WM9081_BIAS_SRC | WM9081_BIAS_ENA, + WM9081_BIAS_SRC | WM9081_BIAS_ENA); /* VMID 2*4k; Soft VMID ramp enable */ - reg = snd_soc_read(codec, WM9081_VMID_CONTROL); - reg |= WM9081_VMID_RAMP | 0x6; - snd_soc_write(codec, WM9081_VMID_CONTROL, reg); + snd_soc_update_bits(codec, WM9081_VMID_CONTROL, + WM9081_VMID_RAMP | + WM9081_VMID_SEL_MASK, + WM9081_VMID_RAMP | 0x6); mdelay(100); /* Normal bias enable & soft start off */ - reg &= ~WM9081_VMID_RAMP; - snd_soc_write(codec, WM9081_VMID_CONTROL, reg); + snd_soc_update_bits(codec, WM9081_VMID_CONTROL, + WM9081_VMID_RAMP, 0); /* Standard bias source */ - reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); - reg &= ~WM9081_BIAS_SRC; - snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg); + snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1, + WM9081_BIAS_SRC, 0); } /* VMID 2*240k */ - reg = snd_soc_read(codec, WM9081_VMID_CONTROL); - reg &= ~WM9081_VMID_SEL_MASK; - reg |= 0x04; - snd_soc_write(codec, WM9081_VMID_CONTROL, reg); + snd_soc_update_bits(codec, WM9081_VMID_CONTROL, + WM9081_VMID_SEL_MASK, 0x04); /* Standby bias current on */ - reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); - reg |= WM9081_STBY_BIAS_ENA; - snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg); + snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1, + WM9081_STBY_BIAS_ENA, + WM9081_STBY_BIAS_ENA); break; case SND_SOC_BIAS_OFF: /* Startup bias source and disable bias */ - reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); - reg |= WM9081_BIAS_SRC; - reg &= ~WM9081_BIAS_ENA; - snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg); + snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1, + WM9081_BIAS_SRC | WM9081_BIAS_ENA, + WM9081_BIAS_SRC); /* Disable VMID with soft ramping */ - reg = snd_soc_read(codec, WM9081_VMID_CONTROL); - reg &= ~WM9081_VMID_SEL_MASK; - reg |= WM9081_VMID_RAMP; - snd_soc_write(codec, WM9081_VMID_CONTROL, reg); + snd_soc_update_bits(codec, WM9081_VMID_CONTROL, + WM9081_VMID_RAMP | WM9081_VMID_SEL_MASK, + WM9081_VMID_RAMP); /* Actively discharge LINEOUT */ - reg = snd_soc_read(codec, WM9081_ANTI_POP_CONTROL); - reg |= WM9081_LINEOUT_DISCH; - snd_soc_write(codec, WM9081_ANTI_POP_CONTROL, reg); + snd_soc_update_bits(codec, WM9081_ANTI_POP_CONTROL, + WM9081_LINEOUT_DISCH, + WM9081_LINEOUT_DISCH); break; } @@ -1291,11 +1281,10 @@ static int wm9081_probe(struct snd_soc_codec *codec) wm9081_set_bias_level(codec, SND_SOC_BIAS_STANDBY); /* Enable zero cross by default */ - reg = snd_soc_read(codec, WM9081_ANALOGUE_LINEOUT); - snd_soc_write(codec, WM9081_ANALOGUE_LINEOUT, reg | WM9081_LINEOUTZC); - reg = snd_soc_read(codec, WM9081_ANALOGUE_SPEAKER_PGA); - snd_soc_write(codec, WM9081_ANALOGUE_SPEAKER_PGA, - reg | WM9081_SPKPGAZC); + snd_soc_update_bits(codec, WM9081_ANALOGUE_LINEOUT, + WM9081_LINEOUTZC, WM9081_LINEOUTZC); + snd_soc_update_bits(codec, WM9081_ANALOGUE_SPEAKER_PGA, + WM9081_SPKPGAZC, WM9081_SPKPGAZC); if (!wm9081->pdata.num_retune_configs) { dev_dbg(codec->dev, -- cgit v1.1 From 596830ee1d2d9cf56e5efe0c020eb588beecae62 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 15:06:45 +0100 Subject: ALSA: hda/realtek - Look through codec SSID for fix-up lists Not only PCI SSIDs but also look through codec SSIDs for fix-up table entries. MacBook tend to give the same PCI SSID but unique codec SSIDs. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 75f739b..640cf28 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -1526,6 +1526,7 @@ static void alc_pick_fixup(struct hda_codec *codec, const struct alc_fixup *fixlist) { struct alc_spec *spec = codec->spec; + const struct snd_pci_quirk *q; int id = -1; const char *name = NULL; @@ -1540,12 +1541,25 @@ static void alc_pick_fixup(struct hda_codec *codec, } } if (id < 0) { - quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); - if (quirk) { - id = quirk->value; + q = snd_pci_quirk_lookup(codec->bus->pci, quirk); + if (q) { + id = q->value; +#ifdef CONFIG_SND_DEBUG_VERBOSE + name = q->name; +#endif + } + } + if (id < 0) { + for (q = quirk; q->subvendor; q++) { + unsigned int vendorid = + q->subdevice | (q->subvendor << 16); + if (vendorid == codec->subsystem_id) { + id = q->value; #ifdef CONFIG_SND_DEBUG_VERBOSE - name = quirk->name; + name = q->name; #endif + break; + } } } -- cgit v1.1 From 177943a39aabec31cdbd529fd5f3060850f5aef9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 12:55:18 +0100 Subject: ALSA: hda/realtek - Drop ALC882 asus-a7j and asus-a7m models These models work fine with the auto-parser with the additional COEF setup. The iMac 7,1 (106b:3200) also uses the same quirk, so remove it too. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 106 ------------------------------------------ sound/pci/hda/patch_realtek.c | 14 +++++- 2 files changed, 13 insertions(+), 107 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index 2be5e07..c3438da 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -11,8 +11,6 @@ enum { ALC882_ARIMA, ALC882_W2JC, ALC882_TARGA, - ALC882_ASUS_A7J, - ALC882_ASUS_A7M, ALC885_MACPRO, ALC885_MBA21, ALC885_MBP3, @@ -1140,40 +1138,6 @@ static const struct snd_kcontrol_new alc882_targa_mixer[] = { { } /* end */ }; -/* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? - * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c - */ -static const struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), - HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - { } /* end */ -}; - -static const struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - { } /* end */ -}; - static const struct snd_kcontrol_new alc882_chmode_mixer[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -1770,42 +1734,6 @@ static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) alc882_targa_automute(codec); } -static const struct hda_verb alc882_asus_a7j_verbs[] = { - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - - {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ - {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ - - {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ - {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ - {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ - { } /* end */ -}; - -static const struct hda_verb alc882_asus_a7m_verbs[] = { - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - - {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ - {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ - - {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ - {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ - {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ - { } /* end */ -}; - static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) { unsigned int gpiostate, gpiomask, gpiodir; @@ -2699,8 +2627,6 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC882_ARIMA] = "arima", [ALC882_W2JC] = "w2jc", [ALC882_TARGA] = "targa", - [ALC882_ASUS_A7J] = "asus-a7j", - [ALC882_ASUS_A7M] = "asus-a7m", [ALC885_MACPRO] = "macpro", [ALC885_MB5] = "mb5", [ALC885_MACMINI3] = "macmini3", @@ -2782,9 +2708,6 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), - SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), - SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), - SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), @@ -2876,7 +2799,6 @@ static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), - SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M), SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), @@ -3059,34 +2981,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc882_targa_setup, .init_hook = alc882_targa_automute, }, - [ALC882_ASUS_A7J] = { - .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, - .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, - alc882_asus_a7j_verbs}, - .num_dacs = ARRAY_SIZE(alc882_dac_nids), - .dac_nids = alc882_dac_nids, - .dig_out_nid = ALC882_DIGOUT_NID, - .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), - .adc_nids = alc882_adc_nids, - .capsrc_nids = alc882_capsrc_nids, - .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), - .channel_mode = alc882_3ST_6ch_modes, - .need_dac_fix = 1, - .input_mux = &alc882_capture_source, - }, - [ALC882_ASUS_A7M] = { - .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, - .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, - alc882_eapd_verbs, alc880_gpio1_init_verbs, - alc882_asus_a7m_verbs }, - .num_dacs = ARRAY_SIZE(alc882_dac_nids), - .dac_nids = alc882_dac_nids, - .dig_out_nid = ALC882_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), - .channel_mode = alc880_threestack_modes, - .need_dac_fix = 1, - .input_mux = &alc882_capture_source, - }, [ALC883_3ST_2ch_DIG] = { .mixers = { alc883_3ST_2ch_mixer }, .init_verbs = { alc883_init_verbs }, diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 640cf28..43c7aea 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4235,6 +4235,7 @@ enum { ALC882_FIXUP_ASUS_W90V, ALC889_FIXUP_VAIO_TT, ALC888_FIXUP_EEE1601, + ALC882_FIXUP_EAPD, }; static const struct alc_fixup alc882_fixups[] = { @@ -4287,14 +4288,25 @@ static const struct alc_fixup alc882_fixups[] = { { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 }, { } } - } + }, + [ALC882_FIXUP_EAPD] = { + .type = ALC_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { + /* change to EAPD mode */ + { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 }, + { } + } + }, }; static const struct snd_pci_quirk alc882_fixup_tbl[] = { SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), + SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), + SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), /* codec SSID */ SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), -- cgit v1.1 From 8af2d066d145f6fa97eb16145a4a918c5edfddc6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 13:06:37 +0100 Subject: ALSA: hda/realtek - Drop lenovo-sky, asus-m90v, fujitsu-pi2515 quirks These machines are working well with the auto-parser without static configurations. More diet. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 181 ------------------------------------------ 1 file changed, 181 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index c3438da..88f93fc 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -37,19 +37,16 @@ enum { ALC883_LENOVO_101E_2ch, ALC883_LENOVO_NB0763, ALC888_LENOVO_MS7195_DIG, - ALC888_LENOVO_SKY, ALC883_HAIER_W66, ALC888_3ST_HP, ALC888_6ST_DELL, ALC883_MITAC, ALC883_CLEVO_M540R, ALC883_CLEVO_M720, - ALC883_FUJITSU_PI2515, ALC888_FUJITSU_XA3530, ALC883_3ST_6ch_INTEL, ALC889A_INTEL, ALC889_INTEL, - ALC888_ASUS_M90V, ALC889A_MB31, ALC882_MODEL_LAST, }; @@ -605,23 +602,6 @@ static const struct hda_input_mux alc883_lenovo_nb0763_capture_source = { }, }; -static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { - .num_items = 2, - .items = { - { "Mic", 0x0 }, - { "Internal Mic", 0x1 }, - }, -}; - -static const struct hda_input_mux alc883_lenovo_sky_capture_source = { - .num_items = 3, - .items = { - { "Mic", 0x0 }, - { "Front Mic", 0x1 }, - { "Line", 0x4 }, - }, -}; - static const struct hda_input_mux alc889A_mb31_capture_source = { .num_items = 2, .items = { @@ -1863,20 +1843,6 @@ static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { - HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), @@ -2121,31 +2087,6 @@ static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), - HDA_CODEC_VOLUME_MONO("Center Playback Volume", - 0x0d, 1, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), - HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - static const struct snd_kcontrol_new alc889A_mb31_mixer[] = { /* Output mixers */ HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), @@ -2258,20 +2199,6 @@ static const struct hda_verb alc883_clevo_m720_verbs[] = { { } /* end */ }; -static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { - /* HP */ - {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - /* Subwoofer */ - {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - - /* enable unsolicited event */ - {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - - { } /* end */ -}; - static const struct hda_verb alc883_targa_verbs[] = { {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, @@ -2338,18 +2265,6 @@ static const struct hda_verb alc883_haier_w66_verbs[] = { { } /* end */ }; -static const struct hda_verb alc888_lenovo_sky_verbs[] = { - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - { } /* end */ -}; - static const struct hda_verb alc888_6st_dell_verbs[] = { {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, { } @@ -2468,16 +2383,6 @@ static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, } } -/* toggle speaker-output according to the hp-jack state */ -static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x14; - spec->autocfg.speaker_pins[0] = 0x15; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - static void alc883_haier_w66_setup(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; @@ -2538,43 +2443,6 @@ static void alc888_6st_dell_setup(struct hda_codec *codec) alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); } -static void alc888_lenovo_sky_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x1b; - spec->autocfg.speaker_pins[0] = 0x14; - spec->autocfg.speaker_pins[1] = 0x15; - spec->autocfg.speaker_pins[2] = 0x16; - spec->autocfg.speaker_pins[3] = 0x17; - spec->autocfg.speaker_pins[4] = 0x1a; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -static const struct hda_verb alc888_asus_m90v_verbs[] = { - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - /* enable unsolicited event */ - {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, - { } /* end */ -}; - -static void alc883_mode2_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x1b; - spec->autocfg.speaker_pins[0] = 0x14; - spec->autocfg.speaker_pins[1] = 0x15; - spec->autocfg.speaker_pins[2] = 0x16; - spec->ext_mic_pin = 0x18; - spec->int_mic_pin = 0x19; - spec->auto_mic = 1; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - static const struct hda_verb alc889A_mb31_verbs[] = { /* Init rear pin (used as headphone output) */ {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ @@ -2653,14 +2521,12 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC883_LENOVO_101E_2ch] = "lenovo-101e", [ALC883_LENOVO_NB0763] = "lenovo-nb0763", [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", - [ALC888_LENOVO_SKY] = "lenovo-sky", [ALC883_HAIER_W66] = "haier-w66", [ALC888_3ST_HP] = "3stack-hp", [ALC888_6ST_DELL] = "6stack-dell", [ALC883_MITAC] = "mitac", [ALC883_CLEVO_M540R] = "clevo-m540r", [ALC883_CLEVO_M720] = "clevo-m720", - [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", [ALC889A_INTEL] = "intel-alc889a", @@ -2708,7 +2574,6 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), - SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), @@ -2765,15 +2630,12 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), - SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", - ALC883_FUJITSU_PI2515), SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", ALC888_FUJITSU_XA3530), SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), - SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), @@ -3404,20 +3266,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc883_mitac_setup, .init_hook = alc_hp_automute, }, - [ALC883_FUJITSU_PI2515] = { - .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, - .init_verbs = { alc883_init_verbs, - alc883_2ch_fujitsu_pi2515_verbs}, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .input_mux = &alc883_fujitsu_pi2515_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc883_2ch_fujitsu_pi2515_setup, - .init_hook = alc_hp_automute, - }, [ALC888_FUJITSU_XA3530] = { .mixers = { alc888_base_mixer, alc883_chmode_mixer }, .init_verbs = { alc883_init_verbs, @@ -3437,35 +3285,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc888_fujitsu_xa3530_setup, .init_hook = alc_hp_automute, }, - [ALC888_LENOVO_SKY] = { - .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), - .channel_mode = alc883_sixstack_modes, - .need_dac_fix = 1, - .input_mux = &alc883_lenovo_sky_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc888_lenovo_sky_setup, - .init_hook = alc_hp_automute, - }, - [ALC888_ASUS_M90V] = { - .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .dig_in_nid = ALC883_DIGIN_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), - .channel_mode = alc883_3ST_6ch_modes, - .need_dac_fix = 1, - .input_mux = &alc883_fujitsu_pi2515_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc883_mode2_setup, - .init_hook = alc_inithook, - }, [ALC889A_MB31] = { .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, -- cgit v1.1 From f01f587bb779aabf220233b3aac52b437114ec84 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 14:32:38 +0100 Subject: ALSA: hda/realtek - Drop ALC882 lenovo and haier-w66 static configs Remove all ALC882 static configurations for all Lenovo and Haier-w66 quirks. They work fine with the auto-parser now. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 188 ------------------------------------------ 1 file changed, 188 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index 88f93fc..a71077d 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -34,10 +34,6 @@ enum { ALC883_MEDION, ALC883_MEDION_WIM2160, ALC883_LAPTOP_EAPD, - ALC883_LENOVO_101E_2ch, - ALC883_LENOVO_NB0763, - ALC888_LENOVO_MS7195_DIG, - ALC883_HAIER_W66, ALC888_3ST_HP, ALC888_6ST_DELL, ALC883_MITAC, @@ -584,24 +580,6 @@ static const struct hda_input_mux alc883_3stack_6ch_intel = { }, }; -static const struct hda_input_mux alc883_lenovo_101e_capture_source = { - .num_items = 2, - .items = { - { "Mic", 0x1 }, - { "Line", 0x2 }, - }, -}; - -static const struct hda_input_mux alc883_lenovo_nb0763_capture_source = { - .num_items = 4, - .items = { - { "Mic", 0x0 }, - { "Internal Mic", 0x1 }, - { "Line", 0x2 }, - { "CD", 0x4 }, - }, -}; - static const struct hda_input_mux alc889A_mb31_capture_source = { .num_items = 2, .items = { @@ -2000,31 +1978,6 @@ static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - -static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { - HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - static const struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), @@ -2228,43 +2181,6 @@ static const struct hda_verb alc883_targa_verbs[] = { { } /* end */ }; -static const struct hda_verb alc883_lenovo_101e_verbs[] = { - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_FRONT_EVENT|AC_USRSP_EN}, - {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT|AC_USRSP_EN}, - { } /* end */ -}; - -static const struct hda_verb alc883_lenovo_nb0763_verbs[] = { - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - { } /* end */ -}; - -static const struct hda_verb alc888_lenovo_ms7195_verbs[] = { - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_FRONT_EVENT | AC_USRSP_EN}, - {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - { } /* end */ -}; - -static const struct hda_verb alc883_haier_w66_verbs[] = { - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - - {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - { } /* end */ -}; - static const struct hda_verb alc888_6st_dell_verbs[] = { {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, { } @@ -2331,26 +2247,6 @@ static const struct hda_channel_mode alc888_3st_hp_modes[3] = { { 6, alc888_3st_hp_6ch_init }, }; -static void alc888_lenovo_ms7195_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x1b; - spec->autocfg.line_out_pins[0] = 0x14; - spec->autocfg.speaker_pins[0] = 0x15; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -/* toggle speaker-output according to the hp-jack state */ -static void alc883_lenovo_nb0763_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x14; - spec->autocfg.speaker_pins[0] = 0x15; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - /* toggle speaker-output according to the hp-jack state */ #define alc883_targa_init_hook alc882_targa_init_hook #define alc883_targa_unsol_event alc882_targa_unsol_event @@ -2383,25 +2279,6 @@ static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, } } -static void alc883_haier_w66_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x1b; - spec->autocfg.speaker_pins[0] = 0x14; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -static void alc883_lenovo_101e_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x1b; - spec->autocfg.line_out_pins[0] = 0x14; - spec->autocfg.speaker_pins[0] = 0x15; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - /* toggle speaker-output according to the hp-jack state */ static void alc883_acer_aspire_setup(struct hda_codec *codec) { @@ -2518,10 +2395,6 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC883_MEDION] = "medion", [ALC883_MEDION_WIM2160] = "medion-wim2160", [ALC883_LAPTOP_EAPD] = "laptop-eapd", - [ALC883_LENOVO_101E_2ch] = "lenovo-101e", - [ALC883_LENOVO_NB0763] = "lenovo-nb0763", - [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", - [ALC883_HAIER_W66] = "haier-w66", [ALC888_3ST_HP] = "3stack-hp", [ALC888_6ST_DELL] = "6stack-dell", [ALC883_MITAC] = "mitac", @@ -2632,13 +2505,7 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", ALC888_FUJITSU_XA3530), - SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), - SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), - SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), - SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), - SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), @@ -3172,61 +3039,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc883_clevo_m720_setup, .init_hook = alc883_clevo_m720_init_hook, }, - [ALC883_LENOVO_101E_2ch] = { - .mixers = { alc883_lenovo_101e_2ch_mixer}, - .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .adc_nids = alc883_adc_nids_alt, - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), - .capsrc_nids = alc883_capsrc_nids, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .input_mux = &alc883_lenovo_101e_capture_source, - .setup = alc883_lenovo_101e_setup, - .unsol_event = alc_sku_unsol_event, - .init_hook = alc_inithook, - }, - [ALC883_LENOVO_NB0763] = { - .mixers = { alc883_lenovo_nb0763_mixer }, - .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .need_dac_fix = 1, - .input_mux = &alc883_lenovo_nb0763_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc883_lenovo_nb0763_setup, - .init_hook = alc_hp_automute, - }, - [ALC888_LENOVO_MS7195_DIG] = { - .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), - .channel_mode = alc883_3ST_6ch_modes, - .need_dac_fix = 1, - .input_mux = &alc883_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc888_lenovo_ms7195_setup, - .init_hook = alc_inithook, - }, - [ALC883_HAIER_W66] = { - .mixers = { alc883_targa_2ch_mixer}, - .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .input_mux = &alc883_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc883_haier_w66_setup, - .init_hook = alc_hp_automute, - }, [ALC888_3ST_HP] = { .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, -- cgit v1.1 From ed63a88775c183dd3d6ee0bde0670960754e944a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 14:56:13 +0100 Subject: ALSA: hda/realtek - Drop ALC882 mitac and fujitsu-xa3530 static configs These are working well with the auto-parser although they have relatively complex setup. Let's go forward. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 131 ------------------------------------------ 1 file changed, 131 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index a71077d..2c5c181 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -36,10 +36,8 @@ enum { ALC883_LAPTOP_EAPD, ALC888_3ST_HP, ALC888_6ST_DELL, - ALC883_MITAC, ALC883_CLEVO_M540R, ALC883_CLEVO_M720, - ALC888_FUJITSU_XA3530, ALC883_3ST_6ch_INTEL, ALC889A_INTEL, ALC889_INTEL, @@ -114,43 +112,6 @@ static const struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { { 8, alc888_4ST_ch8_intel_init }, }; -/* - * ALC888 Fujitsu Siemens Amillo xa3530 - */ - -static const struct hda_verb alc888_fujitsu_xa3530_verbs[] = { -/* Front Mic: set to PIN_IN (empty by default) */ - {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, -/* Connect Internal HP to Front */ - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, -/* Connect Bass HP to Front */ - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, -/* Connect Line-Out side jack (SPDIF) to Side */ - {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, -/* Connect Mic jack to CLFE */ - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, -/* Connect Line-in jack to Surround */ - {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, -/* Connect HP out jack to Front */ - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, -/* Enable unsolicited event for HP jack and Line-out jack */ - {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - {} -}; - static void alc889_automute_setup(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; @@ -170,17 +131,6 @@ static void alc889_intel_init_hook(struct hda_codec *codec) alc_hp_automute(codec); } -static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x17; /* line-out */ - spec->autocfg.hp_pins[1] = 0x1b; /* hp */ - spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ - spec->autocfg.speaker_pins[1] = 0x15; /* bass */ - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - /* * ALC888 Acer Aspire 4930G model */ @@ -1790,23 +1740,6 @@ static const struct hda_verb alc883_medion_eapd_verbs[] = { #define alc883_base_mixer alc882_base_mixer -static const struct snd_kcontrol_new alc883_mitac_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), - HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), @@ -2095,32 +2028,6 @@ static const struct snd_kcontrol_new alc883_chmode_mixer[] = { { } /* end */ }; -/* toggle speaker-output according to the hp-jack state */ -static void alc883_mitac_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x15; - spec->autocfg.speaker_pins[0] = 0x14; - spec->autocfg.speaker_pins[1] = 0x17; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -static const struct hda_verb alc883_mitac_verbs[] = { - /* HP */ - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - /* Subwoofer */ - {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, - {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - - /* enable unsolicited event */ - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, */ - - { } /* end */ -}; - static const struct hda_verb alc883_clevo_m540r_verbs[] = { /* HP */ {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, @@ -2397,10 +2304,8 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC883_LAPTOP_EAPD] = "laptop-eapd", [ALC888_3ST_HP] = "3stack-hp", [ALC888_6ST_DELL] = "6stack-dell", - [ALC883_MITAC] = "mitac", [ALC883_CLEVO_M540R] = "clevo-m540r", [ALC883_CLEVO_M720] = "clevo-m720", - [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", [ALC889A_INTEL] = "intel-alc889a", [ALC889_INTEL] = "intel-x58", @@ -2455,8 +2360,6 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), - SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), - SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), @@ -2503,13 +2406,10 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), - SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", - ALC888_FUJITSU_XA3530), SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), - SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), @@ -3066,37 +2966,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc888_6st_dell_setup, .init_hook = alc_hp_automute, }, - [ALC883_MITAC] = { - .mixers = { alc883_mitac_mixer }, - .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .input_mux = &alc883_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc883_mitac_setup, - .init_hook = alc_hp_automute, - }, - [ALC888_FUJITSU_XA3530] = { - .mixers = { alc888_base_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs, - alc888_fujitsu_xa3530_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), - .adc_nids = alc883_adc_nids_rev, - .capsrc_nids = alc883_capsrc_nids_rev, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), - .channel_mode = alc888_4ST_8ch_intel_modes, - .num_mux_defs = - ARRAY_SIZE(alc888_2_capture_sources), - .input_mux = alc888_2_capture_sources, - .unsol_event = alc_sku_unsol_event, - .setup = alc888_fujitsu_xa3530_setup, - .init_hook = alc_hp_automute, - }, [ALC889A_MB31] = { .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, -- cgit v1.1 From 60bf5b072826cd76537071d7464e9fd74ea49350 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 9 Nov 2011 16:29:07 +0000 Subject: ASoC: Need to convert wm5100 cache sync to direct regmap usage too ASoC knows nothing about the cache now. Signed-off-by: Mark Brown --- sound/soc/codecs/wm5100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index b2d1f80..340ffe2 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -1400,7 +1400,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec, break; } - snd_soc_cache_sync(codec); + regcache_sync(wm5100->regmap); } break; -- cgit v1.1 From d926b5a3d921decc0fc537ba8a5ad53350c78f82 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 9 Nov 2011 16:08:48 +0000 Subject: ASoC: Mark WM5100 MISC CONTROL as readable Signed-off-by: Mark Brown --- sound/soc/codecs/wm5100-tables.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm5100-tables.c b/sound/soc/codecs/wm5100-tables.c index 6b2ab65..3e90dea 100644 --- a/sound/soc/codecs/wm5100-tables.c +++ b/sound/soc/codecs/wm5100-tables.c @@ -85,6 +85,7 @@ bool wm5100_readable_register(struct device *dev, unsigned int reg) case WM5100_MIC_DETECT_1: case WM5100_MIC_DETECT_2: case WM5100_MIC_DETECT_3: + case WM5100_MISC_CONTROL: case WM5100_INPUT_ENABLES: case WM5100_INPUT_ENABLES_STATUS: case WM5100_IN1L_CONTROL: -- cgit v1.1 From 588ac5e0b63da9cdef8b1b1d71dbcd95a8a94131 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 9 Nov 2011 16:12:04 +0000 Subject: ASoC: Move most WM5100 resource allocation to I2C probe More standard Linuxish. Signed-off-by: Mark Brown --- sound/soc/codecs/wm5100.c | 263 +++++++++++++++++++++++----------------------- 1 file changed, 131 insertions(+), 132 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index 340ffe2..08bf073 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -205,17 +205,15 @@ static void wm5100_free_sr(struct snd_soc_codec *codec, int rate) } } -static int wm5100_reset(struct snd_soc_codec *codec) +static int wm5100_reset(struct wm5100_priv *wm5100) { - struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); - if (wm5100->pdata.reset) { gpio_set_value_cansleep(wm5100->pdata.reset, 0); gpio_set_value_cansleep(wm5100->pdata.reset, 1); return 0; } else { - return snd_soc_write(codec, WM5100_SOFTWARE_RESET, 0); + return regmap_write(wm5100->regmap, WM5100_SOFTWARE_RESET, 0); } } @@ -2465,98 +2463,6 @@ static int wm5100_probe(struct snd_soc_codec *codec) return ret; } - for (i = 0; i < ARRAY_SIZE(wm5100->core_supplies); i++) - wm5100->core_supplies[i].supply = wm5100_core_supply_names[i]; - - ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm5100->core_supplies), - wm5100->core_supplies); - if (ret != 0) { - dev_err(codec->dev, "Failed to request core supplies: %d\n", - ret); - return ret; - } - - wm5100->cpvdd = regulator_get(&i2c->dev, "CPVDD"); - if (IS_ERR(wm5100->cpvdd)) { - ret = PTR_ERR(wm5100->cpvdd); - dev_err(&i2c->dev, "Failed to get CPVDD: %d\n", ret); - goto err_core; - } - - wm5100->dbvdd2 = regulator_get(&i2c->dev, "DBVDD2"); - if (IS_ERR(wm5100->dbvdd2)) { - ret = PTR_ERR(wm5100->dbvdd2); - dev_err(&i2c->dev, "Failed to get DBVDD2: %d\n", ret); - goto err_cpvdd; - } - - wm5100->dbvdd3 = regulator_get(&i2c->dev, "DBVDD3"); - if (IS_ERR(wm5100->dbvdd3)) { - ret = PTR_ERR(wm5100->dbvdd3); - dev_err(&i2c->dev, "Failed to get DBVDD2: %d\n", ret); - goto err_dbvdd2; - } - - ret = regulator_bulk_enable(ARRAY_SIZE(wm5100->core_supplies), - wm5100->core_supplies); - if (ret != 0) { - dev_err(codec->dev, "Failed to enable core supplies: %d\n", - ret); - goto err_dbvdd3; - } - - if (wm5100->pdata.ldo_ena) { - ret = gpio_request_one(wm5100->pdata.ldo_ena, - GPIOF_OUT_INIT_HIGH, "WM5100 LDOENA"); - if (ret < 0) { - dev_err(&i2c->dev, "Failed to request LDOENA %d: %d\n", - wm5100->pdata.ldo_ena, ret); - goto err_enable; - } - msleep(2); - } - - if (wm5100->pdata.reset) { - ret = gpio_request_one(wm5100->pdata.reset, - GPIOF_OUT_INIT_HIGH, "WM5100 /RESET"); - if (ret < 0) { - dev_err(&i2c->dev, "Failed to request /RESET %d: %d\n", - wm5100->pdata.reset, ret); - goto err_ldo; - } - } - - ret = snd_soc_read(codec, WM5100_SOFTWARE_RESET); - if (ret < 0) { - dev_err(codec->dev, "Failed to read ID register\n"); - goto err_reset; - } - switch (ret) { - case 0x8997: - case 0x5100: - break; - - default: - dev_err(codec->dev, "Device is not a WM5100, ID is %x\n", ret); - ret = -EINVAL; - goto err_reset; - } - - ret = snd_soc_read(codec, WM5100_DEVICE_REVISION); - if (ret < 0) { - dev_err(codec->dev, "Failed to read revision register\n"); - goto err_reset; - } - wm5100->rev = ret & WM5100_DEVICE_REVISION_MASK; - - dev_info(codec->dev, "revision %c\n", wm5100->rev + 'A'); - - ret = wm5100_reset(codec); - if (ret < 0) { - dev_err(codec->dev, "Failed to issue reset\n"); - goto err_reset; - } - regcache_cache_only(wm5100->regmap, true); wm5100_init_gpio(codec); @@ -2668,28 +2574,6 @@ err_gpio: if (i2c->irq) free_irq(i2c->irq, codec); wm5100_free_gpio(codec); -err_reset: - if (wm5100->pdata.reset) { - gpio_set_value_cansleep(wm5100->pdata.reset, 1); - gpio_free(wm5100->pdata.reset); - } -err_ldo: - if (wm5100->pdata.ldo_ena) { - gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0); - gpio_free(wm5100->pdata.ldo_ena); - } -err_enable: - regulator_bulk_disable(ARRAY_SIZE(wm5100->core_supplies), - wm5100->core_supplies); -err_dbvdd3: - regulator_put(wm5100->dbvdd3); -err_dbvdd2: - regulator_put(wm5100->dbvdd2); -err_cpvdd: - regulator_put(wm5100->cpvdd); -err_core: - regulator_bulk_free(ARRAY_SIZE(wm5100->core_supplies), - wm5100->core_supplies); return ret; } @@ -2706,19 +2590,6 @@ static int wm5100_remove(struct snd_soc_codec *codec) if (i2c->irq) free_irq(i2c->irq, codec); wm5100_free_gpio(codec); - if (wm5100->pdata.reset) { - gpio_set_value_cansleep(wm5100->pdata.reset, 1); - gpio_free(wm5100->pdata.reset); - } - if (wm5100->pdata.ldo_ena) { - gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0); - gpio_free(wm5100->pdata.ldo_ena); - } - regulator_put(wm5100->dbvdd3); - regulator_put(wm5100->dbvdd2); - regulator_put(wm5100->cpvdd); - regulator_bulk_free(ARRAY_SIZE(wm5100->core_supplies), - wm5100->core_supplies); return 0; } @@ -2757,6 +2628,7 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, { struct wm5100_pdata *pdata = dev_get_platdata(&i2c->dev); struct wm5100_priv *wm5100; + unsigned int reg; int ret, i; wm5100 = kzalloc(sizeof(struct wm5100_priv), GFP_KERNEL); @@ -2779,16 +2651,130 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, wm5100); + for (i = 0; i < ARRAY_SIZE(wm5100->core_supplies); i++) + wm5100->core_supplies[i].supply = wm5100_core_supply_names[i]; + + ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm5100->core_supplies), + wm5100->core_supplies); + if (ret != 0) { + dev_err(&i2c->dev, "Failed to request core supplies: %d\n", + ret); + goto err_regmap; + } + + wm5100->cpvdd = regulator_get(&i2c->dev, "CPVDD"); + if (IS_ERR(wm5100->cpvdd)) { + ret = PTR_ERR(wm5100->cpvdd); + dev_err(&i2c->dev, "Failed to get CPVDD: %d\n", ret); + goto err_core; + } + + wm5100->dbvdd2 = regulator_get(&i2c->dev, "DBVDD2"); + if (IS_ERR(wm5100->dbvdd2)) { + ret = PTR_ERR(wm5100->dbvdd2); + dev_err(&i2c->dev, "Failed to get DBVDD2: %d\n", ret); + goto err_cpvdd; + } + + wm5100->dbvdd3 = regulator_get(&i2c->dev, "DBVDD3"); + if (IS_ERR(wm5100->dbvdd3)) { + ret = PTR_ERR(wm5100->dbvdd3); + dev_err(&i2c->dev, "Failed to get DBVDD2: %d\n", ret); + goto err_dbvdd2; + } + + ret = regulator_bulk_enable(ARRAY_SIZE(wm5100->core_supplies), + wm5100->core_supplies); + if (ret != 0) { + dev_err(&i2c->dev, "Failed to enable core supplies: %d\n", + ret); + goto err_dbvdd3; + } + + if (wm5100->pdata.ldo_ena) { + ret = gpio_request_one(wm5100->pdata.ldo_ena, + GPIOF_OUT_INIT_HIGH, "WM5100 LDOENA"); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to request LDOENA %d: %d\n", + wm5100->pdata.ldo_ena, ret); + goto err_enable; + } + msleep(2); + } + + if (wm5100->pdata.reset) { + ret = gpio_request_one(wm5100->pdata.reset, + GPIOF_OUT_INIT_HIGH, "WM5100 /RESET"); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to request /RESET %d: %d\n", + wm5100->pdata.reset, ret); + goto err_ldo; + } + } + + ret = regmap_read(wm5100->regmap, WM5100_SOFTWARE_RESET, ®); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to read ID register\n"); + goto err_reset; + } + switch (reg) { + case 0x8997: + case 0x5100: + break; + + default: + dev_err(&i2c->dev, "Device is not a WM5100, ID is %x\n", reg); + ret = -EINVAL; + goto err_reset; + } + + ret = regmap_read(wm5100->regmap, WM5100_DEVICE_REVISION, ®); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to read revision register\n"); + goto err_reset; + } + wm5100->rev = reg & WM5100_DEVICE_REVISION_MASK; + + dev_info(&i2c->dev, "revision %c\n", wm5100->rev + 'A'); + + ret = wm5100_reset(wm5100); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to issue reset\n"); + goto err_reset; + } + ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm5100, wm5100_dai, ARRAY_SIZE(wm5100_dai)); if (ret < 0) { dev_err(&i2c->dev, "Failed to register WM5100: %d\n", ret); - goto err_regmap; + goto err_reset; } return ret; +err_reset: + if (wm5100->pdata.reset) { + gpio_set_value_cansleep(wm5100->pdata.reset, 1); + gpio_free(wm5100->pdata.reset); + } +err_ldo: + if (wm5100->pdata.ldo_ena) { + gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0); + gpio_free(wm5100->pdata.ldo_ena); + } +err_enable: + regulator_bulk_disable(ARRAY_SIZE(wm5100->core_supplies), + wm5100->core_supplies); +err_dbvdd3: + regulator_put(wm5100->dbvdd3); +err_dbvdd2: + regulator_put(wm5100->dbvdd2); +err_cpvdd: + regulator_put(wm5100->cpvdd); +err_core: + regulator_bulk_free(ARRAY_SIZE(wm5100->core_supplies), + wm5100->core_supplies); err_regmap: regmap_exit(wm5100->regmap); err_alloc: @@ -2801,6 +2787,19 @@ static __devexit int wm5100_i2c_remove(struct i2c_client *client) struct wm5100_priv *wm5100 = i2c_get_clientdata(client); snd_soc_unregister_codec(&client->dev); + if (wm5100->pdata.reset) { + gpio_set_value_cansleep(wm5100->pdata.reset, 1); + gpio_free(wm5100->pdata.reset); + } + if (wm5100->pdata.ldo_ena) { + gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0); + gpio_free(wm5100->pdata.ldo_ena); + } + regulator_put(wm5100->dbvdd3); + regulator_put(wm5100->dbvdd2); + regulator_put(wm5100->cpvdd); + regulator_bulk_free(ARRAY_SIZE(wm5100->core_supplies), + wm5100->core_supplies); regmap_exit(wm5100->regmap); kfree(wm5100); -- cgit v1.1 From abda5dfdd56e548a7c569a40c404d8679c4f35f1 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 23 Aug 2011 17:40:01 +0100 Subject: ASoC: Add Lowland machine driver The Lowland platform is based on the Cragganmore system like Speyside but uses the WM5100 audio CODEC. Signed-off-by: Mark Brown --- sound/soc/samsung/Kconfig | 7 ++ sound/soc/samsung/Makefile | 2 + sound/soc/samsung/lowland.c | 246 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 255 insertions(+) create mode 100644 sound/soc/samsung/lowland.c (limited to 'sound') diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index 53aaa69..71f38de 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -198,3 +198,10 @@ config SND_SOC_SPEYSIDE_WM8962 depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 select SND_SAMSUNG_I2S select SND_SOC_WM8962 + +config SND_SOC_LOWLAND + tristate "Audio support for Wolfson Lowland" + depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 + select SND_SAMSUNG_I2S + select SND_SOC_WM5100 + select SND_SOC_WM9081 diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index 8509d3c..7802c25 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile @@ -40,6 +40,7 @@ snd-soc-smdk-wm8580pcm-objs := smdk_wm8580pcm.o snd-soc-smdk-wm8994pcm-objs := smdk_wm8994pcm.o snd-soc-speyside-objs := speyside.o snd-soc-speyside-wm8962-objs := speyside_wm8962.o +snd-soc-lowland-objs := lowland.o obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o @@ -61,3 +62,4 @@ obj-$(CONFIG_SND_SOC_SMDK_WM8580_PCM) += snd-soc-smdk-wm8580pcm.o obj-$(CONFIG_SND_SOC_SMDK_WM8994_PCM) += snd-soc-smdk-wm8994pcm.o obj-$(CONFIG_SND_SOC_SPEYSIDE) += snd-soc-speyside.o obj-$(CONFIG_SND_SOC_SPEYSIDE_WM8962) += snd-soc-speyside-wm8962.o +obj-$(CONFIG_SND_SOC_LOWLAND) += snd-soc-lowland.o diff --git a/sound/soc/samsung/lowland.c b/sound/soc/samsung/lowland.c new file mode 100644 index 0000000..eff1b4b --- /dev/null +++ b/sound/soc/samsung/lowland.c @@ -0,0 +1,246 @@ +/* + * Lowland audio support + * + * Copyright 2011 Wolfson Microelectronics + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include +#include +#include + +#include "../codecs/wm5100.h" +#include "../codecs/wm9081.h" + +#define MCLK1_RATE (44100 * 512) +#define CLKOUT_RATE (44100 * 256) + +static int lowland_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 *cpu_dai = rtd->cpu_dai; + struct snd_soc_dai *codec_dai = rtd->codec_dai; + int ret; + + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S + | SND_SOC_DAIFMT_NB_NF + | SND_SOC_DAIFMT_CBM_CFM); + if (ret < 0) + return ret; + + ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S + | SND_SOC_DAIFMT_NB_NF + | SND_SOC_DAIFMT_CBM_CFM); + if (ret < 0) + return ret; + + return 0; +} + +static struct snd_soc_ops lowland_ops = { + .hw_params = lowland_hw_params, +}; + +static struct snd_soc_jack lowland_headset; + +/* Headset jack detection DAPM pins */ +static struct snd_soc_jack_pin lowland_headset_pins[] = { + { + .pin = "Headphone", + .mask = SND_JACK_HEADPHONE | SND_JACK_LINEOUT, + }, + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, +}; + +static int lowland_wm5100_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_codec *codec = rtd->codec; + int ret; + + ret = snd_soc_codec_set_sysclk(codec, WM5100_CLK_SYSCLK, + WM5100_CLKSRC_MCLK1, MCLK1_RATE, + SND_SOC_CLOCK_IN); + if (ret < 0) { + pr_err("Failed to set SYSCLK clock source: %d\n", ret); + return ret; + } + + /* Clock OPCLK, used by the other audio components. */ + ret = snd_soc_codec_set_sysclk(codec, WM5100_CLK_OPCLK, 0, + CLKOUT_RATE, 0); + if (ret < 0) { + pr_err("Failed to set OPCLK rate: %d\n", ret); + return ret; + } + + ret = snd_soc_jack_new(codec, "Headset", + SND_JACK_LINEOUT | SND_JACK_HEADSET | + SND_JACK_BTN_0, + &lowland_headset); + if (ret) + return ret; + + ret = snd_soc_jack_add_pins(&lowland_headset, + ARRAY_SIZE(lowland_headset_pins), + lowland_headset_pins); + if (ret) + return ret; + + wm5100_detect(codec, &lowland_headset); + + return 0; +} + +static struct snd_soc_dai_link lowland_dai[] = { + { + .name = "CPU", + .stream_name = "CPU", + .cpu_dai_name = "samsung-i2s.0", + .codec_dai_name = "wm5100-aif1", + .platform_name = "samsung-audio", + .codec_name = "wm5100.1-001a", + .ops = &lowland_ops, + .init = lowland_wm5100_init, + }, + { + .name = "Baseband", + .stream_name = "Baseband", + .cpu_dai_name = "wm5100-aif2", + .codec_dai_name = "wm1250-ev1", + .codec_name = "wm1250-ev1.1-0027", + .ops = &lowland_ops, + .ignore_suspend = 1, + }, +}; + +static int lowland_wm9081_init(struct snd_soc_dapm_context *dapm) +{ + snd_soc_dapm_nc_pin(dapm, "LINEOUT"); + + /* At any time the WM9081 is active it will have this clock */ + return snd_soc_codec_set_sysclk(dapm->codec, WM9081_SYSCLK_MCLK, 0, + CLKOUT_RATE, 0); +} + +static struct snd_soc_aux_dev lowland_aux_dev[] = { + { + .name = "wm9081", + .codec_name = "wm9081.1-006c", + .init = lowland_wm9081_init, + }, +}; + +static struct snd_soc_codec_conf lowland_codec_conf[] = { + { + .dev_name = "wm9081.1-006c", + .name_prefix = "Sub", + }, +}; + +static const struct snd_kcontrol_new controls[] = { + SOC_DAPM_PIN_SWITCH("Main Speaker"), + SOC_DAPM_PIN_SWITCH("Main DMIC"), + SOC_DAPM_PIN_SWITCH("Main AMIC"), + SOC_DAPM_PIN_SWITCH("WM1250 Input"), + SOC_DAPM_PIN_SWITCH("WM1250 Output"), + SOC_DAPM_PIN_SWITCH("Headphone"), +}; + +static struct snd_soc_dapm_widget widgets[] = { + SND_SOC_DAPM_HP("Headphone", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), + + SND_SOC_DAPM_SPK("Main Speaker", NULL), + + SND_SOC_DAPM_MIC("Main AMIC", NULL), + SND_SOC_DAPM_MIC("Main DMIC", NULL), +}; + +static struct snd_soc_dapm_route audio_paths[] = { + { "Sub IN1", NULL, "HPOUT2L" }, + { "Sub IN2", NULL, "HPOUT2R" }, + + { "Main Speaker", NULL, "Sub SPKN" }, + { "Main Speaker", NULL, "Sub SPKP" }, + { "Main Speaker", NULL, "SPKDAT1" }, +}; + +static struct snd_soc_card lowland = { + .name = "Lowland", + .dai_link = lowland_dai, + .num_links = ARRAY_SIZE(lowland_dai), + .aux_dev = lowland_aux_dev, + .num_aux_devs = ARRAY_SIZE(lowland_aux_dev), + .codec_conf = lowland_codec_conf, + .num_configs = ARRAY_SIZE(lowland_codec_conf), + + .controls = controls, + .num_controls = ARRAY_SIZE(controls), + .dapm_widgets = widgets, + .num_dapm_widgets = ARRAY_SIZE(widgets), + .dapm_routes = audio_paths, + .num_dapm_routes = ARRAY_SIZE(audio_paths), +}; + +static __devinit int lowland_probe(struct platform_device *pdev) +{ + struct snd_soc_card *card = &lowland; + int ret; + + card->dev = &pdev->dev; + + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); + return ret; + } + + return 0; +} + +static int __devexit lowland_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + + return 0; +} + +static struct platform_driver lowland_driver = { + .driver = { + .name = "lowland", + .owner = THIS_MODULE, + .pm = &snd_soc_pm_ops, + }, + .probe = lowland_probe, + .remove = __devexit_p(lowland_remove), +}; + +static int __init lowland_audio_init(void) +{ + return platform_driver_register(&lowland_driver); +} +module_init(lowland_audio_init); + +static void __exit lowland_audio_exit(void) +{ + platform_driver_unregister(&lowland_driver); +} +module_exit(lowland_audio_exit); + +MODULE_DESCRIPTION("Lowland audio support"); +MODULE_AUTHOR("Mark Brown "); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:lowland"); -- cgit v1.1 From 7a6069bf64d22e1ca5413acf494dafb4200be44c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 15:22:01 +0100 Subject: ALSA: hda/realtek - Replace ALC882 arima, medion and laptop-eapd quirks Move these quitks to the auto-parser. They just need some EAPD setups in addition. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 104 ------------------------------------------ sound/pci/hda/patch_realtek.c | 13 ++++++ 2 files changed, 13 insertions(+), 104 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index 2c5c181..0f7f5e7 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -8,7 +8,6 @@ enum { ALC882_AUTO, ALC882_3ST_DIG, ALC882_6ST_DIG, - ALC882_ARIMA, ALC882_W2JC, ALC882_TARGA, ALC885_MACPRO, @@ -31,9 +30,6 @@ enum { ALC888_ACER_ASPIRE_6530G, ALC888_ACER_ASPIRE_8930G, ALC888_ACER_ASPIRE_7730G, - ALC883_MEDION, - ALC883_MEDION_WIM2160, - ALC883_LAPTOP_EAPD, ALC888_3ST_HP, ALC888_6ST_DELL, ALC883_CLEVO_M540R, @@ -1731,13 +1727,6 @@ static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { { 6, alc889A_mb31_ch6_init }, }; -static const struct hda_verb alc883_medion_eapd_verbs[] = { - /* eanable EAPD on medion laptop */ - {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, - {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, - { } -}; - #define alc883_base_mixer alc882_base_mixer static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { @@ -1911,43 +1900,6 @@ static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), - { } /* end */ -}; - -static const struct hda_verb alc883_medion_wim2160_verbs[] = { - /* Unmute front mixer */ - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - - /* Set speaker pin to front mixer */ - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - - /* Init headphone pin */ - {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - - { } /* end */ -}; - -/* toggle speaker-output according to the hp-jack state */ -static void alc883_medion_wim2160_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x1a; - spec->autocfg.speaker_pins[0] = 0x15; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), @@ -2276,7 +2228,6 @@ static const hda_nid_t alc1200_slave_dig_outs[] = { static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC882_3ST_DIG] = "3stack-dig", [ALC882_6ST_DIG] = "6stack-dig", - [ALC882_ARIMA] = "arima", [ALC882_W2JC] = "w2jc", [ALC882_TARGA] = "targa", [ALC885_MACPRO] = "macpro", @@ -2299,9 +2250,6 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", - [ALC883_MEDION] = "medion", - [ALC883_MEDION_WIM2160] = "medion-wim2160", - [ALC883_LAPTOP_EAPD] = "laptop-eapd", [ALC888_3ST_HP] = "3stack-hp", [ALC888_6ST_DELL] = "6stack-dell", [ALC883_CLEVO_M540R] = "clevo-m540r", @@ -2360,7 +2308,6 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), - SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), @@ -2402,10 +2349,7 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), - SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), - /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ - SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), @@ -2471,16 +2415,6 @@ static const struct alc_config_preset alc882_presets[] = { .channel_mode = alc882_sixstack_modes, .input_mux = &alc882_capture_source, }, - [ALC882_ARIMA] = { - .mixers = { alc882_base_mixer, alc882_chmode_mixer }, - .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, - alc882_eapd_verbs }, - .num_dacs = ARRAY_SIZE(alc882_dac_nids), - .dac_nids = alc882_dac_nids, - .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), - .channel_mode = alc882_sixstack_modes, - .input_mux = &alc882_capture_source, - }, [ALC882_W2JC] = { .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, @@ -2873,44 +2807,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc888_acer_aspire_7730g_setup, .init_hook = alc_hp_automute, }, - [ALC883_MEDION] = { - .mixers = { alc883_fivestack_mixer, - alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs, - alc883_medion_eapd_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .adc_nids = alc883_adc_nids_alt, - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), - .capsrc_nids = alc883_capsrc_nids, - .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), - .channel_mode = alc883_sixstack_modes, - .input_mux = &alc883_capture_source, - }, - [ALC883_MEDION_WIM2160] = { - .mixers = { alc883_medion_wim2160_mixer }, - .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), - .adc_nids = alc883_adc_nids, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .input_mux = &alc883_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc883_medion_wim2160_setup, - .init_hook = alc_hp_automute, - }, - [ALC883_LAPTOP_EAPD] = { - .mixers = { alc883_base_mixer }, - .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .input_mux = &alc883_capture_source, - }, [ALC883_CLEVO_M540R] = { .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 43c7aea..422430d 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4236,6 +4236,7 @@ enum { ALC889_FIXUP_VAIO_TT, ALC888_FIXUP_EEE1601, ALC882_FIXUP_EAPD, + ALC883_FIXUP_EAPD, }; static const struct alc_fixup alc882_fixups[] = { @@ -4298,6 +4299,15 @@ static const struct alc_fixup alc882_fixups[] = { { } } }, + [ALC883_FIXUP_EAPD] = { + .type = ALC_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { + /* change to EAPD mode */ + { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, + { } + } + }, }; static const struct snd_pci_quirk alc882_fixup_tbl[] = { @@ -4307,9 +4317,12 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), /* codec SSID */ + SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), + SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), + SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), {} }; -- cgit v1.1 From 145fa008a208e824567d2d9b26133a4cd0e7fdbd Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 17:28:27 +0100 Subject: ALSA: hda/realtek - Drop ALC882 3stack-hp, 6stack-dell and clevo-m540r models These static configs are no longer needed by replacement with the auto-parser. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 150 ------------------------------------------ 1 file changed, 150 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index 0f7f5e7..80321a1 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -30,9 +30,6 @@ enum { ALC888_ACER_ASPIRE_6530G, ALC888_ACER_ASPIRE_8930G, ALC888_ACER_ASPIRE_7730G, - ALC888_3ST_HP, - ALC888_6ST_DELL, - ALC883_CLEVO_M540R, ALC883_CLEVO_M720, ALC883_3ST_6ch_INTEL, ALC889A_INTEL, @@ -1980,22 +1977,6 @@ static const struct snd_kcontrol_new alc883_chmode_mixer[] = { { } /* end */ }; -static const struct hda_verb alc883_clevo_m540r_verbs[] = { - /* HP */ - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - /* Int speaker */ - /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ - - /* enable unsolicited event */ - /* - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, - */ - - { } /* end */ -}; - static const struct hda_verb alc883_clevo_m720_verbs[] = { /* HP */ {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, @@ -2040,72 +2021,6 @@ static const struct hda_verb alc883_targa_verbs[] = { { } /* end */ }; -static const struct hda_verb alc888_6st_dell_verbs[] = { - {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - { } -}; - -static void alc888_3st_hp_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x1b; - spec->autocfg.speaker_pins[0] = 0x14; - spec->autocfg.speaker_pins[1] = 0x16; - spec->autocfg.speaker_pins[2] = 0x18; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -static const struct hda_verb alc888_3st_hp_verbs[] = { - {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ - {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ - {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ - {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - { } /* end */ -}; - -/* - * 2ch mode - */ -static const struct hda_verb alc888_3st_hp_2ch_init[] = { - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, - { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { } /* end */ -}; - -/* - * 4ch mode - */ -static const struct hda_verb alc888_3st_hp_4ch_init[] = { - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, - { } /* end */ -}; - -/* - * 6ch mode - */ -static const struct hda_verb alc888_3st_hp_6ch_init[] = { - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, - { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, - { } /* end */ -}; - -static const struct hda_channel_mode alc888_3st_hp_modes[3] = { - { 2, alc888_3st_hp_2ch_init }, - { 4, alc888_3st_hp_4ch_init }, - { 6, alc888_3st_hp_6ch_init }, -}; - /* toggle speaker-output according to the hp-jack state */ #define alc883_targa_init_hook alc882_targa_init_hook #define alc883_targa_unsol_event alc882_targa_unsol_event @@ -2167,18 +2082,6 @@ static const struct hda_verb alc883_acer_eapd_verbs[] = { { } }; -static void alc888_6st_dell_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x1b; - spec->autocfg.speaker_pins[0] = 0x14; - spec->autocfg.speaker_pins[1] = 0x15; - spec->autocfg.speaker_pins[2] = 0x16; - spec->autocfg.speaker_pins[3] = 0x17; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - static const struct hda_verb alc889A_mb31_verbs[] = { /* Init rear pin (used as headphone output) */ {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ @@ -2250,9 +2153,6 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", - [ALC888_3ST_HP] = "3stack-hp", - [ALC888_6ST_DELL] = "6stack-dell", - [ALC883_CLEVO_M540R] = "clevo-m540r", [ALC883_CLEVO_M720] = "clevo-m720", [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", [ALC889A_INTEL] = "intel-alc889a", @@ -2291,14 +2191,8 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { */ /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ - SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), - SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), - SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), - SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), @@ -2308,7 +2202,6 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), - SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), @@ -2348,7 +2241,6 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), - SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), @@ -2807,21 +2699,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc888_acer_aspire_7730g_setup, .init_hook = alc_hp_automute, }, - [ALC883_CLEVO_M540R] = { - .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .dig_in_nid = ALC883_DIGIN_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), - .channel_mode = alc883_3ST_6ch_clevo_modes, - .need_dac_fix = 1, - .input_mux = &alc883_capture_source, - /* This machine has the hardware HP auto-muting, thus - * we need no software mute via unsol event - */ - }, [ALC883_CLEVO_M720] = { .mixers = { alc883_clevo_m720_mixer }, .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, @@ -2835,33 +2712,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc883_clevo_m720_setup, .init_hook = alc883_clevo_m720_init_hook, }, - [ALC888_3ST_HP] = { - .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), - .channel_mode = alc888_3st_hp_modes, - .need_dac_fix = 1, - .input_mux = &alc883_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc888_3st_hp_setup, - .init_hook = alc_hp_automute, - }, - [ALC888_6ST_DELL] = { - .mixers = { alc883_base_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .dig_in_nid = ALC883_DIGIN_NID, - .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), - .channel_mode = alc883_sixstack_modes, - .input_mux = &alc883_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc888_6st_dell_setup, - .init_hook = alc_hp_automute, - }, [ALC889A_MB31] = { .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, -- cgit v1.1 From b3ca3bf5e8e0fb445a81aef02092ae0b11fa4482 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 17:32:39 +0100 Subject: ALSA: hda/realtek - Drop ALC882 model=clevo-m720 quirk This works well without any special handling with the auto-parser. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 74 ------------------------------------------- 1 file changed, 74 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index 80321a1..370b5a7 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -30,7 +30,6 @@ enum { ALC888_ACER_ASPIRE_6530G, ALC888_ACER_ASPIRE_8930G, ALC888_ACER_ASPIRE_7730G, - ALC883_CLEVO_M720, ALC883_3ST_6ch_INTEL, ALC889A_INTEL, ALC889_INTEL, @@ -1726,20 +1725,6 @@ static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { #define alc883_base_mixer alc882_base_mixer -static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { - HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), @@ -1977,21 +1962,6 @@ static const struct snd_kcontrol_new alc883_chmode_mixer[] = { { } /* end */ }; -static const struct hda_verb alc883_clevo_m720_verbs[] = { - /* HP */ - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - /* Int speaker */ - {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - - /* enable unsolicited event */ - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, - - { } /* end */ -}; - static const struct hda_verb alc883_targa_verbs[] = { {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, @@ -2025,34 +1995,6 @@ static const struct hda_verb alc883_targa_verbs[] = { #define alc883_targa_init_hook alc882_targa_init_hook #define alc883_targa_unsol_event alc882_targa_unsol_event -static void alc883_clevo_m720_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x15; - spec->autocfg.speaker_pins[0] = 0x14; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -static void alc883_clevo_m720_init_hook(struct hda_codec *codec) -{ - alc_hp_automute(codec); - alc88x_simple_mic_automute(codec); -} - -static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, - unsigned int res) -{ - switch (res >> 26) { - case ALC_MIC_EVENT: - alc88x_simple_mic_automute(codec); - break; - default: - alc_sku_unsol_event(codec, res); - break; - } -} - /* toggle speaker-output according to the hp-jack state */ static void alc883_acer_aspire_setup(struct hda_codec *codec) { @@ -2153,7 +2095,6 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", - [ALC883_CLEVO_M720] = "clevo-m720", [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", [ALC889A_INTEL] = "intel-alc889a", [ALC889_INTEL] = "intel-x58", @@ -2239,8 +2180,6 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), - SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), - SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), @@ -2699,19 +2638,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc888_acer_aspire_7730g_setup, .init_hook = alc_hp_automute, }, - [ALC883_CLEVO_M720] = { - .mixers = { alc883_clevo_m720_mixer }, - .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .input_mux = &alc883_capture_source, - .unsol_event = alc883_clevo_m720_unsol_event, - .setup = alc883_clevo_m720_setup, - .init_hook = alc883_clevo_m720_init_hook, - }, [ALC889A_MB31] = { .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, -- cgit v1.1 From 25da1f86b4e7f5fef26cec1f65be3b120f2d36ac Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 17:33:27 +0100 Subject: ALSA: hda/realtek - Drop ALC882 model=acer quirk This quirk is anyway not used any more, so no problem to remove. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index 370b5a7..29c9b8a 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -24,7 +24,6 @@ enum { ALC883_TARGA_DIG, ALC883_TARGA_2ch_DIG, ALC883_TARGA_8ch_DIG, - ALC883_ACER, ALC883_ACER_ASPIRE, ALC888_ACER_ASPIRE_4930G, ALC888_ACER_ASPIRE_6530G, @@ -2089,7 +2088,6 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC883_TARGA_DIG] = "targa-dig", [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", - [ALC883_ACER] = "acer", [ALC883_ACER_ASPIRE] = "acer-aspire", [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", @@ -2127,10 +2125,6 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { ALC888_ACER_ASPIRE_6530G), SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", ALC888_ACER_ASPIRE_7730G), - /* default Acer -- disabled as it causes more problems. - * model=auto should work fine now - */ - /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG), SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), @@ -2524,20 +2518,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc882_targa_setup, .init_hook = alc882_targa_automute, }, - [ALC883_ACER] = { - .mixers = { alc883_base_mixer }, - /* On TravelMate laptops, GPIO 0 enables the internal speaker - * and the headphone jack. Turn this on and rely on the - * standard mute methods whenever the user wants to turn - * these outputs off. - */ - .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .input_mux = &alc883_capture_source, - }, [ALC883_ACER_ASPIRE] = { .mixers = { alc883_acer_aspire_mixer }, .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, -- cgit v1.1 From 8812c4f96178620ebaabbd6e32401411b244d26b Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 17:39:15 +0100 Subject: ALSA: hda/realtek - Move ALC882 model=acer-aspire to auto-parser The ALC882 model=acer-aspire requires the additional COEF setup. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 62 ------------------------------------------- sound/pci/hda/patch_realtek.c | 16 +++++++++++ 2 files changed, 16 insertions(+), 62 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index 29c9b8a..707dd28 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -24,7 +24,6 @@ enum { ALC883_TARGA_DIG, ALC883_TARGA_2ch_DIG, ALC883_TARGA_8ch_DIG, - ALC883_ACER_ASPIRE, ALC888_ACER_ASPIRE_4930G, ALC888_ACER_ASPIRE_6530G, ALC888_ACER_ASPIRE_8930G, @@ -1881,18 +1880,6 @@ static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - { } /* end */ -}; - static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), @@ -1994,35 +1981,6 @@ static const struct hda_verb alc883_targa_verbs[] = { #define alc883_targa_init_hook alc882_targa_init_hook #define alc883_targa_unsol_event alc882_targa_unsol_event -/* toggle speaker-output according to the hp-jack state */ -static void alc883_acer_aspire_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x14; - spec->autocfg.speaker_pins[0] = 0x15; - spec->autocfg.speaker_pins[1] = 0x16; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -static const struct hda_verb alc883_acer_eapd_verbs[] = { - /* HP Pin: output 0 (0x0c) */ - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* Front Pin: output 0 (0x0c) */ - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* eanable EAPD on medion laptop */ - {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, - {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, - /* enable unsolicited event */ - {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - { } -}; - static const struct hda_verb alc889A_mb31_verbs[] = { /* Init rear pin (used as headphone output) */ {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ @@ -2088,7 +2046,6 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC883_TARGA_DIG] = "targa-dig", [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", - [ALC883_ACER_ASPIRE] = "acer-aspire", [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", @@ -2103,12 +2060,6 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), - SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), - SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), - SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), - SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), - SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), - SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", ALC888_ACER_ASPIRE_4930G), SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", @@ -2518,19 +2469,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc882_targa_setup, .init_hook = alc882_targa_automute, }, - [ALC883_ACER_ASPIRE] = { - .mixers = { alc883_acer_aspire_mixer }, - .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .input_mux = &alc883_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc883_acer_aspire_setup, - .init_hook = alc_hp_automute, - }, [ALC888_ACER_ASPIRE_4930G] = { .mixers = { alc888_acer_aspire_4930g_mixer, alc883_chmode_mixer }, diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 422430d..32663c7 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4237,6 +4237,7 @@ enum { ALC888_FIXUP_EEE1601, ALC882_FIXUP_EAPD, ALC883_FIXUP_EAPD, + ALC883_FIXUP_ACER_EAPD, }; static const struct alc_fixup alc882_fixups[] = { @@ -4308,9 +4309,24 @@ static const struct alc_fixup alc882_fixups[] = { { } } }, + [ALC883_FIXUP_ACER_EAPD] = { + .type = ALC_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { + /* eanable EAPD on Acer laptops */ + { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, + { } + } + }, }; static const struct snd_pci_quirk alc882_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD), + SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), + SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD), + SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), + SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD), + SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD), SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), -- cgit v1.1 From ac9b1cddf10a299fb3a4dd411e518d07ad17f89f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 17:45:55 +0100 Subject: ALSA: hda/realtek - Reorder alc882_fixup_tbl[] No, I'm not Mr. Monk, but can't resist... Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 32663c7..765780c 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4328,17 +4328,17 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD), SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD), SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), + SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), - SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), + SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), /* codec SSID */ SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), - SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), - SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), + SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), {} }; -- cgit v1.1 From eb844d51cccca0ce9fad316da803f1bbe53d323b Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 18:03:07 +0100 Subject: ALSA: hda/realtek - Remove ALC882 targa-* models All ALC882 targa-* models can be replaced with the auto-parser just with the additional GPIO3 setup. And it's generically applied to all MSI boards unless other quirks are present. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 235 ------------------------------------------ sound/pci/hda/patch_realtek.c | 6 ++ 2 files changed, 6 insertions(+), 235 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index 707dd28..185ad65 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -9,7 +9,6 @@ enum { ALC882_3ST_DIG, ALC882_6ST_DIG, ALC882_W2JC, - ALC882_TARGA, ALC885_MACPRO, ALC885_MBA21, ALC885_MBP3, @@ -21,9 +20,6 @@ enum { ALC883_3ST_6ch_DIG, ALC883_3ST_6ch, ALC883_6ST_DIG, - ALC883_TARGA_DIG, - ALC883_TARGA_2ch_DIG, - ALC883_TARGA_8ch_DIG, ALC888_ACER_ASPIRE_4930G, ALC888_ACER_ASPIRE_6530G, ALC888_ACER_ASPIRE_8930G, @@ -1019,23 +1015,6 @@ static const struct snd_kcontrol_new alc882_w2jc_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc882_targa_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), - { } /* end */ -}; - static const struct snd_kcontrol_new alc882_chmode_mixer[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -1593,45 +1572,7 @@ static void alc885_imac91_setup(struct hda_codec *codec) alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); } -static const struct hda_verb alc882_targa_verbs[] = { - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - - {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ - {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ - {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ - - {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - { } /* end */ -}; - /* toggle speaker-output according to the hp-jack state */ -static void alc882_targa_automute(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - alc_hp_automute(codec); - snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, - spec->hp_jack_present ? 1 : 3); -} - -static void alc882_targa_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x14; - spec->autocfg.speaker_pins[0] = 0x1b; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) -{ - if ((res >> 26) == ALC_HP_EVENT) - alc882_targa_automute(codec); -} - static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) { unsigned int gpiostate, gpiomask, gpiodir; @@ -1834,52 +1775,6 @@ static const struct snd_kcontrol_new alc883_fivestack_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc883_targa_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), - HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), - HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - { } /* end */ -}; - -static const struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), - HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - -static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { - HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), @@ -1948,39 +1843,6 @@ static const struct snd_kcontrol_new alc883_chmode_mixer[] = { { } /* end */ }; -static const struct hda_verb alc883_targa_verbs[] = { - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - -/* Connect Line-Out side jack (SPDIF) to Side */ - {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, -/* Connect Mic jack to CLFE */ - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, -/* Connect Line-in jack to Surround */ - {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, -/* Connect HP out jack to Front */ - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, - - {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - - { } /* end */ -}; - -/* toggle speaker-output according to the hp-jack state */ -#define alc883_targa_init_hook alc882_targa_init_hook -#define alc883_targa_unsol_event alc882_targa_unsol_event - static const struct hda_verb alc889A_mb31_verbs[] = { /* Init rear pin (used as headphone output) */ {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ @@ -2031,7 +1893,6 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC882_3ST_DIG] = "3stack-dig", [ALC882_6ST_DIG] = "6stack-dig", [ALC882_W2JC] = "w2jc", - [ALC882_TARGA] = "targa", [ALC885_MACPRO] = "macpro", [ALC885_MB5] = "mb5", [ALC885_MACMINI3] = "macmini3", @@ -2043,9 +1904,6 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", [ALC883_3ST_6ch] = "3stack-6ch", [ALC883_6ST_DIG] = "alc883-6stack-dig", - [ALC883_TARGA_DIG] = "targa-dig", - [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", - [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", @@ -2091,37 +1949,14 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), - SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), - SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), - SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), - SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ - SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), - SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), - SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), - SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), - SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), - SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), - SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), - SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), - SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), - SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), - SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), - SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), - SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), - SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), - SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), - SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), - SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), @@ -2302,24 +2137,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc885_imac91_setup, .init_hook = alc_hp_automute, }, - [ALC882_TARGA] = { - .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, - .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, - alc880_gpio3_init_verbs, alc882_targa_verbs}, - .num_dacs = ARRAY_SIZE(alc882_dac_nids), - .dac_nids = alc882_dac_nids, - .dig_out_nid = ALC882_DIGOUT_NID, - .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), - .adc_nids = alc882_adc_nids, - .capsrc_nids = alc882_capsrc_nids, - .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), - .channel_mode = alc882_3ST_6ch_modes, - .need_dac_fix = 1, - .input_mux = &alc882_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc882_targa_setup, - .init_hook = alc882_targa_automute, - }, [ALC883_3ST_2ch_DIG] = { .mixers = { alc883_3ST_2ch_mixer }, .init_verbs = { alc883_init_verbs }, @@ -2417,58 +2234,6 @@ static const struct alc_config_preset alc882_presets[] = { .channel_mode = alc883_sixstack_modes, .input_mux = &alc883_capture_source, }, - [ALC883_TARGA_DIG] = { - .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, - alc883_targa_verbs}, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), - .channel_mode = alc883_3ST_6ch_modes, - .need_dac_fix = 1, - .input_mux = &alc883_capture_source, - .unsol_event = alc883_targa_unsol_event, - .setup = alc882_targa_setup, - .init_hook = alc882_targa_automute, - }, - [ALC883_TARGA_2ch_DIG] = { - .mixers = { alc883_targa_2ch_mixer}, - .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, - alc883_targa_verbs}, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .adc_nids = alc883_adc_nids_alt, - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), - .capsrc_nids = alc883_capsrc_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .input_mux = &alc883_capture_source, - .unsol_event = alc883_targa_unsol_event, - .setup = alc882_targa_setup, - .init_hook = alc882_targa_automute, - }, - [ALC883_TARGA_8ch_DIG] = { - .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, - alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, - alc883_targa_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), - .adc_nids = alc883_adc_nids_rev, - .capsrc_nids = alc883_capsrc_nids_rev, - .dig_out_nid = ALC883_DIGOUT_NID, - .dig_in_nid = ALC883_DIGIN_NID, - .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), - .channel_mode = alc883_4ST_8ch_modes, - .need_dac_fix = 1, - .input_mux = &alc883_capture_source, - .unsol_event = alc883_targa_unsol_event, - .setup = alc882_targa_setup, - .init_hook = alc882_targa_automute, - }, [ALC888_ACER_ASPIRE_4930G] = { .mixers = { alc888_acer_aspire_4930g_mixer, alc883_chmode_mixer }, diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 765780c..5aa8deb 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4238,6 +4238,7 @@ enum { ALC882_FIXUP_EAPD, ALC883_FIXUP_EAPD, ALC883_FIXUP_ACER_EAPD, + ALC882_FIXUP_GPIO3, }; static const struct alc_fixup alc882_fixups[] = { @@ -4318,6 +4319,10 @@ static const struct alc_fixup alc882_fixups[] = { { } } }, + [ALC882_FIXUP_GPIO3] = { + .type = ALC_FIXUP_VERBS, + .v.verbs = alc_gpio3_init_verbs, + }, }; static const struct snd_pci_quirk alc882_fixup_tbl[] = { @@ -4335,6 +4340,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), /* codec SSID */ SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), + SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), -- cgit v1.1 From 68ef0561efe494143516df38c03a16b837b8e79c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 9 Nov 2011 18:24:44 +0100 Subject: ALSA: hda/realtek - Drop ALC882 desktop model quirks Now we're touching the desktop static configs for ALC88x codecs. These are mostly OK with the auto-parser, but some models need careful handling; ALC889 intel mobo requires the COEF setup, and W2JC needs GPIO1 and COEF. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 780 ------------------------------------------ sound/pci/hda/patch_realtek.c | 30 +- 2 files changed, 22 insertions(+), 788 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index 185ad65..ccd20d1 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -6,9 +6,6 @@ /* ALC882 models */ enum { ALC882_AUTO, - ALC882_3ST_DIG, - ALC882_6ST_DIG, - ALC882_W2JC, ALC885_MACPRO, ALC885_MBA21, ALC885_MBP3, @@ -16,108 +13,15 @@ enum { ALC885_MACMINI3, ALC885_IMAC24, ALC885_IMAC91, - ALC883_3ST_2ch_DIG, - ALC883_3ST_6ch_DIG, - ALC883_3ST_6ch, - ALC883_6ST_DIG, ALC888_ACER_ASPIRE_4930G, ALC888_ACER_ASPIRE_6530G, ALC888_ACER_ASPIRE_8930G, ALC888_ACER_ASPIRE_7730G, - ALC883_3ST_6ch_INTEL, - ALC889A_INTEL, - ALC889_INTEL, ALC889A_MB31, ALC882_MODEL_LAST, }; /* - * 2ch mode - */ -static const struct hda_verb alc888_4ST_ch2_intel_init[] = { -/* Mic-in jack as mic in */ - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, -/* Line-in jack as Line in */ - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, -/* Line-Out as Front */ - { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, - { } /* end */ -}; - -/* - * 4ch mode - */ -static const struct hda_verb alc888_4ST_ch4_intel_init[] = { -/* Mic-in jack as mic in */ - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, -/* Line-in jack as Surround */ - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, -/* Line-Out as Front */ - { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, - { } /* end */ -}; - -/* - * 6ch mode - */ -static const struct hda_verb alc888_4ST_ch6_intel_init[] = { -/* Mic-in jack as CLFE */ - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, -/* Line-in jack as Surround */ - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, -/* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ - { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, - { } /* end */ -}; - -/* - * 8ch mode - */ -static const struct hda_verb alc888_4ST_ch8_intel_init[] = { -/* Mic-in jack as CLFE */ - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, -/* Line-in jack as Surround */ - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, -/* Line-Out as Side */ - { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, - { } /* end */ -}; - -static const struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { - { 2, alc888_4ST_ch2_intel_init }, - { 4, alc888_4ST_ch4_intel_init }, - { 6, alc888_4ST_ch6_intel_init }, - { 8, alc888_4ST_ch8_intel_init }, -}; - -static void alc889_automute_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x15; - spec->autocfg.speaker_pins[0] = 0x14; - spec->autocfg.speaker_pins[1] = 0x16; - spec->autocfg.speaker_pins[2] = 0x17; - spec->autocfg.speaker_pins[3] = 0x19; - spec->autocfg.speaker_pins[4] = 0x1a; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -static void alc889_intel_init_hook(struct hda_codec *codec) -{ - alc889_coef_init(codec); - alc_hp_automute(codec); -} - -/* * ALC888 Acer Aspire 4930G model */ @@ -586,79 +490,6 @@ static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = { #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes -/* - * 2ch mode - */ -static const struct hda_verb alc883_3ST_ch2_clevo_init[] = { - { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { } /* end */ -}; - -/* - * 4ch mode - */ -static const struct hda_verb alc883_3ST_ch4_clevo_init[] = { - { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, - { } /* end */ -}; - -/* - * 6ch mode - */ -static const struct hda_verb alc883_3ST_ch6_clevo_init[] = { - { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, - { } /* end */ -}; - -static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { - { 2, alc883_3ST_ch2_clevo_init }, - { 4, alc883_3ST_ch4_clevo_init }, - { 6, alc883_3ST_ch6_clevo_init }, -}; - - -/* - * 6ch mode - */ -static const struct hda_verb alc882_sixstack_ch6_init[] = { - { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, - { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { } /* end */ -}; - -/* - * 8ch mode - */ -static const struct hda_verb alc882_sixstack_ch8_init[] = { - { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { } /* end */ -}; - -static const struct hda_channel_mode alc882_sixstack_modes[2] = { - { 6, alc882_sixstack_ch6_init }, - { 8, alc882_sixstack_ch8_init }, -}; - /* Macbook Air 2,1 */ @@ -728,216 +559,6 @@ static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = { #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes -/* - * 2ch mode - */ -static const struct hda_verb alc883_4ST_ch2_init[] = { - { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { } /* end */ -}; - -/* - * 4ch mode - */ -static const struct hda_verb alc883_4ST_ch4_init[] = { - { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, - { } /* end */ -}; - -/* - * 6ch mode - */ -static const struct hda_verb alc883_4ST_ch6_init[] = { - { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, - { } /* end */ -}; - -/* - * 8ch mode - */ -static const struct hda_verb alc883_4ST_ch8_init[] = { - { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, - { } /* end */ -}; - -static const struct hda_channel_mode alc883_4ST_8ch_modes[4] = { - { 2, alc883_4ST_ch2_init }, - { 4, alc883_4ST_ch4_init }, - { 6, alc883_4ST_ch6_init }, - { 8, alc883_4ST_ch8_init }, -}; - - -/* - * 2ch mode - */ -static const struct hda_verb alc883_3ST_ch2_intel_init[] = { - { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, - { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { } /* end */ -}; - -/* - * 4ch mode - */ -static const struct hda_verb alc883_3ST_ch4_intel_init[] = { - { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, - { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, - { } /* end */ -}; - -/* - * 6ch mode - */ -static const struct hda_verb alc883_3ST_ch6_intel_init[] = { - { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, - { } /* end */ -}; - -static const struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { - { 2, alc883_3ST_ch2_intel_init }, - { 4, alc883_3ST_ch4_intel_init }, - { 6, alc883_3ST_ch6_intel_init }, -}; - -/* - * 2ch mode - */ -static const struct hda_verb alc889_ch2_intel_init[] = { - { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, - { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, - { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, - { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { } /* end */ -}; - -/* - * 6ch mode - */ -static const struct hda_verb alc889_ch6_intel_init[] = { - { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, - { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, - { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, - { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { } /* end */ -}; - -/* - * 8ch mode - */ -static const struct hda_verb alc889_ch8_intel_init[] = { - { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, - { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, - { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, - { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, - { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { } /* end */ -}; - -static const struct hda_channel_mode alc889_8ch_intel_modes[3] = { - { 2, alc889_ch2_intel_init }, - { 6, alc889_ch6_intel_init }, - { 8, alc889_ch8_intel_init }, -}; - -/* - * 6ch mode - */ -static const struct hda_verb alc883_sixstack_ch6_init[] = { - { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, - { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { } /* end */ -}; - -/* - * 8ch mode - */ -static const struct hda_verb alc883_sixstack_ch8_init[] = { - { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { } /* end */ -}; - -static const struct hda_channel_mode alc883_sixstack_modes[2] = { - { 6, alc883_sixstack_ch6_init }, - { 8, alc883_sixstack_ch8_init }, -}; - - -/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 - * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b - */ -static const struct snd_kcontrol_new alc882_base_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), - HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), - HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - /* Macbook Air 2,1 same control for HP and internal Speaker */ static const struct snd_kcontrol_new alc885_mba21_mixer[] = { @@ -1002,19 +623,6 @@ static const struct snd_kcontrol_new alc885_imac91_mixer[] = { }; -static const struct snd_kcontrol_new alc882_w2jc_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - { } /* end */ -}; - static const struct snd_kcontrol_new alc882_chmode_mixer[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -1100,100 +708,12 @@ static const struct hda_verb alc882_adc1_init_verbs[] = { { } }; -static const struct hda_verb alc882_eapd_verbs[] = { - /* change to EAPD mode */ - {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, - {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, - { } -}; - static const struct hda_verb alc889_eapd_verbs[] = { {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, { } }; -static const struct hda_verb alc_hp15_unsol_verbs[] = { - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {} -}; - -static const struct hda_verb alc885_init_verbs[] = { - /* Front mixer: unmute input/output amp left and right (volume = 0) */ - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - /* Rear mixer */ - {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - /* CLFE mixer */ - {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - /* Side mixer */ - {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - - /* Front HP Pin: output 0 (0x0c) */ - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* Front Pin: output 0 (0x0c) */ - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* Rear Pin: output 1 (0x0d) */ - {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, - /* CLFE Pin: output 2 (0x0e) */ - {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, - /* Side Pin: output 3 (0x0f) */ - {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, - /* Mic (rear) pin: input vref at 80% */ - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, - {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - /* Front Mic pin: input vref at 80% */ - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, - {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - /* Line In pin: input */ - {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, - {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - - /* Mixer elements: 0x18, , 0x1a, 0x1b */ - /* Input mixer1 */ - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - /* Input mixer2 */ - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - /* Input mixer3 */ - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - /* ADC2: mute amp left and right */ - {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - /* ADC3: mute amp left and right */ - {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - - { } -}; - -static const struct hda_verb alc885_init_input_verbs[] = { - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, - { } -}; - - -/* Unmute Selector 24h and set the default input to front mic */ -static const struct hda_verb alc889_init_input_verbs[] = { - {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - { } -}; - - #define alc883_init_verbs alc882_base_init_verbs /* Mac Pro test */ @@ -1662,25 +1182,6 @@ static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { { 6, alc889A_mb31_ch6_init }, }; -#define alc883_base_mixer alc882_base_mixer - -static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), @@ -1704,77 +1205,6 @@ static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), - HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, - HDA_OUTPUT), - HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), - HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - { } /* end */ -}; - -static const struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), - HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, - HDA_OUTPUT), - HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), - HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - { } /* end */ -}; - -static const struct snd_kcontrol_new alc883_fivestack_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), - HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), - HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT), - HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), @@ -1814,24 +1244,6 @@ static const struct snd_kcontrol_new alc889A_mb31_mixer[] = { { } /* end */ }; -static const struct hda_bind_ctls alc883_bind_cap_vol = { - .ops = &snd_hda_bind_vol, - .values = { - HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), - HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), - 0 - }, -}; - -static const struct hda_bind_ctls alc883_bind_cap_switch = { - .ops = &snd_hda_bind_sw, - .values = { - HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), - HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), - 0 - }, -}; - static const struct snd_kcontrol_new alc883_chmode_mixer[] = { { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, @@ -1878,21 +1290,10 @@ static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) alc889A_mb31_automute(codec); } -static const hda_nid_t alc883_slave_dig_outs[] = { - ALC1200_DIGOUT_NID, 0, -}; - -static const hda_nid_t alc1200_slave_dig_outs[] = { - ALC883_DIGOUT_NID, 0, -}; - /* * configuration and preset */ static const char * const alc882_models[ALC882_MODEL_LAST] = { - [ALC882_3ST_DIG] = "3stack-dig", - [ALC882_6ST_DIG] = "6stack-dig", - [ALC882_W2JC] = "w2jc", [ALC885_MACPRO] = "macpro", [ALC885_MB5] = "mb5", [ALC885_MACMINI3] = "macmini3", @@ -1900,24 +1301,15 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC885_MBP3] = "mbp3", [ALC885_IMAC24] = "imac24", [ALC885_IMAC91] = "imac91", - [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", - [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", - [ALC883_3ST_6ch] = "3stack-6ch", - [ALC883_6ST_DIG] = "alc883-6stack-dig", [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", - [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", - [ALC889A_INTEL] = "intel-alc889a", - [ALC889_INTEL] = "intel-x58", [ALC889A_MB31] = "mb31", [ALC882_AUTO] = "auto", }; static const struct snd_pci_quirk alc882_cfg_tbl[] = { - SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), - SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", ALC888_ACER_ASPIRE_4930G), SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", @@ -1926,50 +1318,12 @@ static const struct snd_pci_quirk alc882_cfg_tbl[] = { ALC888_ACER_ASPIRE_8930G), SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", ALC888_ACER_ASPIRE_8930G), - SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), - SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", ALC888_ACER_ASPIRE_6530G), SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", ALC888_ACER_ASPIRE_6530G), SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", ALC888_ACER_ASPIRE_7730G), - - SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), - - SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), - SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), - SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), - SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), - SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), - - SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), - SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), - SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), - - SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), - SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), - SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), - - SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), - SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), - SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), - SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), - - SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), - SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), - SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), - SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), - SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), - SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), - {} }; @@ -2001,43 +1355,6 @@ static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { }; static const struct alc_config_preset alc882_presets[] = { - [ALC882_3ST_DIG] = { - .mixers = { alc882_base_mixer }, - .init_verbs = { alc882_base_init_verbs, - alc882_adc1_init_verbs }, - .num_dacs = ARRAY_SIZE(alc882_dac_nids), - .dac_nids = alc882_dac_nids, - .dig_out_nid = ALC882_DIGOUT_NID, - .dig_in_nid = ALC882_DIGIN_NID, - .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), - .channel_mode = alc882_ch_modes, - .need_dac_fix = 1, - .input_mux = &alc882_capture_source, - }, - [ALC882_6ST_DIG] = { - .mixers = { alc882_base_mixer, alc882_chmode_mixer }, - .init_verbs = { alc882_base_init_verbs, - alc882_adc1_init_verbs }, - .num_dacs = ARRAY_SIZE(alc882_dac_nids), - .dac_nids = alc882_dac_nids, - .dig_out_nid = ALC882_DIGOUT_NID, - .dig_in_nid = ALC882_DIGIN_NID, - .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), - .channel_mode = alc882_sixstack_modes, - .input_mux = &alc882_capture_source, - }, - [ALC882_W2JC] = { - .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, - .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, - alc882_eapd_verbs, alc880_gpio1_init_verbs }, - .num_dacs = ARRAY_SIZE(alc882_dac_nids), - .dac_nids = alc882_dac_nids, - .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), - .channel_mode = alc880_threestack_modes, - .need_dac_fix = 1, - .input_mux = &alc882_capture_source, - .dig_out_nid = ALC882_DIGOUT_NID, - }, [ALC885_MBA21] = { .mixers = { alc885_mba21_mixer }, .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, @@ -2137,103 +1454,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc885_imac91_setup, .init_hook = alc_hp_automute, }, - [ALC883_3ST_2ch_DIG] = { - .mixers = { alc883_3ST_2ch_mixer }, - .init_verbs = { alc883_init_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .dig_in_nid = ALC883_DIGIN_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .input_mux = &alc883_capture_source, - }, - [ALC883_3ST_6ch_DIG] = { - .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .dig_in_nid = ALC883_DIGIN_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), - .channel_mode = alc883_3ST_6ch_modes, - .need_dac_fix = 1, - .input_mux = &alc883_capture_source, - }, - [ALC883_3ST_6ch] = { - .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), - .channel_mode = alc883_3ST_6ch_modes, - .need_dac_fix = 1, - .input_mux = &alc883_capture_source, - }, - [ALC883_3ST_6ch_INTEL] = { - .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .dig_in_nid = ALC883_DIGIN_NID, - .slave_dig_outs = alc883_slave_dig_outs, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), - .channel_mode = alc883_3ST_6ch_intel_modes, - .need_dac_fix = 1, - .input_mux = &alc883_3stack_6ch_intel, - }, - [ALC889A_INTEL] = { - .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, - .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, - alc_hp15_unsol_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), - .adc_nids = alc889_adc_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .dig_in_nid = ALC883_DIGIN_NID, - .slave_dig_outs = alc883_slave_dig_outs, - .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), - .channel_mode = alc889_8ch_intel_modes, - .capsrc_nids = alc889_capsrc_nids, - .input_mux = &alc889_capture_source, - .setup = alc889_automute_setup, - .init_hook = alc_hp_automute, - .unsol_event = alc_sku_unsol_event, - .need_dac_fix = 1, - }, - [ALC889_INTEL] = { - .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, - .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, - alc889_eapd_verbs, alc_hp15_unsol_verbs}, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), - .adc_nids = alc889_adc_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .dig_in_nid = ALC883_DIGIN_NID, - .slave_dig_outs = alc883_slave_dig_outs, - .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), - .channel_mode = alc889_8ch_intel_modes, - .capsrc_nids = alc889_capsrc_nids, - .input_mux = &alc889_capture_source, - .setup = alc889_automute_setup, - .init_hook = alc889_intel_init_hook, - .unsol_event = alc_sku_unsol_event, - .need_dac_fix = 1, - }, - [ALC883_6ST_DIG] = { - .mixers = { alc883_base_mixer, alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .dig_in_nid = ALC883_DIGIN_NID, - .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), - .channel_mode = alc883_sixstack_modes, - .input_mux = &alc883_capture_source, - }, [ALC888_ACER_ASPIRE_4930G] = { .mixers = { alc888_acer_aspire_4930g_mixer, alc883_chmode_mixer }, diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 5aa8deb..c1fa4c3 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4239,8 +4239,18 @@ enum { ALC883_FIXUP_EAPD, ALC883_FIXUP_ACER_EAPD, ALC882_FIXUP_GPIO3, + ALC889_FIXUP_COEF, + ALC882_FIXUP_ASUS_W2JC, }; +static void alc889_fixup_coef(struct hda_codec *codec, + const struct alc_fixup *fix, int action) +{ + if (action != ALC_FIXUP_ACT_INIT) + return; + alc889_coef_init(codec); +} + static const struct alc_fixup alc882_fixups[] = { [ALC882_FIXUP_ABIT_AW9D_MAX] = { .type = ALC_FIXUP_PINS, @@ -4323,6 +4333,16 @@ static const struct alc_fixup alc882_fixups[] = { .type = ALC_FIXUP_VERBS, .v.verbs = alc_gpio3_init_verbs, }, + [ALC882_FIXUP_ASUS_W2JC] = { + .type = ALC_FIXUP_VERBS, + .v.verbs = alc_gpio1_init_verbs, + .chained = true, + .chain_id = ALC882_FIXUP_EAPD, + }, + [ALC889_FIXUP_COEF] = { + .type = ALC_FIXUP_FUNC, + .v.func = alc889_fixup_coef, + }, }; static const struct snd_pci_quirk alc882_fixup_tbl[] = { @@ -4336,6 +4356,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), + SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), /* codec SSID */ @@ -4345,6 +4366,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), + SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF), {} }; @@ -4417,14 +4439,6 @@ static int patch_alc882(struct hda_codec *codec) err = alc882_parse_auto_config(codec); if (err < 0) goto error; -#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS - else if (!err) { - printk(KERN_INFO - "hda_codec: Cannot set up configuration " - "from BIOS. Using base mode...\n"); - board_config = ALC882_3ST_DIG; - } -#endif } if (board_config != ALC_MODEL_AUTO) -- cgit v1.1 From 9db16e4c1b21abe5bfc15b6a14824acc0ce0d594 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 9 Nov 2011 17:27:28 +0000 Subject: ASoC: Convert WM5100 gpiolib support to direct regmap API usage Signed-off-by: Mark Brown --- sound/soc/codecs/wm5100.c | 52 +++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 27 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index 08bf073..0077086 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -2352,24 +2352,22 @@ static inline struct wm5100_priv *gpio_to_wm5100(struct gpio_chip *chip) static void wm5100_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); - struct snd_soc_codec *codec = wm5100->codec; - snd_soc_update_bits(codec, WM5100_GPIO_CTRL_1 + offset, - WM5100_GP1_LVL, !!value << WM5100_GP1_LVL_SHIFT); + regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset, + WM5100_GP1_LVL, !!value << WM5100_GP1_LVL_SHIFT); } static int wm5100_gpio_direction_out(struct gpio_chip *chip, unsigned offset, int value) { struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); - struct snd_soc_codec *codec = wm5100->codec; int val, ret; val = (1 << WM5100_GP1_FN_SHIFT) | (!!value << WM5100_GP1_LVL_SHIFT); - ret = snd_soc_update_bits(codec, WM5100_GPIO_CTRL_1 + offset, - WM5100_GP1_FN_MASK | WM5100_GP1_DIR | - WM5100_GP1_LVL, val); + ret = regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset, + WM5100_GP1_FN_MASK | WM5100_GP1_DIR | + WM5100_GP1_LVL, val); if (ret < 0) return ret; else @@ -2379,25 +2377,24 @@ static int wm5100_gpio_direction_out(struct gpio_chip *chip, static int wm5100_gpio_get(struct gpio_chip *chip, unsigned offset) { struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); - struct snd_soc_codec *codec = wm5100->codec; + unsigned int reg; int ret; - ret = snd_soc_read(codec, WM5100_GPIO_CTRL_1 + offset); + ret = regmap_read(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset, ®); if (ret < 0) return ret; - return (ret & WM5100_GP1_LVL) != 0; + return (reg & WM5100_GP1_LVL) != 0; } static int wm5100_gpio_direction_in(struct gpio_chip *chip, unsigned offset) { struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); - struct snd_soc_codec *codec = wm5100->codec; - return snd_soc_update_bits(codec, WM5100_GPIO_CTRL_1 + offset, - WM5100_GP1_FN_MASK | WM5100_GP1_DIR, - (1 << WM5100_GP1_FN_SHIFT) | - (1 << WM5100_GP1_DIR_SHIFT)); + return regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset, + WM5100_GP1_FN_MASK | WM5100_GP1_DIR, + (1 << WM5100_GP1_FN_SHIFT) | + (1 << WM5100_GP1_DIR_SHIFT)); } static struct gpio_chip wm5100_template_chip = { @@ -2410,14 +2407,14 @@ static struct gpio_chip wm5100_template_chip = { .can_sleep = 1, }; -static void wm5100_init_gpio(struct snd_soc_codec *codec) +static void wm5100_init_gpio(struct i2c_client *i2c) { - struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); + struct wm5100_priv *wm5100 = i2c_get_clientdata(i2c); int ret; wm5100->gpio_chip = wm5100_template_chip; wm5100->gpio_chip.ngpio = 6; - wm5100->gpio_chip.dev = codec->dev; + wm5100->gpio_chip.dev = &i2c->dev; if (wm5100->pdata.gpio_base) wm5100->gpio_chip.base = wm5100->pdata.gpio_base; @@ -2426,24 +2423,24 @@ static void wm5100_init_gpio(struct snd_soc_codec *codec) ret = gpiochip_add(&wm5100->gpio_chip); if (ret != 0) - dev_err(codec->dev, "Failed to add GPIOs: %d\n", ret); + dev_err(&i2c->dev, "Failed to add GPIOs: %d\n", ret); } -static void wm5100_free_gpio(struct snd_soc_codec *codec) +static void wm5100_free_gpio(struct i2c_client *i2c) { - struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); + struct wm5100_priv *wm5100 = i2c_get_clientdata(i2c); int ret; ret = gpiochip_remove(&wm5100->gpio_chip); if (ret != 0) - dev_err(codec->dev, "Failed to remove GPIOs: %d\n", ret); + dev_err(&i2c->dev, "Failed to remove GPIOs: %d\n", ret); } #else -static void wm5100_init_gpio(struct snd_soc_codec *codec) +static void wm5100_init_gpio(struct i2c_client *i2c) { } -static void wm5100_free_gpio(struct snd_soc_codec *codec) +static void wm5100_free_gpio(struct i2c_client *i2c) { } #endif @@ -2465,7 +2462,6 @@ static int wm5100_probe(struct snd_soc_codec *codec) regcache_cache_only(wm5100->regmap, true); - wm5100_init_gpio(codec); for (i = 0; i < ARRAY_SIZE(wm5100_dig_vu); i++) snd_soc_update_bits(codec, wm5100_dig_vu[i], WM5100_OUT_VU, @@ -2573,7 +2569,6 @@ static int wm5100_probe(struct snd_soc_codec *codec) err_gpio: if (i2c->irq) free_irq(i2c->irq, codec); - wm5100_free_gpio(codec); return ret; } @@ -2589,7 +2584,6 @@ static int wm5100_remove(struct snd_soc_codec *codec) } if (i2c->irq) free_irq(i2c->irq, codec); - wm5100_free_gpio(codec); return 0; } @@ -2743,6 +2737,8 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, goto err_reset; } + wm5100_init_gpio(i2c); + ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm5100, wm5100_dai, ARRAY_SIZE(wm5100_dai)); @@ -2754,6 +2750,7 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, return ret; err_reset: + wm5100_free_gpio(i2c); if (wm5100->pdata.reset) { gpio_set_value_cansleep(wm5100->pdata.reset, 1); gpio_free(wm5100->pdata.reset); @@ -2787,6 +2784,7 @@ static __devexit int wm5100_i2c_remove(struct i2c_client *client) struct wm5100_priv *wm5100 = i2c_get_clientdata(client); snd_soc_unregister_codec(&client->dev); + wm5100_free_gpio(client); if (wm5100->pdata.reset) { gpio_set_value_cansleep(wm5100->pdata.reset, 1); gpio_free(wm5100->pdata.reset); -- cgit v1.1 From f4034147259f72cb7c4870a4188bd8beb592f87d Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 9 Nov 2011 23:15:26 +0000 Subject: ASoC: Fix duplicate const warnings in da7210.c Signed-off-by: Mark Brown --- sound/soc/codecs/da7210.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index b545b7d..8b5848a 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c @@ -240,7 +240,7 @@ static const DECLARE_TLV_DB_SCALE(adc_eq_master_gain_tlv, -1800, 600, 1); static const DECLARE_TLV_DB_SCALE(dac_gain_tlv, -7725, 75, 0); /* ADC and DAC high pass filter f0 value */ -static const char const *da7210_hpf_cutoff_txt[] = { +static const char * const da7210_hpf_cutoff_txt[] = { "Fs/8192*pi", "Fs/4096*pi", "Fs/2048*pi", "Fs/1024*pi" }; @@ -251,7 +251,7 @@ static const struct soc_enum da7210_adc_hpf_cutoff = SOC_ENUM_SINGLE(DA7210_ADC_HPF, 0, 4, da7210_hpf_cutoff_txt); /* ADC and DAC voice (8kHz) high pass cutoff value */ -static const char const *da7210_vf_cutoff_txt[] = { +static const char * const da7210_vf_cutoff_txt[] = { "2.5Hz", "25Hz", "50Hz", "100Hz", "150Hz", "200Hz", "300Hz", "400Hz" }; -- cgit v1.1 From 94d5f7c0255bd712d68732a0180558d45fe6eac5 Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Sat, 5 Nov 2011 12:38:02 +0200 Subject: ASoC: Add new Realtek ALC5632 CODEC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This driver implements basic functionality, using I²C for the control channel. Signed-off-by: Leon Romanovsky Signed-off-by: Andrey Danin Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 3 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/alc5632.c | 1153 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/alc5632.h | 249 ++++++++++ 4 files changed, 1407 insertions(+) create mode 100644 sound/soc/codecs/alc5632.c create mode 100644 sound/soc/codecs/alc5632.h (limited to 'sound') diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 4584514..684cc15 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -26,6 +26,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_AK4642 if I2C select SND_SOC_AK4671 if I2C select SND_SOC_ALC5623 if I2C + select SND_SOC_ALC5632 if I2C select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC select SND_SOC_CS42L51 if I2C select SND_SOC_CS4270 if I2C @@ -168,6 +169,8 @@ config SND_SOC_AK4671 config SND_SOC_ALC5623 tristate +config SND_SOC_ALC5632 + tristate config SND_SOC_CQ0093VC tristate diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index a7c415d..af64905 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -31,6 +31,7 @@ snd-soc-pcm3008-objs := pcm3008.o snd-soc-rt5631-objs := rt5631.o snd-soc-sgtl5000-objs := sgtl5000.o snd-soc-alc5623-objs := alc5623.o +snd-soc-alc5632-objs := alc5632.o snd-soc-sn95031-objs := sn95031.o snd-soc-spdif-objs := spdif_transciever.o snd-soc-ssm2602-objs := ssm2602.o @@ -113,6 +114,7 @@ obj-$(CONFIG_SND_SOC_AK4641) += snd-soc-ak4641.o obj-$(CONFIG_SND_SOC_AK4642) += snd-soc-ak4642.o obj-$(CONFIG_SND_SOC_AK4671) += snd-soc-ak4671.o obj-$(CONFIG_SND_SOC_ALC5623) += snd-soc-alc5623.o +obj-$(CONFIG_SND_SOC_ALC5632) += snd-soc-alc5632.o obj-$(CONFIG_SND_SOC_CQ0093VC) += snd-soc-cq93vc.o obj-$(CONFIG_SND_SOC_CS42L51) += snd-soc-cs42l51.o obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c new file mode 100644 index 0000000..ee6a497 --- /dev/null +++ b/sound/soc/codecs/alc5632.c @@ -0,0 +1,1153 @@ +/* +* alc5632.c -- ALC5632 ALSA SoC Audio Codec +* +* Copyright (C) 2011 The AC100 Kernel Team +* +* Authors: Leon Romanovsky +* Andrey Danin +* Ilya Petrov +* Marc Dietrich +* +* Based on alc5623.c by Arnaud Patard +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "alc5632.h" + +/* + * ALC5632 register cache + */ +static const u16 alc5632_reg_defaults[] = { + 0x59B4, 0x0000, 0x8080, 0x0000, /* 0 */ + 0x8080, 0x0000, 0x8080, 0x0000, /* 4 */ + 0xC800, 0x0000, 0xE808, 0x0000, /* 8 */ + 0x1010, 0x0000, 0x0808, 0x0000, /* 12 */ + 0xEE0F, 0x0000, 0xCBCB, 0x0000, /* 16 */ + 0x7F7F, 0x0000, 0x0000, 0x0000, /* 20 */ + 0xE010, 0x0000, 0x0000, 0x0000, /* 24 */ + 0x8008, 0x0000, 0x0000, 0x0000, /* 28 */ + 0x0000, 0x0000, 0x0000, 0x0000, /* 32 */ + 0x00C0, 0x0000, 0xEF00, 0x0000, /* 36 */ + 0x0000, 0x0000, 0x0000, 0x0000, /* 40 */ + 0x0000, 0x0000, 0x0000, 0x0000, /* 44 */ + 0x0000, 0x0000, 0x0000, 0x0000, /* 48 */ + 0x8000, 0x0000, 0x0000, 0x0000, /* 52 */ + 0x0000, 0x0000, 0x0000, 0x0000, /* 56 */ + 0x0000, 0x0000, 0x8000, 0x0000, /* 60 */ + 0x0C0A, 0x0000, 0x0000, 0x0000, /* 64 */ + 0x0000, 0x0000, 0x0000, 0x0000, /* 68 */ + 0x0000, 0x0000, 0x0000, 0x0000, /* 72 */ + 0xBE3E, 0x0000, 0xBE3E, 0x0000, /* 76 */ + 0x0000, 0x0000, 0x0000, 0x0000, /* 80 */ + 0x803A, 0x0000, 0x0000, 0x0000, /* 84 */ + 0x0000, 0x0000, 0x0009, 0x0000, /* 88 */ + 0x0000, 0x0000, 0x3000, 0x0000, /* 92 */ + 0x3075, 0x0000, 0x1010, 0x0000, /* 96 */ + 0x3110, 0x0000, 0x0000, 0x0000, /* 100 */ + 0x0553, 0x0000, 0x0000, 0x0000, /* 104 */ + 0x0000, 0x0000, 0x0000, 0x0000, /* 108 */ +}; + +/* codec private data */ +struct alc5632_priv { + enum snd_soc_control_type control_type; + void *control_data; + struct mutex mutex; + u8 id; + unsigned int sysclk; +}; + +static int alc5632_volatile_register(struct snd_soc_codec *codec, + unsigned int reg) +{ + switch (reg) { + case ALC5632_RESET: + case ALC5632_PWR_DOWN_CTRL_STATUS: + case ALC5632_GPIO_PIN_STATUS: + case ALC5632_OVER_CURR_STATUS: + case ALC5632_HID_CTRL_DATA: + case ALC5632_EQ_CTRL: + return 1; + + default: + break; + } + + return 0; +} + +static inline int alc5632_reset(struct snd_soc_codec *codec) +{ + snd_soc_write(codec, ALC5632_RESET, 0); + return snd_soc_read(codec, ALC5632_RESET); +} + +static int amp_mixer_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) +{ + /* to power-on/off class-d amp generators/speaker */ + /* need to write to 'index-46h' register : */ + /* so write index num (here 0x46) to reg 0x6a */ + /* and then 0xffff/0 to reg 0x6c */ + snd_soc_write(w->codec, ALC5632_HID_CTRL_INDEX, 0x46); + + switch (event) { + case SND_SOC_DAPM_PRE_PMU: + snd_soc_write(w->codec, ALC5632_HID_CTRL_DATA, 0xFFFF); + break; + case SND_SOC_DAPM_POST_PMD: + snd_soc_write(w->codec, ALC5632_HID_CTRL_DATA, 0); + break; + } + + return 0; +} + +/* + * ALC5632 Controls + */ + +/* -34.5db min scale, 1.5db steps, no mute */ +static const DECLARE_TLV_DB_SCALE(vol_tlv, -3450, 150, 0); +/* -46.5db min scale, 1.5db steps, no mute */ +static const DECLARE_TLV_DB_SCALE(hp_tlv, -4650, 150, 0); +/* -16.5db min scale, 1.5db steps, no mute */ +static const DECLARE_TLV_DB_SCALE(adc_rec_tlv, -1650, 150, 0); +static const unsigned int boost_tlv[] = { + TLV_DB_RANGE_HEAD(3), + 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), + 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0), + 2, 2, TLV_DB_SCALE_ITEM(3000, 0, 0), +}; +/* 0db min scale, 6 db steps, no mute */ +static const DECLARE_TLV_DB_SCALE(dig_tlv, 0, 600, 0); +/* 0db min scalem 0.75db steps, no mute */ +static const DECLARE_TLV_DB_SCALE(vdac_tlv, -3525, 075, 0); + +static const struct snd_kcontrol_new alc5632_vol_snd_controls[] = { + /* left starts at bit 8, right at bit 0 */ + /* 31 steps (5 bit), -46.5db scale */ + SOC_DOUBLE_TLV("Line Playback Volume", + ALC5632_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv), + /* bit 15 mutes left, bit 7 right */ + SOC_DOUBLE("Line Playback Switch", + ALC5632_SPK_OUT_VOL, 15, 7, 1, 1), + SOC_DOUBLE_TLV("Headphone Playback Volume", + ALC5632_HP_OUT_VOL, 8, 0, 31, 1, hp_tlv), + SOC_DOUBLE("Headphone Playback Switch", + ALC5632_HP_OUT_VOL, 15, 7, 1, 1), +}; + +static const struct snd_kcontrol_new alc5632_snd_controls[] = { + SOC_DOUBLE_TLV("Auxout Playback Volume", + ALC5632_AUX_OUT_VOL, 8, 0, 31, 1, hp_tlv), + SOC_DOUBLE("Auxout Playback Switch", + ALC5632_AUX_OUT_VOL, 15, 7, 1, 1), + SOC_SINGLE_TLV("Voice DAC Playback Volume", + ALC5632_VOICE_DAC_VOL, 0, 63, 0, vdac_tlv), + SOC_SINGLE_TLV("Phone Capture Volume", + ALC5632_PHONE_IN_VOL, 8, 31, 1, vol_tlv), + SOC_DOUBLE_TLV("LineIn Capture Volume", + ALC5632_LINE_IN_VOL, 8, 0, 31, 1, vol_tlv), + SOC_DOUBLE_TLV("Stereo DAC Playback Volume", + ALC5632_STEREO_DAC_IN_VOL, 8, 0, 63, 1, vdac_tlv), + SOC_DOUBLE("Stereo DAC Playback Switch", + ALC5632_STEREO_DAC_IN_VOL, 15, 7, 1, 1), + SOC_SINGLE_TLV("Mic1 Capture Volume", + ALC5632_MIC_VOL, 8, 31, 1, vol_tlv), + SOC_SINGLE_TLV("Mic2 Capture Volume", + ALC5632_MIC_VOL, 0, 31, 1, vol_tlv), + SOC_DOUBLE_TLV("Rec Capture Volume", + ALC5632_ADC_REC_GAIN, 8, 0, 31, 0, adc_rec_tlv), + SOC_SINGLE_TLV("Mic 1 Boost Volume", + ALC5632_MIC_CTRL, 10, 2, 0, boost_tlv), + SOC_SINGLE_TLV("Mic 2 Boost Volume", + ALC5632_MIC_CTRL, 8, 2, 0, boost_tlv), + SOC_SINGLE_TLV("Digital Boost Volume", + ALC5632_DIGI_BOOST_CTRL, 0, 7, 0, dig_tlv), +}; + +/* + * DAPM Controls + */ +static const struct snd_kcontrol_new alc5632_hp_mixer_controls[] = { +SOC_DAPM_SINGLE("LI2HP Playback Switch", ALC5632_LINE_IN_VOL, 15, 1, 1), +SOC_DAPM_SINGLE("PHONE2HP Playback Switch", ALC5632_PHONE_IN_VOL, 15, 1, 1), +SOC_DAPM_SINGLE("MIC12HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 15, 1, 1), +SOC_DAPM_SINGLE("MIC22HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 11, 1, 1), +SOC_DAPM_SINGLE("VOICE2HP Playback Switch", ALC5632_VOICE_DAC_VOL, 15, 1, 1), +}; + +static const struct snd_kcontrol_new alc5632_hpl_mixer_controls[] = { +SOC_DAPM_SINGLE("ADC2HP_L Playback Switch", ALC5632_ADC_REC_GAIN, 15, 1, 1), +SOC_DAPM_SINGLE("DACL2HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 3, 1, 1), +}; + +static const struct snd_kcontrol_new alc5632_hpr_mixer_controls[] = { +SOC_DAPM_SINGLE("ADC2HP_R Playback Switch", ALC5632_ADC_REC_GAIN, 7, 1, 1), +SOC_DAPM_SINGLE("DACR2HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 2, 1, 1), +}; + +static const struct snd_kcontrol_new alc5632_mono_mixer_controls[] = { +SOC_DAPM_SINGLE("ADC2MONO_L Playback Switch", ALC5632_ADC_REC_GAIN, 14, 1, 1), +SOC_DAPM_SINGLE("ADC2MONO_R Playback Switch", ALC5632_ADC_REC_GAIN, 6, 1, 1), +SOC_DAPM_SINGLE("LI2MONO Playback Switch", ALC5632_LINE_IN_VOL, 13, 1, 1), +SOC_DAPM_SINGLE("MIC12MONO Playback Switch", + ALC5632_MIC_ROUTING_CTRL, 13, 1, 1), +SOC_DAPM_SINGLE("MIC22MONO Playback Switch", + ALC5632_MIC_ROUTING_CTRL, 9, 1, 1), +SOC_DAPM_SINGLE("DAC2MONO Playback Switch", ALC5632_MIC_ROUTING_CTRL, 0, 1, 1), +SOC_DAPM_SINGLE("VOICE2MONO Playback Switch", ALC5632_VOICE_DAC_VOL, 13, 1, 1), +}; + +static const struct snd_kcontrol_new alc5632_speaker_mixer_controls[] = { +SOC_DAPM_SINGLE("LI2SPK Playback Switch", ALC5632_LINE_IN_VOL, 14, 1, 1), +SOC_DAPM_SINGLE("PHONE2SPK Playback Switch", ALC5632_PHONE_IN_VOL, 14, 1, 1), +SOC_DAPM_SINGLE("MIC12SPK Playback Switch", + ALC5632_MIC_ROUTING_CTRL, 14, 1, 1), +SOC_DAPM_SINGLE("MIC22SPK Playback Switch", + ALC5632_MIC_ROUTING_CTRL, 10, 1, 1), +SOC_DAPM_SINGLE("DAC2SPK Playback Switch", ALC5632_MIC_ROUTING_CTRL, 1, 1, 1), +SOC_DAPM_SINGLE("VOICE2SPK Playback Switch", ALC5632_VOICE_DAC_VOL, 14, 1, 1), +}; + +/* Left Record Mixer */ +static const struct snd_kcontrol_new alc5632_captureL_mixer_controls[] = { +SOC_DAPM_SINGLE("Mic1 Capture Switch", ALC5632_ADC_REC_MIXER, 14, 1, 1), +SOC_DAPM_SINGLE("Mic2 Capture Switch", ALC5632_ADC_REC_MIXER, 13, 1, 1), +SOC_DAPM_SINGLE("LineInL Capture Switch", ALC5632_ADC_REC_MIXER, 12, 1, 1), +SOC_DAPM_SINGLE("Left Phone Capture Switch", ALC5632_ADC_REC_MIXER, 11, 1, 1), +SOC_DAPM_SINGLE("HPMixerL Capture Switch", ALC5632_ADC_REC_MIXER, 10, 1, 1), +SOC_DAPM_SINGLE("SPKMixer Capture Switch", ALC5632_ADC_REC_MIXER, 9, 1, 1), +SOC_DAPM_SINGLE("MonoMixer Capture Switch", ALC5632_ADC_REC_MIXER, 8, 1, 1), +}; + +/* Right Record Mixer */ +static const struct snd_kcontrol_new alc5632_captureR_mixer_controls[] = { +SOC_DAPM_SINGLE("Mic1 Capture Switch", ALC5632_ADC_REC_MIXER, 6, 1, 1), +SOC_DAPM_SINGLE("Mic2 Capture Switch", ALC5632_ADC_REC_MIXER, 5, 1, 1), +SOC_DAPM_SINGLE("LineInR Capture Switch", ALC5632_ADC_REC_MIXER, 4, 1, 1), +SOC_DAPM_SINGLE("Right Phone Capture Switch", ALC5632_ADC_REC_MIXER, 3, 1, 1), +SOC_DAPM_SINGLE("HPMixerR Capture Switch", ALC5632_ADC_REC_MIXER, 2, 1, 1), +SOC_DAPM_SINGLE("SPKMixer Capture Switch", ALC5632_ADC_REC_MIXER, 1, 1, 1), +SOC_DAPM_SINGLE("MonoMixer Capture Switch", ALC5632_ADC_REC_MIXER, 0, 1, 1), +}; + +static const char *alc5632_spk_n_sour_sel[] = { + "RN/-R", "RP/+R", "LN/-R", "Mute"}; +static const char *alc5632_hpl_out_input_sel[] = { + "Vmid", "HP Left Mix"}; +static const char *alc5632_hpr_out_input_sel[] = { + "Vmid", "HP Right Mix"}; +static const char *alc5632_spkout_input_sel[] = { + "Vmid", "HPOut Mix", "Speaker Mix", "Mono Mix"}; +static const char *alc5632_aux_out_input_sel[] = { + "Vmid", "HPOut Mix", "Speaker Mix", "Mono Mix"}; + +/* auxout output mux */ +static const struct soc_enum alc5632_aux_out_input_enum = +SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 6, 4, alc5632_aux_out_input_sel); +static const struct snd_kcontrol_new alc5632_auxout_mux_controls = +SOC_DAPM_ENUM("AuxOut Mux", alc5632_aux_out_input_enum); + +/* speaker output mux */ +static const struct soc_enum alc5632_spkout_input_enum = +SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 10, 4, alc5632_spkout_input_sel); +static const struct snd_kcontrol_new alc5632_spkout_mux_controls = +SOC_DAPM_ENUM("SpeakerOut Mux", alc5632_spkout_input_enum); + +/* headphone left output mux */ +static const struct soc_enum alc5632_hpl_out_input_enum = +SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 9, 2, alc5632_hpl_out_input_sel); +static const struct snd_kcontrol_new alc5632_hpl_out_mux_controls = +SOC_DAPM_ENUM("Left Headphone Mux", alc5632_hpl_out_input_enum); + +/* headphone right output mux */ +static const struct soc_enum alc5632_hpr_out_input_enum = +SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 8, 2, alc5632_hpr_out_input_sel); +static const struct snd_kcontrol_new alc5632_hpr_out_mux_controls = +SOC_DAPM_ENUM("Right Headphone Mux", alc5632_hpr_out_input_enum); + +/* speaker output N select */ +static const struct soc_enum alc5632_spk_n_sour_enum = +SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 14, 4, alc5632_spk_n_sour_sel); +static const struct snd_kcontrol_new alc5632_spkoutn_mux_controls = +SOC_DAPM_ENUM("SpeakerOut N Mux", alc5632_spk_n_sour_enum); + +/* speaker amplifier */ +static const char *alc5632_amp_names[] = {"AB Amp", "D Amp"}; +static const struct soc_enum alc5632_amp_enum = + SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 13, 2, alc5632_amp_names); +static const struct snd_kcontrol_new alc5632_amp_mux_controls = + SOC_DAPM_ENUM("AB-D Amp Mux", alc5632_amp_enum); + + +static const struct snd_soc_dapm_widget alc5632_dapm_widgets[] = { +/* Muxes */ +SND_SOC_DAPM_MUX("AuxOut Mux", SND_SOC_NOPM, 0, 0, + &alc5632_auxout_mux_controls), +SND_SOC_DAPM_MUX("SpeakerOut Mux", SND_SOC_NOPM, 0, 0, + &alc5632_spkout_mux_controls), +SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0, + &alc5632_hpl_out_mux_controls), +SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0, + &alc5632_hpr_out_mux_controls), +SND_SOC_DAPM_MUX("SpeakerOut N Mux", SND_SOC_NOPM, 0, 0, + &alc5632_spkoutn_mux_controls), + +/* output mixers */ +SND_SOC_DAPM_MIXER("HP Mix", SND_SOC_NOPM, 0, 0, + &alc5632_hp_mixer_controls[0], + ARRAY_SIZE(alc5632_hp_mixer_controls)), +SND_SOC_DAPM_MIXER("HPR Mix", ALC5632_PWR_MANAG_ADD2, 4, 0, + &alc5632_hpr_mixer_controls[0], + ARRAY_SIZE(alc5632_hpr_mixer_controls)), +SND_SOC_DAPM_MIXER("HPL Mix", ALC5632_PWR_MANAG_ADD2, 5, 0, + &alc5632_hpl_mixer_controls[0], + ARRAY_SIZE(alc5632_hpl_mixer_controls)), +SND_SOC_DAPM_MIXER("HPOut Mix", SND_SOC_NOPM, 0, 0, NULL, 0), +SND_SOC_DAPM_MIXER("Mono Mix", ALC5632_PWR_MANAG_ADD2, 2, 0, + &alc5632_mono_mixer_controls[0], + ARRAY_SIZE(alc5632_mono_mixer_controls)), +SND_SOC_DAPM_MIXER("Speaker Mix", ALC5632_PWR_MANAG_ADD2, 3, 0, + &alc5632_speaker_mixer_controls[0], + ARRAY_SIZE(alc5632_speaker_mixer_controls)), + +/* input mixers */ +SND_SOC_DAPM_MIXER("Left Capture Mix", ALC5632_PWR_MANAG_ADD2, 1, 0, + &alc5632_captureL_mixer_controls[0], + ARRAY_SIZE(alc5632_captureL_mixer_controls)), +SND_SOC_DAPM_MIXER("Right Capture Mix", ALC5632_PWR_MANAG_ADD2, 0, 0, + &alc5632_captureR_mixer_controls[0], + ARRAY_SIZE(alc5632_captureR_mixer_controls)), + +SND_SOC_DAPM_DAC("Left DAC", "HiFi Playback", + ALC5632_PWR_MANAG_ADD2, 9, 0), +SND_SOC_DAPM_DAC("Right DAC", "HiFi Playback", + ALC5632_PWR_MANAG_ADD2, 8, 0), +SND_SOC_DAPM_MIXER("DAC Left Channel", ALC5632_PWR_MANAG_ADD1, 15, 0, NULL, 0), +SND_SOC_DAPM_MIXER("DAC Right Channel", + ALC5632_PWR_MANAG_ADD1, 14, 0, NULL, 0), +SND_SOC_DAPM_MIXER("I2S Mix", ALC5632_PWR_MANAG_ADD1, 11, 0, NULL, 0), +SND_SOC_DAPM_MIXER("Phone Mix", SND_SOC_NOPM, 0, 0, NULL, 0), +SND_SOC_DAPM_MIXER("Line Mix", SND_SOC_NOPM, 0, 0, NULL, 0), +SND_SOC_DAPM_ADC("Left ADC", "HiFi Capture", + ALC5632_PWR_MANAG_ADD2, 7, 0), +SND_SOC_DAPM_ADC("Right ADC", "HiFi Capture", + ALC5632_PWR_MANAG_ADD2, 6, 0), +SND_SOC_DAPM_PGA("Left Headphone", ALC5632_PWR_MANAG_ADD3, 11, 0, NULL, 0), +SND_SOC_DAPM_PGA("Right Headphone", ALC5632_PWR_MANAG_ADD3, 10, 0, NULL, 0), +SND_SOC_DAPM_PGA("Left Speaker", ALC5632_PWR_MANAG_ADD3, 13, 0, NULL, 0), +SND_SOC_DAPM_PGA("Right Speaker", ALC5632_PWR_MANAG_ADD3, 12, 0, NULL, 0), +SND_SOC_DAPM_PGA("Aux Out", ALC5632_PWR_MANAG_ADD3, 14, 0, NULL, 0), +SND_SOC_DAPM_PGA("Left LineIn", ALC5632_PWR_MANAG_ADD3, 7, 0, NULL, 0), +SND_SOC_DAPM_PGA("Right LineIn", ALC5632_PWR_MANAG_ADD3, 6, 0, NULL, 0), +SND_SOC_DAPM_PGA("Phone", ALC5632_PWR_MANAG_ADD3, 5, 0, NULL, 0), +SND_SOC_DAPM_PGA("Phone ADMix", ALC5632_PWR_MANAG_ADD3, 4, 0, NULL, 0), +SND_SOC_DAPM_PGA("MIC1 PGA", ALC5632_PWR_MANAG_ADD3, 3, 0, NULL, 0), +SND_SOC_DAPM_PGA("MIC2 PGA", ALC5632_PWR_MANAG_ADD3, 2, 0, NULL, 0), +SND_SOC_DAPM_PGA("MIC1 Pre Amp", ALC5632_PWR_MANAG_ADD3, 1, 0, NULL, 0), +SND_SOC_DAPM_PGA("MIC2 Pre Amp", ALC5632_PWR_MANAG_ADD3, 0, 0, NULL, 0), +SND_SOC_DAPM_SUPPLY("Mic Bias1", ALC5632_PWR_MANAG_ADD1, 3, 0, NULL, 0), +SND_SOC_DAPM_SUPPLY("Mic Bias2", ALC5632_PWR_MANAG_ADD1, 2, 0, NULL, 0), + +SND_SOC_DAPM_PGA_E("D Amp", ALC5632_PWR_MANAG_ADD2, 14, 0, NULL, 0, + amp_mixer_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), +SND_SOC_DAPM_PGA("AB Amp", ALC5632_PWR_MANAG_ADD2, 15, 0, NULL, 0), +SND_SOC_DAPM_MUX("AB-D Amp Mux", ALC5632_PWR_MANAG_ADD1, 10, 0, + &alc5632_amp_mux_controls), + +SND_SOC_DAPM_OUTPUT("AUXOUT"), +SND_SOC_DAPM_OUTPUT("HPL"), +SND_SOC_DAPM_OUTPUT("HPR"), +SND_SOC_DAPM_OUTPUT("SPKOUT"), +SND_SOC_DAPM_OUTPUT("SPKOUTN"), +SND_SOC_DAPM_INPUT("LINEINL"), +SND_SOC_DAPM_INPUT("LINEINR"), +SND_SOC_DAPM_INPUT("PHONEP"), +SND_SOC_DAPM_INPUT("PHONEN"), +SND_SOC_DAPM_INPUT("MIC1"), +SND_SOC_DAPM_INPUT("MIC2"), +SND_SOC_DAPM_VMID("Vmid"), +}; + + +static const struct snd_soc_dapm_route alc5632_dapm_routes[] = { + /* virtual mixer - mixes left & right channels */ + {"I2S Mix", NULL, "Left DAC"}, + {"I2S Mix", NULL, "Right DAC"}, + {"Line Mix", NULL, "Right LineIn"}, + {"Line Mix", NULL, "Left LineIn"}, + {"Phone Mix", NULL, "Phone"}, + {"Phone Mix", NULL, "Phone ADMix"}, + {"AUXOUT", NULL, "Aux Out"}, + + /* DAC */ + {"DAC Right Channel", NULL, "I2S Mix"}, + {"DAC Left Channel", NULL, "I2S Mix"}, + + /* HP mixer */ + {"HPL Mix", "ADC2HP_L Playback Switch", "Left Capture Mix"}, + {"HPL Mix", NULL, "HP Mix"}, + {"HPR Mix", "ADC2HP_R Playback Switch", "Right Capture Mix"}, + {"HPR Mix", NULL, "HP Mix"}, + {"HP Mix", "LI2HP Playback Switch", "Line Mix"}, + {"HP Mix", "PHONE2HP Playback Switch", "Phone Mix"}, + {"HP Mix", "MIC12HP Playback Switch", "MIC1 PGA"}, + {"HP Mix", "MIC22HP Playback Switch", "MIC2 PGA"}, + + {"HPR Mix", "DACR2HP Playback Switch", "DAC Right Channel"}, + {"HPL Mix", "DACL2HP Playback Switch", "DAC Left Channel"}, + + /* speaker mixer */ + {"Speaker Mix", "LI2SPK Playback Switch", "Line Mix"}, + {"Speaker Mix", "PHONE2SPK Playback Switch", "Phone Mix"}, + {"Speaker Mix", "MIC12SPK Playback Switch", "MIC1 PGA"}, + {"Speaker Mix", "MIC22SPK Playback Switch", "MIC2 PGA"}, + {"Speaker Mix", "DAC2SPK Playback Switch", "DAC Left Channel"}, + + + + /* mono mixer */ + {"Mono Mix", "ADC2MONO_L Playback Switch", "Left Capture Mix"}, + {"Mono Mix", "ADC2MONO_R Playback Switch", "Right Capture Mix"}, + {"Mono Mix", "LI2MONO Playback Switch", "Line Mix"}, + {"Mono Mix", "VOICE2MONO Playback Switch", "Phone Mix"}, + {"Mono Mix", "MIC12MONO Playback Switch", "MIC1 PGA"}, + {"Mono Mix", "MIC22MONO Playback Switch", "MIC2 PGA"}, + {"Mono Mix", "DAC2MONO Playback Switch", "DAC Left Channel"}, + + /* Left record mixer */ + {"Left Capture Mix", "LineInL Capture Switch", "LINEINL"}, + {"Left Capture Mix", "Left Phone Capture Switch", "PHONEN"}, + {"Left Capture Mix", "Mic1 Capture Switch", "MIC1 Pre Amp"}, + {"Left Capture Mix", "Mic2 Capture Switch", "MIC2 Pre Amp"}, + {"Left Capture Mix", "HPMixerL Capture Switch", "HPL Mix"}, + {"Left Capture Mix", "SPKMixer Capture Switch", "Speaker Mix"}, + {"Left Capture Mix", "MonoMixer Capture Switch", "Mono Mix"}, + + /*Right record mixer */ + {"Right Capture Mix", "LineInR Capture Switch", "LINEINR"}, + {"Right Capture Mix", "Right Phone Capture Switch", "PHONEP"}, + {"Right Capture Mix", "Mic1 Capture Switch", "MIC1 Pre Amp"}, + {"Right Capture Mix", "Mic2 Capture Switch", "MIC2 Pre Amp"}, + {"Right Capture Mix", "HPMixerR Capture Switch", "HPR Mix"}, + {"Right Capture Mix", "SPKMixer Capture Switch", "Speaker Mix"}, + {"Right Capture Mix", "MonoMixer Capture Switch", "Mono Mix"}, + + /* headphone left mux */ + {"Left Headphone Mux", "HP Left Mix", "HPL Mix"}, + {"Left Headphone Mux", "Vmid", "Vmid"}, + + /* headphone right mux */ + {"Right Headphone Mux", "HP Right Mix", "HPR Mix"}, + {"Right Headphone Mux", "Vmid", "Vmid"}, + + /* speaker out mux */ + {"SpeakerOut Mux", "Vmid", "Vmid"}, + {"SpeakerOut Mux", "HPOut Mix", "HPOut Mix"}, + {"SpeakerOut Mux", "Speaker Mix", "Speaker Mix"}, + {"SpeakerOut Mux", "Mono Mix", "Mono Mix"}, + + /* Mono/Aux Out mux */ + {"AuxOut Mux", "Vmid", "Vmid"}, + {"AuxOut Mux", "HPOut Mix", "HPOut Mix"}, + {"AuxOut Mux", "Speaker Mix", "Speaker Mix"}, + {"AuxOut Mux", "Mono Mix", "Mono Mix"}, + + /* output pga */ + {"HPL", NULL, "Left Headphone"}, + {"Left Headphone", NULL, "Left Headphone Mux"}, + {"HPR", NULL, "Right Headphone"}, + {"Right Headphone", NULL, "Right Headphone Mux"}, + {"Aux Out", NULL, "AuxOut Mux"}, + + /* input pga */ + {"Left LineIn", NULL, "LINEINL"}, + {"Right LineIn", NULL, "LINEINR"}, + {"Phone", NULL, "PHONEP"}, + {"MIC1 Pre Amp", NULL, "MIC1"}, + {"MIC2 Pre Amp", NULL, "MIC2"}, + {"MIC1 PGA", NULL, "MIC1 Pre Amp"}, + {"MIC2 PGA", NULL, "MIC2 Pre Amp"}, + + /* left ADC */ + {"Left ADC", NULL, "Left Capture Mix"}, + + /* right ADC */ + {"Right ADC", NULL, "Right Capture Mix"}, + + {"SpeakerOut N Mux", "RN/-R", "Left Speaker"}, + {"SpeakerOut N Mux", "RP/+R", "Left Speaker"}, + {"SpeakerOut N Mux", "LN/-R", "Left Speaker"}, + {"SpeakerOut N Mux", "Mute", "Vmid"}, + + {"SpeakerOut N Mux", "RN/-R", "Right Speaker"}, + {"SpeakerOut N Mux", "RP/+R", "Right Speaker"}, + {"SpeakerOut N Mux", "LN/-R", "Right Speaker"}, + {"SpeakerOut N Mux", "Mute", "Vmid"}, + + {"AB Amp", NULL, "SpeakerOut Mux"}, + {"D Amp", NULL, "SpeakerOut Mux"}, + {"AB-D Amp Mux", "AB Amp", "AB Amp"}, + {"AB-D Amp Mux", "D Amp", "D Amp"}, + {"Left Speaker", NULL, "AB-D Amp Mux"}, + {"Right Speaker", NULL, "AB-D Amp Mux"}, + + {"SPKOUT", NULL, "Left Speaker"}, + {"SPKOUT", NULL, "Right Speaker"}, + + {"SPKOUTN", NULL, "SpeakerOut N Mux"}, + +}; + +/* PLL divisors */ +struct _pll_div { + u32 pll_in; + u32 pll_out; + u16 regvalue; +}; + +/* Note : pll code from original alc5632 driver. Not sure of how good it is */ +/* usefull only for master mode */ +static const struct _pll_div codec_master_pll_div[] = { + + { 2048000, 8192000, 0x0ea0}, + { 3686400, 8192000, 0x4e27}, + { 12000000, 8192000, 0x456b}, + { 13000000, 8192000, 0x495f}, + { 13100000, 8192000, 0x0320}, + { 2048000, 11289600, 0xf637}, + { 3686400, 11289600, 0x2f22}, + { 12000000, 11289600, 0x3e2f}, + { 13000000, 11289600, 0x4d5b}, + { 13100000, 11289600, 0x363b}, + { 2048000, 16384000, 0x1ea0}, + { 3686400, 16384000, 0x9e27}, + { 12000000, 16384000, 0x452b}, + { 13000000, 16384000, 0x542f}, + { 13100000, 16384000, 0x03a0}, + { 2048000, 16934400, 0xe625}, + { 3686400, 16934400, 0x9126}, + { 12000000, 16934400, 0x4d2c}, + { 13000000, 16934400, 0x742f}, + { 13100000, 16934400, 0x3c27}, + { 2048000, 22579200, 0x2aa0}, + { 3686400, 22579200, 0x2f20}, + { 12000000, 22579200, 0x7e2f}, + { 13000000, 22579200, 0x742f}, + { 13100000, 22579200, 0x3c27}, + { 2048000, 24576000, 0x2ea0}, + { 3686400, 24576000, 0xee27}, + { 12000000, 24576000, 0x2915}, + { 13000000, 24576000, 0x772e}, + { 13100000, 24576000, 0x0d20}, +}; + +/* FOUT = MCLK*(N+2)/((M+2)*(K+2)) + N: bit 15:8 (div 2 .. div 257) + K: bit 6:4 typical 2 + M: bit 3:0 (div 2 .. div 17) + + same as for 5623 - thanks! +*/ + +static const struct _pll_div codec_slave_pll_div[] = { + + { 1024000, 16384000, 0x3ea0}, + { 1411200, 22579200, 0x3ea0}, + { 1536000, 24576000, 0x3ea0}, + { 2048000, 16384000, 0x1ea0}, + { 2822400, 22579200, 0x1ea0}, + { 3072000, 24576000, 0x1ea0}, + +}; + +static int alc5632_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, + int source, unsigned int freq_in, unsigned int freq_out) +{ + int i; + struct snd_soc_codec *codec = codec_dai->codec; + int gbl_clk = 0, pll_div = 0; + u16 reg; + + if (pll_id < ALC5632_PLL_FR_MCLK || pll_id > ALC5632_PLL_FR_VBCLK) + return -EINVAL; + + /* Disable PLL power */ + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2, + ALC5632_PWR_ADD2_PLL1, + 0); + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2, + ALC5632_PWR_ADD2_PLL2, + 0); + + /* pll is not used in slave mode */ + reg = snd_soc_read(codec, ALC5632_DAI_CONTROL); + if (reg & ALC5632_DAI_SDP_SLAVE_MODE) + return 0; + + if (!freq_in || !freq_out) + return 0; + + switch (pll_id) { + case ALC5632_PLL_FR_MCLK: + for (i = 0; i < ARRAY_SIZE(codec_master_pll_div); i++) { + if (codec_master_pll_div[i].pll_in == freq_in + && codec_master_pll_div[i].pll_out == freq_out) { + /* PLL source from MCLK */ + pll_div = codec_master_pll_div[i].regvalue; + break; + } + } + break; + case ALC5632_PLL_FR_BCLK: + for (i = 0; i < ARRAY_SIZE(codec_slave_pll_div); i++) { + if (codec_slave_pll_div[i].pll_in == freq_in + && codec_slave_pll_div[i].pll_out == freq_out) { + /* PLL source from Bitclk */ + gbl_clk = ALC5632_PLL_FR_BCLK; + pll_div = codec_slave_pll_div[i].regvalue; + break; + } + } + break; + case ALC5632_PLL_FR_VBCLK: + for (i = 0; i < ARRAY_SIZE(codec_slave_pll_div); i++) { + if (codec_slave_pll_div[i].pll_in == freq_in + && codec_slave_pll_div[i].pll_out == freq_out) { + /* PLL source from voice clock */ + gbl_clk = ALC5632_PLL_FR_VBCLK; + pll_div = codec_slave_pll_div[i].regvalue; + break; + } + } + break; + default: + return -EINVAL; + } + + if (!pll_div) + return -EINVAL; + + /* choose MCLK/BCLK/VBCLK */ + snd_soc_write(codec, ALC5632_GPCR2, gbl_clk); + /* choose PLL1 clock rate */ + snd_soc_write(codec, ALC5632_PLL1_CTRL, pll_div); + /* enable PLL1 */ + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2, + ALC5632_PWR_ADD2_PLL1, + ALC5632_PWR_ADD2_PLL1); + /* enable PLL2 */ + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2, + ALC5632_PWR_ADD2_PLL2, + ALC5632_PWR_ADD2_PLL2); + /* use PLL1 as main SYSCLK */ + snd_soc_update_bits(codec, ALC5632_GPCR1, + ALC5632_GPCR1_CLK_SYS_SRC_SEL_PLL1, + ALC5632_GPCR1_CLK_SYS_SRC_SEL_PLL1); + + return 0; +} + +struct _coeff_div { + u16 fs; + u16 regvalue; +}; + +/* codec hifi mclk (after PLL) clock divider coefficients */ +/* values inspired from column BCLK=32Fs of Appendix A table */ +static const struct _coeff_div coeff_div[] = { + {512*1, 0x3075}, +}; + +static int get_coeff(struct snd_soc_codec *codec, int rate) +{ + struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec); + int i; + + for (i = 0; i < ARRAY_SIZE(coeff_div); i++) { + if (coeff_div[i].fs * rate == alc5632->sysclk) + return i; + } + return -EINVAL; +} + +/* + * Clock after PLL and dividers + */ +static int alc5632_set_dai_sysclk(struct snd_soc_dai *codec_dai, + int clk_id, unsigned int freq, int dir) +{ + struct snd_soc_codec *codec = codec_dai->codec; + struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec); + + switch (freq) { + case 8192000: + case 11289600: + case 12288000: + case 16384000: + case 16934400: + case 18432000: + case 22579200: + case 24576000: + alc5632->sysclk = freq; + return 0; + } + return -EINVAL; +} + +static int alc5632_set_dai_fmt(struct snd_soc_dai *codec_dai, + unsigned int fmt) +{ + struct snd_soc_codec *codec = codec_dai->codec; + u16 iface = 0; + + /* set master/slave audio interface */ + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { + case SND_SOC_DAIFMT_CBM_CFM: + iface = ALC5632_DAI_SDP_MASTER_MODE; + break; + case SND_SOC_DAIFMT_CBS_CFS: + iface = ALC5632_DAI_SDP_SLAVE_MODE; + break; + default: + return -EINVAL; + } + + /* interface format */ + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { + case SND_SOC_DAIFMT_I2S: + iface |= ALC5632_DAI_I2S_DF_I2S; + break; + case SND_SOC_DAIFMT_LEFT_J: + iface |= ALC5632_DAI_I2S_DF_LEFT; + break; + case SND_SOC_DAIFMT_DSP_A: + iface |= ALC5632_DAI_I2S_DF_PCM_A; + break; + case SND_SOC_DAIFMT_DSP_B: + iface |= ALC5632_DAI_I2S_DF_PCM_B; + break; + default: + return -EINVAL; + } + + /* clock inversion */ + switch (fmt & SND_SOC_DAIFMT_INV_MASK) { + case SND_SOC_DAIFMT_NB_NF: + break; + case SND_SOC_DAIFMT_IB_IF: + iface |= ALC5632_DAI_MAIN_I2S_BCLK_POL_CTRL; + break; + case SND_SOC_DAIFMT_IB_NF: + iface |= ALC5632_DAI_MAIN_I2S_BCLK_POL_CTRL; + break; + case SND_SOC_DAIFMT_NB_IF: + break; + default: + return -EINVAL; + } + + return snd_soc_write(codec, ALC5632_DAI_CONTROL, iface); +} + +static int alc5632_pcm_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_codec *codec = rtd->codec; + int coeff, rate; + u16 iface; + + iface = snd_soc_read(codec, ALC5632_DAI_CONTROL); + iface &= ~ALC5632_DAI_I2S_DL_MASK; + + /* bit size */ + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: + iface |= ALC5632_DAI_I2S_DL_16; + break; + case SNDRV_PCM_FORMAT_S20_3LE: + iface |= ALC5632_DAI_I2S_DL_20; + break; + case SNDRV_PCM_FORMAT_S24_LE: + iface |= ALC5632_DAI_I2S_DL_24; + break; + default: + return -EINVAL; + } + + /* set iface & srate */ + snd_soc_write(codec, ALC5632_DAI_CONTROL, iface); + rate = params_rate(params); + coeff = get_coeff(codec, rate); + if (coeff < 0) + return -EINVAL; + + coeff = coeff_div[coeff].regvalue; + snd_soc_write(codec, ALC5632_DAC_CLK_CTRL1, coeff); + + return 0; +} + +static int alc5632_mute(struct snd_soc_dai *dai, int mute) +{ + struct snd_soc_codec *codec = dai->codec; + u16 hp_mute = ALC5632_MISC_HP_DEPOP_MUTE_L \ + |ALC5632_MISC_HP_DEPOP_MUTE_R; + u16 mute_reg = snd_soc_read(codec, ALC5632_MISC_CTRL) & ~hp_mute; + + if (mute) + mute_reg |= hp_mute; + + return snd_soc_write(codec, ALC5632_MISC_CTRL, mute_reg); +} + +#define ALC5632_ADD2_POWER_EN (ALC5632_PWR_ADD2_VREF) + +#define ALC5632_ADD3_POWER_EN (ALC5632_PWR_ADD3_MIC1_BOOST_AD) + +#define ALC5632_ADD1_POWER_EN \ + (ALC5632_PWR_ADD1_DAC_REF \ + | ALC5632_PWR_ADD1_SOFTGEN_EN \ + | ALC5632_PWR_ADD1_HP_OUT_AMP \ + | ALC5632_PWR_ADD1_HP_OUT_ENH_AMP \ + | ALC5632_PWR_ADD1_MAIN_BIAS) + +static void enable_power_depop(struct snd_soc_codec *codec) +{ + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1, + ALC5632_PWR_ADD1_SOFTGEN_EN, + ALC5632_PWR_ADD1_SOFTGEN_EN); + + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD3, + ALC5632_ADD3_POWER_EN, + ALC5632_ADD3_POWER_EN); + + snd_soc_update_bits(codec, ALC5632_MISC_CTRL, + ALC5632_MISC_HP_DEPOP_MODE2_EN, + ALC5632_MISC_HP_DEPOP_MODE2_EN); + + /* "normal" mode: 0 @ 26 */ + /* set all PR0-7 mixers to 0 */ + snd_soc_update_bits(codec, ALC5632_PWR_DOWN_CTRL_STATUS, + ALC5632_PWR_DOWN_CTRL_STATUS_MASK, + 0); + + msleep(500); + + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2, + ALC5632_ADD2_POWER_EN, + ALC5632_ADD2_POWER_EN); + + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1, + ALC5632_ADD1_POWER_EN, + ALC5632_ADD1_POWER_EN); + + /* disable HP Depop2 */ + snd_soc_update_bits(codec, ALC5632_MISC_CTRL, + ALC5632_MISC_HP_DEPOP_MODE2_EN, + 0); + +} + +static int alc5632_set_bias_level(struct snd_soc_codec *codec, + enum snd_soc_bias_level level) +{ + switch (level) { + case SND_SOC_BIAS_ON: + enable_power_depop(codec); + break; + case SND_SOC_BIAS_PREPARE: + break; + case SND_SOC_BIAS_STANDBY: + /* everything off except vref/vmid, */ + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1, + ALC5632_PWR_MANAG_ADD1_MASK, + ALC5632_PWR_ADD1_MAIN_BIAS); + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2, + ALC5632_PWR_MANAG_ADD2_MASK, + ALC5632_PWR_ADD2_VREF); + /* "normal" mode: 0 @ 26 */ + snd_soc_update_bits(codec, ALC5632_PWR_DOWN_CTRL_STATUS, + ALC5632_PWR_DOWN_CTRL_STATUS_MASK, + 0xffff ^ (ALC5632_PWR_VREF_PR3 + | ALC5632_PWR_VREF_PR2)); + break; + case SND_SOC_BIAS_OFF: + /* everything off, dac mute, inactive */ + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2, + ALC5632_PWR_MANAG_ADD2_MASK, 0); + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD3, + ALC5632_PWR_MANAG_ADD3_MASK, 0); + snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1, + ALC5632_PWR_MANAG_ADD1_MASK, 0); + break; + } + codec->dapm.bias_level = level; + return 0; +} + +#define ALC5632_FORMATS (SNDRV_PCM_FMTBIT_S16_LE \ + | SNDRV_PCM_FMTBIT_S24_LE \ + | SNDRV_PCM_FMTBIT_S32_LE) + +static struct snd_soc_dai_ops alc5632_dai_ops = { + .hw_params = alc5632_pcm_hw_params, + .digital_mute = alc5632_mute, + .set_fmt = alc5632_set_dai_fmt, + .set_sysclk = alc5632_set_dai_sysclk, + .set_pll = alc5632_set_dai_pll, +}; + +static struct snd_soc_dai_driver alc5632_dai = { + .name = "alc5632-hifi", + .playback = { + .stream_name = "HiFi Playback", + .channels_min = 1, + .channels_max = 2, + .rate_min = 8000, + .rate_max = 48000, + .rates = SNDRV_PCM_RATE_8000_48000, + .formats = ALC5632_FORMATS,}, + .capture = { + .stream_name = "HiFi Capture", + .channels_min = 1, + .channels_max = 2, + .rate_min = 8000, + .rate_max = 48000, + .rates = SNDRV_PCM_RATE_8000_48000, + .formats = ALC5632_FORMATS,}, + + .ops = &alc5632_dai_ops, + .symmetric_rates = 1, +}; + +static int alc5632_suspend(struct snd_soc_codec *codec, pm_message_t mesg) +{ + alc5632_set_bias_level(codec, SND_SOC_BIAS_OFF); + return 0; +} + +static int alc5632_resume(struct snd_soc_codec *codec) +{ + int ret; + + /* mark cache as needed to sync */ + codec->cache_sync = 1; + + ret = snd_soc_cache_sync(codec); + if (ret != 0) { + dev_err(codec->dev, "Failed to sync cache: %d\n", ret); + return ret; + } + + alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY); + return 0; +} + +#define ALC5632_REC_UNMUTE (ALC5632_ADC_REC_MIC2 \ + | ALC5632_ADC_REC_LINE_IN | ALC5632_ADC_REC_AUX \ + | ALC5632_ADC_REC_HP | ALC5632_ADC_REC_SPK \ + | ALC5632_ADC_REC_MONOMIX) + +#define ALC5632_MIC_ROUTE (ALC5632_MIC_ROUTE_HP \ + | ALC5632_MIC_ROUTE_SPK \ + | ALC5632_MIC_ROUTE_MONOMIX) + +#define ALC5632_PWR_DEFAULT (ALC5632_PWR_ADC_STATUS \ + | ALC5632_PWR_DAC_STATUS \ + | ALC5632_PWR_AMIX_STATUS \ + | ALC5632_PWR_VREF_STATUS) + +#define ALC5632_ADC_REC_GAIN_COMP(x) (int)((x - ALC5632_ADC_REC_GAIN_BASE) \ + / ALC5632_ADC_REC_GAIN_STEP) + +#define ALC5632_MIC_BOOST_COMP(x) (int)(x / ALC5632_MIC_BOOST_STEP) + +#define ALC5632_SPK_OUT_VOL_COMP(x) (int)(x / ALC5632_SPK_OUT_VOL_STEP) + +static int alc5632_probe(struct snd_soc_codec *codec) +{ + struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec); + int ret; + + ret = snd_soc_codec_set_cache_io(codec, 8, 16, alc5632->control_type); + if (ret < 0) { + dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); + return ret; + } + + alc5632_reset(codec); + + /* power on device */ + alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY); + + switch (alc5632->id) { + case 0x5c: + snd_soc_add_controls(codec, alc5632_vol_snd_controls, + ARRAY_SIZE(alc5632_vol_snd_controls)); + break; + default: + return -EINVAL; + } + + return ret; +} + +/* power down chip */ +static int alc5632_remove(struct snd_soc_codec *codec) +{ + alc5632_set_bias_level(codec, SND_SOC_BIAS_OFF); + return 0; +} + +static struct snd_soc_codec_driver soc_codec_device_alc5632 = { + .probe = alc5632_probe, + .remove = alc5632_remove, + .suspend = alc5632_suspend, + .resume = alc5632_resume, + .set_bias_level = alc5632_set_bias_level, + .reg_word_size = sizeof(u16), + .reg_cache_step = 2, + .reg_cache_default = alc5632_reg_defaults, + .reg_cache_size = ARRAY_SIZE(alc5632_reg_defaults), + .volatile_register = alc5632_volatile_register, + .controls = alc5632_snd_controls, + .num_controls = ARRAY_SIZE(alc5632_snd_controls), + .dapm_widgets = alc5632_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(alc5632_dapm_widgets), + .dapm_routes = alc5632_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(alc5632_dapm_routes), +}; + +/* + * alc5632 2 wire address is determined by A1 pin + * state during powerup. + * low = 0x1a + * high = 0x1b + */ +static int alc5632_i2c_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct alc5632_priv *alc5632; + int ret, vid1, vid2; + + vid1 = i2c_smbus_read_word_data(client, ALC5632_VENDOR_ID1); + if (vid1 < 0) { + dev_err(&client->dev, "failed to read I2C\n"); + return -EIO; + } else { + dev_info(&client->dev, "got vid1: %x\n", vid1); + } + vid1 = ((vid1 & 0xff) << 8) | (vid1 >> 8); + + vid2 = i2c_smbus_read_word_data(client, ALC5632_VENDOR_ID2); + if (vid2 < 0) { + dev_err(&client->dev, "failed to read I2C\n"); + return -EIO; + } else { + dev_info(&client->dev, "got vid2: %x\n", vid2); + } + vid2 = (vid2 & 0xff); + + if ((vid1 != 0x10ec) || (vid2 != id->driver_data)) { + dev_err(&client->dev, "unknown or wrong codec\n"); + dev_err(&client->dev, "Expected %x:%lx, got %x:%x\n", + 0x10ec, id->driver_data, + vid1, vid2); + return -ENODEV; + } + + alc5632 = devm_kzalloc(&client->dev, + sizeof(struct alc5632_priv), GFP_KERNEL); + if (alc5632 == NULL) + return -ENOMEM; + + alc5632->id = vid2; + switch (alc5632->id) { + case 0x5c: + alc5632_dai.name = "alc5632-hifi"; + break; + default: + return -EINVAL; + } + + i2c_set_clientdata(client, alc5632); + alc5632->control_data = client; + alc5632->control_type = SND_SOC_I2C; + mutex_init(&alc5632->mutex); + + ret = snd_soc_register_codec(&client->dev, + &soc_codec_device_alc5632, &alc5632_dai, 1); + if (ret != 0) + dev_err(&client->dev, "Failed to register codec: %d\n", ret); + + return ret; +} + +static int alc5632_i2c_remove(struct i2c_client *client) +{ + snd_soc_unregister_codec(&client->dev); + + return 0; +} + +static const struct i2c_device_id alc5632_i2c_table[] = { + {"alc5632", 0x5c}, + {} +}; +MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table); + +/* i2c codec control layer */ +static struct i2c_driver alc5632_i2c_driver = { + .driver = { + .name = "alc5632", + .owner = THIS_MODULE, + }, + .probe = alc5632_i2c_probe, + .remove = __devexit_p(alc5632_i2c_remove), + .id_table = alc5632_i2c_table, +}; + +static int __init alc5632_modinit(void) +{ + int ret; + + ret = i2c_add_driver(&alc5632_i2c_driver); + if (ret != 0) { + printk(KERN_ERR "%s: can't add i2c driver", __func__); + return ret; + } + + return ret; +} +module_init(alc5632_modinit); + +static void __exit alc5632_modexit(void) +{ + i2c_del_driver(&alc5632_i2c_driver); +} +module_exit(alc5632_modexit); + +MODULE_DESCRIPTION("ASoC ALC5632 driver"); +MODULE_AUTHOR("Leon Romanovsky "); +MODULE_LICENSE("GPL"); diff --git a/sound/soc/codecs/alc5632.h b/sound/soc/codecs/alc5632.h new file mode 100644 index 0000000..ff4c0fd --- /dev/null +++ b/sound/soc/codecs/alc5632.h @@ -0,0 +1,249 @@ +/* +* alc5632.h -- ALC5632 ALSA SoC Audio Codec +* +* Copyright (C) 2011 The AC100 Kernel Team +* +* Authors: Leon Romanovsky +* Andrey Danin +* Ilya Petrov +* Marc Dietrich +* +* Based on alc5623.h by Arnaud Patard +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef _ALC5632_H +#define _ALC5632_H + +#define ALC5632_RESET 0x00 +/* speaker output vol 2 2 */ +/* line output vol 4 2 */ +/* HP output vol 4 0 4 */ +#define ALC5632_SPK_OUT_VOL 0x02 /* spe out vol */ +#define ALC5632_SPK_OUT_VOL_STEP 1.5 +#define ALC5632_HP_OUT_VOL 0x04 /* hp out vol */ +#define ALC5632_AUX_OUT_VOL 0x06 /* aux out vol */ +#define ALC5632_PHONE_IN_VOL 0x08 /* phone in vol */ +#define ALC5632_LINE_IN_VOL 0x0A /* line in vol */ +#define ALC5632_STEREO_DAC_IN_VOL 0x0C /* stereo dac in vol */ +#define ALC5632_MIC_VOL 0x0E /* mic in vol */ +/* stero dac/mic routing */ +#define ALC5632_MIC_ROUTING_CTRL 0x10 +#define ALC5632_MIC_ROUTE_MONOMIX (1 << 0) +#define ALC5632_MIC_ROUTE_SPK (1 << 1) +#define ALC5632_MIC_ROUTE_HP (1 << 2) + +#define ALC5632_ADC_REC_GAIN 0x12 /* rec gain */ +#define ALC5632_ADC_REC_GAIN_RANGE 0x1F1F +#define ALC5632_ADC_REC_GAIN_BASE (-16.5) +#define ALC5632_ADC_REC_GAIN_STEP 1.5 + +#define ALC5632_ADC_REC_MIXER 0x14 /* mixer control */ +#define ALC5632_ADC_REC_MIC1 (1 << 6) +#define ALC5632_ADC_REC_MIC2 (1 << 5) +#define ALC5632_ADC_REC_LINE_IN (1 << 4) +#define ALC5632_ADC_REC_AUX (1 << 3) +#define ALC5632_ADC_REC_HP (1 << 2) +#define ALC5632_ADC_REC_SPK (1 << 1) +#define ALC5632_ADC_REC_MONOMIX (1 << 0) + +#define ALC5632_VOICE_DAC_VOL 0x18 /* voice dac vol */ +/* ALC5632_OUTPUT_MIXER_CTRL : */ +/* same remark as for reg 2 line vs speaker */ +#define ALC5632_OUTPUT_MIXER_CTRL 0x1C /* out mix ctrl */ +#define ALC5632_OUTPUT_MIXER_RP (1 << 14) +#define ALC5632_OUTPUT_MIXER_WEEK (1 << 12) +#define ALC5632_OUTPUT_MIXER_HP (1 << 10) +#define ALC5632_OUTPUT_MIXER_AUX_SPK (2 << 6) +#define ALC5632_OUTPUT_MIXER_AUX_HP_LR (1 << 6) +#define ALC5632_OUTPUT_MIXER_HP_R (1 << 8) +#define ALC5632_OUTPUT_MIXER_HP_L (1 << 9) + +#define ALC5632_MIC_CTRL 0x22 /* mic phone ctrl */ +#define ALC5632_MIC_BOOST_BYPASS 0 +#define ALC5632_MIC_BOOST_20DB 1 +#define ALC5632_MIC_BOOST_30DB 2 +#define ALC5632_MIC_BOOST_40DB 3 + +#define ALC5632_DIGI_BOOST_CTRL 0x24 /* digi mic / bost ctl */ +#define ALC5632_MIC_BOOST_RANGE 7 +#define ALC5632_MIC_BOOST_STEP 6 +#define ALC5632_PWR_DOWN_CTRL_STATUS 0x26 +#define ALC5632_PWR_DOWN_CTRL_STATUS_MASK 0xEF00 +#define ALC5632_PWR_VREF_PR3 (1 << 11) +#define ALC5632_PWR_VREF_PR2 (1 << 10) +#define ALC5632_PWR_VREF_STATUS (1 << 3) +#define ALC5632_PWR_AMIX_STATUS (1 << 2) +#define ALC5632_PWR_DAC_STATUS (1 << 1) +#define ALC5632_PWR_ADC_STATUS (1 << 0) +/* stereo/voice DAC / stereo adc func ctrl */ +#define ALC5632_DAC_FUNC_SELECT 0x2E + +/* Main serial data port ctrl (i2s) */ +#define ALC5632_DAI_CONTROL 0x34 + +#define ALC5632_DAI_SDP_MASTER_MODE (0 << 15) +#define ALC5632_DAI_SDP_SLAVE_MODE (1 << 15) +#define ALC5632_DAI_SADLRCK_MODE (1 << 14) +/* 0:voice, 1:main */ +#define ALC5632_DAI_MAIN_I2S_SYSCLK_SEL (1 << 8) +#define ALC5632_DAI_MAIN_I2S_BCLK_POL_CTRL (1 << 7) +/* 0:normal, 1:invert */ +#define ALC5632_DAI_MAIN_I2S_LRCK_INV (1 << 6) +#define ALC5632_DAI_I2S_DL_MASK (3 << 2) +#define ALC5632_DAI_I2S_DL_8 (3 << 2) +#define ALC5632_DAI_I2S_DL_24 (2 << 2) +#define ALC5632_DAI_I2S_DL_20 (1 << 2) +#define ALC5632_DAI_I2S_DL_16 (0 << 2) +#define ALC5632_DAI_I2S_DF_MASK (3 << 0) +#define ALC5632_DAI_I2S_DF_PCM_B (3 << 0) +#define ALC5632_DAI_I2S_DF_PCM_A (2 << 0) +#define ALC5632_DAI_I2S_DF_LEFT (1 << 0) +#define ALC5632_DAI_I2S_DF_I2S (0 << 0) +/* extend serial data port control (VoDAC_i2c/pcm) */ +#define ALC5632_DAI_CONTROL2 0x36 +/* 0:gpio func, 1:voice pcm */ +#define ALC5632_DAI_VOICE_PCM_ENABLE (1 << 15) +/* 0:master, 1:slave */ +#define ALC5632_DAI_VOICE_MODE_SEL (1 << 14) +/* 0:disable, 1:enable */ +#define ALC5632_DAI_HPF_CLK_CTRL (1 << 13) +/* 0:main, 1:voice */ +#define ALC5632_DAI_VOICE_I2S_SYSCLK_SEL (1 << 8) +/* 0:normal, 1:invert */ +#define ALC5632_DAI_VOICE_VBCLK_SYSCLK_SEL (1 << 7) +/* 0:normal, 1:invert */ +#define ALC5632_DAI_VOICE_I2S_LR_INV (1 << 6) +#define ALC5632_DAI_VOICE_DL_MASK (3 << 2) +#define ALC5632_DAI_VOICE_DL_16 (0 << 2) +#define ALC5632_DAI_VOICE_DL_20 (1 << 2) +#define ALC5632_DAI_VOICE_DL_24 (2 << 2) +#define ALC5632_DAI_VOICE_DL_8 (3 << 2) +#define ALC5632_DAI_VOICE_DF_MASK (3 << 0) +#define ALC5632_DAI_VOICE_DF_I2S (0 << 0) +#define ALC5632_DAI_VOICE_DF_LEFT (1 << 0) +#define ALC5632_DAI_VOICE_DF_PCM_A (2 << 0) +#define ALC5632_DAI_VOICE_DF_PCM_B (3 << 0) + +#define ALC5632_PWR_MANAG_ADD1 0x3A +#define ALC5632_PWR_MANAG_ADD1_MASK 0xEFFF +#define ALC5632_PWR_ADD1_DAC_L_EN (1 << 15) +#define ALC5632_PWR_ADD1_DAC_R_EN (1 << 14) +#define ALC5632_PWR_ADD1_ZERO_CROSS (1 << 13) +#define ALC5632_PWR_ADD1_MAIN_I2S_EN (1 << 11) +#define ALC5632_PWR_ADD1_SPK_AMP_EN (1 << 10) +#define ALC5632_PWR_ADD1_HP_OUT_AMP (1 << 9) +#define ALC5632_PWR_ADD1_HP_OUT_ENH_AMP (1 << 8) +#define ALC5632_PWR_ADD1_VOICE_DAC_MIX (1 << 7) +#define ALC5632_PWR_ADD1_SOFTGEN_EN (1 << 6) +#define ALC5632_PWR_ADD1_MIC1_SHORT_CURR (1 << 5) +#define ALC5632_PWR_ADD1_MIC2_SHORT_CURR (1 << 4) +#define ALC5632_PWR_ADD1_MIC1_EN (1 << 3) +#define ALC5632_PWR_ADD1_MIC2_EN (1 << 2) +#define ALC5632_PWR_ADD1_MAIN_BIAS (1 << 1) +#define ALC5632_PWR_ADD1_DAC_REF (1 << 0) + +#define ALC5632_PWR_MANAG_ADD2 0x3C +#define ALC5632_PWR_MANAG_ADD2_MASK 0x7FFF +#define ALC5632_PWR_ADD2_PLL1 (1 << 15) +#define ALC5632_PWR_ADD2_PLL2 (1 << 14) +#define ALC5632_PWR_ADD2_VREF (1 << 13) +#define ALC5632_PWR_ADD2_OVT_DET (1 << 12) +#define ALC5632_PWR_ADD2_VOICE_DAC (1 << 10) +#define ALC5632_PWR_ADD2_L_DAC_CLK (1 << 9) +#define ALC5632_PWR_ADD2_R_DAC_CLK (1 << 8) +#define ALC5632_PWR_ADD2_L_ADC_CLK_GAIN (1 << 7) +#define ALC5632_PWR_ADD2_R_ADC_CLK_GAIN (1 << 6) +#define ALC5632_PWR_ADD2_L_HP_MIXER (1 << 5) +#define ALC5632_PWR_ADD2_R_HP_MIXER (1 << 4) +#define ALC5632_PWR_ADD2_SPK_MIXER (1 << 3) +#define ALC5632_PWR_ADD2_MONO_MIXER (1 << 2) +#define ALC5632_PWR_ADD2_L_ADC_REC_MIXER (1 << 1) +#define ALC5632_PWR_ADD2_R_ADC_REC_MIXER (1 << 0) + +#define ALC5632_PWR_MANAG_ADD3 0x3E +#define ALC5632_PWR_MANAG_ADD3_MASK 0x7CFF +#define ALC5632_PWR_ADD3_AUXOUT_VOL (1 << 14) +#define ALC5632_PWR_ADD3_SPK_L_OUT (1 << 13) +#define ALC5632_PWR_ADD3_SPK_R_OUT (1 << 12) +#define ALC5632_PWR_ADD3_HP_L_OUT_VOL (1 << 11) +#define ALC5632_PWR_ADD3_HP_R_OUT_VOL (1 << 10) +#define ALC5632_PWR_ADD3_LINEIN_L_VOL (1 << 7) +#define ALC5632_PWR_ADD3_LINEIN_R_VOL (1 << 6) +#define ALC5632_PWR_ADD3_AUXIN_VOL (1 << 5) +#define ALC5632_PWR_ADD3_AUXIN_MIX (1 << 4) +#define ALC5632_PWR_ADD3_MIC1_VOL (1 << 3) +#define ALC5632_PWR_ADD3_MIC2_VOL (1 << 2) +#define ALC5632_PWR_ADD3_MIC1_BOOST_AD (1 << 1) +#define ALC5632_PWR_ADD3_MIC2_BOOST_AD (1 << 0) + +#define ALC5632_GPCR1 0x40 +#define ALC5632_GPCR1_CLK_SYS_SRC_SEL_PLL1 (1 << 15) +#define ALC5632_GPCR1_CLK_SYS_SRC_SEL_MCLK (0 << 15) +#define ALC5632_GPCR1_DAC_HI_FLT_EN (1 << 10) +#define ALC5632_GPCR1_SPK_AMP_CTRL (7 << 1) +#define ALC5632_GPCR1_VDD_100 (5 << 1) +#define ALC5632_GPCR1_VDD_125 (4 << 1) +#define ALC5632_GPCR1_VDD_150 (3 << 1) +#define ALC5632_GPCR1_VDD_175 (2 << 1) +#define ALC5632_GPCR1_VDD_200 (1 << 1) +#define ALC5632_GPCR1_VDD_225 (0 << 1) + +#define ALC5632_GPCR2 0x42 +#define ALC5632_GPCR2_PLL1_SOUR_SEL (3 << 12) +#define ALC5632_PLL_FR_MCLK (0 << 12) +#define ALC5632_PLL_FR_BCLK (2 << 12) +#define ALC5632_PLL_FR_VBCLK (3 << 12) +#define ALC5632_GPCR2_CLK_PLL_PRE_DIV1 (0 << 0) + +#define ALC5632_PLL1_CTRL 0x44 +#define ALC5632_PLL1_CTRL_N_VAL(n) (((n) & 0x0f) << 8) +#define ALC5632_PLL1_M_BYPASS (1 << 7) +#define ALC5632_PLL1_CTRL_K_VAL(k) (((k) & 0x07) << 4) +#define ALC5632_PLL1_CTRL_M_VAL(m) (((m) & 0x0f) << 0) + +#define ALC5632_PLL2_CTRL 0x46 +#define ALC5632_PLL2_EN (1 << 15) +#define ALC5632_PLL2_RATIO (0 << 15) + +#define ALC5632_GPIO_PIN_CONFIG 0x4C +#define ALC5632_GPIO_PIN_POLARITY 0x4E +#define ALC5632_GPIO_PIN_STICKY 0x50 +#define ALC5632_GPIO_PIN_WAKEUP 0x52 +#define ALC5632_GPIO_PIN_STATUS 0x54 +#define ALC5632_GPIO_PIN_SHARING 0x56 +#define ALC5632_OVER_CURR_STATUS 0x58 +#define ALC5632_SOFTVOL_CTRL 0x5A +#define ALC5632_GPIO_OUPUT_PIN_CTRL 0x5C + +#define ALC5632_MISC_CTRL 0x5E +#define ALC5632_MISC_DISABLE_FAST_VREG (1 << 15) +#define ALC5632_MISC_AVC_TRGT_SEL (3 << 12) +#define ALC5632_MISC_AVC_TRGT_RIGHT (1 << 12) +#define ALC5632_MISC_AVC_TRGT_LEFT (2 << 12) +#define ALC5632_MISC_AVC_TRGT_BOTH (3 << 12) +#define ALC5632_MISC_HP_DEPOP_MODE1_EN (1 << 9) +#define ALC5632_MISC_HP_DEPOP_MODE2_EN (1 << 8) +#define ALC5632_MISC_HP_DEPOP_MUTE_L (1 << 7) +#define ALC5632_MISC_HP_DEPOP_MUTE_R (1 << 6) +#define ALC5632_MISC_HP_DEPOP_MUTE (1 << 5) +#define ALC5632_MISC_GPIO_WAKEUP_CTRL (1 << 1) +#define ALC5632_MISC_IRQOUT_INV_CTRL (1 << 0) + +#define ALC5632_DAC_CLK_CTRL1 0x60 +#define ALC5632_DAC_CLK_CTRL2 0x62 +#define ALC5632_DAC_CLK_CTRL2_DIV1_2 (1 << 0) +#define ALC5632_VOICE_DAC_PCM_CLK_CTRL1 0x64 +#define ALC5632_PSEUDO_SPATIAL_CTRL 0x68 +#define ALC5632_HID_CTRL_INDEX 0x6A +#define ALC5632_HID_CTRL_DATA 0x6C +#define ALC5632_EQ_CTRL 0x6E + +/* undocumented */ +#define ALC5632_VENDOR_ID1 0x7C +#define ALC5632_VENDOR_ID2 0x7E + +#endif -- cgit v1.1 From c9016a7937122b72d87ff2037664b7bd717d3e4b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 10 Nov 2011 13:06:52 +0000 Subject: ASoC: Remove LZO cache type There are no current users and new drivers ought to be using the regmap API and its cache implementation directly so just delete the ASoC copy. Signed-off-by: Mark Brown --- sound/soc/Kconfig | 15 -- sound/soc/soc-cache.c | 384 -------------------------------------------------- 2 files changed, 399 deletions(-) (limited to 'sound') diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index 1381db8..35e662d 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig @@ -22,21 +22,6 @@ menuconfig SND_SOC if SND_SOC -config SND_SOC_CACHE_LZO - bool "Support LZO compression for register caches" - select LZO_COMPRESS - select LZO_DECOMPRESS - ---help--- - Select this to enable LZO compression for register caches. - This will allow machine or CODEC drivers to compress register - caches in memory, reducing the memory consumption at the - expense of performance. If this is not present and is used - the system will fall back to uncompressed caches. - - Usually it is safe to disable this option, where cache - compression in used the rbtree option will typically perform - better. - config SND_SOC_AC97_BUS bool diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 9077aa4..18bb6b3 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -439,378 +438,6 @@ err: return ret; } -#ifdef CONFIG_SND_SOC_CACHE_LZO -struct snd_soc_lzo_ctx { - void *wmem; - void *dst; - const void *src; - size_t src_len; - size_t dst_len; - size_t decompressed_size; - unsigned long *sync_bmp; - int sync_bmp_nbits; -}; - -#define LZO_BLOCK_NUM 8 -static int snd_soc_lzo_block_count(void) -{ - return LZO_BLOCK_NUM; -} - -static int snd_soc_lzo_prepare(struct snd_soc_lzo_ctx *lzo_ctx) -{ - lzo_ctx->wmem = kmalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL); - if (!lzo_ctx->wmem) - return -ENOMEM; - return 0; -} - -static int snd_soc_lzo_compress(struct snd_soc_lzo_ctx *lzo_ctx) -{ - size_t compress_size; - int ret; - - ret = lzo1x_1_compress(lzo_ctx->src, lzo_ctx->src_len, - lzo_ctx->dst, &compress_size, lzo_ctx->wmem); - if (ret != LZO_E_OK || compress_size > lzo_ctx->dst_len) - return -EINVAL; - lzo_ctx->dst_len = compress_size; - return 0; -} - -static int snd_soc_lzo_decompress(struct snd_soc_lzo_ctx *lzo_ctx) -{ - size_t dst_len; - int ret; - - dst_len = lzo_ctx->dst_len; - ret = lzo1x_decompress_safe(lzo_ctx->src, lzo_ctx->src_len, - lzo_ctx->dst, &dst_len); - if (ret != LZO_E_OK || dst_len != lzo_ctx->dst_len) - return -EINVAL; - return 0; -} - -static int snd_soc_lzo_compress_cache_block(struct snd_soc_codec *codec, - struct snd_soc_lzo_ctx *lzo_ctx) -{ - int ret; - - lzo_ctx->dst_len = lzo1x_worst_compress(PAGE_SIZE); - lzo_ctx->dst = kmalloc(lzo_ctx->dst_len, GFP_KERNEL); - if (!lzo_ctx->dst) { - lzo_ctx->dst_len = 0; - return -ENOMEM; - } - - ret = snd_soc_lzo_compress(lzo_ctx); - if (ret < 0) - return ret; - return 0; -} - -static int snd_soc_lzo_decompress_cache_block(struct snd_soc_codec *codec, - struct snd_soc_lzo_ctx *lzo_ctx) -{ - int ret; - - lzo_ctx->dst_len = lzo_ctx->decompressed_size; - lzo_ctx->dst = kmalloc(lzo_ctx->dst_len, GFP_KERNEL); - if (!lzo_ctx->dst) { - lzo_ctx->dst_len = 0; - return -ENOMEM; - } - - ret = snd_soc_lzo_decompress(lzo_ctx); - if (ret < 0) - return ret; - return 0; -} - -static inline int snd_soc_lzo_get_blkindex(struct snd_soc_codec *codec, - unsigned int reg) -{ - const struct snd_soc_codec_driver *codec_drv; - - codec_drv = codec->driver; - return (reg * codec_drv->reg_word_size) / - DIV_ROUND_UP(codec->reg_size, snd_soc_lzo_block_count()); -} - -static inline int snd_soc_lzo_get_blkpos(struct snd_soc_codec *codec, - unsigned int reg) -{ - const struct snd_soc_codec_driver *codec_drv; - - codec_drv = codec->driver; - return reg % (DIV_ROUND_UP(codec->reg_size, snd_soc_lzo_block_count()) / - codec_drv->reg_word_size); -} - -static inline int snd_soc_lzo_get_blksize(struct snd_soc_codec *codec) -{ - return DIV_ROUND_UP(codec->reg_size, snd_soc_lzo_block_count()); -} - -static int snd_soc_lzo_cache_sync(struct snd_soc_codec *codec) -{ - struct snd_soc_lzo_ctx **lzo_blocks; - unsigned int val; - int i; - int ret; - - lzo_blocks = codec->reg_cache; - for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) { - WARN_ON(!snd_soc_codec_writable_register(codec, i)); - ret = snd_soc_cache_read(codec, i, &val); - if (ret) - return ret; - codec->cache_bypass = 1; - ret = snd_soc_write(codec, i, val); - codec->cache_bypass = 0; - if (ret) - return ret; - dev_dbg(codec->dev, "Synced register %#x, value = %#x\n", - i, val); - } - - return 0; -} - -static int snd_soc_lzo_cache_write(struct snd_soc_codec *codec, - unsigned int reg, unsigned int value) -{ - struct snd_soc_lzo_ctx *lzo_block, **lzo_blocks; - int ret, blkindex, blkpos; - size_t blksize, tmp_dst_len; - void *tmp_dst; - - /* index of the compressed lzo block */ - blkindex = snd_soc_lzo_get_blkindex(codec, reg); - /* register index within the decompressed block */ - blkpos = snd_soc_lzo_get_blkpos(codec, reg); - /* size of the compressed block */ - blksize = snd_soc_lzo_get_blksize(codec); - lzo_blocks = codec->reg_cache; - lzo_block = lzo_blocks[blkindex]; - - /* save the pointer and length of the compressed block */ - tmp_dst = lzo_block->dst; - tmp_dst_len = lzo_block->dst_len; - - /* prepare the source to be the compressed block */ - lzo_block->src = lzo_block->dst; - lzo_block->src_len = lzo_block->dst_len; - - /* decompress the block */ - ret = snd_soc_lzo_decompress_cache_block(codec, lzo_block); - if (ret < 0) { - kfree(lzo_block->dst); - goto out; - } - - /* write the new value to the cache */ - if (snd_soc_set_cache_val(lzo_block->dst, blkpos, value, - codec->driver->reg_word_size)) { - kfree(lzo_block->dst); - goto out; - } - - /* prepare the source to be the decompressed block */ - lzo_block->src = lzo_block->dst; - lzo_block->src_len = lzo_block->dst_len; - - /* compress the block */ - ret = snd_soc_lzo_compress_cache_block(codec, lzo_block); - if (ret < 0) { - kfree(lzo_block->dst); - kfree(lzo_block->src); - goto out; - } - - /* set the bit so we know we have to sync this register */ - set_bit(reg, lzo_block->sync_bmp); - kfree(tmp_dst); - kfree(lzo_block->src); - return 0; -out: - lzo_block->dst = tmp_dst; - lzo_block->dst_len = tmp_dst_len; - return ret; -} - -static int snd_soc_lzo_cache_read(struct snd_soc_codec *codec, - unsigned int reg, unsigned int *value) -{ - struct snd_soc_lzo_ctx *lzo_block, **lzo_blocks; - int ret, blkindex, blkpos; - size_t blksize, tmp_dst_len; - void *tmp_dst; - - *value = 0; - /* index of the compressed lzo block */ - blkindex = snd_soc_lzo_get_blkindex(codec, reg); - /* register index within the decompressed block */ - blkpos = snd_soc_lzo_get_blkpos(codec, reg); - /* size of the compressed block */ - blksize = snd_soc_lzo_get_blksize(codec); - lzo_blocks = codec->reg_cache; - lzo_block = lzo_blocks[blkindex]; - - /* save the pointer and length of the compressed block */ - tmp_dst = lzo_block->dst; - tmp_dst_len = lzo_block->dst_len; - - /* prepare the source to be the compressed block */ - lzo_block->src = lzo_block->dst; - lzo_block->src_len = lzo_block->dst_len; - - /* decompress the block */ - ret = snd_soc_lzo_decompress_cache_block(codec, lzo_block); - if (ret >= 0) - /* fetch the value from the cache */ - *value = snd_soc_get_cache_val(lzo_block->dst, blkpos, - codec->driver->reg_word_size); - - kfree(lzo_block->dst); - /* restore the pointer and length of the compressed block */ - lzo_block->dst = tmp_dst; - lzo_block->dst_len = tmp_dst_len; - return 0; -} - -static int snd_soc_lzo_cache_exit(struct snd_soc_codec *codec) -{ - struct snd_soc_lzo_ctx **lzo_blocks; - int i, blkcount; - - lzo_blocks = codec->reg_cache; - if (!lzo_blocks) - return 0; - - blkcount = snd_soc_lzo_block_count(); - /* - * the pointer to the bitmap used for syncing the cache - * is shared amongst all lzo_blocks. Ensure it is freed - * only once. - */ - if (lzo_blocks[0]) - kfree(lzo_blocks[0]->sync_bmp); - for (i = 0; i < blkcount; ++i) { - if (lzo_blocks[i]) { - kfree(lzo_blocks[i]->wmem); - kfree(lzo_blocks[i]->dst); - } - /* each lzo_block is a pointer returned by kmalloc or NULL */ - kfree(lzo_blocks[i]); - } - kfree(lzo_blocks); - codec->reg_cache = NULL; - return 0; -} - -static int snd_soc_lzo_cache_init(struct snd_soc_codec *codec) -{ - struct snd_soc_lzo_ctx **lzo_blocks; - size_t bmp_size; - const struct snd_soc_codec_driver *codec_drv; - int ret, tofree, i, blksize, blkcount; - const char *p, *end; - unsigned long *sync_bmp; - - ret = 0; - codec_drv = codec->driver; - - /* - * If we have not been given a default register cache - * then allocate a dummy zero-ed out region, compress it - * and remember to free it afterwards. - */ - tofree = 0; - if (!codec->reg_def_copy) - tofree = 1; - - if (!codec->reg_def_copy) { - codec->reg_def_copy = kzalloc(codec->reg_size, GFP_KERNEL); - if (!codec->reg_def_copy) - return -ENOMEM; - } - - blkcount = snd_soc_lzo_block_count(); - codec->reg_cache = kzalloc(blkcount * sizeof *lzo_blocks, - GFP_KERNEL); - if (!codec->reg_cache) { - ret = -ENOMEM; - goto err_tofree; - } - lzo_blocks = codec->reg_cache; - - /* - * allocate a bitmap to be used when syncing the cache with - * the hardware. Each time a register is modified, the corresponding - * bit is set in the bitmap, so we know that we have to sync - * that register. - */ - bmp_size = codec_drv->reg_cache_size; - sync_bmp = kmalloc(BITS_TO_LONGS(bmp_size) * sizeof(long), - GFP_KERNEL); - if (!sync_bmp) { - ret = -ENOMEM; - goto err; - } - bitmap_zero(sync_bmp, bmp_size); - - /* allocate the lzo blocks and initialize them */ - for (i = 0; i < blkcount; ++i) { - lzo_blocks[i] = kzalloc(sizeof **lzo_blocks, - GFP_KERNEL); - if (!lzo_blocks[i]) { - kfree(sync_bmp); - ret = -ENOMEM; - goto err; - } - lzo_blocks[i]->sync_bmp = sync_bmp; - lzo_blocks[i]->sync_bmp_nbits = bmp_size; - /* alloc the working space for the compressed block */ - ret = snd_soc_lzo_prepare(lzo_blocks[i]); - if (ret < 0) - goto err; - } - - blksize = snd_soc_lzo_get_blksize(codec); - p = codec->reg_def_copy; - end = codec->reg_def_copy + codec->reg_size; - /* compress the register map and fill the lzo blocks */ - for (i = 0; i < blkcount; ++i, p += blksize) { - lzo_blocks[i]->src = p; - if (p + blksize > end) - lzo_blocks[i]->src_len = end - p; - else - lzo_blocks[i]->src_len = blksize; - ret = snd_soc_lzo_compress_cache_block(codec, - lzo_blocks[i]); - if (ret < 0) - goto err; - lzo_blocks[i]->decompressed_size = - lzo_blocks[i]->src_len; - } - - if (tofree) { - kfree(codec->reg_def_copy); - codec->reg_def_copy = NULL; - } - return 0; -err: - snd_soc_cache_exit(codec); -err_tofree: - if (tofree) { - kfree(codec->reg_def_copy); - codec->reg_def_copy = NULL; - } - return ret; -} -#endif - static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec) { int i; @@ -889,17 +516,6 @@ static const struct snd_soc_cache_ops cache_types[] = { .write = snd_soc_flat_cache_write, .sync = snd_soc_flat_cache_sync }, -#ifdef CONFIG_SND_SOC_CACHE_LZO - { - .id = SND_SOC_LZO_COMPRESSION, - .name = "LZO", - .init = snd_soc_lzo_cache_init, - .exit = snd_soc_lzo_cache_exit, - .read = snd_soc_lzo_cache_read, - .write = snd_soc_lzo_cache_write, - .sync = snd_soc_lzo_cache_sync - }, -#endif { .id = SND_SOC_RBTREE_COMPRESSION, .name = "rbtree", -- cgit v1.1 From 07b18f69a766375736a5313c29d808e59b1e13e9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 10 Nov 2011 15:42:54 +0100 Subject: ALSA: hda/realtek - Create multi-io jacks more aggresively So far the driver creates the multi-io jacks only when a single output jack, i.e. no multiple speakers are assigned. This patch adds the similar multi-io detection even with multiple speakers are assigned primarily, so that 5.1-speakers + HP/mic/LI combination can work. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 63 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index c1fa4c3..8194c07 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -2974,6 +2974,23 @@ static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin) return 0; } +/* check whether the DAC is reachable from the pin */ +static bool alc_auto_is_dac_reachable(struct hda_codec *codec, + hda_nid_t pin, hda_nid_t dac) +{ + hda_nid_t srcs[5]; + int i, num; + + pin = alc_go_down_to_selector(codec, pin); + num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); + for (i = 0; i < num; i++) { + hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]); + if (nid == dac) + return true; + } + return false; +} + static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin) { hda_nid_t sel = alc_go_down_to_selector(codec, pin); @@ -3003,13 +3020,15 @@ static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs, } static int alc_auto_fill_multi_ios(struct hda_codec *codec, - unsigned int location); + unsigned int location, int offset); /* fill in the dac_nids table from the parsed pin configuration */ static int alc_auto_fill_dac_nids(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; const struct auto_pin_cfg *cfg = &spec->autocfg; + unsigned int location, defcfg; + int num_pins; bool redone = false; int i; @@ -3061,13 +3080,10 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) if (cfg->line_outs == 1 && cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { /* try to fill multi-io first */ - unsigned int location, defcfg; - int num_pins; - defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]); location = get_defcfg_location(defcfg); - num_pins = alc_auto_fill_multi_ios(codec, location); + num_pins = alc_auto_fill_multi_ios(codec, location, 0); if (num_pins > 0) { spec->multi_ios = num_pins; spec->ext_channel_count = 2; @@ -3082,6 +3098,21 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) alc_auto_fill_extra_dacs(codec, cfg->speaker_outs, cfg->speaker_pins, spec->multiout.extra_out_nid); + if (!spec->multi_ios && + cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && + cfg->hp_outs) { + /* try multi-ios with HP + inputs */ + defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]); + location = get_defcfg_location(defcfg); + + num_pins = alc_auto_fill_multi_ios(codec, location, 1); + if (num_pins > 0) { + spec->multi_ios = num_pins; + spec->ext_channel_count = 2; + spec->multiout.num_dacs = num_pins + 1; + } + } + return 0; } @@ -3467,17 +3498,19 @@ static void alc_auto_init_extra_out(struct hda_codec *codec) * multi-io helper */ static int alc_auto_fill_multi_ios(struct hda_codec *codec, - unsigned int location) + unsigned int location, + int offset) { struct alc_spec *spec = codec->spec; struct auto_pin_cfg *cfg = &spec->autocfg; hda_nid_t prime_dac = spec->private_dac_nids[0]; - int type, i, num_pins = 0; + int type, i, dacs, num_pins = 0; + dacs = spec->multiout.num_dacs; for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) { for (i = 0; i < cfg->num_inputs; i++) { hda_nid_t nid = cfg->inputs[i].pin; - hda_nid_t dac; + hda_nid_t dac = 0; unsigned int defcfg, caps; if (cfg->inputs[i].type != type) continue; @@ -3489,7 +3522,13 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec, caps = snd_hda_query_pin_caps(codec, nid); if (!(caps & AC_PINCAP_OUT)) continue; - dac = alc_auto_look_for_dac(codec, nid); + if (offset && offset + num_pins < dacs) { + dac = spec->private_dac_nids[offset + num_pins]; + if (!alc_auto_is_dac_reachable(codec, nid, dac)) + dac = 0; + } + if (!dac) + dac = alc_auto_look_for_dac(codec, nid); if (!dac) continue; spec->multi_io[num_pins].pin = nid; @@ -3498,11 +3537,11 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec, spec->private_dac_nids[spec->multiout.num_dacs++] = dac; } } - spec->multiout.num_dacs = 1; + spec->multiout.num_dacs = dacs; if (num_pins < 2) { /* clear up again */ - memset(spec->private_dac_nids, 0, - sizeof(spec->private_dac_nids)); + memset(spec->private_dac_nids + dacs, 0, + sizeof(hda_nid_t) * (AUTO_CFG_MAX_OUTS - dacs)); spec->private_dac_nids[0] = prime_dac; return 0; } -- cgit v1.1 From c3e837bbcc03e39991da5dd1f791c06cde9f7a45 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 10 Nov 2011 16:01:47 +0100 Subject: ALSA: hda/realtek - Rewrite ALC882 acer-aspire-* models with the auto-parser Now we can move the big acer-aspire-* static quirks to the auto-paresr with some additional pin-configs and verbs. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 425 ------------------------------------------ sound/pci/hda/patch_realtek.c | 74 +++++++- 2 files changed, 69 insertions(+), 430 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index ccd20d1..c1f6ac6 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -21,322 +21,6 @@ enum { ALC882_MODEL_LAST, }; -/* - * ALC888 Acer Aspire 4930G model - */ - -static const struct hda_verb alc888_acer_aspire_4930g_verbs[] = { -/* Front Mic: set to PIN_IN (empty by default) */ - {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, -/* Unselect Front Mic by default in input mixer 3 */ - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, -/* Enable unsolicited event for HP jack */ - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, -/* Connect Internal HP to front */ - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, -/* Connect HP out to front */ - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, - { } -}; - -/* - * ALC888 Acer Aspire 6530G model - */ - -static const struct hda_verb alc888_acer_aspire_6530g_verbs[] = { -/* Route to built-in subwoofer as well as speakers */ - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, -/* Bias voltage on for external mic port */ - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, -/* Front Mic: set to PIN_IN (empty by default) */ - {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, -/* Unselect Front Mic by default in input mixer 3 */ - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, -/* Enable unsolicited event for HP jack */ - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, -/* Enable speaker output */ - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, -/* Enable headphone output */ - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, - {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, - { } -}; - -/* - *ALC888 Acer Aspire 7730G model - */ - -static const struct hda_verb alc888_acer_aspire_7730G_verbs[] = { -/* Bias voltage on for external mic port */ - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, -/* Front Mic: set to PIN_IN (empty by default) */ - {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, -/* Unselect Front Mic by default in input mixer 3 */ - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, -/* Enable unsolicited event for HP jack */ - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, -/* Enable speaker output */ - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, -/* Enable headphone output */ - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, - {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, -/*Enable internal subwoofer */ - {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, - {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, - { } -}; - -/* - * ALC889 Acer Aspire 8930G model - */ - -static const struct hda_verb alc889_acer_aspire_8930g_verbs[] = { -/* Front Mic: set to PIN_IN (empty by default) */ - {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, -/* Unselect Front Mic by default in input mixer 3 */ - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, -/* Enable unsolicited event for HP jack */ - {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, -/* Connect Internal Front to Front */ - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, -/* Connect Internal Rear to Rear */ - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, -/* Connect Internal CLFE to CLFE */ - {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, -/* Connect HP out to Front */ - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, - {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, -/* Enable all DACs */ -/* DAC DISABLE/MUTE 1? */ -/* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ - {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, - {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, -/* DAC DISABLE/MUTE 2? */ -/* some bit here disables the other DACs. Init=0x4900 */ - {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, - {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, -/* DMIC fix - * This laptop has a stereo digital microphone. The mics are only 1cm apart - * which makes the stereo useless. However, either the mic or the ALC889 - * makes the signal become a difference/sum signal instead of standard - * stereo, which is annoying. So instead we flip this bit which makes the - * codec replicate the sum signal to both channels, turning it into a - * normal mono mic. - */ -/* DMIC_CONTROL? Init value = 0x0001 */ - {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, - {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, - { } -}; - -static const struct hda_input_mux alc888_2_capture_sources[2] = { - /* Front mic only available on one ADC */ - { - .num_items = 4, - .items = { - { "Mic", 0x0 }, - { "Line", 0x2 }, - { "CD", 0x4 }, - { "Front Mic", 0xb }, - }, - }, - { - .num_items = 3, - .items = { - { "Mic", 0x0 }, - { "Line", 0x2 }, - { "CD", 0x4 }, - }, - } -}; - -static const struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { - /* Interal mic only available on one ADC */ - { - .num_items = 5, - .items = { - { "Mic", 0x0 }, - { "Line In", 0x2 }, - { "CD", 0x4 }, - { "Input Mix", 0xa }, - { "Internal Mic", 0xb }, - }, - }, - { - .num_items = 4, - .items = { - { "Mic", 0x0 }, - { "Line In", 0x2 }, - { "CD", 0x4 }, - { "Input Mix", 0xa }, - }, - } -}; - -static const struct hda_input_mux alc889_capture_sources[3] = { - /* Digital mic only available on first "ADC" */ - { - .num_items = 5, - .items = { - { "Mic", 0x0 }, - { "Line", 0x2 }, - { "CD", 0x4 }, - { "Front Mic", 0xb }, - { "Input Mix", 0xa }, - }, - }, - { - .num_items = 4, - .items = { - { "Mic", 0x0 }, - { "Line", 0x2 }, - { "CD", 0x4 }, - { "Input Mix", 0xa }, - }, - }, - { - .num_items = 4, - .items = { - { "Mic", 0x0 }, - { "Line", 0x2 }, - { "CD", 0x4 }, - { "Input Mix", 0xa }, - }, - } -}; - -static const struct snd_kcontrol_new alc888_base_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), - HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, - HDA_OUTPUT), - HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), - HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - { } /* end */ -}; - -static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), - HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, - HDA_OUTPUT), - HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), - HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), - HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - { } /* end */ -}; - -static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), - HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, - HDA_OUTPUT), - HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), - HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - { } /* end */ -}; - - -static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x15; - spec->autocfg.speaker_pins[0] = 0x14; - spec->autocfg.speaker_pins[1] = 0x16; - spec->autocfg.speaker_pins[2] = 0x17; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x15; - spec->autocfg.speaker_pins[0] = 0x14; - spec->autocfg.speaker_pins[1] = 0x16; - spec->autocfg.speaker_pins[2] = 0x17; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x15; - spec->autocfg.speaker_pins[0] = 0x14; - spec->autocfg.speaker_pins[1] = 0x16; - spec->autocfg.speaker_pins[2] = 0x17; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - -static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x15; - spec->autocfg.speaker_pins[0] = 0x14; - spec->autocfg.speaker_pins[1] = 0x16; - spec->autocfg.speaker_pins[2] = 0x1b; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - #define ALC882_DIGOUT_NID 0x06 #define ALC882_DIGIN_NID 0x0a #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID @@ -1301,32 +985,10 @@ static const char * const alc882_models[ALC882_MODEL_LAST] = { [ALC885_MBP3] = "mbp3", [ALC885_IMAC24] = "imac24", [ALC885_IMAC91] = "imac91", - [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", - [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", - [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", - [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", [ALC889A_MB31] = "mb31", [ALC882_AUTO] = "auto", }; -static const struct snd_pci_quirk alc882_cfg_tbl[] = { - SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", - ALC888_ACER_ASPIRE_4930G), - SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", - ALC888_ACER_ASPIRE_4930G), - SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", - ALC888_ACER_ASPIRE_8930G), - SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", - ALC888_ACER_ASPIRE_8930G), - SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", - ALC888_ACER_ASPIRE_6530G), - SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", - ALC888_ACER_ASPIRE_6530G), - SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", - ALC888_ACER_ASPIRE_7730G), - {} -}; - /* codec SSID table for Intel Mac */ static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), @@ -1454,93 +1116,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc885_imac91_setup, .init_hook = alc_hp_automute, }, - [ALC888_ACER_ASPIRE_4930G] = { - .mixers = { alc888_acer_aspire_4930g_mixer, - alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, - alc888_acer_aspire_4930g_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), - .adc_nids = alc883_adc_nids_rev, - .capsrc_nids = alc883_capsrc_nids_rev, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), - .channel_mode = alc883_3ST_6ch_modes, - .need_dac_fix = 1, - .const_channel_count = 6, - .num_mux_defs = - ARRAY_SIZE(alc888_2_capture_sources), - .input_mux = alc888_2_capture_sources, - .unsol_event = alc_sku_unsol_event, - .setup = alc888_acer_aspire_4930g_setup, - .init_hook = alc_hp_automute, - }, - [ALC888_ACER_ASPIRE_6530G] = { - .mixers = { alc888_acer_aspire_6530_mixer }, - .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, - alc888_acer_aspire_6530g_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), - .adc_nids = alc883_adc_nids_rev, - .capsrc_nids = alc883_capsrc_nids_rev, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), - .channel_mode = alc883_3ST_2ch_modes, - .num_mux_defs = - ARRAY_SIZE(alc888_2_capture_sources), - .input_mux = alc888_acer_aspire_6530_sources, - .unsol_event = alc_sku_unsol_event, - .setup = alc888_acer_aspire_6530g_setup, - .init_hook = alc_hp_automute, - }, - [ALC888_ACER_ASPIRE_8930G] = { - .mixers = { alc889_acer_aspire_8930g_mixer, - alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, - alc889_acer_aspire_8930g_verbs, - alc889_eapd_verbs}, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), - .adc_nids = alc889_adc_nids, - .capsrc_nids = alc889_capsrc_nids, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), - .channel_mode = alc883_3ST_6ch_modes, - .need_dac_fix = 1, - .const_channel_count = 6, - .num_mux_defs = - ARRAY_SIZE(alc889_capture_sources), - .input_mux = alc889_capture_sources, - .unsol_event = alc_sku_unsol_event, - .setup = alc889_acer_aspire_8930g_setup, - .init_hook = alc_hp_automute, -#ifdef CONFIG_SND_HDA_POWER_SAVE - .power_hook = alc_power_eapd, -#endif - }, - [ALC888_ACER_ASPIRE_7730G] = { - .mixers = { alc883_3ST_6ch_mixer, - alc883_chmode_mixer }, - .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, - alc888_acer_aspire_7730G_verbs }, - .num_dacs = ARRAY_SIZE(alc883_dac_nids), - .dac_nids = alc883_dac_nids, - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), - .adc_nids = alc883_adc_nids_rev, - .capsrc_nids = alc883_capsrc_nids_rev, - .dig_out_nid = ALC883_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), - .channel_mode = alc883_3ST_6ch_modes, - .need_dac_fix = 1, - .const_channel_count = 6, - .input_mux = &alc883_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc888_acer_aspire_7730g_setup, - .init_hook = alc_hp_automute, - }, [ALC889A_MB31] = { .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8194c07..9fc2ba0 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4280,6 +4280,9 @@ enum { ALC882_FIXUP_GPIO3, ALC889_FIXUP_COEF, ALC882_FIXUP_ASUS_W2JC, + ALC882_FIXUP_ACER_ASPIRE_4930G, + ALC882_FIXUP_ACER_ASPIRE_8930G, + ALC882_FIXUP_ASPIRE_8930G_VERBS, }; static void alc889_fixup_coef(struct hda_codec *codec, @@ -4382,6 +4385,57 @@ static const struct alc_fixup alc882_fixups[] = { .type = ALC_FIXUP_FUNC, .v.func = alc889_fixup_coef, }, + [ALC882_FIXUP_ACER_ASPIRE_4930G] = { + .type = ALC_FIXUP_PINS, + .v.pins = (const struct alc_pincfg[]) { + { 0x16, 0x99130111 }, /* CLFE speaker */ + { 0x17, 0x99130112 }, /* surround speaker */ + { } + } + }, + [ALC882_FIXUP_ACER_ASPIRE_8930G] = { + .type = ALC_FIXUP_PINS, + .v.pins = (const struct alc_pincfg[]) { + { 0x16, 0x99130111 }, /* CLFE speaker */ + { 0x1b, 0x99130112 }, /* surround speaker */ + { } + }, + .chained = true, + .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS, + }, + [ALC882_FIXUP_ASPIRE_8930G_VERBS] = { + /* additional init verbs for Acer Aspire 8930G */ + .type = ALC_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { + /* Enable all DACs */ + /* DAC DISABLE/MUTE 1? */ + /* setting bits 1-5 disables DAC nids 0x02-0x06 + * apparently. Init=0x38 */ + { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 }, + /* DAC DISABLE/MUTE 2? */ + /* some bit here disables the other DACs. + * Init=0x4900 */ + { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 }, + /* DMIC fix + * This laptop has a stereo digital microphone. + * The mics are only 1cm apart which makes the stereo + * useless. However, either the mic or the ALC889 + * makes the signal become a difference/sum signal + * instead of standard stereo, which is annoying. + * So instead we flip this bit which makes the + * codec replicate the sum signal to both channels, + * turning it into a normal mono mic. + */ + /* DMIC_CONTROL? Init value = 0x0001 */ + { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 }, + { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, + { } + } + }, }; static const struct snd_pci_quirk alc882_fixup_tbl[] = { @@ -4391,6 +4445,20 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD), SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD), + SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", + ALC882_FIXUP_ACER_ASPIRE_4930G), + SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", + ALC882_FIXUP_ACER_ASPIRE_4930G), + SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", + ALC882_FIXUP_ACER_ASPIRE_8930G), + SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", + ALC882_FIXUP_ACER_ASPIRE_8930G), + SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", + ALC882_FIXUP_ACER_ASPIRE_4930G), + SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", + ALC882_FIXUP_ACER_ASPIRE_4930G), + SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", + ALC882_FIXUP_ACER_ASPIRE_4930G), SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), @@ -4453,11 +4521,7 @@ static int patch_alc882(struct hda_codec *codec) if (err < 0) goto error; - board_config = alc_board_config(codec, ALC882_MODEL_LAST, - alc882_models, alc882_cfg_tbl); - - if (board_config < 0) - board_config = alc_board_codec_sid_config(codec, + board_config = alc_board_codec_sid_config(codec, ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); if (board_config < 0) { -- cgit v1.1 From d9b5e9c6bccc3850b91ddaac11b49f2510375f5b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 10 Nov 2011 16:14:04 +0000 Subject: ASoC: Move WM5100 platform data based setup into I2C probe Get things configured as early as possible, especially useful for the GPIOs which might be useful anyway. Signed-off-by: Mark Brown --- sound/soc/codecs/wm5100.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index 0077086..f37d67f 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -2467,24 +2467,6 @@ static int wm5100_probe(struct snd_soc_codec *codec) snd_soc_update_bits(codec, wm5100_dig_vu[i], WM5100_OUT_VU, WM5100_OUT_VU); - for (i = 0; i < ARRAY_SIZE(wm5100->pdata.in_mode); i++) { - snd_soc_update_bits(codec, WM5100_IN1L_CONTROL, - WM5100_IN1_MODE_MASK | - WM5100_IN1_DMIC_SUP_MASK, - (wm5100->pdata.in_mode[i] << - WM5100_IN1_MODE_SHIFT) | - (wm5100->pdata.dmic_sup[i] << - WM5100_IN1_DMIC_SUP_SHIFT)); - } - - for (i = 0; i < ARRAY_SIZE(wm5100->pdata.gpio_defaults); i++) { - if (!wm5100->pdata.gpio_defaults[i]) - continue; - - snd_soc_write(codec, WM5100_GPIO_CTRL_1 + i, - wm5100->pdata.gpio_defaults[i]); - } - /* Don't debounce interrupts to support use of SYSCLK only */ snd_soc_write(codec, WM5100_IRQ_DEBOUNCE_1, 0); snd_soc_write(codec, WM5100_IRQ_DEBOUNCE_2, 0); @@ -2739,6 +2721,24 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, wm5100_init_gpio(i2c); + for (i = 0; i < ARRAY_SIZE(wm5100->pdata.gpio_defaults); i++) { + if (!wm5100->pdata.gpio_defaults[i]) + continue; + + regmap_write(wm5100->regmap, WM5100_GPIO_CTRL_1 + i, + wm5100->pdata.gpio_defaults[i]); + } + + for (i = 0; i < ARRAY_SIZE(wm5100->pdata.in_mode); i++) { + regmap_update_bits(wm5100->regmap, WM5100_IN1L_CONTROL, + WM5100_IN1_MODE_MASK | + WM5100_IN1_DMIC_SUP_MASK, + (wm5100->pdata.in_mode[i] << + WM5100_IN1_MODE_SHIFT) | + (wm5100->pdata.dmic_sup[i] << + WM5100_IN1_DMIC_SUP_SHIFT)); + } + ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm5100, wm5100_dai, ARRAY_SIZE(wm5100_dai)); -- cgit v1.1 From c42da64293b81463e9d3d1a74254f3425509a29b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 10 Nov 2011 17:15:54 +0000 Subject: ASoC: Convert WM8995 to direct regmap usage Large code size increase due to the addition of readability information and the reformatting of the defaults table. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8995.c | 717 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 608 insertions(+), 109 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c index 4d109b1..3774acb 100644 --- a/sound/soc/codecs/wm8995.c +++ b/sound/soc/codecs/wm8995.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -43,88 +44,331 @@ static const char *wm8995_supply_names[WM8995_NUM_SUPPLIES] = { "MICVDD" }; -static const u16 wm8995_reg_defs[WM8995_MAX_REGISTER + 1] = { - [0] = 0x8995, [5] = 0x0100, [16] = 0x000b, [17] = 0x000b, - [24] = 0x02c0, [25] = 0x02c0, [26] = 0x02c0, [27] = 0x02c0, - [28] = 0x000f, [32] = 0x0005, [33] = 0x0005, [40] = 0x0003, - [41] = 0x0013, [48] = 0x0004, [56] = 0x09f8, [64] = 0x1f25, - [69] = 0x0004, [82] = 0xaaaa, [84] = 0x2a2a, [146] = 0x0060, - [256] = 0x0002, [257] = 0x8004, [520] = 0x0010, [528] = 0x0083, - [529] = 0x0083, [548] = 0x0c80, [580] = 0x0c80, [768] = 0x4050, - [769] = 0x4000, [771] = 0x0040, [772] = 0x0040, [773] = 0x0040, - [774] = 0x0004, [775] = 0x0100, [784] = 0x4050, [785] = 0x4000, - [787] = 0x0040, [788] = 0x0040, [789] = 0x0040, [1024] = 0x00c0, - [1025] = 0x00c0, [1026] = 0x00c0, [1027] = 0x00c0, [1028] = 0x00c0, - [1029] = 0x00c0, [1030] = 0x00c0, [1031] = 0x00c0, [1056] = 0x0200, - [1057] = 0x0010, [1058] = 0x0200, [1059] = 0x0010, [1088] = 0x0098, - [1089] = 0x0845, [1104] = 0x0098, [1105] = 0x0845, [1152] = 0x6318, - [1153] = 0x6300, [1154] = 0x0fca, [1155] = 0x0400, [1156] = 0x00d8, - [1157] = 0x1eb5, [1158] = 0xf145, [1159] = 0x0b75, [1160] = 0x01c5, - [1161] = 0x1c58, [1162] = 0xf373, [1163] = 0x0a54, [1164] = 0x0558, - [1165] = 0x168e, [1166] = 0xf829, [1167] = 0x07ad, [1168] = 0x1103, - [1169] = 0x0564, [1170] = 0x0559, [1171] = 0x4000, [1184] = 0x6318, - [1185] = 0x6300, [1186] = 0x0fca, [1187] = 0x0400, [1188] = 0x00d8, - [1189] = 0x1eb5, [1190] = 0xf145, [1191] = 0x0b75, [1192] = 0x01c5, - [1193] = 0x1c58, [1194] = 0xf373, [1195] = 0x0a54, [1196] = 0x0558, - [1197] = 0x168e, [1198] = 0xf829, [1199] = 0x07ad, [1200] = 0x1103, - [1201] = 0x0564, [1202] = 0x0559, [1203] = 0x4000, [1280] = 0x00c0, - [1281] = 0x00c0, [1282] = 0x00c0, [1283] = 0x00c0, [1312] = 0x0200, - [1313] = 0x0010, [1344] = 0x0098, [1345] = 0x0845, [1408] = 0x6318, - [1409] = 0x6300, [1410] = 0x0fca, [1411] = 0x0400, [1412] = 0x00d8, - [1413] = 0x1eb5, [1414] = 0xf145, [1415] = 0x0b75, [1416] = 0x01c5, - [1417] = 0x1c58, [1418] = 0xf373, [1419] = 0x0a54, [1420] = 0x0558, - [1421] = 0x168e, [1422] = 0xf829, [1423] = 0x07ad, [1424] = 0x1103, - [1425] = 0x0564, [1426] = 0x0559, [1427] = 0x4000, [1568] = 0x0002, - [1792] = 0xa100, [1793] = 0xa101, [1794] = 0xa101, [1795] = 0xa101, - [1796] = 0xa101, [1797] = 0xa101, [1798] = 0xa101, [1799] = 0xa101, - [1800] = 0xa101, [1801] = 0xa101, [1802] = 0xa101, [1803] = 0xa101, - [1804] = 0xa101, [1805] = 0xa101, [1825] = 0x0055, [1848] = 0x3fff, - [1849] = 0x1fff, [2049] = 0x0001, [2050] = 0x0069, [2056] = 0x0002, - [2057] = 0x0003, [2058] = 0x0069, [12288] = 0x0001, [12289] = 0x0001, - [12291] = 0x0006, [12292] = 0x0040, [12293] = 0x0001, [12294] = 0x000f, - [12295] = 0x0006, [12296] = 0x0001, [12297] = 0x0003, [12298] = 0x0104, - [12300] = 0x0060, [12301] = 0x0011, [12302] = 0x0401, [12304] = 0x0050, - [12305] = 0x0003, [12306] = 0x0100, [12308] = 0x0051, [12309] = 0x0003, - [12310] = 0x0104, [12311] = 0x000a, [12312] = 0x0060, [12313] = 0x003b, - [12314] = 0x0502, [12315] = 0x0100, [12316] = 0x2fff, [12320] = 0x2fff, - [12324] = 0x2fff, [12328] = 0x2fff, [12332] = 0x2fff, [12336] = 0x2fff, - [12340] = 0x2fff, [12344] = 0x2fff, [12348] = 0x2fff, [12352] = 0x0001, - [12353] = 0x0001, [12355] = 0x0006, [12356] = 0x0040, [12357] = 0x0001, - [12358] = 0x000f, [12359] = 0x0006, [12360] = 0x0001, [12361] = 0x0003, - [12362] = 0x0104, [12364] = 0x0060, [12365] = 0x0011, [12366] = 0x0401, - [12368] = 0x0050, [12369] = 0x0003, [12370] = 0x0100, [12372] = 0x0060, - [12373] = 0x003b, [12374] = 0x0502, [12375] = 0x0100, [12376] = 0x2fff, - [12380] = 0x2fff, [12384] = 0x2fff, [12388] = 0x2fff, [12392] = 0x2fff, - [12396] = 0x2fff, [12400] = 0x2fff, [12404] = 0x2fff, [12408] = 0x2fff, - [12412] = 0x2fff, [12416] = 0x0001, [12417] = 0x0001, [12419] = 0x0006, - [12420] = 0x0040, [12421] = 0x0001, [12422] = 0x000f, [12423] = 0x0006, - [12424] = 0x0001, [12425] = 0x0003, [12426] = 0x0106, [12428] = 0x0061, - [12429] = 0x0011, [12430] = 0x0401, [12432] = 0x0050, [12433] = 0x0003, - [12434] = 0x0102, [12436] = 0x0051, [12437] = 0x0003, [12438] = 0x0106, - [12439] = 0x000a, [12440] = 0x0061, [12441] = 0x003b, [12442] = 0x0502, - [12443] = 0x0100, [12444] = 0x2fff, [12448] = 0x2fff, [12452] = 0x2fff, - [12456] = 0x2fff, [12460] = 0x2fff, [12464] = 0x2fff, [12468] = 0x2fff, - [12472] = 0x2fff, [12476] = 0x2fff, [12480] = 0x0001, [12481] = 0x0001, - [12483] = 0x0006, [12484] = 0x0040, [12485] = 0x0001, [12486] = 0x000f, - [12487] = 0x0006, [12488] = 0x0001, [12489] = 0x0003, [12490] = 0x0106, - [12492] = 0x0061, [12493] = 0x0011, [12494] = 0x0401, [12496] = 0x0050, - [12497] = 0x0003, [12498] = 0x0102, [12500] = 0x0061, [12501] = 0x003b, - [12502] = 0x0502, [12503] = 0x0100, [12504] = 0x2fff, [12508] = 0x2fff, - [12512] = 0x2fff, [12516] = 0x2fff, [12520] = 0x2fff, [12524] = 0x2fff, - [12528] = 0x2fff, [12532] = 0x2fff, [12536] = 0x2fff, [12540] = 0x2fff, - [12544] = 0x0060, [12546] = 0x0601, [12548] = 0x0050, [12550] = 0x0100, - [12552] = 0x0001, [12554] = 0x0104, [12555] = 0x0100, [12556] = 0x2fff, - [12560] = 0x2fff, [12564] = 0x2fff, [12568] = 0x2fff, [12572] = 0x2fff, - [12576] = 0x2fff, [12580] = 0x2fff, [12584] = 0x2fff, [12588] = 0x2fff, - [12592] = 0x2fff, [12596] = 0x2fff, [12600] = 0x2fff, [12604] = 0x2fff, - [12608] = 0x0061, [12610] = 0x0601, [12612] = 0x0050, [12614] = 0x0102, - [12616] = 0x0001, [12618] = 0x0106, [12619] = 0x0100, [12620] = 0x2fff, - [12624] = 0x2fff, [12628] = 0x2fff, [12632] = 0x2fff, [12636] = 0x2fff, - [12640] = 0x2fff, [12644] = 0x2fff, [12648] = 0x2fff, [12652] = 0x2fff, - [12656] = 0x2fff, [12660] = 0x2fff, [12664] = 0x2fff, [12668] = 0x2fff, - [12672] = 0x0060, [12674] = 0x0601, [12676] = 0x0061, [12678] = 0x0601, - [12680] = 0x0050, [12682] = 0x0300, [12684] = 0x0001, [12686] = 0x0304, - [12688] = 0x0040, [12690] = 0x000f, [12692] = 0x0001, [12695] = 0x0100 +static struct reg_default wm8995_reg_defaults[] = { + { 0, 0x8995 }, + { 5, 0x0100 }, + { 16, 0x000b }, + { 17, 0x000b }, + { 24, 0x02c0 }, + { 25, 0x02c0 }, + { 26, 0x02c0 }, + { 27, 0x02c0 }, + { 28, 0x000f }, + { 32, 0x0005 }, + { 33, 0x0005 }, + { 40, 0x0003 }, + { 41, 0x0013 }, + { 48, 0x0004 }, + { 56, 0x09f8 }, + { 64, 0x1f25 }, + { 69, 0x0004 }, + { 82, 0xaaaa }, + { 84, 0x2a2a }, + { 146, 0x0060 }, + { 256, 0x0002 }, + { 257, 0x8004 }, + { 520, 0x0010 }, + { 528, 0x0083 }, + { 529, 0x0083 }, + { 548, 0x0c80 }, + { 580, 0x0c80 }, + { 768, 0x4050 }, + { 769, 0x4000 }, + { 771, 0x0040 }, + { 772, 0x0040 }, + { 773, 0x0040 }, + { 774, 0x0004 }, + { 775, 0x0100 }, + { 784, 0x4050 }, + { 785, 0x4000 }, + { 787, 0x0040 }, + { 788, 0x0040 }, + { 789, 0x0040 }, + { 1024, 0x00c0 }, + { 1025, 0x00c0 }, + { 1026, 0x00c0 }, + { 1027, 0x00c0 }, + { 1028, 0x00c0 }, + { 1029, 0x00c0 }, + { 1030, 0x00c0 }, + { 1031, 0x00c0 }, + { 1056, 0x0200 }, + { 1057, 0x0010 }, + { 1058, 0x0200 }, + { 1059, 0x0010 }, + { 1088, 0x0098 }, + { 1089, 0x0845 }, + { 1104, 0x0098 }, + { 1105, 0x0845 }, + { 1152, 0x6318 }, + { 1153, 0x6300 }, + { 1154, 0x0fca }, + { 1155, 0x0400 }, + { 1156, 0x00d8 }, + { 1157, 0x1eb5 }, + { 1158, 0xf145 }, + { 1159, 0x0b75 }, + { 1160, 0x01c5 }, + { 1161, 0x1c58 }, + { 1162, 0xf373 }, + { 1163, 0x0a54 }, + { 1164, 0x0558 }, + { 1165, 0x168e }, + { 1166, 0xf829 }, + { 1167, 0x07ad }, + { 1168, 0x1103 }, + { 1169, 0x0564 }, + { 1170, 0x0559 }, + { 1171, 0x4000 }, + { 1184, 0x6318 }, + { 1185, 0x6300 }, + { 1186, 0x0fca }, + { 1187, 0x0400 }, + { 1188, 0x00d8 }, + { 1189, 0x1eb5 }, + { 1190, 0xf145 }, + { 1191, 0x0b75 }, + { 1192, 0x01c5 }, + { 1193, 0x1c58 }, + { 1194, 0xf373 }, + { 1195, 0x0a54 }, + { 1196, 0x0558 }, + { 1197, 0x168e }, + { 1198, 0xf829 }, + { 1199, 0x07ad }, + { 1200, 0x1103 }, + { 1201, 0x0564 }, + { 1202, 0x0559 }, + { 1203, 0x4000 }, + { 1280, 0x00c0 }, + { 1281, 0x00c0 }, + { 1282, 0x00c0 }, + { 1283, 0x00c0 }, + { 1312, 0x0200 }, + { 1313, 0x0010 }, + { 1344, 0x0098 }, + { 1345, 0x0845 }, + { 1408, 0x6318 }, + { 1409, 0x6300 }, + { 1410, 0x0fca }, + { 1411, 0x0400 }, + { 1412, 0x00d8 }, + { 1413, 0x1eb5 }, + { 1414, 0xf145 }, + { 1415, 0x0b75 }, + { 1416, 0x01c5 }, + { 1417, 0x1c58 }, + { 1418, 0xf373 }, + { 1419, 0x0a54 }, + { 1420, 0x0558 }, + { 1421, 0x168e }, + { 1422, 0xf829 }, + { 1423, 0x07ad }, + { 1424, 0x1103 }, + { 1425, 0x0564 }, + { 1426, 0x0559 }, + { 1427, 0x4000 }, + { 1568, 0x0002 }, + { 1792, 0xa100 }, + { 1793, 0xa101 }, + { 1794, 0xa101 }, + { 1795, 0xa101 }, + { 1796, 0xa101 }, + { 1797, 0xa101 }, + { 1798, 0xa101 }, + { 1799, 0xa101 }, + { 1800, 0xa101 }, + { 1801, 0xa101 }, + { 1802, 0xa101 }, + { 1803, 0xa101 }, + { 1804, 0xa101 }, + { 1805, 0xa101 }, + { 1825, 0x0055 }, + { 1848, 0x3fff }, + { 1849, 0x1fff }, + { 2049, 0x0001 }, + { 2050, 0x0069 }, + { 2056, 0x0002 }, + { 2057, 0x0003 }, + { 2058, 0x0069 }, + { 12288, 0x0001 }, + { 12289, 0x0001 }, + { 12291, 0x0006 }, + { 12292, 0x0040 }, + { 12293, 0x0001 }, + { 12294, 0x000f }, + { 12295, 0x0006 }, + { 12296, 0x0001 }, + { 12297, 0x0003 }, + { 12298, 0x0104 }, + { 12300, 0x0060 }, + { 12301, 0x0011 }, + { 12302, 0x0401 }, + { 12304, 0x0050 }, + { 12305, 0x0003 }, + { 12306, 0x0100 }, + { 12308, 0x0051 }, + { 12309, 0x0003 }, + { 12310, 0x0104 }, + { 12311, 0x000a }, + { 12312, 0x0060 }, + { 12313, 0x003b }, + { 12314, 0x0502 }, + { 12315, 0x0100 }, + { 12316, 0x2fff }, + { 12320, 0x2fff }, + { 12324, 0x2fff }, + { 12328, 0x2fff }, + { 12332, 0x2fff }, + { 12336, 0x2fff }, + { 12340, 0x2fff }, + { 12344, 0x2fff }, + { 12348, 0x2fff }, + { 12352, 0x0001 }, + { 12353, 0x0001 }, + { 12355, 0x0006 }, + { 12356, 0x0040 }, + { 12357, 0x0001 }, + { 12358, 0x000f }, + { 12359, 0x0006 }, + { 12360, 0x0001 }, + { 12361, 0x0003 }, + { 12362, 0x0104 }, + { 12364, 0x0060 }, + { 12365, 0x0011 }, + { 12366, 0x0401 }, + { 12368, 0x0050 }, + { 12369, 0x0003 }, + { 12370, 0x0100 }, + { 12372, 0x0060 }, + { 12373, 0x003b }, + { 12374, 0x0502 }, + { 12375, 0x0100 }, + { 12376, 0x2fff }, + { 12380, 0x2fff }, + { 12384, 0x2fff }, + { 12388, 0x2fff }, + { 12392, 0x2fff }, + { 12396, 0x2fff }, + { 12400, 0x2fff }, + { 12404, 0x2fff }, + { 12408, 0x2fff }, + { 12412, 0x2fff }, + { 12416, 0x0001 }, + { 12417, 0x0001 }, + { 12419, 0x0006 }, + { 12420, 0x0040 }, + { 12421, 0x0001 }, + { 12422, 0x000f }, + { 12423, 0x0006 }, + { 12424, 0x0001 }, + { 12425, 0x0003 }, + { 12426, 0x0106 }, + { 12428, 0x0061 }, + { 12429, 0x0011 }, + { 12430, 0x0401 }, + { 12432, 0x0050 }, + { 12433, 0x0003 }, + { 12434, 0x0102 }, + { 12436, 0x0051 }, + { 12437, 0x0003 }, + { 12438, 0x0106 }, + { 12439, 0x000a }, + { 12440, 0x0061 }, + { 12441, 0x003b }, + { 12442, 0x0502 }, + { 12443, 0x0100 }, + { 12444, 0x2fff }, + { 12448, 0x2fff }, + { 12452, 0x2fff }, + { 12456, 0x2fff }, + { 12460, 0x2fff }, + { 12464, 0x2fff }, + { 12468, 0x2fff }, + { 12472, 0x2fff }, + { 12476, 0x2fff }, + { 12480, 0x0001 }, + { 12481, 0x0001 }, + { 12483, 0x0006 }, + { 12484, 0x0040 }, + { 12485, 0x0001 }, + { 12486, 0x000f }, + { 12487, 0x0006 }, + { 12488, 0x0001 }, + { 12489, 0x0003 }, + { 12490, 0x0106 }, + { 12492, 0x0061 }, + { 12493, 0x0011 }, + { 12494, 0x0401 }, + { 12496, 0x0050 }, + { 12497, 0x0003 }, + { 12498, 0x0102 }, + { 12500, 0x0061 }, + { 12501, 0x003b }, + { 12502, 0x0502 }, + { 12503, 0x0100 }, + { 12504, 0x2fff }, + { 12508, 0x2fff }, + { 12512, 0x2fff }, + { 12516, 0x2fff }, + { 12520, 0x2fff }, + { 12524, 0x2fff }, + { 12528, 0x2fff }, + { 12532, 0x2fff }, + { 12536, 0x2fff }, + { 12540, 0x2fff }, + { 12544, 0x0060 }, + { 12546, 0x0601 }, + { 12548, 0x0050 }, + { 12550, 0x0100 }, + { 12552, 0x0001 }, + { 12554, 0x0104 }, + { 12555, 0x0100 }, + { 12556, 0x2fff }, + { 12560, 0x2fff }, + { 12564, 0x2fff }, + { 12568, 0x2fff }, + { 12572, 0x2fff }, + { 12576, 0x2fff }, + { 12580, 0x2fff }, + { 12584, 0x2fff }, + { 12588, 0x2fff }, + { 12592, 0x2fff }, + { 12596, 0x2fff }, + { 12600, 0x2fff }, + { 12604, 0x2fff }, + { 12608, 0x0061 }, + { 12610, 0x0601 }, + { 12612, 0x0050 }, + { 12614, 0x0102 }, + { 12616, 0x0001 }, + { 12618, 0x0106 }, + { 12619, 0x0100 }, + { 12620, 0x2fff }, + { 12624, 0x2fff }, + { 12628, 0x2fff }, + { 12632, 0x2fff }, + { 12636, 0x2fff }, + { 12640, 0x2fff }, + { 12644, 0x2fff }, + { 12648, 0x2fff }, + { 12652, 0x2fff }, + { 12656, 0x2fff }, + { 12660, 0x2fff }, + { 12664, 0x2fff }, + { 12668, 0x2fff }, + { 12672, 0x0060 }, + { 12674, 0x0601 }, + { 12676, 0x0061 }, + { 12678, 0x0601 }, + { 12680, 0x0050 }, + { 12682, 0x0300 }, + { 12684, 0x0001 }, + { 12686, 0x0304 }, + { 12688, 0x0040 }, + { 12690, 0x000f }, + { 12692, 0x0001 }, + { 12695, 0x0100 }, }; struct fll_config { @@ -134,7 +378,7 @@ struct fll_config { }; struct wm8995_priv { - enum snd_soc_control_type control_type; + struct regmap *regmap; int sysclk[2]; int mclk[2]; int aifclk[2]; @@ -156,7 +400,7 @@ static int wm8995_regulator_event_##n(struct notifier_block *nb, \ struct wm8995_priv *wm8995 = container_of(nb, struct wm8995_priv, \ disable_nb[n]); \ if (event & REGULATOR_EVENT_DISABLE) { \ - wm8995->codec->cache_sync = 1; \ + regcache_mark_dirty(wm8995->regmap); \ } \ return 0; \ } @@ -949,31 +1193,244 @@ static const struct snd_soc_dapm_route wm8995_intercon[] = { { "SPK2R", NULL, "SPK2R Driver" } }; -static int wm8995_volatile(struct snd_soc_codec *codec, unsigned int reg) +static bool wm8995_readable(struct device *dev, unsigned int reg) { - /* out of bounds registers are generally considered - * volatile to support register banks that are partially - * owned by something else for e.g. a DSP - */ - if (reg > WM8995_MAX_CACHED_REGISTER) - return 1; - switch (reg) { case WM8995_SOFTWARE_RESET: + case WM8995_POWER_MANAGEMENT_1: + case WM8995_POWER_MANAGEMENT_2: + case WM8995_POWER_MANAGEMENT_3: + case WM8995_POWER_MANAGEMENT_4: + case WM8995_POWER_MANAGEMENT_5: + case WM8995_LEFT_LINE_INPUT_1_VOLUME: + case WM8995_RIGHT_LINE_INPUT_1_VOLUME: + case WM8995_LEFT_LINE_INPUT_CONTROL: + case WM8995_DAC1_LEFT_VOLUME: + case WM8995_DAC1_RIGHT_VOLUME: + case WM8995_DAC2_LEFT_VOLUME: + case WM8995_DAC2_RIGHT_VOLUME: + case WM8995_OUTPUT_VOLUME_ZC_1: + case WM8995_MICBIAS_1: + case WM8995_MICBIAS_2: + case WM8995_LDO_1: + case WM8995_LDO_2: + case WM8995_ACCESSORY_DETECT_MODE1: + case WM8995_ACCESSORY_DETECT_MODE2: + case WM8995_HEADPHONE_DETECT1: + case WM8995_HEADPHONE_DETECT2: + case WM8995_MIC_DETECT_1: + case WM8995_MIC_DETECT_2: + case WM8995_CHARGE_PUMP_1: + case WM8995_CLASS_W_1: + case WM8995_DC_SERVO_1: + case WM8995_DC_SERVO_2: + case WM8995_DC_SERVO_3: + case WM8995_DC_SERVO_5: + case WM8995_DC_SERVO_6: + case WM8995_DC_SERVO_7: case WM8995_DC_SERVO_READBACK_0: + case WM8995_ANALOGUE_HP_1: + case WM8995_ANALOGUE_HP_2: + case WM8995_CHIP_REVISION: + case WM8995_CONTROL_INTERFACE_1: + case WM8995_CONTROL_INTERFACE_2: + case WM8995_WRITE_SEQUENCER_CTRL_1: + case WM8995_WRITE_SEQUENCER_CTRL_2: + case WM8995_AIF1_CLOCKING_1: + case WM8995_AIF1_CLOCKING_2: + case WM8995_AIF2_CLOCKING_1: + case WM8995_AIF2_CLOCKING_2: + case WM8995_CLOCKING_1: + case WM8995_CLOCKING_2: + case WM8995_AIF1_RATE: + case WM8995_AIF2_RATE: + case WM8995_RATE_STATUS: + case WM8995_FLL1_CONTROL_1: + case WM8995_FLL1_CONTROL_2: + case WM8995_FLL1_CONTROL_3: + case WM8995_FLL1_CONTROL_4: + case WM8995_FLL1_CONTROL_5: + case WM8995_FLL2_CONTROL_1: + case WM8995_FLL2_CONTROL_2: + case WM8995_FLL2_CONTROL_3: + case WM8995_FLL2_CONTROL_4: + case WM8995_FLL2_CONTROL_5: + case WM8995_AIF1_CONTROL_1: + case WM8995_AIF1_CONTROL_2: + case WM8995_AIF1_MASTER_SLAVE: + case WM8995_AIF1_BCLK: + case WM8995_AIF1ADC_LRCLK: + case WM8995_AIF1DAC_LRCLK: + case WM8995_AIF1DAC_DATA: + case WM8995_AIF1ADC_DATA: + case WM8995_AIF2_CONTROL_1: + case WM8995_AIF2_CONTROL_2: + case WM8995_AIF2_MASTER_SLAVE: + case WM8995_AIF2_BCLK: + case WM8995_AIF2ADC_LRCLK: + case WM8995_AIF2DAC_LRCLK: + case WM8995_AIF2DAC_DATA: + case WM8995_AIF2ADC_DATA: + case WM8995_AIF1_ADC1_LEFT_VOLUME: + case WM8995_AIF1_ADC1_RIGHT_VOLUME: + case WM8995_AIF1_DAC1_LEFT_VOLUME: + case WM8995_AIF1_DAC1_RIGHT_VOLUME: + case WM8995_AIF1_ADC2_LEFT_VOLUME: + case WM8995_AIF1_ADC2_RIGHT_VOLUME: + case WM8995_AIF1_DAC2_LEFT_VOLUME: + case WM8995_AIF1_DAC2_RIGHT_VOLUME: + case WM8995_AIF1_ADC1_FILTERS: + case WM8995_AIF1_ADC2_FILTERS: + case WM8995_AIF1_DAC1_FILTERS_1: + case WM8995_AIF1_DAC1_FILTERS_2: + case WM8995_AIF1_DAC2_FILTERS_1: + case WM8995_AIF1_DAC2_FILTERS_2: + case WM8995_AIF1_DRC1_1: + case WM8995_AIF1_DRC1_2: + case WM8995_AIF1_DRC1_3: + case WM8995_AIF1_DRC1_4: + case WM8995_AIF1_DRC1_5: + case WM8995_AIF1_DRC2_1: + case WM8995_AIF1_DRC2_2: + case WM8995_AIF1_DRC2_3: + case WM8995_AIF1_DRC2_4: + case WM8995_AIF1_DRC2_5: + case WM8995_AIF1_DAC1_EQ_GAINS_1: + case WM8995_AIF1_DAC1_EQ_GAINS_2: + case WM8995_AIF1_DAC1_EQ_BAND_1_A: + case WM8995_AIF1_DAC1_EQ_BAND_1_B: + case WM8995_AIF1_DAC1_EQ_BAND_1_PG: + case WM8995_AIF1_DAC1_EQ_BAND_2_A: + case WM8995_AIF1_DAC1_EQ_BAND_2_B: + case WM8995_AIF1_DAC1_EQ_BAND_2_C: + case WM8995_AIF1_DAC1_EQ_BAND_2_PG: + case WM8995_AIF1_DAC1_EQ_BAND_3_A: + case WM8995_AIF1_DAC1_EQ_BAND_3_B: + case WM8995_AIF1_DAC1_EQ_BAND_3_C: + case WM8995_AIF1_DAC1_EQ_BAND_3_PG: + case WM8995_AIF1_DAC1_EQ_BAND_4_A: + case WM8995_AIF1_DAC1_EQ_BAND_4_B: + case WM8995_AIF1_DAC1_EQ_BAND_4_C: + case WM8995_AIF1_DAC1_EQ_BAND_4_PG: + case WM8995_AIF1_DAC1_EQ_BAND_5_A: + case WM8995_AIF1_DAC1_EQ_BAND_5_B: + case WM8995_AIF1_DAC1_EQ_BAND_5_PG: + case WM8995_AIF1_DAC2_EQ_GAINS_1: + case WM8995_AIF1_DAC2_EQ_GAINS_2: + case WM8995_AIF1_DAC2_EQ_BAND_1_A: + case WM8995_AIF1_DAC2_EQ_BAND_1_B: + case WM8995_AIF1_DAC2_EQ_BAND_1_PG: + case WM8995_AIF1_DAC2_EQ_BAND_2_A: + case WM8995_AIF1_DAC2_EQ_BAND_2_B: + case WM8995_AIF1_DAC2_EQ_BAND_2_C: + case WM8995_AIF1_DAC2_EQ_BAND_2_PG: + case WM8995_AIF1_DAC2_EQ_BAND_3_A: + case WM8995_AIF1_DAC2_EQ_BAND_3_B: + case WM8995_AIF1_DAC2_EQ_BAND_3_C: + case WM8995_AIF1_DAC2_EQ_BAND_3_PG: + case WM8995_AIF1_DAC2_EQ_BAND_4_A: + case WM8995_AIF1_DAC2_EQ_BAND_4_B: + case WM8995_AIF1_DAC2_EQ_BAND_4_C: + case WM8995_AIF1_DAC2_EQ_BAND_4_PG: + case WM8995_AIF1_DAC2_EQ_BAND_5_A: + case WM8995_AIF1_DAC2_EQ_BAND_5_B: + case WM8995_AIF1_DAC2_EQ_BAND_5_PG: + case WM8995_AIF2_ADC_LEFT_VOLUME: + case WM8995_AIF2_ADC_RIGHT_VOLUME: + case WM8995_AIF2_DAC_LEFT_VOLUME: + case WM8995_AIF2_DAC_RIGHT_VOLUME: + case WM8995_AIF2_ADC_FILTERS: + case WM8995_AIF2_DAC_FILTERS_1: + case WM8995_AIF2_DAC_FILTERS_2: + case WM8995_AIF2_DRC_1: + case WM8995_AIF2_DRC_2: + case WM8995_AIF2_DRC_3: + case WM8995_AIF2_DRC_4: + case WM8995_AIF2_DRC_5: + case WM8995_AIF2_EQ_GAINS_1: + case WM8995_AIF2_EQ_GAINS_2: + case WM8995_AIF2_EQ_BAND_1_A: + case WM8995_AIF2_EQ_BAND_1_B: + case WM8995_AIF2_EQ_BAND_1_PG: + case WM8995_AIF2_EQ_BAND_2_A: + case WM8995_AIF2_EQ_BAND_2_B: + case WM8995_AIF2_EQ_BAND_2_C: + case WM8995_AIF2_EQ_BAND_2_PG: + case WM8995_AIF2_EQ_BAND_3_A: + case WM8995_AIF2_EQ_BAND_3_B: + case WM8995_AIF2_EQ_BAND_3_C: + case WM8995_AIF2_EQ_BAND_3_PG: + case WM8995_AIF2_EQ_BAND_4_A: + case WM8995_AIF2_EQ_BAND_4_B: + case WM8995_AIF2_EQ_BAND_4_C: + case WM8995_AIF2_EQ_BAND_4_PG: + case WM8995_AIF2_EQ_BAND_5_A: + case WM8995_AIF2_EQ_BAND_5_B: + case WM8995_AIF2_EQ_BAND_5_PG: + case WM8995_DAC1_MIXER_VOLUMES: + case WM8995_DAC1_LEFT_MIXER_ROUTING: + case WM8995_DAC1_RIGHT_MIXER_ROUTING: + case WM8995_DAC2_MIXER_VOLUMES: + case WM8995_DAC2_LEFT_MIXER_ROUTING: + case WM8995_DAC2_RIGHT_MIXER_ROUTING: + case WM8995_AIF1_ADC1_LEFT_MIXER_ROUTING: + case WM8995_AIF1_ADC1_RIGHT_MIXER_ROUTING: + case WM8995_AIF1_ADC2_LEFT_MIXER_ROUTING: + case WM8995_AIF1_ADC2_RIGHT_MIXER_ROUTING: + case WM8995_DAC_SOFTMUTE: + case WM8995_OVERSAMPLING: + case WM8995_SIDETONE: + case WM8995_GPIO_1: + case WM8995_GPIO_2: + case WM8995_GPIO_3: + case WM8995_GPIO_4: + case WM8995_GPIO_5: + case WM8995_GPIO_6: + case WM8995_GPIO_7: + case WM8995_GPIO_8: + case WM8995_GPIO_9: + case WM8995_GPIO_10: + case WM8995_GPIO_11: + case WM8995_GPIO_12: + case WM8995_GPIO_13: + case WM8995_GPIO_14: + case WM8995_PULL_CONTROL_1: + case WM8995_PULL_CONTROL_2: case WM8995_INTERRUPT_STATUS_1: case WM8995_INTERRUPT_STATUS_2: + case WM8995_INTERRUPT_RAW_STATUS_2: case WM8995_INTERRUPT_STATUS_1_MASK: case WM8995_INTERRUPT_STATUS_2_MASK: case WM8995_INTERRUPT_CONTROL: + case WM8995_LEFT_PDM_SPEAKER_1: + case WM8995_RIGHT_PDM_SPEAKER_1: + case WM8995_PDM_SPEAKER_1_MUTE_SEQUENCE: + case WM8995_LEFT_PDM_SPEAKER_2: + case WM8995_RIGHT_PDM_SPEAKER_2: + case WM8995_PDM_SPEAKER_2_MUTE_SEQUENCE: + return true; + default: + return false; + } +} + +static bool wm8995_volatile(struct device *dev, unsigned int reg) +{ + switch (reg) { + case WM8995_SOFTWARE_RESET: + case WM8995_DC_SERVO_READBACK_0: + case WM8995_INTERRUPT_STATUS_1: + case WM8995_INTERRUPT_STATUS_2: + case WM8995_INTERRUPT_CONTROL: case WM8995_ACCESSORY_DETECT_MODE1: case WM8995_ACCESSORY_DETECT_MODE2: case WM8995_HEADPHONE_DETECT1: case WM8995_HEADPHONE_DETECT2: - return 1; + case WM8995_RATE_STATUS: + return true; + default: + return false; } - - return 0; } static int wm8995_aif_mute(struct snd_soc_dai *dai, int mute) @@ -1528,7 +1985,7 @@ static int wm8995_set_bias_level(struct snd_soc_codec *codec, if (ret) return ret; - ret = snd_soc_cache_sync(codec); + ret = regcache_sync(wm8995->regmap); if (ret) { dev_err(codec->dev, "Failed to sync cache: %d\n", ret); @@ -1594,7 +2051,7 @@ static int wm8995_probe(struct snd_soc_codec *codec) wm8995 = snd_soc_codec_get_drvdata(codec); wm8995->codec = codec; - ret = snd_soc_codec_set_cache_io(codec, 16, 16, wm8995->control_type); + ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); if (ret < 0) { dev_err(codec->dev, "Failed to set cache i/o: %d\n", ret); return ret; @@ -1783,11 +2240,18 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8995 = { .suspend = wm8995_suspend, .resume = wm8995_resume, .set_bias_level = wm8995_set_bias_level, - .reg_cache_size = ARRAY_SIZE(wm8995_reg_defs), - .reg_word_size = sizeof(u16), - .reg_cache_default = wm8995_reg_defs, - .volatile_register = wm8995_volatile, - .compress_type = SND_SOC_RBTREE_COMPRESSION +}; + +static struct regmap_config wm8995_regmap = { + .reg_bits = 16, + .val_bits = 16, + + .max_register = WM8995_MAX_REGISTER, + .reg_defaults = wm8995_reg_defaults, + .num_reg_defaults = ARRAY_SIZE(wm8995_reg_defaults), + .volatile_reg = wm8995_volatile, + .readable_reg = wm8995_readable, + .cache_type = REGCACHE_RBTREE, }; #if defined(CONFIG_SPI_MASTER) @@ -1800,21 +2264,37 @@ static int __devinit wm8995_spi_probe(struct spi_device *spi) if (!wm8995) return -ENOMEM; - wm8995->control_type = SND_SOC_SPI; spi_set_drvdata(spi, wm8995); + wm8995->regmap = regmap_init_spi(spi, &wm8995_regmap); + if (IS_ERR(wm8995->regmap)) { + ret = PTR_ERR(wm8995->regmap); + dev_err(&spi->dev, "Failed to register regmap: %d\n", ret); + goto err_alloc; + } + ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_wm8995, wm8995_dai, ARRAY_SIZE(wm8995_dai)); if (ret < 0) - kfree(wm8995); + goto err_regmap; + + return ret; + +err_regmap: + regmap_exit(wm8995->regmap); +err_alloc: + kfree(wm8995); + return ret; } static int __devexit wm8995_spi_remove(struct spi_device *spi) { + struct wm8995_priv *wm8995 = spi_get_drvdata(spi); snd_soc_unregister_codec(&spi->dev); - kfree(spi_get_drvdata(spi)); + regmap_exit(wm8995->regmap); + kfree(wm8995); return 0; } @@ -1839,21 +2319,40 @@ static __devinit int wm8995_i2c_probe(struct i2c_client *i2c, if (!wm8995) return -ENOMEM; - wm8995->control_type = SND_SOC_I2C; i2c_set_clientdata(i2c, wm8995); + wm8995->regmap = regmap_init_i2c(i2c, &wm8995_regmap); + if (IS_ERR(wm8995->regmap)) { + ret = PTR_ERR(wm8995->regmap); + dev_err(&i2c->dev, "Failed to register regmap: %d\n", ret); + goto err_alloc; + } + ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8995, wm8995_dai, ARRAY_SIZE(wm8995_dai)); - if (ret < 0) - kfree(wm8995); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); + goto err_regmap; + } + + return ret; + +err_regmap: + regmap_exit(wm8995->regmap); +err_alloc: + kfree(wm8995); + return ret; } static __devexit int wm8995_i2c_remove(struct i2c_client *client) { + struct wm8995_priv *wm8995 = i2c_get_clientdata(client); + snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); + regmap_exit(wm8995->regmap); + kfree(wm8995); return 0; } -- cgit v1.1 From d8c29e7f78a6c52fc5cfa956c4b72c797a468241 Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Thu, 10 Nov 2011 21:22:15 +0200 Subject: ASoC: Remove unused defines in alc5632 codec Signed-off-by: Leon Romanovsky Signed-off-by: Mark Brown --- sound/soc/codecs/alc5632.c | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index ee6a497..048c60e 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -964,27 +964,6 @@ static int alc5632_resume(struct snd_soc_codec *codec) return 0; } -#define ALC5632_REC_UNMUTE (ALC5632_ADC_REC_MIC2 \ - | ALC5632_ADC_REC_LINE_IN | ALC5632_ADC_REC_AUX \ - | ALC5632_ADC_REC_HP | ALC5632_ADC_REC_SPK \ - | ALC5632_ADC_REC_MONOMIX) - -#define ALC5632_MIC_ROUTE (ALC5632_MIC_ROUTE_HP \ - | ALC5632_MIC_ROUTE_SPK \ - | ALC5632_MIC_ROUTE_MONOMIX) - -#define ALC5632_PWR_DEFAULT (ALC5632_PWR_ADC_STATUS \ - | ALC5632_PWR_DAC_STATUS \ - | ALC5632_PWR_AMIX_STATUS \ - | ALC5632_PWR_VREF_STATUS) - -#define ALC5632_ADC_REC_GAIN_COMP(x) (int)((x - ALC5632_ADC_REC_GAIN_BASE) \ - / ALC5632_ADC_REC_GAIN_STEP) - -#define ALC5632_MIC_BOOST_COMP(x) (int)(x / ALC5632_MIC_BOOST_STEP) - -#define ALC5632_SPK_OUT_VOL_COMP(x) (int)(x / ALC5632_SPK_OUT_VOL_STEP) - static int alc5632_probe(struct snd_soc_codec *codec) { struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec); -- cgit v1.1 From 88c494b99a5873a46738c4c3f6f37ccce87b03e9 Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Thu, 10 Nov 2011 21:22:16 +0200 Subject: ASoC: Remove unnecessary backslash from alc5632 codec Signed-off-by: Leon Romanovsky Signed-off-by: Mark Brown --- sound/soc/codecs/alc5632.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index 048c60e..8a3bf71 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -811,7 +811,7 @@ static int alc5632_pcm_hw_params(struct snd_pcm_substream *substream, static int alc5632_mute(struct snd_soc_dai *dai, int mute) { struct snd_soc_codec *codec = dai->codec; - u16 hp_mute = ALC5632_MISC_HP_DEPOP_MUTE_L \ + u16 hp_mute = ALC5632_MISC_HP_DEPOP_MUTE_L |ALC5632_MISC_HP_DEPOP_MUTE_R; u16 mute_reg = snd_soc_read(codec, ALC5632_MISC_CTRL) & ~hp_mute; -- cgit v1.1 From ed2dd7da35cad3115c38fd42eecbecae899a1d7a Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 10 Nov 2011 16:21:01 -0800 Subject: ASoC: ak4642: add ak4642_set_bias_level() Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/codecs/ak4642.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index b854eb0..004a093 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -196,8 +196,8 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, snd_soc_update_bits(codec, MD_CTL3, BST1, BST1); snd_soc_write(codec, L_IVC, 0x91); /* volume */ snd_soc_write(codec, R_IVC, 0x91); /* volume */ - snd_soc_update_bits(codec, PW_MGMT1, PMVCM | PMMIN | PMDAC, - PMVCM | PMMIN | PMDAC); + snd_soc_update_bits(codec, PW_MGMT1, PMMIN | PMDAC, + PMMIN | PMDAC); snd_soc_update_bits(codec, PW_MGMT2, PMHP_MASK, PMHP); snd_soc_update_bits(codec, PW_MGMT2, HPMTN, HPMTN); } else { @@ -217,8 +217,7 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, snd_soc_write(codec, SG_SL1, PMMP | MGAIN0); snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3)); snd_soc_write(codec, ALC_CTL1, ALC | LMTH0); - snd_soc_update_bits(codec, PW_MGMT1, PMVCM | PMADL, - PMVCM | PMADL); + snd_soc_update_bits(codec, PW_MGMT1, PMADL, PMADL); snd_soc_update_bits(codec, PW_MGMT3, PMADR, PMADR); } @@ -376,6 +375,22 @@ static int ak4642_dai_hw_params(struct snd_pcm_substream *substream, return 0; } +static int ak4642_set_bias_level(struct snd_soc_codec *codec, + enum snd_soc_bias_level level) +{ + switch (level) { + case SND_SOC_BIAS_OFF: + snd_soc_write(codec, PW_MGMT1, 0x00); + break; + default: + snd_soc_update_bits(codec, PW_MGMT1, PMVCM, PMVCM); + break; + } + codec->dapm.bias_level = level; + + return 0; +} + static struct snd_soc_dai_ops ak4642_dai_ops = { .startup = ak4642_dai_startup, .shutdown = ak4642_dai_shutdown, @@ -425,12 +440,22 @@ static int ak4642_probe(struct snd_soc_codec *codec) snd_soc_add_controls(codec, ak4642_snd_controls, ARRAY_SIZE(ak4642_snd_controls)); + ak4642_set_bias_level(codec, SND_SOC_BIAS_STANDBY); + + return 0; +} + +static int ak4642_remove(struct snd_soc_codec *codec) +{ + ak4642_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; } static struct snd_soc_codec_driver soc_codec_dev_ak4642 = { .probe = ak4642_probe, + .remove = ak4642_remove, .resume = ak4642_resume, + .set_bias_level = ak4642_set_bias_level, .reg_cache_size = ARRAY_SIZE(ak4642_reg), .reg_word_size = sizeof(u8), .reg_cache_default = ak4642_reg, -- cgit v1.1 From 24747daea5610676fd1e2c2ca603c8822a085c87 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 10 Nov 2011 16:21:31 -0800 Subject: ASoC: ak4642: add DAPM support for HeadPhone Output Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/codecs/ak4642.c | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 004a093..da9caf0 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -152,6 +152,37 @@ static const struct snd_kcontrol_new ak4642_snd_controls[] = { 0, 0xFF, 1, out_tlv), }; +static const struct snd_kcontrol_new ak4642_hpout_mixer_controls[] = { + SOC_DAPM_SINGLE("DACH", MD_CTL4, 0, 1, 0), +}; + +static const struct snd_soc_dapm_widget ak4642_dapm_widgets[] = { + + /* Outputs */ + SND_SOC_DAPM_OUTPUT("HPOUTL"), + SND_SOC_DAPM_OUTPUT("HPOUTR"), + + SND_SOC_DAPM_MIXER("HPOUTL Mixer", PW_MGMT2, 5, 0, + &ak4642_hpout_mixer_controls[0], + ARRAY_SIZE(ak4642_hpout_mixer_controls)), + + SND_SOC_DAPM_MIXER("HPOUTR Mixer", PW_MGMT2, 4, 0, + &ak4642_hpout_mixer_controls[0], + ARRAY_SIZE(ak4642_hpout_mixer_controls)), + + /* DAC */ + SND_SOC_DAPM_DAC("DAC", "HiFi Playback", PW_MGMT1, 2, 0), +}; + +static const struct snd_soc_dapm_route ak4642_intercon[] = { + + /* Outputs */ + {"HPOUTL", NULL, "HPOUTL Mixer"}, + {"HPOUTR", NULL, "HPOUTR Mixer"}, + + {"HPOUTL Mixer", "DACH", "DAC"}, + {"HPOUTR Mixer", "DACH", "DAC"}, +}; /* codec private data */ struct ak4642_priv { @@ -192,13 +223,8 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, * This operation came from example code of * "ASAHI KASEI AK4642" (japanese) manual p97. */ - snd_soc_update_bits(codec, MD_CTL4, DACH, DACH); - snd_soc_update_bits(codec, MD_CTL3, BST1, BST1); snd_soc_write(codec, L_IVC, 0x91); /* volume */ snd_soc_write(codec, R_IVC, 0x91); /* volume */ - snd_soc_update_bits(codec, PW_MGMT1, PMMIN | PMDAC, - PMMIN | PMDAC); - snd_soc_update_bits(codec, PW_MGMT2, PMHP_MASK, PMHP); snd_soc_update_bits(codec, PW_MGMT2, HPMTN, HPMTN); } else { /* @@ -233,10 +259,6 @@ static void ak4642_dai_shutdown(struct snd_pcm_substream *substream, if (is_play) { /* stop headphone output */ snd_soc_update_bits(codec, PW_MGMT2, HPMTN, 0); - snd_soc_update_bits(codec, PW_MGMT2, PMHP_MASK, 0); - snd_soc_update_bits(codec, PW_MGMT1, PMMIN | PMDAC, 0); - snd_soc_update_bits(codec, MD_CTL3, BST1, 0); - snd_soc_update_bits(codec, MD_CTL4, DACH, 0); } else { /* stop stereo input */ snd_soc_update_bits(codec, PW_MGMT1, PMADL, 0); @@ -459,6 +481,10 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4642 = { .reg_cache_size = ARRAY_SIZE(ak4642_reg), .reg_word_size = sizeof(u8), .reg_cache_default = ak4642_reg, + .dapm_widgets = ak4642_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(ak4642_dapm_widgets), + .dapm_routes = ak4642_intercon, + .num_dapm_routes = ARRAY_SIZE(ak4642_intercon), }; #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) -- cgit v1.1 From 3c7035268c2c89942fe51a61833d1066b4a766eb Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 10 Nov 2011 16:21:42 -0800 Subject: ASoC: ak4642: add headphone mute switch control Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/codecs/ak4642.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index da9caf0..b2460c2 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -150,6 +150,8 @@ static const struct snd_kcontrol_new ak4642_snd_controls[] = { SOC_DOUBLE_R_TLV("Digital Playback Volume", L_DVC, R_DVC, 0, 0xFF, 1, out_tlv), + + SOC_SINGLE("Headphone Switch", PW_MGMT2, 6, 1, 0), }; static const struct snd_kcontrol_new ak4642_hpout_mixer_controls[] = { @@ -225,7 +227,6 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, */ snd_soc_write(codec, L_IVC, 0x91); /* volume */ snd_soc_write(codec, R_IVC, 0x91); /* volume */ - snd_soc_update_bits(codec, PW_MGMT2, HPMTN, HPMTN); } else { /* * start stereo input @@ -257,8 +258,6 @@ static void ak4642_dai_shutdown(struct snd_pcm_substream *substream, struct snd_soc_codec *codec = dai->codec; if (is_play) { - /* stop headphone output */ - snd_soc_update_bits(codec, PW_MGMT2, HPMTN, 0); } else { /* stop stereo input */ snd_soc_update_bits(codec, PW_MGMT1, PMADL, 0); -- cgit v1.1 From e8c83dbfb7fc0c3cec141112524906b029a1f413 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 10 Nov 2011 16:21:55 -0800 Subject: ASoC: ak4642: add Line out support Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/codecs/ak4642.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index b2460c2..daec5f7 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -158,11 +158,16 @@ static const struct snd_kcontrol_new ak4642_hpout_mixer_controls[] = { SOC_DAPM_SINGLE("DACH", MD_CTL4, 0, 1, 0), }; +static const struct snd_kcontrol_new ak4642_lout_mixer_controls[] = { + SOC_DAPM_SINGLE("DACL", SG_SL1, 4, 1, 0), +}; + static const struct snd_soc_dapm_widget ak4642_dapm_widgets[] = { /* Outputs */ SND_SOC_DAPM_OUTPUT("HPOUTL"), SND_SOC_DAPM_OUTPUT("HPOUTR"), + SND_SOC_DAPM_OUTPUT("LINEOUT"), SND_SOC_DAPM_MIXER("HPOUTL Mixer", PW_MGMT2, 5, 0, &ak4642_hpout_mixer_controls[0], @@ -172,6 +177,10 @@ static const struct snd_soc_dapm_widget ak4642_dapm_widgets[] = { &ak4642_hpout_mixer_controls[0], ARRAY_SIZE(ak4642_hpout_mixer_controls)), + SND_SOC_DAPM_MIXER("LINEOUT Mixer", PW_MGMT1, 3, 0, + &ak4642_lout_mixer_controls[0], + ARRAY_SIZE(ak4642_lout_mixer_controls)), + /* DAC */ SND_SOC_DAPM_DAC("DAC", "HiFi Playback", PW_MGMT1, 2, 0), }; @@ -181,9 +190,11 @@ static const struct snd_soc_dapm_route ak4642_intercon[] = { /* Outputs */ {"HPOUTL", NULL, "HPOUTL Mixer"}, {"HPOUTR", NULL, "HPOUTR Mixer"}, + {"LINEOUT", NULL, "LINEOUT Mixer"}, {"HPOUTL Mixer", "DACH", "DAC"}, {"HPOUTR Mixer", "DACH", "DAC"}, + {"LINEOUT Mixer", "DACL", "DAC"}, }; /* codec private data */ -- cgit v1.1 From a9317e8b6b53ab61d3ee764b6456596efd8c83b7 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 10 Nov 2011 16:22:05 -0800 Subject: ASoC: ak4642: add ak4648 support Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/codecs/ak4642.c | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index daec5f7..859e015 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -20,6 +20,7 @@ * * AK4642 is tested. * AK4643 is tested. + * AK4648 is tested. */ #include @@ -71,8 +72,6 @@ #define HP_MS 0x23 #define SPK_MS 0x24 -#define AK4642_CACHEREGNUM 0x25 - /* PW_MGMT1*/ #define PMVCM (1 << 6) /* VCOM Power Management */ #define PMMIN (1 << 5) /* MIN Input Power Management */ @@ -206,7 +205,7 @@ struct ak4642_priv { /* * ak4642 register cache */ -static const u8 ak4642_reg[AK4642_CACHEREGNUM] = { +static const u8 ak4642_reg[] = { 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0xe1, 0xe1, 0x18, 0x00, @@ -219,6 +218,19 @@ static const u8 ak4642_reg[AK4642_CACHEREGNUM] = { 0x00, }; +static const u8 ak4648_reg[] = { + 0x00, 0x00, 0x01, 0x00, + 0x02, 0x00, 0x00, 0x00, + 0xe1, 0xe1, 0x18, 0x00, + 0xe1, 0x18, 0x11, 0xb8, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x88, 0x88, 0x08, +}; + static int ak4642_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { @@ -488,9 +500,23 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4642 = { .remove = ak4642_remove, .resume = ak4642_resume, .set_bias_level = ak4642_set_bias_level, - .reg_cache_size = ARRAY_SIZE(ak4642_reg), + .reg_cache_default = ak4642_reg, /* ak4642 reg */ + .reg_cache_size = ARRAY_SIZE(ak4642_reg), /* ak4642 reg */ + .reg_word_size = sizeof(u8), + .dapm_widgets = ak4642_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(ak4642_dapm_widgets), + .dapm_routes = ak4642_intercon, + .num_dapm_routes = ARRAY_SIZE(ak4642_intercon), +}; + +static struct snd_soc_codec_driver soc_codec_dev_ak4648 = { + .probe = ak4642_probe, + .remove = ak4642_remove, + .resume = ak4642_resume, + .set_bias_level = ak4642_set_bias_level, + .reg_cache_default = ak4648_reg, /* ak4648 reg */ + .reg_cache_size = ARRAY_SIZE(ak4648_reg), /* ak4648 reg */ .reg_word_size = sizeof(u8), - .reg_cache_default = ak4642_reg, .dapm_widgets = ak4642_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(ak4642_dapm_widgets), .dapm_routes = ak4642_intercon, @@ -512,7 +538,8 @@ static __devinit int ak4642_i2c_probe(struct i2c_client *i2c, ak4642->control_type = SND_SOC_I2C; ret = snd_soc_register_codec(&i2c->dev, - &soc_codec_dev_ak4642, &ak4642_dai, 1); + (struct snd_soc_codec_driver *)id->driver_data, + &ak4642_dai, 1); if (ret < 0) kfree(ak4642); return ret; @@ -526,8 +553,9 @@ static __devexit int ak4642_i2c_remove(struct i2c_client *client) } static const struct i2c_device_id ak4642_i2c_id[] = { - { "ak4642", 0 }, - { "ak4643", 0 }, + { "ak4642", (kernel_ulong_t)&soc_codec_dev_ak4642 }, + { "ak4643", (kernel_ulong_t)&soc_codec_dev_ak4642 }, + { "ak4648", (kernel_ulong_t)&soc_codec_dev_ak4648 }, { } }; MODULE_DEVICE_TABLE(i2c, ak4642_i2c_id); -- cgit v1.1 From e29d377814b83af816fb8c1857605b9c4196477b Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 14 Nov 2011 17:13:23 +0100 Subject: ALSA: hda/realtek - Create mono volume controls for mono-outputs When the pin or the DAC doesn't support the stereo, create a mono control instead of creating a stereo control blindly. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 9fc2ba0..6f0f2f6 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3144,8 +3144,15 @@ static int alc_auto_add_vol_ctl(struct hda_codec *codec, val); } -#define alc_auto_add_stereo_vol(codec, pfx, cidx, nid) \ - alc_auto_add_vol_ctl(codec, pfx, cidx, nid, 3) +static int alc_auto_add_stereo_vol(struct hda_codec *codec, + const char *pfx, int cidx, + hda_nid_t nid) +{ + int chs = 1; + if (get_wcaps(codec, nid) & AC_WCAP_STEREO) + chs = 3; + return alc_auto_add_vol_ctl(codec, pfx, cidx, nid, chs); +} /* create a mute-switch for the given mixer widget; * if it has multiple sources (e.g. DAC and loopback), create a bind-mute @@ -3177,8 +3184,14 @@ static int alc_auto_add_sw_ctl(struct hda_codec *codec, return __add_pb_sw_ctrl(codec->spec, type, pfx, cidx, val); } -#define alc_auto_add_stereo_sw(codec, pfx, cidx, nid) \ - alc_auto_add_sw_ctl(codec, pfx, cidx, nid, 3) +static int alc_auto_add_stereo_sw(struct hda_codec *codec, const char *pfx, + int cidx, hda_nid_t nid) +{ + int chs = 1; + if (get_wcaps(codec, nid) & AC_WCAP_STEREO) + chs = 3; + return alc_auto_add_sw_ctl(codec, pfx, cidx, nid, chs); +} static hda_nid_t alc_look_for_out_mute_nid(struct hda_codec *codec, hda_nid_t pin, hda_nid_t dac) -- cgit v1.1 From 3ccbf1c3763510d5c443133f9aa40d8bf4ae8db9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 14 Nov 2011 17:20:49 +0100 Subject: ALSA: hda/realtek - Remove left-over chunks in alc882_quirks.c Remove unused variables. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 102 ------------------------------------------ 1 file changed, 102 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index c1f6ac6..403e30a 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -13,10 +13,6 @@ enum { ALC885_MACMINI3, ALC885_IMAC24, ALC885_IMAC91, - ALC888_ACER_ASPIRE_4930G, - ALC888_ACER_ASPIRE_6530G, - ALC888_ACER_ASPIRE_8930G, - ALC888_ACER_ASPIRE_7730G, ALC889A_MB31, ALC882_MODEL_LAST, }; @@ -43,15 +39,9 @@ static const hda_nid_t alc882_dac_nids[4] = { #define alc882_adc_nids alc880_adc_nids #define alc882_adc_nids_alt alc880_adc_nids_alt #define alc883_adc_nids alc882_adc_nids_alt -static const hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; -static const hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; -#define alc889_adc_nids alc880_adc_nids -static const hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; #define alc883_capsrc_nids alc882_capsrc_nids_alt -static const hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; -#define alc889_capsrc_nids alc882_capsrc_nids /* input MUX */ /* FIXME: should be a matrix-type input source selection */ @@ -68,15 +58,6 @@ static const struct hda_input_mux alc882_capture_source = { #define alc883_capture_source alc882_capture_source -static const struct hda_input_mux alc889_capture_source = { - .num_items = 3, - .items = { - { "Front Mic", 0x0 }, - { "Mic", 0x3 }, - { "Line", 0x2 }, - }, -}; - static const struct hda_input_mux mb5_capture_source = { .num_items = 3, .items = { @@ -123,58 +104,6 @@ static const struct hda_input_mux alc889A_imac91_capture_source = { }, }; -/* - * 2ch mode - */ -static const struct hda_channel_mode alc883_3ST_2ch_modes[1] = { - { 2, NULL } -}; - -/* - * 2ch mode - */ -static const struct hda_verb alc882_3ST_ch2_init[] = { - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { } /* end */ -}; - -/* - * 4ch mode - */ -static const struct hda_verb alc882_3ST_ch4_init[] = { - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, - { } /* end */ -}; - -/* - * 6ch mode - */ -static const struct hda_verb alc882_3ST_ch6_init[] = { - { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, - { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, - { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, - { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, - { } /* end */ -}; - -static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = { - { 2, alc882_3ST_ch2_init }, - { 4, alc882_3ST_ch4_init }, - { 6, alc882_3ST_ch6_init }, -}; - -#define alc883_3ST_6ch_modes alc882_3ST_6ch_modes - - /* Macbook Air 2,1 */ static const struct hda_channel_mode alc885_mba21_ch_modes[1] = { @@ -380,24 +309,6 @@ static const struct hda_verb alc882_base_init_verbs[] = { { } }; -static const struct hda_verb alc882_adc1_init_verbs[] = { - /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, - /* ADC1: mute amp left and right */ - {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, - { } -}; - -static const struct hda_verb alc889_eapd_verbs[] = { - {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, - {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, - { } -}; - #define alc883_init_verbs alc882_base_init_verbs /* Mac Pro test */ @@ -889,19 +800,6 @@ static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { { } /* end */ }; -static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - { } /* end */ -}; - static const struct snd_kcontrol_new alc889A_mb31_mixer[] = { /* Output mixers */ HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), -- cgit v1.1 From b25396994b90f69c5fc6d7cd448174d7eea69f14 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 14 Nov 2011 17:32:17 +0100 Subject: ALSA: hda/realtek - Re-add the model string selection for ALC88x In the commit [c3e837bb: ALSA: hda/realtek - Rewrite ALC882 acer-aspire-* models with the auto-parser], the check of the model option got removed mistakenly. Re-added the board_config check again. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6f0f2f6..41590e3 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4534,7 +4534,10 @@ static int patch_alc882(struct hda_codec *codec) if (err < 0) goto error; - board_config = alc_board_codec_sid_config(codec, + board_config = alc_board_config(codec, ALC882_MODEL_LAST, + alc882_models, NULL); + if (board_config < 0) + board_config = alc_board_codec_sid_config(codec, ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); if (board_config < 0) { -- cgit v1.1 From 5671087ffa80ea7fcc254c08de9697551fecedcf Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 14 Nov 2011 17:42:11 +0100 Subject: ALSA: hda/realtek - Move ALC885 macpro and imac24 models to auto-parser The ALC882 macpro and imac24 static configs can be transferred to the auto-parser with the additional GPIO setup. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc882_quirks.c | 174 ------------------------------------------ sound/pci/hda/patch_realtek.c | 57 +++++++++++++- 2 files changed, 56 insertions(+), 175 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c index 403e30a..bdf0ed4 100644 --- a/sound/pci/hda/alc882_quirks.c +++ b/sound/pci/hda/alc882_quirks.c @@ -6,12 +6,10 @@ /* ALC882 models */ enum { ALC882_AUTO, - ALC885_MACPRO, ALC885_MBA21, ALC885_MBP3, ALC885_MB5, ALC885_MACMINI3, - ALC885_IMAC24, ALC885_IMAC91, ALC889A_MB31, ALC882_MODEL_LAST, @@ -311,71 +309,6 @@ static const struct hda_verb alc882_base_init_verbs[] = { #define alc883_init_verbs alc882_base_init_verbs -/* Mac Pro test */ -static const struct snd_kcontrol_new alc882_macpro_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), - /* FIXME: this looks suspicious... - HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), - */ - { } /* end */ -}; - -static const struct hda_verb alc882_macpro_init_verbs[] = { - /* Front mixer: unmute input/output amp left and right (volume = 0) */ - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, - /* Front Pin: output 0 (0x0c) */ - {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* Front Mic pin: input vref at 80% */ - {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, - {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - /* Speaker: output */ - {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, - /* Headphone output (output 0 - 0x0c) */ - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, - - /* FIXME: use matrix-type input source selection */ - /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ - /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, - {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, - /* Input mixer2 */ - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, - {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, - /* Input mixer3 */ - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, - {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, - /* ADC1: mute amp left and right */ - {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* ADC2: mute amp left and right */ - {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* ADC3: mute amp left and right */ - {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, - {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, - - { } -}; - /* Macbook 5,1 */ static const struct hda_verb alc885_mb5_init_verbs[] = { /* DACs */ @@ -614,34 +547,6 @@ static const struct hda_verb alc885_imac91_init_verbs[] = { { } }; -/* iMac 24 mixer. */ -static const struct snd_kcontrol_new alc885_imac24_mixer[] = { - HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), - HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), - { } /* end */ -}; - -/* iMac 24 init verbs. */ -static const struct hda_verb alc885_imac24_init_verbs[] = { - /* Internal speakers: output 0 (0x0c) */ - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* Internal speakers: output 0 (0x0c) */ - {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, - /* Headphone: output 0 (0x0c) */ - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, - {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN}, - /* Front Mic: input vref at 80% */ - {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, - {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - { } -}; - /* Toggle speaker-output according to the hp-jack state */ static void alc885_imac24_setup(struct hda_codec *codec) { @@ -687,53 +592,6 @@ static void alc885_imac91_setup(struct hda_codec *codec) alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); } -/* toggle speaker-output according to the hp-jack state */ -static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) -{ - unsigned int gpiostate, gpiomask, gpiodir; - - gpiostate = snd_hda_codec_read(codec, codec->afg, 0, - AC_VERB_GET_GPIO_DATA, 0); - - if (!muted) - gpiostate |= (1 << pin); - else - gpiostate &= ~(1 << pin); - - gpiomask = snd_hda_codec_read(codec, codec->afg, 0, - AC_VERB_GET_GPIO_MASK, 0); - gpiomask |= (1 << pin); - - gpiodir = snd_hda_codec_read(codec, codec->afg, 0, - AC_VERB_GET_GPIO_DIRECTION, 0); - gpiodir |= (1 << pin); - - - snd_hda_codec_write(codec, codec->afg, 0, - AC_VERB_SET_GPIO_MASK, gpiomask); - snd_hda_codec_write(codec, codec->afg, 0, - AC_VERB_SET_GPIO_DIRECTION, gpiodir); - - msleep(1); - - snd_hda_codec_write(codec, codec->afg, 0, - AC_VERB_SET_GPIO_DATA, gpiostate); -} - -/* set up GPIO at initialization */ -static void alc885_macpro_init_hook(struct hda_codec *codec) -{ - alc882_gpio_mute(codec, 0, 0); - alc882_gpio_mute(codec, 1, 0); -} - -/* set up GPIO and update auto-muting at initialization */ -static void alc885_imac24_init_hook(struct hda_codec *codec) -{ - alc885_macpro_init_hook(codec); - alc_hp_automute(codec); -} - /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ static const struct hda_verb alc889A_mb31_ch2_init[] = { {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ @@ -876,12 +734,10 @@ static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) * configuration and preset */ static const char * const alc882_models[ALC882_MODEL_LAST] = { - [ALC885_MACPRO] = "macpro", [ALC885_MB5] = "mb5", [ALC885_MACMINI3] = "macmini3", [ALC885_MBA21] = "mba21", [ALC885_MBP3] = "mbp3", - [ALC885_IMAC24] = "imac24", [ALC885_IMAC91] = "imac91", [ALC889A_MB31] = "mb31", [ALC882_AUTO] = "auto", @@ -892,16 +748,12 @@ static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), - SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), - SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), - SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), - SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), @@ -973,32 +825,6 @@ static const struct alc_config_preset alc882_presets[] = { .setup = alc885_macmini3_setup, .init_hook = alc_hp_automute, }, - [ALC885_MACPRO] = { - .mixers = { alc882_macpro_mixer }, - .init_verbs = { alc882_macpro_init_verbs }, - .num_dacs = ARRAY_SIZE(alc882_dac_nids), - .dac_nids = alc882_dac_nids, - .dig_out_nid = ALC882_DIGOUT_NID, - .dig_in_nid = ALC882_DIGIN_NID, - .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), - .channel_mode = alc882_ch_modes, - .input_mux = &alc882_capture_source, - .init_hook = alc885_macpro_init_hook, - }, - [ALC885_IMAC24] = { - .mixers = { alc885_imac24_mixer }, - .init_verbs = { alc885_imac24_init_verbs }, - .num_dacs = ARRAY_SIZE(alc882_dac_nids), - .dac_nids = alc882_dac_nids, - .dig_out_nid = ALC882_DIGOUT_NID, - .dig_in_nid = ALC882_DIGIN_NID, - .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), - .channel_mode = alc882_ch_modes, - .input_mux = &alc882_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc885_imac24_setup, - .init_hook = alc885_imac24_init_hook, - }, [ALC885_IMAC91] = { .mixers = {alc885_imac91_mixer}, .init_verbs = { alc885_imac91_init_verbs, diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 41590e3..fb48085 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4296,6 +4296,7 @@ enum { ALC882_FIXUP_ACER_ASPIRE_4930G, ALC882_FIXUP_ACER_ASPIRE_8930G, ALC882_FIXUP_ASPIRE_8930G_VERBS, + ALC885_FIXUP_MACPRO_GPIO, }; static void alc889_fixup_coef(struct hda_codec *codec, @@ -4306,6 +4307,49 @@ static void alc889_fixup_coef(struct hda_codec *codec, alc889_coef_init(codec); } +/* toggle speaker-output according to the hp-jack state */ +static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) +{ + unsigned int gpiostate, gpiomask, gpiodir; + + gpiostate = snd_hda_codec_read(codec, codec->afg, 0, + AC_VERB_GET_GPIO_DATA, 0); + + if (!muted) + gpiostate |= (1 << pin); + else + gpiostate &= ~(1 << pin); + + gpiomask = snd_hda_codec_read(codec, codec->afg, 0, + AC_VERB_GET_GPIO_MASK, 0); + gpiomask |= (1 << pin); + + gpiodir = snd_hda_codec_read(codec, codec->afg, 0, + AC_VERB_GET_GPIO_DIRECTION, 0); + gpiodir |= (1 << pin); + + + snd_hda_codec_write(codec, codec->afg, 0, + AC_VERB_SET_GPIO_MASK, gpiomask); + snd_hda_codec_write(codec, codec->afg, 0, + AC_VERB_SET_GPIO_DIRECTION, gpiodir); + + msleep(1); + + snd_hda_codec_write(codec, codec->afg, 0, + AC_VERB_SET_GPIO_DATA, gpiostate); +} + +/* set up GPIO at initialization */ +static void alc885_fixup_macpro_gpio(struct hda_codec *codec, + const struct alc_fixup *fix, int action) +{ + if (action != ALC_FIXUP_ACT_INIT) + return; + alc882_gpio_mute(codec, 0, 0); + alc882_gpio_mute(codec, 1, 0); +} + static const struct alc_fixup alc882_fixups[] = { [ALC882_FIXUP_ABIT_AW9D_MAX] = { .type = ALC_FIXUP_PINS, @@ -4449,6 +4493,10 @@ static const struct alc_fixup alc882_fixups[] = { { } } }, + [ALC885_FIXUP_MACPRO_GPIO] = { + .type = ALC_FIXUP_FUNC, + .v.func = alc885_fixup_macpro_gpio, + }, }; static const struct snd_pci_quirk alc882_fixup_tbl[] = { @@ -4479,7 +4527,14 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), - SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), /* codec SSID */ + + /* All Apple entries are in codec SSIDs */ + SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_FIXUP_MACPRO_GPIO), + SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO), + SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO), + SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), + SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO), + SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), -- cgit v1.1 From e012ba249171a205c5735a76b947bdae9cf34c6e Mon Sep 17 00:00:00 2001 From: Johannes Stezenbach Date: Mon, 14 Nov 2011 17:23:17 +0100 Subject: ASoC: sta32x: add platform data definition Add a structure for platform specific configuration and use it, thereby removing a few FIXMEs which marked hard-coded values. Signed-off-by: Johannes Stezenbach Signed-off-by: Mark Brown --- sound/soc/codecs/sta32x.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index d2f3715..97091e3 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -35,6 +35,7 @@ #include #include +#include #include "sta32x.h" #define STA32X_RATES (SNDRV_PCM_RATE_32000 | \ @@ -73,6 +74,7 @@ static const char *sta32x_supply_names[] = { struct sta32x_priv { struct regulator_bulk_data supplies[ARRAY_SIZE(sta32x_supply_names)]; struct snd_soc_codec *codec; + struct sta32x_platform_data *pdata; unsigned int mclk; unsigned int format; @@ -775,9 +777,10 @@ static int sta32x_resume(struct snd_soc_codec *codec) static int sta32x_probe(struct snd_soc_codec *codec) { struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); - int i, ret = 0; + int i, ret = 0, thermal = 0; sta32x->codec = codec; + sta32x->pdata = dev_get_platdata(codec->dev); /* regulators */ for (i = 0; i < ARRAY_SIZE(sta32x->supplies); i++) @@ -820,25 +823,34 @@ static int sta32x_probe(struct snd_soc_codec *codec) snd_soc_cache_write(codec, STA32X_AUTO3, 0x00); snd_soc_cache_write(codec, STA32X_C3CFG, 0x40); - /* FIXME enable thermal warning adjustment and recovery */ + /* set thermal warning adjustment and recovery */ + if (!(sta32x->pdata->thermal_conf & STA32X_THERMAL_ADJUSTMENT_ENABLE)) + thermal |= STA32X_CONFA_TWAB; + if (!(sta32x->pdata->thermal_conf & STA32X_THERMAL_RECOVERY_ENABLE)) + thermal |= STA32X_CONFA_TWRB; snd_soc_update_bits(codec, STA32X_CONFA, - STA32X_CONFA_TWAB | STA32X_CONFA_TWRB, 0); + STA32X_CONFA_TWAB | STA32X_CONFA_TWRB, + thermal); - /* FIXME select 2.1 mode */ + /* select output configuration */ snd_soc_update_bits(codec, STA32X_CONFF, STA32X_CONFF_OCFG_MASK, - 1 << STA32X_CONFF_OCFG_SHIFT); + sta32x->pdata->output_conf + << STA32X_CONFF_OCFG_SHIFT); - /* FIXME channel to output mapping */ + /* channel to output mapping */ snd_soc_update_bits(codec, STA32X_C1CFG, STA32X_CxCFG_OM_MASK, - 0 << STA32X_CxCFG_OM_SHIFT); + sta32x->pdata->ch1_output_mapping + << STA32X_CxCFG_OM_SHIFT); snd_soc_update_bits(codec, STA32X_C2CFG, STA32X_CxCFG_OM_MASK, - 1 << STA32X_CxCFG_OM_SHIFT); + sta32x->pdata->ch2_output_mapping + << STA32X_CxCFG_OM_SHIFT); snd_soc_update_bits(codec, STA32X_C3CFG, STA32X_CxCFG_OM_MASK, - 2 << STA32X_CxCFG_OM_SHIFT); + sta32x->pdata->ch3_output_mapping + << STA32X_CxCFG_OM_SHIFT); /* initialize coefficient shadow RAM with reset values */ for (i = 4; i <= 49; i += 5) -- cgit v1.1 From 3fb5eac50d66cab4a41177269432ffffcc3e67ac Mon Sep 17 00:00:00 2001 From: Johannes Stezenbach Date: Mon, 14 Nov 2011 17:23:18 +0100 Subject: ASoC: sta32x: add workaround for ESD reset issue sta32x resets and loses all configuration during ESD test. Work around by polling the CONFA register once a second and restore all coeffcients and registers when CONFA changes unexpectedly. Signed-off-by: Johannes Stezenbach Signed-off-by: Mark Brown --- sound/soc/codecs/sta32x.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index 97091e3..3b0deaf 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -80,6 +81,8 @@ struct sta32x_priv { unsigned int format; u32 coef_shadow[STA32X_COEF_COUNT]; + struct delayed_work watchdog_work; + int shutdown; }; static const DECLARE_TLV_DB_SCALE(mvol_tlv, -12700, 50, 1); @@ -304,6 +307,46 @@ int sta32x_cache_sync(struct snd_soc_codec *codec) return rc; } +/* work around ESD issue where sta32x resets and loses all configuration */ +static void sta32x_watchdog(struct work_struct *work) +{ + struct sta32x_priv *sta32x = container_of(work, struct sta32x_priv, + watchdog_work.work); + struct snd_soc_codec *codec = sta32x->codec; + unsigned int confa, confa_cached; + + /* check if sta32x has reset itself */ + confa_cached = snd_soc_read(codec, STA32X_CONFA); + codec->cache_bypass = 1; + confa = snd_soc_read(codec, STA32X_CONFA); + codec->cache_bypass = 0; + if (confa != confa_cached) { + codec->cache_sync = 1; + sta32x_cache_sync(codec); + } + + if (!sta32x->shutdown) + schedule_delayed_work(&sta32x->watchdog_work, + round_jiffies_relative(HZ)); +} + +static void sta32x_watchdog_start(struct sta32x_priv *sta32x) +{ + if (sta32x->pdata->needs_esd_watchdog) { + sta32x->shutdown = 0; + schedule_delayed_work(&sta32x->watchdog_work, + round_jiffies_relative(HZ)); + } +} + +static void sta32x_watchdog_stop(struct sta32x_priv *sta32x) +{ + if (sta32x->pdata->needs_esd_watchdog) { + sta32x->shutdown = 1; + cancel_delayed_work_sync(&sta32x->watchdog_work); + } +} + #define SINGLE_COEF(xname, index) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ .info = sta32x_coefficient_info, \ @@ -714,6 +757,7 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec, } sta32x_cache_sync(codec); + sta32x_watchdog_start(sta32x); } /* Power up to mute */ @@ -730,7 +774,7 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec, STA32X_CONFF_PWDN | STA32X_CONFF_EAPD, STA32X_CONFF_PWDN); msleep(300); - + sta32x_watchdog_stop(sta32x); regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); break; @@ -863,6 +907,9 @@ static int sta32x_probe(struct snd_soc_codec *codec) sta32x->coef_shadow[60] = 0x400000; sta32x->coef_shadow[61] = 0x400000; + if (sta32x->pdata->needs_esd_watchdog) + INIT_DELAYED_WORK(&sta32x->watchdog_work, sta32x_watchdog); + sta32x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); /* Bias level configuration will have done an extra enable */ regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); @@ -879,6 +926,7 @@ static int sta32x_remove(struct snd_soc_codec *codec) { struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); + sta32x_watchdog_stop(sta32x); sta32x_set_bias_level(codec, SND_SOC_BIAS_OFF); regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); regulator_bulk_free(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); -- cgit v1.1 From 6662ff5c3b8efe8c107118d9506ad65daf3e3a1b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sun, 13 Nov 2011 11:56:28 +0800 Subject: ASoC: Remove unused control_data and mutex fields from struct alc5632_priv Signed-off-by: Axel Lin Acked-off-by: Leon Romanovsky Signed-off-by: Mark Brown --- sound/soc/codecs/alc5632.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index 8a3bf71..07e958a 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -68,8 +68,6 @@ static const u16 alc5632_reg_defaults[] = { /* codec private data */ struct alc5632_priv { enum snd_soc_control_type control_type; - void *control_data; - struct mutex mutex; u8 id; unsigned int sysclk; }; @@ -1071,9 +1069,7 @@ static int alc5632_i2c_probe(struct i2c_client *client, } i2c_set_clientdata(client, alc5632); - alc5632->control_data = client; alc5632->control_type = SND_SOC_I2C; - mutex_init(&alc5632->mutex); ret = snd_soc_register_codec(&client->dev, &soc_codec_device_alc5632, &alc5632_dai, 1); -- cgit v1.1 From ee3b29693cb56b36fa4913b9a573d6c233bb8f03 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 15 Nov 2011 14:26:54 +0100 Subject: ALSA: hda/realtek - Move ALC880 model=medion-rim to auto-parser Translate ALC880 medion-rim static configs to the auto-parser with the additional GPIO2 verb and COEF setup. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc880_quirks.c | 90 ------------------------------------------- sound/pci/hda/patch_realtek.c | 38 ++++++++++++++++++ 2 files changed, 38 insertions(+), 90 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc880_quirks.c b/sound/pci/hda/alc880_quirks.c index bea22ed..dffa7a9 100644 --- a/sound/pci/hda/alc880_quirks.c +++ b/sound/pci/hda/alc880_quirks.c @@ -27,7 +27,6 @@ enum { ALC880_TCL_S700, ALC880_LG, ALC880_LG_LW, - ALC880_MEDION_RIM, #ifdef CONFIG_SND_DEBUG ALC880_TEST, #endif @@ -1137,78 +1136,6 @@ static void alc880_lg_lw_setup(struct hda_codec *codec) alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); } -static const struct snd_kcontrol_new alc880_medion_rim_mixer[] = { - HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), - HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), - { } /* end */ -}; - -static const struct hda_input_mux alc880_medion_rim_capture_source = { - .num_items = 2, - .items = { - { "Mic", 0x0 }, - { "Internal Mic", 0x1 }, - }, -}; - -static const struct hda_verb alc880_medion_rim_init_verbs[] = { - {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ - - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - - /* Mic1 (rear panel) pin widget for input and vref at 80% */ - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, - {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - /* Mic2 (as headphone out) for HP output */ - {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, - /* Internal Speaker */ - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, - {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - - {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, - {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, - - {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, - { } -}; - -/* toggle speaker-output according to the hp-jack state */ -static void alc880_medion_rim_automute(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - alc_hp_automute(codec); - /* toggle EAPD */ - if (spec->hp_jack_present) - snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); - else - snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); -} - -static void alc880_medion_rim_unsol_event(struct hda_codec *codec, - unsigned int res) -{ - /* Looks like the unsol event is incompatible with the standard - * definition. 4bit tag is placed at 28 bit! - */ - if ((res >> 28) == ALC_HP_EVENT) - alc880_medion_rim_automute(codec); -} - -static void alc880_medion_rim_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x14; - spec->autocfg.speaker_pins[0] = 0x1b; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - #ifdef CONFIG_SND_HDA_POWER_SAVE static const struct hda_amp_list alc880_lg_loopbacks[] = { { 0x0b, HDA_INPUT, 1 }, @@ -1506,7 +1433,6 @@ static const char * const alc880_models[ALC880_MODEL_LAST] = { [ALC880_F1734] = "F1734", [ALC880_LG] = "lg", [ALC880_LG_LW] = "lg-lw", - [ALC880_MEDION_RIM] = "medion", #ifdef CONFIG_SND_DEBUG [ALC880_TEST] = "test", #endif @@ -1557,7 +1483,6 @@ static const struct snd_pci_quirk alc880_cfg_tbl[] = { SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), - SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), @@ -1862,21 +1787,6 @@ static const struct alc_config_preset alc880_presets[] = { .setup = alc880_lg_lw_setup, .init_hook = alc_hp_automute, }, - [ALC880_MEDION_RIM] = { - .mixers = { alc880_medion_rim_mixer }, - .init_verbs = { alc880_volume_init_verbs, - alc880_medion_rim_init_verbs, - alc_gpio2_init_verbs }, - .num_dacs = ARRAY_SIZE(alc880_dac_nids), - .dac_nids = alc880_dac_nids, - .dig_out_nid = ALC880_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), - .channel_mode = alc880_2_jack_modes, - .input_mux = &alc880_medion_rim_capture_source, - .unsol_event = alc880_medion_rim_unsol_event, - .setup = alc880_medion_rim_setup, - .init_hook = alc880_medion_rim_automute, - }, #ifdef CONFIG_SND_DEBUG [ALC880_TEST] = { .mixers = { alc880_test_mixer }, diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index fb48085..8d1b27b 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4035,6 +4035,37 @@ static const struct hda_amp_list alc880_loopbacks[] = { #endif /* + * ALC880 fix-ups + */ +enum { + ALC880_FIXUP_GPIO2, + ALC880_FIXUP_MEDION_RIM, +}; + +static const struct alc_fixup alc880_fixups[] = { + [ALC880_FIXUP_GPIO2] = { + .type = ALC_FIXUP_VERBS, + .v.verbs = alc_gpio2_init_verbs, + }, + [ALC880_FIXUP_MEDION_RIM] = { + .type = ALC_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { + { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 }, + { } + }, + .chained = true, + .chain_id = ALC880_FIXUP_GPIO2, + }, +}; + +static const struct snd_pci_quirk alc880_fixup_tbl[] = { + SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM), + {} +}; + + +/* * board setups */ #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS @@ -4080,6 +4111,11 @@ static int patch_alc880(struct hda_codec *codec) } if (board_config == ALC_MODEL_AUTO) { + alc_pick_fixup(codec, NULL, alc880_fixup_tbl, alc880_fixups); + alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); + } + + if (board_config == ALC_MODEL_AUTO) { /* automatic parse from the BIOS config */ err = alc880_parse_auto_config(codec); if (err < 0) @@ -4113,6 +4149,8 @@ static int patch_alc880(struct hda_codec *codec) set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); } + alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); + spec->vmaster_nid = 0x0c; codec->patch_ops = alc_patch_ops; -- cgit v1.1 From 19723079db3ef1769803e05293314461ba81dede Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 15 Nov 2011 14:46:25 +0100 Subject: ALSA: hda/realtek - Move ALC880 model=lg-lw to auto-parser ALC880 model=lg-lw works fine with the auto-parser as is. Signed-off-by: Takashi Iwai --- sound/pci/hda/alc880_quirks.c | 103 ------------------------------------------ 1 file changed, 103 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/alc880_quirks.c b/sound/pci/hda/alc880_quirks.c index dffa7a9..5b68435 100644 --- a/sound/pci/hda/alc880_quirks.c +++ b/sound/pci/hda/alc880_quirks.c @@ -26,7 +26,6 @@ enum { ALC880_CLEVO, ALC880_TCL_S700, ALC880_LG, - ALC880_LG_LW, #ifdef CONFIG_SND_DEBUG ALC880_TEST, #endif @@ -1051,91 +1050,6 @@ static void alc880_lg_setup(struct hda_codec *codec) alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); } -/* - * LG LW20 - * - * Pin assignment: - * Speaker-out: 0x14 - * Mic-In: 0x18 - * Built-in Mic-In: 0x19 - * Line-In: 0x1b - * HP-Out: 0x1a - * SPDIF-Out: 0x1e - */ - -static const struct hda_input_mux alc880_lg_lw_capture_source = { - .num_items = 3, - .items = { - { "Mic", 0x0 }, - { "Internal Mic", 0x1 }, - { "Line In", 0x2 }, - }, -}; - -#define alc880_lg_lw_modes alc880_threestack_modes - -static const struct snd_kcontrol_new alc880_lg_lw_mixer[] = { - HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), - HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), - HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), - HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), - HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), - HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), - HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), - HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), - HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), - { - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, - .name = "Channel Mode", - .info = alc_ch_mode_info, - .get = alc_ch_mode_get, - .put = alc_ch_mode_put, - }, - { } /* end */ -}; - -static const struct hda_verb alc880_lg_lw_init_verbs[] = { - {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ - {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ - {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ - - /* set capture source to mic-in */ - {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, - /* speaker-out */ - {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - /* HP-out */ - {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, - {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - /* mic-in to input */ - {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, - {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - /* built-in mic */ - {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, - {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, - /* jack sense */ - {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, - { } -}; - -/* toggle speaker-output according to the hp-jack state */ -static void alc880_lg_lw_setup(struct hda_codec *codec) -{ - struct alc_spec *spec = codec->spec; - - spec->autocfg.hp_pins[0] = 0x1b; - spec->autocfg.speaker_pins[0] = 0x14; - alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); -} - #ifdef CONFIG_SND_HDA_POWER_SAVE static const struct hda_amp_list alc880_lg_loopbacks[] = { { 0x0b, HDA_INPUT, 1 }, @@ -1432,7 +1346,6 @@ static const char * const alc880_models[ALC880_MODEL_LAST] = { [ALC880_FUJITSU] = "fujitsu", [ALC880_F1734] = "F1734", [ALC880_LG] = "lg", - [ALC880_LG_LW] = "lg-lw", #ifdef CONFIG_SND_DEBUG [ALC880_TEST] = "test", #endif @@ -1489,11 +1402,9 @@ static const struct snd_pci_quirk alc880_cfg_tbl[] = { SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), - SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), - SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), @@ -1773,20 +1684,6 @@ static const struct alc_config_preset alc880_presets[] = { .loopbacks = alc880_lg_loopbacks, #endif }, - [ALC880_LG_LW] = { - .mixers = { alc880_lg_lw_mixer }, - .init_verbs = { alc880_volume_init_verbs, - alc880_lg_lw_init_verbs }, - .num_dacs = ARRAY_SIZE(alc880_dac_nids), - .dac_nids = alc880_dac_nids, - .dig_out_nid = ALC880_DIGOUT_NID, - .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), - .channel_mode = alc880_lg_lw_modes, - .input_mux = &alc880_lg_lw_capture_source, - .unsol_event = alc_sku_unsol_event, - .setup = alc880_lg_lw_setup, - .init_hook = alc_hp_automute, - }, #ifdef CONFIG_SND_DEBUG [ALC880_TEST] = { .mixers = { alc880_test_mixer }, -- cgit v1.1 From 04f5ade6afc4326dc6cd10d235500972fba548eb Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 27 Oct 2011 20:47:07 +0200 Subject: ALSA: hda - Introduce snd_hda_get_pin_label() Create a new helper function snd_hda_get_pin_label() for getting a label string for both input and output pins. hda_get_input_pin_label() is obsoleted by this function, and the callers are replaced appropriately now by this patch. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 63 ++++++++++++++++++++++++++++++++++++++++-- sound/pci/hda/hda_local.h | 4 +-- sound/pci/hda/patch_ca0110.c | 2 +- sound/pci/hda/patch_cirrus.c | 2 +- sound/pci/hda/patch_sigmatel.c | 4 +-- 5 files changed, 66 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index e44b107..c6ff9b9 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -5004,8 +5004,8 @@ EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_attr); * "Rear", "Internal". */ -const char *hda_get_input_pin_label(struct hda_codec *codec, hda_nid_t pin, - int check_location) +static const char *hda_get_input_pin_label(struct hda_codec *codec, + hda_nid_t pin, bool check_location) { unsigned int def_conf; static const char * const mic_names[] = { @@ -5044,7 +5044,6 @@ const char *hda_get_input_pin_label(struct hda_codec *codec, hda_nid_t pin, return "Misc"; } } -EXPORT_SYMBOL_HDA(hda_get_input_pin_label); /* Check whether the location prefix needs to be added to the label. * If all mic-jacks are in the same location (e.g. rear panel), we don't @@ -5102,6 +5101,64 @@ const char *hda_get_autocfg_input_label(struct hda_codec *codec, EXPORT_SYMBOL_HDA(hda_get_autocfg_input_label); /** + * snd_hda_get_pin_label - Get a label for the given I/O pin + * + * Get a label for the given pin. This function works for both input and + * output pins. When @cfg is given as non-NULL, the function tries to get + * an optimized label using hda_get_autocfg_input_label(). + */ +const char *snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, + const struct auto_pin_cfg *cfg) +{ + unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); + int attr; + int i; + + if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) + return NULL; + + attr = snd_hda_get_input_pin_attr(def_conf); + switch (get_defcfg_device(def_conf)) { + case AC_JACK_LINE_OUT: + switch (attr) { + case INPUT_PIN_ATTR_INT: + return "Speaker"; + case INPUT_PIN_ATTR_DOCK: + return "Dock Line-Out"; + case INPUT_PIN_ATTR_FRONT: + return "Front Line-Out"; + default: + return "Line-Out"; + } + case AC_JACK_SPEAKER: + return "Speaker"; + case AC_JACK_HP_OUT: + switch (attr) { + case INPUT_PIN_ATTR_DOCK: + return "Dock Headphone"; + case INPUT_PIN_ATTR_FRONT: + return "Front Headphone"; + default: + return "Headphone"; + } + case AC_JACK_SPDIF_OUT: + case AC_JACK_DIG_OTHER_OUT: + if (get_defcfg_location(def_conf) == AC_JACK_LOC_HDMI) + return "HDMI"; + else + return "SPDIF"; + } + + if (cfg) { + for (i = 0; i < cfg->num_inputs; i++) + if (cfg->inputs[i].pin == nid) + return hda_get_autocfg_input_label(codec, cfg, i); + } + return hda_get_input_pin_label(codec, nid, true); +} +EXPORT_SYMBOL_HDA(snd_hda_get_pin_label); + +/** * snd_hda_add_imux_item - Add an item to input_mux * * When the same label is used already in the existing items, the number diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 618ddad..7a10fe9 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -394,11 +394,11 @@ struct auto_pin_cfg_item { }; struct auto_pin_cfg; -const char *hda_get_input_pin_label(struct hda_codec *codec, hda_nid_t pin, - int check_location); const char *hda_get_autocfg_input_label(struct hda_codec *codec, const struct auto_pin_cfg *cfg, int input); +const char *snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, + const struct auto_pin_cfg *cfg); int snd_hda_add_imux_item(struct hda_input_mux *imux, const char *label, int index, int *type_index_ret); diff --git a/sound/pci/hda/patch_ca0110.c b/sound/pci/hda/patch_ca0110.c index 993757b..6bd602b 100644 --- a/sound/pci/hda/patch_ca0110.c +++ b/sound/pci/hda/patch_ca0110.c @@ -476,7 +476,7 @@ static void parse_input(struct hda_codec *codec) if (j >= cfg->num_inputs) continue; spec->input_pins[n] = pin; - spec->input_labels[n] = hda_get_input_pin_label(codec, pin, 1); + spec->input_labels[n] = snd_hda_get_pin_label(codec, pin, NULL); spec->adcs[n] = nid; n++; } diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 2a2d864..34a460b 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c @@ -711,7 +711,7 @@ static int cs_capture_source_info(struct snd_kcontrol *kcontrol, uinfo->value.enumerated.item = spec->num_inputs - 1; idx = spec->input_idx[uinfo->value.enumerated.item]; strcpy(uinfo->value.enumerated.name, - hda_get_input_pin_label(codec, cfg->inputs[idx].pin, 1)); + snd_hda_get_pin_label(codec, cfg->inputs[idx].pin, NULL)); return 0; } diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 470f6f2..3b4ef0c 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2872,7 +2872,7 @@ static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec, } if (control) { - strcpy(name, hda_get_input_pin_label(codec, nid, 1)); + strcpy(name, snd_hda_get_pin_label(codec, nid, NULL)); return stac92xx_add_control(codec->spec, control, strcat(name, " Jack Mode"), nid); } @@ -3563,7 +3563,7 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, if (index < 0) continue; - label = hda_get_input_pin_label(codec, nid, 1); + label = snd_hda_get_pin_label(codec, nid, NULL); snd_hda_add_imux_item(dimux, label, index, &type_idx); if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) snd_hda_add_imux_item(imux, label, index, &type_idx); -- cgit v1.1 From 1835a0f9a2121ce3198dab67507d4d3e960cc09e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 27 Oct 2011 22:12:46 +0200 Subject: ALSA: hda - Cache the jack-detection value Introduce a table containing the pins and their jack-detection states for avoiding the unnecessary verbs to check the pin status at each time. When the unsol event is enabled via snd_hda_jack_detect_enable(), it automatically adds the given NID to the table. Then the driver supposes that the codec driver will set the dirty flag appropariately when an unsolicited event is invoked for that pin. The behavior for reading other pins that aren't registered in the table doesn't change. Only the pins assigned to the table are cached, so far. In near futre, this table can be extended to use the central place for the unsolicited events of all pins, etc, and eventually include the jack-detect kcontrols that replace the current input-jack stuff. Signed-off-by: Takashi Iwai --- sound/pci/hda/Makefile | 2 +- sound/pci/hda/hda_codec.c | 40 +---------- sound/pci/hda/hda_codec.h | 3 + sound/pci/hda/hda_jack.c | 148 +++++++++++++++++++++++++++++++++++++++++ sound/pci/hda/hda_jack.h | 63 ++++++++++++++++++ sound/pci/hda/hda_local.h | 15 ----- sound/pci/hda/patch_analog.c | 1 + sound/pci/hda/patch_cirrus.c | 18 +++-- sound/pci/hda/patch_conexant.c | 20 +++--- sound/pci/hda/patch_hdmi.c | 6 +- sound/pci/hda/patch_realtek.c | 20 +++--- sound/pci/hda/patch_sigmatel.c | 46 +++++++------ sound/pci/hda/patch_via.c | 19 +++--- 13 files changed, 284 insertions(+), 117 deletions(-) create mode 100644 sound/pci/hda/hda_jack.c create mode 100644 sound/pci/hda/hda_jack.h (limited to 'sound') diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile index f928d66..ace157c 100644 --- a/sound/pci/hda/Makefile +++ b/sound/pci/hda/Makefile @@ -1,6 +1,6 @@ snd-hda-intel-objs := hda_intel.o -snd-hda-codec-y := hda_codec.o +snd-hda-codec-y := hda_codec.o hda_jack.o snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index c6ff9b9..8217ff7 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -33,6 +33,7 @@ #include #include "hda_local.h" #include "hda_beep.h" +#include "hda_jack.h" #include #define CREATE_TRACE_POINTS @@ -1723,43 +1724,6 @@ int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid, } EXPORT_SYMBOL_HDA(snd_hda_override_pin_caps); -/** - * snd_hda_pin_sense - execute pin sense measurement - * @codec: the CODEC to sense - * @nid: the pin NID to sense - * - * Execute necessary pin sense measurement and return its Presence Detect, - * Impedance, ELD Valid etc. status bits. - */ -u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) -{ - u32 pincap; - - if (!codec->no_trigger_sense) { - pincap = snd_hda_query_pin_caps(codec, nid); - if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ - snd_hda_codec_read(codec, nid, 0, - AC_VERB_SET_PIN_SENSE, 0); - } - return snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_PIN_SENSE, 0); -} -EXPORT_SYMBOL_HDA(snd_hda_pin_sense); - -/** - * snd_hda_jack_detect - query pin Presence Detect status - * @codec: the CODEC to sense - * @nid: the pin NID to sense - * - * Query and return the pin's Presence Detect status. - */ -int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) -{ - u32 sense = snd_hda_pin_sense(codec, nid); - return !!(sense & AC_PINSENSE_PRESENCE); -} -EXPORT_SYMBOL_HDA(snd_hda_jack_detect); - /* * read the current volume to info * if the cache exists, read the cache value. @@ -2308,6 +2272,7 @@ int snd_hda_codec_reset(struct hda_codec *codec) } if (codec->patch_ops.free) codec->patch_ops.free(codec); + snd_hda_jack_tbl_clear(codec); codec->proc_widget_hook = NULL; codec->spec = NULL; free_hda_cache(&codec->amp_cache); @@ -3364,6 +3329,7 @@ static void hda_call_codec_resume(struct hda_codec *codec) restore_pincfgs(codec); /* restore all current pin configs */ restore_shutup_pins(codec); hda_exec_init_verbs(codec); + snd_hda_jack_set_dirty_all(codec); if (codec->patch_ops.resume) codec->patch_ops.resume(codec); else { diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 5644711..97aa65d 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -869,6 +869,9 @@ struct hda_codec { void (*proc_widget_hook)(struct snd_info_buffer *buffer, struct hda_codec *codec, hda_nid_t nid); + /* jack detection */ + struct snd_array jacktbl; + #ifdef CONFIG_SND_HDA_INPUT_JACK /* jack detection */ struct snd_array jacks; diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c new file mode 100644 index 0000000..64b78a2 --- /dev/null +++ b/sound/pci/hda/hda_jack.c @@ -0,0 +1,148 @@ +/* + * Jack-detection handling for HD-audio + * + * Copyright (c) 2011 Takashi Iwai + * + * This driver is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include +#include +#include +#include "hda_codec.h" +#include "hda_local.h" +#include "hda_jack.h" + +/* execute pin sense measurement */ +static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid) +{ + u32 pincap; + + if (!codec->no_trigger_sense) { + pincap = snd_hda_query_pin_caps(codec, nid); + if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ + snd_hda_codec_read(codec, nid, 0, + AC_VERB_SET_PIN_SENSE, 0); + } + return snd_hda_codec_read(codec, nid, 0, + AC_VERB_GET_PIN_SENSE, 0); +} + +/** + * snd_hda_jack_tbl_get - query the jack-table entry for the given NID + */ +struct hda_jack_tbl * +snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid) +{ + struct hda_jack_tbl *jack = codec->jacktbl.list; + int i; + + if (!nid || !jack) + return NULL; + for (i = 0; i < codec->jacktbl.used; i++, jack++) + if (jack->nid == nid) + return jack; + return NULL; +} +EXPORT_SYMBOL_HDA(snd_hda_jack_tbl_get); + +/** + * snd_hda_jack_tbl_new - create a jack-table entry for the given NID + */ +struct hda_jack_tbl * +snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid) +{ + struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); + if (jack) + return jack; + snd_array_init(&codec->jacktbl, sizeof(*jack), 16); + jack = snd_array_new(&codec->jacktbl); + if (!jack) + return NULL; + jack->nid = nid; + jack->jack_dirty = 1; + return jack; +} + +void snd_hda_jack_tbl_clear(struct hda_codec *codec) +{ + snd_array_free(&codec->jacktbl); +} + +/* update the cached value and notification flag if needed */ +static void jack_detect_update(struct hda_codec *codec, + struct hda_jack_tbl *jack) +{ + if (jack->jack_dirty) { + jack->pin_sense = read_pin_sense(codec, jack->nid); + jack->jack_dirty = 0; + } +} + +/** + * snd_hda_set_dirty_all - Mark all the cached as dirty + * + * This function sets the dirty flag to all entries of jack table. + * It's called from the resume path in hda_codec.c. + */ +void snd_hda_jack_set_dirty_all(struct hda_codec *codec) +{ + struct hda_jack_tbl *jack = codec->jacktbl.list; + int i; + + for (i = 0; i < codec->jacktbl.used; i++, jack++) + if (jack->nid) + jack->jack_dirty = 1; +} +EXPORT_SYMBOL_HDA(snd_hda_jack_set_dirty_all); + +/** + * snd_hda_pin_sense - execute pin sense measurement + * @codec: the CODEC to sense + * @nid: the pin NID to sense + * + * Execute necessary pin sense measurement and return its Presence Detect, + * Impedance, ELD Valid etc. status bits. + */ +u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) +{ + struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); + if (jack) { + jack_detect_update(codec, jack); + return jack->pin_sense; + } + return read_pin_sense(codec, nid); +} +EXPORT_SYMBOL_HDA(snd_hda_pin_sense); + +/** + * snd_hda_jack_detect - query pin Presence Detect status + * @codec: the CODEC to sense + * @nid: the pin NID to sense + * + * Query and return the pin's Presence Detect status. + */ +int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) +{ + u32 sense = snd_hda_pin_sense(codec, nid); + return !!(sense & AC_PINSENSE_PRESENCE); +} +EXPORT_SYMBOL_HDA(snd_hda_jack_detect); + +/** + * snd_hda_jack_detect_enable - enable the jack-detection + */ +int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, + unsigned int tag) +{ + struct hda_jack_tbl *jack = snd_hda_jack_tbl_new(codec, nid); + if (!jack) + return -ENOMEM; + return snd_hda_codec_write_cache(codec, nid, 0, + AC_VERB_SET_UNSOLICITED_ENABLE, + AC_USRSP_EN | tag); +} +EXPORT_SYMBOL_HDA(snd_hda_jack_detect_enable); diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h new file mode 100644 index 0000000..5c1bcb8 --- /dev/null +++ b/sound/pci/hda/hda_jack.h @@ -0,0 +1,63 @@ +/* + * Jack-detection handling for HD-audio + * + * Copyright (c) 2011 Takashi Iwai + * + * This driver is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef __SOUND_HDA_JACK_H +#define __SOUND_HDA_JACK_H + +struct hda_jack_tbl { + hda_nid_t nid; + unsigned int pin_sense; /* cached pin-sense value */ + unsigned int jack_dirty:1; /* needs to update? */ +}; + +struct hda_jack_tbl * +snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid); + +struct hda_jack_tbl * +snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid); +void snd_hda_jack_tbl_clear(struct hda_codec *codec); + +/** + * snd_hda_jack_set_dirty - set the dirty flag for the given jack-entry + * + * Call this function when a pin-state may change, e.g. when the hardware + * notifies via an unsolicited event. + */ +static inline void snd_hda_jack_set_dirty(struct hda_codec *codec, + hda_nid_t nid) +{ + struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); + if (jack) + jack->jack_dirty = 1; +} + +void snd_hda_jack_set_dirty_all(struct hda_codec *codec); + +int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, + unsigned int tag); + +u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid); +int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); + +static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) +{ + if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT)) + return false; + if (!codec->ignore_misc_bit && + (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & + AC_DEFCFG_MISC_NO_PRESENCE)) + return false; + if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) + return false; + return true; +} + +#endif /* __SOUND_HDA_JACK_H */ diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 7a10fe9..08e88b82 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -505,21 +505,6 @@ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid, unsigned int caps); -u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid); -int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); - -static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) -{ - if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT)) - return false; - if (!codec->ignore_misc_bit && - (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & - AC_DEFCFG_MISC_NO_PRESENCE)) - return false; - if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) - return false; - return true; -} /* flags for hda_nid_item */ #define HDA_NID_ITEM_AMP (1<<0) diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index bcb3310..9cb14b4 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -29,6 +29,7 @@ #include "hda_codec.h" #include "hda_local.h" #include "hda_beep.h" +#include "hda_jack.h" struct ad198x_spec { const struct snd_kcontrol_new *mixers[6]; diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 34a460b..6f15877 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c @@ -26,6 +26,7 @@ #include #include "hda_codec.h" #include "hda_local.h" +#include "hda_jack.h" #include /* @@ -1020,9 +1021,7 @@ static void init_output(struct hda_codec *codec) if (!cfg->speaker_outs) continue; if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { - snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | HP_EVENT); + snd_hda_jack_detect_enable(codec, nid, HP_EVENT); spec->hp_detect = 1; } } @@ -1063,9 +1062,7 @@ static void init_input(struct hda_codec *codec) AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(spec->adc_idx[i])); if (spec->mic_detect && spec->automic_idx == i) - snd_hda_codec_write(codec, pin, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | MIC_EVENT); + snd_hda_jack_detect_enable(codec, pin, MIC_EVENT); } /* specific to CS421x */ if (spec->vendor_nid == CS421X_VENDOR_NID) { @@ -1227,6 +1224,8 @@ static void cs_free(struct hda_codec *codec) static void cs_unsol_event(struct hda_codec *codec, unsigned int res) { + snd_hda_jack_set_dirty_all(codec); /* FIXME: to be more fine-grained */ + switch ((res >> 26) & 0x7f) { case HP_EVENT: cs_automute(codec); @@ -1585,10 +1584,7 @@ static void init_cs421x_digital(struct hda_codec *codec) if (!cfg->speaker_outs) continue; if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { - - snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | SPDIF_EVENT); + snd_hda_jack_detect_enable(codec, nid, SPDIF_EVENT); spec->spdif_detect = 1; } } @@ -1806,6 +1802,8 @@ static int cs421x_build_controls(struct hda_codec *codec) static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res) { + snd_hda_jack_set_dirty_all(codec); /* FIXME: to be more fine-grained */ + switch ((res >> 26) & 0x3f) { case HP_EVENT: case SPDIF_EVENT: diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 0de2119..220e567 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -31,6 +31,7 @@ #include "hda_codec.h" #include "hda_local.h" #include "hda_beep.h" +#include "hda_jack.h" #define CXT_PIN_DIR_IN 0x00 #define CXT_PIN_DIR_OUT 0x01 @@ -3756,6 +3757,7 @@ static void cx_auto_automic(struct hda_codec *codec) static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res) { int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20; + snd_hda_jack_set_dirty(codec, nid); switch (res >> 26) { case CONEXANT_HP_EVENT: cx_auto_hp_automute(codec); @@ -3983,9 +3985,7 @@ static void enable_unsol_pins(struct hda_codec *codec, int num_pins, { int i; for (i = 0; i < num_pins; i++) - snd_hda_codec_write(codec, pins[i], 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | tag); + snd_hda_jack_detect_enable(codec, pins[i], tag); } static void cx_auto_init_output(struct hda_codec *codec) @@ -4060,16 +4060,14 @@ static void cx_auto_init_input(struct hda_codec *codec) if (spec->auto_mic) { if (spec->auto_mic_ext >= 0) { - snd_hda_codec_write(codec, - cfg->inputs[spec->auto_mic_ext].pin, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | CONEXANT_MIC_EVENT); + snd_hda_jack_detect_enable(codec, + cfg->inputs[spec->auto_mic_ext].pin, + CONEXANT_MIC_EVENT); } if (spec->auto_mic_dock >= 0) { - snd_hda_codec_write(codec, - cfg->inputs[spec->auto_mic_dock].pin, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | CONEXANT_MIC_EVENT); + snd_hda_jack_detect_enable(codec, + cfg->inputs[spec->auto_mic_dock].pin, + CONEXANT_MIC_EVENT); } cx_auto_automic(codec); } else { diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 9850c5b..ea6d85d 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -36,6 +36,7 @@ #include #include "hda_codec.h" #include "hda_local.h" +#include "hda_jack.h" static bool static_hdmi_pcm; module_param(static_hdmi_pcm, bool, 0644); @@ -766,6 +767,7 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) if (pin_idx < 0) return; + snd_hda_jack_set_dirty(codec, pin_nid); hdmi_present_sense(&spec->pins[pin_idx], true); } @@ -1282,9 +1284,7 @@ static int generic_hdmi_init(struct hda_codec *codec) struct hdmi_eld *eld = &per_pin->sink_eld; hdmi_init_pin(codec, pin_nid); - snd_hda_codec_write(codec, pin_nid, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | pin_nid); + snd_hda_jack_detect_enable(codec, pin_nid, pin_nid); per_pin->codec = codec; INIT_DELAYED_WORK(&per_pin->work, hdmi_repoll_eld); diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 14feecf..da9d227 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -33,6 +33,7 @@ #include "hda_codec.h" #include "hda_local.h" #include "hda_beep.h" +#include "hda_jack.h" /* unsol event tags */ #define ALC_FRONT_EVENT 0x01 @@ -664,6 +665,7 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) res >>= 28; else res >>= 26; + snd_hda_jack_set_dirty_all(codec); /* FIXME: to be more fine-grained */ switch (res) { case ALC_HP_EVENT: alc_hp_automute(codec); @@ -964,9 +966,7 @@ static void alc_init_automute(struct hda_codec *codec) continue; snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", nid); - snd_hda_codec_write_cache(codec, nid, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | ALC_HP_EVENT); + snd_hda_jack_detect_enable(codec, nid, ALC_HP_EVENT); spec->detect_hp = 1; } @@ -978,9 +978,8 @@ static void alc_init_automute(struct hda_codec *codec) continue; snd_printdd("realtek: Enable Line-Out " "auto-muting on NID 0x%x\n", nid); - snd_hda_codec_write_cache(codec, nid, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | ALC_FRONT_EVENT); + snd_hda_jack_detect_enable(codec, nid, + ALC_FRONT_EVENT); spec->detect_lo = 1; } spec->automute_lo_possible = spec->detect_hp; @@ -1108,13 +1107,10 @@ static bool alc_auto_mic_check_imux(struct hda_codec *codec) return false; /* no corresponding imux */ } - snd_hda_codec_write_cache(codec, spec->ext_mic_pin, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | ALC_MIC_EVENT); + snd_hda_jack_detect_enable(codec, spec->ext_mic_pin, ALC_MIC_EVENT); if (spec->dock_mic_pin) - snd_hda_codec_write_cache(codec, spec->dock_mic_pin, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | ALC_MIC_EVENT); + snd_hda_jack_detect_enable(codec, spec->dock_mic_pin, + ALC_MIC_EVENT); spec->auto_mic_valid_imux = 1; spec->auto_mic = 1; diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 3b4ef0c..97c6df9 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -37,6 +37,7 @@ #include "hda_codec.h" #include "hda_local.h" #include "hda_beep.h" +#include "hda_jack.h" enum { STAC_VREF_EVENT = 1, @@ -4244,9 +4245,7 @@ static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, if (tag < 0) return 0; } - snd_hda_codec_write_cache(codec, nid, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | tag); + snd_hda_jack_detect_enable(codec, nid, tag); return 1; } @@ -4795,24 +4794,11 @@ static void stac92xx_mic_detect(struct hda_codec *codec) mic->mux_idx); } -static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid) -{ - struct sigmatel_event *event = stac_get_event(codec, nid); - if (!event) - return; - codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26); -} - -static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) +static void handle_unsol_event(struct hda_codec *codec, + struct sigmatel_event *event) { struct sigmatel_spec *spec = codec->spec; - struct sigmatel_event *event; - int tag, data; - - tag = (res >> 26) & 0x7f; - event = stac_get_event_from_tag(codec, tag); - if (!event) - return; + int data; switch (event->type) { case STAC_HP_EVENT: @@ -4862,6 +4848,28 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) } } +static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid) +{ + struct sigmatel_event *event = stac_get_event(codec, nid); + if (!event) + return; + handle_unsol_event(codec, event); +} + +static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) +{ + struct sigmatel_spec *spec = codec->spec; + struct sigmatel_event *event; + int tag; + + tag = (res >> 26) & 0x7f; + event = stac_get_event_from_tag(codec, tag); + if (!event) + return; + snd_hda_jack_set_dirty(codec, event->nid); + handle_unsol_event(codec, event); +} + static int hp_blike_system(u32 subsystem_id); static void set_hp_led_gpio(struct hda_codec *codec) diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 431c0d4..3467d0c 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -54,6 +54,7 @@ #include #include "hda_codec.h" #include "hda_local.h" +#include "hda_jack.h" /* Pin Widget NID */ #define VT1708_HP_PIN_NID 0x20 @@ -1708,6 +1709,8 @@ static void via_gpio_control(struct hda_codec *codec) static void via_unsol_event(struct hda_codec *codec, unsigned int res) { + snd_hda_jack_set_dirty_all(codec); /* FIXME: to be more fine-grained */ + res >>= 26; if (res & VIA_JACK_EVENT) @@ -2729,9 +2732,8 @@ static void via_auto_init_unsol_event(struct hda_codec *codec) int i; if (cfg->hp_pins[0] && is_jack_detectable(codec, cfg->hp_pins[0])) - snd_hda_codec_write(codec, cfg->hp_pins[0], 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT); + snd_hda_jack_detect_enable(codec, cfg->hp_pins[0], + VIA_HP_EVENT | VIA_JACK_EVENT); if (cfg->speaker_pins[0]) ev = VIA_LINE_EVENT; @@ -2740,16 +2742,14 @@ static void via_auto_init_unsol_event(struct hda_codec *codec) for (i = 0; i < cfg->line_outs; i++) { if (cfg->line_out_pins[i] && is_jack_detectable(codec, cfg->line_out_pins[i])) - snd_hda_codec_write(codec, cfg->line_out_pins[i], 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | ev | VIA_JACK_EVENT); + snd_hda_jack_detect_enable(codec, cfg->line_out_pins[i], + ev | VIA_JACK_EVENT); } for (i = 0; i < cfg->num_inputs; i++) { if (is_jack_detectable(codec, cfg->inputs[i].pin)) - snd_hda_codec_write(codec, cfg->inputs[i].pin, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | VIA_JACK_EVENT); + snd_hda_jack_detect_enable(codec, cfg->inputs[i].pin, + VIA_JACK_EVENT); } } @@ -2781,6 +2781,7 @@ static void vt1708_update_hp_jack_state(struct work_struct *work) vt1708_hp_work.work); if (spec->codec_type != VT1708) return; + snd_hda_jack_set_dirty_all(spec->codec); /* if jack state toggled */ if (spec->vt1708_hp_present != snd_hda_jack_detect(spec->codec, spec->autocfg.hp_pins[0])) { -- cgit v1.1 From 01a61e12b4602c82bde9797d0e153f3e53c95b04 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 28 Oct 2011 00:03:22 +0200 Subject: ALSA: hda - Create jack-detection kcontrols Create kcontrols for pin jack-detections, which work similarly like jack-input layer. Each control will notify when the jack is plugged or unplugged, and also user can read the value at any time via the normal control API. The control elements are created with iface=CARD, so that they won't appear in the mixer apps. So far, only the pins that enabled the jack-detection are registered. For covering all pins, the transition of the common unsol-tag handling would be needed. Stay tuned. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_jack.c | 168 ++++++++++++++++++++++++++++++++++++++++- sound/pci/hda/hda_jack.h | 12 +++ sound/pci/hda/patch_cirrus.c | 27 ++++++- sound/pci/hda/patch_conexant.c | 2 + sound/pci/hda/patch_hdmi.c | 6 ++ sound/pci/hda/patch_realtek.c | 7 ++ sound/pci/hda/patch_sigmatel.c | 7 ++ sound/pci/hda/patch_via.c | 7 ++ 8 files changed, 232 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index 64b78a2..cee6a00 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "hda_codec.h" #include "hda_local.h" #include "hda_jack.h" @@ -76,9 +77,13 @@ void snd_hda_jack_tbl_clear(struct hda_codec *codec) static void jack_detect_update(struct hda_codec *codec, struct hda_jack_tbl *jack) { - if (jack->jack_dirty) { - jack->pin_sense = read_pin_sense(codec, jack->nid); + if (jack->jack_dirty || !jack->jack_cachable) { + unsigned int val = read_pin_sense(codec, jack->nid); jack->jack_dirty = 0; + if (val != jack->pin_sense) { + jack->need_notify = 1; + jack->pin_sense = val; + } } } @@ -141,8 +146,167 @@ int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, struct hda_jack_tbl *jack = snd_hda_jack_tbl_new(codec, nid); if (!jack) return -ENOMEM; + if (jack->jack_cachable) + return 0; /* already registered */ + jack->jack_cachable = 1; return snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | tag); } EXPORT_SYMBOL_HDA(snd_hda_jack_detect_enable); + +/* queue the notification when needed */ +static void jack_detect_report(struct hda_codec *codec, + struct hda_jack_tbl *jack) +{ + jack_detect_update(codec, jack); + if (jack->need_notify) { + snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE, + &jack->kctl->id); + jack->need_notify = 0; + } +} + +/** + * snd_hda_jack_report - notify kctl when the jack state was changed + */ +void snd_hda_jack_report(struct hda_codec *codec, hda_nid_t nid) +{ + struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); + + if (jack) + jack_detect_report(codec, jack); +} +EXPORT_SYMBOL_HDA(snd_hda_jack_report); + +/** + * snd_hda_jack_report_sync - sync the states of all jacks and report if changed + */ +void snd_hda_jack_report_sync(struct hda_codec *codec) +{ + struct hda_jack_tbl *jack = codec->jacktbl.list; + int i; + + for (i = 0; i < codec->jacktbl.used; i++, jack++) + if (jack->nid) { + jack_detect_update(codec, jack); + jack_detect_report(codec, jack); + } +} +EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync); + +/* + * jack-detection kcontrols + */ + +#define jack_detect_kctl_info snd_ctl_boolean_mono_info + +static int jack_detect_kctl_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct hda_codec *codec = snd_kcontrol_chip(kcontrol); + hda_nid_t nid = kcontrol->private_value; + + ucontrol->value.integer.value[0] = snd_hda_jack_detect(codec, nid); + return 0; +} + +static struct snd_kcontrol_new jack_detect_kctl = { + /* name is filled later */ + .iface = SNDRV_CTL_ELEM_IFACE_CARD, + .access = SNDRV_CTL_ELEM_ACCESS_READ, + .info = jack_detect_kctl_info, + .get = jack_detect_kctl_get, +}; + +/** + * snd_hda_jack_add_kctl - Add a kctl for the given pin + * + * This assigns a jack-detection kctl to the given pin. The kcontrol + * will have the given name and index. + */ +int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, + const char *name, int idx) +{ + struct hda_jack_tbl *jack; + struct snd_kcontrol *kctl; + + jack = snd_hda_jack_tbl_get(codec, nid); + if (!jack) + return 0; + if (jack->kctl) + return 0; /* already created */ + kctl = snd_ctl_new1(&jack_detect_kctl, codec); + if (!kctl) + return -ENOMEM; + snprintf(kctl->id.name, sizeof(kctl->id.name), "%s Jack", name); + kctl->id.index = idx; + kctl->private_value = nid; + if (snd_hda_ctl_add(codec, nid, kctl) < 0) + return -ENOMEM; + jack->kctl = kctl; + return 0; +} + +static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, int idx, + const struct auto_pin_cfg *cfg) +{ + if (!nid) + return 0; + if (!is_jack_detectable(codec, nid)) + return 0; + return snd_hda_jack_add_kctl(codec, nid, + snd_hda_get_pin_label(codec, nid, cfg), + idx); +} + +/** + * snd_hda_jack_add_kctls - Add kctls for all pins included in the given pincfg + * + * As of now, it assigns only to the pins that enabled the detection. + * Usually this is called at the end of build_controls callback. + */ +int snd_hda_jack_add_kctls(struct hda_codec *codec, + const struct auto_pin_cfg *cfg) +{ + const hda_nid_t *p; + int i, err; + + for (i = 0, p = cfg->line_out_pins; i < cfg->line_outs; i++, p++) { + err = add_jack_kctl(codec, *p, i, cfg); + if (err < 0) + return err; + } + for (i = 0, p = cfg->hp_pins; i < cfg->hp_outs; i++, p++) { + if (*p == *cfg->line_out_pins) /* might be duplicated */ + break; + err = add_jack_kctl(codec, *p, i, cfg); + if (err < 0) + return err; + } + for (i = 0, p = cfg->speaker_pins; i < cfg->speaker_outs; i++, p++) { + if (*p == *cfg->line_out_pins) /* might be duplicated */ + break; + err = add_jack_kctl(codec, *p, i, cfg); + if (err < 0) + return err; + } + for (i = 0; i < cfg->num_inputs; i++) { + err = add_jack_kctl(codec, cfg->inputs[i].pin, 0, cfg); + if (err < 0) + return err; + } + for (i = 0, p = cfg->dig_out_pins; i < cfg->dig_outs; i++, p++) { + err = add_jack_kctl(codec, *p, i, cfg); + if (err < 0) + return err; + } + err = add_jack_kctl(codec, cfg->dig_in_pin, 0, cfg); + if (err < 0) + return err; + err = add_jack_kctl(codec, cfg->mono_out_pin, 0, cfg); + if (err < 0) + return err; + return 0; +} +EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctls); diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h index 5c1bcb8..b5983ea 100644 --- a/sound/pci/hda/hda_jack.h +++ b/sound/pci/hda/hda_jack.h @@ -15,7 +15,10 @@ struct hda_jack_tbl { hda_nid_t nid; unsigned int pin_sense; /* cached pin-sense value */ + unsigned int jack_cachable:1; /* can be updated via unsol events */ unsigned int jack_dirty:1; /* needs to update? */ + unsigned int need_notify:1; /* to be notified? */ + struct snd_kcontrol *kctl; /* assigned kctl for jack-detection */ }; struct hda_jack_tbl * @@ -60,4 +63,13 @@ static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) return true; } +int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, + const char *name, int idx); +int snd_hda_jack_add_kctls(struct hda_codec *codec, + const struct auto_pin_cfg *cfg); + +void snd_hda_jack_report(struct hda_codec *codec, hda_nid_t nid); +void snd_hda_jack_report_sync(struct hda_codec *codec); + + #endif /* __SOUND_HDA_JACK_H */ diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 6f15877..135fd49 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c @@ -1192,11 +1192,14 @@ static int cs_init(struct hda_codec *codec) init_output(codec); init_input(codec); init_digital(codec); + snd_hda_jack_report_sync(codec); + return 0; } static int cs_build_controls(struct hda_codec *codec) { + struct cs_spec *spec = codec->spec; int err; err = build_output(codec); @@ -1211,7 +1214,15 @@ static int cs_build_controls(struct hda_codec *codec) err = build_digital_input(codec); if (err < 0) return err; - return cs_init(codec); + err = cs_init(codec); + if (err < 0) + return err; + + err = snd_hda_jack_add_kctls(codec, &spec->autocfg); + if (err < 0) + return err; + + return 0; } static void cs_free(struct hda_codec *codec) @@ -1234,6 +1245,7 @@ static void cs_unsol_event(struct hda_codec *codec, unsigned int res) cs_automic(codec); break; } + snd_hda_jack_report_sync(codec); } static const struct hda_codec_ops cs_patch_ops = { @@ -1611,6 +1623,7 @@ static int cs421x_init(struct hda_codec *codec) init_output(codec); init_input(codec); init_cs421x_digital(codec); + snd_hda_jack_report_sync(codec); return 0; } @@ -1786,6 +1799,7 @@ static int build_cs421x_output(struct hda_codec *codec) static int cs421x_build_controls(struct hda_codec *codec) { + struct cs_spec *spec = codec->spec; int err; err = build_cs421x_output(codec); @@ -1797,7 +1811,15 @@ static int cs421x_build_controls(struct hda_codec *codec) err = build_digital_output(codec); if (err < 0) return err; - return cs421x_init(codec); + err = cs421x_init(codec); + if (err < 0) + return err; + + err = snd_hda_jack_add_kctls(codec, &spec->autocfg); + if (err < 0) + return err; + + return 0; } static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res) @@ -1814,6 +1836,7 @@ static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res) cs_automic(codec); break; } + snd_hda_jack_report_sync(codec); } static int parse_cs421x_input(struct hda_codec *codec) diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 220e567..25fdd1e 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -3770,6 +3770,7 @@ static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res) snd_hda_input_jack_report(codec, nid); break; } + snd_hda_jack_report_sync(codec); } /* check whether the pin config is suitable for auto-mic switching; @@ -4095,6 +4096,7 @@ static int cx_auto_init(struct hda_codec *codec) cx_auto_init_output(codec); cx_auto_init_input(codec); cx_auto_init_digital(codec); + snd_hda_jack_report_sync(codec); return 0; } diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index ea6d85d..f01c5ef 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -769,6 +769,7 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) snd_hda_jack_set_dirty(codec, pin_nid); hdmi_present_sense(&spec->pins[pin_idx], true); + snd_hda_jack_report_sync(codec); } static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) @@ -1268,6 +1269,10 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) if (err < 0) return err; + err = snd_hda_jack_add_kctl(codec, per_pin->pin_nid, + "HDMI", pin_idx); + if (err < 0) + return err; } return 0; @@ -1290,6 +1295,7 @@ static int generic_hdmi_init(struct hda_codec *codec) INIT_DELAYED_WORK(&per_pin->work, hdmi_repoll_eld); snd_hda_eld_proc_new(codec, eld, pin_idx); } + snd_hda_jack_report_sync(codec); return 0; } diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index da9d227..04beae0 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -677,6 +677,7 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) alc_mic_automute(codec); break; } + snd_hda_jack_report_sync(codec); } /* call init functions of standard auto-mute helpers */ @@ -2054,6 +2055,10 @@ static int alc_build_controls(struct hda_codec *codec) alc_free_kctls(codec); /* no longer needed */ + err = snd_hda_jack_add_kctls(codec, &spec->autocfg); + if (err < 0) + return err; + return 0; } @@ -2081,6 +2086,8 @@ static int alc_init(struct hda_codec *codec) alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); + snd_hda_jack_report_sync(codec); + hda_call_check_power_status(codec, 0x01); return 0; } diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 97c6df9..90954b8 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1212,6 +1212,10 @@ static int stac92xx_build_controls(struct hda_codec *codec) return err; } + err = snd_hda_jack_add_kctls(codec, &spec->autocfg); + if (err < 0) + return err; + return 0; } @@ -4473,6 +4477,8 @@ static int stac92xx_init(struct hda_codec *codec) stac_toggle_power_map(codec, nid, 0); } + snd_hda_jack_report_sync(codec); + /* sync mute LED */ if (spec->gpio_led) hda_call_check_power_status(codec, 0x01); @@ -4868,6 +4874,7 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) return; snd_hda_jack_set_dirty(codec, event->nid); handle_unsol_event(codec, event); + snd_hda_jack_report_sync(codec); } static int hp_blike_system(u32 subsystem_id); diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 3467d0c..8529396 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -1500,6 +1500,11 @@ static int via_build_controls(struct hda_codec *codec) analog_low_current_mode(codec); via_free_kctls(codec); /* no longer needed */ + + err = snd_hda_jack_add_kctls(codec, &spec->autocfg); + if (err < 0) + return err; + return 0; } @@ -1722,6 +1727,7 @@ static void via_unsol_event(struct hda_codec *codec, via_hp_automute(codec); else if (res == VIA_GPIO_EVENT) via_gpio_control(codec); + snd_hda_jack_report_sync(codec); } #ifdef CONFIG_PM @@ -2771,6 +2777,7 @@ static int via_init(struct hda_codec *codec) via_auto_init_unsol_event(codec); via_hp_automute(codec); + snd_hda_jack_report_sync(codec); return 0; } -- cgit v1.1 From 3a93897ea37cbb8277f8a4232c12c0c18168a7db Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 28 Oct 2011 01:16:55 +0200 Subject: ALSA: hda - Manage unsol tags in hda_jack.c Manage the tags assigned for unsolicited events dynamically together with the jack-detection routines. Basically this is almost same as what we've done in patch_sigmatel.c. Assign the new tag number for each new unsol event, associate with the given NID and the action type, etc. With this change, now all pins looked over in snd_hda_jack_add_kctls() are actually enabled for detection now even if the pins aren't used for jack-retasking by the driver. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_jack.c | 61 +++++++++++++++--------- sound/pci/hda/hda_jack.h | 28 +++++++---- sound/pci/hda/patch_cirrus.c | 8 +--- sound/pci/hda/patch_conexant.c | 8 ++-- sound/pci/hda/patch_hdmi.c | 13 ++++-- sound/pci/hda/patch_realtek.c | 6 ++- sound/pci/hda/patch_sigmatel.c | 104 +++++++++++------------------------------ sound/pci/hda/patch_via.c | 3 +- 8 files changed, 105 insertions(+), 126 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index cee6a00..8829d5c 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -51,6 +51,24 @@ snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid) EXPORT_SYMBOL_HDA(snd_hda_jack_tbl_get); /** + * snd_hda_jack_tbl_get_from_tag - query the jack-table entry for the given tag + */ +struct hda_jack_tbl * +snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec, unsigned char tag) +{ + struct hda_jack_tbl *jack = codec->jacktbl.list; + int i; + + if (!tag || !jack) + return NULL; + for (i = 0; i < codec->jacktbl.used; i++, jack++) + if (jack->tag == tag) + return jack; + return NULL; +} +EXPORT_SYMBOL_HDA(snd_hda_jack_tbl_get_from_tag); + +/** * snd_hda_jack_tbl_new - create a jack-table entry for the given NID */ struct hda_jack_tbl * @@ -65,6 +83,7 @@ snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid) return NULL; jack->nid = nid; jack->jack_dirty = 1; + jack->tag = codec->jacktbl.used; return jack; } @@ -77,7 +96,7 @@ void snd_hda_jack_tbl_clear(struct hda_codec *codec) static void jack_detect_update(struct hda_codec *codec, struct hda_jack_tbl *jack) { - if (jack->jack_dirty || !jack->jack_cachable) { + if (jack->jack_dirty || !jack->jack_detect) { unsigned int val = read_pin_sense(codec, jack->nid); jack->jack_dirty = 0; if (val != jack->pin_sense) { @@ -141,17 +160,19 @@ EXPORT_SYMBOL_HDA(snd_hda_jack_detect); * snd_hda_jack_detect_enable - enable the jack-detection */ int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, - unsigned int tag) + unsigned char action) { struct hda_jack_tbl *jack = snd_hda_jack_tbl_new(codec, nid); if (!jack) return -ENOMEM; - if (jack->jack_cachable) + if (jack->jack_detect) return 0; /* already registered */ - jack->jack_cachable = 1; + jack->jack_detect = 1; + if (action) + jack->action = action; return snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | tag); + AC_USRSP_EN | jack->tag); } EXPORT_SYMBOL_HDA(snd_hda_jack_detect_enable); @@ -168,18 +189,6 @@ static void jack_detect_report(struct hda_codec *codec, } /** - * snd_hda_jack_report - notify kctl when the jack state was changed - */ -void snd_hda_jack_report(struct hda_codec *codec, hda_nid_t nid) -{ - struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); - - if (jack) - jack_detect_report(codec, jack); -} -EXPORT_SYMBOL_HDA(snd_hda_jack_report); - -/** * snd_hda_jack_report_sync - sync the states of all jacks and report if changed */ void snd_hda_jack_report_sync(struct hda_codec *codec) @@ -231,7 +240,7 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, struct hda_jack_tbl *jack; struct snd_kcontrol *kctl; - jack = snd_hda_jack_tbl_get(codec, nid); + jack = snd_hda_jack_tbl_new(codec, nid); if (!jack) return 0; if (jack->kctl) @@ -251,20 +260,28 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, int idx, const struct auto_pin_cfg *cfg) { + unsigned int def_conf, conn; + int err; + if (!nid) return 0; if (!is_jack_detectable(codec, nid)) return 0; - return snd_hda_jack_add_kctl(codec, nid, + def_conf = snd_hda_codec_get_pincfg(codec, nid); + conn = get_defcfg_connect(def_conf); + if (conn != AC_JACK_PORT_COMPLEX) + return 0; + + err = snd_hda_jack_add_kctl(codec, nid, snd_hda_get_pin_label(codec, nid, cfg), idx); + if (err < 0) + return err; + return snd_hda_jack_detect_enable(codec, nid, 0); } /** * snd_hda_jack_add_kctls - Add kctls for all pins included in the given pincfg - * - * As of now, it assigns only to the pins that enabled the detection. - * Usually this is called at the end of build_controls callback. */ int snd_hda_jack_add_kctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h index b5983ea..69a67f8 100644 --- a/sound/pci/hda/hda_jack.h +++ b/sound/pci/hda/hda_jack.h @@ -14,8 +14,12 @@ struct hda_jack_tbl { hda_nid_t nid; + unsigned char action; /* event action (0 = none) */ + unsigned char tag; /* unsol event tag */ + unsigned int private_data; /* arbitrary data */ + /* jack-detection stuff */ unsigned int pin_sense; /* cached pin-sense value */ - unsigned int jack_cachable:1; /* can be updated via unsol events */ + unsigned int jack_detect:1; /* capable of jack-detection? */ unsigned int jack_dirty:1; /* needs to update? */ unsigned int need_notify:1; /* to be notified? */ struct snd_kcontrol *kctl; /* assigned kctl for jack-detection */ @@ -23,29 +27,34 @@ struct hda_jack_tbl { struct hda_jack_tbl * snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid); +struct hda_jack_tbl * +snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec, unsigned char tag); struct hda_jack_tbl * snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid); void snd_hda_jack_tbl_clear(struct hda_codec *codec); /** - * snd_hda_jack_set_dirty - set the dirty flag for the given jack-entry + * snd_hda_jack_get_action - get jack-tbl entry for the tag * - * Call this function when a pin-state may change, e.g. when the hardware - * notifies via an unsolicited event. + * Call this from the unsol event handler to get the assigned action for the + * event. This will mark the dirty flag for the later reporting, too. */ -static inline void snd_hda_jack_set_dirty(struct hda_codec *codec, - hda_nid_t nid) +static inline unsigned char +snd_hda_jack_get_action(struct hda_codec *codec, unsigned int tag) { - struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); - if (jack) + struct hda_jack_tbl *jack = snd_hda_jack_tbl_get_from_tag(codec, tag); + if (jack) { jack->jack_dirty = 1; + return jack->action; + } + return 0; } void snd_hda_jack_set_dirty_all(struct hda_codec *codec); int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, - unsigned int tag); + unsigned char action); u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid); int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); @@ -68,7 +77,6 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, int snd_hda_jack_add_kctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg); -void snd_hda_jack_report(struct hda_codec *codec, hda_nid_t nid); void snd_hda_jack_report_sync(struct hda_codec *codec); diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 135fd49..0e34554 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c @@ -1235,9 +1235,7 @@ static void cs_free(struct hda_codec *codec) static void cs_unsol_event(struct hda_codec *codec, unsigned int res) { - snd_hda_jack_set_dirty_all(codec); /* FIXME: to be more fine-grained */ - - switch ((res >> 26) & 0x7f) { + switch (snd_hda_jack_get_action(codec, res >> 26)) { case HP_EVENT: cs_automute(codec); break; @@ -1824,9 +1822,7 @@ static int cs421x_build_controls(struct hda_codec *codec) static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res) { - snd_hda_jack_set_dirty_all(codec); /* FIXME: to be more fine-grained */ - - switch ((res >> 26) & 0x3f) { + switch (snd_hda_jack_get_action(codec, res >> 26)) { case HP_EVENT: case SPDIF_EVENT: cs_automute(codec); diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 25fdd1e..40bd75b 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -3757,8 +3757,8 @@ static void cx_auto_automic(struct hda_codec *codec) static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res) { int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20; - snd_hda_jack_set_dirty(codec, nid); - switch (res >> 26) { + + switch (snd_hda_jack_get_action(codec, res >> 26)) { case CONEXANT_HP_EVENT: cx_auto_hp_automute(codec); break; @@ -3982,11 +3982,11 @@ static void mute_outputs(struct hda_codec *codec, int num_nids, } static void enable_unsol_pins(struct hda_codec *codec, int num_pins, - hda_nid_t *pins, unsigned int tag) + hda_nid_t *pins, unsigned int action) { int i; for (i = 0; i < num_pins; i++) - snd_hda_jack_detect_enable(codec, pins[i], tag); + snd_hda_jack_detect_enable(codec, pins[i], action); } static void cx_auto_init_output(struct hda_codec *codec) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index f01c5ef..ea30bf4 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -754,10 +754,18 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry); static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) { struct hdmi_spec *spec = codec->spec; - int pin_nid = res >> AC_UNSOL_RES_TAG_SHIFT; + int tag = res >> AC_UNSOL_RES_TAG_SHIFT; + int pin_nid; int pd = !!(res & AC_UNSOL_RES_PD); int eldv = !!(res & AC_UNSOL_RES_ELDV); int pin_idx; + struct hda_jack_tbl *jack; + + jack = snd_hda_jack_tbl_get_from_tag(codec, tag); + if (!jack) + return; + pin_nid = jack->nid; + jack->jack_dirty = 1; printk(KERN_INFO "HDMI hot plug event: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", @@ -767,7 +775,6 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) if (pin_idx < 0) return; - snd_hda_jack_set_dirty(codec, pin_nid); hdmi_present_sense(&spec->pins[pin_idx], true); snd_hda_jack_report_sync(codec); } @@ -801,7 +808,7 @@ static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) int tag = res >> AC_UNSOL_RES_TAG_SHIFT; int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; - if (pin_nid_to_pin_index(spec, tag) < 0) { + if (!snd_hda_jack_tbl_get_from_tag(codec, tag)) { snd_printd(KERN_INFO "Unexpected HDMI event tag 0x%x\n", tag); return; } diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 04beae0..9a90cda 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -185,6 +185,7 @@ struct alc_spec { unsigned int vol_in_capsrc:1; /* use capsrc volume (ADC has no vol) */ unsigned int parse_flags; /* passed to snd_hda_parse_pin_defcfg() */ unsigned int shared_mic_hp:1; /* HP/Mic-in sharing */ + unsigned int use_jack_tbl:1; /* 1 for model=auto */ /* auto-mute control */ int automute_mode; @@ -661,11 +662,13 @@ static void alc_mic_automute(struct hda_codec *codec) /* unsolicited event for HP jack sensing */ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) { + struct alc_spec *spec = codec->spec; if (codec->vendor_id == 0x10ec0880) res >>= 28; else res >>= 26; - snd_hda_jack_set_dirty_all(codec); /* FIXME: to be more fine-grained */ + if (spec->use_jack_tbl) + res = snd_hda_jack_get_action(codec, res); switch (res) { case ALC_HP_EVENT: alc_hp_automute(codec); @@ -3896,6 +3899,7 @@ static void set_capture_mixer(struct hda_codec *codec) static void alc_auto_init_std(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; + spec->use_jack_tbl = 1; alc_auto_init_multi_out(codec); alc_auto_init_extra_out(codec); alc_auto_init_analog_input(codec); diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 90954b8..dd6569f 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -177,13 +177,6 @@ enum { STAC_9872_MODELS }; -struct sigmatel_event { - hda_nid_t nid; - unsigned char type; - unsigned char tag; - int data; -}; - struct sigmatel_mic_route { hda_nid_t pin; signed char mux_idx; @@ -231,9 +224,6 @@ struct sigmatel_spec { const hda_nid_t *pwr_nids; const hda_nid_t *dac_list; - /* events */ - struct snd_array events; - /* playback */ struct hda_input_mux *mono_mux; unsigned int cur_mmux; @@ -4182,49 +4172,18 @@ static int stac92xx_add_jack(struct hda_codec *codec, #endif /* CONFIG_SND_HDA_INPUT_JACK */ } -static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, +static int stac_add_event(struct hda_codec *codec, hda_nid_t nid, unsigned char type, int data) { - struct sigmatel_event *event; + struct hda_jack_tbl *event; - snd_array_init(&spec->events, sizeof(*event), 32); - event = snd_array_new(&spec->events); + event = snd_hda_jack_tbl_new(codec, nid); if (!event) return -ENOMEM; - event->nid = nid; - event->type = type; - event->tag = spec->events.used; - event->data = data; - - return event->tag; -} - -static struct sigmatel_event *stac_get_event(struct hda_codec *codec, - hda_nid_t nid) -{ - struct sigmatel_spec *spec = codec->spec; - struct sigmatel_event *event = spec->events.list; - int i; - - for (i = 0; i < spec->events.used; i++, event++) { - if (event->nid == nid) - return event; - } - return NULL; -} + event->action = type; + event->private_data = data; -static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec, - unsigned char tag) -{ - struct sigmatel_spec *spec = codec->spec; - struct sigmatel_event *event = spec->events.list; - int i; - - for (i = 0; i < spec->events.used; i++, event++) { - if (event->tag == tag) - return event; - } - return NULL; + return 0; } /* check if given nid is a valid pin and no other events are assigned @@ -4234,22 +4193,17 @@ static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec, static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, unsigned int type) { - struct sigmatel_event *event; - int tag; + struct hda_jack_tbl *event; if (!is_jack_detectable(codec, nid)) return 0; - event = stac_get_event(codec, nid); - if (event) { - if (event->type != type) - return 0; - tag = event->tag; - } else { - tag = stac_add_event(codec->spec, nid, type, 0); - if (tag < 0) - return 0; - } - snd_hda_jack_detect_enable(codec, nid, tag); + event = snd_hda_jack_tbl_new(codec, nid); + if (!event) + return -ENOMEM; + if (event->action && event->action != type) + return 0; + event->action = type; + snd_hda_jack_detect_enable(codec, nid, 0); return 1; } @@ -4536,7 +4490,6 @@ static void stac92xx_free(struct hda_codec *codec) stac92xx_shutup(codec); snd_hda_input_jack_free(codec); - snd_array_free(&spec->events); kfree(spec); snd_hda_detach_beep_device(codec); @@ -4801,12 +4754,12 @@ static void stac92xx_mic_detect(struct hda_codec *codec) } static void handle_unsol_event(struct hda_codec *codec, - struct sigmatel_event *event) + struct hda_jack_tbl *event) { struct sigmatel_spec *spec = codec->spec; int data; - switch (event->type) { + switch (event->action) { case STAC_HP_EVENT: case STAC_LO_EVENT: stac92xx_hp_detect(codec); @@ -4816,7 +4769,7 @@ static void handle_unsol_event(struct hda_codec *codec, break; } - switch (event->type) { + switch (event->action) { case STAC_HP_EVENT: case STAC_LO_EVENT: case STAC_MIC_EVENT: @@ -4849,14 +4802,14 @@ static void handle_unsol_event(struct hda_codec *codec, AC_VERB_GET_GPIO_DATA, 0); /* toggle VREF state based on GPIOx status */ snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, - !!(data & (1 << event->data))); + !!(data & (1 << event->private_data))); break; } } static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid) { - struct sigmatel_event *event = stac_get_event(codec, nid); + struct hda_jack_tbl *event = snd_hda_jack_tbl_get(codec, nid); if (!event) return; handle_unsol_event(codec, event); @@ -4864,15 +4817,14 @@ static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid) static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) { - struct sigmatel_spec *spec = codec->spec; - struct sigmatel_event *event; + struct hda_jack_tbl *event; int tag; tag = (res >> 26) & 0x7f; - event = stac_get_event_from_tag(codec, tag); + event = snd_hda_jack_tbl_get_from_tag(codec, tag); if (!event) return; - snd_hda_jack_set_dirty(codec, event->nid); + event->jack_dirty = 1; handle_unsol_event(codec, event); snd_hda_jack_report_sync(codec); } @@ -5857,15 +5809,13 @@ again: switch (spec->board_config) { case STAC_HP_M4: /* Enable VREF power saving on GPIO1 detect */ - err = stac_add_event(spec, codec->afg, + err = stac_add_event(codec, codec->afg, STAC_VREF_EVENT, 0x02); if (err < 0) return err; snd_hda_codec_write_cache(codec, codec->afg, 0, AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); - snd_hda_codec_write_cache(codec, codec->afg, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | err); + snd_hda_jack_detect_enable(codec, codec->afg, 0); spec->gpio_mask |= 0x02; break; } @@ -6338,14 +6288,12 @@ static int patch_stac9205(struct hda_codec *codec) snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030); /* Enable unsol response for GPIO4/Dock HP connection */ - err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01); + err = stac_add_event(codec, codec->afg, STAC_VREF_EVENT, 0x01); if (err < 0) return err; snd_hda_codec_write_cache(codec, codec->afg, 0, AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); - snd_hda_codec_write_cache(codec, codec->afg, 0, - AC_VERB_SET_UNSOLICITED_ENABLE, - AC_USRSP_EN | err); + snd_hda_jack_detect_enable(codec, codec->afg, 0); spec->gpio_dir = 0x0b; spec->eapd_mask = 0x01; diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 8529396..f73c986 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -1714,9 +1714,8 @@ static void via_gpio_control(struct hda_codec *codec) static void via_unsol_event(struct hda_codec *codec, unsigned int res) { - snd_hda_jack_set_dirty_all(codec); /* FIXME: to be more fine-grained */ - res >>= 26; + res = snd_hda_jack_get_action(codec, res); if (res & VIA_JACK_EVENT) set_widgets_power_state(codec); -- cgit v1.1 From 35be544af367170a9c6bf63adcf9d0cb2d569dbb Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 2 Nov 2011 08:36:06 +0100 Subject: ALSA: Introduce common helper functions for jack-detection control Now move the helper function for creating and reporting the jack-detection to the common place. The driver that needs this functionality should select CONFIG_SND_KCTL_JACK kconfig. Signed-off-by: Takashi Iwai --- sound/core/Kconfig | 3 +++ sound/core/Makefile | 1 + sound/core/ctljack.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++ sound/pci/hda/Kconfig | 1 + sound/pci/hda/hda_jack.c | 56 +++++++----------------------------------------- sound/pci/hda/hda_jack.h | 1 - 6 files changed, 68 insertions(+), 49 deletions(-) create mode 100644 sound/core/ctljack.c (limited to 'sound') diff --git a/sound/core/Kconfig b/sound/core/Kconfig index 475455c..66f287f 100644 --- a/sound/core/Kconfig +++ b/sound/core/Kconfig @@ -207,6 +207,9 @@ config SND_PCM_XRUN_DEBUG config SND_VMASTER bool +config SND_KCTL_JACK + bool + config SND_DMA_SGBUF def_bool y depends on X86 diff --git a/sound/core/Makefile b/sound/core/Makefile index 350a08d..b4637c3 100644 --- a/sound/core/Makefile +++ b/sound/core/Makefile @@ -7,6 +7,7 @@ snd-y := sound.o init.o memory.o info.o control.o misc.o device.o snd-$(CONFIG_ISA_DMA_API) += isadma.o snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o info_oss.o snd-$(CONFIG_SND_VMASTER) += vmaster.o +snd-$(CONFIG_SND_KCTL_JACK) += ctljack.o snd-$(CONFIG_SND_JACK) += jack.o snd-pcm-objs := pcm.o pcm_native.o pcm_lib.o pcm_timer.o pcm_misc.o \ diff --git a/sound/core/ctljack.c b/sound/core/ctljack.c new file mode 100644 index 0000000..af0e78a --- /dev/null +++ b/sound/core/ctljack.c @@ -0,0 +1,55 @@ +/* + * Helper functions for jack-detection kcontrols + * + * Copyright (c) 2011 Takashi Iwai + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + */ + +#include +#include +#include + +#define jack_detect_kctl_info snd_ctl_boolean_mono_info + +static int jack_detect_kctl_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + ucontrol->value.integer.value[0] = kcontrol->private_value; + return 0; +} + +static struct snd_kcontrol_new jack_detect_kctl = { + /* name is filled later */ + .iface = SNDRV_CTL_ELEM_IFACE_CARD, + .access = SNDRV_CTL_ELEM_ACCESS_READ, + .info = jack_detect_kctl_info, + .get = jack_detect_kctl_get, +}; + +struct snd_kcontrol * +snd_kctl_jack_new(const char *name, int idx, void *private_data) +{ + struct snd_kcontrol *kctl; + kctl = snd_ctl_new1(&jack_detect_kctl, private_data); + if (!kctl) + return NULL; + snprintf(kctl->id.name, sizeof(kctl->id.name), "%s Jack", name); + kctl->id.index = idx; + kctl->private_value = 0; + return kctl; +} +EXPORT_SYMBOL_GPL(snd_kctl_jack_new); + +void snd_kctl_jack_report(struct snd_card *card, + struct snd_kcontrol *kctl, bool status) +{ + if (kctl->private_value == status) + return; + kctl->private_value = status; + snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); +} +EXPORT_SYMBOL_GPL(snd_kctl_jack_report); diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig index bb7e102..163b6b5 100644 --- a/sound/pci/hda/Kconfig +++ b/sound/pci/hda/Kconfig @@ -2,6 +2,7 @@ menuconfig SND_HDA_INTEL tristate "Intel HD Audio" select SND_PCM select SND_VMASTER + select SND_KCTL_JACK help Say Y here to include support for Intel "High Definition Audio" (Azalia) and its compatible devices. diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index 8829d5c..a2ab52b 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -97,12 +97,8 @@ static void jack_detect_update(struct hda_codec *codec, struct hda_jack_tbl *jack) { if (jack->jack_dirty || !jack->jack_detect) { - unsigned int val = read_pin_sense(codec, jack->nid); + jack->pin_sense = read_pin_sense(codec, jack->nid); jack->jack_dirty = 0; - if (val != jack->pin_sense) { - jack->need_notify = 1; - jack->pin_sense = val; - } } } @@ -142,6 +138,8 @@ u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) } EXPORT_SYMBOL_HDA(snd_hda_pin_sense); +#define get_jack_plug_state(sense) !!(sense & AC_PINSENSE_PRESENCE) + /** * snd_hda_jack_detect - query pin Presence Detect status * @codec: the CODEC to sense @@ -152,7 +150,7 @@ EXPORT_SYMBOL_HDA(snd_hda_pin_sense); int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid) { u32 sense = snd_hda_pin_sense(codec, nid); - return !!(sense & AC_PINSENSE_PRESENCE); + return get_jack_plug_state(sense); } EXPORT_SYMBOL_HDA(snd_hda_jack_detect); @@ -176,58 +174,23 @@ int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid, } EXPORT_SYMBOL_HDA(snd_hda_jack_detect_enable); -/* queue the notification when needed */ -static void jack_detect_report(struct hda_codec *codec, - struct hda_jack_tbl *jack) -{ - jack_detect_update(codec, jack); - if (jack->need_notify) { - snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE, - &jack->kctl->id); - jack->need_notify = 0; - } -} - /** * snd_hda_jack_report_sync - sync the states of all jacks and report if changed */ void snd_hda_jack_report_sync(struct hda_codec *codec) { struct hda_jack_tbl *jack = codec->jacktbl.list; - int i; + int i, state; for (i = 0; i < codec->jacktbl.used; i++, jack++) if (jack->nid) { jack_detect_update(codec, jack); - jack_detect_report(codec, jack); + state = get_jack_plug_state(jack->pin_sense); + snd_kctl_jack_notify(codec->bus->card, jack->kctl, state); } } EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync); -/* - * jack-detection kcontrols - */ - -#define jack_detect_kctl_info snd_ctl_boolean_mono_info - -static int jack_detect_kctl_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) -{ - struct hda_codec *codec = snd_kcontrol_chip(kcontrol); - hda_nid_t nid = kcontrol->private_value; - - ucontrol->value.integer.value[0] = snd_hda_jack_detect(codec, nid); - return 0; -} - -static struct snd_kcontrol_new jack_detect_kctl = { - /* name is filled later */ - .iface = SNDRV_CTL_ELEM_IFACE_CARD, - .access = SNDRV_CTL_ELEM_ACCESS_READ, - .info = jack_detect_kctl_info, - .get = jack_detect_kctl_get, -}; - /** * snd_hda_jack_add_kctl - Add a kctl for the given pin * @@ -245,12 +208,9 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, return 0; if (jack->kctl) return 0; /* already created */ - kctl = snd_ctl_new1(&jack_detect_kctl, codec); + kctl = snd_kctl_jack_new(name, idx, codec); if (!kctl) return -ENOMEM; - snprintf(kctl->id.name, sizeof(kctl->id.name), "%s Jack", name); - kctl->id.index = idx; - kctl->private_value = nid; if (snd_hda_ctl_add(codec, nid, kctl) < 0) return -ENOMEM; jack->kctl = kctl; diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h index 69a67f8..4bb75ee 100644 --- a/sound/pci/hda/hda_jack.h +++ b/sound/pci/hda/hda_jack.h @@ -21,7 +21,6 @@ struct hda_jack_tbl { unsigned int pin_sense; /* cached pin-sense value */ unsigned int jack_detect:1; /* capable of jack-detection? */ unsigned int jack_dirty:1; /* needs to update? */ - unsigned int need_notify:1; /* to be notified? */ struct snd_kcontrol *kctl; /* assigned kctl for jack-detection */ }; -- cgit v1.1 From aad37dbd563010252e1bedb6dad6cddb867b9235 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 2 Nov 2011 08:54:51 +0100 Subject: ALSA: hda - Merge input-jack helpers to hda_jack.c We can use the very same table in hda_jack.c for managing the list for input-jack elements, too. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 108 ----------------------------------------- sound/pci/hda/hda_jack.c | 97 +++++++++++++++++++++++++++++++++++- sound/pci/hda/hda_jack.h | 4 ++ sound/pci/hda/hda_local.h | 4 -- sound/pci/hda/patch_conexant.c | 1 - sound/pci/hda/patch_hdmi.c | 1 - sound/pci/hda/patch_realtek.c | 1 - sound/pci/hda/patch_sigmatel.c | 1 - 8 files changed, 100 insertions(+), 117 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 8217ff7..e57698f 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -5275,113 +5275,5 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen) } EXPORT_SYMBOL_HDA(snd_print_pcm_bits); -#ifdef CONFIG_SND_HDA_INPUT_JACK -/* - * Input-jack notification support - */ -struct hda_jack_item { - hda_nid_t nid; - int type; - struct snd_jack *jack; -}; - -static const char *get_jack_default_name(struct hda_codec *codec, hda_nid_t nid, - int type) -{ - switch (type) { - case SND_JACK_HEADPHONE: - return "Headphone"; - case SND_JACK_MICROPHONE: - return "Mic"; - case SND_JACK_LINEOUT: - return "Line-out"; - case SND_JACK_LINEIN: - return "Line-in"; - case SND_JACK_HEADSET: - return "Headset"; - case SND_JACK_VIDEOOUT: - return "HDMI/DP"; - default: - return "Misc"; - } -} - -static void hda_free_jack_priv(struct snd_jack *jack) -{ - struct hda_jack_item *jacks = jack->private_data; - jacks->nid = 0; - jacks->jack = NULL; -} - -int snd_hda_input_jack_add(struct hda_codec *codec, hda_nid_t nid, int type, - const char *name) -{ - struct hda_jack_item *jack; - int err; - - snd_array_init(&codec->jacks, sizeof(*jack), 32); - jack = snd_array_new(&codec->jacks); - if (!jack) - return -ENOMEM; - - jack->nid = nid; - jack->type = type; - if (!name) - name = get_jack_default_name(codec, nid, type); - err = snd_jack_new(codec->bus->card, name, type, &jack->jack); - if (err < 0) { - jack->nid = 0; - return err; - } - jack->jack->private_data = jack; - jack->jack->private_free = hda_free_jack_priv; - return 0; -} -EXPORT_SYMBOL_HDA(snd_hda_input_jack_add); - -void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid) -{ - struct hda_jack_item *jacks = codec->jacks.list; - int i; - - if (!jacks) - return; - - for (i = 0; i < codec->jacks.used; i++, jacks++) { - unsigned int pin_ctl; - unsigned int present; - int type; - - if (jacks->nid != nid) - continue; - present = snd_hda_jack_detect(codec, nid); - type = jacks->type; - if (type == (SND_JACK_HEADPHONE | SND_JACK_LINEOUT)) { - pin_ctl = snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_PIN_WIDGET_CONTROL, 0); - type = (pin_ctl & AC_PINCTL_HP_EN) ? - SND_JACK_HEADPHONE : SND_JACK_LINEOUT; - } - snd_jack_report(jacks->jack, present ? type : 0); - } -} -EXPORT_SYMBOL_HDA(snd_hda_input_jack_report); - -/* free jack instances manually when clearing/reconfiguring */ -void snd_hda_input_jack_free(struct hda_codec *codec) -{ - if (!codec->bus->shutdown && codec->jacks.list) { - struct hda_jack_item *jacks = codec->jacks.list; - int i; - for (i = 0; i < codec->jacks.used; i++, jacks++) { - if (jacks->jack) - snd_device_free(codec->bus->card, jacks->jack); - } - } - snd_array_free(&codec->jacks); -} -EXPORT_SYMBOL_HDA(snd_hda_input_jack_free); -#endif /* CONFIG_SND_HDA_INPUT_JACK */ - MODULE_DESCRIPTION("HDA codec core"); MODULE_LICENSE("GPL"); diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index a2ab52b..1389958 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "hda_codec.h" #include "hda_local.h" #include "hda_jack.h" @@ -87,8 +88,15 @@ snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid) return jack; } +#ifdef CONFIG_SND_HDA_INPUT_JACK +static void snd_hda_input_jack_free(struct hda_codec *codec); +#else +#define snd_hda_input_jack_free(codec) +#endif + void snd_hda_jack_tbl_clear(struct hda_codec *codec) { + snd_hda_input_jack_free(codec); snd_array_free(&codec->jacktbl); } @@ -186,7 +194,7 @@ void snd_hda_jack_report_sync(struct hda_codec *codec) if (jack->nid) { jack_detect_update(codec, jack); state = get_jack_plug_state(jack->pin_sense); - snd_kctl_jack_notify(codec->bus->card, jack->kctl, state); + snd_kctl_jack_report(codec->bus->card, jack->kctl, state); } } EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync); @@ -287,3 +295,90 @@ int snd_hda_jack_add_kctls(struct hda_codec *codec, return 0; } EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctls); + +#ifdef CONFIG_SND_HDA_INPUT_JACK +/* + * Input-jack notification support + */ +static const char *get_jack_default_name(struct hda_codec *codec, hda_nid_t nid, + int type) +{ + switch (type) { + case SND_JACK_HEADPHONE: + return "Headphone"; + case SND_JACK_MICROPHONE: + return "Mic"; + case SND_JACK_LINEOUT: + return "Line-out"; + case SND_JACK_LINEIN: + return "Line-in"; + case SND_JACK_HEADSET: + return "Headset"; + case SND_JACK_VIDEOOUT: + return "HDMI/DP"; + default: + return "Misc"; + } +} + +static void hda_free_jack_priv(struct snd_jack *jack) +{ + struct hda_jack_tbl *jacks = jack->private_data; + jacks->nid = 0; + jacks->jack = NULL; +} + +int snd_hda_input_jack_add(struct hda_codec *codec, hda_nid_t nid, int type, + const char *name) +{ + struct hda_jack_tbl *jack = snd_hda_jack_tbl_new(codec, nid); + int err; + + if (!jack) + return -ENOMEM; + if (!name) + name = get_jack_default_name(codec, nid, type); + err = snd_jack_new(codec->bus->card, name, type, &jack->jack); + if (err < 0) + return err; + jack->jack->private_data = jack; + jack->jack->private_free = hda_free_jack_priv; + return 0; +} +EXPORT_SYMBOL_HDA(snd_hda_input_jack_add); + +void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid) +{ + struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); + unsigned int pin_ctl; + unsigned int present; + int type; + + if (!jack) + return; + + present = snd_hda_jack_detect(codec, nid); + type = jack->type; + if (type == (SND_JACK_HEADPHONE | SND_JACK_LINEOUT)) { + pin_ctl = snd_hda_codec_read(codec, nid, 0, + AC_VERB_GET_PIN_WIDGET_CONTROL, 0); + type = (pin_ctl & AC_PINCTL_HP_EN) ? + SND_JACK_HEADPHONE : SND_JACK_LINEOUT; + } + snd_jack_report(jack->jack, present ? type : 0); +} +EXPORT_SYMBOL_HDA(snd_hda_input_jack_report); + +/* free jack instances manually when clearing/reconfiguring */ +static void snd_hda_input_jack_free(struct hda_codec *codec) +{ + if (!codec->bus->shutdown && codec->jacktbl.list) { + struct hda_jack_tbl *jack = codec->jacktbl.list; + int i; + for (i = 0; i < codec->jacktbl.used; i++, jack++) { + if (jack->jack) + snd_device_free(codec->bus->card, jack->jack); + } + } +} +#endif /* CONFIG_SND_HDA_INPUT_JACK */ diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h index 4bb75ee..f8f97c7 100644 --- a/sound/pci/hda/hda_jack.h +++ b/sound/pci/hda/hda_jack.h @@ -22,6 +22,10 @@ struct hda_jack_tbl { unsigned int jack_detect:1; /* capable of jack-detection? */ unsigned int jack_dirty:1; /* needs to update? */ struct snd_kcontrol *kctl; /* assigned kctl for jack-detection */ +#ifdef CONFIG_SND_HDA_INPUT_JACK + int type; + struct snd_jack *jack; +#endif }; struct hda_jack_tbl * diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 08e88b82..13f6814 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -680,7 +680,6 @@ void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen); int snd_hda_input_jack_add(struct hda_codec *codec, hda_nid_t nid, int type, const char *name); void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid); -void snd_hda_input_jack_free(struct hda_codec *codec); #else /* CONFIG_SND_HDA_INPUT_JACK */ static inline int snd_hda_input_jack_add(struct hda_codec *codec, hda_nid_t nid, int type, @@ -692,9 +691,6 @@ static inline void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid) { } -static inline void snd_hda_input_jack_free(struct hda_codec *codec) -{ -} #endif /* CONFIG_SND_HDA_INPUT_JACK */ #endif /* __SOUND_HDA_LOCAL_H */ diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 40bd75b..ae9c028 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -475,7 +475,6 @@ static int conexant_init(struct hda_codec *codec) static void conexant_free(struct hda_codec *codec) { - snd_hda_input_jack_free(codec); snd_hda_detach_beep_device(codec); kfree(codec->spec); } diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index ea30bf4..bb8cfc6 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -1318,7 +1318,6 @@ static void generic_hdmi_free(struct hda_codec *codec) cancel_delayed_work(&per_pin->work); snd_hda_eld_proc_free(codec, eld); } - snd_hda_input_jack_free(codec); flush_workqueue(codec->bus->workq); kfree(spec); diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 9a90cda..933c8cf 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -2474,7 +2474,6 @@ static void alc_free(struct hda_codec *codec) return; alc_shutup(codec); - snd_hda_input_jack_free(codec); alc_free_kctls(codec); alc_free_bind_ctls(codec); kfree(spec); diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index dd6569f..73bf7cd0 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4489,7 +4489,6 @@ static void stac92xx_free(struct hda_codec *codec) return; stac92xx_shutup(codec); - snd_hda_input_jack_free(codec); kfree(spec); snd_hda_detach_beep_device(codec); -- cgit v1.1 From d1cb620081f51c78cf95224efb593a886875078f Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Fri, 11 Nov 2011 17:13:15 +0100 Subject: ALSA: HDA: Jack: Export required functions from hda_jack.c These two functions are being used by the codec-idt and codec-hdmi modules, so they need to be exported properly. Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_jack.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index 1389958..eac002d 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -87,6 +87,7 @@ snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid) jack->tag = codec->jacktbl.used; return jack; } +EXPORT_SYMBOL_HDA(snd_hda_jack_tbl_new); #ifdef CONFIG_SND_HDA_INPUT_JACK static void snd_hda_input_jack_free(struct hda_codec *codec); @@ -224,6 +225,7 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, jack->kctl = kctl; return 0; } +EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctl); static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, int idx, const struct auto_pin_cfg *cfg) -- cgit v1.1 From cfc7c9d307b6a3557e333f960218d344d3a70ce7 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 11 Nov 2011 17:53:03 +0100 Subject: ALSA: hda/jack - Fix NULL-dereference at probing At probing time, the elements that aren't assigned to kctl or jack may be called. Need proper NULL-checks. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_jack.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index eac002d..ef36cbb9 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -194,6 +194,8 @@ void snd_hda_jack_report_sync(struct hda_codec *codec) for (i = 0; i < codec->jacktbl.used; i++, jack++) if (jack->nid) { jack_detect_update(codec, jack); + if (!jack->kctl) + continue; state = get_jack_plug_state(jack->pin_sense); snd_kctl_jack_report(codec->bus->card, jack->kctl, state); } @@ -356,7 +358,7 @@ void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid) unsigned int present; int type; - if (!jack) + if (!jack || !jack->jack) return; present = snd_hda_jack_detect(codec, nid); -- cgit v1.1 From 344b01aecdc1e1173b5aa86208ef583489de7710 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 11 Nov 2011 17:54:19 +0100 Subject: ALSA: hda/jack - Fix the assignment of input jack-type The type field was lost during the transition. Restored. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_jack.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index ef36cbb9..3bcf623 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -345,6 +345,7 @@ int snd_hda_input_jack_add(struct hda_codec *codec, hda_nid_t nid, int type, err = snd_jack_new(codec->bus->card, name, type, &jack->jack); if (err < 0) return err; + jack->type = type; jack->jack->private_data = jack; jack->jack->private_free = hda_free_jack_priv; return 0; -- cgit v1.1 From fc5b15f13886afad43fc6c0040af7cb5172a0bd8 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 14 Nov 2011 10:32:21 +0100 Subject: ALSA: hda - Add missing initialization of kctl jack status Otherwise the jack kctls will report invalid values until the jack is re-plugged. Reported-by: David Henningsson Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_jack.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index 3bcf623..e014562 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -225,6 +225,8 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, if (snd_hda_ctl_add(codec, nid, kctl) < 0) return -ENOMEM; jack->kctl = kctl; + snd_kctl_jack_report(codec->bus->card, kctl, + snd_hda_jack_detect(codec, nid)); return 0; } EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctl); -- cgit v1.1 From c9be8427b1dbd5e9d0313762fb80b2633abb694b Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Wed, 16 Nov 2011 12:07:00 +0200 Subject: ASoC: alc5632: Fix compile without CONFIG_PM Signed-off-by: Leon Romanovsky Signed-off-by: Mark Brown --- sound/soc/codecs/alc5632.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index 07e958a..e560a21 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -939,6 +939,7 @@ static struct snd_soc_dai_driver alc5632_dai = { .symmetric_rates = 1, }; +#ifdef CONFIG_PM static int alc5632_suspend(struct snd_soc_codec *codec, pm_message_t mesg) { alc5632_set_bias_level(codec, SND_SOC_BIAS_OFF); @@ -961,6 +962,10 @@ static int alc5632_resume(struct snd_soc_codec *codec) alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY); return 0; } +#else +#define alc5632_suspend NULL +#define alc5632_resume NULL +#endif static int alc5632_probe(struct snd_soc_codec *codec) { -- cgit v1.1 From bb39753c2ba69d4d9467a109b03861cf43a6dcf8 Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Wed, 16 Nov 2011 12:06:58 +0200 Subject: ASoC: Convert ALC5632 codec to use regmap API Signed-off-by: Leon Romanovsky Signed-off-by: Mark Brown --- sound/soc/codecs/alc5632.c | 217 +++++++++++++++++++++++++++++++++------------ sound/soc/codecs/alc5632.h | 2 + 2 files changed, 161 insertions(+), 58 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index e560a21..c5055c1 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -34,45 +35,129 @@ /* * ALC5632 register cache */ -static const u16 alc5632_reg_defaults[] = { - 0x59B4, 0x0000, 0x8080, 0x0000, /* 0 */ - 0x8080, 0x0000, 0x8080, 0x0000, /* 4 */ - 0xC800, 0x0000, 0xE808, 0x0000, /* 8 */ - 0x1010, 0x0000, 0x0808, 0x0000, /* 12 */ - 0xEE0F, 0x0000, 0xCBCB, 0x0000, /* 16 */ - 0x7F7F, 0x0000, 0x0000, 0x0000, /* 20 */ - 0xE010, 0x0000, 0x0000, 0x0000, /* 24 */ - 0x8008, 0x0000, 0x0000, 0x0000, /* 28 */ - 0x0000, 0x0000, 0x0000, 0x0000, /* 32 */ - 0x00C0, 0x0000, 0xEF00, 0x0000, /* 36 */ - 0x0000, 0x0000, 0x0000, 0x0000, /* 40 */ - 0x0000, 0x0000, 0x0000, 0x0000, /* 44 */ - 0x0000, 0x0000, 0x0000, 0x0000, /* 48 */ - 0x8000, 0x0000, 0x0000, 0x0000, /* 52 */ - 0x0000, 0x0000, 0x0000, 0x0000, /* 56 */ - 0x0000, 0x0000, 0x8000, 0x0000, /* 60 */ - 0x0C0A, 0x0000, 0x0000, 0x0000, /* 64 */ - 0x0000, 0x0000, 0x0000, 0x0000, /* 68 */ - 0x0000, 0x0000, 0x0000, 0x0000, /* 72 */ - 0xBE3E, 0x0000, 0xBE3E, 0x0000, /* 76 */ - 0x0000, 0x0000, 0x0000, 0x0000, /* 80 */ - 0x803A, 0x0000, 0x0000, 0x0000, /* 84 */ - 0x0000, 0x0000, 0x0009, 0x0000, /* 88 */ - 0x0000, 0x0000, 0x3000, 0x0000, /* 92 */ - 0x3075, 0x0000, 0x1010, 0x0000, /* 96 */ - 0x3110, 0x0000, 0x0000, 0x0000, /* 100 */ - 0x0553, 0x0000, 0x0000, 0x0000, /* 104 */ - 0x0000, 0x0000, 0x0000, 0x0000, /* 108 */ +static struct reg_default alc5632_reg_defaults[] = { + { 0, 0x59B4 }, + { 1, 0x0000 }, + { 2, 0x8080 }, + { 3, 0x0000 }, + { 4, 0x8080 }, + { 5, 0x0000 }, + { 6, 0x8080 }, + { 7, 0x0000 }, + { 8, 0xC800 }, + { 9, 0x0000 }, + { 10, 0xE808 }, + { 11, 0x0000 }, + { 12, 0x1010 }, + { 13, 0x0000 }, + { 14, 0x0808 }, + { 15, 0x0000 }, + { 16, 0xEE0F }, + { 17, 0x0000 }, + { 18, 0xCBCB }, + { 19, 0x0000 }, + { 20, 0x7F7F }, + { 21, 0x0000 }, + { 22, 0x0000 }, + { 23, 0x0000 }, + { 24, 0xE010 }, + { 25, 0x0000 }, + { 26, 0x0000 }, + { 27, 0x0000 }, + { 28, 0x8008 }, + { 29, 0x0000 }, + { 30, 0x0000 }, + { 31, 0x0000 }, + { 32, 0x0000 }, + { 33, 0x0000 }, + { 34, 0x0000 }, + { 35, 0x0000 }, + { 36, 0x00C0 }, + { 37, 0x0000 }, + { 38, 0xEF00 }, + { 39, 0x0000 }, + { 40, 0x0000 }, + { 41, 0x0000 }, + { 42, 0x0000 }, + { 43, 0x0000 }, + { 44, 0x0000 }, + { 45, 0x0000 }, + { 46, 0x0000 }, + { 47, 0x0000 }, + { 48, 0x0000 }, + { 49, 0x0000 }, + { 50, 0x0000 }, + { 51, 0x0000 }, + { 52, 0x8000 }, + { 53, 0x0000 }, + { 54, 0x0000 }, + { 55, 0x0000 }, + { 56, 0x0000 }, + { 57, 0x0000 }, + { 58, 0x0000 }, + { 59, 0x0000 }, + { 60, 0x0000 }, + { 61, 0x0000 }, + { 62, 0x8000 }, + { 63, 0x0000 }, + { 64, 0x0C0A }, + { 65, 0x0000 }, + { 66, 0x0000 }, + { 67, 0x0000 }, + { 68, 0x0000 }, + { 69, 0x0000 }, + { 70, 0x0000 }, + { 71, 0x0000 }, + { 72, 0x0000 }, + { 73, 0x0000 }, + { 74, 0x0000 }, + { 75, 0x0000 }, + { 76, 0xBE3E }, + { 77, 0x0000 }, + { 78, 0xBE3E }, + { 79, 0x0000 }, + { 80, 0x0000 }, + { 81, 0x0000 }, + { 82, 0x0000 }, + { 83, 0x0000 }, + { 84, 0x803A }, + { 85, 0x0000 }, + { 86, 0x0000 }, + { 87, 0x0000 }, + { 88, 0x0000 }, + { 89, 0x0000 }, + { 90, 0x0009 }, + { 91, 0x0000 }, + { 92, 0x0000 }, + { 93, 0x0000 }, + { 94, 0x3000 }, + { 95, 0x0000 }, + { 96, 0x3075 }, + { 97, 0x0000 }, + { 98, 0x1010 }, + { 99, 0x0000 }, + { 100, 0x3110 }, + { 101, 0x0000 }, + { 102, 0x0000 }, + { 103, 0x0000 }, + { 104, 0x0553 }, + { 105, 0x0000 }, + { 106, 0x0000 }, + { 107, 0x0000 }, + { 108, 0x0000 }, + { 109, 0x0000 }, + { 110, 0x0000 }, + { 111, 0x0000 }, }; /* codec private data */ struct alc5632_priv { - enum snd_soc_control_type control_type; + struct regmap *regmap; u8 id; unsigned int sysclk; }; -static int alc5632_volatile_register(struct snd_soc_codec *codec, +static bool alc5632_volatile_register(struct device *dev, unsigned int reg) { switch (reg) { @@ -82,19 +167,18 @@ static int alc5632_volatile_register(struct snd_soc_codec *codec, case ALC5632_OVER_CURR_STATUS: case ALC5632_HID_CTRL_DATA: case ALC5632_EQ_CTRL: - return 1; + return true; default: break; } - return 0; + return false; } -static inline int alc5632_reset(struct snd_soc_codec *codec) +static inline int alc5632_reset(struct regmap *map) { - snd_soc_write(codec, ALC5632_RESET, 0); - return snd_soc_read(codec, ALC5632_RESET); + return regmap_write(map, ALC5632_RESET, 0x59B4); } static int amp_mixer_event(struct snd_soc_dapm_widget *w, @@ -948,16 +1032,9 @@ static int alc5632_suspend(struct snd_soc_codec *codec, pm_message_t mesg) static int alc5632_resume(struct snd_soc_codec *codec) { - int ret; - - /* mark cache as needed to sync */ - codec->cache_sync = 1; + struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec); - ret = snd_soc_cache_sync(codec); - if (ret != 0) { - dev_err(codec->dev, "Failed to sync cache: %d\n", ret); - return ret; - } + regcache_sync(alc5632->regmap); alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY); return 0; @@ -972,14 +1049,14 @@ static int alc5632_probe(struct snd_soc_codec *codec) struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec); int ret; - ret = snd_soc_codec_set_cache_io(codec, 8, 16, alc5632->control_type); - if (ret < 0) { + codec->control_data = alc5632->regmap; + + ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP); + if (ret != 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); return ret; } - alc5632_reset(codec); - /* power on device */ alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY); @@ -1008,11 +1085,6 @@ static struct snd_soc_codec_driver soc_codec_device_alc5632 = { .suspend = alc5632_suspend, .resume = alc5632_resume, .set_bias_level = alc5632_set_bias_level, - .reg_word_size = sizeof(u16), - .reg_cache_step = 2, - .reg_cache_default = alc5632_reg_defaults, - .reg_cache_size = ARRAY_SIZE(alc5632_reg_defaults), - .volatile_register = alc5632_volatile_register, .controls = alc5632_snd_controls, .num_controls = ARRAY_SIZE(alc5632_snd_controls), .dapm_widgets = alc5632_dapm_widgets, @@ -1021,13 +1093,24 @@ static struct snd_soc_codec_driver soc_codec_device_alc5632 = { .num_dapm_routes = ARRAY_SIZE(alc5632_dapm_routes), }; +static struct regmap_config alc5632_regmap = { + .reg_bits = 8, + .val_bits = 16, + + .max_register = ALC5632_MAX_REGISTER, + .reg_defaults = alc5632_reg_defaults, + .num_reg_defaults = ARRAY_SIZE(alc5632_reg_defaults), + .volatile_reg = alc5632_volatile_register, + .cache_type = REGCACHE_RBTREE, +}; + /* * alc5632 2 wire address is determined by A1 pin * state during powerup. * low = 0x1a * high = 0x1b */ -static int alc5632_i2c_probe(struct i2c_client *client, +static __devinit int alc5632_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct alc5632_priv *alc5632; @@ -1074,20 +1157,38 @@ static int alc5632_i2c_probe(struct i2c_client *client, } i2c_set_clientdata(client, alc5632); - alc5632->control_type = SND_SOC_I2C; + + alc5632->regmap = regmap_init_i2c(client, &alc5632_regmap); + if (IS_ERR(alc5632->regmap)) { + ret = PTR_ERR(alc5632->regmap); + dev_err(&client->dev, "regmap_init() failed: %d\n", ret); + return ret; + } + + ret = alc5632_reset(alc5632->regmap); + if (ret < 0) { + dev_err(&client->dev, "Failed to issue reset\n"); + regmap_exit(alc5632->regmap); + return ret; + } ret = snd_soc_register_codec(&client->dev, &soc_codec_device_alc5632, &alc5632_dai, 1); - if (ret != 0) + + if (ret < 0) { dev_err(&client->dev, "Failed to register codec: %d\n", ret); + regmap_exit(alc5632->regmap); + return ret; + } return ret; } static int alc5632_i2c_remove(struct i2c_client *client) { + struct alc5632_priv *alc5632 = i2c_get_clientdata(client); snd_soc_unregister_codec(&client->dev); - + regmap_exit(alc5632->regmap); return 0; } diff --git a/sound/soc/codecs/alc5632.h b/sound/soc/codecs/alc5632.h index ff4c0fd..357651e 100644 --- a/sound/soc/codecs/alc5632.h +++ b/sound/soc/codecs/alc5632.h @@ -246,4 +246,6 @@ #define ALC5632_VENDOR_ID1 0x7C #define ALC5632_VENDOR_ID2 0x7E +#define ALC5632_MAX_REGISTER 0x7E + #endif -- cgit v1.1 From 1a083257eb95af8e1d6e0d03e960c34f0017ad31 Mon Sep 17 00:00:00 2001 From: Andrey Danin Date: Sun, 13 Nov 2011 21:53:13 +0200 Subject: ASoC: alc5632: rename volume/switch contols for master and speaker volumes. Signed-off-by: Andrey Danin Signed-off-by: Leon Romanovsky Signed-off-by: Mark Brown --- sound/soc/codecs/alc5632.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index c5055c1..6bfbbc7 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -226,10 +226,10 @@ static const DECLARE_TLV_DB_SCALE(vdac_tlv, -3525, 075, 0); static const struct snd_kcontrol_new alc5632_vol_snd_controls[] = { /* left starts at bit 8, right at bit 0 */ /* 31 steps (5 bit), -46.5db scale */ - SOC_DOUBLE_TLV("Line Playback Volume", + SOC_DOUBLE_TLV("Speaker Playback Volume", ALC5632_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv), /* bit 15 mutes left, bit 7 right */ - SOC_DOUBLE("Line Playback Switch", + SOC_DOUBLE("Speaker Playback Switch", ALC5632_SPK_OUT_VOL, 15, 7, 1, 1), SOC_DOUBLE_TLV("Headphone Playback Volume", ALC5632_HP_OUT_VOL, 8, 0, 31, 1, hp_tlv), @@ -248,9 +248,9 @@ static const struct snd_kcontrol_new alc5632_snd_controls[] = { ALC5632_PHONE_IN_VOL, 8, 31, 1, vol_tlv), SOC_DOUBLE_TLV("LineIn Capture Volume", ALC5632_LINE_IN_VOL, 8, 0, 31, 1, vol_tlv), - SOC_DOUBLE_TLV("Stereo DAC Playback Volume", + SOC_DOUBLE_TLV("Master Playback Volume", ALC5632_STEREO_DAC_IN_VOL, 8, 0, 63, 1, vdac_tlv), - SOC_DOUBLE("Stereo DAC Playback Switch", + SOC_DOUBLE("Master Playback Switch", ALC5632_STEREO_DAC_IN_VOL, 15, 7, 1, 1), SOC_SINGLE_TLV("Mic1 Capture Volume", ALC5632_MIC_VOL, 8, 31, 1, vol_tlv), -- cgit v1.1 From bf815bf0a3c3b8ad6cd97cda6bc29cc3708fe749 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 16 Nov 2011 14:28:33 +0100 Subject: ALSA: hda - Add missing inclusion of linux/export.h This is needed newly since 3.2... Signed-off-by: Takashi Iwai --- sound/core/ctljack.c | 1 + sound/pci/hda/hda_jack.c | 1 + 2 files changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/core/ctljack.c b/sound/core/ctljack.c index af0e78a..e4b38fb 100644 --- a/sound/core/ctljack.c +++ b/sound/core/ctljack.c @@ -10,6 +10,7 @@ */ #include +#include #include #include diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index e014562..25f7565 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include -- cgit v1.1 From 201e06ffa9ef9b5265e636617f4fa20cd1490343 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 16 Nov 2011 15:33:26 +0100 Subject: ALSA: hda - Give more unique names by snd_hda_get_pin_label() The function now gives more unique names for the output pins by adding some prefix and suffix for the location and the channels. Otherwise, it can pass the index number. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 141 +++++++++++++++++++++++++++++++---------- sound/pci/hda/hda_jack.c | 24 +++---- sound/pci/hda/hda_local.h | 5 +- sound/pci/hda/patch_ca0110.c | 6 +- sound/pci/hda/patch_cirrus.c | 5 +- sound/pci/hda/patch_sigmatel.c | 8 ++- 6 files changed, 135 insertions(+), 54 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index e57698f..e050f89 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -5066,61 +5066,136 @@ const char *hda_get_autocfg_input_label(struct hda_codec *codec, } EXPORT_SYMBOL_HDA(hda_get_autocfg_input_label); +/* get a unique suffix or an index number */ +static const char *check_output_sfx(hda_nid_t nid, const hda_nid_t *pins, + int num_pins, int *indexp) +{ + static const char * const channel_sfx[] = { + " Front", " Surrount", " CLFE", " Side" + }; + int i; + + for (i = 0; i < num_pins; i++) { + if (pins[i] == nid) { + if (num_pins == 1) + return ""; + if (num_pins > ARRAY_SIZE(channel_sfx)) { + if (indexp) + *indexp = i; + return ""; + } + return channel_sfx[i]; + } + } + return NULL; +} + +static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid, + const struct auto_pin_cfg *cfg, + const char *name, char *label, int maxlen, + int *indexp) +{ + unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); + int attr = snd_hda_get_input_pin_attr(def_conf); + const char *pfx = "", *sfx = ""; + + /* handle as a speaker if it's a fixed line-out */ + if (!strcmp(name, "Line-Out") && attr == INPUT_PIN_ATTR_INT) + name = "Speaker"; + /* check the location */ + switch (attr) { + case INPUT_PIN_ATTR_DOCK: + pfx = "Dock "; + break; + case INPUT_PIN_ATTR_FRONT: + pfx = "Front "; + break; + } + if (cfg) { + /* try to give a unique suffix if needed */ + sfx = check_output_sfx(nid, cfg->line_out_pins, cfg->line_outs, + indexp); + if (!sfx) + sfx = check_output_sfx(nid, cfg->hp_pins, cfg->hp_outs, + indexp); + if (!sfx) + sfx = check_output_sfx(nid, cfg->speaker_pins, cfg->speaker_outs, + indexp); + if (!sfx) + sfx = ""; + } + snprintf(label, maxlen, "%s%s%s", pfx, name, sfx); + return 1; +} + /** * snd_hda_get_pin_label - Get a label for the given I/O pin * * Get a label for the given pin. This function works for both input and * output pins. When @cfg is given as non-NULL, the function tries to get * an optimized label using hda_get_autocfg_input_label(). + * + * This function tries to give a unique label string for the pin as much as + * possible. For example, when the multiple line-outs are present, it adds + * the channel suffix like "Front", "Surround", etc (only when @cfg is given). + * If no unique name with a suffix is available and @indexp is non-NULL, the + * index number is stored in the pointer. */ -const char *snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, - const struct auto_pin_cfg *cfg) +int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, + const struct auto_pin_cfg *cfg, + char *label, int maxlen, int *indexp) { unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); - int attr; + const char *name = NULL; int i; + if (indexp) + *indexp = 0; if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) - return NULL; + return 0; - attr = snd_hda_get_input_pin_attr(def_conf); switch (get_defcfg_device(def_conf)) { case AC_JACK_LINE_OUT: - switch (attr) { - case INPUT_PIN_ATTR_INT: - return "Speaker"; - case INPUT_PIN_ATTR_DOCK: - return "Dock Line-Out"; - case INPUT_PIN_ATTR_FRONT: - return "Front Line-Out"; - default: - return "Line-Out"; - } + return fill_audio_out_name(codec, nid, cfg, "Line-Out", + label, maxlen, indexp); case AC_JACK_SPEAKER: - return "Speaker"; + return fill_audio_out_name(codec, nid, cfg, "Speaker", + label, maxlen, indexp); case AC_JACK_HP_OUT: - switch (attr) { - case INPUT_PIN_ATTR_DOCK: - return "Dock Headphone"; - case INPUT_PIN_ATTR_FRONT: - return "Front Headphone"; - default: - return "Headphone"; - } + return fill_audio_out_name(codec, nid, cfg, "Headphone", + label, maxlen, indexp); case AC_JACK_SPDIF_OUT: case AC_JACK_DIG_OTHER_OUT: if (get_defcfg_location(def_conf) == AC_JACK_LOC_HDMI) - return "HDMI"; + name = "HDMI"; else - return "SPDIF"; - } - - if (cfg) { - for (i = 0; i < cfg->num_inputs; i++) - if (cfg->inputs[i].pin == nid) - return hda_get_autocfg_input_label(codec, cfg, i); + name = "SPDIF"; + if (cfg && indexp) { + for (i = 0; i < cfg->dig_outs; i++) + if (cfg->dig_out_pins[i] == nid) { + *indexp = i; + break; + } + } + break; + default: + if (cfg) { + for (i = 0; i < cfg->num_inputs; i++) { + if (cfg->inputs[i].pin != nid) + continue; + name = hda_get_autocfg_input_label(codec, cfg, i); + if (name) + break; + } + } + if (!name) + name = hda_get_input_pin_label(codec, nid, true); + break; } - return hda_get_input_pin_label(codec, nid, true); + if (!name) + return 0; + strlcpy(label, name, maxlen); + return 1; } EXPORT_SYMBOL_HDA(snd_hda_get_pin_label); diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index 25f7565..39490151 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -232,11 +232,12 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, } EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctl); -static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, int idx, +static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, const struct auto_pin_cfg *cfg) { unsigned int def_conf, conn; - int err; + char name[44]; + int idx, err; if (!nid) return 0; @@ -247,9 +248,8 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, int idx, if (conn != AC_JACK_PORT_COMPLEX) return 0; - err = snd_hda_jack_add_kctl(codec, nid, - snd_hda_get_pin_label(codec, nid, cfg), - idx); + snd_hda_get_pin_label(codec, nid, cfg, name, sizeof(name), &idx); + err = snd_hda_jack_add_kctl(codec, nid, name, idx); if (err < 0) return err; return snd_hda_jack_detect_enable(codec, nid, 0); @@ -265,38 +265,38 @@ int snd_hda_jack_add_kctls(struct hda_codec *codec, int i, err; for (i = 0, p = cfg->line_out_pins; i < cfg->line_outs; i++, p++) { - err = add_jack_kctl(codec, *p, i, cfg); + err = add_jack_kctl(codec, *p, cfg); if (err < 0) return err; } for (i = 0, p = cfg->hp_pins; i < cfg->hp_outs; i++, p++) { if (*p == *cfg->line_out_pins) /* might be duplicated */ break; - err = add_jack_kctl(codec, *p, i, cfg); + err = add_jack_kctl(codec, *p, cfg); if (err < 0) return err; } for (i = 0, p = cfg->speaker_pins; i < cfg->speaker_outs; i++, p++) { if (*p == *cfg->line_out_pins) /* might be duplicated */ break; - err = add_jack_kctl(codec, *p, i, cfg); + err = add_jack_kctl(codec, *p, cfg); if (err < 0) return err; } for (i = 0; i < cfg->num_inputs; i++) { - err = add_jack_kctl(codec, cfg->inputs[i].pin, 0, cfg); + err = add_jack_kctl(codec, cfg->inputs[i].pin, cfg); if (err < 0) return err; } for (i = 0, p = cfg->dig_out_pins; i < cfg->dig_outs; i++, p++) { - err = add_jack_kctl(codec, *p, i, cfg); + err = add_jack_kctl(codec, *p, cfg); if (err < 0) return err; } - err = add_jack_kctl(codec, cfg->dig_in_pin, 0, cfg); + err = add_jack_kctl(codec, cfg->dig_in_pin, cfg); if (err < 0) return err; - err = add_jack_kctl(codec, cfg->mono_out_pin, 0, cfg); + err = add_jack_kctl(codec, cfg->mono_out_pin, cfg); if (err < 0) return err; return 0; diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 13f6814..ef09716 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -397,8 +397,9 @@ struct auto_pin_cfg; const char *hda_get_autocfg_input_label(struct hda_codec *codec, const struct auto_pin_cfg *cfg, int input); -const char *snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, - const struct auto_pin_cfg *cfg); +int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, + const struct auto_pin_cfg *cfg, + char *label, int maxlen, int *indexp); int snd_hda_add_imux_item(struct hda_input_mux *imux, const char *label, int index, int *type_index_ret); diff --git a/sound/pci/hda/patch_ca0110.c b/sound/pci/hda/patch_ca0110.c index 6bd602b..09ccfab 100644 --- a/sound/pci/hda/patch_ca0110.c +++ b/sound/pci/hda/patch_ca0110.c @@ -41,7 +41,7 @@ struct ca0110_spec { hda_nid_t dig_out; hda_nid_t dig_in; unsigned int num_inputs; - const char *input_labels[AUTO_PIN_LAST]; + char input_labels[AUTO_PIN_LAST][32]; struct hda_pcm pcm_rec[2]; /* PCM information */ }; @@ -476,7 +476,9 @@ static void parse_input(struct hda_codec *codec) if (j >= cfg->num_inputs) continue; spec->input_pins[n] = pin; - spec->input_labels[n] = snd_hda_get_pin_label(codec, pin, NULL); + snd_hda_get_pin_label(codec, pin, cfg, + spec->input_labels[n], + sizeof(spec->input_labels[n]), NULL); spec->adcs[n] = nid; n++; } diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 0e34554..0ba0387 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c @@ -711,8 +711,9 @@ static int cs_capture_source_info(struct snd_kcontrol *kcontrol, if (uinfo->value.enumerated.item >= spec->num_inputs) uinfo->value.enumerated.item = spec->num_inputs - 1; idx = spec->input_idx[uinfo->value.enumerated.item]; - strcpy(uinfo->value.enumerated.name, - snd_hda_get_pin_label(codec, cfg->inputs[idx].pin, NULL)); + snd_hda_get_pin_label(codec, cfg->inputs[idx].pin, cfg, + uinfo->value.enumerated.name, + sizeof(uinfo->value.enumerated.name), NULL); return 0; } diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 73bf7cd0..0988dc4 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -2867,7 +2867,8 @@ static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec, } if (control) { - strcpy(name, snd_hda_get_pin_label(codec, nid, NULL)); + snd_hda_get_pin_label(codec, nid, &spec->autocfg, + name, sizeof(name), NULL); return stac92xx_add_control(codec->spec, control, strcat(name, " Jack Mode"), nid); } @@ -3545,7 +3546,7 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, for (i = 0; i < spec->num_dmics; i++) { hda_nid_t nid; int index, type_idx; - const char *label; + char label[32]; nid = spec->dmic_nids[i]; if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) @@ -3558,7 +3559,8 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, if (index < 0) continue; - label = snd_hda_get_pin_label(codec, nid, NULL); + snd_hda_get_pin_label(codec, nid, &spec->autocfg, + label, sizeof(label), NULL); snd_hda_add_imux_item(dimux, label, index, &type_idx); if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) snd_hda_add_imux_item(imux, label, index, &type_idx); -- cgit v1.1 From 086834e2d2bdf74e4e53bee9ee5359dfe849da1a Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 16 Nov 2011 13:38:28 +0000 Subject: ASoC: Say how long short WM8958 DSP2 firmwares are Signed-off-by: Mark Brown --- sound/soc/codecs/wm8958-dsp2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c index 0293763..39e9557 100644 --- a/sound/soc/codecs/wm8958-dsp2.c +++ b/sound/soc/codecs/wm8958-dsp2.c @@ -55,7 +55,8 @@ static int wm8958_dsp2_fw(struct snd_soc_codec *codec, const char *name, return 0; if (fw->size < 32) { - dev_err(codec->dev, "%s: firmware too short\n", name); + dev_err(codec->dev, "%s: firmware too short (%d bytes)\n", + name, fw->size); goto err; } -- cgit v1.1 From 6d10c91493a0b32744f649776744f898d27ea303 Mon Sep 17 00:00:00 2001 From: Brian Austin Date: Wed, 16 Nov 2011 12:32:27 -0600 Subject: ASoC: Add support for CS42L73 codec This patch adds support for the Cirrus Logic CS42L73 low power stereo codec. Signed-off-by: Brian Austin Signed-off-by: Georgi Vlaev Acked-by: Vinod Koul Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/cs42l73.c | 1457 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/cs42l73.h | 227 +++++++ 4 files changed, 1690 insertions(+) create mode 100644 sound/soc/codecs/cs42l73.c create mode 100644 sound/soc/codecs/cs42l73.h (limited to 'sound') diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 684cc15..686f45a 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -29,6 +29,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_ALC5632 if I2C select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC select SND_SOC_CS42L51 if I2C + select SND_SOC_CS42L73 if I2C select SND_SOC_CS4270 if I2C select SND_SOC_CS4271 if SND_SOC_I2C_AND_SPI select SND_SOC_CX20442 @@ -178,6 +179,9 @@ config SND_SOC_CQ0093VC config SND_SOC_CS42L51 tristate +config SND_SOC_CS42L73 + tristate + # Cirrus Logic CS4270 Codec config SND_SOC_CS4270 tristate diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index af64905..62b01e4 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -15,6 +15,7 @@ snd-soc-ak4642-objs := ak4642.o snd-soc-ak4671-objs := ak4671.o snd-soc-cq93vc-objs := cq93vc.o snd-soc-cs42l51-objs := cs42l51.o +snd-soc-cs42l73-objs := cs42l73.o snd-soc-cs4270-objs := cs4270.o snd-soc-cs4271-objs := cs4271.o snd-soc-cx20442-objs := cx20442.o @@ -117,6 +118,7 @@ obj-$(CONFIG_SND_SOC_ALC5623) += snd-soc-alc5623.o obj-$(CONFIG_SND_SOC_ALC5632) += snd-soc-alc5632.o obj-$(CONFIG_SND_SOC_CQ0093VC) += snd-soc-cq93vc.o obj-$(CONFIG_SND_SOC_CS42L51) += snd-soc-cs42l51.o +obj-$(CONFIG_SND_SOC_CS42L73) += snd-soc-cs42l73.o obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o obj-$(CONFIG_SND_SOC_CS4271) += snd-soc-cs4271.o obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c new file mode 100644 index 0000000..6fe259a --- /dev/null +++ b/sound/soc/codecs/cs42l73.c @@ -0,0 +1,1457 @@ +/* + * cs42l73.c -- CS42L73 ALSA Soc Audio driver + * + * Copyright 2011 Cirrus Logic, Inc. + * + * Authors: Georgi Vlaev, Nucleus Systems Ltd, + * Brian Austin, Cirrus Logic Inc, + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cs42l73.h" + +struct sp_config { + u8 spc, mmcc, spfs; + u32 srate; +}; +struct cs42l73_private { + struct sp_config config[3]; + struct regmap *regmap; + u32 sysclk; + u8 mclksel; + u32 mclk; +}; + +struct reg_default cs42l73_reg_defaults[] = { + { 1, 0x42 }, /* r01 - Device ID A&B */ + { 2, 0xA7 }, /* r02 - Device ID C&D */ + { 3, 0x30 }, /* r03 - Device ID E */ + { 6, 0xF1 }, /* r06 - Power Ctl 1 */ + { 7, 0xDF }, /* r07 - Power Ctl 2 */ + { 8, 0x3F }, /* r08 - Power Ctl 3 */ + { 9, 0x50 }, /* r09 - Charge Pump Freq */ + { 10, 0x53 }, /* r0A - Output Load MicBias Short Detect */ + { 11, 0x00 }, /* r0B - DMIC Master Clock Ctl */ + { 12, 0x00 }, /* r0C - Aux PCM Ctl */ + { 13, 0x15 }, /* r0D - Aux PCM Master Clock Ctl */ + { 14, 0x00 }, /* r0E - Audio PCM Ctl */ + { 15, 0x15 }, /* r0F - Audio PCM Master Clock Ctl */ + { 16, 0x00 }, /* r10 - Voice PCM Ctl */ + { 17, 0x15 }, /* r11 - Voice PCM Master Clock Ctl */ + { 18, 0x00 }, /* r12 - Voice/Aux Sample Rate */ + { 19, 0x06 }, /* r13 - Misc I/O Path Ctl */ + { 20, 0x00 }, /* r14 - ADC Input Path Ctl */ + { 21, 0x00 }, /* r15 - MICA Preamp, PGA Volume */ + { 22, 0x00 }, /* r16 - MICB Preamp, PGA Volume */ + { 23, 0x00 }, /* r17 - Input Path A Digital Volume */ + { 24, 0x00 }, /* r18 - Input Path B Digital Volume */ + { 25, 0x00 }, /* r19 - Playback Digital Ctl */ + { 26, 0x00 }, /* r1A - HP/LO Left Digital Volume */ + { 27, 0x00 }, /* r1B - HP/LO Right Digital Volume */ + { 28, 0x00 }, /* r1C - Speakerphone Digital Volume */ + { 29, 0x00 }, /* r1D - Ear/SPKLO Digital Volume */ + { 30, 0x00 }, /* r1E - HP Left Analog Volume */ + { 31, 0x00 }, /* r1F - HP Right Analog Volume */ + { 32, 0x00 }, /* r20 - LO Left Analog Volume */ + { 33, 0x00 }, /* r21 - LO Right Analog Volume */ + { 34, 0x00 }, /* r22 - Stereo Input Path Advisory Volume */ + { 35, 0x00 }, /* r23 - Aux PCM Input Advisory Volume */ + { 36, 0x00 }, /* r24 - Audio PCM Input Advisory Volume */ + { 37, 0x00 }, /* r25 - Voice PCM Input Advisory Volume */ + { 38, 0x00 }, /* r26 - Limiter Attack Rate HP/LO */ + { 39, 0x7F }, /* r27 - Limter Ctl, Release Rate HP/LO */ + { 40, 0x00 }, /* r28 - Limter Threshold HP/LO */ + { 41, 0x00 }, /* r29 - Limiter Attack Rate Speakerphone */ + { 42, 0x3F }, /* r2A - Limter Ctl, Release Rate Speakerphone */ + { 43, 0x00 }, /* r2B - Limter Threshold Speakerphone */ + { 44, 0x00 }, /* r2C - Limiter Attack Rate Ear/SPKLO */ + { 45, 0x3F }, /* r2D - Limter Ctl, Release Rate Ear/SPKLO */ + { 46, 0x00 }, /* r2E - Limter Threshold Ear/SPKLO */ + { 47, 0x00 }, /* r2F - ALC Enable, Attack Rate Left/Right */ + { 48, 0x3F }, /* r30 - ALC Release Rate Left/Right */ + { 49, 0x00 }, /* r31 - ALC Threshold Left/Right */ + { 50, 0x00 }, /* r32 - Noise Gate Ctl Left/Right */ + { 51, 0x00 }, /* r33 - ALC/NG Misc Ctl */ + { 52, 0x18 }, /* r34 - Mixer Ctl */ + { 53, 0x3F }, /* r35 - HP/LO Left Mixer Input Path Volume */ + { 54, 0x3F }, /* r36 - HP/LO Right Mixer Input Path Volume */ + { 55, 0x3F }, /* r37 - HP/LO Left Mixer Aux PCM Volume */ + { 56, 0x3F }, /* r38 - HP/LO Right Mixer Aux PCM Volume */ + { 57, 0x3F }, /* r39 - HP/LO Left Mixer Audio PCM Volume */ + { 58, 0x3F }, /* r3A - HP/LO Right Mixer Audio PCM Volume */ + { 59, 0x3F }, /* r3B - HP/LO Left Mixer Voice PCM Mono Volume */ + { 60, 0x3F }, /* r3C - HP/LO Right Mixer Voice PCM Mono Volume */ + { 61, 0x3F }, /* r3D - Aux PCM Left Mixer Input Path Volume */ + { 62, 0x3F }, /* r3E - Aux PCM Right Mixer Input Path Volume */ + { 63, 0x3F }, /* r3F - Aux PCM Left Mixer Volume */ + { 64, 0x3F }, /* r40 - Aux PCM Left Mixer Volume */ + { 65, 0x3F }, /* r41 - Aux PCM Left Mixer Audio PCM L Volume */ + { 66, 0x3F }, /* r42 - Aux PCM Right Mixer Audio PCM R Volume */ + { 67, 0x3F }, /* r43 - Aux PCM Left Mixer Voice PCM Volume */ + { 68, 0x3F }, /* r44 - Aux PCM Right Mixer Voice PCM Volume */ + { 69, 0x3F }, /* r45 - Audio PCM Left Input Path Volume */ + { 70, 0x3F }, /* r46 - Audio PCM Right Input Path Volume */ + { 71, 0x3F }, /* r47 - Audio PCM Left Mixer Aux PCM L Volume */ + { 72, 0x3F }, /* r48 - Audio PCM Right Mixer Aux PCM R Volume */ + { 73, 0x3F }, /* r49 - Audio PCM Left Mixer Volume */ + { 74, 0x3F }, /* r4A - Audio PCM Right Mixer Volume */ + { 75, 0x3F }, /* r4B - Audio PCM Left Mixer Voice PCM Volume */ + { 76, 0x3F }, /* r4C - Audio PCM Right Mixer Voice PCM Volume */ + { 77, 0x3F }, /* r4D - Voice PCM Left Input Path Volume */ + { 78, 0x3F }, /* r4E - Voice PCM Right Input Path Volume */ + { 79, 0x3F }, /* r4F - Voice PCM Left Mixer Aux PCM L Volume */ + { 80, 0x3F }, /* r50 - Voice PCM Right Mixer Aux PCM R Volume */ + { 81, 0x3F }, /* r51 - Voice PCM Left Mixer Audio PCM L Volume */ + { 82, 0x3F }, /* r52 - Voice PCM Right Mixer Audio PCM R Volume */ + { 83, 0x3F }, /* r53 - Voice PCM Left Mixer Voice PCM Volume */ + { 84, 0x3F }, /* r54 - Voice PCM Right Mixer Voice PCM Volume */ + { 85, 0xAA }, /* r55 - Mono Mixer Ctl */ + { 86, 0x3F }, /* r56 - SPK Mono Mixer Input Path Volume */ + { 87, 0x3F }, /* r57 - SPK Mono Mixer Aux PCM Mono/L/R Volume */ + { 88, 0x3F }, /* r58 - SPK Mono Mixer Audio PCM Mono/L/R Volume */ + { 89, 0x3F }, /* r59 - SPK Mono Mixer Voice PCM Mono Volume */ + { 90, 0x3F }, /* r5A - SPKLO Mono Mixer Input Path Mono Volume */ + { 91, 0x3F }, /* r5B - SPKLO Mono Mixer Aux Mono/L/R Volume */ + { 92, 0x3F }, /* r5C - SPKLO Mono Mixer Audio Mono/L/R Volume */ + { 93, 0x3F }, /* r5D - SPKLO Mono Mixer Voice Mono Volume */ + { 94, 0x00 }, /* r5E - Interrupt Mask 1 */ + { 95, 0x00 }, /* r5F - Interrupt Mask 2 */ +}; + +static bool cs42l73_volatile_register(struct device *dev, unsigned int reg) +{ + switch (reg) { + case CS42L73_IS1: + case CS42L73_IS2: + return true; + default: + return false; + } +} + +static bool cs42l73_readable_register(struct device *dev, unsigned int reg) +{ + switch (reg) { + case CS42L73_DEVID_AB: + case CS42L73_DEVID_CD: + case CS42L73_DEVID_E: + case CS42L73_REVID: + case CS42L73_PWRCTL1: + case CS42L73_PWRCTL2: + case CS42L73_PWRCTL3: + case CS42L73_CPFCHC: + case CS42L73_OLMBMSDC: + case CS42L73_DMMCC: + case CS42L73_XSPC: + case CS42L73_XSPMMCC: + case CS42L73_ASPC: + case CS42L73_ASPMMCC: + case CS42L73_VSPC: + case CS42L73_VSPMMCC: + case CS42L73_VXSPFS: + case CS42L73_MIOPC: + case CS42L73_ADCIPC: + case CS42L73_MICAPREPGAAVOL: + case CS42L73_MICBPREPGABVOL: + case CS42L73_IPADVOL: + case CS42L73_IPBDVOL: + case CS42L73_PBDC: + case CS42L73_HLADVOL: + case CS42L73_HLBDVOL: + case CS42L73_SPKDVOL: + case CS42L73_ESLDVOL: + case CS42L73_HPAAVOL: + case CS42L73_HPBAVOL: + case CS42L73_LOAAVOL: + case CS42L73_LOBAVOL: + case CS42L73_STRINV: + case CS42L73_XSPINV: + case CS42L73_ASPINV: + case CS42L73_VSPINV: + case CS42L73_LIMARATEHL: + case CS42L73_LIMRRATEHL: + case CS42L73_LMAXHL: + case CS42L73_LIMARATESPK: + case CS42L73_LIMRRATESPK: + case CS42L73_LMAXSPK: + case CS42L73_LIMARATEESL: + case CS42L73_LIMRRATEESL: + case CS42L73_LMAXESL: + case CS42L73_ALCARATE: + case CS42L73_ALCRRATE: + case CS42L73_ALCMINMAX: + case CS42L73_NGCAB: + case CS42L73_ALCNGMC: + case CS42L73_MIXERCTL: + case CS42L73_HLAIPAA: + case CS42L73_HLBIPBA: + case CS42L73_HLAXSPAA: + case CS42L73_HLBXSPBA: + case CS42L73_HLAASPAA: + case CS42L73_HLBASPBA: + case CS42L73_HLAVSPMA: + case CS42L73_HLBVSPMA: + case CS42L73_XSPAIPAA: + case CS42L73_XSPBIPBA: + case CS42L73_XSPAXSPAA: + case CS42L73_XSPBXSPBA: + case CS42L73_XSPAASPAA: + case CS42L73_XSPAASPBA: + case CS42L73_XSPAVSPMA: + case CS42L73_XSPBVSPMA: + case CS42L73_ASPAIPAA: + case CS42L73_ASPBIPBA: + case CS42L73_ASPAXSPAA: + case CS42L73_ASPBXSPBA: + case CS42L73_ASPAASPAA: + case CS42L73_ASPBASPBA: + case CS42L73_ASPAVSPMA: + case CS42L73_ASPBVSPMA: + case CS42L73_VSPAIPAA: + case CS42L73_VSPBIPBA: + case CS42L73_VSPAXSPAA: + case CS42L73_VSPBXSPBA: + case CS42L73_VSPAASPAA: + case CS42L73_VSPBASPBA: + case CS42L73_VSPAVSPMA: + case CS42L73_VSPBVSPMA: + case CS42L73_MMIXCTL: + case CS42L73_SPKMIPMA: + case CS42L73_SPKMXSPA: + case CS42L73_SPKMASPA: + case CS42L73_SPKMVSPMA: + case CS42L73_ESLMIPMA: + case CS42L73_ESLMXSPA: + case CS42L73_ESLMASPA: + case CS42L73_ESLMVSPMA: + case CS42L73_IM1: + case CS42L73_IM2: + return true; + default: + return false; + } +} + +static const unsigned int hpaloa_tlv[] = { + TLV_DB_RANGE_HEAD(2), + 0, 13, TLV_DB_SCALE_ITEM(-7600, 200, 0), + 14, 75, TLV_DB_SCALE_ITEM(-4900, 100, 0), +}; + +static DECLARE_TLV_DB_SCALE(adc_boost_tlv, 0, 2500, 0); + +static DECLARE_TLV_DB_SCALE(hl_tlv, -10200, 50, 0); + +static DECLARE_TLV_DB_SCALE(ipd_tlv, -9600, 100, 0); + +static DECLARE_TLV_DB_SCALE(micpga_tlv, -600, 50, 0); + +static const unsigned int limiter_tlv[] = { + TLV_DB_RANGE_HEAD(2), + 0, 2, TLV_DB_SCALE_ITEM(-3000, 600, 0), + 3, 7, TLV_DB_SCALE_ITEM(-1200, 300, 0), +}; + +static const DECLARE_TLV_DB_SCALE(attn_tlv, -6300, 100, 1); + +static const char * const cs42l73_pgaa_text[] = { "Line A", "Mic 1" }; +static const char * const cs42l73_pgab_text[] = { "Line B", "Mic 2" }; + +static const struct soc_enum pgaa_enum = + SOC_ENUM_SINGLE(CS42L73_ADCIPC, 3, + ARRAY_SIZE(cs42l73_pgaa_text), cs42l73_pgaa_text); + +static const struct soc_enum pgab_enum = + SOC_ENUM_SINGLE(CS42L73_ADCIPC, 7, + ARRAY_SIZE(cs42l73_pgab_text), cs42l73_pgab_text); + +static const struct snd_kcontrol_new pgaa_mux = + SOC_DAPM_ENUM("Left Analog Input Capture Mux", pgaa_enum); + +static const struct snd_kcontrol_new pgab_mux = + SOC_DAPM_ENUM("Right Analog Input Capture Mux", pgab_enum); + +static const struct snd_kcontrol_new input_left_mixer[] = { + SOC_DAPM_SINGLE("ADC Left Input", CS42L73_PWRCTL1, + 5, 1, 1), + SOC_DAPM_SINGLE("DMIC Left Input", CS42L73_PWRCTL1, + 4, 1, 1), +}; + +static const struct snd_kcontrol_new input_right_mixer[] = { + SOC_DAPM_SINGLE("ADC Right Input", CS42L73_PWRCTL1, + 7, 1, 1), + SOC_DAPM_SINGLE("DMIC Right Input", CS42L73_PWRCTL1, + 6, 1, 1), +}; + +static const char * const cs42l73_ng_delay_text[] = { + "50ms", "100ms", "150ms", "200ms" }; + +static const struct soc_enum ng_delay_enum = + SOC_ENUM_SINGLE(CS42L73_NGCAB, 0, + ARRAY_SIZE(cs42l73_ng_delay_text), cs42l73_ng_delay_text); + +static const char * const charge_pump_freq_text[] = { + "0", "1", "2", "3", "4", + "5", "6", "7", "8", "9", + "10", "11", "12", "13", "14", "15" }; + +static const struct soc_enum charge_pump_enum = + SOC_ENUM_SINGLE(CS42L73_CPFCHC, 4, + ARRAY_SIZE(charge_pump_freq_text), charge_pump_freq_text); + +static const char * const cs42l73_mono_mix_texts[] = { + "Left", "Right", "Mono Mix"}; + +static const unsigned int cs42l73_mono_mix_values[] = { 0, 1, 2 }; + +static const struct soc_enum spk_asp_enum = + SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 6, 1, + ARRAY_SIZE(cs42l73_mono_mix_texts), + cs42l73_mono_mix_texts, + cs42l73_mono_mix_values); + +static const struct snd_kcontrol_new spk_asp_mixer = + SOC_DAPM_ENUM("Route", spk_asp_enum); + +static const struct soc_enum spk_xsp_enum = + SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 4, 3, + ARRAY_SIZE(cs42l73_mono_mix_texts), + cs42l73_mono_mix_texts, + cs42l73_mono_mix_values); + +static const struct snd_kcontrol_new spk_xsp_mixer = + SOC_DAPM_ENUM("Route", spk_xsp_enum); + +static const struct soc_enum esl_asp_enum = + SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 2, 5, + ARRAY_SIZE(cs42l73_mono_mix_texts), + cs42l73_mono_mix_texts, + cs42l73_mono_mix_values); + +static const struct snd_kcontrol_new esl_asp_mixer = + SOC_DAPM_ENUM("Route", esl_asp_enum); + +static const struct soc_enum esl_xsp_enum = + SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 0, 7, + ARRAY_SIZE(cs42l73_mono_mix_texts), + cs42l73_mono_mix_texts, + cs42l73_mono_mix_values); + +static const struct snd_kcontrol_new esl_xsp_mixer = + SOC_DAPM_ENUM("Route", esl_xsp_enum); + +static const char * const cs42l73_ip_swap_text[] = { + "Stereo", "Mono A", "Mono B", "Swap A-B"}; + +static const struct soc_enum ip_swap_enum = + SOC_ENUM_SINGLE(CS42L73_MIOPC, 6, + ARRAY_SIZE(cs42l73_ip_swap_text), cs42l73_ip_swap_text); + +static const char * const cs42l73_spo_mixer_text[] = {"Mono", "Stereo"}; + +static const struct soc_enum vsp_output_mux_enum = + SOC_ENUM_SINGLE(CS42L73_MIXERCTL, 5, + ARRAY_SIZE(cs42l73_spo_mixer_text), cs42l73_spo_mixer_text); + +static const struct soc_enum xsp_output_mux_enum = + SOC_ENUM_SINGLE(CS42L73_MIXERCTL, 4, + ARRAY_SIZE(cs42l73_spo_mixer_text), cs42l73_spo_mixer_text); + +static const struct snd_kcontrol_new vsp_output_mux = + SOC_DAPM_ENUM("Route", vsp_output_mux_enum); + +static const struct snd_kcontrol_new xsp_output_mux = + SOC_DAPM_ENUM("Route", xsp_output_mux_enum); + +static const struct snd_kcontrol_new hp_amp_ctl = + SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 0, 1, 1); + +static const struct snd_kcontrol_new lo_amp_ctl = + SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 1, 1, 1); + +static const struct snd_kcontrol_new spk_amp_ctl = + SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 2, 1, 1); + +static const struct snd_kcontrol_new spklo_amp_ctl = + SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 4, 1, 1); + +static const struct snd_kcontrol_new ear_amp_ctl = + SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 3, 1, 1); + +static const struct snd_kcontrol_new cs42l73_snd_controls[] = { + SOC_DOUBLE_R_SX_TLV("Headphone Analog Playback Volume", + CS42L73_HPAAVOL, CS42L73_HPBAVOL, 7, + 0xffffffC1, 0x0C, hpaloa_tlv), + + SOC_DOUBLE_R_SX_TLV("LineOut Analog Playback Volume", CS42L73_LOAAVOL, + CS42L73_LOBAVOL, 7, 0xffffffC1, 0x0C, hpaloa_tlv), + + SOC_DOUBLE_R_SX_TLV("Input PGA Analog Volume", CS42L73_MICAPREPGAAVOL, + CS42L73_MICBPREPGABVOL, 5, 0xffffff35, + 0x34, micpga_tlv), + + SOC_DOUBLE_R("MIC Preamp Switch", CS42L73_MICAPREPGAAVOL, + CS42L73_MICBPREPGABVOL, 6, 1, 1), + + SOC_DOUBLE_R_SX_TLV("Input Path Digital Volume", CS42L73_IPADVOL, + CS42L73_IPBDVOL, 7, 0xffffffA0, 0xA0, ipd_tlv), + + SOC_DOUBLE_R_SX_TLV("HL Digital Playback Volume", + CS42L73_HLADVOL, CS42L73_HLBDVOL, 7, 0xffffffE5, + 0xE4, hl_tlv), + + SOC_SINGLE_TLV("ADC A Boost Volume", + CS42L73_ADCIPC, 2, 0x01, 1, adc_boost_tlv), + + SOC_SINGLE_TLV("ADC B Boost Volume", + CS42L73_ADCIPC, 6, 0x01, 1, adc_boost_tlv), + + SOC_SINGLE_TLV("Speakerphone Digital Playback Volume", + CS42L73_SPKDVOL, 0, 0xE4, 1, hl_tlv), + + SOC_SINGLE_TLV("Ear Speaker Digital Playback Volume", + CS42L73_ESLDVOL, 0, 0xE4, 1, hl_tlv), + + SOC_DOUBLE_R("Headphone Analog Playback Switch", CS42L73_HPAAVOL, + CS42L73_HPBAVOL, 7, 1, 1), + + SOC_DOUBLE_R("LineOut Analog Playback Switch", CS42L73_LOAAVOL, + CS42L73_LOBAVOL, 7, 1, 1), + SOC_DOUBLE("Input Path Digital Switch", CS42L73_ADCIPC, 0, 4, 1, 1), + SOC_DOUBLE("HL Digital Playback Switch", CS42L73_PBDC, 0, + 1, 1, 1), + SOC_SINGLE("Speakerphone Digital Playback Switch", CS42L73_PBDC, 2, 1, + 1), + SOC_SINGLE("Ear Speaker Digital Playback Switch", CS42L73_PBDC, 3, 1, + 1), + + SOC_SINGLE("PGA Soft-Ramp Switch", CS42L73_MIOPC, 3, 1, 0), + SOC_SINGLE("Analog Zero Cross Switch", CS42L73_MIOPC, 2, 1, 0), + SOC_SINGLE("Digital Soft-Ramp Switch", CS42L73_MIOPC, 1, 1, 0), + SOC_SINGLE("Analog Output Soft-Ramp Switch", CS42L73_MIOPC, 0, 1, 0), + + SOC_DOUBLE("ADC Signal Polarity Switch", CS42L73_ADCIPC, 1, 5, 1, + 0), + + SOC_SINGLE("HL Limiter Attack Rate", CS42L73_LIMARATEHL, 0, 0x3F, + 0), + SOC_SINGLE("HL Limiter Release Rate", CS42L73_LIMRRATEHL, 0, + 0x3F, 0), + + + SOC_SINGLE("HL Limiter Switch", CS42L73_LIMRRATEHL, 7, 1, 0), + SOC_SINGLE("HL Limiter All Channels Switch", CS42L73_LIMRRATEHL, 6, 1, + 0), + + SOC_SINGLE_TLV("HL Limiter Max Threshold Volume", CS42L73_LMAXHL, 5, 7, + 1, limiter_tlv), + + SOC_SINGLE_TLV("HL Limiter Cushion Volume", CS42L73_LMAXHL, 2, 7, 1, + limiter_tlv), + + SOC_SINGLE("SPK Limiter Attack Rate Volume", CS42L73_LIMARATESPK, 0, + 0x3F, 0), + SOC_SINGLE("SPK Limiter Release Rate Volume", CS42L73_LIMRRATESPK, 0, + 0x3F, 0), + SOC_SINGLE("SPK Limiter Switch", CS42L73_LIMRRATESPK, 7, 1, 0), + SOC_SINGLE("SPK Limiter All Channels Switch", CS42L73_LIMRRATESPK, + 6, 1, 0), + SOC_SINGLE_TLV("SPK Limiter Max Threshold Volume", CS42L73_LMAXSPK, 5, + 7, 1, limiter_tlv), + + SOC_SINGLE_TLV("SPK Limiter Cushion Volume", CS42L73_LMAXSPK, 2, 7, 1, + limiter_tlv), + + SOC_SINGLE("ESL Limiter Attack Rate Volume", CS42L73_LIMARATEESL, 0, + 0x3F, 0), + SOC_SINGLE("ESL Limiter Release Rate Volume", CS42L73_LIMRRATEESL, 0, + 0x3F, 0), + SOC_SINGLE("ESL Limiter Switch", CS42L73_LIMRRATEESL, 7, 1, 0), + SOC_SINGLE_TLV("ESL Limiter Max Threshold Volume", CS42L73_LMAXESL, 5, + 7, 1, limiter_tlv), + + SOC_SINGLE_TLV("ESL Limiter Cushion Volume", CS42L73_LMAXESL, 2, 7, 1, + limiter_tlv), + + SOC_SINGLE("ALC Attack Rate Volume", CS42L73_ALCARATE, 0, 0x3F, 0), + SOC_SINGLE("ALC Release Rate Volume", CS42L73_ALCRRATE, 0, 0x3F, 0), + SOC_DOUBLE("ALC Switch", CS42L73_ALCARATE, 6, 7, 1, 0), + SOC_SINGLE_TLV("ALC Max Threshold Volume", CS42L73_ALCMINMAX, 5, 7, 0, + limiter_tlv), + SOC_SINGLE_TLV("ALC Min Threshold Volume", CS42L73_ALCMINMAX, 2, 7, 0, + limiter_tlv), + + SOC_DOUBLE("NG Enable Switch", CS42L73_NGCAB, 6, 7, 1, 0), + SOC_SINGLE("NG Boost Switch", CS42L73_NGCAB, 5, 1, 0), + /* + NG Threshold depends on NG_BOOTSAB, which selects + between two threshold scales in decibels. + Set linear values for now .. + */ + SOC_SINGLE("NG Threshold", CS42L73_NGCAB, 2, 7, 0), + SOC_ENUM("NG Delay", ng_delay_enum), + + SOC_ENUM("Charge Pump Frequency", charge_pump_enum), + + SOC_DOUBLE_R_TLV("XSP-IP Volume", + CS42L73_XSPAIPAA, CS42L73_XSPBIPBA, 0, 0x3F, 1, + attn_tlv), + SOC_DOUBLE_R_TLV("XSP-XSP Volume", + CS42L73_XSPAXSPAA, CS42L73_XSPBXSPBA, 0, 0x3F, 1, + attn_tlv), + SOC_DOUBLE_R_TLV("XSP-ASP Volume", + CS42L73_XSPAASPAA, CS42L73_XSPAASPBA, 0, 0x3F, 1, + attn_tlv), + SOC_DOUBLE_R_TLV("XSP-VSP Volume", + CS42L73_XSPAVSPMA, CS42L73_XSPBVSPMA, 0, 0x3F, 1, + attn_tlv), + + SOC_DOUBLE_R_TLV("ASP-IP Volume", + CS42L73_ASPAIPAA, CS42L73_ASPBIPBA, 0, 0x3F, 1, + attn_tlv), + SOC_DOUBLE_R_TLV("ASP-XSP Volume", + CS42L73_ASPAXSPAA, CS42L73_ASPBXSPBA, 0, 0x3F, 1, + attn_tlv), + SOC_DOUBLE_R_TLV("ASP-ASP Volume", + CS42L73_ASPAASPAA, CS42L73_ASPBASPBA, 0, 0x3F, 1, + attn_tlv), + SOC_DOUBLE_R_TLV("ASP-VSP Volume", + CS42L73_ASPAVSPMA, CS42L73_ASPBVSPMA, 0, 0x3F, 1, + attn_tlv), + + SOC_DOUBLE_R_TLV("VSP-IP Volume", + CS42L73_VSPAIPAA, CS42L73_VSPBIPBA, 0, 0x3F, 1, + attn_tlv), + SOC_DOUBLE_R_TLV("VSP-XSP Volume", + CS42L73_VSPAXSPAA, CS42L73_VSPBXSPBA, 0, 0x3F, 1, + attn_tlv), + SOC_DOUBLE_R_TLV("VSP-ASP Volume", + CS42L73_VSPAASPAA, CS42L73_VSPBASPBA, 0, 0x3F, 1, + attn_tlv), + SOC_DOUBLE_R_TLV("VSP-VSP Volume", + CS42L73_VSPAVSPMA, CS42L73_VSPBVSPMA, 0, 0x3F, 1, + attn_tlv), + + SOC_DOUBLE_R_TLV("HL-IP Volume", + CS42L73_HLAIPAA, CS42L73_HLBIPBA, 0, 0x3F, 1, + attn_tlv), + SOC_DOUBLE_R_TLV("HL-XSP Volume", + CS42L73_HLAXSPAA, CS42L73_HLBXSPBA, 0, 0x3F, 1, + attn_tlv), + SOC_DOUBLE_R_TLV("HL-ASP Volume", + CS42L73_HLAASPAA, CS42L73_HLBASPBA, 0, 0x3F, 1, + attn_tlv), + SOC_DOUBLE_R_TLV("HL-VSP Volume", + CS42L73_HLAVSPMA, CS42L73_HLBVSPMA, 0, 0x3F, 1, + attn_tlv), + + SOC_SINGLE_TLV("SPK-IP Mono Volume", + CS42L73_SPKMIPMA, 0, 0x3E, 1, attn_tlv), + SOC_SINGLE_TLV("SPK-XSP Mono Volume", + CS42L73_SPKMXSPA, 0, 0x3E, 1, attn_tlv), + SOC_SINGLE_TLV("SPK-ASP Mono Volume", + CS42L73_SPKMASPA, 0, 0x3E, 1, attn_tlv), + SOC_SINGLE_TLV("SPK-VSP Mono Volume", + CS42L73_SPKMVSPMA, 0, 0x3E, 1, attn_tlv), + + SOC_SINGLE_TLV("ESL-IP Mono Volume", + CS42L73_ESLMIPMA, 0, 0x3E, 1, attn_tlv), + SOC_SINGLE_TLV("ESL-XSP Mono Volume", + CS42L73_ESLMXSPA, 0, 0x3E, 1, attn_tlv), + SOC_SINGLE_TLV("ESL-ASP Mono Volume", + CS42L73_ESLMASPA, 0, 0x3E, 1, attn_tlv), + SOC_SINGLE_TLV("ESL-VSP Mono Volume", + CS42L73_ESLMVSPMA, 0, 0x3E, 1, attn_tlv), + + SOC_ENUM("IP Digital Swap/Mono Select", ip_swap_enum), + + SOC_ENUM("VSPOUT Mono/Stereo Select", vsp_output_mux_enum), + SOC_ENUM("XSPOUT Mono/Stereo Select", xsp_output_mux_enum), +}; + +static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = { + SND_SOC_DAPM_INPUT("LINEINA"), + SND_SOC_DAPM_INPUT("LINEINB"), + SND_SOC_DAPM_INPUT("MIC1"), + SND_SOC_DAPM_SUPPLY("MIC1 Bias", CS42L73_PWRCTL2, 6, 1, NULL, 0), + SND_SOC_DAPM_INPUT("MIC2"), + SND_SOC_DAPM_SUPPLY("MIC2 Bias", CS42L73_PWRCTL2, 7, 1, NULL, 0), + + SND_SOC_DAPM_AIF_OUT("XSPOUTL", "XSP Capture", 0, + CS42L73_PWRCTL2, 1, 1), + SND_SOC_DAPM_AIF_OUT("XSPOUTR", "XSP Capture", 0, + CS42L73_PWRCTL2, 1, 1), + SND_SOC_DAPM_AIF_OUT("ASPOUTL", "ASP Capture", 0, + CS42L73_PWRCTL2, 3, 1), + SND_SOC_DAPM_AIF_OUT("ASPOUTR", "ASP Capture", 0, + CS42L73_PWRCTL2, 3, 1), + SND_SOC_DAPM_AIF_OUT("VSPOUTL", "VSP Capture", 0, + CS42L73_PWRCTL2, 4, 1), + SND_SOC_DAPM_AIF_OUT("VSPOUTR", "VSP Capture", 0, + CS42L73_PWRCTL2, 4, 1), + + SND_SOC_DAPM_PGA("PGA Left", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_PGA("PGA Right", SND_SOC_NOPM, 0, 0, NULL, 0), + + SND_SOC_DAPM_MUX("PGA Left Mux", SND_SOC_NOPM, 0, 0, &pgaa_mux), + SND_SOC_DAPM_MUX("PGA Right Mux", SND_SOC_NOPM, 0, 0, &pgab_mux), + + SND_SOC_DAPM_ADC("ADC Left", NULL, CS42L73_PWRCTL1, 7, 1), + SND_SOC_DAPM_ADC("ADC Right", NULL, CS42L73_PWRCTL1, 5, 1), + SND_SOC_DAPM_ADC("DMIC Left", NULL, CS42L73_PWRCTL1, 6, 1), + SND_SOC_DAPM_ADC("DMIC Right", NULL, CS42L73_PWRCTL1, 4, 1), + + SND_SOC_DAPM_MIXER_NAMED_CTL("Input Left Capture", SND_SOC_NOPM, + 0, 0, input_left_mixer, + ARRAY_SIZE(input_left_mixer)), + + SND_SOC_DAPM_MIXER_NAMED_CTL("Input Right Capture", SND_SOC_NOPM, + 0, 0, input_right_mixer, + ARRAY_SIZE(input_right_mixer)), + + SND_SOC_DAPM_MIXER("ASPL Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_MIXER("ASPR Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_MIXER("XSPL Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_MIXER("XSPR Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_MIXER("VSPL Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_MIXER("VSPR Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), + + SND_SOC_DAPM_AIF_IN("XSPINL", "XSP Playback", 0, + CS42L73_PWRCTL2, 0, 1), + SND_SOC_DAPM_AIF_IN("XSPINR", "XSP Playback", 0, + CS42L73_PWRCTL2, 0, 1), + SND_SOC_DAPM_AIF_IN("XSPINM", "XSP Playback", 0, + CS42L73_PWRCTL2, 0, 1), + + SND_SOC_DAPM_AIF_IN("ASPINL", "ASP Playback", 0, + CS42L73_PWRCTL2, 2, 1), + SND_SOC_DAPM_AIF_IN("ASPINR", "ASP Playback", 0, + CS42L73_PWRCTL2, 2, 1), + SND_SOC_DAPM_AIF_IN("ASPINM", "ASP Playback", 0, + CS42L73_PWRCTL2, 2, 1), + + SND_SOC_DAPM_AIF_IN("VSPIN", "VSP Playback", 0, + CS42L73_PWRCTL2, 4, 1), + + SND_SOC_DAPM_MIXER("HL Left Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_MIXER("HL Right Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_MIXER("SPK Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_MIXER("ESL Mixer", SND_SOC_NOPM, 0, 0, NULL, 0), + + SND_SOC_DAPM_MUX("ESL-XSP Mux", SND_SOC_NOPM, + 0, 0, &esl_xsp_mixer), + + SND_SOC_DAPM_MUX("ESL-ASP Mux", SND_SOC_NOPM, + 0, 0, &esl_asp_mixer), + + SND_SOC_DAPM_MUX("SPK-ASP Mux", SND_SOC_NOPM, + 0, 0, &spk_asp_mixer), + + SND_SOC_DAPM_MUX("SPK-XSP Mux", SND_SOC_NOPM, + 0, 0, &spk_xsp_mixer), + + SND_SOC_DAPM_PGA("HL Left DAC", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_PGA("HL Right DAC", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_PGA("SPK DAC", SND_SOC_NOPM, 0, 0, NULL, 0), + SND_SOC_DAPM_PGA("ESL DAC", SND_SOC_NOPM, 0, 0, NULL, 0), + + SND_SOC_DAPM_SWITCH("HP Amp", CS42L73_PWRCTL3, 0, 1, + &hp_amp_ctl), + SND_SOC_DAPM_SWITCH("LO Amp", CS42L73_PWRCTL3, 1, 1, + &lo_amp_ctl), + SND_SOC_DAPM_SWITCH("SPK Amp", CS42L73_PWRCTL3, 2, 1, + &spk_amp_ctl), + SND_SOC_DAPM_SWITCH("EAR Amp", CS42L73_PWRCTL3, 3, 1, + &ear_amp_ctl), + SND_SOC_DAPM_SWITCH("SPKLO Amp", CS42L73_PWRCTL3, 4, 1, + &spklo_amp_ctl), + + SND_SOC_DAPM_OUTPUT("HPOUTA"), + SND_SOC_DAPM_OUTPUT("HPOUTB"), + SND_SOC_DAPM_OUTPUT("LINEOUTA"), + SND_SOC_DAPM_OUTPUT("LINEOUTB"), + SND_SOC_DAPM_OUTPUT("EAROUT"), + SND_SOC_DAPM_OUTPUT("SPKOUT"), + SND_SOC_DAPM_OUTPUT("SPKLINEOUT"), +}; + +static const struct snd_soc_dapm_route cs42l73_audio_map[] = { + + /* SPKLO EARSPK Paths */ + {"EAROUT", NULL, "EAR Amp"}, + {"SPKLINEOUT", NULL, "SPKLO Amp"}, + + {"EAR Amp", "Switch", "ESL DAC"}, + {"SPKLO Amp", "Switch", "ESL DAC"}, + + {"ESL DAC", "ESL-ASP Mono Volume", "ESL Mixer"}, + {"ESL DAC", "ESL-XSP Mono Volume", "ESL Mixer"}, + {"ESL DAC", "ESL-VSP Mono Volume", "VSPIN"}, + /* Loopback */ + {"ESL DAC", "ESL-IP Mono Volume", "Input Left Capture"}, + {"ESL DAC", "ESL-IP Mono Volume", "Input Right Capture"}, + + {"ESL Mixer", NULL, "ESL-ASP Mux"}, + {"ESL Mixer", NULL, "ESL-XSP Mux"}, + + {"ESL-ASP Mux", "Left", "ASPINL"}, + {"ESL-ASP Mux", "Right", "ASPINR"}, + {"ESL-ASP Mux", "Mono Mix", "ASPINM"}, + + {"ESL-XSP Mux", "Left", "XSPINL"}, + {"ESL-XSP Mux", "Right", "XSPINR"}, + {"ESL-XSP Mux", "Mono Mix", "XSPINM"}, + + /* Speakerphone Paths */ + {"SPKOUT", NULL, "SPK Amp"}, + {"SPK Amp", "Switch", "SPK DAC"}, + + {"SPK DAC", "SPK-ASP Mono Volume", "SPK Mixer"}, + {"SPK DAC", "SPK-XSP Mono Volume", "SPK Mixer"}, + {"SPK DAC", "SPK-VSP Mono Volume", "VSPIN"}, + /* Loopback */ + {"SPK DAC", "SPK-IP Mono Volume", "Input Left Capture"}, + {"SPK DAC", "SPK-IP Mono Volume", "Input Right Capture"}, + + {"SPK Mixer", NULL, "SPK-ASP Mux"}, + {"SPK Mixer", NULL, "SPK-XSP Mux"}, + + {"SPK-ASP Mux", "Left", "ASPINL"}, + {"SPK-ASP Mux", "Mono Mix", "ASPINM"}, + {"SPK-ASP Mux", "Right", "ASPINR"}, + + {"SPK-XSP Mux", "Left", "XSPINL"}, + {"SPK-XSP Mux", "Mono Mix", "XSPINM"}, + {"SPK-XSP Mux", "Right", "XSPINR"}, + + /* HP LineOUT Paths */ + {"HPOUTA", NULL, "HP Amp"}, + {"HPOUTB", NULL, "HP Amp"}, + {"LINEOUTA", NULL, "LO Amp"}, + {"LINEOUTB", NULL, "LO Amp"}, + + {"HP Amp", "Switch", "HL Left DAC"}, + {"HP Amp", "Switch", "HL Right DAC"}, + {"LO Amp", "Switch", "HL Left DAC"}, + {"LO Amp", "Switch", "HL Right DAC"}, + + {"HL Left DAC", "HL-XSP Volume", "HL Left Mixer"}, + {"HL Right DAC", "HL-XSP Volume", "HL Right Mixer"}, + {"HL Left DAC", "HL-ASP Volume", "HL Left Mixer"}, + {"HL Right DAC", "HL-ASP Volume", "HL Right Mixer"}, + {"HL Left DAC", "HL-VSP Volume", "HL Left Mixer"}, + {"HL Right DAC", "HL-VSP Volume", "HL Right Mixer"}, + /* Loopback */ + {"HL Left DAC", "HL-IP Volume", "HL Left Mixer"}, + {"HL Right DAC", "HL-IP Volume", "HL Right Mixer"}, + {"HL Left Mixer", NULL, "Input Left Capture"}, + {"HL Right Mixer", NULL, "Input Right Capture"}, + + {"HL Left Mixer", NULL, "ASPINL"}, + {"HL Right Mixer", NULL, "ASPINR"}, + {"HL Left Mixer", NULL, "XSPINL"}, + {"HL Right Mixer", NULL, "XSPINR"}, + {"HL Left Mixer", NULL, "VSPIN"}, + {"HL Right Mixer", NULL, "VSPIN"}, + + /* Capture Paths */ + {"MIC1", NULL, "MIC1 Bias"}, + {"PGA Left Mux", "Mic 1", "MIC1"}, + {"MIC2", NULL, "MIC2 Bias"}, + {"PGA Right Mux", "Mic 2", "MIC2"}, + + {"PGA Left Mux", "Line A", "LINEINA"}, + {"PGA Right Mux", "Line B", "LINEINB"}, + + {"PGA Left", NULL, "PGA Left Mux"}, + {"PGA Right", NULL, "PGA Right Mux"}, + + {"ADC Left", NULL, "PGA Left"}, + {"ADC Right", NULL, "PGA Right"}, + + {"Input Left Capture", "ADC Left Input", "ADC Left"}, + {"Input Right Capture", "ADC Right Input", "ADC Right"}, + {"Input Left Capture", "DMIC Left Input", "DMIC Left"}, + {"Input Right Capture", "DMIC Right Input", "DMIC Right"}, + + /* Audio Capture */ + {"ASPL Output Mixer", NULL, "Input Left Capture"}, + {"ASPR Output Mixer", NULL, "Input Right Capture"}, + + {"ASPOUTL", "ASP-IP Volume", "ASPL Output Mixer"}, + {"ASPOUTR", "ASP-IP Volume", "ASPR Output Mixer"}, + + /* Auxillary Capture */ + {"XSPL Output Mixer", NULL, "Input Left Capture"}, + {"XSPR Output Mixer", NULL, "Input Right Capture"}, + + {"XSPOUTL", "XSP-IP Volume", "XSPL Output Mixer"}, + {"XSPOUTR", "XSP-IP Volume", "XSPR Output Mixer"}, + + {"XSPOUTL", NULL, "XSPL Output Mixer"}, + {"XSPOUTR", NULL, "XSPR Output Mixer"}, + + /* Voice Capture */ + {"VSPL Output Mixer", NULL, "Input Left Capture"}, + {"VSPR Output Mixer", NULL, "Input Left Capture"}, + + {"VSPOUTL", "VSP-IP Volume", "VSPL Output Mixer"}, + {"VSPOUTR", "VSP-IP Volume", "VSPR Output Mixer"}, + + {"VSPOUTL", NULL, "VSPL Output Mixer"}, + {"VSPOUTR", NULL, "VSPR Output Mixer"}, +}; + +struct cs42l73_mclk_div { + u32 mclk; + u32 srate; + u8 mmcc; +}; + +static struct cs42l73_mclk_div cs42l73_mclk_coeffs[] = { + /* MCLK, Sample Rate, xMMCC[5:0] */ + {5644800, 11025, 0x30}, + {5644800, 22050, 0x20}, + {5644800, 44100, 0x10}, + + {6000000, 8000, 0x39}, + {6000000, 11025, 0x33}, + {6000000, 12000, 0x31}, + {6000000, 16000, 0x29}, + {6000000, 22050, 0x23}, + {6000000, 24000, 0x21}, + {6000000, 32000, 0x19}, + {6000000, 44100, 0x13}, + {6000000, 48000, 0x11}, + + {6144000, 8000, 0x38}, + {6144000, 12000, 0x30}, + {6144000, 16000, 0x28}, + {6144000, 24000, 0x20}, + {6144000, 32000, 0x18}, + {6144000, 48000, 0x10}, + + {6500000, 8000, 0x3C}, + {6500000, 11025, 0x35}, + {6500000, 12000, 0x34}, + {6500000, 16000, 0x2C}, + {6500000, 22050, 0x25}, + {6500000, 24000, 0x24}, + {6500000, 32000, 0x1C}, + {6500000, 44100, 0x15}, + {6500000, 48000, 0x14}, + + {6400000, 8000, 0x3E}, + {6400000, 11025, 0x37}, + {6400000, 12000, 0x36}, + {6400000, 16000, 0x2E}, + {6400000, 22050, 0x27}, + {6400000, 24000, 0x26}, + {6400000, 32000, 0x1E}, + {6400000, 44100, 0x17}, + {6400000, 48000, 0x16}, +}; + +struct cs42l73_mclkx_div { + u32 mclkx; + u8 ratio; + u8 mclkdiv; +}; + +static struct cs42l73_mclkx_div cs42l73_mclkx_coeffs[] = { + {5644800, 1, 0}, /* 5644800 */ + {6000000, 1, 0}, /* 6000000 */ + {6144000, 1, 0}, /* 6144000 */ + {11289600, 2, 2}, /* 5644800 */ + {12288000, 2, 2}, /* 6144000 */ + {12000000, 2, 2}, /* 6000000 */ + {13000000, 2, 2}, /* 6500000 */ + {19200000, 3, 3}, /* 6400000 */ + {24000000, 4, 4}, /* 6000000 */ + {26000000, 4, 4}, /* 6500000 */ + {38400000, 6, 5} /* 6400000 */ +}; + +static int cs42l73_get_mclkx_coeff(int mclkx) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(cs42l73_mclkx_coeffs); i++) { + if (cs42l73_mclkx_coeffs[i].mclkx == mclkx) + return i; + } + return -EINVAL; +} + +static int cs42l73_get_mclk_coeff(int mclk, int srate) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(cs42l73_mclk_coeffs); i++) { + if (cs42l73_mclk_coeffs[i].mclk == mclk && + cs42l73_mclk_coeffs[i].srate == srate) + return i; + } + return -EINVAL; + +} + +static int cs42l73_set_mclk(struct snd_soc_dai *dai, unsigned int freq) +{ + struct snd_soc_codec *codec = dai->codec; + struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); + + int mclkx_coeff; + u32 mclk = 0; + u8 dmmcc = 0; + + /* MCLKX -> MCLK */ + mclkx_coeff = cs42l73_get_mclkx_coeff(freq); + + mclk = cs42l73_mclkx_coeffs[mclkx_coeff].mclkx / + cs42l73_mclkx_coeffs[mclkx_coeff].ratio; + + dev_dbg(codec->dev, "MCLK%u %u <-> internal MCLK %u\n", + priv->mclksel + 1, cs42l73_mclkx_coeffs[mclkx_coeff].mclkx, + mclk); + + dmmcc = (priv->mclksel << 4) | + (cs42l73_mclkx_coeffs[mclkx_coeff].mclkdiv << 1); + + snd_soc_write(codec, CS42L73_DMMCC, dmmcc); + + priv->sysclk = mclkx_coeff; + priv->mclk = mclk; + + return 0; +} + +static int cs42l73_set_sysclk(struct snd_soc_dai *dai, + int clk_id, unsigned int freq, int dir) +{ + struct snd_soc_codec *codec = dai->codec; + struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); + + switch (clk_id) { + case CS42L73_CLKID_MCLK1: + break; + case CS42L73_CLKID_MCLK2: + break; + default: + return -EINVAL; + } + + if ((cs42l73_set_mclk(dai, freq)) < 0) { + dev_err(codec->dev, "Unable to set MCLK for dai %s\n", + dai->name); + return -EINVAL; + } + + priv->mclksel = clk_id; + + return 0; +} + +static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) +{ + struct snd_soc_codec *codec = codec_dai->codec; + struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); + u8 id = codec_dai->id; + u8 inv, format; + u8 spc, mmcc; + + spc = snd_soc_read(codec, CS42L73_SPC(id)); + mmcc = snd_soc_read(codec, CS42L73_MMCC(id)); + + switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { + case SND_SOC_DAIFMT_CBM_CFM: + mmcc |= MS_MASTER; + break; + + case SND_SOC_DAIFMT_CBS_CFS: + mmcc &= ~MS_MASTER; + break; + + default: + return -EINVAL; + } + + format = (fmt & SND_SOC_DAIFMT_FORMAT_MASK); + inv = (fmt & SND_SOC_DAIFMT_INV_MASK); + + switch (format) { + case SND_SOC_DAIFMT_I2S: + spc &= ~SPDIF_PCM; + break; + case SND_SOC_DAIFMT_DSP_A: + case SND_SOC_DAIFMT_DSP_B: + if (mmcc & MS_MASTER) { + dev_err(codec->dev, + "PCM format in slave mode only\n"); + return -EINVAL; + } + if (id == CS42L73_ASP) { + dev_err(codec->dev, + "PCM format is not supported on ASP port\n"); + return -EINVAL; + } + spc |= SPDIF_PCM; + break; + default: + return -EINVAL; + } + + if (spc & SPDIF_PCM) { + spc &= (31 << 3); /* Clear PCM mode, set MSB->LSB */ + switch (format) { + case SND_SOC_DAIFMT_DSP_B: + if (inv == SND_SOC_DAIFMT_IB_IF) + spc |= (PCM_MODE0 << 4); + if (inv == SND_SOC_DAIFMT_IB_NF) + spc |= (PCM_MODE1 << 4); + break; + case SND_SOC_DAIFMT_DSP_A: + if (inv == SND_SOC_DAIFMT_IB_IF) + spc |= (PCM_MODE1 << 4); + break; + default: + return -EINVAL; + } + } + + priv->config[id].spc = spc; + priv->config[id].mmcc = mmcc; + + return 0; +} + +static u32 cs42l73_asrc_rates[] = { + 8000, 11025, 12000, 16000, 22050, + 24000, 32000, 44100, 48000 +}; + +static unsigned int cs42l73_get_xspfs_coeff(u32 rate) +{ + int i; + for (i = 0; i < ARRAY_SIZE(cs42l73_asrc_rates); i++) { + if (cs42l73_asrc_rates[i] == rate) + return i + 1; + } + return 0; /* 0 = Don't know */ +} + +static void cs42l73_update_asrc(struct snd_soc_codec *codec, int id, int srate) +{ + u8 spfs = 0; + + if (srate > 0) + spfs = cs42l73_get_xspfs_coeff(srate); + + switch (id) { + case CS42L73_XSP: + snd_soc_update_bits(codec, CS42L73_VXSPFS, 0x0f, spfs); + break; + case CS42L73_ASP: + snd_soc_update_bits(codec, CS42L73_ASPC, 0x3c, spfs << 2); + break; + case CS42L73_VSP: + snd_soc_update_bits(codec, CS42L73_VXSPFS, 0xf0, spfs << 4); + break; + default: + break; + } +} + +static int cs42l73_pcm_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_codec *codec = rtd->codec; + struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); + int id = dai->id; + int mclk_coeff; + int srate = params_rate(params); + + if (priv->config[id].mmcc & MS_MASTER) { + /* CS42L73 Master */ + /* MCLK -> srate */ + mclk_coeff = + cs42l73_get_mclk_coeff(priv->mclk, srate); + + if (mclk_coeff < 0) + return -EINVAL; + + dev_dbg(codec->dev, + "DAI[%d]: MCLK %u, srate %u, MMCC[5:0] = %x\n", + id, priv->mclk, srate, + cs42l73_mclk_coeffs[mclk_coeff].mmcc); + + priv->config[id].mmcc &= 0xC0; + priv->config[id].mmcc |= cs42l73_mclk_coeffs[mclk_coeff].mmcc; + priv->config[id].spc &= 0xFC; + priv->config[id].spc &= MCK_SCLK_64FS; + } else { + /* CS42L73 Slave */ + priv->config[id].spc &= 0xFC; + priv->config[id].spc |= MCK_SCLK_64FS; + } + /* Update ASRCs */ + priv->config[id].srate = srate; + + snd_soc_write(codec, CS42L73_SPC(id), priv->config[id].spc); + snd_soc_write(codec, CS42L73_MMCC(id), priv->config[id].mmcc); + + cs42l73_update_asrc(codec, id, srate); + + return 0; +} + +static int cs42l73_set_bias_level(struct snd_soc_codec *codec, + enum snd_soc_bias_level level) +{ + struct cs42l73_private *cs42l73 = snd_soc_codec_get_drvdata(codec); + + switch (level) { + case SND_SOC_BIAS_ON: + snd_soc_update_bits(codec, CS42L73_DMMCC, MCLKDIS, 0); + snd_soc_update_bits(codec, CS42L73_PWRCTL1, PDN, 0); + break; + + case SND_SOC_BIAS_PREPARE: + break; + + case SND_SOC_BIAS_STANDBY: + if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { + regcache_cache_only(cs42l73->regmap, false); + regcache_sync(cs42l73->regmap); + } + snd_soc_update_bits(codec, CS42L73_PWRCTL1, PDN, 1); + break; + + case SND_SOC_BIAS_OFF: + snd_soc_update_bits(codec, CS42L73_PWRCTL1, PDN, 1); + snd_soc_update_bits(codec, CS42L73_DMMCC, MCLKDIS, 1); + break; + } + codec->dapm.bias_level = level; + return 0; +} + +static int cs42l73_set_tristate(struct snd_soc_dai *dai, int tristate) +{ + struct snd_soc_codec *codec = dai->codec; + int id = dai->id; + + return snd_soc_update_bits(codec, CS42L73_SPC(id), + 0x7F, tristate << 7); +} + +static struct snd_pcm_hw_constraint_list constraints_12_24 = { + .count = ARRAY_SIZE(cs42l73_asrc_rates), + .list = cs42l73_asrc_rates, +}; + +static int cs42l73_pcm_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + snd_pcm_hw_constraint_list(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_RATE, + &constraints_12_24); + return 0; +} + +/* SNDRV_PCM_RATE_KNOT -> 12000, 24000 Hz, limit with constraint list */ +#define CS42L73_RATES (SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_KNOT) + + +#define CS42L73_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ + SNDRV_PCM_FMTBIT_S24_LE) + +static const struct snd_soc_dai_ops cs42l73_ops = { + .startup = cs42l73_pcm_startup, + .hw_params = cs42l73_pcm_hw_params, + .set_fmt = cs42l73_set_dai_fmt, + .set_sysclk = cs42l73_set_sysclk, + .set_tristate = cs42l73_set_tristate, +}; + +static struct snd_soc_dai_driver cs42l73_dai[] = { + { + .name = "cs42l73-xsp", + .id = CS42L73_XSP, + .playback = { + .stream_name = "XSP Playback", + .channels_min = 1, + .channels_max = 2, + .rates = CS42L73_RATES, + .formats = CS42L73_FORMATS, + }, + .capture = { + .stream_name = "XSP Capture", + .channels_min = 1, + .channels_max = 2, + .rates = CS42L73_RATES, + .formats = CS42L73_FORMATS, + }, + .ops = &cs42l73_ops, + .symmetric_rates = 1, + }, + { + .name = "cs42l73-asp", + .id = CS42L73_ASP, + .playback = { + .stream_name = "ASP Playback", + .channels_min = 2, + .channels_max = 2, + .rates = CS42L73_RATES, + .formats = CS42L73_FORMATS, + }, + .capture = { + .stream_name = "ASP Capture", + .channels_min = 2, + .channels_max = 2, + .rates = CS42L73_RATES, + .formats = CS42L73_FORMATS, + }, + .ops = &cs42l73_ops, + .symmetric_rates = 1, + }, + { + .name = "cs42l73-vsp", + .id = CS42L73_VSP, + .playback = { + .stream_name = "VSP Playback", + .channels_min = 1, + .channels_max = 2, + .rates = CS42L73_RATES, + .formats = CS42L73_FORMATS, + }, + .capture = { + .stream_name = "VSP Capture", + .channels_min = 1, + .channels_max = 2, + .rates = CS42L73_RATES, + .formats = CS42L73_FORMATS, + }, + .ops = &cs42l73_ops, + .symmetric_rates = 1, + } +}; + +static int cs42l73_suspend(struct snd_soc_codec *codec, pm_message_t state) +{ + cs42l73_set_bias_level(codec, SND_SOC_BIAS_OFF); + + return 0; +} + +static int cs42l73_resume(struct snd_soc_codec *codec) +{ + + struct cs42l73_private *cs42l73 = snd_soc_codec_get_drvdata(codec); + regcache_sync(cs42l73->regmap); + + cs42l73_set_bias_level(codec, SND_SOC_BIAS_STANDBY); + return 0; +} + +static int cs42l73_probe(struct snd_soc_codec *codec) +{ + int ret; + struct cs42l73_private *cs42l73 = snd_soc_codec_get_drvdata(codec); + + codec->control_data = cs42l73->regmap; + + ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP); + if (ret < 0) { + dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); + return ret; + } + + regcache_cache_only(cs42l73->regmap, true); + + cs42l73_set_bias_level(codec, SND_SOC_BIAS_STANDBY); + + cs42l73->mclksel = CS42L73_CLKID_MCLK1; /* MCLK1 as master clk */ + cs42l73->mclk = 0; + + return ret; +} + +static int cs42l73_remove(struct snd_soc_codec *codec) +{ + cs42l73_set_bias_level(codec, SND_SOC_BIAS_OFF); + return 0; +} + +static struct snd_soc_codec_driver soc_codec_dev_cs42l73 = { + .probe = cs42l73_probe, + .remove = cs42l73_remove, + .suspend = cs42l73_suspend, + .resume = cs42l73_resume, + .set_bias_level = cs42l73_set_bias_level, + + .dapm_widgets = cs42l73_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(cs42l73_dapm_widgets), + .dapm_routes = cs42l73_audio_map, + .num_dapm_routes = ARRAY_SIZE(cs42l73_audio_map), + + .controls = cs42l73_snd_controls, + .num_controls = ARRAY_SIZE(cs42l73_snd_controls), +}; + +static struct regmap_config cs42l73_regmap = { + .reg_bits = 8, + .val_bits = 8, + + .max_register = CS42L73_MAX_REGISTER, + .reg_defaults = cs42l73_reg_defaults, + .num_reg_defaults = ARRAY_SIZE(cs42l73_reg_defaults), + .volatile_reg = cs42l73_volatile_register, + .readable_reg = cs42l73_readable_register, + .cache_type = REGCACHE_RBTREE, +}; + +static __devinit int cs42l73_i2c_probe(struct i2c_client *i2c_client, + const struct i2c_device_id *id) +{ + struct cs42l73_private *cs42l73; + int ret; + unsigned int devid = 0; + unsigned int reg; + + cs42l73 = kzalloc((sizeof *cs42l73), GFP_KERNEL); + if (!cs42l73) { + dev_err(&i2c_client->dev, "could not allocate codec\n"); + return -ENOMEM; + } + + i2c_set_clientdata(i2c_client, cs42l73); + + cs42l73->regmap = regmap_init_i2c(i2c_client, &cs42l73_regmap); + if (IS_ERR(cs42l73->regmap)) { + ret = PTR_ERR(cs42l73->regmap); + dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret); + goto err; + } + /* initialize codec */ + ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_AB, ®); + devid = (reg & 0xFF) << 12; + + ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_CD, ®); + devid |= (reg & 0xFF) << 4; + + ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_E, ®); + devid |= (reg & 0xF0) >> 4; + + + if (devid != CS42L73_DEVID) { + dev_err(&i2c_client->dev, + "CS42L73 Device ID (%X). Expected %X\n", + devid, CS42L73_DEVID); + goto err_regmap; + } + + ret = regmap_read(cs42l73->regmap, CS42L73_REVID, ®); + if (ret < 0) { + dev_err(&i2c_client->dev, "Get Revision ID failed\n"); + goto err_regmap; + } + + dev_info(&i2c_client->dev, + "Cirrus Logic CS42L73, Revision: %02X\n", ret & 0xFF); + + regcache_cache_only(cs42l73->regmap, true); + + ret = snd_soc_register_codec(&i2c_client->dev, + &soc_codec_dev_cs42l73, cs42l73_dai, + ARRAY_SIZE(cs42l73_dai)); + if (ret < 0) + goto err_regmap; + return 0; + +err_regmap: + regmap_exit(cs42l73->regmap); + +err: + kfree(cs42l73); + + return ret; +} + +static __devexit int cs42l73_i2c_remove(struct i2c_client *client) +{ + struct cs42l73_private *cs42l73 = i2c_get_clientdata(client); + + snd_soc_unregister_codec(&client->dev); + regmap_exit(cs42l73->regmap); + + kfree(cs42l73); + return 0; +} + +static const struct i2c_device_id cs42l73_id[] = { + {"cs42l73", 0}, + {} +}; + +MODULE_DEVICE_TABLE(i2c, cs42l73_id); + +static struct i2c_driver cs42l73_i2c_driver = { + .driver = { + .name = "cs42l73", + .owner = THIS_MODULE, + }, + .id_table = cs42l73_id, + .probe = cs42l73_i2c_probe, + .remove = __devexit_p(cs42l73_i2c_remove), + +}; + +static int __init cs42l73_modinit(void) +{ + int ret; + ret = i2c_add_driver(&cs42l73_i2c_driver); + if (ret != 0) { + pr_err("Failed to register CS42L73 I2C driver: %d\n", ret); + return ret; + } + return 0; +} + +module_init(cs42l73_modinit); + +static void __exit cs42l73_exit(void) +{ + i2c_del_driver(&cs42l73_i2c_driver); +} + +module_exit(cs42l73_exit); + +MODULE_DESCRIPTION("ASoC CS42L73 driver"); +MODULE_AUTHOR("Georgi Vlaev, Nucleus Systems Ltd, "); +MODULE_AUTHOR("Brian Austin, Cirrus Logic Inc, "); +MODULE_LICENSE("GPL"); diff --git a/sound/soc/codecs/cs42l73.h b/sound/soc/codecs/cs42l73.h new file mode 100644 index 0000000..7c3bf7f --- /dev/null +++ b/sound/soc/codecs/cs42l73.h @@ -0,0 +1,227 @@ +/* + * ALSA SoC CS42L73 codec driver + * + * Copyright 2011 Cirrus Logic, Inc. + * + * Author: Georgi Vlaev + * Brian Austin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef __CS42L73_H__ +#define __CS42L73_H__ + +/* I2C Registers */ +/* I2C Address: 1001010[R/W] - 10010100 = 0x94(Write); 10010101 = 0x95(Read) */ +#define CS42L73_CHIP_ID 0x4a +#define CS42L73_DEVID_AB 0x01 /* Device ID A & B [RO]. */ +#define CS42L73_DEVID_CD 0x02 /* Device ID C & D [RO]. */ +#define CS42L73_DEVID_E 0x03 /* Device ID E [RO]. */ +#define CS42L73_REVID 0x05 /* Revision ID [RO]. */ +#define CS42L73_PWRCTL1 0x06 /* Power Control 1. */ +#define CS42L73_PWRCTL2 0x07 /* Power Control 2. */ +#define CS42L73_PWRCTL3 0x08 /* Power Control 3. */ +#define CS42L73_CPFCHC 0x09 /* Charge Pump Freq. Class H Ctl. */ +#define CS42L73_OLMBMSDC 0x0A /* Output Load, MIC Bias, MIC2 SDT */ +#define CS42L73_DMMCC 0x0B /* Digital MIC & Master Clock Ctl. */ +#define CS42L73_XSPC 0x0C /* Auxiliary Serial Port (XSP) Ctl. */ +#define CS42L73_XSPMMCC 0x0D /* XSP Master Mode Clocking Control. */ +#define CS42L73_ASPC 0x0E /* Audio Serial Port (ASP) Control. */ +#define CS42L73_ASPMMCC 0x0F /* ASP Master Mode Clocking Control. */ +#define CS42L73_VSPC 0x10 /* Voice Serial Port (VSP) Control. */ +#define CS42L73_VSPMMCC 0x11 /* VSP Master Mode Clocking Control. */ +#define CS42L73_VXSPFS 0x12 /* VSP & XSP Sample Rate. */ +#define CS42L73_MIOPC 0x13 /* Misc. Input & Output Path Control. */ +#define CS42L73_ADCIPC 0x14 /* ADC/IP Control. */ +#define CS42L73_MICAPREPGAAVOL 0x15 /* MIC 1 [A] PreAmp, PGAA Vol. */ +#define CS42L73_MICBPREPGABVOL 0x16 /* MIC 2 [B] PreAmp, PGAB Vol. */ +#define CS42L73_IPADVOL 0x17 /* Input Pat7h A Digital Volume. */ +#define CS42L73_IPBDVOL 0x18 /* Input Path B Digital Volume. */ +#define CS42L73_PBDC 0x19 /* Playback Digital Control. */ +#define CS42L73_HLADVOL 0x1A /* HP/Line A Out Digital Vol. */ +#define CS42L73_HLBDVOL 0x1B /* HP/Line B Out Digital Vol. */ +#define CS42L73_SPKDVOL 0x1C /* Spkphone Out [A] Digital Vol. */ +#define CS42L73_ESLDVOL 0x1D /* Ear/Spkphone LO [B] Digital */ +#define CS42L73_HPAAVOL 0x1E /* HP A Analog Volume. */ +#define CS42L73_HPBAVOL 0x1F /* HP B Analog Volume. */ +#define CS42L73_LOAAVOL 0x20 /* Line Out A Analog Volume. */ +#define CS42L73_LOBAVOL 0x21 /* Line Out B Analog Volume. */ +#define CS42L73_STRINV 0x22 /* Stereo Input Path Adv. Vol. */ +#define CS42L73_XSPINV 0x23 /* Auxiliary Port Input Advisory Vol. */ +#define CS42L73_ASPINV 0x24 /* Audio Port Input Advisory Vol. */ +#define CS42L73_VSPINV 0x25 /* Voice Port Input Advisory Vol. */ +#define CS42L73_LIMARATEHL 0x26 /* Lmtr Attack Rate HP/Line. */ +#define CS42L73_LIMRRATEHL 0x27 /* Lmtr Ctl, Rel.Rate HP/Line. */ +#define CS42L73_LMAXHL 0x28 /* Lmtr Thresholds HP/Line. */ +#define CS42L73_LIMARATESPK 0x29 /* Lmtr Attack Rate Spkphone [A]. */ +#define CS42L73_LIMRRATESPK 0x2A /* Lmtr Ctl,Release Rate Spk. [A]. */ +#define CS42L73_LMAXSPK 0x2B /* Lmtr Thresholds Spkphone [A]. */ +#define CS42L73_LIMARATEESL 0x2C /* Lmtr Attack Rate */ +#define CS42L73_LIMRRATEESL 0x2D /* Lmtr Ctl,Release Rate */ +#define CS42L73_LMAXESL 0x2E /* Lmtr Thresholds */ +#define CS42L73_ALCARATE 0x2F /* ALC Enable, Attack Rate AB. */ +#define CS42L73_ALCRRATE 0x30 /* ALC Release Rate AB. */ +#define CS42L73_ALCMINMAX 0x31 /* ALC Thresholds AB. */ +#define CS42L73_NGCAB 0x32 /* Noise Gate Ctl AB. */ +#define CS42L73_ALCNGMC 0x33 /* ALC & Noise Gate Misc Ctl. */ +#define CS42L73_MIXERCTL 0x34 /* Mixer Control. */ +#define CS42L73_HLAIPAA 0x35 /* HP/LO Left Mixer: L. */ +#define CS42L73_HLBIPBA 0x36 /* HP/LO Right Mixer: R. */ +#define CS42L73_HLAXSPAA 0x37 /* HP/LO Left Mixer: XSP L */ +#define CS42L73_HLBXSPBA 0x38 /* HP/LO Right Mixer: XSP R */ +#define CS42L73_HLAASPAA 0x39 /* HP/LO Left Mixer: ASP L */ +#define CS42L73_HLBASPBA 0x3A /* HP/LO Right Mixer: ASP R */ +#define CS42L73_HLAVSPMA 0x3B /* HP/LO Left Mixer: VSP. */ +#define CS42L73_HLBVSPMA 0x3C /* HP/LO Right Mixer: VSP */ +#define CS42L73_XSPAIPAA 0x3D /* XSP Left Mixer: Left */ +#define CS42L73_XSPBIPBA 0x3E /* XSP Rt. Mixer: Right */ +#define CS42L73_XSPAXSPAA 0x3F /* XSP Left Mixer: XSP L */ +#define CS42L73_XSPBXSPBA 0x40 /* XSP Rt. Mixer: XSP R */ +#define CS42L73_XSPAASPAA 0x41 /* XSP Left Mixer: ASP L */ +#define CS42L73_XSPAASPBA 0x42 /* XSP Rt. Mixer: ASP R */ +#define CS42L73_XSPAVSPMA 0x43 /* XSP Left Mixer: VSP */ +#define CS42L73_XSPBVSPMA 0x44 /* XSP Rt. Mixer: VSP */ +#define CS42L73_ASPAIPAA 0x45 /* ASP Left Mixer: Left */ +#define CS42L73_ASPBIPBA 0x46 /* ASP Rt. Mixer: Right */ +#define CS42L73_ASPAXSPAA 0x47 /* ASP Left Mixer: XSP L */ +#define CS42L73_ASPBXSPBA 0x48 /* ASP Rt. Mixer: XSP R */ +#define CS42L73_ASPAASPAA 0x49 /* ASP Left Mixer: ASP L */ +#define CS42L73_ASPBASPBA 0x4A /* ASP Rt. Mixer: ASP R */ +#define CS42L73_ASPAVSPMA 0x4B /* ASP Left Mixer: VSP */ +#define CS42L73_ASPBVSPMA 0x4C /* ASP Rt. Mixer: VSP */ +#define CS42L73_VSPAIPAA 0x4D /* VSP Left Mixer: Left */ +#define CS42L73_VSPBIPBA 0x4E /* VSP Rt. Mixer: Right */ +#define CS42L73_VSPAXSPAA 0x4F /* VSP Left Mixer: XSP L */ +#define CS42L73_VSPBXSPBA 0x50 /* VSP Rt. Mixer: XSP R */ +#define CS42L73_VSPAASPAA 0x51 /* VSP Left Mixer: ASP Left */ +#define CS42L73_VSPBASPBA 0x52 /* VSP Rt. Mixer: ASP Right */ +#define CS42L73_VSPAVSPMA 0x53 /* VSP Left Mixer: VSP */ +#define CS42L73_VSPBVSPMA 0x54 /* VSP Rt. Mixer: VSP */ +#define CS42L73_MMIXCTL 0x55 /* Mono Mixer Controls. */ +#define CS42L73_SPKMIPMA 0x56 /* SPK Mono Mixer: In. Path */ +#define CS42L73_SPKMXSPA 0x57 /* SPK Mono Mixer: XSP Mono/L/R Att. */ +#define CS42L73_SPKMASPA 0x58 /* SPK Mono Mixer: ASP Mono/L/R Att. */ +#define CS42L73_SPKMVSPMA 0x59 /* SPK Mono Mixer: VSP Mono Atten. */ +#define CS42L73_ESLMIPMA 0x5A /* Ear/SpLO Mono Mixer: */ +#define CS42L73_ESLMXSPA 0x5B /* Ear/SpLO Mono Mixer: XSP */ +#define CS42L73_ESLMASPA 0x5C /* Ear/SpLO Mono Mixer: ASP */ +#define CS42L73_ESLMVSPMA 0x5D /* Ear/SpLO Mono Mixer: VSP */ +#define CS42L73_IM1 0x5E /* Interrupt Mask 1. */ +#define CS42L73_IM2 0x5F /* Interrupt Mask 2. */ +#define CS42L73_IS1 0x60 /* Interrupt Status 1 [RO]. */ +#define CS42L73_IS2 0x61 /* Interrupt Status 2 [RO]. */ +#define CS42L73_MAX_REGISTER 0x61 /* Total Registers */ +/* Bitfield Definitions */ + +/* CS42L73_PWRCTL1 */ +#define PDN_ADCB (1 << 7) +#define PDN_DMICB (1 << 6) +#define PDN_ADCA (1 << 5) +#define PDN_DMICA (1 << 4) +#define PDN_LDO (1 << 2) +#define DISCHG_FILT (1 << 1) +#define PDN (1 << 0) + +/* CS42L73_PWRCTL2 */ +#define PDN_MIC2_BIAS (1 << 7) +#define PDN_MIC1_BIAS (1 << 6) +#define PDN_VSP (1 << 4) +#define PDN_ASP_SDOUT (1 << 3) +#define PDN_ASP_SDIN (1 << 2) +#define PDN_XSP_SDOUT (1 << 1) +#define PDN_XSP_SDIN (1 << 0) + +/* CS42L73_PWRCTL3 */ +#define PDN_THMS (1 << 5) +#define PDN_SPKLO (1 << 4) +#define PDN_EAR (1 << 3) +#define PDN_SPK (1 << 2) +#define PDN_LO (1 << 1) +#define PDN_HP (1 << 0) + +/* Thermal Overload Detect. Requires interrupt ... */ +#define THMOVLD_150C 0 +#define THMOVLD_132C 1 +#define THMOVLD_115C 2 +#define THMOVLD_098C 3 + + +/* CS42L73_ASPC, CS42L73_XSPC, CS42L73_VSPC */ +#define SP_3ST (1 << 7) +#define SPDIF_I2S 0 +#define SPDIF_PCM (1 << 6) +#define PCM_MODE0 0 +#define PCM_MODE1 1 +#define PCM_MODE2 2 +#define PCM_BO_MSBLSB 0 +#define PCM_BO_LSBMSB 1 +#define MCK_SCLK_64FS 0 +#define MCK_SCLK_MCLK 2 +#define MCK_SCLK_PREMCLK 3 + +/* CS42L73_xSPMMCC */ +#define MS_MASTER (1 << 7) + + +/* CS42L73_DMMCC */ +#define MCLKDIS (1 << 0) +#define MCLKSEL_MCLK2 (1 << 4) +#define MCLKSEL_MCLK1 (0 << 4) + +/* CS42L73 MCLK derived from MCLK1 or MCLK2 */ +#define CS42L73_CLKID_MCLK1 0 +#define CS42L73_CLKID_MCLK2 1 + +#define CS42L73_MCLKXDIV 0 +#define CS42L73_MMCCDIV 1 + +#define CS42L73_XSP 0 +#define CS42L73_ASP 1 +#define CS42L73_VSP 2 + +/* IS1, IM1 */ +#define MIC2_SDET (1 << 6) +#define THMOVLD (1 << 4) +#define DIGMIXOVFL (1 << 3) +#define IPBOVFL (1 << 1) +#define IPAOVFL (1 << 0) + +/* Analog Softramp */ +#define ANLGOSFT (1 << 0) + +/* HP A/B Analog Mute */ +#define HPA_MUTE (1 << 7) +/* LO A/B Analog Mute */ +#define LOA_MUTE (1 << 7) +/* Digital Mute */ +#define HLAD_MUTE (1 << 0) +#define HLBD_MUTE (1 << 1) +#define SPKD_MUTE (1 << 2) +#define ESLD_MUTE (1 << 3) + +/* Misc defines for codec */ +#define CS42L73_RESET_GPIO 143 + +#define CS42L73_DEVID 0x00042A73 +#define CS42L73_MCLKX_MIN 5644800 +#define CS42L73_MCLKX_MAX 38400000 + +#define CS42L73_SPC(id) (CS42L73_XSPC + (id << 1)) +#define CS42L73_MMCC(id) (CS42L73_XSPMMCC + (id << 1)) +#define CS42L73_SPFS(id) ((id == CS42L73_ASP) ? CS42L73_ASPC : CS42L73_VXSPFS) + +#endif /* __CS42L73_H__ */ -- cgit v1.1 From 43fa8e53379003c92e6aabaf7b3e19bd482947bb Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Thu, 17 Nov 2011 12:01:28 +0200 Subject: ASoC: alc5632: Remove unrelevant registers and name the relevant Signed-off-by: Leon Romanovsky Signed-off-by: Mark Brown --- sound/soc/codecs/alc5632.c | 161 ++++++++++++++------------------------------- 1 file changed, 49 insertions(+), 112 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index 6bfbbc7..9660542 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -36,118 +36,55 @@ * ALC5632 register cache */ static struct reg_default alc5632_reg_defaults[] = { - { 0, 0x59B4 }, - { 1, 0x0000 }, - { 2, 0x8080 }, - { 3, 0x0000 }, - { 4, 0x8080 }, - { 5, 0x0000 }, - { 6, 0x8080 }, - { 7, 0x0000 }, - { 8, 0xC800 }, - { 9, 0x0000 }, - { 10, 0xE808 }, - { 11, 0x0000 }, - { 12, 0x1010 }, - { 13, 0x0000 }, - { 14, 0x0808 }, - { 15, 0x0000 }, - { 16, 0xEE0F }, - { 17, 0x0000 }, - { 18, 0xCBCB }, - { 19, 0x0000 }, - { 20, 0x7F7F }, - { 21, 0x0000 }, - { 22, 0x0000 }, - { 23, 0x0000 }, - { 24, 0xE010 }, - { 25, 0x0000 }, - { 26, 0x0000 }, - { 27, 0x0000 }, - { 28, 0x8008 }, - { 29, 0x0000 }, - { 30, 0x0000 }, - { 31, 0x0000 }, - { 32, 0x0000 }, - { 33, 0x0000 }, - { 34, 0x0000 }, - { 35, 0x0000 }, - { 36, 0x00C0 }, - { 37, 0x0000 }, - { 38, 0xEF00 }, - { 39, 0x0000 }, - { 40, 0x0000 }, - { 41, 0x0000 }, - { 42, 0x0000 }, - { 43, 0x0000 }, - { 44, 0x0000 }, - { 45, 0x0000 }, - { 46, 0x0000 }, - { 47, 0x0000 }, - { 48, 0x0000 }, - { 49, 0x0000 }, - { 50, 0x0000 }, - { 51, 0x0000 }, - { 52, 0x8000 }, - { 53, 0x0000 }, - { 54, 0x0000 }, - { 55, 0x0000 }, - { 56, 0x0000 }, - { 57, 0x0000 }, - { 58, 0x0000 }, - { 59, 0x0000 }, - { 60, 0x0000 }, - { 61, 0x0000 }, - { 62, 0x8000 }, - { 63, 0x0000 }, - { 64, 0x0C0A }, - { 65, 0x0000 }, - { 66, 0x0000 }, - { 67, 0x0000 }, - { 68, 0x0000 }, - { 69, 0x0000 }, - { 70, 0x0000 }, - { 71, 0x0000 }, - { 72, 0x0000 }, - { 73, 0x0000 }, - { 74, 0x0000 }, - { 75, 0x0000 }, - { 76, 0xBE3E }, - { 77, 0x0000 }, - { 78, 0xBE3E }, - { 79, 0x0000 }, - { 80, 0x0000 }, - { 81, 0x0000 }, - { 82, 0x0000 }, - { 83, 0x0000 }, - { 84, 0x803A }, - { 85, 0x0000 }, - { 86, 0x0000 }, - { 87, 0x0000 }, - { 88, 0x0000 }, - { 89, 0x0000 }, - { 90, 0x0009 }, - { 91, 0x0000 }, - { 92, 0x0000 }, - { 93, 0x0000 }, - { 94, 0x3000 }, - { 95, 0x0000 }, - { 96, 0x3075 }, - { 97, 0x0000 }, - { 98, 0x1010 }, - { 99, 0x0000 }, - { 100, 0x3110 }, - { 101, 0x0000 }, - { 102, 0x0000 }, - { 103, 0x0000 }, - { 104, 0x0553 }, - { 105, 0x0000 }, - { 106, 0x0000 }, - { 107, 0x0000 }, - { 108, 0x0000 }, - { 109, 0x0000 }, - { 110, 0x0000 }, - { 111, 0x0000 }, + { 0, 0x59B4 }, /* R0 - Reset */ + { 2, 0x8080 }, /* R2 - Speaker Output Volume */ + { 4, 0x8080 }, /* R4 - Headphone Output Volume */ + { 6, 0x8080 }, /* R6 - AUXOUT Volume */ + { 8, 0xC800 }, /* R8 - Phone Input */ + { 10, 0xE808 }, /* R10 - LINE_IN Volume */ + { 12, 0x1010 }, /* R12 - STEREO DAC Input Volume */ + { 14, 0x0808 }, /* R14 - MIC Input Volume */ + { 16, 0xEE0F }, /* R16 - Stereo DAC and MIC Routing Control */ + { 18, 0xCBCB }, /* R18 - ADC Record Gain */ + { 20, 0x7F7F }, /* R20 - ADC Record Mixer Control */ + { 24, 0xE010 }, /* R24 - Voice DAC Volume */ + { 28, 0x8008 }, /* R28 - Output Mixer Control */ + { 34, 0x0000 }, /* R34 - Microphone Control */ + { 36, 0x00C0 }, /* R36 - Codec Digital MIC/Digital Boost + Control */ + { 38, 0xEF00 }, /* R38 - Power Down Control/Status */ + { 46, 0x0000 }, /* R46 - Stereo DAC/Voice DAC/Stereo ADC + Function Select */ + { 52, 0x8000 }, /* R52 - Main Serial Data Port Control + (Stereo I2S) */ + { 54, 0x0000 }, /* R54 - Extend Serial Data Port Control + (VoDAC_I2S/PCM) */ + { 58, 0x0000 }, /* R58 - Power Management Addition 1 */ + { 60, 0x0000 }, /* R60 - Power Management Addition 2 */ + { 62, 0x8000 }, /* R62 - Power Management Addition 3 */ + { 64, 0x0C0A }, /* R64 - General Purpose Control Register 1 */ + { 66, 0x0000 }, /* R66 - General Purpose Control Register 2 */ + { 68, 0x0000 }, /* R68 - PLL1 Control */ + { 70, 0x0000 }, /* R70 - PLL2 Control */ + { 76, 0xBE3E }, /* R76 - GPIO Pin Configuration */ + { 78, 0xBE3E }, /* R78 - GPIO Pin Polarity */ + { 80, 0x0000 }, /* R80 - GPIO Pin Sticky */ + { 82, 0x0000 }, /* R82 - GPIO Pin Wake Up */ + { 84, 0x803A }, /* R84 - GPIO Pin Status */ + { 86, 0x0000 }, /* R86 - Pin Sharing */ + { 88, 0x0000 }, /* R88 - Over-Temp/Current Status */ + { 90, 0x0009 }, /* R90 - Soft Volume Control Setting */ + { 92, 0x0000 }, /* R92 - GPIO_Output Pin Control */ + { 94, 0x3000 }, /* R94 - MISC Control */ + { 96, 0x3075 }, /* R96 - Stereo DAC Clock Control_1 */ + { 98, 0x1010 }, /* R98 - Stereo DAC Clock Control_2 */ + { 100, 0x3110 }, /* R100 - VoDAC_PCM Clock Control_1 */ + { 104, 0x0553 }, /* R104 - Pseudo Stereo and Spatial Effect + Block Control */ + { 106, 0x0000 }, /* R106 - Private Register Address */ + { 108, 0x0000 }, /* R108 - Private Register Data */ + { 110, 0x0000 }, /* R110 - EQ Control and Status/ADC + HPF Control */ }; /* codec private data */ -- cgit v1.1 From 9b4156cbe9c18605d42ecf80bb99364d0c5b884a Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Thu, 17 Nov 2011 12:01:29 +0200 Subject: ASoC: alc5632: Added support of two undocumented registers There are two undocumented registers in use in alc5632_i2c_probe function. It must be added to support future rewrite of this function to use regmap API completely. Signed-off-by: Leon Romanovsky Signed-off-by: Mark Brown --- sound/soc/codecs/alc5632.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index 9660542..be10228 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -104,6 +104,8 @@ static bool alc5632_volatile_register(struct device *dev, case ALC5632_OVER_CURR_STATUS: case ALC5632_HID_CTRL_DATA: case ALC5632_EQ_CTRL: + case ALC5632_VENDOR_ID1: + case ALC5632_VENDOR_ID2: return true; default: -- cgit v1.1 From 277c01bb45a4924b1741fd41c353860e8d530f6f Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Thu, 17 Nov 2011 12:01:30 +0200 Subject: ASoC: alc5632: Update of i2c_probe function to use regmap API only Signed-off-by: Leon Romanovsky Signed-off-by: Mark Brown --- sound/soc/codecs/alc5632.c | 67 +++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 37 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index be10228..c32eade 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -1053,48 +1053,14 @@ static __devinit int alc5632_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct alc5632_priv *alc5632; - int ret, vid1, vid2; - - vid1 = i2c_smbus_read_word_data(client, ALC5632_VENDOR_ID1); - if (vid1 < 0) { - dev_err(&client->dev, "failed to read I2C\n"); - return -EIO; - } else { - dev_info(&client->dev, "got vid1: %x\n", vid1); - } - vid1 = ((vid1 & 0xff) << 8) | (vid1 >> 8); - - vid2 = i2c_smbus_read_word_data(client, ALC5632_VENDOR_ID2); - if (vid2 < 0) { - dev_err(&client->dev, "failed to read I2C\n"); - return -EIO; - } else { - dev_info(&client->dev, "got vid2: %x\n", vid2); - } - vid2 = (vid2 & 0xff); - - if ((vid1 != 0x10ec) || (vid2 != id->driver_data)) { - dev_err(&client->dev, "unknown or wrong codec\n"); - dev_err(&client->dev, "Expected %x:%lx, got %x:%x\n", - 0x10ec, id->driver_data, - vid1, vid2); - return -ENODEV; - } + int ret, ret1, ret2; + unsigned int vid1, vid2; alc5632 = devm_kzalloc(&client->dev, sizeof(struct alc5632_priv), GFP_KERNEL); if (alc5632 == NULL) return -ENOMEM; - alc5632->id = vid2; - switch (alc5632->id) { - case 0x5c: - alc5632_dai.name = "alc5632-hifi"; - break; - default: - return -EINVAL; - } - i2c_set_clientdata(client, alc5632); alc5632->regmap = regmap_init_i2c(client, &alc5632_regmap); @@ -1104,6 +1070,24 @@ static __devinit int alc5632_i2c_probe(struct i2c_client *client, return ret; } + ret1 = regmap_read(alc5632->regmap, ALC5632_VENDOR_ID1, &vid1); + ret2 = regmap_read(alc5632->regmap, ALC5632_VENDOR_ID2, &vid2); + if (ret1 != 0 || ret2 != 0) { + dev_err(&client->dev, + "Failed to read chip ID: ret1=%d, ret2=%d\n", ret1, ret2); + regmap_exit(alc5632->regmap); + return -EIO; + } + + vid2 >>= 8; + + if ((vid1 != 0x10EC) || (vid2 != id->driver_data)) { + dev_err(&client->dev, + "Device is not a ALC5632: VID1=0x%x, VID2=0x%x\n", vid1, vid2); + regmap_exit(alc5632->regmap); + return -EINVAL; + } + ret = alc5632_reset(alc5632->regmap); if (ret < 0) { dev_err(&client->dev, "Failed to issue reset\n"); @@ -1111,7 +1095,16 @@ static __devinit int alc5632_i2c_probe(struct i2c_client *client, return ret; } - ret = snd_soc_register_codec(&client->dev, + alc5632->id = vid2; + switch (alc5632->id) { + case 0x5c: + alc5632_dai.name = "alc5632-hifi"; + break; + default: + return -EINVAL; + } + + ret = snd_soc_register_codec(&client->dev, &soc_codec_device_alc5632, &alc5632_dai, 1); if (ret < 0) { -- cgit v1.1 From 2f534edc1505ab7c6abd4b3389ba3842bf643235 Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Thu, 17 Nov 2011 18:48:42 +0200 Subject: ASoC: alc5632: Remove volatile registers from regmap defaults There is no need to provide defaults for the volatile registers and doing so might cause confusion. Signed-off-by: Leon Romanovsky Signed-off-by: Mark Brown --- sound/soc/codecs/alc5632.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index c32eade..2d77665 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -36,7 +36,6 @@ * ALC5632 register cache */ static struct reg_default alc5632_reg_defaults[] = { - { 0, 0x59B4 }, /* R0 - Reset */ { 2, 0x8080 }, /* R2 - Speaker Output Volume */ { 4, 0x8080 }, /* R4 - Headphone Output Volume */ { 6, 0x8080 }, /* R6 - AUXOUT Volume */ @@ -52,7 +51,6 @@ static struct reg_default alc5632_reg_defaults[] = { { 34, 0x0000 }, /* R34 - Microphone Control */ { 36, 0x00C0 }, /* R36 - Codec Digital MIC/Digital Boost Control */ - { 38, 0xEF00 }, /* R38 - Power Down Control/Status */ { 46, 0x0000 }, /* R46 - Stereo DAC/Voice DAC/Stereo ADC Function Select */ { 52, 0x8000 }, /* R52 - Main Serial Data Port Control @@ -70,9 +68,7 @@ static struct reg_default alc5632_reg_defaults[] = { { 78, 0xBE3E }, /* R78 - GPIO Pin Polarity */ { 80, 0x0000 }, /* R80 - GPIO Pin Sticky */ { 82, 0x0000 }, /* R82 - GPIO Pin Wake Up */ - { 84, 0x803A }, /* R84 - GPIO Pin Status */ { 86, 0x0000 }, /* R86 - Pin Sharing */ - { 88, 0x0000 }, /* R88 - Over-Temp/Current Status */ { 90, 0x0009 }, /* R90 - Soft Volume Control Setting */ { 92, 0x0000 }, /* R92 - GPIO_Output Pin Control */ { 94, 0x3000 }, /* R94 - MISC Control */ @@ -82,9 +78,6 @@ static struct reg_default alc5632_reg_defaults[] = { { 104, 0x0553 }, /* R104 - Pseudo Stereo and Spatial Effect Block Control */ { 106, 0x0000 }, /* R106 - Private Register Address */ - { 108, 0x0000 }, /* R108 - Private Register Data */ - { 110, 0x0000 }, /* R110 - EQ Control and Status/ADC - HPF Control */ }; /* codec private data */ -- cgit v1.1 From d6018bb566f6eef277184278b105e04705e8aeb6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 21 Nov 2011 14:17:16 +0100 Subject: ALSA: hda - Fix a typo Reported-by: David Henningsson Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index e050f89..b703e25 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -5071,7 +5071,7 @@ static const char *check_output_sfx(hda_nid_t nid, const hda_nid_t *pins, int num_pins, int *indexp) { static const char * const channel_sfx[] = { - " Front", " Surrount", " CLFE", " Side" + " Front", " Surround", " CLFE", " Side" }; int i; -- cgit v1.1 From 358b6e62b86f6313d114e0f6b7d8f8adaf85ed9c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 21 Nov 2011 14:34:20 +0100 Subject: ALSA: hda - Don't add channel suffix for headphone pin labels The multiple headphone pins are usually handled as copied from the same source, not as individual channels like front and surround. Thus it'd be more correct to avoid the channel suffix for "Headphone" pin labels in snd_hda_get_pin_label() but give an index number instead. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 52 ++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 21 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index b703e25..de3325e 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -5066,6 +5066,16 @@ const char *hda_get_autocfg_input_label(struct hda_codec *codec, } EXPORT_SYMBOL_HDA(hda_get_autocfg_input_label); +/* return the position of NID in the list, or -1 if not found */ +static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums) +{ + int i; + for (i = 0; i < nums; i++) + if (list[i] == nid) + return i; + return -1; +} + /* get a unique suffix or an index number */ static const char *check_output_sfx(hda_nid_t nid, const hda_nid_t *pins, int num_pins, int *indexp) @@ -5075,19 +5085,17 @@ static const char *check_output_sfx(hda_nid_t nid, const hda_nid_t *pins, }; int i; - for (i = 0; i < num_pins; i++) { - if (pins[i] == nid) { - if (num_pins == 1) - return ""; - if (num_pins > ARRAY_SIZE(channel_sfx)) { - if (indexp) - *indexp = i; - return ""; - } - return channel_sfx[i]; - } + i = find_idx_in_nid_list(nid, pins, num_pins); + if (i < 0) + return NULL; + if (num_pins == 1) + return ""; + if (num_pins > ARRAY_SIZE(channel_sfx)) { + if (indexp) + *indexp = i; + return ""; } - return NULL; + return channel_sfx[i]; } static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid, @@ -5116,13 +5124,16 @@ static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid, sfx = check_output_sfx(nid, cfg->line_out_pins, cfg->line_outs, indexp); if (!sfx) - sfx = check_output_sfx(nid, cfg->hp_pins, cfg->hp_outs, - indexp); - if (!sfx) sfx = check_output_sfx(nid, cfg->speaker_pins, cfg->speaker_outs, indexp); - if (!sfx) + if (!sfx) { + /* don't add channel suffix for Headphone controls */ + int idx = find_idx_in_nid_list(nid, cfg->hp_pins, + cfg->hp_outs); + if (idx >= 0) + *indexp = idx; sfx = ""; + } } snprintf(label, maxlen, "%s%s%s", pfx, name, sfx); return 1; @@ -5171,11 +5182,10 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, else name = "SPDIF"; if (cfg && indexp) { - for (i = 0; i < cfg->dig_outs; i++) - if (cfg->dig_out_pins[i] == nid) { - *indexp = i; - break; - } + i = find_idx_in_nid_list(nid, cfg->dig_out_pins, + cfg->dig_outs); + if (i >= 0) + *indexp = i; } break; default: -- cgit v1.1 From cb555318ca5dd5c1426c7a639aa1e90a88c8f024 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 21 Nov 2011 12:59:52 +0000 Subject: ASoC: Use table based init for wm8731_snd_controls Signed-off-by: Mark Brown --- sound/soc/codecs/wm8731.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 7e5ec03..f5161f3 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c @@ -553,9 +553,6 @@ static int wm8731_probe(struct snd_soc_codec *codec) /* Disable bypass path by default */ snd_soc_update_bits(codec, WM8731_APANA, 0x8, 0); - snd_soc_add_controls(codec, wm8731_snd_controls, - ARRAY_SIZE(wm8731_snd_controls)); - /* Regulators will have been enabled by bias management */ regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); @@ -595,6 +592,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8731 = { .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets), .dapm_routes = wm8731_intercon, .num_dapm_routes = ARRAY_SIZE(wm8731_intercon), + .controls = wm8731_snd_controls, + .num_controls = ARRAY_SIZE(wm8731_snd_controls), }; static const struct of_device_id wm8731_of_match[] = { -- cgit v1.1 From ea0756158110fef07b2f2975e38890cecde6a1ce Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 19 Nov 2011 10:15:53 +0800 Subject: ASoC: cs42l73: Return proper error code if device id mismatch Return -ENODEV instead of 0 if device id mismatch. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l73.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 6fe259a..fdd8aa20 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -1369,6 +1369,7 @@ static __devinit int cs42l73_i2c_probe(struct i2c_client *i2c_client, if (devid != CS42L73_DEVID) { + ret = -ENODEV; dev_err(&i2c_client->dev, "CS42L73 Device ID (%X). Expected %X\n", devid, CS42L73_DEVID); -- cgit v1.1 From 8421f620da9717dade941d0dc9570ad731b4a9ca Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 19 Nov 2011 10:17:36 +0800 Subject: ASoC: cs42l73: Show correct revision id Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l73.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index fdd8aa20..1b773bf 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -1383,7 +1383,7 @@ static __devinit int cs42l73_i2c_probe(struct i2c_client *i2c_client, } dev_info(&i2c_client->dev, - "Cirrus Logic CS42L73, Revision: %02X\n", ret & 0xFF); + "Cirrus Logic CS42L73, Revision: %02X\n", reg & 0xFF); regcache_cache_only(cs42l73->regmap, true); -- cgit v1.1 From afe713089a5cce680ff76fab554c42d5cbb577d0 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 19 Nov 2011 13:45:34 +0800 Subject: ASoC: Remove redundant regcache_sync call in cs42l73_resume It's done in cs42l73_set_bias_level when the dapm.bias_level is switching from SND_SOC_BIAS_OFF to SND_SOC_BIAS_STANDBY. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l73.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 1b773bf..5544f14 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -1270,10 +1270,6 @@ static int cs42l73_suspend(struct snd_soc_codec *codec, pm_message_t state) static int cs42l73_resume(struct snd_soc_codec *codec) { - - struct cs42l73_private *cs42l73 = snd_soc_codec_get_drvdata(codec); - regcache_sync(cs42l73->regmap); - cs42l73_set_bias_level(codec, SND_SOC_BIAS_STANDBY); return 0; } -- cgit v1.1 From 56a926dd72bd836f71216ba5b034adb7f48e80e9 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 21 Nov 2011 15:46:51 +0000 Subject: ASoC: Convert WM8753 to table based DAPM and control init Signed-off-by: Mark Brown --- sound/soc/codecs/wm8753.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index 3a629d0..13156c83 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c @@ -486,7 +486,7 @@ SND_SOC_DAPM_INPUT("MIC2"), SND_SOC_DAPM_VMID("VREF"), }; -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route wm8753_dapm_routes[] = { /* left mixer */ {"Left Mixer", "Left Playback Switch", "Left DAC"}, {"Left Mixer", "Voice Playback Switch", "Voice DAC"}, @@ -640,17 +640,6 @@ static const struct snd_soc_dapm_route audio_map[] = { {"ACOP", NULL, "ALC Mixer"}, }; -static int wm8753_add_widgets(struct snd_soc_codec *codec) -{ - struct snd_soc_dapm_context *dapm = &codec->dapm; - - snd_soc_dapm_new_controls(dapm, wm8753_dapm_widgets, - ARRAY_SIZE(wm8753_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - - return 0; -} - /* PLL divisors */ struct _pll_div { u32 div2:1; @@ -1467,10 +1456,6 @@ static int wm8753_probe(struct snd_soc_codec *codec) snd_soc_update_bits(codec, WM8753_LINVOL, 0x0100, 0x0100); snd_soc_update_bits(codec, WM8753_RINVOL, 0x0100, 0x0100); - snd_soc_add_controls(codec, wm8753_snd_controls, - ARRAY_SIZE(wm8753_snd_controls)); - wm8753_add_widgets(codec); - return 0; } @@ -1492,6 +1477,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8753 = { .reg_cache_size = ARRAY_SIZE(wm8753_reg), .reg_word_size = sizeof(u16), .reg_cache_default = wm8753_reg, + + .controls = wm8753_snd_controls, + .num_controls = ARRAY_SIZE(wm8753_snd_controls), + .dapm_widgets = wm8753_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8753_dapm_widgets), + .dapm_routes = wm8753_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8753_dapm_routes), }; static const struct of_device_id wm8753_of_match[] = { -- cgit v1.1 From f733547aa30b9e85cc5f2739f3c236408157d2ce Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 2 Nov 2011 14:47:24 +0000 Subject: ASoC: Remove WM5100 DSP memory windows from register default data They're all volatile so shouldn't have defaults and as we've got pages into the DSP memory the registers themselves aren't that useful - a further patch adding support for the DSPs will provide direct diagnostic access to the DSP memories. Signed-off-by: Mark Brown --- sound/soc/codecs/wm5100-tables.c | 168 --------------------------------------- 1 file changed, 168 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm5100-tables.c b/sound/soc/codecs/wm5100-tables.c index 3e90dea..9a18fae 100644 --- a/sound/soc/codecs/wm5100-tables.c +++ b/sound/soc/codecs/wm5100-tables.c @@ -697,90 +697,6 @@ bool wm5100_readable_register(struct device *dev, unsigned int reg) case WM5100_HPLPF3_2: case WM5100_HPLPF4_1: case WM5100_HPLPF4_2: - case WM5100_DSP1_DM_0: - case WM5100_DSP1_DM_1: - case WM5100_DSP1_DM_2: - case WM5100_DSP1_DM_3: - case WM5100_DSP1_DM_508: - case WM5100_DSP1_DM_509: - case WM5100_DSP1_DM_510: - case WM5100_DSP1_DM_511: - case WM5100_DSP1_PM_0: - case WM5100_DSP1_PM_1: - case WM5100_DSP1_PM_2: - case WM5100_DSP1_PM_3: - case WM5100_DSP1_PM_4: - case WM5100_DSP1_PM_5: - case WM5100_DSP1_PM_1530: - case WM5100_DSP1_PM_1531: - case WM5100_DSP1_PM_1532: - case WM5100_DSP1_PM_1533: - case WM5100_DSP1_PM_1534: - case WM5100_DSP1_PM_1535: - case WM5100_DSP1_ZM_0: - case WM5100_DSP1_ZM_1: - case WM5100_DSP1_ZM_2: - case WM5100_DSP1_ZM_3: - case WM5100_DSP1_ZM_2044: - case WM5100_DSP1_ZM_2045: - case WM5100_DSP1_ZM_2046: - case WM5100_DSP1_ZM_2047: - case WM5100_DSP2_DM_0: - case WM5100_DSP2_DM_1: - case WM5100_DSP2_DM_2: - case WM5100_DSP2_DM_3: - case WM5100_DSP2_DM_508: - case WM5100_DSP2_DM_509: - case WM5100_DSP2_DM_510: - case WM5100_DSP2_DM_511: - case WM5100_DSP2_PM_0: - case WM5100_DSP2_PM_1: - case WM5100_DSP2_PM_2: - case WM5100_DSP2_PM_3: - case WM5100_DSP2_PM_4: - case WM5100_DSP2_PM_5: - case WM5100_DSP2_PM_1530: - case WM5100_DSP2_PM_1531: - case WM5100_DSP2_PM_1532: - case WM5100_DSP2_PM_1533: - case WM5100_DSP2_PM_1534: - case WM5100_DSP2_PM_1535: - case WM5100_DSP2_ZM_0: - case WM5100_DSP2_ZM_1: - case WM5100_DSP2_ZM_2: - case WM5100_DSP2_ZM_3: - case WM5100_DSP2_ZM_2044: - case WM5100_DSP2_ZM_2045: - case WM5100_DSP2_ZM_2046: - case WM5100_DSP2_ZM_2047: - case WM5100_DSP3_DM_0: - case WM5100_DSP3_DM_1: - case WM5100_DSP3_DM_2: - case WM5100_DSP3_DM_3: - case WM5100_DSP3_DM_508: - case WM5100_DSP3_DM_509: - case WM5100_DSP3_DM_510: - case WM5100_DSP3_DM_511: - case WM5100_DSP3_PM_0: - case WM5100_DSP3_PM_1: - case WM5100_DSP3_PM_2: - case WM5100_DSP3_PM_3: - case WM5100_DSP3_PM_4: - case WM5100_DSP3_PM_5: - case WM5100_DSP3_PM_1530: - case WM5100_DSP3_PM_1531: - case WM5100_DSP3_PM_1532: - case WM5100_DSP3_PM_1533: - case WM5100_DSP3_PM_1534: - case WM5100_DSP3_PM_1535: - case WM5100_DSP3_ZM_0: - case WM5100_DSP3_ZM_1: - case WM5100_DSP3_ZM_2: - case WM5100_DSP3_ZM_3: - case WM5100_DSP3_ZM_2044: - case WM5100_DSP3_ZM_2045: - case WM5100_DSP3_ZM_2046: - case WM5100_DSP3_ZM_2047: return 1; default: return 0; @@ -1445,88 +1361,4 @@ struct reg_default wm5100_reg_defaults[WM5100_REGISTER_COUNT] = { { 0x0EC9, 0x0000 }, /* R3785 - HPLPF3_2 */ { 0x0ECC, 0x0000 }, /* R3788 - HPLPF4_1 */ { 0x0ECD, 0x0000 }, /* R3789 - HPLPF4_2 */ - { 0x4000, 0x0000 }, /* R16384 - DSP1 DM 0 */ - { 0x4001, 0x0000 }, /* R16385 - DSP1 DM 1 */ - { 0x4002, 0x0000 }, /* R16386 - DSP1 DM 2 */ - { 0x4003, 0x0000 }, /* R16387 - DSP1 DM 3 */ - { 0x41FC, 0x0000 }, /* R16892 - DSP1 DM 508 */ - { 0x41FD, 0x0000 }, /* R16893 - DSP1 DM 509 */ - { 0x41FE, 0x0000 }, /* R16894 - DSP1 DM 510 */ - { 0x41FF, 0x0000 }, /* R16895 - DSP1 DM 511 */ - { 0x4800, 0x0000 }, /* R18432 - DSP1 PM 0 */ - { 0x4801, 0x0000 }, /* R18433 - DSP1 PM 1 */ - { 0x4802, 0x0000 }, /* R18434 - DSP1 PM 2 */ - { 0x4803, 0x0000 }, /* R18435 - DSP1 PM 3 */ - { 0x4804, 0x0000 }, /* R18436 - DSP1 PM 4 */ - { 0x4805, 0x0000 }, /* R18437 - DSP1 PM 5 */ - { 0x4DFA, 0x0000 }, /* R19962 - DSP1 PM 1530 */ - { 0x4DFB, 0x0000 }, /* R19963 - DSP1 PM 1531 */ - { 0x4DFC, 0x0000 }, /* R19964 - DSP1 PM 1532 */ - { 0x4DFD, 0x0000 }, /* R19965 - DSP1 PM 1533 */ - { 0x4DFE, 0x0000 }, /* R19966 - DSP1 PM 1534 */ - { 0x4DFF, 0x0000 }, /* R19967 - DSP1 PM 1535 */ - { 0x5000, 0x0000 }, /* R20480 - DSP1 ZM 0 */ - { 0x5001, 0x0000 }, /* R20481 - DSP1 ZM 1 */ - { 0x5002, 0x0000 }, /* R20482 - DSP1 ZM 2 */ - { 0x5003, 0x0000 }, /* R20483 - DSP1 ZM 3 */ - { 0x57FC, 0x0000 }, /* R22524 - DSP1 ZM 2044 */ - { 0x57FD, 0x0000 }, /* R22525 - DSP1 ZM 2045 */ - { 0x57FE, 0x0000 }, /* R22526 - DSP1 ZM 2046 */ - { 0x57FF, 0x0000 }, /* R22527 - DSP1 ZM 2047 */ - { 0x6000, 0x0000 }, /* R24576 - DSP2 DM 0 */ - { 0x6001, 0x0000 }, /* R24577 - DSP2 DM 1 */ - { 0x6002, 0x0000 }, /* R24578 - DSP2 DM 2 */ - { 0x6003, 0x0000 }, /* R24579 - DSP2 DM 3 */ - { 0x61FC, 0x0000 }, /* R25084 - DSP2 DM 508 */ - { 0x61FD, 0x0000 }, /* R25085 - DSP2 DM 509 */ - { 0x61FE, 0x0000 }, /* R25086 - DSP2 DM 510 */ - { 0x61FF, 0x0000 }, /* R25087 - DSP2 DM 511 */ - { 0x6800, 0x0000 }, /* R26624 - DSP2 PM 0 */ - { 0x6801, 0x0000 }, /* R26625 - DSP2 PM 1 */ - { 0x6802, 0x0000 }, /* R26626 - DSP2 PM 2 */ - { 0x6803, 0x0000 }, /* R26627 - DSP2 PM 3 */ - { 0x6804, 0x0000 }, /* R26628 - DSP2 PM 4 */ - { 0x6805, 0x0000 }, /* R26629 - DSP2 PM 5 */ - { 0x6DFA, 0x0000 }, /* R28154 - DSP2 PM 1530 */ - { 0x6DFB, 0x0000 }, /* R28155 - DSP2 PM 1531 */ - { 0x6DFC, 0x0000 }, /* R28156 - DSP2 PM 1532 */ - { 0x6DFD, 0x0000 }, /* R28157 - DSP2 PM 1533 */ - { 0x6DFE, 0x0000 }, /* R28158 - DSP2 PM 1534 */ - { 0x6DFF, 0x0000 }, /* R28159 - DSP2 PM 1535 */ - { 0x7000, 0x0000 }, /* R28672 - DSP2 ZM 0 */ - { 0x7001, 0x0000 }, /* R28673 - DSP2 ZM 1 */ - { 0x7002, 0x0000 }, /* R28674 - DSP2 ZM 2 */ - { 0x7003, 0x0000 }, /* R28675 - DSP2 ZM 3 */ - { 0x77FC, 0x0000 }, /* R30716 - DSP2 ZM 2044 */ - { 0x77FD, 0x0000 }, /* R30717 - DSP2 ZM 2045 */ - { 0x77FE, 0x0000 }, /* R30718 - DSP2 ZM 2046 */ - { 0x77FF, 0x0000 }, /* R30719 - DSP2 ZM 2047 */ - { 0x8000, 0x0000 }, /* R32768 - DSP3 DM 0 */ - { 0x8001, 0x0000 }, /* R32769 - DSP3 DM 1 */ - { 0x8002, 0x0000 }, /* R32770 - DSP3 DM 2 */ - { 0x8003, 0x0000 }, /* R32771 - DSP3 DM 3 */ - { 0x81FC, 0x0000 }, /* R33276 - DSP3 DM 508 */ - { 0x81FD, 0x0000 }, /* R33277 - DSP3 DM 509 */ - { 0x81FE, 0x0000 }, /* R33278 - DSP3 DM 510 */ - { 0x81FF, 0x0000 }, /* R33279 - DSP3 DM 511 */ - { 0x8800, 0x0000 }, /* R34816 - DSP3 PM 0 */ - { 0x8801, 0x0000 }, /* R34817 - DSP3 PM 1 */ - { 0x8802, 0x0000 }, /* R34818 - DSP3 PM 2 */ - { 0x8803, 0x0000 }, /* R34819 - DSP3 PM 3 */ - { 0x8804, 0x0000 }, /* R34820 - DSP3 PM 4 */ - { 0x8805, 0x0000 }, /* R34821 - DSP3 PM 5 */ - { 0x8DFA, 0x0000 }, /* R36346 - DSP3 PM 1530 */ - { 0x8DFB, 0x0000 }, /* R36347 - DSP3 PM 1531 */ - { 0x8DFC, 0x0000 }, /* R36348 - DSP3 PM 1532 */ - { 0x8DFD, 0x0000 }, /* R36349 - DSP3 PM 1533 */ - { 0x8DFE, 0x0000 }, /* R36350 - DSP3 PM 1534 */ - { 0x8DFF, 0x0000 }, /* R36351 - DSP3 PM 1535 */ - { 0x9000, 0x0000 }, /* R36864 - DSP3 ZM 0 */ - { 0x9001, 0x0000 }, /* R36865 - DSP3 ZM 1 */ - { 0x9002, 0x0000 }, /* R36866 - DSP3 ZM 2 */ - { 0x9003, 0x0000 }, /* R36867 - DSP3 ZM 3 */ - { 0x97FC, 0x0000 }, /* R38908 - DSP3 ZM 2044 */ - { 0x97FD, 0x0000 }, /* R38909 - DSP3 ZM 2045 */ - { 0x97FE, 0x0000 }, /* R38910 - DSP3 ZM 2046 */ - { 0x97FF, 0x0000 }, /* R38911 - DSP3 ZM 2047 */ }; -- cgit v1.1 From 12a7a709a09aac117b630264cdd526e20d4d0ce2 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 21 Nov 2011 12:11:37 +0000 Subject: ASoC: Remove conditional I2C usage from tlv320aic3x driver The driver only supports I2C so doesn't need to do things conditionally. Signed-off-by: Mark Brown Acked-by: Jarkko Nikula --- sound/soc/codecs/tlv320aic3x.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 14cb553..2e2bf18 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -1481,7 +1481,6 @@ static struct snd_soc_codec_driver soc_codec_dev_aic3x = { .resume = aic3x_resume, }; -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) /* * AIC3X 2 wire address can be up to 4 devices with device addresses * 0x18, 0x19, 0x1A, 0x1B @@ -1548,27 +1547,22 @@ static struct i2c_driver aic3x_i2c_driver = { .remove = aic3x_i2c_remove, .id_table = aic3x_i2c_id, }; -#endif static int __init aic3x_modinit(void) { int ret = 0; -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) ret = i2c_add_driver(&aic3x_i2c_driver); if (ret != 0) { printk(KERN_ERR "Failed to register TLV320AIC3x I2C driver: %d\n", ret); } -#endif return ret; } module_init(aic3x_modinit); static void __exit aic3x_exit(void) { -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) i2c_del_driver(&aic3x_i2c_driver); -#endif } module_exit(aic3x_exit); -- cgit v1.1 From 717b8fae3873b4c83dda2274e8190f538c442000 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 18 Nov 2011 16:05:13 +0800 Subject: ASoC: cs42l73: Unify the way to define bits of register Current code defines some bits with left shift to the proper bit defined in datasheet, but some don't. Unify the definition with proper left shift and adjust the code accordingly. Signed-off-by: Axel Lin Acked-by: Brian Austin Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l73.c | 6 +++--- sound/soc/codecs/cs42l73.h | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 5544f14..672da66 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -1028,13 +1028,13 @@ static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) switch (format) { case SND_SOC_DAIFMT_DSP_B: if (inv == SND_SOC_DAIFMT_IB_IF) - spc |= (PCM_MODE0 << 4); + spc |= PCM_MODE0; if (inv == SND_SOC_DAIFMT_IB_NF) - spc |= (PCM_MODE1 << 4); + spc |= PCM_MODE1; break; case SND_SOC_DAIFMT_DSP_A: if (inv == SND_SOC_DAIFMT_IB_IF) - spc |= (PCM_MODE1 << 4); + spc |= PCM_MODE1; break; default: return -EINVAL; diff --git a/sound/soc/codecs/cs42l73.h b/sound/soc/codecs/cs42l73.h index 7c3bf7f..f30a4c4 100644 --- a/sound/soc/codecs/cs42l73.h +++ b/sound/soc/codecs/cs42l73.h @@ -162,16 +162,16 @@ /* CS42L73_ASPC, CS42L73_XSPC, CS42L73_VSPC */ #define SP_3ST (1 << 7) -#define SPDIF_I2S 0 +#define SPDIF_I2S (0 << 6) #define SPDIF_PCM (1 << 6) -#define PCM_MODE0 0 -#define PCM_MODE1 1 -#define PCM_MODE2 2 -#define PCM_BO_MSBLSB 0 -#define PCM_BO_LSBMSB 1 -#define MCK_SCLK_64FS 0 -#define MCK_SCLK_MCLK 2 -#define MCK_SCLK_PREMCLK 3 +#define PCM_MODE0 (0 << 4) +#define PCM_MODE1 (1 << 4) +#define PCM_MODE2 (2 << 4) +#define PCM_MODE_MASK (3 << 4) +#define PCM_BIT_ORDER (1 << 3) +#define MCK_SCLK_64FS (0 << 0) +#define MCK_SCLK_MCLK (2 << 0) +#define MCK_SCLK_PREMCLK (3 << 0) /* CS42L73_xSPMMCC */ #define MS_MASTER (1 << 7) -- cgit v1.1 From dbb1f516375b3019373f2177b46e334b47a6d8bf Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 18 Nov 2011 17:16:22 +0800 Subject: ASoC: cs42l73: Make inv and format to be unsigned int Fix below smatch warning: sound/soc/codecs/cs42l73.c +1030 cs42l73_set_dai_fmt(53) error: inv is never equal to 1024 (wrong type 0 - 255). sound/soc/codecs/cs42l73.c +1032 cs42l73_set_dai_fmt(55) error: inv is never equal to 768 (wrong type 0 - 255). sound/soc/codecs/cs42l73.c +1036 cs42l73_set_dai_fmt(59) error: inv is never equal to 1024 (wrong type 0 - 255). Reported-by: Dan Carpenter Signed-off-by: Axel Lin Acked-by: Brian Austin Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l73.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 672da66..9f52a94 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -979,7 +979,7 @@ static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) struct snd_soc_codec *codec = codec_dai->codec; struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec); u8 id = codec_dai->id; - u8 inv, format; + unsigned int inv, format; u8 spc, mmcc; spc = snd_soc_read(codec, CS42L73_SPC(id)); -- cgit v1.1 From 404417e6b49694931241aada4209e1ec0b4eefee Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 22 Nov 2011 15:13:30 +0000 Subject: ASoC: Staticise and constify cs42l73_reg_defaults It's not exported and doesn't need to change. Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l73.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 9f52a94..d09578f 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -42,7 +42,7 @@ struct cs42l73_private { u32 mclk; }; -struct reg_default cs42l73_reg_defaults[] = { +static const struct reg_default cs42l73_reg_defaults[] = { { 1, 0x42 }, /* r01 - Device ID A&B */ { 2, 0xA7 }, /* r02 - Device ID C&D */ { 3, 0x30 }, /* r03 - Device ID E */ -- cgit v1.1 From 1db3c98e18962557ce9d9fd0b895c8a6e41c96fd Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 22 Nov 2011 23:19:41 +0000 Subject: ASoC: Convert wm8776 to table based control and DAPM init Signed-off-by: Mark Brown --- sound/soc/codecs/wm8776.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index bfdc523..f967c59d 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c @@ -414,12 +414,6 @@ static int wm8776_probe(struct snd_soc_codec *codec) snd_soc_update_bits(codec, WM8776_HPRVOL, 0x100, 0x100); snd_soc_update_bits(codec, WM8776_DACRVOL, 0x100, 0x100); - snd_soc_add_controls(codec, wm8776_snd_controls, - ARRAY_SIZE(wm8776_snd_controls)); - snd_soc_dapm_new_controls(dapm, wm8776_dapm_widgets, - ARRAY_SIZE(wm8776_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, routes, ARRAY_SIZE(routes)); - return ret; } @@ -439,6 +433,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8776 = { .reg_cache_size = ARRAY_SIZE(wm8776_reg), .reg_word_size = sizeof(u16), .reg_cache_default = wm8776_reg, + + .controls = wm8776_snd_controls, + .num_controls = ARRAY_SIZE(wm8776_snd_controls), + .dapm_widgets = wm8776_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8776_dapm_widgets), + .dapm_routes = routes, + .num_dapm_routes = ARRAY_SIZE(routes), }; static const struct of_device_id wm8776_of_match[] = { -- cgit v1.1 From 99c92ae4ffca81f4dfba3b7648734c56d0b32d4c Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 22 Nov 2011 18:21:14 -0700 Subject: ASoC: Tegra PCM: Use module_platform_driver This saves some boiler-plate code. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/tegra_pcm.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c index 436def1..90345ee 100644 --- a/sound/soc/tegra/tegra_pcm.c +++ b/sound/soc/tegra/tegra_pcm.c @@ -392,18 +392,7 @@ static struct platform_driver tegra_pcm_driver = { .probe = tegra_pcm_platform_probe, .remove = __devexit_p(tegra_pcm_platform_remove), }; - -static int __init snd_tegra_pcm_init(void) -{ - return platform_driver_register(&tegra_pcm_driver); -} -module_init(snd_tegra_pcm_init); - -static void __exit snd_tegra_pcm_exit(void) -{ - platform_driver_unregister(&tegra_pcm_driver); -} -module_exit(snd_tegra_pcm_exit); +module_platform_driver(tegra_pcm_driver); MODULE_AUTHOR("Stephen Warren "); MODULE_DESCRIPTION("Tegra PCM ASoC driver"); -- cgit v1.1 From f2296d7bf19a210a462a57bb90b1c9263d18a4ee Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 22 Nov 2011 18:21:15 -0700 Subject: ASoC: Tegra DAS: Use devm_ APIs and module_platform_driver module_platform_drive saves some boiler-plate code. The devm_ APIs remove the need to manually clean up allocations, thus removing some code. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/tegra_das.c | 45 ++++++++++----------------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_das.c b/sound/soc/tegra/tegra_das.c index 3b55a44..fa3a442 100644 --- a/sound/soc/tegra/tegra_das.c +++ b/sound/soc/tegra/tegra_das.c @@ -172,11 +172,11 @@ static int __devinit tegra_das_probe(struct platform_device *pdev) if (das) return -ENODEV; - das = kzalloc(sizeof(struct tegra_das), GFP_KERNEL); + das = devm_kzalloc(&pdev->dev, sizeof(struct tegra_das), GFP_KERNEL); if (!das) { dev_err(&pdev->dev, "Can't allocate tegra_das\n"); ret = -ENOMEM; - goto exit; + goto err; } das->dev = &pdev->dev; @@ -184,22 +184,22 @@ static int __devinit tegra_das_probe(struct platform_device *pdev) if (!res) { dev_err(&pdev->dev, "No memory resource\n"); ret = -ENODEV; - goto err_free; + goto err; } - region = request_mem_region(res->start, resource_size(res), - pdev->name); + region = devm_request_mem_region(&pdev->dev, res->start, + resource_size(res), pdev->name); if (!region) { dev_err(&pdev->dev, "Memory region already claimed\n"); ret = -EBUSY; - goto err_free; + goto err; } - das->regs = ioremap(res->start, resource_size(res)); + das->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (!das->regs) { dev_err(&pdev->dev, "ioremap failed\n"); ret = -ENOMEM; - goto err_release; + goto err; } tegra_das_debug_add(das); @@ -208,32 +208,18 @@ static int __devinit tegra_das_probe(struct platform_device *pdev) return 0; -err_release: - release_mem_region(res->start, resource_size(res)); -err_free: - kfree(das); +err: das = NULL; -exit: return ret; } static int __devexit tegra_das_remove(struct platform_device *pdev) { - struct resource *res; - if (!das) return -ENODEV; - platform_set_drvdata(pdev, NULL); - tegra_das_debug_remove(das); - iounmap(das->regs); - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(res->start, resource_size(res)); - - kfree(das); das = NULL; return 0; @@ -246,18 +232,7 @@ static struct platform_driver tegra_das_driver = { .name = DRV_NAME, }, }; - -static int __init tegra_das_modinit(void) -{ - return platform_driver_register(&tegra_das_driver); -} -module_init(tegra_das_modinit); - -static void __exit tegra_das_modexit(void) -{ - platform_driver_unregister(&tegra_das_driver); -} -module_exit(tegra_das_modexit); +module_platform_driver(tegra_das_driver); MODULE_AUTHOR("Stephen Warren "); MODULE_DESCRIPTION("Tegra DAS driver"); -- cgit v1.1 From 65713ce8442b42c6f688bd8b0950a49d8f4dcf5f Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 22 Nov 2011 18:21:13 -0700 Subject: ASoC: Tegra: Move DAS configuration into machine drivers This removes potentially machine-specific routing knowledge from the I2S driverinto the machine drivers, which is better equipped to know what the appropriate routing configuration is. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/tegra_i2s.c | 18 ------------------ sound/soc/tegra/tegra_wm8903.c | 13 +++++++++++++ sound/soc/tegra/trimslice.c | 15 +++++++++++++++ 3 files changed, 28 insertions(+), 18 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c index 6728fab..33e62fc 100644 --- a/sound/soc/tegra/tegra_i2s.c +++ b/sound/soc/tegra/tegra_i2s.c @@ -42,7 +42,6 @@ #include #include -#include "tegra_das.h" #include "tegra_i2s.h" #define DRV_NAME "tegra-i2s" @@ -363,23 +362,6 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) return -EINVAL; } - /* - * FIXME: Until a codec driver exists for the tegra DAS, hard-code a - * 1:1 mapping between audio controllers and audio ports. - */ - ret = tegra_das_connect_dap_to_dac(TEGRA_DAS_DAP_ID_1 + pdev->id, - TEGRA_DAS_DAP_SEL_DAC1 + pdev->id); - if (ret) { - dev_err(&pdev->dev, "Can't set up DAP connection\n"); - return ret; - } - ret = tegra_das_connect_dac_to_dap(TEGRA_DAS_DAC_ID_1 + pdev->id, - TEGRA_DAS_DAC_SEL_DAP1 + pdev->id); - if (ret) { - dev_err(&pdev->dev, "Can't set up DAC connection\n"); - return ret; - } - i2s = kzalloc(sizeof(struct tegra_i2s), GFP_KERNEL); if (!i2s) { dev_err(&pdev->dev, "Can't allocate tegra_i2s\n"); diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index a81cf39..9b0ee15 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c @@ -249,6 +249,19 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) struct tegra_wm8903_platform_data *pdata = machine->pdata; int ret; + ret = tegra_das_connect_dap_to_dac(TEGRA_DAS_DAP_ID_1, + TEGRA_DAS_DAP_SEL_DAC1); + if (ret) { + dev_err(card->dev, "Can't set up DAS DAP connection\n"); + return ret; + } + ret = tegra_das_connect_dac_to_dap(TEGRA_DAS_DAC_ID_1, + TEGRA_DAS_DAC_SEL_DAP1); + if (ret) { + dev_err(card->dev, "Can't set up DAS DAC connection\n"); + return ret; + } + if (gpio_is_valid(pdata->gpio_spkr_en)) { ret = gpio_request(pdata->gpio_spkr_en, "spkr_en"); if (ret) { diff --git a/sound/soc/tegra/trimslice.c b/sound/soc/tegra/trimslice.c index b3a7efa..2699a6f 100644 --- a/sound/soc/tegra/trimslice.c +++ b/sound/soc/tegra/trimslice.c @@ -118,7 +118,22 @@ static const struct snd_soc_dapm_route trimslice_audio_map[] = { static int trimslice_asoc_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_card *card = codec->card; struct snd_soc_dapm_context *dapm = &codec->dapm; + int ret; + + ret = tegra_das_connect_dap_to_dac(TEGRA_DAS_DAP_ID_1, + TEGRA_DAS_DAP_SEL_DAC1); + if (ret) { + dev_err(card->dev, "Can't set up DAS DAP connection\n"); + return ret; + } + ret = tegra_das_connect_dac_to_dap(TEGRA_DAS_DAC_ID_1, + TEGRA_DAS_DAC_SEL_DAP1); + if (ret) { + dev_err(card->dev, "Can't set up DAS DAC connection\n"); + return ret; + } snd_soc_dapm_nc_pin(dapm, "LHPOUT"); snd_soc_dapm_nc_pin(dapm, "RHPOUT"); -- cgit v1.1 From bea0ed0825be288f9fc98696fc476066776b26be Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 22 Nov 2011 18:21:16 -0700 Subject: ASoC: Tegra I2S: Use devm_ APIs and module_platform_driver module_platform_drive saves some boiler-plate code. The devm_ APIs remove the need to manually clean up allocations, thus removing some code. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/tegra_i2s.c | 45 ++++++++++----------------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c index 33e62fc..76014f0 100644 --- a/sound/soc/tegra/tegra_i2s.c +++ b/sound/soc/tegra/tegra_i2s.c @@ -362,11 +362,11 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) return -EINVAL; } - i2s = kzalloc(sizeof(struct tegra_i2s), GFP_KERNEL); + i2s = devm_kzalloc(&pdev->dev, sizeof(struct tegra_i2s), GFP_KERNEL); if (!i2s) { dev_err(&pdev->dev, "Can't allocate tegra_i2s\n"); ret = -ENOMEM; - goto exit; + goto err; } dev_set_drvdata(&pdev->dev, i2s); @@ -374,7 +374,7 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) if (IS_ERR(i2s->clk_i2s)) { dev_err(&pdev->dev, "Can't retrieve i2s clock\n"); ret = PTR_ERR(i2s->clk_i2s); - goto err_free; + goto err; } mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -391,19 +391,19 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) goto err_clk_put; } - memregion = request_mem_region(mem->start, resource_size(mem), - DRV_NAME); + memregion = devm_request_mem_region(&pdev->dev, mem->start, + resource_size(mem), DRV_NAME); if (!memregion) { dev_err(&pdev->dev, "Memory region already claimed\n"); ret = -EBUSY; goto err_clk_put; } - i2s->regs = ioremap(mem->start, resource_size(mem)); + i2s->regs = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); if (!i2s->regs) { dev_err(&pdev->dev, "ioremap failed\n"); ret = -ENOMEM; - goto err_release; + goto err_clk_put; } i2s->capture_dma_data.addr = mem->start + TEGRA_I2S_FIFO2; @@ -422,43 +422,29 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "Could not register DAI: %d\n", ret); ret = -ENOMEM; - goto err_unmap; + goto err_clk_put; } tegra_i2s_debug_add(i2s, pdev->id); return 0; -err_unmap: - iounmap(i2s->regs); -err_release: - release_mem_region(mem->start, resource_size(mem)); err_clk_put: clk_put(i2s->clk_i2s); -err_free: - kfree(i2s); -exit: +err: return ret; } static int __devexit tegra_i2s_platform_remove(struct platform_device *pdev) { struct tegra_i2s *i2s = dev_get_drvdata(&pdev->dev); - struct resource *res; snd_soc_unregister_dai(&pdev->dev); tegra_i2s_debug_remove(i2s); - iounmap(i2s->regs); - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(res->start, resource_size(res)); - clk_put(i2s->clk_i2s); - kfree(i2s); - return 0; } @@ -470,18 +456,7 @@ static struct platform_driver tegra_i2s_driver = { .probe = tegra_i2s_platform_probe, .remove = __devexit_p(tegra_i2s_platform_remove), }; - -static int __init snd_tegra_i2s_init(void) -{ - return platform_driver_register(&tegra_i2s_driver); -} -module_init(snd_tegra_i2s_init); - -static void __exit snd_tegra_i2s_exit(void) -{ - platform_driver_unregister(&tegra_i2s_driver); -} -module_exit(snd_tegra_i2s_exit); +module_platform_driver(tegra_i2s_driver); MODULE_AUTHOR("Stephen Warren "); MODULE_DESCRIPTION("Tegra I2S ASoC driver"); -- cgit v1.1 From 85e7652d89293a6dab42bfd31f276f8bc072d4c5 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 23 Nov 2011 11:40:40 +0100 Subject: ASoC: Constify snd_soc_dai_ops structs Commit 1ee46ebd("ASoC: Make the DAI ops constant in the DAI structure") introduced the possibility to have constant DAI ops structures, yet this is barley used in both existing drivers and also new drivers being submitted, although none of them modifies its DAI ops structure. The later is not surprising since existing drivers are often used as templates for new drivers. So this patch just constifies all existing snd_soc_dai_ops structs to eliminate the issue altogether. The patch was generated with the following coccinelle semantic patch: // @@ identifier ops; @@ -struct snd_soc_dai_ops ops = +const struct snd_soc_dai_ops ops = { ... }; // Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/atmel/atmel_ssc_dai.c | 2 +- sound/soc/au1x/ac97c.c | 2 +- sound/soc/au1x/i2sc.c | 2 +- sound/soc/au1x/psc-ac97.c | 2 +- sound/soc/au1x/psc-i2s.c | 2 +- sound/soc/blackfin/bf5xx-i2s.c | 2 +- sound/soc/blackfin/bf5xx-tdm.c | 2 +- sound/soc/codecs/88pm860x-codec.c | 4 ++-- sound/soc/codecs/ac97.c | 2 +- sound/soc/codecs/ad1836.c | 2 +- sound/soc/codecs/ad193x.c | 2 +- sound/soc/codecs/adau1373.c | 2 +- sound/soc/codecs/adau1701.c | 2 +- sound/soc/codecs/adav80x.c | 2 +- sound/soc/codecs/ak4104.c | 2 +- sound/soc/codecs/ak4535.c | 2 +- sound/soc/codecs/ak4641.c | 4 ++-- sound/soc/codecs/ak4642.c | 2 +- sound/soc/codecs/ak4671.c | 2 +- sound/soc/codecs/alc5623.c | 2 +- sound/soc/codecs/alc5632.c | 2 +- sound/soc/codecs/cq93vc.c | 2 +- sound/soc/codecs/cs4270.c | 2 +- sound/soc/codecs/cs4271.c | 2 +- sound/soc/codecs/cs42l51.c | 2 +- sound/soc/codecs/cs42l73.c | 2 +- sound/soc/codecs/da7210.c | 2 +- sound/soc/codecs/jz4740.c | 2 +- sound/soc/codecs/max98088.c | 4 ++-- sound/soc/codecs/max98095.c | 6 +++--- sound/soc/codecs/max9850.c | 2 +- sound/soc/codecs/rt5631.c | 2 +- sound/soc/codecs/sgtl5000.c | 2 +- sound/soc/codecs/sn95031.c | 8 ++++---- sound/soc/codecs/ssm2602.c | 2 +- sound/soc/codecs/sta32x.c | 2 +- sound/soc/codecs/stac9766.c | 4 ++-- sound/soc/codecs/tlv320aic23.c | 2 +- sound/soc/codecs/tlv320aic26.c | 2 +- sound/soc/codecs/tlv320aic32x4.c | 2 +- sound/soc/codecs/tlv320aic3x.c | 2 +- sound/soc/codecs/tlv320dac33.c | 2 +- sound/soc/codecs/twl4030.c | 4 ++-- sound/soc/codecs/twl6040.c | 2 +- sound/soc/codecs/uda134x.c | 2 +- sound/soc/codecs/uda1380.c | 6 +++--- sound/soc/codecs/wl1273.c | 2 +- sound/soc/codecs/wm5100.c | 2 +- sound/soc/codecs/wm8350.c | 2 +- sound/soc/codecs/wm8400.c | 2 +- sound/soc/codecs/wm8510.c | 2 +- sound/soc/codecs/wm8523.c | 2 +- sound/soc/codecs/wm8580.c | 4 ++-- sound/soc/codecs/wm8711.c | 2 +- sound/soc/codecs/wm8728.c | 2 +- sound/soc/codecs/wm8731.c | 2 +- sound/soc/codecs/wm8737.c | 2 +- sound/soc/codecs/wm8741.c | 2 +- sound/soc/codecs/wm8750.c | 2 +- sound/soc/codecs/wm8753.c | 4 ++-- sound/soc/codecs/wm8770.c | 2 +- sound/soc/codecs/wm8776.c | 4 ++-- sound/soc/codecs/wm8804.c | 2 +- sound/soc/codecs/wm8900.c | 2 +- sound/soc/codecs/wm8903.c | 2 +- sound/soc/codecs/wm8904.c | 2 +- sound/soc/codecs/wm8940.c | 2 +- sound/soc/codecs/wm8955.c | 2 +- sound/soc/codecs/wm8960.c | 2 +- sound/soc/codecs/wm8961.c | 2 +- sound/soc/codecs/wm8962.c | 2 +- sound/soc/codecs/wm8971.c | 2 +- sound/soc/codecs/wm8974.c | 2 +- sound/soc/codecs/wm8978.c | 2 +- sound/soc/codecs/wm8983.c | 2 +- sound/soc/codecs/wm8985.c | 2 +- sound/soc/codecs/wm8988.c | 2 +- sound/soc/codecs/wm8990.c | 2 +- sound/soc/codecs/wm8991.c | 2 +- sound/soc/codecs/wm8993.c | 2 +- sound/soc/codecs/wm8994.c | 6 +++--- sound/soc/codecs/wm8995.c | 6 +++--- sound/soc/codecs/wm8996.c | 2 +- sound/soc/codecs/wm9081.c | 2 +- sound/soc/codecs/wm9705.c | 2 +- sound/soc/codecs/wm9712.c | 4 ++-- sound/soc/codecs/wm9713.c | 6 +++--- sound/soc/davinci/davinci-i2s.c | 2 +- sound/soc/davinci/davinci-mcasp.c | 2 +- sound/soc/davinci/davinci-vcif.c | 2 +- sound/soc/ep93xx/ep93xx-ac97.c | 2 +- sound/soc/ep93xx/ep93xx-i2s.c | 2 +- sound/soc/fsl/fsl_ssi.c | 2 +- sound/soc/fsl/mpc5200_psc_ac97.c | 4 ++-- sound/soc/fsl/mpc5200_psc_i2s.c | 2 +- sound/soc/imx/imx-ssi.c | 2 +- sound/soc/jz4740/jz4740-i2s.c | 2 +- sound/soc/kirkwood/kirkwood-i2s.c | 2 +- sound/soc/mxs/mxs-saif.c | 2 +- sound/soc/nuc900/nuc900-ac97.c | 2 +- sound/soc/omap/ams-delta.c | 2 +- sound/soc/omap/omap-hdmi.c | 2 +- sound/soc/omap/omap-mcbsp.c | 2 +- sound/soc/omap/omap-mcpdm.c | 2 +- sound/soc/pxa/pxa-ssp.c | 2 +- sound/soc/pxa/pxa2xx-ac97.c | 6 +++--- sound/soc/pxa/pxa2xx-i2s.c | 2 +- sound/soc/s6000/s6000-i2s.c | 2 +- sound/soc/samsung/ac97.c | 4 ++-- sound/soc/samsung/i2s.c | 2 +- sound/soc/samsung/pcm.c | 2 +- sound/soc/samsung/s3c2412-i2s.c | 2 +- sound/soc/samsung/s3c24xx-i2s.c | 2 +- sound/soc/samsung/spdif.c | 2 +- sound/soc/sh/fsi.c | 2 +- sound/soc/sh/hac.c | 2 +- sound/soc/sh/siu_dai.c | 2 +- sound/soc/sh/ssi.c | 2 +- sound/soc/soc-core.c | 2 +- sound/soc/tegra/tegra_i2s.c | 2 +- sound/soc/tegra/tegra_spdif.c | 2 +- 121 files changed, 147 insertions(+), 147 deletions(-) (limited to 'sound') diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index 7122509..a67fc9b 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c @@ -719,7 +719,7 @@ static int atmel_ssc_remove(struct snd_soc_dai *dai) #define ATMEL_SSC_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |\ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops atmel_ssc_dai_ops = { +static const struct snd_soc_dai_ops atmel_ssc_dai_ops = { .startup = atmel_ssc_startup, .shutdown = atmel_ssc_shutdown, .prepare = atmel_ssc_prepare, diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c index 726bd65..7771934 100644 --- a/sound/soc/au1x/ac97c.c +++ b/sound/soc/au1x/ac97c.c @@ -195,7 +195,7 @@ static int alchemy_ac97c_startup(struct snd_pcm_substream *substream, return 0; } -static struct snd_soc_dai_ops alchemy_ac97c_ops = { +static const struct snd_soc_dai_ops alchemy_ac97c_ops = { .startup = alchemy_ac97c_startup, }; diff --git a/sound/soc/au1x/i2sc.c b/sound/soc/au1x/i2sc.c index 6bcf48f..2d5f755 100644 --- a/sound/soc/au1x/i2sc.c +++ b/sound/soc/au1x/i2sc.c @@ -201,7 +201,7 @@ static int au1xi2s_startup(struct snd_pcm_substream *substream, return 0; } -static const struct snd_soc_dai_ops au1xi2s_dai_ops = { +static const const struct snd_soc_dai_ops au1xi2s_dai_ops = { .startup = au1xi2s_startup, .trigger = au1xi2s_trigger, .hw_params = au1xi2s_hw_params, diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c index 0c6acd5..87daf45 100644 --- a/sound/soc/au1x/psc-ac97.c +++ b/sound/soc/au1x/psc-ac97.c @@ -337,7 +337,7 @@ static int au1xpsc_ac97_probe(struct snd_soc_dai *dai) return au1xpsc_ac97_workdata ? 0 : -ENODEV; } -static struct snd_soc_dai_ops au1xpsc_ac97_dai_ops = { +static const struct snd_soc_dai_ops au1xpsc_ac97_dai_ops = { .startup = au1xpsc_ac97_startup, .trigger = au1xpsc_ac97_trigger, .hw_params = au1xpsc_ac97_hw_params, diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c index e03c5ce..f7714d5 100644 --- a/sound/soc/au1x/psc-i2s.c +++ b/sound/soc/au1x/psc-i2s.c @@ -265,7 +265,7 @@ static int au1xpsc_i2s_startup(struct snd_pcm_substream *substream, return 0; } -static struct snd_soc_dai_ops au1xpsc_i2s_dai_ops = { +static const struct snd_soc_dai_ops au1xpsc_i2s_dai_ops = { .startup = au1xpsc_i2s_startup, .trigger = au1xpsc_i2s_trigger, .hw_params = au1xpsc_i2s_hw_params, diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c index 00cc3e0..b31662e 100644 --- a/sound/soc/blackfin/bf5xx-i2s.c +++ b/sound/soc/blackfin/bf5xx-i2s.c @@ -223,7 +223,7 @@ static int bf5xx_i2s_resume(struct snd_soc_dai *dai) SNDRV_PCM_FMTBIT_S24_LE | \ SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops bf5xx_i2s_dai_ops = { +static const struct snd_soc_dai_ops bf5xx_i2s_dai_ops = { .shutdown = bf5xx_i2s_shutdown, .hw_params = bf5xx_i2s_hw_params, .set_fmt = bf5xx_i2s_set_dai_fmt, diff --git a/sound/soc/blackfin/bf5xx-tdm.c b/sound/soc/blackfin/bf5xx-tdm.c index a822d1e..7876b50 100644 --- a/sound/soc/blackfin/bf5xx-tdm.c +++ b/sound/soc/blackfin/bf5xx-tdm.c @@ -226,7 +226,7 @@ static int bf5xx_tdm_resume(struct snd_soc_dai *dai) #define bf5xx_tdm_resume NULL #endif -static struct snd_soc_dai_ops bf5xx_tdm_dai_ops = { +static const struct snd_soc_dai_ops bf5xx_tdm_dai_ops = { .hw_params = bf5xx_tdm_hw_params, .set_fmt = bf5xx_tdm_set_dai_fmt, .shutdown = bf5xx_tdm_shutdown, diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index 5ca122e..ea305b8 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c @@ -1198,14 +1198,14 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec, return 0; } -static struct snd_soc_dai_ops pm860x_pcm_dai_ops = { +static const struct snd_soc_dai_ops pm860x_pcm_dai_ops = { .digital_mute = pm860x_digital_mute, .hw_params = pm860x_pcm_hw_params, .set_fmt = pm860x_pcm_set_dai_fmt, .set_sysclk = pm860x_set_dai_sysclk, }; -static struct snd_soc_dai_ops pm860x_i2s_dai_ops = { +static const struct snd_soc_dai_ops pm860x_i2s_dai_ops = { .digital_mute = pm860x_digital_mute, .hw_params = pm860x_i2s_hw_params, .set_fmt = pm860x_i2s_set_dai_fmt, diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c index e715186..8f32167 100644 --- a/sound/soc/codecs/ac97.c +++ b/sound/soc/codecs/ac97.c @@ -39,7 +39,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream, SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 |\ SNDRV_PCM_RATE_48000) -static struct snd_soc_dai_ops ac97_dai_ops = { +static const struct snd_soc_dai_ops ac97_dai_ops = { .prepare = ac97_prepare, }; diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c index 4e5c572..fab0948 100644 --- a/sound/soc/codecs/ad1836.c +++ b/sound/soc/codecs/ad1836.c @@ -189,7 +189,7 @@ static int ad1836_hw_params(struct snd_pcm_substream *substream, return 0; } -static struct snd_soc_dai_ops ad1836_dai_ops = { +static const struct snd_soc_dai_ops ad1836_dai_ops = { .hw_params = ad1836_hw_params, .set_fmt = ad1836_set_dai_fmt, }; diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c index 1206021..1901cd2 100644 --- a/sound/soc/codecs/ad193x.c +++ b/sound/soc/codecs/ad193x.c @@ -312,7 +312,7 @@ static int ad193x_hw_params(struct snd_pcm_substream *substream, return 0; } -static struct snd_soc_dai_ops ad193x_dai_ops = { +static const struct snd_soc_dai_ops ad193x_dai_ops = { .hw_params = ad193x_hw_params, .digital_mute = ad193x_mute, .set_tdm_slot = ad193x_set_tdm_slot, diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c index 45c6302..2e040af 100644 --- a/sound/soc/codecs/adau1373.c +++ b/sound/soc/codecs/adau1373.c @@ -1042,7 +1042,7 @@ static int adau1373_set_dai_sysclk(struct snd_soc_dai *dai, return 0; } -static const struct snd_soc_dai_ops adau1373_dai_ops = { +static const const struct snd_soc_dai_ops adau1373_dai_ops = { .hw_params = adau1373_hw_params, .set_sysclk = adau1373_set_dai_sysclk, .set_fmt = adau1373_set_dai_fmt, diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index 8b7e1c5..c69bdfe 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c @@ -427,7 +427,7 @@ static int adau1701_set_sysclk(struct snd_soc_codec *codec, int clk_id, #define ADAU1701_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static const struct snd_soc_dai_ops adau1701_dai_ops = { +static const const struct snd_soc_dai_ops adau1701_dai_ops = { .set_fmt = adau1701_set_dai_fmt, .hw_params = adau1701_hw_params, .digital_mute = adau1701_digital_mute, diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c index f9f0894..d927feb 100644 --- a/sound/soc/codecs/adav80x.c +++ b/sound/soc/codecs/adav80x.c @@ -718,7 +718,7 @@ static void adav80x_dai_shutdown(struct snd_pcm_substream *substream, adav80x->rate = 0; } -static const struct snd_soc_dai_ops adav80x_dai_ops = { +static const const struct snd_soc_dai_ops adav80x_dai_ops = { .set_fmt = adav80x_set_dai_fmt, .hw_params = adav80x_hw_params, .startup = adav80x_dai_startup, diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c index d3b29dc..152420c 100644 --- a/sound/soc/codecs/ak4104.c +++ b/sound/soc/codecs/ak4104.c @@ -170,7 +170,7 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream, return ak4104_spi_write(codec, AK4104_REG_CHN_STATUS(3), val); } -static struct snd_soc_dai_ops ak4101_dai_ops = { +static const struct snd_soc_dai_ops ak4101_dai_ops = { .hw_params = ak4104_hw_params, .set_fmt = ak4104_set_dai_fmt, }; diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c index 95d782d..f6c4734 100644 --- a/sound/soc/codecs/ak4535.c +++ b/sound/soc/codecs/ak4535.c @@ -331,7 +331,7 @@ static int ak4535_set_bias_level(struct snd_soc_codec *codec, SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\ SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000) -static struct snd_soc_dai_ops ak4535_dai_ops = { +static const struct snd_soc_dai_ops ak4535_dai_ops = { .hw_params = ak4535_hw_params, .set_fmt = ak4535_set_dai_fmt, .digital_mute = ak4535_mute, diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c index 7783858..3657c76 100644 --- a/sound/soc/codecs/ak4641.c +++ b/sound/soc/codecs/ak4641.c @@ -442,14 +442,14 @@ static int ak4641_set_bias_level(struct snd_soc_codec *codec, SNDRV_PCM_RATE_16000) #define AK4641_FORMATS (SNDRV_PCM_FMTBIT_S16_LE) -static struct snd_soc_dai_ops ak4641_i2s_dai_ops = { +static const struct snd_soc_dai_ops ak4641_i2s_dai_ops = { .hw_params = ak4641_i2s_hw_params, .set_fmt = ak4641_i2s_set_dai_fmt, .digital_mute = ak4641_mute, .set_sysclk = ak4641_set_dai_sysclk, }; -static struct snd_soc_dai_ops ak4641_pcm_dai_ops = { +static const struct snd_soc_dai_ops ak4641_pcm_dai_ops = { .hw_params = NULL, /* rates are controlled by BT chip */ .set_fmt = ak4641_pcm_set_dai_fmt, .digital_mute = ak4641_mute, diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 859e015..c887ddf 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -435,7 +435,7 @@ static int ak4642_set_bias_level(struct snd_soc_codec *codec, return 0; } -static struct snd_soc_dai_ops ak4642_dai_ops = { +static const struct snd_soc_dai_ops ak4642_dai_ops = { .startup = ak4642_dai_startup, .shutdown = ak4642_dai_shutdown, .set_sysclk = ak4642_dai_set_sysclk, diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c index de9ff66..4f5c69f 100644 --- a/sound/soc/codecs/ak4671.c +++ b/sound/soc/codecs/ak4671.c @@ -594,7 +594,7 @@ static int ak4671_set_bias_level(struct snd_soc_codec *codec, #define AK4671_FORMATS SNDRV_PCM_FMTBIT_S16_LE -static struct snd_soc_dai_ops ak4671_dai_ops = { +static const struct snd_soc_dai_ops ak4671_dai_ops = { .hw_params = ak4671_hw_params, .set_sysclk = ak4671_set_dai_sysclk, .set_fmt = ak4671_set_dai_fmt, diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c index 984b14b..88647d3 100644 --- a/sound/soc/codecs/alc5623.c +++ b/sound/soc/codecs/alc5623.c @@ -839,7 +839,7 @@ static int alc5623_set_bias_level(struct snd_soc_codec *codec, | SNDRV_PCM_FMTBIT_S24_LE \ | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops alc5623_dai_ops = { +static const struct snd_soc_dai_ops alc5623_dai_ops = { .hw_params = alc5623_pcm_hw_params, .digital_mute = alc5623_mute, .set_fmt = alc5623_set_dai_fmt, diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index 2d77665..3f750de 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -924,7 +924,7 @@ static int alc5632_set_bias_level(struct snd_soc_codec *codec, | SNDRV_PCM_FMTBIT_S24_LE \ | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops alc5632_dai_ops = { +static const struct snd_soc_dai_ops alc5632_dai_ops = { .hw_params = alc5632_pcm_hw_params, .digital_mute = alc5632_mute, .set_fmt = alc5632_set_dai_fmt, diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c index 46dbfd0..cbb3028 100644 --- a/sound/soc/codecs/cq93vc.c +++ b/sound/soc/codecs/cq93vc.c @@ -122,7 +122,7 @@ static int cq93vc_set_bias_level(struct snd_soc_codec *codec, #define CQ93VC_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000) #define CQ93VC_FORMATS (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE) -static struct snd_soc_dai_ops cq93vc_dai_ops = { +static const struct snd_soc_dai_ops cq93vc_dai_ops = { .digital_mute = cq93vc_mute, .set_sysclk = cq93vc_set_dai_sysclk, }; diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index 73f46eb..5396b91 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c @@ -447,7 +447,7 @@ static const struct snd_kcontrol_new cs4270_snd_controls[] = { snd_soc_get_volsw, cs4270_soc_put_mute), }; -static struct snd_soc_dai_ops cs4270_dai_ops = { +static const struct snd_soc_dai_ops cs4270_dai_ops = { .hw_params = cs4270_hw_params, .set_sysclk = cs4270_set_dai_sysclk, .set_fmt = cs4270_set_dai_fmt, diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c index 69fde15..a6f77a8 100644 --- a/sound/soc/codecs/cs4271.c +++ b/sound/soc/codecs/cs4271.c @@ -402,7 +402,7 @@ static const struct snd_kcontrol_new cs4271_snd_controls[] = { 7, 1, 1), }; -static struct snd_soc_dai_ops cs4271_dai_ops = { +static const struct snd_soc_dai_ops cs4271_dai_ops = { .hw_params = cs4271_hw_params, .set_sysclk = cs4271_set_dai_sysclk, .set_fmt = cs4271_set_dai_fmt, diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 00718b5..e378c4d 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c @@ -483,7 +483,7 @@ static int cs42l51_dai_mute(struct snd_soc_dai *dai, int mute) return snd_soc_write(codec, CS42L51_DAC_OUT_CTL, reg); } -static struct snd_soc_dai_ops cs42l51_dai_ops = { +static const struct snd_soc_dai_ops cs42l51_dai_ops = { .hw_params = cs42l51_hw_params, .set_sysclk = cs42l51_set_dai_sysclk, .set_fmt = cs42l51_set_dai_fmt, diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index d09578f..75d80b2 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -1190,7 +1190,7 @@ static int cs42l73_pcm_startup(struct snd_pcm_substream *substream, #define CS42L73_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static const struct snd_soc_dai_ops cs42l73_ops = { +static const const struct snd_soc_dai_ops cs42l73_ops = { .startup = cs42l73_pcm_startup, .hw_params = cs42l73_pcm_hw_params, .set_fmt = cs42l73_set_dai_fmt, diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index 8b5848a..8ef820f 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c @@ -761,7 +761,7 @@ static int da7210_mute(struct snd_soc_dai *dai, int mute) SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) /* DAI operations */ -static struct snd_soc_dai_ops da7210_dai_ops = { +static const struct snd_soc_dai_ops da7210_dai_ops = { .hw_params = da7210_hw_params, .set_fmt = da7210_set_dai_fmt, .digital_mute = da7210_mute, diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index e373f8f..64a479c 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c @@ -206,7 +206,7 @@ static int jz4740_codec_hw_params(struct snd_pcm_substream *substream, return 0; } -static struct snd_soc_dai_ops jz4740_codec_dai_ops = { +static const struct snd_soc_dai_ops jz4740_codec_dai_ops = { .hw_params = jz4740_codec_hw_params, }; diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index ebbf63c..48a52a1 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -1650,14 +1650,14 @@ static int max98088_set_bias_level(struct snd_soc_codec *codec, #define MAX98088_RATES SNDRV_PCM_RATE_8000_96000 #define MAX98088_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops max98088_dai1_ops = { +static const struct snd_soc_dai_ops max98088_dai1_ops = { .set_sysclk = max98088_dai_set_sysclk, .set_fmt = max98088_dai1_set_fmt, .hw_params = max98088_dai1_hw_params, .digital_mute = max98088_dai1_digital_mute, }; -static struct snd_soc_dai_ops max98088_dai2_ops = { +static const struct snd_soc_dai_ops max98088_dai2_ops = { .set_sysclk = max98088_dai_set_sysclk, .set_fmt = max98088_dai2_set_fmt, .hw_params = max98088_dai2_hw_params, diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c index 26d7b08..cc712d5 100644 --- a/sound/soc/codecs/max98095.c +++ b/sound/soc/codecs/max98095.c @@ -1782,19 +1782,19 @@ static int max98095_set_bias_level(struct snd_soc_codec *codec, #define MAX98095_RATES SNDRV_PCM_RATE_8000_96000 #define MAX98095_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops max98095_dai1_ops = { +static const struct snd_soc_dai_ops max98095_dai1_ops = { .set_sysclk = max98095_dai_set_sysclk, .set_fmt = max98095_dai1_set_fmt, .hw_params = max98095_dai1_hw_params, }; -static struct snd_soc_dai_ops max98095_dai2_ops = { +static const struct snd_soc_dai_ops max98095_dai2_ops = { .set_sysclk = max98095_dai_set_sysclk, .set_fmt = max98095_dai2_set_fmt, .hw_params = max98095_dai2_hw_params, }; -static struct snd_soc_dai_ops max98095_dai3_ops = { +static const struct snd_soc_dai_ops max98095_dai3_ops = { .set_sysclk = max98095_dai_set_sysclk, .set_fmt = max98095_dai3_set_fmt, .hw_params = max98095_dai3_hw_params, diff --git a/sound/soc/codecs/max9850.c b/sound/soc/codecs/max9850.c index 208d2ee..94c2b58 100644 --- a/sound/soc/codecs/max9850.c +++ b/sound/soc/codecs/max9850.c @@ -254,7 +254,7 @@ static int max9850_set_bias_level(struct snd_soc_codec *codec, #define MAX9850_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops max9850_dai_ops = { +static const struct snd_soc_dai_ops max9850_dai_ops = { .hw_params = max9850_hw_params, .set_sysclk = max9850_set_dai_sysclk, .set_fmt = max9850_set_dai_fmt, diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index 4646e80..dac4d05 100644 --- a/sound/soc/codecs/rt5631.c +++ b/sound/soc/codecs/rt5631.c @@ -1664,7 +1664,7 @@ static int rt5631_resume(struct snd_soc_codec *codec) SNDRV_PCM_FMTBIT_S24_LE | \ SNDRV_PCM_FMTBIT_S8) -static struct snd_soc_dai_ops rt5631_ops = { +static const struct snd_soc_dai_ops rt5631_ops = { .hw_params = rt5631_hifi_pcm_params, .set_fmt = rt5631_hifi_codec_set_dai_fmt, .set_sysclk = rt5631_hifi_codec_set_dai_sysclk, diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index bbcf921..1a6564b 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -923,7 +923,7 @@ static int sgtl5000_set_bias_level(struct snd_soc_codec *codec, SNDRV_PCM_FMTBIT_S24_LE |\ SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops sgtl5000_ops = { +static const struct snd_soc_dai_ops sgtl5000_ops = { .hw_params = sgtl5000_pcm_hw_params, .digital_mute = sgtl5000_digital_mute, .set_fmt = sgtl5000_set_dai_fmt, diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index 887d618..65f2ef9 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c @@ -698,21 +698,21 @@ static int sn95031_pcm_hw_params(struct snd_pcm_substream *substream, } /* Codec DAI section */ -static struct snd_soc_dai_ops sn95031_headset_dai_ops = { +static const struct snd_soc_dai_ops sn95031_headset_dai_ops = { .digital_mute = sn95031_pcm_hs_mute, .hw_params = sn95031_pcm_hw_params, }; -static struct snd_soc_dai_ops sn95031_speaker_dai_ops = { +static const struct snd_soc_dai_ops sn95031_speaker_dai_ops = { .digital_mute = sn95031_pcm_spkr_mute, .hw_params = sn95031_pcm_hw_params, }; -static struct snd_soc_dai_ops sn95031_vib1_dai_ops = { +static const struct snd_soc_dai_ops sn95031_vib1_dai_ops = { .hw_params = sn95031_pcm_hw_params, }; -static struct snd_soc_dai_ops sn95031_vib2_dai_ops = { +static const struct snd_soc_dai_ops sn95031_vib2_dai_ops = { .hw_params = sn95031_pcm_hw_params, }; diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index 3cb3271..620411c 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c @@ -498,7 +498,7 @@ static int ssm2602_set_bias_level(struct snd_soc_codec *codec, #define SSM2602_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops ssm2602_dai_ops = { +static const struct snd_soc_dai_ops ssm2602_dai_ops = { .startup = ssm2602_startup, .hw_params = ssm2602_hw_params, .shutdown = ssm2602_shutdown, diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index 3b0deaf..e2b1cde 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -783,7 +783,7 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec, return 0; } -static struct snd_soc_dai_ops sta32x_dai_ops = { +static const struct snd_soc_dai_ops sta32x_dai_ops = { .hw_params = sta32x_hw_params, .set_sysclk = sta32x_set_dai_sysclk, .set_fmt = sta32x_set_dai_fmt, diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c index 78b2b50..e4783a4 100644 --- a/sound/soc/codecs/stac9766.c +++ b/sound/soc/codecs/stac9766.c @@ -286,11 +286,11 @@ reset: return 0; } -static struct snd_soc_dai_ops stac9766_dai_ops_analog = { +static const struct snd_soc_dai_ops stac9766_dai_ops_analog = { .prepare = ac97_analog_prepare, }; -static struct snd_soc_dai_ops stac9766_dai_ops_digital = { +static const struct snd_soc_dai_ops stac9766_dai_ops_digital = { .prepare = ac97_digital_prepare, }; diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index 336de8f..9782631 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c @@ -503,7 +503,7 @@ static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec, #define AIC23_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops tlv320aic23_dai_ops = { +static const struct snd_soc_dai_ops tlv320aic23_dai_ops = { .prepare = tlv320aic23_pcm_prepare, .hw_params = tlv320aic23_hw_params, .shutdown = tlv320aic23_shutdown, diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c index 7859bdc..86d1fa3 100644 --- a/sound/soc/codecs/tlv320aic26.c +++ b/sound/soc/codecs/tlv320aic26.c @@ -275,7 +275,7 @@ static int aic26_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) #define AIC26_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE |\ SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S32_BE) -static struct snd_soc_dai_ops aic26_dai_ops = { +static const struct snd_soc_dai_ops aic26_dai_ops = { .hw_params = aic26_hw_params, .digital_mute = aic26_mute, .set_sysclk = aic26_set_sysclk, diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index b21c610..d2e38af 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c @@ -597,7 +597,7 @@ static int aic32x4_set_bias_level(struct snd_soc_codec *codec, #define AIC32X4_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE \ | SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops aic32x4_ops = { +static const struct snd_soc_dai_ops aic32x4_ops = { .hw_params = aic32x4_hw_params, .digital_mute = aic32x4_mute, .set_fmt = aic32x4_set_dai_fmt, diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 2e2bf18..7d665ea 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -1244,7 +1244,7 @@ EXPORT_SYMBOL_GPL(aic3x_button_pressed); #define AIC3X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops aic3x_dai_ops = { +static const struct snd_soc_dai_ops aic3x_dai_ops = { .hw_params = aic3x_hw_params, .digital_mute = aic3x_mute, .set_sysclk = aic3x_set_dai_sysclk, diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index dc8a2b2..abcb97e 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c @@ -1499,7 +1499,7 @@ static struct snd_soc_codec_driver soc_codec_dev_tlv320dac33 = { SNDRV_PCM_RATE_48000) #define DAC33_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops dac33_dai_ops = { +static const struct snd_soc_dai_ops dac33_dai_ops = { .startup = dac33_startup, .shutdown = dac33_shutdown, .hw_params = dac33_hw_params, diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index f798247..2a3a528 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c @@ -2149,7 +2149,7 @@ static int twl4030_voice_set_tristate(struct snd_soc_dai *dai, int tristate) #define TWL4030_RATES (SNDRV_PCM_RATE_8000_48000) #define TWL4030_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops twl4030_dai_hifi_ops = { +static const struct snd_soc_dai_ops twl4030_dai_hifi_ops = { .startup = twl4030_startup, .shutdown = twl4030_shutdown, .hw_params = twl4030_hw_params, @@ -2158,7 +2158,7 @@ static struct snd_soc_dai_ops twl4030_dai_hifi_ops = { .set_tristate = twl4030_set_tristate, }; -static struct snd_soc_dai_ops twl4030_dai_voice_ops = { +static const struct snd_soc_dai_ops twl4030_dai_voice_ops = { .startup = twl4030_voice_startup, .shutdown = twl4030_voice_shutdown, .hw_params = twl4030_voice_hw_params, diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 73e11f0..17930ed 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c @@ -1397,7 +1397,7 @@ static int twl6040_set_dai_sysclk(struct snd_soc_dai *codec_dai, return 0; } -static struct snd_soc_dai_ops twl6040_dai_ops = { +static const struct snd_soc_dai_ops twl6040_dai_ops = { .startup = twl6040_startup, .hw_params = twl6040_hw_params, .prepare = twl6040_prepare, diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index a7b8f30..486aef6 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c @@ -452,7 +452,7 @@ SOC_ENUM("PCM Playback De-emphasis", uda134x_mixer_enum[1]), SOC_SINGLE("DC Filter Enable Switch", UDA134X_STATUS0, 0, 1, 0), }; -static struct snd_soc_dai_ops uda134x_dai_ops = { +static const struct snd_soc_dai_ops uda134x_dai_ops = { .startup = uda134x_startup, .shutdown = uda134x_shutdown, .hw_params = uda134x_hw_params, diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index c5ca8cf..6b933ef 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c @@ -643,21 +643,21 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec, SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\ SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000) -static struct snd_soc_dai_ops uda1380_dai_ops = { +static const struct snd_soc_dai_ops uda1380_dai_ops = { .hw_params = uda1380_pcm_hw_params, .shutdown = uda1380_pcm_shutdown, .trigger = uda1380_trigger, .set_fmt = uda1380_set_dai_fmt_both, }; -static struct snd_soc_dai_ops uda1380_dai_ops_playback = { +static const struct snd_soc_dai_ops uda1380_dai_ops_playback = { .hw_params = uda1380_pcm_hw_params, .shutdown = uda1380_pcm_shutdown, .trigger = uda1380_trigger, .set_fmt = uda1380_set_dai_fmt_playback, }; -static struct snd_soc_dai_ops uda1380_dai_ops_capture = { +static const struct snd_soc_dai_ops uda1380_dai_ops_capture = { .hw_params = uda1380_pcm_hw_params, .shutdown = uda1380_pcm_shutdown, .trigger = uda1380_trigger, diff --git a/sound/soc/codecs/wl1273.c b/sound/soc/codecs/wl1273.c index a854989..9531c35 100644 --- a/sound/soc/codecs/wl1273.c +++ b/sound/soc/codecs/wl1273.c @@ -386,7 +386,7 @@ static int wl1273_hw_params(struct snd_pcm_substream *substream, return 0; } -static struct snd_soc_dai_ops wl1273_dai_ops = { +static const struct snd_soc_dai_ops wl1273_dai_ops = { .startup = wl1273_startup, .hw_params = wl1273_hw_params, }; diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index f37d67f..6c79d97 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -1661,7 +1661,7 @@ static int wm5100_hw_params(struct snd_pcm_substream *substream, return 0; } -static struct snd_soc_dai_ops wm5100_dai_ops = { +static const struct snd_soc_dai_ops wm5100_dai_ops = { .set_fmt = wm5100_set_fmt, .hw_params = wm5100_hw_params, }; diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 35f3ad83..3b846c9 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c @@ -1511,7 +1511,7 @@ EXPORT_SYMBOL_GPL(wm8350_mic_jack_detect); SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops wm8350_dai_ops = { +static const struct snd_soc_dai_ops wm8350_dai_ops = { .hw_params = wm8350_pcm_hw_params, .digital_mute = wm8350_mute, .trigger = wm8350_pcm_trigger, diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index 585def1..07d84a8 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c @@ -1316,7 +1316,7 @@ static int wm8400_set_bias_level(struct snd_soc_codec *codec, #define WM8400_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops wm8400_dai_ops = { +static const struct snd_soc_dai_ops wm8400_dai_ops = { .hw_params = wm8400_hw_params, .digital_mute = wm8400_mute, .set_fmt = wm8400_set_dai_fmt, diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index 07c9cc7..26571b2 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c @@ -509,7 +509,7 @@ static int wm8510_set_bias_level(struct snd_soc_codec *codec, #define WM8510_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8510_dai_ops = { +static const struct snd_soc_dai_ops wm8510_dai_ops = { .hw_params = wm8510_pcm_hw_params, .digital_mute = wm8510_mute, .set_fmt = wm8510_set_dai_fmt, diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c index db7a681..d0ae82d 100644 --- a/sound/soc/codecs/wm8523.c +++ b/sound/soc/codecs/wm8523.c @@ -365,7 +365,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec, #define WM8523_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8523_dai_ops = { +static const struct snd_soc_dai_ops wm8523_dai_ops = { .startup = wm8523_startup, .hw_params = wm8523_hw_params, .set_sysclk = wm8523_set_dai_sysclk, diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 8212b3c..0aa3e4d 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c @@ -776,7 +776,7 @@ static int wm8580_set_bias_level(struct snd_soc_codec *codec, #define WM8580_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8580_dai_ops_playback = { +static const struct snd_soc_dai_ops wm8580_dai_ops_playback = { .set_sysclk = wm8580_set_sysclk, .hw_params = wm8580_paif_hw_params, .set_fmt = wm8580_set_paif_dai_fmt, @@ -785,7 +785,7 @@ static struct snd_soc_dai_ops wm8580_dai_ops_playback = { .digital_mute = wm8580_digital_mute, }; -static struct snd_soc_dai_ops wm8580_dai_ops_capture = { +static const struct snd_soc_dai_ops wm8580_dai_ops_capture = { .set_sysclk = wm8580_set_sysclk, .hw_params = wm8580_paif_hw_params, .set_fmt = wm8580_set_paif_dai_fmt, diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c index 076bdb9..a6f1e39 100644 --- a/sound/soc/codecs/wm8711.c +++ b/sound/soc/codecs/wm8711.c @@ -318,7 +318,7 @@ static int wm8711_set_bias_level(struct snd_soc_codec *codec, #define WM8711_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops wm8711_ops = { +static const struct snd_soc_dai_ops wm8711_ops = { .prepare = wm8711_pcm_prepare, .hw_params = wm8711_hw_params, .shutdown = wm8711_shutdown, diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c index 04b027e..085c2f8 100644 --- a/sound/soc/codecs/wm8728.c +++ b/sound/soc/codecs/wm8728.c @@ -196,7 +196,7 @@ static int wm8728_set_bias_level(struct snd_soc_codec *codec, #define WM8728_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops wm8728_dai_ops = { +static const struct snd_soc_dai_ops wm8728_dai_ops = { .hw_params = wm8728_hw_params, .digital_mute = wm8728_mute, .set_fmt = wm8728_set_dai_fmt, diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index ca59622..28972d8 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c @@ -465,7 +465,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec, #define WM8731_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops wm8731_dai_ops = { +static const struct snd_soc_dai_ops wm8731_dai_ops = { .hw_params = wm8731_hw_params, .digital_mute = wm8731_mute, .set_sysclk = wm8731_set_dai_sysclk, diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c index f6aef58..b7d6615 100644 --- a/sound/soc/codecs/wm8737.c +++ b/sound/soc/codecs/wm8737.c @@ -521,7 +521,7 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec, #define WM8737_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8737_dai_ops = { +static const struct snd_soc_dai_ops wm8737_dai_ops = { .hw_params = wm8737_hw_params, .set_sysclk = wm8737_set_dai_sysclk, .set_fmt = wm8737_set_dai_fmt, diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c index 57ad22a..e51f4f0 100644 --- a/sound/soc/codecs/wm8741.c +++ b/sound/soc/codecs/wm8741.c @@ -382,7 +382,7 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai, #define WM8741_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8741_dai_ops = { +static const struct snd_soc_dai_ops wm8741_dai_ops = { .startup = wm8741_startup, .hw_params = wm8741_hw_params, .set_sysclk = wm8741_set_dai_sysclk, diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index ca75a81..dfb41ad 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c @@ -643,7 +643,7 @@ static int wm8750_set_bias_level(struct snd_soc_codec *codec, #define WM8750_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops wm8750_dai_ops = { +static const struct snd_soc_dai_ops wm8750_dai_ops = { .hw_params = wm8750_pcm_hw_params, .digital_mute = wm8750_mute, .set_fmt = wm8750_set_dai_fmt, diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index 13156c83..fb013b1 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c @@ -1315,7 +1315,7 @@ static int wm8753_set_bias_level(struct snd_soc_codec *codec, * 3. Voice disabled - HIFI over HIFI * 4. Voice disabled - HIFI over HIFI, uses voice DAI LRC for capture */ -static struct snd_soc_dai_ops wm8753_dai_ops_hifi_mode = { +static const struct snd_soc_dai_ops wm8753_dai_ops_hifi_mode = { .hw_params = wm8753_i2s_hw_params, .digital_mute = wm8753_mute, .set_fmt = wm8753_hifi_set_dai_fmt, @@ -1324,7 +1324,7 @@ static struct snd_soc_dai_ops wm8753_dai_ops_hifi_mode = { .set_sysclk = wm8753_set_dai_sysclk, }; -static struct snd_soc_dai_ops wm8753_dai_ops_voice_mode = { +static const struct snd_soc_dai_ops wm8753_dai_ops_voice_mode = { .hw_params = wm8753_pcm_hw_params, .digital_mute = wm8753_mute, .set_fmt = wm8753_voice_set_dai_fmt, diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index aa05e65..87957e8 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c @@ -528,7 +528,7 @@ static int wm8770_set_bias_level(struct snd_soc_codec *codec, #define WM8770_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8770_dai_ops = { +static const struct snd_soc_dai_ops wm8770_dai_ops = { .digital_mute = wm8770_mute, .hw_params = wm8770_hw_params, .set_fmt = wm8770_set_fmt, diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index f967c59d..223fc5a 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c @@ -327,14 +327,14 @@ static int wm8776_set_bias_level(struct snd_soc_codec *codec, #define WM8776_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8776_dac_ops = { +static const struct snd_soc_dai_ops wm8776_dac_ops = { .digital_mute = wm8776_mute, .hw_params = wm8776_hw_params, .set_fmt = wm8776_set_fmt, .set_sysclk = wm8776_set_sysclk, }; -static struct snd_soc_dai_ops wm8776_adc_ops = { +static const struct snd_soc_dai_ops wm8776_adc_ops = { .hw_params = wm8776_hw_params, .set_fmt = wm8776_set_fmt, .set_sysclk = wm8776_set_sysclk, diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c index 9ee072b..d99c6a0 100644 --- a/sound/soc/codecs/wm8804.c +++ b/sound/soc/codecs/wm8804.c @@ -670,7 +670,7 @@ err_reg_get: return ret; } -static struct snd_soc_dai_ops wm8804_dai_ops = { +static const struct snd_soc_dai_ops wm8804_dai_ops = { .hw_params = wm8804_hw_params, .set_fmt = wm8804_set_fmt, .set_sysclk = wm8804_set_sysclk, diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index 17a12c2..a430930 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c @@ -987,7 +987,7 @@ static int wm8900_digital_mute(struct snd_soc_dai *codec_dai, int mute) (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \ SNDRV_PCM_FORMAT_S24_LE) -static struct snd_soc_dai_ops wm8900_dai_ops = { +static const struct snd_soc_dai_ops wm8900_dai_ops = { .hw_params = wm8900_hw_params, .set_clkdiv = wm8900_set_dai_clkdiv, .set_pll = wm8900_set_dai_pll, diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 4ad8ebd..812dce9 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -1732,7 +1732,7 @@ static irqreturn_t wm8903_irq(int irq, void *data) SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops wm8903_dai_ops = { +static const struct snd_soc_dai_ops wm8903_dai_ops = { .hw_params = wm8903_hw_params, .digital_mute = wm8903_digital_mute, .set_fmt = wm8903_set_dai_fmt, diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index bb070f83..f0b0c7a 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c @@ -2205,7 +2205,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec, #define WM8904_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8904_dai_ops = { +static const struct snd_soc_dai_ops wm8904_dai_ops = { .set_sysclk = wm8904_set_sysclk, .set_fmt = wm8904_set_fmt, .set_tdm_slot = wm8904_set_tdm_slot, diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index 1b5856b..0dd1e0c 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c @@ -644,7 +644,7 @@ static int wm8940_set_dai_clkdiv(struct snd_soc_dai *codec_dai, SNDRV_PCM_FMTBIT_S24_LE | \ SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8940_dai_ops = { +static const struct snd_soc_dai_ops wm8940_dai_ops = { .hw_params = wm8940_i2s_hw_params, .set_sysclk = wm8940_set_dai_sysclk, .digital_mute = wm8940_mute, diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index 3c71987..dbf2a83 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c @@ -859,7 +859,7 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec, #define WM8955_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8955_dai_ops = { +static const struct snd_soc_dai_ops wm8955_dai_ops = { .set_sysclk = wm8955_set_sysclk, .set_fmt = wm8955_set_fmt, .hw_params = wm8955_hw_params, diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 6e22f9b..06dca88 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -869,7 +869,7 @@ static int wm8960_set_bias_level(struct snd_soc_codec *codec, (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops wm8960_dai_ops = { +static const struct snd_soc_dai_ops wm8960_dai_ops = { .hw_params = wm8960_hw_params, .digital_mute = wm8960_mute, .set_fmt = wm8960_set_dai_fmt, diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 7f2df7b..783a3d1 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -929,7 +929,7 @@ static int wm8961_set_bias_level(struct snd_soc_codec *codec, (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops wm8961_dai_ops = { +static const struct snd_soc_dai_ops wm8961_dai_ops = { .hw_params = wm8961_hw_params, .set_sysclk = wm8961_set_sysclk, .set_fmt = wm8961_set_fmt, diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 48b5c95..555311d 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -3503,7 +3503,7 @@ static int wm8962_mute(struct snd_soc_dai *dai, int mute) #define WM8962_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8962_dai_ops = { +static const struct snd_soc_dai_ops wm8962_dai_ops = { .hw_params = wm8962_hw_params, .set_sysclk = wm8962_set_dai_sysclk, .set_fmt = wm8962_set_dai_fmt, diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index 3a06a95..98bfbdd 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c @@ -567,7 +567,7 @@ static int wm8971_set_bias_level(struct snd_soc_codec *codec, #define WM8971_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops wm8971_dai_ops = { +static const struct snd_soc_dai_ops wm8971_dai_ops = { .hw_params = wm8971_pcm_hw_params, .digital_mute = wm8971_mute, .set_fmt = wm8971_set_dai_fmt, diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index 7bd35b8..16569c7 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c @@ -557,7 +557,7 @@ static int wm8974_set_bias_level(struct snd_soc_codec *codec, #define WM8974_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops wm8974_ops = { +static const struct snd_soc_dai_ops wm8974_ops = { .hw_params = wm8974_pcm_hw_params, .digital_mute = wm8974_mute, .set_fmt = wm8974_set_dai_fmt, diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c index 41ca4d9..517bb22 100644 --- a/sound/soc/codecs/wm8978.c +++ b/sound/soc/codecs/wm8978.c @@ -865,7 +865,7 @@ static int wm8978_set_bias_level(struct snd_soc_codec *codec, #define WM8978_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8978_dai_ops = { +static const struct snd_soc_dai_ops wm8978_dai_ops = { .hw_params = wm8978_hw_params, .digital_mute = wm8978_mute, .set_fmt = wm8978_set_dai_fmt, diff --git a/sound/soc/codecs/wm8983.c b/sound/soc/codecs/wm8983.c index 58e067b..362298c 100644 --- a/sound/soc/codecs/wm8983.c +++ b/sound/soc/codecs/wm8983.c @@ -1035,7 +1035,7 @@ static int wm8983_probe(struct snd_soc_codec *codec) return 0; } -static struct snd_soc_dai_ops wm8983_dai_ops = { +static const struct snd_soc_dai_ops wm8983_dai_ops = { .digital_mute = wm8983_dac_mute, .hw_params = wm8983_hw_params, .set_fmt = wm8983_set_fmt, diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c index 36c4ee0..9e4481b 100644 --- a/sound/soc/codecs/wm8985.c +++ b/sound/soc/codecs/wm8985.c @@ -1031,7 +1031,7 @@ err_reg_get: return ret; } -static struct snd_soc_dai_ops wm8985_dai_ops = { +static const struct snd_soc_dai_ops wm8985_dai_ops = { .digital_mute = wm8985_dac_mute, .hw_params = wm8985_hw_params, .set_fmt = wm8985_set_fmt, diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index 514189d..9d83bed5 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c @@ -701,7 +701,7 @@ static int wm8988_set_bias_level(struct snd_soc_codec *codec, #define WM8988_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops wm8988_ops = { +static const struct snd_soc_dai_ops wm8988_ops = { .startup = wm8988_pcm_startup, .hw_params = wm8988_pcm_hw_params, .set_fmt = wm8988_set_dai_fmt, diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index d4cbec6..61c620e 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c @@ -1287,7 +1287,7 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec, * 1. ADC/DAC on Primary Interface * 2. ADC on Primary Interface/DAC on secondary */ -static struct snd_soc_dai_ops wm8990_dai_ops = { +static const struct snd_soc_dai_ops wm8990_dai_ops = { .hw_params = wm8990_hw_params, .digital_mute = wm8990_mute, .set_fmt = wm8990_set_dai_fmt, diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c index 1d46d59..ac957ec 100644 --- a/sound/soc/codecs/wm8991.c +++ b/sound/soc/codecs/wm8991.c @@ -1311,7 +1311,7 @@ static int wm8991_probe(struct snd_soc_codec *codec) #define WM8991_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops wm8991_ops = { +static const struct snd_soc_dai_ops wm8991_ops = { .hw_params = wm8991_hw_params, .digital_mute = wm8991_mute, .set_fmt = wm8991_set_dai_fmt, diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index d1a142f4..780c24c 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c @@ -1394,7 +1394,7 @@ out: return 0; } -static struct snd_soc_dai_ops wm8993_ops = { +static const struct snd_soc_dai_ops wm8993_ops = { .set_sysclk = wm8993_set_sysclk, .set_fmt = wm8993_set_dai_fmt, .hw_params = wm8993_hw_params, diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 9c982e4..73db980 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -2531,7 +2531,7 @@ static int wm8994_aif2_probe(struct snd_soc_dai *dai) #define WM8994_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8994_aif1_dai_ops = { +static const struct snd_soc_dai_ops wm8994_aif1_dai_ops = { .set_sysclk = wm8994_set_dai_sysclk, .set_fmt = wm8994_set_dai_fmt, .hw_params = wm8994_hw_params, @@ -2541,7 +2541,7 @@ static struct snd_soc_dai_ops wm8994_aif1_dai_ops = { .set_tristate = wm8994_set_tristate, }; -static struct snd_soc_dai_ops wm8994_aif2_dai_ops = { +static const struct snd_soc_dai_ops wm8994_aif2_dai_ops = { .set_sysclk = wm8994_set_dai_sysclk, .set_fmt = wm8994_set_dai_fmt, .hw_params = wm8994_hw_params, @@ -2551,7 +2551,7 @@ static struct snd_soc_dai_ops wm8994_aif2_dai_ops = { .set_tristate = wm8994_set_tristate, }; -static struct snd_soc_dai_ops wm8994_aif3_dai_ops = { +static const struct snd_soc_dai_ops wm8994_aif3_dai_ops = { .hw_params = wm8994_aif3_hw_params, .set_tristate = wm8994_set_tristate, }; diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c index 3774acb..8f6a36d 100644 --- a/sound/soc/codecs/wm8995.c +++ b/sound/soc/codecs/wm8995.c @@ -2155,7 +2155,7 @@ err_reg_get: #define WM8995_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8995_aif1_dai_ops = { +static const struct snd_soc_dai_ops wm8995_aif1_dai_ops = { .set_sysclk = wm8995_set_dai_sysclk, .set_fmt = wm8995_set_dai_fmt, .hw_params = wm8995_hw_params, @@ -2164,7 +2164,7 @@ static struct snd_soc_dai_ops wm8995_aif1_dai_ops = { .set_tristate = wm8995_set_tristate, }; -static struct snd_soc_dai_ops wm8995_aif2_dai_ops = { +static const struct snd_soc_dai_ops wm8995_aif2_dai_ops = { .set_sysclk = wm8995_set_dai_sysclk, .set_fmt = wm8995_set_dai_fmt, .hw_params = wm8995_hw_params, @@ -2173,7 +2173,7 @@ static struct snd_soc_dai_ops wm8995_aif2_dai_ops = { .set_tristate = wm8995_set_tristate, }; -static struct snd_soc_dai_ops wm8995_aif3_dai_ops = { +static const struct snd_soc_dai_ops wm8995_aif3_dai_ops = { .set_tristate = wm8995_set_tristate, }; diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index fd5bb1a..304a0e57 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c @@ -3052,7 +3052,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8996 = { SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE |\ SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm8996_dai_ops = { +static const struct snd_soc_dai_ops wm8996_dai_ops = { .set_fmt = wm8996_set_fmt, .hw_params = wm8996_hw_params, .set_sysclk = wm8996_set_sysclk, diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index f7c0738..48bf80b 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c @@ -1234,7 +1234,7 @@ static int wm9081_set_tdm_slot(struct snd_soc_dai *dai, (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops wm9081_dai_ops = { +static const struct snd_soc_dai_ops wm9081_dai_ops = { .hw_params = wm9081_hw_params, .set_fmt = wm9081_set_dai_fmt, .digital_mute = wm9081_digital_mute, diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index 646b58d..edf6032 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c @@ -258,7 +258,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream, SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000) -static struct snd_soc_dai_ops wm9705_dai_ops = { +static const struct snd_soc_dai_ops wm9705_dai_ops = { .prepare = ac97_prepare, }; diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 90117f8..fd18127 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -505,11 +505,11 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream, SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 |\ SNDRV_PCM_RATE_48000) -static struct snd_soc_dai_ops wm9712_dai_ops_hifi = { +static const struct snd_soc_dai_ops wm9712_dai_ops_hifi = { .prepare = ac97_prepare, }; -static struct snd_soc_dai_ops wm9712_dai_ops_aux = { +static const struct snd_soc_dai_ops wm9712_dai_ops_aux = { .prepare = ac97_aux_prepare, }; diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index 7167cb6..09360b6 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c @@ -1026,19 +1026,19 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream, (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \ SNDRV_PCM_FORMAT_S24_LE) -static struct snd_soc_dai_ops wm9713_dai_ops_hifi = { +static const struct snd_soc_dai_ops wm9713_dai_ops_hifi = { .prepare = ac97_hifi_prepare, .set_clkdiv = wm9713_set_dai_clkdiv, .set_pll = wm9713_set_dai_pll, }; -static struct snd_soc_dai_ops wm9713_dai_ops_aux = { +static const struct snd_soc_dai_ops wm9713_dai_ops_aux = { .prepare = ac97_aux_prepare, .set_clkdiv = wm9713_set_dai_clkdiv, .set_pll = wm9713_set_dai_pll, }; -static struct snd_soc_dai_ops wm9713_dai_ops_voice = { +static const struct snd_soc_dai_ops wm9713_dai_ops_voice = { .hw_params = wm9713_pcm_hw_params, .set_clkdiv = wm9713_set_dai_clkdiv, .set_pll = wm9713_set_dai_pll, diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index 300e121..f3d5ae1 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c @@ -620,7 +620,7 @@ static void davinci_i2s_shutdown(struct snd_pcm_substream *substream, #define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 -static struct snd_soc_dai_ops davinci_i2s_dai_ops = { +static const struct snd_soc_dai_ops davinci_i2s_dai_ops = { .startup = davinci_i2s_startup, .shutdown = davinci_i2s_shutdown, .prepare = davinci_i2s_prepare, diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 7173df2..03cea9d 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -813,7 +813,7 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, return 0; } -static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { +static const struct snd_soc_dai_ops davinci_mcasp_dai_ops = { .startup = davinci_mcasp_startup, .trigger = davinci_mcasp_trigger, .hw_params = davinci_mcasp_hw_params, diff --git a/sound/soc/davinci/davinci-vcif.c b/sound/soc/davinci/davinci-vcif.c index 1f11525..dae96b8 100644 --- a/sound/soc/davinci/davinci-vcif.c +++ b/sound/soc/davinci/davinci-vcif.c @@ -183,7 +183,7 @@ static int davinci_vcif_startup(struct snd_pcm_substream *substream, #define DAVINCI_VCIF_RATES SNDRV_PCM_RATE_8000_48000 -static struct snd_soc_dai_ops davinci_vcif_dai_ops = { +static const struct snd_soc_dai_ops davinci_vcif_dai_ops = { .startup = davinci_vcif_startup, .trigger = davinci_vcif_trigger, .hw_params = davinci_vcif_hw_params, diff --git a/sound/soc/ep93xx/ep93xx-ac97.c b/sound/soc/ep93xx/ep93xx-ac97.c index 3cd6158..c423d12 100644 --- a/sound/soc/ep93xx/ep93xx-ac97.c +++ b/sound/soc/ep93xx/ep93xx-ac97.c @@ -330,7 +330,7 @@ static int ep93xx_ac97_startup(struct snd_pcm_substream *substream, return 0; } -static struct snd_soc_dai_ops ep93xx_ac97_dai_ops = { +static const struct snd_soc_dai_ops ep93xx_ac97_dai_ops = { .startup = ep93xx_ac97_startup, .trigger = ep93xx_ac97_trigger, }; diff --git a/sound/soc/ep93xx/ep93xx-i2s.c b/sound/soc/ep93xx/ep93xx-i2s.c index 099614e..3dba128 100644 --- a/sound/soc/ep93xx/ep93xx-i2s.c +++ b/sound/soc/ep93xx/ep93xx-i2s.c @@ -338,7 +338,7 @@ static int ep93xx_i2s_resume(struct snd_soc_dai *dai) #define ep93xx_i2s_resume NULL #endif -static struct snd_soc_dai_ops ep93xx_i2s_dai_ops = { +static const struct snd_soc_dai_ops ep93xx_i2s_dai_ops = { .startup = ep93xx_i2s_startup, .shutdown = ep93xx_i2s_shutdown, .hw_params = ep93xx_i2s_hw_params, diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 83c4bd5..17d857e 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -514,7 +514,7 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream, } } -static struct snd_soc_dai_ops fsl_ssi_dai_ops = { +static const struct snd_soc_dai_ops fsl_ssi_dai_ops = { .startup = fsl_ssi_startup, .hw_params = fsl_ssi_hw_params, .shutdown = fsl_ssi_shutdown, diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c index ad36b09..2fb388f 100644 --- a/sound/soc/fsl/mpc5200_psc_ac97.c +++ b/sound/soc/fsl/mpc5200_psc_ac97.c @@ -226,12 +226,12 @@ static int psc_ac97_probe(struct snd_soc_dai *cpu_dai) /** * psc_ac97_dai_template: template CPU Digital Audio Interface */ -static struct snd_soc_dai_ops psc_ac97_analog_ops = { +static const struct snd_soc_dai_ops psc_ac97_analog_ops = { .hw_params = psc_ac97_hw_analog_params, .trigger = psc_ac97_trigger, }; -static struct snd_soc_dai_ops psc_ac97_digital_ops = { +static const struct snd_soc_dai_ops psc_ac97_digital_ops = { .hw_params = psc_ac97_hw_digital_params, }; diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c index 87cf2a5..e77a1f2 100644 --- a/sound/soc/fsl/mpc5200_psc_i2s.c +++ b/sound/soc/fsl/mpc5200_psc_i2s.c @@ -123,7 +123,7 @@ static int psc_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int format) /** * psc_i2s_dai_template: template CPU Digital Audio Interface */ -static struct snd_soc_dai_ops psc_i2s_dai_ops = { +static const struct snd_soc_dai_ops psc_i2s_dai_ops = { .hw_params = psc_i2s_hw_params, .set_sysclk = psc_i2s_set_sysclk, .set_fmt = psc_i2s_set_fmt, diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index 4c05e2b..eed7041 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c @@ -342,7 +342,7 @@ static int imx_ssi_trigger(struct snd_pcm_substream *substream, int cmd, return 0; } -static struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = { +static const struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = { .hw_params = imx_ssi_hw_params, .set_fmt = imx_ssi_set_dai_fmt, .set_clkdiv = imx_ssi_set_dai_clkdiv, diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c index cd22a54..91255c6 100644 --- a/sound/soc/jz4740/jz4740-i2s.c +++ b/sound/soc/jz4740/jz4740-i2s.c @@ -392,7 +392,7 @@ static int jz4740_i2s_dai_remove(struct snd_soc_dai *dai) return 0; } -static struct snd_soc_dai_ops jz4740_i2s_dai_ops = { +static const struct snd_soc_dai_ops jz4740_i2s_dai_ops = { .startup = jz4740_i2s_startup, .shutdown = jz4740_i2s_shutdown, .trigger = jz4740_i2s_trigger, diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index 715e841..2b212dc 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c @@ -373,7 +373,7 @@ static int kirkwood_i2s_remove(struct snd_soc_dai *dai) return 0; } -static struct snd_soc_dai_ops kirkwood_i2s_dai_ops = { +static const struct snd_soc_dai_ops kirkwood_i2s_dai_ops = { .startup = kirkwood_i2s_startup, .trigger = kirkwood_i2s_trigger, .hw_params = kirkwood_i2s_hw_params, diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index 76dc74d..46d76b5 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c @@ -550,7 +550,7 @@ static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd, (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ SNDRV_PCM_FMTBIT_S24_LE) -static struct snd_soc_dai_ops mxs_saif_dai_ops = { +static const struct snd_soc_dai_ops mxs_saif_dai_ops = { .startup = mxs_saif_startup, .trigger = mxs_saif_trigger, .prepare = mxs_saif_prepare, diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c index 9c0edad..7544d24 100644 --- a/sound/soc/nuc900/nuc900-ac97.c +++ b/sound/soc/nuc900/nuc900-ac97.c @@ -291,7 +291,7 @@ static int nuc900_ac97_remove(struct snd_soc_dai *dai) return 0; } -static struct snd_soc_dai_ops nuc900_ac97_dai_ops = { +static const struct snd_soc_dai_ops nuc900_ac97_dai_ops = { .trigger = nuc900_ac97_trigger, }; diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c index ccb8a6a..a04a433 100644 --- a/sound/soc/omap/ams-delta.c +++ b/sound/soc/omap/ams-delta.c @@ -474,7 +474,7 @@ static int ams_delta_digital_mute(struct snd_soc_dai *dai, int mute) } /* Our codec DAI probably doesn't have its own .ops structure */ -static struct snd_soc_dai_ops ams_delta_dai_ops = { +static const struct snd_soc_dai_ops ams_delta_dai_ops = { .digital_mute = ams_delta_digital_mute, }; diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index 36c6eae..9bb1cf8 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c @@ -83,7 +83,7 @@ static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream, return err; } -static struct snd_soc_dai_ops omap_hdmi_dai_ops = { +static const struct snd_soc_dai_ops omap_hdmi_dai_ops = { .startup = omap_hdmi_dai_startup, .hw_params = omap_hdmi_dai_hw_params, }; diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 4314647..d91e6ef 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c @@ -599,7 +599,7 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai, return err; } -static struct snd_soc_dai_ops mcbsp_dai_ops = { +static const struct snd_soc_dai_ops mcbsp_dai_ops = { .startup = omap_mcbsp_dai_startup, .shutdown = omap_mcbsp_dai_shutdown, .trigger = omap_mcbsp_dai_trigger, diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index 41d1706..cc8ceff 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c @@ -367,7 +367,7 @@ static int omap_mcpdm_prepare(struct snd_pcm_substream *substream, return 0; } -static struct snd_soc_dai_ops omap_mcpdm_dai_ops = { +static const struct snd_soc_dai_ops omap_mcpdm_dai_ops = { .startup = omap_mcpdm_dai_startup, .shutdown = omap_mcpdm_dai_shutdown, .hw_params = omap_mcpdm_dai_hw_params, diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index 8ad93ee..9c9a51e 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c @@ -771,7 +771,7 @@ static int pxa_ssp_remove(struct snd_soc_dai *dai) SNDRV_PCM_FMTBIT_S24_LE | \ SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops pxa_ssp_dai_ops = { +static const struct snd_soc_dai_ops pxa_ssp_dai_ops = { .startup = pxa_ssp_startup, .shutdown = pxa_ssp_shutdown, .trigger = pxa_ssp_trigger, diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index ac51c6d..3fec2f3 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c @@ -163,15 +163,15 @@ static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream, SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000) -static struct snd_soc_dai_ops pxa_ac97_hifi_dai_ops = { +static const struct snd_soc_dai_ops pxa_ac97_hifi_dai_ops = { .hw_params = pxa2xx_ac97_hw_params, }; -static struct snd_soc_dai_ops pxa_ac97_aux_dai_ops = { +static const struct snd_soc_dai_ops pxa_ac97_aux_dai_ops = { .hw_params = pxa2xx_ac97_hw_aux_params, }; -static struct snd_soc_dai_ops pxa_ac97_mic_dai_ops = { +static const struct snd_soc_dai_ops pxa_ac97_mic_dai_ops = { .hw_params = pxa2xx_ac97_hw_mic_params, }; diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index 11be595..609abd5 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c @@ -331,7 +331,7 @@ static int pxa2xx_i2s_remove(struct snd_soc_dai *dai) SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000) -static struct snd_soc_dai_ops pxa_i2s_dai_ops = { +static const struct snd_soc_dai_ops pxa_i2s_dai_ops = { .startup = pxa2xx_i2s_startup, .shutdown = pxa2xx_i2s_shutdown, .trigger = pxa2xx_i2s_trigger, diff --git a/sound/soc/s6000/s6000-i2s.c b/sound/soc/s6000/s6000-i2s.c index 3052f64..13716a9 100644 --- a/sound/soc/s6000/s6000-i2s.c +++ b/sound/soc/s6000/s6000-i2s.c @@ -409,7 +409,7 @@ static int s6000_i2s_dai_probe(struct snd_soc_dai *dai) SNDRV_PCM_RATE_8000_192000) #define S6000_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) -static struct snd_soc_dai_ops s6000_i2s_dai_ops = { +static const struct snd_soc_dai_ops s6000_i2s_dai_ops = { .set_fmt = s6000_i2s_set_dai_fmt, .set_clkdiv = s6000_i2s_set_clkdiv, .hw_params = s6000_i2s_hw_params, diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c index 16521e3..09035af 100644 --- a/sound/soc/samsung/ac97.c +++ b/sound/soc/samsung/ac97.c @@ -329,12 +329,12 @@ static int s3c_ac97_mic_trigger(struct snd_pcm_substream *substream, return 0; } -static struct snd_soc_dai_ops s3c_ac97_dai_ops = { +static const struct snd_soc_dai_ops s3c_ac97_dai_ops = { .hw_params = s3c_ac97_hw_params, .trigger = s3c_ac97_trigger, }; -static struct snd_soc_dai_ops s3c_ac97_mic_dai_ops = { +static const struct snd_soc_dai_ops s3c_ac97_mic_dai_ops = { .hw_params = s3c_ac97_hw_mic_params, .trigger = s3c_ac97_mic_trigger, }; diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index bff42bf..03ee8ce 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -923,7 +923,7 @@ static int samsung_i2s_dai_remove(struct snd_soc_dai *dai) return 0; } -static struct snd_soc_dai_ops samsung_i2s_dai_ops = { +static const struct snd_soc_dai_ops samsung_i2s_dai_ops = { .trigger = i2s_trigger, .hw_params = i2s_hw_params, .set_fmt = i2s_set_fmt, diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c index 05a47cf..2df2762 100644 --- a/sound/soc/samsung/pcm.c +++ b/sound/soc/samsung/pcm.c @@ -452,7 +452,7 @@ static int s3c_pcm_set_sysclk(struct snd_soc_dai *cpu_dai, return 0; } -static struct snd_soc_dai_ops s3c_pcm_dai_ops = { +static const struct snd_soc_dai_ops s3c_pcm_dai_ops = { .set_sysclk = s3c_pcm_set_sysclk, .set_clkdiv = s3c_pcm_set_clkdiv, .trigger = s3c_pcm_trigger, diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c index 7bbec25..545773d 100644 --- a/sound/soc/samsung/s3c2412-i2s.c +++ b/sound/soc/samsung/s3c2412-i2s.c @@ -142,7 +142,7 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) -static struct snd_soc_dai_ops s3c2412_i2s_dai_ops = { +static const struct snd_soc_dai_ops s3c2412_i2s_dai_ops = { .hw_params = s3c2412_i2s_hw_params, }; diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c index 558c64b..2a98bed 100644 --- a/sound/soc/samsung/s3c24xx-i2s.c +++ b/sound/soc/samsung/s3c24xx-i2s.c @@ -444,7 +444,7 @@ static int s3c24xx_i2s_resume(struct snd_soc_dai *cpu_dai) SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) -static struct snd_soc_dai_ops s3c24xx_i2s_dai_ops = { +static const struct snd_soc_dai_ops s3c24xx_i2s_dai_ops = { .trigger = s3c24xx_i2s_trigger, .hw_params = s3c24xx_i2s_hw_params, .set_fmt = s3c24xx_i2s_set_fmt, diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c index 468cff1..a1fee1a 100644 --- a/sound/soc/samsung/spdif.c +++ b/sound/soc/samsung/spdif.c @@ -334,7 +334,7 @@ static int spdif_resume(struct snd_soc_dai *cpu_dai) #define spdif_resume NULL #endif -static struct snd_soc_dai_ops spdif_dai_ops = { +static const struct snd_soc_dai_ops spdif_dai_ops = { .set_sysclk = spdif_set_sysclk, .trigger = spdif_trigger, .hw_params = spdif_hw_params, diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 99ed610..aa30330 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -1096,7 +1096,7 @@ static int fsi_dai_hw_params(struct snd_pcm_substream *substream, return ret; } -static struct snd_soc_dai_ops fsi_dai_ops = { +static const struct snd_soc_dai_ops fsi_dai_ops = { .startup = fsi_dai_startup, .shutdown = fsi_dai_shutdown, .trigger = fsi_dai_trigger, diff --git a/sound/soc/sh/hac.c b/sound/soc/sh/hac.c index c87e3ff..a1f307b 100644 --- a/sound/soc/sh/hac.c +++ b/sound/soc/sh/hac.c @@ -266,7 +266,7 @@ static int hac_hw_params(struct snd_pcm_substream *substream, #define AC97_FMTS \ SNDRV_PCM_FMTBIT_S16_LE -static struct snd_soc_dai_ops hac_dai_ops = { +static const struct snd_soc_dai_ops hac_dai_ops = { .hw_params = hac_hw_params, }; diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c index edacfeb..93dea49 100644 --- a/sound/soc/sh/siu_dai.c +++ b/sound/soc/sh/siu_dai.c @@ -707,7 +707,7 @@ epclkget: return ret; } -static struct snd_soc_dai_ops siu_dai_ops = { +static const struct snd_soc_dai_ops siu_dai_ops = { .startup = siu_dai_startup, .shutdown = siu_dai_shutdown, .prepare = siu_dai_prepare, diff --git a/sound/soc/sh/ssi.c b/sound/soc/sh/ssi.c index e0c621c..1fda16a 100644 --- a/sound/soc/sh/ssi.c +++ b/sound/soc/sh/ssi.c @@ -332,7 +332,7 @@ static int ssi_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_U24_3LE | \ SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_U32_LE) -static struct snd_soc_dai_ops ssi_dai_ops = { +static const struct snd_soc_dai_ops ssi_dai_ops = { .startup = ssi_startup, .shutdown = ssi_shutdown, .trigger = ssi_trigger, diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a5d3685..bf41d90 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -735,7 +735,7 @@ EXPORT_SYMBOL_GPL(snd_soc_resume); #define snd_soc_resume NULL #endif -static struct snd_soc_dai_ops null_dai_ops = { +static const struct snd_soc_dai_ops null_dai_ops = { }; static int soc_bind_dai_link(struct snd_soc_card *card, int num) diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c index 76014f0..1acbb55 100644 --- a/sound/soc/tegra/tegra_i2s.c +++ b/sound/soc/tegra/tegra_i2s.c @@ -305,7 +305,7 @@ static int tegra_i2s_probe(struct snd_soc_dai *dai) return 0; } -static struct snd_soc_dai_ops tegra_i2s_dai_ops = { +static const struct snd_soc_dai_ops tegra_i2s_dai_ops = { .set_fmt = tegra_i2s_set_fmt, .hw_params = tegra_i2s_hw_params, .trigger = tegra_i2s_trigger, diff --git a/sound/soc/tegra/tegra_spdif.c b/sound/soc/tegra/tegra_spdif.c index dd11d0c..ea9c920 100644 --- a/sound/soc/tegra/tegra_spdif.c +++ b/sound/soc/tegra/tegra_spdif.c @@ -226,7 +226,7 @@ static int tegra_spdif_probe(struct snd_soc_dai *dai) return 0; } -static struct snd_soc_dai_ops tegra_spdif_dai_ops = { +static const struct snd_soc_dai_ops tegra_spdif_dai_ops = { .hw_params = tegra_spdif_hw_params, .trigger = tegra_spdif_trigger, }; -- cgit v1.1 From 186bcda6f6217dc4b5353c3474121bc1194847f6 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 22 Nov 2011 18:21:18 -0700 Subject: ASoC: Tegra DAS: Add device tree binding Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/tegra_das.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_das.c b/sound/soc/tegra/tegra_das.c index fa3a442..5b82b4e 100644 --- a/sound/soc/tegra/tegra_das.c +++ b/sound/soc/tegra/tegra_das.c @@ -225,11 +225,18 @@ static int __devexit tegra_das_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id tegra_das_of_match[] __devinitconst = { + { .compatible = "nvidia,tegra20-das", }, + {}, +}; + static struct platform_driver tegra_das_driver = { .probe = tegra_das_probe, .remove = __devexit_p(tegra_das_remove), .driver = { .name = DRV_NAME, + .owner = THIS_MODULE, + .of_match_table = tegra_das_of_match, }, }; module_platform_driver(tegra_das_driver); @@ -238,3 +245,4 @@ MODULE_AUTHOR("Stephen Warren "); MODULE_DESCRIPTION("Tegra DAS driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:" DRV_NAME); +MODULE_DEVICE_TABLE(of, tegra_das_of_match); -- cgit v1.1 From e4e4c18a930ff11940ba2c525676566bd631706f Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 22 Nov 2011 18:21:20 -0700 Subject: ASoC: Tegra+WM8903 machine: Use devm_ APIs and module_platform_driver module_platform_driver saves some boiler-plate code. The devm_ APIs remove the need to manually clean up allocations, thus removing some code. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/tegra_wm8903.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index 9b0ee15..33feee8 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c @@ -390,17 +390,19 @@ static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev) return -EINVAL; } - machine = kzalloc(sizeof(struct tegra_wm8903), GFP_KERNEL); + machine = devm_kzalloc(&pdev->dev, sizeof(struct tegra_wm8903), + GFP_KERNEL); if (!machine) { dev_err(&pdev->dev, "Can't allocate tegra_wm8903 struct\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err; } machine->pdata = pdata; ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); if (ret) - goto err_free_machine; + goto err; card->dev = &pdev->dev; platform_set_drvdata(pdev, card); @@ -431,8 +433,7 @@ static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev) err_fini_utils: tegra_asoc_utils_fini(&machine->util_data); -err_free_machine: - kfree(machine); +err: return ret; } @@ -460,8 +461,6 @@ static int __devexit tegra_wm8903_driver_remove(struct platform_device *pdev) tegra_asoc_utils_fini(&machine->util_data); - kfree(machine); - return 0; } @@ -474,18 +473,7 @@ static struct platform_driver tegra_wm8903_driver = { .probe = tegra_wm8903_driver_probe, .remove = __devexit_p(tegra_wm8903_driver_remove), }; - -static int __init tegra_wm8903_modinit(void) -{ - return platform_driver_register(&tegra_wm8903_driver); -} -module_init(tegra_wm8903_modinit); - -static void __exit tegra_wm8903_modexit(void) -{ - platform_driver_unregister(&tegra_wm8903_driver); -} -module_exit(tegra_wm8903_modexit); +module_platform_driver(tegra_wm8903_driver); MODULE_AUTHOR("Stephen Warren "); MODULE_DESCRIPTION("Tegra+WM8903 machine ASoC driver"); -- cgit v1.1 From 45c26091205eb6ad737329c5973f46fd7c122595 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 22 Nov 2011 18:21:21 -0700 Subject: ASoC: Tegra TrimSlice machine: Use devm_ APIs and module_platform_driver module_platform_driver saves some boiler-plate code. The devm_ APIs remove the need to manually clean up allocations, thus removing some code. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/trimslice.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/trimslice.c b/sound/soc/tegra/trimslice.c index 2699a6f..d564b40 100644 --- a/sound/soc/tegra/trimslice.c +++ b/sound/soc/tegra/trimslice.c @@ -170,15 +170,17 @@ static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev) struct tegra_trimslice *trimslice; int ret; - trimslice = kzalloc(sizeof(struct tegra_trimslice), GFP_KERNEL); + trimslice = devm_kzalloc(&pdev->dev, sizeof(struct tegra_trimslice), + GFP_KERNEL); if (!trimslice) { dev_err(&pdev->dev, "Can't allocate tegra_trimslice\n"); - return -ENOMEM; + ret = -ENOMEM; + goto err; } ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev); if (ret) - goto err_free_trimslice; + goto err; card->dev = &pdev->dev; platform_set_drvdata(pdev, card); @@ -195,8 +197,7 @@ static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev) err_fini_utils: tegra_asoc_utils_fini(&trimslice->util_data); -err_free_trimslice: - kfree(trimslice); +err: return ret; } @@ -209,8 +210,6 @@ static int __devexit tegra_snd_trimslice_remove(struct platform_device *pdev) tegra_asoc_utils_fini(&trimslice->util_data); - kfree(trimslice); - return 0; } @@ -222,18 +221,7 @@ static struct platform_driver tegra_snd_trimslice_driver = { .probe = tegra_snd_trimslice_probe, .remove = __devexit_p(tegra_snd_trimslice_remove), }; - -static int __init snd_tegra_trimslice_init(void) -{ - return platform_driver_register(&tegra_snd_trimslice_driver); -} -module_init(snd_tegra_trimslice_init); - -static void __exit snd_tegra_trimslice_exit(void) -{ - platform_driver_unregister(&tegra_snd_trimslice_driver); -} -module_exit(snd_tegra_trimslice_exit); +module_platform_driver(tegra_snd_trimslice_driver); MODULE_AUTHOR("Mike Rapoport "); MODULE_DESCRIPTION("Trimslice machine ASoC driver"); -- cgit v1.1 From 890754a878c887de50bc0c9f9041b8b73bd09937 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 23 Nov 2011 14:11:21 +0100 Subject: ASoC: Cleanup duplicated const Commit 85e7652("ASoC: Constify snd_soc_dai_ops structs") accidentally introduced a few duplicated consts. This patch cleans it up. Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/au1x/i2sc.c | 2 +- sound/soc/codecs/adau1373.c | 2 +- sound/soc/codecs/adau1701.c | 2 +- sound/soc/codecs/adav80x.c | 2 +- sound/soc/codecs/cs42l73.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/au1x/i2sc.c b/sound/soc/au1x/i2sc.c index 2d5f755..6bcf48f 100644 --- a/sound/soc/au1x/i2sc.c +++ b/sound/soc/au1x/i2sc.c @@ -201,7 +201,7 @@ static int au1xi2s_startup(struct snd_pcm_substream *substream, return 0; } -static const const struct snd_soc_dai_ops au1xi2s_dai_ops = { +static const struct snd_soc_dai_ops au1xi2s_dai_ops = { .startup = au1xi2s_startup, .trigger = au1xi2s_trigger, .hw_params = au1xi2s_hw_params, diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c index 2e040af..45c6302 100644 --- a/sound/soc/codecs/adau1373.c +++ b/sound/soc/codecs/adau1373.c @@ -1042,7 +1042,7 @@ static int adau1373_set_dai_sysclk(struct snd_soc_dai *dai, return 0; } -static const const struct snd_soc_dai_ops adau1373_dai_ops = { +static const struct snd_soc_dai_ops adau1373_dai_ops = { .hw_params = adau1373_hw_params, .set_sysclk = adau1373_set_dai_sysclk, .set_fmt = adau1373_set_dai_fmt, diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index c69bdfe..8b7e1c5 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c @@ -427,7 +427,7 @@ static int adau1701_set_sysclk(struct snd_soc_codec *codec, int clk_id, #define ADAU1701_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static const const struct snd_soc_dai_ops adau1701_dai_ops = { +static const struct snd_soc_dai_ops adau1701_dai_ops = { .set_fmt = adau1701_set_dai_fmt, .hw_params = adau1701_hw_params, .digital_mute = adau1701_digital_mute, diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c index d927feb..f9f0894 100644 --- a/sound/soc/codecs/adav80x.c +++ b/sound/soc/codecs/adav80x.c @@ -718,7 +718,7 @@ static void adav80x_dai_shutdown(struct snd_pcm_substream *substream, adav80x->rate = 0; } -static const const struct snd_soc_dai_ops adav80x_dai_ops = { +static const struct snd_soc_dai_ops adav80x_dai_ops = { .set_fmt = adav80x_set_dai_fmt, .hw_params = adav80x_hw_params, .startup = adav80x_dai_startup, diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 75d80b2..d09578f 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -1190,7 +1190,7 @@ static int cs42l73_pcm_startup(struct snd_pcm_substream *substream, #define CS42L73_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ SNDRV_PCM_FMTBIT_S24_LE) -static const const struct snd_soc_dai_ops cs42l73_ops = { +static const struct snd_soc_dai_ops cs42l73_ops = { .startup = cs42l73_pcm_startup, .hw_params = cs42l73_pcm_hw_params, .set_fmt = cs42l73_set_dai_fmt, -- cgit v1.1 From 16c88583dca05034f284ad5c52f007a47673cf35 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 23 Nov 2011 14:59:54 +0000 Subject: ASoC: Remove unused variable in wm8776 driver Signed-off-by: Mark Brown --- sound/soc/codecs/wm8776.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index 223fc5a..359319c 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c @@ -392,7 +392,6 @@ static int wm8776_resume(struct snd_soc_codec *codec) static int wm8776_probe(struct snd_soc_codec *codec) { struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec); - struct snd_soc_dapm_context *dapm = &codec->dapm; int ret = 0; ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8776->control_type); -- cgit v1.1 From d4a2eca781bfd7323bfd98dbc7fd63c7d613fef2 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Wed, 23 Nov 2011 13:33:25 -0700 Subject: ASoC: Tegra I2S: Remove dependency on pdev->id When devices are instantiated from device-tree, pdev->id is set to -1. Rework the driver so it doesn't depend on the ID. Tegra I2S instantiated from board files are configured with pdev name "tegra-i2s" and ID 0 or 1. The driver core then names the device "tegra-i2s.0" or "tegra-i2s.1". This is not changing. When a device is instantiated from device-tree, it will have pdev->name="" and pdev->id=-1. For this reason, the pdev->id value is not something we can rely on. This patch doesn't actually change any names though: When a device is instantiated from device-tree, the overall device name will be "${unit_address}.${node_name}". This causes issues such as clk_get() failures due to lack of a device-name match. To solve that, AUXDATA was invented, to force a specific device name, thus allowing dev_name() to return the same as the non-device-tree case. Tegra currently uses AUXDATA for the I2S controllers. Eventually, AUXDATA will go away, most likely replaced by phandle-based references within the device tree. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/tegra_i2s.c | 72 +++++++++++++++------------------------------ sound/soc/tegra/tegra_i2s.h | 1 + 2 files changed, 24 insertions(+), 49 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c index 1acbb55..ca4d0c0 100644 --- a/sound/soc/tegra/tegra_i2s.c +++ b/sound/soc/tegra/tegra_i2s.c @@ -98,13 +98,11 @@ static const struct file_operations tegra_i2s_debug_fops = { .release = single_release, }; -static void tegra_i2s_debug_add(struct tegra_i2s *i2s, int id) +static void tegra_i2s_debug_add(struct tegra_i2s *i2s) { - char name[] = DRV_NAME ".0"; - - snprintf(name, sizeof(name), DRV_NAME".%1d", id); - i2s->debug = debugfs_create_file(name, S_IRUGO, snd_soc_debugfs_root, - i2s, &tegra_i2s_debug_fops); + i2s->debug = debugfs_create_file(i2s->dai.name, S_IRUGO, + snd_soc_debugfs_root, i2s, + &tegra_i2s_debug_fops); } static void tegra_i2s_debug_remove(struct tegra_i2s *i2s) @@ -311,43 +309,22 @@ static const struct snd_soc_dai_ops tegra_i2s_dai_ops = { .trigger = tegra_i2s_trigger, }; -static struct snd_soc_dai_driver tegra_i2s_dai[] = { - { - .name = DRV_NAME ".0", - .probe = tegra_i2s_probe, - .playback = { - .channels_min = 2, - .channels_max = 2, - .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, - }, - .capture = { - .channels_min = 2, - .channels_max = 2, - .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, - }, - .ops = &tegra_i2s_dai_ops, - .symmetric_rates = 1, +static const struct snd_soc_dai_driver tegra_i2s_dai_template = { + .probe = tegra_i2s_probe, + .playback = { + .channels_min = 2, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_96000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, }, - { - .name = DRV_NAME ".1", - .probe = tegra_i2s_probe, - .playback = { - .channels_min = 2, - .channels_max = 2, - .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, - }, - .capture = { - .channels_min = 2, - .channels_max = 2, - .rates = SNDRV_PCM_RATE_8000_96000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, - }, - .ops = &tegra_i2s_dai_ops, - .symmetric_rates = 1, + .capture = { + .channels_min = 2, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_96000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, }, + .ops = &tegra_i2s_dai_ops, + .symmetric_rates = 1, }; static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) @@ -356,12 +333,6 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) struct resource *mem, *memregion, *dmareq; int ret; - if ((pdev->id < 0) || - (pdev->id >= ARRAY_SIZE(tegra_i2s_dai))) { - dev_err(&pdev->dev, "ID %d out of range\n", pdev->id); - return -EINVAL; - } - i2s = devm_kzalloc(&pdev->dev, sizeof(struct tegra_i2s), GFP_KERNEL); if (!i2s) { dev_err(&pdev->dev, "Can't allocate tegra_i2s\n"); @@ -370,6 +341,9 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) } dev_set_drvdata(&pdev->dev, i2s); + i2s->dai = tegra_i2s_dai_template; + i2s->dai.name = dev_name(&pdev->dev); + i2s->clk_i2s = clk_get(&pdev->dev, NULL); if (IS_ERR(i2s->clk_i2s)) { dev_err(&pdev->dev, "Can't retrieve i2s clock\n"); @@ -418,14 +392,14 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) i2s->reg_ctrl = TEGRA_I2S_CTRL_FIFO_FORMAT_PACKED; - ret = snd_soc_register_dai(&pdev->dev, &tegra_i2s_dai[pdev->id]); + ret = snd_soc_register_dai(&pdev->dev, &i2s->dai); if (ret) { dev_err(&pdev->dev, "Could not register DAI: %d\n", ret); ret = -ENOMEM; goto err_clk_put; } - tegra_i2s_debug_add(i2s, pdev->id); + tegra_i2s_debug_add(i2s); return 0; diff --git a/sound/soc/tegra/tegra_i2s.h b/sound/soc/tegra/tegra_i2s.h index 2b38a09..15ce1e2 100644 --- a/sound/soc/tegra/tegra_i2s.h +++ b/sound/soc/tegra/tegra_i2s.h @@ -153,6 +153,7 @@ #define TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_TWELVE_SLOTS (TEGRA_I2S_FIFO_ATN_LVL_TWELVE_SLOTS << TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_SHIFT) struct tegra_i2s { + struct snd_soc_dai_driver dai; struct clk *clk_i2s; int clk_refs; struct tegra_pcm_dma_params capture_dma_data; -- cgit v1.1 From 1633281b79fd276f1c7c2fb37c3b97da74e42ae5 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Wed, 23 Nov 2011 12:42:04 -0700 Subject: ASoC: Implement fully_routed card property A card is fully routed if the DAPM route table describes all connections on the board. When a card is fully routed, some operations can be automated by the ASoC core. The first, and currently only, such operation is described below, and implemented by this patch. Codecs often have a large number of external pins, and not all of these pins will be connected on all board designs. Some machine drivers therefore call snd_soc_dapm_nc_pin() for all the unused pins, in order to tell the ASoC core never to activate them. However, when a card is fully routed, the information needed to derive the set of unused pins is present in card->dapm_routes. In this case, have the ASoC core automatically call snd_soc_dapm_nc_pin() for each unused codec pin. This has been tested with soc/tegra/tegra_wm8903.c and soc/tegra/trimslice.c. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 4 +++ sound/soc/soc-dapm.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) (limited to 'sound') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index b194842..2abaf6d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1488,6 +1488,10 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) snd_soc_dapm_new_widgets(&card->dapm); + if (card->fully_routed) + list_for_each_entry(codec, &codec_list, list) + snd_soc_dapm_auto_nc_codec_pins(codec); + ret = snd_card_register(card->snd_card); if (ret < 0) { printk(KERN_ERR "asoc: failed to register soundcard for %s\n", card->name); diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index f42e8b9..1ecd1b4 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2947,6 +2947,79 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, } EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend); +static bool snd_soc_dapm_widget_in_card_paths(struct snd_soc_card *card, + struct snd_soc_dapm_widget *w) +{ + struct snd_soc_dapm_path *p; + + list_for_each_entry(p, &card->paths, list) { + if ((p->source == w) || (p->sink == w)) { + dev_dbg(card->dev, + "... Path %s(id:%d dapm:%p) - %s(id:%d dapm:%p)\n", + p->source->name, p->source->id, p->source->dapm, + p->sink->name, p->sink->id, p->sink->dapm); + + /* Connected to something other than the codec */ + if (p->source->dapm != p->sink->dapm) + return true; + /* + * Loopback connection from codec external pin to + * codec external pin + */ + if (p->sink->id == snd_soc_dapm_input) { + switch (p->source->id) { + case snd_soc_dapm_output: + case snd_soc_dapm_micbias: + return true; + default: + break; + } + } + } + } + + return false; +} + +/** + * snd_soc_dapm_auto_nc_codec_pins - call snd_soc_dapm_nc_pin for unused pins + * @codec: The codec whose pins should be processed + * + * Automatically call snd_soc_dapm_nc_pin() for any external pins in the codec + * which are unused. Pins are used if they are connected externally to the + * codec, whether that be to some other device, or a loop-back connection to + * the codec itself. + */ +void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec) +{ + struct snd_soc_card *card = codec->card; + struct snd_soc_dapm_context *dapm = &codec->dapm; + struct snd_soc_dapm_widget *w; + + dev_dbg(card->dev, "Auto NC: DAPMs: card:%p codec:%p\n", + &card->dapm, &codec->dapm); + + list_for_each_entry(w, &card->widgets, list) { + if (w->dapm != dapm) + continue; + switch (w->id) { + case snd_soc_dapm_input: + case snd_soc_dapm_output: + case snd_soc_dapm_micbias: + dev_dbg(card->dev, "Auto NC: Checking widget %s\n", + w->name); + if (!snd_soc_dapm_widget_in_card_paths(card, w)) { + dev_dbg(card->dev, + "... Not in map; disabling\n"); + snd_soc_dapm_nc_pin(dapm, w->name); + } + break; + default: + break; + } + } +} + /** * snd_soc_dapm_free - free dapm resources * @dapm: DAPM context -- cgit v1.1 From 6e5fdba9c9d4e2fdb19bf19633cb7b9bb72dccb1 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Wed, 23 Nov 2011 12:42:05 -0700 Subject: ASoC: Tegra+WM903 machine: Set the new fully_routed flag Set card.fully_routed to request the ASoC core calculated unused codec pins, and call snd_soc_dapm_nc_pin() for them. Remove the open-coded calls. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/tegra_wm8903.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index 33feee8..b260f54 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c @@ -331,27 +331,6 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) snd_soc_dapm_force_enable_pin(dapm, "Mic Bias"); - /* FIXME: Calculate automatically based on DAPM routes? */ - if (!machine_is_harmony()) - snd_soc_dapm_nc_pin(dapm, "IN1L"); - if (!machine_is_seaboard() && !machine_is_aebl()) - snd_soc_dapm_nc_pin(dapm, "IN1R"); - snd_soc_dapm_nc_pin(dapm, "IN2L"); - if (!machine_is_kaen()) - snd_soc_dapm_nc_pin(dapm, "IN2R"); - snd_soc_dapm_nc_pin(dapm, "IN3L"); - snd_soc_dapm_nc_pin(dapm, "IN3R"); - - if (machine_is_aebl()) { - snd_soc_dapm_nc_pin(dapm, "LON"); - snd_soc_dapm_nc_pin(dapm, "RON"); - snd_soc_dapm_nc_pin(dapm, "ROP"); - snd_soc_dapm_nc_pin(dapm, "LOP"); - } else { - snd_soc_dapm_nc_pin(dapm, "LINEOUTR"); - snd_soc_dapm_nc_pin(dapm, "LINEOUTL"); - } - return 0; } @@ -375,6 +354,7 @@ static struct snd_soc_card snd_soc_tegra_wm8903 = { .num_controls = ARRAY_SIZE(tegra_wm8903_controls), .dapm_widgets = tegra_wm8903_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(tegra_wm8903_dapm_widgets), + .fully_routed = true, }; static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev) -- cgit v1.1 From 504855d171f4183ac231a5ecdf0273ac249cda2b Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Wed, 23 Nov 2011 12:42:06 -0700 Subject: ASoC: TrimSlice machine: Set the new fully_routed flag Set card.fully_routed to request the ASoC core calculated unused codec pins, and call snd_soc_dapm_nc_pin() for them. Remove the open-coded calls. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/trimslice.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/trimslice.c b/sound/soc/tegra/trimslice.c index d564b40..043eb7c 100644 --- a/sound/soc/tegra/trimslice.c +++ b/sound/soc/tegra/trimslice.c @@ -119,7 +119,6 @@ static int trimslice_asoc_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_card *card = codec->card; - struct snd_soc_dapm_context *dapm = &codec->dapm; int ret; ret = tegra_das_connect_dap_to_dac(TEGRA_DAS_DAP_ID_1, @@ -135,10 +134,6 @@ static int trimslice_asoc_init(struct snd_soc_pcm_runtime *rtd) return ret; } - snd_soc_dapm_nc_pin(dapm, "LHPOUT"); - snd_soc_dapm_nc_pin(dapm, "RHPOUT"); - snd_soc_dapm_nc_pin(dapm, "MICIN"); - return 0; } @@ -162,6 +157,7 @@ static struct snd_soc_card snd_soc_trimslice = { .num_dapm_widgets = ARRAY_SIZE(trimslice_dapm_widgets), .dapm_routes = trimslice_audio_map, .num_dapm_routes = ARRAY_SIZE(trimslice_audio_map), + .fully_routed = true, }; static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev) -- cgit v1.1 From 39afd66cead742e99c051d6f3b07f89d09eebbbb Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 23 Nov 2011 21:33:07 +0000 Subject: ASoC: Add fully_routed flag to Speyside machines Signed-off-by: Mark Brown --- sound/soc/samsung/speyside.c | 3 +-- sound/soc/samsung/speyside_wm8962.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c index 85bf541..efa5187 100644 --- a/sound/soc/samsung/speyside.c +++ b/sound/soc/samsung/speyside.c @@ -222,8 +222,6 @@ static struct snd_soc_dai_link speyside_dai[] = { static int speyside_wm9081_init(struct snd_soc_dapm_context *dapm) { - snd_soc_dapm_nc_pin(dapm, "LINEOUT"); - /* At any time the WM9081 is active it will have this clock */ return snd_soc_codec_set_sysclk(dapm->codec, WM9081_SYSCLK_MCLK, 0, 48000 * 256, 0); @@ -308,6 +306,7 @@ static struct snd_soc_card speyside = { .num_dapm_widgets = ARRAY_SIZE(widgets), .dapm_routes = audio_paths, .num_dapm_routes = ARRAY_SIZE(audio_paths), + .fully_routed = true, .late_probe = speyside_late_probe, }; diff --git a/sound/soc/samsung/speyside_wm8962.c b/sound/soc/samsung/speyside_wm8962.c index e3e2716..a681c8d 100644 --- a/sound/soc/samsung/speyside_wm8962.c +++ b/sound/soc/samsung/speyside_wm8962.c @@ -208,6 +208,7 @@ static struct snd_soc_card speyside_wm8962 = { .num_dapm_widgets = ARRAY_SIZE(widgets), .dapm_routes = audio_paths, .num_dapm_routes = ARRAY_SIZE(audio_paths), + .fully_routed = true, .late_probe = speyside_wm8962_late_probe, }; -- cgit v1.1 From 45f3121615b2b354f7d95d30f795bc5fe0043e92 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 23 Nov 2011 16:55:34 -0800 Subject: ASoC: fsi-ak4642: modify specification method of FSI / ak464x Current fsi-ak4642 was using id_entry name in order to specify FSI port and ak464x codec. But it was no sense, no flexibility. Platform can specify FSI/ak464x pair by this patch. Acked-by: Paul Mundt Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/fsi-ak4642.c | 114 +++++----------------------------------------- 1 file changed, 11 insertions(+), 103 deletions(-) (limited to 'sound') diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c index dff64b9..11d2d7f 100644 --- a/sound/soc/sh/fsi-ak4642.c +++ b/sound/soc/sh/fsi-ak4642.c @@ -58,27 +58,23 @@ static struct platform_device *fsi_snd_device; static int fsi_ak4642_probe(struct platform_device *pdev) { int ret = -ENOMEM; - const struct platform_device_id *id_entry; - struct fsi_ak4642_data *pdata; + struct fsi_ak4642_info *pinfo = pdev->dev.platform_data; - id_entry = pdev->id_entry; - if (!id_entry) { - dev_err(&pdev->dev, "unknown fsi ak4642\n"); - return -ENODEV; + if (!pinfo) { + dev_err(&pdev->dev, "no info for fsi ak4642\n"); + goto out; } - pdata = (struct fsi_ak4642_data *)id_entry->driver_data; - - fsi_snd_device = platform_device_alloc("soc-audio", pdata->id); + fsi_snd_device = platform_device_alloc("soc-audio", pinfo->id); if (!fsi_snd_device) goto out; - fsi_dai_link.name = pdata->name; - fsi_dai_link.stream_name = pdata->name; - fsi_dai_link.cpu_dai_name = pdata->cpu_dai; - fsi_dai_link.platform_name = pdata->platform; - fsi_dai_link.codec_name = pdata->codec; - fsi_soc_card.name = pdata->card; + fsi_dai_link.name = pinfo->name; + fsi_dai_link.stream_name = pinfo->name; + fsi_dai_link.cpu_dai_name = pinfo->cpu_dai; + fsi_dai_link.platform_name = pinfo->platform; + fsi_dai_link.codec_name = pinfo->codec; + fsi_soc_card.name = pinfo->card; platform_set_drvdata(fsi_snd_device, &fsi_soc_card); ret = platform_device_add(fsi_snd_device); @@ -96,100 +92,12 @@ static int fsi_ak4642_remove(struct platform_device *pdev) return 0; } -static struct fsi_ak4642_data fsi_a_ak4642 = { - .name = "AK4642", - .card = "FSIA-AK4642", - .cpu_dai = "fsia-dai", - .codec = "ak4642-codec.0-0012", - .platform = "sh_fsi.0", - .id = FSI_PORT_A, -}; - -static struct fsi_ak4642_data fsi_b_ak4642 = { - .name = "AK4642", - .card = "FSIB-AK4642", - .cpu_dai = "fsib-dai", - .codec = "ak4642-codec.0-0012", - .platform = "sh_fsi.0", - .id = FSI_PORT_B, -}; - -static struct fsi_ak4642_data fsi_a_ak4643 = { - .name = "AK4643", - .card = "FSIA-AK4643", - .cpu_dai = "fsia-dai", - .codec = "ak4642-codec.0-0013", - .platform = "sh_fsi.0", - .id = FSI_PORT_A, -}; - -static struct fsi_ak4642_data fsi_b_ak4643 = { - .name = "AK4643", - .card = "FSIB-AK4643", - .cpu_dai = "fsib-dai", - .codec = "ak4642-codec.0-0013", - .platform = "sh_fsi.0", - .id = FSI_PORT_B, -}; - -static struct fsi_ak4642_data fsi2_a_ak4642 = { - .name = "AK4642", - .card = "FSI2A-AK4642", - .cpu_dai = "fsia-dai", - .codec = "ak4642-codec.0-0012", - .platform = "sh_fsi2", - .id = FSI_PORT_A, -}; - -static struct fsi_ak4642_data fsi2_b_ak4642 = { - .name = "AK4642", - .card = "FSI2B-AK4642", - .cpu_dai = "fsib-dai", - .codec = "ak4642-codec.0-0012", - .platform = "sh_fsi2", - .id = FSI_PORT_B, -}; - -static struct fsi_ak4642_data fsi2_a_ak4643 = { - .name = "AK4643", - .card = "FSI2A-AK4643", - .cpu_dai = "fsia-dai", - .codec = "ak4642-codec.0-0013", - .platform = "sh_fsi2", - .id = FSI_PORT_A, -}; - -static struct fsi_ak4642_data fsi2_b_ak4643 = { - .name = "AK4643", - .card = "FSI2B-AK4643", - .cpu_dai = "fsib-dai", - .codec = "ak4642-codec.0-0013", - .platform = "sh_fsi2", - .id = FSI_PORT_B, -}; - -static struct platform_device_id fsi_id_table[] = { - /* FSI */ - { "sh_fsi_a_ak4642", (kernel_ulong_t)&fsi_a_ak4642 }, - { "sh_fsi_b_ak4642", (kernel_ulong_t)&fsi_b_ak4642 }, - { "sh_fsi_a_ak4643", (kernel_ulong_t)&fsi_a_ak4643 }, - { "sh_fsi_b_ak4643", (kernel_ulong_t)&fsi_b_ak4643 }, - - /* FSI 2 */ - { "sh_fsi2_a_ak4642", (kernel_ulong_t)&fsi2_a_ak4642 }, - { "sh_fsi2_b_ak4642", (kernel_ulong_t)&fsi2_b_ak4642 }, - { "sh_fsi2_a_ak4643", (kernel_ulong_t)&fsi2_a_ak4643 }, - { "sh_fsi2_b_ak4643", (kernel_ulong_t)&fsi2_b_ak4643 }, - {}, -}; - static struct platform_driver fsi_ak4642 = { .driver = { .name = "fsi-ak4642-audio", }, .probe = fsi_ak4642_probe, .remove = fsi_ak4642_remove, - .id_table = fsi_id_table, }; static int __init fsi_ak4642_init(void) -- cgit v1.1 From ee18f6314fa16376d53c29ecf9704011f2ce8180 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 24 Nov 2011 12:07:55 +0800 Subject: ASoC: Convert ep93xx directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Acked-by: Mika Westerberg Acked-by: Alexander Sverdlin Signed-off-by: Mark Brown --- sound/soc/ep93xx/edb93xx.c | 12 +----------- sound/soc/ep93xx/ep93xx-ac97.c | 12 +----------- sound/soc/ep93xx/ep93xx-i2s.c | 13 +------------ sound/soc/ep93xx/ep93xx-pcm.c | 13 +------------ sound/soc/ep93xx/simone.c | 12 +----------- sound/soc/ep93xx/snappercl15.c | 13 +------------ 6 files changed, 6 insertions(+), 69 deletions(-) (limited to 'sound') diff --git a/sound/soc/ep93xx/edb93xx.c b/sound/soc/ep93xx/edb93xx.c index 51930b6..6b90c75 100644 --- a/sound/soc/ep93xx/edb93xx.c +++ b/sound/soc/ep93xx/edb93xx.c @@ -131,17 +131,7 @@ static struct platform_driver edb93xx_driver = { .remove = __devexit_p(edb93xx_remove), }; -static int __init edb93xx_init(void) -{ - return platform_driver_register(&edb93xx_driver); -} -module_init(edb93xx_init); - -static void __exit edb93xx_exit(void) -{ - platform_driver_unregister(&edb93xx_driver); -} -module_exit(edb93xx_exit); +module_platform_driver(edb93xx_driver); MODULE_AUTHOR("Alexander Sverdlin "); MODULE_DESCRIPTION("ALSA SoC EDB93xx"); diff --git a/sound/soc/ep93xx/ep93xx-ac97.c b/sound/soc/ep93xx/ep93xx-ac97.c index c423d12..0678637 100644 --- a/sound/soc/ep93xx/ep93xx-ac97.c +++ b/sound/soc/ep93xx/ep93xx-ac97.c @@ -449,17 +449,7 @@ static struct platform_driver ep93xx_ac97_driver = { }, }; -static int __init ep93xx_ac97_init(void) -{ - return platform_driver_register(&ep93xx_ac97_driver); -} -module_init(ep93xx_ac97_init); - -static void __exit ep93xx_ac97_exit(void) -{ - platform_driver_unregister(&ep93xx_ac97_driver); -} -module_exit(ep93xx_ac97_exit); +module_platform_driver(ep93xx_ac97_driver); MODULE_DESCRIPTION("EP93xx AC97 ASoC Driver"); MODULE_AUTHOR("Mika Westerberg "); diff --git a/sound/soc/ep93xx/ep93xx-i2s.c b/sound/soc/ep93xx/ep93xx-i2s.c index 3dba128..f7a6234 100644 --- a/sound/soc/ep93xx/ep93xx-i2s.c +++ b/sound/soc/ep93xx/ep93xx-i2s.c @@ -464,18 +464,7 @@ static struct platform_driver ep93xx_i2s_driver = { }, }; -static int __init ep93xx_i2s_init(void) -{ - return platform_driver_register(&ep93xx_i2s_driver); -} - -static void __exit ep93xx_i2s_exit(void) -{ - platform_driver_unregister(&ep93xx_i2s_driver); -} - -module_init(ep93xx_i2s_init); -module_exit(ep93xx_i2s_exit); +module_platform_driver(ep93xx_i2s_driver); MODULE_ALIAS("platform:ep93xx-i2s"); MODULE_AUTHOR("Ryan Mallon"); diff --git a/sound/soc/ep93xx/ep93xx-pcm.c b/sound/soc/ep93xx/ep93xx-pcm.c index d00230a..a2de9c4 100644 --- a/sound/soc/ep93xx/ep93xx-pcm.c +++ b/sound/soc/ep93xx/ep93xx-pcm.c @@ -339,18 +339,7 @@ static struct platform_driver ep93xx_pcm_driver = { .remove = __devexit_p(ep93xx_soc_platform_remove), }; -static int __init ep93xx_soc_platform_init(void) -{ - return platform_driver_register(&ep93xx_pcm_driver); -} - -static void __exit ep93xx_soc_platform_exit(void) -{ - platform_driver_unregister(&ep93xx_pcm_driver); -} - -module_init(ep93xx_soc_platform_init); -module_exit(ep93xx_soc_platform_exit); +module_platform_driver(ep93xx_pcm_driver); MODULE_AUTHOR("Ryan Mallon"); MODULE_DESCRIPTION("EP93xx ALSA PCM interface"); diff --git a/sound/soc/ep93xx/simone.c b/sound/soc/ep93xx/simone.c index 968cb31..1e00b33 100644 --- a/sound/soc/ep93xx/simone.c +++ b/sound/soc/ep93xx/simone.c @@ -81,17 +81,7 @@ static struct platform_driver simone_driver = { .remove = __devexit_p(simone_remove), }; -static int __init simone_init(void) -{ - return platform_driver_register(&simone_driver); -} -module_init(simone_init); - -static void __exit simone_exit(void) -{ - platform_driver_unregister(&simone_driver); -} -module_exit(simone_exit); +module_platform_driver(simone_driver); MODULE_DESCRIPTION("ALSA SoC Simplemachines Sim.One"); MODULE_AUTHOR("Mika Westerberg "); diff --git a/sound/soc/ep93xx/snappercl15.c b/sound/soc/ep93xx/snappercl15.c index 2cde433..33901d6 100644 --- a/sound/soc/ep93xx/snappercl15.c +++ b/sound/soc/ep93xx/snappercl15.c @@ -147,18 +147,7 @@ static struct platform_driver snappercl15_driver = { .remove = __devexit_p(snappercl15_remove), }; -static int __init snappercl15_init(void) -{ - return platform_driver_register(&snappercl15_driver); -} - -static void __exit snappercl15_exit(void) -{ - platform_driver_unregister(&snappercl15_driver); -} - -module_init(snappercl15_init); -module_exit(snappercl15_exit); +module_platform_driver(snappercl15_driver); MODULE_AUTHOR("Ryan Mallon"); MODULE_DESCRIPTION("ALSA SoC Snapper CL15"); -- cgit v1.1 From 880dd7210cd04205c6584922ad16b2d5731ab2c0 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 24 Nov 2011 12:14:56 +0800 Subject: ASoC: Convert s6000 directory to module_platform_driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Factor out some boilerplate code. Signed-off-by: Axel Lin Acked-by: Daniel Glöckner Signed-off-by: Mark Brown --- sound/soc/s6000/s6000-i2s.c | 12 +----------- sound/soc/s6000/s6000-pcm.c | 12 +----------- 2 files changed, 2 insertions(+), 22 deletions(-) (limited to 'sound') diff --git a/sound/soc/s6000/s6000-i2s.c b/sound/soc/s6000/s6000-i2s.c index 13716a9..aaabdba 100644 --- a/sound/soc/s6000/s6000-i2s.c +++ b/sound/soc/s6000/s6000-i2s.c @@ -604,17 +604,7 @@ static struct platform_driver s6000_i2s_driver = { }, }; -static int __init s6000_i2s_init(void) -{ - return platform_driver_register(&s6000_i2s_driver); -} -module_init(s6000_i2s_init); - -static void __exit s6000_i2s_exit(void) -{ - platform_driver_unregister(&s6000_i2s_driver); -} -module_exit(s6000_i2s_exit); +module_platform_driver(s6000_i2s_driver); MODULE_AUTHOR("Daniel Gloeckner"); MODULE_DESCRIPTION("Stretch s6000 family I2S SoC Interface"); diff --git a/sound/soc/s6000/s6000-pcm.c b/sound/soc/s6000/s6000-pcm.c index 55efc2b..43c014f 100644 --- a/sound/soc/s6000/s6000-pcm.c +++ b/sound/soc/s6000/s6000-pcm.c @@ -520,17 +520,7 @@ static struct platform_driver s6000_pcm_driver = { .remove = __devexit_p(s6000_soc_platform_remove), }; -static int __init snd_s6000_pcm_init(void) -{ - return platform_driver_register(&s6000_pcm_driver); -} -module_init(snd_s6000_pcm_init); - -static void __exit snd_s6000_pcm_exit(void) -{ - platform_driver_unregister(&s6000_pcm_driver); -} -module_exit(snd_s6000_pcm_exit); +module_platform_driver(s6000_pcm_driver); MODULE_AUTHOR("Daniel Gloeckner"); MODULE_DESCRIPTION("Stretch s6000 family PCM DMA module"); -- cgit v1.1 From 85aa0960d8ef22edbb092446559b3b700a5512ef Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 24 Nov 2011 14:21:29 +0800 Subject: ASoC: Convert mxs directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Acked-by: Wolfram Sang Acked-by: Dong Aisheng Signed-off-by: Mark Brown --- sound/soc/mxs/mxs-pcm.c | 12 +----------- sound/soc/mxs/mxs-saif.c | 12 +----------- sound/soc/mxs/mxs-sgtl5000.c | 12 +----------- 3 files changed, 3 insertions(+), 33 deletions(-) (limited to 'sound') diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c index dea5aa4..612ad3d 100644 --- a/sound/soc/mxs/mxs-pcm.c +++ b/sound/soc/mxs/mxs-pcm.c @@ -346,14 +346,4 @@ static struct platform_driver mxs_pcm_driver = { .remove = __devexit_p(mxs_soc_platform_remove), }; -static int __init snd_mxs_pcm_init(void) -{ - return platform_driver_register(&mxs_pcm_driver); -} -module_init(snd_mxs_pcm_init); - -static void __exit snd_mxs_pcm_exit(void) -{ - platform_driver_unregister(&mxs_pcm_driver); -} -module_exit(snd_mxs_pcm_exit); +module_platform_driver(mxs_pcm_driver); diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index 46d76b5..1a13ab8 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c @@ -781,18 +781,8 @@ static struct platform_driver mxs_saif_driver = { }, }; -static int __init mxs_saif_init(void) -{ - return platform_driver_register(&mxs_saif_driver); -} - -static void __exit mxs_saif_exit(void) -{ - platform_driver_unregister(&mxs_saif_driver); -} +module_platform_driver(mxs_saif_driver); -module_init(mxs_saif_init); -module_exit(mxs_saif_exit); MODULE_AUTHOR("Freescale Semiconductor, Inc."); MODULE_DESCRIPTION("MXS ASoC SAIF driver"); MODULE_LICENSE("GPL"); diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c index 7fbeaec..200a928 100644 --- a/sound/soc/mxs/mxs-sgtl5000.c +++ b/sound/soc/mxs/mxs-sgtl5000.c @@ -156,17 +156,7 @@ static struct platform_driver mxs_sgtl5000_audio_driver = { .remove = __devexit_p(mxs_sgtl5000_remove), }; -static int __init mxs_sgtl5000_init(void) -{ - return platform_driver_register(&mxs_sgtl5000_audio_driver); -} -module_init(mxs_sgtl5000_init); - -static void __exit mxs_sgtl5000_exit(void) -{ - platform_driver_unregister(&mxs_sgtl5000_audio_driver); -} -module_exit(mxs_sgtl5000_exit); +module_platform_driver(mxs_sgtl5000_audio_driver); MODULE_AUTHOR("Freescale Semiconductor, Inc."); MODULE_DESCRIPTION("MXS ALSA SoC Machine driver"); -- cgit v1.1 From fb80297e4379640653b525e897b65b0b05a5b845 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 24 Nov 2011 14:44:52 +0800 Subject: ASoC: Convert blackfin directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Acked-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/blackfin/bf5xx-ac97-pcm.c | 12 +----------- sound/soc/blackfin/bf5xx-ac97.c | 13 +------------ sound/soc/blackfin/bf5xx-i2s-pcm.c | 12 +----------- sound/soc/blackfin/bf5xx-i2s.c | 13 +------------ sound/soc/blackfin/bf5xx-tdm-pcm.c | 12 +----------- sound/soc/blackfin/bf5xx-tdm.c | 12 +----------- sound/soc/blackfin/bfin-eval-adau1373.c | 12 +----------- sound/soc/blackfin/bfin-eval-adau1701.c | 12 +----------- sound/soc/blackfin/bfin-eval-adav80x.c | 12 +----------- 9 files changed, 9 insertions(+), 101 deletions(-) (limited to 'sound') diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c index 56815c1..fcff583 100644 --- a/sound/soc/blackfin/bf5xx-ac97-pcm.c +++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c @@ -475,17 +475,7 @@ static struct platform_driver bf5xx_pcm_driver = { .remove = __devexit_p(bf5xx_soc_platform_remove), }; -static int __init snd_bf5xx_pcm_init(void) -{ - return platform_driver_register(&bf5xx_pcm_driver); -} -module_init(snd_bf5xx_pcm_init); - -static void __exit snd_bf5xx_pcm_exit(void) -{ - platform_driver_unregister(&bf5xx_pcm_driver); -} -module_exit(snd_bf5xx_pcm_exit); +module_platform_driver(bf5xx_pcm_driver); MODULE_AUTHOR("Cliff Cai"); MODULE_DESCRIPTION("ADI Blackfin AC97 PCM DMA module"); diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c index 6d21625..f4e9dc4 100644 --- a/sound/soc/blackfin/bf5xx-ac97.c +++ b/sound/soc/blackfin/bf5xx-ac97.c @@ -375,18 +375,7 @@ static struct platform_driver asoc_bfin_ac97_driver = { .remove = __devexit_p(asoc_bfin_ac97_remove), }; -static int __init bfin_ac97_init(void) -{ - return platform_driver_register(&asoc_bfin_ac97_driver); -} -module_init(bfin_ac97_init); - -static void __exit bfin_ac97_exit(void) -{ - platform_driver_unregister(&asoc_bfin_ac97_driver); -} -module_exit(bfin_ac97_exit); - +module_platform_driver(asoc_bfin_ac97_driver); MODULE_AUTHOR("Roy Huang"); MODULE_DESCRIPTION("AC97 driver for ADI Blackfin"); diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c index 7565e15..6ec3d41 100644 --- a/sound/soc/blackfin/bf5xx-i2s-pcm.c +++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c @@ -314,17 +314,7 @@ static struct platform_driver bfin_i2s_pcm_driver = { .remove = __devexit_p(bfin_i2s_soc_platform_remove), }; -static int __init snd_bfin_i2s_pcm_init(void) -{ - return platform_driver_register(&bfin_i2s_pcm_driver); -} -module_init(snd_bfin_i2s_pcm_init); - -static void __exit snd_bfin_i2s_pcm_exit(void) -{ - platform_driver_unregister(&bfin_i2s_pcm_driver); -} -module_exit(snd_bfin_i2s_pcm_exit); +module_platform_driver(bfin_i2s_pcm_driver); MODULE_AUTHOR("Cliff Cai"); MODULE_DESCRIPTION("ADI Blackfin I2S PCM DMA module"); diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c index b31662e..4dccf03 100644 --- a/sound/soc/blackfin/bf5xx-i2s.c +++ b/sound/soc/blackfin/bf5xx-i2s.c @@ -288,18 +288,7 @@ static struct platform_driver bfin_i2s_driver = { }, }; -static int __init bfin_i2s_init(void) -{ - return platform_driver_register(&bfin_i2s_driver); -} - -static void __exit bfin_i2s_exit(void) -{ - platform_driver_unregister(&bfin_i2s_driver); -} - -module_init(bfin_i2s_init); -module_exit(bfin_i2s_exit); +module_platform_driver(bfin_i2s_driver); /* Module information */ MODULE_AUTHOR("Cliff Cai"); diff --git a/sound/soc/blackfin/bf5xx-tdm-pcm.c b/sound/soc/blackfin/bf5xx-tdm-pcm.c index c95cc03..4406f9a 100644 --- a/sound/soc/blackfin/bf5xx-tdm-pcm.c +++ b/sound/soc/blackfin/bf5xx-tdm-pcm.c @@ -339,17 +339,7 @@ static struct platform_driver bfin_tdm_driver = { .remove = __devexit_p(bf5xx_soc_platform_remove), }; -static int __init snd_bfin_tdm_init(void) -{ - return platform_driver_register(&bfin_tdm_driver); -} -module_init(snd_bfin_tdm_init); - -static void __exit snd_bfin_tdm_exit(void) -{ - platform_driver_unregister(&bfin_tdm_driver); -} -module_exit(snd_bfin_tdm_exit); +module_platform_driver(bfin_tdm_driver); MODULE_AUTHOR("Barry Song"); MODULE_DESCRIPTION("ADI Blackfin TDM PCM DMA module"); diff --git a/sound/soc/blackfin/bf5xx-tdm.c b/sound/soc/blackfin/bf5xx-tdm.c index 7876b50..594f882 100644 --- a/sound/soc/blackfin/bf5xx-tdm.c +++ b/sound/soc/blackfin/bf5xx-tdm.c @@ -314,17 +314,7 @@ static struct platform_driver bfin_tdm_driver = { }, }; -static int __init bfin_tdm_init(void) -{ - return platform_driver_register(&bfin_tdm_driver); -} -module_init(bfin_tdm_init); - -static void __exit bfin_tdm_exit(void) -{ - platform_driver_unregister(&bfin_tdm_driver); -} -module_exit(bfin_tdm_exit); +module_platform_driver(bfin_tdm_driver); /* Module information */ MODULE_AUTHOR("Barry Song"); diff --git a/sound/soc/blackfin/bfin-eval-adau1373.c b/sound/soc/blackfin/bfin-eval-adau1373.c index 8df2a3b..85ed39a 100644 --- a/sound/soc/blackfin/bfin-eval-adau1373.c +++ b/sound/soc/blackfin/bfin-eval-adau1373.c @@ -184,17 +184,7 @@ static struct platform_driver bfin_eval_adau1373_driver = { .remove = __devexit_p(bfin_eval_adau1373_remove), }; -static int __init bfin_eval_adau1373_init(void) -{ - return platform_driver_register(&bfin_eval_adau1373_driver); -} -module_init(bfin_eval_adau1373_init); - -static void __exit bfin_eval_adau1373_exit(void) -{ - platform_driver_unregister(&bfin_eval_adau1373_driver); -} -module_exit(bfin_eval_adau1373_exit); +module_platform_driver(bfin_eval_adau1373_driver); MODULE_AUTHOR("Lars-Peter Clausen "); MODULE_DESCRIPTION("ALSA SoC bfin adau1373 driver"); diff --git a/sound/soc/blackfin/bfin-eval-adau1701.c b/sound/soc/blackfin/bfin-eval-adau1701.c index e5550ac..1a88fe9 100644 --- a/sound/soc/blackfin/bfin-eval-adau1701.c +++ b/sound/soc/blackfin/bfin-eval-adau1701.c @@ -121,17 +121,7 @@ static struct platform_driver bfin_eval_adau1701_driver = { .remove = __devexit_p(bfin_eval_adau1701_remove), }; -static int __init bfin_eval_adau1701_init(void) -{ - return platform_driver_register(&bfin_eval_adau1701_driver); -} -module_init(bfin_eval_adau1701_init); - -static void __exit bfin_eval_adau1701_exit(void) -{ - platform_driver_unregister(&bfin_eval_adau1701_driver); -} -module_exit(bfin_eval_adau1701_exit); +module_platform_driver(bfin_eval_adau1701_driver); MODULE_AUTHOR("Lars-Peter Clausen "); MODULE_DESCRIPTION("ALSA SoC bfin ADAU1701 driver"); diff --git a/sound/soc/blackfin/bfin-eval-adav80x.c b/sound/soc/blackfin/bfin-eval-adav80x.c index 897cfa6..0bc995f 100644 --- a/sound/soc/blackfin/bfin-eval-adav80x.c +++ b/sound/soc/blackfin/bfin-eval-adav80x.c @@ -157,17 +157,7 @@ static struct platform_driver bfin_eval_adav80x_driver = { .id_table = bfin_eval_adav80x_ids, }; -static int __init bfin_eval_adav80x_init(void) -{ - return platform_driver_register(&bfin_eval_adav80x_driver); -} -module_init(bfin_eval_adav80x_init); - -static void __exit bfin_eval_adav80x_exit(void) -{ - platform_driver_unregister(&bfin_eval_adav80x_driver); -} -module_exit(bfin_eval_adav80x_exit); +module_platform_driver(bfin_eval_adav80x_driver); MODULE_AUTHOR("Lars-Peter Clausen "); MODULE_DESCRIPTION("ALSA SoC bfin adav80x driver"); -- cgit v1.1 From 7a24b2ba59fda5e6d1367d5d3cb0d4d0f811713b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 24 Nov 2011 15:03:50 +0800 Subject: ASoC: Convert imx directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/imx/imx-pcm-dma-mx2.c | 12 +----------- sound/soc/imx/imx-pcm-fiq.c | 12 +----------- sound/soc/imx/imx-ssi.c | 13 +------------ 3 files changed, 3 insertions(+), 34 deletions(-) (limited to 'sound') diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c index 43fdc24f..1cf2fe8 100644 --- a/sound/soc/imx/imx-pcm-dma-mx2.c +++ b/sound/soc/imx/imx-pcm-dma-mx2.c @@ -326,16 +326,6 @@ static struct platform_driver imx_pcm_driver = { .remove = __devexit_p(imx_soc_platform_remove), }; -static int __init snd_imx_pcm_init(void) -{ - return platform_driver_register(&imx_pcm_driver); -} -module_init(snd_imx_pcm_init); - -static void __exit snd_imx_pcm_exit(void) -{ - platform_driver_unregister(&imx_pcm_driver); -} -module_exit(snd_imx_pcm_exit); +module_platform_driver(imx_pcm_driver); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:imx-pcm-audio"); diff --git a/sound/soc/imx/imx-pcm-fiq.c b/sound/soc/imx/imx-pcm-fiq.c index 8df0fae2..d7ea0b3 100644 --- a/sound/soc/imx/imx-pcm-fiq.c +++ b/sound/soc/imx/imx-pcm-fiq.c @@ -331,14 +331,4 @@ static struct platform_driver imx_pcm_driver = { .remove = __devexit_p(imx_soc_platform_remove), }; -static int __init snd_imx_pcm_init(void) -{ - return platform_driver_register(&imx_pcm_driver); -} -module_init(snd_imx_pcm_init); - -static void __exit snd_imx_pcm_exit(void) -{ - platform_driver_unregister(&imx_pcm_driver); -} -module_exit(snd_imx_pcm_exit); +module_platform_driver(imx_pcm_driver); diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index eed7041..01d1f74 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c @@ -757,18 +757,7 @@ static struct platform_driver imx_ssi_driver = { }, }; -static int __init imx_ssi_init(void) -{ - return platform_driver_register(&imx_ssi_driver); -} - -static void __exit imx_ssi_exit(void) -{ - platform_driver_unregister(&imx_ssi_driver); -} - -module_init(imx_ssi_init); -module_exit(imx_ssi_exit); +module_platform_driver(imx_ssi_driver); /* Module information */ MODULE_AUTHOR("Sascha Hauer, "); -- cgit v1.1 From c32986e66bd72c02f9ecef490769248c7fcb5145 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 24 Nov 2011 10:13:03 +0800 Subject: ASoC: Convert jz4740 directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/jz4740/jz4740-i2s.c | 12 +----------- sound/soc/jz4740/jz4740-pcm.c | 12 +----------- 2 files changed, 2 insertions(+), 22 deletions(-) (limited to 'sound') diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c index 91255c6..a5af7c4 100644 --- a/sound/soc/jz4740/jz4740-i2s.c +++ b/sound/soc/jz4740/jz4740-i2s.c @@ -519,17 +519,7 @@ static struct platform_driver jz4740_i2s_driver = { }, }; -static int __init jz4740_i2s_init(void) -{ - return platform_driver_register(&jz4740_i2s_driver); -} -module_init(jz4740_i2s_init); - -static void __exit jz4740_i2s_exit(void) -{ - platform_driver_unregister(&jz4740_i2s_driver); -} -module_exit(jz4740_i2s_exit); +module_platform_driver(jz4740_i2s_driver); MODULE_AUTHOR("Lars-Peter Clausen, "); MODULE_DESCRIPTION("Ingenic JZ4740 SoC I2S driver"); diff --git a/sound/soc/jz4740/jz4740-pcm.c b/sound/soc/jz4740/jz4740-pcm.c index d1989cd..50cda9e 100644 --- a/sound/soc/jz4740/jz4740-pcm.c +++ b/sound/soc/jz4740/jz4740-pcm.c @@ -356,17 +356,7 @@ static struct platform_driver jz4740_pcm_driver = { }, }; -static int __init jz4740_soc_platform_init(void) -{ - return platform_driver_register(&jz4740_pcm_driver); -} -module_init(jz4740_soc_platform_init); - -static void __exit jz4740_soc_platform_exit(void) -{ - return platform_driver_unregister(&jz4740_pcm_driver); -} -module_exit(jz4740_soc_platform_exit); +module_platform_driver(jz4740_pcm_driver); MODULE_AUTHOR("Lars-Peter Clausen "); MODULE_DESCRIPTION("Ingenic SoC JZ4740 PCM driver"); -- cgit v1.1 From d0efa6a279e53df0f695382a5a6958e8a9863bff Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 24 Nov 2011 10:45:32 +0800 Subject: ASoC: Convert nuc900 directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/nuc900/nuc900-ac97.c | 13 +------------ sound/soc/nuc900/nuc900-pcm.c | 12 +----------- 2 files changed, 2 insertions(+), 23 deletions(-) (limited to 'sound') diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c index 7544d24..f0c7904 100644 --- a/sound/soc/nuc900/nuc900-ac97.c +++ b/sound/soc/nuc900/nuc900-ac97.c @@ -405,18 +405,7 @@ static struct platform_driver nuc900_ac97_driver = { .remove = __devexit_p(nuc900_ac97_drvremove), }; -static int __init nuc900_ac97_init(void) -{ - return platform_driver_register(&nuc900_ac97_driver); -} - -static void __exit nuc900_ac97_exit(void) -{ - platform_driver_unregister(&nuc900_ac97_driver); -} - -module_init(nuc900_ac97_init); -module_exit(nuc900_ac97_exit); +module_platform_driver(nuc900_ac97_driver); MODULE_AUTHOR("Wan ZongShun "); MODULE_DESCRIPTION("NUC900 AC97 SoC driver!"); diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c index ae8d680..37585b4 100644 --- a/sound/soc/nuc900/nuc900-pcm.c +++ b/sound/soc/nuc900/nuc900-pcm.c @@ -358,17 +358,7 @@ static struct platform_driver nuc900_pcm_driver = { .remove = __devexit_p(nuc900_soc_platform_remove), }; -static int __init nuc900_pcm_init(void) -{ - return platform_driver_register(&nuc900_pcm_driver); -} -module_init(nuc900_pcm_init); - -static void __exit nuc900_pcm_exit(void) -{ - platform_driver_unregister(&nuc900_pcm_driver); -} -module_exit(nuc900_pcm_exit); +module_platform_driver(nuc900_pcm_driver); MODULE_AUTHOR("Wan ZongShun, "); MODULE_DESCRIPTION("nuc900 Audio DMA module"); -- cgit v1.1 From 41b1022509733bb3347b15d670f3c1609ddf928f Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 24 Nov 2011 11:43:09 +0800 Subject: ASoC: Convert kirkwood directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/kirkwood/kirkwood-dma.c | 12 +----------- sound/soc/kirkwood/kirkwood-i2s.c | 12 +----------- 2 files changed, 2 insertions(+), 22 deletions(-) (limited to 'sound') diff --git a/sound/soc/kirkwood/kirkwood-dma.c b/sound/soc/kirkwood/kirkwood-dma.c index cd33de1..2104382 100644 --- a/sound/soc/kirkwood/kirkwood-dma.c +++ b/sound/soc/kirkwood/kirkwood-dma.c @@ -388,17 +388,7 @@ static struct platform_driver kirkwood_pcm_driver = { .remove = __devexit_p(kirkwood_soc_platform_remove), }; -static int __init kirkwood_pcm_init(void) -{ - return platform_driver_register(&kirkwood_pcm_driver); -} -module_init(kirkwood_pcm_init); - -static void __exit kirkwood_pcm_exit(void) -{ - platform_driver_unregister(&kirkwood_pcm_driver); -} -module_exit(kirkwood_pcm_exit); +module_platform_driver(kirkwood_pcm_driver); MODULE_AUTHOR("Arnaud Patard "); MODULE_DESCRIPTION("Marvell Kirkwood Audio DMA module"); diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index 2b212dc..f6bb211 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c @@ -483,17 +483,7 @@ static struct platform_driver kirkwood_i2s_driver = { }, }; -static int __init kirkwood_i2s_init(void) -{ - return platform_driver_register(&kirkwood_i2s_driver); -} -module_init(kirkwood_i2s_init); - -static void __exit kirkwood_i2s_exit(void) -{ - platform_driver_unregister(&kirkwood_i2s_driver); -} -module_exit(kirkwood_i2s_exit); +module_platform_driver(kirkwood_i2s_driver); /* Module information */ MODULE_AUTHOR("Arnaud Patard, "); -- cgit v1.1 From 29515d62db425796d82e2e2d9209a44b9e324ff4 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 24 Nov 2011 11:51:56 +0800 Subject: ASoC: Convert mid-x86 directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Acked-by: Vinod Koul Signed-off-by: Mark Brown --- sound/soc/mid-x86/mfld_machine.c | 14 +------------- sound/soc/mid-x86/sst_platform.c | 14 +------------- 2 files changed, 2 insertions(+), 26 deletions(-) (limited to 'sound') diff --git a/sound/soc/mid-x86/mfld_machine.c b/sound/soc/mid-x86/mfld_machine.c index cca693a..e53f8e4 100644 --- a/sound/soc/mid-x86/mfld_machine.c +++ b/sound/soc/mid-x86/mfld_machine.c @@ -428,19 +428,7 @@ static struct platform_driver snd_mfld_mc_driver = { .remove = __devexit_p(snd_mfld_mc_remove), }; -static int __init snd_mfld_driver_init(void) -{ - pr_debug("snd_mfld_driver_init called\n"); - return platform_driver_register(&snd_mfld_mc_driver); -} -module_init(snd_mfld_driver_init); - -static void __exit snd_mfld_driver_exit(void) -{ - pr_debug("snd_mfld_driver_exit called\n"); - platform_driver_unregister(&snd_mfld_mc_driver); -} -module_exit(snd_mfld_driver_exit); +module_platform_driver(snd_mfld_mc_driver); MODULE_DESCRIPTION("ASoC Intel(R) MID Machine driver"); MODULE_AUTHOR("Vinod Koul "); diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c index 2305702..94f70b3 100644 --- a/sound/soc/mid-x86/sst_platform.c +++ b/sound/soc/mid-x86/sst_platform.c @@ -472,19 +472,7 @@ static struct platform_driver sst_platform_driver = { .remove = sst_platform_remove, }; -static int __init sst_soc_platform_init(void) -{ - pr_debug("sst_soc_platform_init called\n"); - return platform_driver_register(&sst_platform_driver); -} -module_init(sst_soc_platform_init); - -static void __exit sst_soc_platform_exit(void) -{ - platform_driver_unregister(&sst_platform_driver); - pr_debug("sst_soc_platform_exit success\n"); -} -module_exit(sst_soc_platform_exit); +module_platform_driver(sst_platform_driver); MODULE_DESCRIPTION("ASoC Intel(R) MID Platform driver"); MODULE_AUTHOR("Vinod Koul "); -- cgit v1.1 From 51451b8d607374297055c4e08034b39f4be22d33 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 24 Nov 2011 18:47:25 +0800 Subject: ALSA: Convert mips directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Signed-off-by: Takashi Iwai --- sound/mips/hal2.c | 13 +------------ sound/mips/sgio2audio.c | 13 +------------ 2 files changed, 2 insertions(+), 24 deletions(-) (limited to 'sound') diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c index 2e6c858..5f88d1f 100644 --- a/sound/mips/hal2.c +++ b/sound/mips/hal2.c @@ -935,15 +935,4 @@ static struct platform_driver hal2_driver = { } }; -static int __init alsa_card_hal2_init(void) -{ - return platform_driver_register(&hal2_driver); -} - -static void __exit alsa_card_hal2_exit(void) -{ - platform_driver_unregister(&hal2_driver); -} - -module_init(alsa_card_hal2_init); -module_exit(alsa_card_hal2_exit); +module_platform_driver(hal2_driver); diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c index 69425d4..ceaa593 100644 --- a/sound/mips/sgio2audio.c +++ b/sound/mips/sgio2audio.c @@ -976,15 +976,4 @@ static struct platform_driver sgio2audio_driver = { } }; -static int __init alsa_card_sgio2audio_init(void) -{ - return platform_driver_register(&sgio2audio_driver); -} - -static void __exit alsa_card_sgio2audio_exit(void) -{ - platform_driver_unregister(&sgio2audio_driver); -} - -module_init(alsa_card_sgio2audio_init) -module_exit(alsa_card_sgio2audio_exit) +module_platform_driver(sgio2audio_driver); -- cgit v1.1 From e00c3f555f1f404b38d44bcfe19db674a92c809a Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 23 Nov 2011 15:20:13 +0000 Subject: ASoC: Convert Samsung directory to module_platform_driver Saves some boilerplate code. Signed-off-by: Mark Brown Acked-by: Sangbeom Kim --- sound/soc/samsung/ac97.c | 12 +----------- sound/soc/samsung/dma.c | 12 +----------- sound/soc/samsung/i2s.c | 12 +----------- sound/soc/samsung/idma.c | 12 +----------- sound/soc/samsung/lowland.c | 12 +----------- sound/soc/samsung/pcm.c | 12 +----------- sound/soc/samsung/s3c2412-i2s.c | 12 +----------- sound/soc/samsung/s3c24xx-i2s.c | 12 +----------- sound/soc/samsung/s3c24xx_simtec_hermes.c | 16 ++-------------- sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c | 16 ++-------------- sound/soc/samsung/s3c24xx_uda134x.c | 14 +------------- sound/soc/samsung/smdk_wm8580pcm.c | 14 +------------- sound/soc/samsung/spdif.c | 12 +----------- sound/soc/samsung/speyside.c | 12 +----------- sound/soc/samsung/speyside_wm8962.c | 12 +----------- 15 files changed, 17 insertions(+), 175 deletions(-) (limited to 'sound') diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c index 09035af..7b9bf93 100644 --- a/sound/soc/samsung/ac97.c +++ b/sound/soc/samsung/ac97.c @@ -509,17 +509,7 @@ static struct platform_driver s3c_ac97_driver = { }, }; -static int __init s3c_ac97_init(void) -{ - return platform_driver_register(&s3c_ac97_driver); -} -module_init(s3c_ac97_init); - -static void __exit s3c_ac97_exit(void) -{ - platform_driver_unregister(&s3c_ac97_driver); -} -module_exit(s3c_ac97_exit); +module_platform_driver(s3c_ac97_driver); MODULE_AUTHOR("Jaswinder Singh, "); MODULE_DESCRIPTION("AC97 driver for the Samsung SoC"); diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c index a68b264..797c3d5 100644 --- a/sound/soc/samsung/dma.c +++ b/sound/soc/samsung/dma.c @@ -458,17 +458,7 @@ static struct platform_driver asoc_dma_driver = { .remove = __devexit_p(samsung_asoc_platform_remove), }; -static int __init samsung_asoc_init(void) -{ - return platform_driver_register(&asoc_dma_driver); -} -module_init(samsung_asoc_init); - -static void __exit samsung_asoc_exit(void) -{ - platform_driver_unregister(&asoc_dma_driver); -} -module_exit(samsung_asoc_exit); +module_platform_driver(asoc_dma_driver); MODULE_AUTHOR("Ben Dooks, "); MODULE_DESCRIPTION("Samsung ASoC DMA Driver"); diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 03ee8ce..fb80f28 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1144,17 +1144,7 @@ static struct platform_driver samsung_i2s_driver = { }, }; -static int __init samsung_i2s_init(void) -{ - return platform_driver_register(&samsung_i2s_driver); -} -module_init(samsung_i2s_init); - -static void __exit samsung_i2s_exit(void) -{ - platform_driver_unregister(&samsung_i2s_driver); -} -module_exit(samsung_i2s_exit); +module_platform_driver(samsung_i2s_driver); /* Module information */ MODULE_AUTHOR("Jaswinder Singh, "); diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c index c41178e..6ca3d8c 100644 --- a/sound/soc/samsung/idma.c +++ b/sound/soc/samsung/idma.c @@ -437,17 +437,7 @@ static struct platform_driver asoc_idma_driver = { .remove = __devexit_p(asoc_idma_platform_remove), }; -static int __init asoc_idma_init(void) -{ - return platform_driver_register(&asoc_idma_driver); -} -module_init(asoc_idma_init); - -static void __exit asoc_idma_exit(void) -{ - platform_driver_unregister(&asoc_idma_driver); -} -module_exit(asoc_idma_exit); +module_platform_driver(asoc_idma_driver); MODULE_AUTHOR("Jaswinder Singh, "); MODULE_DESCRIPTION("Samsung ASoC IDMA Driver"); diff --git a/sound/soc/samsung/lowland.c b/sound/soc/samsung/lowland.c index eff1b4b..4216a06 100644 --- a/sound/soc/samsung/lowland.c +++ b/sound/soc/samsung/lowland.c @@ -228,17 +228,7 @@ static struct platform_driver lowland_driver = { .remove = __devexit_p(lowland_remove), }; -static int __init lowland_audio_init(void) -{ - return platform_driver_register(&lowland_driver); -} -module_init(lowland_audio_init); - -static void __exit lowland_audio_exit(void) -{ - platform_driver_unregister(&lowland_driver); -} -module_exit(lowland_audio_exit); +module_platform_driver(lowland_driver); MODULE_DESCRIPTION("Lowland audio support"); MODULE_AUTHOR("Mark Brown "); diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c index 2df2762..beef63f 100644 --- a/sound/soc/samsung/pcm.c +++ b/sound/soc/samsung/pcm.c @@ -632,17 +632,7 @@ static struct platform_driver s3c_pcm_driver = { }, }; -static int __init s3c_pcm_init(void) -{ - return platform_driver_register(&s3c_pcm_driver); -} -module_init(s3c_pcm_init); - -static void __exit s3c_pcm_exit(void) -{ - platform_driver_unregister(&s3c_pcm_driver); -} -module_exit(s3c_pcm_exit); +module_platform_driver(s3c_pcm_driver); /* Module information */ MODULE_AUTHOR("Jaswinder Singh, "); diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c index 545773d..7218507 100644 --- a/sound/soc/samsung/s3c2412-i2s.c +++ b/sound/soc/samsung/s3c2412-i2s.c @@ -184,17 +184,7 @@ static struct platform_driver s3c2412_iis_driver = { }, }; -static int __init s3c2412_i2s_init(void) -{ - return platform_driver_register(&s3c2412_iis_driver); -} -module_init(s3c2412_i2s_init); - -static void __exit s3c2412_i2s_exit(void) -{ - platform_driver_unregister(&s3c2412_iis_driver); -} -module_exit(s3c2412_i2s_exit); +module_platform_driver(s3c2412_iis_driver); /* Module information */ MODULE_AUTHOR("Ben Dooks, "); diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c index 2a98bed..c4aa4d4 100644 --- a/sound/soc/samsung/s3c24xx-i2s.c +++ b/sound/soc/samsung/s3c24xx-i2s.c @@ -489,17 +489,7 @@ static struct platform_driver s3c24xx_iis_driver = { }, }; -static int __init s3c24xx_i2s_init(void) -{ - return platform_driver_register(&s3c24xx_iis_driver); -} -module_init(s3c24xx_i2s_init); - -static void __exit s3c24xx_i2s_exit(void) -{ - platform_driver_unregister(&s3c24xx_iis_driver); -} -module_exit(s3c24xx_i2s_exit); +module_platform_driver(s3c24xx_iis_driver); /* Module information */ MODULE_AUTHOR("Ben Dooks, "); diff --git a/sound/soc/samsung/s3c24xx_simtec_hermes.c b/sound/soc/samsung/s3c24xx_simtec_hermes.c index d125e79..5027981 100644 --- a/sound/soc/samsung/s3c24xx_simtec_hermes.c +++ b/sound/soc/samsung/s3c24xx_simtec_hermes.c @@ -114,21 +114,9 @@ static struct platform_driver simtec_audio_hermes_platdrv = { .remove = __devexit_p(simtec_audio_remove), }; -MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd"); - -static int __init simtec_hermes_modinit(void) -{ - return platform_driver_register(&simtec_audio_hermes_platdrv); -} - -static void __exit simtec_hermes_modexit(void) -{ - platform_driver_unregister(&simtec_audio_hermes_platdrv); -} - -module_init(simtec_hermes_modinit); -module_exit(simtec_hermes_modexit); +module_platform_driver(simtec_audio_hermes_platdrv); +MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd"); MODULE_AUTHOR("Ben Dooks "); MODULE_DESCRIPTION("ALSA SoC Simtec Audio support"); MODULE_LICENSE("GPL"); diff --git a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c index 5e4fd46..7324609 100644 --- a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c +++ b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c @@ -102,21 +102,9 @@ static struct platform_driver simtec_audio_tlv320aic23_platdrv = { .remove = __devexit_p(simtec_audio_remove), }; -MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23"); - -static int __init simtec_tlv320aic23_modinit(void) -{ - return platform_driver_register(&simtec_audio_tlv320aic23_platdrv); -} - -static void __exit simtec_tlv320aic23_modexit(void) -{ - platform_driver_unregister(&simtec_audio_tlv320aic23_platdrv); -} - -module_init(simtec_tlv320aic23_modinit); -module_exit(simtec_tlv320aic23_modexit); +module_platform_driver(simtec_audio_tlv320aic32_driver); +MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23"); MODULE_AUTHOR("Ben Dooks "); MODULE_DESCRIPTION("ALSA SoC Simtec Audio support"); MODULE_LICENSE("GPL"); diff --git a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c index 548c6ac..62b69fb 100644 --- a/sound/soc/samsung/s3c24xx_uda134x.c +++ b/sound/soc/samsung/s3c24xx_uda134x.c @@ -343,19 +343,7 @@ static struct platform_driver s3c24xx_uda134x_driver = { }, }; -static int __init s3c24xx_uda134x_init(void) -{ - return platform_driver_register(&s3c24xx_uda134x_driver); -} - -static void __exit s3c24xx_uda134x_exit(void) -{ - platform_driver_unregister(&s3c24xx_uda134x_driver); -} - - -module_init(s3c24xx_uda134x_init); -module_exit(s3c24xx_uda134x_exit); +module_platform_driver(s3c24xx_uda134x_driver); MODULE_AUTHOR("Zoltan Devai, Christian Pellegrin "); MODULE_DESCRIPTION("S3C24XX_UDA134X ALSA SoC audio driver"); diff --git a/sound/soc/samsung/smdk_wm8580pcm.c b/sound/soc/samsung/smdk_wm8580pcm.c index 0677473..49dfafb 100644 --- a/sound/soc/samsung/smdk_wm8580pcm.c +++ b/sound/soc/samsung/smdk_wm8580pcm.c @@ -188,19 +188,7 @@ static struct platform_driver snd_smdk_driver = { .remove = __devexit_p(snd_smdk_remove), }; -static int __init smdk_audio_init(void) -{ - return platform_driver_register(&snd_smdk_driver); -} - -module_init(smdk_audio_init); - -static void __exit smdk_audio_exit(void) -{ - platform_driver_unregister(&snd_smdk_driver); -} - -module_exit(smdk_audio_exit); +module_platform_driver(snd_smdk_driver); MODULE_AUTHOR("Sangbeom Kim, "); MODULE_DESCRIPTION("ALSA SoC SMDK WM8580 for PCM"); diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c index a1fee1a..a5a56a1 100644 --- a/sound/soc/samsung/spdif.c +++ b/sound/soc/samsung/spdif.c @@ -483,17 +483,7 @@ static struct platform_driver samsung_spdif_driver = { }, }; -static int __init spdif_init(void) -{ - return platform_driver_register(&samsung_spdif_driver); -} -module_init(spdif_init); - -static void __exit spdif_exit(void) -{ - platform_driver_unregister(&samsung_spdif_driver); -} -module_exit(spdif_exit); +module_platform_driver(samsung_spdif_driver); MODULE_AUTHOR("Seungwhan Youn, "); MODULE_DESCRIPTION("Samsung S/PDIF Controller Driver"); diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c index efa5187..11196b9 100644 --- a/sound/soc/samsung/speyside.c +++ b/sound/soc/samsung/speyside.c @@ -347,17 +347,7 @@ static struct platform_driver speyside_driver = { .remove = __devexit_p(speyside_remove), }; -static int __init speyside_audio_init(void) -{ - return platform_driver_register(&speyside_driver); -} -module_init(speyside_audio_init); - -static void __exit speyside_audio_exit(void) -{ - platform_driver_unregister(&speyside_driver); -} -module_exit(speyside_audio_exit); +module_platform_driver(speyside_driver); MODULE_DESCRIPTION("Speyside audio support"); MODULE_AUTHOR("Mark Brown "); diff --git a/sound/soc/samsung/speyside_wm8962.c b/sound/soc/samsung/speyside_wm8962.c index a681c8d..c09648e 100644 --- a/sound/soc/samsung/speyside_wm8962.c +++ b/sound/soc/samsung/speyside_wm8962.c @@ -249,17 +249,7 @@ static struct platform_driver speyside_wm8962_driver = { .remove = __devexit_p(speyside_wm8962_remove), }; -static int __init speyside_wm8962_audio_init(void) -{ - return platform_driver_register(&speyside_wm8962_driver); -} -module_init(speyside_wm8962_audio_init); - -static void __exit speyside_wm8962_audio_exit(void) -{ - platform_driver_unregister(&speyside_wm8962_driver); -} -module_exit(speyside_wm8962_audio_exit); +module_platform_driver(speyside_wm8962_driver); MODULE_DESCRIPTION("Speyside WM8962 audio support"); MODULE_AUTHOR("Mark Brown "); -- cgit v1.1 From 878042d19c760178ba08ed24025d08ba750e38c3 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 24 Nov 2011 17:31:12 +0000 Subject: ASoC: Staticise non-exported symbols in sta32x Signed-off-by: Mark Brown Acked-by: Johannes Stezenbach --- sound/soc/codecs/sta32x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index e2b1cde..edcbeef 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -265,7 +265,7 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol, return 0; } -int sta32x_sync_coef_shadow(struct snd_soc_codec *codec) +static int sta32x_sync_coef_shadow(struct snd_soc_codec *codec) { struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); unsigned int cfud; @@ -290,7 +290,7 @@ int sta32x_sync_coef_shadow(struct snd_soc_codec *codec) return 0; } -int sta32x_cache_sync(struct snd_soc_codec *codec) +static int sta32x_cache_sync(struct snd_soc_codec *codec) { unsigned int mute; int rc; -- cgit v1.1 From a81b82c09e70db853cb270ed9ac166b6c50d7b8c Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 24 Nov 2011 18:28:51 +0000 Subject: ASoC: Use devm_kzalloc() in wm5100 Signed-off-by: Mark Brown --- sound/soc/codecs/wm5100.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index 6c79d97..844d5d2 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -2607,7 +2607,8 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, unsigned int reg; int ret, i; - wm5100 = kzalloc(sizeof(struct wm5100_priv), GFP_KERNEL); + wm5100 = devm_kzalloc(&i2c->dev, sizeof(struct wm5100_priv), + GFP_KERNEL); if (wm5100 == NULL) return -ENOMEM; @@ -2616,7 +2617,7 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, ret = PTR_ERR(wm5100->regmap); dev_err(&i2c->dev, "Failed to allocate register map: %d\n", ret); - goto err_alloc; + goto err; } for (i = 0; i < ARRAY_SIZE(wm5100->fll); i++) @@ -2774,8 +2775,7 @@ err_core: wm5100->core_supplies); err_regmap: regmap_exit(wm5100->regmap); -err_alloc: - kfree(wm5100); +err: return ret; } @@ -2799,7 +2799,6 @@ static __devexit int wm5100_i2c_remove(struct i2c_client *client) regulator_bulk_free(ARRAY_SIZE(wm5100->core_supplies), wm5100->core_supplies); regmap_exit(wm5100->regmap); - kfree(wm5100); return 0; } -- cgit v1.1 From b31c9056e400ddf10ec9691c6fada2fba1709330 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 25 Nov 2011 10:05:45 +0800 Subject: ASoC: Convert atmel directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Acked-by: Nicolas Ferre Signed-off-by: Mark Brown --- sound/soc/atmel/atmel-pcm.c | 12 +----------- sound/soc/atmel/atmel_ssc_dai.c | 12 +----------- 2 files changed, 2 insertions(+), 22 deletions(-) (limited to 'sound') diff --git a/sound/soc/atmel/atmel-pcm.c b/sound/soc/atmel/atmel-pcm.c index f81d4c3..60de055 100644 --- a/sound/soc/atmel/atmel-pcm.c +++ b/sound/soc/atmel/atmel-pcm.c @@ -495,17 +495,7 @@ static struct platform_driver atmel_pcm_driver = { .remove = __devexit_p(atmel_soc_platform_remove), }; -static int __init snd_atmel_pcm_init(void) -{ - return platform_driver_register(&atmel_pcm_driver); -} -module_init(snd_atmel_pcm_init); - -static void __exit snd_atmel_pcm_exit(void) -{ - platform_driver_unregister(&atmel_pcm_driver); -} -module_exit(snd_atmel_pcm_exit); +module_platform_driver(atmel_pcm_driver); MODULE_AUTHOR("Sedji Gaouaou "); MODULE_DESCRIPTION("Atmel PCM module"); diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index a67fc9b..354341e 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c @@ -859,17 +859,7 @@ int atmel_ssc_set_audio(int ssc_id) } EXPORT_SYMBOL_GPL(atmel_ssc_set_audio); -static int __init snd_atmel_ssc_init(void) -{ - return platform_driver_register(&asoc_ssc_driver); -} -module_init(snd_atmel_ssc_init); - -static void __exit snd_atmel_ssc_exit(void) -{ - platform_driver_unregister(&asoc_ssc_driver); -} -module_exit(snd_atmel_ssc_exit); +module_platform_driver(asoc_ssc_driver); /* Module information */ MODULE_AUTHOR("Sedji Gaouaou, sedji.gaouaou@atmel.com, www.atmel.com"); -- cgit v1.1 From 8a124f9cc9bafc40f5650e63a84ba1ff98a36ea0 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 25 Nov 2011 10:06:59 +0800 Subject: ASoC: Convert au1x directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/au1x/db1000.c | 13 +------------ sound/soc/au1x/db1200.c | 13 +------------ sound/soc/au1x/dbdma2.c | 13 +------------ sound/soc/au1x/dma.c | 13 +------------ sound/soc/au1x/i2sc.c | 13 +------------ sound/soc/au1x/psc-i2s.c | 13 +------------ 6 files changed, 6 insertions(+), 72 deletions(-) (limited to 'sound') diff --git a/sound/soc/au1x/db1000.c b/sound/soc/au1x/db1000.c index 127477a..094a207 100644 --- a/sound/soc/au1x/db1000.c +++ b/sound/soc/au1x/db1000.c @@ -57,18 +57,7 @@ static struct platform_driver db1000_audio_driver = { .remove = __devexit_p(db1000_audio_remove), }; -static int __init db1000_audio_load(void) -{ - return platform_driver_register(&db1000_audio_driver); -} - -static void __exit db1000_audio_unload(void) -{ - platform_driver_unregister(&db1000_audio_driver); -} - -module_init(db1000_audio_load); -module_exit(db1000_audio_unload); +module_platform_driver(db1000_audio_driver); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("DB1000/DB1500/DB1100 ASoC audio"); diff --git a/sound/soc/au1x/db1200.c b/sound/soc/au1x/db1200.c index 289312c..8073333 100644 --- a/sound/soc/au1x/db1200.c +++ b/sound/soc/au1x/db1200.c @@ -133,18 +133,7 @@ static struct platform_driver db1200_audio_driver = { .remove = __devexit_p(db1200_audio_remove), }; -static int __init db1200_audio_load(void) -{ - return platform_driver_register(&db1200_audio_driver); -} - -static void __exit db1200_audio_unload(void) -{ - platform_driver_unregister(&db1200_audio_driver); -} - -module_init(db1200_audio_load); -module_exit(db1200_audio_unload); +module_platform_driver(db1200_audio_driver); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("DB1200 ASoC audio support"); diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c index d7d04e2..09699de 100644 --- a/sound/soc/au1x/dbdma2.c +++ b/sound/soc/au1x/dbdma2.c @@ -384,18 +384,7 @@ static struct platform_driver au1xpsc_pcm_driver = { .remove = __devexit_p(au1xpsc_pcm_drvremove), }; -static int __init au1xpsc_audio_dbdma_load(void) -{ - return platform_driver_register(&au1xpsc_pcm_driver); -} - -static void __exit au1xpsc_audio_dbdma_unload(void) -{ - platform_driver_unregister(&au1xpsc_pcm_driver); -} - -module_init(au1xpsc_audio_dbdma_load); -module_exit(au1xpsc_audio_dbdma_unload); +module_platform_driver(au1xpsc_pcm_driver); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Au12x0/Au1550 PSC Audio DMA driver"); diff --git a/sound/soc/au1x/dma.c b/sound/soc/au1x/dma.c index 177f713..dc4dae4 100644 --- a/sound/soc/au1x/dma.c +++ b/sound/soc/au1x/dma.c @@ -359,18 +359,7 @@ static struct platform_driver alchemy_pcmdma_driver = { .remove = __devexit_p(alchemy_pcm_drvremove), }; -static int __init alchemy_pcmdma_load(void) -{ - return platform_driver_register(&alchemy_pcmdma_driver); -} - -static void __exit alchemy_pcmdma_unload(void) -{ - platform_driver_unregister(&alchemy_pcmdma_driver); -} - -module_init(alchemy_pcmdma_load); -module_exit(alchemy_pcmdma_unload); +module_platform_driver(alchemy_pcmdma_driver); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Au1000/Au1500/Au1100 Audio DMA driver"); diff --git a/sound/soc/au1x/i2sc.c b/sound/soc/au1x/i2sc.c index 6bcf48f..cb53ad8 100644 --- a/sound/soc/au1x/i2sc.c +++ b/sound/soc/au1x/i2sc.c @@ -331,18 +331,7 @@ static struct platform_driver au1xi2s_driver = { .remove = __devexit_p(au1xi2s_drvremove), }; -static int __init au1xi2s_load(void) -{ - return platform_driver_register(&au1xi2s_driver); -} - -static void __exit au1xi2s_unload(void) -{ - platform_driver_unregister(&au1xi2s_driver); -} - -module_init(au1xi2s_load); -module_exit(au1xi2s_unload); +module_platform_driver(au1xi2s_driver); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Au1000/1500/1100 I2S ASoC driver"); diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c index f7714d5..5c1dc8a 100644 --- a/sound/soc/au1x/psc-i2s.c +++ b/sound/soc/au1x/psc-i2s.c @@ -435,18 +435,7 @@ static struct platform_driver au1xpsc_i2s_driver = { .remove = __devexit_p(au1xpsc_i2s_drvremove), }; -static int __init au1xpsc_i2s_load(void) -{ - return platform_driver_register(&au1xpsc_i2s_driver); -} - -static void __exit au1xpsc_i2s_unload(void) -{ - platform_driver_unregister(&au1xpsc_i2s_driver); -} - -module_init(au1xpsc_i2s_load); -module_exit(au1xpsc_i2s_unload); +module_platform_driver(au1xpsc_i2s_driver); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Au12x0/Au1550 PSC I2S ALSA ASoC audio driver"); -- cgit v1.1 From 2f702a19154ddbd294825c0588593e1eef10b1e2 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 25 Nov 2011 10:13:37 +0800 Subject: ASoC: Convert pxa directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Acked-by: Marek Vasut Acked-by: Robert Jarzmik Signed-off-by: Mark Brown --- sound/soc/pxa/hx4700.c | 13 +------------ sound/soc/pxa/mioa701_wm9713.c | 13 +------------ sound/soc/pxa/palm27x.c | 13 +------------ sound/soc/pxa/pxa-ssp.c | 12 +----------- sound/soc/pxa/pxa2xx-ac97.c | 12 +----------- sound/soc/pxa/pxa2xx-pcm.c | 12 +----------- 6 files changed, 6 insertions(+), 69 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/hx4700.c b/sound/soc/pxa/hx4700.c index 65c1248..e32afaf 100644 --- a/sound/soc/pxa/hx4700.c +++ b/sound/soc/pxa/hx4700.c @@ -236,18 +236,7 @@ static struct platform_driver hx4700_audio_driver = { .remove = __devexit_p(hx4700_audio_remove), }; -static int __init hx4700_modinit(void) -{ - return platform_driver_register(&hx4700_audio_driver); -} -module_init(hx4700_modinit); - -static void __exit hx4700_modexit(void) -{ - platform_driver_unregister(&hx4700_audio_driver); -} - -module_exit(hx4700_modexit); +module_platform_driver(hx4700_audio_driver); MODULE_AUTHOR("Philipp Zabel"); MODULE_DESCRIPTION("ALSA SoC iPAQ hx4700"); diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c index 0b8d1ee..0e73a7f 100644 --- a/sound/soc/pxa/mioa701_wm9713.c +++ b/sound/soc/pxa/mioa701_wm9713.c @@ -227,18 +227,7 @@ static struct platform_driver mioa701_wm9713_driver = { }, }; -static int __init mioa701_asoc_init(void) -{ - return platform_driver_register(&mioa701_wm9713_driver); -} - -static void __exit mioa701_asoc_exit(void) -{ - platform_driver_unregister(&mioa701_wm9713_driver); -} - -module_init(mioa701_asoc_init); -module_exit(mioa701_asoc_exit); +module_platform_driver(mioa701_wm9713_driver); /* Module information */ MODULE_AUTHOR("Robert Jarzmik (rjarzmik@free.fr)"); diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c index 7edc1fb..f313eca 100644 --- a/sound/soc/pxa/palm27x.c +++ b/sound/soc/pxa/palm27x.c @@ -201,18 +201,7 @@ static struct platform_driver palm27x_wm9712_driver = { }, }; -static int __init palm27x_asoc_init(void) -{ - return platform_driver_register(&palm27x_wm9712_driver); -} - -static void __exit palm27x_asoc_exit(void) -{ - platform_driver_unregister(&palm27x_wm9712_driver); -} - -module_init(palm27x_asoc_init); -module_exit(palm27x_asoc_exit); +module_platform_driver(palm27x_wm9712_driver); /* Module information */ MODULE_AUTHOR("Marek Vasut "); diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index 9c9a51e..a57cfbc 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c @@ -825,17 +825,7 @@ static struct platform_driver asoc_ssp_driver = { .remove = __devexit_p(asoc_ssp_remove), }; -static int __init pxa_ssp_init(void) -{ - return platform_driver_register(&asoc_ssp_driver); -} -module_init(pxa_ssp_init); - -static void __exit pxa_ssp_exit(void) -{ - platform_driver_unregister(&asoc_ssp_driver); -} -module_exit(pxa_ssp_exit); +module_platform_driver(asoc_ssp_driver); /* Module information */ MODULE_AUTHOR("Mark Brown "); diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index 3fec2f3..837ff34 100644 --- a/sound/soc/pxa/pxa2xx-ac97.c +++ b/sound/soc/pxa/pxa2xx-ac97.c @@ -263,17 +263,7 @@ static struct platform_driver pxa2xx_ac97_driver = { }, }; -static int __init pxa_ac97_init(void) -{ - return platform_driver_register(&pxa2xx_ac97_driver); -} -module_init(pxa_ac97_init); - -static void __exit pxa_ac97_exit(void) -{ - platform_driver_unregister(&pxa2xx_ac97_driver); -} -module_exit(pxa_ac97_exit); +module_platform_driver(pxa2xx_ac97_driver); MODULE_AUTHOR("Nicolas Pitre"); MODULE_DESCRIPTION("AC97 driver for the Intel PXA2xx chip"); diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index 600676f..fdd6bed 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c @@ -141,17 +141,7 @@ static struct platform_driver pxa_pcm_driver = { .remove = __devexit_p(pxa2xx_soc_platform_remove), }; -static int __init snd_pxa_pcm_init(void) -{ - return platform_driver_register(&pxa_pcm_driver); -} -module_init(snd_pxa_pcm_init); - -static void __exit snd_pxa_pcm_exit(void) -{ - platform_driver_unregister(&pxa_pcm_driver); -} -module_exit(snd_pxa_pcm_exit); +module_platform_driver(pxa_pcm_driver); MODULE_AUTHOR("Nicolas Pitre"); MODULE_DESCRIPTION("Intel PXA2xx PCM DMA module"); -- cgit v1.1 From cb5e87387cfa8172faca36682e2df069b006efdf Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 25 Nov 2011 10:15:07 +0800 Subject: ASoC: Convert sh directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/sh/dma-sh7760.c | 12 +----------- sound/soc/sh/fsi-ak4642.c | 13 +------------ sound/soc/sh/fsi-hdmi.c | 13 +------------ sound/soc/sh/fsi.c | 13 +------------ sound/soc/sh/hac.c | 12 +----------- sound/soc/sh/siu_dai.c | 13 +------------ sound/soc/sh/ssi.c | 12 +----------- 7 files changed, 7 insertions(+), 81 deletions(-) (limited to 'sound') diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c index db74005..7da2018 100644 --- a/sound/soc/sh/dma-sh7760.c +++ b/sound/soc/sh/dma-sh7760.c @@ -369,17 +369,7 @@ static struct platform_driver sh7760_pcm_driver = { .remove = __devexit_p(sh7760_soc_platform_remove), }; -static int __init snd_sh7760_pcm_init(void) -{ - return platform_driver_register(&sh7760_pcm_driver); -} -module_init(snd_sh7760_pcm_init); - -static void __exit snd_sh7760_pcm_exit(void) -{ - platform_driver_unregister(&sh7760_pcm_driver); -} -module_exit(snd_sh7760_pcm_exit); +module_platform_driver(sh7760_pcm_driver); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SH7760 Audio DMA (DMABRG) driver"); diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c index 11d2d7f..eb52778 100644 --- a/sound/soc/sh/fsi-ak4642.c +++ b/sound/soc/sh/fsi-ak4642.c @@ -100,18 +100,7 @@ static struct platform_driver fsi_ak4642 = { .remove = fsi_ak4642_remove, }; -static int __init fsi_ak4642_init(void) -{ - return platform_driver_register(&fsi_ak4642); -} - -static void __exit fsi_ak4642_exit(void) -{ - platform_driver_unregister(&fsi_ak4642); -} - -module_init(fsi_ak4642_init); -module_exit(fsi_ak4642_exit); +module_platform_driver(fsi_ak4642); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card"); diff --git a/sound/soc/sh/fsi-hdmi.c b/sound/soc/sh/fsi-hdmi.c index 3ebebe7..621aea1 100644 --- a/sound/soc/sh/fsi-hdmi.c +++ b/sound/soc/sh/fsi-hdmi.c @@ -110,18 +110,7 @@ static struct platform_driver fsi_hdmi = { .id_table = fsi_id_table, }; -static int __init fsi_hdmi_init(void) -{ - return platform_driver_register(&fsi_hdmi); -} - -static void __exit fsi_hdmi_exit(void) -{ - platform_driver_unregister(&fsi_hdmi); -} - -module_init(fsi_hdmi_init); -module_exit(fsi_hdmi_exit); +module_platform_driver(fsi_hdmi); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Generic SH4 FSI-HDMI sound card"); diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index aa30330..a27c306 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -1468,18 +1468,7 @@ static struct platform_driver fsi_driver = { .id_table = fsi_id_table, }; -static int __init fsi_mobile_init(void) -{ - return platform_driver_register(&fsi_driver); -} - -static void __exit fsi_mobile_exit(void) -{ - platform_driver_unregister(&fsi_driver); -} - -module_init(fsi_mobile_init); -module_exit(fsi_mobile_exit); +module_platform_driver(fsi_driver); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SuperH onchip FSI audio driver"); diff --git a/sound/soc/sh/hac.c b/sound/soc/sh/hac.c index a1f307b..3474d7b 100644 --- a/sound/soc/sh/hac.c +++ b/sound/soc/sh/hac.c @@ -332,17 +332,7 @@ static struct platform_driver hac_pcm_driver = { .remove = __devexit_p(hac_soc_platform_remove), }; -static int __init sh4_hac_pcm_init(void) -{ - return platform_driver_register(&hac_pcm_driver); -} -module_init(sh4_hac_pcm_init); - -static void __exit sh4_hac_pcm_exit(void) -{ - platform_driver_unregister(&hac_pcm_driver); -} -module_exit(sh4_hac_pcm_exit); +module_platform_driver(hac_pcm_driver); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SuperH onchip HAC (AC97) audio driver"); diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c index 93dea49..11c6085 100644 --- a/sound/soc/sh/siu_dai.c +++ b/sound/soc/sh/siu_dai.c @@ -852,18 +852,7 @@ static struct platform_driver siu_driver = { .remove = __devexit_p(siu_remove), }; -static int __init siu_init(void) -{ - return platform_driver_register(&siu_driver); -} - -static void __exit siu_exit(void) -{ - platform_driver_unregister(&siu_driver); -} - -module_init(siu_init) -module_exit(siu_exit) +module_platform_driver(siu_driver); MODULE_AUTHOR("Carlos Munoz "); MODULE_DESCRIPTION("ALSA SoC SH7722 SIU driver"); diff --git a/sound/soc/sh/ssi.c b/sound/soc/sh/ssi.c index 1fda16a..ff82b56 100644 --- a/sound/soc/sh/ssi.c +++ b/sound/soc/sh/ssi.c @@ -401,17 +401,7 @@ static struct platform_driver sh4_ssi_driver = { .remove = __devexit_p(sh4_soc_dai_remove), }; -static int __init snd_sh4_ssi_init(void) -{ - return platform_driver_register(&sh4_ssi_driver); -} -module_init(snd_sh4_ssi_init); - -static void __exit snd_sh4_ssi_exit(void) -{ - platform_driver_unregister(&sh4_ssi_driver); -} -module_exit(snd_sh4_ssi_exit); +module_platform_driver(sh4_ssi_driver); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SuperH onchip SSI (I2S) audio driver"); -- cgit v1.1 From 33d316cd8b39fda7106332e5554f5959dc04b4dc Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 25 Nov 2011 10:16:10 +0800 Subject: ASoC: Convert txx9 directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/txx9/txx9aclc-ac97.c | 13 +------------ sound/soc/txx9/txx9aclc.c | 12 +----------- 2 files changed, 2 insertions(+), 23 deletions(-) (limited to 'sound') diff --git a/sound/soc/txx9/txx9aclc-ac97.c b/sound/soc/txx9/txx9aclc-ac97.c index a4e3f55..28db4ca 100644 --- a/sound/soc/txx9/txx9aclc-ac97.c +++ b/sound/soc/txx9/txx9aclc-ac97.c @@ -223,18 +223,7 @@ static struct platform_driver txx9aclc_ac97_driver = { }, }; -static int __init txx9aclc_ac97_init(void) -{ - return platform_driver_register(&txx9aclc_ac97_driver); -} - -static void __exit txx9aclc_ac97_exit(void) -{ - platform_driver_unregister(&txx9aclc_ac97_driver); -} - -module_init(txx9aclc_ac97_init); -module_exit(txx9aclc_ac97_exit); +module_platform_driver(txx9aclc_ac97_driver); MODULE_AUTHOR("Atsushi Nemoto "); MODULE_DESCRIPTION("TXx9 ACLC AC97 driver"); diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c index 3de99af..93931de 100644 --- a/sound/soc/txx9/txx9aclc.c +++ b/sound/soc/txx9/txx9aclc.c @@ -438,17 +438,7 @@ static struct platform_driver txx9aclc_pcm_driver = { .remove = __devexit_p(txx9aclc_soc_platform_remove), }; -static int __init snd_txx9aclc_pcm_init(void) -{ - return platform_driver_register(&txx9aclc_pcm_driver); -} -module_init(snd_txx9aclc_pcm_init); - -static void __exit snd_txx9aclc_pcm_exit(void) -{ - platform_driver_unregister(&txx9aclc_pcm_driver); -} -module_exit(snd_txx9aclc_pcm_exit); +module_platform_driver(txx9aclc_pcm_driver); MODULE_AUTHOR("Atsushi Nemoto "); MODULE_DESCRIPTION("TXx9 ACLC Audio DMA driver"); -- cgit v1.1 From f9b8a51493d69841bab3c5e85f335b6af0c8e5c2 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 25 Nov 2011 10:09:27 +0800 Subject: ASoC: Convert davinci directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/davinci/davinci-i2s.c | 12 +----------- sound/soc/davinci/davinci-mcasp.c | 12 +----------- sound/soc/davinci/davinci-pcm.c | 12 +----------- sound/soc/davinci/davinci-vcif.c | 12 +----------- 4 files changed, 4 insertions(+), 44 deletions(-) (limited to 'sound') diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index f3d5ae1..ec18710 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c @@ -774,17 +774,7 @@ static struct platform_driver davinci_mcbsp_driver = { }, }; -static int __init davinci_i2s_init(void) -{ - return platform_driver_register(&davinci_mcbsp_driver); -} -module_init(davinci_i2s_init); - -static void __exit davinci_i2s_exit(void) -{ - platform_driver_unregister(&davinci_mcbsp_driver); -} -module_exit(davinci_i2s_exit); +module_platform_driver(davinci_mcbsp_driver); MODULE_AUTHOR("Vladimir Barinov"); MODULE_DESCRIPTION("TI DAVINCI I2S (McBSP) SoC Interface"); diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 03cea9d..2152ff5 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -991,17 +991,7 @@ static struct platform_driver davinci_mcasp_driver = { }, }; -static int __init davinci_mcasp_init(void) -{ - return platform_driver_register(&davinci_mcasp_driver); -} -module_init(davinci_mcasp_init); - -static void __exit davinci_mcasp_exit(void) -{ - platform_driver_unregister(&davinci_mcasp_driver); -} -module_exit(davinci_mcasp_exit); +module_platform_driver(davinci_mcasp_driver); MODULE_AUTHOR("Steve Chen"); MODULE_DESCRIPTION("TI DAVINCI McASP SoC Interface"); diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index d5fe08c..65bff3d 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c @@ -886,17 +886,7 @@ static struct platform_driver davinci_pcm_driver = { .remove = __devexit_p(davinci_soc_platform_remove), }; -static int __init snd_davinci_pcm_init(void) -{ - return platform_driver_register(&davinci_pcm_driver); -} -module_init(snd_davinci_pcm_init); - -static void __exit snd_davinci_pcm_exit(void) -{ - platform_driver_unregister(&davinci_pcm_driver); -} -module_exit(snd_davinci_pcm_exit); +module_platform_driver(davinci_pcm_driver); MODULE_AUTHOR("Vladimir Barinov"); MODULE_DESCRIPTION("TI DAVINCI PCM DMA module"); diff --git a/sound/soc/davinci/davinci-vcif.c b/sound/soc/davinci/davinci-vcif.c index dae96b8..70ce10c 100644 --- a/sound/soc/davinci/davinci-vcif.c +++ b/sound/soc/davinci/davinci-vcif.c @@ -265,17 +265,7 @@ static struct platform_driver davinci_vcif_driver = { }, }; -static int __init davinci_vcif_init(void) -{ - return platform_driver_probe(&davinci_vcif_driver, davinci_vcif_probe); -} -module_init(davinci_vcif_init); - -static void __exit davinci_vcif_exit(void) -{ - platform_driver_unregister(&davinci_vcif_driver); -} -module_exit(davinci_vcif_exit); +module_platform_driver(davinci_vcif_driver); MODULE_AUTHOR("Miguel Aguilar"); MODULE_DESCRIPTION("Texas Instruments DaVinci ASoC Voice Codec Interface"); -- cgit v1.1 From beda5bf575a93823289fbeb868b42e75e9f08d96 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 25 Nov 2011 10:12:16 +0800 Subject: ASoC: Convert omap directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Acked-by: Jarkko Nikula Acked-by: Peter Ujfalusi Signed-off-by: Mark Brown --- sound/soc/omap/omap-hdmi.c | 12 +----------- sound/soc/omap/omap-mcbsp.c | 12 +----------- sound/soc/omap/omap-mcpdm.c | 12 +----------- sound/soc/omap/omap-pcm.c | 12 +----------- sound/soc/omap/omap4-hdmi-card.c | 12 +----------- 5 files changed, 5 insertions(+), 55 deletions(-) (limited to 'sound') diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index 9bb1cf8..38e0def 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c @@ -139,17 +139,7 @@ static struct platform_driver hdmi_dai_driver = { .remove = __devexit_p(omap_hdmi_remove), }; -static int __init hdmi_dai_init(void) -{ - return platform_driver_register(&hdmi_dai_driver); -} -module_init(hdmi_dai_init); - -static void __exit hdmi_dai_exit(void) -{ - platform_driver_unregister(&hdmi_dai_driver); -} -module_exit(hdmi_dai_exit); +module_platform_driver(hdmi_dai_driver); MODULE_AUTHOR("Jorge Candelaria "); MODULE_AUTHOR("Ricardo Neri "); diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index d91e6ef..bd11d25 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c @@ -785,17 +785,7 @@ static struct platform_driver asoc_mcbsp_driver = { .remove = __devexit_p(asoc_mcbsp_remove), }; -static int __init snd_omap_mcbsp_init(void) -{ - return platform_driver_register(&asoc_mcbsp_driver); -} -module_init(snd_omap_mcbsp_init); - -static void __exit snd_omap_mcbsp_exit(void) -{ - platform_driver_unregister(&asoc_mcbsp_driver); -} -module_exit(snd_omap_mcbsp_exit); +module_platform_driver(asoc_mcbsp_driver); MODULE_AUTHOR("Jarkko Nikula "); MODULE_DESCRIPTION("OMAP I2S SoC Interface"); diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index cc8ceff..b50ac60 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c @@ -520,17 +520,7 @@ static struct platform_driver asoc_mcpdm_driver = { .remove = __devexit_p(asoc_mcpdm_remove), }; -static int __init snd_omap_mcpdm_init(void) -{ - return platform_driver_register(&asoc_mcpdm_driver); -} -module_init(snd_omap_mcpdm_init); - -static void __exit snd_omap_mcpdm_exit(void) -{ - platform_driver_unregister(&asoc_mcpdm_driver); -} -module_exit(snd_omap_mcpdm_exit); +module_platform_driver(asoc_mcpdm_driver); MODULE_AUTHOR("Misael Lopez Cruz "); MODULE_DESCRIPTION("OMAP PDM SoC Interface"); diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index 6ede7dc..52a0f63 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c @@ -433,17 +433,7 @@ static struct platform_driver omap_pcm_driver = { .remove = __devexit_p(omap_pcm_remove), }; -static int __init snd_omap_pcm_init(void) -{ - return platform_driver_register(&omap_pcm_driver); -} -module_init(snd_omap_pcm_init); - -static void __exit snd_omap_pcm_exit(void) -{ - platform_driver_unregister(&omap_pcm_driver); -} -module_exit(snd_omap_pcm_exit); +module_platform_driver(omap_pcm_driver); MODULE_AUTHOR("Jarkko Nikula "); MODULE_DESCRIPTION("OMAP PCM DMA module"); diff --git a/sound/soc/omap/omap4-hdmi-card.c b/sound/soc/omap/omap4-hdmi-card.c index 8671261..52d471c 100644 --- a/sound/soc/omap/omap4-hdmi-card.c +++ b/sound/soc/omap/omap4-hdmi-card.c @@ -112,17 +112,7 @@ static struct platform_driver omap4_hdmi_driver = { .remove = __devexit_p(omap4_hdmi_remove), }; -static int __init omap4_hdmi_init(void) -{ - return platform_driver_register(&omap4_hdmi_driver); -} -module_init(omap4_hdmi_init); - -static void __exit omap4_hdmi_exit(void) -{ - platform_driver_unregister(&omap4_hdmi_driver); -} -module_exit(omap4_hdmi_exit); +module_platform_driver(omap4_hdmi_driver); MODULE_AUTHOR("Ricardo Neri "); MODULE_DESCRIPTION("OMAP4 HDMI machine ASoC driver"); -- cgit v1.1 From 01b65bfb4f8cd45b0d44547c961ef59a0bcf74be Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 24 Nov 2011 14:31:46 +0100 Subject: ALSA: hda - Supports more audio streams So far, the driver supports up to 10 streams. This is a restriction in hda_intel.c and hda_codec.c: in the former, the fixed array size limits the amount, and in the latter, the fixed device-number assignment table (in get_empty_pcm_device()) limits the possibility. This patch reduces the restriction by - using linked list for managing PCM instances in hda_intel.c, and - assigning non-fixed device numbers for the extra devices Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_codec.c | 6 ++++++ sound/pci/hda/hda_codec.h | 3 --- sound/pci/hda/hda_intel.c | 48 +++++++++++++++++++++++------------------------ 3 files changed, 30 insertions(+), 27 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 4562e9d..4463f9a 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3850,6 +3850,12 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type) if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits)) return audio_idx[type][i]; + /* non-fixed slots starting from 10 */ + for (i = 10; i < 32; i++) { + if (!test_and_set_bit(i, bus->pcm_dev_bits)) + return i; + } + snd_printk(KERN_WARNING "Too many %s devices\n", snd_hda_pcm_type_name[type]); return -EAGAIN; diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 5644711..17cee4e 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h @@ -547,9 +547,6 @@ enum { /* max. codec address */ #define HDA_MAX_CODEC_ADDRESS 0x0f -/* max number of PCM devics per card */ -#define HDA_MAX_PCMS 10 - /* * generic arrays */ diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 096507d..ddd7f3b 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -407,6 +407,14 @@ struct azx_rb { u32 res[AZX_MAX_CODECS]; /* last read value */ }; +struct azx_pcm { + struct azx *chip; + struct snd_pcm *pcm; + struct hda_codec *codec; + struct hda_pcm_stream *hinfo[2]; + struct list_head list; +}; + struct azx { struct snd_card *card; struct pci_dev *pci; @@ -434,7 +442,7 @@ struct azx { struct azx_dev *azx_dev; /* PCM */ - struct snd_pcm *pcm[HDA_MAX_PCMS]; + struct list_head pcm_list; /* azx_pcm list */ /* HD codec */ unsigned short codec_mask; @@ -1486,10 +1494,9 @@ static void azx_bus_reset(struct hda_bus *bus) azx_init_chip(chip, 1); #ifdef CONFIG_PM if (chip->initialized) { - int i; - - for (i = 0; i < HDA_MAX_PCMS; i++) - snd_pcm_suspend_all(chip->pcm[i]); + struct azx_pcm *p; + list_for_each_entry(p, &chip->pcm_list, list) + snd_pcm_suspend_all(p->pcm); snd_hda_suspend(chip->bus); snd_hda_resume(chip->bus); } @@ -1667,12 +1674,6 @@ static struct snd_pcm_hardware azx_pcm_hw = { .fifo_size = 0, }; -struct azx_pcm { - struct azx *chip; - struct hda_codec *codec; - struct hda_pcm_stream *hinfo[2]; -}; - static int azx_pcm_open(struct snd_pcm_substream *substream) { struct azx_pcm *apcm = snd_pcm_substream_chip(substream); @@ -2197,7 +2198,7 @@ static void azx_pcm_free(struct snd_pcm *pcm) { struct azx_pcm *apcm = pcm->private_data; if (apcm) { - apcm->chip->pcm[pcm->device] = NULL; + list_del(&apcm->list); kfree(apcm); } } @@ -2215,14 +2216,11 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, unsigned int size; int s, err; - if (pcm_dev >= HDA_MAX_PCMS) { - snd_printk(KERN_ERR SFX "Invalid PCM device number %d\n", - pcm_dev); - return -EINVAL; - } - if (chip->pcm[pcm_dev]) { - snd_printk(KERN_ERR SFX "PCM %d already exists\n", pcm_dev); - return -EBUSY; + list_for_each_entry(apcm, &chip->pcm_list, list) { + if (apcm->pcm->device == pcm_dev) { + snd_printk(KERN_ERR SFX "PCM %d already exists\n", pcm_dev); + return -EBUSY; + } } err = snd_pcm_new(chip->card, cpcm->name, pcm_dev, cpcm->stream[SNDRV_PCM_STREAM_PLAYBACK].substreams, @@ -2235,12 +2233,13 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec, if (apcm == NULL) return -ENOMEM; apcm->chip = chip; + apcm->pcm = pcm; apcm->codec = codec; pcm->private_data = apcm; pcm->private_free = azx_pcm_free; if (cpcm->pcm_type == HDA_PCM_TYPE_MODEM) pcm->dev_class = SNDRV_PCM_CLASS_MODEM; - chip->pcm[pcm_dev] = pcm; + list_add_tail(&apcm->list, &chip->pcm_list); cpcm->pcm = pcm; for (s = 0; s < 2; s++) { apcm->hinfo[s] = &cpcm->stream[s]; @@ -2370,12 +2369,12 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state) { struct snd_card *card = pci_get_drvdata(pci); struct azx *chip = card->private_data; - int i; + struct azx_pcm *p; snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); azx_clear_irq_pending(chip); - for (i = 0; i < HDA_MAX_PCMS; i++) - snd_pcm_suspend_all(chip->pcm[i]); + list_for_each_entry(p, &chip->pcm_list, list) + snd_pcm_suspend_all(p->pcm); if (chip->initialized) snd_hda_suspend(chip->bus); azx_stop_chip(chip); @@ -2672,6 +2671,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, check_msi(chip); chip->dev_index = dev; INIT_WORK(&chip->irq_pending_work, azx_irq_pending_work); + INIT_LIST_HEAD(&chip->pcm_list); chip->position_fix[0] = chip->position_fix[1] = check_position_fix(chip, position_fix[dev]); -- cgit v1.1 From a4567cb389301262f7ff392074eb3b0864498737 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 24 Nov 2011 14:44:19 +0100 Subject: ALSA: hda - Increase the max number of coverters/pins in patch_hdmi.c The new hardware tends to have more and more. As a temporary fix, just increase the number for now. For a long-term solution, we should assign the cvts/pins dynamically. Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_hdmi.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index c505fd5..6e0756f 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -48,8 +48,8 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); * * The HDA correspondence of pipes/ports are converter/pin nodes. */ -#define MAX_HDMI_CVTS 4 -#define MAX_HDMI_PINS 4 +#define MAX_HDMI_CVTS 8 +#define MAX_HDMI_PINS 8 struct hdmi_spec_per_cvt { hda_nid_t cvt_nid; @@ -1126,12 +1126,12 @@ static int hdmi_parse_codec(struct hda_codec *codec) /* */ -static char *generic_hdmi_pcm_names[MAX_HDMI_PINS] = { - "HDMI 0", - "HDMI 1", - "HDMI 2", - "HDMI 3", -}; +static char *get_hdmi_pcm_name(int idx) +{ + static char names[MAX_HDMI_PINS][8]; + sprintf(&names[idx][0], "HDMI %d", idx); + return &names[idx][0]; +} /* * HDMI callbacks @@ -1209,7 +1209,7 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec) struct hda_pcm_stream *pstr; info = &spec->pcm_rec[pin_idx]; - info->name = generic_hdmi_pcm_names[pin_idx]; + info->name = get_hdmi_pcm_name(pin_idx); info->pcm_type = HDA_PCM_TYPE_HDMI; pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; @@ -1364,7 +1364,7 @@ static int simple_playback_build_pcms(struct hda_codec *codec) chans = get_wcaps(codec, spec->cvts[i].cvt_nid); chans = get_wcaps_channels(chans); - info->name = generic_hdmi_pcm_names[i]; + info->name = get_hdmi_pcm_name(i); info->pcm_type = HDA_PCM_TYPE_HDMI; pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; snd_BUG_ON(!spec->pcm_playback); -- cgit v1.1 From 679acec1f240b433dc3879714655b6c6452385ea Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 27 Nov 2011 12:11:46 +0000 Subject: ASoC: Remove driver versioning from ak4642 It's never been updated so it can't be that useful and it makes the driver needlessly chatty. Signed-off-by: Mark Brown --- sound/soc/codecs/ak4642.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index c887ddf..30ce3d6 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -32,8 +32,6 @@ #include #include -#define AK4642_VERSION "0.0.1" - #define PW_MGMT1 0x00 #define PW_MGMT2 0x01 #define SG_SL1 0x02 @@ -473,8 +471,6 @@ static int ak4642_probe(struct snd_soc_codec *codec) struct ak4642_priv *ak4642 = snd_soc_codec_get_drvdata(codec); int ret; - dev_info(codec->dev, "AK4642 Audio Codec %s", AK4642_VERSION); - ret = snd_soc_codec_set_cache_io(codec, 8, 8, ak4642->control_type); if (ret < 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); -- cgit v1.1 From 997c2ea916edb516f23d6e1848cd1f4a10e62740 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 27 Nov 2011 12:14:37 +0000 Subject: ASoC: Remove unneeded platform_device.h inclusions from CODECs They've not been needed for a long time if they were ever required. Signed-off-by: Mark Brown --- sound/soc/codecs/ak4535.c | 1 - sound/soc/codecs/ak4641.c | 1 - sound/soc/codecs/ak4642.c | 1 - sound/soc/codecs/alc5623.c | 1 - sound/soc/codecs/cs4270.c | 1 - sound/soc/codecs/cs42l51.c | 1 - sound/soc/codecs/da7210.c | 1 - sound/soc/codecs/max98088.c | 1 - sound/soc/codecs/max98095.c | 1 - sound/soc/codecs/rt5631.c | 1 - sound/soc/codecs/sgtl5000.c | 1 - sound/soc/codecs/ssm2602.c | 1 - sound/soc/codecs/sta32x.c | 1 - sound/soc/codecs/tlv320aic23.c | 1 - sound/soc/codecs/tlv320aic32x4.c | 1 - sound/soc/codecs/tlv320aic3x.c | 1 - sound/soc/codecs/tlv320dac33.c | 1 - sound/soc/codecs/wm2000.c | 1 - sound/soc/codecs/wm5100.c | 1 - sound/soc/codecs/wm8510.c | 1 - sound/soc/codecs/wm8523.c | 1 - sound/soc/codecs/wm8580.c | 1 - sound/soc/codecs/wm8711.c | 1 - sound/soc/codecs/wm8731.c | 1 - sound/soc/codecs/wm8737.c | 1 - sound/soc/codecs/wm8741.c | 1 - sound/soc/codecs/wm8750.c | 1 - sound/soc/codecs/wm8753.c | 1 - sound/soc/codecs/wm8770.c | 1 - sound/soc/codecs/wm8776.c | 1 - sound/soc/codecs/wm8900.c | 1 - sound/soc/codecs/wm8903.c | 1 - sound/soc/codecs/wm8904.c | 1 - sound/soc/codecs/wm8940.c | 1 - sound/soc/codecs/wm8955.c | 1 - sound/soc/codecs/wm8960.c | 1 - sound/soc/codecs/wm8961.c | 1 - sound/soc/codecs/wm8962.c | 1 - sound/soc/codecs/wm8971.c | 1 - sound/soc/codecs/wm8974.c | 1 - sound/soc/codecs/wm8978.c | 1 - sound/soc/codecs/wm8988.c | 1 - sound/soc/codecs/wm8990.c | 1 - sound/soc/codecs/wm8991.c | 1 - sound/soc/codecs/wm9081.c | 1 - sound/soc/codecs/wm_hubs.c | 1 - 46 files changed, 46 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c index f6c4734..e1f5310 100644 --- a/sound/soc/codecs/ak4535.c +++ b/sound/soc/codecs/ak4535.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c index 3657c76..f53f314 100644 --- a/sound/soc/codecs/ak4641.c +++ b/sound/soc/codecs/ak4641.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 30ce3d6..9b4ee6c 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c index 88647d3..6a5c001 100644 --- a/sound/soc/codecs/alc5623.c +++ b/sound/soc/codecs/alc5623.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index 5396b91..dc77ff7 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c @@ -22,7 +22,6 @@ */ #include -#include #include #include #include diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 2f268f2..528510b 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c @@ -22,7 +22,6 @@ */ #include -#include #include #include #include diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index 8ef820f..e4ca61c 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 48a52a1..9b6036e 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c index cc712d5..01f4ad7 100644 --- a/sound/soc/codecs/max98095.c +++ b/sound/soc/codecs/max98095.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index dac4d05..9fd50bd 100644 --- a/sound/soc/codecs/rt5631.c +++ b/sound/soc/codecs/rt5631.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 1a6564b..ff0a107 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index 620411c..0d43e4b 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index edcbeef..b3d1c78 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index 9782631..cba798e 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index d2e38af..f553375 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 7d665ea..21625dd 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index abcb97e..6b0f0e2 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index a3b9cbb..01b1abe 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index 844d5d2..8be5dae 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index 26571b2..3a65571 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c index d0ae82d..0c89f8e 100644 --- a/sound/soc/codecs/wm8523.c +++ b/sound/soc/codecs/wm8523.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 0aa3e4d..764b2bf 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c index a6f1e39..760080e 100644 --- a/sound/soc/codecs/wm8711.c +++ b/sound/soc/codecs/wm8711.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 28972d8..c18dee0 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c index b7d6615..c13e4f7 100644 --- a/sound/soc/codecs/wm8737.c +++ b/sound/soc/codecs/wm8737.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c index e51f4f0..bf471dc 100644 --- a/sound/soc/codecs/wm8741.c +++ b/sound/soc/codecs/wm8741.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index dfb41ad..b312fccb 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index fb013b1..dc31538 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index 87957e8..391c385 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index 359319c..af542a2 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index a430930..6ac80cf 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 812dce9..5957a8b 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index f0b0c7a..babca49 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index 0dd1e0c..9f1cce8 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index dbf2a83..ca38722 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 06dca88..ed2773f6 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 783a3d1..c058701 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 555311d..018257c 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index 98bfbdd..b01df56 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index 16569c7..e41f999 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c index 517bb22..649a2e3 100644 --- a/sound/soc/codecs/wm8978.c +++ b/sound/soc/codecs/wm8978.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index 9d83bed5..608c672 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index 61c620e..58d7f0b 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c index ac957ec..35c5389 100644 --- a/sound/soc/codecs/wm8991.c +++ b/sound/soc/codecs/wm8991.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 48bf80b..ba12690 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index bde0e84..d1debfb 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include -- cgit v1.1 From 5fe803f56ad41cf008399f71ee48280f0cf9732b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 27 Nov 2011 15:56:55 +0000 Subject: ASoC: Convert wm1250-ev1 driver to use devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm1250-ev1.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm1250-ev1.c b/sound/soc/codecs/wm1250-ev1.c index cd0ec0f..aefb4f8 100644 --- a/sound/soc/codecs/wm1250-ev1.c +++ b/sound/soc/codecs/wm1250-ev1.c @@ -116,7 +116,7 @@ static int __devinit wm1250_ev1_pdata(struct i2c_client *i2c) if (!pdata) return 0; - wm1250 = kzalloc(sizeof(*wm1250), GFP_KERNEL); + wm1250 = devm_kzalloc(&i2c->dev, sizeof(*wm1250), GFP_KERNEL); if (!wm1250) { dev_err(&i2c->dev, "Unable to allocate private data\n"); ret = -ENOMEM; @@ -134,15 +134,13 @@ static int __devinit wm1250_ev1_pdata(struct i2c_client *i2c) ret = gpio_request_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios)); if (ret != 0) { dev_err(&i2c->dev, "Failed to get GPIOs: %d\n", ret); - goto err_alloc; + goto err; } dev_set_drvdata(&i2c->dev, wm1250); return ret; -err_alloc: - kfree(wm1250); err: return ret; } @@ -151,10 +149,8 @@ static void wm1250_ev1_free(struct i2c_client *i2c) { struct wm1250_priv *wm1250 = dev_get_drvdata(&i2c->dev); - if (wm1250) { + if (wm1250) gpio_free_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios)); - kfree(wm1250); - } } static int __devinit wm1250_ev1_probe(struct i2c_client *i2c, -- cgit v1.1 From 897f7847e6fec6f24efef4268993afcfc36dca23 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 27 Nov 2011 15:57:44 +0000 Subject: ASoC: Convert wm9081 driver to use devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm9081.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index ba12690..8a4b970 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c @@ -1361,7 +1361,8 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c, unsigned int reg; int ret; - wm9081 = kzalloc(sizeof(struct wm9081_priv), GFP_KERNEL); + wm9081 = devm_kzalloc(&i2c->dev, sizeof(struct wm9081_priv), + GFP_KERNEL); if (wm9081 == NULL) return -ENOMEM; @@ -1405,7 +1406,6 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c, err_regmap: regmap_exit(wm9081->regmap); err: - kfree(wm9081); return ret; } @@ -1416,7 +1416,6 @@ static __devexit int wm9081_i2c_remove(struct i2c_client *client) snd_soc_unregister_codec(&client->dev); regmap_exit(wm9081->regmap); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From a290986b2a184941da60921ada71bcb47a0d4af2 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 27 Nov 2011 15:59:23 +0000 Subject: ASoC: Convert wm8996 to use devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm8996.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 304a0e57..41cc9d2 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c @@ -3104,7 +3104,8 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c, int ret, i; unsigned int reg; - wm8996 = kzalloc(sizeof(struct wm8996_priv), GFP_KERNEL); + wm8996 = devm_kzalloc(&i2c->dev, sizeof(struct wm8996_priv), + GFP_KERNEL); if (wm8996 == NULL) return -ENOMEM; @@ -3216,7 +3217,6 @@ err_gpio: if (wm8996->pdata.ldo_ena > 0) gpio_free(wm8996->pdata.ldo_ena); err: - kfree(wm8996); return ret; } @@ -3234,7 +3234,6 @@ static __devexit int wm8996_i2c_remove(struct i2c_client *client) gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); gpio_free(wm8996->pdata.ldo_ena); } - kfree(wm8996); return 0; } -- cgit v1.1 From a09452eeb776d1444effec5fb862c35efb623704 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sun, 27 Nov 2011 16:36:04 +0800 Subject: ALSA: convert sound/* to use module_platform_driver() This patch converts the drivers in sound/* to use the module_platform_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin Signed-off-by: Takashi Iwai --- sound/arm/pxa2xx-ac97.c | 13 +------------ sound/drivers/ml403-ac97cr.c | 13 +------------ sound/sh/sh_dac_audio.c | 13 +------------ sound/sparc/cs4231.c | 13 +------------ sound/sparc/dbri.c | 14 +------------- 5 files changed, 5 insertions(+), 61 deletions(-) (limited to 'sound') diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 5d94118..3a39626 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c @@ -251,18 +251,7 @@ static struct platform_driver pxa2xx_ac97_driver = { }, }; -static int __init pxa2xx_ac97_init(void) -{ - return platform_driver_register(&pxa2xx_ac97_driver); -} - -static void __exit pxa2xx_ac97_exit(void) -{ - platform_driver_unregister(&pxa2xx_ac97_driver); -} - -module_init(pxa2xx_ac97_init); -module_exit(pxa2xx_ac97_exit); +module_platform_driver(pxa2xx_ac97_driver); MODULE_AUTHOR("Nicolas Pitre"); MODULE_DESCRIPTION("AC97 driver for the Intel PXA2xx chip"); diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c index 2ee82c5..07ede97 100644 --- a/sound/drivers/ml403-ac97cr.c +++ b/sound/drivers/ml403-ac97cr.c @@ -1341,15 +1341,4 @@ static struct platform_driver snd_ml403_ac97cr_driver = { }, }; -static int __init alsa_card_ml403_ac97cr_init(void) -{ - return platform_driver_register(&snd_ml403_ac97cr_driver); -} - -static void __exit alsa_card_ml403_ac97cr_exit(void) -{ - platform_driver_unregister(&snd_ml403_ac97cr_driver); -} - -module_init(alsa_card_ml403_ac97cr_init) -module_exit(alsa_card_ml403_ac97cr_exit) +module_platform_driver(snd_ml403_ac97cr_driver); diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c index 56bcb46a..b11f82b 100644 --- a/sound/sh/sh_dac_audio.c +++ b/sound/sh/sh_dac_audio.c @@ -441,15 +441,4 @@ static struct platform_driver driver = { }, }; -static int __init sh_dac_init(void) -{ - return platform_driver_register(&driver); -} - -static void __exit sh_dac_exit(void) -{ - platform_driver_unregister(&driver); -} - -module_init(sh_dac_init); -module_exit(sh_dac_exit); +module_platform_driver(driver); diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index 0e618f8..9aa90e0 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c @@ -2118,15 +2118,4 @@ static struct platform_driver cs4231_driver = { .remove = __devexit_p(cs4231_remove), }; -static int __init cs4231_init(void) -{ - return platform_driver_register(&cs4231_driver); -} - -static void __exit cs4231_exit(void) -{ - platform_driver_unregister(&cs4231_driver); -} - -module_init(cs4231_init); -module_exit(cs4231_exit); +module_platform_driver(cs4231_driver); diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index 4a4f1d7..6afe087 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c @@ -2697,16 +2697,4 @@ static struct platform_driver dbri_sbus_driver = { .remove = __devexit_p(dbri_remove), }; -/* Probe for the dbri chip and then attach the driver. */ -static int __init dbri_init(void) -{ - return platform_driver_register(&dbri_sbus_driver); -} - -static void __exit dbri_exit(void) -{ - platform_driver_unregister(&dbri_sbus_driver); -} - -module_init(dbri_init); -module_exit(dbri_exit); +module_platform_driver(dbri_sbus_driver); -- cgit v1.1 From b05d8dc15f346224306bda4b4ae39fc5ace74ee6 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 27 Nov 2011 19:38:34 +0000 Subject: ASoC: Fix CODEC enumeration for auto_nc_codec_pins We need to enumerate all the CODECs that are part of the card we're instantiating, not all the CODECs that are in the system as the system may have multiple cards. Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 2abaf6d..ec783f0 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1489,7 +1489,7 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) snd_soc_dapm_new_widgets(&card->dapm); if (card->fully_routed) - list_for_each_entry(codec, &codec_list, list) + list_for_each_entry(codec, &card->codec_dev_list, card_list) snd_soc_dapm_auto_nc_codec_pins(codec); ret = snd_card_register(card->snd_card); -- cgit v1.1 From a094b80bb603d602bef5d8c02faedab8d06ed484 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 27 Nov 2011 19:42:20 +0000 Subject: ASoC: Log automatic pin disconnection per CODEC rather than per card This makes the output a bit less confusing on multi-CODEC systems as the same pin may appear in multiple CODECs. Signed-off-by: Mark Brown --- sound/soc/soc-dapm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 1ecd1b4..da5c1ae 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -2996,7 +2996,7 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec) struct snd_soc_dapm_context *dapm = &codec->dapm; struct snd_soc_dapm_widget *w; - dev_dbg(card->dev, "Auto NC: DAPMs: card:%p codec:%p\n", + dev_dbg(codec->dev, "Auto NC: DAPMs: card:%p codec:%p\n", &card->dapm, &codec->dapm); list_for_each_entry(w, &card->widgets, list) { @@ -3006,10 +3006,10 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec) case snd_soc_dapm_input: case snd_soc_dapm_output: case snd_soc_dapm_micbias: - dev_dbg(card->dev, "Auto NC: Checking widget %s\n", + dev_dbg(codec->dev, "Auto NC: Checking widget %s\n", w->name); if (!snd_soc_dapm_widget_in_card_paths(card, w)) { - dev_dbg(card->dev, + dev_dbg(codec->dev, "... Not in map; disabling\n"); snd_soc_dapm_nc_pin(dapm, w->name); } -- cgit v1.1 From be086aa8ca7aac8292db9f1a6a17756fb1cfda81 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 27 Nov 2011 19:56:52 +0000 Subject: ASoC: Convert WM8962 to devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm8962.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 018257c..8810988 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -4150,7 +4150,8 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c, unsigned int reg; int ret, i; - wm8962 = kzalloc(sizeof(struct wm8962_priv), GFP_KERNEL); + wm8962 = devm_kzalloc(&i2c->dev, sizeof(struct wm8962_priv), + GFP_KERNEL); if (wm8962 == NULL) return -ENOMEM; @@ -4167,7 +4168,7 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c, wm8962->supplies); if (ret != 0) { dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); - goto err_alloc; + goto err; } ret = regulator_bulk_enable(ARRAY_SIZE(wm8962->supplies), @@ -4241,8 +4242,7 @@ err_enable: regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); err_get: regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); -err_alloc: - kfree(wm8962); +err: return ret; } @@ -4253,7 +4253,6 @@ static __devexit int wm8962_i2c_remove(struct i2c_client *client) snd_soc_unregister_codec(&client->dev); regmap_exit(wm8962->regmap); regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From 5bbcc3c0d0f063318ec83146d1958acf7154c66f Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 23 Nov 2011 22:52:08 +0000 Subject: ASoC: Convert CODEC drivers to module_platform_driver Factors out a bit of boilerplate. Signed-off-by: Mark Brown --- sound/soc/codecs/88pm860x-codec.c | 12 +----------- sound/soc/codecs/ac97.c | 12 +----------- sound/soc/codecs/ad1980.c | 12 +----------- sound/soc/codecs/ad73311.c | 12 +----------- sound/soc/codecs/ads117x.c | 12 +----------- sound/soc/codecs/cq93vc.c | 12 +----------- sound/soc/codecs/cx20442.c | 12 +----------- sound/soc/codecs/dfbmcs320.c | 12 +----------- sound/soc/codecs/dmic.c | 12 +----------- sound/soc/codecs/jz4740.c | 12 +----------- sound/soc/codecs/pcm3008.c | 12 +----------- sound/soc/codecs/sn95031.c | 14 +------------- sound/soc/codecs/spdif_transciever.c | 13 +------------ sound/soc/codecs/stac9766.c | 12 +----------- sound/soc/codecs/twl4030.c | 12 +----------- sound/soc/codecs/twl6040.c | 12 +----------- sound/soc/codecs/uda134x.c | 12 +----------- sound/soc/codecs/wl1273.c | 12 +----------- sound/soc/codecs/wm8350.c | 12 +----------- sound/soc/codecs/wm8400.c | 12 +----------- sound/soc/codecs/wm8727.c | 12 +----------- sound/soc/codecs/wm8782.c | 12 +----------- sound/soc/codecs/wm8994.c | 13 +------------ sound/soc/codecs/wm9705.c | 12 +----------- sound/soc/codecs/wm9712.c | 12 +----------- sound/soc/codecs/wm9713.c | 12 +----------- 26 files changed, 26 insertions(+), 290 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index ea305b8..2d39123 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c @@ -1481,17 +1481,7 @@ static struct platform_driver pm860x_codec_driver = { .remove = __devexit_p(pm860x_codec_remove), }; -static __init int pm860x_init(void) -{ - return platform_driver_register(&pm860x_codec_driver); -} -module_init(pm860x_init); - -static __exit void pm860x_exit(void) -{ - platform_driver_unregister(&pm860x_codec_driver); -} -module_exit(pm860x_exit); +module_platform_driver(pm860x_codec_driver); MODULE_DESCRIPTION("ASoC 88PM860x driver"); MODULE_AUTHOR("Haojian Zhuang "); diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c index 8f32167..221ec29f 100644 --- a/sound/soc/codecs/ac97.c +++ b/sound/soc/codecs/ac97.c @@ -148,17 +148,7 @@ static struct platform_driver ac97_codec_driver = { .remove = __devexit_p(ac97_remove), }; -static int __init ac97_init(void) -{ - return platform_driver_register(&ac97_codec_driver); -} -module_init(ac97_init); - -static void __exit ac97_exit(void) -{ - platform_driver_unregister(&ac97_codec_driver); -} -module_exit(ac97_exit); +module_platform_driver(ac97_codec_driver); MODULE_DESCRIPTION("Soc Generic AC97 driver"); MODULE_AUTHOR("Liam Girdwood"); diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c index e3931cc..9bba7f8 100644 --- a/sound/soc/codecs/ad1980.c +++ b/sound/soc/codecs/ad1980.c @@ -277,17 +277,7 @@ static struct platform_driver ad1980_codec_driver = { .remove = __devexit_p(ad1980_remove), }; -static int __init ad1980_init(void) -{ - return platform_driver_register(&ad1980_codec_driver); -} -module_init(ad1980_init); - -static void __exit ad1980_exit(void) -{ - platform_driver_unregister(&ad1980_codec_driver); -} -module_exit(ad1980_exit); +module_platform_driver(ad1980_codec_driver); MODULE_DESCRIPTION("ASoC ad1980 driver (Obsolete)"); MODULE_AUTHOR("Roy Huang, Cliff Cai"); diff --git a/sound/soc/codecs/ad73311.c b/sound/soc/codecs/ad73311.c index 8d793e9..ee7a68d 100644 --- a/sound/soc/codecs/ad73311.c +++ b/sound/soc/codecs/ad73311.c @@ -63,17 +63,7 @@ static struct platform_driver ad73311_codec_driver = { .remove = __devexit_p(ad73311_remove), }; -static int __init ad73311_init(void) -{ - return platform_driver_register(&ad73311_codec_driver); -} -module_init(ad73311_init); - -static void __exit ad73311_exit(void) -{ - platform_driver_unregister(&ad73311_codec_driver); -} -module_exit(ad73311_exit); +module_platform_driver(ad73311_codec_driver); MODULE_DESCRIPTION("ASoC ad73311 driver"); MODULE_AUTHOR("Cliff Cai "); diff --git a/sound/soc/codecs/ads117x.c b/sound/soc/codecs/ads117x.c index 9082e0f..8103b93 100644 --- a/sound/soc/codecs/ads117x.c +++ b/sound/soc/codecs/ads117x.c @@ -58,17 +58,7 @@ static struct platform_driver ads117x_codec_driver = { .remove = __devexit_p(ads117x_remove), }; -static int __init ads117x_init(void) -{ - return platform_driver_register(&ads117x_codec_driver); -} -module_init(ads117x_init); - -static void __exit ads117x_exit(void) -{ - platform_driver_unregister(&ads117x_codec_driver); -} -module_exit(ads117x_exit); +module_platform_driver(ads117x_codec_driver); MODULE_DESCRIPTION("ASoC ads117x driver"); MODULE_AUTHOR("Graeme Gregory"); diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c index cbb3028..4854b47 100644 --- a/sound/soc/codecs/cq93vc.c +++ b/sound/soc/codecs/cq93vc.c @@ -206,17 +206,7 @@ static struct platform_driver cq93vc_codec_driver = { .remove = __devexit_p(cq93vc_platform_remove), }; -static int __init cq93vc_init(void) -{ - return platform_driver_register(&cq93vc_codec_driver); -} -module_init(cq93vc_init); - -static void __exit cq93vc_exit(void) -{ - platform_driver_unregister(&cq93vc_codec_driver); -} -module_exit(cq93vc_exit); +module_platform_driver(cq93vc_codec_driver); MODULE_DESCRIPTION("Texas Instruments DaVinci ASoC CQ0093 Voice Codec Driver"); MODULE_AUTHOR("Miguel Aguilar"); diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index bc7067d..ae55e31 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c @@ -391,17 +391,7 @@ static struct platform_driver cx20442_platform_driver = { .remove = __exit_p(cx20442_platform_remove), }; -static int __init cx20442_init(void) -{ - return platform_driver_register(&cx20442_platform_driver); -} -module_init(cx20442_init); - -static void __exit cx20442_exit(void) -{ - platform_driver_unregister(&cx20442_platform_driver); -} -module_exit(cx20442_exit); +module_platform_driver(cx20442_platform_driver); MODULE_DESCRIPTION("ASoC CX20442-11 voice modem codec driver"); MODULE_AUTHOR("Janusz Krzysztofik"); diff --git a/sound/soc/codecs/dfbmcs320.c b/sound/soc/codecs/dfbmcs320.c index 704bbde..bfe46aa 100644 --- a/sound/soc/codecs/dfbmcs320.c +++ b/sound/soc/codecs/dfbmcs320.c @@ -55,17 +55,7 @@ static struct platform_driver dfmcs320_driver = { .remove = __devexit_p(dfbmcs320_remove), }; -static int __init dfbmcs320_init(void) -{ - return platform_driver_register(&dfmcs320_driver); -} -module_init(dfbmcs320_init); - -static void __exit dfbmcs320_exit(void) -{ - platform_driver_unregister(&dfmcs320_driver); -} -module_exit(dfbmcs320_exit); +module_platform_driver(dfmcs320_driver); MODULE_AUTHOR("Lars-Peter Clausen "); MODULE_DESCRIPTION("ASoC DFBM-CS320 bluethooth module driver"); diff --git a/sound/soc/codecs/dmic.c b/sound/soc/codecs/dmic.c index 6fae765..3e929f0 100644 --- a/sound/soc/codecs/dmic.c +++ b/sound/soc/codecs/dmic.c @@ -89,17 +89,7 @@ static struct platform_driver dmic_driver = { .remove = __devexit_p(dmic_dev_remove), }; -static int __init dmic_init(void) -{ - return platform_driver_register(&dmic_driver); -} -module_init(dmic_init); - -static void __exit dmic_exit(void) -{ - platform_driver_unregister(&dmic_driver); -} -module_exit(dmic_exit); +module_platform_driver(dmic_driver); MODULE_DESCRIPTION("Generic DMIC driver"); MODULE_AUTHOR("Liam Girdwood "); diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index 64a479c..4fca8bc 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c @@ -424,17 +424,7 @@ static struct platform_driver jz4740_codec_driver = { }, }; -static int __init jz4740_codec_init(void) -{ - return platform_driver_register(&jz4740_codec_driver); -} -module_init(jz4740_codec_init); - -static void __exit jz4740_codec_exit(void) -{ - platform_driver_unregister(&jz4740_codec_driver); -} -module_exit(jz4740_codec_exit); +module_platform_driver(jz4740_codec_driver); MODULE_DESCRIPTION("JZ4740 SoC internal codec driver"); MODULE_AUTHOR("Lars-Peter Clausen "); diff --git a/sound/soc/codecs/pcm3008.c b/sound/soc/codecs/pcm3008.c index f731651..b12d01f 100644 --- a/sound/soc/codecs/pcm3008.c +++ b/sound/soc/codecs/pcm3008.c @@ -172,17 +172,7 @@ static struct platform_driver pcm3008_codec_driver = { }, }; -static int __init pcm3008_modinit(void) -{ - return platform_driver_register(&pcm3008_codec_driver); -} -module_init(pcm3008_modinit); - -static void __exit pcm3008_exit(void) -{ - platform_driver_unregister(&pcm3008_codec_driver); -} -module_exit(pcm3008_exit); +module_platform_driver(pcm3008_codec_driver); MODULE_DESCRIPTION("Soc PCM3008 driver"); MODULE_AUTHOR("Hugo Villeneuve"); diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index 65f2ef9..f99baa0 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c @@ -920,19 +920,7 @@ static struct platform_driver sn95031_codec_driver = { .remove = __devexit_p(sn95031_device_remove), }; -static int __init sn95031_init(void) -{ - pr_debug("driver init called\n"); - return platform_driver_register(&sn95031_codec_driver); -} -module_init(sn95031_init); - -static void __exit sn95031_exit(void) -{ - pr_debug("driver exit called\n"); - platform_driver_unregister(&sn95031_codec_driver); -} -module_exit(sn95031_exit); +module_platform_driver(sn95031_codec_driver); MODULE_DESCRIPTION("ASoC TI SN95031 codec driver"); MODULE_AUTHOR("Vinod Koul "); diff --git a/sound/soc/codecs/spdif_transciever.c b/sound/soc/codecs/spdif_transciever.c index 6a1a7e7..112a49d 100644 --- a/sound/soc/codecs/spdif_transciever.c +++ b/sound/soc/codecs/spdif_transciever.c @@ -61,18 +61,7 @@ static struct platform_driver spdif_dit_driver = { }, }; -static int __init dit_modinit(void) -{ - return platform_driver_register(&spdif_dit_driver); -} - -static void __exit dit_exit(void) -{ - platform_driver_unregister(&spdif_dit_driver); -} - -module_init(dit_modinit); -module_exit(dit_exit); +module_platform_driver(spdif_dit_driver); MODULE_AUTHOR("Steve Chen "); MODULE_DESCRIPTION("SPDIF dummy codec driver"); diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c index e4783a4..5581953 100644 --- a/sound/soc/codecs/stac9766.c +++ b/sound/soc/codecs/stac9766.c @@ -408,17 +408,7 @@ static struct platform_driver stac9766_codec_driver = { .remove = __devexit_p(stac9766_remove), }; -static int __init stac9766_init(void) -{ - return platform_driver_register(&stac9766_codec_driver); -} -module_init(stac9766_init); - -static void __exit stac9766_exit(void) -{ - platform_driver_unregister(&stac9766_codec_driver); -} -module_exit(stac9766_exit); +module_platform_driver(stac9766_codec_driver); MODULE_DESCRIPTION("ASoC stac9766 driver"); MODULE_AUTHOR("Jon Smirl "); diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 2a3a528..61d8a90 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c @@ -2294,17 +2294,7 @@ static struct platform_driver twl4030_codec_driver = { }, }; -static int __init twl4030_modinit(void) -{ - return platform_driver_register(&twl4030_codec_driver); -} -module_init(twl4030_modinit); - -static void __exit twl4030_exit(void) -{ - platform_driver_unregister(&twl4030_codec_driver); -} -module_exit(twl4030_exit); +module_platform_driver(twl4030_codec_driver); MODULE_DESCRIPTION("ASoC TWL4030 codec driver"); MODULE_AUTHOR("Steve Sakoman"); diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 17930ed..a4a65dc 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c @@ -1620,17 +1620,7 @@ static struct platform_driver twl6040_codec_driver = { .remove = __devexit_p(twl6040_codec_remove), }; -static int __init twl6040_codec_init(void) -{ - return platform_driver_register(&twl6040_codec_driver); -} -module_init(twl6040_codec_init); - -static void __exit twl6040_codec_exit(void) -{ - platform_driver_unregister(&twl6040_codec_driver); -} -module_exit(twl6040_codec_exit); +module_platform_driver(twl6040_codec_driver); MODULE_DESCRIPTION("ASoC TWL6040 codec driver"); MODULE_AUTHOR("Misael Lopez Cruz"); diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index 486aef6..d0f9d90 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c @@ -625,17 +625,7 @@ static struct platform_driver uda134x_codec_driver = { .remove = __devexit_p(uda134x_codec_remove), }; -static int __init uda134x_codec_init(void) -{ - return platform_driver_register(&uda134x_codec_driver); -} -module_init(uda134x_codec_init); - -static void __exit uda134x_codec_exit(void) -{ - platform_driver_unregister(&uda134x_codec_driver); -} -module_exit(uda134x_codec_exit); +module_platform_driver(uda134x_codec_driver); MODULE_DESCRIPTION("UDA134X ALSA soc codec driver"); MODULE_AUTHOR("Zoltan Devai, Christian Pellegrin "); diff --git a/sound/soc/codecs/wl1273.c b/sound/soc/codecs/wl1273.c index 9531c35..44aacf9 100644 --- a/sound/soc/codecs/wl1273.c +++ b/sound/soc/codecs/wl1273.c @@ -510,17 +510,7 @@ static struct platform_driver wl1273_platform_driver = { .remove = __devexit_p(wl1273_platform_remove), }; -static int __init wl1273_init(void) -{ - return platform_driver_register(&wl1273_platform_driver); -} -module_init(wl1273_init); - -static void __exit wl1273_exit(void) -{ - platform_driver_unregister(&wl1273_platform_driver); -} -module_exit(wl1273_exit); +module_platform_driver(wl1273_platform_driver); MODULE_AUTHOR("Matti Aaltonen "); MODULE_DESCRIPTION("ASoC WL1273 codec driver"); diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 3b846c9..3f1ed5f 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c @@ -1711,17 +1711,7 @@ static struct platform_driver wm8350_codec_driver = { .remove = __devexit_p(wm8350_remove), }; -static __init int wm8350_init(void) -{ - return platform_driver_register(&wm8350_codec_driver); -} -module_init(wm8350_init); - -static __exit void wm8350_exit(void) -{ - platform_driver_unregister(&wm8350_codec_driver); -} -module_exit(wm8350_exit); +module_platform_driver(wm8350_codec_driver); MODULE_DESCRIPTION("ASoC WM8350 driver"); MODULE_AUTHOR("Liam Girdwood"); diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index 07d84a8..a1173eb 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c @@ -1477,17 +1477,7 @@ static struct platform_driver wm8400_codec_driver = { .remove = __devexit_p(wm8400_remove), }; -static __init int wm8400_init(void) -{ - return platform_driver_register(&wm8400_codec_driver); -} -module_init(wm8400_init); - -static __exit void wm8400_exit(void) -{ - platform_driver_unregister(&wm8400_codec_driver); -} -module_exit(wm8400_exit); +module_platform_driver(wm8400_codec_driver); MODULE_DESCRIPTION("ASoC WM8400 driver"); MODULE_AUTHOR("Mark Brown"); diff --git a/sound/soc/codecs/wm8727.c b/sound/soc/codecs/wm8727.c index 7488082..fad90a3 100644 --- a/sound/soc/codecs/wm8727.c +++ b/sound/soc/codecs/wm8727.c @@ -67,17 +67,7 @@ static struct platform_driver wm8727_codec_driver = { .remove = __devexit_p(wm8727_remove), }; -static int __init wm8727_init(void) -{ - return platform_driver_register(&wm8727_codec_driver); -} -module_init(wm8727_init); - -static void __exit wm8727_exit(void) -{ - platform_driver_unregister(&wm8727_codec_driver); -} -module_exit(wm8727_exit); +module_platform_driver(wm8727_codec_driver); MODULE_DESCRIPTION("ASoC wm8727 driver"); MODULE_AUTHOR("Neil Jones"); diff --git a/sound/soc/codecs/wm8782.c b/sound/soc/codecs/wm8782.c index f2ced71..3fdea98 100644 --- a/sound/soc/codecs/wm8782.c +++ b/sound/soc/codecs/wm8782.c @@ -63,17 +63,7 @@ static struct platform_driver wm8782_codec_driver = { .remove = __devexit_p(wm8782_remove), }; -static int __init wm8782_init(void) -{ - return platform_driver_register(&wm8782_codec_driver); -} -module_init(wm8782_init); - -static void __exit wm8782_exit(void) -{ - platform_driver_unregister(&wm8782_codec_driver); -} -module_exit(wm8782_exit); +module_platform_driver(wm8782_codec_driver); MODULE_DESCRIPTION("ASoC WM8782 driver"); MODULE_AUTHOR("Johannes Stezenbach "); diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 73db980..380e3f2 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3579,18 +3579,7 @@ static struct platform_driver wm8994_codec_driver = { .remove = __devexit_p(wm8994_remove), }; -static __init int wm8994_init(void) -{ - return platform_driver_register(&wm8994_codec_driver); -} -module_init(wm8994_init); - -static __exit void wm8994_exit(void) -{ - platform_driver_unregister(&wm8994_codec_driver); -} -module_exit(wm8994_exit); - +module_platform_driver(wm8994_codec_driver); MODULE_DESCRIPTION("ASoC WM8994 driver"); MODULE_AUTHOR("Mark Brown "); diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index edf6032..b720a43 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c @@ -406,17 +406,7 @@ static struct platform_driver wm9705_codec_driver = { .remove = __devexit_p(wm9705_remove), }; -static int __init wm9705_init(void) -{ - return platform_driver_register(&wm9705_codec_driver); -} -module_init(wm9705_init); - -static void __exit wm9705_exit(void) -{ - platform_driver_unregister(&wm9705_codec_driver); -} -module_exit(wm9705_exit); +module_platform_driver(wm9705_codec_driver); MODULE_DESCRIPTION("ASoC WM9705 driver"); MODULE_AUTHOR("Ian Molton"); diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index fd18127..4ce73f5 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -694,17 +694,7 @@ static struct platform_driver wm9712_codec_driver = { .remove = __devexit_p(wm9712_remove), }; -static int __init wm9712_init(void) -{ - return platform_driver_register(&wm9712_codec_driver); -} -module_init(wm9712_init); - -static void __exit wm9712_exit(void) -{ - platform_driver_unregister(&wm9712_codec_driver); -} -module_exit(wm9712_exit); +module_platform_driver(wm9712_codec_driver); MODULE_DESCRIPTION("ASoC WM9711/WM9712 driver"); MODULE_AUTHOR("Liam Girdwood"); diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index 09360b6..edb5981 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c @@ -1277,17 +1277,7 @@ static struct platform_driver wm9713_codec_driver = { .remove = __devexit_p(wm9713_remove), }; -static int __init wm9713_init(void) -{ - return platform_driver_register(&wm9713_codec_driver); -} -module_init(wm9713_init); - -static void __exit wm9713_exit(void) -{ - platform_driver_unregister(&wm9713_codec_driver); -} -module_exit(wm9713_exit); +module_platform_driver(wm9713_codec_driver); MODULE_DESCRIPTION("ASoC WM9713/WM9714 driver"); MODULE_AUTHOR("Liam Girdwood"); -- cgit v1.1 From 5032dc34294d1084b7367877dadb6edb2d45ad7c Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 27 Nov 2011 12:20:08 +0000 Subject: ASoC: Convert WM8903 MICBIAS to a supply widget Also rename it to MICBIAS to reflect the pin name and help any out of tree users notice the change. Signed-off-by: Mark Brown Acked-by: Stephen Warren --- sound/soc/codecs/wm8903.c | 4 ++-- sound/soc/tegra/tegra_wm8903.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 5957a8b..70a2268 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -838,7 +838,7 @@ SND_SOC_DAPM_OUTPUT("LON"), SND_SOC_DAPM_OUTPUT("ROP"), SND_SOC_DAPM_OUTPUT("RON"), -SND_SOC_DAPM_MICBIAS("Mic Bias", WM8903_MIC_BIAS_CONTROL_0, 0, 0), +SND_SOC_DAPM_SUPPLY("MICBIAS", WM8903_MIC_BIAS_CONTROL_0, 0, 0, NULL, 0), SND_SOC_DAPM_MUX("Left Input Mux", SND_SOC_NOPM, 0, 0, &linput_mux), SND_SOC_DAPM_MUX("Left Input Inverting Mux", SND_SOC_NOPM, 0, 0, @@ -947,7 +947,7 @@ SND_SOC_DAPM_SUPPLY("CLK_SYS", WM8903_CLOCK_RATES_2, 2, 0, NULL, 0), static const struct snd_soc_dapm_route wm8903_intercon[] = { { "CLK_DSP", NULL, "CLK_SYS" }, - { "Mic Bias", NULL, "CLK_SYS" }, + { "MICBIAS", NULL, "CLK_SYS" }, { "HPL_DCS", NULL, "CLK_SYS" }, { "HPR_DCS", NULL, "CLK_SYS" }, { "LINEOUTL_DCS", NULL, "CLK_SYS" }, diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index b260f54..2f5b107 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c @@ -201,8 +201,8 @@ static const struct snd_soc_dapm_route harmony_audio_map[] = { {"Int Spk", NULL, "RON"}, {"Int Spk", NULL, "LOP"}, {"Int Spk", NULL, "LON"}, - {"Mic Bias", NULL, "Mic Jack"}, - {"IN1L", NULL, "Mic Bias"}, + {"Mic Jack", NULL, "MICBIAS"}, + {"IN1L", NULL, "Mic Jack"}, }; static const struct snd_soc_dapm_route seaboard_audio_map[] = { @@ -212,8 +212,8 @@ static const struct snd_soc_dapm_route seaboard_audio_map[] = { {"Int Spk", NULL, "RON"}, {"Int Spk", NULL, "LOP"}, {"Int Spk", NULL, "LON"}, - {"Mic Bias", NULL, "Mic Jack"}, - {"IN1R", NULL, "Mic Bias"}, + {"Mic Jack", NULL, "MICBIAS"}, + {"IN1R", NULL, "Mic Jack"}, }; static const struct snd_soc_dapm_route kaen_audio_map[] = { @@ -223,8 +223,8 @@ static const struct snd_soc_dapm_route kaen_audio_map[] = { {"Int Spk", NULL, "RON"}, {"Int Spk", NULL, "LOP"}, {"Int Spk", NULL, "LON"}, - {"Mic Bias", NULL, "Mic Jack"}, - {"IN2R", NULL, "Mic Bias"}, + {"Mic Jack", NULL, "MICBIAS"}, + {"IN2R", NULL, "Mic Jack"}, }; static const struct snd_soc_dapm_route aebl_audio_map[] = { @@ -232,8 +232,8 @@ static const struct snd_soc_dapm_route aebl_audio_map[] = { {"Headphone Jack", NULL, "HPOUTL"}, {"Int Spk", NULL, "LINEOUTR"}, {"Int Spk", NULL, "LINEOUTL"}, - {"Mic Bias", NULL, "Mic Jack"}, - {"IN1R", NULL, "Mic Bias"}, + {"Mic Jack", NULL, "MICBIAS"}, + {"IN1R", NULL, "Mic Jack"}, }; static const struct snd_kcontrol_new tegra_wm8903_controls[] = { @@ -329,7 +329,7 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) wm8903_mic_detect(codec, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE, 0); - snd_soc_dapm_force_enable_pin(dapm, "Mic Bias"); + snd_soc_dapm_force_enable_pin(dapm, "MICBIAS"); return 0; } -- cgit v1.1 From fd26f9474676bb2232ba9dded148edc41fd02ef4 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Mon, 28 Nov 2011 15:45:40 +0200 Subject: ASoC: OMAP4: omap-dmic: Initial support for OMAP DMIC Add support for OMAP4 Digital Microphone interface. Signed-off-by: Peter Ujfalusi Signed-off-by: Mark Brown --- sound/soc/omap/Kconfig | 3 + sound/soc/omap/Makefile | 2 + sound/soc/omap/omap-dmic.c | 549 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/omap/omap-dmic.h | 69 ++++++ 4 files changed, 623 insertions(+) create mode 100644 sound/soc/omap/omap-dmic.c create mode 100644 sound/soc/omap/omap-dmic.h (limited to 'sound') diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig index fe83d0d..052254a 100644 --- a/sound/soc/omap/Kconfig +++ b/sound/soc/omap/Kconfig @@ -2,6 +2,9 @@ config SND_OMAP_SOC tristate "SoC Audio for the Texas Instruments OMAP chips" depends on ARCH_OMAP +config SND_OMAP_SOC_DMIC + tristate + config SND_OMAP_SOC_MCBSP tristate select OMAP_MCBSP diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile index 052fd75..1fd723f 100644 --- a/sound/soc/omap/Makefile +++ b/sound/soc/omap/Makefile @@ -1,10 +1,12 @@ # OMAP Platform Support snd-soc-omap-objs := omap-pcm.o +snd-soc-omap-dmic-objs := omap-dmic.o snd-soc-omap-mcbsp-objs := omap-mcbsp.o snd-soc-omap-mcpdm-objs := omap-mcpdm.o snd-soc-omap-hdmi-objs := omap-hdmi.o obj-$(CONFIG_SND_OMAP_SOC) += snd-soc-omap.o +obj-$(CONFIG_SND_OMAP_SOC_DMIC) += snd-soc-omap-dmic.o obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o obj-$(CONFIG_SND_OMAP_SOC_MCPDM) += snd-soc-omap-mcpdm.o obj-$(CONFIG_SND_OMAP_SOC_HDMI) += snd-soc-omap-hdmi.o diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c new file mode 100644 index 0000000..9c73c0c --- /dev/null +++ b/sound/soc/omap/omap-dmic.c @@ -0,0 +1,549 @@ +/* + * omap-dmic.c -- OMAP ASoC DMIC DAI driver + * + * Copyright (C) 2010 - 2011 Texas Instruments + * + * Author: David Lambert + * Misael Lopez Cruz + * Liam Girdwood + * Peter Ujfalusi + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "omap-pcm.h" +#include "omap-dmic.h" + +struct omap_dmic { + struct device *dev; + void __iomem *io_base; + struct clk *fclk; + int fclk_freq; + int out_freq; + int clk_div; + int sysclk; + int threshold; + u32 ch_enabled; + bool active; + struct mutex mutex; +}; + +/* + * Stream DMA parameters + */ +static struct omap_pcm_dma_data omap_dmic_dai_dma_params = { + .name = "DMIC capture", + .data_type = OMAP_DMA_DATA_TYPE_S32, + .sync_mode = OMAP_DMA_SYNC_PACKET, +}; + +static inline void omap_dmic_write(struct omap_dmic *dmic, u16 reg, u32 val) +{ + __raw_writel(val, dmic->io_base + reg); +} + +static inline int omap_dmic_read(struct omap_dmic *dmic, u16 reg) +{ + return __raw_readl(dmic->io_base + reg); +} + +static inline void omap_dmic_start(struct omap_dmic *dmic) +{ + u32 ctrl = omap_dmic_read(dmic, OMAP_DMIC_CTRL_REG); + + /* Configure DMA controller */ + omap_dmic_write(dmic, OMAP_DMIC_DMAENABLE_SET_REG, + OMAP_DMIC_DMA_ENABLE); + + omap_dmic_write(dmic, OMAP_DMIC_CTRL_REG, ctrl | dmic->ch_enabled); +} + +static inline void omap_dmic_stop(struct omap_dmic *dmic) +{ + u32 ctrl = omap_dmic_read(dmic, OMAP_DMIC_CTRL_REG); + omap_dmic_write(dmic, OMAP_DMIC_CTRL_REG, + ctrl & ~OMAP_DMIC_UP_ENABLE_MASK); + + /* Disable DMA request generation */ + omap_dmic_write(dmic, OMAP_DMIC_DMAENABLE_CLR_REG, + OMAP_DMIC_DMA_ENABLE); + +} + +static inline int dmic_is_enabled(struct omap_dmic *dmic) +{ + return omap_dmic_read(dmic, OMAP_DMIC_CTRL_REG) & + OMAP_DMIC_UP_ENABLE_MASK; +} + +static int omap_dmic_dai_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); + int ret = 0; + + mutex_lock(&dmic->mutex); + + if (!dai->active) { + pm_runtime_get_sync(dmic->dev); + snd_pcm_hw_constraint_msbits(substream->runtime, 0, 32, 24); + dmic->active = 1; + } else { + ret = -EBUSY; + } + + mutex_unlock(&dmic->mutex); + + return ret; +} + +static void omap_dmic_dai_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); + + mutex_lock(&dmic->mutex); + + if (!dai->active) { + pm_runtime_put_sync(dmic->dev); + dmic->active = 0; + } + + mutex_unlock(&dmic->mutex); +} + +static int omap_dmic_select_divider(struct omap_dmic *dmic, int sample_rate) +{ + int divider = -EINVAL; + + /* + * 192KHz rate is only supported with 19.2MHz/3.84MHz clock + * configuration. + */ + if (sample_rate == 192000) { + if (dmic->fclk_freq == 19200000 && dmic->out_freq == 3840000) + divider = 0x6; /* Divider: 5 (192KHz sampling rate) */ + else + dev_err(dmic->dev, + "invalid clock configuration for 192KHz\n"); + + return divider; + } + + switch (dmic->out_freq) { + case 1536000: + if (dmic->fclk_freq != 24576000) + goto div_err; + divider = 0x4; /* Divider: 16 */ + break; + case 2400000: + switch (dmic->fclk_freq) { + case 12000000: + divider = 0x5; /* Divider: 5 */ + break; + case 19200000: + divider = 0x0; /* Divider: 8 */ + break; + case 24000000: + divider = 0x2; /* Divider: 10 */ + break; + default: + goto div_err; + } + break; + case 3072000: + if (dmic->fclk_freq != 24576000) + goto div_err; + divider = 0x3; /* Divider: 8 */ + break; + case 3840000: + if (dmic->fclk_freq != 19200000) + goto div_err; + divider = 0x1; /* Divider: 5 (96KHz sampling rate) */ + break; + default: + dev_err(dmic->dev, "invalid out frequency: %dHz\n", + dmic->out_freq); + break; + } + + return divider; + +div_err: + dev_err(dmic->dev, "invalid out frequency %dHz for %dHz input\n", + dmic->out_freq, dmic->fclk_freq); + return -EINVAL; +} + +static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) +{ + struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); + int channels; + + dmic->clk_div = omap_dmic_select_divider(dmic, params_rate(params)); + if (dmic->clk_div < 0) { + dev_err(dmic->dev, "no valid divider for %dHz from %dHz\n", + dmic->out_freq, dmic->fclk_freq); + return -EINVAL; + } + + dmic->ch_enabled = 0; + channels = params_channels(params); + switch (channels) { + case 6: + dmic->ch_enabled |= OMAP_DMIC_UP3_ENABLE; + case 4: + dmic->ch_enabled |= OMAP_DMIC_UP2_ENABLE; + case 2: + dmic->ch_enabled |= OMAP_DMIC_UP1_ENABLE; + break; + default: + dev_err(dmic->dev, "invalid number of legacy channels\n"); + return -EINVAL; + } + + /* packet size is threshold * channels */ + omap_dmic_dai_dma_params.packet_size = dmic->threshold * channels; + snd_soc_dai_set_dma_data(dai, substream, &omap_dmic_dai_dma_params); + + return 0; +} + +static int omap_dmic_dai_prepare(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); + u32 ctrl; + + /* Configure uplink threshold */ + omap_dmic_write(dmic, OMAP_DMIC_FIFO_CTRL_REG, dmic->threshold); + + ctrl = omap_dmic_read(dmic, OMAP_DMIC_CTRL_REG); + + /* Set dmic out format */ + ctrl &= ~(OMAP_DMIC_FORMAT | OMAP_DMIC_POLAR_MASK); + ctrl |= (OMAP_DMICOUTFORMAT_LJUST | OMAP_DMIC_POLAR1 | + OMAP_DMIC_POLAR2 | OMAP_DMIC_POLAR3); + + /* Configure dmic clock divider */ + ctrl &= ~OMAP_DMIC_CLK_DIV_MASK; + ctrl |= OMAP_DMIC_CLK_DIV(dmic->clk_div); + + omap_dmic_write(dmic, OMAP_DMIC_CTRL_REG, ctrl); + + omap_dmic_write(dmic, OMAP_DMIC_CTRL_REG, + ctrl | OMAP_DMICOUTFORMAT_LJUST | OMAP_DMIC_POLAR1 | + OMAP_DMIC_POLAR2 | OMAP_DMIC_POLAR3); + + return 0; +} + +static int omap_dmic_dai_trigger(struct snd_pcm_substream *substream, + int cmd, struct snd_soc_dai *dai) +{ + struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); + + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + omap_dmic_start(dmic); + break; + case SNDRV_PCM_TRIGGER_STOP: + omap_dmic_stop(dmic); + break; + default: + break; + } + + return 0; +} + +static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id, + unsigned int freq) +{ + struct clk *parent_clk; + char *parent_clk_name; + int ret = 0; + + switch (freq) { + case 12000000: + case 19200000: + case 24000000: + case 24576000: + break; + default: + dev_err(dmic->dev, "invalid input frequency: %dHz\n", freq); + dmic->fclk_freq = 0; + return -EINVAL; + } + + if (dmic->sysclk == clk_id) { + dmic->fclk_freq = freq; + return 0; + } + + /* re-parent not allowed if a stream is ongoing */ + if (dmic->active && dmic_is_enabled(dmic)) { + dev_err(dmic->dev, "can't re-parent when DMIC active\n"); + return -EBUSY; + } + + switch (clk_id) { + case OMAP_DMIC_SYSCLK_PAD_CLKS: + parent_clk_name = "pad_clks_ck"; + break; + case OMAP_DMIC_SYSCLK_SLIMBLUS_CLKS: + parent_clk_name = "slimbus_clk"; + break; + case OMAP_DMIC_SYSCLK_SYNC_MUX_CLKS: + parent_clk_name = "dmic_sync_mux_ck"; + break; + default: + dev_err(dmic->dev, "fclk clk_id (%d) not supported\n", clk_id); + return -EINVAL; + } + + parent_clk = clk_get(dmic->dev, parent_clk_name); + if (IS_ERR(parent_clk)) { + dev_err(dmic->dev, "can't get %s\n", parent_clk_name); + return -ENODEV; + } + + mutex_lock(&dmic->mutex); + if (dmic->active) { + /* disable clock while reparenting */ + pm_runtime_put_sync(dmic->dev); + ret = clk_set_parent(dmic->fclk, parent_clk); + pm_runtime_get_sync(dmic->dev); + } else { + ret = clk_set_parent(dmic->fclk, parent_clk); + } + mutex_unlock(&dmic->mutex); + + if (ret < 0) { + dev_err(dmic->dev, "re-parent failed\n"); + goto err_busy; + } + + dmic->sysclk = clk_id; + dmic->fclk_freq = freq; + +err_busy: + clk_put(parent_clk); + + return ret; +} + +static int omap_dmic_select_outclk(struct omap_dmic *dmic, int clk_id, + unsigned int freq) +{ + int ret = 0; + + if (clk_id != OMAP_DMIC_ABE_DMIC_CLK) { + dev_err(dmic->dev, "output clk_id (%d) not supported\n", + clk_id); + return -EINVAL; + } + + switch (freq) { + case 1536000: + case 2400000: + case 3072000: + case 3840000: + dmic->out_freq = freq; + break; + default: + dev_err(dmic->dev, "invalid out frequency: %dHz\n", freq); + dmic->out_freq = 0; + ret = -EINVAL; + } + + return ret; +} + +static int omap_dmic_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id, + unsigned int freq, int dir) +{ + struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); + + if (dir == SND_SOC_CLOCK_IN) + return omap_dmic_select_fclk(dmic, clk_id, freq); + else if (dir == SND_SOC_CLOCK_OUT) + return omap_dmic_select_outclk(dmic, clk_id, freq); + + dev_err(dmic->dev, "invalid clock direction (%d)\n", dir); + return -EINVAL; +} + +static const struct snd_soc_dai_ops omap_dmic_dai_ops = { + .startup = omap_dmic_dai_startup, + .shutdown = omap_dmic_dai_shutdown, + .hw_params = omap_dmic_dai_hw_params, + .prepare = omap_dmic_dai_prepare, + .trigger = omap_dmic_dai_trigger, + .set_sysclk = omap_dmic_set_dai_sysclk, +}; + +static int omap_dmic_probe(struct snd_soc_dai *dai) +{ + struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); + + pm_runtime_enable(dmic->dev); + + /* Disable lines while request is ongoing */ + pm_runtime_get_sync(dmic->dev); + omap_dmic_write(dmic, OMAP_DMIC_CTRL_REG, 0x00); + pm_runtime_put_sync(dmic->dev); + + /* Configure DMIC threshold value */ + dmic->threshold = OMAP_DMIC_THRES_MAX - 3; + return 0; +} + +static int omap_dmic_remove(struct snd_soc_dai *dai) +{ + struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); + + pm_runtime_disable(dmic->dev); + + return 0; +} + +static struct snd_soc_dai_driver omap_dmic_dai = { + .name = "omap-dmic", + .probe = omap_dmic_probe, + .remove = omap_dmic_remove, + .capture = { + .channels_min = 2, + .channels_max = 6, + .rates = SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000, + .formats = SNDRV_PCM_FMTBIT_S32_LE, + }, + .ops = &omap_dmic_dai_ops, +}; + +static __devinit int asoc_dmic_probe(struct platform_device *pdev) +{ + struct omap_dmic *dmic; + struct resource *res; + int ret; + + dmic = devm_kzalloc(&pdev->dev, sizeof(struct omap_dmic), GFP_KERNEL); + if (!dmic) + return -ENOMEM; + + platform_set_drvdata(pdev, dmic); + dmic->dev = &pdev->dev; + dmic->sysclk = OMAP_DMIC_SYSCLK_SYNC_MUX_CLKS; + + mutex_init(&dmic->mutex); + + dmic->fclk = clk_get(dmic->dev, "dmic_fck"); + if (IS_ERR(dmic->fclk)) { + dev_err(dmic->dev, "cant get dmic_fck\n"); + return -ENODEV; + } + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma"); + if (!res) { + dev_err(dmic->dev, "invalid dma memory resource\n"); + ret = -ENODEV; + goto err_put_clk; + } + omap_dmic_dai_dma_params.port_addr = res->start + OMAP_DMIC_DATA_REG; + + res = platform_get_resource(pdev, IORESOURCE_DMA, 0); + if (!res) { + dev_err(dmic->dev, "invalid dma resource\n"); + ret = -ENODEV; + goto err_put_clk; + } + omap_dmic_dai_dma_params.dma_req = res->start; + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu"); + if (!res) { + dev_err(dmic->dev, "invalid memory resource\n"); + ret = -ENODEV; + goto err_put_clk; + } + + if (!devm_request_mem_region(&pdev->dev, res->start, + resource_size(res), pdev->name)) { + dev_err(dmic->dev, "memory region already claimed\n"); + ret = -ENODEV; + goto err_put_clk; + } + + dmic->io_base = devm_ioremap(&pdev->dev, res->start, + resource_size(res)); + if (!dmic->io_base) { + ret = -ENOMEM; + goto err_put_clk; + } + + ret = snd_soc_register_dai(&pdev->dev, &omap_dmic_dai); + if (ret) + goto err_put_clk; + + return 0; + +err_put_clk: + clk_put(dmic->fclk); + return ret; +} + +static int __devexit asoc_dmic_remove(struct platform_device *pdev) +{ + struct omap_dmic *dmic = platform_get_drvdata(pdev); + + snd_soc_unregister_dai(&pdev->dev); + clk_put(dmic->fclk); + + return 0; +} + +static struct platform_driver asoc_dmic_driver = { + .driver = { + .name = "omap-dmic", + .owner = THIS_MODULE, + }, + .probe = asoc_dmic_probe, + .remove = __devexit_p(asoc_dmic_remove), +}; + +module_platform_driver(asoc_dmic_driver); + +MODULE_ALIAS("platform:omap-dmic"); +MODULE_AUTHOR("Peter Ujfalusi "); +MODULE_DESCRIPTION("OMAP DMIC ASoC Interface"); +MODULE_LICENSE("GPL"); diff --git a/sound/soc/omap/omap-dmic.h b/sound/soc/omap/omap-dmic.h new file mode 100644 index 0000000..231e728 --- /dev/null +++ b/sound/soc/omap/omap-dmic.h @@ -0,0 +1,69 @@ +/* + * omap-dmic.h -- OMAP Digital Microphone Controller + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef _OMAP_DMIC_H +#define _OMAP_DMIC_H + +#define OMAP_DMIC_REVISION_REG 0x00 +#define OMAP_DMIC_SYSCONFIG_REG 0x10 +#define OMAP_DMIC_IRQSTATUS_RAW_REG 0x24 +#define OMAP_DMIC_IRQSTATUS_REG 0x28 +#define OMAP_DMIC_IRQENABLE_SET_REG 0x2C +#define OMAP_DMIC_IRQENABLE_CLR_REG 0x30 +#define OMAP_DMIC_IRQWAKE_EN_REG 0x34 +#define OMAP_DMIC_DMAENABLE_SET_REG 0x38 +#define OMAP_DMIC_DMAENABLE_CLR_REG 0x3C +#define OMAP_DMIC_DMAWAKEEN_REG 0x40 +#define OMAP_DMIC_CTRL_REG 0x44 +#define OMAP_DMIC_DATA_REG 0x48 +#define OMAP_DMIC_FIFO_CTRL_REG 0x4C +#define OMAP_DMIC_FIFO_DMIC1R_DATA_REG 0x50 +#define OMAP_DMIC_FIFO_DMIC1L_DATA_REG 0x54 +#define OMAP_DMIC_FIFO_DMIC2R_DATA_REG 0x58 +#define OMAP_DMIC_FIFO_DMIC2L_DATA_REG 0x5C +#define OMAP_DMIC_FIFO_DMIC3R_DATA_REG 0x60 +#define OMAP_DMIC_FIFO_DMIC3L_DATA_REG 0x64 + +/* IRQSTATUS_RAW, IRQSTATUS, IRQENABLE_SET, IRQENABLE_CLR bit fields */ +#define OMAP_DMIC_IRQ (1 << 0) +#define OMAP_DMIC_IRQ_FULL (1 << 1) +#define OMAP_DMIC_IRQ_ALMST_EMPTY (1 << 2) +#define OMAP_DMIC_IRQ_EMPTY (1 << 3) +#define OMAP_DMIC_IRQ_MASK 0x07 + +/* DMIC_DMAENABLE bit fields */ +#define OMAP_DMIC_DMA_ENABLE 0x1 + +/* DMIC_CTRL bit fields */ +#define OMAP_DMIC_UP1_ENABLE (1 << 0) +#define OMAP_DMIC_UP2_ENABLE (1 << 1) +#define OMAP_DMIC_UP3_ENABLE (1 << 2) +#define OMAP_DMIC_UP_ENABLE_MASK 0x7 +#define OMAP_DMIC_FORMAT (1 << 3) +#define OMAP_DMIC_POLAR1 (1 << 4) +#define OMAP_DMIC_POLAR2 (1 << 5) +#define OMAP_DMIC_POLAR3 (1 << 6) +#define OMAP_DMIC_POLAR_MASK (0x7 << 4) +#define OMAP_DMIC_CLK_DIV(x) (((x) & 0x7) << 7) +#define OMAP_DMIC_CLK_DIV_MASK (0x7 << 7) +#define OMAP_DMIC_RESET (1 << 10) + +#define OMAP_DMICOUTFORMAT_LJUST (0 << 3) +#define OMAP_DMICOUTFORMAT_RJUST (1 << 3) + +/* DMIC_FIFO_CTRL bit fields */ +#define OMAP_DMIC_THRES_MAX 0xF + +enum omap_dmic_clk { + OMAP_DMIC_SYSCLK_PAD_CLKS, /* PAD_CLKS */ + OMAP_DMIC_SYSCLK_SLIMBLUS_CLKS, /* SLIMBUS_CLK */ + OMAP_DMIC_SYSCLK_SYNC_MUX_CLKS, /* DMIC_SYNC_MUX_CLK */ + OMAP_DMIC_ABE_DMIC_CLK, /* abe_dmic_clk */ +}; + +#endif -- cgit v1.1 From 6524c8e3e6525891d6085c7fb0f7fe5ce18e5b50 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Mon, 28 Nov 2011 15:45:43 +0200 Subject: ASoC: sdp4430: Add support for digital microphones OMAP4 SDP/Blaze boards have digital microphones. Signed-off-by: Peter Ujfalusi Signed-off-by: Mark Brown --- sound/soc/omap/Kconfig | 2 ++ sound/soc/omap/sdp4430.c | 85 +++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 76 insertions(+), 11 deletions(-) (limited to 'sound') diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig index 052254a..fb1bf258 100644 --- a/sound/soc/omap/Kconfig +++ b/sound/soc/omap/Kconfig @@ -100,8 +100,10 @@ config SND_OMAP_SOC_SDP3430 config SND_OMAP_SOC_SDP4430 tristate "SoC Audio support for Texas Instruments SDP4430" depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP_4430SDP + select SND_OMAP_SOC_DMIC select SND_OMAP_SOC_MCPDM select SND_SOC_TWL6040 + select SND_SOC_DMIC help Say Y if you want to add support for SoC audio on Texas Instruments SDP4430. diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c index 03d9fa4..2735fa03 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c @@ -33,6 +33,7 @@ #include #include +#include "omap-dmic.h" #include "omap-mcpdm.h" #include "omap-pcm.h" #include "../codecs/twl6040.h" @@ -67,6 +68,32 @@ static struct snd_soc_ops sdp4430_ops = { .hw_params = sdp4430_hw_params, }; +static int sdp4430_dmic_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 *cpu_dai = rtd->cpu_dai; + int ret = 0; + + ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_DMIC_SYSCLK_PAD_CLKS, + 19200000, SND_SOC_CLOCK_IN); + if (ret < 0) { + printk(KERN_ERR "can't set DMIC cpu system clock\n"); + return ret; + } + ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_DMIC_ABE_DMIC_CLK, 2400000, + SND_SOC_CLOCK_OUT); + if (ret < 0) { + printk(KERN_ERR "can't set DMIC output clock\n"); + return ret; + } + return 0; +} + +static struct snd_soc_ops sdp4430_dmic_ops = { + .hw_params = sdp4430_dmic_hw_params, +}; + /* Headset jack */ static struct snd_soc_jack hs_jack; @@ -148,23 +175,59 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd) return ret; } +static const struct snd_soc_dapm_widget sdp4430_dmic_dapm_widgets[] = { + SND_SOC_DAPM_MIC("Digital Mic", NULL), +}; + +static const struct snd_soc_dapm_route dmic_audio_map[] = { + {"DMic", NULL, "Digital Mic1 Bias"}, + {"Digital Mic1 Bias", NULL, "Digital Mic"}, +}; + +static int sdp4430_dmic_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_dapm_context *dapm = &codec->dapm; + int ret; + + ret = snd_soc_dapm_new_controls(dapm, sdp4430_dmic_dapm_widgets, + ARRAY_SIZE(sdp4430_dmic_dapm_widgets)); + if (ret) + return ret; + + return snd_soc_dapm_add_routes(dapm, dmic_audio_map, + ARRAY_SIZE(dmic_audio_map)); +} + /* Digital audio interface glue - connects codec <--> CPU */ -static struct snd_soc_dai_link sdp4430_dai = { - .name = "TWL6040", - .stream_name = "TWL6040", - .cpu_dai_name = "omap-mcpdm", - .codec_dai_name = "twl6040-legacy", - .platform_name = "omap-pcm-audio", - .codec_name = "twl6040-codec", - .init = sdp4430_twl6040_init, - .ops = &sdp4430_ops, +static struct snd_soc_dai_link sdp4430_dai[] = { + { + .name = "TWL6040", + .stream_name = "TWL6040", + .cpu_dai_name = "omap-mcpdm", + .codec_dai_name = "twl6040-legacy", + .platform_name = "omap-pcm-audio", + .codec_name = "twl6040-codec", + .init = sdp4430_twl6040_init, + .ops = &sdp4430_ops, + }, + { + .name = "DMIC", + .stream_name = "DMIC Capture", + .cpu_dai_name = "omap-dmic", + .codec_dai_name = "dmic-hifi", + .platform_name = "omap-pcm-audio", + .codec_name = "dmic-codec", + .init = sdp4430_dmic_init, + .ops = &sdp4430_dmic_ops, + }, }; /* Audio machine driver */ static struct snd_soc_card snd_soc_sdp4430 = { .name = "SDP4430", - .dai_link = &sdp4430_dai, - .num_links = 1, + .dai_link = sdp4430_dai, + .num_links = ARRAY_SIZE(sdp4430_dai), .dapm_widgets = sdp4430_twl6040_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(sdp4430_twl6040_dapm_widgets), -- cgit v1.1 From ba0a7e024d2a0ccdb887cda149f3e11f1ce27101 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 25 Nov 2011 10:10:55 +0800 Subject: ASoC: Convert fsl directory to module_platform_driver Factor out some boilerplate code. Signed-off-by: Axel Lin Acked-by: Timur Tabi Signed-off-by: Mark Brown --- sound/soc/fsl/fsl_dma.c | 15 +-------------- sound/soc/fsl/fsl_ssi.c | 15 +-------------- sound/soc/fsl/mpc5200_dma.c | 12 +----------- sound/soc/fsl/mpc5200_psc_ac97.c | 16 +--------------- sound/soc/fsl/mpc5200_psc_i2s.c | 16 +--------------- 5 files changed, 5 insertions(+), 69 deletions(-) (limited to 'sound') diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c index ef15402..4f59bba 100644 --- a/sound/soc/fsl/fsl_dma.c +++ b/sound/soc/fsl/fsl_dma.c @@ -992,20 +992,7 @@ static struct platform_driver fsl_soc_dma_driver = { .remove = __devexit_p(fsl_soc_dma_remove), }; -static int __init fsl_soc_dma_init(void) -{ - pr_info("Freescale Elo DMA ASoC PCM Driver\n"); - - return platform_driver_register(&fsl_soc_dma_driver); -} - -static void __exit fsl_soc_dma_exit(void) -{ - platform_driver_unregister(&fsl_soc_dma_driver); -} - -module_init(fsl_soc_dma_init); -module_exit(fsl_soc_dma_exit); +module_platform_driver(fsl_soc_dma_driver); MODULE_AUTHOR("Timur Tabi "); MODULE_DESCRIPTION("Freescale Elo DMA ASoC PCM Driver"); diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 17d857e..3e06696 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -793,20 +793,7 @@ static struct platform_driver fsl_ssi_driver = { .remove = fsl_ssi_remove, }; -static int __init fsl_ssi_init(void) -{ - printk(KERN_INFO "Freescale Synchronous Serial Interface (SSI) ASoC Driver\n"); - - return platform_driver_register(&fsl_ssi_driver); -} - -static void __exit fsl_ssi_exit(void) -{ - platform_driver_unregister(&fsl_ssi_driver); -} - -module_init(fsl_ssi_init); -module_exit(fsl_ssi_exit); +module_platform_driver(fsl_ssi_driver); MODULE_AUTHOR("Timur Tabi "); MODULE_DESCRIPTION("Freescale Synchronous Serial Interface (SSI) ASoC Driver"); diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c index 5c6c245..e7803d3 100644 --- a/sound/soc/fsl/mpc5200_dma.c +++ b/sound/soc/fsl/mpc5200_dma.c @@ -526,17 +526,7 @@ static struct platform_driver mpc5200_hpcd_of_driver = { } }; -static int __init mpc5200_hpcd_init(void) -{ - return platform_driver_register(&mpc5200_hpcd_of_driver); -} -module_init(mpc5200_hpcd_init); - -static void __exit mpc5200_hpcd_exit(void) -{ - platform_driver_unregister(&mpc5200_hpcd_of_driver); -} -module_exit(mpc5200_hpcd_exit); +module_platform_driver(mpc5200_hpcd_of_driver); MODULE_AUTHOR("Grant Likely "); MODULE_DESCRIPTION("Freescale MPC5200 PSC in DMA mode ASoC Driver"); diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c index 2fb388f..ffa00a2 100644 --- a/sound/soc/fsl/mpc5200_psc_ac97.c +++ b/sound/soc/fsl/mpc5200_psc_ac97.c @@ -325,21 +325,7 @@ static struct platform_driver psc_ac97_driver = { }, }; -/* --------------------------------------------------------------------- - * Module setup and teardown; simply register the of_platform driver - * for the PSC in AC97 mode. - */ -static int __init psc_ac97_init(void) -{ - return platform_driver_register(&psc_ac97_driver); -} -module_init(psc_ac97_init); - -static void __exit psc_ac97_exit(void) -{ - platform_driver_unregister(&psc_ac97_driver); -} -module_exit(psc_ac97_exit); +module_platform_driver(psc_ac97_driver); MODULE_AUTHOR("Jon Smirl "); MODULE_DESCRIPTION("mpc5200 AC97 module"); diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c index e77a1f2..7b53032 100644 --- a/sound/soc/fsl/mpc5200_psc_i2s.c +++ b/sound/soc/fsl/mpc5200_psc_i2s.c @@ -222,21 +222,7 @@ static struct platform_driver psc_i2s_driver = { }, }; -/* --------------------------------------------------------------------- - * Module setup and teardown; simply register the of_platform driver - * for the PSC in I2S mode. - */ -static int __init psc_i2s_init(void) -{ - return platform_driver_register(&psc_i2s_driver); -} -module_init(psc_i2s_init); - -static void __exit psc_i2s_exit(void) -{ - platform_driver_unregister(&psc_i2s_driver); -} -module_exit(psc_i2s_exit); +module_platform_driver(psc_i2s_driver); MODULE_AUTHOR("Grant Likely "); MODULE_DESCRIPTION("Freescale MPC5200 PSC in I2S mode ASoC Driver"); -- cgit v1.1 From b90d4183f70e8a922db781b7ecfc823d37a3202a Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 28 Nov 2011 17:28:06 +0100 Subject: ASoC: ad193x: Use table based DAPM and controls setup Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/codecs/ad193x.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c index 1901cd2..1dfda5c 100644 --- a/sound/soc/codecs/ad193x.c +++ b/sound/soc/codecs/ad193x.c @@ -345,7 +345,6 @@ static struct snd_soc_dai_driver ad193x_dai = { static int ad193x_probe(struct snd_soc_codec *codec) { struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec); - struct snd_soc_dapm_context *dapm = &codec->dapm; int ret; codec->control_data = ad193x->regmap; @@ -371,17 +370,17 @@ static int ad193x_probe(struct snd_soc_codec *codec) snd_soc_write(codec, AD193X_PLL_CLK_CTRL0, 0x99); /* mclk=24.576Mhz: 0x9D; mclk=12.288Mhz: 0x99 */ snd_soc_write(codec, AD193X_PLL_CLK_CTRL1, 0x04); - snd_soc_add_controls(codec, ad193x_snd_controls, - ARRAY_SIZE(ad193x_snd_controls)); - snd_soc_dapm_new_controls(dapm, ad193x_dapm_widgets, - ARRAY_SIZE(ad193x_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths)); - return ret; } static struct snd_soc_codec_driver soc_codec_dev_ad193x = { .probe = ad193x_probe, + .controls = ad193x_snd_controls, + .num_controls = ARRAY_SIZE(ad193x_snd_controls), + .dapm_widgets = ad193x_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(ad193x_dapm_widgets), + .dapm_routes = audio_paths, + .num_dapm_routes = ARRAY_SIZE(audio_paths), }; #if defined(CONFIG_SPI_MASTER) -- cgit v1.1 From 591c034a32a8e3034c447308ad7a4ef19e7ca617 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 28 Nov 2011 17:28:07 +0100 Subject: ASoC: ad193x: Provide dB ranges for the volume controls Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/codecs/ad193x.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c index 1dfda5c..7da7e29 100644 --- a/sound/soc/codecs/ad193x.c +++ b/sound/soc/codecs/ad193x.c @@ -35,16 +35,18 @@ static const char *ad193x_deemp[] = {"None", "48kHz", "44.1kHz", "32kHz"}; static const struct soc_enum ad193x_deemp_enum = SOC_ENUM_SINGLE(AD193X_DAC_CTRL2, 1, 4, ad193x_deemp); +static const DECLARE_TLV_DB_MINMAX(adau193x_tlv, -9563, 0); + static const struct snd_kcontrol_new ad193x_snd_controls[] = { /* DAC volume control */ - SOC_DOUBLE_R("DAC1 Volume", AD193X_DAC_L1_VOL, - AD193X_DAC_R1_VOL, 0, 0xFF, 1), - SOC_DOUBLE_R("DAC2 Volume", AD193X_DAC_L2_VOL, - AD193X_DAC_R2_VOL, 0, 0xFF, 1), - SOC_DOUBLE_R("DAC3 Volume", AD193X_DAC_L3_VOL, - AD193X_DAC_R3_VOL, 0, 0xFF, 1), - SOC_DOUBLE_R("DAC4 Volume", AD193X_DAC_L4_VOL, - AD193X_DAC_R4_VOL, 0, 0xFF, 1), + SOC_DOUBLE_R_TLV("DAC1 Volume", AD193X_DAC_L1_VOL, + AD193X_DAC_R1_VOL, 0, 0xFF, 1, adau193x_tlv), + SOC_DOUBLE_R_TLV("DAC2 Volume", AD193X_DAC_L2_VOL, + AD193X_DAC_R2_VOL, 0, 0xFF, 1, adau193x_tlv), + SOC_DOUBLE_R_TLV("DAC3 Volume", AD193X_DAC_L3_VOL, + AD193X_DAC_R3_VOL, 0, 0xFF, 1, adau193x_tlv), + SOC_DOUBLE_R_TLV("DAC4 Volume", AD193X_DAC_L4_VOL, + AD193X_DAC_R4_VOL, 0, 0xFF, 1, adau193x_tlv), /* ADC switch control */ SOC_DOUBLE("ADC1 Switch", AD193X_ADC_CTRL0, AD193X_ADCL1_MUTE, -- cgit v1.1 From c4e7a4a2768aad0bb83988922a164b4a96393713 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 28 Nov 2011 17:28:08 +0100 Subject: ASoC: ad193x: Make enum items const char * const Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/codecs/ad193x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c index 7da7e29..665af5c 100644 --- a/sound/soc/codecs/ad193x.c +++ b/sound/soc/codecs/ad193x.c @@ -30,7 +30,7 @@ struct ad193x_priv { /* * AD193X volume/mute/de-emphasis etc. controls */ -static const char *ad193x_deemp[] = {"None", "48kHz", "44.1kHz", "32kHz"}; +static const char * const ad193x_deemp[] = {"None", "48kHz", "44.1kHz", "32kHz"}; static const struct soc_enum ad193x_deemp_enum = SOC_ENUM_SINGLE(AD193X_DAC_CTRL2, 1, 4, ad193x_deemp); -- cgit v1.1 From b21990b47d799152f5039c2873c38622fa7ae0f2 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 28 Nov 2011 17:28:09 +0100 Subject: ASoC: ad193x: Remove non-functional DAPM route controls DAPM route controls only take effect on paths where the sink is a mixer or a mux, furthermore the control must be a control assigned to the mixer or mux. Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/codecs/ad193x.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c index 665af5c..c52ebd3 100644 --- a/sound/soc/codecs/ad193x.c +++ b/sound/soc/codecs/ad193x.c @@ -90,12 +90,12 @@ static const struct snd_soc_dapm_route audio_paths[] = { { "ADC", NULL, "PLL_PWR" }, { "DAC", NULL, "ADC_PWR" }, { "ADC", NULL, "ADC_PWR" }, - { "DAC1OUT", "DAC1 Switch", "DAC" }, - { "DAC2OUT", "DAC2 Switch", "DAC" }, - { "DAC3OUT", "DAC3 Switch", "DAC" }, - { "DAC4OUT", "DAC4 Switch", "DAC" }, - { "ADC", "ADC1 Switch", "ADC1IN" }, - { "ADC", "ADC2 Switch", "ADC2IN" }, + { "DAC1OUT", NULL, "DAC" }, + { "DAC2OUT", NULL, "DAC" }, + { "DAC3OUT", NULL, "DAC" }, + { "DAC4OUT", NULL, "DAC" }, + { "ADC", NULL, "ADC1IN" }, + { "ADC", NULL, "ADC2IN" }, }; /* -- cgit v1.1 From 0718fd27775fcc335c728cfa4965ce78c0662b67 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 28 Nov 2011 17:28:10 +0100 Subject: ASoC: ad193x: Add sysclk DAPM supply Add a DAPM supply widget for the internal sysclk, so it can be disabled automatically when not needed. Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/codecs/ad193x.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c index c52ebd3..c19e223 100644 --- a/sound/soc/codecs/ad193x.c +++ b/sound/soc/codecs/ad193x.c @@ -77,6 +77,7 @@ static const struct snd_soc_dapm_widget ad193x_dapm_widgets[] = { SND_SOC_DAPM_ADC("ADC", "Capture", SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_SUPPLY("PLL_PWR", AD193X_PLL_CLK_CTRL0, 0, 1, NULL, 0), SND_SOC_DAPM_SUPPLY("ADC_PWR", AD193X_ADC_CTRL0, 0, 1, NULL, 0), + SND_SOC_DAPM_SUPPLY("SYSCLK", AD193X_PLL_CLK_CTRL0, 7, 0, NULL, 0), SND_SOC_DAPM_OUTPUT("DAC1OUT"), SND_SOC_DAPM_OUTPUT("DAC2OUT"), SND_SOC_DAPM_OUTPUT("DAC3OUT"), @@ -86,8 +87,8 @@ static const struct snd_soc_dapm_widget ad193x_dapm_widgets[] = { }; static const struct snd_soc_dapm_route audio_paths[] = { - { "DAC", NULL, "PLL_PWR" }, - { "ADC", NULL, "PLL_PWR" }, + { "DAC", NULL, "SYSCLK" }, + { "ADC", NULL, "SYSCLK" }, { "DAC", NULL, "ADC_PWR" }, { "ADC", NULL, "ADC_PWR" }, { "DAC1OUT", NULL, "DAC" }, @@ -96,6 +97,7 @@ static const struct snd_soc_dapm_route audio_paths[] = { { "DAC4OUT", NULL, "DAC" }, { "ADC", NULL, "ADC1IN" }, { "ADC", NULL, "ADC2IN" }, + { "SYSCLK", NULL, "PLL_PWR" }, }; /* -- cgit v1.1 From b82ca578fd8b28d9600a077f4e24e22a71383fe8 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 28 Nov 2011 17:28:11 +0100 Subject: ASoC: ad193x: Use snd_soc_update_bits where appropriate We can reduce the code size here a bit by using snd_soc_update_bits instead of open-coding the read-modify-write cycle. The conversion done in this patch is not completely straightforward and some minor code restructuring has been incorporated to further reduce the code size. Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/codecs/ad193x.c | 96 ++++++++++++++++++----------------------------- sound/soc/codecs/ad193x.h | 17 +++++---- 2 files changed, 45 insertions(+), 68 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c index c19e223..7d64f20 100644 --- a/sound/soc/codecs/ad193x.c +++ b/sound/soc/codecs/ad193x.c @@ -123,35 +123,29 @@ static int ad193x_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, unsigned int rx_mask, int slots, int width) { struct snd_soc_codec *codec = dai->codec; - int dac_reg = snd_soc_read(codec, AD193X_DAC_CTRL1); - int adc_reg = snd_soc_read(codec, AD193X_ADC_CTRL2); - - dac_reg &= ~AD193X_DAC_CHAN_MASK; - adc_reg &= ~AD193X_ADC_CHAN_MASK; + unsigned int channels; switch (slots) { case 2: - dac_reg |= AD193X_DAC_2_CHANNELS << AD193X_DAC_CHAN_SHFT; - adc_reg |= AD193X_ADC_2_CHANNELS << AD193X_ADC_CHAN_SHFT; + channels = AD193X_2_CHANNELS; break; case 4: - dac_reg |= AD193X_DAC_4_CHANNELS << AD193X_DAC_CHAN_SHFT; - adc_reg |= AD193X_ADC_4_CHANNELS << AD193X_ADC_CHAN_SHFT; + channels = AD193X_4_CHANNELS; break; case 8: - dac_reg |= AD193X_DAC_8_CHANNELS << AD193X_DAC_CHAN_SHFT; - adc_reg |= AD193X_ADC_8_CHANNELS << AD193X_ADC_CHAN_SHFT; + channels = AD193X_8_CHANNELS; break; case 16: - dac_reg |= AD193X_DAC_16_CHANNELS << AD193X_DAC_CHAN_SHFT; - adc_reg |= AD193X_ADC_16_CHANNELS << AD193X_ADC_CHAN_SHFT; + channels = AD193X_16_CHANNELS; break; default: return -EINVAL; } - snd_soc_write(codec, AD193X_DAC_CTRL1, dac_reg); - snd_soc_write(codec, AD193X_ADC_CTRL2, adc_reg); + snd_soc_update_bits(codec, AD193X_DAC_CTRL1, AD193X_DAC_CHAN_MASK, + channels << AD193X_DAC_CHAN_SHFT); + snd_soc_update_bits(codec, AD193X_ADC_CTRL2, AD193X_ADC_CHAN_MASK, + channels << AD193X_ADC_CHAN_SHFT); return 0; } @@ -160,23 +154,19 @@ static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { struct snd_soc_codec *codec = codec_dai->codec; - int adc_reg1, adc_reg2, dac_reg; - - adc_reg1 = snd_soc_read(codec, AD193X_ADC_CTRL1); - adc_reg2 = snd_soc_read(codec, AD193X_ADC_CTRL2); - dac_reg = snd_soc_read(codec, AD193X_DAC_CTRL1); + unsigned int adc_serfmt = 0; + unsigned int adc_fmt = 0; + unsigned int dac_fmt = 0; /* At present, the driver only support AUX ADC mode(SND_SOC_DAIFMT_I2S * with TDM) and ADC&DAC TDM mode(SND_SOC_DAIFMT_DSP_A) */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { case SND_SOC_DAIFMT_I2S: - adc_reg1 &= ~AD193X_ADC_SERFMT_MASK; - adc_reg1 |= AD193X_ADC_SERFMT_TDM; + adc_serfmt |= AD193X_ADC_SERFMT_TDM; break; case SND_SOC_DAIFMT_DSP_A: - adc_reg1 &= ~AD193X_ADC_SERFMT_MASK; - adc_reg1 |= AD193X_ADC_SERFMT_AUX; + adc_serfmt |= AD193X_ADC_SERFMT_AUX; break; default: return -EINVAL; @@ -184,29 +174,20 @@ static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai, switch (fmt & SND_SOC_DAIFMT_INV_MASK) { case SND_SOC_DAIFMT_NB_NF: /* normal bit clock + frame */ - adc_reg2 &= ~AD193X_ADC_LEFT_HIGH; - adc_reg2 &= ~AD193X_ADC_BCLK_INV; - dac_reg &= ~AD193X_DAC_LEFT_HIGH; - dac_reg &= ~AD193X_DAC_BCLK_INV; break; case SND_SOC_DAIFMT_NB_IF: /* normal bclk + invert frm */ - adc_reg2 |= AD193X_ADC_LEFT_HIGH; - adc_reg2 &= ~AD193X_ADC_BCLK_INV; - dac_reg |= AD193X_DAC_LEFT_HIGH; - dac_reg &= ~AD193X_DAC_BCLK_INV; + adc_fmt |= AD193X_ADC_LEFT_HIGH; + dac_fmt |= AD193X_DAC_LEFT_HIGH; break; case SND_SOC_DAIFMT_IB_NF: /* invert bclk + normal frm */ - adc_reg2 &= ~AD193X_ADC_LEFT_HIGH; - adc_reg2 |= AD193X_ADC_BCLK_INV; - dac_reg &= ~AD193X_DAC_LEFT_HIGH; - dac_reg |= AD193X_DAC_BCLK_INV; + adc_fmt |= AD193X_ADC_BCLK_INV; + dac_fmt |= AD193X_DAC_BCLK_INV; break; - case SND_SOC_DAIFMT_IB_IF: /* invert bclk + frm */ - adc_reg2 |= AD193X_ADC_LEFT_HIGH; - adc_reg2 |= AD193X_ADC_BCLK_INV; - dac_reg |= AD193X_DAC_LEFT_HIGH; - dac_reg |= AD193X_DAC_BCLK_INV; + adc_fmt |= AD193X_ADC_LEFT_HIGH; + adc_fmt |= AD193X_ADC_BCLK_INV; + dac_fmt |= AD193X_DAC_LEFT_HIGH; + dac_fmt |= AD193X_DAC_BCLK_INV; break; default: return -EINVAL; @@ -214,36 +195,31 @@ static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai, switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBM_CFM: /* codec clk & frm master */ - adc_reg2 |= AD193X_ADC_LCR_MASTER; - adc_reg2 |= AD193X_ADC_BCLK_MASTER; - dac_reg |= AD193X_DAC_LCR_MASTER; - dac_reg |= AD193X_DAC_BCLK_MASTER; + adc_fmt |= AD193X_ADC_LCR_MASTER; + adc_fmt |= AD193X_ADC_BCLK_MASTER; + dac_fmt |= AD193X_DAC_LCR_MASTER; + dac_fmt |= AD193X_DAC_BCLK_MASTER; break; case SND_SOC_DAIFMT_CBS_CFM: /* codec clk slave & frm master */ - adc_reg2 |= AD193X_ADC_LCR_MASTER; - adc_reg2 &= ~AD193X_ADC_BCLK_MASTER; - dac_reg |= AD193X_DAC_LCR_MASTER; - dac_reg &= ~AD193X_DAC_BCLK_MASTER; + adc_fmt |= AD193X_ADC_LCR_MASTER; + dac_fmt |= AD193X_DAC_LCR_MASTER; break; case SND_SOC_DAIFMT_CBM_CFS: /* codec clk master & frame slave */ - adc_reg2 &= ~AD193X_ADC_LCR_MASTER; - adc_reg2 |= AD193X_ADC_BCLK_MASTER; - dac_reg &= ~AD193X_DAC_LCR_MASTER; - dac_reg |= AD193X_DAC_BCLK_MASTER; + adc_fmt |= AD193X_ADC_BCLK_MASTER; + dac_fmt |= AD193X_DAC_BCLK_MASTER; break; case SND_SOC_DAIFMT_CBS_CFS: /* codec clk & frm slave */ - adc_reg2 &= ~AD193X_ADC_LCR_MASTER; - adc_reg2 &= ~AD193X_ADC_BCLK_MASTER; - dac_reg &= ~AD193X_DAC_LCR_MASTER; - dac_reg &= ~AD193X_DAC_BCLK_MASTER; break; default: return -EINVAL; } - snd_soc_write(codec, AD193X_ADC_CTRL1, adc_reg1); - snd_soc_write(codec, AD193X_ADC_CTRL2, adc_reg2); - snd_soc_write(codec, AD193X_DAC_CTRL1, dac_reg); + snd_soc_update_bits(codec, AD193X_ADC_CTRL1, AD193X_ADC_SERFMT_MASK, + adc_serfmt); + snd_soc_update_bits(codec, AD193X_ADC_CTRL2, AD193X_ADC_FMT_MASK, + adc_fmt); + snd_soc_update_bits(codec, AD193X_DAC_CTRL1, AD193X_DAC_FMT_MASK, + dac_fmt); return 0; } diff --git a/sound/soc/codecs/ad193x.h b/sound/soc/codecs/ad193x.h index 1507eaa..4733880 100644 --- a/sound/soc/codecs/ad193x.h +++ b/sound/soc/codecs/ad193x.h @@ -23,16 +23,14 @@ #define AD193X_DAC_SERFMT_STEREO (0 << 6) #define AD193X_DAC_SERFMT_TDM (1 << 6) #define AD193X_DAC_CTRL1 0x03 -#define AD193X_DAC_2_CHANNELS 0 -#define AD193X_DAC_4_CHANNELS 1 -#define AD193X_DAC_8_CHANNELS 2 -#define AD193X_DAC_16_CHANNELS 3 #define AD193X_DAC_CHAN_SHFT 1 #define AD193X_DAC_CHAN_MASK (3 << AD193X_DAC_CHAN_SHFT) #define AD193X_DAC_LCR_MASTER (1 << 4) #define AD193X_DAC_BCLK_MASTER (1 << 5) #define AD193X_DAC_LEFT_HIGH (1 << 3) #define AD193X_DAC_BCLK_INV (1 << 7) +#define AD193X_DAC_FMT_MASK (AD193X_DAC_LCR_MASTER | \ + AD193X_DAC_BCLK_MASTER | AD193X_DAC_LEFT_HIGH | AD193X_DAC_BCLK_INV) #define AD193X_DAC_CTRL2 0x04 #define AD193X_DAC_WORD_LEN_SHFT 3 #define AD193X_DAC_WORD_LEN_MASK 0x18 @@ -68,16 +66,19 @@ #define AD193X_ADC_SERFMT_AUX (2 << 5) #define AD193X_ADC_WORD_LEN_MASK 0x3 #define AD193X_ADC_CTRL2 0x10 -#define AD193X_ADC_2_CHANNELS 0 -#define AD193X_ADC_4_CHANNELS 1 -#define AD193X_ADC_8_CHANNELS 2 -#define AD193X_ADC_16_CHANNELS 3 #define AD193X_ADC_CHAN_SHFT 4 #define AD193X_ADC_CHAN_MASK (3 << AD193X_ADC_CHAN_SHFT) #define AD193X_ADC_LCR_MASTER (1 << 3) #define AD193X_ADC_BCLK_MASTER (1 << 6) #define AD193X_ADC_LEFT_HIGH (1 << 2) #define AD193X_ADC_BCLK_INV (1 << 1) +#define AD193X_ADC_FMT_MASK (AD193X_ADC_LCR_MASTER | \ + AD193X_ADC_BCLK_MASTER | AD193X_ADC_LEFT_HIGH | AD193X_ADC_BCLK_INV) + +#define AD193X_2_CHANNELS 0 +#define AD193X_4_CHANNELS 1 +#define AD193X_8_CHANNELS 2 +#define AD193X_16_CHANNELS 3 #define AD193X_NUM_REGS 17 -- cgit v1.1 From 34cbe16833a1840d6cde592123335fb3ad75b5d4 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 28 Nov 2011 17:28:12 +0100 Subject: ASoC: ad193x: Convert to direct regmap API usage Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/codecs/ad193x.c | 61 ++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 25 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c index 7d64f20..c1b7d92 100644 --- a/sound/soc/codecs/ad193x.c +++ b/sound/soc/codecs/ad193x.c @@ -106,14 +106,14 @@ static const struct snd_soc_dapm_route audio_paths[] = { static int ad193x_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; + struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(dai->codec); if (mute) - snd_soc_update_bits(codec, AD193X_DAC_CTRL2, + regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL2, AD193X_DAC_MASTER_MUTE, AD193X_DAC_MASTER_MUTE); else - snd_soc_update_bits(codec, AD193X_DAC_CTRL2, + regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL2, AD193X_DAC_MASTER_MUTE, 0); return 0; @@ -122,7 +122,7 @@ static int ad193x_mute(struct snd_soc_dai *dai, int mute) static int ad193x_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, unsigned int rx_mask, int slots, int width) { - struct snd_soc_codec *codec = dai->codec; + struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(dai->codec); unsigned int channels; switch (slots) { @@ -142,10 +142,10 @@ static int ad193x_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, return -EINVAL; } - snd_soc_update_bits(codec, AD193X_DAC_CTRL1, AD193X_DAC_CHAN_MASK, - channels << AD193X_DAC_CHAN_SHFT); - snd_soc_update_bits(codec, AD193X_ADC_CTRL2, AD193X_ADC_CHAN_MASK, - channels << AD193X_ADC_CHAN_SHFT); + regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL1, + AD193X_DAC_CHAN_MASK, channels << AD193X_DAC_CHAN_SHFT); + regmap_update_bits(ad193x->regmap, AD193X_ADC_CTRL2, + AD193X_ADC_CHAN_MASK, channels << AD193X_ADC_CHAN_SHFT); return 0; } @@ -153,7 +153,7 @@ static int ad193x_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { - struct snd_soc_codec *codec = codec_dai->codec; + struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec_dai->codec); unsigned int adc_serfmt = 0; unsigned int adc_fmt = 0; unsigned int dac_fmt = 0; @@ -214,12 +214,12 @@ static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai, return -EINVAL; } - snd_soc_update_bits(codec, AD193X_ADC_CTRL1, AD193X_ADC_SERFMT_MASK, - adc_serfmt); - snd_soc_update_bits(codec, AD193X_ADC_CTRL2, AD193X_ADC_FMT_MASK, - adc_fmt); - snd_soc_update_bits(codec, AD193X_DAC_CTRL1, AD193X_DAC_FMT_MASK, - dac_fmt); + regmap_update_bits(ad193x->regmap, AD193X_ADC_CTRL1, + AD193X_ADC_SERFMT_MASK, adc_serfmt); + regmap_update_bits(ad193x->regmap, AD193X_ADC_CTRL2, + AD193X_ADC_FMT_MASK, adc_fmt); + regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL1, + AD193X_DAC_FMT_MASK, dac_fmt); return 0; } @@ -279,14 +279,14 @@ static int ad193x_hw_params(struct snd_pcm_substream *substream, break; } - snd_soc_update_bits(codec, AD193X_PLL_CLK_CTRL0, + regmap_update_bits(ad193x->regmap, AD193X_PLL_CLK_CTRL0, AD193X_PLL_INPUT_MASK, master_rate); - snd_soc_update_bits(codec, AD193X_DAC_CTRL2, + regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL2, AD193X_DAC_WORD_LEN_MASK, word_len << AD193X_DAC_WORD_LEN_SHFT); - snd_soc_update_bits(codec, AD193X_ADC_CTRL1, + regmap_update_bits(ad193x->regmap, AD193X_ADC_CTRL1, AD193X_ADC_WORD_LEN_MASK, word_len); return 0; @@ -337,18 +337,18 @@ static int ad193x_probe(struct snd_soc_codec *codec) /* default setting for ad193x */ /* unmute dac channels */ - snd_soc_write(codec, AD193X_DAC_CHNL_MUTE, 0x0); + regmap_write(ad193x->regmap, AD193X_DAC_CHNL_MUTE, 0x0); /* de-emphasis: 48kHz, powedown dac */ - snd_soc_write(codec, AD193X_DAC_CTRL2, 0x1A); + regmap_write(ad193x->regmap, AD193X_DAC_CTRL2, 0x1A); /* powerdown dac, dac in tdm mode */ - snd_soc_write(codec, AD193X_DAC_CTRL0, 0x41); + regmap_write(ad193x->regmap, AD193X_DAC_CTRL0, 0x41); /* high-pass filter enable */ - snd_soc_write(codec, AD193X_ADC_CTRL0, 0x3); + regmap_write(ad193x->regmap, AD193X_ADC_CTRL0, 0x3); /* sata delay=1, adc aux mode */ - snd_soc_write(codec, AD193X_ADC_CTRL1, 0x43); + regmap_write(ad193x->regmap, AD193X_ADC_CTRL1, 0x43); /* pll input: mclki/xi */ - snd_soc_write(codec, AD193X_PLL_CLK_CTRL0, 0x99); /* mclk=24.576Mhz: 0x9D; mclk=12.288Mhz: 0x99 */ - snd_soc_write(codec, AD193X_PLL_CLK_CTRL1, 0x04); + regmap_write(ad193x->regmap, AD193X_PLL_CLK_CTRL0, 0x99); /* mclk=24.576Mhz: 0x9D; mclk=12.288Mhz: 0x99 */ + regmap_write(ad193x->regmap, AD193X_PLL_CLK_CTRL1, 0x04); return ret; } @@ -363,6 +363,11 @@ static struct snd_soc_codec_driver soc_codec_dev_ad193x = { .num_dapm_routes = ARRAY_SIZE(audio_paths), }; +static bool adau193x_reg_volatile(struct device *dev, unsigned int reg) +{ + return false; +} + #if defined(CONFIG_SPI_MASTER) static const struct regmap_config ad193x_spi_regmap_config = { @@ -370,6 +375,9 @@ static const struct regmap_config ad193x_spi_regmap_config = { .reg_bits = 16, .read_flag_mask = 0x09, .write_flag_mask = 0x08, + + .max_register = AD193X_NUM_REGS - 1, + .volatile_reg = adau193x_reg_volatile, }; static int __devinit ad193x_spi_probe(struct spi_device *spi) @@ -429,6 +437,9 @@ static struct spi_driver ad193x_spi_driver = { static const struct regmap_config ad193x_i2c_regmap_config = { .val_bits = 8, .reg_bits = 8, + + .max_register = AD193X_NUM_REGS - 1, + .volatile_reg = adau193x_reg_volatile, }; static const struct i2c_device_id ad193x_id[] = { -- cgit v1.1 From 0a590b1de28813c81effa2c291f24ef1f47444e9 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 28 Nov 2011 22:05:41 +0000 Subject: ASoC: Add basic 1277-EV1 Littlemill audio driver The Littlemill audio card supports a number of pluggable miniboards, normally for the WM8994 family of devices. As all these devices look mostly the same from an external configuration point of view and are runtime enumerable we can write a standard machine driver which will work out of the box with any of them. Start doing that with the bare bones of a driver, only supporting AIF1. Future patches will flesh this out to be more fully featured. Signed-off-by: Mark Brown --- sound/soc/samsung/Kconfig | 6 ++ sound/soc/samsung/Makefile | 2 + sound/soc/samsung/littlemill.c | 227 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 235 insertions(+) create mode 100644 sound/soc/samsung/littlemill.c (limited to 'sound') diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index 71f38de..7aaaf8e 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -205,3 +205,9 @@ config SND_SOC_LOWLAND select SND_SAMSUNG_I2S select SND_SOC_WM5100 select SND_SOC_WM9081 + +config SND_SOC_LITTLEMILL + tristate "Audio support for Wolfson Littlemill" + depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 + select SND_SAMSUNG_I2S + select SND_SOC_WM8994 diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index 7802c25..c9564e3 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile @@ -41,6 +41,7 @@ snd-soc-smdk-wm8994pcm-objs := smdk_wm8994pcm.o snd-soc-speyside-objs := speyside.o snd-soc-speyside-wm8962-objs := speyside_wm8962.o snd-soc-lowland-objs := lowland.o +snd-soc-littlemill-objs := littlemill.o obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o @@ -63,3 +64,4 @@ obj-$(CONFIG_SND_SOC_SMDK_WM8994_PCM) += snd-soc-smdk-wm8994pcm.o obj-$(CONFIG_SND_SOC_SPEYSIDE) += snd-soc-speyside.o obj-$(CONFIG_SND_SOC_SPEYSIDE_WM8962) += snd-soc-speyside-wm8962.o obj-$(CONFIG_SND_SOC_LOWLAND) += snd-soc-lowland.o +obj-$(CONFIG_SND_SOC_LITTLEMILL) += snd-soc-littlemill.o diff --git a/sound/soc/samsung/littlemill.c b/sound/soc/samsung/littlemill.c new file mode 100644 index 0000000..d2a44ab --- /dev/null +++ b/sound/soc/samsung/littlemill.c @@ -0,0 +1,227 @@ +/* + * Littlemill audio support + * + * Copyright 2011 Wolfson Microelectronics + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include +#include +#include + +#include "../codecs/wm8994.h" + +static int sample_rate = 44100; + +static int littlemill_set_bias_level(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level) +{ + struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; + int ret; + + if (dapm->dev != codec_dai->dev) + return 0; + + switch (level) { + case SND_SOC_BIAS_PREPARE: + /* + * If we've not already clocked things via hw_params() + * then do so now, otherwise these are noops. + */ + if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { + ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, + WM8994_FLL_SRC_MCLK2, 32768, + sample_rate * 512); + if (ret < 0) { + pr_err("Failed to start FLL: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_sysclk(codec_dai, + WM8994_SYSCLK_FLL1, + sample_rate * 512, + SND_SOC_CLOCK_IN); + if (ret < 0) { + pr_err("Failed to set SYSCLK: %d\n", ret); + return ret; + } + } + break; + + default: + break; + } + + return 0; +} + +static int littlemill_set_bias_level_post(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level) +{ + struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; + int ret; + + if (dapm->dev != codec_dai->dev) + return 0; + + switch (level) { + case SND_SOC_BIAS_STANDBY: + ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_MCLK2, + 32768, SND_SOC_CLOCK_IN); + if (ret < 0) { + pr_err("Failed to switch away from FLL: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, + 0, 0, 0); + if (ret < 0) { + pr_err("Failed to stop FLL: %d\n", ret); + return ret; + } + break; + + default: + break; + } + + dapm->bias_level = level; + + return 0; +} + +static int littlemill_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->codec_dai; + int ret; + + sample_rate = params_rate(params); + + ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, + WM8994_FLL_SRC_MCLK2, 32768, + sample_rate * 512); + if (ret < 0) { + pr_err("Failed to start FLL: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_sysclk(codec_dai, + WM8994_SYSCLK_FLL1, + sample_rate * 512, + SND_SOC_CLOCK_IN); + if (ret < 0) { + pr_err("Failed to set SYSCLK: %d\n", ret); + return ret; + } + + return 0; +} + +static struct snd_soc_ops littlemill_ops = { + .hw_params = littlemill_hw_params, +}; + +static struct snd_soc_dai_link littlemill_dai[] = { + { + .name = "CPU", + .stream_name = "CPU", + .cpu_dai_name = "samsung-i2s.0", + .codec_dai_name = "wm8994-aif1", + .platform_name = "samsung-audio", + .codec_name = "wm8994-codec", + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF + | SND_SOC_DAIFMT_CBM_CFM, + .ops = &littlemill_ops, + }, +}; + +static struct snd_soc_dapm_widget widgets[] = { + SND_SOC_DAPM_HP("Headphone", NULL), +}; + +static struct snd_soc_dapm_route audio_paths[] = { + { "Headphone", NULL, "HPOUT1L" }, + { "Headphone", NULL, "HPOUT1R" }, +}; + +static int littlemill_late_probe(struct snd_soc_card *card) +{ + struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; + int ret; + + ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_MCLK2, + 32768, SND_SOC_CLOCK_IN); + if (ret < 0) + return ret; + + return 0; +} + +static struct snd_soc_card littlemill = { + .name = "Littlemill", + .dai_link = littlemill_dai, + .num_links = ARRAY_SIZE(littlemill_dai), + + .set_bias_level = littlemill_set_bias_level, + .set_bias_level_post = littlemill_set_bias_level_post, + + .dapm_widgets = widgets, + .num_dapm_widgets = ARRAY_SIZE(widgets), + .dapm_routes = audio_paths, + .num_dapm_routes = ARRAY_SIZE(audio_paths), + + .late_probe = littlemill_late_probe, +}; + +static __devinit int littlemill_probe(struct platform_device *pdev) +{ + struct snd_soc_card *card = &littlemill; + int ret; + + card->dev = &pdev->dev; + + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); + return ret; + } + + return 0; +} + +static int __devexit littlemill_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + + return 0; +} + +static struct platform_driver littlemill_driver = { + .driver = { + .name = "littlemill", + .owner = THIS_MODULE, + .pm = &snd_soc_pm_ops, + }, + .probe = littlemill_probe, + .remove = __devexit_p(littlemill_remove), +}; + +module_platform_driver(littlemill_driver); + +MODULE_DESCRIPTION("Littlemill audio support"); +MODULE_AUTHOR("Mark Brown "); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:littlemill"); -- cgit v1.1 From af3c2621a9b4d22b8927b91bc9cc02a13087e12b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 28 Nov 2011 18:55:03 +0800 Subject: ASoC: Convert tegra_spdif to use module_platform_driver() Use the module_platform_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin Acked-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/tegra_spdif.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_spdif.c b/sound/soc/tegra/tegra_spdif.c index ea9c920..475428c 100644 --- a/sound/soc/tegra/tegra_spdif.c +++ b/sound/soc/tegra/tegra_spdif.c @@ -352,17 +352,7 @@ static struct platform_driver tegra_spdif_driver = { .remove = __devexit_p(tegra_spdif_platform_remove), }; -static int __init snd_tegra_spdif_init(void) -{ - return platform_driver_register(&tegra_spdif_driver); -} -module_init(snd_tegra_spdif_init); - -static void __exit snd_tegra_spdif_exit(void) -{ - platform_driver_unregister(&tegra_spdif_driver); -} -module_exit(snd_tegra_spdif_exit); +module_platform_driver(tegra_spdif_driver); MODULE_AUTHOR("Stephen Warren "); MODULE_DESCRIPTION("Tegra SPDIF ASoC driver"); -- cgit v1.1 From cc0b401ad87e830843d3034f892c4017f9837fae Mon Sep 17 00:00:00 2001 From: Brian Austin Date: Mon, 28 Nov 2011 15:49:31 -0600 Subject: ASoC: Convert CS42L73 to devm_kzalloc() Signed-off-by: Brian Austin Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l73.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index d09578f..9fd5de7 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -1339,7 +1339,8 @@ static __devinit int cs42l73_i2c_probe(struct i2c_client *i2c_client, unsigned int devid = 0; unsigned int reg; - cs42l73 = kzalloc((sizeof *cs42l73), GFP_KERNEL); + cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_private), + GFP_KERNEL); if (!cs42l73) { dev_err(&i2c_client->dev, "could not allocate codec\n"); return -ENOMEM; @@ -1394,8 +1395,6 @@ err_regmap: regmap_exit(cs42l73->regmap); err: - kfree(cs42l73); - return ret; } @@ -1406,7 +1405,6 @@ static __devexit int cs42l73_i2c_remove(struct i2c_client *client) snd_soc_unregister_codec(&client->dev); regmap_exit(cs42l73->regmap); - kfree(cs42l73); return 0; } -- cgit v1.1 From 1175f71197140dfdb8ad31767030175d88cbea2b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 28 Nov 2011 18:53:57 +0800 Subject: ASoC: Convert smdk_wm8994pcm to use module_platform_driver() Use the module_platform_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/samsung/smdk_wm8994pcm.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'sound') diff --git a/sound/soc/samsung/smdk_wm8994pcm.c b/sound/soc/samsung/smdk_wm8994pcm.c index da9c2a2..23c7fb7 100644 --- a/sound/soc/samsung/smdk_wm8994pcm.c +++ b/sound/soc/samsung/smdk_wm8994pcm.c @@ -158,19 +158,7 @@ static struct platform_driver snd_smdk_driver = { .remove = __devexit_p(snd_smdk_remove), }; -static int __init smdk_audio_init(void) -{ - return platform_driver_register(&snd_smdk_driver); -} - -module_init(smdk_audio_init); - -static void __exit smdk_audio_exit(void) -{ - platform_driver_unregister(&snd_smdk_driver); -} - -module_exit(smdk_audio_exit); +module_platform_driver(snd_smdk_driver); MODULE_AUTHOR("Sangbeom Kim, "); MODULE_DESCRIPTION("ALSA SoC SMDK WM8994 for PCM"); -- cgit v1.1 From 7b282cbbf3c7bbad20505761a9eadd6d9a7280c7 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 29 Nov 2011 19:47:38 +0800 Subject: ASoC: cs42l73: Fix clear wrong bits in cs42l73_set_dai_fmt What we want is to clear BIT[5:4](PCM_MODE_MASK) and BIT[3](PCM_BIT_ORDER) bits, but current code clears BIT[2:0]. Signed-off-by: Axel Lin Acked-by: Brian Austin Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l73.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 9fd5de7..da3125a 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -1024,7 +1024,8 @@ static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) } if (spc & SPDIF_PCM) { - spc &= (31 << 3); /* Clear PCM mode, set MSB->LSB */ + /* Clear PCM mode, clear PCM_BIT_ORDER bit for MSB->LSB */ + spc &= ~(PCM_MODE_MASK | PCM_BIT_ORDER); switch (format) { case SND_SOC_DAIFMT_DSP_B: if (inv == SND_SOC_DAIFMT_IB_IF) -- cgit v1.1 From 40216ce7aa88c2e70869723a0f5929fdbd4a91c5 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 28 Nov 2011 09:44:17 +0100 Subject: ASoC: Move SigmaDSP firmware loader to ASoC It has been pointed out previously, that the firmware subsystem is not the right place for the SigmaDSP firmware loader. Furthermore the SigmaDSP is currently only used in audio products and we are aiming for better integration into the ASoC framework in the future, with support for ALSA controls for firmware parameters and support dynamic power management as well. So the natural choice for the SigmaDSP firmware loader is the ASoC subsystem. Signed-off-by: Lars-Peter Clausen Acked-by: Mike Frysinger Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 6 +- sound/soc/codecs/Makefile | 2 + sound/soc/codecs/adau1701.c | 2 +- sound/soc/codecs/sigmadsp.c | 154 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/sigmadsp.h | 55 ++++++++++++++++ 5 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 sound/soc/codecs/sigmadsp.c create mode 100644 sound/soc/codecs/sigmadsp.h (limited to 'sound') diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 686f45a..593174c 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -141,7 +141,7 @@ config SND_SOC_AD73311 tristate config SND_SOC_ADAU1701 - select SIGMA + select SND_SOC_SIGMADSP tristate config SND_SOC_ADAU1373 @@ -234,6 +234,10 @@ config SND_SOC_RT5631 config SND_SOC_SGTL5000 tristate +config SND_SOC_SIGMADSP + tristate + select CRC32 + config SND_SOC_SN95031 tristate diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 62b01e4..fa15006 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -33,6 +33,7 @@ snd-soc-rt5631-objs := rt5631.o snd-soc-sgtl5000-objs := sgtl5000.o snd-soc-alc5623-objs := alc5623.o snd-soc-alc5632-objs := alc5632.o +snd-soc-sigmadsp-objs := sigmadsp.o snd-soc-sn95031-objs := sn95031.o snd-soc-spdif-objs := spdif_transciever.o snd-soc-ssm2602-objs := ssm2602.o @@ -134,6 +135,7 @@ obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o +obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o obj-$(CONFIG_SND_SOC_SN95031) +=snd-soc-sn95031.o obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif.o obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index 8b7e1c5..6a6af56 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c @@ -12,13 +12,13 @@ #include #include #include -#include #include #include #include #include #include +#include "sigmadsp.h" #include "adau1701.h" #define ADAU1701_DSPCTRL 0x1c diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c new file mode 100644 index 0000000..acb97a9 --- /dev/null +++ b/sound/soc/codecs/sigmadsp.c @@ -0,0 +1,154 @@ +/* + * Load Analog Devices SigmaStudio firmware files + * + * Copyright 2009-2011 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#include +#include +#include +#include +#include +#include + +#include "sigmadsp.h" + +static size_t sigma_action_size(struct sigma_action *sa) +{ + size_t payload = 0; + + switch (sa->instr) { + case SIGMA_ACTION_WRITEXBYTES: + case SIGMA_ACTION_WRITESINGLE: + case SIGMA_ACTION_WRITESAFELOAD: + payload = sigma_action_len(sa); + break; + default: + break; + } + + payload = ALIGN(payload, 2); + + return payload + sizeof(struct sigma_action); +} + +/* + * Returns a negative error value in case of an error, 0 if processing of + * the firmware should be stopped after this action, 1 otherwise. + */ +static int +process_sigma_action(struct i2c_client *client, struct sigma_action *sa) +{ + size_t len = sigma_action_len(sa); + int ret; + + pr_debug("%s: instr:%i addr:%#x len:%zu\n", __func__, + sa->instr, sa->addr, len); + + switch (sa->instr) { + case SIGMA_ACTION_WRITEXBYTES: + case SIGMA_ACTION_WRITESINGLE: + case SIGMA_ACTION_WRITESAFELOAD: + ret = i2c_master_send(client, (void *)&sa->addr, len); + if (ret < 0) + return -EINVAL; + break; + case SIGMA_ACTION_DELAY: + udelay(len); + len = 0; + break; + case SIGMA_ACTION_END: + return 0; + default: + return -EINVAL; + } + + return 1; +} + +static int +process_sigma_actions(struct i2c_client *client, struct sigma_firmware *ssfw) +{ + struct sigma_action *sa; + size_t size; + int ret; + + while (ssfw->pos + sizeof(*sa) <= ssfw->fw->size) { + sa = (struct sigma_action *)(ssfw->fw->data + ssfw->pos); + + size = sigma_action_size(sa); + ssfw->pos += size; + if (ssfw->pos > ssfw->fw->size || size == 0) + break; + + ret = process_sigma_action(client, sa); + + pr_debug("%s: action returned %i\n", __func__, ret); + + if (ret <= 0) + return ret; + } + + if (ssfw->pos != ssfw->fw->size) + return -EINVAL; + + return 0; +} + +int process_sigma_firmware(struct i2c_client *client, const char *name) +{ + int ret; + struct sigma_firmware_header *ssfw_head; + struct sigma_firmware ssfw; + const struct firmware *fw; + u32 crc; + + pr_debug("%s: loading firmware %s\n", __func__, name); + + /* first load the blob */ + ret = request_firmware(&fw, name, &client->dev); + if (ret) { + pr_debug("%s: request_firmware() failed with %i\n", __func__, ret); + return ret; + } + ssfw.fw = fw; + + /* then verify the header */ + ret = -EINVAL; + + /* + * Reject too small or unreasonable large files. The upper limit has been + * chosen a bit arbitrarily, but it should be enough for all practical + * purposes and having the limit makes it easier to avoid integer + * overflows later in the loading process. + */ + if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000) + goto done; + + ssfw_head = (void *)fw->data; + if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic))) + goto done; + + crc = crc32(0, fw->data + sizeof(*ssfw_head), + fw->size - sizeof(*ssfw_head)); + pr_debug("%s: crc=%x\n", __func__, crc); + if (crc != le32_to_cpu(ssfw_head->crc)) + goto done; + + ssfw.pos = sizeof(*ssfw_head); + + /* finally process all of the actions */ + ret = process_sigma_actions(client, &ssfw); + + done: + release_firmware(fw); + + pr_debug("%s: loaded %s\n", __func__, name); + + return ret; +} +EXPORT_SYMBOL(process_sigma_firmware); + +MODULE_LICENSE("GPL"); diff --git a/sound/soc/codecs/sigmadsp.h b/sound/soc/codecs/sigmadsp.h new file mode 100644 index 0000000..d0de882 --- /dev/null +++ b/sound/soc/codecs/sigmadsp.h @@ -0,0 +1,55 @@ +/* + * Load firmware files from Analog Devices SigmaStudio + * + * Copyright 2009-2011 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#ifndef __SIGMA_FIRMWARE_H__ +#define __SIGMA_FIRMWARE_H__ + +#include +#include + +struct i2c_client; + +#define SIGMA_MAGIC "ADISIGM" + +struct sigma_firmware { + const struct firmware *fw; + size_t pos; +}; + +struct sigma_firmware_header { + unsigned char magic[7]; + u8 version; + __le32 crc; +}; + +enum { + SIGMA_ACTION_WRITEXBYTES = 0, + SIGMA_ACTION_WRITESINGLE, + SIGMA_ACTION_WRITESAFELOAD, + SIGMA_ACTION_DELAY, + SIGMA_ACTION_PLLWAIT, + SIGMA_ACTION_NOOP, + SIGMA_ACTION_END, +}; + +struct sigma_action { + u8 instr; + u8 len_hi; + __le16 len; + __be16 addr; + unsigned char payload[]; +}; + +static inline u32 sigma_action_len(struct sigma_action *sa) +{ + return (sa->len_hi << 16) | le16_to_cpu(sa->len); +} + +extern int process_sigma_firmware(struct i2c_client *client, const char *name); + +#endif -- cgit v1.1 From 48afc5272eec2e1a7cf17aee0d2949810a45994a Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 28 Nov 2011 09:44:18 +0100 Subject: ASoC: SigmaDSP: Provide diagnostic error messages Provide some error messages when loading the firmware fails, so it is possible to diagnose the reason for the failure. Signed-off-by: Lars-Peter Clausen Acked-by: Mike Frysinger Signed-off-by: Mark Brown --- sound/soc/codecs/sigmadsp.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c index acb97a9..c0ad885 100644 --- a/sound/soc/codecs/sigmadsp.c +++ b/sound/soc/codecs/sigmadsp.c @@ -124,18 +124,25 @@ int process_sigma_firmware(struct i2c_client *client, const char *name) * purposes and having the limit makes it easier to avoid integer * overflows later in the loading process. */ - if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000) + if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000) { + dev_err(&client->dev, "Failed to load firmware: Invalid size\n"); goto done; + } ssfw_head = (void *)fw->data; - if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic))) + if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic))) { + dev_err(&client->dev, "Failed to load firmware: Invalid magic\n"); goto done; + } crc = crc32(0, fw->data + sizeof(*ssfw_head), fw->size - sizeof(*ssfw_head)); pr_debug("%s: crc=%x\n", __func__, crc); - if (crc != le32_to_cpu(ssfw_head->crc)) + if (crc != le32_to_cpu(ssfw_head->crc)) { + dev_err(&client->dev, "Failed to load firmware: Wrong crc checksum: expected %x got %x\n", + le32_to_cpu(ssfw_head->crc), crc); goto done; + } ssfw.pos = sizeof(*ssfw_head); -- cgit v1.1 From a4c1d7e66719b326431c6e617da07cab0caedbca Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 28 Nov 2011 09:44:19 +0100 Subject: ASoC: SigmaDSP: Move private structs and functions to C file Move the structs and functions only used by SigmaDSP firmware loader itself from the header to the C file. Signed-off-by: Lars-Peter Clausen Acked-by: Mike Frysinger Signed-off-by: Mark Brown --- sound/soc/codecs/sigmadsp.c | 36 ++++++++++++++++++++++++++++++++++++ sound/soc/codecs/sigmadsp.h | 39 --------------------------------------- 2 files changed, 36 insertions(+), 39 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c index c0ad885..aa223c5 100644 --- a/sound/soc/codecs/sigmadsp.c +++ b/sound/soc/codecs/sigmadsp.c @@ -15,6 +15,42 @@ #include "sigmadsp.h" +#define SIGMA_MAGIC "ADISIGM" + +struct sigma_firmware_header { + unsigned char magic[7]; + u8 version; + __le32 crc; +} __packed; + +enum { + SIGMA_ACTION_WRITEXBYTES = 0, + SIGMA_ACTION_WRITESINGLE, + SIGMA_ACTION_WRITESAFELOAD, + SIGMA_ACTION_DELAY, + SIGMA_ACTION_PLLWAIT, + SIGMA_ACTION_NOOP, + SIGMA_ACTION_END, +}; + +struct sigma_action { + u8 instr; + u8 len_hi; + __le16 len; + __be16 addr; + unsigned char payload[]; +} __packed; + +struct sigma_firmware { + const struct firmware *fw; + size_t pos; +}; + +static inline u32 sigma_action_len(struct sigma_action *sa) +{ + return (sa->len_hi << 16) | le16_to_cpu(sa->len); +} + static size_t sigma_action_size(struct sigma_action *sa) { size_t payload = 0; diff --git a/sound/soc/codecs/sigmadsp.h b/sound/soc/codecs/sigmadsp.h index d0de882..99a6091 100644 --- a/sound/soc/codecs/sigmadsp.h +++ b/sound/soc/codecs/sigmadsp.h @@ -9,47 +9,8 @@ #ifndef __SIGMA_FIRMWARE_H__ #define __SIGMA_FIRMWARE_H__ -#include -#include - struct i2c_client; -#define SIGMA_MAGIC "ADISIGM" - -struct sigma_firmware { - const struct firmware *fw; - size_t pos; -}; - -struct sigma_firmware_header { - unsigned char magic[7]; - u8 version; - __le32 crc; -}; - -enum { - SIGMA_ACTION_WRITEXBYTES = 0, - SIGMA_ACTION_WRITESINGLE, - SIGMA_ACTION_WRITESAFELOAD, - SIGMA_ACTION_DELAY, - SIGMA_ACTION_PLLWAIT, - SIGMA_ACTION_NOOP, - SIGMA_ACTION_END, -}; - -struct sigma_action { - u8 instr; - u8 len_hi; - __le16 len; - __be16 addr; - unsigned char payload[]; -}; - -static inline u32 sigma_action_len(struct sigma_action *sa) -{ - return (sa->len_hi << 16) | le16_to_cpu(sa->len); -} - extern int process_sigma_firmware(struct i2c_client *client, const char *name); #endif -- cgit v1.1 From 38fd54ee38624a52c28d65fadfd452c9c49fb152 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 28 Nov 2011 09:44:20 +0100 Subject: ASoC: SigmaDSP: Add regmap support Add support for loading the SigmaDSP firmware using regmap. This allows us to transparently use SPI or I2C as the transport protocol on devices which support them. For now we keep the old I2C support since we have one user of this which is not straight forward to convert to regmap, due to variable length registers. Signed-off-by: Lars-Peter Clausen Acked-by: Mike Frysinger Signed-off-by: Mark Brown --- sound/soc/codecs/sigmadsp.c | 75 +++++++++++++++++++++++++++++++++++++-------- sound/soc/codecs/sigmadsp.h | 5 +++ 2 files changed, 67 insertions(+), 13 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c index aa223c5..5be42bf 100644 --- a/sound/soc/codecs/sigmadsp.c +++ b/sound/soc/codecs/sigmadsp.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "sigmadsp.h" @@ -44,6 +45,10 @@ struct sigma_action { struct sigma_firmware { const struct firmware *fw; size_t pos; + + void *control_data; + int (*write)(void *control_data, const struct sigma_action *sa, + size_t len); }; static inline u32 sigma_action_len(struct sigma_action *sa) @@ -75,7 +80,7 @@ static size_t sigma_action_size(struct sigma_action *sa) * the firmware should be stopped after this action, 1 otherwise. */ static int -process_sigma_action(struct i2c_client *client, struct sigma_action *sa) +process_sigma_action(struct sigma_firmware *ssfw, struct sigma_action *sa) { size_t len = sigma_action_len(sa); int ret; @@ -87,7 +92,7 @@ process_sigma_action(struct i2c_client *client, struct sigma_action *sa) case SIGMA_ACTION_WRITEXBYTES: case SIGMA_ACTION_WRITESINGLE: case SIGMA_ACTION_WRITESAFELOAD: - ret = i2c_master_send(client, (void *)&sa->addr, len); + ret = ssfw->write(ssfw->control_data, sa, len); if (ret < 0) return -EINVAL; break; @@ -105,7 +110,7 @@ process_sigma_action(struct i2c_client *client, struct sigma_action *sa) } static int -process_sigma_actions(struct i2c_client *client, struct sigma_firmware *ssfw) +process_sigma_actions(struct sigma_firmware *ssfw) { struct sigma_action *sa; size_t size; @@ -119,7 +124,7 @@ process_sigma_actions(struct i2c_client *client, struct sigma_firmware *ssfw) if (ssfw->pos > ssfw->fw->size || size == 0) break; - ret = process_sigma_action(client, sa); + ret = process_sigma_action(ssfw, sa); pr_debug("%s: action returned %i\n", __func__, ret); @@ -133,23 +138,23 @@ process_sigma_actions(struct i2c_client *client, struct sigma_firmware *ssfw) return 0; } -int process_sigma_firmware(struct i2c_client *client, const char *name) +static int _process_sigma_firmware(struct device *dev, + struct sigma_firmware *ssfw, const char *name) { int ret; struct sigma_firmware_header *ssfw_head; - struct sigma_firmware ssfw; const struct firmware *fw; u32 crc; pr_debug("%s: loading firmware %s\n", __func__, name); /* first load the blob */ - ret = request_firmware(&fw, name, &client->dev); + ret = request_firmware(&fw, name, dev); if (ret) { pr_debug("%s: request_firmware() failed with %i\n", __func__, ret); return ret; } - ssfw.fw = fw; + ssfw->fw = fw; /* then verify the header */ ret = -EINVAL; @@ -161,13 +166,13 @@ int process_sigma_firmware(struct i2c_client *client, const char *name) * overflows later in the loading process. */ if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000) { - dev_err(&client->dev, "Failed to load firmware: Invalid size\n"); + dev_err(dev, "Failed to load firmware: Invalid size\n"); goto done; } ssfw_head = (void *)fw->data; if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic))) { - dev_err(&client->dev, "Failed to load firmware: Invalid magic\n"); + dev_err(dev, "Failed to load firmware: Invalid magic\n"); goto done; } @@ -175,15 +180,15 @@ int process_sigma_firmware(struct i2c_client *client, const char *name) fw->size - sizeof(*ssfw_head)); pr_debug("%s: crc=%x\n", __func__, crc); if (crc != le32_to_cpu(ssfw_head->crc)) { - dev_err(&client->dev, "Failed to load firmware: Wrong crc checksum: expected %x got %x\n", + dev_err(dev, "Failed to load firmware: Wrong crc checksum: expected %x got %x\n", le32_to_cpu(ssfw_head->crc), crc); goto done; } - ssfw.pos = sizeof(*ssfw_head); + ssfw->pos = sizeof(*ssfw_head); /* finally process all of the actions */ - ret = process_sigma_actions(client, &ssfw); + ret = process_sigma_actions(ssfw); done: release_firmware(fw); @@ -192,6 +197,50 @@ int process_sigma_firmware(struct i2c_client *client, const char *name) return ret; } + +#if IS_ENABLED(CONFIG_I2C) + +static int sigma_action_write_i2c(void *control_data, + const struct sigma_action *sa, size_t len) +{ + return i2c_master_send(control_data, (const unsigned char *)&sa->addr, + len); +} + +int process_sigma_firmware(struct i2c_client *client, const char *name) +{ + struct sigma_firmware ssfw; + + ssfw.control_data = client; + ssfw.write = sigma_action_write_i2c; + + return _process_sigma_firmware(&client->dev, &ssfw, name); +} EXPORT_SYMBOL(process_sigma_firmware); +#endif + +#if IS_ENABLED(CONFIG_REGMAP) + +static int sigma_action_write_regmap(void *control_data, + const struct sigma_action *sa, size_t len) +{ + return regmap_raw_write(control_data, le16_to_cpu(sa->addr), + sa->payload, len - 2); +} + +int process_sigma_firmware_regmap(struct device *dev, struct regmap *regmap, + const char *name) +{ + struct sigma_firmware ssfw; + + ssfw.control_data = regmap; + ssfw.write = sigma_action_write_regmap; + + return _process_sigma_firmware(dev, &ssfw, name); +} +EXPORT_SYMBOL(process_sigma_firmware_regmap); + +#endif + MODULE_LICENSE("GPL"); diff --git a/sound/soc/codecs/sigmadsp.h b/sound/soc/codecs/sigmadsp.h index 99a6091..e439cbd 100644 --- a/sound/soc/codecs/sigmadsp.h +++ b/sound/soc/codecs/sigmadsp.h @@ -9,8 +9,13 @@ #ifndef __SIGMA_FIRMWARE_H__ #define __SIGMA_FIRMWARE_H__ +#include +#include + struct i2c_client; extern int process_sigma_firmware(struct i2c_client *client, const char *name); +extern int process_sigma_firmware_regmap(struct device *dev, + struct regmap *regmap, const char *name); #endif -- cgit v1.1 From 4cdf5e49ce8ff79038ee5388cc5f97097238bb29 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 29 Nov 2011 14:36:17 +0000 Subject: ASoC: Ensure SYSCLK is enabled for WM8958 accessory detection Ensure SYSCLK is enabled while running accessory detection on WM8958. It is always required so there is no sense in requiring machine drivers to individually do this. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 5ea0c3c..0a16de7 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3016,6 +3016,8 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, cb_data = codec; } + snd_soc_dapm_force_enable_pin(&codec->dapm, "CLK_SYS"); + wm8994->micdet[0].jack = jack; wm8994->jack_cb = cb; wm8994->jack_cb_data = cb_data; @@ -3025,6 +3027,7 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, } else { snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, WM8958_MICD_ENA, 0); + snd_soc_dapm_disable_pin(&codec->dapm, "CLK_SYS"); } return 0; -- cgit v1.1 From 9b8f5695a155308a4e0355a29747961bec9757c0 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 27 Nov 2011 21:35:40 +0000 Subject: ASoC: Fix __iomem annotation for IDMA registers We always store the register address as __iomem but pass it around as a plain void * which upsets sparse. Signed-off-by: Mark Brown --- sound/soc/samsung/i2s.c | 2 +- sound/soc/samsung/idma.c | 2 +- sound/soc/samsung/idma.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index fb80f28..5de500c 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -881,7 +881,7 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai) writel(CON_RSTCLR, i2s->addr + I2SCON); if (i2s->quirks & QUIRK_SEC_DAI) - idma_reg_addr_init((void *)i2s->addr, + idma_reg_addr_init(i2s->addr, i2s->sec_dai->idma_playback.dma_addr); probe_exit: diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c index 6ca3d8c..baf97eb 100644 --- a/sound/soc/samsung/idma.c +++ b/sound/soc/samsung/idma.c @@ -403,7 +403,7 @@ static int idma_new(struct snd_soc_pcm_runtime *rtd) return ret; } -void idma_reg_addr_init(void *regs, dma_addr_t addr) +void idma_reg_addr_init(void __iomem *regs, dma_addr_t addr) { spin_lock_init(&idma.lock); idma.regs = regs; diff --git a/sound/soc/samsung/idma.h b/sound/soc/samsung/idma.h index 4827321..8644946 100644 --- a/sound/soc/samsung/idma.h +++ b/sound/soc/samsung/idma.h @@ -14,7 +14,7 @@ #ifndef __SND_SOC_SAMSUNG_IDMA_H_ #define __SND_SOC_SAMSUNG_IDMA_H_ -extern void idma_reg_addr_init(void *regs, dma_addr_t addr); +extern void idma_reg_addr_init(void __iomem *regs, dma_addr_t addr); /* dma_state */ #define LPAM_DMA_STOP 0 -- cgit v1.1 From 500fa30ed5795a1d8e8539d0cd81f73b34f831a3 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 29 Nov 2011 19:58:19 +0000 Subject: ASoC: Put WM8958 and WM1811 MICBIAS into bypass mode when no audio When we don't have any active audio we can put the microphone biases into bypass mode to save power at the expense of performance. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 0a16de7..207bccd 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -2025,6 +2025,18 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_PREPARE: + /* MICBIAS into regulating mode */ + switch (control->type) { + case WM8958: + case WM1811: + snd_soc_update_bits(codec, WM8958_MICBIAS1, + WM8958_MICB1_MODE, 0); + snd_soc_update_bits(codec, WM8958_MICBIAS2, + WM8958_MICB2_MODE, 0); + break; + default: + break; + } break; case SND_SOC_BIAS_STANDBY: @@ -2077,7 +2089,20 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, WM8994_LINEOUT2_DISCH); } - + /* MICBIAS into bypass mode on newer devices */ + switch (control->type) { + case WM8958: + case WM1811: + snd_soc_update_bits(codec, WM8958_MICBIAS1, + WM8958_MICB1_MODE, + WM8958_MICB1_MODE); + snd_soc_update_bits(codec, WM8958_MICBIAS2, + WM8958_MICB2_MODE, + WM8958_MICB2_MODE); + break; + default: + break; + } break; case SND_SOC_BIAS_OFF: @@ -3371,6 +3396,19 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) break; } + /* Put MICBIAS into bypass mode by default on newer devices */ + switch (control->type) { + case WM8958: + case WM1811: + snd_soc_update_bits(codec, WM8958_MICBIAS1, + WM8958_MICB1_MODE, WM8958_MICB1_MODE); + snd_soc_update_bits(codec, WM8958_MICBIAS2, + WM8958_MICB2_MODE, WM8958_MICB2_MODE); + break; + default: + break; + } + wm8994_update_class_w(codec); wm8994_handle_pdata(wm8994); -- cgit v1.1 From b00adf76a6fa492c39f8225fc42debc01bbbdc1d Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 13 Aug 2011 11:57:18 +0900 Subject: ASoC: Enhance default WM8958 microphone detection Actively manage the detection rate for microphones with WM8958, providing improved power consumption and maximising the benefit from the hardware debounce. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 120 +++++++++++++++++++++++++++++++++++++++++----- sound/soc/codecs/wm8994.h | 2 + 2 files changed, 111 insertions(+), 11 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 207bccd..027bf68 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -53,6 +53,56 @@ static int wm8994_retune_mobile_base[] = { WM8994_AIF2_EQ_GAINS_1, }; +static void wm8958_default_micdet(u16 status, void *data); + +static const struct { + int sysclk; + bool idle; + int start; + int rate; +} wm8958_micd_rates[] = { + { 32768, true, 1, 4 }, + { 32768, false, 1, 1 }, + { 44100 * 256, true, 7, 6 }, + { 44100 * 256, false, 7, 6 }, +}; + +static void wm8958_micd_set_rate(struct snd_soc_codec *codec) +{ + struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); + int best, i, sysclk, val; + bool idle; + + if (wm8994->jack_cb != wm8958_default_micdet) + return; + + idle = !wm8994->jack_mic; + + sysclk = snd_soc_read(codec, WM8994_CLOCKING_1); + if (sysclk & WM8994_SYSCLK_SRC) + sysclk = wm8994->aifclk[1]; + else + sysclk = wm8994->aifclk[0]; + + best = 0; + for (i = 0; i < ARRAY_SIZE(wm8958_micd_rates); i++) { + if (wm8958_micd_rates[i].idle != idle) + continue; + if (abs(wm8958_micd_rates[i].sysclk - sysclk) < + abs(wm8958_micd_rates[best].sysclk - sysclk)) + best = i; + else if (wm8958_micd_rates[best].idle != idle) + best = i; + } + + val = wm8958_micd_rates[best].start << WM8958_MICD_BIAS_STARTTIME_SHIFT + | wm8958_micd_rates[best].rate << WM8958_MICD_RATE_SHIFT; + + snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, + WM8958_MICD_BIAS_STARTTIME_MASK | + WM8958_MICD_RATE_MASK, val); +} + static int wm8994_readable(struct snd_soc_codec *codec, unsigned int reg) { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); @@ -221,8 +271,10 @@ static int configure_clock(struct snd_soc_codec *codec) */ /* If they're equal it doesn't matter which is used */ - if (wm8994->aifclk[0] == wm8994->aifclk[1]) + if (wm8994->aifclk[0] == wm8994->aifclk[1]) { + wm8958_micd_set_rate(codec); return 0; + } if (wm8994->aifclk[0] < wm8994->aifclk[1]) new = WM8994_SYSCLK_SRC; @@ -236,6 +288,8 @@ static int configure_clock(struct snd_soc_codec *codec) snd_soc_dapm_sync(&codec->dapm); + wm8958_micd_set_rate(codec); + return 0; } @@ -2987,21 +3041,56 @@ static void wm8958_default_micdet(u16 status, void *data) { struct snd_soc_codec *codec = data; struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); - int report = 0; /* If nothing present then clear our statuses */ - if (!(status & WM8958_MICD_STS)) - goto done; + if (!(status & WM8958_MICD_STS)) { + dev_dbg(codec->dev, "Detected open circuit\n"); + wm8994->jack_mic = false; + wm8994->detecting = true; + + wm8958_micd_set_rate(codec); - report = SND_JACK_MICROPHONE; + snd_soc_jack_report(wm8994->micdet[0].jack, 0, + SND_JACK_BTN_0 | SND_JACK_HEADSET); + + return; + } - /* Everything else is buttons; just assign slots */ - if (status & 0x1c) - report |= SND_JACK_BTN_0; + /* If the measurement is showing a high impedence we've got a + * microphone. + */ + if (wm8994->detecting && (status & 0x600)) { + dev_dbg(codec->dev, "Detected microphone\n"); + + wm8994->detecting = false; + wm8994->jack_mic = true; + + wm8958_micd_set_rate(codec); + + snd_soc_jack_report(wm8994->micdet[0].jack, SND_JACK_HEADSET, + SND_JACK_HEADSET); + } -done: - snd_soc_jack_report(wm8994->micdet[0].jack, report, - SND_JACK_BTN_0 | SND_JACK_MICROPHONE); + + if (wm8994->detecting && status & 0x4) { + dev_dbg(codec->dev, "Detected headphone\n"); + wm8994->detecting = false; + + wm8958_micd_set_rate(codec); + + snd_soc_jack_report(wm8994->micdet[0].jack, SND_JACK_HEADPHONE, + SND_JACK_HEADSET); + } + + /* Report short circuit as a button */ + if (wm8994->jack_mic) { + if (status & 0x4) + snd_soc_jack_report(wm8994->micdet[0].jack, + SND_JACK_BTN_0, SND_JACK_BTN_0); + else + snd_soc_jack_report(wm8994->micdet[0].jack, + 0, SND_JACK_BTN_0); + } } /** @@ -3047,6 +3136,15 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, wm8994->jack_cb = cb; wm8994->jack_cb_data = cb_data; + wm8994->detecting = true; + wm8994->jack_mic = false; + + wm8958_micd_set_rate(codec); + + /* Detect microphones and short circuits */ + snd_soc_update_bits(codec, WM8958_MIC_DETECT_2, + WM8958_MICD_LVL_SEL_MASK, 0x41); + snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, WM8958_MICD_ENA, WM8958_MICD_ENA); } else { diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index f4f1355..1087425 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h @@ -126,6 +126,8 @@ struct wm8994_priv { struct soc_enum enh_eq_enum; struct wm8994_micdet micdet[2]; + bool detecting; + bool jack_mic; wm8958_micdet_cb jack_cb; void *jack_cb_data; -- cgit v1.1 From bf55499e6ee927e047feed85349365481289bd75 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 29 Nov 2011 18:36:48 -0700 Subject: ASoC: Tegra I2S: Add device tree binding Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/tegra_i2s.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c index ca4d0c0..33509de 100644 --- a/sound/soc/tegra/tegra_i2s.c +++ b/sound/soc/tegra/tegra_i2s.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -331,6 +332,8 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) { struct tegra_i2s * i2s; struct resource *mem, *memregion, *dmareq; + u32 of_dma[2]; + u32 dma_ch; int ret; i2s = devm_kzalloc(&pdev->dev, sizeof(struct tegra_i2s), GFP_KERNEL); @@ -360,9 +363,16 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) dmareq = platform_get_resource(pdev, IORESOURCE_DMA, 0); if (!dmareq) { - dev_err(&pdev->dev, "No DMA resource\n"); - ret = -ENODEV; - goto err_clk_put; + if (of_property_read_u32_array(pdev->dev.of_node, + "nvidia,dma-request-selector", + of_dma, 2) < 0) { + dev_err(&pdev->dev, "No DMA resource\n"); + ret = -ENODEV; + goto err_clk_put; + } + dma_ch = of_dma[1]; + } else { + dma_ch = dmareq->start; } memregion = devm_request_mem_region(&pdev->dev, mem->start, @@ -383,12 +393,12 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) i2s->capture_dma_data.addr = mem->start + TEGRA_I2S_FIFO2; i2s->capture_dma_data.wrap = 4; i2s->capture_dma_data.width = 32; - i2s->capture_dma_data.req_sel = dmareq->start; + i2s->capture_dma_data.req_sel = dma_ch; i2s->playback_dma_data.addr = mem->start + TEGRA_I2S_FIFO1; i2s->playback_dma_data.wrap = 4; i2s->playback_dma_data.width = 32; - i2s->playback_dma_data.req_sel = dmareq->start; + i2s->playback_dma_data.req_sel = dma_ch; i2s->reg_ctrl = TEGRA_I2S_CTRL_FIFO_FORMAT_PACKED; @@ -422,10 +432,16 @@ static int __devexit tegra_i2s_platform_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id tegra_i2s_of_match[] __devinitconst = { + { .compatible = "nvidia,tegra20-i2s", }, + {}, +}; + static struct platform_driver tegra_i2s_driver = { .driver = { .name = DRV_NAME, .owner = THIS_MODULE, + .of_match_table = tegra_i2s_of_match, }, .probe = tegra_i2s_platform_probe, .remove = __devexit_p(tegra_i2s_platform_remove), @@ -436,3 +452,4 @@ MODULE_AUTHOR("Stephen Warren "); MODULE_DESCRIPTION("Tegra I2S ASoC driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:" DRV_NAME); +MODULE_DEVICE_TABLE(of, tegra_i2s_of_match); -- cgit v1.1 From 6414261f0a2af00c6ffc80f847e9202344360bb4 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 30 Nov 2011 13:30:27 +0000 Subject: ASoC: Rename Speyside WM8962 to Tobermory All the other machine drivers for non-default configurations are named after the relevant audio module so do so for Tobermory also. Signed-off-by: Mark Brown --- sound/soc/samsung/Kconfig | 4 +- sound/soc/samsung/Makefile | 4 +- sound/soc/samsung/speyside_wm8962.c | 257 ------------------------------------ sound/soc/samsung/tobermory.c | 257 ++++++++++++++++++++++++++++++++++++ 4 files changed, 261 insertions(+), 261 deletions(-) delete mode 100644 sound/soc/samsung/speyside_wm8962.c create mode 100644 sound/soc/samsung/tobermory.c (limited to 'sound') diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index 7aaaf8e..09d636c 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -193,8 +193,8 @@ config SND_SOC_SPEYSIDE select SND_SOC_WM9081 select SND_SOC_WM1250_EV1 -config SND_SOC_SPEYSIDE_WM8962 - tristate "Audio support for Wolfson Speyside with WM8962" +config SND_SOC_TOBERMORY + tristate "Audio support for Wolfson Tobermory" depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 select SND_SAMSUNG_I2S select SND_SOC_WM8962 diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index c9564e3..9d03beb 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile @@ -39,7 +39,7 @@ snd-soc-smdk-spdif-objs := smdk_spdif.o snd-soc-smdk-wm8580pcm-objs := smdk_wm8580pcm.o snd-soc-smdk-wm8994pcm-objs := smdk_wm8994pcm.o snd-soc-speyside-objs := speyside.o -snd-soc-speyside-wm8962-objs := speyside_wm8962.o +snd-soc-tobermory-objs := tobermory.o snd-soc-lowland-objs := lowland.o snd-soc-littlemill-objs := littlemill.o @@ -62,6 +62,6 @@ obj-$(CONFIG_SND_SOC_GONI_AQUILA_WM8994) += snd-soc-goni-wm8994.o obj-$(CONFIG_SND_SOC_SMDK_WM8580_PCM) += snd-soc-smdk-wm8580pcm.o obj-$(CONFIG_SND_SOC_SMDK_WM8994_PCM) += snd-soc-smdk-wm8994pcm.o obj-$(CONFIG_SND_SOC_SPEYSIDE) += snd-soc-speyside.o -obj-$(CONFIG_SND_SOC_SPEYSIDE_WM8962) += snd-soc-speyside-wm8962.o +obj-$(CONFIG_SND_SOC_TOBERMORY) += snd-soc-tobermory.o obj-$(CONFIG_SND_SOC_LOWLAND) += snd-soc-lowland.o obj-$(CONFIG_SND_SOC_LITTLEMILL) += snd-soc-littlemill.o diff --git a/sound/soc/samsung/speyside_wm8962.c b/sound/soc/samsung/speyside_wm8962.c deleted file mode 100644 index c09648e..0000000 --- a/sound/soc/samsung/speyside_wm8962.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Speyside with WM8962 audio support - * - * Copyright 2011 Wolfson Microelectronics - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include -#include -#include -#include -#include - -#include "../codecs/wm8962.h" - -static int sample_rate = 44100; - -static int speyside_wm8962_set_bias_level(struct snd_soc_card *card, - struct snd_soc_dapm_context *dapm, - enum snd_soc_bias_level level) -{ - struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; - int ret; - - if (dapm->dev != codec_dai->dev) - return 0; - - switch (level) { - case SND_SOC_BIAS_PREPARE: - if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { - ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL, - WM8962_FLL_MCLK, 32768, - sample_rate * 512); - if (ret < 0) - pr_err("Failed to start FLL: %d\n", ret); - - ret = snd_soc_dai_set_sysclk(codec_dai, - WM8962_SYSCLK_FLL, - sample_rate * 512, - SND_SOC_CLOCK_IN); - if (ret < 0) { - pr_err("Failed to set SYSCLK: %d\n", ret); - return ret; - } - } - break; - - default: - break; - } - - return 0; -} - -static int speyside_wm8962_set_bias_level_post(struct snd_soc_card *card, - struct snd_soc_dapm_context *dapm, - enum snd_soc_bias_level level) -{ - struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; - int ret; - - if (dapm->dev != codec_dai->dev) - return 0; - - switch (level) { - case SND_SOC_BIAS_STANDBY: - ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK, - 32768, SND_SOC_CLOCK_IN); - if (ret < 0) { - pr_err("Failed to switch away from FLL: %d\n", ret); - return ret; - } - - ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL, - 0, 0, 0); - if (ret < 0) { - pr_err("Failed to stop FLL: %d\n", ret); - return ret; - } - break; - - default: - break; - } - - dapm->bias_level = level; - - return 0; -} - -static int speyside_wm8962_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - sample_rate = params_rate(params); - - return 0; -} - -static struct snd_soc_ops speyside_wm8962_ops = { - .hw_params = speyside_wm8962_hw_params, -}; - -static struct snd_soc_dai_link speyside_wm8962_dai[] = { - { - .name = "CPU", - .stream_name = "CPU", - .cpu_dai_name = "samsung-i2s.0", - .codec_dai_name = "wm8962", - .platform_name = "samsung-audio", - .codec_name = "wm8962.1-001a", - .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF - | SND_SOC_DAIFMT_CBM_CFM, - .ops = &speyside_wm8962_ops, - }, -}; - -static const struct snd_kcontrol_new controls[] = { - SOC_DAPM_PIN_SWITCH("Main Speaker"), - SOC_DAPM_PIN_SWITCH("DMIC"), -}; - -static struct snd_soc_dapm_widget widgets[] = { - SND_SOC_DAPM_HP("Headphone", NULL), - SND_SOC_DAPM_MIC("Headset Mic", NULL), - - SND_SOC_DAPM_MIC("DMIC", NULL), - SND_SOC_DAPM_MIC("AMIC", NULL), - - SND_SOC_DAPM_SPK("Main Speaker", NULL), -}; - -static struct snd_soc_dapm_route audio_paths[] = { - { "Headphone", NULL, "HPOUTL" }, - { "Headphone", NULL, "HPOUTR" }, - - { "Main Speaker", NULL, "SPKOUTL" }, - { "Main Speaker", NULL, "SPKOUTR" }, - - { "Headset Mic", NULL, "MICBIAS" }, - { "IN4L", NULL, "Headset Mic" }, - { "IN4R", NULL, "Headset Mic" }, - - { "AMIC", NULL, "MICBIAS" }, - { "IN1L", NULL, "AMIC" }, - { "IN1R", NULL, "AMIC" }, - - { "DMIC", NULL, "MICBIAS" }, - { "DMICDAT", NULL, "DMIC" }, -}; - -static struct snd_soc_jack speyside_wm8962_headset; - -/* Headset jack detection DAPM pins */ -static struct snd_soc_jack_pin speyside_wm8962_headset_pins[] = { - { - .pin = "Headset Mic", - .mask = SND_JACK_MICROPHONE, - }, - { - .pin = "Headphone", - .mask = SND_JACK_MICROPHONE, - }, -}; - -static int speyside_wm8962_late_probe(struct snd_soc_card *card) -{ - struct snd_soc_codec *codec = card->rtd[0].codec; - struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; - int ret; - - ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK, - 32768, SND_SOC_CLOCK_IN); - if (ret < 0) - return ret; - - ret = snd_soc_jack_new(codec, "Headset", - SND_JACK_HEADSET | SND_JACK_BTN_0, - &speyside_wm8962_headset); - if (ret) - return ret; - - ret = snd_soc_jack_add_pins(&speyside_wm8962_headset, - ARRAY_SIZE(speyside_wm8962_headset_pins), - speyside_wm8962_headset_pins); - if (ret) - return ret; - - wm8962_mic_detect(codec, &speyside_wm8962_headset); - - return 0; -} - -static struct snd_soc_card speyside_wm8962 = { - .name = "Speyside WM8962", - .dai_link = speyside_wm8962_dai, - .num_links = ARRAY_SIZE(speyside_wm8962_dai), - - .set_bias_level = speyside_wm8962_set_bias_level, - .set_bias_level_post = speyside_wm8962_set_bias_level_post, - - .controls = controls, - .num_controls = ARRAY_SIZE(controls), - .dapm_widgets = widgets, - .num_dapm_widgets = ARRAY_SIZE(widgets), - .dapm_routes = audio_paths, - .num_dapm_routes = ARRAY_SIZE(audio_paths), - .fully_routed = true, - - .late_probe = speyside_wm8962_late_probe, -}; - -static __devinit int speyside_wm8962_probe(struct platform_device *pdev) -{ - struct snd_soc_card *card = &speyside_wm8962; - int ret; - - card->dev = &pdev->dev; - - ret = snd_soc_register_card(card); - if (ret) { - dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", - ret); - return ret; - } - - return 0; -} - -static int __devexit speyside_wm8962_remove(struct platform_device *pdev) -{ - struct snd_soc_card *card = platform_get_drvdata(pdev); - - snd_soc_unregister_card(card); - - return 0; -} - -static struct platform_driver speyside_wm8962_driver = { - .driver = { - .name = "speyside-wm8962", - .owner = THIS_MODULE, - .pm = &snd_soc_pm_ops, - }, - .probe = speyside_wm8962_probe, - .remove = __devexit_p(speyside_wm8962_remove), -}; - -module_platform_driver(speyside_wm8962_driver); - -MODULE_DESCRIPTION("Speyside WM8962 audio support"); -MODULE_AUTHOR("Mark Brown "); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:speyside-wm8962"); diff --git a/sound/soc/samsung/tobermory.c b/sound/soc/samsung/tobermory.c new file mode 100644 index 0000000..6f91c65 --- /dev/null +++ b/sound/soc/samsung/tobermory.c @@ -0,0 +1,257 @@ +/* + * Tobermory audio support + * + * Copyright 2011 Wolfson Microelectronics + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#include +#include +#include +#include +#include + +#include "../codecs/wm8962.h" + +static int sample_rate = 44100; + +static int tobermory_set_bias_level(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level) +{ + struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; + int ret; + + if (dapm->dev != codec_dai->dev) + return 0; + + switch (level) { + case SND_SOC_BIAS_PREPARE: + if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { + ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL, + WM8962_FLL_MCLK, 32768, + sample_rate * 512); + if (ret < 0) + pr_err("Failed to start FLL: %d\n", ret); + + ret = snd_soc_dai_set_sysclk(codec_dai, + WM8962_SYSCLK_FLL, + sample_rate * 512, + SND_SOC_CLOCK_IN); + if (ret < 0) { + pr_err("Failed to set SYSCLK: %d\n", ret); + return ret; + } + } + break; + + default: + break; + } + + return 0; +} + +static int tobermory_set_bias_level_post(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level) +{ + struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; + int ret; + + if (dapm->dev != codec_dai->dev) + return 0; + + switch (level) { + case SND_SOC_BIAS_STANDBY: + ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK, + 32768, SND_SOC_CLOCK_IN); + if (ret < 0) { + pr_err("Failed to switch away from FLL: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_pll(codec_dai, WM8962_FLL, + 0, 0, 0); + if (ret < 0) { + pr_err("Failed to stop FLL: %d\n", ret); + return ret; + } + break; + + default: + break; + } + + dapm->bias_level = level; + + return 0; +} + +static int tobermory_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + sample_rate = params_rate(params); + + return 0; +} + +static struct snd_soc_ops tobermory_ops = { + .hw_params = tobermory_hw_params, +}; + +static struct snd_soc_dai_link tobermory_dai[] = { + { + .name = "CPU", + .stream_name = "CPU", + .cpu_dai_name = "samsung-i2s.0", + .codec_dai_name = "wm8962", + .platform_name = "samsung-audio", + .codec_name = "wm8962.1-001a", + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF + | SND_SOC_DAIFMT_CBM_CFM, + .ops = &tobermory_ops, + }, +}; + +static const struct snd_kcontrol_new controls[] = { + SOC_DAPM_PIN_SWITCH("Main Speaker"), + SOC_DAPM_PIN_SWITCH("DMIC"), +}; + +static struct snd_soc_dapm_widget widgets[] = { + SND_SOC_DAPM_HP("Headphone", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), + + SND_SOC_DAPM_MIC("DMIC", NULL), + SND_SOC_DAPM_MIC("AMIC", NULL), + + SND_SOC_DAPM_SPK("Main Speaker", NULL), +}; + +static struct snd_soc_dapm_route audio_paths[] = { + { "Headphone", NULL, "HPOUTL" }, + { "Headphone", NULL, "HPOUTR" }, + + { "Main Speaker", NULL, "SPKOUTL" }, + { "Main Speaker", NULL, "SPKOUTR" }, + + { "Headset Mic", NULL, "MICBIAS" }, + { "IN4L", NULL, "Headset Mic" }, + { "IN4R", NULL, "Headset Mic" }, + + { "AMIC", NULL, "MICBIAS" }, + { "IN1L", NULL, "AMIC" }, + { "IN1R", NULL, "AMIC" }, + + { "DMIC", NULL, "MICBIAS" }, + { "DMICDAT", NULL, "DMIC" }, +}; + +static struct snd_soc_jack tobermory_headset; + +/* Headset jack detection DAPM pins */ +static struct snd_soc_jack_pin tobermory_headset_pins[] = { + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, + { + .pin = "Headphone", + .mask = SND_JACK_MICROPHONE, + }, +}; + +static int tobermory_late_probe(struct snd_soc_card *card) +{ + struct snd_soc_codec *codec = card->rtd[0].codec; + struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; + int ret; + + ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK, + 32768, SND_SOC_CLOCK_IN); + if (ret < 0) + return ret; + + ret = snd_soc_jack_new(codec, "Headset", + SND_JACK_HEADSET | SND_JACK_BTN_0, + &tobermory_headset); + if (ret) + return ret; + + ret = snd_soc_jack_add_pins(&tobermory_headset, + ARRAY_SIZE(tobermory_headset_pins), + tobermory_headset_pins); + if (ret) + return ret; + + wm8962_mic_detect(codec, &tobermory_headset); + + return 0; +} + +static struct snd_soc_card tobermory = { + .name = "Tobermory", + .dai_link = tobermory_dai, + .num_links = ARRAY_SIZE(tobermory_dai), + + .set_bias_level = tobermory_set_bias_level, + .set_bias_level_post = tobermory_set_bias_level_post, + + .controls = controls, + .num_controls = ARRAY_SIZE(controls), + .dapm_widgets = widgets, + .num_dapm_widgets = ARRAY_SIZE(widgets), + .dapm_routes = audio_paths, + .num_dapm_routes = ARRAY_SIZE(audio_paths), + .fully_routed = true, + + .late_probe = tobermory_late_probe, +}; + +static __devinit int tobermory_probe(struct platform_device *pdev) +{ + struct snd_soc_card *card = &tobermory; + int ret; + + card->dev = &pdev->dev; + + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); + return ret; + } + + return 0; +} + +static int __devexit tobermory_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + + return 0; +} + +static struct platform_driver tobermory_driver = { + .driver = { + .name = "tobermory", + .owner = THIS_MODULE, + .pm = &snd_soc_pm_ops, + }, + .probe = tobermory_probe, + .remove = __devexit_p(tobermory_remove), +}; + +module_platform_driver(tobermory_driver); + +MODULE_DESCRIPTION("Tobermory audio support"); +MODULE_AUTHOR("Mark Brown "); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:tobermory"); -- cgit v1.1 From a1691343a397157dd5f67bce50435f64024a462d Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 30 Nov 2011 14:56:40 +0000 Subject: ASoC: Provide debug log of accessory status on WM8958 Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 027bf68..16e2bd7 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3042,6 +3042,8 @@ static void wm8958_default_micdet(u16 status, void *data) struct snd_soc_codec *codec = data; struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); + dev_dbg(codec->dev, "MICDET %x\n", status); + /* If nothing present then clear our statuses */ if (!(status & WM8958_MICD_STS)) { dev_dbg(codec->dev, "Detected open circuit\n"); -- cgit v1.1 From 2a8a856d427fea68a5d538adf52edae4cdbb246b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 24 Jul 2011 12:20:41 +0100 Subject: ASoC: Don't use control_data to get struct wm8994 This will support refactoring to make use of the regmap API more directly in the core. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 72 +++++++++++++++++++++++++---------------------- sound/soc/codecs/wm8994.h | 5 ++-- 2 files changed, 41 insertions(+), 36 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 16e2bd7..d36b62b 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -106,7 +106,7 @@ static void wm8958_micd_set_rate(struct snd_soc_codec *codec) static int wm8994_readable(struct snd_soc_codec *codec, unsigned int reg) { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); - struct wm8994 *control = codec->control_data; + struct wm8994 *control = wm8994->wm8994; switch (reg) { case WM8994_GPIO_1: @@ -1822,7 +1822,7 @@ static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src, unsigned int freq_in, unsigned int freq_out) { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); - struct wm8994 *control = codec->control_data; + struct wm8994 *control = wm8994->wm8994; int reg_offset, ret; struct fll_div fll; u16 reg, aif1, aif2; @@ -2071,8 +2071,8 @@ static int wm8994_set_dai_sysclk(struct snd_soc_dai *dai, static int wm8994_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { - struct wm8994 *control = codec->control_data; struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); + struct wm8994 *control = wm8994->wm8994; switch (level) { case SND_SOC_BIAS_ON: @@ -2174,7 +2174,8 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, static int wm8994_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) { struct snd_soc_codec *codec = dai->codec; - struct wm8994 *control = codec->control_data; + struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); + struct wm8994 *control = wm8994->wm8994; int ms_reg; int aif1_reg; int ms = 0; @@ -2474,7 +2475,8 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct snd_soc_codec *codec = dai->codec; - struct wm8994 *control = codec->control_data; + struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); + struct wm8994 *control = wm8994->wm8994; int aif1_reg; int aif1 = 0; @@ -2705,7 +2707,7 @@ static struct snd_soc_dai_driver wm8994_dai[] = { static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state) { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); - struct wm8994 *control = codec->control_data; + struct wm8994 *control = wm8994->wm8994; int i, ret; switch (control->type) { @@ -2736,7 +2738,7 @@ static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state) static int wm8994_resume(struct snd_soc_codec *codec) { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); - struct wm8994 *control = codec->control_data; + struct wm8994 *control = wm8994->wm8994; int i, ret; unsigned int val, mask; @@ -2958,7 +2960,7 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994_micdet *micdet; - struct wm8994 *control = codec->control_data; + struct wm8994 *control = wm8994->wm8994; int reg; if (control->type != WM8994) @@ -3115,7 +3117,7 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, wm8958_micdet_cb cb, void *cb_data) { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); - struct wm8994 *control = codec->control_data; + struct wm8994 *control = wm8994->wm8994; switch (control->type) { case WM1811: @@ -3247,6 +3249,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) return -ENOMEM; snd_soc_codec_set_drvdata(codec, wm8994); + + wm8994->wm8994 = dev_get_drvdata(codec->dev->parent); wm8994->pdata = dev_get_platdata(codec->dev->parent); wm8994->codec = codec; @@ -3328,14 +3332,14 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) break; } - wm8994_request_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR, + wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, wm8994_fifo_error, "FIFO error", codec); - wm8994_request_irq(codec->control_data, WM8994_IRQ_TEMP_WARN, + wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, wm8994_temp_warn, "Thermal warning", codec); - wm8994_request_irq(codec->control_data, WM8994_IRQ_TEMP_SHUT, + wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, wm8994_temp_shut, "Thermal shutdown", codec); - ret = wm8994_request_irq(codec->control_data, WM8994_IRQ_DCS_DONE, + ret = wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE, wm_hubs_dcs_done, "DC servo done", &wm8994->hubs); if (ret == 0) @@ -3355,7 +3359,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) ret); } - ret = wm8994_request_irq(codec->control_data, + ret = wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT, wm8994_mic_irq, "Mic 1 short", wm8994); @@ -3364,7 +3368,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) "Failed to request Mic1 short IRQ: %d\n", ret); - ret = wm8994_request_irq(codec->control_data, + ret = wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_MIC2_DET, wm8994_mic_irq, "Mic 2 detect", wm8994); @@ -3373,7 +3377,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) "Failed to request Mic2 detect IRQ: %d\n", ret); - ret = wm8994_request_irq(codec->control_data, + ret = wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_MIC2_SHRT, wm8994_mic_irq, "Mic 2 short", wm8994); @@ -3400,7 +3404,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) wm8994->fll_locked_irq = true; for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) { - ret = wm8994_request_irq(codec->control_data, + ret = wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i, wm8994_fll_locked_irq, "FLL lock", &wm8994->fll_locked[i]); @@ -3620,19 +3624,19 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) return 0; err_irq: - wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_SHRT, wm8994); - wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_DET, wm8994); - wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_SHRT, wm8994); + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_SHRT, wm8994); + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_DET, wm8994); + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT, wm8994); if (wm8994->micdet_irq) free_irq(wm8994->micdet_irq, wm8994); for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) - wm8994_free_irq(codec->control_data, WM8994_IRQ_FLL1_LOCK + i, + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i, &wm8994->fll_locked[i]); - wm8994_free_irq(codec->control_data, WM8994_IRQ_DCS_DONE, + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE, &wm8994->hubs); - wm8994_free_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR, codec); - wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_SHUT, codec); - wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_WARN, codec); + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec); + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec); + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec); err: kfree(wm8994); return ret; @@ -3641,7 +3645,7 @@ err: static int wm8994_codec_remove(struct snd_soc_codec *codec) { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); - struct wm8994 *control = codec->control_data; + struct wm8994 *control = wm8994->wm8994; int i; wm8994_set_bias_level(codec, SND_SOC_BIAS_OFF); @@ -3649,24 +3653,24 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec) pm_runtime_disable(codec->dev); for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) - wm8994_free_irq(codec->control_data, WM8994_IRQ_FLL1_LOCK + i, + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i, &wm8994->fll_locked[i]); - wm8994_free_irq(codec->control_data, WM8994_IRQ_DCS_DONE, + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE, &wm8994->hubs); - wm8994_free_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR, codec); - wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_SHUT, codec); - wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_WARN, codec); + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec); + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec); + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec); switch (control->type) { case WM8994: if (wm8994->micdet_irq) free_irq(wm8994->micdet_irq, wm8994); - wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_DET, + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_DET, wm8994); - wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_SHRT, + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT, wm8994); - wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_DET, + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_DET, wm8994); break; diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index 1087425..c3e71d7 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h @@ -70,10 +70,11 @@ struct wm8994_fll_config { #define WM8994_NUM_DRC 3 #define WM8994_NUM_EQ 3 +struct wm8994; + struct wm8994_priv { struct wm_hubs_data hubs; - enum snd_soc_control_type control_type; - void *control_data; + struct wm8994 *wm8994; struct snd_soc_codec *codec; int sysclk[2]; int sysclk_rate[2]; -- cgit v1.1 From 604533de0f60c3be6ae99fdaf44d1d79f38b307e Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 1 Dec 2011 12:51:25 +0000 Subject: ASoC: Tune down active mode detection rate for WM8958 mic detection Saves a little power. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index d36b62b..45bfa09 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -63,8 +63,8 @@ static const struct { } wm8958_micd_rates[] = { { 32768, true, 1, 4 }, { 32768, false, 1, 1 }, - { 44100 * 256, true, 7, 6 }, - { 44100 * 256, false, 7, 6 }, + { 44100 * 256, true, 7, 10 }, + { 44100 * 256, false, 7, 10 }, }; static void wm8958_micd_set_rate(struct snd_soc_codec *codec) -- cgit v1.1 From 4585790d1cde32a5719c24412e9845e031358e08 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 30 Nov 2011 10:55:14 +0000 Subject: ASoC: Allow more WM8958/WM1811 button levels with default handler The WM8958 and WM1811 support detecting a range of buttons. Allow the user to provide platform data enabling more of these levels without having to write a custom detection handler. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 42 ++++++++++++++++++++++++++++++++++-------- sound/soc/codecs/wm8994.h | 1 + 2 files changed, 35 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 45bfa09..3e52d40 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3043,6 +3043,7 @@ static void wm8958_default_micdet(u16 status, void *data) { struct snd_soc_codec *codec = data; struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); + int report; dev_dbg(codec->dev, "MICDET %x\n", status); @@ -3055,7 +3056,7 @@ static void wm8958_default_micdet(u16 status, void *data) wm8958_micd_set_rate(codec); snd_soc_jack_report(wm8994->micdet[0].jack, 0, - SND_JACK_BTN_0 | SND_JACK_HEADSET); + wm8994->btn_mask | SND_JACK_HEADSET); return; } @@ -3088,12 +3089,27 @@ static void wm8958_default_micdet(u16 status, void *data) /* Report short circuit as a button */ if (wm8994->jack_mic) { + report = 0; if (status & 0x4) - snd_soc_jack_report(wm8994->micdet[0].jack, - SND_JACK_BTN_0, SND_JACK_BTN_0); - else - snd_soc_jack_report(wm8994->micdet[0].jack, - 0, SND_JACK_BTN_0); + report |= SND_JACK_BTN_0; + + if (status & 0x8) + report |= SND_JACK_BTN_1; + + if (status & 0x10) + report |= SND_JACK_BTN_2; + + if (status & 0x20) + report |= SND_JACK_BTN_3; + + if (status & 0x40) + report |= SND_JACK_BTN_4; + + if (status & 0x80) + report |= SND_JACK_BTN_5; + + snd_soc_jack_report(wm8994->micdet[0].jack, report, + wm8994->btn_mask); } } @@ -3118,6 +3134,7 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994 *control = wm8994->wm8994; + u16 micd_lvl_sel; switch (control->type) { case WM1811: @@ -3145,9 +3162,18 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, wm8958_micd_set_rate(codec); - /* Detect microphones and short circuits */ + /* Detect microphones and short circuits by default */ + if (wm8994->pdata->micd_lvl_sel) + micd_lvl_sel = wm8994->pdata->micd_lvl_sel; + else + micd_lvl_sel = 0x41; + + wm8994->btn_mask = SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3 | + SND_JACK_BTN_4 | SND_JACK_BTN_5; + snd_soc_update_bits(codec, WM8958_MIC_DETECT_2, - WM8958_MICD_LVL_SEL_MASK, 0x41); + WM8958_MICD_LVL_SEL_MASK, micd_lvl_sel); snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, WM8958_MICD_ENA, WM8958_MICD_ENA); diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index c3e71d7..77e3d8c 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h @@ -129,6 +129,7 @@ struct wm8994_priv { struct wm8994_micdet micdet[2]; bool detecting; bool jack_mic; + int btn_mask; wm8958_micdet_cb jack_cb; void *jack_cb_data; -- cgit v1.1 From 157a75e664f8c811c660de1d1b9abb16a1f72579 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 30 Nov 2011 13:43:51 +0000 Subject: ASoC: Rename WM8994 detecting flag to mic_detecting More specific and avoids confusion with a following change. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 12 ++++++------ sound/soc/codecs/wm8994.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 3e52d40..e65745b 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3051,7 +3051,7 @@ static void wm8958_default_micdet(u16 status, void *data) if (!(status & WM8958_MICD_STS)) { dev_dbg(codec->dev, "Detected open circuit\n"); wm8994->jack_mic = false; - wm8994->detecting = true; + wm8994->mic_detecting = true; wm8958_micd_set_rate(codec); @@ -3064,10 +3064,10 @@ static void wm8958_default_micdet(u16 status, void *data) /* If the measurement is showing a high impedence we've got a * microphone. */ - if (wm8994->detecting && (status & 0x600)) { + if (wm8994->mic_detecting && (status & 0x600)) { dev_dbg(codec->dev, "Detected microphone\n"); - wm8994->detecting = false; + wm8994->mic_detecting = false; wm8994->jack_mic = true; wm8958_micd_set_rate(codec); @@ -3077,9 +3077,9 @@ static void wm8958_default_micdet(u16 status, void *data) } - if (wm8994->detecting && status & 0x4) { + if (wm8994->mic_detecting && status & 0x4) { dev_dbg(codec->dev, "Detected headphone\n"); - wm8994->detecting = false; + wm8994->mic_detecting = false; wm8958_micd_set_rate(codec); @@ -3157,7 +3157,7 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, wm8994->jack_cb = cb; wm8994->jack_cb_data = cb_data; - wm8994->detecting = true; + wm8994->mic_detecting = true; wm8994->jack_mic = false; wm8958_micd_set_rate(codec); diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index 77e3d8c..8622bc4 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h @@ -127,7 +127,7 @@ struct wm8994_priv { struct soc_enum enh_eq_enum; struct wm8994_micdet micdet[2]; - bool detecting; + bool mic_detecting; bool jack_mic; int btn_mask; -- cgit v1.1 From af6b6fe41c4bc9e7933d66bbbf5106e0e7e6e484 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 30 Nov 2011 20:32:05 +0000 Subject: ASoC: Implement support for WM1811A jack detection The WM1811A features an advanced low power accessory detection subsystem which allows the device to be maintained in a very low power state while the system is idle without sacrificing any accessory detection features. Implement software support for this, automatically managing the power configuration of the device depending on the detected accessory. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 264 ++++++++++++++++++++++++++++++++++++++++++---- sound/soc/codecs/wm8994.h | 3 + 2 files changed, 248 insertions(+), 19 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index e65745b..2e28f47 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -38,6 +38,11 @@ #include "wm8994.h" #include "wm_hubs.h" +#define WM1811_JACKDET_MODE_NONE 0x0000 +#define WM1811_JACKDET_MODE_JACK 0x0100 +#define WM1811_JACKDET_MODE_MIC 0x0080 +#define WM1811_JACKDET_MODE_AUDIO 0x0180 + #define WM8994_NUM_DRC 3 #define WM8994_NUM_EQ 3 @@ -55,23 +60,34 @@ static int wm8994_retune_mobile_base[] = { static void wm8958_default_micdet(u16 status, void *data); -static const struct { +struct wm8958_micd_rate { int sysclk; bool idle; int start; int rate; -} wm8958_micd_rates[] = { +}; + +static const struct wm8958_micd_rate micdet_rates[] = { { 32768, true, 1, 4 }, { 32768, false, 1, 1 }, { 44100 * 256, true, 7, 10 }, { 44100 * 256, false, 7, 10 }, }; +static const struct wm8958_micd_rate jackdet_rates[] = { + { 32768, true, 0, 1 }, + { 32768, false, 0, 1 }, + { 44100 * 256, true, 7, 10 }, + { 44100 * 256, false, 7, 10 }, +}; + static void wm8958_micd_set_rate(struct snd_soc_codec *codec) { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); int best, i, sysclk, val; bool idle; + const struct wm8958_micd_rate *rates; + int num_rates; if (wm8994->jack_cb != wm8958_default_micdet) return; @@ -84,19 +100,27 @@ static void wm8958_micd_set_rate(struct snd_soc_codec *codec) else sysclk = wm8994->aifclk[0]; + if (wm8994->jackdet) { + rates = jackdet_rates; + num_rates = ARRAY_SIZE(jackdet_rates); + } else { + rates = micdet_rates; + num_rates = ARRAY_SIZE(micdet_rates); + } + best = 0; - for (i = 0; i < ARRAY_SIZE(wm8958_micd_rates); i++) { - if (wm8958_micd_rates[i].idle != idle) + for (i = 0; i < num_rates; i++) { + if (rates[i].idle != idle) continue; - if (abs(wm8958_micd_rates[i].sysclk - sysclk) < - abs(wm8958_micd_rates[best].sysclk - sysclk)) + if (abs(rates[i].sysclk - sysclk) < + abs(rates[best].sysclk - sysclk)) best = i; - else if (wm8958_micd_rates[best].idle != idle) + else if (rates[best].idle != idle) best = i; } - val = wm8958_micd_rates[best].start << WM8958_MICD_BIAS_STARTTIME_SHIFT - | wm8958_micd_rates[best].rate << WM8958_MICD_RATE_SHIFT; + val = rates[best].start << WM8958_MICD_BIAS_STARTTIME_SHIFT + | rates[best].rate << WM8958_MICD_RATE_SHIFT; snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, WM8958_MICD_BIAS_STARTTIME_MASK | @@ -762,6 +786,74 @@ SOC_SINGLE_TLV("MIXINL IN1RP Boost Volume", WM8994_INPUT_MIXER_1, 8, 1, 0, mixin_boost_tlv), }; +/* We run all mode setting through a function to enforce audio mode */ +static void wm1811_jackdet_set_mode(struct snd_soc_codec *codec, u16 mode) +{ + struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); + + if (wm8994->active_refcount) + mode = WM1811_JACKDET_MODE_AUDIO; + + snd_soc_update_bits(codec, WM8994_ANTIPOP_2, + WM1811_JACKDET_MODE_MASK, mode); + + if (mode == WM1811_JACKDET_MODE_MIC) + msleep(2); +} + +static void active_reference(struct snd_soc_codec *codec) +{ + struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); + + mutex_lock(&wm8994->accdet_lock); + + wm8994->active_refcount++; + + dev_dbg(codec->dev, "Active refcount incremented, now %d\n", + wm8994->active_refcount); + + if (wm8994->active_refcount == 1) { + /* If we're using jack detection go into audio mode */ + if (wm8994->jackdet && wm8994->jack_cb) { + snd_soc_update_bits(codec, WM8994_ANTIPOP_2, + WM1811_JACKDET_MODE_MASK, + WM1811_JACKDET_MODE_AUDIO); + msleep(2); + } + } + + mutex_unlock(&wm8994->accdet_lock); +} + +static void active_dereference(struct snd_soc_codec *codec) +{ + struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); + u16 mode; + + mutex_lock(&wm8994->accdet_lock); + + wm8994->active_refcount--; + + dev_dbg(codec->dev, "Active refcount decremented, now %d\n", + wm8994->active_refcount); + + if (wm8994->active_refcount == 0) { + /* Go into appropriate detection only mode */ + if (wm8994->jackdet && wm8994->jack_cb) { + if (wm8994->jack_mic || wm8994->mic_detecting) + mode = WM1811_JACKDET_MODE_MIC; + else + mode = WM1811_JACKDET_MODE_JACK; + + snd_soc_update_bits(codec, WM8994_ANTIPOP_2, + WM1811_JACKDET_MODE_MASK, + mode); + } + } + + mutex_unlock(&wm8994->accdet_lock); +} + static int clk_sys_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { @@ -1919,6 +2011,8 @@ static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src, if (freq_out) { /* Enable VMID if we need it */ if (!was_enabled) { + active_reference(codec); + switch (control->type) { case WM8994: vmid_reference(codec); @@ -1962,6 +2056,8 @@ static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src, default: break; } + + active_dereference(codec); } } @@ -2091,6 +2187,9 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, default: break; } + + if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) + active_reference(codec); break; case SND_SOC_BIAS_STANDBY: @@ -2143,6 +2242,9 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, WM8994_LINEOUT2_DISCH); } + if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE) + active_dereference(codec); + /* MICBIAS into bypass mode on newer devices */ switch (control->type) { case WM8958: @@ -2168,6 +2270,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, break; } codec->dapm.bias_level = level; + return 0; } @@ -2715,6 +2818,9 @@ static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state) snd_soc_update_bits(codec, WM8994_MICBIAS, WM8994_MICD_ENA, 0); break; case WM1811: + snd_soc_update_bits(codec, WM8994_ANTIPOP_2, + WM1811_JACKDET_MODE_MASK, 0); + /* Fall through */ case WM8958: snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, WM8958_MICD_ENA, 0); @@ -2784,6 +2890,13 @@ static int wm8994_resume(struct snd_soc_codec *codec) WM8994_MICD_ENA, WM8994_MICD_ENA); break; case WM1811: + if (wm8994->jackdet && wm8994->jack_cb) { + /* Restart from idle */ + snd_soc_update_bits(codec, WM8994_ANTIPOP_2, + WM1811_JACKDET_MODE_MASK, + WM1811_JACKDET_MODE_JACK); + break; + } case WM8958: if (wm8994->jack_cb) snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, @@ -3047,17 +3160,20 @@ static void wm8958_default_micdet(u16 status, void *data) dev_dbg(codec->dev, "MICDET %x\n", status); - /* If nothing present then clear our statuses */ + /* Either nothing present or just starting detection */ if (!(status & WM8958_MICD_STS)) { - dev_dbg(codec->dev, "Detected open circuit\n"); - wm8994->jack_mic = false; - wm8994->mic_detecting = true; + if (!wm8994->jackdet) { + /* If nothing present then clear our statuses */ + dev_dbg(codec->dev, "Detected open circuit\n"); + wm8994->jack_mic = false; + wm8994->mic_detecting = true; - wm8958_micd_set_rate(codec); - - snd_soc_jack_report(wm8994->micdet[0].jack, 0, - wm8994->btn_mask | SND_JACK_HEADSET); + wm8958_micd_set_rate(codec); + snd_soc_jack_report(wm8994->micdet[0].jack, 0, + wm8994->btn_mask | + SND_JACK_HEADSET); + } return; } @@ -3085,6 +3201,15 @@ static void wm8958_default_micdet(u16 status, void *data) snd_soc_jack_report(wm8994->micdet[0].jack, SND_JACK_HEADPHONE, SND_JACK_HEADSET); + + /* If we have jackdet that will detect removal */ + if (wm8994->jackdet) { + snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, + WM8958_MICD_ENA, 0); + + wm1811_jackdet_set_mode(codec, + WM1811_JACKDET_MODE_JACK); + } } /* Report short circuit as a button */ @@ -3113,6 +3238,56 @@ static void wm8958_default_micdet(u16 status, void *data) } } +static irqreturn_t wm1811_jackdet_irq(int irq, void *data) +{ + struct wm8994_priv *wm8994 = data; + struct snd_soc_codec *codec = wm8994->codec; + int reg; + + mutex_lock(&wm8994->accdet_lock); + + reg = snd_soc_read(codec, WM1811_JACKDET_CTRL); + if (reg < 0) { + dev_err(codec->dev, "Failed to read jack status: %d\n", reg); + mutex_unlock(&wm8994->accdet_lock); + return IRQ_NONE; + } + + dev_dbg(codec->dev, "JACKDET %x\n", reg); + + if (reg & WM1811_JACKDET_LVL) { + dev_dbg(codec->dev, "Jack detected\n"); + + snd_soc_jack_report(wm8994->micdet[0].jack, + SND_JACK_MECHANICAL, SND_JACK_MECHANICAL); + + /* + * Start off measument of microphone impedence to find + * out what's actually there. + */ + wm8994->mic_detecting = true; + wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_MIC); + snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, + WM8958_MICD_ENA, WM8958_MICD_ENA); + } else { + dev_dbg(codec->dev, "Jack not detected\n"); + + snd_soc_jack_report(wm8994->micdet[0].jack, 0, + SND_JACK_MECHANICAL | SND_JACK_HEADSET | + wm8994->btn_mask); + + wm8994->mic_detecting = false; + wm8994->jack_mic = false; + snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, + WM8958_MICD_ENA, 0); + wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK); + } + + mutex_unlock(&wm8994->accdet_lock); + + return IRQ_HANDLED; +} + /** * wm8958_mic_detect - Enable microphone detection via the WM8958 IRQ * @@ -3175,8 +3350,22 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, snd_soc_update_bits(codec, WM8958_MIC_DETECT_2, WM8958_MICD_LVL_SEL_MASK, micd_lvl_sel); - snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, - WM8958_MICD_ENA, WM8958_MICD_ENA); + WARN_ON(codec->dapm.bias_level > SND_SOC_BIAS_STANDBY); + + /* + * If we can use jack detection start off with that, + * otherwise jump straight to microphone detection. + */ + if (wm8994->jackdet) { + snd_soc_update_bits(codec, WM8994_LDO_1, + WM8994_LDO1_DISCH, 0); + wm1811_jackdet_set_mode(codec, + WM1811_JACKDET_MODE_JACK); + } else { + snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, + WM8958_MICD_ENA, WM8958_MICD_ENA); + } + } else { snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, WM8958_MICD_ENA, 0); @@ -3193,6 +3382,18 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data) struct snd_soc_codec *codec = wm8994->codec; int reg, count; + mutex_lock(&wm8994->accdet_lock); + + /* + * Jack detection may have detected a removal simulataneously + * with an update of the MICDET status; if so it will have + * stopped detection and we can ignore this interrupt. + */ + if (!(snd_soc_read(codec, WM8958_MIC_DETECT_1) & WM8958_MICD_ENA)) { + mutex_unlock(&wm8994->accdet_lock); + return IRQ_HANDLED; + } + /* We may occasionally read a detection without an impedence * range being provided - if that happens loop again. */ @@ -3200,6 +3401,7 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data) do { reg = snd_soc_read(codec, WM8958_MIC_DETECT_3); if (reg < 0) { + mutex_unlock(&wm8994->accdet_lock); dev_err(codec->dev, "Failed to read mic detect status: %d\n", reg); @@ -3230,6 +3432,8 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data) dev_warn(codec->dev, "Accessory detection with no callback\n"); out: + mutex_unlock(&wm8994->accdet_lock); + return IRQ_HANDLED; } @@ -3280,6 +3484,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) wm8994->pdata = dev_get_platdata(codec->dev->parent); wm8994->codec = codec; + mutex_init(&wm8994->accdet_lock); + for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) init_completion(&wm8994->fll_locked[i]); @@ -3428,6 +3634,21 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) } } + switch (control->type) { + case WM1811: + if (wm8994->revision > 1) { + ret = wm8994_request_irq(wm8994->wm8994, + WM8994_IRQ_GPIO(6), + wm1811_jackdet_irq, "JACKDET", + wm8994); + if (ret == 0) + wm8994->jackdet = true; + } + break; + default: + break; + } + wm8994->fll_locked_irq = true; for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) { ret = wm8994_request_irq(wm8994->wm8994, @@ -3650,6 +3871,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) return 0; err_irq: + if (wm8994->jackdet) + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_GPIO(6), wm8994); wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_SHRT, wm8994); wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_DET, wm8994); wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT, wm8994); @@ -3688,6 +3911,9 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec) wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec); wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec); + if (wm8994->jackdet) + wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_GPIO(6), wm8994); + switch (control->type) { case WM8994: if (wm8994->micdet_irq) diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index 8622bc4..6ef3f11 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h @@ -85,6 +85,7 @@ struct wm8994_priv { bool fll_locked_irq; int vmid_refcount; + int active_refcount; int dac_rates[2]; int lrclk_shared[2]; @@ -126,10 +127,12 @@ struct wm8994_priv { const char **enh_eq_texts; struct soc_enum enh_eq_enum; + struct mutex accdet_lock; struct wm8994_micdet micdet[2]; bool mic_detecting; bool jack_mic; int btn_mask; + bool jackdet; wm8958_micdet_cb jack_cb; void *jack_cb_data; -- cgit v1.1 From 52ac7ab2475da2b577e4a4616c98b5d1fa3a3cfd Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 1 Dec 2011 12:43:26 +0000 Subject: ASoC: Ensure we reconfigure WM8958 microphone detection on rate changes We don't need to rerun DAPM if the clock source is the same but we do need to adjust the microphone detection rate in case we are moving from an audio to a non-audio rate. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 2e28f47..91f3638 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -307,10 +307,8 @@ static int configure_clock(struct snd_soc_codec *codec) change = snd_soc_update_bits(codec, WM8994_CLOCKING_1, WM8994_SYSCLK_SRC, new); - if (!change) - return 0; - - snd_soc_dapm_sync(&codec->dapm); + if (change) + snd_soc_dapm_sync(&codec->dapm); wm8958_micd_set_rate(codec); -- cgit v1.1 From cd1707a99a2cb43cd8ab0c1952b455b218f15884 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 1 Dec 2011 13:44:25 +0000 Subject: ASoC: Add platform data for WM8958/WM1811 microphone detection rates Allow systems to override the default microphone detection rates using platform data in case the settings are not suitable (eg, due to an unusually noisy jack). Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 91f3638..6bdf813 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -60,13 +60,6 @@ static int wm8994_retune_mobile_base[] = { static void wm8958_default_micdet(u16 status, void *data); -struct wm8958_micd_rate { - int sysclk; - bool idle; - int start; - int rate; -}; - static const struct wm8958_micd_rate micdet_rates[] = { { 32768, true, 1, 4 }, { 32768, false, 1, 1 }, @@ -100,7 +93,10 @@ static void wm8958_micd_set_rate(struct snd_soc_codec *codec) else sysclk = wm8994->aifclk[0]; - if (wm8994->jackdet) { + if (wm8994->pdata && wm8994->pdata->micd_rates) { + rates = wm8994->pdata->micd_rates; + num_rates = wm8994->pdata->num_micd_rates; + } else if (wm8994->jackdet) { rates = jackdet_rates; num_rates = ARRAY_SIZE(jackdet_rates); } else { -- cgit v1.1 From 7270cebef293c7af3f91afdbe7514797ca53a5dd Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 1 Dec 2011 14:00:19 +0000 Subject: ASoC: Convert WM8994 to devm_kzalloc() Still have a manual free in there for some realloc()ed memory as there's no devm version of that. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 6bdf813..0699ed2 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3003,8 +3003,8 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994) }; /* We need an array of texts for the enum API */ - wm8994->drc_texts = kmalloc(sizeof(char *) - * pdata->num_drc_cfgs, GFP_KERNEL); + wm8994->drc_texts = devm_kzalloc(wm8994->codec->dev, + sizeof(char *) * pdata->num_drc_cfgs, GFP_KERNEL); if (!wm8994->drc_texts) { dev_err(wm8994->codec->dev, "Failed to allocate %d DRC config texts\n", @@ -3468,7 +3468,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) codec->control_data = dev_get_drvdata(codec->dev->parent); control = codec->control_data; - wm8994 = kzalloc(sizeof(struct wm8994_priv), GFP_KERNEL); + wm8994 = devm_kzalloc(codec->dev, sizeof(struct wm8994_priv), + GFP_KERNEL); if (wm8994 == NULL) return -ENOMEM; snd_soc_codec_set_drvdata(codec, wm8994); @@ -3880,8 +3881,6 @@ err_irq: wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec); wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec); wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec); -err: - kfree(wm8994); return ret; } @@ -3933,8 +3932,6 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec) if (wm8994->enh_eq) release_firmware(wm8994->enh_eq); kfree(wm8994->retune_mobile_texts); - kfree(wm8994->drc_texts); - kfree(wm8994); return 0; } -- cgit v1.1 From 31ef22579302ac42054bebecb528710f46580925 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 1 Dec 2011 17:41:36 +0100 Subject: ALSA: hda - Integrate input-jack stuff into kctl-jack Instead of managing input-jack stuff separately, call all stuff inside the kctl-jack creation, deletion and report. The caller no longer needs to care about input-jack. The better integration between input-jack and kctl-jack should be done in the upper layer in near future, but for now, it's implemented locally for more tests. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_jack.c | 159 ++++++++++++++++------------------------- sound/pci/hda/hda_local.h | 20 ------ sound/pci/hda/patch_conexant.c | 52 +++----------- sound/pci/hda/patch_hdmi.c | 22 ++---- sound/pci/hda/patch_realtek.c | 52 -------------- sound/pci/hda/patch_sigmatel.c | 46 ------------ 6 files changed, 74 insertions(+), 277 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index 39490151..d8a35da 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -90,15 +90,19 @@ snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid) } EXPORT_SYMBOL_HDA(snd_hda_jack_tbl_new); -#ifdef CONFIG_SND_HDA_INPUT_JACK -static void snd_hda_input_jack_free(struct hda_codec *codec); -#else -#define snd_hda_input_jack_free(codec) -#endif - void snd_hda_jack_tbl_clear(struct hda_codec *codec) { - snd_hda_input_jack_free(codec); +#ifdef CONFIG_SND_HDA_INPUT_JACK + /* free jack instances manually when clearing/reconfiguring */ + if (!codec->bus->shutdown && codec->jacktbl.list) { + struct hda_jack_tbl *jack = codec->jacktbl.list; + int i; + for (i = 0; i < codec->jacktbl.used; i++, jack++) { + if (jack->jack) + snd_device_free(codec->bus->card, jack->jack); + } + } +#endif snd_array_free(&codec->jacktbl); } @@ -199,10 +203,44 @@ void snd_hda_jack_report_sync(struct hda_codec *codec) continue; state = get_jack_plug_state(jack->pin_sense); snd_kctl_jack_report(codec->bus->card, jack->kctl, state); +#ifdef CONFIG_SND_HDA_INPUT_JACK + if (jack->jack) + snd_jack_report(jack->jack, + state ? jack->type : 0); +#endif } } EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync); +#ifdef CONFIG_SND_HDA_INPUT_JACK +/* guess the jack type from the pin-config */ +static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid) +{ + unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); + switch (get_defcfg_device(def_conf)) { + case AC_JACK_LINE_OUT: + case AC_JACK_SPEAKER: + return SND_JACK_LINEOUT; + case AC_JACK_HP_OUT: + return SND_JACK_HEADPHONE; + case AC_JACK_SPDIF_OUT: + case AC_JACK_DIG_OTHER_OUT: + return SND_JACK_AVOUT; + case AC_JACK_MIC_IN: + return SND_JACK_MICROPHONE; + default: + return SND_JACK_LINEIN; + } +} + +static void hda_free_jack_priv(struct snd_jack *jack) +{ + struct hda_jack_tbl *jacks = jack->private_data; + jacks->nid = 0; + jacks->jack = NULL; +} +#endif + /** * snd_hda_jack_add_kctl - Add a kctl for the given pin * @@ -214,6 +252,7 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, { struct hda_jack_tbl *jack; struct snd_kcontrol *kctl; + int err, state; jack = snd_hda_jack_tbl_new(codec, nid); if (!jack) @@ -223,11 +262,21 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, kctl = snd_kctl_jack_new(name, idx, codec); if (!kctl) return -ENOMEM; - if (snd_hda_ctl_add(codec, nid, kctl) < 0) - return -ENOMEM; + err = snd_hda_ctl_add(codec, nid, kctl); + if (err < 0) + return err; jack->kctl = kctl; - snd_kctl_jack_report(codec->bus->card, kctl, - snd_hda_jack_detect(codec, nid)); + state = snd_hda_jack_detect(codec, nid); + snd_kctl_jack_report(codec->bus->card, kctl, state); +#ifdef CONFIG_SND_HDA_INPUT_JACK + jack->type = get_input_jack_type(codec, nid); + err = snd_jack_new(codec->bus->card, name, jack->type, &jack->jack); + if (err < 0) + return err; + jack->jack->private_data = jack; + jack->jack->private_free = hda_free_jack_priv; + snd_jack_report(jack->jack, state ? jack->type : 0); +#endif return 0; } EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctl); @@ -302,91 +351,3 @@ int snd_hda_jack_add_kctls(struct hda_codec *codec, return 0; } EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctls); - -#ifdef CONFIG_SND_HDA_INPUT_JACK -/* - * Input-jack notification support - */ -static const char *get_jack_default_name(struct hda_codec *codec, hda_nid_t nid, - int type) -{ - switch (type) { - case SND_JACK_HEADPHONE: - return "Headphone"; - case SND_JACK_MICROPHONE: - return "Mic"; - case SND_JACK_LINEOUT: - return "Line-out"; - case SND_JACK_LINEIN: - return "Line-in"; - case SND_JACK_HEADSET: - return "Headset"; - case SND_JACK_VIDEOOUT: - return "HDMI/DP"; - default: - return "Misc"; - } -} - -static void hda_free_jack_priv(struct snd_jack *jack) -{ - struct hda_jack_tbl *jacks = jack->private_data; - jacks->nid = 0; - jacks->jack = NULL; -} - -int snd_hda_input_jack_add(struct hda_codec *codec, hda_nid_t nid, int type, - const char *name) -{ - struct hda_jack_tbl *jack = snd_hda_jack_tbl_new(codec, nid); - int err; - - if (!jack) - return -ENOMEM; - if (!name) - name = get_jack_default_name(codec, nid, type); - err = snd_jack_new(codec->bus->card, name, type, &jack->jack); - if (err < 0) - return err; - jack->type = type; - jack->jack->private_data = jack; - jack->jack->private_free = hda_free_jack_priv; - return 0; -} -EXPORT_SYMBOL_HDA(snd_hda_input_jack_add); - -void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid) -{ - struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); - unsigned int pin_ctl; - unsigned int present; - int type; - - if (!jack || !jack->jack) - return; - - present = snd_hda_jack_detect(codec, nid); - type = jack->type; - if (type == (SND_JACK_HEADPHONE | SND_JACK_LINEOUT)) { - pin_ctl = snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_PIN_WIDGET_CONTROL, 0); - type = (pin_ctl & AC_PINCTL_HP_EN) ? - SND_JACK_HEADPHONE : SND_JACK_LINEOUT; - } - snd_jack_report(jack->jack, present ? type : 0); -} -EXPORT_SYMBOL_HDA(snd_hda_input_jack_report); - -/* free jack instances manually when clearing/reconfiguring */ -static void snd_hda_input_jack_free(struct hda_codec *codec) -{ - if (!codec->bus->shutdown && codec->jacktbl.list) { - struct hda_jack_tbl *jack = codec->jacktbl.list; - int i; - for (i = 0; i < codec->jacktbl.used; i++, jack++) { - if (jack->jack) - snd_device_free(codec->bus->card, jack->jack); - } - } -} -#endif /* CONFIG_SND_HDA_INPUT_JACK */ diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index ef09716..e1abc07 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -674,24 +674,4 @@ static inline void snd_hda_eld_proc_free(struct hda_codec *codec, #define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80 void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen); -/* - * Input-jack notification support - */ -#ifdef CONFIG_SND_HDA_INPUT_JACK -int snd_hda_input_jack_add(struct hda_codec *codec, hda_nid_t nid, int type, - const char *name); -void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid); -#else /* CONFIG_SND_HDA_INPUT_JACK */ -static inline int snd_hda_input_jack_add(struct hda_codec *codec, - hda_nid_t nid, int type, - const char *name) -{ - return 0; -} -static inline void snd_hda_input_jack_report(struct hda_codec *codec, - hda_nid_t nid) -{ -} -#endif /* CONFIG_SND_HDA_INPUT_JACK */ - #endif /* __SOUND_HDA_LOCAL_H */ diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index ae9c028..bf14a0a 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -416,40 +416,6 @@ static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol, &spec->cur_mux[adc_idx]); } -static int conexant_init_jacks(struct hda_codec *codec) -{ -#ifdef CONFIG_SND_HDA_INPUT_JACK - struct conexant_spec *spec = codec->spec; - int i; - - for (i = 0; i < spec->num_init_verbs; i++) { - const struct hda_verb *hv; - - hv = spec->init_verbs[i]; - while (hv->nid) { - int err = 0; - switch (hv->param ^ AC_USRSP_EN) { - case CONEXANT_HP_EVENT: - err = snd_hda_input_jack_add(codec, hv->nid, - SND_JACK_HEADPHONE, NULL); - snd_hda_input_jack_report(codec, hv->nid); - break; - case CXT5051_PORTC_EVENT: - case CONEXANT_MIC_EVENT: - err = snd_hda_input_jack_add(codec, hv->nid, - SND_JACK_MICROPHONE, NULL); - snd_hda_input_jack_report(codec, hv->nid); - break; - } - if (err < 0) - return err; - ++hv; - } - } -#endif /* CONFIG_SND_HDA_INPUT_JACK */ - return 0; -} - static void conexant_set_power(struct hda_codec *codec, hda_nid_t fg, unsigned int power_state) { @@ -1750,7 +1716,6 @@ static void cxt5051_hp_automute(struct hda_codec *codec) static void cxt5051_hp_unsol_event(struct hda_codec *codec, unsigned int res) { - int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20; switch (res >> 26) { case CONEXANT_HP_EVENT: cxt5051_hp_automute(codec); @@ -1762,7 +1727,6 @@ static void cxt5051_hp_unsol_event(struct hda_codec *codec, cxt5051_portc_automic(codec); break; } - snd_hda_input_jack_report(codec, nid); } static const struct snd_kcontrol_new cxt5051_playback_mixers[] = { @@ -1901,8 +1865,6 @@ static void cxt5051_init_mic_port(struct hda_codec *codec, hda_nid_t nid, snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | event); - snd_hda_input_jack_add(codec, nid, SND_JACK_MICROPHONE, NULL); - snd_hda_input_jack_report(codec, nid); } static const struct hda_verb cxt5051_ideapad_init_verbs[] = { @@ -1918,7 +1880,6 @@ static int cxt5051_init(struct hda_codec *codec) struct conexant_spec *spec = codec->spec; conexant_init(codec); - conexant_init_jacks(codec); if (spec->auto_mic & AUTO_MIC_PORTB) cxt5051_init_mic_port(codec, 0x17, CXT5051_PORTB_EVENT); @@ -3450,7 +3411,6 @@ static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins) hda_nid_t nid = pins[i]; if (!nid || !is_jack_detectable(codec, nid)) break; - snd_hda_input_jack_report(codec, nid); present |= snd_hda_jack_detect(codec, nid); } return present; @@ -3755,8 +3715,6 @@ static void cx_auto_automic(struct hda_codec *codec) static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res) { - int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20; - switch (snd_hda_jack_get_action(codec, res >> 26)) { case CONEXANT_HP_EVENT: cx_auto_hp_automute(codec); @@ -3766,7 +3724,6 @@ static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res) break; case CONEXANT_MIC_EVENT: cx_auto_automic(codec); - snd_hda_input_jack_report(codec, nid); break; } snd_hda_jack_report_sync(codec); @@ -4325,6 +4282,7 @@ static int cx_auto_build_input_controls(struct hda_codec *codec) static int cx_auto_build_controls(struct hda_codec *codec) { + struct conexant_spec *spec = codec->spec; int err; err = cx_auto_build_output_controls(codec); @@ -4333,7 +4291,13 @@ static int cx_auto_build_controls(struct hda_codec *codec) err = cx_auto_build_input_controls(codec); if (err < 0) return err; - return conexant_build_controls(codec); + err = conexant_build_controls(codec); + if (err < 0) + return err; + err = snd_hda_jack_add_kctls(codec, &spec->autocfg); + if (err < 0) + return err; + return 0; } static int cx_auto_search_adcs(struct hda_codec *codec) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index bb8cfc6..66dc7e6 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -1005,8 +1005,6 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry) msecs_to_jiffies(300)); } } - - snd_hda_input_jack_report(codec, pin_nid); } static void hdmi_repoll_eld(struct work_struct *work) @@ -1232,21 +1230,15 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec) static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx) { - int err; - char hdmi_str[32]; + char hdmi_str[32] = "HDMI/DP"; struct hdmi_spec *spec = codec->spec; struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; int pcmdev = spec->pcm_rec[pin_idx].device; - snprintf(hdmi_str, sizeof(hdmi_str), "HDMI/DP,pcm=%d", pcmdev); - - err = snd_hda_input_jack_add(codec, per_pin->pin_nid, - SND_JACK_VIDEOOUT, pcmdev > 0 ? hdmi_str : NULL); - if (err < 0) - return err; + if (pcmdev > 0) + sprintf(hdmi_str + strlen(hdmi_str), ",pcm=%d", pcmdev); - hdmi_present_sense(per_pin, false); - return 0; + return snd_hda_jack_add_kctl(codec, per_pin->pin_nid, hdmi_str, 0); } static int generic_hdmi_build_controls(struct hda_codec *codec) @@ -1276,10 +1268,8 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) if (err < 0) return err; - err = snd_hda_jack_add_kctl(codec, per_pin->pin_nid, - "HDMI", pin_idx); - if (err < 0) - return err; + + hdmi_present_sense(per_pin, false); } return 0; diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 933c8cf..641c829 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -461,46 +461,6 @@ static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, } /* - * Jack-reporting via input-jack layer - */ - -/* initialization of jacks; currently checks only a few known pins */ -static int alc_init_jacks(struct hda_codec *codec) -{ -#ifdef CONFIG_SND_HDA_INPUT_JACK - struct alc_spec *spec = codec->spec; - int err; - unsigned int hp_nid = spec->autocfg.hp_pins[0]; - unsigned int mic_nid = spec->ext_mic_pin; - unsigned int dock_nid = spec->dock_mic_pin; - - if (hp_nid) { - err = snd_hda_input_jack_add(codec, hp_nid, - SND_JACK_HEADPHONE, NULL); - if (err < 0) - return err; - snd_hda_input_jack_report(codec, hp_nid); - } - - if (mic_nid) { - err = snd_hda_input_jack_add(codec, mic_nid, - SND_JACK_MICROPHONE, NULL); - if (err < 0) - return err; - snd_hda_input_jack_report(codec, mic_nid); - } - if (dock_nid) { - err = snd_hda_input_jack_add(codec, dock_nid, - SND_JACK_MICROPHONE, NULL); - if (err < 0) - return err; - snd_hda_input_jack_report(codec, dock_nid); - } -#endif /* CONFIG_SND_HDA_INPUT_JACK */ - return 0; -} - -/* * Jack detections for HP auto-mute and mic-switch */ @@ -513,7 +473,6 @@ static bool detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins) hda_nid_t nid = pins[i]; if (!nid) break; - snd_hda_input_jack_report(codec, nid); present |= snd_hda_jack_detect(codec, nid); } return present; @@ -653,10 +612,6 @@ static void alc_mic_automute(struct hda_codec *codec) alc_mux_select(codec, 0, spec->dock_mic_idx, false); else alc_mux_select(codec, 0, spec->int_mic_idx, false); - - snd_hda_input_jack_report(codec, pins[spec->ext_mic_idx]); - if (spec->dock_mic_idx >= 0) - snd_hda_input_jack_report(codec, pins[spec->dock_mic_idx]); } /* unsolicited event for HP jack sensing */ @@ -4686,7 +4641,6 @@ static int patch_alc882(struct hda_codec *codec) if (board_config == ALC_MODEL_AUTO) spec->init_hook = alc_auto_init_std; - alc_init_jacks(codec); #ifdef CONFIG_SND_HDA_POWER_SAVE if (!spec->loopback.amplist) spec->loopback.amplist = alc882_loopbacks; @@ -4866,7 +4820,6 @@ static int patch_alc262(struct hda_codec *codec) spec->init_hook = alc_auto_init_std; spec->shutup = alc_eapd_shutup; - alc_init_jacks(codec); #ifdef CONFIG_SND_HDA_POWER_SAVE if (!spec->loopback.amplist) spec->loopback.amplist = alc262_loopbacks; @@ -4979,8 +4932,6 @@ static int patch_alc268(struct hda_codec *codec) spec->init_hook = alc_auto_init_std; spec->shutup = alc_eapd_shutup; - alc_init_jacks(codec); - return 0; error: @@ -5538,7 +5489,6 @@ static int patch_alc269(struct hda_codec *codec) spec->init_hook = alc_auto_init_std; spec->shutup = alc269_shutup; - alc_init_jacks(codec); #ifdef CONFIG_SND_HDA_POWER_SAVE if (!spec->loopback.amplist) spec->loopback.amplist = alc269_loopbacks; @@ -6153,8 +6103,6 @@ static int patch_alc662(struct hda_codec *codec) spec->init_hook = alc_auto_init_std; spec->shutup = alc_eapd_shutup; - alc_init_jacks(codec); - #ifdef CONFIG_SND_HDA_POWER_SAVE if (!spec->loopback.amplist) spec->loopback.amplist = alc662_loopbacks; diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 0988dc4..2d4156c 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -1084,13 +1084,10 @@ static const char * const slave_sws[] = { }; static void stac92xx_free_kctls(struct hda_codec *codec); -static int stac92xx_add_jack(struct hda_codec *codec, hda_nid_t nid, int type); static int stac92xx_build_controls(struct hda_codec *codec) { struct sigmatel_spec *spec = codec->spec; - struct auto_pin_cfg *cfg = &spec->autocfg; - hda_nid_t nid; int err; int i; @@ -1176,32 +1173,6 @@ static int stac92xx_build_controls(struct hda_codec *codec) stac92xx_free_kctls(codec); /* no longer needed */ - /* create jack input elements */ - if (spec->hp_detect) { - for (i = 0; i < cfg->hp_outs; i++) { - int type = SND_JACK_HEADPHONE; - nid = cfg->hp_pins[i]; - /* jack detection */ - if (cfg->hp_outs == i) - type |= SND_JACK_LINEOUT; - err = stac92xx_add_jack(codec, nid, type); - if (err < 0) - return err; - } - } - for (i = 0; i < cfg->line_outs; i++) { - err = stac92xx_add_jack(codec, cfg->line_out_pins[i], - SND_JACK_LINEOUT); - if (err < 0) - return err; - } - for (i = 0; i < cfg->num_inputs; i++) { - nid = cfg->inputs[i].pin; - err = stac92xx_add_jack(codec, nid, SND_JACK_MICROPHONE); - if (err < 0) - return err; - } - err = snd_hda_jack_add_kctls(codec, &spec->autocfg); if (err < 0) return err; @@ -4158,22 +4129,6 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ } -static int stac92xx_add_jack(struct hda_codec *codec, - hda_nid_t nid, int type) -{ -#ifdef CONFIG_SND_HDA_INPUT_JACK - int def_conf = snd_hda_codec_get_pincfg(codec, nid); - int connectivity = get_defcfg_connect(def_conf); - - if (connectivity && connectivity != AC_JACK_PORT_FIXED) - return 0; - - return snd_hda_input_jack_add(codec, nid, type, NULL); -#else - return 0; -#endif /* CONFIG_SND_HDA_INPUT_JACK */ -} - static int stac_add_event(struct hda_codec *codec, hda_nid_t nid, unsigned char type, int data) { @@ -4778,7 +4733,6 @@ static void handle_unsol_event(struct hda_codec *codec, case STAC_PWR_EVENT: if (spec->num_pwrs > 0) stac92xx_pin_sense(codec, event->nid); - snd_hda_input_jack_report(codec, event->nid); switch (codec->subsystem_id) { case 0x103c308f: -- cgit v1.1 From 705978516fe4a5e0b5726e2ea860c1bfc6909472 Mon Sep 17 00:00:00 2001 From: David Dillow Date: Thu, 1 Dec 2011 23:26:57 -0500 Subject: ALSA: sis7019 - convert to dev_*() logging Signed-off-by: David Dillow Signed-off-by: Takashi Iwai --- sound/pci/sis7019.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'sound') diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index 28dfafb..7331b2d 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c @@ -983,7 +983,7 @@ timeout: mutex_unlock(&sis->ac97_mutex); if (!count) { - printk(KERN_ERR "sis7019: ac97 codec %d timeout cmd 0x%08x\n", + dev_err(&sis->pci->dev, "ac97 codec %d timeout cmd 0x%08x\n", codec, cmd); } @@ -1142,13 +1142,13 @@ static int sis_chip_init(struct sis7019 *sis) /* All done, check for errors. */ if (!sis->codecs_present) { - printk(KERN_ERR "sis7019: could not find any codecs\n"); + dev_err(&sis->pci->dev, "could not find any codecs\n"); return -EIO; } if (sis->codecs_present != codecs) { - printk(KERN_WARNING "sis7019: missing codecs, found %0x, expected %0x\n", - sis->codecs_present, codecs); + dev_warn(&sis->pci->dev, "missing codecs, found %0x, expected %0x\n", + sis->codecs_present, codecs); } /* Let the hardware know that the audio driver is alive, @@ -1256,18 +1256,18 @@ static int sis_resume(struct pci_dev *pci) pci_restore_state(pci); if (pci_enable_device(pci) < 0) { - printk(KERN_ERR "sis7019: unable to re-enable device\n"); + dev_err(&pci->dev, "unable to re-enable device\n"); goto error; } if (sis_chip_init(sis)) { - printk(KERN_ERR "sis7019: unable to re-init controller\n"); + dev_err(&pci->dev, "unable to re-init controller\n"); goto error; } if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED, KBUILD_MODNAME, sis)) { - printk(KERN_ERR "sis7019: unable to regain IRQ %d\n", pci->irq); + dev_err(&pci->dev, "unable to regain IRQ %d\n", pci->irq); goto error; } @@ -1335,8 +1335,7 @@ static int __devinit sis_chip_create(struct snd_card *card, goto error_out; if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0) { - printk(KERN_ERR "sis7019: architecture does not support " - "30-bit PCI busmaster DMA"); + dev_err(&pci->dev, "architecture does not support 30-bit PCI busmaster DMA"); goto error_out_enabled; } @@ -1350,20 +1349,20 @@ static int __devinit sis_chip_create(struct snd_card *card, rc = pci_request_regions(pci, "SiS7019"); if (rc) { - printk(KERN_ERR "sis7019: unable request regions\n"); + dev_err(&pci->dev, "unable request regions\n"); goto error_out_enabled; } rc = -EIO; sis->ioaddr = ioremap_nocache(pci_resource_start(pci, 1), 0x4000); if (!sis->ioaddr) { - printk(KERN_ERR "sis7019: unable to remap MMIO, aborting\n"); + dev_err(&pci->dev, "unable to remap MMIO, aborting\n"); goto error_out_cleanup; } rc = sis_alloc_suspend(sis); if (rc < 0) { - printk(KERN_ERR "sis7019: unable to allocate state storage\n"); + dev_err(&pci->dev, "unable to allocate state storage\n"); goto error_out_cleanup; } @@ -1371,9 +1370,9 @@ static int __devinit sis_chip_create(struct snd_card *card, if (rc) goto error_out_cleanup; - if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED, - KBUILD_MODNAME, sis)) { - printk(KERN_ERR "unable to allocate irq %d\n", sis->irq); + if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED, KBUILD_MODNAME, + sis)) { + dev_err(&pci->dev, "unable to allocate irq %d\n", sis->irq); goto error_out_cleanup; } -- cgit v1.1 From 1ab97c8cad98de016cb36a870e118feaf0a0caaf Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 27 Nov 2011 16:21:51 +0000 Subject: ASoC: Add signal generator widget type A signal generator behaves as an input would but is not considered for any of the special behaviour associated with external input pins. This is especially useful when automatically working out not connected widgets. Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- sound/soc/soc-dapm.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sound') diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index da5c1ae..6bb327e 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -339,6 +339,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w, case snd_soc_dapm_output: case snd_soc_dapm_adc: case snd_soc_dapm_input: + case snd_soc_dapm_siggen: case snd_soc_dapm_dac: case snd_soc_dapm_micbias: case snd_soc_dapm_vmid: @@ -772,6 +773,11 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget) return widget->inputs; } + /* signal generator */ + if (widget->id == snd_soc_dapm_siggen) { + widget->inputs = snd_soc_dapm_suspend_check(widget); + return widget->inputs; + } } list_for_each_entry(path, &widget->sources, list_sink) { @@ -1982,6 +1988,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, case snd_soc_dapm_out_drv: case snd_soc_dapm_input: case snd_soc_dapm_output: + case snd_soc_dapm_siggen: case snd_soc_dapm_micbias: case snd_soc_dapm_vmid: case snd_soc_dapm_pre: -- cgit v1.1 From dea8e237415f1992694b3a8625570f8920927f28 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 27 Nov 2011 16:24:05 +0000 Subject: ASoC: Make WM5100 tone generator widgets signal generators Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- sound/soc/codecs/wm5100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index 8be5dae..a234b70 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -952,7 +952,7 @@ SND_SOC_DAPM_INPUT("IN3L"), SND_SOC_DAPM_INPUT("IN3R"), SND_SOC_DAPM_INPUT("IN4L"), SND_SOC_DAPM_INPUT("IN4R"), -SND_SOC_DAPM_INPUT("TONE"), +SND_SOC_DAPM_SIGGEN("TONE"), SND_SOC_DAPM_PGA_E("IN1L PGA", WM5100_INPUT_ENABLES, WM5100_IN1L_ENA_SHIFT, 0, NULL, 0, wm5100_out_ev, SND_SOC_DAPM_POST_PMU), -- cgit v1.1 From 36c6b54cb0ec1908bc98c4d2d3b8584219f4d532 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 27 Nov 2011 16:24:18 +0000 Subject: ASoC: Make WM8962 beep a signal generator Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- sound/soc/codecs/wm8962.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 8810988..be35b64 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -2675,7 +2675,7 @@ SND_SOC_DAPM_INPUT("IN3L"), SND_SOC_DAPM_INPUT("IN3R"), SND_SOC_DAPM_INPUT("IN4L"), SND_SOC_DAPM_INPUT("IN4R"), -SND_SOC_DAPM_INPUT("Beep"), +SND_SOC_DAPM_SIGGEN("Beep"), SND_SOC_DAPM_INPUT("DMICDAT"), SND_SOC_DAPM_SUPPLY("MICBIAS", WM8962_PWR_MGMT_1, 1, 0, NULL, 0), -- cgit v1.1 From 84b315ee893676e9a9ce8ac42ab5ef44e2af3ee1 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 2 Dec 2011 10:18:28 +0100 Subject: ASoC: Drop unused state parameter from CODEC suspend callback The existence of this parameter is purely historical. None of the CODEC drivers uses it and we always pass in the same value anyway, so it should be safe to remove it. Signed-off-by: Lars-Peter Clausen Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/codecs/ac97.c | 2 +- sound/soc/codecs/ad1836.c | 2 +- sound/soc/codecs/adau1373.c | 2 +- sound/soc/codecs/adav80x.c | 2 +- sound/soc/codecs/ak4535.c | 2 +- sound/soc/codecs/ak4641.c | 2 +- sound/soc/codecs/alc5623.c | 2 +- sound/soc/codecs/alc5632.c | 2 +- sound/soc/codecs/cs4270.c | 2 +- sound/soc/codecs/cs4271.c | 2 +- sound/soc/codecs/cs42l73.c | 2 +- sound/soc/codecs/jz4740.c | 2 +- sound/soc/codecs/max98088.c | 2 +- sound/soc/codecs/max98095.c | 2 +- sound/soc/codecs/max9850.c | 2 +- sound/soc/codecs/pcm3008.c | 2 +- sound/soc/codecs/rt5631.c | 2 +- sound/soc/codecs/sgtl5000.c | 2 +- sound/soc/codecs/ssm2602.c | 2 +- sound/soc/codecs/sta32x.c | 2 +- sound/soc/codecs/stac9766.c | 3 +-- sound/soc/codecs/tlv320aic23.c | 3 +-- sound/soc/codecs/tlv320aic32x4.c | 2 +- sound/soc/codecs/tlv320aic3x.c | 2 +- sound/soc/codecs/tlv320dac33.c | 2 +- sound/soc/codecs/twl4030.c | 2 +- sound/soc/codecs/twl6040.c | 2 +- sound/soc/codecs/uda134x.c | 3 +-- sound/soc/codecs/uda1380.c | 2 +- sound/soc/codecs/wm8350.c | 2 +- sound/soc/codecs/wm8400.c | 2 +- sound/soc/codecs/wm8510.c | 2 +- sound/soc/codecs/wm8523.c | 2 +- sound/soc/codecs/wm8711.c | 2 +- sound/soc/codecs/wm8728.c | 2 +- sound/soc/codecs/wm8731.c | 2 +- sound/soc/codecs/wm8737.c | 2 +- sound/soc/codecs/wm8750.c | 2 +- sound/soc/codecs/wm8753.c | 2 +- sound/soc/codecs/wm8770.c | 2 +- sound/soc/codecs/wm8776.c | 2 +- sound/soc/codecs/wm8804.c | 2 +- sound/soc/codecs/wm8900.c | 2 +- sound/soc/codecs/wm8903.c | 2 +- sound/soc/codecs/wm8904.c | 2 +- sound/soc/codecs/wm8940.c | 2 +- sound/soc/codecs/wm8955.c | 2 +- sound/soc/codecs/wm8960.c | 2 +- sound/soc/codecs/wm8961.c | 2 +- sound/soc/codecs/wm8971.c | 2 +- sound/soc/codecs/wm8974.c | 2 +- sound/soc/codecs/wm8978.c | 2 +- sound/soc/codecs/wm8983.c | 2 +- sound/soc/codecs/wm8985.c | 2 +- sound/soc/codecs/wm8988.c | 2 +- sound/soc/codecs/wm8990.c | 2 +- sound/soc/codecs/wm8991.c | 2 +- sound/soc/codecs/wm8993.c | 2 +- sound/soc/codecs/wm8994.c | 2 +- sound/soc/codecs/wm8995.c | 2 +- sound/soc/codecs/wm9081.c | 2 +- sound/soc/codecs/wm9090.c | 2 +- sound/soc/codecs/wm9705.c | 2 +- sound/soc/codecs/wm9712.c | 3 +-- sound/soc/codecs/wm9713.c | 3 +-- sound/soc/soc-core.c | 2 +- 66 files changed, 66 insertions(+), 71 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c index 221ec29f..1bbad4c 100644 --- a/sound/soc/codecs/ac97.c +++ b/sound/soc/codecs/ac97.c @@ -99,7 +99,7 @@ static int ac97_soc_remove(struct snd_soc_codec *codec) } #ifdef CONFIG_PM -static int ac97_soc_suspend(struct snd_soc_codec *codec, pm_message_t msg) +static int ac97_soc_suspend(struct snd_soc_codec *codec) { snd_ac97_suspend(codec->ac97); diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c index fab0948..919322d 100644 --- a/sound/soc/codecs/ad1836.c +++ b/sound/soc/codecs/ad1836.c @@ -223,7 +223,7 @@ static struct snd_soc_dai_driver ad183x_dais[] = { }; #ifdef CONFIG_PM -static int ad1836_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int ad1836_suspend(struct snd_soc_codec *codec) { /* reset clock control mode */ return snd_soc_update_bits(codec, AD1836_ADC_CTRL2, diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c index 45c6302..637b114 100644 --- a/sound/soc/codecs/adau1373.c +++ b/sound/soc/codecs/adau1373.c @@ -1321,7 +1321,7 @@ static int adau1373_remove(struct snd_soc_codec *codec) return 0; } -static int adau1373_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int adau1373_suspend(struct snd_soc_codec *codec) { return adau1373_set_bias_level(codec, SND_SOC_BIAS_OFF); } diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c index f9f0894..ebd7b37 100644 --- a/sound/soc/codecs/adav80x.c +++ b/sound/soc/codecs/adav80x.c @@ -798,7 +798,7 @@ static int adav80x_probe(struct snd_soc_codec *codec) return adav80x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); } -static int adav80x_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int adav80x_suspend(struct snd_soc_codec *codec) { return adav80x_set_bias_level(codec, SND_SOC_BIAS_OFF); } diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c index e1f5310..96296fd 100644 --- a/sound/soc/codecs/ak4535.c +++ b/sound/soc/codecs/ak4535.c @@ -354,7 +354,7 @@ static struct snd_soc_dai_driver ak4535_dai = { .ops = &ak4535_dai_ops, }; -static int ak4535_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int ak4535_suspend(struct snd_soc_codec *codec) { ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c index f53f314..9018470 100644 --- a/sound/soc/codecs/ak4641.c +++ b/sound/soc/codecs/ak4641.c @@ -498,7 +498,7 @@ static struct snd_soc_dai_driver ak4641_dai[] = { }, }; -static int ak4641_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int ak4641_suspend(struct snd_soc_codec *codec) { ak4641_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c index 6a5c001..da97f02 100644 --- a/sound/soc/codecs/alc5623.c +++ b/sound/soc/codecs/alc5623.c @@ -868,7 +868,7 @@ static struct snd_soc_dai_driver alc5623_dai = { .ops = &alc5623_dai_ops, }; -static int alc5623_suspend(struct snd_soc_codec *codec, pm_message_t mesg) +static int alc5623_suspend(struct snd_soc_codec *codec) { alc5623_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index 3f750de..08613c7 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -956,7 +956,7 @@ static struct snd_soc_dai_driver alc5632_dai = { }; #ifdef CONFIG_PM -static int alc5632_suspend(struct snd_soc_codec *codec, pm_message_t mesg) +static int alc5632_suspend(struct snd_soc_codec *codec) { alc5632_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index dc77ff7..fef0f48 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c @@ -578,7 +578,7 @@ static int cs4270_remove(struct snd_soc_codec *codec) * and all registers are written back to the hardware when resuming. */ -static int cs4270_soc_suspend(struct snd_soc_codec *codec, pm_message_t mesg) +static int cs4270_soc_suspend(struct snd_soc_codec *codec) { struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); int reg, ret; diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c index a6f77a8..f6fe846 100644 --- a/sound/soc/codecs/cs4271.c +++ b/sound/soc/codecs/cs4271.c @@ -430,7 +430,7 @@ static struct snd_soc_dai_driver cs4271_dai = { }; #ifdef CONFIG_PM -static int cs4271_soc_suspend(struct snd_soc_codec *codec, pm_message_t mesg) +static int cs4271_soc_suspend(struct snd_soc_codec *codec) { int ret; /* Set power-down bit */ diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index da3125a..9d38db8 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c @@ -1262,7 +1262,7 @@ static struct snd_soc_dai_driver cs42l73_dai[] = { } }; -static int cs42l73_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int cs42l73_suspend(struct snd_soc_codec *codec) { cs42l73_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index 4fca8bc..517e2a5 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c @@ -311,7 +311,7 @@ static int jz4740_codec_dev_remove(struct snd_soc_codec *codec) #ifdef CONFIG_PM_SLEEP -static int jz4740_codec_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int jz4740_codec_suspend(struct snd_soc_codec *codec) { return jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_OFF); } diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 9b6036e..ba4f6f1 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -1946,7 +1946,7 @@ static void max98088_handle_pdata(struct snd_soc_codec *codec) } #ifdef CONFIG_PM -static int max98088_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int max98088_suspend(struct snd_soc_codec *codec) { max98088_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c index 01f4ad7..c69dd02 100644 --- a/sound/soc/codecs/max98095.c +++ b/sound/soc/codecs/max98095.c @@ -2174,7 +2174,7 @@ static void max98095_handle_pdata(struct snd_soc_codec *codec) } #ifdef CONFIG_PM -static int max98095_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int max98095_suspend(struct snd_soc_codec *codec) { max98095_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/max9850.c b/sound/soc/codecs/max9850.c index 94c2b58..7dfd6e8 100644 --- a/sound/soc/codecs/max9850.c +++ b/sound/soc/codecs/max9850.c @@ -273,7 +273,7 @@ static struct snd_soc_dai_driver max9850_dai = { }; #ifdef CONFIG_PM -static int max9850_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int max9850_suspend(struct snd_soc_codec *codec) { max9850_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/pcm3008.c b/sound/soc/codecs/pcm3008.c index b12d01f..edcaa7e 100644 --- a/sound/soc/codecs/pcm3008.c +++ b/sound/soc/codecs/pcm3008.c @@ -118,7 +118,7 @@ static int pcm3008_soc_remove(struct snd_soc_codec *codec) } #ifdef CONFIG_PM -static int pcm3008_soc_suspend(struct snd_soc_codec *codec, pm_message_t msg) +static int pcm3008_soc_suspend(struct snd_soc_codec *codec) { struct pcm3008_setup_data *setup = codec->dev->platform_data; diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index 9fd50bd..f6e4f5e 100644 --- a/sound/soc/codecs/rt5631.c +++ b/sound/soc/codecs/rt5631.c @@ -1641,7 +1641,7 @@ static int rt5631_remove(struct snd_soc_codec *codec) } #ifdef CONFIG_PM -static int rt5631_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int rt5631_suspend(struct snd_soc_codec *codec) { rt5631_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index ff0a107..2501757 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -967,7 +967,7 @@ static int sgtl5000_volatile_register(struct snd_soc_codec *codec, } #ifdef CONFIG_SUSPEND -static int sgtl5000_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int sgtl5000_suspend(struct snd_soc_codec *codec) { sgtl5000_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index 0d43e4b..7dfc7b0 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c @@ -523,7 +523,7 @@ static struct snd_soc_dai_driver ssm2602_dai = { .ops = &ssm2602_dai_ops, }; -static int ssm2602_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int ssm2602_suspend(struct snd_soc_codec *codec) { ssm2602_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index b3d1c78..6648af6 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -801,7 +801,7 @@ static struct snd_soc_dai_driver sta32x_dai = { }; #ifdef CONFIG_PM -static int sta32x_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int sta32x_suspend(struct snd_soc_codec *codec) { sta32x_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c index 5581953..e34969c 100644 --- a/sound/soc/codecs/stac9766.c +++ b/sound/soc/codecs/stac9766.c @@ -256,8 +256,7 @@ static int stac9766_reset(struct snd_soc_codec *codec, int try_warm) return 0; } -static int stac9766_codec_suspend(struct snd_soc_codec *codec, - pm_message_t state) +static int stac9766_codec_suspend(struct snd_soc_codec *codec) { stac9766_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index cba798e..60d08ae 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c @@ -528,8 +528,7 @@ static struct snd_soc_dai_driver tlv320aic23_dai = { .ops = &tlv320aic23_dai_ops, }; -static int tlv320aic23_suspend(struct snd_soc_codec *codec, - pm_message_t state) +static int tlv320aic23_suspend(struct snd_soc_codec *codec) { tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index f553375..81a26e1 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c @@ -621,7 +621,7 @@ static struct snd_soc_dai_driver aic32x4_dai = { .symmetric_rates = 1, }; -static int aic32x4_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int aic32x4_suspend(struct snd_soc_codec *codec) { aic32x4_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 21625dd..6f963c5 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -1268,7 +1268,7 @@ static struct snd_soc_dai_driver aic3x_dai = { .symmetric_rates = 1, }; -static int aic3x_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int aic3x_suspend(struct snd_soc_codec *codec) { aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index 6b0f0e2..c7a61fb 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c @@ -1460,7 +1460,7 @@ static int dac33_soc_remove(struct snd_soc_codec *codec) return 0; } -static int dac33_soc_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int dac33_soc_suspend(struct snd_soc_codec *codec) { dac33_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 61d8a90..18e7101 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c @@ -2202,7 +2202,7 @@ static struct snd_soc_dai_driver twl4030_dai[] = { }, }; -static int twl4030_soc_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int twl4030_soc_suspend(struct snd_soc_codec *codec) { twl4030_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index a4a65dc..3376e6f 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c @@ -1470,7 +1470,7 @@ static struct snd_soc_dai_driver twl6040_dai[] = { }; #ifdef CONFIG_PM -static int twl6040_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int twl6040_suspend(struct snd_soc_codec *codec) { twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index d0f9d90..8f4f469 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c @@ -571,8 +571,7 @@ static int uda134x_soc_remove(struct snd_soc_codec *codec) } #if defined(CONFIG_PM) -static int uda134x_soc_suspend(struct snd_soc_codec *codec, - pm_message_t state) +static int uda134x_soc_suspend(struct snd_soc_codec *codec) { uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); uda134x_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index 6b933ef..d08b91d 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c @@ -705,7 +705,7 @@ static struct snd_soc_dai_driver uda1380_dai[] = { }, }; -static int uda1380_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int uda1380_suspend(struct snd_soc_codec *codec) { uda1380_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 3f1ed5f..f39497fc1 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c @@ -1315,7 +1315,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec, return 0; } -static int wm8350_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8350_suspend(struct snd_soc_codec *codec) { wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index a1173eb..56a7b72 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c @@ -1352,7 +1352,7 @@ static struct snd_soc_dai_driver wm8400_dai = { .ops = &wm8400_dai_ops, }; -static int wm8400_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8400_suspend(struct snd_soc_codec *codec) { wm8400_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index 3a65571..5e84750 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c @@ -534,7 +534,7 @@ static struct snd_soc_dai_driver wm8510_dai = { .symmetric_rates = 1, }; -static int wm8510_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8510_suspend(struct snd_soc_codec *codec) { wm8510_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c index 0c89f8e..7fea2c3 100644 --- a/sound/soc/codecs/wm8523.c +++ b/sound/soc/codecs/wm8523.c @@ -384,7 +384,7 @@ static struct snd_soc_dai_driver wm8523_dai = { }; #ifdef CONFIG_PM -static int wm8523_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8523_suspend(struct snd_soc_codec *codec) { wm8523_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c index 760080e..b9b1a2f 100644 --- a/sound/soc/codecs/wm8711.c +++ b/sound/soc/codecs/wm8711.c @@ -338,7 +338,7 @@ static struct snd_soc_dai_driver wm8711_dai = { .ops = &wm8711_ops, }; -static int wm8711_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8711_suspend(struct snd_soc_codec *codec) { snd_soc_write(codec, WM8711_ACTIVE, 0x0); wm8711_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c index 085c2f8..b1f01d9 100644 --- a/sound/soc/codecs/wm8728.c +++ b/sound/soc/codecs/wm8728.c @@ -214,7 +214,7 @@ static struct snd_soc_dai_driver wm8728_dai = { .ops = &wm8728_dai_ops, }; -static int wm8728_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8728_suspend(struct snd_soc_codec *codec) { wm8728_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index c18dee0..8821af7 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c @@ -490,7 +490,7 @@ static struct snd_soc_dai_driver wm8731_dai = { }; #ifdef CONFIG_PM -static int wm8731_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8731_suspend(struct snd_soc_codec *codec) { wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c index c13e4f7..ff95e62c 100644 --- a/sound/soc/codecs/wm8737.c +++ b/sound/soc/codecs/wm8737.c @@ -539,7 +539,7 @@ static struct snd_soc_dai_driver wm8737_dai = { }; #ifdef CONFIG_PM -static int wm8737_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8737_suspend(struct snd_soc_codec *codec) { wm8737_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index b312fccb..48cb78f 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c @@ -666,7 +666,7 @@ static struct snd_soc_dai_driver wm8750_dai = { .ops = &wm8750_dai_ops, }; -static int wm8750_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8750_suspend(struct snd_soc_codec *codec) { wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index dc31538..b114c19 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c @@ -1380,7 +1380,7 @@ static void wm8753_work(struct work_struct *work) wm8753_set_bias_level(codec, dapm->bias_level); } -static int wm8753_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8753_suspend(struct snd_soc_codec *codec) { wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index 391c385..8976eb5 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c @@ -555,7 +555,7 @@ static struct snd_soc_dai_driver wm8770_dai = { }; #ifdef CONFIG_PM -static int wm8770_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8770_suspend(struct snd_soc_codec *codec) { wm8770_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index af542a2..fbf80c5 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c @@ -371,7 +371,7 @@ static struct snd_soc_dai_driver wm8776_dai[] = { }; #ifdef CONFIG_PM -static int wm8776_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8776_suspend(struct snd_soc_codec *codec) { wm8776_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c index d99c6a0..ae4b8fb 100644 --- a/sound/soc/codecs/wm8804.c +++ b/sound/soc/codecs/wm8804.c @@ -542,7 +542,7 @@ static int wm8804_set_bias_level(struct snd_soc_codec *codec, } #ifdef CONFIG_PM -static int wm8804_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8804_suspend(struct snd_soc_codec *codec) { wm8804_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index 6ac80cf..85632ff 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c @@ -1106,7 +1106,7 @@ static int wm8900_set_bias_level(struct snd_soc_codec *codec, return 0; } -static int wm8900_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8900_suspend(struct snd_soc_codec *codec) { struct wm8900_priv *wm8900 = snd_soc_codec_get_drvdata(codec); int fll_out = wm8900->fll_out; diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 70a2268..d663c97 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -1758,7 +1758,7 @@ static struct snd_soc_dai_driver wm8903_dai = { .symmetric_rates = 1, }; -static int wm8903_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8903_suspend(struct snd_soc_codec *codec) { wm8903_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index babca49..f0ae01b 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c @@ -2234,7 +2234,7 @@ static struct snd_soc_dai_driver wm8904_dai = { }; #ifdef CONFIG_PM -static int wm8904_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8904_suspend(struct snd_soc_codec *codec) { wm8904_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index 9f1cce8..0fe4545 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c @@ -672,7 +672,7 @@ static struct snd_soc_dai_driver wm8940_dai = { .symmetric_rates = 1, }; -static int wm8940_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8940_suspend(struct snd_soc_codec *codec) { return wm8940_set_bias_level(codec, SND_SOC_BIAS_OFF); } diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index ca38722..cdd5139 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c @@ -878,7 +878,7 @@ static struct snd_soc_dai_driver wm8955_dai = { }; #ifdef CONFIG_PM -static int wm8955_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8955_suspend(struct snd_soc_codec *codec) { wm8955_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index ed2773f6..55b9a25 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -894,7 +894,7 @@ static struct snd_soc_dai_driver wm8960_dai = { .symmetric_rates = 1, }; -static int wm8960_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8960_suspend(struct snd_soc_codec *codec) { struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index c058701..9bcf846 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -1038,7 +1038,7 @@ static int wm8961_remove(struct snd_soc_codec *codec) } #ifdef CONFIG_PM -static int wm8961_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8961_suspend(struct snd_soc_codec *codec) { wm8961_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index b01df56..aadd14a 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c @@ -599,7 +599,7 @@ static void wm8971_work(struct work_struct *work) wm8971_set_bias_level(codec, codec->dapm.bias_level); } -static int wm8971_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8971_suspend(struct snd_soc_codec *codec) { wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index e41f999..a5fd017 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c @@ -582,7 +582,7 @@ static struct snd_soc_dai_driver wm8974_dai = { .symmetric_rates = 1, }; -static int wm8974_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8974_suspend(struct snd_soc_codec *codec) { wm8974_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c index 649a2e3..85d514d 100644 --- a/sound/soc/codecs/wm8978.c +++ b/sound/soc/codecs/wm8978.c @@ -892,7 +892,7 @@ static struct snd_soc_dai_driver wm8978_dai = { .ops = &wm8978_dai_ops, }; -static int wm8978_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8978_suspend(struct snd_soc_codec *codec) { wm8978_set_bias_level(codec, SND_SOC_BIAS_OFF); /* Also switch PLL off */ diff --git a/sound/soc/codecs/wm8983.c b/sound/soc/codecs/wm8983.c index 362298c..cebde56 100644 --- a/sound/soc/codecs/wm8983.c +++ b/sound/soc/codecs/wm8983.c @@ -974,7 +974,7 @@ static int wm8983_set_bias_level(struct snd_soc_codec *codec, } #ifdef CONFIG_PM -static int wm8983_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8983_suspend(struct snd_soc_codec *codec) { wm8983_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c index 9e4481b..c0c86b3 100644 --- a/sound/soc/codecs/wm8985.c +++ b/sound/soc/codecs/wm8985.c @@ -945,7 +945,7 @@ static int wm8985_set_bias_level(struct snd_soc_codec *codec, } #ifdef CONFIG_PM -static int wm8985_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8985_suspend(struct snd_soc_codec *codec) { wm8985_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index 608c672..0938847 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c @@ -728,7 +728,7 @@ static struct snd_soc_dai_driver wm8988_dai = { .symmetric_rates = 1, }; -static int wm8988_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8988_suspend(struct snd_soc_codec *codec) { wm8988_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index 58d7f0b..b417d2e 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c @@ -1313,7 +1313,7 @@ static struct snd_soc_dai_driver wm8990_dai = { .ops = &wm8990_dai_ops, }; -static int wm8990_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8990_suspend(struct snd_soc_codec *codec) { wm8990_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c index 35c5389..7ee40da 100644 --- a/sound/soc/codecs/wm8991.c +++ b/sound/soc/codecs/wm8991.c @@ -1240,7 +1240,7 @@ static int wm8991_set_bias_level(struct snd_soc_codec *codec, return 0; } -static int wm8991_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8991_suspend(struct snd_soc_codec *codec) { wm8991_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index 780c24c..0f8278b 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c @@ -1544,7 +1544,7 @@ static int wm8993_remove(struct snd_soc_codec *codec) } #ifdef CONFIG_PM -static int wm8993_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8993_suspend(struct snd_soc_codec *codec) { struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); int fll_fout = wm8993->fll_fout; diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 0699ed2..d9faa39 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -2801,7 +2801,7 @@ static struct snd_soc_dai_driver wm8994_dai[] = { }; #ifdef CONFIG_PM -static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8994_suspend(struct snd_soc_codec *codec) { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); struct wm8994 *control = wm8994->wm8994; diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c index 8f6a36d..5863406 100644 --- a/sound/soc/codecs/wm8995.c +++ b/sound/soc/codecs/wm8995.c @@ -2009,7 +2009,7 @@ static int wm8995_set_bias_level(struct snd_soc_codec *codec, } #ifdef CONFIG_PM -static int wm8995_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm8995_suspend(struct snd_soc_codec *codec) { wm8995_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 8a4b970..1f2672b 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c @@ -1302,7 +1302,7 @@ static int wm9081_remove(struct snd_soc_codec *codec) } #ifdef CONFIG_PM -static int wm9081_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm9081_suspend(struct snd_soc_codec *codec) { wm9081_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c index f94c060..5cb8759 100644 --- a/sound/soc/codecs/wm9090.c +++ b/sound/soc/codecs/wm9090.c @@ -604,7 +604,7 @@ static int wm9090_probe(struct snd_soc_codec *codec) } #ifdef CONFIG_PM -static int wm9090_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int wm9090_suspend(struct snd_soc_codec *codec) { wm9090_set_bias_level(codec, SND_SOC_BIAS_OFF); diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index b720a43..40c92ea 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c @@ -306,7 +306,7 @@ static int wm9705_reset(struct snd_soc_codec *codec) } #ifdef CONFIG_PM -static int wm9705_soc_suspend(struct snd_soc_codec *codec, pm_message_t msg) +static int wm9705_soc_suspend(struct snd_soc_codec *codec) { soc_ac97_ops.write(codec->ac97, AC97_POWERDOWN, 0xffff); diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 4ce73f5..b7b31f8 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c @@ -583,8 +583,7 @@ err: return -EIO; } -static int wm9712_soc_suspend(struct snd_soc_codec *codec, - pm_message_t state) +static int wm9712_soc_suspend(struct snd_soc_codec *codec) { wm9712_set_bias_level(codec, SND_SOC_BIAS_OFF); return 0; diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index edb5981..2b8479b 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c @@ -1140,8 +1140,7 @@ static int wm9713_set_bias_level(struct snd_soc_codec *codec, return 0; } -static int wm9713_soc_suspend(struct snd_soc_codec *codec, - pm_message_t state) +static int wm9713_soc_suspend(struct snd_soc_codec *codec) { u16 reg; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index ec783f0..5195f06 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -572,7 +572,7 @@ int snd_soc_suspend(struct device *dev) switch (codec->dapm.bias_level) { case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_OFF: - codec->driver->suspend(codec, PMSG_SUSPEND); + codec->driver->suspend(codec); codec->suspended = 1; codec->cache_sync = 1; break; -- cgit v1.1 From 6f526f0a86dbb22fd2fc5a873f55c9e2341a79c0 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Thu, 1 Dec 2011 13:49:19 -0700 Subject: ASoC: WM8903: Disallow all invalid gpio_cfg pdata values The GPIO registers are 15 bits wide. Hence values, higher than 0x7fff are not legal GPIO register values. Modify the pdata.gpio_cfg handling code to reject all illegal values, not just WM8903_GPIO_NO_CONFIG (0x8000). This will allow the later use of 0xffffffff as an invalid value in future device tree bindings, meaning "don't touch this GPIO's configuration". Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/codecs/wm8903.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index d663c97..60ad8cd 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -1936,11 +1936,11 @@ static int wm8903_probe(struct snd_soc_codec *codec) bool mic_gpio = false; for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) { - if (pdata->gpio_cfg[i] == WM8903_GPIO_NO_CONFIG) + if (pdata->gpio_cfg[i] > 0x7fff) continue; snd_soc_write(codec, WM8903_GPIO_CONTROL_1 + i, - pdata->gpio_cfg[i] & 0xffff); + pdata->gpio_cfg[i] & 0x7fff); val = (pdata->gpio_cfg[i] & WM8903_GP1_FN_MASK) >> WM8903_GP1_FN_SHIFT; -- cgit v1.1 From a806aa9207ad59933464efbe6009394723713c0d Mon Sep 17 00:00:00 2001 From: Timur Tabi Date: Thu, 1 Dec 2011 19:52:46 -0600 Subject: ASoC: p1022ds: add support for fsl,P1022 and fsl,P1022DS model names Commit ab827d97 ("powerpc/85xx: Rework P1022DS device tree") renamed the the /model property of the P1022DS device tree from "fsl,P1022" to "fsl,P1022DS". To support both old and new device trees, the ASoC machine driver for the P1022DS needs to query the /model property and update the platform driver object dynamically. Signed-off-by: Timur Tabi Signed-off-by: Mark Brown --- sound/soc/fsl/p1022_ds.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c index 2c064a9..30916265 100644 --- a/sound/soc/fsl/p1022_ds.c +++ b/sound/soc/fsl/p1022_ds.c @@ -540,12 +540,6 @@ static struct platform_driver p1022_ds_driver = { .probe = p1022_ds_probe, .remove = __devexit_p(p1022_ds_remove), .driver = { - /* The name must match the 'model' property in the device tree, - * in lowercase letters, but only the part after that last - * comma. This is because some model properties have a "fsl," - * prefix. - */ - .name = "snd-soc-p1022", .owner = THIS_MODULE, }, }; @@ -559,13 +553,39 @@ static int __init p1022_ds_init(void) { struct device_node *guts_np; struct resource res; + const char *sprop; + + /* + * Check if we're actually running on a P1022DS. Older device trees + * have a model of "fsl,P1022" and newer ones use "fsl,P1022DS", so we + * need to support both. The SSI driver uses that property to link to + * the machine driver, so have to match it. + */ + sprop = of_get_property(of_find_node_by_path("/"), "model", NULL); + if (!sprop) { + pr_err("snd-soc-p1022ds: missing /model node"); + return -ENODEV; + } + + pr_debug("snd-soc-p1022ds: board model name is %s\n", sprop); - pr_info("Freescale P1022 DS ALSA SoC machine driver\n"); + /* + * The name of this board, taken from the device tree. Normally, this is a* + * fixed string, but some P1022DS device trees have a /model property of + * "fsl,P1022", and others have "fsl,P1022DS". + */ + if (strcasecmp(sprop, "fsl,p1022ds") == 0) + p1022_ds_driver.driver.name = "snd-soc-p1022ds"; + else if (strcasecmp(sprop, "fsl,p1022") == 0) + p1022_ds_driver.driver.name = "snd-soc-p1022"; + else + return -ENODEV; /* Get the physical address of the global utilities registers */ guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts"); if (of_address_to_resource(guts_np, 0, &res)) { - pr_err("p1022-ds: missing/invalid global utilities node\n"); + pr_err("snd-soc-p1022ds: missing/invalid global utils node\n"); + of_node_put(guts_np); return -EINVAL; } guts_phys = res.start; -- cgit v1.1 From 6132725eac521b89dee3d58df3c6d04a1e50844c Mon Sep 17 00:00:00 2001 From: Timur Tabi Date: Thu, 1 Dec 2011 19:52:47 -0600 Subject: ASoC: fsl/powerpc: don't rely on the cell-index property Instead of using the 'cell-index' property in the I2C adapter node to determine the adapter number, just query the i2c_adapter object directly. Previously, the I2C nodes always appeared in cell-index order, so the dynamic numbering coincided with the cell-index property. With commit ab827d97 ("powerpc/85xx: Rework P1022DS device tree"), the I2C nodes are unintentionally reversed in the device tree, and so the machine driver guesses the wrong I2C adapter number. Signed-off-by: Timur Tabi Signed-off-by: Mark Brown --- sound/soc/fsl/mpc8610_hpcd.c | 13 ++++++++----- sound/soc/fsl/p1022_ds.c | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index ae49f1c..0ea4a5a 100644 --- a/sound/soc/fsl/mpc8610_hpcd.c +++ b/sound/soc/fsl/mpc8610_hpcd.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -249,8 +250,9 @@ static int get_parent_cell_index(struct device_node *np) static int codec_node_dev_name(struct device_node *np, char *buf, size_t len) { const u32 *iprop; - int bus, addr; + int addr; char temp[DAI_NAME_SIZE]; + struct i2c_client *i2c; of_modalias_node(np, temp, DAI_NAME_SIZE); @@ -260,11 +262,12 @@ static int codec_node_dev_name(struct device_node *np, char *buf, size_t len) addr = be32_to_cpup(iprop); - bus = get_parent_cell_index(np); - if (bus < 0) - return bus; + /* We need the adapter number */ + i2c = of_find_i2c_device_by_node(np); + if (!i2c) + return -ENODEV; - snprintf(buf, len, "%s-codec.%u-%04x", temp, bus, addr); + snprintf(buf, len, "%s-codec.%u-%04x", temp, i2c->adapter->nr, addr); return 0; } diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c index 30916265..a5d4e80 100644 --- a/sound/soc/fsl/p1022_ds.c +++ b/sound/soc/fsl/p1022_ds.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -252,8 +253,9 @@ static int get_parent_cell_index(struct device_node *np) static int codec_node_dev_name(struct device_node *np, char *buf, size_t len) { const u32 *iprop; - int bus, addr; + int addr; char temp[DAI_NAME_SIZE]; + struct i2c_client *i2c; of_modalias_node(np, temp, DAI_NAME_SIZE); @@ -263,11 +265,12 @@ static int codec_node_dev_name(struct device_node *np, char *buf, size_t len) addr = be32_to_cpup(iprop); - bus = get_parent_cell_index(np); - if (bus < 0) - return bus; + /* We need the adapter number */ + i2c = of_find_i2c_device_by_node(np); + if (!i2c) + return -ENODEV; - snprintf(buf, len, "%s.%u-%04x", temp, bus, addr); + snprintf(buf, len, "%s.%u-%04x", temp, i2c->adapter->nr, addr); return 0; } -- cgit v1.1 From 3631e8d43e385e851f88637244a287433246c097 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 10:55:12 +0000 Subject: ASoC: Add missing err label Reported-by: Stephen Rothwell Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index d9faa39..83e8033 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3881,6 +3881,7 @@ err_irq: wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec); wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec); wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec); +err: return ret; } -- cgit v1.1 From f2e2026c98b74028b55901711c5df98e6d2ad8c6 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 15:55:52 +0000 Subject: ASoC: Add WM8958 based headset detection on Littlemill The board supports CODECs that won't work with this but the CODEC driver will check to see if it's running on the right chip for us. Signed-off-by: Mark Brown --- sound/soc/samsung/littlemill.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sound') diff --git a/sound/soc/samsung/littlemill.c b/sound/soc/samsung/littlemill.c index d2a44ab..5d7680f 100644 --- a/sound/soc/samsung/littlemill.c +++ b/sound/soc/samsung/littlemill.c @@ -154,8 +154,11 @@ static struct snd_soc_dapm_route audio_paths[] = { { "Headphone", NULL, "HPOUT1R" }, }; +static struct snd_soc_jack littlemill_headset; + static int littlemill_late_probe(struct snd_soc_card *card) { + struct snd_soc_codec *codec = card->rtd[0].codec; struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; int ret; @@ -164,6 +167,18 @@ static int littlemill_late_probe(struct snd_soc_card *card) if (ret < 0) return ret; + ret = snd_soc_jack_new(codec, "Headset", + SND_JACK_HEADSET | SND_JACK_MECHANICAL | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3 | + SND_JACK_BTN_4 | SND_JACK_BTN_5, + &littlemill_headset); + if (ret) + return ret; + + /* This will check device compatibility itself */ + wm8958_mic_detect(codec, &littlemill_headset, NULL, NULL); + return 0; } -- cgit v1.1 From 91e20854e58075231c72a9c63d4454616787557e Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 16:01:41 +0000 Subject: ASoC: Convert WM8994 MICBIASes to supply widgets There are some in tree systems using the driver but none use the MICBIAS widgets. Signed-off-by: Mark Brown --- sound/soc/codecs/wm_hubs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index d1debfb..2a61094 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c @@ -610,8 +610,8 @@ SND_SOC_DAPM_INPUT("IN1RP"), SND_SOC_DAPM_INPUT("IN2RN"), SND_SOC_DAPM_INPUT("IN2RP:VXRP"), -SND_SOC_DAPM_MICBIAS("MICBIAS2", WM8993_POWER_MANAGEMENT_1, 5, 0), -SND_SOC_DAPM_MICBIAS("MICBIAS1", WM8993_POWER_MANAGEMENT_1, 4, 0), +SND_SOC_DAPM_SUPPLY("MICBIAS2", WM8993_POWER_MANAGEMENT_1, 5, 0, NULL, 0), +SND_SOC_DAPM_SUPPLY("MICBIAS1", WM8993_POWER_MANAGEMENT_1, 4, 0, NULL, 0), SND_SOC_DAPM_MIXER("IN1L PGA", WM8993_POWER_MANAGEMENT_2, 6, 0, in1l_pga, ARRAY_SIZE(in1l_pga)), -- cgit v1.1 From 8f103167fecb1f4b5888fbcfc81b67e3c810dee0 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 17:36:06 +0000 Subject: ASoC: Map microphones on Littlemill Littlemill has one analogue microphone on the board (connected to IN1LN) and an array of four DMICs connected to both DMICDAT lines. The biases can be selected by jumpers but pick the default jumper fit. Signed-off-by: Mark Brown --- sound/soc/samsung/littlemill.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sound') diff --git a/sound/soc/samsung/littlemill.c b/sound/soc/samsung/littlemill.c index 5d7680f..5cea59b 100644 --- a/sound/soc/samsung/littlemill.c +++ b/sound/soc/samsung/littlemill.c @@ -147,11 +147,21 @@ static struct snd_soc_dai_link littlemill_dai[] = { static struct snd_soc_dapm_widget widgets[] = { SND_SOC_DAPM_HP("Headphone", NULL), + + SND_SOC_DAPM_MIC("AMIC", NULL), + SND_SOC_DAPM_MIC("DMIC", NULL), }; static struct snd_soc_dapm_route audio_paths[] = { { "Headphone", NULL, "HPOUT1L" }, { "Headphone", NULL, "HPOUT1R" }, + + { "AMIC", NULL, "MICBIAS1" }, /* Default for AMICBIAS jumper */ + { "IN1LN", NULL, "AMIC" }, + + { "DMIC", NULL, "MICBIAS2" }, /* Default for DMICBIAS jumper */ + { "DMIC1DAT", NULL, "DMIC" }, + { "DMIC2DAT", NULL, "DMIC" }, }; static struct snd_soc_jack littlemill_headset; -- cgit v1.1 From 2950cd2208174af9be430f6b6f1507d429c366ca Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 10:59:32 +0000 Subject: ASoC: Convert WM8903 to devm_kzalloc() Signed-off-by: Mark Brown Tested-by: Stephen Warren --- sound/soc/codecs/wm8903.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 60ad8cd..12eedaf 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -2079,7 +2079,8 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, struct wm8903_priv *wm8903; int ret; - wm8903 = kzalloc(sizeof(struct wm8903_priv), GFP_KERNEL); + wm8903 = devm_kzalloc(&i2c->dev, sizeof(struct wm8903_priv), + GFP_KERNEL); if (wm8903 == NULL) return -ENOMEM; @@ -2088,15 +2089,13 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8903, &wm8903_dai, 1); - if (ret < 0) - kfree(wm8903); + return ret; } static __devexit int wm8903_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From f4a10837c9dd473cd615766cf38f33a3c1f745cf Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 18:21:28 +0000 Subject: ASoC: Use table based control init for WM8903 Signed-off-by: Mark Brown Tested-by: Stephen Warren --- sound/soc/codecs/wm8903.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 12eedaf..76c7c2b 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -2034,9 +2034,6 @@ static int wm8903_probe(struct snd_soc_codec *codec) WM8903_DAC_MUTEMODE | WM8903_DAC_MUTE, WM8903_DAC_MUTEMODE | WM8903_DAC_MUTE); - snd_soc_add_controls(codec, wm8903_snd_controls, - ARRAY_SIZE(wm8903_snd_controls)); - wm8903_init_gpio(codec); return ret; @@ -2066,6 +2063,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8903 = { .reg_cache_default = wm8903_reg_defaults, .volatile_register = wm8903_volatile_register, .seq_notifier = wm8903_seq_notifier, + .controls = wm8903_snd_controls, + .num_controls = ARRAY_SIZE(wm8903_snd_controls), .dapm_widgets = wm8903_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(wm8903_dapm_widgets), .dapm_routes = wm8903_intercon, -- cgit v1.1 From 88a1b12b9c70d1b2ea4d11bdfa6ae65c9570909b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 18:21:52 +0000 Subject: ASoC: WM8903 only supports I2C so don't ifdef it Signed-off-by: Mark Brown Tested-by: Stephen Warren --- sound/soc/codecs/wm8903.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 76c7c2b..7456812 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -2071,7 +2071,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8903 = { .num_dapm_routes = ARRAY_SIZE(wm8903_intercon), }; -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { @@ -2113,27 +2112,22 @@ static struct i2c_driver wm8903_i2c_driver = { .remove = __devexit_p(wm8903_i2c_remove), .id_table = wm8903_i2c_id, }; -#endif static int __init wm8903_modinit(void) { int ret = 0; -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) ret = i2c_add_driver(&wm8903_i2c_driver); if (ret != 0) { printk(KERN_ERR "Failed to register wm8903 I2C driver: %d\n", ret); } -#endif return ret; } module_init(wm8903_modinit); static void __exit wm8903_exit(void) { -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) i2c_del_driver(&wm8903_i2c_driver); -#endif } module_exit(wm8903_exit); -- cgit v1.1 From 45e967553f3466f773ecd418c09fe92b753f18b0 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 18:23:37 +0000 Subject: ASoC: Use a normal cache sync for WM8903 The driver used to use a complicated method to sync the register cache after having brought the bias level up to standby in resume due to the use of the write sequencer to manage the initial power up. Now that we don't use the write sequencer there is no need for this and we can just use snd_soc_cache_sync() directly. Signed-off-by: Mark Brown Tested-by: Stephen Warren --- sound/soc/codecs/wm8903.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 7456812..fdc3ff0 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -1767,23 +1767,11 @@ static int wm8903_suspend(struct snd_soc_codec *codec) static int wm8903_resume(struct snd_soc_codec *codec) { - int i; - u16 *reg_cache = codec->reg_cache; - u16 *tmp_cache = kmemdup(reg_cache, sizeof(wm8903_reg_defaults), - GFP_KERNEL); + struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); - /* Bring the codec back up to standby first to minimise pop/clicks */ - wm8903_set_bias_level(codec, SND_SOC_BIAS_STANDBY); + snd_soc_cache_sync(codec); - /* Sync back everything else */ - if (tmp_cache) { - for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++) - if (tmp_cache[i] != reg_cache[i]) - snd_soc_write(codec, i, tmp_cache[i]); - kfree(tmp_cache); - } else { - dev_err(codec->dev, "Failed to allocate temporary cache\n"); - } + wm8903_set_bias_level(codec, SND_SOC_BIAS_STANDBY); return 0; } -- cgit v1.1 From 82ae55dbcc4a37a4288346795755da5e07c09d33 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 18:24:40 +0000 Subject: ASoC: Don't resync WM8903 register cache on reset We only do this on initial power on so it's at best a waste of time as the core will have already defaulted to the same values. Signed-off-by: Mark Brown Tested-by: Stephen Warren --- sound/soc/codecs/wm8903.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index fdc3ff0..d840cbf 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -260,8 +260,6 @@ static int wm8903_volatile_register(struct snd_soc_codec *codec, unsigned int re static void wm8903_reset(struct snd_soc_codec *codec) { snd_soc_write(codec, WM8903_SW_RESET_AND_ID, 0); - memcpy(codec->reg_cache, wm8903_reg_defaults, - sizeof(wm8903_reg_defaults)); } static int wm8903_cp_event(struct snd_soc_dapm_widget *w, -- cgit v1.1 From ee244ce4ea5651989229d7f287f777f68104a59a Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 18:33:32 +0000 Subject: ASoC: Convert WM8903 to direct regmap API usage Converting to an rbtree cache as regcache doesn't have a flat cache. Since the top of the register map is fairly sparse this should be an overall win. Signed-off-by: Mark Brown Tested-by: Stephen Warren --- sound/soc/codecs/wm8903.c | 378 ++++++++++++++++++++++++---------------------- 1 file changed, 196 insertions(+), 182 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index d840cbf..0b12a552 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -37,184 +38,84 @@ #include "wm8903.h" /* Register defaults at reset */ -static u16 wm8903_reg_defaults[] = { - 0x8903, /* R0 - SW Reset and ID */ - 0x0000, /* R1 - Revision Number */ - 0x0000, /* R2 */ - 0x0000, /* R3 */ - 0x0018, /* R4 - Bias Control 0 */ - 0x0000, /* R5 - VMID Control 0 */ - 0x0000, /* R6 - Mic Bias Control 0 */ - 0x0000, /* R7 */ - 0x0001, /* R8 - Analogue DAC 0 */ - 0x0000, /* R9 */ - 0x0001, /* R10 - Analogue ADC 0 */ - 0x0000, /* R11 */ - 0x0000, /* R12 - Power Management 0 */ - 0x0000, /* R13 - Power Management 1 */ - 0x0000, /* R14 - Power Management 2 */ - 0x0000, /* R15 - Power Management 3 */ - 0x0000, /* R16 - Power Management 4 */ - 0x0000, /* R17 - Power Management 5 */ - 0x0000, /* R18 - Power Management 6 */ - 0x0000, /* R19 */ - 0x0400, /* R20 - Clock Rates 0 */ - 0x0D07, /* R21 - Clock Rates 1 */ - 0x0000, /* R22 - Clock Rates 2 */ - 0x0000, /* R23 */ - 0x0050, /* R24 - Audio Interface 0 */ - 0x0242, /* R25 - Audio Interface 1 */ - 0x0008, /* R26 - Audio Interface 2 */ - 0x0022, /* R27 - Audio Interface 3 */ - 0x0000, /* R28 */ - 0x0000, /* R29 */ - 0x00C0, /* R30 - DAC Digital Volume Left */ - 0x00C0, /* R31 - DAC Digital Volume Right */ - 0x0000, /* R32 - DAC Digital 0 */ - 0x0000, /* R33 - DAC Digital 1 */ - 0x0000, /* R34 */ - 0x0000, /* R35 */ - 0x00C0, /* R36 - ADC Digital Volume Left */ - 0x00C0, /* R37 - ADC Digital Volume Right */ - 0x0000, /* R38 - ADC Digital 0 */ - 0x0073, /* R39 - Digital Microphone 0 */ - 0x09BF, /* R40 - DRC 0 */ - 0x3241, /* R41 - DRC 1 */ - 0x0020, /* R42 - DRC 2 */ - 0x0000, /* R43 - DRC 3 */ - 0x0085, /* R44 - Analogue Left Input 0 */ - 0x0085, /* R45 - Analogue Right Input 0 */ - 0x0044, /* R46 - Analogue Left Input 1 */ - 0x0044, /* R47 - Analogue Right Input 1 */ - 0x0000, /* R48 */ - 0x0000, /* R49 */ - 0x0008, /* R50 - Analogue Left Mix 0 */ - 0x0004, /* R51 - Analogue Right Mix 0 */ - 0x0000, /* R52 - Analogue Spk Mix Left 0 */ - 0x0000, /* R53 - Analogue Spk Mix Left 1 */ - 0x0000, /* R54 - Analogue Spk Mix Right 0 */ - 0x0000, /* R55 - Analogue Spk Mix Right 1 */ - 0x0000, /* R56 */ - 0x002D, /* R57 - Analogue OUT1 Left */ - 0x002D, /* R58 - Analogue OUT1 Right */ - 0x0039, /* R59 - Analogue OUT2 Left */ - 0x0039, /* R60 - Analogue OUT2 Right */ - 0x0100, /* R61 */ - 0x0139, /* R62 - Analogue OUT3 Left */ - 0x0139, /* R63 - Analogue OUT3 Right */ - 0x0000, /* R64 */ - 0x0000, /* R65 - Analogue SPK Output Control 0 */ - 0x0000, /* R66 */ - 0x0010, /* R67 - DC Servo 0 */ - 0x0100, /* R68 */ - 0x00A4, /* R69 - DC Servo 2 */ - 0x0807, /* R70 */ - 0x0000, /* R71 */ - 0x0000, /* R72 */ - 0x0000, /* R73 */ - 0x0000, /* R74 */ - 0x0000, /* R75 */ - 0x0000, /* R76 */ - 0x0000, /* R77 */ - 0x0000, /* R78 */ - 0x000E, /* R79 */ - 0x0000, /* R80 */ - 0x0000, /* R81 */ - 0x0000, /* R82 */ - 0x0000, /* R83 */ - 0x0000, /* R84 */ - 0x0000, /* R85 */ - 0x0000, /* R86 */ - 0x0006, /* R87 */ - 0x0000, /* R88 */ - 0x0000, /* R89 */ - 0x0000, /* R90 - Analogue HP 0 */ - 0x0060, /* R91 */ - 0x0000, /* R92 */ - 0x0000, /* R93 */ - 0x0000, /* R94 - Analogue Lineout 0 */ - 0x0060, /* R95 */ - 0x0000, /* R96 */ - 0x0000, /* R97 */ - 0x0000, /* R98 - Charge Pump 0 */ - 0x1F25, /* R99 */ - 0x2B19, /* R100 */ - 0x01C0, /* R101 */ - 0x01EF, /* R102 */ - 0x2B00, /* R103 */ - 0x0000, /* R104 - Class W 0 */ - 0x01C0, /* R105 */ - 0x1C10, /* R106 */ - 0x0000, /* R107 */ - 0x0000, /* R108 - Write Sequencer 0 */ - 0x0000, /* R109 - Write Sequencer 1 */ - 0x0000, /* R110 - Write Sequencer 2 */ - 0x0000, /* R111 - Write Sequencer 3 */ - 0x0000, /* R112 - Write Sequencer 4 */ - 0x0000, /* R113 */ - 0x0000, /* R114 - Control Interface */ - 0x0000, /* R115 */ - 0x00A8, /* R116 - GPIO Control 1 */ - 0x00A8, /* R117 - GPIO Control 2 */ - 0x00A8, /* R118 - GPIO Control 3 */ - 0x0220, /* R119 - GPIO Control 4 */ - 0x01A0, /* R120 - GPIO Control 5 */ - 0x0000, /* R121 - Interrupt Status 1 */ - 0xFFFF, /* R122 - Interrupt Status 1 Mask */ - 0x0000, /* R123 - Interrupt Polarity 1 */ - 0x0000, /* R124 */ - 0x0003, /* R125 */ - 0x0000, /* R126 - Interrupt Control */ - 0x0000, /* R127 */ - 0x0005, /* R128 */ - 0x0000, /* R129 - Control Interface Test 1 */ - 0x0000, /* R130 */ - 0x0000, /* R131 */ - 0x0000, /* R132 */ - 0x0000, /* R133 */ - 0x0000, /* R134 */ - 0x03FF, /* R135 */ - 0x0007, /* R136 */ - 0x0040, /* R137 */ - 0x0000, /* R138 */ - 0x0000, /* R139 */ - 0x0000, /* R140 */ - 0x0000, /* R141 */ - 0x0000, /* R142 */ - 0x0000, /* R143 */ - 0x0000, /* R144 */ - 0x0000, /* R145 */ - 0x0000, /* R146 */ - 0x0000, /* R147 */ - 0x4000, /* R148 */ - 0x6810, /* R149 - Charge Pump Test 1 */ - 0x0004, /* R150 */ - 0x0000, /* R151 */ - 0x0000, /* R152 */ - 0x0000, /* R153 */ - 0x0000, /* R154 */ - 0x0000, /* R155 */ - 0x0000, /* R156 */ - 0x0000, /* R157 */ - 0x0000, /* R158 */ - 0x0000, /* R159 */ - 0x0000, /* R160 */ - 0x0000, /* R161 */ - 0x0000, /* R162 */ - 0x0000, /* R163 */ - 0x0028, /* R164 - Clock Rate Test 4 */ - 0x0004, /* R165 */ - 0x0000, /* R166 */ - 0x0060, /* R167 */ - 0x0000, /* R168 */ - 0x0000, /* R169 */ - 0x0000, /* R170 */ - 0x0000, /* R171 */ - 0x0000, /* R172 - Analogue Output Bias 0 */ +static const struct reg_default wm8903_reg_defaults[] = { + { 4, 0x0018 }, /* R4 - Bias Control 0 */ + { 5, 0x0000 }, /* R5 - VMID Control 0 */ + { 6, 0x0000 }, /* R6 - Mic Bias Control 0 */ + { 8, 0x0001 }, /* R8 - Analogue DAC 0 */ + { 10, 0x0001 }, /* R10 - Analogue ADC 0 */ + { 12, 0x0000 }, /* R12 - Power Management 0 */ + { 13, 0x0000 }, /* R13 - Power Management 1 */ + { 14, 0x0000 }, /* R14 - Power Management 2 */ + { 15, 0x0000 }, /* R15 - Power Management 3 */ + { 16, 0x0000 }, /* R16 - Power Management 4 */ + { 17, 0x0000 }, /* R17 - Power Management 5 */ + { 18, 0x0000 }, /* R18 - Power Management 6 */ + { 20, 0x0400 }, /* R20 - Clock Rates 0 */ + { 21, 0x0D07 }, /* R21 - Clock Rates 1 */ + { 22, 0x0000 }, /* R22 - Clock Rates 2 */ + { 24, 0x0050 }, /* R24 - Audio Interface 0 */ + { 25, 0x0242 }, /* R25 - Audio Interface 1 */ + { 26, 0x0008 }, /* R26 - Audio Interface 2 */ + { 27, 0x0022 }, /* R27 - Audio Interface 3 */ + { 30, 0x00C0 }, /* R30 - DAC Digital Volume Left */ + { 31, 0x00C0 }, /* R31 - DAC Digital Volume Right */ + { 32, 0x0000 }, /* R32 - DAC Digital 0 */ + { 33, 0x0000 }, /* R33 - DAC Digital 1 */ + { 36, 0x00C0 }, /* R36 - ADC Digital Volume Left */ + { 37, 0x00C0 }, /* R37 - ADC Digital Volume Right */ + { 38, 0x0000 }, /* R38 - ADC Digital 0 */ + { 39, 0x0073 }, /* R39 - Digital Microphone 0 */ + { 40, 0x09BF }, /* R40 - DRC 0 */ + { 41, 0x3241 }, /* R41 - DRC 1 */ + { 42, 0x0020 }, /* R42 - DRC 2 */ + { 43, 0x0000 }, /* R43 - DRC 3 */ + { 44, 0x0085 }, /* R44 - Analogue Left Input 0 */ + { 45, 0x0085 }, /* R45 - Analogue Right Input 0 */ + { 46, 0x0044 }, /* R46 - Analogue Left Input 1 */ + { 47, 0x0044 }, /* R47 - Analogue Right Input 1 */ + { 50, 0x0008 }, /* R50 - Analogue Left Mix 0 */ + { 51, 0x0004 }, /* R51 - Analogue Right Mix 0 */ + { 52, 0x0000 }, /* R52 - Analogue Spk Mix Left 0 */ + { 53, 0x0000 }, /* R53 - Analogue Spk Mix Left 1 */ + { 54, 0x0000 }, /* R54 - Analogue Spk Mix Right 0 */ + { 55, 0x0000 }, /* R55 - Analogue Spk Mix Right 1 */ + { 57, 0x002D }, /* R57 - Analogue OUT1 Left */ + { 58, 0x002D }, /* R58 - Analogue OUT1 Right */ + { 59, 0x0039 }, /* R59 - Analogue OUT2 Left */ + { 60, 0x0039 }, /* R60 - Analogue OUT2 Right */ + { 62, 0x0139 }, /* R62 - Analogue OUT3 Left */ + { 63, 0x0139 }, /* R63 - Analogue OUT3 Right */ + { 64, 0x0000 }, /* R65 - Analogue SPK Output Control 0 */ + { 67, 0x0010 }, /* R67 - DC Servo 0 */ + { 69, 0x00A4 }, /* R69 - DC Servo 2 */ + { 90, 0x0000 }, /* R90 - Analogue HP 0 */ + { 94, 0x0000 }, /* R94 - Analogue Lineout 0 */ + { 98, 0x0000 }, /* R98 - Charge Pump 0 */ + { 104, 0x0000 }, /* R104 - Class W 0 */ + { 108, 0x0000 }, /* R108 - Write Sequencer 0 */ + { 109, 0x0000 }, /* R109 - Write Sequencer 1 */ + { 110, 0x0000 }, /* R110 - Write Sequencer 2 */ + { 111, 0x0000 }, /* R111 - Write Sequencer 3 */ + { 112, 0x0000 }, /* R112 - Write Sequencer 4 */ + { 114, 0x0000 }, /* R114 - Control Interface */ + { 116, 0x00A8 }, /* R116 - GPIO Control 1 */ + { 117, 0x00A8 }, /* R117 - GPIO Control 2 */ + { 118, 0x00A8 }, /* R118 - GPIO Control 3 */ + { 119, 0x0220 }, /* R119 - GPIO Control 4 */ + { 120, 0x01A0 }, /* R120 - GPIO Control 5 */ + { 122, 0xFFFF }, /* R122 - Interrupt Status 1 Mask */ + { 123, 0x0000 }, /* R123 - Interrupt Polarity 1 */ + { 126, 0x0000 }, /* R126 - Interrupt Control */ + { 129, 0x0000 }, /* R129 - Control Interface Test 1 */ + { 149, 0x6810 }, /* R149 - Charge Pump Test 1 */ + { 164, 0x0028 }, /* R164 - Clock Rate Test 4 */ + { 172, 0x0000 }, /* R172 - Analogue Output Bias 0 */ }; struct wm8903_priv { struct snd_soc_codec *codec; + struct regmap *regmap; int sysclk; int irq; @@ -239,7 +140,93 @@ struct wm8903_priv { #endif }; -static int wm8903_volatile_register(struct snd_soc_codec *codec, unsigned int reg) +static bool wm8903_readable_register(struct device *dev, unsigned int reg) +{ + switch (reg) { + case WM8903_SW_RESET_AND_ID: + case WM8903_REVISION_NUMBER: + case WM8903_BIAS_CONTROL_0: + case WM8903_VMID_CONTROL_0: + case WM8903_MIC_BIAS_CONTROL_0: + case WM8903_ANALOGUE_DAC_0: + case WM8903_ANALOGUE_ADC_0: + case WM8903_POWER_MANAGEMENT_0: + case WM8903_POWER_MANAGEMENT_1: + case WM8903_POWER_MANAGEMENT_2: + case WM8903_POWER_MANAGEMENT_3: + case WM8903_POWER_MANAGEMENT_4: + case WM8903_POWER_MANAGEMENT_5: + case WM8903_POWER_MANAGEMENT_6: + case WM8903_CLOCK_RATES_0: + case WM8903_CLOCK_RATES_1: + case WM8903_CLOCK_RATES_2: + case WM8903_AUDIO_INTERFACE_0: + case WM8903_AUDIO_INTERFACE_1: + case WM8903_AUDIO_INTERFACE_2: + case WM8903_AUDIO_INTERFACE_3: + case WM8903_DAC_DIGITAL_VOLUME_LEFT: + case WM8903_DAC_DIGITAL_VOLUME_RIGHT: + case WM8903_DAC_DIGITAL_0: + case WM8903_DAC_DIGITAL_1: + case WM8903_ADC_DIGITAL_VOLUME_LEFT: + case WM8903_ADC_DIGITAL_VOLUME_RIGHT: + case WM8903_ADC_DIGITAL_0: + case WM8903_DIGITAL_MICROPHONE_0: + case WM8903_DRC_0: + case WM8903_DRC_1: + case WM8903_DRC_2: + case WM8903_DRC_3: + case WM8903_ANALOGUE_LEFT_INPUT_0: + case WM8903_ANALOGUE_RIGHT_INPUT_0: + case WM8903_ANALOGUE_LEFT_INPUT_1: + case WM8903_ANALOGUE_RIGHT_INPUT_1: + case WM8903_ANALOGUE_LEFT_MIX_0: + case WM8903_ANALOGUE_RIGHT_MIX_0: + case WM8903_ANALOGUE_SPK_MIX_LEFT_0: + case WM8903_ANALOGUE_SPK_MIX_LEFT_1: + case WM8903_ANALOGUE_SPK_MIX_RIGHT_0: + case WM8903_ANALOGUE_SPK_MIX_RIGHT_1: + case WM8903_ANALOGUE_OUT1_LEFT: + case WM8903_ANALOGUE_OUT1_RIGHT: + case WM8903_ANALOGUE_OUT2_LEFT: + case WM8903_ANALOGUE_OUT2_RIGHT: + case WM8903_ANALOGUE_OUT3_LEFT: + case WM8903_ANALOGUE_OUT3_RIGHT: + case WM8903_ANALOGUE_SPK_OUTPUT_CONTROL_0: + case WM8903_DC_SERVO_0: + case WM8903_DC_SERVO_2: + case WM8903_DC_SERVO_READBACK_1: + case WM8903_DC_SERVO_READBACK_2: + case WM8903_DC_SERVO_READBACK_3: + case WM8903_DC_SERVO_READBACK_4: + case WM8903_ANALOGUE_HP_0: + case WM8903_ANALOGUE_LINEOUT_0: + case WM8903_CHARGE_PUMP_0: + case WM8903_CLASS_W_0: + case WM8903_WRITE_SEQUENCER_0: + case WM8903_WRITE_SEQUENCER_1: + case WM8903_WRITE_SEQUENCER_2: + case WM8903_WRITE_SEQUENCER_3: + case WM8903_WRITE_SEQUENCER_4: + case WM8903_CONTROL_INTERFACE: + case WM8903_GPIO_CONTROL_1: + case WM8903_GPIO_CONTROL_2: + case WM8903_GPIO_CONTROL_3: + case WM8903_GPIO_CONTROL_4: + case WM8903_GPIO_CONTROL_5: + case WM8903_INTERRUPT_STATUS_1: + case WM8903_INTERRUPT_STATUS_1_MASK: + case WM8903_INTERRUPT_POLARITY_1: + case WM8903_INTERRUPT_CONTROL: + case WM8903_CLOCK_RATE_TEST_4: + case WM8903_ANALOGUE_OUTPUT_BIAS_0: + return true; + default: + return false; + } +} + +static bool wm8903_volatile_register(struct device *dev, unsigned int reg) { switch (reg) { case WM8903_SW_RESET_AND_ID: @@ -1767,7 +1754,7 @@ static int wm8903_resume(struct snd_soc_codec *codec) { struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); - snd_soc_cache_sync(codec); + regcache_sync(wm8903->regmap); wm8903_set_bias_level(codec, SND_SOC_BIAS_STANDBY); @@ -1897,15 +1884,16 @@ static int wm8903_probe(struct snd_soc_codec *codec) u16 val; wm8903->codec = codec; + codec->control_data = wm8903->regmap; - ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_I2C); + ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP); if (ret != 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); return ret; } val = snd_soc_read(codec, WM8903_SW_RESET_AND_ID); - if (val != wm8903_reg_defaults[WM8903_SW_RESET_AND_ID]) { + if (val != 0x8903) { dev_err(codec->dev, "Device with ID register %x is not a WM8903\n", val); return -ENODEV; @@ -2044,10 +2032,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8903 = { .suspend = wm8903_suspend, .resume = wm8903_resume, .set_bias_level = wm8903_set_bias_level, - .reg_cache_size = ARRAY_SIZE(wm8903_reg_defaults), - .reg_word_size = sizeof(u16), - .reg_cache_default = wm8903_reg_defaults, - .volatile_register = wm8903_volatile_register, .seq_notifier = wm8903_seq_notifier, .controls = wm8903_snd_controls, .num_controls = ARRAY_SIZE(wm8903_snd_controls), @@ -2057,6 +2041,19 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8903 = { .num_dapm_routes = ARRAY_SIZE(wm8903_intercon), }; +static const struct regmap_config wm8903_regmap = { + .reg_bits = 8, + .val_bits = 16, + + .max_register = WM8903_MAX_REGISTER, + .volatile_reg = wm8903_volatile_register, + .readable_reg = wm8903_readable_register, + + .cache_type = REGCACHE_RBTREE, + .reg_defaults = wm8903_reg_defaults, + .num_reg_defaults = ARRAY_SIZE(wm8903_reg_defaults), +}; + static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { @@ -2068,18 +2065,35 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, if (wm8903 == NULL) return -ENOMEM; + wm8903->regmap = regmap_init_i2c(i2c, &wm8903_regmap); + if (IS_ERR(wm8903->regmap)) { + ret = PTR_ERR(wm8903->regmap); + dev_err(&i2c->dev, "Failed to allocate register map: %d\n", + ret); + return ret; + } + i2c_set_clientdata(i2c, wm8903); wm8903->irq = i2c->irq; ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8903, &wm8903_dai, 1); + if (ret != 0) + goto err; + return 0; +err: + regmap_exit(wm8903->regmap); return ret; } static __devexit int wm8903_i2c_remove(struct i2c_client *client) { + struct wm8903_priv *wm8903 = i2c_get_clientdata(client); + + regmap_exit(wm8903->regmap); snd_soc_unregister_codec(&client->dev); + return 0; } -- cgit v1.1 From 7d46a528c609418e0a61121aac75edaf4992b622 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 18:39:17 +0000 Subject: ASoC: Move initial WM8903 identification and reset to I2C probe Get control of the device earlier and avoid trying to do an ASoC probe on a card that won't work. Signed-off-by: Mark Brown Tested-by: Stephen Warren --- sound/soc/codecs/wm8903.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 0b12a552..a75688b 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -244,11 +244,6 @@ static bool wm8903_volatile_register(struct device *dev, unsigned int reg) } } -static void wm8903_reset(struct snd_soc_codec *codec) -{ - snd_soc_write(codec, WM8903_SW_RESET_AND_ID, 0); -} - static int wm8903_cp_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { @@ -1892,19 +1887,6 @@ static int wm8903_probe(struct snd_soc_codec *codec) return ret; } - val = snd_soc_read(codec, WM8903_SW_RESET_AND_ID); - if (val != 0x8903) { - dev_err(codec->dev, - "Device with ID register %x is not a WM8903\n", val); - return -ENODEV; - } - - val = snd_soc_read(codec, WM8903_REVISION_NUMBER); - dev_info(codec->dev, "WM8903 revision %c\n", - (val & WM8903_CHIP_REV_MASK) + 'A'); - - wm8903_reset(codec); - /* Set up GPIOs and microphone detection */ if (pdata) { bool mic_gpio = false; @@ -2058,6 +2040,7 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct wm8903_priv *wm8903; + unsigned int val; int ret; wm8903 = devm_kzalloc(&i2c->dev, sizeof(struct wm8903_priv), @@ -2076,6 +2059,28 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, wm8903); wm8903->irq = i2c->irq; + ret = regmap_read(wm8903->regmap, WM8903_SW_RESET_AND_ID, &val); + if (ret != 0) { + dev_err(&i2c->dev, "Failed to read chip ID: %d\n", ret); + goto err; + } + if (val != 0x8903) { + dev_err(&i2c->dev, "Device with ID %x is not a WM8903\n", val); + ret = -ENODEV; + goto err; + } + + ret = regmap_read(wm8903->regmap, WM8903_REVISION_NUMBER, &val); + if (ret != 0) { + dev_err(&i2c->dev, "Failed to read chip revision: %d\n", ret); + goto err; + } + dev_info(&i2c->dev, "WM8903 revision %c\n", + (val & WM8903_CHIP_REV_MASK) + 'A'); + + /* Reset the device */ + regmap_write(wm8903->regmap, WM8903_SW_RESET_AND_ID, 0x8903); + ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8903, &wm8903_dai, 1); if (ret != 0) -- cgit v1.1 From c0eb27cf84ffd79347907f07ae33061ba0034c41 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Fri, 2 Dec 2011 15:08:38 -0700 Subject: ASoC: WM8903: Create default platform data structure When no platform data is supplied, point pdata at a default platform structure. This enables two future changes: a) Defines the default platform data values in a single place. b) There is always a valid pdata pointer, so some conditional code can be simplified by a later patch. Based on work by John Bonesio, but significantly reworked since then. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/codecs/wm8903.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index a75688b..e6ecede 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -114,6 +114,7 @@ static const struct reg_default wm8903_reg_defaults[] = { }; struct wm8903_priv { + struct wm8903_platform_data *pdata; struct snd_soc_codec *codec; struct regmap *regmap; @@ -1834,7 +1835,7 @@ static struct gpio_chip wm8903_template_chip = { static void wm8903_init_gpio(struct snd_soc_codec *codec) { struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); - struct wm8903_platform_data *pdata = dev_get_platdata(codec->dev); + struct wm8903_platform_data *pdata = wm8903->pdata; int ret; wm8903->gpio_chip = wm8903_template_chip; @@ -1872,8 +1873,8 @@ static void wm8903_free_gpio(struct snd_soc_codec *codec) static int wm8903_probe(struct snd_soc_codec *codec) { - struct wm8903_platform_data *pdata = dev_get_platdata(codec->dev); struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); + struct wm8903_platform_data *pdata = wm8903->pdata; int ret, i; int trigger, irq_pol; u16 val; @@ -2039,6 +2040,7 @@ static const struct regmap_config wm8903_regmap = { static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { + struct wm8903_platform_data *pdata = dev_get_platdata(&i2c->dev); struct wm8903_priv *wm8903; unsigned int val; int ret; @@ -2059,6 +2061,19 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, wm8903); wm8903->irq = i2c->irq; + /* If no platform data was supplied, create storage for defaults */ + if (pdata) { + wm8903->pdata = pdata; + } else { + wm8903->pdata = devm_kzalloc(&i2c->dev, + sizeof(struct wm8903_platform_data), + GFP_KERNEL); + if (wm8903->pdata == NULL) { + dev_err(&i2c->dev, "Failed to allocate pdata\n"); + return -ENOMEM; + } + } + ret = regmap_read(wm8903->regmap, WM8903_SW_RESET_AND_ID, &val); if (ret != 0) { dev_err(&i2c->dev, "Failed to read chip ID: %d\n", ret); -- cgit v1.1 From 091edccf7f500837f2b3942be0d40362d25234c0 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 22:08:49 +0000 Subject: ASoC: Remove unused -codec from Wolfson device driver names Devices that aren't MFDs don't need to distinguish this. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8510.c | 2 +- sound/soc/codecs/wm8727.c | 2 +- sound/soc/codecs/wm8900.c | 4 ++-- sound/soc/codecs/wm8904.c | 2 +- sound/soc/codecs/wm8940.c | 2 +- sound/soc/codecs/wm8955.c | 2 +- sound/soc/codecs/wm8960.c | 2 +- sound/soc/codecs/wm8961.c | 2 +- sound/soc/codecs/wm8971.c | 2 +- sound/soc/codecs/wm8974.c | 2 +- sound/soc/codecs/wm8988.c | 2 +- sound/soc/codecs/wm8990.c | 2 +- sound/soc/codecs/wm8993.c | 2 +- sound/soc/codecs/wm9090.c | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index 5e84750..00f8dfa 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c @@ -666,7 +666,7 @@ MODULE_DEVICE_TABLE(i2c, wm8510_i2c_id); static struct i2c_driver wm8510_i2c_driver = { .driver = { - .name = "wm8510-codec", + .name = "wm8510", .owner = THIS_MODULE, .of_match_table = wm8510_of_match, }, diff --git a/sound/soc/codecs/wm8727.c b/sound/soc/codecs/wm8727.c index fad90a3..e817056 100644 --- a/sound/soc/codecs/wm8727.c +++ b/sound/soc/codecs/wm8727.c @@ -59,7 +59,7 @@ static int __devexit wm8727_remove(struct platform_device *pdev) static struct platform_driver wm8727_codec_driver = { .driver = { - .name = "wm8727-codec", + .name = "wm8727", .owner = THIS_MODULE, }, diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index 85632ff..e427a38 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c @@ -1258,7 +1258,7 @@ static int __devexit wm8900_spi_remove(struct spi_device *spi) static struct spi_driver wm8900_spi_driver = { .driver = { - .name = "wm8900-codec", + .name = "wm8900", .owner = THIS_MODULE, }, .probe = wm8900_spi_probe, @@ -1302,7 +1302,7 @@ MODULE_DEVICE_TABLE(i2c, wm8900_i2c_id); static struct i2c_driver wm8900_i2c_driver = { .driver = { - .name = "wm8900-codec", + .name = "wm8900", .owner = THIS_MODULE, }, .probe = wm8900_i2c_probe, diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index f0ae01b..f31c754 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c @@ -2564,7 +2564,7 @@ MODULE_DEVICE_TABLE(i2c, wm8904_i2c_id); static struct i2c_driver wm8904_i2c_driver = { .driver = { - .name = "wm8904-codec", + .name = "wm8904", .owner = THIS_MODULE, }, .probe = wm8904_i2c_probe, diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index 0fe4545..14039ea 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c @@ -779,7 +779,7 @@ MODULE_DEVICE_TABLE(i2c, wm8940_i2c_id); static struct i2c_driver wm8940_i2c_driver = { .driver = { - .name = "wm8940-codec", + .name = "wm8940", .owner = THIS_MODULE, }, .probe = wm8940_i2c_probe, diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index cdd5139..9245481 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c @@ -1037,7 +1037,7 @@ MODULE_DEVICE_TABLE(i2c, wm8955_i2c_id); static struct i2c_driver wm8955_i2c_driver = { .driver = { - .name = "wm8955-codec", + .name = "wm8955", .owner = THIS_MODULE, }, .probe = wm8955_i2c_probe, diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 55b9a25..3446f9c 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -1030,7 +1030,7 @@ MODULE_DEVICE_TABLE(i2c, wm8960_i2c_id); static struct i2c_driver wm8960_i2c_driver = { .driver = { - .name = "wm8960-codec", + .name = "wm8960", .owner = THIS_MODULE, }, .probe = wm8960_i2c_probe, diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 9bcf846..dc087c1 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -1116,7 +1116,7 @@ MODULE_DEVICE_TABLE(i2c, wm8961_i2c_id); static struct i2c_driver wm8961_i2c_driver = { .driver = { - .name = "wm8961-codec", + .name = "wm8961", .owner = THIS_MODULE, }, .probe = wm8961_i2c_probe, diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index aadd14a..4af8936 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c @@ -724,7 +724,7 @@ MODULE_DEVICE_TABLE(i2c, wm8971_i2c_id); static struct i2c_driver wm8971_i2c_driver = { .driver = { - .name = "wm8971-codec", + .name = "wm8971", .owner = THIS_MODULE, }, .probe = wm8971_i2c_probe, diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index a5fd017..4a6a7b5 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c @@ -671,7 +671,7 @@ MODULE_DEVICE_TABLE(i2c, wm8974_i2c_id); static struct i2c_driver wm8974_i2c_driver = { .driver = { - .name = "wm8974-codec", + .name = "wm8974", .owner = THIS_MODULE, }, .probe = wm8974_i2c_probe, diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index 0938847..ab52963 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c @@ -822,7 +822,7 @@ static int __devexit wm8988_spi_remove(struct spi_device *spi) static struct spi_driver wm8988_spi_driver = { .driver = { - .name = "wm8988-codec", + .name = "wm8988", .owner = THIS_MODULE, }, .probe = wm8988_spi_probe, diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index b417d2e..e538eda 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c @@ -1417,7 +1417,7 @@ MODULE_DEVICE_TABLE(i2c, wm8990_i2c_id); static struct i2c_driver wm8990_i2c_driver = { .driver = { - .name = "wm8990-codec", + .name = "wm8990", .owner = THIS_MODULE, }, .probe = wm8990_i2c_probe, diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index 0f8278b..f472ea6 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c @@ -1641,7 +1641,7 @@ MODULE_DEVICE_TABLE(i2c, wm8993_i2c_id); static struct i2c_driver wm8993_i2c_driver = { .driver = { - .name = "wm8993-codec", + .name = "wm8993", .owner = THIS_MODULE, }, .probe = wm8993_i2c_probe, diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c index 5cb8759..31869af 100644 --- a/sound/soc/codecs/wm9090.c +++ b/sound/soc/codecs/wm9090.c @@ -685,7 +685,7 @@ MODULE_DEVICE_TABLE(i2c, wm9090_id); static struct i2c_driver wm9090_i2c_driver = { .driver = { - .name = "wm9090-codec", + .name = "wm9090", .owner = THIS_MODULE, }, .probe = wm9090_i2c_probe, -- cgit v1.1 From 3a0d077f3d013811cc9f2208089d765ae79a2695 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 21:20:37 +0000 Subject: ASoC: Remove I2C ifdefs from WM8960 The driver only supports I2C as the control interface. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8960.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 3446f9c..ee8d97f 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -994,7 +994,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8960 = { .reg_cache_default = wm8960_reg, }; -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) static __devinit int wm8960_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { @@ -1037,27 +1036,22 @@ static struct i2c_driver wm8960_i2c_driver = { .remove = __devexit_p(wm8960_i2c_remove), .id_table = wm8960_i2c_id, }; -#endif static int __init wm8960_modinit(void) { int ret = 0; -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) ret = i2c_add_driver(&wm8960_i2c_driver); if (ret != 0) { printk(KERN_ERR "Failed to register WM8960 I2C driver: %d\n", ret); } -#endif return ret; } module_init(wm8960_modinit); static void __exit wm8960_exit(void) { -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) i2c_del_driver(&wm8960_i2c_driver); -#endif } module_exit(wm8960_exit); -- cgit v1.1 From 6cd4eb959294990cbf38051fd9ab1e9091b3e926 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 21:20:58 +0000 Subject: ASoC: Remove unused AUDIO_NAME define from WM8960 Signed-off-by: Mark Brown --- sound/soc/codecs/wm8960.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index ee8d97f..6a9c41d 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -25,8 +25,6 @@ #include "wm8960.h" -#define AUDIO_NAME "wm8960" - /* R25 - Power 1 */ #define WM8960_VMID_MASK 0x180 #define WM8960_VREF 0x40 -- cgit v1.1 From b03e96e4d619183cbe9aea55f2340596c1fecf64 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 21:28:31 +0000 Subject: ASoC: Convert WM2000 to devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm2000.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index 01b1abe..2726f66 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c @@ -740,7 +740,8 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, return -EINVAL; } - wm2000 = kzalloc(sizeof(struct wm2000_priv), GFP_KERNEL); + wm2000 = devm_kzalloc(&i2c->dev, sizeof(struct wm2000_priv), + GFP_KERNEL); if (wm2000 == NULL) { dev_err(&i2c->dev, "Unable to allocate private data\n"); return -ENOMEM; @@ -779,7 +780,9 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, /* Pre-cook the concatenation of the register address onto the image */ wm2000->anc_download_size = fw->size + 2; - wm2000->anc_download = kmalloc(wm2000->anc_download_size, GFP_KERNEL); + wm2000->anc_download = devm_kzalloc(&i2c->dev, + wm2000->anc_download_size, + GFP_KERNEL); if (wm2000->anc_download == NULL) { dev_err(&i2c->dev, "Out of memory\n"); ret = -ENOMEM; @@ -810,7 +813,6 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, err_fw: release_firmware(fw); err: - kfree(wm2000); return ret; } @@ -821,8 +823,6 @@ static __devexit int wm2000_i2c_remove(struct i2c_client *i2c) wm2000_anc_transition(wm2000, ANC_OFF); wm2000_i2c = NULL; - kfree(wm2000->anc_download); - kfree(wm2000); return 0; } -- cgit v1.1 From 0d1fe0d4521436d8af2111045a682c4c8aa1b55d Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 11:29:38 +0000 Subject: ASoC: Convert WM8350 to devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm8350.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index f39497fc1..7b095ae 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c @@ -1553,7 +1553,8 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) return -EINVAL; } - priv = kzalloc(sizeof(struct wm8350_data), GFP_KERNEL); + priv = devm_kzalloc(codec->dev, sizeof(struct wm8350_data), + GFP_KERNEL); if (priv == NULL) return -ENOMEM; snd_soc_codec_set_drvdata(codec, priv); @@ -1564,7 +1565,7 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) ret = regulator_bulk_get(wm8350->dev, ARRAY_SIZE(priv->supplies), priv->supplies); if (ret != 0) - goto err_priv; + return ret; wm8350->codec.codec = codec; codec->control_data = wm8350; @@ -1640,10 +1641,6 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) wm8350_set_bias_level(codec, SND_SOC_BIAS_STANDBY); return 0; - -err_priv: - kfree(priv); - return ret; } static int wm8350_codec_remove(struct snd_soc_codec *codec) @@ -1676,7 +1673,7 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec) wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); regulator_bulk_free(ARRAY_SIZE(priv->supplies), priv->supplies); - kfree(priv); + return 0; } -- cgit v1.1 From b903c0ed2e85155c3a67cfc54117223a61bb483f Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 11:41:27 +0000 Subject: ASoC: Convert WM8400 to devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm8400.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index 56a7b72..aef7e4d 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c @@ -1383,7 +1383,8 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec) int ret; u16 reg; - priv = kzalloc(sizeof(struct wm8400_priv), GFP_KERNEL); + priv = devm_kzalloc(codec->dev, sizeof(struct wm8400_priv), + GFP_KERNEL); if (priv == NULL) return -ENOMEM; @@ -1395,7 +1396,7 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec) ARRAY_SIZE(power), &power[0]); if (ret != 0) { dev_err(codec->dev, "Failed to get regulators: %d\n", ret); - goto err; + return ret; } INIT_WORK(&priv->work, wm8400_probe_deferred); @@ -1426,14 +1427,11 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec) err_regulator: regulator_bulk_free(ARRAY_SIZE(power), power); -err: - kfree(priv); return ret; } static int wm8400_codec_remove(struct snd_soc_codec *codec) { - struct wm8400_priv *priv = snd_soc_codec_get_drvdata(codec); u16 reg; reg = wm8400_read(codec, WM8400_POWER_MANAGEMENT_1); @@ -1441,7 +1439,6 @@ static int wm8400_codec_remove(struct snd_soc_codec *codec) reg & (~WM8400_CODEC_ENA)); regulator_bulk_free(ARRAY_SIZE(power), power); - kfree(priv); return 0; } -- cgit v1.1 From 5aefb306e35541d35c8d5838ae97f3f9d8ad1a12 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 17:17:05 +0000 Subject: ASoC: Convert WM8741 to devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm8741.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c index bf471dc..24d8ec5 100644 --- a/sound/soc/codecs/wm8741.c +++ b/sound/soc/codecs/wm8741.c @@ -503,7 +503,8 @@ static int wm8741_i2c_probe(struct i2c_client *i2c, struct wm8741_priv *wm8741; int ret; - wm8741 = kzalloc(sizeof(struct wm8741_priv), GFP_KERNEL); + wm8741 = devm_kzalloc(&i2c->dev, sizeof(struct wm8741_priv), + GFP_KERNEL); if (wm8741 == NULL) return -ENOMEM; @@ -512,20 +513,13 @@ static int wm8741_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8741, &wm8741_dai, 1); - if (ret != 0) - goto err; return ret; - -err: - kfree(wm8741); - return ret; } static int wm8741_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } @@ -553,7 +547,8 @@ static int __devinit wm8741_spi_probe(struct spi_device *spi) struct wm8741_priv *wm8741; int ret; - wm8741 = kzalloc(sizeof(struct wm8741_priv), GFP_KERNEL); + wm8741 = devm_kzalloc(&spi->dev, sizeof(struct wm8741_priv), + GFP_KERNEL); if (wm8741 == NULL) return -ENOMEM; @@ -562,15 +557,12 @@ static int __devinit wm8741_spi_probe(struct spi_device *spi) ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_wm8741, &wm8741_dai, 1); - if (ret < 0) - kfree(wm8741); return ret; } static int __devexit wm8741_spi_remove(struct spi_device *spi) { snd_soc_unregister_codec(&spi->dev); - kfree(spi_get_drvdata(spi)); return 0; } -- cgit v1.1 From 2edaed82b70c22b63bb918e1ca9c34876da21320 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 17:18:37 +0000 Subject: ASoC: Convert WM8750 to devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm8750.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index 48cb78f..fa5732d 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c @@ -744,7 +744,8 @@ static int __devinit wm8750_spi_probe(struct spi_device *spi) struct wm8750_priv *wm8750; int ret; - wm8750 = kzalloc(sizeof(struct wm8750_priv), GFP_KERNEL); + wm8750 = devm_kzalloc(&spi->dev, sizeof(struct wm8750_priv), + GFP_KERNEL); if (wm8750 == NULL) return -ENOMEM; @@ -753,15 +754,12 @@ static int __devinit wm8750_spi_probe(struct spi_device *spi) ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_wm8750, &wm8750_dai, 1); - if (ret < 0) - kfree(wm8750); return ret; } static int __devexit wm8750_spi_remove(struct spi_device *spi) { snd_soc_unregister_codec(&spi->dev); - kfree(spi_get_drvdata(spi)); return 0; } @@ -791,7 +789,8 @@ static __devinit int wm8750_i2c_probe(struct i2c_client *i2c, struct wm8750_priv *wm8750; int ret; - wm8750 = kzalloc(sizeof(struct wm8750_priv), GFP_KERNEL); + wm8750 = devm_kzalloc(&i2c->dev, sizeof(struct wm8750_priv), + GFP_KERNEL); if (wm8750 == NULL) return -ENOMEM; @@ -800,15 +799,12 @@ static __devinit int wm8750_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8750, &wm8750_dai, 1); - if (ret < 0) - kfree(wm8750); return ret; } static __devexit int wm8750_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From 455b91bfe86fd4773a15593eb7a834b9f552797d Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 22:09:47 +0000 Subject: ASoC: Convert WM9090 to devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm9090.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c index 31869af..d1d2c70 100644 --- a/sound/soc/codecs/wm9090.c +++ b/sound/soc/codecs/wm9090.c @@ -647,7 +647,7 @@ static int wm9090_i2c_probe(struct i2c_client *i2c, struct wm9090_priv *wm9090; int ret; - wm9090 = kzalloc(sizeof(*wm9090), GFP_KERNEL); + wm9090 = devm_kzalloc(&i2c->dev, sizeof(*wm9090), GFP_KERNEL); if (wm9090 == NULL) { dev_err(&i2c->dev, "Can not allocate memory\n"); return -ENOMEM; @@ -661,8 +661,6 @@ static int wm9090_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm9090, NULL, 0); - if (ret < 0) - kfree(wm9090); return ret; } @@ -671,7 +669,6 @@ static int __devexit wm9090_i2c_remove(struct i2c_client *i2c) struct wm9090_priv *wm9090 = i2c_get_clientdata(i2c); snd_soc_unregister_codec(&i2c->dev); - kfree(wm9090); return 0; } -- cgit v1.1 From e6c94e9f6dd77c928419dc05af2b3d17ed9463b9 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 11:31:58 +0000 Subject: ASoC: Convert WM8350 to table based DAPM and control init Signed-off-by: Mark Brown --- sound/soc/codecs/wm8350.c | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index 7b095ae..8c4c959 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c @@ -696,7 +696,7 @@ static const struct snd_soc_dapm_widget wm8350_dapm_widgets[] = { SND_SOC_DAPM_INPUT("IN3L"), }; -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route wm8350_dapm_routes[] = { /* left playback mixer */ {"Left Playback Mixer", "Playback Switch", "Left DAC"}, @@ -777,29 +777,6 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Beep", NULL, "IN3R PGA"}, }; -static int wm8350_add_widgets(struct snd_soc_codec *codec) -{ - struct snd_soc_dapm_context *dapm = &codec->dapm; - int ret; - - ret = snd_soc_dapm_new_controls(dapm, - wm8350_dapm_widgets, - ARRAY_SIZE(wm8350_dapm_widgets)); - if (ret != 0) { - dev_err(codec->dev, "dapm control register failed\n"); - return ret; - } - - /* set up audio paths */ - ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - if (ret != 0) { - dev_err(codec->dev, "DAPM route register failed\n"); - return ret; - } - - return 0; -} - static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { @@ -1634,10 +1611,6 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) wm8350_mic_handler, 0, "Microphone detect", priv); - snd_soc_add_controls(codec, wm8350_snd_controls, - ARRAY_SIZE(wm8350_snd_controls)); - wm8350_add_widgets(codec); - wm8350_set_bias_level(codec, SND_SOC_BIAS_STANDBY); return 0; @@ -1685,6 +1658,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8350 = { .read = wm8350_codec_read, .write = wm8350_codec_write, .set_bias_level = wm8350_set_bias_level, + + .controls = wm8350_snd_controls, + .num_controls = ARRAY_SIZE(wm8350_snd_controls), + .dapm_widgets = wm8350_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8350_dapm_widgets), + .dapm_routes = wm8350_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes), }; static int __devinit wm8350_probe(struct platform_device *pdev) -- cgit v1.1 From b4505ab141a72f65bf7bb1f7c120411ab129181a Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 11:34:34 +0000 Subject: ASoC: Convert WM8400 to table based DAPM and control init Signed-off-by: Mark Brown --- sound/soc/codecs/wm8400.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index aef7e4d..898979d 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c @@ -353,13 +353,6 @@ SOC_SINGLE("RIN34 Mute Switch", WM8400_RIGHT_LINE_INPUT_3_4_VOLUME, }; -/* add non dapm controls */ -static int wm8400_add_controls(struct snd_soc_codec *codec) -{ - return snd_soc_add_controls(codec, wm8400_snd_controls, - ARRAY_SIZE(wm8400_snd_controls)); -} - /* * _DAPM_ Controls */ @@ -783,7 +776,7 @@ SND_SOC_DAPM_OUTPUT("RON"), SND_SOC_DAPM_OUTPUT("Internal DAC Sink"), }; -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route wm8400_dapm_routes[] = { /* Make DACs turn on when playing even if not mixed into any outputs */ {"Internal DAC Sink", NULL, "Left DAC"}, {"Internal DAC Sink", NULL, "Right DAC"}, @@ -909,17 +902,6 @@ static const struct snd_soc_dapm_route audio_map[] = { {"RON", NULL, "RONMIX"}, }; -static int wm8400_add_widgets(struct snd_soc_codec *codec) -{ - struct snd_soc_dapm_context *dapm = &codec->dapm; - - snd_soc_dapm_new_controls(dapm, wm8400_dapm_widgets, - ARRAY_SIZE(wm8400_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - - return 0; -} - /* * Clock after FLL and dividers */ @@ -1421,8 +1403,6 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec) ret = -EINVAL; goto err_regulator; } - wm8400_add_controls(codec); - wm8400_add_widgets(codec); return 0; err_regulator: @@ -1451,6 +1431,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8400 = { .read = wm8400_read, .write = wm8400_write, .set_bias_level = wm8400_set_bias_level, + + .controls = wm8400_snd_controls, + .num_controls = ARRAY_SIZE(wm8400_snd_controls), + .dapm_widgets = wm8400_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8400_dapm_widgets), + .dapm_routes = wm8400_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8400_dapm_routes), }; static int __devinit wm8400_probe(struct platform_device *pdev) -- cgit v1.1 From b6709f3bbd7550fd4a10943513df72e7fa41c962 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 11:41:45 +0000 Subject: ASoC: Convert WM8510 to table based DAPM and control init Signed-off-by: Mark Brown --- sound/soc/codecs/wm8510.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index 00f8dfa..9166126 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c @@ -181,7 +181,7 @@ SND_SOC_DAPM_OUTPUT("SPKOUTP"), SND_SOC_DAPM_OUTPUT("SPKOUTN"), }; -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route wm8510_dapm_routes[] = { /* Mono output mixer */ {"Mono Mixer", "PCM Playback Switch", "DAC"}, {"Mono Mixer", "Aux Playback Switch", "Aux Input"}, @@ -213,17 +213,6 @@ static const struct snd_soc_dapm_route audio_map[] = { {"ADC", NULL, "Boost Mixer"}, }; -static int wm8510_add_widgets(struct snd_soc_codec *codec) -{ - struct snd_soc_dapm_context *dapm = &codec->dapm; - - snd_soc_dapm_new_controls(dapm, wm8510_dapm_widgets, - ARRAY_SIZE(wm8510_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - - return 0; -} - struct pll_ { unsigned int pre_div:4; /* prescale - 1 */ unsigned int n:4; @@ -561,9 +550,6 @@ static int wm8510_probe(struct snd_soc_codec *codec) /* power on device */ wm8510_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - snd_soc_add_controls(codec, wm8510_snd_controls, - ARRAY_SIZE(wm8510_snd_controls)); - wm8510_add_widgets(codec); return ret; } @@ -587,6 +573,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8510 = { .reg_cache_size = ARRAY_SIZE(wm8510_reg), .reg_word_size = sizeof(u16), .reg_cache_default =wm8510_reg, + + .controls = wm8510_snd_controls, + .num_controls = ARRAY_SIZE(wm8510_snd_controls), + .dapm_widgets = wm8510_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8510_dapm_widgets), + .dapm_routes = wm8510_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8510_dapm_routes), }; static const struct of_device_id wm8510_of_match[] = { -- cgit v1.1 From f235c649c1301ae85d5c7e51e88b13adb30ed6a8 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 11:42:01 +0000 Subject: ASoC: Convert WM8580 to table based DAPM and control init Signed-off-by: Mark Brown --- sound/soc/codecs/wm8580.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 764b2bf..b1c8d3d 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c @@ -272,7 +272,7 @@ SND_SOC_DAPM_INPUT("AINL"), SND_SOC_DAPM_INPUT("AINR"), }; -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route wm8580_dapm_routes[] = { { "VOUT1L", NULL, "DAC1" }, { "VOUT1R", NULL, "DAC1" }, @@ -286,17 +286,6 @@ static const struct snd_soc_dapm_route audio_map[] = { { "ADC", NULL, "AINR" }, }; -static int wm8580_add_widgets(struct snd_soc_codec *codec) -{ - struct snd_soc_dapm_context *dapm = &codec->dapm; - - snd_soc_dapm_new_controls(dapm, wm8580_dapm_widgets, - ARRAY_SIZE(wm8580_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - - return 0; -} - /* PLL divisors */ struct _pll_div { u32 prescale:1; @@ -856,10 +845,6 @@ static int wm8580_probe(struct snd_soc_codec *codec) wm8580_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - snd_soc_add_controls(codec, wm8580_snd_controls, - ARRAY_SIZE(wm8580_snd_controls)); - wm8580_add_widgets(codec); - return 0; err_regulator_enable: @@ -889,6 +874,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8580 = { .reg_cache_size = ARRAY_SIZE(wm8580_reg), .reg_word_size = sizeof(u16), .reg_cache_default = wm8580_reg, + + .controls = wm8580_snd_controls, + .num_controls = ARRAY_SIZE(wm8580_snd_controls), + .dapm_widgets = wm8580_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8580_dapm_widgets), + .dapm_routes = wm8580_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8580_dapm_routes), }; static const struct of_device_id wm8580_of_match[] = { -- cgit v1.1 From 0e62780f5f27f24a30d5a08ed731088115e1fe80 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 17:15:06 +0000 Subject: ASoC: Convert WM8741 to table based DAPM and control init Signed-off-by: Mark Brown --- sound/soc/codecs/wm8741.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c index 24d8ec5..3941f50 100644 --- a/sound/soc/codecs/wm8741.c +++ b/sound/soc/codecs/wm8741.c @@ -85,24 +85,13 @@ SND_SOC_DAPM_OUTPUT("VOUTRP"), SND_SOC_DAPM_OUTPUT("VOUTRN"), }; -static const struct snd_soc_dapm_route intercon[] = { +static const struct snd_soc_dapm_route wm8741_dapm_routes[] = { { "VOUTLP", NULL, "DACL" }, { "VOUTLN", NULL, "DACL" }, { "VOUTRP", NULL, "DACR" }, { "VOUTRN", NULL, "DACR" }, }; -static int wm8741_add_widgets(struct snd_soc_codec *codec) -{ - struct snd_soc_dapm_context *dapm = &codec->dapm; - - snd_soc_dapm_new_controls(dapm, wm8741_dapm_widgets, - ARRAY_SIZE(wm8741_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon)); - - return 0; -} - static struct { int value; int ratio; @@ -456,10 +445,6 @@ static int wm8741_probe(struct snd_soc_codec *codec) snd_soc_update_bits(codec, WM8741_DACRMSB_ATTENUATION, WM8741_UPDATERM, WM8741_UPDATERM); - snd_soc_add_controls(codec, wm8741_snd_controls, - ARRAY_SIZE(wm8741_snd_controls)); - wm8741_add_widgets(codec); - dev_dbg(codec->dev, "Successful registration\n"); return ret; @@ -488,6 +473,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8741 = { .reg_cache_size = ARRAY_SIZE(wm8741_reg_defaults), .reg_word_size = sizeof(u16), .reg_cache_default = wm8741_reg_defaults, + + .controls = wm8741_snd_controls, + .num_controls = ARRAY_SIZE(wm8741_snd_controls), + .dapm_widgets = wm8741_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8741_dapm_widgets), + .dapm_routes = wm8741_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8741_dapm_routes), }; static const struct of_device_id wm8741_of_match[] = { -- cgit v1.1 From 0f185e3f8b06c1d0fd817af3d4c03f9c21d776e9 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 17:21:43 +0000 Subject: ASoC: Convert WM8750 to table based DAPM and control init Signed-off-by: Mark Brown --- sound/soc/codecs/wm8750.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index fa5732d..e4c50ce 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c @@ -301,7 +301,7 @@ static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = { SND_SOC_DAPM_INPUT("RINPUT3"), }; -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route wm8750_dapm_routes[] = { /* left mixer */ {"Left Mixer", "Playback Switch", "Left DAC"}, {"Left Mixer", "Left Bypass Switch", "Left Line Mux"}, @@ -395,17 +395,6 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Right ADC", NULL, "Right ADC Mux"}, }; -static int wm8750_add_widgets(struct snd_soc_codec *codec) -{ - struct snd_soc_dapm_context *dapm = &codec->dapm; - - snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets, - ARRAY_SIZE(wm8750_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - - return 0; -} - struct _coeff_div { u32 mclk; u32 rate; @@ -708,9 +697,6 @@ static int wm8750_probe(struct snd_soc_codec *codec) snd_soc_update_bits(codec, WM8750_LINVOL, 0x0100, 0x0100); snd_soc_update_bits(codec, WM8750_RINVOL, 0x0100, 0x0100); - snd_soc_add_controls(codec, wm8750_snd_controls, - ARRAY_SIZE(wm8750_snd_controls)); - wm8750_add_widgets(codec); return ret; } @@ -729,6 +715,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8750 = { .reg_cache_size = ARRAY_SIZE(wm8750_reg), .reg_word_size = sizeof(u16), .reg_cache_default = wm8750_reg, + + .controls = wm8750_snd_controls, + .num_controls = ARRAY_SIZE(wm8750_snd_controls), + .dapm_widgets = wm8750_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets), + .dapm_routes = wm8750_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8750_dapm_routes), }; static const struct of_device_id wm8750_of_match[] = { -- cgit v1.1 From 2f5374d8cf05d8b71f593633bf20972102f591c6 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 11:47:23 +0000 Subject: ASoC: Convert WM8711 to table based control init Signed-off-by: Mark Brown --- sound/soc/codecs/wm8711.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c index b9b1a2f..0b76d1d 100644 --- a/sound/soc/codecs/wm8711.c +++ b/sound/soc/codecs/wm8711.c @@ -374,9 +374,6 @@ static int wm8711_probe(struct snd_soc_codec *codec) snd_soc_update_bits(codec, WM8711_LOUT1V, 0x0100, 0x0100); snd_soc_update_bits(codec, WM8711_ROUT1V, 0x0100, 0x0100); - snd_soc_add_controls(codec, wm8711_snd_controls, - ARRAY_SIZE(wm8711_snd_controls)); - return ret; } @@ -397,6 +394,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8711 = { .reg_cache_size = ARRAY_SIZE(wm8711_reg), .reg_word_size = sizeof(u16), .reg_cache_default = wm8711_reg, + .controls = wm8711_snd_controls, + .num_controls = ARRAY_SIZE(wm8711_snd_controls), .dapm_widgets = wm8711_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(wm8711_dapm_widgets), .dapm_routes = wm8711_intercon, -- cgit v1.1 From e41d5a3b7a04e9b82279293055d09cb8164ec29e Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 11:49:02 +0000 Subject: ASoC: Convert WM8728 to table based control init Signed-off-by: Mark Brown --- sound/soc/codecs/wm8728.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c index b1f01d9..fc3d59e 100644 --- a/sound/soc/codecs/wm8728.c +++ b/sound/soc/codecs/wm8728.c @@ -243,9 +243,6 @@ static int wm8728_probe(struct snd_soc_codec *codec) /* power on device */ wm8728_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - snd_soc_add_controls(codec, wm8728_snd_controls, - ARRAY_SIZE(wm8728_snd_controls)); - return ret; } @@ -264,6 +261,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8728 = { .reg_cache_size = ARRAY_SIZE(wm8728_reg_defaults), .reg_word_size = sizeof(u16), .reg_cache_default = wm8728_reg_defaults, + .controls = wm8728_snd_controls, + .num_controls = ARRAY_SIZE(wm8728_snd_controls), .dapm_widgets = wm8728_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(wm8728_dapm_widgets), .dapm_routes = wm8728_intercon, -- cgit v1.1 From 012d12db0c42119356f3ff876289b191c2e730a7 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 21:29:50 +0000 Subject: ASoC: Remove unused struct wm2000_setup_data Signed-off-by: Mark Brown --- sound/soc/codecs/wm2000.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm2000.h b/sound/soc/codecs/wm2000.h index 0b6f056..28a51ed 100644 --- a/sound/soc/codecs/wm2000.h +++ b/sound/soc/codecs/wm2000.h @@ -9,11 +9,6 @@ #ifndef _WM2000_H #define _WM2000_H -struct wm2000_setup_data { - unsigned short i2c_address; - int mclk_div; /* Set to a non-zero value if MCLK_DIV_2 required */ -}; - extern int wm2000_add_controls(struct snd_soc_codec *codec); #define WM2000_REG_SYS_START 0x8000 -- cgit v1.1 From 8aa1fe81c56d98e484f6d8dfc7ac434dad9acd1c Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 21:57:19 +0000 Subject: ASoC: Convert wm2000 to use regmap API The driver wasn't even using the ASoC common code. Signed-off-by: Mark Brown --- sound/soc/codecs/wm2000.c | 75 ++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 44 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index 2726f66..a5f57ce 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -51,6 +52,7 @@ enum wm2000_anc_mode { struct wm2000_priv { struct i2c_client *i2c; + struct regmap *regmap; enum wm2000_anc_mode anc_mode; @@ -70,54 +72,21 @@ static struct i2c_client *wm2000_i2c; static int wm2000_write(struct i2c_client *i2c, unsigned int reg, unsigned int value) { - u8 data[3]; - int ret; - - data[0] = (reg >> 8) & 0xff; - data[1] = reg & 0xff; - data[2] = value & 0xff; - - dev_vdbg(&i2c->dev, "write %x = %x\n", reg, value); - - ret = i2c_master_send(i2c, data, 3); - if (ret == 3) - return 0; - if (ret < 0) - return ret; - else - return -EIO; + struct wm2000_priv *wm2000 = i2c_get_clientdata(i2c); + return regmap_write(wm2000->regmap, reg, value); } static unsigned int wm2000_read(struct i2c_client *i2c, unsigned int r) { - struct i2c_msg xfer[2]; - u8 reg[2]; - u8 data; + struct wm2000_priv *wm2000 = i2c_get_clientdata(i2c); + unsigned int val; int ret; - /* Write register */ - reg[0] = (r >> 8) & 0xff; - reg[1] = r & 0xff; - xfer[0].addr = i2c->addr; - xfer[0].flags = 0; - xfer[0].len = sizeof(reg); - xfer[0].buf = ®[0]; - - /* Read data */ - xfer[1].addr = i2c->addr; - xfer[1].flags = I2C_M_RD; - xfer[1].len = 1; - xfer[1].buf = &data; - - ret = i2c_transfer(i2c->adapter, xfer, 2); - if (ret != 2) { - dev_err(&i2c->dev, "i2c_transfer() returned %d\n", ret); - return 0; - } - - dev_vdbg(&i2c->dev, "read %x from %x\n", data, r); + ret = regmap_read(wm2000->regmap, r, &val); + if (ret < 0) + return -1; - return data; + return val; } static void wm2000_reset(struct wm2000_priv *wm2000) @@ -725,6 +694,11 @@ int wm2000_add_controls(struct snd_soc_codec *codec) } EXPORT_SYMBOL_GPL(wm2000_add_controls); +static const struct regmap_config wm2000_regmap = { + .reg_bits = 8, + .val_bits = 8, +}; + static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *i2c_id) { @@ -747,6 +721,16 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, return -ENOMEM; } + dev_set_drvdata(&i2c->dev, wm2000); + + wm2000->regmap = regmap_init_i2c(i2c, &wm2000_regmap); + if (IS_ERR(wm2000->regmap)) { + ret = PTR_ERR(wm2000->regmap); + dev_err(&i2c->dev, "Failed to allocate register map: %d\n", + ret); + goto err; + } + /* Verify that this is a WM2000 */ reg = wm2000_read(i2c, WM2000_REG_ID1); id = reg << 8; @@ -756,7 +740,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, if (id != 0x2000) { dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id); ret = -ENODEV; - goto err; + goto err_regmap; } reg = wm2000_read(i2c, WM2000_REG_REVISON); @@ -775,7 +759,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, ret = request_firmware(&fw, filename, &i2c->dev); if (ret != 0) { dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret); - goto err; + goto err_regmap; } /* Pre-cook the concatenation of the register address onto the image */ @@ -795,7 +779,6 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, release_firmware(fw); - dev_set_drvdata(&i2c->dev, wm2000); wm2000->anc_eng_ena = 1; wm2000->anc_active = 1; wm2000->spk_ena = 1; @@ -812,6 +795,8 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, err_fw: release_firmware(fw); +err_regmap: + regmap_exit(wm2000->regmap); err: return ret; } @@ -822,6 +807,8 @@ static __devexit int wm2000_i2c_remove(struct i2c_client *i2c) wm2000_anc_transition(wm2000, ANC_OFF); + regmap_exit(wm2000->regmap); + wm2000_i2c = NULL; return 0; -- cgit v1.1 From 4911ccdb9d052d0389353cec5cc591a3669f39cb Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 21:59:18 +0000 Subject: ASoC: Convert WM2000 into a standard CODEC driver We've been able to handle external amps for a while now. Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 6 +- sound/soc/codecs/Makefile | 4 +- sound/soc/codecs/wm2000.c | 145 ++++++++++++++++++++++------------------------ sound/soc/codecs/wm2000.h | 2 - 4 files changed, 73 insertions(+), 84 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 593174c..08e9d40 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -289,6 +289,9 @@ config SND_SOC_WL1273 config SND_SOC_WM1250_EV1 tristate +config SND_SOC_WM2000 + tristate + config SND_SOC_WM5100 tristate @@ -425,8 +428,5 @@ config SND_SOC_MAX9877 config SND_SOC_TPA6130A2 tristate -config SND_SOC_WM2000 - tristate - config SND_SOC_WM9090 tristate diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index fa15006..adfa22e 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -50,6 +50,7 @@ snd-soc-uda134x-objs := uda134x.o snd-soc-uda1380-objs := uda1380.o snd-soc-wl1273-objs := wl1273.o snd-soc-wm1250-ev1-objs := wm1250-ev1.o +snd-soc-wm2000-objs := wm2000.o snd-soc-wm5100-objs := wm5100.o wm5100-tables.o snd-soc-wm8350-objs := wm8350.o snd-soc-wm8400-objs := wm8400.o @@ -97,7 +98,6 @@ snd-soc-wm-hubs-objs := wm_hubs.o # Amp snd-soc-max9877-objs := max9877.o snd-soc-tpa6130a2-objs := tpa6130a2.o -snd-soc-wm2000-objs := wm2000.o snd-soc-wm9090-objs := wm9090.o obj-$(CONFIG_SND_SOC_88PM860X) += snd-soc-88pm860x.o @@ -152,6 +152,7 @@ obj-$(CONFIG_SND_SOC_UDA134X) += snd-soc-uda134x.o obj-$(CONFIG_SND_SOC_UDA1380) += snd-soc-uda1380.o obj-$(CONFIG_SND_SOC_WL1273) += snd-soc-wl1273.o obj-$(CONFIG_SND_SOC_WM1250_EV1) += snd-soc-wm1250-ev1.o +obj-$(CONFIG_SND_SOC_WM2000) += snd-soc-wm2000.o obj-$(CONFIG_SND_SOC_WM5100) += snd-soc-wm5100.o obj-$(CONFIG_SND_SOC_WM8350) += snd-soc-wm8350.o obj-$(CONFIG_SND_SOC_WM8400) += snd-soc-wm8400.o @@ -199,5 +200,4 @@ obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o # Amp obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o obj-$(CONFIG_SND_SOC_TPA6130A2) += snd-soc-tpa6130a2.o -obj-$(CONFIG_SND_SOC_WM2000) += snd-soc-wm2000.o obj-$(CONFIG_SND_SOC_WM9090) += snd-soc-wm9090.o diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index a5f57ce..c288090 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c @@ -67,8 +67,6 @@ struct wm2000_priv { char *anc_download; }; -static struct i2c_client *wm2000_i2c; - static int wm2000_write(struct i2c_client *i2c, unsigned int reg, unsigned int value) { @@ -580,7 +578,8 @@ static int wm2000_anc_set_mode(struct wm2000_priv *wm2000) static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct wm2000_priv *wm2000 = dev_get_drvdata(&wm2000_i2c->dev); + struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); + struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); ucontrol->value.enumerated.item[0] = wm2000->anc_active; @@ -590,7 +589,8 @@ static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol, static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct wm2000_priv *wm2000 = dev_get_drvdata(&wm2000_i2c->dev); + struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); + struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); int anc_active = ucontrol->value.enumerated.item[0]; if (anc_active > 1) @@ -604,7 +604,8 @@ static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol, static int wm2000_speaker_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct wm2000_priv *wm2000 = dev_get_drvdata(&wm2000_i2c->dev); + struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); + struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); ucontrol->value.enumerated.item[0] = wm2000->spk_ena; @@ -614,7 +615,8 @@ static int wm2000_speaker_get(struct snd_kcontrol *kcontrol, static int wm2000_speaker_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct wm2000_priv *wm2000 = dev_get_drvdata(&wm2000_i2c->dev); + struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); + struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); int val = ucontrol->value.enumerated.item[0]; if (val > 1) @@ -637,7 +639,8 @@ static const struct snd_kcontrol_new wm2000_controls[] = { static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { - struct wm2000_priv *wm2000 = dev_get_drvdata(&wm2000_i2c->dev); + struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); + struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); if (SND_SOC_DAPM_EVENT_ON(event)) wm2000->anc_eng_ena = 1; @@ -650,11 +653,11 @@ static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w, static const struct snd_soc_dapm_widget wm2000_dapm_widgets[] = { /* Externally visible pins */ -SND_SOC_DAPM_OUTPUT("WM2000 SPKN"), -SND_SOC_DAPM_OUTPUT("WM2000 SPKP"), +SND_SOC_DAPM_OUTPUT("SPKN"), +SND_SOC_DAPM_OUTPUT("SPKP"), -SND_SOC_DAPM_INPUT("WM2000 LINN"), -SND_SOC_DAPM_INPUT("WM2000 LINP"), +SND_SOC_DAPM_INPUT("LINN"), +SND_SOC_DAPM_INPUT("LINP"), SND_SOC_DAPM_PGA_E("ANC Engine", SND_SOC_NOPM, 0, 0, NULL, 0, wm2000_anc_power_event, @@ -662,43 +665,68 @@ SND_SOC_DAPM_PGA_E("ANC Engine", SND_SOC_NOPM, 0, 0, NULL, 0, }; /* Target, Path, Source */ -static const struct snd_soc_dapm_route audio_map[] = { - { "WM2000 SPKN", NULL, "ANC Engine" }, - { "WM2000 SPKP", NULL, "ANC Engine" }, - { "ANC Engine", NULL, "WM2000 LINN" }, - { "ANC Engine", NULL, "WM2000 LINP" }, +static const struct snd_soc_dapm_route wm2000_audio_map[] = { + { "SPKN", NULL, "ANC Engine" }, + { "SPKP", NULL, "ANC Engine" }, + { "ANC Engine", NULL, "LINN" }, + { "ANC Engine", NULL, "LINP" }, }; -/* Called from the machine driver */ -int wm2000_add_controls(struct snd_soc_codec *codec) +#ifdef CONFIG_PM +static int wm2000_suspend(struct snd_soc_codec *codec) { - struct snd_soc_dapm_context *dapm = &codec->dapm; - int ret; + struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); - if (!wm2000_i2c) { - pr_err("WM2000 not yet probed\n"); - return -ENODEV; - } - - ret = snd_soc_dapm_new_controls(dapm, wm2000_dapm_widgets, - ARRAY_SIZE(wm2000_dapm_widgets)); - if (ret < 0) - return ret; + return wm2000_anc_transition(wm2000, ANC_OFF); +} - ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - if (ret < 0) - return ret; +static int wm2000_resume(struct snd_soc_codec *codec) +{ + struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); - return snd_soc_add_controls(codec, wm2000_controls, - ARRAY_SIZE(wm2000_controls)); + return wm2000_anc_set_mode(wm2000); } -EXPORT_SYMBOL_GPL(wm2000_add_controls); +#else +#define wm2000_suspend NULL +#define wm2000_resume NULL +#endif static const struct regmap_config wm2000_regmap = { .reg_bits = 8, .val_bits = 8, }; +static int wm2000_probe(struct snd_soc_codec *codec) +{ + struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); + + /* This will trigger a transition to standby mode by default */ + wm2000_anc_set_mode(wm2000); + + return 0; +} + +static int wm2000_remove(struct snd_soc_codec *codec) +{ + struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); + + return wm2000_anc_transition(wm2000, ANC_OFF); +} + +static struct snd_soc_codec_driver soc_codec_dev_wm2000 = { + .probe = wm2000_probe, + .remove = wm2000_remove, + .suspend = wm2000_suspend, + .resume = wm2000_resume, + + .dapm_widgets = wm2000_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm2000_dapm_widgets), + .dapm_routes = wm2000_audio_map, + .num_dapm_routes = ARRAY_SIZE(wm2000_audio_map), + .controls = wm2000_controls, + .num_controls = ARRAY_SIZE(wm2000_controls), +}; + static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *i2c_id) { @@ -709,11 +737,6 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, int reg, ret; u16 id; - if (wm2000_i2c) { - dev_err(&i2c->dev, "Another WM2000 is already registered\n"); - return -EINVAL; - } - wm2000 = devm_kzalloc(&i2c->dev, sizeof(struct wm2000_priv), GFP_KERNEL); if (wm2000 == NULL) { @@ -786,10 +809,10 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, wm2000_reset(wm2000); - /* This will trigger a transition to standby mode by default */ - wm2000_anc_set_mode(wm2000); - - wm2000_i2c = i2c; + ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, + NULL, 0); + if (ret != 0) + goto err_fw; return 0; @@ -805,42 +828,12 @@ static __devexit int wm2000_i2c_remove(struct i2c_client *i2c) { struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); - wm2000_anc_transition(wm2000, ANC_OFF); - + snd_soc_unregister_codec(&i2c->dev); regmap_exit(wm2000->regmap); - wm2000_i2c = NULL; - return 0; } -static void wm2000_i2c_shutdown(struct i2c_client *i2c) -{ - struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); - - wm2000_anc_transition(wm2000, ANC_OFF); -} - -#ifdef CONFIG_PM -static int wm2000_i2c_suspend(struct device *dev) -{ - struct i2c_client *i2c = to_i2c_client(dev); - struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); - - return wm2000_anc_transition(wm2000, ANC_OFF); -} - -static int wm2000_i2c_resume(struct device *dev) -{ - struct i2c_client *i2c = to_i2c_client(dev); - struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); - - return wm2000_anc_set_mode(wm2000); -} -#endif - -static SIMPLE_DEV_PM_OPS(wm2000_pm, wm2000_i2c_suspend, wm2000_i2c_resume); - static const struct i2c_device_id wm2000_i2c_id[] = { { "wm2000", 0 }, { } @@ -851,11 +844,9 @@ static struct i2c_driver wm2000_i2c_driver = { .driver = { .name = "wm2000", .owner = THIS_MODULE, - .pm = &wm2000_pm, }, .probe = wm2000_i2c_probe, .remove = __devexit_p(wm2000_i2c_remove), - .shutdown = wm2000_i2c_shutdown, .id_table = wm2000_i2c_id, }; diff --git a/sound/soc/codecs/wm2000.h b/sound/soc/codecs/wm2000.h index 28a51ed..abcd82a 100644 --- a/sound/soc/codecs/wm2000.h +++ b/sound/soc/codecs/wm2000.h @@ -9,8 +9,6 @@ #ifndef _WM2000_H #define _WM2000_H -extern int wm2000_add_controls(struct snd_soc_codec *codec); - #define WM2000_REG_SYS_START 0x8000 #define WM2000_REG_SPEECH_CLARITY 0x8fef #define WM2000_REG_SYS_WATCHDOG 0x8ff6 -- cgit v1.1 From 59792aa91fa90ab89f58152afa09d6447fdfc754 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 2 Dec 2011 22:00:39 +0000 Subject: ASoC: Sort WM9090 in with the CODEC drivers The driver itself has been a regular CODEC driver for a while now. Signed-off-by: Mark Brown --- sound/soc/codecs/Kconfig | 6 +++--- sound/soc/codecs/Makefile | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 08e9d40..bc2364ac 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -409,6 +409,9 @@ config SND_SOC_WM8996 config SND_SOC_WM9081 tristate +config SND_SOC_WM9090 + tristate + config SND_SOC_WM9705 tristate @@ -427,6 +430,3 @@ config SND_SOC_MAX9877 config SND_SOC_TPA6130A2 tristate - -config SND_SOC_WM9090 - tristate diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index adfa22e..9aa6e66 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -90,6 +90,7 @@ snd-soc-wm8993-objs := wm8993.o snd-soc-wm8994-objs := wm8994.o wm8994-tables.o wm8958-dsp2.o snd-soc-wm8995-objs := wm8995.o snd-soc-wm9081-objs := wm9081.o +snd-soc-wm9090-objs := wm9090.o snd-soc-wm9705-objs := wm9705.o snd-soc-wm9712-objs := wm9712.o snd-soc-wm9713-objs := wm9713.o @@ -98,7 +99,6 @@ snd-soc-wm-hubs-objs := wm_hubs.o # Amp snd-soc-max9877-objs := max9877.o snd-soc-tpa6130a2-objs := tpa6130a2.o -snd-soc-wm9090-objs := wm9090.o obj-$(CONFIG_SND_SOC_88PM860X) += snd-soc-88pm860x.o obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o @@ -192,6 +192,7 @@ obj-$(CONFIG_SND_SOC_WM8993) += snd-soc-wm8993.o obj-$(CONFIG_SND_SOC_WM8994) += snd-soc-wm8994.o obj-$(CONFIG_SND_SOC_WM8995) += snd-soc-wm8995.o obj-$(CONFIG_SND_SOC_WM9081) += snd-soc-wm9081.o +obj-$(CONFIG_SND_SOC_WM9090) += snd-soc-wm9090.o obj-$(CONFIG_SND_SOC_WM9705) += snd-soc-wm9705.o obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o @@ -200,4 +201,3 @@ obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o # Amp obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o obj-$(CONFIG_SND_SOC_TPA6130A2) += snd-soc-tpa6130a2.o -obj-$(CONFIG_SND_SOC_WM9090) += snd-soc-wm9090.o -- cgit v1.1 From dd85ecc269a3aa537fd045e113b4755a3cd1284f Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sun, 4 Dec 2011 08:15:17 +0800 Subject: ASoC: Make SND_SOC_LITTLEMILL select MFD_WM8994 SND_SOC_LITTLEMILL selects SND_SOC_WM8994, but SND_SOC_WM8994 needs MFD_WM8994. Thus we need to select MFD_WM8994 to fix below build error: LD .tmp_vmlinux1 sound/built-in.o: In function `wm8994_write': sound/soc/codecs/wm8994.c:201: undefined reference to `wm8994_reg_write' sound/built-in.o: In function `wm8994_read': sound/soc/codecs/wm8994.c:222: undefined reference to `wm8994_reg_read' sound/built-in.o: In function `wm8994_resume': sound/soc/codecs/wm8994.c:2847: undefined reference to `wm8994_reg_read' sound/built-in.o: In function `wm8994_codec_probe': sound/soc/codecs/wm8994.c:3501: undefined reference to `wm8994_reg_read' sound/soc/codecs/wm8994.c:3660: undefined reference to `wm8994_reg_read' sound/soc/codecs/wm8994.c:3672: undefined reference to `wm8994_reg_read' sound/built-in.o: In function `wm8958_dsp2_fw': sound/soc/codecs/wm8958-dsp2.c:154: undefined reference to `wm8994_bulk_write' make: *** [.tmp_vmlinux1] Error 1 Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/samsung/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index 09d636c..f3417f2 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig @@ -210,4 +210,5 @@ config SND_SOC_LITTLEMILL tristate "Audio support for Wolfson Littlemill" depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 select SND_SAMSUNG_I2S + select MFD_WM8994 select SND_SOC_WM8994 -- cgit v1.1 From aec60f51e5127fb750b66eb7905047c67372177f Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 5 Dec 2011 17:09:11 +0800 Subject: ASoC: Convert e740_wm9705 to use gpio_request_one() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/e740_wm9705.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c index 35ed7eb..818dc57 100644 --- a/sound/soc/pxa/e740_wm9705.c +++ b/sound/soc/pxa/e740_wm9705.c @@ -146,29 +146,21 @@ static int __init e740_init(void) if (!machine_is_e740()) return -ENODEV; - ret = gpio_request(GPIO_E740_MIC_ON, "Mic amp"); + /* Disable audio */ + ret = gpio_request_one(GPIO_E740_MIC_ON, GPIOF_OUT_INIT_LOW, "Mic amp"); if (ret) return ret; - ret = gpio_request(GPIO_E740_AMP_ON, "Output amp"); + ret = gpio_request_one(GPIO_E740_AMP_ON, GPIOF_OUT_INIT_LOW, + "Output amp"); if (ret) goto free_mic_amp_gpio; - ret = gpio_request(GPIO_E740_WM9705_nAVDD2, "Audio power"); + ret = gpio_request_one(GPIO_E740_WM9705_nAVDD2, GPIOF_OUT_INIT_HIGH, + "Audio power"); if (ret) goto free_op_amp_gpio; - /* Disable audio */ - ret = gpio_direction_output(GPIO_E740_MIC_ON, 0); - if (ret) - goto free_apwr_gpio; - ret = gpio_direction_output(GPIO_E740_AMP_ON, 0); - if (ret) - goto free_apwr_gpio; - ret = gpio_direction_output(GPIO_E740_WM9705_nAVDD2, 1); - if (ret) - goto free_apwr_gpio; - e740_snd_device = platform_device_alloc("soc-audio", -1); if (!e740_snd_device) { ret = -ENOMEM; -- cgit v1.1 From 68020db8ac1046e50c758545b75850eb356a0651 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 5 Dec 2011 07:58:25 +0800 Subject: ASoC: uda1380: Convert to gpio_request_one() Using gpio_request_one can make the error handling simpler. Also remove a redundant "Failed to issue reset" error message. We already show the error message in uda1380_reset() error path. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/uda1380.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index 39c228c..83e45d2 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c @@ -732,27 +732,21 @@ static int uda1380_probe(struct snd_soc_codec *codec) return -EINVAL; if (gpio_is_valid(pdata->gpio_reset)) { - ret = gpio_request(pdata->gpio_reset, "uda1380 reset"); + ret = gpio_request_one(pdata->gpio_reset, GPIOF_OUT_INIT_LOW, + "uda1380 reset"); if (ret) goto err_out; - ret = gpio_direction_output(pdata->gpio_reset, 0); - if (ret) - goto err_gpio_reset_conf; } if (gpio_is_valid(pdata->gpio_power)) { - ret = gpio_request(pdata->gpio_power, "uda1380 power"); - if (ret) - goto err_gpio; - ret = gpio_direction_output(pdata->gpio_power, 0); + ret = gpio_request_one(pdata->gpio_power, GPIOF_OUT_INIT_LOW, + "uda1380 power"); if (ret) - goto err_gpio_power_conf; + goto err_free_gpio; } else { ret = uda1380_reset(codec); - if (ret) { - dev_err(codec->dev, "Failed to issue reset\n"); - goto err_reset; - } + if (ret) + goto err_free_gpio; } INIT_WORK(&uda1380->work, uda1380_flush_work); @@ -776,13 +770,7 @@ static int uda1380_probe(struct snd_soc_codec *codec) return 0; -err_reset: -err_gpio_power_conf: - if (gpio_is_valid(pdata->gpio_power)) - gpio_free(pdata->gpio_power); - -err_gpio_reset_conf: -err_gpio: +err_free_gpio: if (gpio_is_valid(pdata->gpio_reset)) gpio_free(pdata->gpio_reset); err_out: -- cgit v1.1 From f031efe9402e4ab6a6cd86bbda54b30ed9171237 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 5 Dec 2011 10:06:04 +0800 Subject: ASoC: Fix reg_cache_size for stac9766 reg_cache_size is supposed to be the number of elements in the register cache, not the size in bytes. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/stac9766.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c index e34969c..cc0566c 100644 --- a/sound/soc/codecs/stac9766.c +++ b/sound/soc/codecs/stac9766.c @@ -379,7 +379,7 @@ static struct snd_soc_codec_driver soc_codec_dev_stac9766 = { .remove = stac9766_codec_remove, .suspend = stac9766_codec_suspend, .resume = stac9766_codec_resume, - .reg_cache_size = sizeof(stac9766_reg), + .reg_cache_size = ARRAY_SIZE(stac9766_reg), .reg_word_size = sizeof(u16), .reg_cache_step = 2, .reg_cache_default = stac9766_reg, -- cgit v1.1 From 03c33042dbcd087303062c51f462c4575eb630d6 Mon Sep 17 00:00:00 2001 From: Vinod Koul Date: Mon, 5 Dec 2011 19:13:41 +0530 Subject: ASoC: sst_platform: fix the dsp driver interface lower level drivers typically register with upper layers. So fix by exporting symbols from sst_platform driver for dsp driver to register to sst platform driver Now this driver doesnt depend on sst driver, so remove the dependency and the header files Signed-off-by: Vinod Koul Signed-off-by: Mark Brown --- sound/soc/mid-x86/Kconfig | 1 - sound/soc/mid-x86/sst_platform.c | 130 +++++++++++++++++++++++++-------------- sound/soc/mid-x86/sst_platform.h | 82 +++++++++++++++++++++--- 3 files changed, 158 insertions(+), 55 deletions(-) (limited to 'sound') diff --git a/sound/soc/mid-x86/Kconfig b/sound/soc/mid-x86/Kconfig index 2935042..61c10bf 100644 --- a/sound/soc/mid-x86/Kconfig +++ b/sound/soc/mid-x86/Kconfig @@ -1,7 +1,6 @@ config SND_MFLD_MACHINE tristate "SOC Machine Audio driver for Intel Medfield MID platform" depends on INTEL_SCU_IPC - depends on SND_INTEL_SST select SND_SOC_SN95031 select SND_SST_PLATFORM help diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c index 94f70b3..24f9471 100644 --- a/sound/soc/mid-x86/sst_platform.c +++ b/sound/soc/mid-x86/sst_platform.c @@ -32,10 +32,51 @@ #include #include #include -#include "../../../drivers/staging/intel_sst/intel_sst_ioctl.h" -#include "../../../drivers/staging/intel_sst/intel_sst.h" #include "sst_platform.h" +static struct sst_device *sst; +static DEFINE_MUTEX(sst_lock); + +int sst_register_dsp(struct sst_device *dev) +{ + BUG_ON(!dev); + if (!try_module_get(dev->dev->driver->owner)) + return -ENODEV; + mutex_lock(&sst_lock); + if (sst) { + pr_err("we already have a device %s\n", sst->name); + module_put(dev->dev->driver->owner); + mutex_unlock(&sst_lock); + return -EEXIST; + } + pr_debug("registering device %s\n", dev->name); + sst = dev; + mutex_unlock(&sst_lock); + return 0; +} +EXPORT_SYMBOL_GPL(sst_register_dsp); + +int sst_unregister_dsp(struct sst_device *dev) +{ + BUG_ON(!dev); + if (dev != sst) + return -EINVAL; + + mutex_lock(&sst_lock); + + if (!sst) { + mutex_unlock(&sst_lock); + return -EIO; + } + + module_put(sst->dev->driver->owner); + pr_debug("unreg %s\n", sst->name); + sst = NULL; + mutex_unlock(&sst_lock); + return 0; +} +EXPORT_SYMBOL_GPL(sst_unregister_dsp); + static struct snd_pcm_hardware sst_platform_pcm_hw = { .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_DOUBLE | @@ -135,37 +176,34 @@ static inline int sst_get_stream_status(struct sst_runtime_stream *stream) } static void sst_fill_pcm_params(struct snd_pcm_substream *substream, - struct snd_sst_stream_params *param) + struct sst_pcm_params *param) { - param->uc.pcm_params.codec = SST_CODEC_TYPE_PCM; - param->uc.pcm_params.num_chan = (u8) substream->runtime->channels; - param->uc.pcm_params.pcm_wd_sz = substream->runtime->sample_bits; - param->uc.pcm_params.reserved = 0; - param->uc.pcm_params.sfreq = substream->runtime->rate; - param->uc.pcm_params.ring_buffer_size = - snd_pcm_lib_buffer_bytes(substream); - param->uc.pcm_params.period_count = substream->runtime->period_size; - param->uc.pcm_params.ring_buffer_addr = - virt_to_phys(substream->dma_buffer.area); - pr_debug("period_cnt = %d\n", param->uc.pcm_params.period_count); - pr_debug("sfreq= %d, wd_sz = %d\n", - param->uc.pcm_params.sfreq, param->uc.pcm_params.pcm_wd_sz); + param->codec = SST_CODEC_TYPE_PCM; + param->num_chan = (u8) substream->runtime->channels; + param->pcm_wd_sz = substream->runtime->sample_bits; + param->reserved = 0; + param->sfreq = substream->runtime->rate; + param->ring_buffer_size = snd_pcm_lib_buffer_bytes(substream); + param->period_count = substream->runtime->period_size; + param->ring_buffer_addr = virt_to_phys(substream->dma_buffer.area); + pr_debug("period_cnt = %d\n", param->period_count); + pr_debug("sfreq= %d, wd_sz = %d\n", param->sfreq, param->pcm_wd_sz); } static int sst_platform_alloc_stream(struct snd_pcm_substream *substream) { struct sst_runtime_stream *stream = substream->runtime->private_data; - struct snd_sst_stream_params param = {{{0,},},}; - struct snd_sst_params str_params = {0}; + struct sst_pcm_params param = {0}; + struct sst_stream_params str_params = {0}; int ret_val; /* set codec params and inform SST driver the same */ sst_fill_pcm_params(substream, ¶m); substream->runtime->dma_area = substream->dma_buffer.area; str_params.sparams = param; - str_params.codec = param.uc.pcm_params.codec; + str_params.codec = param.codec; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { str_params.ops = STREAM_OPS_PLAYBACK; str_params.device_type = substream->pcm->device + 1; @@ -177,7 +215,7 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream) pr_debug("Capture stream,Device %d\n", substream->pcm->device); } - ret_val = stream->sstdrv_ops->pcm_control->open(&str_params); + ret_val = stream->ops->open(&str_params); pr_debug("SST_SND_PLAY/CAPTURE ret_val = %x\n", ret_val); if (ret_val < 0) return ret_val; @@ -216,7 +254,7 @@ static int sst_platform_init_stream(struct snd_pcm_substream *substream) stream->stream_info.mad_substream = substream; stream->stream_info.buffer_ptr = 0; stream->stream_info.sfreq = substream->runtime->rate; - ret_val = stream->sstdrv_ops->pcm_control->device_control( + ret_val = stream->ops->device_control( SST_SND_STREAM_INIT, &stream->stream_info); if (ret_val) pr_err("control_set ret error %d\n", ret_val); @@ -229,7 +267,6 @@ static int sst_platform_open(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct sst_runtime_stream *stream; - int ret_val = 0; pr_debug("sst_platform_open called\n"); @@ -243,27 +280,27 @@ static int sst_platform_open(struct snd_pcm_substream *substream) if (!stream) return -ENOMEM; spin_lock_init(&stream->status_lock); - stream->stream_info.str_id = 0; - sst_set_stream_status(stream, SST_PLATFORM_INIT); - stream->stream_info.mad_substream = substream; - /* allocate memory for SST API set */ - stream->sstdrv_ops = kzalloc(sizeof(*stream->sstdrv_ops), - GFP_KERNEL); - if (!stream->sstdrv_ops) { - pr_err("sst: mem allocation for ops fail\n"); + + /* get the sst ops */ + mutex_lock(&sst_lock); + if (!sst) { + pr_err("no device available to run\n"); + mutex_unlock(&sst_lock); kfree(stream); - return -ENOMEM; + return -ENODEV; } - stream->sstdrv_ops->vendor_id = MSIC_VENDOR_ID; - stream->sstdrv_ops->module_name = SST_CARD_NAMES; - /* registering with SST driver to get access to SST APIs to use */ - ret_val = register_sst_card(stream->sstdrv_ops); - if (ret_val) { - pr_err("sst: sst card registration failed\n"); - kfree(stream->sstdrv_ops); + if (!try_module_get(sst->dev->driver->owner)) { + mutex_unlock(&sst_lock); kfree(stream); - return ret_val; + return -ENODEV; } + stream->ops = sst->ops; + mutex_unlock(&sst_lock); + + stream->stream_info.str_id = 0; + sst_set_stream_status(stream, SST_PLATFORM_INIT); + stream->stream_info.mad_substream = substream; + /* allocate memory for SST API set */ runtime->private_data = stream; return 0; @@ -278,9 +315,8 @@ static int sst_platform_close(struct snd_pcm_substream *substream) stream = substream->runtime->private_data; str_id = stream->stream_info.str_id; if (str_id) - ret_val = stream->sstdrv_ops->pcm_control->close(str_id); - unregister_sst_card(stream->sstdrv_ops); - kfree(stream->sstdrv_ops); + ret_val = stream->ops->close(str_id); + module_put(sst->dev->driver->owner); kfree(stream); return ret_val; } @@ -294,8 +330,8 @@ static int sst_platform_pcm_prepare(struct snd_pcm_substream *substream) stream = substream->runtime->private_data; str_id = stream->stream_info.str_id; if (stream->stream_info.str_id) { - ret_val = stream->sstdrv_ops->pcm_control->device_control( - SST_SND_DROP, &str_id); + ret_val = stream->ops->device_control( + SST_SND_DROP, &str_id); return ret_val; } @@ -347,8 +383,7 @@ static int sst_platform_pcm_trigger(struct snd_pcm_substream *substream, default: return -EINVAL; } - ret_val = stream->sstdrv_ops->pcm_control->device_control(str_cmd, - &str_id); + ret_val = stream->ops->device_control(str_cmd, &str_id); if (!ret_val) sst_set_stream_status(stream, status); @@ -368,7 +403,7 @@ static snd_pcm_uframes_t sst_platform_pcm_pointer if (status == SST_PLATFORM_INIT) return 0; str_info = &stream->stream_info; - ret_val = stream->sstdrv_ops->pcm_control->device_control( + ret_val = stream->ops->device_control( SST_SND_BUFFER_POINTER, str_info); if (ret_val) { pr_err("sst: error code = %d\n", ret_val); @@ -439,6 +474,7 @@ static int sst_platform_probe(struct platform_device *pdev) int ret; pr_debug("sst_platform_probe called\n"); + sst = NULL; ret = snd_soc_register_platform(&pdev->dev, &sst_soc_platform_drv); if (ret) { pr_err("registering soc platform failed\n"); diff --git a/sound/soc/mid-x86/sst_platform.h b/sound/soc/mid-x86/sst_platform.h index df37028..f04f4f7 100644 --- a/sound/soc/mid-x86/sst_platform.h +++ b/sound/soc/mid-x86/sst_platform.h @@ -42,14 +42,14 @@ #define SST_MIN_PERIODS 2 #define SST_MAX_PERIODS (1024*2) #define SST_FIFO_SIZE 0 -#define SST_CARD_NAMES "intel_mid_card" -#define MSIC_VENDOR_ID 3 +#define SST_CODEC_TYPE_PCM 1 -struct sst_runtime_stream { - int stream_status; - struct pcm_stream_info stream_info; - struct intel_sst_card_ops *sstdrv_ops; - spinlock_t status_lock; +struct pcm_stream_info { + int str_id; + void *mad_substream; + void (*period_elapsed) (void *mad_substream); + unsigned long long buffer_ptr; + int sfreq; }; enum sst_drv_status { @@ -60,4 +60,72 @@ enum sst_drv_status { SST_PLATFORM_DROPPED, }; +enum sst_controls { + SST_SND_ALLOC = 0x00, + SST_SND_PAUSE = 0x01, + SST_SND_RESUME = 0x02, + SST_SND_DROP = 0x03, + SST_SND_FREE = 0x04, + SST_SND_BUFFER_POINTER = 0x05, + SST_SND_STREAM_INIT = 0x06, + SST_SND_START = 0x07, + SST_MAX_CONTROLS = 0x07, +}; + +enum sst_stream_ops { + STREAM_OPS_PLAYBACK = 0, + STREAM_OPS_CAPTURE, +}; + +enum sst_audio_device_type { + SND_SST_DEVICE_HEADSET = 1, + SND_SST_DEVICE_IHF, + SND_SST_DEVICE_VIBRA, + SND_SST_DEVICE_HAPTIC, + SND_SST_DEVICE_CAPTURE, +}; + +/* PCM Parameters */ +struct sst_pcm_params { + u16 codec; /* codec type */ + u8 num_chan; /* 1=Mono, 2=Stereo */ + u8 pcm_wd_sz; /* 16/24 - bit*/ + u32 reserved; /* Bitrate in bits per second */ + u32 sfreq; /* Sampling rate in Hz */ + u32 ring_buffer_size; + u32 period_count; /* period elapsed in samples*/ + u32 ring_buffer_addr; +}; + +struct sst_stream_params { + u32 result; + u32 stream_id; + u8 codec; + u8 ops; + u8 stream_type; + u8 device_type; + struct sst_pcm_params sparams; +}; + +struct sst_ops { + int (*open) (struct sst_stream_params *str_param); + int (*device_control) (int cmd, void *arg); + int (*close) (unsigned int str_id); +}; + +struct sst_runtime_stream { + int stream_status; + struct pcm_stream_info stream_info; + struct sst_ops *ops; + spinlock_t status_lock; +}; + +struct sst_device { + char *name; + struct device *dev; + struct sst_ops *ops; +}; + +int sst_register_dsp(struct sst_device *sst); +int sst_unregister_dsp(struct sst_device *sst); #endif -- cgit v1.1 From a0f203d384fadacba514748cd0095efeadeed96c Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Fri, 2 Dec 2011 15:08:37 -0700 Subject: ASoC: WM8903: Fix platform data gpio_cfg confusion wm8903_platform_data.gpio_cfg[] was intended to be interpreted as follows: 0: Don't touch this GPIO's configuration register 1..7fff: Write that value to the GPIO's configuration register 8000: Write zero to the GPIO's configuration register other: Undefined (invalid) The rationale is that platform data is usually global data, and a value of zero means that the field wasn't explicitly set to anything (e.g. because the field was new to the pdata type, and existing users weren't update to initialize it) and hence the value zero should be ignored. 0x8000 is an explicit way to get 0 in the register. The code worked this way until commit 7cfe561 "ASoC: wm8903: Expose GPIOs through gpiolib", where the behaviour was changed due to my lack of awareness of the above rationale. This patch reverts to the intended behaviour, and updates all in-tree users to use the correct scheme. This also makes WM8903 consistent with other devices that use a similar scheme. WM8903_GPIO_NO_CONFIG is also renamed to WM8903_GPIO_CONFIG_ZERO so that its name accurately reflects its purpose. Signed-off-by: Stephen Warren Cc: Olof Johansson Cc: Colin Cross Signed-off-by: Mark Brown --- sound/soc/codecs/wm8903.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index e6ecede..184b677 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -1893,7 +1893,8 @@ static int wm8903_probe(struct snd_soc_codec *codec) bool mic_gpio = false; for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) { - if (pdata->gpio_cfg[i] > 0x7fff) + if ((!pdata->gpio_cfg[i]) || + (pdata->gpio_cfg[i] > WM8903_GPIO_CONFIG_ZERO)) continue; snd_soc_write(codec, WM8903_GPIO_CONTROL_1 + i, -- cgit v1.1 From db81778409227a0dc46ab95b95e1c7184ae9ef48 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Fri, 2 Dec 2011 15:08:39 -0700 Subject: ASoC: WM8903: Remove conditionals checking pdata != NULL The pdata pointer is now always valid. Remove any conditions that check its validity. This patch is mostly just removing an indentation level. One variable had to be moved due to the removal of a scope, and one comment was split into two. Viewing the patch with git show/diff -b will show that it's actually very small. Note that WM8903_MIC_BIAS_CONTROL_0 is now written unconditionally, whereas it used to be written only if pdata was supplied. Since defpdata.micdet_cfg = 0, this unconditional write simply echos the HW defaults in the case where pdata is not supplied. Based on work by John Bonesio, but significantly reworked since then. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/codecs/wm8903.c | 74 +++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 38 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 184b677..b114468 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -1842,7 +1842,7 @@ static void wm8903_init_gpio(struct snd_soc_codec *codec) wm8903->gpio_chip.ngpio = WM8903_NUM_GPIO; wm8903->gpio_chip.dev = codec->dev; - if (pdata && pdata->gpio_base) + if (pdata->gpio_base) wm8903->gpio_chip.base = pdata->gpio_base; else wm8903->gpio_chip.base = -1; @@ -1878,6 +1878,7 @@ static int wm8903_probe(struct snd_soc_codec *codec) int ret, i; int trigger, irq_pol; u16 val; + bool mic_gpio = false; wm8903->codec = codec; codec->control_data = wm8903->regmap; @@ -1888,52 +1889,49 @@ static int wm8903_probe(struct snd_soc_codec *codec) return ret; } - /* Set up GPIOs and microphone detection */ - if (pdata) { - bool mic_gpio = false; - - for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) { - if ((!pdata->gpio_cfg[i]) || - (pdata->gpio_cfg[i] > WM8903_GPIO_CONFIG_ZERO)) - continue; + /* Set up GPIOs, detect if any are MIC detect outputs */ + for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) { + if ((!pdata->gpio_cfg[i]) || + (pdata->gpio_cfg[i] > WM8903_GPIO_CONFIG_ZERO)) + continue; - snd_soc_write(codec, WM8903_GPIO_CONTROL_1 + i, - pdata->gpio_cfg[i] & 0x7fff); + snd_soc_write(codec, WM8903_GPIO_CONTROL_1 + i, + pdata->gpio_cfg[i] & 0x7fff); - val = (pdata->gpio_cfg[i] & WM8903_GP1_FN_MASK) - >> WM8903_GP1_FN_SHIFT; + val = (pdata->gpio_cfg[i] & WM8903_GP1_FN_MASK) + >> WM8903_GP1_FN_SHIFT; - switch (val) { - case WM8903_GPn_FN_MICBIAS_CURRENT_DETECT: - case WM8903_GPn_FN_MICBIAS_SHORT_DETECT: - mic_gpio = true; - break; - default: - break; - } + switch (val) { + case WM8903_GPn_FN_MICBIAS_CURRENT_DETECT: + case WM8903_GPn_FN_MICBIAS_SHORT_DETECT: + mic_gpio = true; + break; + default: + break; } + } - snd_soc_write(codec, WM8903_MIC_BIAS_CONTROL_0, - pdata->micdet_cfg); + /* Set up microphone detection */ + snd_soc_write(codec, WM8903_MIC_BIAS_CONTROL_0, + pdata->micdet_cfg); - /* Microphone detection needs the WSEQ clock */ - if (pdata->micdet_cfg) - snd_soc_update_bits(codec, WM8903_WRITE_SEQUENCER_0, - WM8903_WSEQ_ENA, WM8903_WSEQ_ENA); + /* Microphone detection needs the WSEQ clock */ + if (pdata->micdet_cfg) + snd_soc_update_bits(codec, WM8903_WRITE_SEQUENCER_0, + WM8903_WSEQ_ENA, WM8903_WSEQ_ENA); - /* If microphone detection is enabled by pdata but - * detected via IRQ then interrupts can be lost before - * the machine driver has set up microphone detection - * IRQs as the IRQs are clear on read. The detection - * will be enabled when the machine driver configures. - */ - WARN_ON(!mic_gpio && (pdata->micdet_cfg & WM8903_MICDET_ENA)); + /* If microphone detection is enabled by pdata but + * detected via IRQ then interrupts can be lost before + * the machine driver has set up microphone detection + * IRQs as the IRQs are clear on read. The detection + * will be enabled when the machine driver configures. + */ + WARN_ON(!mic_gpio && (pdata->micdet_cfg & WM8903_MICDET_ENA)); + + wm8903->mic_delay = pdata->micdet_delay; - wm8903->mic_delay = pdata->micdet_delay; - } - if (wm8903->irq) { - if (pdata && pdata->irq_active_low) { + if (pdata->irq_active_low) { trigger = IRQF_TRIGGER_LOW; irq_pol = WM8903_IRQ_POL; } else { -- cgit v1.1 From 9d35f3e100eb5cfb91d777c8621fb585ad0327cd Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Fri, 2 Dec 2011 15:08:40 -0700 Subject: ASoC: WM8903: Get default irq_active_low from IRQ controller If the WM8903 is hooked up to an interrupt, set the irq_active_low flag in the default platform data based on the IRQ's IRQ_TYPE. Map IRQ_TYPE_NONE (a lack of explicit configuration/restriction) to irq_active_low = false; the previous default. This code is mainly added to support device tree interrupt bindings, although will work perfectly well in a non device tree system too. Any interrupt controller that supports only a single IRQ_TYPE could set each IRQ's type based on that restriction. This applies equally with and without device tree. To cater for interrupt controllers that don't do this, for which irqd_get_trigger_type() will return IRQ_TYPE_NONE, the platform data irq_active_low field may be used in systems that don't use device tree. With device tree, every IRQ must have some IRQ_TYPE set. Controllers that support DT and multiple IRQ_TYPEs must define the interrupts property (as used in interrupt source nodes) such that it defines the IRQ_TYPE to use. When the core DT setup code initializes wm8903->irq, the interrupts property will be parsed, and as a side- effect, set the IRQ's IRQ_TYPE for the WM8903 probe() function to read. Controllers that support DT and a single IRQ_TYPE could arrange to set the IRQ_TYPE somehow during their initialization, or hard-code it during the processing of the child interrupts property. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/codecs/wm8903.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index b114468..b4f2c90 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -2036,6 +2037,39 @@ static const struct regmap_config wm8903_regmap = { .num_reg_defaults = ARRAY_SIZE(wm8903_reg_defaults), }; +static int wm8903_set_pdata_irq_trigger(struct i2c_client *i2c, + struct wm8903_platform_data *pdata) +{ + struct irq_data *irq_data = irq_get_irq_data(i2c->irq); + if (!irq_data) { + dev_err(&i2c->dev, "Invalid IRQ: %d\n", + i2c->irq); + return -EINVAL; + } + + switch (irqd_get_trigger_type(irq_data)) { + case IRQ_TYPE_NONE: + /* + * We assume the controller imposes no restrictions, + * so we are able to select active-high + */ + /* Fall-through */ + case IRQ_TYPE_LEVEL_HIGH: + pdata->irq_active_low = false; + break; + case IRQ_TYPE_LEVEL_LOW: + pdata->irq_active_low = true; + break; + default: + dev_err(&i2c->dev, + "Unsupported IRQ_TYPE %x\n", + irqd_get_trigger_type(irq_data)); + return -EINVAL; + } + + return 0; +} + static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { @@ -2071,6 +2105,12 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, dev_err(&i2c->dev, "Failed to allocate pdata\n"); return -ENOMEM; } + + if (i2c->irq) { + ret = wm8903_set_pdata_irq_trigger(i2c, wm8903->pdata); + if (ret != 0) + return ret; + } } ret = regmap_read(wm8903->regmap, WM8903_SW_RESET_AND_ID, &val); -- cgit v1.1 From 5d680b3a84b3e870fc1ea01495935e58e17de7aa Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Fri, 2 Dec 2011 15:08:41 -0700 Subject: ASoC: WM8903: Add device tree binding Document the device tree binding for the WM8903 codec, and modify the driver to extract platform data from the device tree, if present. Based on work by John Bonesio, but significantly reworked since then. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/codecs/wm8903.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index b4f2c90..adfbefa 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -2070,6 +2070,49 @@ static int wm8903_set_pdata_irq_trigger(struct i2c_client *i2c, return 0; } +static int wm8903_set_pdata_from_of(struct i2c_client *i2c, + struct wm8903_platform_data *pdata) +{ + const struct device_node *np = i2c->dev.of_node; + u32 val32; + int i; + + if (of_property_read_u32(np, "micdet-cfg", &val32) >= 0) + pdata->micdet_cfg = val32; + + if (of_property_read_u32(np, "micdet-delay", &val32) >= 0) + pdata->micdet_delay = val32; + + if (of_property_read_u32_array(np, "gpio-cfg", pdata->gpio_cfg, + ARRAY_SIZE(pdata->gpio_cfg)) >= 0) { + /* + * In device tree: 0 means "write 0", + * 0xffffffff means "don't touch". + * + * In platform data: 0 means "don't touch", + * 0x8000 means "write 0". + * + * Note: WM8903_GPIO_CONFIG_ZERO == 0x8000. + * + * Convert from DT to pdata representation here, + * so no other code needs to change. + */ + for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) { + if (pdata->gpio_cfg[i] == 0) { + pdata->gpio_cfg[i] = WM8903_GPIO_CONFIG_ZERO; + } else if (pdata->gpio_cfg[i] == 0xffffffff) { + pdata->gpio_cfg[i] = 0; + } else if (pdata->gpio_cfg[i] > 0x7fff) { + dev_err(&i2c->dev, "Invalid gpio-cfg[%d] %x\n", + i, pdata->gpio_cfg[i]); + return -EINVAL; + } + } + } + + return 0; +} + static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { @@ -2111,6 +2154,12 @@ static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, if (ret != 0) return ret; } + + if (i2c->dev.of_node) { + ret = wm8903_set_pdata_from_of(i2c, wm8903->pdata); + if (ret != 0) + return ret; + } } ret = regmap_read(wm8903->regmap, WM8903_SW_RESET_AND_ID, &val); -- cgit v1.1 From 6664ee115bb45d912d64d1c6b26bd3b96ef7df09 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 6 Dec 2011 10:30:24 +0000 Subject: ASoC: Don't fail if we can't read the IRQ type in WM8903 If we fail to read the IRQ type from the interrupt controller don't fail, just assume a value and solider on - we may fail later when we try to request the IRQ but it's possible we'll succeed. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8903.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index adfbefa..21b9fdc 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -2049,6 +2049,7 @@ static int wm8903_set_pdata_irq_trigger(struct i2c_client *i2c, switch (irqd_get_trigger_type(irq_data)) { case IRQ_TYPE_NONE: + default: /* * We assume the controller imposes no restrictions, * so we are able to select active-high @@ -2060,11 +2061,6 @@ static int wm8903_set_pdata_irq_trigger(struct i2c_client *i2c, case IRQ_TYPE_LEVEL_LOW: pdata->irq_active_low = true; break; - default: - dev_err(&i2c->dev, - "Unsupported IRQ_TYPE %x\n", - irqd_get_trigger_type(irq_data)); - return -EINVAL; } return 0; -- cgit v1.1 From 1d5d37f408e530ce1eab1deb66d2331535665ec7 Mon Sep 17 00:00:00 2001 From: Thomas Meyer Date: Tue, 29 Nov 2011 22:08:00 +0100 Subject: ALSA: ctxf: Use kcalloc instead of kzalloc to allocate array The advantage of kcalloc is, that will prevent integer overflows which could result from the multiplication of number of elements and size and it is also a bit nicer to read. The semantic patch that makes this change is available in https://lkml.org/lkml/2011/11/25/107 Signed-off-by: Thomas Meyer Signed-off-by: Takashi Iwai --- sound/pci/ctxfi/ctsrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/ctxfi/ctsrc.c b/sound/pci/ctxfi/ctsrc.c index e134b3a..6e77e86 100644 --- a/sound/pci/ctxfi/ctsrc.c +++ b/sound/pci/ctxfi/ctsrc.c @@ -437,7 +437,7 @@ get_src_rsc(struct src_mgr *mgr, const struct src_desc *desc, struct src **rsrc) /* Allocate mem for master src resource */ if (MEMRD == desc->mode) - src = kzalloc(sizeof(*src)*desc->multi, GFP_KERNEL); + src = kcalloc(desc->multi, sizeof(*src), GFP_KERNEL); else src = kzalloc(sizeof(*src), GFP_KERNEL); -- cgit v1.1 From 6d2d4313690f2f81a9a54c6a0c8ae645c4598063 Mon Sep 17 00:00:00 2001 From: Thomas Meyer Date: Tue, 29 Nov 2011 22:08:00 +0100 Subject: ALSA: asihp: Use kcalloc instead of kzalloc to allocate array The advantage of kcalloc is, that will prevent integer overflows which could result from the multiplication of number of elements and size and it is also a bit nicer to read. The semantic patch that makes this change is available in https://lkml.org/lkml/2011/11/25/107 Signed-off-by: Thomas Meyer Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpicmn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c index bd47521..44c7eb4 100644 --- a/sound/pci/asihpi/hpicmn.c +++ b/sound/pci/asihpi/hpicmn.c @@ -631,7 +631,7 @@ struct hpi_control_cache *hpi_alloc_control_cache(const u32 control_count, if (!p_cache) return NULL; - p_cache->p_info = kzalloc(sizeof(*p_cache->p_info) * control_count, + p_cache->p_info = kcalloc(control_count, sizeof(*p_cache->p_info), GFP_KERNEL); if (!p_cache->p_info) { kfree(p_cache); -- cgit v1.1 From f18b4e2ee9649c4aa50cc279826d3890f468a80e Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 6 Dec 2011 14:15:41 -0700 Subject: ASoC: WM8903: Add of_match_table This allows the device to be matched against the device tree using the compatible flag directly, as is standard, rather than falling back to matching .id_table against the non-vendor portion of the first compatible property value. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/codecs/wm8903.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 21b9fdc..d88b727 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -2201,6 +2201,12 @@ static __devexit int wm8903_i2c_remove(struct i2c_client *client) return 0; } +static const struct of_device_id wm8903_of_match[] = { + { .compatible = "wlf,wm8903", }, + {}, +}; +MODULE_DEVICE_TABLE(of, wm8903_of_match); + static const struct i2c_device_id wm8903_i2c_id[] = { { "wm8903", 0 }, { } @@ -2211,6 +2217,7 @@ static struct i2c_driver wm8903_i2c_driver = { .driver = { .name = "wm8903", .owner = THIS_MODULE, + .of_match_table = wm8903_of_match, }, .probe = wm8903_i2c_probe, .remove = __devexit_p(wm8903_i2c_remove), -- cgit v1.1 From b960ce74a70477d7d7d3c08669a8f0f52017b4fa Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 20:30:37 +0000 Subject: ASoC: Convert Samsung I2S driver to devm_kzalloc() Signed-off-by: Mark Brown Acked-by: Sangbeom Kim --- sound/soc/samsung/i2s.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 5de500c..ff5d919 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -945,7 +945,7 @@ struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) { struct i2s_dai *i2s; - i2s = kzalloc(sizeof(struct i2s_dai), GFP_KERNEL); + i2s = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dai), GFP_KERNEL); if (i2s == NULL) return NULL; @@ -972,10 +972,8 @@ struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec) i2s->pdev = platform_device_register_resndata(NULL, pdev->name, pdev->id + SAMSUNG_I2S_SECOFF, NULL, 0, NULL, 0); - if (IS_ERR(i2s->pdev)) { - kfree(i2s); + if (IS_ERR(i2s->pdev)) return NULL; - } } /* Pre-assign snd_soc_dai_set_drvdata */ @@ -1048,7 +1046,7 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev) if (!pri_dai) { dev_err(&pdev->dev, "Unable to alloc I2S_pri\n"); ret = -ENOMEM; - goto err1; + goto err; } pri_dai->dma_playback.dma_addr = regs_base + I2STXD; @@ -1073,7 +1071,7 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev) if (!sec_dai) { dev_err(&pdev->dev, "Unable to alloc I2S_sec\n"); ret = -ENOMEM; - goto err2; + goto err; } sec_dai->dma_playback.dma_addr = regs_base + I2STXDS; sec_dai->dma_playback.client = @@ -1092,17 +1090,13 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev) if (i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) { dev_err(&pdev->dev, "Unable to configure gpio\n"); ret = -EINVAL; - goto err3; + goto err; } snd_soc_register_dai(&pri_dai->pdev->dev, &pri_dai->i2s_dai_drv); return 0; -err3: - kfree(sec_dai); -err2: - kfree(pri_dai); -err1: +err: release_mem_region(regs_base, resource_size(res)); return ret; @@ -1128,8 +1122,6 @@ static __devexit int samsung_i2s_remove(struct platform_device *pdev) i2s->pri_dai = NULL; i2s->sec_dai = NULL; - kfree(i2s); - snd_soc_unregister_dai(&pdev->dev); return 0; -- cgit v1.1 From c1496b4ac3c6a1664592351b3530489cd8eff959 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 7 Dec 2011 18:04:10 +0800 Subject: ASoC: Fix a typo in s3c24xx_simtec_tlv320aic23 driver Fix a typo introduced by commit e00c3f55 "ASoC: Convert Samsung directory to module_platform_driver". This fixes the build error: CC sound/soc/samsung/s3c24xx_simtec_tlv320aic23.o sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c: In function 'simtec_audio_tlv320aic32_driver_init': sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c:105: error: 'simtec_audio_tlv320aic32_driver' undeclared (first use in this function) sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c:105: error: (Each undeclared identifier is reported only once sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c:105: error: for each function it appears in.) sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c: In function 'simtec_audio_tlv320aic32_driver_exit': sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c:105: error: 'simtec_audio_tlv320aic32_driver' undeclared (first use in this function) make[3]: *** [sound/soc/samsung/s3c24xx_simtec_tlv320aic23.o] Error 1 make[2]: *** [sound/soc/samsung] Error 2 make[1]: *** [sound/soc] Error 2 make: *** [sound] Error 2 I think we had better naming it with *driver, thus I change it to simtec_audio_tlv320aic23_driver. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c index 7324609..89b57b5 100644 --- a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c +++ b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c @@ -92,7 +92,7 @@ static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd) return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23); } -static struct platform_driver simtec_audio_tlv320aic23_platdrv = { +static struct platform_driver simtec_audio_tlv320aic23_driver = { .driver = { .owner = THIS_MODULE, .name = "s3c24xx-simtec-tlv320aic23", @@ -102,7 +102,7 @@ static struct platform_driver simtec_audio_tlv320aic23_platdrv = { .remove = __devexit_p(simtec_audio_remove), }; -module_platform_driver(simtec_audio_tlv320aic32_driver); +module_platform_driver(simtec_audio_tlv320aic23_driver); MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23"); MODULE_AUTHOR("Ben Dooks "); -- cgit v1.1 From 5ff7ada748fe2f74f525893577c4418bfdaf6d4f Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 7 Dec 2011 10:04:07 +0800 Subject: ASoC: Convert e750_wm9705 to use gpio_request_one() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/e750_wm9705.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c index ce5f0560..55c53d1 100644 --- a/sound/soc/pxa/e750_wm9705.c +++ b/sound/soc/pxa/e750_wm9705.c @@ -129,22 +129,16 @@ static int __init e750_init(void) if (!machine_is_e750()) return -ENODEV; - ret = gpio_request(GPIO_E750_HP_AMP_OFF, "Headphone amp"); + ret = gpio_request_one(GPIO_E750_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, + "Headphone amp"); if (ret) return ret; - ret = gpio_request(GPIO_E750_SPK_AMP_OFF, "Speaker amp"); + ret = gpio_request_one(GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH, + "Speaker amp"); if (ret) goto free_hp_amp_gpio; - ret = gpio_direction_output(GPIO_E750_HP_AMP_OFF, 1); - if (ret) - goto free_spk_amp_gpio; - - ret = gpio_direction_output(GPIO_E750_SPK_AMP_OFF, 1); - if (ret) - goto free_spk_amp_gpio; - e750_snd_device = platform_device_alloc("soc-audio", -1); if (!e750_snd_device) { ret = -ENOMEM; -- cgit v1.1 From 8faab941bec7af1c1865db316ac2f37c78071271 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 7 Dec 2011 10:01:30 +0800 Subject: ASoC: Fix error handling in e800_init to free gpios Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/e800_wm9712.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c index 6a8f38b..26e0232 100644 --- a/sound/soc/pxa/e800_wm9712.c +++ b/sound/soc/pxa/e800_wm9712.c @@ -136,8 +136,10 @@ static int __init e800_init(void) goto free_spk_amp_gpio; e800_snd_device = platform_device_alloc("soc-audio", -1); - if (!e800_snd_device) - return -ENOMEM; + if (!e800_snd_device) { + ret = -ENOMEM; + goto free_spk_amp_gpio; + } platform_set_drvdata(e800_snd_device, &e800); ret = platform_device_add(e800_snd_device); -- cgit v1.1 From 209e8cf668d3f421eb6d86eb62451396fb0a737d Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 7 Dec 2011 10:03:12 +0800 Subject: ASoC: Convert e800_wm9712 to use gpio_request_one() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/e800_wm9712.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c index 26e0232..478ff19 100644 --- a/sound/soc/pxa/e800_wm9712.c +++ b/sound/soc/pxa/e800_wm9712.c @@ -119,22 +119,16 @@ static int __init e800_init(void) if (!machine_is_e800()) return -ENODEV; - ret = gpio_request(GPIO_E800_HP_AMP_OFF, "Headphone amp"); + ret = gpio_request_one(GPIO_E800_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, + "Headphone amp"); if (ret) return ret; - ret = gpio_request(GPIO_E800_SPK_AMP_ON, "Speaker amp"); + ret = gpio_request_one(GPIO_E800_SPK_AMP_ON, GPIOF_OUT_INIT_HIGH, + "Speaker amp"); if (ret) goto free_hp_amp_gpio; - ret = gpio_direction_output(GPIO_E800_HP_AMP_OFF, 1); - if (ret) - goto free_spk_amp_gpio; - - ret = gpio_direction_output(GPIO_E800_SPK_AMP_ON, 1); - if (ret) - goto free_spk_amp_gpio; - e800_snd_device = platform_device_alloc("soc-audio", -1); if (!e800_snd_device) { ret = -ENOMEM; -- cgit v1.1 From d6652ef8229e9953543f41d8e081c23e653f0044 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 20:14:31 +0000 Subject: ASoC: Hold runtime PM references to components of active DAIs Every device that implements runtime power management for DAIs is doing it in pretty much the same way: in the startup callback they take a runtime PM reference and then in the shutdown callback they release that reference, keeping the device active while the DAI is active. Given the frequency with which this is done and the obviousness of the need to keep the device active in this period factor the code out into the core, taking references on the device for each CPU DAI, CODEC DAI and DMA device in the core. As runtime PM is reference counted this shouldn't interfere with any other reference holding by the drivers, and since (in common with the existing implementations) we don't check for errors on enabling it shouldn't matter if the device actually has runtime PM enabled or not. Signed-off-by: Mark Brown Tested-by: Peter Ujfalusi --- sound/soc/soc-pcm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sound') diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 49aa71e..8aa7cec 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -77,6 +78,10 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) struct snd_soc_dai_driver *codec_dai_drv = codec_dai->driver; int ret = 0; + pm_runtime_get_sync(cpu_dai->dev); + pm_runtime_get_sync(codec_dai->dev); + pm_runtime_get_sync(platform->dev); + mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); /* startup the audio subsystem */ @@ -233,6 +238,11 @@ platform_err: cpu_dai->driver->ops->shutdown(substream, cpu_dai); out: mutex_unlock(&rtd->pcm_mutex); + + pm_runtime_put(platform->dev); + pm_runtime_put(codec_dai->dev); + pm_runtime_put(cpu_dai->dev); + return ret; } @@ -339,6 +349,11 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) } mutex_unlock(&rtd->pcm_mutex); + + pm_runtime_put(platform->dev); + pm_runtime_put(codec_dai->dev); + pm_runtime_put(cpu_dai->dev); + return 0; } -- cgit v1.1 From 06d07b6b1cf46ad1bfd15ab1ba84c0d7ee6dab31 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 20:20:02 +0000 Subject: ASoC: Use core pm_runtime callbacks for omap-dmic Now that the core holds a pm_runtime reference to the device while the link is active there is no need for the driver to do so. Signed-off-by: Mark Brown Acked-by: Peter Ujfalusi --- sound/soc/omap/omap-dmic.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index 9c73c0c..0855c1c 100644 --- a/sound/soc/omap/omap-dmic.c +++ b/sound/soc/omap/omap-dmic.c @@ -114,7 +114,6 @@ static int omap_dmic_dai_startup(struct snd_pcm_substream *substream, mutex_lock(&dmic->mutex); if (!dai->active) { - pm_runtime_get_sync(dmic->dev); snd_pcm_hw_constraint_msbits(substream->runtime, 0, 32, 24); dmic->active = 1; } else { @@ -133,10 +132,8 @@ static void omap_dmic_dai_shutdown(struct snd_pcm_substream *substream, mutex_lock(&dmic->mutex); - if (!dai->active) { - pm_runtime_put_sync(dmic->dev); + if (!dai->active) dmic->active = 0; - } mutex_unlock(&dmic->mutex); } -- cgit v1.1 From beaff340e04fc3a752aa2cca70195dd506deccef Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 20:20:47 +0000 Subject: ASoC: Use core pm_runtime callbacks for omap-mcpdm Now that the core holds a pm_runtime reference to the device while the link is active there is no need for the driver to do so. Signed-off-by: Mark Brown Acked-by: Peter Ujfalusi --- sound/soc/omap/omap-mcpdm.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index b50ac60..0e25df4 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c @@ -266,8 +266,6 @@ static int omap_mcpdm_dai_startup(struct snd_pcm_substream *substream, mutex_lock(&mcpdm->mutex); if (!dai->active) { - pm_runtime_get_sync(mcpdm->dev); - /* Enable watch dog for ES above ES 1.0 to avoid saturation */ if (omap_rev() != OMAP4430_REV_ES1_0) { u32 ctrl = omap_mcpdm_read(mcpdm, MCPDM_REG_CTRL); @@ -295,9 +293,6 @@ static void omap_mcpdm_dai_shutdown(struct snd_pcm_substream *substream, omap_mcpdm_stop(mcpdm); omap_mcpdm_close_streams(mcpdm); } - - if (!omap_mcpdm_active(mcpdm)) - pm_runtime_put_sync(mcpdm->dev); } mutex_unlock(&mcpdm->mutex); -- cgit v1.1 From f1aac484f705007caf0d7c256a1a29506600cae3 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 5 Dec 2011 15:17:06 +0000 Subject: ASoC: Take a pm_runtime reference on DAPM devices that are enabled As for PCMs take a runtime power management reference to devices that are in a non-off bias, avoiding the need to do this in individual drivers. Signed-off-by: Mark Brown --- sound/soc/soc-dapm.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sound') diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 6bb327e..e174d08 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -1206,6 +1207,9 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie) /* If we're off and we're not supposed to be go into STANDBY */ if (d->bias_level == SND_SOC_BIAS_OFF && d->target_bias_level != SND_SOC_BIAS_OFF) { + if (d->dev) + pm_runtime_get_sync(d->dev); + ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_STANDBY); if (ret != 0) dev_err(d->dev, @@ -1245,6 +1249,9 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie) ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_OFF); if (ret != 0) dev_err(d->dev, "Failed to turn off bias: %d\n", ret); + + if (d->dev) + pm_runtime_put_sync(d->dev); } /* If we just powered up then move to active bias */ -- cgit v1.1 From 4105ab846ca795f03e63fb7bfacafc4217f48ca8 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 5 Dec 2011 15:17:36 +0000 Subject: ASoC: Rely on core enabling the wm8994 with runtime PM No need to do this in the driver now. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 02ca257..3eaf56a 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -2188,8 +2188,6 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, case SND_SOC_BIAS_STANDBY: if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { - pm_runtime_get_sync(codec->dev); - switch (control->type) { case WM8994: if (wm8994->revision < 4) { @@ -2256,11 +2254,8 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_OFF: - if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) { + if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) wm8994->cur_fw = NULL; - - pm_runtime_put(codec->dev); - } break; } codec->dapm.bias_level = level; -- cgit v1.1 From 16b24881a031a653cd76b83bfd96ef2d30b2491b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 8 Dec 2011 11:09:15 +0800 Subject: ASoC: wm8960: Use snd_soc_update_bits for read-modify-write Use snd_soc_update_bits for read-modify-write register access instead of open-coding it using snd_soc_read and snd_soc_write Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/wm8960.c | 67 +++++++++++++++-------------------------------- 1 file changed, 21 insertions(+), 46 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 6a9c41d..2315b86 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -543,30 +543,24 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream, static int wm8960_mute(struct snd_soc_dai *dai, int mute) { struct snd_soc_codec *codec = dai->codec; - u16 mute_reg = snd_soc_read(codec, WM8960_DACCTL1) & 0xfff7; if (mute) - snd_soc_write(codec, WM8960_DACCTL1, mute_reg | 0x8); + snd_soc_update_bits(codec, WM8960_DACCTL1, 0x8, 0x8); else - snd_soc_write(codec, WM8960_DACCTL1, mute_reg); + snd_soc_update_bits(codec, WM8960_DACCTL1, 0x8, 0); return 0; } static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { - u16 reg; - switch (level) { case SND_SOC_BIAS_ON: break; case SND_SOC_BIAS_PREPARE: /* Set VMID to 2x50k */ - reg = snd_soc_read(codec, WM8960_POWER1); - reg &= ~0x180; - reg |= 0x80; - snd_soc_write(codec, WM8960_POWER1, reg); + snd_soc_update_bits(codec, WM8960_POWER1, 0x180, 0x80); break; case SND_SOC_BIAS_STANDBY: @@ -579,23 +573,19 @@ static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec, WM8960_BUFDCOPEN | WM8960_BUFIOEN); /* Enable & ramp VMID at 2x50k */ - reg = snd_soc_read(codec, WM8960_POWER1); - reg |= 0x80; - snd_soc_write(codec, WM8960_POWER1, reg); + snd_soc_update_bits(codec, WM8960_POWER1, 0x80, 0x80); msleep(100); /* Enable VREF */ - snd_soc_write(codec, WM8960_POWER1, reg | WM8960_VREF); + snd_soc_update_bits(codec, WM8960_POWER1, WM8960_VREF, + WM8960_VREF); /* Disable anti-pop features */ snd_soc_write(codec, WM8960_APOP1, WM8960_BUFIOEN); } /* Set VMID to 2x250k */ - reg = snd_soc_read(codec, WM8960_POWER1); - reg &= ~0x180; - reg |= 0x100; - snd_soc_write(codec, WM8960_POWER1, reg); + snd_soc_update_bits(codec, WM8960_POWER1, 0x180, 0x100); break; case SND_SOC_BIAS_OFF: @@ -787,10 +777,8 @@ static int wm8960_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, /* Disable the PLL: even if we are changing the frequency the * PLL needs to be disabled while we do so. */ - snd_soc_write(codec, WM8960_CLOCK1, - snd_soc_read(codec, WM8960_CLOCK1) & ~1); - snd_soc_write(codec, WM8960_POWER2, - snd_soc_read(codec, WM8960_POWER2) & ~1); + snd_soc_update_bits(codec, WM8960_CLOCK1, 0x1, 0); + snd_soc_update_bits(codec, WM8960_POWER2, 0x1, 0); if (!freq_in || !freq_out) return 0; @@ -809,11 +797,9 @@ static int wm8960_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, snd_soc_write(codec, WM8960_PLL1, reg); /* Turn it on */ - snd_soc_write(codec, WM8960_POWER2, - snd_soc_read(codec, WM8960_POWER2) | 1); + snd_soc_update_bits(codec, WM8960_POWER2, 0x1, 0x1); msleep(250); - snd_soc_write(codec, WM8960_CLOCK1, - snd_soc_read(codec, WM8960_CLOCK1) | 1); + snd_soc_update_bits(codec, WM8960_CLOCK1, 0x1, 0x1); return 0; } @@ -913,7 +899,6 @@ static int wm8960_probe(struct snd_soc_codec *codec) struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); struct wm8960_data *pdata = dev_get_platdata(codec->dev); int ret; - u16 reg; wm8960->set_bias_level = wm8960_set_bias_level_out3; @@ -944,26 +929,16 @@ static int wm8960_probe(struct snd_soc_codec *codec) wm8960->set_bias_level(codec, SND_SOC_BIAS_STANDBY); /* Latch the update bits */ - reg = snd_soc_read(codec, WM8960_LINVOL); - snd_soc_write(codec, WM8960_LINVOL, reg | 0x100); - reg = snd_soc_read(codec, WM8960_RINVOL); - snd_soc_write(codec, WM8960_RINVOL, reg | 0x100); - reg = snd_soc_read(codec, WM8960_LADC); - snd_soc_write(codec, WM8960_LADC, reg | 0x100); - reg = snd_soc_read(codec, WM8960_RADC); - snd_soc_write(codec, WM8960_RADC, reg | 0x100); - reg = snd_soc_read(codec, WM8960_LDAC); - snd_soc_write(codec, WM8960_LDAC, reg | 0x100); - reg = snd_soc_read(codec, WM8960_RDAC); - snd_soc_write(codec, WM8960_RDAC, reg | 0x100); - reg = snd_soc_read(codec, WM8960_LOUT1); - snd_soc_write(codec, WM8960_LOUT1, reg | 0x100); - reg = snd_soc_read(codec, WM8960_ROUT1); - snd_soc_write(codec, WM8960_ROUT1, reg | 0x100); - reg = snd_soc_read(codec, WM8960_LOUT2); - snd_soc_write(codec, WM8960_LOUT2, reg | 0x100); - reg = snd_soc_read(codec, WM8960_ROUT2); - snd_soc_write(codec, WM8960_ROUT2, reg | 0x100); + snd_soc_update_bits(codec, WM8960_LINVOL, 0x100, 0x100); + snd_soc_update_bits(codec, WM8960_RINVOL, 0x100, 0x100); + snd_soc_update_bits(codec, WM8960_LADC, 0x100, 0x100); + snd_soc_update_bits(codec, WM8960_RADC, 0x100, 0x100); + snd_soc_update_bits(codec, WM8960_LDAC, 0x100, 0x100); + snd_soc_update_bits(codec, WM8960_RDAC, 0x100, 0x100); + snd_soc_update_bits(codec, WM8960_LOUT1, 0x100, 0x100); + snd_soc_update_bits(codec, WM8960_ROUT1, 0x100, 0x100); + snd_soc_update_bits(codec, WM8960_LOUT2, 0x100, 0x100); + snd_soc_update_bits(codec, WM8960_ROUT2, 0x100, 0x100); snd_soc_add_controls(codec, wm8960_snd_controls, ARRAY_SIZE(wm8960_snd_controls)); -- cgit v1.1 From 7b9b5e11704afb8f05aa6490c3b4bb2cc328647c Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Wed, 7 Dec 2011 13:58:29 -0700 Subject: ASoC: Tegra: Move DAS configuration into DAS driver Move DAS routing setup into the DAS driver itself. This removes the need to duplicate this in each machine driver, of which we'll soon have three. An added advantage is that the machine drivers no longer call the Tegra20- specific DAS functions by name, so the machine driver no longer needs to be split up into Tegra20 and Tegra30 versions. If individual machine drivers need a different routing setup to this default, they can still call the DAS functions to set that up. Long-term, DAS will be a codec driver, and user-space will be able to control its routing, possibly within constraints that the machine driver sets up. Configuring the DAS routing from the DAS driver is a very slight move in that direction. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/tegra_das.c | 13 +++++++++++++ sound/soc/tegra/tegra_wm8903.c | 13 ------------- sound/soc/tegra/trimslice.c | 23 ----------------------- 3 files changed, 13 insertions(+), 36 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_das.c b/sound/soc/tegra/tegra_das.c index 5b82b4e..3b3c1ba 100644 --- a/sound/soc/tegra/tegra_das.c +++ b/sound/soc/tegra/tegra_das.c @@ -202,6 +202,19 @@ static int __devinit tegra_das_probe(struct platform_device *pdev) goto err; } + ret = tegra_das_connect_dap_to_dac(TEGRA_DAS_DAP_ID_1, + TEGRA_DAS_DAP_SEL_DAC1); + if (ret) { + dev_err(&pdev->dev, "Can't set up DAS DAP connection\n"); + goto err; + } + ret = tegra_das_connect_dac_to_dap(TEGRA_DAS_DAC_ID_1, + TEGRA_DAS_DAC_SEL_DAP1); + if (ret) { + dev_err(&pdev->dev, "Can't set up DAS DAC connection\n"); + goto err; + } + tegra_das_debug_add(das); platform_set_drvdata(pdev, das); diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index 2f5b107..ba2d23e 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c @@ -249,19 +249,6 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) struct tegra_wm8903_platform_data *pdata = machine->pdata; int ret; - ret = tegra_das_connect_dap_to_dac(TEGRA_DAS_DAP_ID_1, - TEGRA_DAS_DAP_SEL_DAC1); - if (ret) { - dev_err(card->dev, "Can't set up DAS DAP connection\n"); - return ret; - } - ret = tegra_das_connect_dac_to_dap(TEGRA_DAS_DAC_ID_1, - TEGRA_DAS_DAC_SEL_DAP1); - if (ret) { - dev_err(card->dev, "Can't set up DAS DAC connection\n"); - return ret; - } - if (gpio_is_valid(pdata->gpio_spkr_en)) { ret = gpio_request(pdata->gpio_spkr_en, "spkr_en"); if (ret) { diff --git a/sound/soc/tegra/trimslice.c b/sound/soc/tegra/trimslice.c index 043eb7c..7d95b76 100644 --- a/sound/soc/tegra/trimslice.c +++ b/sound/soc/tegra/trimslice.c @@ -115,28 +115,6 @@ static const struct snd_soc_dapm_route trimslice_audio_map[] = { {"RLINEIN", NULL, "Line In"}, }; -static int trimslice_asoc_init(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_codec *codec = rtd->codec; - struct snd_soc_card *card = codec->card; - int ret; - - ret = tegra_das_connect_dap_to_dac(TEGRA_DAS_DAP_ID_1, - TEGRA_DAS_DAP_SEL_DAC1); - if (ret) { - dev_err(card->dev, "Can't set up DAS DAP connection\n"); - return ret; - } - ret = tegra_das_connect_dac_to_dap(TEGRA_DAS_DAC_ID_1, - TEGRA_DAS_DAC_SEL_DAP1); - if (ret) { - dev_err(card->dev, "Can't set up DAS DAC connection\n"); - return ret; - } - - return 0; -} - static struct snd_soc_dai_link trimslice_tlv320aic23_dai = { .name = "TLV320AIC23", .stream_name = "AIC23", @@ -144,7 +122,6 @@ static struct snd_soc_dai_link trimslice_tlv320aic23_dai = { .platform_name = "tegra-pcm-audio", .cpu_dai_name = "tegra-i2s.0", .codec_dai_name = "tlv320aic23-hifi", - .init = trimslice_asoc_init, .ops = &trimslice_asoc_ops, }; -- cgit v1.1 From 2610ab7767bba916f65094d71cfed3b8281cba08 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Wed, 7 Dec 2011 13:58:27 -0700 Subject: ASoC: Refactor some conditions and loop in soc_bind_dai_link() Transform some loops from: for_each(x) { if (f(x)) { work_on(x); } } to new structure: for_each(x) { if (!f(x)) continue; work_on(x); } This will allow future modification of f(x) with less impact to the code. Signed-off-by: Stephen Warren Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 52 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 22 deletions(-) (limited to 'sound') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 5195f06..ebb1048 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -763,10 +763,11 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) } /* no, then find CPU DAI from registered DAIs*/ list_for_each_entry(cpu_dai, &dai_list, list) { - if (!strcmp(cpu_dai->name, dai_link->cpu_dai_name)) { - rtd->cpu_dai = cpu_dai; - goto find_codec; - } + if (strcmp(cpu_dai->name, dai_link->cpu_dai_name)) + continue; + + rtd->cpu_dai = cpu_dai; + goto find_codec; } dev_dbg(card->dev, "CPU DAI %s not registered\n", dai_link->cpu_dai_name); @@ -779,22 +780,28 @@ find_codec: /* no, then find CODEC from registered CODECs*/ list_for_each_entry(codec, &codec_list, list) { - if (!strcmp(codec->name, dai_link->codec_name)) { - rtd->codec = codec; - - /* CODEC found, so find CODEC DAI from registered DAIs from this CODEC*/ - list_for_each_entry(codec_dai, &dai_list, list) { - if (codec->dev == codec_dai->dev && - !strcmp(codec_dai->name, dai_link->codec_dai_name)) { - rtd->codec_dai = codec_dai; - goto find_platform; - } - } - dev_dbg(card->dev, "CODEC DAI %s not registered\n", - dai_link->codec_dai_name); + if (strcmp(codec->name, dai_link->codec_name)) + continue; + + rtd->codec = codec; - goto find_platform; + /* + * CODEC found, so find CODEC DAI from registered DAIs from + * this CODEC + */ + list_for_each_entry(codec_dai, &dai_list, list) { + if (codec->dev == codec_dai->dev && + !strcmp(codec_dai->name, + dai_link->codec_dai_name)) { + + rtd->codec_dai = codec_dai; + goto find_platform; + } } + dev_dbg(card->dev, "CODEC DAI %s not registered\n", + dai_link->codec_dai_name); + + goto find_platform; } dev_dbg(card->dev, "CODEC %s not registered\n", dai_link->codec_name); @@ -811,10 +818,11 @@ find_platform: /* no, then find one from the set of registered platforms */ list_for_each_entry(platform, &platform_list, list) { - if (!strcmp(platform->name, platform_name)) { - rtd->platform = platform; - goto out; - } + if (strcmp(platform->name, platform_name)) + continue; + + rtd->platform = platform; + goto out; } dev_dbg(card->dev, "platform %s not registered\n", -- cgit v1.1 From bf97ca9a0dabd6110a6aa7b4d1b20274973810af Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 8 Dec 2011 16:45:22 +0800 Subject: ASoC: Convert WM8776 to devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm8776.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index fbf80c5..38b4556 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c @@ -452,7 +452,8 @@ static int __devinit wm8776_spi_probe(struct spi_device *spi) struct wm8776_priv *wm8776; int ret; - wm8776 = kzalloc(sizeof(struct wm8776_priv), GFP_KERNEL); + wm8776 = devm_kzalloc(&spi->dev, sizeof(struct wm8776_priv), + GFP_KERNEL); if (wm8776 == NULL) return -ENOMEM; @@ -461,15 +462,13 @@ static int __devinit wm8776_spi_probe(struct spi_device *spi) ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_wm8776, wm8776_dai, ARRAY_SIZE(wm8776_dai)); - if (ret < 0) - kfree(wm8776); + return ret; } static int __devexit wm8776_spi_remove(struct spi_device *spi) { snd_soc_unregister_codec(&spi->dev); - kfree(spi_get_drvdata(spi)); return 0; } @@ -491,7 +490,8 @@ static __devinit int wm8776_i2c_probe(struct i2c_client *i2c, struct wm8776_priv *wm8776; int ret; - wm8776 = kzalloc(sizeof(struct wm8776_priv), GFP_KERNEL); + wm8776 = devm_kzalloc(&i2c->dev, sizeof(struct wm8776_priv), + GFP_KERNEL); if (wm8776 == NULL) return -ENOMEM; @@ -500,15 +500,13 @@ static __devinit int wm8776_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8776, wm8776_dai, ARRAY_SIZE(wm8776_dai)); - if (ret < 0) - kfree(wm8776); + return ret; } static __devexit int wm8776_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From bc9c040d363f3be17a59024191e9400e5b6205ae Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 8 Dec 2011 16:46:59 +0800 Subject: ASoC: Make WM8770 SPI usage unconditional The device only supports SPI. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8770.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index 8976eb5..ea6f007 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c @@ -690,7 +690,6 @@ static const struct of_device_id wm8770_of_match[] = { }; MODULE_DEVICE_TABLE(of, wm8770_of_match); -#if defined(CONFIG_SPI_MASTER) static int __devinit wm8770_spi_probe(struct spi_device *spi) { struct wm8770_priv *wm8770; @@ -726,28 +725,23 @@ static struct spi_driver wm8770_spi_driver = { .probe = wm8770_spi_probe, .remove = __devexit_p(wm8770_spi_remove) }; -#endif static int __init wm8770_modinit(void) { int ret = 0; -#if defined(CONFIG_SPI_MASTER) ret = spi_register_driver(&wm8770_spi_driver); if (ret) { printk(KERN_ERR "Failed to register wm8770 SPI driver: %d\n", ret); } -#endif return ret; } module_init(wm8770_modinit); static void __exit wm8770_exit(void) { -#if defined(CONFIG_SPI_MASTER) spi_unregister_driver(&wm8770_spi_driver); -#endif } module_exit(wm8770_exit); -- cgit v1.1 From 5a374524216a244d30c42545ab49f743a43b05c7 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 8 Dec 2011 16:52:19 +0800 Subject: ASoC: Convert WM8804 to table based control init Signed-off-by: Mark Brown --- sound/soc/codecs/wm8804.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c index ae4b8fb..d54a3ca 100644 --- a/sound/soc/codecs/wm8804.c +++ b/sound/soc/codecs/wm8804.c @@ -659,8 +659,6 @@ static int wm8804_probe(struct snd_soc_codec *codec) wm8804_set_bias_level(codec, SND_SOC_BIAS_STANDBY); - snd_soc_add_controls(codec, wm8804_snd_controls, - ARRAY_SIZE(wm8804_snd_controls)); return 0; err_reg_enable: @@ -715,7 +713,10 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8804 = { .reg_cache_size = ARRAY_SIZE(wm8804_reg_defs), .reg_word_size = sizeof(u8), .reg_cache_default = wm8804_reg_defs, - .volatile_register = wm8804_volatile + .volatile_register = wm8804_volatile, + + .controls = wm8804_snd_controls, + .num_controls = ARRAY_SIZE(wm8804_snd_controls), }; static const struct of_device_id wm8804_of_match[] = { -- cgit v1.1 From 46ce904f7d4788ebc2ca7894fb56b9aa5b84af2d Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 8 Dec 2011 16:53:47 +0800 Subject: ASoC: Convert WM8900 to table based DAPM and control init Signed-off-by: Mark Brown --- sound/soc/codecs/wm8900.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index e427a38..f18c554 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c @@ -542,7 +542,7 @@ SND_SOC_DAPM_MIXER("Right Output Mixer", WM8900_REG_POWER3, 2, 0, }; /* Target, Path, Source */ -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route wm8900_dapm_routes[] = { /* Inputs */ {"Left Input PGA", "LINPUT1 Switch", "LINPUT1"}, {"Left Input PGA", "LINPUT2 Switch", "LINPUT2"}, @@ -606,17 +606,6 @@ static const struct snd_soc_dapm_route audio_map[] = { {"HP_R", NULL, "Headphone Amplifier"}, }; -static int wm8900_add_widgets(struct snd_soc_codec *codec) -{ - struct snd_soc_dapm_context *dapm = &codec->dapm; - - snd_soc_dapm_new_controls(dapm, wm8900_dapm_widgets, - ARRAY_SIZE(wm8900_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - - return 0; -} - static int wm8900_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) @@ -1203,10 +1192,6 @@ static int wm8900_probe(struct snd_soc_codec *codec) /* Set the DAC and mixer output bias */ snd_soc_write(codec, WM8900_REG_OUTBIASCTL, 0x81); - snd_soc_add_controls(codec, wm8900_snd_controls, - ARRAY_SIZE(wm8900_snd_controls)); - wm8900_add_widgets(codec); - return 0; } @@ -1227,6 +1212,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8900 = { .reg_cache_size = ARRAY_SIZE(wm8900_reg_defaults), .reg_word_size = sizeof(u16), .reg_cache_default = wm8900_reg_defaults, + + .controls = wm8900_snd_controls, + .num_controls = ARRAY_SIZE(wm8900_snd_controls), + .dapm_widgets = wm8900_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8900_dapm_widgets), + .dapm_routes = wm8900_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(wm8900_dapm_routes), }; #if defined(CONFIG_SPI_MASTER) -- cgit v1.1 From 7fcadfd17699b6b7973ce4f99eae47a11b4c44a7 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 9 Dec 2011 18:43:20 +0800 Subject: ASoC: Fix comments for disabling amplifier and PGA Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/wm8961.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index dc087c1..58fbf0a 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -422,11 +422,11 @@ static int wm8961_spk_event(struct snd_soc_dapm_widget *w, } if (event & SND_SOC_DAPM_PRE_PMD) { - /* Enable the amplifier */ + /* Disable the amplifier */ spk_reg &= ~(WM8961_SPKL_ENA | WM8961_SPKR_ENA); snd_soc_write(codec, WM8961_CLASS_D_CONTROL_1, spk_reg); - /* Enable the PGA */ + /* Disable the PGA */ pwr_reg &= ~(WM8961_SPKL_PGA | WM8961_SPKR_PGA); snd_soc_write(codec, WM8961_PWR_MGMT_2, pwr_reg); } -- cgit v1.1 From 3025ae45d6d905c8e973bba59d6f9a1be0da734d Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 8 Dec 2011 16:24:16 +0800 Subject: ASoC: Convert wm8770 to devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm8770.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index ea6f007..19374a9 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c @@ -695,7 +695,8 @@ static int __devinit wm8770_spi_probe(struct spi_device *spi) struct wm8770_priv *wm8770; int ret; - wm8770 = kzalloc(sizeof(struct wm8770_priv), GFP_KERNEL); + wm8770 = devm_kzalloc(&spi->dev, sizeof(struct wm8770_priv), + GFP_KERNEL); if (!wm8770) return -ENOMEM; @@ -704,15 +705,13 @@ static int __devinit wm8770_spi_probe(struct spi_device *spi) ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_wm8770, &wm8770_dai, 1); - if (ret < 0) - kfree(wm8770); + return ret; } static int __devexit wm8770_spi_remove(struct spi_device *spi) { snd_soc_unregister_codec(&spi->dev); - kfree(spi_get_drvdata(spi)); return 0; } -- cgit v1.1 From 7c08be84f83b23762fb7571ac9a4aea3c34d1a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= Date: Fri, 9 Dec 2011 14:16:29 +0100 Subject: ASoC: Fix an obvious copy paste error in an error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The message was obviously copied from soc_init_codec_debugfs() Signed-off-by: Lothar Waßmann Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index ebb1048..1252ab1 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -412,7 +412,7 @@ static void soc_init_card_debugfs(struct snd_soc_card *card) snd_soc_debugfs_root); if (!card->debugfs_card_root) { dev_warn(card->dev, - "ASoC: Failed to create codec debugfs directory\n"); + "ASoC: Failed to create card debugfs directory\n"); return; } -- cgit v1.1 From 3628137646e2ee25c9e46ba9d2c20b313e4a1a25 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 11 Dec 2011 11:31:22 +0800 Subject: ASoC: Raise Speyside audio system clock rate to 512fs To support advanced system functionality for additional components; the actively used clocks will remain the same for current components. Also factor the rate out to a single #define while we're at it. Signed-off-by: Mark Brown --- sound/soc/samsung/speyside.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c index 18e6356..0222d86 100644 --- a/sound/soc/samsung/speyside.c +++ b/sound/soc/samsung/speyside.c @@ -19,6 +19,7 @@ #include "../codecs/wm9081.h" #define WM8996_HPSEL_GPIO 214 +#define MCLK_AUDIO_RATE (512 * 48000) static int speyside_set_bias_level(struct snd_soc_card *card, struct snd_soc_dapm_context *dapm, @@ -67,7 +68,7 @@ static int speyside_set_bias_level_post(struct snd_soc_card *card, if (card->dapm.bias_level == SND_SOC_BIAS_STANDBY) { ret = snd_soc_dai_set_pll(codec_dai, 0, WM8996_FLL_MCLK2, - 32768, 48000 * 256); + 32768, MCLK_AUDIO_RATE); if (ret < 0) { pr_err("Failed to start FLL\n"); return ret; @@ -75,7 +76,7 @@ static int speyside_set_bias_level_post(struct snd_soc_card *card, ret = snd_soc_dai_set_sysclk(codec_dai, WM8996_SYSCLK_FLL, - 48000 * 256, + MCLK_AUDIO_RATE, SND_SOC_CLOCK_IN); if (ret < 0) return ret; @@ -224,7 +225,7 @@ static int speyside_wm9081_init(struct snd_soc_dapm_context *dapm) { /* At any time the WM9081 is active it will have this clock */ return snd_soc_codec_set_sysclk(dapm->codec, WM9081_SYSCLK_MCLK, 0, - 48000 * 256, 0); + MCLK_AUDIO_RATE, 0); } static struct snd_soc_aux_dev speyside_aux_dev[] = { -- cgit v1.1 From 0604ca48f1689ad06144b81f5c08f297b6edd831 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 12 Dec 2011 16:01:15 +0800 Subject: ASoC: Add missed MODULE_LICENSE("GPL") for imx-pcm-fiq This driver can be built as module and the file header indicates that the driver is published under the GPL. Thus add MODULE_LICENSE("GPL") for it. Signed-off-by: Axel Lin Acked-by: Sascha Hauer Signed-off-by: Mark Brown --- sound/soc/imx/imx-pcm-fiq.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/soc/imx/imx-pcm-fiq.c b/sound/soc/imx/imx-pcm-fiq.c index d7ea0b3..456b7d7 100644 --- a/sound/soc/imx/imx-pcm-fiq.c +++ b/sound/soc/imx/imx-pcm-fiq.c @@ -332,3 +332,5 @@ static struct platform_driver imx_pcm_driver = { }; module_platform_driver(imx_pcm_driver); + +MODULE_LICENSE("GPL"); -- cgit v1.1 From fde48a1f808e2bb6aaad5709d2470d814a157c86 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Fri, 9 Dec 2011 18:27:42 +0800 Subject: ALSA: HDA: Realtek: Take vmaster dac from multiout dac list With the auto-parser we can choose the dac nid for vmaster from the DACs we already know, instead of hard-coding it. This is more future-proof and was actually wrong on one machine. Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8a74c1e..690f2a2 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3039,6 +3039,8 @@ static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs, static int alc_auto_fill_multi_ios(struct hda_codec *codec, unsigned int location, int offset); +static hda_nid_t alc_look_for_out_vol_nid(struct hda_codec *codec, + hda_nid_t pin, hda_nid_t dac); /* fill in the dac_nids table from the parsed pin configuration */ static int alc_auto_fill_dac_nids(struct hda_codec *codec) @@ -3153,6 +3155,10 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) } } + if (cfg->line_out_pins[0]) + spec->vmaster_nid = + alc_look_for_out_vol_nid(codec, cfg->line_out_pins[0], + spec->multiout.dac_nids[0]); return 0; } @@ -4175,8 +4181,10 @@ static int patch_alc880(struct hda_codec *codec) #endif } - if (board_config != ALC_MODEL_AUTO) + if (board_config != ALC_MODEL_AUTO) { + spec->vmaster_nid = 0x0c; setup_preset(codec, &alc880_presets[board_config]); + } if (!spec->no_analog && !spec->adc_nids) { alc_auto_fill_adc_caps(codec); @@ -4196,8 +4204,6 @@ static int patch_alc880(struct hda_codec *codec) alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); - spec->vmaster_nid = 0x0c; - codec->patch_ops = alc_patch_ops; if (board_config == ALC_MODEL_AUTO) spec->init_hook = alc_auto_init_std; @@ -4304,8 +4310,10 @@ static int patch_alc260(struct hda_codec *codec) #endif } - if (board_config != ALC_MODEL_AUTO) + if (board_config != ALC_MODEL_AUTO) { setup_preset(codec, &alc260_presets[board_config]); + spec->vmaster_nid = 0x08; + } if (!spec->no_analog && !spec->adc_nids) { alc_auto_fill_adc_caps(codec); @@ -4325,8 +4333,6 @@ static int patch_alc260(struct hda_codec *codec) alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); - spec->vmaster_nid = 0x08; - codec->patch_ops = alc_patch_ops; if (board_config == ALC_MODEL_AUTO) spec->init_hook = alc_auto_init_std; @@ -4698,8 +4704,10 @@ static int patch_alc882(struct hda_codec *codec) goto error; } - if (board_config != ALC_MODEL_AUTO) + if (board_config != ALC_MODEL_AUTO) { setup_preset(codec, &alc882_presets[board_config]); + spec->vmaster_nid = 0x0c; + } if (!spec->no_analog && !spec->adc_nids) { alc_auto_fill_adc_caps(codec); @@ -4719,8 +4727,6 @@ static int patch_alc882(struct hda_codec *codec) alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); - spec->vmaster_nid = 0x0c; - codec->patch_ops = alc_patch_ops; if (board_config == ALC_MODEL_AUTO) spec->init_hook = alc_auto_init_std; @@ -4899,8 +4905,6 @@ static int patch_alc262(struct hda_codec *codec) alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); - spec->vmaster_nid = 0x0c; - codec->patch_ops = alc_patch_ops; spec->init_hook = alc_auto_init_std; spec->shutup = alc_eapd_shutup; @@ -5012,8 +5016,6 @@ static int patch_alc268(struct hda_codec *codec) if (!spec->no_analog && !spec->cap_mixer) set_capture_mixer(codec); - spec->vmaster_nid = 0x02; - codec->patch_ops = alc_patch_ops; spec->init_hook = alc_auto_init_std; spec->shutup = alc_eapd_shutup; @@ -5568,8 +5570,6 @@ static int patch_alc269(struct hda_codec *codec) alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); - spec->vmaster_nid = 0x02; - codec->patch_ops = alc_patch_ops; #ifdef CONFIG_PM codec->patch_ops.resume = alc269_resume; @@ -5674,8 +5674,6 @@ static int patch_alc861(struct hda_codec *codec) set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); } - spec->vmaster_nid = 0x03; - alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); codec->patch_ops = alc_patch_ops; @@ -5800,8 +5798,6 @@ static int patch_alc861vd(struct hda_codec *codec) set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); } - spec->vmaster_nid = 0x02; - alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); codec->patch_ops = alc_patch_ops; @@ -6184,7 +6180,6 @@ static int patch_alc662(struct hda_codec *codec) break; } } - spec->vmaster_nid = 0x02; alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); @@ -6240,8 +6235,6 @@ static int patch_alc680(struct hda_codec *codec) if (!spec->no_analog && !spec->cap_mixer) set_capture_mixer(codec); - spec->vmaster_nid = 0x02; - codec->patch_ops = alc_patch_ops; spec->init_hook = alc_auto_init_std; -- cgit v1.1 From 1bba160a0777046967707bbcdc9fb09d334ab2e5 Mon Sep 17 00:00:00 2001 From: Sergiusz Urbaniak Date: Mon, 5 Dec 2011 20:27:46 +0100 Subject: ALSA: snd-usb: added VOX ToneLab ST midi handling Signed-off-by: Sergiusz Urbaniak Signed-off-by: Takashi Iwai --- sound/usb/quirks-table.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sound') diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index 32d2a21..99b8c88 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -2336,6 +2336,16 @@ YAMAHA_DEVICE(0x7010, "UB99"), } }, +{ + USB_DEVICE_VENDOR_SPEC(0x0944, 0x0201), + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { + .vendor_name = "KORG, Inc.", + /* .product_name = "ToneLab ST", */ + .ifnum = 3, + .type = QUIRK_MIDI_STANDARD_INTERFACE, + } +}, + /* AKAI devices */ { USB_DEVICE(0x09e8, 0x0062), -- cgit v1.1 From 4de45284d3927b5068de6ed972b11627a3428427 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 25 Oct 2011 15:44:12 +0200 Subject: mfd: Define some additional wm8994 registers Add a bunch of definitions for wm8994 registers that are not currently used by software. Signed-off-by: Mark Brown Acked-by: Samuel Ortiz --- sound/soc/codecs/wm8994-tables.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994-tables.c b/sound/soc/codecs/wm8994-tables.c index df5a8b9..6ed19d9 100644 --- a/sound/soc/codecs/wm8994-tables.c +++ b/sound/soc/codecs/wm8994-tables.c @@ -78,7 +78,7 @@ const struct wm8994_access_mask wm8994_access_masks[WM8994_CACHE_SIZE] = { { 0x0000, 0x0000 }, /* R74 */ { 0x0000, 0x0000 }, /* R75 */ { 0x8000, 0x8000 }, /* R76 - Charge Pump (1) */ - { 0x0000, 0x0000 }, /* R77 */ + { 0x8000, 0x8000 }, /* R77 - Charge Pump (2) */ { 0x0000, 0x0000 }, /* R78 */ { 0x0000, 0x0000 }, /* R79 */ { 0x0000, 0x0000 }, /* R80 */ @@ -1651,7 +1651,7 @@ const u16 wm8994_reg_defaults[WM8994_CACHE_SIZE] = { 0x0000, /* R74 */ 0x0000, /* R75 */ 0x1F25, /* R76 - Charge Pump (1) */ - 0x0000, /* R77 */ + 0xAB19, /* R77 - Charge Pump (2) */ 0x0000, /* R78 */ 0x0000, /* R79 */ 0x0000, /* R80 */ @@ -2124,8 +2124,8 @@ const u16 wm8994_reg_defaults[WM8994_CACHE_SIZE] = { 0x0000, /* R547 - FLL1 Control (4) */ 0x0C80, /* R548 - FLL1 Control (5) */ 0x0000, /* R549 */ - 0x0000, /* R550 */ - 0x0000, /* R551 */ + 0x0000, /* R550 - FLL1 EFS 1 */ + 0x0006, /* R551 - FLL1 EFS 2 */ 0x0000, /* R552 */ 0x0000, /* R553 */ 0x0000, /* R554 */ @@ -2156,8 +2156,8 @@ const u16 wm8994_reg_defaults[WM8994_CACHE_SIZE] = { 0x0000, /* R579 - FLL2 Control (4) */ 0x0C80, /* R580 - FLL2 Control (5) */ 0x0000, /* R581 */ - 0x0000, /* R582 */ - 0x0000, /* R583 */ + 0x0000, /* R582 - FLL2 EFS 1 */ + 0x0006, /* R583 - FLL2 EFS 2 */ 0x0000, /* R584 */ 0x0000, /* R585 */ 0x0000, /* R586 */ -- cgit v1.1 From d9a7666ff3a9e109844bf5aca5f50e3743f65840 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 24 Jul 2011 12:49:52 +0100 Subject: ASoC: Remove ASoC-specific WM8994 I/O code Just go directly to the regmap API, saving code and making integration that bit more direct. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 63 +++++++++-------------------------------------- 1 file changed, 12 insertions(+), 51 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 3eaf56a..2858908 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -184,44 +184,6 @@ static int wm8994_volatile(struct snd_soc_codec *codec, unsigned int reg) } } -static int wm8994_write(struct snd_soc_codec *codec, unsigned int reg, - unsigned int value) -{ - int ret; - - BUG_ON(reg > WM8994_MAX_REGISTER); - - if (!wm8994_volatile(codec, reg)) { - ret = snd_soc_cache_write(codec, reg, value); - if (ret != 0) - dev_err(codec->dev, "Cache write to %x failed: %d\n", - reg, ret); - } - - return wm8994_reg_write(codec->control_data, reg, value); -} - -static unsigned int wm8994_read(struct snd_soc_codec *codec, - unsigned int reg) -{ - unsigned int val; - int ret; - - BUG_ON(reg > WM8994_MAX_REGISTER); - - if (!wm8994_volatile(codec, reg) && wm8994_readable(codec, reg) && - reg < codec->driver->reg_cache_size) { - ret = snd_soc_cache_read(codec, reg, &val); - if (ret >= 0) - return val; - else - dev_err(codec->dev, "Cache read from %x failed: %d\n", - reg, ret); - } - - return wm8994_reg_read(codec->control_data, reg); -} - static int configure_aif_clock(struct snd_soc_codec *codec, int aif) { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); @@ -2839,8 +2801,8 @@ static int wm8994_resume(struct snd_soc_codec *codec) if (wm8994->revision < 4) { /* force a HW read */ - val = wm8994_reg_read(codec->control_data, - WM8994_POWER_MANAGEMENT_5); + ret = regmap_read(control->regmap, + WM8994_POWER_MANAGEMENT_5, &val); /* modify the cache only */ codec->cache_only = 1; @@ -3455,13 +3417,13 @@ static irqreturn_t wm8994_temp_shut(int irq, void *data) static int wm8994_codec_probe(struct snd_soc_codec *codec) { - struct wm8994 *control; + struct wm8994 *control = dev_get_drvdata(codec->dev->parent); struct wm8994_priv *wm8994; struct snd_soc_dapm_context *dapm = &codec->dapm; + unsigned int reg; int ret, i; - codec->control_data = dev_get_drvdata(codec->dev->parent); - control = codec->control_data; + codec->control_data = control->regmap; wm8994 = devm_kzalloc(codec->dev, sizeof(struct wm8994_priv), GFP_KERNEL); @@ -3469,6 +3431,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) return -ENOMEM; snd_soc_codec_set_drvdata(codec, wm8994); + snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); wm8994->wm8994 = dev_get_drvdata(codec->dev->parent); wm8994->pdata = dev_get_platdata(codec->dev->parent); @@ -3494,11 +3457,11 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) if (!wm8994_readable(codec, i) || wm8994_volatile(codec, i)) continue; - ret = wm8994_reg_read(codec->control_data, i); + ret = regmap_read(control->regmap, i, ®); if (ret <= 0) continue; - ret = snd_soc_cache_write(codec, i, ret); + ret = snd_soc_cache_write(codec, i, reg); if (ret != 0) { dev_err(codec->dev, "Failed to initialise cache for 0x%x: %d\n", @@ -3653,24 +3616,24 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) * configured on init - if a system wants to do this dynamically * at runtime we can deal with that then. */ - ret = wm8994_reg_read(codec->control_data, WM8994_GPIO_1); + ret = regmap_read(control->regmap, WM8994_GPIO_1, ®); if (ret < 0) { dev_err(codec->dev, "Failed to read GPIO1 state: %d\n", ret); goto err_irq; } - if ((ret & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) { + if ((reg & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) { wm8994->lrclk_shared[0] = 1; wm8994_dai[0].symmetric_rates = 1; } else { wm8994->lrclk_shared[0] = 0; } - ret = wm8994_reg_read(codec->control_data, WM8994_GPIO_6); + ret = regmap_read(control->regmap, WM8994_GPIO_6, ®); if (ret < 0) { dev_err(codec->dev, "Failed to read GPIO6 state: %d\n", ret); goto err_irq; } - if ((ret & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) { + if ((reg & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) { wm8994->lrclk_shared[1] = 1; wm8994_dai[1].symmetric_rates = 1; } else { @@ -3937,8 +3900,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { .remove = wm8994_codec_remove, .suspend = wm8994_suspend, .resume = wm8994_resume, - .read = wm8994_read, - .write = wm8994_write, .readable_register = wm8994_readable, .volatile_register = wm8994_volatile, .set_bias_level = wm8994_set_bias_level, -- cgit v1.1 From cae59c7b2185856522822e40260174c088ca5b11 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 25 Oct 2011 16:13:12 +0200 Subject: ASoC: Remove WM8994 register cache Now that the mfd is using the register map cache there's no need for the CODEC driver to do any register cache management or any funny dances to interact with the other drivers using the device so just remove the cache initialisation and volatility information. Signed-off-by: Mark Brown --- sound/soc/codecs/Makefile | 2 +- sound/soc/codecs/wm8994-tables.c | 3147 -------------------------------------- sound/soc/codecs/wm8994.c | 87 -- sound/soc/codecs/wm8994.h | 10 - 4 files changed, 1 insertion(+), 3245 deletions(-) delete mode 100644 sound/soc/codecs/wm8994-tables.c (limited to 'sound') diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 9aa6e66..de80781 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -87,7 +87,7 @@ snd-soc-wm8988-objs := wm8988.o snd-soc-wm8990-objs := wm8990.o snd-soc-wm8991-objs := wm8991.o snd-soc-wm8993-objs := wm8993.o -snd-soc-wm8994-objs := wm8994.o wm8994-tables.o wm8958-dsp2.o +snd-soc-wm8994-objs := wm8994.o wm8958-dsp2.o snd-soc-wm8995-objs := wm8995.o snd-soc-wm9081-objs := wm9081.o snd-soc-wm9090-objs := wm9090.o diff --git a/sound/soc/codecs/wm8994-tables.c b/sound/soc/codecs/wm8994-tables.c deleted file mode 100644 index 6ed19d9..0000000 --- a/sound/soc/codecs/wm8994-tables.c +++ /dev/null @@ -1,3147 +0,0 @@ -#include "wm8994.h" - -const struct wm8994_access_mask wm8994_access_masks[WM8994_CACHE_SIZE] = { - { 0xFFFF, 0xFFFF }, /* R0 - Software Reset */ - { 0x3B37, 0x3B37 }, /* R1 - Power Management (1) */ - { 0x6BF0, 0x6BF0 }, /* R2 - Power Management (2) */ - { 0x3FF0, 0x3FF0 }, /* R3 - Power Management (3) */ - { 0x3F3F, 0x3F3F }, /* R4 - Power Management (4) */ - { 0x3F0F, 0x3F0F }, /* R5 - Power Management (5) */ - { 0x003F, 0x003F }, /* R6 - Power Management (6) */ - { 0x0000, 0x0000 }, /* R7 */ - { 0x0000, 0x0000 }, /* R8 */ - { 0x0000, 0x0000 }, /* R9 */ - { 0x0000, 0x0000 }, /* R10 */ - { 0x0000, 0x0000 }, /* R11 */ - { 0x0000, 0x0000 }, /* R12 */ - { 0x0000, 0x0000 }, /* R13 */ - { 0x0000, 0x0000 }, /* R14 */ - { 0x0000, 0x0000 }, /* R15 */ - { 0x0000, 0x0000 }, /* R16 */ - { 0x0000, 0x0000 }, /* R17 */ - { 0x0000, 0x0000 }, /* R18 */ - { 0x0000, 0x0000 }, /* R19 */ - { 0x0000, 0x0000 }, /* R20 */ - { 0x01C0, 0x01C0 }, /* R21 - Input Mixer (1) */ - { 0x0000, 0x0000 }, /* R22 */ - { 0x0000, 0x0000 }, /* R23 */ - { 0x00DF, 0x01DF }, /* R24 - Left Line Input 1&2 Volume */ - { 0x00DF, 0x01DF }, /* R25 - Left Line Input 3&4 Volume */ - { 0x00DF, 0x01DF }, /* R26 - Right Line Input 1&2 Volume */ - { 0x00DF, 0x01DF }, /* R27 - Right Line Input 3&4 Volume */ - { 0x00FF, 0x01FF }, /* R28 - Left Output Volume */ - { 0x00FF, 0x01FF }, /* R29 - Right Output Volume */ - { 0x0077, 0x0077 }, /* R30 - Line Outputs Volume */ - { 0x0030, 0x0030 }, /* R31 - HPOUT2 Volume */ - { 0x00FF, 0x01FF }, /* R32 - Left OPGA Volume */ - { 0x00FF, 0x01FF }, /* R33 - Right OPGA Volume */ - { 0x007F, 0x007F }, /* R34 - SPKMIXL Attenuation */ - { 0x017F, 0x017F }, /* R35 - SPKMIXR Attenuation */ - { 0x003F, 0x003F }, /* R36 - SPKOUT Mixers */ - { 0x003F, 0x003F }, /* R37 - ClassD */ - { 0x00FF, 0x01FF }, /* R38 - Speaker Volume Left */ - { 0x00FF, 0x01FF }, /* R39 - Speaker Volume Right */ - { 0x00FF, 0x00FF }, /* R40 - Input Mixer (2) */ - { 0x01B7, 0x01B7 }, /* R41 - Input Mixer (3) */ - { 0x01B7, 0x01B7 }, /* R42 - Input Mixer (4) */ - { 0x01C7, 0x01C7 }, /* R43 - Input Mixer (5) */ - { 0x01C7, 0x01C7 }, /* R44 - Input Mixer (6) */ - { 0x01FF, 0x01FF }, /* R45 - Output Mixer (1) */ - { 0x01FF, 0x01FF }, /* R46 - Output Mixer (2) */ - { 0x0FFF, 0x0FFF }, /* R47 - Output Mixer (3) */ - { 0x0FFF, 0x0FFF }, /* R48 - Output Mixer (4) */ - { 0x0FFF, 0x0FFF }, /* R49 - Output Mixer (5) */ - { 0x0FFF, 0x0FFF }, /* R50 - Output Mixer (6) */ - { 0x0038, 0x0038 }, /* R51 - HPOUT2 Mixer */ - { 0x0077, 0x0077 }, /* R52 - Line Mixer (1) */ - { 0x0077, 0x0077 }, /* R53 - Line Mixer (2) */ - { 0x03FF, 0x03FF }, /* R54 - Speaker Mixer */ - { 0x00C1, 0x00C1 }, /* R55 - Additional Control */ - { 0x00F0, 0x00F0 }, /* R56 - AntiPOP (1) */ - { 0x01EF, 0x01EF }, /* R57 - AntiPOP (2) */ - { 0x00FF, 0x00FF }, /* R58 - MICBIAS */ - { 0x000F, 0x000F }, /* R59 - LDO 1 */ - { 0x0007, 0x0007 }, /* R60 - LDO 2 */ - { 0xFFFF, 0xFFFF }, /* R61 */ - { 0xFFFF, 0xFFFF }, /* R62 */ - { 0x0000, 0x0000 }, /* R63 */ - { 0x0000, 0x0000 }, /* R64 */ - { 0x0000, 0x0000 }, /* R65 */ - { 0x0000, 0x0000 }, /* R66 */ - { 0x0000, 0x0000 }, /* R67 */ - { 0x0000, 0x0000 }, /* R68 */ - { 0x0000, 0x0000 }, /* R69 */ - { 0x0000, 0x0000 }, /* R70 */ - { 0x0000, 0x0000 }, /* R71 */ - { 0x0000, 0x0000 }, /* R72 */ - { 0x0000, 0x0000 }, /* R73 */ - { 0x0000, 0x0000 }, /* R74 */ - { 0x0000, 0x0000 }, /* R75 */ - { 0x8000, 0x8000 }, /* R76 - Charge Pump (1) */ - { 0x8000, 0x8000 }, /* R77 - Charge Pump (2) */ - { 0x0000, 0x0000 }, /* R78 */ - { 0x0000, 0x0000 }, /* R79 */ - { 0x0000, 0x0000 }, /* R80 */ - { 0x0301, 0x0301 }, /* R81 - Class W (1) */ - { 0x0000, 0x0000 }, /* R82 */ - { 0x0000, 0x0000 }, /* R83 */ - { 0x333F, 0x333F }, /* R84 - DC Servo (1) */ - { 0x0FEF, 0x0FEF }, /* R85 - DC Servo (2) */ - { 0x0000, 0x0000 }, /* R86 */ - { 0xFFFF, 0xFFFF }, /* R87 - DC Servo (4) */ - { 0x0333, 0x0000 }, /* R88 - DC Servo Readback */ - { 0x0000, 0x0000 }, /* R89 */ - { 0x0000, 0x0000 }, /* R90 */ - { 0x0000, 0x0000 }, /* R91 */ - { 0x0000, 0x0000 }, /* R92 */ - { 0x0000, 0x0000 }, /* R93 */ - { 0x0000, 0x0000 }, /* R94 */ - { 0x0000, 0x0000 }, /* R95 */ - { 0x00EE, 0x00EE }, /* R96 - Analogue HP (1) */ - { 0x0000, 0x0000 }, /* R97 */ - { 0x0000, 0x0000 }, /* R98 */ - { 0x0000, 0x0000 }, /* R99 */ - { 0x0000, 0x0000 }, /* R100 */ - { 0x0000, 0x0000 }, /* R101 */ - { 0x0000, 0x0000 }, /* R102 */ - { 0x0000, 0x0000 }, /* R103 */ - { 0x0000, 0x0000 }, /* R104 */ - { 0x0000, 0x0000 }, /* R105 */ - { 0x0000, 0x0000 }, /* R106 */ - { 0x0000, 0x0000 }, /* R107 */ - { 0x0000, 0x0000 }, /* R108 */ - { 0x0000, 0x0000 }, /* R109 */ - { 0x0000, 0x0000 }, /* R110 */ - { 0x0000, 0x0000 }, /* R111 */ - { 0x0000, 0x0000 }, /* R112 */ - { 0x0000, 0x0000 }, /* R113 */ - { 0x0000, 0x0000 }, /* R114 */ - { 0x0000, 0x0000 }, /* R115 */ - { 0x0000, 0x0000 }, /* R116 */ - { 0x0000, 0x0000 }, /* R117 */ - { 0x0000, 0x0000 }, /* R118 */ - { 0x0000, 0x0000 }, /* R119 */ - { 0x0000, 0x0000 }, /* R120 */ - { 0x0000, 0x0000 }, /* R121 */ - { 0x0000, 0x0000 }, /* R122 */ - { 0x0000, 0x0000 }, /* R123 */ - { 0x0000, 0x0000 }, /* R124 */ - { 0x0000, 0x0000 }, /* R125 */ - { 0x0000, 0x0000 }, /* R126 */ - { 0x0000, 0x0000 }, /* R127 */ - { 0x0000, 0x0000 }, /* R128 */ - { 0x0000, 0x0000 }, /* R129 */ - { 0x0000, 0x0000 }, /* R130 */ - { 0x0000, 0x0000 }, /* R131 */ - { 0x0000, 0x0000 }, /* R132 */ - { 0x0000, 0x0000 }, /* R133 */ - { 0x0000, 0x0000 }, /* R134 */ - { 0x0000, 0x0000 }, /* R135 */ - { 0x0000, 0x0000 }, /* R136 */ - { 0x0000, 0x0000 }, /* R137 */ - { 0x0000, 0x0000 }, /* R138 */ - { 0x0000, 0x0000 }, /* R139 */ - { 0x0000, 0x0000 }, /* R140 */ - { 0x0000, 0x0000 }, /* R141 */ - { 0x0000, 0x0000 }, /* R142 */ - { 0x0000, 0x0000 }, /* R143 */ - { 0x0000, 0x0000 }, /* R144 */ - { 0x0000, 0x0000 }, /* R145 */ - { 0x0000, 0x0000 }, /* R146 */ - { 0x0000, 0x0000 }, /* R147 */ - { 0x0000, 0x0000 }, /* R148 */ - { 0x0000, 0x0000 }, /* R149 */ - { 0x0000, 0x0000 }, /* R150 */ - { 0x0000, 0x0000 }, /* R151 */ - { 0x0000, 0x0000 }, /* R152 */ - { 0x0000, 0x0000 }, /* R153 */ - { 0x0000, 0x0000 }, /* R154 */ - { 0x0000, 0x0000 }, /* R155 */ - { 0x0000, 0x0000 }, /* R156 */ - { 0x0000, 0x0000 }, /* R157 */ - { 0x0000, 0x0000 }, /* R158 */ - { 0x0000, 0x0000 }, /* R159 */ - { 0x0000, 0x0000 }, /* R160 */ - { 0x0000, 0x0000 }, /* R161 */ - { 0x0000, 0x0000 }, /* R162 */ - { 0x0000, 0x0000 }, /* R163 */ - { 0x0000, 0x0000 }, /* R164 */ - { 0x0000, 0x0000 }, /* R165 */ - { 0x0000, 0x0000 }, /* R166 */ - { 0x0000, 0x0000 }, /* R167 */ - { 0x0000, 0x0000 }, /* R168 */ - { 0x0000, 0x0000 }, /* R169 */ - { 0x0000, 0x0000 }, /* R170 */ - { 0x0000, 0x0000 }, /* R171 */ - { 0x0000, 0x0000 }, /* R172 */ - { 0x0000, 0x0000 }, /* R173 */ - { 0x0000, 0x0000 }, /* R174 */ - { 0x0000, 0x0000 }, /* R175 */ - { 0x0000, 0x0000 }, /* R176 */ - { 0x0000, 0x0000 }, /* R177 */ - { 0x0000, 0x0000 }, /* R178 */ - { 0x0000, 0x0000 }, /* R179 */ - { 0x0000, 0x0000 }, /* R180 */ - { 0x0000, 0x0000 }, /* R181 */ - { 0x0000, 0x0000 }, /* R182 */ - { 0x0000, 0x0000 }, /* R183 */ - { 0x0000, 0x0000 }, /* R184 */ - { 0x0000, 0x0000 }, /* R185 */ - { 0x0000, 0x0000 }, /* R186 */ - { 0x0000, 0x0000 }, /* R187 */ - { 0x0000, 0x0000 }, /* R188 */ - { 0x0000, 0x0000 }, /* R189 */ - { 0x0000, 0x0000 }, /* R190 */ - { 0x0000, 0x0000 }, /* R191 */ - { 0x0000, 0x0000 }, /* R192 */ - { 0x0000, 0x0000 }, /* R193 */ - { 0x0000, 0x0000 }, /* R194 */ - { 0x0000, 0x0000 }, /* R195 */ - { 0x0000, 0x0000 }, /* R196 */ - { 0x0000, 0x0000 }, /* R197 */ - { 0x0000, 0x0000 }, /* R198 */ - { 0x0000, 0x0000 }, /* R199 */ - { 0x0000, 0x0000 }, /* R200 */ - { 0x0000, 0x0000 }, /* R201 */ - { 0x0000, 0x0000 }, /* R202 */ - { 0x0000, 0x0000 }, /* R203 */ - { 0x0000, 0x0000 }, /* R204 */ - { 0x0000, 0x0000 }, /* R205 */ - { 0x0000, 0x0000 }, /* R206 */ - { 0x0000, 0x0000 }, /* R207 */ - { 0xFFFF, 0xFFFF }, /* R208 */ - { 0xFFFF, 0xFFFF }, /* R209 */ - { 0xFFFF, 0xFFFF }, /* R210 */ - { 0x0000, 0x0000 }, /* R211 */ - { 0x0000, 0x0000 }, /* R212 */ - { 0x0000, 0x0000 }, /* R213 */ - { 0x0000, 0x0000 }, /* R214 */ - { 0x0000, 0x0000 }, /* R215 */ - { 0x0000, 0x0000 }, /* R216 */ - { 0x0000, 0x0000 }, /* R217 */ - { 0x0000, 0x0000 }, /* R218 */ - { 0x0000, 0x0000 }, /* R219 */ - { 0x0000, 0x0000 }, /* R220 */ - { 0x0000, 0x0000 }, /* R221 */ - { 0x0000, 0x0000 }, /* R222 */ - { 0x0000, 0x0000 }, /* R223 */ - { 0x0000, 0x0000 }, /* R224 */ - { 0x0000, 0x0000 }, /* R225 */ - { 0x0000, 0x0000 }, /* R226 */ - { 0x0000, 0x0000 }, /* R227 */ - { 0x0000, 0x0000 }, /* R228 */ - { 0x0000, 0x0000 }, /* R229 */ - { 0x0000, 0x0000 }, /* R230 */ - { 0x0000, 0x0000 }, /* R231 */ - { 0x0000, 0x0000 }, /* R232 */ - { 0x0000, 0x0000 }, /* R233 */ - { 0x0000, 0x0000 }, /* R234 */ - { 0x0000, 0x0000 }, /* R235 */ - { 0x0000, 0x0000 }, /* R236 */ - { 0x0000, 0x0000 }, /* R237 */ - { 0x0000, 0x0000 }, /* R238 */ - { 0x0000, 0x0000 }, /* R239 */ - { 0x0000, 0x0000 }, /* R240 */ - { 0x0000, 0x0000 }, /* R241 */ - { 0x0000, 0x0000 }, /* R242 */ - { 0x0000, 0x0000 }, /* R243 */ - { 0x0000, 0x0000 }, /* R244 */ - { 0x0000, 0x0000 }, /* R245 */ - { 0x0000, 0x0000 }, /* R246 */ - { 0x0000, 0x0000 }, /* R247 */ - { 0x0000, 0x0000 }, /* R248 */ - { 0x0000, 0x0000 }, /* R249 */ - { 0x0000, 0x0000 }, /* R250 */ - { 0x0000, 0x0000 }, /* R251 */ - { 0x0000, 0x0000 }, /* R252 */ - { 0x0000, 0x0000 }, /* R253 */ - { 0x0000, 0x0000 }, /* R254 */ - { 0x0000, 0x0000 }, /* R255 */ - { 0x000F, 0x0000 }, /* R256 - Chip Revision */ - { 0x0074, 0x0074 }, /* R257 - Control Interface */ - { 0x0000, 0x0000 }, /* R258 */ - { 0x0000, 0x0000 }, /* R259 */ - { 0x0000, 0x0000 }, /* R260 */ - { 0x0000, 0x0000 }, /* R261 */ - { 0x0000, 0x0000 }, /* R262 */ - { 0x0000, 0x0000 }, /* R263 */ - { 0x0000, 0x0000 }, /* R264 */ - { 0x0000, 0x0000 }, /* R265 */ - { 0x0000, 0x0000 }, /* R266 */ - { 0x0000, 0x0000 }, /* R267 */ - { 0x0000, 0x0000 }, /* R268 */ - { 0x0000, 0x0000 }, /* R269 */ - { 0x0000, 0x0000 }, /* R270 */ - { 0x0000, 0x0000 }, /* R271 */ - { 0x807F, 0x837F }, /* R272 - Write Sequencer Ctrl (1) */ - { 0x017F, 0x0000 }, /* R273 - Write Sequencer Ctrl (2) */ - { 0x0000, 0x0000 }, /* R274 */ - { 0x0000, 0x0000 }, /* R275 */ - { 0x0000, 0x0000 }, /* R276 */ - { 0x0000, 0x0000 }, /* R277 */ - { 0x0000, 0x0000 }, /* R278 */ - { 0x0000, 0x0000 }, /* R279 */ - { 0x0000, 0x0000 }, /* R280 */ - { 0x0000, 0x0000 }, /* R281 */ - { 0x0000, 0x0000 }, /* R282 */ - { 0x0000, 0x0000 }, /* R283 */ - { 0x0000, 0x0000 }, /* R284 */ - { 0x0000, 0x0000 }, /* R285 */ - { 0x0000, 0x0000 }, /* R286 */ - { 0x0000, 0x0000 }, /* R287 */ - { 0x0000, 0x0000 }, /* R288 */ - { 0x0000, 0x0000 }, /* R289 */ - { 0x0000, 0x0000 }, /* R290 */ - { 0x0000, 0x0000 }, /* R291 */ - { 0x0000, 0x0000 }, /* R292 */ - { 0x0000, 0x0000 }, /* R293 */ - { 0x0000, 0x0000 }, /* R294 */ - { 0x0000, 0x0000 }, /* R295 */ - { 0x0000, 0x0000 }, /* R296 */ - { 0x0000, 0x0000 }, /* R297 */ - { 0x0000, 0x0000 }, /* R298 */ - { 0x0000, 0x0000 }, /* R299 */ - { 0x0000, 0x0000 }, /* R300 */ - { 0x0000, 0x0000 }, /* R301 */ - { 0x0000, 0x0000 }, /* R302 */ - { 0x0000, 0x0000 }, /* R303 */ - { 0x0000, 0x0000 }, /* R304 */ - { 0x0000, 0x0000 }, /* R305 */ - { 0x0000, 0x0000 }, /* R306 */ - { 0x0000, 0x0000 }, /* R307 */ - { 0x0000, 0x0000 }, /* R308 */ - { 0x0000, 0x0000 }, /* R309 */ - { 0x0000, 0x0000 }, /* R310 */ - { 0x0000, 0x0000 }, /* R311 */ - { 0x0000, 0x0000 }, /* R312 */ - { 0x0000, 0x0000 }, /* R313 */ - { 0x0000, 0x0000 }, /* R314 */ - { 0x0000, 0x0000 }, /* R315 */ - { 0x0000, 0x0000 }, /* R316 */ - { 0x0000, 0x0000 }, /* R317 */ - { 0x0000, 0x0000 }, /* R318 */ - { 0x0000, 0x0000 }, /* R319 */ - { 0x0000, 0x0000 }, /* R320 */ - { 0x0000, 0x0000 }, /* R321 */ - { 0x0000, 0x0000 }, /* R322 */ - { 0x0000, 0x0000 }, /* R323 */ - { 0x0000, 0x0000 }, /* R324 */ - { 0x0000, 0x0000 }, /* R325 */ - { 0x0000, 0x0000 }, /* R326 */ - { 0x0000, 0x0000 }, /* R327 */ - { 0x0000, 0x0000 }, /* R328 */ - { 0x0000, 0x0000 }, /* R329 */ - { 0x0000, 0x0000 }, /* R330 */ - { 0x0000, 0x0000 }, /* R331 */ - { 0x0000, 0x0000 }, /* R332 */ - { 0x0000, 0x0000 }, /* R333 */ - { 0x0000, 0x0000 }, /* R334 */ - { 0x0000, 0x0000 }, /* R335 */ - { 0x0000, 0x0000 }, /* R336 */ - { 0x0000, 0x0000 }, /* R337 */ - { 0x0000, 0x0000 }, /* R338 */ - { 0x0000, 0x0000 }, /* R339 */ - { 0x0000, 0x0000 }, /* R340 */ - { 0x0000, 0x0000 }, /* R341 */ - { 0x0000, 0x0000 }, /* R342 */ - { 0x0000, 0x0000 }, /* R343 */ - { 0x0000, 0x0000 }, /* R344 */ - { 0x0000, 0x0000 }, /* R345 */ - { 0x0000, 0x0000 }, /* R346 */ - { 0x0000, 0x0000 }, /* R347 */ - { 0x0000, 0x0000 }, /* R348 */ - { 0x0000, 0x0000 }, /* R349 */ - { 0x0000, 0x0000 }, /* R350 */ - { 0x0000, 0x0000 }, /* R351 */ - { 0x0000, 0x0000 }, /* R352 */ - { 0x0000, 0x0000 }, /* R353 */ - { 0x0000, 0x0000 }, /* R354 */ - { 0x0000, 0x0000 }, /* R355 */ - { 0x0000, 0x0000 }, /* R356 */ - { 0x0000, 0x0000 }, /* R357 */ - { 0x0000, 0x0000 }, /* R358 */ - { 0x0000, 0x0000 }, /* R359 */ - { 0x0000, 0x0000 }, /* R360 */ - { 0x0000, 0x0000 }, /* R361 */ - { 0x0000, 0x0000 }, /* R362 */ - { 0x0000, 0x0000 }, /* R363 */ - { 0x0000, 0x0000 }, /* R364 */ - { 0x0000, 0x0000 }, /* R365 */ - { 0x0000, 0x0000 }, /* R366 */ - { 0x0000, 0x0000 }, /* R367 */ - { 0x0000, 0x0000 }, /* R368 */ - { 0x0000, 0x0000 }, /* R369 */ - { 0x0000, 0x0000 }, /* R370 */ - { 0x0000, 0x0000 }, /* R371 */ - { 0x0000, 0x0000 }, /* R372 */ - { 0x0000, 0x0000 }, /* R373 */ - { 0x0000, 0x0000 }, /* R374 */ - { 0x0000, 0x0000 }, /* R375 */ - { 0x0000, 0x0000 }, /* R376 */ - { 0x0000, 0x0000 }, /* R377 */ - { 0x0000, 0x0000 }, /* R378 */ - { 0x0000, 0x0000 }, /* R379 */ - { 0x0000, 0x0000 }, /* R380 */ - { 0x0000, 0x0000 }, /* R381 */ - { 0x0000, 0x0000 }, /* R382 */ - { 0x0000, 0x0000 }, /* R383 */ - { 0x0000, 0x0000 }, /* R384 */ - { 0x0000, 0x0000 }, /* R385 */ - { 0x0000, 0x0000 }, /* R386 */ - { 0x0000, 0x0000 }, /* R387 */ - { 0x0000, 0x0000 }, /* R388 */ - { 0x0000, 0x0000 }, /* R389 */ - { 0x0000, 0x0000 }, /* R390 */ - { 0x0000, 0x0000 }, /* R391 */ - { 0x0000, 0x0000 }, /* R392 */ - { 0x0000, 0x0000 }, /* R393 */ - { 0x0000, 0x0000 }, /* R394 */ - { 0x0000, 0x0000 }, /* R395 */ - { 0x0000, 0x0000 }, /* R396 */ - { 0x0000, 0x0000 }, /* R397 */ - { 0x0000, 0x0000 }, /* R398 */ - { 0x0000, 0x0000 }, /* R399 */ - { 0x0000, 0x0000 }, /* R400 */ - { 0x0000, 0x0000 }, /* R401 */ - { 0x0000, 0x0000 }, /* R402 */ - { 0x0000, 0x0000 }, /* R403 */ - { 0x0000, 0x0000 }, /* R404 */ - { 0x0000, 0x0000 }, /* R405 */ - { 0x0000, 0x0000 }, /* R406 */ - { 0x0000, 0x0000 }, /* R407 */ - { 0x0000, 0x0000 }, /* R408 */ - { 0x0000, 0x0000 }, /* R409 */ - { 0x0000, 0x0000 }, /* R410 */ - { 0x0000, 0x0000 }, /* R411 */ - { 0x0000, 0x0000 }, /* R412 */ - { 0x0000, 0x0000 }, /* R413 */ - { 0x0000, 0x0000 }, /* R414 */ - { 0x0000, 0x0000 }, /* R415 */ - { 0x0000, 0x0000 }, /* R416 */ - { 0x0000, 0x0000 }, /* R417 */ - { 0x0000, 0x0000 }, /* R418 */ - { 0x0000, 0x0000 }, /* R419 */ - { 0x0000, 0x0000 }, /* R420 */ - { 0x0000, 0x0000 }, /* R421 */ - { 0x0000, 0x0000 }, /* R422 */ - { 0x0000, 0x0000 }, /* R423 */ - { 0x0000, 0x0000 }, /* R424 */ - { 0x0000, 0x0000 }, /* R425 */ - { 0x0000, 0x0000 }, /* R426 */ - { 0x0000, 0x0000 }, /* R427 */ - { 0x0000, 0x0000 }, /* R428 */ - { 0x0000, 0x0000 }, /* R429 */ - { 0x0000, 0x0000 }, /* R430 */ - { 0x0000, 0x0000 }, /* R431 */ - { 0x0000, 0x0000 }, /* R432 */ - { 0x0000, 0x0000 }, /* R433 */ - { 0x0000, 0x0000 }, /* R434 */ - { 0x0000, 0x0000 }, /* R435 */ - { 0x0000, 0x0000 }, /* R436 */ - { 0x0000, 0x0000 }, /* R437 */ - { 0x0000, 0x0000 }, /* R438 */ - { 0x0000, 0x0000 }, /* R439 */ - { 0x0000, 0x0000 }, /* R440 */ - { 0x0000, 0x0000 }, /* R441 */ - { 0x0000, 0x0000 }, /* R442 */ - { 0x0000, 0x0000 }, /* R443 */ - { 0x0000, 0x0000 }, /* R444 */ - { 0x0000, 0x0000 }, /* R445 */ - { 0x0000, 0x0000 }, /* R446 */ - { 0x0000, 0x0000 }, /* R447 */ - { 0x0000, 0x0000 }, /* R448 */ - { 0x0000, 0x0000 }, /* R449 */ - { 0x0000, 0x0000 }, /* R450 */ - { 0x0000, 0x0000 }, /* R451 */ - { 0x0000, 0x0000 }, /* R452 */ - { 0x0000, 0x0000 }, /* R453 */ - { 0x0000, 0x0000 }, /* R454 */ - { 0x0000, 0x0000 }, /* R455 */ - { 0x0000, 0x0000 }, /* R456 */ - { 0x0000, 0x0000 }, /* R457 */ - { 0x0000, 0x0000 }, /* R458 */ - { 0x0000, 0x0000 }, /* R459 */ - { 0x0000, 0x0000 }, /* R460 */ - { 0x0000, 0x0000 }, /* R461 */ - { 0x0000, 0x0000 }, /* R462 */ - { 0x0000, 0x0000 }, /* R463 */ - { 0x0000, 0x0000 }, /* R464 */ - { 0x0000, 0x0000 }, /* R465 */ - { 0x0000, 0x0000 }, /* R466 */ - { 0x0000, 0x0000 }, /* R467 */ - { 0x0000, 0x0000 }, /* R468 */ - { 0x0000, 0x0000 }, /* R469 */ - { 0x0000, 0x0000 }, /* R470 */ - { 0x0000, 0x0000 }, /* R471 */ - { 0x0000, 0x0000 }, /* R472 */ - { 0x0000, 0x0000 }, /* R473 */ - { 0x0000, 0x0000 }, /* R474 */ - { 0x0000, 0x0000 }, /* R475 */ - { 0x0000, 0x0000 }, /* R476 */ - { 0x0000, 0x0000 }, /* R477 */ - { 0x0000, 0x0000 }, /* R478 */ - { 0x0000, 0x0000 }, /* R479 */ - { 0x0000, 0x0000 }, /* R480 */ - { 0x0000, 0x0000 }, /* R481 */ - { 0x0000, 0x0000 }, /* R482 */ - { 0x0000, 0x0000 }, /* R483 */ - { 0x0000, 0x0000 }, /* R484 */ - { 0x0000, 0x0000 }, /* R485 */ - { 0x0000, 0x0000 }, /* R486 */ - { 0x0000, 0x0000 }, /* R487 */ - { 0x0000, 0x0000 }, /* R488 */ - { 0x0000, 0x0000 }, /* R489 */ - { 0x0000, 0x0000 }, /* R490 */ - { 0x0000, 0x0000 }, /* R491 */ - { 0x0000, 0x0000 }, /* R492 */ - { 0x0000, 0x0000 }, /* R493 */ - { 0x0000, 0x0000 }, /* R494 */ - { 0x0000, 0x0000 }, /* R495 */ - { 0x0000, 0x0000 }, /* R496 */ - { 0x0000, 0x0000 }, /* R497 */ - { 0x0000, 0x0000 }, /* R498 */ - { 0x0000, 0x0000 }, /* R499 */ - { 0x0000, 0x0000 }, /* R500 */ - { 0x0000, 0x0000 }, /* R501 */ - { 0x0000, 0x0000 }, /* R502 */ - { 0x0000, 0x0000 }, /* R503 */ - { 0x0000, 0x0000 }, /* R504 */ - { 0x0000, 0x0000 }, /* R505 */ - { 0x0000, 0x0000 }, /* R506 */ - { 0x0000, 0x0000 }, /* R507 */ - { 0x0000, 0x0000 }, /* R508 */ - { 0x0000, 0x0000 }, /* R509 */ - { 0x0000, 0x0000 }, /* R510 */ - { 0x0000, 0x0000 }, /* R511 */ - { 0x001F, 0x001F }, /* R512 - AIF1 Clocking (1) */ - { 0x003F, 0x003F }, /* R513 - AIF1 Clocking (2) */ - { 0x0000, 0x0000 }, /* R514 */ - { 0x0000, 0x0000 }, /* R515 */ - { 0x001F, 0x001F }, /* R516 - AIF2 Clocking (1) */ - { 0x003F, 0x003F }, /* R517 - AIF2 Clocking (2) */ - { 0x0000, 0x0000 }, /* R518 */ - { 0x0000, 0x0000 }, /* R519 */ - { 0x001F, 0x001F }, /* R520 - Clocking (1) */ - { 0x0777, 0x0777 }, /* R521 - Clocking (2) */ - { 0x0000, 0x0000 }, /* R522 */ - { 0x0000, 0x0000 }, /* R523 */ - { 0x0000, 0x0000 }, /* R524 */ - { 0x0000, 0x0000 }, /* R525 */ - { 0x0000, 0x0000 }, /* R526 */ - { 0x0000, 0x0000 }, /* R527 */ - { 0x00FF, 0x00FF }, /* R528 - AIF1 Rate */ - { 0x00FF, 0x00FF }, /* R529 - AIF2 Rate */ - { 0x000F, 0x0000 }, /* R530 - Rate Status */ - { 0x0000, 0x0000 }, /* R531 */ - { 0x0000, 0x0000 }, /* R532 */ - { 0x0000, 0x0000 }, /* R533 */ - { 0x0000, 0x0000 }, /* R534 */ - { 0x0000, 0x0000 }, /* R535 */ - { 0x0000, 0x0000 }, /* R536 */ - { 0x0000, 0x0000 }, /* R537 */ - { 0x0000, 0x0000 }, /* R538 */ - { 0x0000, 0x0000 }, /* R539 */ - { 0x0000, 0x0000 }, /* R540 */ - { 0x0000, 0x0000 }, /* R541 */ - { 0x0000, 0x0000 }, /* R542 */ - { 0x0000, 0x0000 }, /* R543 */ - { 0x0007, 0x0007 }, /* R544 - FLL1 Control (1) */ - { 0x3F77, 0x3F77 }, /* R545 - FLL1 Control (2) */ - { 0xFFFF, 0xFFFF }, /* R546 - FLL1 Control (3) */ - { 0x7FEF, 0x7FEF }, /* R547 - FLL1 Control (4) */ - { 0x1FDB, 0x1FDB }, /* R548 - FLL1 Control (5) */ - { 0x0000, 0x0000 }, /* R549 */ - { 0x0000, 0x0000 }, /* R550 */ - { 0x0000, 0x0000 }, /* R551 */ - { 0x0000, 0x0000 }, /* R552 */ - { 0x0000, 0x0000 }, /* R553 */ - { 0x0000, 0x0000 }, /* R554 */ - { 0x0000, 0x0000 }, /* R555 */ - { 0x0000, 0x0000 }, /* R556 */ - { 0x0000, 0x0000 }, /* R557 */ - { 0x0000, 0x0000 }, /* R558 */ - { 0x0000, 0x0000 }, /* R559 */ - { 0x0000, 0x0000 }, /* R560 */ - { 0x0000, 0x0000 }, /* R561 */ - { 0x0000, 0x0000 }, /* R562 */ - { 0x0000, 0x0000 }, /* R563 */ - { 0x0000, 0x0000 }, /* R564 */ - { 0x0000, 0x0000 }, /* R565 */ - { 0x0000, 0x0000 }, /* R566 */ - { 0x0000, 0x0000 }, /* R567 */ - { 0x0000, 0x0000 }, /* R568 */ - { 0x0000, 0x0000 }, /* R569 */ - { 0x0000, 0x0000 }, /* R570 */ - { 0x0000, 0x0000 }, /* R571 */ - { 0x0000, 0x0000 }, /* R572 */ - { 0x0000, 0x0000 }, /* R573 */ - { 0x0000, 0x0000 }, /* R574 */ - { 0x0000, 0x0000 }, /* R575 */ - { 0x0007, 0x0007 }, /* R576 - FLL2 Control (1) */ - { 0x3F77, 0x3F77 }, /* R577 - FLL2 Control (2) */ - { 0xFFFF, 0xFFFF }, /* R578 - FLL2 Control (3) */ - { 0x7FEF, 0x7FEF }, /* R579 - FLL2 Control (4) */ - { 0x1FDB, 0x1FDB }, /* R580 - FLL2 Control (5) */ - { 0x0000, 0x0000 }, /* R581 */ - { 0x0000, 0x0000 }, /* R582 */ - { 0x0000, 0x0000 }, /* R583 */ - { 0x0000, 0x0000 }, /* R584 */ - { 0x0000, 0x0000 }, /* R585 */ - { 0x0000, 0x0000 }, /* R586 */ - { 0x0000, 0x0000 }, /* R587 */ - { 0x0000, 0x0000 }, /* R588 */ - { 0x0000, 0x0000 }, /* R589 */ - { 0x0000, 0x0000 }, /* R590 */ - { 0x0000, 0x0000 }, /* R591 */ - { 0x0000, 0x0000 }, /* R592 */ - { 0x0000, 0x0000 }, /* R593 */ - { 0x0000, 0x0000 }, /* R594 */ - { 0x0000, 0x0000 }, /* R595 */ - { 0x0000, 0x0000 }, /* R596 */ - { 0x0000, 0x0000 }, /* R597 */ - { 0x0000, 0x0000 }, /* R598 */ - { 0x0000, 0x0000 }, /* R599 */ - { 0x0000, 0x0000 }, /* R600 */ - { 0x0000, 0x0000 }, /* R601 */ - { 0x0000, 0x0000 }, /* R602 */ - { 0x0000, 0x0000 }, /* R603 */ - { 0x0000, 0x0000 }, /* R604 */ - { 0x0000, 0x0000 }, /* R605 */ - { 0x0000, 0x0000 }, /* R606 */ - { 0x0000, 0x0000 }, /* R607 */ - { 0x0000, 0x0000 }, /* R608 */ - { 0x0000, 0x0000 }, /* R609 */ - { 0x0000, 0x0000 }, /* R610 */ - { 0x0000, 0x0000 }, /* R611 */ - { 0x0000, 0x0000 }, /* R612 */ - { 0x0000, 0x0000 }, /* R613 */ - { 0x0000, 0x0000 }, /* R614 */ - { 0x0000, 0x0000 }, /* R615 */ - { 0x0000, 0x0000 }, /* R616 */ - { 0x0000, 0x0000 }, /* R617 */ - { 0x0000, 0x0000 }, /* R618 */ - { 0x0000, 0x0000 }, /* R619 */ - { 0x0000, 0x0000 }, /* R620 */ - { 0x0000, 0x0000 }, /* R621 */ - { 0x0000, 0x0000 }, /* R622 */ - { 0x0000, 0x0000 }, /* R623 */ - { 0x0000, 0x0000 }, /* R624 */ - { 0x0000, 0x0000 }, /* R625 */ - { 0x0000, 0x0000 }, /* R626 */ - { 0x0000, 0x0000 }, /* R627 */ - { 0x0000, 0x0000 }, /* R628 */ - { 0x0000, 0x0000 }, /* R629 */ - { 0x0000, 0x0000 }, /* R630 */ - { 0x0000, 0x0000 }, /* R631 */ - { 0x0000, 0x0000 }, /* R632 */ - { 0x0000, 0x0000 }, /* R633 */ - { 0x0000, 0x0000 }, /* R634 */ - { 0x0000, 0x0000 }, /* R635 */ - { 0x0000, 0x0000 }, /* R636 */ - { 0x0000, 0x0000 }, /* R637 */ - { 0x0000, 0x0000 }, /* R638 */ - { 0x0000, 0x0000 }, /* R639 */ - { 0x0000, 0x0000 }, /* R640 */ - { 0x0000, 0x0000 }, /* R641 */ - { 0x0000, 0x0000 }, /* R642 */ - { 0x0000, 0x0000 }, /* R643 */ - { 0x0000, 0x0000 }, /* R644 */ - { 0x0000, 0x0000 }, /* R645 */ - { 0x0000, 0x0000 }, /* R646 */ - { 0x0000, 0x0000 }, /* R647 */ - { 0x0000, 0x0000 }, /* R648 */ - { 0x0000, 0x0000 }, /* R649 */ - { 0x0000, 0x0000 }, /* R650 */ - { 0x0000, 0x0000 }, /* R651 */ - { 0x0000, 0x0000 }, /* R652 */ - { 0x0000, 0x0000 }, /* R653 */ - { 0x0000, 0x0000 }, /* R654 */ - { 0x0000, 0x0000 }, /* R655 */ - { 0x0000, 0x0000 }, /* R656 */ - { 0x0000, 0x0000 }, /* R657 */ - { 0x0000, 0x0000 }, /* R658 */ - { 0x0000, 0x0000 }, /* R659 */ - { 0x0000, 0x0000 }, /* R660 */ - { 0x0000, 0x0000 }, /* R661 */ - { 0x0000, 0x0000 }, /* R662 */ - { 0x0000, 0x0000 }, /* R663 */ - { 0x0000, 0x0000 }, /* R664 */ - { 0x0000, 0x0000 }, /* R665 */ - { 0x0000, 0x0000 }, /* R666 */ - { 0x0000, 0x0000 }, /* R667 */ - { 0x0000, 0x0000 }, /* R668 */ - { 0x0000, 0x0000 }, /* R669 */ - { 0x0000, 0x0000 }, /* R670 */ - { 0x0000, 0x0000 }, /* R671 */ - { 0x0000, 0x0000 }, /* R672 */ - { 0x0000, 0x0000 }, /* R673 */ - { 0x0000, 0x0000 }, /* R674 */ - { 0x0000, 0x0000 }, /* R675 */ - { 0x0000, 0x0000 }, /* R676 */ - { 0x0000, 0x0000 }, /* R677 */ - { 0x0000, 0x0000 }, /* R678 */ - { 0x0000, 0x0000 }, /* R679 */ - { 0x0000, 0x0000 }, /* R680 */ - { 0x0000, 0x0000 }, /* R681 */ - { 0x0000, 0x0000 }, /* R682 */ - { 0x0000, 0x0000 }, /* R683 */ - { 0x0000, 0x0000 }, /* R684 */ - { 0x0000, 0x0000 }, /* R685 */ - { 0x0000, 0x0000 }, /* R686 */ - { 0x0000, 0x0000 }, /* R687 */ - { 0x0000, 0x0000 }, /* R688 */ - { 0x0000, 0x0000 }, /* R689 */ - { 0x0000, 0x0000 }, /* R690 */ - { 0x0000, 0x0000 }, /* R691 */ - { 0x0000, 0x0000 }, /* R692 */ - { 0x0000, 0x0000 }, /* R693 */ - { 0x0000, 0x0000 }, /* R694 */ - { 0x0000, 0x0000 }, /* R695 */ - { 0x0000, 0x0000 }, /* R696 */ - { 0x0000, 0x0000 }, /* R697 */ - { 0x0000, 0x0000 }, /* R698 */ - { 0x0000, 0x0000 }, /* R699 */ - { 0x0000, 0x0000 }, /* R700 */ - { 0x0000, 0x0000 }, /* R701 */ - { 0x0000, 0x0000 }, /* R702 */ - { 0x0000, 0x0000 }, /* R703 */ - { 0x0000, 0x0000 }, /* R704 */ - { 0x0000, 0x0000 }, /* R705 */ - { 0x0000, 0x0000 }, /* R706 */ - { 0x0000, 0x0000 }, /* R707 */ - { 0x0000, 0x0000 }, /* R708 */ - { 0x0000, 0x0000 }, /* R709 */ - { 0x0000, 0x0000 }, /* R710 */ - { 0x0000, 0x0000 }, /* R711 */ - { 0x0000, 0x0000 }, /* R712 */ - { 0x0000, 0x0000 }, /* R713 */ - { 0x0000, 0x0000 }, /* R714 */ - { 0x0000, 0x0000 }, /* R715 */ - { 0x0000, 0x0000 }, /* R716 */ - { 0x0000, 0x0000 }, /* R717 */ - { 0x0000, 0x0000 }, /* R718 */ - { 0x0000, 0x0000 }, /* R719 */ - { 0x0000, 0x0000 }, /* R720 */ - { 0x0000, 0x0000 }, /* R721 */ - { 0x0000, 0x0000 }, /* R722 */ - { 0x0000, 0x0000 }, /* R723 */ - { 0x0000, 0x0000 }, /* R724 */ - { 0x0000, 0x0000 }, /* R725 */ - { 0x0000, 0x0000 }, /* R726 */ - { 0x0000, 0x0000 }, /* R727 */ - { 0x0000, 0x0000 }, /* R728 */ - { 0x0000, 0x0000 }, /* R729 */ - { 0x0000, 0x0000 }, /* R730 */ - { 0x0000, 0x0000 }, /* R731 */ - { 0x0000, 0x0000 }, /* R732 */ - { 0x0000, 0x0000 }, /* R733 */ - { 0x0000, 0x0000 }, /* R734 */ - { 0x0000, 0x0000 }, /* R735 */ - { 0x0000, 0x0000 }, /* R736 */ - { 0x0000, 0x0000 }, /* R737 */ - { 0x0000, 0x0000 }, /* R738 */ - { 0x0000, 0x0000 }, /* R739 */ - { 0x0000, 0x0000 }, /* R740 */ - { 0x0000, 0x0000 }, /* R741 */ - { 0x0000, 0x0000 }, /* R742 */ - { 0x0000, 0x0000 }, /* R743 */ - { 0x0000, 0x0000 }, /* R744 */ - { 0x0000, 0x0000 }, /* R745 */ - { 0x0000, 0x0000 }, /* R746 */ - { 0x0000, 0x0000 }, /* R747 */ - { 0x0000, 0x0000 }, /* R748 */ - { 0x0000, 0x0000 }, /* R749 */ - { 0x0000, 0x0000 }, /* R750 */ - { 0x0000, 0x0000 }, /* R751 */ - { 0x0000, 0x0000 }, /* R752 */ - { 0x0000, 0x0000 }, /* R753 */ - { 0x0000, 0x0000 }, /* R754 */ - { 0x0000, 0x0000 }, /* R755 */ - { 0x0000, 0x0000 }, /* R756 */ - { 0x0000, 0x0000 }, /* R757 */ - { 0x0000, 0x0000 }, /* R758 */ - { 0x0000, 0x0000 }, /* R759 */ - { 0x0000, 0x0000 }, /* R760 */ - { 0x0000, 0x0000 }, /* R761 */ - { 0x0000, 0x0000 }, /* R762 */ - { 0x0000, 0x0000 }, /* R763 */ - { 0x0000, 0x0000 }, /* R764 */ - { 0x0000, 0x0000 }, /* R765 */ - { 0x0000, 0x0000 }, /* R766 */ - { 0x0000, 0x0000 }, /* R767 */ - { 0xE1F8, 0xE1F8 }, /* R768 - AIF1 Control (1) */ - { 0xCD1F, 0xCD1F }, /* R769 - AIF1 Control (2) */ - { 0xF000, 0xF000 }, /* R770 - AIF1 Master/Slave */ - { 0x01F0, 0x01F0 }, /* R771 - AIF1 BCLK */ - { 0x0FFF, 0x0FFF }, /* R772 - AIF1ADC LRCLK */ - { 0x0FFF, 0x0FFF }, /* R773 - AIF1DAC LRCLK */ - { 0x0003, 0x0003 }, /* R774 - AIF1DAC Data */ - { 0x0003, 0x0003 }, /* R775 - AIF1ADC Data */ - { 0x0000, 0x0000 }, /* R776 */ - { 0x0000, 0x0000 }, /* R777 */ - { 0x0000, 0x0000 }, /* R778 */ - { 0x0000, 0x0000 }, /* R779 */ - { 0x0000, 0x0000 }, /* R780 */ - { 0x0000, 0x0000 }, /* R781 */ - { 0x0000, 0x0000 }, /* R782 */ - { 0x0000, 0x0000 }, /* R783 */ - { 0xF1F8, 0xF1F8 }, /* R784 - AIF2 Control (1) */ - { 0xFD1F, 0xFD1F }, /* R785 - AIF2 Control (2) */ - { 0xF000, 0xF000 }, /* R786 - AIF2 Master/Slave */ - { 0x01F0, 0x01F0 }, /* R787 - AIF2 BCLK */ - { 0x0FFF, 0x0FFF }, /* R788 - AIF2ADC LRCLK */ - { 0x0FFF, 0x0FFF }, /* R789 - AIF2DAC LRCLK */ - { 0x0003, 0x0003 }, /* R790 - AIF2DAC Data */ - { 0x0003, 0x0003 }, /* R791 - AIF2ADC Data */ - { 0x0000, 0x0000 }, /* R792 */ - { 0x0000, 0x0000 }, /* R793 */ - { 0x0000, 0x0000 }, /* R794 */ - { 0x0000, 0x0000 }, /* R795 */ - { 0x0000, 0x0000 }, /* R796 */ - { 0x0000, 0x0000 }, /* R797 */ - { 0x0000, 0x0000 }, /* R798 */ - { 0x0000, 0x0000 }, /* R799 */ - { 0x0000, 0x0000 }, /* R800 */ - { 0x0000, 0x0000 }, /* R801 */ - { 0x0000, 0x0000 }, /* R802 */ - { 0x0000, 0x0000 }, /* R803 */ - { 0x0000, 0x0000 }, /* R804 */ - { 0x0000, 0x0000 }, /* R805 */ - { 0x0000, 0x0000 }, /* R806 */ - { 0x0000, 0x0000 }, /* R807 */ - { 0x0000, 0x0000 }, /* R808 */ - { 0x0000, 0x0000 }, /* R809 */ - { 0x0000, 0x0000 }, /* R810 */ - { 0x0000, 0x0000 }, /* R811 */ - { 0x0000, 0x0000 }, /* R812 */ - { 0x0000, 0x0000 }, /* R813 */ - { 0x0000, 0x0000 }, /* R814 */ - { 0x0000, 0x0000 }, /* R815 */ - { 0x0000, 0x0000 }, /* R816 */ - { 0x0000, 0x0000 }, /* R817 */ - { 0x0000, 0x0000 }, /* R818 */ - { 0x0000, 0x0000 }, /* R819 */ - { 0x0000, 0x0000 }, /* R820 */ - { 0x0000, 0x0000 }, /* R821 */ - { 0x0000, 0x0000 }, /* R822 */ - { 0x0000, 0x0000 }, /* R823 */ - { 0x0000, 0x0000 }, /* R824 */ - { 0x0000, 0x0000 }, /* R825 */ - { 0x0000, 0x0000 }, /* R826 */ - { 0x0000, 0x0000 }, /* R827 */ - { 0x0000, 0x0000 }, /* R828 */ - { 0x0000, 0x0000 }, /* R829 */ - { 0x0000, 0x0000 }, /* R830 */ - { 0x0000, 0x0000 }, /* R831 */ - { 0x0000, 0x0000 }, /* R832 */ - { 0x0000, 0x0000 }, /* R833 */ - { 0x0000, 0x0000 }, /* R834 */ - { 0x0000, 0x0000 }, /* R835 */ - { 0x0000, 0x0000 }, /* R836 */ - { 0x0000, 0x0000 }, /* R837 */ - { 0x0000, 0x0000 }, /* R838 */ - { 0x0000, 0x0000 }, /* R839 */ - { 0x0000, 0x0000 }, /* R840 */ - { 0x0000, 0x0000 }, /* R841 */ - { 0x0000, 0x0000 }, /* R842 */ - { 0x0000, 0x0000 }, /* R843 */ - { 0x0000, 0x0000 }, /* R844 */ - { 0x0000, 0x0000 }, /* R845 */ - { 0x0000, 0x0000 }, /* R846 */ - { 0x0000, 0x0000 }, /* R847 */ - { 0x0000, 0x0000 }, /* R848 */ - { 0x0000, 0x0000 }, /* R849 */ - { 0x0000, 0x0000 }, /* R850 */ - { 0x0000, 0x0000 }, /* R851 */ - { 0x0000, 0x0000 }, /* R852 */ - { 0x0000, 0x0000 }, /* R853 */ - { 0x0000, 0x0000 }, /* R854 */ - { 0x0000, 0x0000 }, /* R855 */ - { 0x0000, 0x0000 }, /* R856 */ - { 0x0000, 0x0000 }, /* R857 */ - { 0x0000, 0x0000 }, /* R858 */ - { 0x0000, 0x0000 }, /* R859 */ - { 0x0000, 0x0000 }, /* R860 */ - { 0x0000, 0x0000 }, /* R861 */ - { 0x0000, 0x0000 }, /* R862 */ - { 0x0000, 0x0000 }, /* R863 */ - { 0x0000, 0x0000 }, /* R864 */ - { 0x0000, 0x0000 }, /* R865 */ - { 0x0000, 0x0000 }, /* R866 */ - { 0x0000, 0x0000 }, /* R867 */ - { 0x0000, 0x0000 }, /* R868 */ - { 0x0000, 0x0000 }, /* R869 */ - { 0x0000, 0x0000 }, /* R870 */ - { 0x0000, 0x0000 }, /* R871 */ - { 0x0000, 0x0000 }, /* R872 */ - { 0x0000, 0x0000 }, /* R873 */ - { 0x0000, 0x0000 }, /* R874 */ - { 0x0000, 0x0000 }, /* R875 */ - { 0x0000, 0x0000 }, /* R876 */ - { 0x0000, 0x0000 }, /* R877 */ - { 0x0000, 0x0000 }, /* R878 */ - { 0x0000, 0x0000 }, /* R879 */ - { 0x0000, 0x0000 }, /* R880 */ - { 0x0000, 0x0000 }, /* R881 */ - { 0x0000, 0x0000 }, /* R882 */ - { 0x0000, 0x0000 }, /* R883 */ - { 0x0000, 0x0000 }, /* R884 */ - { 0x0000, 0x0000 }, /* R885 */ - { 0x0000, 0x0000 }, /* R886 */ - { 0x0000, 0x0000 }, /* R887 */ - { 0x0000, 0x0000 }, /* R888 */ - { 0x0000, 0x0000 }, /* R889 */ - { 0x0000, 0x0000 }, /* R890 */ - { 0x0000, 0x0000 }, /* R891 */ - { 0x0000, 0x0000 }, /* R892 */ - { 0x0000, 0x0000 }, /* R893 */ - { 0x0000, 0x0000 }, /* R894 */ - { 0x0000, 0x0000 }, /* R895 */ - { 0x0000, 0x0000 }, /* R896 */ - { 0x0000, 0x0000 }, /* R897 */ - { 0x0000, 0x0000 }, /* R898 */ - { 0x0000, 0x0000 }, /* R899 */ - { 0x0000, 0x0000 }, /* R900 */ - { 0x0000, 0x0000 }, /* R901 */ - { 0x0000, 0x0000 }, /* R902 */ - { 0x0000, 0x0000 }, /* R903 */ - { 0x0000, 0x0000 }, /* R904 */ - { 0x0000, 0x0000 }, /* R905 */ - { 0x0000, 0x0000 }, /* R906 */ - { 0x0000, 0x0000 }, /* R907 */ - { 0x0000, 0x0000 }, /* R908 */ - { 0x0000, 0x0000 }, /* R909 */ - { 0x0000, 0x0000 }, /* R910 */ - { 0x0000, 0x0000 }, /* R911 */ - { 0x0000, 0x0000 }, /* R912 */ - { 0x0000, 0x0000 }, /* R913 */ - { 0x0000, 0x0000 }, /* R914 */ - { 0x0000, 0x0000 }, /* R915 */ - { 0x0000, 0x0000 }, /* R916 */ - { 0x0000, 0x0000 }, /* R917 */ - { 0x0000, 0x0000 }, /* R918 */ - { 0x0000, 0x0000 }, /* R919 */ - { 0x0000, 0x0000 }, /* R920 */ - { 0x0000, 0x0000 }, /* R921 */ - { 0x0000, 0x0000 }, /* R922 */ - { 0x0000, 0x0000 }, /* R923 */ - { 0x0000, 0x0000 }, /* R924 */ - { 0x0000, 0x0000 }, /* R925 */ - { 0x0000, 0x0000 }, /* R926 */ - { 0x0000, 0x0000 }, /* R927 */ - { 0x0000, 0x0000 }, /* R928 */ - { 0x0000, 0x0000 }, /* R929 */ - { 0x0000, 0x0000 }, /* R930 */ - { 0x0000, 0x0000 }, /* R931 */ - { 0x0000, 0x0000 }, /* R932 */ - { 0x0000, 0x0000 }, /* R933 */ - { 0x0000, 0x0000 }, /* R934 */ - { 0x0000, 0x0000 }, /* R935 */ - { 0x0000, 0x0000 }, /* R936 */ - { 0x0000, 0x0000 }, /* R937 */ - { 0x0000, 0x0000 }, /* R938 */ - { 0x0000, 0x0000 }, /* R939 */ - { 0x0000, 0x0000 }, /* R940 */ - { 0x0000, 0x0000 }, /* R941 */ - { 0x0000, 0x0000 }, /* R942 */ - { 0x0000, 0x0000 }, /* R943 */ - { 0x0000, 0x0000 }, /* R944 */ - { 0x0000, 0x0000 }, /* R945 */ - { 0x0000, 0x0000 }, /* R946 */ - { 0x0000, 0x0000 }, /* R947 */ - { 0x0000, 0x0000 }, /* R948 */ - { 0x0000, 0x0000 }, /* R949 */ - { 0x0000, 0x0000 }, /* R950 */ - { 0x0000, 0x0000 }, /* R951 */ - { 0x0000, 0x0000 }, /* R952 */ - { 0x0000, 0x0000 }, /* R953 */ - { 0x0000, 0x0000 }, /* R954 */ - { 0x0000, 0x0000 }, /* R955 */ - { 0x0000, 0x0000 }, /* R956 */ - { 0x0000, 0x0000 }, /* R957 */ - { 0x0000, 0x0000 }, /* R958 */ - { 0x0000, 0x0000 }, /* R959 */ - { 0x0000, 0x0000 }, /* R960 */ - { 0x0000, 0x0000 }, /* R961 */ - { 0x0000, 0x0000 }, /* R962 */ - { 0x0000, 0x0000 }, /* R963 */ - { 0x0000, 0x0000 }, /* R964 */ - { 0x0000, 0x0000 }, /* R965 */ - { 0x0000, 0x0000 }, /* R966 */ - { 0x0000, 0x0000 }, /* R967 */ - { 0x0000, 0x0000 }, /* R968 */ - { 0x0000, 0x0000 }, /* R969 */ - { 0x0000, 0x0000 }, /* R970 */ - { 0x0000, 0x0000 }, /* R971 */ - { 0x0000, 0x0000 }, /* R972 */ - { 0x0000, 0x0000 }, /* R973 */ - { 0x0000, 0x0000 }, /* R974 */ - { 0x0000, 0x0000 }, /* R975 */ - { 0x0000, 0x0000 }, /* R976 */ - { 0x0000, 0x0000 }, /* R977 */ - { 0x0000, 0x0000 }, /* R978 */ - { 0x0000, 0x0000 }, /* R979 */ - { 0x0000, 0x0000 }, /* R980 */ - { 0x0000, 0x0000 }, /* R981 */ - { 0x0000, 0x0000 }, /* R982 */ - { 0x0000, 0x0000 }, /* R983 */ - { 0x0000, 0x0000 }, /* R984 */ - { 0x0000, 0x0000 }, /* R985 */ - { 0x0000, 0x0000 }, /* R986 */ - { 0x0000, 0x0000 }, /* R987 */ - { 0x0000, 0x0000 }, /* R988 */ - { 0x0000, 0x0000 }, /* R989 */ - { 0x0000, 0x0000 }, /* R990 */ - { 0x0000, 0x0000 }, /* R991 */ - { 0x0000, 0x0000 }, /* R992 */ - { 0x0000, 0x0000 }, /* R993 */ - { 0x0000, 0x0000 }, /* R994 */ - { 0x0000, 0x0000 }, /* R995 */ - { 0x0000, 0x0000 }, /* R996 */ - { 0x0000, 0x0000 }, /* R997 */ - { 0x0000, 0x0000 }, /* R998 */ - { 0x0000, 0x0000 }, /* R999 */ - { 0x0000, 0x0000 }, /* R1000 */ - { 0x0000, 0x0000 }, /* R1001 */ - { 0x0000, 0x0000 }, /* R1002 */ - { 0x0000, 0x0000 }, /* R1003 */ - { 0x0000, 0x0000 }, /* R1004 */ - { 0x0000, 0x0000 }, /* R1005 */ - { 0x0000, 0x0000 }, /* R1006 */ - { 0x0000, 0x0000 }, /* R1007 */ - { 0x0000, 0x0000 }, /* R1008 */ - { 0x0000, 0x0000 }, /* R1009 */ - { 0x0000, 0x0000 }, /* R1010 */ - { 0x0000, 0x0000 }, /* R1011 */ - { 0x0000, 0x0000 }, /* R1012 */ - { 0x0000, 0x0000 }, /* R1013 */ - { 0x0000, 0x0000 }, /* R1014 */ - { 0x0000, 0x0000 }, /* R1015 */ - { 0x0000, 0x0000 }, /* R1016 */ - { 0x0000, 0x0000 }, /* R1017 */ - { 0x0000, 0x0000 }, /* R1018 */ - { 0x0000, 0x0000 }, /* R1019 */ - { 0x0000, 0x0000 }, /* R1020 */ - { 0x0000, 0x0000 }, /* R1021 */ - { 0x0000, 0x0000 }, /* R1022 */ - { 0x0000, 0x0000 }, /* R1023 */ - { 0x00FF, 0x01FF }, /* R1024 - AIF1 ADC1 Left Volume */ - { 0x00FF, 0x01FF }, /* R1025 - AIF1 ADC1 Right Volume */ - { 0x00FF, 0x01FF }, /* R1026 - AIF1 DAC1 Left Volume */ - { 0x00FF, 0x01FF }, /* R1027 - AIF1 DAC1 Right Volume */ - { 0x00FF, 0x01FF }, /* R1028 - AIF1 ADC2 Left Volume */ - { 0x00FF, 0x01FF }, /* R1029 - AIF1 ADC2 Right Volume */ - { 0x00FF, 0x01FF }, /* R1030 - AIF1 DAC2 Left Volume */ - { 0x00FF, 0x01FF }, /* R1031 - AIF1 DAC2 Right Volume */ - { 0x0000, 0x0000 }, /* R1032 */ - { 0x0000, 0x0000 }, /* R1033 */ - { 0x0000, 0x0000 }, /* R1034 */ - { 0x0000, 0x0000 }, /* R1035 */ - { 0x0000, 0x0000 }, /* R1036 */ - { 0x0000, 0x0000 }, /* R1037 */ - { 0x0000, 0x0000 }, /* R1038 */ - { 0x0000, 0x0000 }, /* R1039 */ - { 0xF800, 0xF800 }, /* R1040 - AIF1 ADC1 Filters */ - { 0x7800, 0x7800 }, /* R1041 - AIF1 ADC2 Filters */ - { 0x0000, 0x0000 }, /* R1042 */ - { 0x0000, 0x0000 }, /* R1043 */ - { 0x0000, 0x0000 }, /* R1044 */ - { 0x0000, 0x0000 }, /* R1045 */ - { 0x0000, 0x0000 }, /* R1046 */ - { 0x0000, 0x0000 }, /* R1047 */ - { 0x0000, 0x0000 }, /* R1048 */ - { 0x0000, 0x0000 }, /* R1049 */ - { 0x0000, 0x0000 }, /* R1050 */ - { 0x0000, 0x0000 }, /* R1051 */ - { 0x0000, 0x0000 }, /* R1052 */ - { 0x0000, 0x0000 }, /* R1053 */ - { 0x0000, 0x0000 }, /* R1054 */ - { 0x0000, 0x0000 }, /* R1055 */ - { 0x02B6, 0x02B6 }, /* R1056 - AIF1 DAC1 Filters (1) */ - { 0x3F00, 0x3F00 }, /* R1057 - AIF1 DAC1 Filters (2) */ - { 0x02B6, 0x02B6 }, /* R1058 - AIF1 DAC2 Filters (1) */ - { 0x3F00, 0x3F00 }, /* R1059 - AIF1 DAC2 Filters (2) */ - { 0x0000, 0x0000 }, /* R1060 */ - { 0x0000, 0x0000 }, /* R1061 */ - { 0x0000, 0x0000 }, /* R1062 */ - { 0x0000, 0x0000 }, /* R1063 */ - { 0x0000, 0x0000 }, /* R1064 */ - { 0x0000, 0x0000 }, /* R1065 */ - { 0x0000, 0x0000 }, /* R1066 */ - { 0x0000, 0x0000 }, /* R1067 */ - { 0x0000, 0x0000 }, /* R1068 */ - { 0x0000, 0x0000 }, /* R1069 */ - { 0x0000, 0x0000 }, /* R1070 */ - { 0x0000, 0x0000 }, /* R1071 */ - { 0x006F, 0x006F }, /* R1072 - AIF1 DAC1 Noise Gate */ - { 0x006F, 0x006F }, /* R1073 - AIF1 DAC2 Noise Gate */ - { 0x0000, 0x0000 }, /* R1074 */ - { 0x0000, 0x0000 }, /* R1075 */ - { 0x0000, 0x0000 }, /* R1076 */ - { 0x0000, 0x0000 }, /* R1077 */ - { 0x0000, 0x0000 }, /* R1078 */ - { 0x0000, 0x0000 }, /* R1079 */ - { 0x0000, 0x0000 }, /* R1080 */ - { 0x0000, 0x0000 }, /* R1081 */ - { 0x0000, 0x0000 }, /* R1082 */ - { 0x0000, 0x0000 }, /* R1083 */ - { 0x0000, 0x0000 }, /* R1084 */ - { 0x0000, 0x0000 }, /* R1085 */ - { 0x0000, 0x0000 }, /* R1086 */ - { 0x0000, 0x0000 }, /* R1087 */ - { 0xFFFF, 0xFFFF }, /* R1088 - AIF1 DRC1 (1) */ - { 0x1FFF, 0x1FFF }, /* R1089 - AIF1 DRC1 (2) */ - { 0xFFFF, 0xFFFF }, /* R1090 - AIF1 DRC1 (3) */ - { 0x07FF, 0x07FF }, /* R1091 - AIF1 DRC1 (4) */ - { 0x03FF, 0x03FF }, /* R1092 - AIF1 DRC1 (5) */ - { 0x0000, 0x0000 }, /* R1093 */ - { 0x0000, 0x0000 }, /* R1094 */ - { 0x0000, 0x0000 }, /* R1095 */ - { 0x0000, 0x0000 }, /* R1096 */ - { 0x0000, 0x0000 }, /* R1097 */ - { 0x0000, 0x0000 }, /* R1098 */ - { 0x0000, 0x0000 }, /* R1099 */ - { 0x0000, 0x0000 }, /* R1100 */ - { 0x0000, 0x0000 }, /* R1101 */ - { 0x0000, 0x0000 }, /* R1102 */ - { 0x0000, 0x0000 }, /* R1103 */ - { 0xFFFF, 0xFFFF }, /* R1104 - AIF1 DRC2 (1) */ - { 0x1FFF, 0x1FFF }, /* R1105 - AIF1 DRC2 (2) */ - { 0xFFFF, 0xFFFF }, /* R1106 - AIF1 DRC2 (3) */ - { 0x07FF, 0x07FF }, /* R1107 - AIF1 DRC2 (4) */ - { 0x03FF, 0x03FF }, /* R1108 - AIF1 DRC2 (5) */ - { 0x0000, 0x0000 }, /* R1109 */ - { 0x0000, 0x0000 }, /* R1110 */ - { 0x0000, 0x0000 }, /* R1111 */ - { 0x0000, 0x0000 }, /* R1112 */ - { 0x0000, 0x0000 }, /* R1113 */ - { 0x0000, 0x0000 }, /* R1114 */ - { 0x0000, 0x0000 }, /* R1115 */ - { 0x0000, 0x0000 }, /* R1116 */ - { 0x0000, 0x0000 }, /* R1117 */ - { 0x0000, 0x0000 }, /* R1118 */ - { 0x0000, 0x0000 }, /* R1119 */ - { 0x0000, 0x0000 }, /* R1120 */ - { 0x0000, 0x0000 }, /* R1121 */ - { 0x0000, 0x0000 }, /* R1122 */ - { 0x0000, 0x0000 }, /* R1123 */ - { 0x0000, 0x0000 }, /* R1124 */ - { 0x0000, 0x0000 }, /* R1125 */ - { 0x0000, 0x0000 }, /* R1126 */ - { 0x0000, 0x0000 }, /* R1127 */ - { 0x0000, 0x0000 }, /* R1128 */ - { 0x0000, 0x0000 }, /* R1129 */ - { 0x0000, 0x0000 }, /* R1130 */ - { 0x0000, 0x0000 }, /* R1131 */ - { 0x0000, 0x0000 }, /* R1132 */ - { 0x0000, 0x0000 }, /* R1133 */ - { 0x0000, 0x0000 }, /* R1134 */ - { 0x0000, 0x0000 }, /* R1135 */ - { 0x0000, 0x0000 }, /* R1136 */ - { 0x0000, 0x0000 }, /* R1137 */ - { 0x0000, 0x0000 }, /* R1138 */ - { 0x0000, 0x0000 }, /* R1139 */ - { 0x0000, 0x0000 }, /* R1140 */ - { 0x0000, 0x0000 }, /* R1141 */ - { 0x0000, 0x0000 }, /* R1142 */ - { 0x0000, 0x0000 }, /* R1143 */ - { 0x0000, 0x0000 }, /* R1144 */ - { 0x0000, 0x0000 }, /* R1145 */ - { 0x0000, 0x0000 }, /* R1146 */ - { 0x0000, 0x0000 }, /* R1147 */ - { 0x0000, 0x0000 }, /* R1148 */ - { 0x0000, 0x0000 }, /* R1149 */ - { 0x0000, 0x0000 }, /* R1150 */ - { 0x0000, 0x0000 }, /* R1151 */ - { 0xFFFF, 0xFFFF }, /* R1152 - AIF1 DAC1 EQ Gains (1) */ - { 0xFFC0, 0xFFC0 }, /* R1153 - AIF1 DAC1 EQ Gains (2) */ - { 0xFFFF, 0xFFFF }, /* R1154 - AIF1 DAC1 EQ Band 1 A */ - { 0xFFFF, 0xFFFF }, /* R1155 - AIF1 DAC1 EQ Band 1 B */ - { 0xFFFF, 0xFFFF }, /* R1156 - AIF1 DAC1 EQ Band 1 PG */ - { 0xFFFF, 0xFFFF }, /* R1157 - AIF1 DAC1 EQ Band 2 A */ - { 0xFFFF, 0xFFFF }, /* R1158 - AIF1 DAC1 EQ Band 2 B */ - { 0xFFFF, 0xFFFF }, /* R1159 - AIF1 DAC1 EQ Band 2 C */ - { 0xFFFF, 0xFFFF }, /* R1160 - AIF1 DAC1 EQ Band 2 PG */ - { 0xFFFF, 0xFFFF }, /* R1161 - AIF1 DAC1 EQ Band 3 A */ - { 0xFFFF, 0xFFFF }, /* R1162 - AIF1 DAC1 EQ Band 3 B */ - { 0xFFFF, 0xFFFF }, /* R1163 - AIF1 DAC1 EQ Band 3 C */ - { 0xFFFF, 0xFFFF }, /* R1164 - AIF1 DAC1 EQ Band 3 PG */ - { 0xFFFF, 0xFFFF }, /* R1165 - AIF1 DAC1 EQ Band 4 A */ - { 0xFFFF, 0xFFFF }, /* R1166 - AIF1 DAC1 EQ Band 4 B */ - { 0xFFFF, 0xFFFF }, /* R1167 - AIF1 DAC1 EQ Band 4 C */ - { 0xFFFF, 0xFFFF }, /* R1168 - AIF1 DAC1 EQ Band 4 PG */ - { 0xFFFF, 0xFFFF }, /* R1169 - AIF1 DAC1 EQ Band 5 A */ - { 0xFFFF, 0xFFFF }, /* R1170 - AIF1 DAC1 EQ Band 5 B */ - { 0xFFFF, 0xFFFF }, /* R1171 - AIF1 DAC1 EQ Band 5 PG */ - { 0x0000, 0x0000 }, /* R1172 */ - { 0x0000, 0x0000 }, /* R1173 */ - { 0x0000, 0x0000 }, /* R1174 */ - { 0x0000, 0x0000 }, /* R1175 */ - { 0x0000, 0x0000 }, /* R1176 */ - { 0x0000, 0x0000 }, /* R1177 */ - { 0x0000, 0x0000 }, /* R1178 */ - { 0x0000, 0x0000 }, /* R1179 */ - { 0x0000, 0x0000 }, /* R1180 */ - { 0x0000, 0x0000 }, /* R1181 */ - { 0x0000, 0x0000 }, /* R1182 */ - { 0x0000, 0x0000 }, /* R1183 */ - { 0xFFFF, 0xFFFF }, /* R1184 - AIF1 DAC2 EQ Gains (1) */ - { 0xFFC0, 0xFFC0 }, /* R1185 - AIF1 DAC2 EQ Gains (2) */ - { 0xFFFF, 0xFFFF }, /* R1186 - AIF1 DAC2 EQ Band 1 A */ - { 0xFFFF, 0xFFFF }, /* R1187 - AIF1 DAC2 EQ Band 1 B */ - { 0xFFFF, 0xFFFF }, /* R1188 - AIF1 DAC2 EQ Band 1 PG */ - { 0xFFFF, 0xFFFF }, /* R1189 - AIF1 DAC2 EQ Band 2 A */ - { 0xFFFF, 0xFFFF }, /* R1190 - AIF1 DAC2 EQ Band 2 B */ - { 0xFFFF, 0xFFFF }, /* R1191 - AIF1 DAC2 EQ Band 2 C */ - { 0xFFFF, 0xFFFF }, /* R1192 - AIF1 DAC2 EQ Band 2 PG */ - { 0xFFFF, 0xFFFF }, /* R1193 - AIF1 DAC2 EQ Band 3 A */ - { 0xFFFF, 0xFFFF }, /* R1194 - AIF1 DAC2 EQ Band 3 B */ - { 0xFFFF, 0xFFFF }, /* R1195 - AIF1 DAC2 EQ Band 3 C */ - { 0xFFFF, 0xFFFF }, /* R1196 - AIF1 DAC2 EQ Band 3 PG */ - { 0xFFFF, 0xFFFF }, /* R1197 - AIF1 DAC2 EQ Band 4 A */ - { 0xFFFF, 0xFFFF }, /* R1198 - AIF1 DAC2 EQ Band 4 B */ - { 0xFFFF, 0xFFFF }, /* R1199 - AIF1 DAC2 EQ Band 4 C */ - { 0xFFFF, 0xFFFF }, /* R1200 - AIF1 DAC2 EQ Band 4 PG */ - { 0xFFFF, 0xFFFF }, /* R1201 - AIF1 DAC2 EQ Band 5 A */ - { 0xFFFF, 0xFFFF }, /* R1202 - AIF1 DAC2 EQ Band 5 B */ - { 0xFFFF, 0xFFFF }, /* R1203 - AIF1 DAC2 EQ Band 5 PG */ - { 0x0000, 0x0000 }, /* R1204 */ - { 0x0000, 0x0000 }, /* R1205 */ - { 0x0000, 0x0000 }, /* R1206 */ - { 0x0000, 0x0000 }, /* R1207 */ - { 0x0000, 0x0000 }, /* R1208 */ - { 0x0000, 0x0000 }, /* R1209 */ - { 0x0000, 0x0000 }, /* R1210 */ - { 0x0000, 0x0000 }, /* R1211 */ - { 0x0000, 0x0000 }, /* R1212 */ - { 0x0000, 0x0000 }, /* R1213 */ - { 0x0000, 0x0000 }, /* R1214 */ - { 0x0000, 0x0000 }, /* R1215 */ - { 0x0000, 0x0000 }, /* R1216 */ - { 0x0000, 0x0000 }, /* R1217 */ - { 0x0000, 0x0000 }, /* R1218 */ - { 0x0000, 0x0000 }, /* R1219 */ - { 0x0000, 0x0000 }, /* R1220 */ - { 0x0000, 0x0000 }, /* R1221 */ - { 0x0000, 0x0000 }, /* R1222 */ - { 0x0000, 0x0000 }, /* R1223 */ - { 0x0000, 0x0000 }, /* R1224 */ - { 0x0000, 0x0000 }, /* R1225 */ - { 0x0000, 0x0000 }, /* R1226 */ - { 0x0000, 0x0000 }, /* R1227 */ - { 0x0000, 0x0000 }, /* R1228 */ - { 0x0000, 0x0000 }, /* R1229 */ - { 0x0000, 0x0000 }, /* R1230 */ - { 0x0000, 0x0000 }, /* R1231 */ - { 0x0000, 0x0000 }, /* R1232 */ - { 0x0000, 0x0000 }, /* R1233 */ - { 0x0000, 0x0000 }, /* R1234 */ - { 0x0000, 0x0000 }, /* R1235 */ - { 0x0000, 0x0000 }, /* R1236 */ - { 0x0000, 0x0000 }, /* R1237 */ - { 0x0000, 0x0000 }, /* R1238 */ - { 0x0000, 0x0000 }, /* R1239 */ - { 0x0000, 0x0000 }, /* R1240 */ - { 0x0000, 0x0000 }, /* R1241 */ - { 0x0000, 0x0000 }, /* R1242 */ - { 0x0000, 0x0000 }, /* R1243 */ - { 0x0000, 0x0000 }, /* R1244 */ - { 0x0000, 0x0000 }, /* R1245 */ - { 0x0000, 0x0000 }, /* R1246 */ - { 0x0000, 0x0000 }, /* R1247 */ - { 0x0000, 0x0000 }, /* R1248 */ - { 0x0000, 0x0000 }, /* R1249 */ - { 0x0000, 0x0000 }, /* R1250 */ - { 0x0000, 0x0000 }, /* R1251 */ - { 0x0000, 0x0000 }, /* R1252 */ - { 0x0000, 0x0000 }, /* R1253 */ - { 0x0000, 0x0000 }, /* R1254 */ - { 0x0000, 0x0000 }, /* R1255 */ - { 0x0000, 0x0000 }, /* R1256 */ - { 0x0000, 0x0000 }, /* R1257 */ - { 0x0000, 0x0000 }, /* R1258 */ - { 0x0000, 0x0000 }, /* R1259 */ - { 0x0000, 0x0000 }, /* R1260 */ - { 0x0000, 0x0000 }, /* R1261 */ - { 0x0000, 0x0000 }, /* R1262 */ - { 0x0000, 0x0000 }, /* R1263 */ - { 0x0000, 0x0000 }, /* R1264 */ - { 0x0000, 0x0000 }, /* R1265 */ - { 0x0000, 0x0000 }, /* R1266 */ - { 0x0000, 0x0000 }, /* R1267 */ - { 0x0000, 0x0000 }, /* R1268 */ - { 0x0000, 0x0000 }, /* R1269 */ - { 0x0000, 0x0000 }, /* R1270 */ - { 0x0000, 0x0000 }, /* R1271 */ - { 0x0000, 0x0000 }, /* R1272 */ - { 0x0000, 0x0000 }, /* R1273 */ - { 0x0000, 0x0000 }, /* R1274 */ - { 0x0000, 0x0000 }, /* R1275 */ - { 0x0000, 0x0000 }, /* R1276 */ - { 0x0000, 0x0000 }, /* R1277 */ - { 0x0000, 0x0000 }, /* R1278 */ - { 0x0000, 0x0000 }, /* R1279 */ - { 0x00FF, 0x01FF }, /* R1280 - AIF2 ADC Left Volume */ - { 0x00FF, 0x01FF }, /* R1281 - AIF2 ADC Right Volume */ - { 0x00FF, 0x01FF }, /* R1282 - AIF2 DAC Left Volume */ - { 0x00FF, 0x01FF }, /* R1283 - AIF2 DAC Right Volume */ - { 0x0000, 0x0000 }, /* R1284 */ - { 0x0000, 0x0000 }, /* R1285 */ - { 0x0000, 0x0000 }, /* R1286 */ - { 0x0000, 0x0000 }, /* R1287 */ - { 0x0000, 0x0000 }, /* R1288 */ - { 0x0000, 0x0000 }, /* R1289 */ - { 0x0000, 0x0000 }, /* R1290 */ - { 0x0000, 0x0000 }, /* R1291 */ - { 0x0000, 0x0000 }, /* R1292 */ - { 0x0000, 0x0000 }, /* R1293 */ - { 0x0000, 0x0000 }, /* R1294 */ - { 0x0000, 0x0000 }, /* R1295 */ - { 0xF800, 0xF800 }, /* R1296 - AIF2 ADC Filters */ - { 0x0000, 0x0000 }, /* R1297 */ - { 0x0000, 0x0000 }, /* R1298 */ - { 0x0000, 0x0000 }, /* R1299 */ - { 0x0000, 0x0000 }, /* R1300 */ - { 0x0000, 0x0000 }, /* R1301 */ - { 0x0000, 0x0000 }, /* R1302 */ - { 0x0000, 0x0000 }, /* R1303 */ - { 0x0000, 0x0000 }, /* R1304 */ - { 0x0000, 0x0000 }, /* R1305 */ - { 0x0000, 0x0000 }, /* R1306 */ - { 0x0000, 0x0000 }, /* R1307 */ - { 0x0000, 0x0000 }, /* R1308 */ - { 0x0000, 0x0000 }, /* R1309 */ - { 0x0000, 0x0000 }, /* R1310 */ - { 0x0000, 0x0000 }, /* R1311 */ - { 0x02B6, 0x02B6 }, /* R1312 - AIF2 DAC Filters (1) */ - { 0x3F00, 0x3F00 }, /* R1313 - AIF2 DAC Filters (2) */ - { 0x0000, 0x0000 }, /* R1314 */ - { 0x0000, 0x0000 }, /* R1315 */ - { 0x0000, 0x0000 }, /* R1316 */ - { 0x0000, 0x0000 }, /* R1317 */ - { 0x0000, 0x0000 }, /* R1318 */ - { 0x0000, 0x0000 }, /* R1319 */ - { 0x0000, 0x0000 }, /* R1320 */ - { 0x0000, 0x0000 }, /* R1321 */ - { 0x0000, 0x0000 }, /* R1322 */ - { 0x0000, 0x0000 }, /* R1323 */ - { 0x0000, 0x0000 }, /* R1324 */ - { 0x0000, 0x0000 }, /* R1325 */ - { 0x0000, 0x0000 }, /* R1326 */ - { 0x0000, 0x0000 }, /* R1327 */ - { 0x006F, 0x006F }, /* R1328 - AIF2 DAC Noise Gate */ - { 0x0000, 0x0000 }, /* R1329 */ - { 0x0000, 0x0000 }, /* R1330 */ - { 0x0000, 0x0000 }, /* R1331 */ - { 0x0000, 0x0000 }, /* R1332 */ - { 0x0000, 0x0000 }, /* R1333 */ - { 0x0000, 0x0000 }, /* R1334 */ - { 0x0000, 0x0000 }, /* R1335 */ - { 0x0000, 0x0000 }, /* R1336 */ - { 0x0000, 0x0000 }, /* R1337 */ - { 0x0000, 0x0000 }, /* R1338 */ - { 0x0000, 0x0000 }, /* R1339 */ - { 0x0000, 0x0000 }, /* R1340 */ - { 0x0000, 0x0000 }, /* R1341 */ - { 0x0000, 0x0000 }, /* R1342 */ - { 0x0000, 0x0000 }, /* R1343 */ - { 0xFFFF, 0xFFFF }, /* R1344 - AIF2 DRC (1) */ - { 0x1FFF, 0x1FFF }, /* R1345 - AIF2 DRC (2) */ - { 0xFFFF, 0xFFFF }, /* R1346 - AIF2 DRC (3) */ - { 0x07FF, 0x07FF }, /* R1347 - AIF2 DRC (4) */ - { 0x03FF, 0x03FF }, /* R1348 - AIF2 DRC (5) */ - { 0x0000, 0x0000 }, /* R1349 */ - { 0x0000, 0x0000 }, /* R1350 */ - { 0x0000, 0x0000 }, /* R1351 */ - { 0x0000, 0x0000 }, /* R1352 */ - { 0x0000, 0x0000 }, /* R1353 */ - { 0x0000, 0x0000 }, /* R1354 */ - { 0x0000, 0x0000 }, /* R1355 */ - { 0x0000, 0x0000 }, /* R1356 */ - { 0x0000, 0x0000 }, /* R1357 */ - { 0x0000, 0x0000 }, /* R1358 */ - { 0x0000, 0x0000 }, /* R1359 */ - { 0x0000, 0x0000 }, /* R1360 */ - { 0x0000, 0x0000 }, /* R1361 */ - { 0x0000, 0x0000 }, /* R1362 */ - { 0x0000, 0x0000 }, /* R1363 */ - { 0x0000, 0x0000 }, /* R1364 */ - { 0x0000, 0x0000 }, /* R1365 */ - { 0x0000, 0x0000 }, /* R1366 */ - { 0x0000, 0x0000 }, /* R1367 */ - { 0x0000, 0x0000 }, /* R1368 */ - { 0x0000, 0x0000 }, /* R1369 */ - { 0x0000, 0x0000 }, /* R1370 */ - { 0x0000, 0x0000 }, /* R1371 */ - { 0x0000, 0x0000 }, /* R1372 */ - { 0x0000, 0x0000 }, /* R1373 */ - { 0x0000, 0x0000 }, /* R1374 */ - { 0x0000, 0x0000 }, /* R1375 */ - { 0x0000, 0x0000 }, /* R1376 */ - { 0x0000, 0x0000 }, /* R1377 */ - { 0x0000, 0x0000 }, /* R1378 */ - { 0x0000, 0x0000 }, /* R1379 */ - { 0x0000, 0x0000 }, /* R1380 */ - { 0x0000, 0x0000 }, /* R1381 */ - { 0x0000, 0x0000 }, /* R1382 */ - { 0x0000, 0x0000 }, /* R1383 */ - { 0x0000, 0x0000 }, /* R1384 */ - { 0x0000, 0x0000 }, /* R1385 */ - { 0x0000, 0x0000 }, /* R1386 */ - { 0x0000, 0x0000 }, /* R1387 */ - { 0x0000, 0x0000 }, /* R1388 */ - { 0x0000, 0x0000 }, /* R1389 */ - { 0x0000, 0x0000 }, /* R1390 */ - { 0x0000, 0x0000 }, /* R1391 */ - { 0x0000, 0x0000 }, /* R1392 */ - { 0x0000, 0x0000 }, /* R1393 */ - { 0x0000, 0x0000 }, /* R1394 */ - { 0x0000, 0x0000 }, /* R1395 */ - { 0x0000, 0x0000 }, /* R1396 */ - { 0x0000, 0x0000 }, /* R1397 */ - { 0x0000, 0x0000 }, /* R1398 */ - { 0x0000, 0x0000 }, /* R1399 */ - { 0x0000, 0x0000 }, /* R1400 */ - { 0x0000, 0x0000 }, /* R1401 */ - { 0x0000, 0x0000 }, /* R1402 */ - { 0x0000, 0x0000 }, /* R1403 */ - { 0x0000, 0x0000 }, /* R1404 */ - { 0x0000, 0x0000 }, /* R1405 */ - { 0x0000, 0x0000 }, /* R1406 */ - { 0x0000, 0x0000 }, /* R1407 */ - { 0xFFFF, 0xFFFF }, /* R1408 - AIF2 EQ Gains (1) */ - { 0xFFC0, 0xFFC0 }, /* R1409 - AIF2 EQ Gains (2) */ - { 0xFFFF, 0xFFFF }, /* R1410 - AIF2 EQ Band 1 A */ - { 0xFFFF, 0xFFFF }, /* R1411 - AIF2 EQ Band 1 B */ - { 0xFFFF, 0xFFFF }, /* R1412 - AIF2 EQ Band 1 PG */ - { 0xFFFF, 0xFFFF }, /* R1413 - AIF2 EQ Band 2 A */ - { 0xFFFF, 0xFFFF }, /* R1414 - AIF2 EQ Band 2 B */ - { 0xFFFF, 0xFFFF }, /* R1415 - AIF2 EQ Band 2 C */ - { 0xFFFF, 0xFFFF }, /* R1416 - AIF2 EQ Band 2 PG */ - { 0xFFFF, 0xFFFF }, /* R1417 - AIF2 EQ Band 3 A */ - { 0xFFFF, 0xFFFF }, /* R1418 - AIF2 EQ Band 3 B */ - { 0xFFFF, 0xFFFF }, /* R1419 - AIF2 EQ Band 3 C */ - { 0xFFFF, 0xFFFF }, /* R1420 - AIF2 EQ Band 3 PG */ - { 0xFFFF, 0xFFFF }, /* R1421 - AIF2 EQ Band 4 A */ - { 0xFFFF, 0xFFFF }, /* R1422 - AIF2 EQ Band 4 B */ - { 0xFFFF, 0xFFFF }, /* R1423 - AIF2 EQ Band 4 C */ - { 0xFFFF, 0xFFFF }, /* R1424 - AIF2 EQ Band 4 PG */ - { 0xFFFF, 0xFFFF }, /* R1425 - AIF2 EQ Band 5 A */ - { 0xFFFF, 0xFFFF }, /* R1426 - AIF2 EQ Band 5 B */ - { 0xFFFF, 0xFFFF }, /* R1427 - AIF2 EQ Band 5 PG */ - { 0x0000, 0x0000 }, /* R1428 */ - { 0x0000, 0x0000 }, /* R1429 */ - { 0x0000, 0x0000 }, /* R1430 */ - { 0x0000, 0x0000 }, /* R1431 */ - { 0x0000, 0x0000 }, /* R1432 */ - { 0x0000, 0x0000 }, /* R1433 */ - { 0x0000, 0x0000 }, /* R1434 */ - { 0x0000, 0x0000 }, /* R1435 */ - { 0x0000, 0x0000 }, /* R1436 */ - { 0x0000, 0x0000 }, /* R1437 */ - { 0x0000, 0x0000 }, /* R1438 */ - { 0x0000, 0x0000 }, /* R1439 */ - { 0x0000, 0x0000 }, /* R1440 */ - { 0x0000, 0x0000 }, /* R1441 */ - { 0x0000, 0x0000 }, /* R1442 */ - { 0x0000, 0x0000 }, /* R1443 */ - { 0x0000, 0x0000 }, /* R1444 */ - { 0x0000, 0x0000 }, /* R1445 */ - { 0x0000, 0x0000 }, /* R1446 */ - { 0x0000, 0x0000 }, /* R1447 */ - { 0x0000, 0x0000 }, /* R1448 */ - { 0x0000, 0x0000 }, /* R1449 */ - { 0x0000, 0x0000 }, /* R1450 */ - { 0x0000, 0x0000 }, /* R1451 */ - { 0x0000, 0x0000 }, /* R1452 */ - { 0x0000, 0x0000 }, /* R1453 */ - { 0x0000, 0x0000 }, /* R1454 */ - { 0x0000, 0x0000 }, /* R1455 */ - { 0x0000, 0x0000 }, /* R1456 */ - { 0x0000, 0x0000 }, /* R1457 */ - { 0x0000, 0x0000 }, /* R1458 */ - { 0x0000, 0x0000 }, /* R1459 */ - { 0x0000, 0x0000 }, /* R1460 */ - { 0x0000, 0x0000 }, /* R1461 */ - { 0x0000, 0x0000 }, /* R1462 */ - { 0x0000, 0x0000 }, /* R1463 */ - { 0x0000, 0x0000 }, /* R1464 */ - { 0x0000, 0x0000 }, /* R1465 */ - { 0x0000, 0x0000 }, /* R1466 */ - { 0x0000, 0x0000 }, /* R1467 */ - { 0x0000, 0x0000 }, /* R1468 */ - { 0x0000, 0x0000 }, /* R1469 */ - { 0x0000, 0x0000 }, /* R1470 */ - { 0x0000, 0x0000 }, /* R1471 */ - { 0x0000, 0x0000 }, /* R1472 */ - { 0x0000, 0x0000 }, /* R1473 */ - { 0x0000, 0x0000 }, /* R1474 */ - { 0x0000, 0x0000 }, /* R1475 */ - { 0x0000, 0x0000 }, /* R1476 */ - { 0x0000, 0x0000 }, /* R1477 */ - { 0x0000, 0x0000 }, /* R1478 */ - { 0x0000, 0x0000 }, /* R1479 */ - { 0x0000, 0x0000 }, /* R1480 */ - { 0x0000, 0x0000 }, /* R1481 */ - { 0x0000, 0x0000 }, /* R1482 */ - { 0x0000, 0x0000 }, /* R1483 */ - { 0x0000, 0x0000 }, /* R1484 */ - { 0x0000, 0x0000 }, /* R1485 */ - { 0x0000, 0x0000 }, /* R1486 */ - { 0x0000, 0x0000 }, /* R1487 */ - { 0x0000, 0x0000 }, /* R1488 */ - { 0x0000, 0x0000 }, /* R1489 */ - { 0x0000, 0x0000 }, /* R1490 */ - { 0x0000, 0x0000 }, /* R1491 */ - { 0x0000, 0x0000 }, /* R1492 */ - { 0x0000, 0x0000 }, /* R1493 */ - { 0x0000, 0x0000 }, /* R1494 */ - { 0x0000, 0x0000 }, /* R1495 */ - { 0x0000, 0x0000 }, /* R1496 */ - { 0x0000, 0x0000 }, /* R1497 */ - { 0x0000, 0x0000 }, /* R1498 */ - { 0x0000, 0x0000 }, /* R1499 */ - { 0x0000, 0x0000 }, /* R1500 */ - { 0x0000, 0x0000 }, /* R1501 */ - { 0x0000, 0x0000 }, /* R1502 */ - { 0x0000, 0x0000 }, /* R1503 */ - { 0x0000, 0x0000 }, /* R1504 */ - { 0x0000, 0x0000 }, /* R1505 */ - { 0x0000, 0x0000 }, /* R1506 */ - { 0x0000, 0x0000 }, /* R1507 */ - { 0x0000, 0x0000 }, /* R1508 */ - { 0x0000, 0x0000 }, /* R1509 */ - { 0x0000, 0x0000 }, /* R1510 */ - { 0x0000, 0x0000 }, /* R1511 */ - { 0x0000, 0x0000 }, /* R1512 */ - { 0x0000, 0x0000 }, /* R1513 */ - { 0x0000, 0x0000 }, /* R1514 */ - { 0x0000, 0x0000 }, /* R1515 */ - { 0x0000, 0x0000 }, /* R1516 */ - { 0x0000, 0x0000 }, /* R1517 */ - { 0x0000, 0x0000 }, /* R1518 */ - { 0x0000, 0x0000 }, /* R1519 */ - { 0x0000, 0x0000 }, /* R1520 */ - { 0x0000, 0x0000 }, /* R1521 */ - { 0x0000, 0x0000 }, /* R1522 */ - { 0x0000, 0x0000 }, /* R1523 */ - { 0x0000, 0x0000 }, /* R1524 */ - { 0x0000, 0x0000 }, /* R1525 */ - { 0x0000, 0x0000 }, /* R1526 */ - { 0x0000, 0x0000 }, /* R1527 */ - { 0x0000, 0x0000 }, /* R1528 */ - { 0x0000, 0x0000 }, /* R1529 */ - { 0x0000, 0x0000 }, /* R1530 */ - { 0x0000, 0x0000 }, /* R1531 */ - { 0x0000, 0x0000 }, /* R1532 */ - { 0x0000, 0x0000 }, /* R1533 */ - { 0x0000, 0x0000 }, /* R1534 */ - { 0x0000, 0x0000 }, /* R1535 */ - { 0x01EF, 0x01EF }, /* R1536 - DAC1 Mixer Volumes */ - { 0x0037, 0x0037 }, /* R1537 - DAC1 Left Mixer Routing */ - { 0x0037, 0x0037 }, /* R1538 - DAC1 Right Mixer Routing */ - { 0x01EF, 0x01EF }, /* R1539 - DAC2 Mixer Volumes */ - { 0x0037, 0x0037 }, /* R1540 - DAC2 Left Mixer Routing */ - { 0x0037, 0x0037 }, /* R1541 - DAC2 Right Mixer Routing */ - { 0x0003, 0x0003 }, /* R1542 - AIF1 ADC1 Left Mixer Routing */ - { 0x0003, 0x0003 }, /* R1543 - AIF1 ADC1 Right Mixer Routing */ - { 0x0003, 0x0003 }, /* R1544 - AIF1 ADC2 Left Mixer Routing */ - { 0x0003, 0x0003 }, /* R1545 - AIF1 ADC2 Right mixer Routing */ - { 0x0000, 0x0000 }, /* R1546 */ - { 0x0000, 0x0000 }, /* R1547 */ - { 0x0000, 0x0000 }, /* R1548 */ - { 0x0000, 0x0000 }, /* R1549 */ - { 0x0000, 0x0000 }, /* R1550 */ - { 0x0000, 0x0000 }, /* R1551 */ - { 0x02FF, 0x03FF }, /* R1552 - DAC1 Left Volume */ - { 0x02FF, 0x03FF }, /* R1553 - DAC1 Right Volume */ - { 0x02FF, 0x03FF }, /* R1554 - DAC2 Left Volume */ - { 0x02FF, 0x03FF }, /* R1555 - DAC2 Right Volume */ - { 0x0003, 0x0003 }, /* R1556 - DAC Softmute */ - { 0x0000, 0x0000 }, /* R1557 */ - { 0x0000, 0x0000 }, /* R1558 */ - { 0x0000, 0x0000 }, /* R1559 */ - { 0x0000, 0x0000 }, /* R1560 */ - { 0x0000, 0x0000 }, /* R1561 */ - { 0x0000, 0x0000 }, /* R1562 */ - { 0x0000, 0x0000 }, /* R1563 */ - { 0x0000, 0x0000 }, /* R1564 */ - { 0x0000, 0x0000 }, /* R1565 */ - { 0x0000, 0x0000 }, /* R1566 */ - { 0x0000, 0x0000 }, /* R1567 */ - { 0x0003, 0x0003 }, /* R1568 - Oversampling */ - { 0x03C3, 0x03C3 }, /* R1569 - Sidetone */ -}; - -const u16 wm8994_reg_defaults[WM8994_CACHE_SIZE] = { - 0x8994, /* R0 - Software Reset */ - 0x0000, /* R1 - Power Management (1) */ - 0x6000, /* R2 - Power Management (2) */ - 0x0000, /* R3 - Power Management (3) */ - 0x0000, /* R4 - Power Management (4) */ - 0x0000, /* R5 - Power Management (5) */ - 0x0000, /* R6 - Power Management (6) */ - 0x0000, /* R7 */ - 0x0000, /* R8 */ - 0x0000, /* R9 */ - 0x0000, /* R10 */ - 0x0000, /* R11 */ - 0x0000, /* R12 */ - 0x0000, /* R13 */ - 0x0000, /* R14 */ - 0x0000, /* R15 */ - 0x0000, /* R16 */ - 0x0000, /* R17 */ - 0x0000, /* R18 */ - 0x0000, /* R19 */ - 0x0000, /* R20 */ - 0x0000, /* R21 - Input Mixer (1) */ - 0x0000, /* R22 */ - 0x0000, /* R23 */ - 0x008B, /* R24 - Left Line Input 1&2 Volume */ - 0x008B, /* R25 - Left Line Input 3&4 Volume */ - 0x008B, /* R26 - Right Line Input 1&2 Volume */ - 0x008B, /* R27 - Right Line Input 3&4 Volume */ - 0x006D, /* R28 - Left Output Volume */ - 0x006D, /* R29 - Right Output Volume */ - 0x0066, /* R30 - Line Outputs Volume */ - 0x0020, /* R31 - HPOUT2 Volume */ - 0x0079, /* R32 - Left OPGA Volume */ - 0x0079, /* R33 - Right OPGA Volume */ - 0x0003, /* R34 - SPKMIXL Attenuation */ - 0x0003, /* R35 - SPKMIXR Attenuation */ - 0x0011, /* R36 - SPKOUT Mixers */ - 0x0140, /* R37 - ClassD */ - 0x0079, /* R38 - Speaker Volume Left */ - 0x0079, /* R39 - Speaker Volume Right */ - 0x0000, /* R40 - Input Mixer (2) */ - 0x0000, /* R41 - Input Mixer (3) */ - 0x0000, /* R42 - Input Mixer (4) */ - 0x0000, /* R43 - Input Mixer (5) */ - 0x0000, /* R44 - Input Mixer (6) */ - 0x0000, /* R45 - Output Mixer (1) */ - 0x0000, /* R46 - Output Mixer (2) */ - 0x0000, /* R47 - Output Mixer (3) */ - 0x0000, /* R48 - Output Mixer (4) */ - 0x0000, /* R49 - Output Mixer (5) */ - 0x0000, /* R50 - Output Mixer (6) */ - 0x0000, /* R51 - HPOUT2 Mixer */ - 0x0000, /* R52 - Line Mixer (1) */ - 0x0000, /* R53 - Line Mixer (2) */ - 0x0000, /* R54 - Speaker Mixer */ - 0x0000, /* R55 - Additional Control */ - 0x0000, /* R56 - AntiPOP (1) */ - 0x0000, /* R57 - AntiPOP (2) */ - 0x0000, /* R58 - MICBIAS */ - 0x000D, /* R59 - LDO 1 */ - 0x0003, /* R60 - LDO 2 */ - 0x0039, /* R61 - MICBIAS1 */ - 0x0039, /* R62 - MICBIAS2 */ - 0x0000, /* R63 */ - 0x0000, /* R64 */ - 0x0000, /* R65 */ - 0x0000, /* R66 */ - 0x0000, /* R67 */ - 0x0000, /* R68 */ - 0x0000, /* R69 */ - 0x0000, /* R70 */ - 0x0000, /* R71 */ - 0x0000, /* R72 */ - 0x0000, /* R73 */ - 0x0000, /* R74 */ - 0x0000, /* R75 */ - 0x1F25, /* R76 - Charge Pump (1) */ - 0xAB19, /* R77 - Charge Pump (2) */ - 0x0000, /* R78 */ - 0x0000, /* R79 */ - 0x0000, /* R80 */ - 0x0004, /* R81 - Class W (1) */ - 0x0000, /* R82 */ - 0x0000, /* R83 */ - 0x0000, /* R84 - DC Servo (1) */ - 0x054A, /* R85 - DC Servo (2) */ - 0x0000, /* R86 */ - 0x0000, /* R87 - DC Servo (4) */ - 0x0000, /* R88 - DC Servo Readback */ - 0x0000, /* R89 */ - 0x0000, /* R90 */ - 0x0000, /* R91 */ - 0x0000, /* R92 */ - 0x0000, /* R93 */ - 0x0000, /* R94 */ - 0x0000, /* R95 */ - 0x0000, /* R96 - Analogue HP (1) */ - 0x0000, /* R97 */ - 0x0000, /* R98 */ - 0x0000, /* R99 */ - 0x0000, /* R100 */ - 0x0000, /* R101 */ - 0x0000, /* R102 */ - 0x0000, /* R103 */ - 0x0000, /* R104 */ - 0x0000, /* R105 */ - 0x0000, /* R106 */ - 0x0000, /* R107 */ - 0x0000, /* R108 */ - 0x0000, /* R109 */ - 0x0000, /* R110 */ - 0x0000, /* R111 */ - 0x0000, /* R112 */ - 0x0000, /* R113 */ - 0x0000, /* R114 */ - 0x0000, /* R115 */ - 0x0000, /* R116 */ - 0x0000, /* R117 */ - 0x0000, /* R118 */ - 0x0000, /* R119 */ - 0x0000, /* R120 */ - 0x0000, /* R121 */ - 0x0000, /* R122 */ - 0x0000, /* R123 */ - 0x0000, /* R124 */ - 0x0000, /* R125 */ - 0x0000, /* R126 */ - 0x0000, /* R127 */ - 0x0000, /* R128 */ - 0x0000, /* R129 */ - 0x0000, /* R130 */ - 0x0000, /* R131 */ - 0x0000, /* R132 */ - 0x0000, /* R133 */ - 0x0000, /* R134 */ - 0x0000, /* R135 */ - 0x0000, /* R136 */ - 0x0000, /* R137 */ - 0x0000, /* R138 */ - 0x0000, /* R139 */ - 0x0000, /* R140 */ - 0x0000, /* R141 */ - 0x0000, /* R142 */ - 0x0000, /* R143 */ - 0x0000, /* R144 */ - 0x0000, /* R145 */ - 0x0000, /* R146 */ - 0x0000, /* R147 */ - 0x0000, /* R148 */ - 0x0000, /* R149 */ - 0x0000, /* R150 */ - 0x0000, /* R151 */ - 0x0000, /* R152 */ - 0x0000, /* R153 */ - 0x0000, /* R154 */ - 0x0000, /* R155 */ - 0x0000, /* R156 */ - 0x0000, /* R157 */ - 0x0000, /* R158 */ - 0x0000, /* R159 */ - 0x0000, /* R160 */ - 0x0000, /* R161 */ - 0x0000, /* R162 */ - 0x0000, /* R163 */ - 0x0000, /* R164 */ - 0x0000, /* R165 */ - 0x0000, /* R166 */ - 0x0000, /* R167 */ - 0x0000, /* R168 */ - 0x0000, /* R169 */ - 0x0000, /* R170 */ - 0x0000, /* R171 */ - 0x0000, /* R172 */ - 0x0000, /* R173 */ - 0x0000, /* R174 */ - 0x0000, /* R175 */ - 0x0000, /* R176 */ - 0x0000, /* R177 */ - 0x0000, /* R178 */ - 0x0000, /* R179 */ - 0x0000, /* R180 */ - 0x0000, /* R181 */ - 0x0000, /* R182 */ - 0x0000, /* R183 */ - 0x0000, /* R184 */ - 0x0000, /* R185 */ - 0x0000, /* R186 */ - 0x0000, /* R187 */ - 0x0000, /* R188 */ - 0x0000, /* R189 */ - 0x0000, /* R190 */ - 0x0000, /* R191 */ - 0x0000, /* R192 */ - 0x0000, /* R193 */ - 0x0000, /* R194 */ - 0x0000, /* R195 */ - 0x0000, /* R196 */ - 0x0000, /* R197 */ - 0x0000, /* R198 */ - 0x0000, /* R199 */ - 0x0000, /* R200 */ - 0x0000, /* R201 */ - 0x0000, /* R202 */ - 0x0000, /* R203 */ - 0x0000, /* R204 */ - 0x0000, /* R205 */ - 0x0000, /* R206 */ - 0x0000, /* R207 */ - 0x0000, /* R208 */ - 0x0000, /* R209 */ - 0x0000, /* R210 */ - 0x0000, /* R211 */ - 0x0000, /* R212 */ - 0x0000, /* R213 */ - 0x0000, /* R214 */ - 0x0000, /* R215 */ - 0x0000, /* R216 */ - 0x0000, /* R217 */ - 0x0000, /* R218 */ - 0x0000, /* R219 */ - 0x0000, /* R220 */ - 0x0000, /* R221 */ - 0x0000, /* R222 */ - 0x0000, /* R223 */ - 0x0000, /* R224 */ - 0x0000, /* R225 */ - 0x0000, /* R226 */ - 0x0000, /* R227 */ - 0x0000, /* R228 */ - 0x0000, /* R229 */ - 0x0000, /* R230 */ - 0x0000, /* R231 */ - 0x0000, /* R232 */ - 0x0000, /* R233 */ - 0x0000, /* R234 */ - 0x0000, /* R235 */ - 0x0000, /* R236 */ - 0x0000, /* R237 */ - 0x0000, /* R238 */ - 0x0000, /* R239 */ - 0x0000, /* R240 */ - 0x0000, /* R241 */ - 0x0000, /* R242 */ - 0x0000, /* R243 */ - 0x0000, /* R244 */ - 0x0000, /* R245 */ - 0x0000, /* R246 */ - 0x0000, /* R247 */ - 0x0000, /* R248 */ - 0x0000, /* R249 */ - 0x0000, /* R250 */ - 0x0000, /* R251 */ - 0x0000, /* R252 */ - 0x0000, /* R253 */ - 0x0000, /* R254 */ - 0x0000, /* R255 */ - 0x0003, /* R256 - Chip Revision */ - 0x8004, /* R257 - Control Interface */ - 0x0000, /* R258 */ - 0x0000, /* R259 */ - 0x0000, /* R260 */ - 0x0000, /* R261 */ - 0x0000, /* R262 */ - 0x0000, /* R263 */ - 0x0000, /* R264 */ - 0x0000, /* R265 */ - 0x0000, /* R266 */ - 0x0000, /* R267 */ - 0x0000, /* R268 */ - 0x0000, /* R269 */ - 0x0000, /* R270 */ - 0x0000, /* R271 */ - 0x0000, /* R272 - Write Sequencer Ctrl (1) */ - 0x0000, /* R273 - Write Sequencer Ctrl (2) */ - 0x0000, /* R274 */ - 0x0000, /* R275 */ - 0x0000, /* R276 */ - 0x0000, /* R277 */ - 0x0000, /* R278 */ - 0x0000, /* R279 */ - 0x0000, /* R280 */ - 0x0000, /* R281 */ - 0x0000, /* R282 */ - 0x0000, /* R283 */ - 0x0000, /* R284 */ - 0x0000, /* R285 */ - 0x0000, /* R286 */ - 0x0000, /* R287 */ - 0x0000, /* R288 */ - 0x0000, /* R289 */ - 0x0000, /* R290 */ - 0x0000, /* R291 */ - 0x0000, /* R292 */ - 0x0000, /* R293 */ - 0x0000, /* R294 */ - 0x0000, /* R295 */ - 0x0000, /* R296 */ - 0x0000, /* R297 */ - 0x0000, /* R298 */ - 0x0000, /* R299 */ - 0x0000, /* R300 */ - 0x0000, /* R301 */ - 0x0000, /* R302 */ - 0x0000, /* R303 */ - 0x0000, /* R304 */ - 0x0000, /* R305 */ - 0x0000, /* R306 */ - 0x0000, /* R307 */ - 0x0000, /* R308 */ - 0x0000, /* R309 */ - 0x0000, /* R310 */ - 0x0000, /* R311 */ - 0x0000, /* R312 */ - 0x0000, /* R313 */ - 0x0000, /* R314 */ - 0x0000, /* R315 */ - 0x0000, /* R316 */ - 0x0000, /* R317 */ - 0x0000, /* R318 */ - 0x0000, /* R319 */ - 0x0000, /* R320 */ - 0x0000, /* R321 */ - 0x0000, /* R322 */ - 0x0000, /* R323 */ - 0x0000, /* R324 */ - 0x0000, /* R325 */ - 0x0000, /* R326 */ - 0x0000, /* R327 */ - 0x0000, /* R328 */ - 0x0000, /* R329 */ - 0x0000, /* R330 */ - 0x0000, /* R331 */ - 0x0000, /* R332 */ - 0x0000, /* R333 */ - 0x0000, /* R334 */ - 0x0000, /* R335 */ - 0x0000, /* R336 */ - 0x0000, /* R337 */ - 0x0000, /* R338 */ - 0x0000, /* R339 */ - 0x0000, /* R340 */ - 0x0000, /* R341 */ - 0x0000, /* R342 */ - 0x0000, /* R343 */ - 0x0000, /* R344 */ - 0x0000, /* R345 */ - 0x0000, /* R346 */ - 0x0000, /* R347 */ - 0x0000, /* R348 */ - 0x0000, /* R349 */ - 0x0000, /* R350 */ - 0x0000, /* R351 */ - 0x0000, /* R352 */ - 0x0000, /* R353 */ - 0x0000, /* R354 */ - 0x0000, /* R355 */ - 0x0000, /* R356 */ - 0x0000, /* R357 */ - 0x0000, /* R358 */ - 0x0000, /* R359 */ - 0x0000, /* R360 */ - 0x0000, /* R361 */ - 0x0000, /* R362 */ - 0x0000, /* R363 */ - 0x0000, /* R364 */ - 0x0000, /* R365 */ - 0x0000, /* R366 */ - 0x0000, /* R367 */ - 0x0000, /* R368 */ - 0x0000, /* R369 */ - 0x0000, /* R370 */ - 0x0000, /* R371 */ - 0x0000, /* R372 */ - 0x0000, /* R373 */ - 0x0000, /* R374 */ - 0x0000, /* R375 */ - 0x0000, /* R376 */ - 0x0000, /* R377 */ - 0x0000, /* R378 */ - 0x0000, /* R379 */ - 0x0000, /* R380 */ - 0x0000, /* R381 */ - 0x0000, /* R382 */ - 0x0000, /* R383 */ - 0x0000, /* R384 */ - 0x0000, /* R385 */ - 0x0000, /* R386 */ - 0x0000, /* R387 */ - 0x0000, /* R388 */ - 0x0000, /* R389 */ - 0x0000, /* R390 */ - 0x0000, /* R391 */ - 0x0000, /* R392 */ - 0x0000, /* R393 */ - 0x0000, /* R394 */ - 0x0000, /* R395 */ - 0x0000, /* R396 */ - 0x0000, /* R397 */ - 0x0000, /* R398 */ - 0x0000, /* R399 */ - 0x0000, /* R400 */ - 0x0000, /* R401 */ - 0x0000, /* R402 */ - 0x0000, /* R403 */ - 0x0000, /* R404 */ - 0x0000, /* R405 */ - 0x0000, /* R406 */ - 0x0000, /* R407 */ - 0x0000, /* R408 */ - 0x0000, /* R409 */ - 0x0000, /* R410 */ - 0x0000, /* R411 */ - 0x0000, /* R412 */ - 0x0000, /* R413 */ - 0x0000, /* R414 */ - 0x0000, /* R415 */ - 0x0000, /* R416 */ - 0x0000, /* R417 */ - 0x0000, /* R418 */ - 0x0000, /* R419 */ - 0x0000, /* R420 */ - 0x0000, /* R421 */ - 0x0000, /* R422 */ - 0x0000, /* R423 */ - 0x0000, /* R424 */ - 0x0000, /* R425 */ - 0x0000, /* R426 */ - 0x0000, /* R427 */ - 0x0000, /* R428 */ - 0x0000, /* R429 */ - 0x0000, /* R430 */ - 0x0000, /* R431 */ - 0x0000, /* R432 */ - 0x0000, /* R433 */ - 0x0000, /* R434 */ - 0x0000, /* R435 */ - 0x0000, /* R436 */ - 0x0000, /* R437 */ - 0x0000, /* R438 */ - 0x0000, /* R439 */ - 0x0000, /* R440 */ - 0x0000, /* R441 */ - 0x0000, /* R442 */ - 0x0000, /* R443 */ - 0x0000, /* R444 */ - 0x0000, /* R445 */ - 0x0000, /* R446 */ - 0x0000, /* R447 */ - 0x0000, /* R448 */ - 0x0000, /* R449 */ - 0x0000, /* R450 */ - 0x0000, /* R451 */ - 0x0000, /* R452 */ - 0x0000, /* R453 */ - 0x0000, /* R454 */ - 0x0000, /* R455 */ - 0x0000, /* R456 */ - 0x0000, /* R457 */ - 0x0000, /* R458 */ - 0x0000, /* R459 */ - 0x0000, /* R460 */ - 0x0000, /* R461 */ - 0x0000, /* R462 */ - 0x0000, /* R463 */ - 0x0000, /* R464 */ - 0x0000, /* R465 */ - 0x0000, /* R466 */ - 0x0000, /* R467 */ - 0x0000, /* R468 */ - 0x0000, /* R469 */ - 0x0000, /* R470 */ - 0x0000, /* R471 */ - 0x0000, /* R472 */ - 0x0000, /* R473 */ - 0x0000, /* R474 */ - 0x0000, /* R475 */ - 0x0000, /* R476 */ - 0x0000, /* R477 */ - 0x0000, /* R478 */ - 0x0000, /* R479 */ - 0x0000, /* R480 */ - 0x0000, /* R481 */ - 0x0000, /* R482 */ - 0x0000, /* R483 */ - 0x0000, /* R484 */ - 0x0000, /* R485 */ - 0x0000, /* R486 */ - 0x0000, /* R487 */ - 0x0000, /* R488 */ - 0x0000, /* R489 */ - 0x0000, /* R490 */ - 0x0000, /* R491 */ - 0x0000, /* R492 */ - 0x0000, /* R493 */ - 0x0000, /* R494 */ - 0x0000, /* R495 */ - 0x0000, /* R496 */ - 0x0000, /* R497 */ - 0x0000, /* R498 */ - 0x0000, /* R499 */ - 0x0000, /* R500 */ - 0x0000, /* R501 */ - 0x0000, /* R502 */ - 0x0000, /* R503 */ - 0x0000, /* R504 */ - 0x0000, /* R505 */ - 0x0000, /* R506 */ - 0x0000, /* R507 */ - 0x0000, /* R508 */ - 0x0000, /* R509 */ - 0x0000, /* R510 */ - 0x0000, /* R511 */ - 0x0000, /* R512 - AIF1 Clocking (1) */ - 0x0000, /* R513 - AIF1 Clocking (2) */ - 0x0000, /* R514 */ - 0x0000, /* R515 */ - 0x0000, /* R516 - AIF2 Clocking (1) */ - 0x0000, /* R517 - AIF2 Clocking (2) */ - 0x0000, /* R518 */ - 0x0000, /* R519 */ - 0x0000, /* R520 - Clocking (1) */ - 0x0000, /* R521 - Clocking (2) */ - 0x0000, /* R522 */ - 0x0000, /* R523 */ - 0x0000, /* R524 */ - 0x0000, /* R525 */ - 0x0000, /* R526 */ - 0x0000, /* R527 */ - 0x0083, /* R528 - AIF1 Rate */ - 0x0083, /* R529 - AIF2 Rate */ - 0x0000, /* R530 - Rate Status */ - 0x0000, /* R531 */ - 0x0000, /* R532 */ - 0x0000, /* R533 */ - 0x0000, /* R534 */ - 0x0000, /* R535 */ - 0x0000, /* R536 */ - 0x0000, /* R537 */ - 0x0000, /* R538 */ - 0x0000, /* R539 */ - 0x0000, /* R540 */ - 0x0000, /* R541 */ - 0x0000, /* R542 */ - 0x0000, /* R543 */ - 0x0000, /* R544 - FLL1 Control (1) */ - 0x0000, /* R545 - FLL1 Control (2) */ - 0x0000, /* R546 - FLL1 Control (3) */ - 0x0000, /* R547 - FLL1 Control (4) */ - 0x0C80, /* R548 - FLL1 Control (5) */ - 0x0000, /* R549 */ - 0x0000, /* R550 - FLL1 EFS 1 */ - 0x0006, /* R551 - FLL1 EFS 2 */ - 0x0000, /* R552 */ - 0x0000, /* R553 */ - 0x0000, /* R554 */ - 0x0000, /* R555 */ - 0x0000, /* R556 */ - 0x0000, /* R557 */ - 0x0000, /* R558 */ - 0x0000, /* R559 */ - 0x0000, /* R560 */ - 0x0000, /* R561 */ - 0x0000, /* R562 */ - 0x0000, /* R563 */ - 0x0000, /* R564 */ - 0x0000, /* R565 */ - 0x0000, /* R566 */ - 0x0000, /* R567 */ - 0x0000, /* R568 */ - 0x0000, /* R569 */ - 0x0000, /* R570 */ - 0x0000, /* R571 */ - 0x0000, /* R572 */ - 0x0000, /* R573 */ - 0x0000, /* R574 */ - 0x0000, /* R575 */ - 0x0000, /* R576 - FLL2 Control (1) */ - 0x0000, /* R577 - FLL2 Control (2) */ - 0x0000, /* R578 - FLL2 Control (3) */ - 0x0000, /* R579 - FLL2 Control (4) */ - 0x0C80, /* R580 - FLL2 Control (5) */ - 0x0000, /* R581 */ - 0x0000, /* R582 - FLL2 EFS 1 */ - 0x0006, /* R583 - FLL2 EFS 2 */ - 0x0000, /* R584 */ - 0x0000, /* R585 */ - 0x0000, /* R586 */ - 0x0000, /* R587 */ - 0x0000, /* R588 */ - 0x0000, /* R589 */ - 0x0000, /* R590 */ - 0x0000, /* R591 */ - 0x0000, /* R592 */ - 0x0000, /* R593 */ - 0x0000, /* R594 */ - 0x0000, /* R595 */ - 0x0000, /* R596 */ - 0x0000, /* R597 */ - 0x0000, /* R598 */ - 0x0000, /* R599 */ - 0x0000, /* R600 */ - 0x0000, /* R601 */ - 0x0000, /* R602 */ - 0x0000, /* R603 */ - 0x0000, /* R604 */ - 0x0000, /* R605 */ - 0x0000, /* R606 */ - 0x0000, /* R607 */ - 0x0000, /* R608 */ - 0x0000, /* R609 */ - 0x0000, /* R610 */ - 0x0000, /* R611 */ - 0x0000, /* R612 */ - 0x0000, /* R613 */ - 0x0000, /* R614 */ - 0x0000, /* R615 */ - 0x0000, /* R616 */ - 0x0000, /* R617 */ - 0x0000, /* R618 */ - 0x0000, /* R619 */ - 0x0000, /* R620 */ - 0x0000, /* R621 */ - 0x0000, /* R622 */ - 0x0000, /* R623 */ - 0x0000, /* R624 */ - 0x0000, /* R625 */ - 0x0000, /* R626 */ - 0x0000, /* R627 */ - 0x0000, /* R628 */ - 0x0000, /* R629 */ - 0x0000, /* R630 */ - 0x0000, /* R631 */ - 0x0000, /* R632 */ - 0x0000, /* R633 */ - 0x0000, /* R634 */ - 0x0000, /* R635 */ - 0x0000, /* R636 */ - 0x0000, /* R637 */ - 0x0000, /* R638 */ - 0x0000, /* R639 */ - 0x0000, /* R640 */ - 0x0000, /* R641 */ - 0x0000, /* R642 */ - 0x0000, /* R643 */ - 0x0000, /* R644 */ - 0x0000, /* R645 */ - 0x0000, /* R646 */ - 0x0000, /* R647 */ - 0x0000, /* R648 */ - 0x0000, /* R649 */ - 0x0000, /* R650 */ - 0x0000, /* R651 */ - 0x0000, /* R652 */ - 0x0000, /* R653 */ - 0x0000, /* R654 */ - 0x0000, /* R655 */ - 0x0000, /* R656 */ - 0x0000, /* R657 */ - 0x0000, /* R658 */ - 0x0000, /* R659 */ - 0x0000, /* R660 */ - 0x0000, /* R661 */ - 0x0000, /* R662 */ - 0x0000, /* R663 */ - 0x0000, /* R664 */ - 0x0000, /* R665 */ - 0x0000, /* R666 */ - 0x0000, /* R667 */ - 0x0000, /* R668 */ - 0x0000, /* R669 */ - 0x0000, /* R670 */ - 0x0000, /* R671 */ - 0x0000, /* R672 */ - 0x0000, /* R673 */ - 0x0000, /* R674 */ - 0x0000, /* R675 */ - 0x0000, /* R676 */ - 0x0000, /* R677 */ - 0x0000, /* R678 */ - 0x0000, /* R679 */ - 0x0000, /* R680 */ - 0x0000, /* R681 */ - 0x0000, /* R682 */ - 0x0000, /* R683 */ - 0x0000, /* R684 */ - 0x0000, /* R685 */ - 0x0000, /* R686 */ - 0x0000, /* R687 */ - 0x0000, /* R688 */ - 0x0000, /* R689 */ - 0x0000, /* R690 */ - 0x0000, /* R691 */ - 0x0000, /* R692 */ - 0x0000, /* R693 */ - 0x0000, /* R694 */ - 0x0000, /* R695 */ - 0x0000, /* R696 */ - 0x0000, /* R697 */ - 0x0000, /* R698 */ - 0x0000, /* R699 */ - 0x0000, /* R700 */ - 0x0000, /* R701 */ - 0x0000, /* R702 */ - 0x0000, /* R703 */ - 0x0000, /* R704 */ - 0x0000, /* R705 */ - 0x0000, /* R706 */ - 0x0000, /* R707 */ - 0x0000, /* R708 */ - 0x0000, /* R709 */ - 0x0000, /* R710 */ - 0x0000, /* R711 */ - 0x0000, /* R712 */ - 0x0000, /* R713 */ - 0x0000, /* R714 */ - 0x0000, /* R715 */ - 0x0000, /* R716 */ - 0x0000, /* R717 */ - 0x0000, /* R718 */ - 0x0000, /* R719 */ - 0x0000, /* R720 */ - 0x0000, /* R721 */ - 0x0000, /* R722 */ - 0x0000, /* R723 */ - 0x0000, /* R724 */ - 0x0000, /* R725 */ - 0x0000, /* R726 */ - 0x0000, /* R727 */ - 0x0000, /* R728 */ - 0x0000, /* R729 */ - 0x0000, /* R730 */ - 0x0000, /* R731 */ - 0x0000, /* R732 */ - 0x0000, /* R733 */ - 0x0000, /* R734 */ - 0x0000, /* R735 */ - 0x0000, /* R736 */ - 0x0000, /* R737 */ - 0x0000, /* R738 */ - 0x0000, /* R739 */ - 0x0000, /* R740 */ - 0x0000, /* R741 */ - 0x0000, /* R742 */ - 0x0000, /* R743 */ - 0x0000, /* R744 */ - 0x0000, /* R745 */ - 0x0000, /* R746 */ - 0x0000, /* R747 */ - 0x0000, /* R748 */ - 0x0000, /* R749 */ - 0x0000, /* R750 */ - 0x0000, /* R751 */ - 0x0000, /* R752 */ - 0x0000, /* R753 */ - 0x0000, /* R754 */ - 0x0000, /* R755 */ - 0x0000, /* R756 */ - 0x0000, /* R757 */ - 0x0000, /* R758 */ - 0x0000, /* R759 */ - 0x0000, /* R760 */ - 0x0000, /* R761 */ - 0x0000, /* R762 */ - 0x0000, /* R763 */ - 0x0000, /* R764 */ - 0x0000, /* R765 */ - 0x0000, /* R766 */ - 0x0000, /* R767 */ - 0x4050, /* R768 - AIF1 Control (1) */ - 0x4000, /* R769 - AIF1 Control (2) */ - 0x0000, /* R770 - AIF1 Master/Slave */ - 0x0040, /* R771 - AIF1 BCLK */ - 0x0040, /* R772 - AIF1ADC LRCLK */ - 0x0040, /* R773 - AIF1DAC LRCLK */ - 0x0004, /* R774 - AIF1DAC Data */ - 0x0100, /* R775 - AIF1ADC Data */ - 0x0000, /* R776 */ - 0x0000, /* R777 */ - 0x0000, /* R778 */ - 0x0000, /* R779 */ - 0x0000, /* R780 */ - 0x0000, /* R781 */ - 0x0000, /* R782 */ - 0x0000, /* R783 */ - 0x4050, /* R784 - AIF2 Control (1) */ - 0x4000, /* R785 - AIF2 Control (2) */ - 0x0000, /* R786 - AIF2 Master/Slave */ - 0x0040, /* R787 - AIF2 BCLK */ - 0x0040, /* R788 - AIF2ADC LRCLK */ - 0x0040, /* R789 - AIF2DAC LRCLK */ - 0x0000, /* R790 - AIF2DAC Data */ - 0x0000, /* R791 - AIF2ADC Data */ - 0x0000, /* R792 */ - 0x0000, /* R793 */ - 0x0000, /* R794 */ - 0x0000, /* R795 */ - 0x0000, /* R796 */ - 0x0000, /* R797 */ - 0x0000, /* R798 */ - 0x0000, /* R799 */ - 0x0000, /* R800 */ - 0x0000, /* R801 */ - 0x0000, /* R802 */ - 0x0000, /* R803 */ - 0x0000, /* R804 */ - 0x0000, /* R805 */ - 0x0000, /* R806 */ - 0x0000, /* R807 */ - 0x0000, /* R808 */ - 0x0000, /* R809 */ - 0x0000, /* R810 */ - 0x0000, /* R811 */ - 0x0000, /* R812 */ - 0x0000, /* R813 */ - 0x0000, /* R814 */ - 0x0000, /* R815 */ - 0x0000, /* R816 */ - 0x0000, /* R817 */ - 0x0000, /* R818 */ - 0x0000, /* R819 */ - 0x0000, /* R820 */ - 0x0000, /* R821 */ - 0x0000, /* R822 */ - 0x0000, /* R823 */ - 0x0000, /* R824 */ - 0x0000, /* R825 */ - 0x0000, /* R826 */ - 0x0000, /* R827 */ - 0x0000, /* R828 */ - 0x0000, /* R829 */ - 0x0000, /* R830 */ - 0x0000, /* R831 */ - 0x0000, /* R832 */ - 0x0000, /* R833 */ - 0x0000, /* R834 */ - 0x0000, /* R835 */ - 0x0000, /* R836 */ - 0x0000, /* R837 */ - 0x0000, /* R838 */ - 0x0000, /* R839 */ - 0x0000, /* R840 */ - 0x0000, /* R841 */ - 0x0000, /* R842 */ - 0x0000, /* R843 */ - 0x0000, /* R844 */ - 0x0000, /* R845 */ - 0x0000, /* R846 */ - 0x0000, /* R847 */ - 0x0000, /* R848 */ - 0x0000, /* R849 */ - 0x0000, /* R850 */ - 0x0000, /* R851 */ - 0x0000, /* R852 */ - 0x0000, /* R853 */ - 0x0000, /* R854 */ - 0x0000, /* R855 */ - 0x0000, /* R856 */ - 0x0000, /* R857 */ - 0x0000, /* R858 */ - 0x0000, /* R859 */ - 0x0000, /* R860 */ - 0x0000, /* R861 */ - 0x0000, /* R862 */ - 0x0000, /* R863 */ - 0x0000, /* R864 */ - 0x0000, /* R865 */ - 0x0000, /* R866 */ - 0x0000, /* R867 */ - 0x0000, /* R868 */ - 0x0000, /* R869 */ - 0x0000, /* R870 */ - 0x0000, /* R871 */ - 0x0000, /* R872 */ - 0x0000, /* R873 */ - 0x0000, /* R874 */ - 0x0000, /* R875 */ - 0x0000, /* R876 */ - 0x0000, /* R877 */ - 0x0000, /* R878 */ - 0x0000, /* R879 */ - 0x0000, /* R880 */ - 0x0000, /* R881 */ - 0x0000, /* R882 */ - 0x0000, /* R883 */ - 0x0000, /* R884 */ - 0x0000, /* R885 */ - 0x0000, /* R886 */ - 0x0000, /* R887 */ - 0x0000, /* R888 */ - 0x0000, /* R889 */ - 0x0000, /* R890 */ - 0x0000, /* R891 */ - 0x0000, /* R892 */ - 0x0000, /* R893 */ - 0x0000, /* R894 */ - 0x0000, /* R895 */ - 0x0000, /* R896 */ - 0x0000, /* R897 */ - 0x0000, /* R898 */ - 0x0000, /* R899 */ - 0x0000, /* R900 */ - 0x0000, /* R901 */ - 0x0000, /* R902 */ - 0x0000, /* R903 */ - 0x0000, /* R904 */ - 0x0000, /* R905 */ - 0x0000, /* R906 */ - 0x0000, /* R907 */ - 0x0000, /* R908 */ - 0x0000, /* R909 */ - 0x0000, /* R910 */ - 0x0000, /* R911 */ - 0x0000, /* R912 */ - 0x0000, /* R913 */ - 0x0000, /* R914 */ - 0x0000, /* R915 */ - 0x0000, /* R916 */ - 0x0000, /* R917 */ - 0x0000, /* R918 */ - 0x0000, /* R919 */ - 0x0000, /* R920 */ - 0x0000, /* R921 */ - 0x0000, /* R922 */ - 0x0000, /* R923 */ - 0x0000, /* R924 */ - 0x0000, /* R925 */ - 0x0000, /* R926 */ - 0x0000, /* R927 */ - 0x0000, /* R928 */ - 0x0000, /* R929 */ - 0x0000, /* R930 */ - 0x0000, /* R931 */ - 0x0000, /* R932 */ - 0x0000, /* R933 */ - 0x0000, /* R934 */ - 0x0000, /* R935 */ - 0x0000, /* R936 */ - 0x0000, /* R937 */ - 0x0000, /* R938 */ - 0x0000, /* R939 */ - 0x0000, /* R940 */ - 0x0000, /* R941 */ - 0x0000, /* R942 */ - 0x0000, /* R943 */ - 0x0000, /* R944 */ - 0x0000, /* R945 */ - 0x0000, /* R946 */ - 0x0000, /* R947 */ - 0x0000, /* R948 */ - 0x0000, /* R949 */ - 0x0000, /* R950 */ - 0x0000, /* R951 */ - 0x0000, /* R952 */ - 0x0000, /* R953 */ - 0x0000, /* R954 */ - 0x0000, /* R955 */ - 0x0000, /* R956 */ - 0x0000, /* R957 */ - 0x0000, /* R958 */ - 0x0000, /* R959 */ - 0x0000, /* R960 */ - 0x0000, /* R961 */ - 0x0000, /* R962 */ - 0x0000, /* R963 */ - 0x0000, /* R964 */ - 0x0000, /* R965 */ - 0x0000, /* R966 */ - 0x0000, /* R967 */ - 0x0000, /* R968 */ - 0x0000, /* R969 */ - 0x0000, /* R970 */ - 0x0000, /* R971 */ - 0x0000, /* R972 */ - 0x0000, /* R973 */ - 0x0000, /* R974 */ - 0x0000, /* R975 */ - 0x0000, /* R976 */ - 0x0000, /* R977 */ - 0x0000, /* R978 */ - 0x0000, /* R979 */ - 0x0000, /* R980 */ - 0x0000, /* R981 */ - 0x0000, /* R982 */ - 0x0000, /* R983 */ - 0x0000, /* R984 */ - 0x0000, /* R985 */ - 0x0000, /* R986 */ - 0x0000, /* R987 */ - 0x0000, /* R988 */ - 0x0000, /* R989 */ - 0x0000, /* R990 */ - 0x0000, /* R991 */ - 0x0000, /* R992 */ - 0x0000, /* R993 */ - 0x0000, /* R994 */ - 0x0000, /* R995 */ - 0x0000, /* R996 */ - 0x0000, /* R997 */ - 0x0000, /* R998 */ - 0x0000, /* R999 */ - 0x0000, /* R1000 */ - 0x0000, /* R1001 */ - 0x0000, /* R1002 */ - 0x0000, /* R1003 */ - 0x0000, /* R1004 */ - 0x0000, /* R1005 */ - 0x0000, /* R1006 */ - 0x0000, /* R1007 */ - 0x0000, /* R1008 */ - 0x0000, /* R1009 */ - 0x0000, /* R1010 */ - 0x0000, /* R1011 */ - 0x0000, /* R1012 */ - 0x0000, /* R1013 */ - 0x0000, /* R1014 */ - 0x0000, /* R1015 */ - 0x0000, /* R1016 */ - 0x0000, /* R1017 */ - 0x0000, /* R1018 */ - 0x0000, /* R1019 */ - 0x0000, /* R1020 */ - 0x0000, /* R1021 */ - 0x0000, /* R1022 */ - 0x0000, /* R1023 */ - 0x00C0, /* R1024 - AIF1 ADC1 Left Volume */ - 0x00C0, /* R1025 - AIF1 ADC1 Right Volume */ - 0x00C0, /* R1026 - AIF1 DAC1 Left Volume */ - 0x00C0, /* R1027 - AIF1 DAC1 Right Volume */ - 0x00C0, /* R1028 - AIF1 ADC2 Left Volume */ - 0x00C0, /* R1029 - AIF1 ADC2 Right Volume */ - 0x00C0, /* R1030 - AIF1 DAC2 Left Volume */ - 0x00C0, /* R1031 - AIF1 DAC2 Right Volume */ - 0x0000, /* R1032 */ - 0x0000, /* R1033 */ - 0x0000, /* R1034 */ - 0x0000, /* R1035 */ - 0x0000, /* R1036 */ - 0x0000, /* R1037 */ - 0x0000, /* R1038 */ - 0x0000, /* R1039 */ - 0x0000, /* R1040 - AIF1 ADC1 Filters */ - 0x0000, /* R1041 - AIF1 ADC2 Filters */ - 0x0000, /* R1042 */ - 0x0000, /* R1043 */ - 0x0000, /* R1044 */ - 0x0000, /* R1045 */ - 0x0000, /* R1046 */ - 0x0000, /* R1047 */ - 0x0000, /* R1048 */ - 0x0000, /* R1049 */ - 0x0000, /* R1050 */ - 0x0000, /* R1051 */ - 0x0000, /* R1052 */ - 0x0000, /* R1053 */ - 0x0000, /* R1054 */ - 0x0000, /* R1055 */ - 0x0200, /* R1056 - AIF1 DAC1 Filters (1) */ - 0x0010, /* R1057 - AIF1 DAC1 Filters (2) */ - 0x0200, /* R1058 - AIF1 DAC2 Filters (1) */ - 0x0010, /* R1059 - AIF1 DAC2 Filters (2) */ - 0x0000, /* R1060 */ - 0x0000, /* R1061 */ - 0x0000, /* R1062 */ - 0x0000, /* R1063 */ - 0x0000, /* R1064 */ - 0x0000, /* R1065 */ - 0x0000, /* R1066 */ - 0x0000, /* R1067 */ - 0x0000, /* R1068 */ - 0x0000, /* R1069 */ - 0x0000, /* R1070 */ - 0x0000, /* R1071 */ - 0x0068, /* R1072 - AIF1 DAC1 Noise Gate */ - 0x0068, /* R1073 - AIF1 DAC2 Noise Gate */ - 0x0000, /* R1074 */ - 0x0000, /* R1075 */ - 0x0000, /* R1076 */ - 0x0000, /* R1077 */ - 0x0000, /* R1078 */ - 0x0000, /* R1079 */ - 0x0000, /* R1080 */ - 0x0000, /* R1081 */ - 0x0000, /* R1082 */ - 0x0000, /* R1083 */ - 0x0000, /* R1084 */ - 0x0000, /* R1085 */ - 0x0000, /* R1086 */ - 0x0000, /* R1087 */ - 0x0098, /* R1088 - AIF1 DRC1 (1) */ - 0x0845, /* R1089 - AIF1 DRC1 (2) */ - 0x0000, /* R1090 - AIF1 DRC1 (3) */ - 0x0000, /* R1091 - AIF1 DRC1 (4) */ - 0x0000, /* R1092 - AIF1 DRC1 (5) */ - 0x0000, /* R1093 */ - 0x0000, /* R1094 */ - 0x0000, /* R1095 */ - 0x0000, /* R1096 */ - 0x0000, /* R1097 */ - 0x0000, /* R1098 */ - 0x0000, /* R1099 */ - 0x0000, /* R1100 */ - 0x0000, /* R1101 */ - 0x0000, /* R1102 */ - 0x0000, /* R1103 */ - 0x0098, /* R1104 - AIF1 DRC2 (1) */ - 0x0845, /* R1105 - AIF1 DRC2 (2) */ - 0x0000, /* R1106 - AIF1 DRC2 (3) */ - 0x0000, /* R1107 - AIF1 DRC2 (4) */ - 0x0000, /* R1108 - AIF1 DRC2 (5) */ - 0x0000, /* R1109 */ - 0x0000, /* R1110 */ - 0x0000, /* R1111 */ - 0x0000, /* R1112 */ - 0x0000, /* R1113 */ - 0x0000, /* R1114 */ - 0x0000, /* R1115 */ - 0x0000, /* R1116 */ - 0x0000, /* R1117 */ - 0x0000, /* R1118 */ - 0x0000, /* R1119 */ - 0x0000, /* R1120 */ - 0x0000, /* R1121 */ - 0x0000, /* R1122 */ - 0x0000, /* R1123 */ - 0x0000, /* R1124 */ - 0x0000, /* R1125 */ - 0x0000, /* R1126 */ - 0x0000, /* R1127 */ - 0x0000, /* R1128 */ - 0x0000, /* R1129 */ - 0x0000, /* R1130 */ - 0x0000, /* R1131 */ - 0x0000, /* R1132 */ - 0x0000, /* R1133 */ - 0x0000, /* R1134 */ - 0x0000, /* R1135 */ - 0x0000, /* R1136 */ - 0x0000, /* R1137 */ - 0x0000, /* R1138 */ - 0x0000, /* R1139 */ - 0x0000, /* R1140 */ - 0x0000, /* R1141 */ - 0x0000, /* R1142 */ - 0x0000, /* R1143 */ - 0x0000, /* R1144 */ - 0x0000, /* R1145 */ - 0x0000, /* R1146 */ - 0x0000, /* R1147 */ - 0x0000, /* R1148 */ - 0x0000, /* R1149 */ - 0x0000, /* R1150 */ - 0x0000, /* R1151 */ - 0x6318, /* R1152 - AIF1 DAC1 EQ Gains (1) */ - 0x6300, /* R1153 - AIF1 DAC1 EQ Gains (2) */ - 0x0FCA, /* R1154 - AIF1 DAC1 EQ Band 1 A */ - 0x0400, /* R1155 - AIF1 DAC1 EQ Band 1 B */ - 0x00D8, /* R1156 - AIF1 DAC1 EQ Band 1 PG */ - 0x1EB5, /* R1157 - AIF1 DAC1 EQ Band 2 A */ - 0xF145, /* R1158 - AIF1 DAC1 EQ Band 2 B */ - 0x0B75, /* R1159 - AIF1 DAC1 EQ Band 2 C */ - 0x01C5, /* R1160 - AIF1 DAC1 EQ Band 2 PG */ - 0x1C58, /* R1161 - AIF1 DAC1 EQ Band 3 A */ - 0xF373, /* R1162 - AIF1 DAC1 EQ Band 3 B */ - 0x0A54, /* R1163 - AIF1 DAC1 EQ Band 3 C */ - 0x0558, /* R1164 - AIF1 DAC1 EQ Band 3 PG */ - 0x168E, /* R1165 - AIF1 DAC1 EQ Band 4 A */ - 0xF829, /* R1166 - AIF1 DAC1 EQ Band 4 B */ - 0x07AD, /* R1167 - AIF1 DAC1 EQ Band 4 C */ - 0x1103, /* R1168 - AIF1 DAC1 EQ Band 4 PG */ - 0x0564, /* R1169 - AIF1 DAC1 EQ Band 5 A */ - 0x0559, /* R1170 - AIF1 DAC1 EQ Band 5 B */ - 0x4000, /* R1171 - AIF1 DAC1 EQ Band 5 PG */ - 0x0000, /* R1172 */ - 0x0000, /* R1173 */ - 0x0000, /* R1174 */ - 0x0000, /* R1175 */ - 0x0000, /* R1176 */ - 0x0000, /* R1177 */ - 0x0000, /* R1178 */ - 0x0000, /* R1179 */ - 0x0000, /* R1180 */ - 0x0000, /* R1181 */ - 0x0000, /* R1182 */ - 0x0000, /* R1183 */ - 0x6318, /* R1184 - AIF1 DAC2 EQ Gains (1) */ - 0x6300, /* R1185 - AIF1 DAC2 EQ Gains (2) */ - 0x0FCA, /* R1186 - AIF1 DAC2 EQ Band 1 A */ - 0x0400, /* R1187 - AIF1 DAC2 EQ Band 1 B */ - 0x00D8, /* R1188 - AIF1 DAC2 EQ Band 1 PG */ - 0x1EB5, /* R1189 - AIF1 DAC2 EQ Band 2 A */ - 0xF145, /* R1190 - AIF1 DAC2 EQ Band 2 B */ - 0x0B75, /* R1191 - AIF1 DAC2 EQ Band 2 C */ - 0x01C5, /* R1192 - AIF1 DAC2 EQ Band 2 PG */ - 0x1C58, /* R1193 - AIF1 DAC2 EQ Band 3 A */ - 0xF373, /* R1194 - AIF1 DAC2 EQ Band 3 B */ - 0x0A54, /* R1195 - AIF1 DAC2 EQ Band 3 C */ - 0x0558, /* R1196 - AIF1 DAC2 EQ Band 3 PG */ - 0x168E, /* R1197 - AIF1 DAC2 EQ Band 4 A */ - 0xF829, /* R1198 - AIF1 DAC2 EQ Band 4 B */ - 0x07AD, /* R1199 - AIF1 DAC2 EQ Band 4 C */ - 0x1103, /* R1200 - AIF1 DAC2 EQ Band 4 PG */ - 0x0564, /* R1201 - AIF1 DAC2 EQ Band 5 A */ - 0x0559, /* R1202 - AIF1 DAC2 EQ Band 5 B */ - 0x4000, /* R1203 - AIF1 DAC2 EQ Band 5 PG */ - 0x0000, /* R1204 */ - 0x0000, /* R1205 */ - 0x0000, /* R1206 */ - 0x0000, /* R1207 */ - 0x0000, /* R1208 */ - 0x0000, /* R1209 */ - 0x0000, /* R1210 */ - 0x0000, /* R1211 */ - 0x0000, /* R1212 */ - 0x0000, /* R1213 */ - 0x0000, /* R1214 */ - 0x0000, /* R1215 */ - 0x0000, /* R1216 */ - 0x0000, /* R1217 */ - 0x0000, /* R1218 */ - 0x0000, /* R1219 */ - 0x0000, /* R1220 */ - 0x0000, /* R1221 */ - 0x0000, /* R1222 */ - 0x0000, /* R1223 */ - 0x0000, /* R1224 */ - 0x0000, /* R1225 */ - 0x0000, /* R1226 */ - 0x0000, /* R1227 */ - 0x0000, /* R1228 */ - 0x0000, /* R1229 */ - 0x0000, /* R1230 */ - 0x0000, /* R1231 */ - 0x0000, /* R1232 */ - 0x0000, /* R1233 */ - 0x0000, /* R1234 */ - 0x0000, /* R1235 */ - 0x0000, /* R1236 */ - 0x0000, /* R1237 */ - 0x0000, /* R1238 */ - 0x0000, /* R1239 */ - 0x0000, /* R1240 */ - 0x0000, /* R1241 */ - 0x0000, /* R1242 */ - 0x0000, /* R1243 */ - 0x0000, /* R1244 */ - 0x0000, /* R1245 */ - 0x0000, /* R1246 */ - 0x0000, /* R1247 */ - 0x0000, /* R1248 */ - 0x0000, /* R1249 */ - 0x0000, /* R1250 */ - 0x0000, /* R1251 */ - 0x0000, /* R1252 */ - 0x0000, /* R1253 */ - 0x0000, /* R1254 */ - 0x0000, /* R1255 */ - 0x0000, /* R1256 */ - 0x0000, /* R1257 */ - 0x0000, /* R1258 */ - 0x0000, /* R1259 */ - 0x0000, /* R1260 */ - 0x0000, /* R1261 */ - 0x0000, /* R1262 */ - 0x0000, /* R1263 */ - 0x0000, /* R1264 */ - 0x0000, /* R1265 */ - 0x0000, /* R1266 */ - 0x0000, /* R1267 */ - 0x0000, /* R1268 */ - 0x0000, /* R1269 */ - 0x0000, /* R1270 */ - 0x0000, /* R1271 */ - 0x0000, /* R1272 */ - 0x0000, /* R1273 */ - 0x0000, /* R1274 */ - 0x0000, /* R1275 */ - 0x0000, /* R1276 */ - 0x0000, /* R1277 */ - 0x0000, /* R1278 */ - 0x0000, /* R1279 */ - 0x00C0, /* R1280 - AIF2 ADC Left Volume */ - 0x00C0, /* R1281 - AIF2 ADC Right Volume */ - 0x00C0, /* R1282 - AIF2 DAC Left Volume */ - 0x00C0, /* R1283 - AIF2 DAC Right Volume */ - 0x0000, /* R1284 */ - 0x0000, /* R1285 */ - 0x0000, /* R1286 */ - 0x0000, /* R1287 */ - 0x0000, /* R1288 */ - 0x0000, /* R1289 */ - 0x0000, /* R1290 */ - 0x0000, /* R1291 */ - 0x0000, /* R1292 */ - 0x0000, /* R1293 */ - 0x0000, /* R1294 */ - 0x0000, /* R1295 */ - 0x0000, /* R1296 - AIF2 ADC Filters */ - 0x0000, /* R1297 */ - 0x0000, /* R1298 */ - 0x0000, /* R1299 */ - 0x0000, /* R1300 */ - 0x0000, /* R1301 */ - 0x0000, /* R1302 */ - 0x0000, /* R1303 */ - 0x0000, /* R1304 */ - 0x0000, /* R1305 */ - 0x0000, /* R1306 */ - 0x0000, /* R1307 */ - 0x0000, /* R1308 */ - 0x0000, /* R1309 */ - 0x0000, /* R1310 */ - 0x0000, /* R1311 */ - 0x0200, /* R1312 - AIF2 DAC Filters (1) */ - 0x0010, /* R1313 - AIF2 DAC Filters (2) */ - 0x0000, /* R1314 */ - 0x0000, /* R1315 */ - 0x0000, /* R1316 */ - 0x0000, /* R1317 */ - 0x0000, /* R1318 */ - 0x0000, /* R1319 */ - 0x0000, /* R1320 */ - 0x0000, /* R1321 */ - 0x0000, /* R1322 */ - 0x0000, /* R1323 */ - 0x0000, /* R1324 */ - 0x0000, /* R1325 */ - 0x0000, /* R1326 */ - 0x0000, /* R1327 */ - 0x0068, /* R1328 - AIF2 DAC Noise Gate */ - 0x0000, /* R1329 */ - 0x0000, /* R1330 */ - 0x0000, /* R1331 */ - 0x0000, /* R1332 */ - 0x0000, /* R1333 */ - 0x0000, /* R1334 */ - 0x0000, /* R1335 */ - 0x0000, /* R1336 */ - 0x0000, /* R1337 */ - 0x0000, /* R1338 */ - 0x0000, /* R1339 */ - 0x0000, /* R1340 */ - 0x0000, /* R1341 */ - 0x0000, /* R1342 */ - 0x0000, /* R1343 */ - 0x0098, /* R1344 - AIF2 DRC (1) */ - 0x0845, /* R1345 - AIF2 DRC (2) */ - 0x0000, /* R1346 - AIF2 DRC (3) */ - 0x0000, /* R1347 - AIF2 DRC (4) */ - 0x0000, /* R1348 - AIF2 DRC (5) */ - 0x0000, /* R1349 */ - 0x0000, /* R1350 */ - 0x0000, /* R1351 */ - 0x0000, /* R1352 */ - 0x0000, /* R1353 */ - 0x0000, /* R1354 */ - 0x0000, /* R1355 */ - 0x0000, /* R1356 */ - 0x0000, /* R1357 */ - 0x0000, /* R1358 */ - 0x0000, /* R1359 */ - 0x0000, /* R1360 */ - 0x0000, /* R1361 */ - 0x0000, /* R1362 */ - 0x0000, /* R1363 */ - 0x0000, /* R1364 */ - 0x0000, /* R1365 */ - 0x0000, /* R1366 */ - 0x0000, /* R1367 */ - 0x0000, /* R1368 */ - 0x0000, /* R1369 */ - 0x0000, /* R1370 */ - 0x0000, /* R1371 */ - 0x0000, /* R1372 */ - 0x0000, /* R1373 */ - 0x0000, /* R1374 */ - 0x0000, /* R1375 */ - 0x0000, /* R1376 */ - 0x0000, /* R1377 */ - 0x0000, /* R1378 */ - 0x0000, /* R1379 */ - 0x0000, /* R1380 */ - 0x0000, /* R1381 */ - 0x0000, /* R1382 */ - 0x0000, /* R1383 */ - 0x0000, /* R1384 */ - 0x0000, /* R1385 */ - 0x0000, /* R1386 */ - 0x0000, /* R1387 */ - 0x0000, /* R1388 */ - 0x0000, /* R1389 */ - 0x0000, /* R1390 */ - 0x0000, /* R1391 */ - 0x0000, /* R1392 */ - 0x0000, /* R1393 */ - 0x0000, /* R1394 */ - 0x0000, /* R1395 */ - 0x0000, /* R1396 */ - 0x0000, /* R1397 */ - 0x0000, /* R1398 */ - 0x0000, /* R1399 */ - 0x0000, /* R1400 */ - 0x0000, /* R1401 */ - 0x0000, /* R1402 */ - 0x0000, /* R1403 */ - 0x0000, /* R1404 */ - 0x0000, /* R1405 */ - 0x0000, /* R1406 */ - 0x0000, /* R1407 */ - 0x6318, /* R1408 - AIF2 EQ Gains (1) */ - 0x6300, /* R1409 - AIF2 EQ Gains (2) */ - 0x0FCA, /* R1410 - AIF2 EQ Band 1 A */ - 0x0400, /* R1411 - AIF2 EQ Band 1 B */ - 0x00D8, /* R1412 - AIF2 EQ Band 1 PG */ - 0x1EB5, /* R1413 - AIF2 EQ Band 2 A */ - 0xF145, /* R1414 - AIF2 EQ Band 2 B */ - 0x0B75, /* R1415 - AIF2 EQ Band 2 C */ - 0x01C5, /* R1416 - AIF2 EQ Band 2 PG */ - 0x1C58, /* R1417 - AIF2 EQ Band 3 A */ - 0xF373, /* R1418 - AIF2 EQ Band 3 B */ - 0x0A54, /* R1419 - AIF2 EQ Band 3 C */ - 0x0558, /* R1420 - AIF2 EQ Band 3 PG */ - 0x168E, /* R1421 - AIF2 EQ Band 4 A */ - 0xF829, /* R1422 - AIF2 EQ Band 4 B */ - 0x07AD, /* R1423 - AIF2 EQ Band 4 C */ - 0x1103, /* R1424 - AIF2 EQ Band 4 PG */ - 0x0564, /* R1425 - AIF2 EQ Band 5 A */ - 0x0559, /* R1426 - AIF2 EQ Band 5 B */ - 0x4000, /* R1427 - AIF2 EQ Band 5 PG */ - 0x0000, /* R1428 */ - 0x0000, /* R1429 */ - 0x0000, /* R1430 */ - 0x0000, /* R1431 */ - 0x0000, /* R1432 */ - 0x0000, /* R1433 */ - 0x0000, /* R1434 */ - 0x0000, /* R1435 */ - 0x0000, /* R1436 */ - 0x0000, /* R1437 */ - 0x0000, /* R1438 */ - 0x0000, /* R1439 */ - 0x0000, /* R1440 */ - 0x0000, /* R1441 */ - 0x0000, /* R1442 */ - 0x0000, /* R1443 */ - 0x0000, /* R1444 */ - 0x0000, /* R1445 */ - 0x0000, /* R1446 */ - 0x0000, /* R1447 */ - 0x0000, /* R1448 */ - 0x0000, /* R1449 */ - 0x0000, /* R1450 */ - 0x0000, /* R1451 */ - 0x0000, /* R1452 */ - 0x0000, /* R1453 */ - 0x0000, /* R1454 */ - 0x0000, /* R1455 */ - 0x0000, /* R1456 */ - 0x0000, /* R1457 */ - 0x0000, /* R1458 */ - 0x0000, /* R1459 */ - 0x0000, /* R1460 */ - 0x0000, /* R1461 */ - 0x0000, /* R1462 */ - 0x0000, /* R1463 */ - 0x0000, /* R1464 */ - 0x0000, /* R1465 */ - 0x0000, /* R1466 */ - 0x0000, /* R1467 */ - 0x0000, /* R1468 */ - 0x0000, /* R1469 */ - 0x0000, /* R1470 */ - 0x0000, /* R1471 */ - 0x0000, /* R1472 */ - 0x0000, /* R1473 */ - 0x0000, /* R1474 */ - 0x0000, /* R1475 */ - 0x0000, /* R1476 */ - 0x0000, /* R1477 */ - 0x0000, /* R1478 */ - 0x0000, /* R1479 */ - 0x0000, /* R1480 */ - 0x0000, /* R1481 */ - 0x0000, /* R1482 */ - 0x0000, /* R1483 */ - 0x0000, /* R1484 */ - 0x0000, /* R1485 */ - 0x0000, /* R1486 */ - 0x0000, /* R1487 */ - 0x0000, /* R1488 */ - 0x0000, /* R1489 */ - 0x0000, /* R1490 */ - 0x0000, /* R1491 */ - 0x0000, /* R1492 */ - 0x0000, /* R1493 */ - 0x0000, /* R1494 */ - 0x0000, /* R1495 */ - 0x0000, /* R1496 */ - 0x0000, /* R1497 */ - 0x0000, /* R1498 */ - 0x0000, /* R1499 */ - 0x0000, /* R1500 */ - 0x0000, /* R1501 */ - 0x0000, /* R1502 */ - 0x0000, /* R1503 */ - 0x0000, /* R1504 */ - 0x0000, /* R1505 */ - 0x0000, /* R1506 */ - 0x0000, /* R1507 */ - 0x0000, /* R1508 */ - 0x0000, /* R1509 */ - 0x0000, /* R1510 */ - 0x0000, /* R1511 */ - 0x0000, /* R1512 */ - 0x0000, /* R1513 */ - 0x0000, /* R1514 */ - 0x0000, /* R1515 */ - 0x0000, /* R1516 */ - 0x0000, /* R1517 */ - 0x0000, /* R1518 */ - 0x0000, /* R1519 */ - 0x0000, /* R1520 */ - 0x0000, /* R1521 */ - 0x0000, /* R1522 */ - 0x0000, /* R1523 */ - 0x0000, /* R1524 */ - 0x0000, /* R1525 */ - 0x0000, /* R1526 */ - 0x0000, /* R1527 */ - 0x0000, /* R1528 */ - 0x0000, /* R1529 */ - 0x0000, /* R1530 */ - 0x0000, /* R1531 */ - 0x0000, /* R1532 */ - 0x0000, /* R1533 */ - 0x0000, /* R1534 */ - 0x0000, /* R1535 */ - 0x0000, /* R1536 - DAC1 Mixer Volumes */ - 0x0000, /* R1537 - DAC1 Left Mixer Routing */ - 0x0000, /* R1538 - DAC1 Right Mixer Routing */ - 0x0000, /* R1539 - DAC2 Mixer Volumes */ - 0x0000, /* R1540 - DAC2 Left Mixer Routing */ - 0x0000, /* R1541 - DAC2 Right Mixer Routing */ - 0x0000, /* R1542 - AIF1 ADC1 Left Mixer Routing */ - 0x0000, /* R1543 - AIF1 ADC1 Right Mixer Routing */ - 0x0000, /* R1544 - AIF1 ADC2 Left Mixer Routing */ - 0x0000, /* R1545 - AIF1 ADC2 Right mixer Routing */ - 0x0000, /* R1546 */ - 0x0000, /* R1547 */ - 0x0000, /* R1548 */ - 0x0000, /* R1549 */ - 0x0000, /* R1550 */ - 0x0000, /* R1551 */ - 0x02C0, /* R1552 - DAC1 Left Volume */ - 0x02C0, /* R1553 - DAC1 Right Volume */ - 0x02C0, /* R1554 - DAC2 Left Volume */ - 0x02C0, /* R1555 - DAC2 Right Volume */ - 0x0000, /* R1556 - DAC Softmute */ - 0x0000, /* R1557 */ - 0x0000, /* R1558 */ - 0x0000, /* R1559 */ - 0x0000, /* R1560 */ - 0x0000, /* R1561 */ - 0x0000, /* R1562 */ - 0x0000, /* R1563 */ - 0x0000, /* R1564 */ - 0x0000, /* R1565 */ - 0x0000, /* R1566 */ - 0x0000, /* R1567 */ - 0x0002, /* R1568 - Oversampling */ - 0x0000, /* R1569 - Sidetone */ -}; diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 2858908..a993690 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -123,67 +123,6 @@ static void wm8958_micd_set_rate(struct snd_soc_codec *codec) WM8958_MICD_RATE_MASK, val); } -static int wm8994_readable(struct snd_soc_codec *codec, unsigned int reg) -{ - struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); - struct wm8994 *control = wm8994->wm8994; - - switch (reg) { - case WM8994_GPIO_1: - case WM8994_GPIO_2: - case WM8994_GPIO_3: - case WM8994_GPIO_4: - case WM8994_GPIO_5: - case WM8994_GPIO_6: - case WM8994_GPIO_7: - case WM8994_GPIO_8: - case WM8994_GPIO_9: - case WM8994_GPIO_10: - case WM8994_GPIO_11: - case WM8994_INTERRUPT_STATUS_1: - case WM8994_INTERRUPT_STATUS_2: - case WM8994_INTERRUPT_RAW_STATUS_2: - return 1; - - case WM8958_DSP2_PROGRAM: - case WM8958_DSP2_CONFIG: - case WM8958_DSP2_EXECCONTROL: - if (control->type == WM8958) - return 1; - else - return 0; - - default: - break; - } - - if (reg >= WM8994_CACHE_SIZE) - return 0; - return wm8994_access_masks[reg].readable != 0; -} - -static int wm8994_volatile(struct snd_soc_codec *codec, unsigned int reg) -{ - if (reg >= WM8994_CACHE_SIZE) - return 1; - - switch (reg) { - case WM8994_SOFTWARE_RESET: - case WM8994_CHIP_REVISION: - case WM8994_DC_SERVO_1: - case WM8994_DC_SERVO_READBACK: - case WM8994_RATE_STATUS: - case WM8994_LDO_1: - case WM8994_LDO_2: - case WM8958_DSP2_EXECCONTROL: - case WM8958_MIC_DETECT_3: - case WM8994_DC_SERVO_4E: - return 1; - default: - return 0; - } -} - static int configure_aif_clock(struct snd_soc_codec *codec, int aif) { struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); @@ -3451,25 +3390,6 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) pm_runtime_enable(codec->dev); pm_runtime_resume(codec->dev); - /* Read our current status back from the chip - we don't want to - * reset as this may interfere with the GPIO or LDO operation. */ - for (i = 0; i < WM8994_CACHE_SIZE; i++) { - if (!wm8994_readable(codec, i) || wm8994_volatile(codec, i)) - continue; - - ret = regmap_read(control->regmap, i, ®); - if (ret <= 0) - continue; - - ret = snd_soc_cache_write(codec, i, reg); - if (ret != 0) { - dev_err(codec->dev, - "Failed to initialise cache for 0x%x: %d\n", - i, ret); - goto err; - } - } - /* Set revision-specific configuration */ wm8994->revision = snd_soc_read(codec, WM8994_CHIP_REVISION); switch (control->type) { @@ -3900,14 +3820,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { .remove = wm8994_codec_remove, .suspend = wm8994_suspend, .resume = wm8994_resume, - .readable_register = wm8994_readable, - .volatile_register = wm8994_volatile, .set_bias_level = wm8994_set_bias_level, - - .reg_cache_size = WM8994_CACHE_SIZE, - .reg_cache_default = wm8994_reg_defaults, - .reg_word_size = 2, - .compress_type = SND_SOC_RBTREE_COMPRESSION, }; static int __devinit wm8994_probe(struct platform_device *pdev) diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index 6ef3f11..c3a4247 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h @@ -39,16 +39,6 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, wm8958_micdet_cb cb, void *cb_data); -#define WM8994_CACHE_SIZE 1570 - -struct wm8994_access_mask { - unsigned short readable; /* Mask of readable bits */ - unsigned short writable; /* Mask of writable bits */ -}; - -extern const struct wm8994_access_mask wm8994_access_masks[WM8994_CACHE_SIZE]; -extern const u16 wm8994_reg_defaults[WM8994_CACHE_SIZE]; - int wm8958_aif_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); -- cgit v1.1 From 1dfb6efd87d63d2efef6e985770d5dd642f83146 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 10 Nov 2011 17:39:40 +0000 Subject: ASoC: Remove rbtree register cache All users now use regmap directly so delete the ASoC version of the code. Signed-off-by: Mark Brown --- sound/soc/soc-cache.c | 381 -------------------------------------------------- 1 file changed, 381 deletions(-) (limited to 'sound') diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 18bb6b3..9d56f02 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c @@ -66,378 +66,6 @@ static unsigned int snd_soc_get_cache_val(const void *base, unsigned int idx, return -1; } -struct snd_soc_rbtree_node { - struct rb_node node; /* the actual rbtree node holding this block */ - unsigned int base_reg; /* base register handled by this block */ - unsigned int word_size; /* number of bytes needed to represent the register index */ - void *block; /* block of adjacent registers */ - unsigned int blklen; /* number of registers available in the block */ -} __attribute__ ((packed)); - -struct snd_soc_rbtree_ctx { - struct rb_root root; - struct snd_soc_rbtree_node *cached_rbnode; -}; - -static inline void snd_soc_rbtree_get_base_top_reg( - struct snd_soc_rbtree_node *rbnode, - unsigned int *base, unsigned int *top) -{ - *base = rbnode->base_reg; - *top = rbnode->base_reg + rbnode->blklen - 1; -} - -static unsigned int snd_soc_rbtree_get_register( - struct snd_soc_rbtree_node *rbnode, unsigned int idx) -{ - unsigned int val; - - switch (rbnode->word_size) { - case 1: { - u8 *p = rbnode->block; - val = p[idx]; - return val; - } - case 2: { - u16 *p = rbnode->block; - val = p[idx]; - return val; - } - default: - BUG(); - break; - } - return -1; -} - -static void snd_soc_rbtree_set_register(struct snd_soc_rbtree_node *rbnode, - unsigned int idx, unsigned int val) -{ - switch (rbnode->word_size) { - case 1: { - u8 *p = rbnode->block; - p[idx] = val; - break; - } - case 2: { - u16 *p = rbnode->block; - p[idx] = val; - break; - } - default: - BUG(); - break; - } -} - -static struct snd_soc_rbtree_node *snd_soc_rbtree_lookup( - struct rb_root *root, unsigned int reg) -{ - struct rb_node *node; - struct snd_soc_rbtree_node *rbnode; - unsigned int base_reg, top_reg; - - node = root->rb_node; - while (node) { - rbnode = container_of(node, struct snd_soc_rbtree_node, node); - snd_soc_rbtree_get_base_top_reg(rbnode, &base_reg, &top_reg); - if (reg >= base_reg && reg <= top_reg) - return rbnode; - else if (reg > top_reg) - node = node->rb_right; - else if (reg < base_reg) - node = node->rb_left; - } - - return NULL; -} - -static int snd_soc_rbtree_insert(struct rb_root *root, - struct snd_soc_rbtree_node *rbnode) -{ - struct rb_node **new, *parent; - struct snd_soc_rbtree_node *rbnode_tmp; - unsigned int base_reg_tmp, top_reg_tmp; - unsigned int base_reg; - - parent = NULL; - new = &root->rb_node; - while (*new) { - rbnode_tmp = container_of(*new, struct snd_soc_rbtree_node, - node); - /* base and top registers of the current rbnode */ - snd_soc_rbtree_get_base_top_reg(rbnode_tmp, &base_reg_tmp, - &top_reg_tmp); - /* base register of the rbnode to be added */ - base_reg = rbnode->base_reg; - parent = *new; - /* if this register has already been inserted, just return */ - if (base_reg >= base_reg_tmp && - base_reg <= top_reg_tmp) - return 0; - else if (base_reg > top_reg_tmp) - new = &((*new)->rb_right); - else if (base_reg < base_reg_tmp) - new = &((*new)->rb_left); - } - - /* insert the node into the rbtree */ - rb_link_node(&rbnode->node, parent, new); - rb_insert_color(&rbnode->node, root); - - return 1; -} - -static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec) -{ - struct snd_soc_rbtree_ctx *rbtree_ctx; - struct rb_node *node; - struct snd_soc_rbtree_node *rbnode; - unsigned int regtmp; - unsigned int val, def; - int ret; - int i; - - rbtree_ctx = codec->reg_cache; - for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) { - rbnode = rb_entry(node, struct snd_soc_rbtree_node, node); - for (i = 0; i < rbnode->blklen; ++i) { - regtmp = rbnode->base_reg + i; - val = snd_soc_rbtree_get_register(rbnode, i); - def = snd_soc_get_cache_val(codec->reg_def_copy, i, - rbnode->word_size); - if (val == def) - continue; - - WARN_ON(!snd_soc_codec_writable_register(codec, regtmp)); - - codec->cache_bypass = 1; - ret = snd_soc_write(codec, regtmp, val); - codec->cache_bypass = 0; - if (ret) - return ret; - dev_dbg(codec->dev, "Synced register %#x, value = %#x\n", - regtmp, val); - } - } - - return 0; -} - -static int snd_soc_rbtree_insert_to_block(struct snd_soc_rbtree_node *rbnode, - unsigned int pos, unsigned int reg, - unsigned int value) -{ - u8 *blk; - - blk = krealloc(rbnode->block, - (rbnode->blklen + 1) * rbnode->word_size, GFP_KERNEL); - if (!blk) - return -ENOMEM; - - /* insert the register value in the correct place in the rbnode block */ - memmove(blk + (pos + 1) * rbnode->word_size, - blk + pos * rbnode->word_size, - (rbnode->blklen - pos) * rbnode->word_size); - - /* update the rbnode block, its size and the base register */ - rbnode->block = blk; - rbnode->blklen++; - if (!pos) - rbnode->base_reg = reg; - - snd_soc_rbtree_set_register(rbnode, pos, value); - return 0; -} - -static int snd_soc_rbtree_cache_write(struct snd_soc_codec *codec, - unsigned int reg, unsigned int value) -{ - struct snd_soc_rbtree_ctx *rbtree_ctx; - struct snd_soc_rbtree_node *rbnode, *rbnode_tmp; - struct rb_node *node; - unsigned int val; - unsigned int reg_tmp; - unsigned int base_reg, top_reg; - unsigned int pos; - int i; - int ret; - - rbtree_ctx = codec->reg_cache; - /* look up the required register in the cached rbnode */ - rbnode = rbtree_ctx->cached_rbnode; - if (rbnode) { - snd_soc_rbtree_get_base_top_reg(rbnode, &base_reg, &top_reg); - if (reg >= base_reg && reg <= top_reg) { - reg_tmp = reg - base_reg; - val = snd_soc_rbtree_get_register(rbnode, reg_tmp); - if (val == value) - return 0; - snd_soc_rbtree_set_register(rbnode, reg_tmp, value); - return 0; - } - } - /* if we can't locate it in the cached rbnode we'll have - * to traverse the rbtree looking for it. - */ - rbnode = snd_soc_rbtree_lookup(&rbtree_ctx->root, reg); - if (rbnode) { - reg_tmp = reg - rbnode->base_reg; - val = snd_soc_rbtree_get_register(rbnode, reg_tmp); - if (val == value) - return 0; - snd_soc_rbtree_set_register(rbnode, reg_tmp, value); - rbtree_ctx->cached_rbnode = rbnode; - } else { - /* bail out early, no need to create the rbnode yet */ - if (!value) - return 0; - /* look for an adjacent register to the one we are about to add */ - for (node = rb_first(&rbtree_ctx->root); node; - node = rb_next(node)) { - rbnode_tmp = rb_entry(node, struct snd_soc_rbtree_node, node); - for (i = 0; i < rbnode_tmp->blklen; ++i) { - reg_tmp = rbnode_tmp->base_reg + i; - if (abs(reg_tmp - reg) != 1) - continue; - /* decide where in the block to place our register */ - if (reg_tmp + 1 == reg) - pos = i + 1; - else - pos = i; - ret = snd_soc_rbtree_insert_to_block(rbnode_tmp, pos, - reg, value); - if (ret) - return ret; - rbtree_ctx->cached_rbnode = rbnode_tmp; - return 0; - } - } - /* we did not manage to find a place to insert it in an existing - * block so create a new rbnode with a single register in its block. - * This block will get populated further if any other adjacent - * registers get modified in the future. - */ - rbnode = kzalloc(sizeof *rbnode, GFP_KERNEL); - if (!rbnode) - return -ENOMEM; - rbnode->blklen = 1; - rbnode->base_reg = reg; - rbnode->word_size = codec->driver->reg_word_size; - rbnode->block = kmalloc(rbnode->blklen * rbnode->word_size, - GFP_KERNEL); - if (!rbnode->block) { - kfree(rbnode); - return -ENOMEM; - } - snd_soc_rbtree_set_register(rbnode, 0, value); - snd_soc_rbtree_insert(&rbtree_ctx->root, rbnode); - rbtree_ctx->cached_rbnode = rbnode; - } - - return 0; -} - -static int snd_soc_rbtree_cache_read(struct snd_soc_codec *codec, - unsigned int reg, unsigned int *value) -{ - struct snd_soc_rbtree_ctx *rbtree_ctx; - struct snd_soc_rbtree_node *rbnode; - unsigned int base_reg, top_reg; - unsigned int reg_tmp; - - rbtree_ctx = codec->reg_cache; - /* look up the required register in the cached rbnode */ - rbnode = rbtree_ctx->cached_rbnode; - if (rbnode) { - snd_soc_rbtree_get_base_top_reg(rbnode, &base_reg, &top_reg); - if (reg >= base_reg && reg <= top_reg) { - reg_tmp = reg - base_reg; - *value = snd_soc_rbtree_get_register(rbnode, reg_tmp); - return 0; - } - } - /* if we can't locate it in the cached rbnode we'll have - * to traverse the rbtree looking for it. - */ - rbnode = snd_soc_rbtree_lookup(&rbtree_ctx->root, reg); - if (rbnode) { - reg_tmp = reg - rbnode->base_reg; - *value = snd_soc_rbtree_get_register(rbnode, reg_tmp); - rbtree_ctx->cached_rbnode = rbnode; - } else { - /* uninitialized registers default to 0 */ - *value = 0; - } - - return 0; -} - -static int snd_soc_rbtree_cache_exit(struct snd_soc_codec *codec) -{ - struct rb_node *next; - struct snd_soc_rbtree_ctx *rbtree_ctx; - struct snd_soc_rbtree_node *rbtree_node; - - /* if we've already been called then just return */ - rbtree_ctx = codec->reg_cache; - if (!rbtree_ctx) - return 0; - - /* free up the rbtree */ - next = rb_first(&rbtree_ctx->root); - while (next) { - rbtree_node = rb_entry(next, struct snd_soc_rbtree_node, node); - next = rb_next(&rbtree_node->node); - rb_erase(&rbtree_node->node, &rbtree_ctx->root); - kfree(rbtree_node->block); - kfree(rbtree_node); - } - - /* release the resources */ - kfree(codec->reg_cache); - codec->reg_cache = NULL; - - return 0; -} - -static int snd_soc_rbtree_cache_init(struct snd_soc_codec *codec) -{ - struct snd_soc_rbtree_ctx *rbtree_ctx; - unsigned int word_size; - unsigned int val; - int i; - int ret; - - codec->reg_cache = kmalloc(sizeof *rbtree_ctx, GFP_KERNEL); - if (!codec->reg_cache) - return -ENOMEM; - - rbtree_ctx = codec->reg_cache; - rbtree_ctx->root = RB_ROOT; - rbtree_ctx->cached_rbnode = NULL; - - if (!codec->reg_def_copy) - return 0; - - word_size = codec->driver->reg_word_size; - for (i = 0; i < codec->driver->reg_cache_size; ++i) { - val = snd_soc_get_cache_val(codec->reg_def_copy, i, - word_size); - if (!val) - continue; - ret = snd_soc_rbtree_cache_write(codec, i, val); - if (ret) - goto err; - } - - return 0; - -err: - snd_soc_cache_exit(codec); - return ret; -} - static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec) { int i; @@ -516,15 +144,6 @@ static const struct snd_soc_cache_ops cache_types[] = { .write = snd_soc_flat_cache_write, .sync = snd_soc_flat_cache_sync }, - { - .id = SND_SOC_RBTREE_COMPRESSION, - .name = "rbtree", - .init = snd_soc_rbtree_cache_init, - .exit = snd_soc_rbtree_cache_exit, - .read = snd_soc_rbtree_cache_read, - .write = snd_soc_rbtree_cache_write, - .sync = snd_soc_rbtree_cache_sync - } }; int snd_soc_cache_init(struct snd_soc_codec *codec) -- cgit v1.1 From a0e17b4e3e09e49d218958fdce09da407573a574 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 13 Dec 2011 10:13:13 +0800 Subject: ASoC: Staticise rx51_aux_dev Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/omap/rx51.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c index 4cabb74..ad16db5 100644 --- a/sound/soc/omap/rx51.c +++ b/sound/soc/omap/rx51.c @@ -365,7 +365,7 @@ static struct snd_soc_dai_link rx51_dai[] = { }, }; -struct snd_soc_aux_dev rx51_aux_dev[] = { +static struct snd_soc_aux_dev rx51_aux_dev[] = { { .name = "TLV320AIC34b", .codec_name = "tlv320aic3x-codec.2-0019", -- cgit v1.1 From bba59f332687884e98c920e6c27278824d194c24 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 13 Dec 2011 10:14:30 +0800 Subject: ASoC: Staticise au1xpsc_soc_platform Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/au1x/dbdma2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c index 09699de..92bc1b0 100644 --- a/sound/soc/au1x/dbdma2.c +++ b/sound/soc/au1x/dbdma2.c @@ -341,7 +341,7 @@ static int au1xpsc_pcm_new(struct snd_soc_pcm_runtime *rtd) } /* au1xpsc audio platform */ -struct snd_soc_platform_driver au1xpsc_soc_platform = { +static struct snd_soc_platform_driver au1xpsc_soc_platform = { .ops = &au1xpsc_pcm_ops, .pcm_new = au1xpsc_pcm_new, .pcm_free = au1xpsc_pcm_free_dma_buffers, -- cgit v1.1 From 796ba9001dfd5cdf19926f374015e514ea2eaa51 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 13 Dec 2011 10:15:40 +0800 Subject: ASoC: Staticise alchemy_pcm_soc_platform Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/au1x/dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/au1x/dma.c b/sound/soc/au1x/dma.c index dc4dae4..c4017bd 100644 --- a/sound/soc/au1x/dma.c +++ b/sound/soc/au1x/dma.c @@ -316,7 +316,7 @@ static int alchemy_pcm_new(struct snd_soc_pcm_runtime *rtd) return 0; } -struct snd_soc_platform_driver alchemy_pcm_soc_platform = { +static struct snd_soc_platform_driver alchemy_pcm_soc_platform = { .ops = &alchemy_pcm_ops, .pcm_new = alchemy_pcm_new, .pcm_free = alchemy_pcm_free_dma_buffers, -- cgit v1.1 From 9215aa4d96add60e95adccbcb11b1dc16a8c3422 Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Mon, 12 Dec 2011 21:43:45 +0200 Subject: ASoC: Rename ALC5632 MICBIAS to common name convention. Signed-off-by: Leon Romanovsky Signed-off-by: Mark Brown --- sound/soc/codecs/alc5632.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index 08613c7..390e437d 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -379,8 +379,8 @@ SND_SOC_DAPM_PGA("MIC1 PGA", ALC5632_PWR_MANAG_ADD3, 3, 0, NULL, 0), SND_SOC_DAPM_PGA("MIC2 PGA", ALC5632_PWR_MANAG_ADD3, 2, 0, NULL, 0), SND_SOC_DAPM_PGA("MIC1 Pre Amp", ALC5632_PWR_MANAG_ADD3, 1, 0, NULL, 0), SND_SOC_DAPM_PGA("MIC2 Pre Amp", ALC5632_PWR_MANAG_ADD3, 0, 0, NULL, 0), -SND_SOC_DAPM_SUPPLY("Mic Bias1", ALC5632_PWR_MANAG_ADD1, 3, 0, NULL, 0), -SND_SOC_DAPM_SUPPLY("Mic Bias2", ALC5632_PWR_MANAG_ADD1, 2, 0, NULL, 0), +SND_SOC_DAPM_SUPPLY("MICBIAS1", ALC5632_PWR_MANAG_ADD1, 3, 0, NULL, 0), +SND_SOC_DAPM_SUPPLY("MICBIAS2", ALC5632_PWR_MANAG_ADD1, 2, 0, NULL, 0), SND_SOC_DAPM_PGA_E("D Amp", ALC5632_PWR_MANAG_ADD2, 14, 0, NULL, 0, amp_mixer_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), -- cgit v1.1 From 6a557c94737a261f1b78767c7c41406206dd25c8 Mon Sep 17 00:00:00 2001 From: Vitaliy Kulikov Date: Mon, 12 Dec 2011 17:35:13 -0600 Subject: ALSA: hda - GPIO to control mute LED may be enabled on HP systems with no such HW This may lead to problems (like loss of sound) as GPIO pin may be used for different function (SPDIF OUT, EAPD etc) on those systems. This patch disables default mute LED GPIO configuration on all new codecs as all new HP systems are expected to provide explicit mute LED configuration in SMBIOS. Signed-off-by: Vitaliy Kulikov Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index eeb25d52..85740e0 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4903,7 +4903,7 @@ static void set_hp_led_gpio(struct hda_codec *codec) * Need more information on whether it is true across the entire series. * -- kunal */ -static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity) +static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity) { struct sigmatel_spec *spec = codec->spec; const struct dmi_device *dev = NULL; @@ -4933,9 +4933,11 @@ static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity) /* * Fallback case - if we don't find the DMI strings, - * we statically set the GPIO - if not a B-series system. + * we statically set the GPIO - if not a B-series system + * and default polarity is provided */ - if (!hp_blike_system(codec->subsystem_id)) { + if (!hp_blike_system(codec->subsystem_id) && + (default_polarity == 0 || default_polarity == 1)) { set_hp_led_gpio(codec); spec->gpio_led_polarity = default_polarity; return 1; @@ -5645,7 +5647,7 @@ again: codec->patch_ops = stac92xx_patch_ops; - if (find_mute_led_gpio(codec, 0)) + if (find_mute_led_cfg(codec, -1/*no default cfg*/)) snd_printd("mute LED gpio %d polarity %d\n", spec->gpio_led, spec->gpio_led_polarity); @@ -5958,7 +5960,7 @@ again: } } - if (find_mute_led_gpio(codec, 1)) + if (find_mute_led_cfg(codec, 1)) snd_printd("mute LED gpio %d polarity %d\n", spec->gpio_led, spec->gpio_led_polarity); -- cgit v1.1 From 6f8d272a440ca7c61f5727300cbae642759d6765 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 14 Dec 2011 11:20:42 +0800 Subject: ASoC: Fix wm8995 regmap usage Signed-off-by: Mark Brown --- sound/soc/codecs/wm8995.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c index 5863406..c8aada5 100644 --- a/sound/soc/codecs/wm8995.c +++ b/sound/soc/codecs/wm8995.c @@ -2051,6 +2051,7 @@ static int wm8995_probe(struct snd_soc_codec *codec) wm8995 = snd_soc_codec_get_drvdata(codec); wm8995->codec = codec; + codec->control_data = wm8995->regmap; ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); if (ret < 0) { dev_err(codec->dev, "Failed to set cache i/o: %d\n", ret); -- cgit v1.1 From 8858d21891ad6aecced34c31ae961584ad418522 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 12 Dec 2011 22:47:25 +0800 Subject: ASoC: Staticise asoc_idma_platform Signed-off-by: Mark Brown Acked-by: Sangbeom Kim --- sound/soc/samsung/idma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c index baf97eb..2bcf758 100644 --- a/sound/soc/samsung/idma.c +++ b/sound/soc/samsung/idma.c @@ -410,7 +410,7 @@ void idma_reg_addr_init(void __iomem *regs, dma_addr_t addr) idma.lp_tx_addr = addr; } -struct snd_soc_platform_driver asoc_idma_platform = { +static struct snd_soc_platform_driver asoc_idma_platform = { .ops = &idma_ops, .pcm_new = idma_new, .pcm_free = idma_free, -- cgit v1.1 From 0c9f110574bdde21ac62b948272a90f6e72b94d8 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 12 Dec 2011 19:05:58 +0800 Subject: ASoC: Complete initialisation before registering Samsung PCM DAI Otherwise there's a race where the DAI might get used without everything having been set up. Signed-off-by: Mark Brown Acked-by: Sangbeom Kim --- sound/soc/samsung/pcm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c index beef63f..3a29c26 100644 --- a/sound/soc/samsung/pcm.c +++ b/sound/soc/samsung/pcm.c @@ -570,12 +570,6 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) } clk_enable(pcm->pclk); - ret = snd_soc_register_dai(&pdev->dev, &s3c_pcm_dai[pdev->id]); - if (ret != 0) { - dev_err(&pdev->dev, "failed to get pcm_clock\n"); - goto err5; - } - s3c_pcm_stereo_in[pdev->id].dma_addr = mem_res->start + S3C_PCM_RXFIFO; s3c_pcm_stereo_out[pdev->id].dma_addr = mem_res->start @@ -587,6 +581,12 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) pcm->dma_capture = &s3c_pcm_stereo_in[pdev->id]; pcm->dma_playback = &s3c_pcm_stereo_out[pdev->id]; + ret = snd_soc_register_dai(&pdev->dev, &s3c_pcm_dai[pdev->id]); + if (ret != 0) { + dev_err(&pdev->dev, "failed to get register DAI: %d\n", ret); + goto err5; + } + return 0; err5: -- cgit v1.1 From 92f6d63bf1366a9dae18965cdb4a950b5ece3a64 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 13 Dec 2011 20:23:50 +0800 Subject: ASoC: Remove unused extern declarations for sh4_hac_dai and sh7760_soc_platform Both sh4_hac_dai and sh7760_soc_platform are changed to static by multi-component patch and they are not used in sh7760-ac97.c now. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/sh/sh7760-ac97.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/sh/sh7760-ac97.c b/sound/soc/sh/sh7760-ac97.c index c62ae68..df651e8 100644 --- a/sound/soc/sh/sh7760-ac97.c +++ b/sound/soc/sh/sh7760-ac97.c @@ -16,10 +16,6 @@ #define IPSEL 0xFE400034 -/* platform specific structs can be declared here */ -extern struct snd_soc_dai_driver sh4_hac_dai[2]; -extern struct snd_soc_platform_driver sh7760_soc_platform; - static struct snd_soc_dai_link sh7760_ac97_dai = { .name = "AC97", .stream_name = "AC97 HiFi", -- cgit v1.1 From 8faa8c1a5520c1e21372f2016355f4b5c2349bb2 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 13 Dec 2011 17:13:45 +0800 Subject: ASoC: Staticise sst_pcm_new and sst_soc_platform_drv Signed-off-by: Axel Lin Acked-by Vinod Koul Acked-by: Lu Guanqun Signed-off-by: Mark Brown --- sound/soc/mid-x86/sst_platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c index 24f9471..5b936d5 100644 --- a/sound/soc/mid-x86/sst_platform.c +++ b/sound/soc/mid-x86/sst_platform.c @@ -443,7 +443,7 @@ static void sst_pcm_free(struct snd_pcm *pcm) snd_pcm_lib_preallocate_free_for_all(pcm); } -int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) +static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; @@ -463,7 +463,7 @@ int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) } return retval; } -struct snd_soc_platform_driver sst_soc_platform_drv = { +static struct snd_soc_platform_driver sst_soc_platform_drv = { .ops = &sst_platform_ops, .pcm_new = sst_pcm_new, .pcm_free = sst_pcm_free, -- cgit v1.1 From 97e287626a219e3754a54ac654691c608b78341d Mon Sep 17 00:00:00 2001 From: Gustavo Maciel Dias Vieira Date: Sun, 4 Dec 2011 15:14:10 -0200 Subject: ALSA: hda: remove unused quirk for inverted mute led Commit b99a776d0b17ae0f3a54e86009887a00ac4889d0 removed all effects of the STAC92HD83* model quirk "hp". However, it left the model selection and documentation behind, confusing users with inverted mute leds. Completely remove this quirk and its documentation. Signed-off-by: Gustavo Maciel Dias Vieira Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 85740e0..65f5179 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -96,7 +96,6 @@ enum { STAC_92HD83XXX_PWR_REF, STAC_DELL_S14, STAC_DELL_VOSTRO_3500, - STAC_92HD83XXX_HP, STAC_92HD83XXX_HP_cNB11_INTQUAD, STAC_HP_DV7_4000, STAC_92HD83XXX_MODELS @@ -1692,7 +1691,6 @@ static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { [STAC_92HD83XXX_PWR_REF] = "mic-ref", [STAC_DELL_S14] = "dell-s14", [STAC_DELL_VOSTRO_3500] = "dell-vostro-3500", - [STAC_92HD83XXX_HP] = "hp", [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad", [STAC_HP_DV7_4000] = "hp-dv7-4000", }; @@ -1707,8 +1705,6 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { "unknown Dell", STAC_DELL_S14), SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028, "Dell Vostro 3500", STAC_DELL_VOSTRO_3500), - SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x3600, - "HP", STAC_92HD83XXX_HP), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656, "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657, -- cgit v1.1 From 1815b34a626742733f846ddd266a89bd2fcea28f Mon Sep 17 00:00:00 2001 From: Andiry Xu Date: Wed, 14 Dec 2011 16:10:27 +0800 Subject: ALSA: HDA: Add support for new AMD products This patch adds HDMI audio support for new AMD products. As HW default disable snoop, force non-snoop mode in HD audio driver. Signed-off-by: Andiry Xu Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index d1582dd..9f7c901a 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -487,6 +487,7 @@ enum { AZX_DRIVER_SCH, AZX_DRIVER_ATI, AZX_DRIVER_ATIHDMI, + AZX_DRIVER_ATIHDMI_NS, AZX_DRIVER_VIA, AZX_DRIVER_SIS, AZX_DRIVER_ULI, @@ -533,6 +534,7 @@ static char *driver_short_names[] __devinitdata = { [AZX_DRIVER_SCH] = "HDA Intel MID", [AZX_DRIVER_ATI] = "HDA ATI SB", [AZX_DRIVER_ATIHDMI] = "HDA ATI HDMI", + [AZX_DRIVER_ATIHDMI_NS] = "HDA ATI HDMI", [AZX_DRIVER_VIA] = "HDA VIA VT82xx", [AZX_DRIVER_SIS] = "HDA SIS966", [AZX_DRIVER_ULI] = "HDA ULI M5461", @@ -2678,6 +2680,8 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, chip->single_cmd = single_cmd; chip->snoop = hda_snoop; + if (chip->driver_type == AZX_DRIVER_ATIHDMI_NS) + chip->snoop = 0; if (bdl_pos_adj[dev] < 0) { switch (chip->driver_type) { @@ -2776,6 +2780,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, chip->capture_streams = ULI_NUM_CAPTURE; break; case AZX_DRIVER_ATIHDMI: + case AZX_DRIVER_ATIHDMI_NS: chip->playback_streams = ATIHDMI_NUM_PLAYBACK; chip->capture_streams = ATIHDMI_NUM_CAPTURE; break; @@ -3037,6 +3042,14 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI }, { PCI_DEVICE(0x1002, 0xaa48), .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI }, + { PCI_DEVICE(0x1002, 0x9902), + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI }, + { PCI_DEVICE(0x1002, 0xaaa0), + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI }, + { PCI_DEVICE(0x1002, 0xaaa8), + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI }, + { PCI_DEVICE(0x1002, 0xaab0), + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI }, /* VIA VT8251/VT8237A */ { PCI_DEVICE(0x1106, 0x3288), .driver_data = AZX_DRIVER_VIA | AZX_DCAPS_POSFIX_VIA }, -- cgit v1.1 From a1585d769731323a792277f15b7a3ee2ae36b698 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 14 Dec 2011 09:27:04 +0100 Subject: ALSA: hda - Check non-snoop in a single place Merge the checks for VIA and ATI-HDMI into a single place for better code-flow management. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 9f7c901a..8d17963 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1153,16 +1153,6 @@ static void update_pci_byte(struct pci_dev *pci, unsigned int reg, static void azx_init_pci(struct azx *chip) { - /* force to non-snoop mode for a new VIA controller when BIOS is set */ - if (chip->snoop && chip->driver_type == AZX_DRIVER_VIA) { - u8 snoop; - pci_read_config_byte(chip->pci, 0x42, &snoop); - if (!(snoop & 0x80) && chip->pci->revision == 0x30) { - chip->snoop = 0; - snd_printdd(SFX "Force to non-snoop mode\n"); - } - } - /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44) * TCSEL == Traffic Class Select Register, which sets PCI express QOS * Ensuring these bits are 0 clears playback static on some HD Audio @@ -2634,6 +2624,35 @@ static void __devinit check_msi(struct azx *chip) } } +/* check the snoop mode availability */ +static void __devinit azx_check_snoop_available(struct azx *chip) +{ + bool snoop = chip->snoop; + + switch (chip->driver_type) { + case AZX_DRIVER_VIA: + /* force to non-snoop mode for a new VIA controller + * when BIOS is set + */ + if (snoop) { + u8 val; + pci_read_config_byte(chip->pci, 0x42, &val); + if (!(val & 0x80) && chip->pci->revision == 0x30) + snoop = false; + } + break; + case AZX_DRIVER_ATIHDMI_NS: + /* new ATI HDMI requires non-snoop */ + snoop = false; + break; + } + + if (snoop != chip->snoop) { + snd_printk(KERN_INFO SFX "Force to %s mode\n", + snoop ? "snoop" : "non-snoop"); + chip->snoop = snoop; + } +} /* * constructor @@ -2680,8 +2699,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, chip->single_cmd = single_cmd; chip->snoop = hda_snoop; - if (chip->driver_type == AZX_DRIVER_ATIHDMI_NS) - chip->snoop = 0; + azx_check_snoop_available(chip); if (bdl_pos_adj[dev] < 0) { switch (chip->driver_type) { -- cgit v1.1 From 42f3b0109ea61aee0541a02f1802fd7939b9853a Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 13 Dec 2011 18:30:03 +0800 Subject: ASoC: Remove cache default for volatile wm9081 reset register Signed-off-by: Mark Brown --- sound/soc/codecs/wm9081.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 1f2672b..a6bab39 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c @@ -31,7 +31,6 @@ #include "wm9081.h" static struct reg_default wm9081_reg[] = { - { 0, 0x9081 }, /* R0 - Software Reset */ { 2, 0x00B9 }, /* R2 - Analogue Lineout */ { 3, 0x00B9 }, /* R3 - Analogue Speaker PGA */ { 4, 0x0001 }, /* R4 - VMID Control */ -- cgit v1.1 From ffbf2a363e1867ba5f5869236dda944ec12fe99b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 13 Dec 2011 21:04:26 +0800 Subject: ASoC: Use standard snd_soc_cache_sync() for WM9090 Signed-off-by: Mark Brown --- sound/soc/codecs/wm9090.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c index d1d2c70..41ebe0dc 100644 --- a/sound/soc/codecs/wm9090.c +++ b/sound/soc/codecs/wm9090.c @@ -513,18 +513,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec, case SND_SOC_BIAS_STANDBY: if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { /* Restore the register cache */ - for (i = 1; i < codec->driver->reg_cache_size; i++) { - if (reg_cache[i] == wm9090_reg_defaults[i]) - continue; - if (wm9090_volatile(codec, i)) - continue; - - ret = snd_soc_write(codec, i, reg_cache[i]); - if (ret != 0) - dev_warn(codec->dev, - "Failed to restore register %d: %d\n", - i, ret); - } + snd_soc_cache_sync(codec); } /* We keep VMID off during standby since the combination of -- cgit v1.1 From f6a9336879caeed63e77bc10097966fa3a6ba20c Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 14 Dec 2011 11:11:52 +0800 Subject: ASoC: Convert wm8993 to devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm8993.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index f472ea6..b966f69 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c @@ -1613,7 +1613,8 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c, struct wm8993_priv *wm8993; int ret; - wm8993 = kzalloc(sizeof(struct wm8993_priv), GFP_KERNEL); + wm8993 = devm_kzalloc(&i2c-dev, sizeof(struct wm8993_priv), + GFP_KERNEL); if (wm8993 == NULL) return -ENOMEM; @@ -1621,8 +1622,6 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8993, &wm8993_dai, 1); - if (ret < 0) - kfree(wm8993); return ret; } -- cgit v1.1 From d0616bbed18884cb2475ca0abb5a596105444b96 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 14 Dec 2011 11:40:59 +0800 Subject: ASoC: Use standard register cache sync in wm8993 Signed-off-by: Mark Brown --- sound/soc/codecs/wm8993.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index b966f69..2835e7d 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c @@ -934,28 +934,6 @@ static const struct snd_soc_dapm_route routes[] = { { "Right Headphone Mux", "DAC", "DACR" }, }; -static void wm8993_cache_restore(struct snd_soc_codec *codec) -{ - u16 *cache = codec->reg_cache; - int i; - - if (!codec->cache_sync) - return; - - /* Reenable hardware writes */ - codec->cache_only = 0; - - /* Restore the register settings */ - for (i = 1; i < WM8993_MAX_REGISTER; i++) { - if (cache[i] == wm8993_reg_defaults[i]) - continue; - snd_soc_write(codec, i, cache[i]); - } - - /* We're in sync again */ - codec->cache_sync = 0; -} - static int wm8993_set_bias_level(struct snd_soc_codec *codec, enum snd_soc_bias_level level) { @@ -979,7 +957,7 @@ static int wm8993_set_bias_level(struct snd_soc_codec *codec, if (ret != 0) return ret; - wm8993_cache_restore(codec); + snd_soc_cache_sync(codec); /* Tune DC servo configuration */ snd_soc_write(codec, 0x44, 3); -- cgit v1.1 From 45ba82d81741398ec4f097fedf2c204704d53b6b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 14 Dec 2011 19:23:37 +0800 Subject: ASoC: Tune the accessory detection rates for WM8996 Use longer intervals when the microphone is not inserted to increase robustness against leisurely insertion. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8996.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 8f88f5a..da7acae 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c @@ -2572,8 +2572,10 @@ static void wm8996_micd(struct snd_soc_codec *codec) SND_JACK_BTN_0); snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, - WM8996_MICD_RATE_MASK, - WM8996_MICD_RATE_MASK); + WM8996_MICD_RATE_MASK | + WM8996_MICD_BIAS_STARTTIME_MASK, + WM8996_MICD_RATE_MASK | + 9 << WM8996_MICD_BIAS_STARTTIME_SHIFT); return; } @@ -2590,8 +2592,10 @@ static void wm8996_micd(struct snd_soc_codec *codec) /* Increase poll rate to give better responsiveness * for buttons */ snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, - WM8996_MICD_RATE_MASK, - 5 << WM8996_MICD_RATE_SHIFT); + WM8996_MICD_RATE_MASK | + WM8996_MICD_BIAS_STARTTIME_MASK, + 5 << WM8996_MICD_RATE_SHIFT | + 7 << WM8996_MICD_BIAS_STARTTIME_SHIFT); } else { dev_dbg(codec->dev, "Mic button up\n"); snd_soc_jack_report(wm8996->jack, 0, SND_JACK_BTN_0); @@ -2639,8 +2643,10 @@ static void wm8996_micd(struct snd_soc_codec *codec) * responsiveness. */ snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, - WM8996_MICD_RATE_MASK, - 7 << WM8996_MICD_RATE_SHIFT); + WM8996_MICD_RATE_MASK | + WM8996_MICD_BIAS_STARTTIME_MASK, + 7 << WM8996_MICD_RATE_SHIFT | + 7 << WM8996_MICD_BIAS_STARTTIME_SHIFT); } } } -- cgit v1.1 From 20e757f79b9956a91f4ba0f33cc3f34efe6eb188 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 20:21:32 +0000 Subject: ASoC: Use core pm_runtime callbacks for siu_dai Now that the core holds a pm_runtime reference to the device while the link is active there is no need for the driver to do so. Signed-off-by: Mark Brown --- sound/soc/sh/siu_dai.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c index 11c6085..52d4c17 100644 --- a/sound/soc/sh/siu_dai.c +++ b/sound/soc/sh/siu_dai.c @@ -112,9 +112,6 @@ static void siu_dai_start(struct siu_port *port_info) dev_dbg(port_info->pcm->card->dev, "%s\n", __func__); - /* Turn on SIU clock */ - pm_runtime_get_sync(info->dev); - /* Issue software reset to siu */ siu_write32(base + SIU_SRCTL, 0); @@ -158,9 +155,6 @@ static void siu_dai_stop(struct siu_port *port_info) /* SIU software reset */ siu_write32(base + SIU_SRCTL, 0); - - /* Turn off SIU clock */ - pm_runtime_put_sync(info->dev); } static void siu_dai_spbAselect(struct siu_port *port_info) -- cgit v1.1 From 27f478a65ff7b67b843250f0a2d1e8b306bf57b6 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sat, 3 Dec 2011 20:22:18 +0000 Subject: ASoC: Use core pm_runtime callbacks for fsi Now that the core holds a pm_runtime reference to the device while the link is active there is no need for the driver to do so. Signed-off-by: Mark Brown --- sound/soc/sh/fsi.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index a27c306..db6c89a 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c @@ -893,8 +893,6 @@ static int fsi_hw_startup(struct fsi_priv *fsi, u32 flags = fsi_get_info_flags(fsi); u32 data = 0; - pm_runtime_get_sync(dev); - /* clock setting */ if (fsi_is_clk_master(fsi)) data = DIMD | DOMD; @@ -951,8 +949,6 @@ static void fsi_hw_shutdown(struct fsi_priv *fsi, { if (fsi_is_clk_master(fsi)) fsi_set_master_clk(dev, fsi, fsi->rate, 0); - - pm_runtime_put_sync(dev); } static int fsi_dai_startup(struct snd_pcm_substream *substream, -- cgit v1.1 From ec641c459048f30e378e1386ba9eff1f7ada522f Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 15 Dec 2011 11:54:00 +0800 Subject: ASoC: Fix partial cherry pick in wm8993 Signed-off-by: Mark Brown --- sound/soc/codecs/wm8993.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index 2835e7d..2b40c93 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c @@ -1591,7 +1591,7 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c, struct wm8993_priv *wm8993; int ret; - wm8993 = devm_kzalloc(&i2c-dev, sizeof(struct wm8993_priv), + wm8993 = devm_kzalloc(&i2c->dev, sizeof(struct wm8993_priv), GFP_KERNEL); if (wm8993 == NULL) return -ENOMEM; -- cgit v1.1 From 00c651612ef2b4b6b953059ace6b50afcb8d88c4 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 14 Dec 2011 19:23:01 +0800 Subject: ASoC: Staticise mfld_msic_dailink Signed-off-by: Axel Lin Acked by: Vinod Koul Signed-off-by: Mark Brown --- sound/soc/mid-x86/mfld_machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/mid-x86/mfld_machine.c b/sound/soc/mid-x86/mfld_machine.c index e53f8e4..8ae0574 100644 --- a/sound/soc/mid-x86/mfld_machine.c +++ b/sound/soc/mid-x86/mfld_machine.c @@ -281,7 +281,7 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime) return ret_val; } -struct snd_soc_dai_link mfld_msic_dailink[] = { +static struct snd_soc_dai_link mfld_msic_dailink[] = { { .name = "Medfield Headset", .stream_name = "Headset", -- cgit v1.1 From c45471eac2bdc271df40963ac8448d76ac434872 Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Thu, 15 Dec 2011 18:24:54 +0100 Subject: ASoC: Fix compile error in sound/soc/mid-x86/sst_platform.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The variable ret_val is used but not declared. This causes the following compile error: sound/soc/mid-x86/sst_platform.c: In function ‘sst_platform_open’: sound/soc/mid-x86/sst_platform.c:274:2: error: ‘ret_val’ undeclared (first use in this function) sound/soc/mid-x86/sst_platform.c:274:2: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [sound/soc/mid-x86/sst_platform.o] Error 1 Fix this. Signed-off-by: Joerg Roedel Signed-off-by: Takashi Iwai --- sound/soc/mid-x86/sst_platform.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c index 24f9471..11c39c5 100644 --- a/sound/soc/mid-x86/sst_platform.c +++ b/sound/soc/mid-x86/sst_platform.c @@ -267,6 +267,7 @@ static int sst_platform_open(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct sst_runtime_stream *stream; + int ret_val; pr_debug("sst_platform_open called\n"); -- cgit v1.1 From 7243a4b1eb377b3c5376cbf0ebdf87972b969127 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Thu, 15 Dec 2011 11:32:27 +0200 Subject: ASoC: omap-mcbsp: Enable FIFO usage on OMAP4 Allow McBSP FIFO configuration from ASoC dai driver on OMAP4 platform. Signed-off-by: Peter Ujfalusi Signed-off-by: Mark Brown --- sound/soc/omap/omap-mcbsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index bd11d25..0173719 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c @@ -258,7 +258,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, default: return -EINVAL; } - if (cpu_is_omap34xx()) { + if (cpu_is_omap34xx() || cpu_is_omap44xx()) { dma_data->set_threshold = omap_mcbsp_set_threshold; /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ if (omap_mcbsp_get_dma_op_mode(bus_id) == -- cgit v1.1 From 62133829fa12a55902ac400b74e424c1ecd161b3 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 10:52:42 +0800 Subject: ASoC: pxa: Convert e740_wm9705 to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/e740_wm9705.c | 75 +++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 43 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c index 818dc57..203ab78a 100644 --- a/sound/soc/pxa/e740_wm9705.c +++ b/sound/soc/pxa/e740_wm9705.c @@ -137,66 +137,55 @@ static struct snd_soc_card e740 = { .num_links = ARRAY_SIZE(e740_dai), }; -static struct platform_device *e740_snd_device; +static struct gpio e740_audio_gpios[] = { + { GPIO_E740_MIC_ON, GPIOF_OUT_INIT_LOW, "Mic amp" }, + { GPIO_E740_AMP_ON, GPIOF_OUT_INIT_LOW, "Output amp" }, + { GPIO_E740_WM9705_nAVDD2, GPIOF_OUT_INIT_HIGH, "Audio power" }, +}; -static int __init e740_init(void) +static int __devinit e740_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &e740; int ret; - if (!machine_is_e740()) - return -ENODEV; - - /* Disable audio */ - ret = gpio_request_one(GPIO_E740_MIC_ON, GPIOF_OUT_INIT_LOW, "Mic amp"); + ret = gpio_request_array(e740_audio_gpios, + ARRAY_SIZE(e740_audio_gpios)); if (ret) return ret; - ret = gpio_request_one(GPIO_E740_AMP_ON, GPIOF_OUT_INIT_LOW, - "Output amp"); - if (ret) - goto free_mic_amp_gpio; + card->dev = &pdev->dev; - ret = gpio_request_one(GPIO_E740_WM9705_nAVDD2, GPIOF_OUT_INIT_HIGH, - "Audio power"); - if (ret) - goto free_op_amp_gpio; - - e740_snd_device = platform_device_alloc("soc-audio", -1); - if (!e740_snd_device) { - ret = -ENOMEM; - goto free_apwr_gpio; + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); + gpio_free_array(e740_audio_gpios, ARRAY_SIZE(e740_audio_gpios)); } - - platform_set_drvdata(e740_snd_device, &e740); - ret = platform_device_add(e740_snd_device); - - if (!ret) - return 0; - -/* Fail gracefully */ - platform_device_put(e740_snd_device); -free_apwr_gpio: - gpio_free(GPIO_E740_WM9705_nAVDD2); -free_op_amp_gpio: - gpio_free(GPIO_E740_AMP_ON); -free_mic_amp_gpio: - gpio_free(GPIO_E740_MIC_ON); - return ret; } -static void __exit e740_exit(void) +static int __devexit e740_remove(struct platform_device *pdev) { - platform_device_unregister(e740_snd_device); - gpio_free(GPIO_E740_WM9705_nAVDD2); - gpio_free(GPIO_E740_AMP_ON); - gpio_free(GPIO_E740_MIC_ON); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + gpio_free_array(e740_audio_gpios, ARRAY_SIZE(e740_audio_gpios)); + snd_soc_unregister_card(card); + return 0; } -module_init(e740_init); -module_exit(e740_exit); +static struct platform_driver e740_driver = { + .driver = { + .name = "e740-audio", + .owner = THIS_MODULE, + }, + .probe = e740_probe, + .remove = __devexit_p(e740_remove), +}; + +module_platform_driver(e740_driver); /* Module information */ MODULE_AUTHOR("Ian Molton "); MODULE_DESCRIPTION("ALSA SoC driver for e740"); MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:e740-audio"); -- cgit v1.1 From 5eb2c3d9273ae63d6b347cde38fe15bda8be1361 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 10:53:29 +0800 Subject: ASoC: pxa: Convert e750_wm9705 to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/e750_wm9705.c | 66 +++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 35 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c index 55c53d1..27f90cc 100644 --- a/sound/soc/pxa/e750_wm9705.c +++ b/sound/soc/pxa/e750_wm9705.c @@ -120,58 +120,54 @@ static struct snd_soc_card e750 = { .num_links = ARRAY_SIZE(e750_dai), }; -static struct platform_device *e750_snd_device; +static struct gpio e750_audio_gpios[] = { + { GPIO_E750_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Headphone amp" }, + { GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" }, +}; -static int __init e750_init(void) +static int __devinit e750_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &e750; int ret; - if (!machine_is_e750()) - return -ENODEV; - - ret = gpio_request_one(GPIO_E750_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, - "Headphone amp"); + ret = gpio_request_array(e750_audio_gpios, + ARRAY_SIZE(e750_audio_gpios)); if (ret) return ret; - ret = gpio_request_one(GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH, - "Speaker amp"); - if (ret) - goto free_hp_amp_gpio; + card->dev = &pdev->dev; - e750_snd_device = platform_device_alloc("soc-audio", -1); - if (!e750_snd_device) { - ret = -ENOMEM; - goto free_spk_amp_gpio; + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); + gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios)); } - - platform_set_drvdata(e750_snd_device, &e750); - ret = platform_device_add(e750_snd_device); - - if (!ret) - return 0; - -/* Fail gracefully */ - platform_device_put(e750_snd_device); -free_spk_amp_gpio: - gpio_free(GPIO_E750_SPK_AMP_OFF); -free_hp_amp_gpio: - gpio_free(GPIO_E750_HP_AMP_OFF); - return ret; } -static void __exit e750_exit(void) +static int __devexit e750_remove(struct platform_device *pdev) { - platform_device_unregister(e750_snd_device); - gpio_free(GPIO_E750_SPK_AMP_OFF); - gpio_free(GPIO_E750_HP_AMP_OFF); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios)); + snd_soc_unregister_card(card); + return 0; } -module_init(e750_init); -module_exit(e750_exit); +static struct platform_driver e750_driver = { + .driver = { + .name = "e750-audio", + .owner = THIS_MODULE, + }, + .probe = e750_probe, + .remove = __devexit_p(e750_remove), +}; + +module_platform_driver(e750_driver); /* Module information */ MODULE_AUTHOR("Ian Molton "); MODULE_DESCRIPTION("ALSA SoC driver for e750"); MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:e750-audio"); -- cgit v1.1 From ac1e89860a89c9d91174bf5439689bba2e4f83bb Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 10:55:24 +0800 Subject: ASoC: pxa: Convert imote2 to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/imote2.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/imote2.c b/sound/soc/pxa/imote2.c index 154fc6f..97d3aec 100644 --- a/sound/soc/pxa/imote2.c +++ b/sound/soc/pxa/imote2.c @@ -70,39 +70,46 @@ static struct snd_soc_dai_link imote2_dai = { .ops = &imote2_asoc_ops, }; -static struct snd_soc_card snd_soc_imote2 = { +static struct snd_soc_card imote2 = { .name = "Imote2", .dai_link = &imote2_dai, .num_links = 1, }; -static struct platform_device *imote2_snd_device; - -static int __init imote2_asoc_init(void) +static int __devinit imote2_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &imote2; int ret; - if (!machine_is_intelmote2()) - return -ENODEV; - imote2_snd_device = platform_device_alloc("soc-audio", -1); - if (!imote2_snd_device) - return -ENOMEM; + card->dev = &pdev->dev; - platform_set_drvdata(imote2_snd_device, &snd_soc_imote2); - ret = platform_device_add(imote2_snd_device); + ret = snd_soc_register_card(card); if (ret) - platform_device_put(imote2_snd_device); - + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); return ret; } -module_init(imote2_asoc_init); -static void __exit imote2_asoc_exit(void) +static int __devexit imote2_remove(struct platform_device *pdev) { - platform_device_unregister(imote2_snd_device); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + return 0; } -module_exit(imote2_asoc_exit); + +static struct platform_driver imote2_driver = { + .driver = { + .name = "imote2-audio", + .owner = THIS_MODULE, + }, + .probe = imote2_probe, + .remove = __devexit_p(imote2_remove), +}; + +module_platform_driver(imote2_driver); MODULE_AUTHOR("Jonathan Cameron"); MODULE_DESCRIPTION("ALSA SoC Imote 2"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:imote2-audio"); -- cgit v1.1 From f285b8c83a8dccc70f168bb1eb6f04c8e36450a6 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 10:57:22 +0800 Subject: ASoC: pxa: Convert tosa to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/tosa.c | 77 ++++++++++++++++++++-------------------------------- 1 file changed, 30 insertions(+), 47 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index 620fc69..3f394de 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c @@ -34,8 +34,6 @@ #include "../codecs/wm9712.h" #include "pxa2xx-ac97.h" -static struct snd_soc_card tosa; - #define TOSA_HP 0 #define TOSA_MIC_INT 1 #define TOSA_HEADSET 2 @@ -236,70 +234,55 @@ static struct snd_soc_dai_link tosa_dai[] = { }, }; -static int tosa_probe(struct snd_soc_card *card) -{ - int ret; - - ret = gpio_request(TOSA_GPIO_L_MUTE, "Headphone Jack"); - if (ret) - return ret; - ret = gpio_direction_output(TOSA_GPIO_L_MUTE, 0); - if (ret) - gpio_free(TOSA_GPIO_L_MUTE); - - return ret; -} - -static int tosa_remove(struct snd_soc_card *card) -{ - gpio_free(TOSA_GPIO_L_MUTE); - return 0; -} - static struct snd_soc_card tosa = { .name = "Tosa", .dai_link = tosa_dai, .num_links = ARRAY_SIZE(tosa_dai), - .probe = tosa_probe, - .remove = tosa_remove, }; -static struct platform_device *tosa_snd_device; - -static int __init tosa_init(void) +static int __devinit tosa_probe(struct platform_device *pdev) { + struct snd_soc_card *card = ⤩ int ret; - if (!machine_is_tosa()) - return -ENODEV; - - tosa_snd_device = platform_device_alloc("soc-audio", -1); - if (!tosa_snd_device) { - ret = -ENOMEM; - goto err_alloc; - } - - platform_set_drvdata(tosa_snd_device, &tosa); - ret = platform_device_add(tosa_snd_device); - - if (!ret) - return 0; + ret = gpio_request_one(TOSA_GPIO_L_MUTE, GPIOF_OUT_INIT_LOW, + "Headphone Jack"); + if (ret) + return ret; - platform_device_put(tosa_snd_device); + card->dev = &pdev->dev; -err_alloc: + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); + gpio_free(TOSA_GPIO_L_MUTE); + } return ret; } -static void __exit tosa_exit(void) +static int __devexit tosa_remove(struct platform_device *pdev) { - platform_device_unregister(tosa_snd_device); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + gpio_free(TOSA_GPIO_L_MUTE); + snd_soc_unregister_card(card); + return 0; } -module_init(tosa_init); -module_exit(tosa_exit); +static struct platform_driver tosa_driver = { + .driver = { + .name = "tosa-audio", + .owner = THIS_MODULE, + }, + .probe = tosa_probe, + .remove = __devexit_p(tosa_remove), +}; + +module_platform_driver(tosa_driver); /* Module information */ MODULE_AUTHOR("Richard Purdie"); MODULE_DESCRIPTION("ALSA SoC Tosa"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:tosa-audio"); -- cgit v1.1 From 1eb0202dc7e45be5996416bc41489ae5a75485e5 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 10:54:25 +0800 Subject: ASoC: pxa: Convert e800_wm9712 to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/e800_wm9712.c | 66 +++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 35 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c index 478ff19..858bf94 100644 --- a/sound/soc/pxa/e800_wm9712.c +++ b/sound/soc/pxa/e800_wm9712.c @@ -110,58 +110,54 @@ static struct snd_soc_card e800 = { .num_links = ARRAY_SIZE(e800_dai), }; -static struct platform_device *e800_snd_device; +static struct gpio e800_audio_gpios[] = { + { GPIO_E800_SPK_AMP_ON, GPIOF_OUT_INIT_HIGH, "Headphone amp" }, + { GPIO_E800_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" }, +}; -static int __init e800_init(void) +static int __devinit e800_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &e800; int ret; - if (!machine_is_e800()) - return -ENODEV; - - ret = gpio_request_one(GPIO_E800_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, - "Headphone amp"); + ret = gpio_request_array(e800_audio_gpios, + ARRAY_SIZE(e800_audio_gpios)); if (ret) return ret; - ret = gpio_request_one(GPIO_E800_SPK_AMP_ON, GPIOF_OUT_INIT_HIGH, - "Speaker amp"); - if (ret) - goto free_hp_amp_gpio; + card->dev = &pdev->dev; - e800_snd_device = platform_device_alloc("soc-audio", -1); - if (!e800_snd_device) { - ret = -ENOMEM; - goto free_spk_amp_gpio; + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); + gpio_free_array(e800_audio_gpios, ARRAY_SIZE(e800_audio_gpios)); } - - platform_set_drvdata(e800_snd_device, &e800); - ret = platform_device_add(e800_snd_device); - - if (!ret) - return 0; - -/* Fail gracefully */ - platform_device_put(e800_snd_device); -free_spk_amp_gpio: - gpio_free(GPIO_E800_SPK_AMP_ON); -free_hp_amp_gpio: - gpio_free(GPIO_E800_HP_AMP_OFF); - return ret; } -static void __exit e800_exit(void) +static int __devexit e800_remove(struct platform_device *pdev) { - platform_device_unregister(e800_snd_device); - gpio_free(GPIO_E800_SPK_AMP_ON); - gpio_free(GPIO_E800_HP_AMP_OFF); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + gpio_free_array(e800_audio_gpios, ARRAY_SIZE(e800_audio_gpios)); + snd_soc_unregister_card(card); + return 0; } -module_init(e800_init); -module_exit(e800_exit); +static struct platform_driver e800_driver = { + .driver = { + .name = "e800-audio", + .owner = THIS_MODULE, + }, + .probe = e800_probe, + .remove = __devexit_p(e800_remove), +}; + +module_platform_driver(e800_driver); /* Module information */ MODULE_AUTHOR("Ian Molton "); MODULE_DESCRIPTION("ALSA SoC driver for e800"); MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:e800-audio"); -- cgit v1.1 From b9791c010966207a9f111e9339d6087a1a7269ab Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 16 Dec 2011 07:42:58 +0100 Subject: ASoC: Convert WM8960 to devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm8960.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 2315b86..e5caae3 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c @@ -973,7 +973,8 @@ static __devinit int wm8960_i2c_probe(struct i2c_client *i2c, struct wm8960_priv *wm8960; int ret; - wm8960 = kzalloc(sizeof(struct wm8960_priv), GFP_KERNEL); + wm8960 = devm_kzalloc(&i2c->dev, sizeof(struct wm8960_priv), + GFP_KERNEL); if (wm8960 == NULL) return -ENOMEM; @@ -982,15 +983,13 @@ static __devinit int wm8960_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8960, &wm8960_dai, 1); - if (ret < 0) - kfree(wm8960); + return ret; } static __devexit int wm8960_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From 69be6660f30b79410111f4e7c55307d775cfb274 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 16 Dec 2011 07:55:02 +0100 Subject: ASoC: Remove I2C ifdefs from wm8961 driver The driver only supports I2C so no need to conditionalise its use. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8961.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 58fbf0a..13a0850 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -1081,7 +1081,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8961 = { .volatile_register = wm8961_volatile_register, }; -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) static __devinit int wm8961_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { @@ -1123,27 +1122,22 @@ static struct i2c_driver wm8961_i2c_driver = { .remove = __devexit_p(wm8961_i2c_remove), .id_table = wm8961_i2c_id, }; -#endif static int __init wm8961_modinit(void) { int ret = 0; -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) ret = i2c_add_driver(&wm8961_i2c_driver); if (ret != 0) { printk(KERN_ERR "Failed to register wm8961 I2C driver: %d\n", ret); } -#endif return ret; } module_init(wm8961_modinit); static void __exit wm8961_exit(void) { -#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) i2c_del_driver(&wm8961_i2c_driver); -#endif } module_exit(wm8961_exit); -- cgit v1.1 From 2ec2a9061dac94ca4c5af13566fe107d84c30d4e Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 16 Dec 2011 07:56:02 +0100 Subject: ASoC: Convert wm8961 to devm_kzalloc() Signed-off-by: Mark Brown --- sound/soc/codecs/wm8961.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 13a0850..8bcc17a 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -1087,7 +1087,8 @@ static __devinit int wm8961_i2c_probe(struct i2c_client *i2c, struct wm8961_priv *wm8961; int ret; - wm8961 = kzalloc(sizeof(struct wm8961_priv), GFP_KERNEL); + wm8961 = devm_kzalloc(&i2c->dev, sizeof(struct wm8961_priv), + GFP_KERNEL); if (wm8961 == NULL) return -ENOMEM; @@ -1095,15 +1096,14 @@ static __devinit int wm8961_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8961, &wm8961_dai, 1); - if (ret < 0) - kfree(wm8961); + return ret; } static __devexit int wm8961_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); + return 0; } -- cgit v1.1 From 202a51a8d9c1fddea9eca5953e6e7d7d504a4343 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 16 Dec 2011 07:57:11 +0100 Subject: ASoC: Use standard cache sync code in wm8961 We write the reset register with the default value so it should not be mistakenly written. Signed-off-by: Mark Brown --- sound/soc/codecs/wm8961.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 8bcc17a..4f20c72 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -1047,18 +1047,7 @@ static int wm8961_suspend(struct snd_soc_codec *codec) static int wm8961_resume(struct snd_soc_codec *codec) { - u16 *reg_cache = codec->reg_cache; - int i; - - for (i = 0; i < codec->driver->reg_cache_size; i++) { - if (reg_cache[i] == wm8961_reg_defaults[i]) - continue; - - if (i == WM8961_SOFTWARE_RESET) - continue; - - snd_soc_write(codec, i, reg_cache[i]); - } + snd_soc_cache_sync(codec); wm8961_set_bias_level(codec, SND_SOC_BIAS_STANDBY); -- cgit v1.1 From a67ff6a54095e27093ea501fb143fefe51a536c2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 15 Dec 2011 13:49:36 +1030 Subject: ALSA: module_param: make bool parameters really bool module_param(bool) used to counter-intuitively take an int. In fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy trick. It's time to remove the int/unsigned int option. For this version it'll simply give a warning, but it'll break next kernel version. Signed-off-by: Rusty Russell Signed-off-by: Takashi Iwai --- sound/core/oss/pcm_oss.c | 2 +- sound/core/seq/seq_dummy.c | 2 +- sound/drivers/aloop.c | 2 +- sound/drivers/dummy.c | 6 +++--- sound/drivers/ml403-ac97cr.c | 2 +- sound/drivers/mpu401/mpu401.c | 6 +++--- sound/drivers/mts64.c | 2 +- sound/drivers/opl3/opl3_midi.c | 2 +- sound/drivers/opl3/opl3_seq.c | 2 +- sound/drivers/pcsp/pcsp.c | 4 ++-- sound/drivers/pcsp/pcsp_lib.c | 2 +- sound/drivers/portman2x4.c | 2 +- sound/drivers/serial-u16550.c | 4 ++-- sound/drivers/virmidi.c | 2 +- sound/isa/ad1816a/ad1816a.c | 2 +- sound/isa/ad1848/ad1848.c | 4 ++-- sound/isa/adlib.c | 2 +- sound/isa/als100.c | 2 +- sound/isa/azt2320.c | 2 +- sound/isa/cmi8330.c | 4 ++-- sound/isa/cs423x/cs4231.c | 2 +- sound/isa/cs423x/cs4236.c | 4 ++-- sound/isa/es1688/es1688.c | 4 ++-- sound/isa/es18xx.c | 4 ++-- sound/isa/galaxy/galaxy.c | 2 +- sound/isa/gus/gusclassic.c | 2 +- sound/isa/gus/gusextreme.c | 2 +- sound/isa/gus/gusmax.c | 2 +- sound/isa/gus/interwave.c | 4 ++-- sound/isa/msnd/msnd_pinnacle.c | 2 +- sound/isa/opl3sa2.c | 4 ++-- sound/isa/opti9xx/miro.c | 2 +- sound/isa/opti9xx/opti92x-ad1848.c | 2 +- sound/isa/sb/jazz16.c | 2 +- sound/isa/sb/sb16.c | 4 ++-- sound/isa/sb/sb8.c | 2 +- sound/isa/sc6000.c | 2 +- sound/isa/wavefront/wavefront.c | 6 +++--- sound/oss/ad1848.c | 8 ++++---- sound/oss/msnd_pinnacle.c | 2 +- sound/oss/pas2_card.c | 12 ++++++------ sound/oss/pss.c | 10 +++++----- sound/oss/trix.c | 2 +- sound/pci/ac97/ac97_codec.c | 2 +- sound/pci/ad1889.c | 2 +- sound/pci/ali5451/ali5451.c | 4 ++-- sound/pci/als4000.c | 2 +- sound/pci/asihpi/asihpi.c | 4 ++-- sound/pci/atiixp.c | 4 ++-- sound/pci/atiixp_modem.c | 2 +- sound/pci/au88x0/au88x0.c | 2 +- sound/pci/aw2/aw2-alsa.c | 2 +- sound/pci/azt3328.c | 2 +- sound/pci/bt87x.c | 4 ++-- sound/pci/ca0106/ca0106_main.c | 2 +- sound/pci/cmipci.c | 4 ++-- sound/pci/cs4281.c | 4 ++-- sound/pci/cs46xx/cs46xx.c | 8 ++++---- sound/pci/cs5535audio/cs5535audio.c | 2 +- sound/pci/ctxfi/cttimer.c | 4 ++-- sound/pci/ctxfi/xfi.c | 2 +- sound/pci/echoaudio/echoaudio.c | 2 +- sound/pci/emu10k1/emu10k1.c | 4 ++-- sound/pci/emu10k1/emu10k1x.c | 2 +- sound/pci/ens1370.c | 4 ++-- sound/pci/es1938.c | 2 +- sound/pci/es1968.c | 4 ++-- sound/pci/fm801.c | 2 +- sound/pci/hda/hda_intel.c | 8 ++++---- sound/pci/ice1712/ice1712.c | 4 ++-- sound/pci/ice1712/ice1724.c | 2 +- sound/pci/intel8x0.c | 6 +++--- sound/pci/intel8x0m.c | 2 +- sound/pci/korg1212/korg1212.c | 2 +- sound/pci/lola/lola.c | 2 +- sound/pci/lx6464es/lx6464es.c | 2 +- sound/pci/maestro3.c | 4 ++-- sound/pci/mixart/mixart.c | 2 +- sound/pci/nm256/nm256.c | 12 ++++++------ sound/pci/oxygen/oxygen.c | 2 +- sound/pci/oxygen/virtuoso.c | 2 +- sound/pci/pcxhr/pcxhr.c | 4 ++-- sound/pci/riptide/riptide.c | 2 +- sound/pci/rme32.c | 4 ++-- sound/pci/rme96.c | 2 +- sound/pci/rme9652/hdsp.c | 2 +- sound/pci/rme9652/hdspm.c | 2 +- sound/pci/rme9652/rme9652.c | 4 ++-- sound/pci/sis7019.c | 2 +- sound/pci/sonicvibes.c | 6 +++--- sound/pci/trident/trident.c | 2 +- sound/pci/via82xx.c | 4 ++-- sound/pci/via82xx_modem.c | 2 +- sound/pci/vx222/vx222.c | 4 ++-- sound/pci/ymfpci/ymfpci.c | 4 ++-- sound/pcmcia/pdaudiocf/pdaudiocf.c | 2 +- sound/pcmcia/vx/vxpocket.c | 2 +- sound/ppc/powermac.c | 2 +- sound/sh/aica.c | 2 +- sound/sparc/amd7930.c | 2 +- sound/sparc/cs4231.c | 2 +- sound/sparc/dbri.c | 2 +- sound/usb/6fire/chip.c | 2 +- sound/usb/caiaq/device.c | 2 +- sound/usb/card.c | 6 +++--- sound/usb/misc/ua101.c | 2 +- sound/usb/usx2y/us122l.c | 2 +- sound/usb/usx2y/usbusx2y.c | 2 +- 108 files changed, 171 insertions(+), 171 deletions(-) (limited to 'sound') diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 3cc4b86..08fde00 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -47,7 +47,7 @@ static int dsp_map[SNDRV_CARDS]; static int adsp_map[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 1}; -static int nonblock_open = 1; +static bool nonblock_open = 1; MODULE_AUTHOR("Jaroslav Kysela , Abramo Bagnara "); MODULE_DESCRIPTION("PCM OSS emulation for ALSA."); diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c index b9b2235..bbe32d2 100644 --- a/sound/core/seq/seq_dummy.c +++ b/sound/core/seq/seq_dummy.c @@ -65,7 +65,7 @@ MODULE_LICENSE("GPL"); MODULE_ALIAS("snd-seq-client-" __stringify(SNDRV_SEQ_CLIENT_DUMMY)); static int ports = 1; -static int duplex; +static bool duplex; module_param(ports, int, 0444); MODULE_PARM_DESC(ports, "number of ports to be created"); diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c index d83bafc..ad079b6 100644 --- a/sound/drivers/aloop.c +++ b/sound/drivers/aloop.c @@ -51,7 +51,7 @@ MODULE_SUPPORTED_DEVICE("{{ALSA,Loopback soundcard}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; +static bool enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8}; static int pcm_notify[SNDRV_CARDS]; diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index 97f1f93..ad9434f 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c @@ -60,15 +60,15 @@ MODULE_SUPPORTED_DEVICE("{{ALSA,Dummy soundcard}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; +static bool enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; static char *model[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = NULL}; static int pcm_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8}; //static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; #ifdef CONFIG_HIGH_RES_TIMERS -static int hrtimer = 1; +static bool hrtimer = 1; #endif -static int fake_buffer = 1; +static bool fake_buffer = 1; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for dummy soundcard."); diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c index 07ede97..6c83b1a 100644 --- a/sound/drivers/ml403-ac97cr.c +++ b/sound/drivers/ml403-ac97cr.c @@ -73,7 +73,7 @@ MODULE_SUPPORTED_DEVICE("{{Xilinx,ML403 AC97 Controller Reference}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for ML403 AC97 Controller Reference."); diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index 2575690..86f5fbc 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c @@ -35,13 +35,13 @@ MODULE_LICENSE("GPL"); static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* exclude the first card */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ #ifdef CONFIG_PNP -static int pnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; +static bool pnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; #endif static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* MPU-401 port number */ static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* MPU-401 IRQ */ -static int uart_enter[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; +static bool uart_enter[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for MPU-401 device."); diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c index f24bf9a..621e60e 100644 --- a/sound/drivers/mts64.c +++ b/sound/drivers/mts64.c @@ -36,7 +36,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; static struct platform_device *platform_devices[SNDRV_CARDS]; static int device_count; diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c index 7d722a0..2bfe4bc 100644 --- a/sound/drivers/opl3/opl3_midi.c +++ b/sound/drivers/opl3/opl3_midi.c @@ -27,7 +27,7 @@ extern char snd_opl3_regmap[MAX_OPL2_VOICES][4]; -extern int use_internal_drums; +extern bool use_internal_drums; static void snd_opl3_note_off_unsafe(void *p, int note, int vel, struct snd_midi_channel *chan); diff --git a/sound/drivers/opl3/opl3_seq.c b/sound/drivers/opl3/opl3_seq.c index 723562e..6839953 100644 --- a/sound/drivers/opl3/opl3_seq.c +++ b/sound/drivers/opl3/opl3_seq.c @@ -32,7 +32,7 @@ MODULE_AUTHOR("Uros Bizjak "); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("ALSA driver for OPL3 FM synth"); -int use_internal_drums = 0; +bool use_internal_drums = 0; module_param(use_internal_drums, bool, 0444); MODULE_PARM_DESC(use_internal_drums, "Enable internal OPL2/3 drums."); diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c index 946a0cb..99704e6 100644 --- a/sound/drivers/pcsp/pcsp.c +++ b/sound/drivers/pcsp/pcsp.c @@ -25,8 +25,8 @@ MODULE_ALIAS("platform:pcspkr"); static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ -static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ -static int nopcm; /* Disable PCM capability of the driver */ +static bool enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ +static bool nopcm; /* Disable PCM capability of the driver */ module_param(index, int, 0444); MODULE_PARM_DESC(index, "Index value for pcsp soundcard."); diff --git a/sound/drivers/pcsp/pcsp_lib.c b/sound/drivers/pcsp/pcsp_lib.c index ce9e7d1..434981d 100644 --- a/sound/drivers/pcsp/pcsp_lib.c +++ b/sound/drivers/pcsp/pcsp_lib.c @@ -14,7 +14,7 @@ #include #include "pcsp.h" -static int nforce_wa; +static bool nforce_wa; module_param(nforce_wa, bool, 0444); MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround " "(expect bad sound)"); diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c index f664823..3e32bd3 100644 --- a/sound/drivers/portman2x4.c +++ b/sound/drivers/portman2x4.c @@ -55,7 +55,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; static struct platform_device *platform_devices[SNDRV_CARDS]; static int device_count; diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index 85aad43..b2d0e8e 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c @@ -69,7 +69,7 @@ static char *adaptor_names[] = { static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x3f8,0x2f8,0x3e8,0x2e8 */ static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 3,4,5,7,9,10,11,14,15 */ static int speed[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 38400}; /* 9600,19200,38400,57600,115200 */ @@ -77,7 +77,7 @@ static int base[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 115200}; /* baud bas static int outs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; /* 1 to 16 */ static int ins[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; /* 1 to 16 */ static int adaptor[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = SNDRV_SERIAL_SOUNDCANVAS}; -static int droponfull[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS -1)] = SNDRV_SERIAL_NORMALBUFF }; +static bool droponfull[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS -1)] = SNDRV_SERIAL_NORMALBUFF }; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Serial MIDI."); diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c index d79d6ed..9d97478 100644 --- a/sound/drivers/virmidi.c +++ b/sound/drivers/virmidi.c @@ -63,7 +63,7 @@ MODULE_SUPPORTED_DEVICE("{{ALSA,Virtual rawmidi device}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; +static bool enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4}; module_param_array(index, int, NULL, 0444); diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index cd44c74..94b83b6 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c @@ -44,7 +44,7 @@ MODULE_SUPPORTED_DEVICE("{{Highscreen,Sound-Boostar 16 3D}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c index 34ab69b..2af77fa 100644 --- a/sound/isa/ad1848/ad1848.c +++ b/sound/isa/ad1848/ad1848.c @@ -43,11 +43,11 @@ MODULE_SUPPORTED_DEVICE("{{Analog Devices,AD1848}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */ static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ -static int thinkpad[SNDRV_CARDS]; /* Thinkpad special case */ +static bool thinkpad[SNDRV_CARDS]; /* Thinkpad special case */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard."); diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c index 7465ae0..4d50c69 100644 --- a/sound/isa/adlib.c +++ b/sound/isa/adlib.c @@ -18,7 +18,7 @@ MODULE_LICENSE("GPL"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; module_param_array(index, int, NULL, 0444); diff --git a/sound/isa/als100.c b/sound/isa/als100.c index fc5b38f..d1f4351 100644 --- a/sound/isa/als100.c +++ b/sound/isa/als100.c @@ -54,7 +54,7 @@ MODULE_LICENSE("GPL"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c index e55f3eb..6a2c78e 100644 --- a/sound/isa/azt2320.c +++ b/sound/isa/azt2320.c @@ -55,7 +55,7 @@ MODULE_SUPPORTED_DEVICE("{{Aztech Systems,PRO16V}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ static long wss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index c94578d..7bd5e33 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -69,9 +69,9 @@ MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8330,isapnp:{CMI0001,@@@0001,@X@0001}}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; #ifdef CONFIG_PNP -static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; +static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; #endif static long sbport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; static int sbirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c index 6d81fa7..99dda45 100644 --- a/sound/isa/cs423x/cs4231.c +++ b/sound/isa/cs423x/cs4231.c @@ -41,7 +41,7 @@ MODULE_SUPPORTED_DEVICE("{{Crystal Semiconductors,CS4231}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */ diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index f5a94b6..740c51a 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c @@ -74,9 +74,9 @@ MODULE_ALIAS("snd_cs4232"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ #ifdef CONFIG_PNP -static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; +static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; #endif static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ static long cport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index 9a1a6f2..b036e60 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c @@ -51,9 +51,9 @@ MODULE_ALIAS("snd_es968"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ #ifdef CONFIG_PNP -static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; +static bool isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; #endif -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* Usually 0x388 */ static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1}; diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 98e3ac1..c20baaf 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -1964,9 +1964,9 @@ MODULE_SUPPORTED_DEVICE("{{ESS,ES1868 PnP AudioDrive}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ #ifdef CONFIG_PNP -static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; +static bool isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; #endif static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */ #ifndef CONFIG_PNP diff --git a/sound/isa/galaxy/galaxy.c b/sound/isa/galaxy/galaxy.c index e51d324..55e2078 100644 --- a/sound/isa/galaxy/galaxy.c +++ b/sound/isa/galaxy/galaxy.c @@ -35,7 +35,7 @@ MODULE_LICENSE("GPL"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard."); diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index d729650..bf63336 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c @@ -42,7 +42,7 @@ MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound Classic}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x230,0x240,0x250,0x260 */ static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 3,5,9,11,12,15 */ static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 1,3,5,6,7 */ diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index 597accd..bc10cc2 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c @@ -46,7 +46,7 @@ MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound Extreme}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ static long gf1_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS) - 1] = -1}; /* 0x210,0x220,0x230,0x240,0x250,0x260,0x270 */ static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS) - 1] = -1}; /* 0x300,0x310,0x320 */ diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index 933cb0f..41c3f44 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c @@ -40,7 +40,7 @@ MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound MAX}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x230,0x240,0x250,0x260 */ static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 2,3,5,9,11,12,15 */ static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 1,3,5,6,7 */ diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 8e7e194..a76bc8d 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -55,9 +55,9 @@ MODULE_SUPPORTED_DEVICE("{{AMD,InterWave STB with TEA6330T}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ #ifdef CONFIG_PNP -static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; +static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; #endif static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x210,0x220,0x230,0x240,0x250,0x260 */ #ifdef SNDRV_STB diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c index 0961e2c..29cc8e1 100644 --- a/sound/isa/msnd/msnd_pinnacle.c +++ b/sound/isa/msnd/msnd_pinnacle.c @@ -785,7 +785,7 @@ static int write_ndelay[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 1 }; static int calibrate_signal; #ifdef CONFIG_PNP -static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(isapnp, bool, NULL, 0444); MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard."); #define has_isapnp(x) isapnp[x] diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 64a9a21..f6cc0b9 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -46,9 +46,9 @@ MODULE_SUPPORTED_DEVICE("{{Yamaha,YMF719E-S}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ #ifdef CONFIG_PNP -static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; +static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; #endif static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0xf86,0x370,0x100 */ static long sb_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index 3785b7a..c24594c 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c @@ -61,7 +61,7 @@ static int dma2 = SNDRV_DEFAULT_DMA1; /* 0,1,3 */ static int wss; static int ide; #ifdef CONFIG_PNP -static int isapnp = 1; /* Enable ISA PnP detection */ +static bool isapnp = 1; /* Enable ISA PnP detection */ #endif module_param(index, int, 0444); diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 97871be..babaedd 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -63,7 +63,7 @@ MODULE_SUPPORTED_DEVICE("{{OPTi,82C924 (AD1848)}," static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ -//static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ +//static bool enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ #ifdef CONFIG_PNP static int isapnp = 1; /* Enable ISA PnP detection */ #endif diff --git a/sound/isa/sb/jazz16.c b/sound/isa/sb/jazz16.c index 54e3c2c..410758c 100644 --- a/sound/isa/sb/jazz16.c +++ b/sound/isa/sb/jazz16.c @@ -36,7 +36,7 @@ MODULE_LICENSE("GPL"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ static unsigned long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; static unsigned long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 115c774..39b8eca 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c @@ -68,9 +68,9 @@ MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB AWE 32}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ #ifdef CONFIG_PNP -static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; +static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; #endif static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */ static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x330,0x300 */ diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index 453ef28..ab5cebe 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c @@ -36,7 +36,7 @@ MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB 1.0/SB 2.0/SB Pro}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,10 */ static int dma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 1,3 */ diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c index 207c161..d97d0f3 100644 --- a/sound/isa/sc6000.c +++ b/sound/isa/sc6000.c @@ -48,7 +48,7 @@ MODULE_SUPPORTED_DEVICE("{{Gallant, SC-6000}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220, 0x240 */ static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5, 7, 9, 10, 11 */ static long mss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x530, 0xe80 */ diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index 150b96b..e0a7327 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c @@ -38,9 +38,9 @@ MODULE_SUPPORTED_DEVICE("{{Turtle Beach,Maui/Tropez/Tropez+}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ #ifdef CONFIG_PNP -static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; +static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; #endif static long cs4232_pcm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ static int cs4232_pcm_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */ @@ -51,7 +51,7 @@ static int ics2115_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 2,9,11,12,15 */ static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ -static int use_cs4232_midi[SNDRV_CARDS]; +static bool use_cs4232_midi[SNDRV_CARDS]; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for WaveFront soundcard."); diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c index 8a197fd..98d23bd 100644 --- a/sound/oss/ad1848.c +++ b/sound/oss/ad1848.c @@ -119,9 +119,9 @@ ad1848_port_info; static struct address_info cfg; static int nr_ad1848_devs; -static int deskpro_xl; -static int deskpro_m; -static int soundpro; +static bool deskpro_xl; +static bool deskpro_m; +static bool soundpro; static volatile signed char irq2dev[17] = { -1, -1, -1, -1, -1, -1, -1, -1, @@ -177,7 +177,7 @@ static struct { #ifdef CONFIG_PNP static int isapnp = 1; static int isapnpjump; -static int reverse; +static bool reverse; static int audio_activated; #else diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c index 7b5c77b3..eba7345 100644 --- a/sound/oss/msnd_pinnacle.c +++ b/sound/oss/msnd_pinnacle.c @@ -1701,7 +1701,7 @@ static int joystick_io __initdata = CONFIG_MSNDPIN_JOYSTICK_IO; #ifndef CONFIG_MSNDPIN_DIGITAL # define CONFIG_MSNDPIN_DIGITAL 0 #endif -static int digital __initdata = CONFIG_MSNDPIN_DIGITAL; +static bool digital __initdata = CONFIG_MSNDPIN_DIGITAL; #endif /* MSND_CLASSIC */ diff --git a/sound/oss/pas2_card.c b/sound/oss/pas2_card.c index 7f377ec..dabf8a8 100644 --- a/sound/oss/pas2_card.c +++ b/sound/oss/pas2_card.c @@ -41,19 +41,19 @@ static int pas_irq; static int pas_sb_base; DEFINE_SPINLOCK(pas_lock); #ifndef CONFIG_PAS_JOYSTICK -static int joystick; +static bool joystick; #else -static int joystick = 1; +static bool joystick = 1; #endif #ifdef SYMPHONY_PAS -static int symphony = 1; +static bool symphony = 1; #else -static int symphony; +static bool symphony; #endif #ifdef BROKEN_BUS_CLOCK -static int broken_bus_clock = 1; +static bool broken_bus_clock = 1; #else -static int broken_bus_clock; +static bool broken_bus_clock; #endif static struct address_info cfg; diff --git a/sound/oss/pss.c b/sound/oss/pss.c index 2fc0624..0f32a56 100644 --- a/sound/oss/pss.c +++ b/sound/oss/pss.c @@ -117,9 +117,9 @@ /* If compiled into kernel, it enable or disable pss mixer */ #ifdef CONFIG_PSS_MIXER -static int pss_mixer = 1; +static bool pss_mixer = 1; #else -static int pss_mixer; +static bool pss_mixer; #endif @@ -147,7 +147,7 @@ static DEFINE_SPINLOCK(lock); static int pss_initialized; static int nonstandard_microcode; static int pss_cdrom_port = -1; /* Parameter for the PSS cdrom port */ -static int pss_enable_joystick; /* Parameter for enabling the joystick */ +static bool pss_enable_joystick; /* Parameter for enabling the joystick */ static coproc_operations pss_coproc_operations; static void pss_write(pss_confdata *devc, int data) @@ -1133,8 +1133,8 @@ static int mss_irq __initdata = -1; static int mss_dma __initdata = -1; static int mpu_io __initdata = -1; static int mpu_irq __initdata = -1; -static int pss_no_sound = 0; /* Just configure non-sound components */ -static int pss_keep_settings = 1; /* Keep hardware settings at module exit */ +static bool pss_no_sound = 0; /* Just configure non-sound components */ +static bool pss_keep_settings = 1; /* Keep hardware settings at module exit */ static char *pss_firmware = "/etc/sound/pss_synth"; module_param(pss_io, int, 0); diff --git a/sound/oss/trix.c b/sound/oss/trix.c index e04169e..944e0c0 100644 --- a/sound/oss/trix.c +++ b/sound/oss/trix.c @@ -31,7 +31,7 @@ static int mpu; -static int joystick; +static bool joystick; static unsigned char trix_read(int addr) { diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index fac51ee..9473fca 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c @@ -42,7 +42,7 @@ MODULE_AUTHOR("Jaroslav Kysela "); MODULE_DESCRIPTION("Universal interface for Audio Codec '97"); MODULE_LICENSE("GPL"); -static int enable_loopback; +static bool enable_loopback; module_param(enable_loopback, bool, 0444); MODULE_PARM_DESC(enable_loopback, "Enable AC97 ADC/DAC Loopback Control"); diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index 6e31118..9d91d61 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c @@ -66,7 +66,7 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; module_param_array(id, charp, NULL, 0444); MODULE_PARM_DESC(id, "ID string for the AD1889 soundcard."); -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(enable, bool, NULL, 0444); MODULE_PARM_DESC(enable, "Enable AD1889 soundcard."); diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index ef85ac5..bdd6164 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -48,7 +48,7 @@ MODULE_SUPPORTED_DEVICE("{{ALI,M5451,pci},{ALI,M5451}}"); static int index = SNDRV_DEFAULT_IDX1; /* Index */ static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ static int pcm_channels = 32; -static int spdif; +static bool spdif; module_param(index, int, 0444); MODULE_PARM_DESC(index, "Index value for ALI M5451 PCI Audio."); @@ -60,7 +60,7 @@ module_param(spdif, bool, 0444); MODULE_PARM_DESC(spdif, "Support SPDIF I/O"); /* just for backward compatibility */ -static int enable; +static bool enable; module_param(enable, bool, 0444); diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index 28ef40e..3269b80 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c @@ -90,7 +90,7 @@ MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS4000}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ #ifdef SUPPORT_JOYSTICK static int joystick_port[SNDRV_CARDS]; #endif diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index f4b9e2b..e9de799 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -63,8 +63,8 @@ MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; -static int enable_hpi_hwdep = 1; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable_hpi_hwdep = 1; module_param_array(index, int, NULL, S_IRUGO); MODULE_PARM_DESC(index, "ALSA index value for AudioScience soundcard."); diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 15e4e5e..590682f 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c @@ -43,7 +43,7 @@ static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ static int ac97_clock = 48000; static char *ac97_quirk; -static int spdif_aclink = 1; +static bool spdif_aclink = 1; static int ac97_codec = -1; module_param(index, int, 0444); @@ -60,7 +60,7 @@ module_param(spdif_aclink, bool, 0444); MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link."); /* just for backward compatibility */ -static int enable; +static bool enable; module_param(enable, bool, 0444); diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index 57bf8f4..524d35f 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c @@ -51,7 +51,7 @@ module_param(ac97_clock, int, 0444); MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); /* just for backward compatibility */ -static int enable; +static bool enable; module_param(enable, bool, 0444); diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c index dc326be..762bb10 100644 --- a/sound/pci/au88x0/au88x0.c +++ b/sound/pci/au88x0/au88x0.c @@ -26,7 +26,7 @@ // module parameters (see "Module Parameters") static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; static int pcifix[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 255 }; module_param_array(index, int, NULL, 0444); diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c index 7a58115..1c523193 100644 --- a/sound/pci/aw2/aw2-alsa.c +++ b/sound/pci/aw2/aw2-alsa.c @@ -153,7 +153,7 @@ static int snd_aw2_control_switch_capture_put(struct snd_kcontrol *kcontrol, ********************************/ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Audiowerk2 soundcard."); diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index bc1e683..95ffa6a 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c @@ -301,7 +301,7 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ module_param_array(id, charp, NULL, 0444); MODULE_PARM_DESC(id, "ID string for AZF3328 soundcard."); -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ module_param_array(enable, bool, NULL, 0444); MODULE_PARM_DESC(enable, "Enable AZF3328 soundcard."); diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index c1c2d0c..62d6163 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c @@ -42,9 +42,9 @@ MODULE_SUPPORTED_DEVICE("{{Brooktree,Bt878}," static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ static int digital_rate[SNDRV_CARDS]; /* digital input rate */ -static int load_all; /* allow to load the non-whitelisted cards */ +static bool load_all; /* allow to load the non-whitelisted cards */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Bt87x soundcard"); diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index fe99fde..08d6ebf 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c @@ -156,7 +156,7 @@ MODULE_SUPPORTED_DEVICE("{{Creative,SB CA0106 chip}}"); // module parameters (see "Module Parameters") static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */ module_param_array(index, int, NULL, 0444); diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 954c993..19b0626 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -54,10 +54,10 @@ MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8738}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ static long mpu_port[SNDRV_CARDS]; static long fm_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; -static int soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; +static bool soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; #ifdef SUPPORT_JOYSTICK static int joystick_port[SNDRV_CARDS]; #endif diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index a6c6c5c..a9f368f 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -44,8 +44,8 @@ MODULE_SUPPORTED_DEVICE("{{Cirrus Logic,CS4281}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ -static int dual_codec[SNDRV_CARDS]; /* dual codec */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ +static bool dual_codec[SNDRV_CARDS]; /* dual codec */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for CS4281 soundcard."); diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c index a4ecb40..819d79d 100644 --- a/sound/pci/cs46xx/cs46xx.c +++ b/sound/pci/cs46xx/cs46xx.c @@ -46,10 +46,10 @@ MODULE_SUPPORTED_DEVICE("{{Cirrus Logic,Sound Fusion (CS4280)}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ -static int external_amp[SNDRV_CARDS]; -static int thinkpad[SNDRV_CARDS]; -static int mmap_valid[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool external_amp[SNDRV_CARDS]; +static bool thinkpad[SNDRV_CARDS]; +static bool mmap_valid[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for the CS46xx soundcard."); diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index b8959d2..a2fb217 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c @@ -57,7 +57,7 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for " DRIVER_NAME); diff --git a/sound/pci/ctxfi/cttimer.c b/sound/pci/ctxfi/cttimer.c index 93b0aed..03fb909 100644 --- a/sound/pci/ctxfi/cttimer.c +++ b/sound/pci/ctxfi/cttimer.c @@ -15,8 +15,8 @@ #include "cthardware.h" #include "cttimer.h" -static int use_system_timer; -MODULE_PARM_DESC(use_system_timer, "Foce to use system-timer"); +static bool use_system_timer; +MODULE_PARM_DESC(use_system_timer, "Force to use system-timer"); module_param(use_system_timer, bool, S_IRUGO); struct ct_timer_ops { diff --git a/sound/pci/ctxfi/xfi.c b/sound/pci/ctxfi/xfi.c index 33931ef..15d95d2 100644 --- a/sound/pci/ctxfi/xfi.c +++ b/sound/pci/ctxfi/xfi.c @@ -32,7 +32,7 @@ module_param(multiple, uint, S_IRUGO); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; static unsigned int subsystem[SNDRV_CARDS]; module_param_array(index, int, NULL, 0444); diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 9fd694c..595c11f 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -26,7 +26,7 @@ MODULE_DEVICE_TABLE(pci, snd_echo_ids); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for " ECHOCARD_NAME " soundcard."); diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index eaa198e..790c65d 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c @@ -44,13 +44,13 @@ MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB Live!/PCI512/E-mu APS}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ static int extin[SNDRV_CARDS]; static int extout[SNDRV_CARDS]; static int seq_ports[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4}; static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64}; static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128}; -static int enable_ir[SNDRV_CARDS]; +static bool enable_ir[SNDRV_CARDS]; static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */ static uint delay_pcm_irq[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 2228be9..47a651c 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c @@ -50,7 +50,7 @@ MODULE_SUPPORTED_DEVICE("{{Dell Creative Labs,SB Live!}"); // module parameters (see "Module Parameters") static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for the EMU10K1X soundcard."); diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index d085ad0..47a245e 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c @@ -83,12 +83,12 @@ MODULE_SUPPORTED_DEVICE("{{Ensoniq,AudioPCI ES1371/73}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ #ifdef SUPPORT_JOYSTICK #ifdef CHIP1371 static int joystick_port[SNDRV_CARDS]; #else -static int joystick[SNDRV_CARDS]; +static bool joystick[SNDRV_CARDS]; #endif #endif #ifdef CHIP1371 diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 04cc21f..53eb76b 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -79,7 +79,7 @@ MODULE_SUPPORTED_DEVICE("{{ESS,ES1938}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for ESS Solo-1 soundcard."); diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 297a151..cb557c6 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c @@ -132,7 +132,7 @@ MODULE_SUPPORTED_DEVICE("{{ESS,Maestro 2e}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ static int total_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1024 }; static int pcm_substreams_p[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4 }; static int pcm_substreams_c[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1 }; @@ -140,7 +140,7 @@ static int clock[SNDRV_CARDS]; static int use_pm[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; static int enable_mpu[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; #ifdef SUPPORT_JOYSTICK -static int joystick[SNDRV_CARDS]; +static bool joystick[SNDRV_CARDS]; #endif module_param_array(index, int, NULL, 0444); diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index ec05ef5..9597ef1 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c @@ -48,7 +48,7 @@ MODULE_SUPPORTED_DEVICE("{{ForteMedia,FM801}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ /* * Enable TEA575x tuner * 1 = MediaForte 256-PCS diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 7d98240..06fe2c5 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -58,13 +58,13 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; static char *model[SNDRV_CARDS]; static int position_fix[SNDRV_CARDS]; static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; static int probe_only[SNDRV_CARDS]; -static int single_cmd; +static bool single_cmd; static int enable_msi = -1; #ifdef CONFIG_SND_HDA_PATCH_LOADER static char *patch[SNDRV_CARDS]; @@ -116,12 +116,12 @@ MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " * this may give more power-saving, but will take longer time to * wake up. */ -static int power_save_controller = 1; +static bool power_save_controller = 1; module_param(power_save_controller, bool, 0644); MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); #endif -static int align_buffer_size = 1; +static bool align_buffer_size = 1; module_param(align_buffer_size, bool, 0644); MODULE_PARM_DESC(align_buffer_size, "Force buffer and period sizes to be multiple of 128 bytes."); diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 44446f2..132a86e 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -84,9 +84,9 @@ MODULE_SUPPORTED_DEVICE("{" static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ static char *model[SNDRV_CARDS]; -static int omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */ +static bool omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */ static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transceiver reset timeout value in msec */ static int dxr_enable[SNDRV_CARDS]; /* DXR enable for DMX6FIRE */ diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 4353e76..4dc5124 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -80,7 +80,7 @@ MODULE_SUPPORTED_DEVICE("{" static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ static char *model[SNDRV_CARDS]; module_param_array(index, int, NULL, 0444); diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 11718b49..40b181b 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -79,9 +79,9 @@ static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ static int ac97_clock; static char *ac97_quirk; -static int buggy_semaphore; +static bool buggy_semaphore; static int buggy_irq = -1; /* auto-check */ -static int xbox; +static bool xbox; static int spdif_aclink = -1; static int inside_vm = -1; @@ -105,7 +105,7 @@ module_param(inside_vm, bool, 0444); MODULE_PARM_DESC(inside_vm, "KVM/Parallels optimization."); /* just for backward compatibility */ -static int enable; +static bool enable; module_param(enable, bool, 0444); static int joystick; module_param(joystick, int, 0444); diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 0f7041e..d689913 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c @@ -68,7 +68,7 @@ module_param(ac97_clock, int, 0444); MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); /* just for backward compatibility */ -static int enable; +static bool enable; module_param(enable, bool, 0444); /* diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 841864b..8fea45a 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c @@ -408,7 +408,7 @@ MODULE_FIRMWARE("korg/k1212.dsp"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Korg 1212 soundcard."); diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c index 924168e..3759827 100644 --- a/sound/pci/lola/lola.c +++ b/sound/pci/lola/lola.c @@ -35,7 +35,7 @@ /* Standard options */ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Digigram Lola driver."); diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index 04ae84b2..d94c0c2 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c @@ -42,7 +42,7 @@ MODULE_SUPPORTED_DEVICE("{digigram lx6464es{}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Digigram LX6464ES interface."); diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 863c8bd..78229b0 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -64,8 +64,8 @@ MODULE_FIRMWARE("ess/maestro3_assp_minisrc.fw"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* all enabled */ -static int external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* all enabled */ +static bool external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; static int amp_gpio[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1}; module_param_array(index, int, NULL, 0444); diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index a0bd1d9..487837c 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -49,7 +49,7 @@ MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Digigram " CARD_NAME " soundcard."); diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index c6c45d9..ade2c64 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c @@ -57,12 +57,12 @@ static int index = SNDRV_DEFAULT_IDX1; /* Index */ static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ static int playback_bufsize = 16; static int capture_bufsize = 16; -static int force_ac97; /* disabled as default */ +static bool force_ac97; /* disabled as default */ static int buffer_top; /* not specified */ -static int use_cache; /* disabled */ -static int vaio_hack; /* disabled */ -static int reset_workaround; -static int reset_workaround_2; +static bool use_cache; /* disabled */ +static bool vaio_hack; /* disabled */ +static bool reset_workaround; +static bool reset_workaround_2; module_param(index, int, 0444); MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); @@ -86,7 +86,7 @@ module_param(reset_workaround_2, bool, 0444); MODULE_PARM_DESC(reset_workaround_2, "Enable extended AC97 RESET workaround for some other laptops."); /* just for backward compatibility */ -static int enable; +static bool enable; module_param(enable, bool, 0444); diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index 5f3a13d..eab663e 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c @@ -74,7 +74,7 @@ MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8786}" static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "card index"); diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 4149a0c..3fdee49 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c @@ -32,7 +32,7 @@ MODULE_SUPPORTED_DEVICE("{{Asus,AV66},{Asus,AV100},{Asus,AV200}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "card index"); diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 56a5265..fd1809a 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -52,8 +52,8 @@ MODULE_SUPPORTED_DEVICE("{{Digigram," DRIVER_NAME "}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ -static int mono[SNDRV_CARDS]; /* capture mono only */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ +static bool mono[SNDRV_CARDS]; /* capture mono only */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Digigram " DRIVER_NAME " soundcard"); diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index dcbedd3..0481d94 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c @@ -122,7 +122,7 @@ MODULE_FIRMWARE("riptide.hex"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; #ifdef SUPPORT_JOYSTICK static int joystick_port[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS - 1)] = 0x200 }; diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index 21bcb47..b4819d5 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c @@ -89,8 +89,8 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ -static int fullduplex[SNDRV_CARDS]; // = {[0 ... (SNDRV_CARDS - 1)] = 1}; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool fullduplex[SNDRV_CARDS]; // = {[0 ... (SNDRV_CARDS - 1)] = 1}; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for RME Digi32 soundcard."); diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 4585c97..ba89415 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -53,7 +53,7 @@ MODULE_SUPPORTED_DEVICE("{{RME,Digi96}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for RME Digi96 soundcard."); diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index f2a3758..0111203 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -45,7 +45,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for RME Hammerfall DSP interface."); diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 19ee220..d623451 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -61,7 +61,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for RME HDSPM interface."); diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 732c5e8..b737d16 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c @@ -38,8 +38,8 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ -static int precise_ptr[SNDRV_CARDS]; /* Enable precise pointer */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool precise_ptr[SNDRV_CARDS]; /* Enable precise pointer */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for RME Digi9652 (Hammerfall) soundcard."); diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index 7331b2d..ff500a8 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c @@ -40,7 +40,7 @@ MODULE_SUPPORTED_DEVICE("{{SiS,SiS7019 Audio Accelerator}}"); static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ -static int enable = 1; +static bool enable = 1; static int codecs = 1; module_param(index, int, 0444); diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index 31b6ad3..54cc802 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c @@ -52,9 +52,9 @@ MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ -static int reverb[SNDRV_CARDS]; -static int mge[SNDRV_CARDS]; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool reverb[SNDRV_CARDS]; +static bool mge[SNDRV_CARDS]; static unsigned int dmaio = 0x7a00; /* DDMA i/o address */ module_param_array(index, int, NULL, 0444); diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c index deb04b9..5f1def7 100644 --- a/sound/pci/trident/trident.c +++ b/sound/pci/trident/trident.c @@ -47,7 +47,7 @@ MODULE_SUPPORTED_DEVICE("{{Trident,4DWave DX}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 32}; static int wavetable_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8192}; diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index ae98d56..7563040 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -80,7 +80,7 @@ static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ static long mpu_port; #ifdef SUPPORT_JOYSTICK -static int joystick; +static bool joystick; #endif static int ac97_clock = 48000; static char *ac97_quirk; @@ -110,7 +110,7 @@ module_param(nodelay, int, 0444); MODULE_PARM_DESC(nodelay, "Disable 500ms init delay"); /* just for backward compatibility */ -static int enable; +static bool enable; module_param(enable, bool, 0444); diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index 80a9c2b..5efcbca 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c @@ -66,7 +66,7 @@ module_param(ac97_clock, int, 0444); MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); /* just for backward compatibility */ -static int enable; +static bool enable; module_param(enable, bool, 0444); diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c index 6765822..6a534bf 100644 --- a/sound/pci/vx222/vx222.c +++ b/sound/pci/vx222/vx222.c @@ -37,8 +37,8 @@ MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ -static int mic[SNDRV_CARDS]; /* microphone */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool mic[SNDRV_CARDS]; /* microphone */ static int ibl[SNDRV_CARDS]; /* microphone */ module_param_array(index, int, NULL, 0444); diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index e97ddca..e57b89e8 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c @@ -41,13 +41,13 @@ MODULE_SUPPORTED_DEVICE("{{Yamaha,YMF724}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ static long fm_port[SNDRV_CARDS]; static long mpu_port[SNDRV_CARDS]; #ifdef SUPPORT_JOYSTICK static long joystick_port[SNDRV_CARDS]; #endif -static int rear_switch[SNDRV_CARDS]; +static bool rear_switch[SNDRV_CARDS]; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for the Yamaha DS-1 PCI soundcard."); diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 6af41d2..830839a 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -39,7 +39,7 @@ MODULE_SUPPORTED_DEVICE("{{Sound Core," CARD_NAME "}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 9e361c9..512f0b4 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -39,7 +39,7 @@ MODULE_SUPPORTED_DEVICE("{{Digigram,VXPocket},{Digigram,VXPocket440}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ static int ibl[SNDRV_CARDS]; module_param_array(index, int, NULL, 0444); diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c index 6564569..5a4e263 100644 --- a/sound/ppc/powermac.c +++ b/sound/ppc/powermac.c @@ -36,7 +36,7 @@ MODULE_LICENSE("GPL"); static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ -static int enable_beep = 1; +static bool enable_beep = 1; module_param(index, int, 0444); MODULE_PARM_DESC(index, "Index value for " CHIP_NAME " soundchip."); diff --git a/sound/sh/aica.c b/sound/sh/aica.c index 1120ca4..391a38c 100644 --- a/sound/sh/aica.c +++ b/sound/sh/aica.c @@ -55,7 +55,7 @@ MODULE_FIRMWARE("aica_firmware.bin"); #define CARD_NAME "AICA" static int index = -1; static char *id; -static int enable = 1; +static bool enable = 1; module_param(index, int, 0444); MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); module_param(id, charp, 0444); diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c index f036776..b63b3a8 100644 --- a/sound/sparc/amd7930.c +++ b/sound/sparc/amd7930.c @@ -50,7 +50,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Sun AMD7930 soundcard."); diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index 9aa90e0..f2eabd3 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c @@ -40,7 +40,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ /* Enable this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Sun CS4231 soundcard."); diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index 6afe087..a6b0deb 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c @@ -80,7 +80,7 @@ MODULE_SUPPORTED_DEVICE("{{Sun,DBRI}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ /* Enable this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for Sun DBRI soundcard."); diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c index c7dca7b..a43f195 100644 --- a/sound/usb/6fire/chip.c +++ b/sound/usb/6fire/chip.c @@ -35,7 +35,7 @@ MODULE_SUPPORTED_DEVICE("{{TerraTec, DMX 6Fire USB}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable card */ static struct sfire_chip *chips[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; static struct usb_device *devices[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c index 3eb605b..7cf67e4 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c @@ -55,7 +55,7 @@ MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ static int snd_card_used[SNDRV_CARDS]; module_param_array(index, int, NULL, 0444); diff --git a/sound/usb/card.c b/sound/usb/card.c index 0f6dc0d..4a7be7b 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -78,14 +78,14 @@ MODULE_SUPPORTED_DEVICE("{{Generic,USB Audio}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ /* Vendor/product IDs for this card */ static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; static int nrpacks = 8; /* max. number of packets per urb */ -static int async_unlink = 1; +static bool async_unlink = 1; static int device_setup[SNDRV_CARDS]; /* device parameter for this card */ -static int ignore_ctl_error; +static bool ignore_ctl_error; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for the USB audio adapter."); diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c index c0609c2..e428058 100644 --- a/sound/usb/misc/ua101.c +++ b/sound/usb/misc/ua101.c @@ -52,7 +52,7 @@ MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; static unsigned int queue_length = 21; module_param_array(index, int, NULL, 0444); diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 726c1a7..86f76a9 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c @@ -37,7 +37,7 @@ MODULE_LICENSE("GPL"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ /* Enable this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for "NAME_ALLCAPS"."); diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index cbd37f2..1d694586 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c @@ -154,7 +154,7 @@ MODULE_SUPPORTED_DEVICE("{{TASCAM(0x1604), "NAME_ALLCAPS"(0x8001)(0x8005)(0x8007 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for "NAME_ALLCAPS"."); -- cgit v1.1 From cde944803d12450f70f0adc4d418afcd8e42db2e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 19 Dec 2011 10:32:48 +0100 Subject: ALSA: Add missing module parameters for als300 and cs5530 drivers These drviers defined only variables but didn't declare as module parameters. Also fix the enable variable to bool type. Signed-off-by: Takashi Iwai --- sound/pci/als300.c | 9 ++++++++- sound/pci/cs5530.c | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/als300.c b/sound/pci/als300.c index 8dc77a0..8196e22 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c @@ -115,7 +115,14 @@ MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS300},{Avance Logic,ALS300+}}"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; + +module_param_array(index, int, NULL, 0444); +MODULE_PARM_DESC(index, "Index value for ALS300 sound card."); +module_param_array(id, charp, NULL, 0444); +MODULE_PARM_DESC(id, "ID string for ALS300 sound card."); +module_param_array(enable, bool, NULL, 0444); +MODULE_PARM_DESC(enable, "Enable ALS300 sound card."); struct snd_als300 { unsigned long port; diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c index 958f494..c47cabf 100644 --- a/sound/pci/cs5530.c +++ b/sound/pci/cs5530.c @@ -50,7 +50,14 @@ MODULE_LICENSE("GPL"); static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; -static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; +static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; + +module_param_array(index, int, NULL, 0444); +MODULE_PARM_DESC(index, "Index value for CS5530 Audio driver."); +module_param_array(id, charp, NULL, 0444); +MODULE_PARM_DESC(id, "ID string for CS5530 Audio driver."); +module_param_array(enable, bool, NULL, 0444); +MODULE_PARM_DESC(enable, "Enable CS5530 Audio driver."); struct snd_cs5530 { struct snd_card *card; -- cgit v1.1 From 5ee65ec628090a3dbfbd900e4174f56e92e70945 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 19 Dec 2011 13:13:31 +0800 Subject: ASoC: Convert max9850 to table based DAPM and control init Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/max9850.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/max9850.c b/sound/soc/codecs/max9850.c index 7dfd6e8..47060d2 100644 --- a/sound/soc/codecs/max9850.c +++ b/sound/soc/codecs/max9850.c @@ -86,7 +86,7 @@ SND_SOC_DAPM_INPUT("INL"), SND_SOC_DAPM_INPUT("INR"), }; -static const struct snd_soc_dapm_route intercon[] = { +static const struct snd_soc_dapm_route max9850_dapm_routes[] = { /* output mixer */ {"Output Mixer", NULL, "DAC"}, {"Output Mixer", "Line In Switch", "Line Input"}, @@ -293,7 +293,6 @@ static int max9850_resume(struct snd_soc_codec *codec) static int max9850_probe(struct snd_soc_codec *codec) { - struct snd_soc_dapm_context *dapm = &codec->dapm; int ret; ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C); @@ -309,13 +308,6 @@ static int max9850_probe(struct snd_soc_codec *codec) /* set slew-rate 125ms */ snd_soc_update_bits(codec, MAX9850_CHARGE_PUMP, 0xff, 0xc0); - snd_soc_dapm_new_controls(dapm, max9850_dapm_widgets, - ARRAY_SIZE(max9850_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon)); - - snd_soc_add_controls(codec, max9850_controls, - ARRAY_SIZE(max9850_controls)); - return 0; } @@ -328,6 +320,13 @@ static struct snd_soc_codec_driver soc_codec_dev_max9850 = { .reg_word_size = sizeof(u8), .reg_cache_default = max9850_reg, .volatile_register = max9850_volatile_register, + + .controls = max9850_controls, + .num_controls = ARRAY_SIZE(max9850_controls), + .dapm_widgets = max9850_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(max9850_dapm_widgets), + .dapm_routes = max9850_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(max9850_dapm_routes), }; static int __devinit max9850_i2c_probe(struct i2c_client *i2c, -- cgit v1.1 From 58fa8e456c8e8329fe829994202b43286eb0de3f Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 19 Dec 2011 13:54:38 +0800 Subject: ASoC: Convert uda1380 to table based DAPM and control init Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/uda1380.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index 83e45d2..8f734d6 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c @@ -373,7 +373,7 @@ static const struct snd_soc_dapm_widget uda1380_dapm_widgets[] = { SND_SOC_DAPM_PGA("HeadPhone Driver", UDA1380_PM, 13, 0, NULL, 0), }; -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route uda1380_dapm_routes[] = { /* output mux */ {"HeadPhone Driver", NULL, "Output Mux"}, @@ -410,17 +410,6 @@ static const struct snd_soc_dapm_route audio_map[] = { {"Right PGA", NULL, "VINR"}, }; -static int uda1380_add_widgets(struct snd_soc_codec *codec) -{ - struct snd_soc_dapm_context *dapm = &codec->dapm; - - snd_soc_dapm_new_controls(dapm, uda1380_dapm_widgets, - ARRAY_SIZE(uda1380_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - - return 0; -} - static int uda1380_set_dai_fmt_both(struct snd_soc_dai *codec_dai, unsigned int fmt) { @@ -764,10 +753,6 @@ static int uda1380_probe(struct snd_soc_codec *codec) break; } - snd_soc_add_controls(codec, uda1380_snd_controls, - ARRAY_SIZE(uda1380_snd_controls)); - uda1380_add_widgets(codec); - return 0; err_free_gpio: @@ -802,6 +787,13 @@ static struct snd_soc_codec_driver soc_codec_dev_uda1380 = { .reg_word_size = sizeof(u16), .reg_cache_default = uda1380_reg, .reg_cache_step = 1, + + .controls = uda1380_snd_controls, + .num_controls = ARRAY_SIZE(uda1380_snd_controls), + .dapm_widgets = uda1380_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(uda1380_dapm_widgets), + .dapm_routes = uda1380_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(uda1380_dapm_routes), }; #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) -- cgit v1.1 From 58783faf281559379871d85faf2ef53e97d075e0 Mon Sep 17 00:00:00 2001 From: Leon Romanovsky Date: Mon, 19 Dec 2011 21:51:52 +0200 Subject: ASoC: Tegra machine ASoC driver for boards using ALC5332 codec At this stage only Toshiba AC100/Dynabook supported. Signed-off-by: Leon Romanovsky Signed-off-by: Andrey Danin Acked-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/Kconfig | 9 ++ sound/soc/tegra/Makefile | 2 + sound/soc/tegra/tegra_alc5632.c | 213 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 224 insertions(+) create mode 100644 sound/soc/tegra/tegra_alc5632.c (limited to 'sound') diff --git a/sound/soc/tegra/Kconfig b/sound/soc/tegra/Kconfig index c6af1fd..ce1b773 100644 --- a/sound/soc/tegra/Kconfig +++ b/sound/soc/tegra/Kconfig @@ -47,3 +47,12 @@ config SND_SOC_TEGRA_TRIMSLICE help Say Y or M here if you want to add support for SoC audio on the TrimSlice platform. + +config SND_SOC_TEGRA_ALC5632 + tristate "SoC Audio support for Tegra boards using an ALC5632 codec" + depends on SND_SOC_TEGRA && I2C + select SND_SOC_TEGRA_I2S + select SND_SOC_ALC5632 + help + Say Y or M here if you want to add support for SoC audio on the + Toshiba AC100 netbook. diff --git a/sound/soc/tegra/Makefile b/sound/soc/tegra/Makefile index 4d943b3..8e584b8 100644 --- a/sound/soc/tegra/Makefile +++ b/sound/soc/tegra/Makefile @@ -14,6 +14,8 @@ obj-$(CONFIG_SND_SOC_TEGRA_SPDIF) += snd-soc-tegra-spdif.o # Tegra machine Support snd-soc-tegra-wm8903-objs := tegra_wm8903.o snd-soc-tegra-trimslice-objs := trimslice.o +snd-soc-tegra-alc5632-objs := tegra_alc5632.o obj-$(CONFIG_SND_SOC_TEGRA_WM8903) += snd-soc-tegra-wm8903.o obj-$(CONFIG_SND_SOC_TEGRA_TRIMSLICE) += snd-soc-tegra-trimslice.o +obj-$(CONFIG_SND_SOC_TEGRA_ALC5632) += snd-soc-tegra-alc5632.o diff --git a/sound/soc/tegra/tegra_alc5632.c b/sound/soc/tegra/tegra_alc5632.c new file mode 100644 index 0000000..9287eb8 --- /dev/null +++ b/sound/soc/tegra/tegra_alc5632.c @@ -0,0 +1,213 @@ +/* +* tegra_alc5632.c -- Toshiba AC100(PAZ00) machine ASoC driver +* +* Copyright (C) 2011 The AC100 Kernel Team +* +* Authors: Leon Romanovsky +* Andrey Danin +* Marc Dietrich +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "../codecs/alc5632.h" + +#include "tegra_das.h" +#include "tegra_i2s.h" +#include "tegra_pcm.h" +#include "tegra_asoc_utils.h" + +#define DRV_NAME "tegra-alc5632" + +struct tegra_alc5632 { + struct tegra_asoc_utils_data util_data; +}; + +static int tegra_alc5632_asoc_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->codec_dai; + struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_card *card = codec->card; + struct tegra_alc5632 *alc5632 = snd_soc_card_get_drvdata(card); + int srate, mclk; + int err; + + srate = params_rate(params); + mclk = 512 * srate; + + err = tegra_asoc_utils_set_rate(&alc5632->util_data, srate, mclk); + if (err < 0) { + dev_err(card->dev, "Can't configure clocks\n"); + return err; + } + + err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, + SND_SOC_CLOCK_IN); + if (err < 0) { + dev_err(card->dev, "codec_dai clock not set\n"); + return err; + } + + return 0; +} + +static struct snd_soc_ops tegra_alc5632_asoc_ops = { + .hw_params = tegra_alc5632_asoc_hw_params, +}; + +static struct snd_soc_jack tegra_alc5632_hs_jack; + +static struct snd_soc_jack_pin tegra_alc5632_hs_jack_pins[] = { + { + .pin = "Headset Mic", + .mask = SND_JACK_MICROPHONE, + }, + { + .pin = "Headset Stereophone", + .mask = SND_JACK_HEADPHONE, + }, +}; + +static const struct snd_soc_dapm_widget tegra_alc5632_dapm_widgets[] = { + SND_SOC_DAPM_SPK("Int Spk", NULL), + SND_SOC_DAPM_HP("Headset Stereophone", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), +}; + +static const struct snd_soc_dapm_route tegra_alc5632_audio_map[] = { + /* Internal Speaker */ + {"Int Spk", NULL, "SPKOUT"}, + {"Int Spk", NULL, "SPKOUTN"}, + + /* Headset Mic */ + {"MIC1", NULL, "MICBIAS1"}, + {"MICBIAS1", NULL, "Headset Mic"}, + + /* Headset Stereophone */ + {"Headset Stereophone", NULL, "HPR"}, + {"Headset Stereophone", NULL, "HPL"}, +}; + +static const struct snd_kcontrol_new tegra_alc5632_controls[] = { + SOC_DAPM_PIN_SWITCH("Int Spk"), +}; + +static int tegra_alc5632_asoc_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_dapm_context *dapm = &codec->dapm; + + snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, + &tegra_alc5632_hs_jack); + snd_soc_jack_add_pins(&tegra_alc5632_hs_jack, + ARRAY_SIZE(tegra_alc5632_hs_jack_pins), + tegra_alc5632_hs_jack_pins); + + snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1"); + + return 0; +} + +static struct snd_soc_dai_link tegra_alc5632_dai = { + .name = "ALC5632", + .stream_name = "ALC5632 PCM", + .codec_name = "alc5632.0-001e", + .platform_name = "tegra-pcm-audio", + .cpu_dai_name = "tegra-i2s.0", + .codec_dai_name = "alc5632-hifi", + .init = tegra_alc5632_asoc_init, + .ops = &tegra_alc5632_asoc_ops, + .dai_fmt = SND_SOC_DAIFMT_I2S + | SND_SOC_DAIFMT_NB_NF + | SND_SOC_DAIFMT_CBS_CFS, +}; + +static struct snd_soc_card snd_soc_tegra_alc5632 = { + .name = "tegra-alc5632", + .dai_link = &tegra_alc5632_dai, + .num_links = 1, + .controls = tegra_alc5632_controls, + .num_controls = ARRAY_SIZE(tegra_alc5632_controls), + .dapm_widgets = tegra_alc5632_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(tegra_alc5632_dapm_widgets), + .dapm_routes = tegra_alc5632_audio_map, + .num_dapm_routes = ARRAY_SIZE(tegra_alc5632_audio_map), + .fully_routed = true, +}; + +static __devinit int tegra_alc5632_probe(struct platform_device *pdev) +{ + struct snd_soc_card *card = &snd_soc_tegra_alc5632; + struct tegra_alc5632 *alc5632; + int ret; + + alc5632 = devm_kzalloc(&pdev->dev, + sizeof(struct tegra_alc5632), GFP_KERNEL); + if (!alc5632) { + dev_err(&pdev->dev, "Can't allocate tegra_alc5632\n"); + return -ENOMEM; + } + + ret = tegra_asoc_utils_init(&alc5632->util_data, &pdev->dev); + if (ret) + return ret; + + card->dev = &pdev->dev; + platform_set_drvdata(pdev, card); + snd_soc_card_set_drvdata(card, alc5632); + + ret = snd_soc_register_card(card); + if (ret) { + dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", + ret); + tegra_asoc_utils_fini(&alc5632->util_data); + return ret; + } + + return 0; +} + +static int __devexit tegra_alc5632_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = platform_get_drvdata(pdev); + struct tegra_alc5632 *alc5632 = snd_soc_card_get_drvdata(card); + + snd_soc_unregister_card(card); + + tegra_asoc_utils_fini(&alc5632->util_data); + + return 0; +} + +static struct platform_driver tegra_alc5632_driver = { + .driver = { + .name = DRV_NAME, + .owner = THIS_MODULE, + .pm = &snd_soc_pm_ops, + }, + .probe = tegra_alc5632_probe, + .remove = __devexit_p(tegra_alc5632_remove), +}; +module_platform_driver(tegra_alc5632_driver); + +MODULE_AUTHOR("Leon Romanovsky "); +MODULE_DESCRIPTION("Tegra+ALC5632 machine ASoC driver"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:" DRV_NAME); -- cgit v1.1 From 5ab2ab6a432e93f083db3904f9bcbaa97d4b1d35 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 14 Dec 2011 19:13:26 +0800 Subject: ASoC: Remove export of s3c_pcm_dai We don't need to export s3c_pcm_dai after multi-component patch. Thus remove export of s3c_pcm_dai and make it static. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/samsung/pcm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c index 3a29c26..5776add 100644 --- a/sound/soc/samsung/pcm.c +++ b/sound/soc/samsung/pcm.c @@ -478,7 +478,7 @@ static const struct snd_soc_dai_ops s3c_pcm_dai_ops = { .formats = SNDRV_PCM_FMTBIT_S16_LE, \ } -struct snd_soc_dai_driver s3c_pcm_dai[] = { +static struct snd_soc_dai_driver s3c_pcm_dai[] = { [0] = { .name = "samsung-pcm.0", S3C_PCM_DAI_DECLARE, @@ -488,7 +488,6 @@ struct snd_soc_dai_driver s3c_pcm_dai[] = { S3C_PCM_DAI_DECLARE, }, }; -EXPORT_SYMBOL_GPL(s3c_pcm_dai); static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) { -- cgit v1.1 From dbec3b30a601791717bc5bb827e210c3b5d6e067 Mon Sep 17 00:00:00 2001 From: Shawn Guo Date: Wed, 14 Dec 2011 15:47:46 +0800 Subject: ASoC: mxs: correct 'direction' of device_prep_dma_cyclic The commit 49920bc (dmaengine: add new enum dma_transfer_direction) changes the type of parameter 'direction' of device_prep_dma_cyclic from dma_data_direction to dma_transfer_direction. Signed-off-by: Shawn Guo Acked-by: Dong Aisheng Signed-off-by: Mark Brown --- sound/soc/mxs/mxs-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c index f39d7dd..5dfd325 100644 --- a/sound/soc/mxs/mxs-pcm.c +++ b/sound/soc/mxs/mxs-pcm.c @@ -136,7 +136,7 @@ static int snd_mxs_pcm_hw_params(struct snd_pcm_substream *substream, iprtd->period_bytes * iprtd->periods, iprtd->period_bytes, substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? - DMA_TO_DEVICE : DMA_FROM_DEVICE); + DMA_MEM_TO_DEV : DMA_DEV_TO_MEM); if (!iprtd->desc) { dev_err(&chan->dev->device, "cannot prepare slave dma\n"); return -EINVAL; -- cgit v1.1 From f521812b03eb906ece7433ffd681fd5a35c0aced Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 17 Dec 2011 15:36:52 +0800 Subject: ASoC: Use dai_fmt in edb93xx machine driver Signed-off-by: Axel Lin Acked-by: Alexander Sverdlin Signed-off-by: Mark Brown --- sound/soc/ep93xx/edb93xx.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/soc/ep93xx/edb93xx.c b/sound/soc/ep93xx/edb93xx.c index 6b90c75..9f6fecd 100644 --- a/sound/soc/ep93xx/edb93xx.c +++ b/sound/soc/ep93xx/edb93xx.c @@ -48,18 +48,6 @@ static int edb93xx_hw_params(struct snd_pcm_substream *substream, else mclk_rate = rate * 64 * 2; - err = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_IF | - SND_SOC_DAIFMT_CBS_CFS); - if (err) - return err; - - err = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_IF | - SND_SOC_DAIFMT_CBS_CFS); - if (err) - return err; - err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk_rate, SND_SOC_CLOCK_IN); if (err) @@ -80,6 +68,8 @@ static struct snd_soc_dai_link edb93xx_dai = { .cpu_dai_name = "ep93xx-i2s", .codec_name = "spi0.0", .codec_dai_name = "cs4271-hifi", + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | + SND_SOC_DAIFMT_CBS_CFS, .ops = &edb93xx_ops, }; -- cgit v1.1 From f49f85108b2b3b1aaa7632418411c401fbb6741c Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 17 Dec 2011 15:41:11 +0800 Subject: ASoC: Use dai_fmt in snappercl15 machine driver Signed-off-by: Axel Lin Reviewed-by: Mika Westerberg Signed-off-by: Mark Brown --- sound/soc/ep93xx/snappercl15.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/soc/ep93xx/snappercl15.c b/sound/soc/ep93xx/snappercl15.c index 33901d6..e97cd57 100644 --- a/sound/soc/ep93xx/snappercl15.c +++ b/sound/soc/ep93xx/snappercl15.c @@ -33,16 +33,6 @@ static int snappercl15_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai = rtd->cpu_dai; int err; - err = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_IF | - SND_SOC_DAIFMT_CBS_CFS); - - err = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_IF | - SND_SOC_DAIFMT_CBS_CFS); - if (err) - return err; - err = snd_soc_dai_set_sysclk(codec_dai, 0, CODEC_CLOCK, SND_SOC_CLOCK_IN); if (err) @@ -96,6 +86,8 @@ static struct snd_soc_dai_link snappercl15_dai = { .codec_name = "tlv320aic23-codec.0-001a", .platform_name = "ep93xx-pcm-audio", .init = snappercl15_tlv320aic23_init, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | + SND_SOC_DAIFMT_CBS_CFS, .ops = &snappercl15_ops, }; -- cgit v1.1 From 6048ef768e7bec7e1e17f48fe8d5360021928b4a Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 15 Dec 2011 11:57:57 +0800 Subject: ASoC: Rename rt562[1|2]_vol_snd_controls to alc562[1|2]_vol_snd_controls The module desciption says this is ASoC alc5621/2/3 driver. Make the naming consistent with the reset of the code. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/alc5623.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c index da97f02..6a9b621 100644 --- a/sound/soc/codecs/alc5623.c +++ b/sound/soc/codecs/alc5623.c @@ -99,7 +99,7 @@ static const unsigned int boost_tlv[] = { }; static const DECLARE_TLV_DB_SCALE(dig_tlv, 0, 600, 0); -static const struct snd_kcontrol_new rt5621_vol_snd_controls[] = { +static const struct snd_kcontrol_new alc5621_vol_snd_controls[] = { SOC_DOUBLE_TLV("Speaker Playback Volume", ALC5623_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv), SOC_DOUBLE("Speaker Playback Switch", @@ -110,7 +110,7 @@ static const struct snd_kcontrol_new rt5621_vol_snd_controls[] = { ALC5623_HP_OUT_VOL, 15, 7, 1, 1), }; -static const struct snd_kcontrol_new rt5622_vol_snd_controls[] = { +static const struct snd_kcontrol_new alc5622_vol_snd_controls[] = { SOC_DOUBLE_TLV("Speaker Playback Volume", ALC5623_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv), SOC_DOUBLE("Speaker Playback Switch", @@ -925,12 +925,12 @@ static int alc5623_probe(struct snd_soc_codec *codec) switch (alc5623->id) { case 0x21: - snd_soc_add_controls(codec, rt5621_vol_snd_controls, - ARRAY_SIZE(rt5621_vol_snd_controls)); + snd_soc_add_controls(codec, alc5621_vol_snd_controls, + ARRAY_SIZE(alc5621_vol_snd_controls)); break; case 0x22: - snd_soc_add_controls(codec, rt5622_vol_snd_controls, - ARRAY_SIZE(rt5622_vol_snd_controls)); + snd_soc_add_controls(codec, alc5622_vol_snd_controls, + ARRAY_SIZE(alc5622_vol_snd_controls)); break; case 0x23: snd_soc_add_controls(codec, alc5623_vol_snd_controls, -- cgit v1.1 From bec4fa05e25f7e78ec67df389539acc6bb352a2a Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 12 Dec 2011 15:55:34 -0700 Subject: ASoC: Add utility to set a card's name from device tree Implement snd_soc_of_parse_card_name(), a utility function that sets a card's name from device tree. The machine driver specifies the DT property to use, since this is binding-specific. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'sound') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 1252ab1..51eef9b 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -3317,6 +3318,30 @@ found: } EXPORT_SYMBOL_GPL(snd_soc_unregister_codec); +/* Retrieve a card's name from device tree */ +int snd_soc_of_parse_card_name(struct snd_soc_card *card, + const char *propname) +{ + struct device_node *np = card->dev->of_node; + int ret; + + ret = of_property_read_string_index(np, propname, 0, &card->name); + /* + * EINVAL means the property does not exist. This is fine providing + * card->name was previously set, which is checked later in + * snd_soc_register_card. + */ + if (ret < 0 && ret != -EINVAL) { + dev_err(card->dev, + "Property '%s' could not be read: %d\n", + propname, ret); + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(snd_soc_of_parse_card_name); + static int __init snd_soc_init(void) { #ifdef CONFIG_DEBUG_FS -- cgit v1.1 From a4a54dd5bb1bb01010f46147d6d8b452255957bf Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 12 Dec 2011 15:55:35 -0700 Subject: ASoC: Add utility to parse DAPM routes from device tree Implement snd_soc_of_parse_audio_routing(), a utility function that can parses a simple DAPM route table from device tree.The machine driver specifies the DT property to use, since this is binding-specific. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'sound') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 51eef9b..42ad2db 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3342,6 +3342,63 @@ int snd_soc_of_parse_card_name(struct snd_soc_card *card, } EXPORT_SYMBOL_GPL(snd_soc_of_parse_card_name); +int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, + const char *propname) +{ + struct device_node *np = card->dev->of_node; + int num_routes; + struct snd_soc_dapm_route *routes; + int i, ret; + + num_routes = of_property_count_strings(np, propname); + if (num_routes & 1) { + dev_err(card->dev, + "Property '%s's length is not even\n", + propname); + return -EINVAL; + } + num_routes /= 2; + if (!num_routes) { + dev_err(card->dev, + "Property '%s's length is zero\n", + propname); + return -EINVAL; + } + + routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes), + GFP_KERNEL); + if (!routes) { + dev_err(card->dev, + "Could not allocate DAPM route table\n"); + return -EINVAL; + } + + for (i = 0; i < num_routes; i++) { + ret = of_property_read_string_index(np, propname, + 2 * i, &routes[i].sink); + if (ret) { + dev_err(card->dev, + "Property '%s' index %d could not be read: %d\n", + propname, 2 * i, ret); + return -EINVAL; + } + ret = of_property_read_string_index(np, propname, + (2 * i) + 1, &routes[i].source); + if (ret) { + dev_err(card->dev, + "Property '%s' index %d could not be read: %d\n", + propname, (2 * i) + 1, ret); + return -EINVAL; + } + } + + card->num_dapm_routes = num_routes; + card->dapm_routes = routes; + + return 0; +} +EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_routing); + static int __init snd_soc_init(void) { #ifdef CONFIG_DEBUG_FS -- cgit v1.1 From 07cdf36d8c4ba4ad0db13228eb25bcd3d5138b29 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 12 Dec 2011 15:55:36 -0700 Subject: ASoC: Tegra+WM8903 machine: Add device tree binding This driver is parameterized in two ways: a) Platform data, which supplies the set of GPIOs used by the driver. These GPIOs can now be parsed out of device tree. b) Machine-specific DAPM route arrays embedded into the ASoC machine driver itself. Historically, the driver picks the appropriate array to use using machine_is_*(). The driver now requires this array to be parsed from device tree when instantiated through device tree, using the core ASoC support for this parsing. Based on work by John Bonesio, but significantly reworked since then. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/tegra/tegra_wm8903.c | 128 +++++++++++++++++++++++++++++++++-------- 1 file changed, 103 insertions(+), 25 deletions(-) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index ba2d23e..4677f26 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c @@ -34,6 +34,7 @@ #include #include #include +#include #include @@ -59,8 +60,9 @@ #define GPIO_HP_DET BIT(4) struct tegra_wm8903 { + struct tegra_wm8903_platform_data pdata; + struct platform_device *pcm_dev; struct tegra_asoc_utils_data util_data; - struct tegra_wm8903_platform_data *pdata; int gpio_requested; }; @@ -160,7 +162,7 @@ static int tegra_wm8903_event_int_spk(struct snd_soc_dapm_widget *w, struct snd_soc_dapm_context *dapm = w->dapm; struct snd_soc_card *card = dapm->card; struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); - struct tegra_wm8903_platform_data *pdata = machine->pdata; + struct tegra_wm8903_platform_data *pdata = &machine->pdata; if (!(machine->gpio_requested & GPIO_SPKR_EN)) return 0; @@ -177,7 +179,7 @@ static int tegra_wm8903_event_hp(struct snd_soc_dapm_widget *w, struct snd_soc_dapm_context *dapm = w->dapm; struct snd_soc_card *card = dapm->card; struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); - struct tegra_wm8903_platform_data *pdata = machine->pdata; + struct tegra_wm8903_platform_data *pdata = &machine->pdata; if (!(machine->gpio_requested & GPIO_HP_MUTE)) return 0; @@ -246,9 +248,36 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dapm_context *dapm = &codec->dapm; struct snd_soc_card *card = codec->card; struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); - struct tegra_wm8903_platform_data *pdata = machine->pdata; + struct tegra_wm8903_platform_data *pdata = &machine->pdata; + struct device_node *np = card->dev->of_node; int ret; + if (card->dev->platform_data) { + memcpy(pdata, card->dev->platform_data, sizeof(*pdata)); + } else if (np) { + /* + * This part must be in init() rather than probe() in order to + * guarantee that the WM8903 has been probed, and hence its + * GPIO controller registered, which is a pre-condition for + * of_get_named_gpio() to be able to map the phandles in the + * properties to the controller node. Given this, all + * pdata handling is in init() for consistency. + */ + pdata->gpio_spkr_en = of_get_named_gpio(np, + "nvidia,spkr-en-gpios", 0); + pdata->gpio_hp_mute = of_get_named_gpio(np, + "nvidia,hp-mute-gpios", 0); + pdata->gpio_hp_det = of_get_named_gpio(np, + "nvidia,hp-det-gpios", 0); + pdata->gpio_int_mic_en = of_get_named_gpio(np, + "nvidia,int-mic-en-gpios", 0); + pdata->gpio_ext_mic_en = of_get_named_gpio(np, + "nvidia,ext-mic-en-gpios", 0); + } else { + dev_err(card->dev, "No platform data supplied\n"); + return -EINVAL; + } + if (gpio_is_valid(pdata->gpio_spkr_en)) { ret = gpio_request(pdata->gpio_spkr_en, "spkr_en"); if (ret) { @@ -348,11 +377,9 @@ static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev) { struct snd_soc_card *card = &snd_soc_tegra_wm8903; struct tegra_wm8903 *machine; - struct tegra_wm8903_platform_data *pdata; int ret; - pdata = pdev->dev.platform_data; - if (!pdata) { + if (!pdev->dev.platform_data && !pdev->dev.of_node) { dev_err(&pdev->dev, "No platform data supplied\n"); return -EINVAL; } @@ -364,31 +391,70 @@ static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev) ret = -ENOMEM; goto err; } - - machine->pdata = pdata; - - ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); - if (ret) - goto err; + machine->pcm_dev = ERR_PTR(-EINVAL); card->dev = &pdev->dev; platform_set_drvdata(pdev, card); snd_soc_card_set_drvdata(card, machine); - if (machine_is_harmony()) { - card->dapm_routes = harmony_audio_map; - card->num_dapm_routes = ARRAY_SIZE(harmony_audio_map); - } else if (machine_is_seaboard()) { - card->dapm_routes = seaboard_audio_map; - card->num_dapm_routes = ARRAY_SIZE(seaboard_audio_map); - } else if (machine_is_kaen()) { - card->dapm_routes = kaen_audio_map; - card->num_dapm_routes = ARRAY_SIZE(kaen_audio_map); + if (pdev->dev.of_node) { + ret = snd_soc_of_parse_card_name(card, "nvidia,model"); + if (ret) + goto err; + + ret = snd_soc_of_parse_audio_routing(card, + "nvidia,audio-routing"); + if (ret) + goto err; + + tegra_wm8903_dai.codec_name = NULL; + tegra_wm8903_dai.codec_of_node = of_parse_phandle( + pdev->dev.of_node, "nvidia,audio-codec", 0); + if (!tegra_wm8903_dai.codec_of_node) { + dev_err(&pdev->dev, + "Property 'nvidia,audio-codec' missing or invalid\n"); + ret = -EINVAL; + goto err; + } + + tegra_wm8903_dai.cpu_dai_name = NULL; + tegra_wm8903_dai.cpu_dai_of_node = of_parse_phandle( + pdev->dev.of_node, "nvidia,i2s-controller", 0); + if (!tegra_wm8903_dai.cpu_dai_of_node) { + dev_err(&pdev->dev, + "Property 'nvidia,i2s-controller' missing or invalid\n"); + ret = -EINVAL; + goto err; + } + + machine->pcm_dev = platform_device_register_simple( + "tegra-pcm-audio", -1, NULL, 0); + if (IS_ERR(machine->pcm_dev)) { + dev_err(&pdev->dev, + "Can't instantiate tegra-pcm-audio\n"); + ret = PTR_ERR(machine->pcm_dev); + goto err; + } } else { - card->dapm_routes = aebl_audio_map; - card->num_dapm_routes = ARRAY_SIZE(aebl_audio_map); + if (machine_is_harmony()) { + card->dapm_routes = harmony_audio_map; + card->num_dapm_routes = ARRAY_SIZE(harmony_audio_map); + } else if (machine_is_seaboard()) { + card->dapm_routes = seaboard_audio_map; + card->num_dapm_routes = ARRAY_SIZE(seaboard_audio_map); + } else if (machine_is_kaen()) { + card->dapm_routes = kaen_audio_map; + card->num_dapm_routes = ARRAY_SIZE(kaen_audio_map); + } else { + card->dapm_routes = aebl_audio_map; + card->num_dapm_routes = ARRAY_SIZE(aebl_audio_map); + } } + ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev); + if (ret) + goto err_unregister; + ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", @@ -400,6 +466,9 @@ static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev) err_fini_utils: tegra_asoc_utils_fini(&machine->util_data); +err_unregister: + if (!IS_ERR(machine->pcm_dev)) + platform_device_unregister(machine->pcm_dev); err: return ret; } @@ -408,7 +477,7 @@ static int __devexit tegra_wm8903_driver_remove(struct platform_device *pdev) { struct snd_soc_card *card = platform_get_drvdata(pdev); struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); - struct tegra_wm8903_platform_data *pdata = machine->pdata; + struct tegra_wm8903_platform_data *pdata = &machine->pdata; if (machine->gpio_requested & GPIO_HP_DET) snd_soc_jack_free_gpios(&tegra_wm8903_hp_jack, @@ -427,15 +496,23 @@ static int __devexit tegra_wm8903_driver_remove(struct platform_device *pdev) snd_soc_unregister_card(card); tegra_asoc_utils_fini(&machine->util_data); + if (!IS_ERR(machine->pcm_dev)) + platform_device_unregister(machine->pcm_dev); return 0; } +static const struct of_device_id tegra_wm8903_of_match[] __devinitconst = { + { .compatible = "nvidia,tegra-audio-wm8903", }, + {}, +}; + static struct platform_driver tegra_wm8903_driver = { .driver = { .name = DRV_NAME, .owner = THIS_MODULE, .pm = &snd_soc_pm_ops, + .of_match_table = tegra_wm8903_of_match, }, .probe = tegra_wm8903_driver_probe, .remove = __devexit_p(tegra_wm8903_driver_remove), @@ -446,3 +523,4 @@ MODULE_AUTHOR("Stephen Warren "); MODULE_DESCRIPTION("Tegra+WM8903 machine ASoC driver"); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:" DRV_NAME); +MODULE_DEVICE_TABLE(of, tegra_wm8903_of_match); -- cgit v1.1 From 3922d5180ffa605b08c50c13a7c9db68ab6bbc19 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 20 Dec 2011 14:37:12 +0800 Subject: ASoC: Convert ak4104 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/ak4104.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c index 152420c..d27b5e4 100644 --- a/sound/soc/codecs/ak4104.c +++ b/sound/soc/codecs/ak4104.c @@ -261,7 +261,8 @@ static int ak4104_spi_probe(struct spi_device *spi) if (ret < 0) return ret; - ak4104 = kzalloc(sizeof(struct ak4104_private), GFP_KERNEL); + ak4104 = devm_kzalloc(&spi->dev, sizeof(struct ak4104_private), + GFP_KERNEL); if (ak4104 == NULL) return -ENOMEM; @@ -271,15 +272,12 @@ static int ak4104_spi_probe(struct spi_device *spi) ret = snd_soc_register_codec(&spi->dev, &soc_codec_device_ak4104, &ak4104_dai, 1); - if (ret < 0) - kfree(ak4104); return ret; } static int __devexit ak4104_spi_remove(struct spi_device *spi) { snd_soc_unregister_codec(&spi->dev); - kfree(spi_get_drvdata(spi)); return 0; } -- cgit v1.1 From 7246492dcf0e56d23f71194f8cd8722a681dfa47 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 20 Dec 2011 14:38:09 +0800 Subject: ASoC: Convert ak4535 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/ak4535.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c index 96296fd..9e809e0 100644 --- a/sound/soc/codecs/ak4535.c +++ b/sound/soc/codecs/ak4535.c @@ -416,7 +416,8 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c, struct ak4535_priv *ak4535; int ret; - ak4535 = kzalloc(sizeof(struct ak4535_priv), GFP_KERNEL); + ak4535 = devm_kzalloc(&i2c->dev, sizeof(struct ak4535_priv), + GFP_KERNEL); if (ak4535 == NULL) return -ENOMEM; @@ -425,15 +426,12 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ak4535, &ak4535_dai, 1); - if (ret < 0) - kfree(ak4535); return ret; } static __devexit int ak4535_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From 4273fcfd71285b4ab6a5d3ce3943e30c2975b797 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 20 Dec 2011 14:39:20 +0800 Subject: ASoC: Convert ak4641 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/ak4641.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c index 9018470..266ebea 100644 --- a/sound/soc/codecs/ak4641.c +++ b/sound/soc/codecs/ak4641.c @@ -602,7 +602,8 @@ static int __devinit ak4641_i2c_probe(struct i2c_client *i2c, struct ak4641_priv *ak4641; int ret; - ak4641 = kzalloc(sizeof(struct ak4641_priv), GFP_KERNEL); + ak4641 = devm_kzalloc(&i2c->dev, sizeof(struct ak4641_priv), + GFP_KERNEL); if (!ak4641) return -ENOMEM; @@ -610,16 +611,12 @@ static int __devinit ak4641_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ak4641, ak4641_dai, ARRAY_SIZE(ak4641_dai)); - if (ret < 0) - kfree(ak4641); - return ret; } static int __devexit ak4641_i2c_remove(struct i2c_client *i2c) { snd_soc_unregister_codec(&i2c->dev); - kfree(i2c_get_clientdata(i2c)); return 0; } -- cgit v1.1 From 2ff49eea9b8a1d92c2ab09d803dfdc06f4f8e74b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 20 Dec 2011 14:40:12 +0800 Subject: ASoC: Convert ak4642 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/ak4642.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 9b4ee6c..5ef70b5 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c @@ -525,7 +525,8 @@ static __devinit int ak4642_i2c_probe(struct i2c_client *i2c, struct ak4642_priv *ak4642; int ret; - ak4642 = kzalloc(sizeof(struct ak4642_priv), GFP_KERNEL); + ak4642 = devm_kzalloc(&i2c->dev, sizeof(struct ak4642_priv), + GFP_KERNEL); if (!ak4642) return -ENOMEM; @@ -535,15 +536,12 @@ static __devinit int ak4642_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, (struct snd_soc_codec_driver *)id->driver_data, &ak4642_dai, 1); - if (ret < 0) - kfree(ak4642); return ret; } static __devexit int ak4642_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From 5b48a5a6dfd44ac80775d94e4ec573f4edda9144 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 20 Dec 2011 14:41:19 +0800 Subject: ASoC: Convert ak4671 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/ak4671.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c index 4f5c69f..a53b152 100644 --- a/sound/soc/codecs/ak4671.c +++ b/sound/soc/codecs/ak4671.c @@ -661,7 +661,8 @@ static int __devinit ak4671_i2c_probe(struct i2c_client *client, struct ak4671_priv *ak4671; int ret; - ak4671 = kzalloc(sizeof(struct ak4671_priv), GFP_KERNEL); + ak4671 = devm_kzalloc(&client->dev, sizeof(struct ak4671_priv), + GFP_KERNEL); if (ak4671 == NULL) return -ENOMEM; @@ -670,15 +671,12 @@ static int __devinit ak4671_i2c_probe(struct i2c_client *client, ret = snd_soc_register_codec(&client->dev, &soc_codec_dev_ak4671, &ak4671_dai, 1); - if (ret < 0) - kfree(ak4671); return ret; } static __devexit int ak4671_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From 673847cfb0b07ba42d23f32d42e59eeda81c3b2f Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 20 Dec 2011 16:13:26 +0800 Subject: ASoC: Use dai_fmt in hx4700 machine driver Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/hx4700.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/hx4700.c b/sound/soc/pxa/hx4700.c index 03ef9f3..8260207 100644 --- a/sound/soc/pxa/hx4700.c +++ b/sound/soc/pxa/hx4700.c @@ -65,20 +65,6 @@ static int hx4700_hw_params(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai = rtd->cpu_dai; int ret = 0; - /* set codec DAI configuration */ - ret = snd_soc_dai_set_fmt(codec_dai, - SND_SOC_DAIFMT_MSB | SND_SOC_DAIFMT_NB_NF | - SND_SOC_DAIFMT_CBS_CFS); - if (ret < 0) - return ret; - - /* set cpu DAI configuration */ - ret = snd_soc_dai_set_fmt(cpu_dai, - SND_SOC_DAIFMT_MSB | SND_SOC_DAIFMT_NB_NF | - SND_SOC_DAIFMT_CBS_CFS); - if (ret < 0) - return ret; - /* set the I2S system clock as output */ ret = snd_soc_dai_set_sysclk(cpu_dai, PXA2XX_I2S_SYSCLK, 0, SND_SOC_CLOCK_OUT); @@ -175,6 +161,8 @@ static struct snd_soc_dai_link hx4700_dai = { .platform_name = "pxa-pcm-audio", .codec_name = "ak4641.0-0012", .init = hx4700_ak4641_init, + .dai_fmt = SND_SOC_DAIFMT_MSB | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, .ops = &hx4700_ops, }; -- cgit v1.1 From 52ec35f64ecdd7ef759ce594061be780ca4b324b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 20 Dec 2011 16:27:28 +0800 Subject: ASoC: Use dai_fmt in imote2 machine driver Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/imote2.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/imote2.c b/sound/soc/pxa/imote2.c index 97d3aec..dc905ae 100644 --- a/sound/soc/pxa/imote2.c +++ b/sound/soc/pxa/imote2.c @@ -30,20 +30,6 @@ static int imote2_asoc_hw_params(struct snd_pcm_substream *substream, break; } - /* set codec DAI configuration */ - ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S - | SND_SOC_DAIFMT_NB_NF - | SND_SOC_DAIFMT_CBS_CFS); - if (ret < 0) - return ret; - - /* CPU should be clock master */ - ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S - | SND_SOC_DAIFMT_NB_NF - | SND_SOC_DAIFMT_CBS_CFS); - if (ret < 0) - return ret; - ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk, SND_SOC_CLOCK_IN); if (ret < 0) @@ -67,6 +53,8 @@ static struct snd_soc_dai_link imote2_dai = { .codec_dai_name = "wm8940-hifi", .platform_name = "pxa-pcm-audio", .codec_name = "wm8940-codec.0-0034", + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, .ops = &imote2_asoc_ops, }; -- cgit v1.1 From f4f8e4c32c5064b292303b270999a87fe11f4ba4 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 20 Dec 2011 10:14:25 +0800 Subject: ASoC: Convert 88pm860x-codec to table based DAPM and control init Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/88pm860x-codec.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index 2d39123..99ca53c 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c @@ -861,7 +861,7 @@ static const struct snd_soc_dapm_widget pm860x_dapm_widgets[] = { PM860X_DAPM_OUTPUT("RSYNC", pm860x_rsync_event), }; -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route pm860x_dapm_routes[] = { /* supply */ {"Left DAC", NULL, "VCODEC"}, {"Right DAC", NULL, "VCODEC"}, @@ -1361,7 +1361,6 @@ EXPORT_SYMBOL_GPL(pm860x_mic_jack_detect); static int pm860x_probe(struct snd_soc_codec *codec) { struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec); - struct snd_soc_dapm_context *dapm = &codec->dapm; int i, ret; pm860x->codec = codec; @@ -1388,11 +1387,6 @@ static int pm860x_probe(struct snd_soc_codec *codec) goto out; } - snd_soc_add_controls(codec, pm860x_snd_controls, - ARRAY_SIZE(pm860x_snd_controls)); - snd_soc_dapm_new_controls(dapm, pm860x_dapm_widgets, - ARRAY_SIZE(pm860x_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); return 0; out: @@ -1420,6 +1414,13 @@ static struct snd_soc_codec_driver soc_codec_dev_pm860x = { .reg_cache_size = REG_CACHE_SIZE, .reg_word_size = sizeof(u8), .set_bias_level = pm860x_set_bias_level, + + .controls = pm860x_snd_controls, + .num_controls = ARRAY_SIZE(pm860x_snd_controls), + .dapm_widgets = pm860x_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(pm860x_dapm_widgets), + .dapm_routes = pm860x_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(pm860x_dapm_routes), }; static int __devinit pm860x_codec_probe(struct platform_device *pdev) -- cgit v1.1 From 3f7cec0493eec1d0139a20716b1ce34815a446c3 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 20 Dec 2011 10:19:54 +0800 Subject: ASoC: Convert cs42l51 to table based DAPM and control init Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l51.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 528510b..ffce9f2 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c @@ -511,7 +511,6 @@ static struct snd_soc_dai_driver cs42l51_dai = { static int cs42l51_probe(struct snd_soc_codec *codec) { struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); - struct snd_soc_dapm_context *dapm = &codec->dapm; int ret, reg; ret = cs42l51_fill_cache(codec); @@ -539,20 +538,20 @@ static int cs42l51_probe(struct snd_soc_codec *codec) if (ret < 0) return ret; - snd_soc_add_controls(codec, cs42l51_snd_controls, - ARRAY_SIZE(cs42l51_snd_controls)); - snd_soc_dapm_new_controls(dapm, cs42l51_dapm_widgets, - ARRAY_SIZE(cs42l51_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, cs42l51_routes, - ARRAY_SIZE(cs42l51_routes)); - return 0; } static struct snd_soc_codec_driver soc_codec_device_cs42l51 = { - .probe = cs42l51_probe, + .probe = cs42l51_probe, .reg_cache_size = CS42L51_NUMREGS + 1, .reg_word_size = sizeof(u8), + + .controls = cs42l51_snd_controls, + .num_controls = ARRAY_SIZE(cs42l51_snd_controls), + .dapm_widgets = cs42l51_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(cs42l51_dapm_widgets), + .dapm_routes = cs42l51_routes, + .num_dapm_routes = ARRAY_SIZE(cs42l51_routes), }; static int cs42l51_i2c_probe(struct i2c_client *i2c_client, -- cgit v1.1 From 82b1d73f1f22df2c8384cb7cea4aabd9db5273a9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 20 Dec 2011 15:53:07 +0100 Subject: ALSA: hda - Fix left-over merge issues in patch_hdmi.c Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_hdmi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 3f42cc9..1168ebd 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -805,7 +805,6 @@ static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) { - struct hdmi_spec *spec = codec->spec; int tag = res >> AC_UNSOL_RES_TAG_SHIFT; int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; @@ -1242,7 +1241,6 @@ static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx) if (pcmdev > 0) sprintf(hdmi_str + strlen(hdmi_str), ",pcm=%d", pcmdev); - hdmi_present_sense(per_pin, 0); return snd_hda_jack_add_kctl(codec, per_pin->pin_nid, hdmi_str, 0); } @@ -1274,7 +1272,7 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) if (err < 0) return err; - hdmi_present_sense(per_pin, false); + hdmi_present_sense(per_pin, 0); } return 0; -- cgit v1.1 From 82150101df27c0f3d315b597081b9fa0e23cd002 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 20 Dec 2011 23:59:41 +0000 Subject: ASoC: Remove ifdefs for GPIO_SYSFS It is part of the GPIO API so should be stubbed appropriately. Signed-off-by: Mark Brown --- sound/soc/soc-jack.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c index 6c5ebd3..ee4353f 100644 --- a/sound/soc/soc-jack.c +++ b/sound/soc/soc-jack.c @@ -341,10 +341,8 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, gpios[i].gpio, ret); } -#ifdef CONFIG_GPIO_SYSFS /* Expose GPIO value over sysfs for diagnostic purposes */ gpio_export(gpios[i].gpio, false); -#endif /* Update initial jack status */ snd_soc_jack_gpio_detect(&gpios[i]); @@ -376,9 +374,7 @@ void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, int i; for (i = 0; i < count; i++) { -#ifdef CONFIG_GPIO_SYSFS gpio_unexport(gpios[i].gpio); -#endif free_irq(gpio_to_irq(gpios[i].gpio), &gpios[i]); cancel_delayed_work_sync(&gpios[i].work); gpio_free(gpios[i].gpio); -- cgit v1.1 From 47a74a5d1ed2af23c2dc1ccfdcc0176e40404345 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 11:54:02 +1300 Subject: ALSA: asihpi - fix pcm dma pointer tracking Elapsed counter should only count data committed to snd_pcm_period_elapsed, rather than all data available Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index e9de799..1ba50e3 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -888,8 +888,8 @@ static void snd_card_asihpi_timer_function(unsigned long data) pd, xfer2)); } } - ds->pcm_buf_host_rw_ofs = ds->pcm_buf_host_rw_ofs + xfercount; - ds->pcm_buf_elapsed_dma_ofs = pcm_buf_dma_ofs; + ds->pcm_buf_host_rw_ofs += xfercount; + ds->pcm_buf_elapsed_dma_ofs += xfercount; snd_pcm_period_elapsed(s); } } -- cgit v1.1 From f6baaec2af36494469aa37558db8c79186f2fa03 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:31 +1300 Subject: ALSA: asihpi - Split hpi version info into separate header file. and update HPI version to 4.10 Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi.h | 18 ------------------ sound/pci/asihpi/hpi_version.h | 32 ++++++++++++++++++++++++++++++++ sound/pci/asihpi/hpidspcd.c | 23 ++++++++++++----------- sound/pci/asihpi/hpidspcd.h | 4 ---- sound/pci/asihpi/hpimsgx.c | 3 ++- sound/pci/asihpi/hpioctl.c | 1 + 6 files changed, 47 insertions(+), 34 deletions(-) create mode 100644 sound/pci/asihpi/hpi_version.h (limited to 'sound') diff --git a/sound/pci/asihpi/hpi.h b/sound/pci/asihpi/hpi.h index f207272..7714937 100644 --- a/sound/pci/asihpi/hpi.h +++ b/sound/pci/asihpi/hpi.h @@ -30,26 +30,8 @@ #ifndef _HPI_H_ #define _HPI_H_ -/* HPI Version -If HPI_VER_MINOR is odd then its a development release not intended for the -public. If HPI_VER_MINOR is even then is a release version -i.e 3.05.02 is a development version -*/ -#define HPI_VERSION_CONSTRUCTOR(maj, min, rel) \ - ((maj << 16) + (min << 8) + rel) - -#define HPI_VER_MAJOR(v) ((int)(v >> 16)) -#define HPI_VER_MINOR(v) ((int)((v >> 8) & 0xFF)) -#define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) - -#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 8, 0) -#define HPI_VER_STRING "4.08.00" - -/* Library version as documented in hpi-api-versions.txt */ -#define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(10, 0, 0) #include -#define HPI_BUILD_EXCLUDE_DEPRECATED #define HPI_BUILD_KERNEL_MODE /******************************************************************************/ diff --git a/sound/pci/asihpi/hpi_version.h b/sound/pci/asihpi/hpi_version.h new file mode 100644 index 0000000..e9146e5 --- /dev/null +++ b/sound/pci/asihpi/hpi_version.h @@ -0,0 +1,32 @@ +/** HPI Version Definitions +Development releases have odd minor version. +Production releases have even minor version. + +\file hpi_version.h +*/ + +#ifndef _HPI_VERSION_H +#define _HPI_VERSION_H + +/* Use single digits for versions less that 10 to avoid octal. */ +/* *** HPI_VER is the only edit required to update version *** */ +/** HPI version */ +#define HPI_VER HPI_VERSION_CONSTRUCTOR(4, 10, 1) + +/** HPI version string in dotted decimal format */ +#define HPI_VER_STRING "4.10.01" + +/** Library version as documented in hpi-api-versions.txt */ +#define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(10, 2, 0) + +/** Construct hpi version number from major, minor, release numbers */ +#define HPI_VERSION_CONSTRUCTOR(maj, min, r) ((maj << 16) + (min << 8) + r) + +/** Extract major version from hpi version number */ +#define HPI_VER_MAJOR(v) ((int)(v >> 16)) +/** Extract minor version from hpi version number */ +#define HPI_VER_MINOR(v) ((int)((v >> 8) & 0xFF)) +/** Extract release from hpi version number */ +#define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) + +#endif diff --git a/sound/pci/asihpi/hpidspcd.c b/sound/pci/asihpi/hpidspcd.c index 71d32c8..21cdb9e 100644 --- a/sound/pci/asihpi/hpidspcd.c +++ b/sound/pci/asihpi/hpidspcd.c @@ -25,6 +25,7 @@ hotplug firmware loader from individual dsp code files #define SOURCEFILE_NAME "hpidspcd.c" #include "hpidspcd.h" #include "hpidebug.h" +#include "hpi_version.h" struct dsp_code_private { /** Firmware descriptor */ @@ -32,9 +33,6 @@ struct dsp_code_private { struct pci_dev *dev; }; -#define HPI_VER_DECIMAL ((int)(HPI_VER_MAJOR(HPI_VER) * 10000 + \ - HPI_VER_MINOR(HPI_VER) * 100 + HPI_VER_RELEASE(HPI_VER))) - /*-------------------------------------------------------------------*/ short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code, u32 *os_error_code) @@ -66,22 +64,25 @@ short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code, if ((header.type != 0x45444F43) || /* "CODE" */ (header.adapter != adapter) || (header.size != firmware->size)) { - dev_printk(KERN_ERR, &dev->dev, "Invalid firmware file\n"); + dev_printk(KERN_ERR, &dev->dev, + "Invalid firmware header size %d != file %zd\n", + header.size, firmware->size); goto error2; } - if ((header.version / 100 & ~1) != (HPI_VER_DECIMAL / 100 & ~1)) { + if ((header.version >> 9) != (HPI_VER >> 9)) { + /* Consider even and subsequent odd minor versions to be compatible */ dev_printk(KERN_ERR, &dev->dev, "Incompatible firmware version " - "DSP image %d != Driver %d\n", header.version, - HPI_VER_DECIMAL); + "DSP image %X != Driver %X\n", header.version, + HPI_VER); goto error2; } - if (header.version != HPI_VER_DECIMAL) { - dev_printk(KERN_WARNING, &dev->dev, - "Firmware: release version mismatch DSP image %d != Driver %d\n", - header.version, HPI_VER_DECIMAL); + if (header.version != HPI_VER) { + dev_printk(KERN_INFO, &dev->dev, + "Firmware: release version mismatch DSP image %X != Driver %X\n", + header.version, HPI_VER); } HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name); diff --git a/sound/pci/asihpi/hpidspcd.h b/sound/pci/asihpi/hpidspcd.h index b228811..659d19c 100644 --- a/sound/pci/asihpi/hpidspcd.h +++ b/sound/pci/asihpi/hpidspcd.h @@ -27,10 +27,6 @@ Functions for reading DSP code to load into DSP #include "hpi_internal.h" -/** Code header version is decimal encoded e.g. 4.06.10 is 40601 */ -#define HPI_VER_DECIMAL ((int)(HPI_VER_MAJOR(HPI_VER) * 10000 + \ -HPI_VER_MINOR(HPI_VER) * 100 + HPI_VER_RELEASE(HPI_VER))) - /** Header structure for dsp firmware file This structure must match that used in s2bin.c for generation of asidsp.bin */ diff --git a/sound/pci/asihpi/hpimsgx.c b/sound/pci/asihpi/hpimsgx.c index 2e77942..d4790dd 100644 --- a/sound/pci/asihpi/hpimsgx.c +++ b/sound/pci/asihpi/hpimsgx.c @@ -1,7 +1,7 @@ /****************************************************************************** AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as @@ -22,6 +22,7 @@ Extended Message Function With Response Caching *****************************************************************************/ #define SOURCEFILE_NAME "hpimsgx.c" #include "hpi_internal.h" +#include "hpi_version.h" #include "hpimsginit.h" #include "hpicmn.h" #include "hpimsgx.h" diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index f6b9517..75f7a2d 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c @@ -21,6 +21,7 @@ Common Linux HPI ioctl and module probe/remove functions #define SOURCEFILE_NAME "hpioctl.c" #include "hpi_internal.h" +#include "hpi_version.h" #include "hpimsginit.h" #include "hpidebug.h" #include "hpimsgx.h" -- cgit v1.1 From 40818b6242513676c8adf30811fb7877b02005fb Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:32 +1300 Subject: ALSA: asihpi - Update copyright to 2011 Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi6000.c | 2 +- sound/pci/asihpi/hpi6000.h | 2 +- sound/pci/asihpi/hpi6205.c | 2 +- sound/pci/asihpi/hpicmn.c | 2 +- sound/pci/asihpi/hpicmn.h | 2 +- sound/pci/asihpi/hpidebug.c | 2 +- sound/pci/asihpi/hpidebug.h | 2 +- sound/pci/asihpi/hpimsginit.c | 2 +- sound/pci/asihpi/hpimsginit.h | 2 +- sound/pci/asihpi/hpimsgx.h | 2 +- sound/pci/asihpi/hpioctl.h | 2 +- sound/pci/asihpi/hpios.c | 2 +- sound/pci/asihpi/hpios.h | 2 +- sound/pci/asihpi/hpipcida.h | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c index 3cc6f11..278bec8 100644 --- a/sound/pci/asihpi/hpi6000.c +++ b/sound/pci/asihpi/hpi6000.c @@ -1,7 +1,7 @@ /****************************************************************************** AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as diff --git a/sound/pci/asihpi/hpi6000.h b/sound/pci/asihpi/hpi6000.h index 4c7d507..7e0deef 100644 --- a/sound/pci/asihpi/hpi6000.h +++ b/sound/pci/asihpi/hpi6000.h @@ -1,7 +1,7 @@ /***************************************************************************** AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c index e041a6a..7f65602 100644 --- a/sound/pci/asihpi/hpi6205.c +++ b/sound/pci/asihpi/hpi6205.c @@ -1,7 +1,7 @@ /****************************************************************************** AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c index 44c7eb4..358853a 100644 --- a/sound/pci/asihpi/hpicmn.c +++ b/sound/pci/asihpi/hpicmn.c @@ -1,7 +1,7 @@ /****************************************************************************** AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as diff --git a/sound/pci/asihpi/hpicmn.h b/sound/pci/asihpi/hpicmn.h index d53cdf6..67cc1b0 100644 --- a/sound/pci/asihpi/hpicmn.h +++ b/sound/pci/asihpi/hpicmn.h @@ -1,7 +1,7 @@ /** AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as diff --git a/sound/pci/asihpi/hpidebug.c b/sound/pci/asihpi/hpidebug.c index b52baf6..ac86a1f 100644 --- a/sound/pci/asihpi/hpidebug.c +++ b/sound/pci/asihpi/hpidebug.c @@ -1,7 +1,7 @@ /************************************************************************ AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as diff --git a/sound/pci/asihpi/hpidebug.h b/sound/pci/asihpi/hpidebug.h index 940f54c..2c9af23 100644 --- a/sound/pci/asihpi/hpidebug.h +++ b/sound/pci/asihpi/hpidebug.h @@ -1,7 +1,7 @@ /***************************************************************************** AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as diff --git a/sound/pci/asihpi/hpimsginit.c b/sound/pci/asihpi/hpimsginit.c index 52400a6..032d563 100644 --- a/sound/pci/asihpi/hpimsginit.c +++ b/sound/pci/asihpi/hpimsginit.c @@ -1,7 +1,7 @@ /****************************************************************************** AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as diff --git a/sound/pci/asihpi/hpimsginit.h b/sound/pci/asihpi/hpimsginit.h index bfd330d..5b48708 100644 --- a/sound/pci/asihpi/hpimsginit.h +++ b/sound/pci/asihpi/hpimsginit.h @@ -1,7 +1,7 @@ /****************************************************************************** AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as diff --git a/sound/pci/asihpi/hpimsgx.h b/sound/pci/asihpi/hpimsgx.h index fd49e75..37f3efd 100644 --- a/sound/pci/asihpi/hpimsgx.h +++ b/sound/pci/asihpi/hpimsgx.h @@ -1,7 +1,7 @@ /****************************************************************************** AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as diff --git a/sound/pci/asihpi/hpioctl.h b/sound/pci/asihpi/hpioctl.h index 847f72f..2614aff 100644 --- a/sound/pci/asihpi/hpioctl.h +++ b/sound/pci/asihpi/hpioctl.h @@ -1,7 +1,7 @@ /******************************************************************************* AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c index ff2a19b..2d7d1c2 100644 --- a/sound/pci/asihpi/hpios.c +++ b/sound/pci/asihpi/hpios.c @@ -1,7 +1,7 @@ /****************************************************************************** AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as diff --git a/sound/pci/asihpi/hpios.h b/sound/pci/asihpi/hpios.h index 2f605e3..d59a059 100644 --- a/sound/pci/asihpi/hpios.h +++ b/sound/pci/asihpi/hpios.h @@ -1,7 +1,7 @@ /****************************************************************************** AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as diff --git a/sound/pci/asihpi/hpipcida.h b/sound/pci/asihpi/hpipcida.h index bb30868..db570dd 100644 --- a/sound/pci/asihpi/hpipcida.h +++ b/sound/pci/asihpi/hpipcida.h @@ -1,7 +1,7 @@ /****************************************************************************** AudioScience HPI driver - Copyright (C) 1997-2010 AudioScience Inc. + Copyright (C) 1997-2011 AudioScience Inc. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as -- cgit v1.1 From c382a5da5cda3e0d8a8f2e8809460285d0a7c1cb Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:33 +1300 Subject: ALSA: asihpi - Low latency mode stream has fixed channel count. Unlike other streams which support 1..max channels, Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 1ba50e3..44e6ef3 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -135,6 +135,8 @@ struct snd_card_asihpi { u16 update_interval_frames; u16 in_max_chans; u16 out_max_chans; + u16 in_min_chans; + u16 out_min_chans; }; /* Per stream data */ @@ -968,8 +970,6 @@ static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi, } static struct snd_pcm_hardware snd_card_asihpi_playback = { - .channels_min = 1, - .channels_max = 2, .buffer_bytes_max = BUFFER_BYTES_MAX, .period_bytes_min = PERIOD_BYTES_MIN, .period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN, @@ -1013,6 +1013,7 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) runtime->private_free = snd_card_asihpi_runtime_free; snd_card_asihpi_playback.channels_max = card->out_max_chans; + snd_card_asihpi_playback.channels_min = card->out_min_chans; /*?snd_card_asihpi_playback.period_bytes_min = card->out_max_chans * 4096; */ @@ -1150,8 +1151,6 @@ static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi, static struct snd_pcm_hardware snd_card_asihpi_capture = { - .channels_min = 1, - .channels_max = 2, .buffer_bytes_max = BUFFER_BYTES_MAX, .period_bytes_min = PERIOD_BYTES_MIN, .period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN, @@ -1193,6 +1192,7 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream) runtime->private_free = snd_card_asihpi_runtime_free; snd_card_asihpi_capture.channels_max = card->in_max_chans; + snd_card_asihpi_capture.channels_min = card->in_min_chans; snd_card_asihpi_capture_format(card, dpcm->h_stream, &snd_card_asihpi_capture); snd_card_asihpi_pcm_samplerates(card, &snd_card_asihpi_capture); @@ -2883,6 +2883,15 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev, asihpi->out_max_chans = 2; } + if (asihpi->out_max_chans > 2) { /* assume LL mode */ + asihpi->out_min_chans = asihpi->out_max_chans; + asihpi->in_min_chans = asihpi->in_max_chans; + asihpi->support_grouping = 0; + } else { + asihpi->out_min_chans = 1; + asihpi->in_min_chans = 1; + } + snd_printk(KERN_INFO "has dma:%d, grouping:%d, mrx:%d\n", asihpi->can_dma, asihpi->support_grouping, -- cgit v1.1 From d4b06d23ab1c5aefbb1377fb01939b555236f57f Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:34 +1300 Subject: ALSA: asihpi - Volumes and meters may have 1 or 2 channels. The channel count can be queried to determine which. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 44e6ef3..6e89e5b 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -1410,6 +1410,7 @@ static int snd_asihpi_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { u32 h_control = kcontrol->private_value; + u32 count; u16 err; /* native gains are in millibels */ short min_gain_mB; @@ -1424,8 +1425,12 @@ static int snd_asihpi_volume_info(struct snd_kcontrol *kcontrol, step_gain_mB = VOL_STEP_mB; } + err = hpi_meter_query_channels(h_control, &count); + if (err) + count = HPI_MAX_CHANNELS; + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->count = 2; + uinfo->count = count; uinfo->value.integer.min = min_gain_mB / VOL_STEP_mB; uinfo->value.integer.max = max_gain_mB / VOL_STEP_mB; uinfo->value.integer.step = step_gain_mB / VOL_STEP_mB; @@ -2033,8 +2038,15 @@ static int __devinit snd_asihpi_tuner_add(struct snd_card_asihpi *asihpi, static int snd_asihpi_meter_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { + u32 h_control = kcontrol->private_value; + u32 count; + u16 err; + err = hpi_meter_query_channels(h_control, &count); + if (err) + count = HPI_MAX_CHANNELS; + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->count = HPI_MAX_CHANNELS; + uinfo->count = count; uinfo->value.integer.min = 0; uinfo->value.integer.max = 0x7FFFFFFF; return 0; -- cgit v1.1 From cbd757daf5ed29618214b4ec4e298c79117baa8e Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:35 +1300 Subject: ALSA: asihpi - Use snd_pcm_debug_name to get substream name. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 6e89e5b..96a6eb0 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -904,7 +904,9 @@ static void snd_card_asihpi_timer_function(unsigned long data) static int snd_card_asihpi_playback_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg) { - snd_printddd(KERN_INFO "P%d ioctl %d\n", substream->number, cmd); + char name[16]; + snd_pcm_debug_name(substream, name, sizeof(name)); + snd_printddd(KERN_INFO "%s ioctl %d\n", name, cmd); return snd_pcm_lib_ioctl(substream, cmd, arg); } @@ -929,9 +931,11 @@ snd_card_asihpi_playback_pointer(struct snd_pcm_substream *substream) struct snd_pcm_runtime *runtime = substream->runtime; struct snd_card_asihpi_pcm *dpcm = runtime->private_data; snd_pcm_uframes_t ptr; + char name[16]; + snd_pcm_debug_name(substream, name, sizeof(name)); ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes); - snd_printddd("P%d pointer = 0x%04lx\n", substream->number, (unsigned long)ptr); + snd_printddd("%s pointer = 0x%04lx\n", name, (unsigned long)ptr); return ptr; } -- cgit v1.1 From 8e0874ea72d9dde8d300a5d4d6dfa87238ff7a81 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:36 +1300 Subject: ALSA: asihpi - Correct stray capital letters in identifier. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi6205.c | 12 ++++++------ sound/pci/asihpi/hpi_internal.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c index 7f65602..95d1cd5 100644 --- a/sound/pci/asihpi/hpi6205.c +++ b/sound/pci/asihpi/hpi6205.c @@ -803,8 +803,8 @@ static void outstream_host_buffer_allocate(struct hpi_adapter_obj *pao, obj_index]; status->samples_processed = 0; status->stream_state = HPI_STATE_STOPPED; - status->dSP_index = 0; - status->host_index = status->dSP_index; + status->dsp_index = 0; + status->host_index = status->dsp_index; status->size_in_bytes = phm->u.d.u.buffer.buffer_size; status->auxiliary_data_available = 0; @@ -878,7 +878,7 @@ static void outstream_host_buffer_free(struct hpi_adapter_obj *pao, static u32 outstream_get_space_available(struct hpi_hostbuffer_status *status) { return status->size_in_bytes - (status->host_index - - status->dSP_index); + status->dsp_index); } static void outstream_write(struct hpi_adapter_obj *pao, @@ -1080,8 +1080,8 @@ static void instream_host_buffer_allocate(struct hpi_adapter_obj *pao, obj_index]; status->samples_processed = 0; status->stream_state = HPI_STATE_STOPPED; - status->dSP_index = 0; - status->host_index = status->dSP_index; + status->dsp_index = 0; + status->host_index = status->dsp_index; status->size_in_bytes = phm->u.d.u.buffer.buffer_size; status->auxiliary_data_available = 0; @@ -1162,7 +1162,7 @@ static void instream_start(struct hpi_adapter_obj *pao, static u32 instream_get_bytes_available(struct hpi_hostbuffer_status *status) { - return status->dSP_index - status->host_index; + return status->dsp_index - status->host_index; } static void instream_read(struct hpi_adapter_obj *pao, diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h index d497030..e5e9e33 100644 --- a/sound/pci/asihpi/hpi_internal.h +++ b/sound/pci/asihpi/hpi_internal.h @@ -618,7 +618,7 @@ struct hpi_hostbuffer_status { u32 auxiliary_data_available; u32 stream_state; /* DSP index in to the host bus master buffer. */ - u32 dSP_index; + u32 dsp_index; /* Host index in to the host bus master buffer. */ u32 host_index; u32 size_in_bytes; @@ -1461,7 +1461,7 @@ struct hpi_control_cache_pad { /* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */ struct hpi_fifo_buffer { u32 size; - u32 dSP_index; + u32 dsp_index; u32 host_index; }; -- cgit v1.1 From 0be55c453f0b46de3d4e9025749dbba571cd7b84 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:37 +1300 Subject: ALSA: asihpi - Relax drained check for more reliable playback startup. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 96a6eb0..d3cab35 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -759,8 +759,7 @@ static void snd_card_asihpi_timer_function(unsigned long data) if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail; if (state == HPI_STATE_STOPPED) { - if ((bytes_avail == 0) && - (on_card_bytes < ds->pcm_buf_host_rw_ofs)) { + if (bytes_avail == 0) { hpi_handle_error(hpi_stream_start(ds->h_stream)); snd_printdd("P%d start\n", s->number); ds->drained_count = 0; @@ -769,7 +768,7 @@ static void snd_card_asihpi_timer_function(unsigned long data) snd_printd(KERN_WARNING "P%d drained\n", s->number); ds->drained_count++; - if (ds->drained_count > 2) { + if (ds->drained_count > 20) { snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN); continue; } -- cgit v1.1 From 09c728aced2bb212ce060a91c28d2ee40a6bf33c Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:38 +1300 Subject: ALSA: asihpi - Only set sync if card supports hardware stream grouping. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index d3cab35..62f094c 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -1033,8 +1033,10 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID; - if (card->support_grouping) + if (card->support_grouping) { snd_card_asihpi_playback.info |= SNDRV_PCM_INFO_SYNC_START; + snd_pcm_set_sync(substream); + } /* struct is copied, so can create initializer dynamically */ runtime->hw = snd_card_asihpi_playback; @@ -1051,8 +1053,6 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, card->update_interval_frames * 2, UINT_MAX); - snd_pcm_set_sync(substream); - snd_printdd("playback open\n"); return 0; -- cgit v1.1 From 502f271ae3d61cbe8ae75a11f28f17174d7bd380 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:39 +1300 Subject: ALSA: asihpi - Update node types. Add "Internal" node type. Remove GPI and GPO node types. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 3 +-- sound/pci/asihpi/hpi.h | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 62f094c..f56a1b8 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -1317,7 +1317,7 @@ static const char * const asihpi_src_names[] = { "Analog", "Adapter", "RTP", - "GPI", + "Internal" }; compile_time_assert( @@ -1335,7 +1335,6 @@ static const char * const asihpi_dst_names[] = { "Net", "Analog", "RTP", - "GPO", }; compile_time_assert( diff --git a/sound/pci/asihpi/hpi.h b/sound/pci/asihpi/hpi.h index 7714937..867c144 100644 --- a/sound/pci/asihpi/hpi.h +++ b/sound/pci/asihpi/hpi.h @@ -195,7 +195,7 @@ enum HPI_SOURCENODES { /** RTP stream input node - This node is a destination for packets of RTP audio samples from other devices. */ HPI_SOURCENODE_RTP_DESTINATION = 112, - HPI_SOURCENODE_GP_IN = 113, /**< general purpose input. */ + HPI_SOURCENODE_INTERNAL = 113, /**< node internal to the device. */ /* !!!Update this AND hpidebug.h if you add a new sourcenode type!!! */ HPI_SOURCENODE_LAST_INDEX = 113 /**< largest ID */ /* AX6 max sourcenode types = 15 */ @@ -224,9 +224,8 @@ enum HPI_DESTNODES { /** RTP stream output node - This node is a source for packets of RTP audio samples that are sent to other devices. */ HPI_DESTNODE_RTP_SOURCE = 208, - HPI_DESTNODE_GP_OUT = 209, /**< general purpose output node. */ /* !!!Update this AND hpidebug.h if you add a new destnode type!!! */ - HPI_DESTNODE_LAST_INDEX = 209 /**< largest ID */ + HPI_DESTNODE_LAST_INDEX = 208 /**< largest ID */ /* AX6 max destnode types = 15 */ }; -- cgit v1.1 From d8aefaef1b10f1063f295342b8967543e0d11d72 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:40 +1300 Subject: ALSA: asihpi - Remove unused structs and defs Structs related to network flash update are not required in kernel. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi_internal.h | 96 +---------------------------------------- 1 file changed, 2 insertions(+), 94 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h index e5e9e33..e06c5e0 100644 --- a/sound/pci/asihpi/hpi_internal.h +++ b/sound/pci/asihpi/hpi_internal.h @@ -25,6 +25,7 @@ HPI internal definitions #define _HPI_INTERNAL_H_ #include "hpi.h" + /** maximum number of memory regions mapped to an adapter */ #define HPI_MAX_ADAPTER_MEM_SPACES (2) @@ -220,8 +221,6 @@ enum HPI_CONTROL_ATTRIBUTES { HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1), HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2), - /*HPI_COBRANET_SET_DATA = HPI_CTL_ATTR(COBRANET, 3), */ - /*HPI_COBRANET_GET_DATA = HPI_CTL_ATTR(COBRANET, 4), */ HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5), HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6), HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7), @@ -393,14 +392,10 @@ enum HPI_FUNCTION_IDS { HPI_SUBSYS_OPEN = HPI_FUNC_ID(SUBSYSTEM, 1), HPI_SUBSYS_GET_VERSION = HPI_FUNC_ID(SUBSYSTEM, 2), HPI_SUBSYS_GET_INFO = HPI_FUNC_ID(SUBSYSTEM, 3), - /* HPI_SUBSYS_FIND_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 4), */ HPI_SUBSYS_CREATE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 5), HPI_SUBSYS_CLOSE = HPI_FUNC_ID(SUBSYSTEM, 6), - /* HPI_SUBSYS_DELETE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 7), */ HPI_SUBSYS_DRIVER_LOAD = HPI_FUNC_ID(SUBSYSTEM, 8), HPI_SUBSYS_DRIVER_UNLOAD = HPI_FUNC_ID(SUBSYSTEM, 9), - /* HPI_SUBSYS_READ_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 10), */ - /* HPI_SUBSYS_WRITE_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 11), */ HPI_SUBSYS_GET_NUM_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 12), HPI_SUBSYS_GET_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 13), HPI_SUBSYS_SET_NETWORK_INTERFACE = HPI_FUNC_ID(SUBSYSTEM, 14), @@ -661,13 +656,6 @@ union hpi_adapterx_msg { u16 index; } module_info; struct { - u32 checksum; - u16 sequence; - u16 length; - u16 offset; /**< offset from start of msg to data */ - u16 unused; - } program_flash; - struct { u16 index; u16 what; u16 property_index; @@ -678,25 +666,18 @@ union hpi_adapterx_msg { u16 parameter2; } property_set; struct { - u32 offset; - } query_flash; - struct { u32 pad32; u16 key1; u16 key2; } restart; struct { - u32 offset; - u32 length; - u32 key; - } start_flash; - struct { u32 pad32; u16 value; } test_assert; struct { u32 yes; } irq_query; + u32 pad[3]; }; struct hpi_adapter_res { @@ -724,18 +705,10 @@ union hpi_adapterx_res { u32 adapter_mode; } mode; struct { - u16 sequence; - } program_flash; - struct { u16 parameter1; u16 parameter2; } property_get; struct { - u32 checksum; - u32 length; - u32 version; - } query_flash; - struct { u32 yes; } irq_query; }; @@ -1150,71 +1123,6 @@ struct hpi_res_adapter_get_info { struct hpi_adapter_res p; }; -/* padding is so these are same size as v0 hpi_message */ -struct hpi_msg_adapter_query_flash { - struct hpi_message_header h; - u32 offset; - u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */ - sizeof(struct hpi_message_header) - 1 * sizeof(u32)]; -}; - -/* padding is so these are same size as v0 hpi_response */ -struct hpi_res_adapter_query_flash { - struct hpi_response_header h; - u32 checksum; - u32 length; - u32 version; - u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ - sizeof(struct hpi_response_header) - 3 * sizeof(u32)]; -}; - -struct hpi_msg_adapter_start_flash { - struct hpi_message_header h; - u32 offset; - u32 length; - u32 key; - u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */ - sizeof(struct hpi_message_header) - 3 * sizeof(u32)]; -}; - -struct hpi_res_adapter_start_flash { - struct hpi_response_header h; - u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ - sizeof(struct hpi_response_header)]; -}; - -struct hpi_msg_adapter_program_flash_payload { - u32 checksum; - u16 sequence; - u16 length; - u16 offset; /**< offset from start of msg to data */ - u16 unused; - /* ensure sizeof(header + payload) == sizeof(hpi_message_V0) - because old firmware expects data after message of this size */ - u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 message */ - sizeof(struct hpi_message_header) - sizeof(u32) - - 4 * sizeof(u16)]; -}; - -struct hpi_msg_adapter_program_flash { - struct hpi_message_header h; - struct hpi_msg_adapter_program_flash_payload p; - u32 data[256]; -}; - -struct hpi_res_adapter_program_flash { - struct hpi_response_header h; - u16 sequence; - u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ - sizeof(struct hpi_response_header) - sizeof(u16)]; -}; - -struct hpi_msg_adapter_debug_read { - struct hpi_message_header h; - u32 dsp_address; - u32 count_bytes; -}; - struct hpi_res_adapter_debug_read { struct hpi_response_header h; u8 bytes[256]; -- cgit v1.1 From 72868339e45cbd01ec20c2d3bb8c43e8d6911331 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:41 +1300 Subject: ALSA: asihpi - Add new function codes. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi_internal.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h index e06c5e0..2a63308 100644 --- a/sound/pci/asihpi/hpi_internal.h +++ b/sound/pci/asihpi/hpi_internal.h @@ -240,7 +240,9 @@ enum HPI_CONTROL_ATTRIBUTES { HPI_PAD_PROGRAM_TYPE = HPI_CTL_ATTR(PAD, 5), HPI_PAD_PROGRAM_ID = HPI_CTL_ATTR(PAD, 6), HPI_PAD_TA_SUPPORT = HPI_CTL_ATTR(PAD, 7), - HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8) + HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8), + + HPI_UNIVERSAL_ENTITY = HPI_CTL_ATTR(UNIVERSAL, 1) }; #define HPI_POLARITY_POSITIVE 0 @@ -425,7 +427,10 @@ enum HPI_FUNCTION_IDS { HPI_ADAPTER_IRQ_QUERY_AND_CLEAR = HPI_FUNC_ID(ADAPTER, 19), HPI_ADAPTER_IRQ_CALLBACK = HPI_FUNC_ID(ADAPTER, 20), HPI_ADAPTER_DELETE = HPI_FUNC_ID(ADAPTER, 21), -#define HPI_ADAPTER_FUNCTION_COUNT 21 + HPI_ADAPTER_READ_FLASH = HPI_FUNC_ID(ADAPTER, 22), + HPI_ADAPTER_END_FLASH = HPI_FUNC_ID(ADAPTER, 23), + HPI_ADAPTER_FILESTORE_DELETE_ALL = HPI_FUNC_ID(ADAPTER, 24), +#define HPI_ADAPTER_FUNCTION_COUNT 24 HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1), HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2), @@ -490,7 +495,9 @@ enum HPI_FUNCTION_IDS { HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10), HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11), HPI_MIXER_GET_CACHE_INFO = HPI_FUNC_ID(MIXER, 12), -#define HPI_MIXER_FUNCTION_COUNT 12 + HPI_MIXER_GET_BLOCK_HANDLE = HPI_FUNC_ID(MIXER, 13), + HPI_MIXER_GET_PARAMETER_HANDLE = HPI_FUNC_ID(MIXER, 14), +#define HPI_MIXER_FUNCTION_COUNT 14 HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1), HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2), -- cgit v1.1 From 3dad06ac89f4b63fcce5020abbe1b3e5754e26dd Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:42 +1300 Subject: ALSA: asihpi - Increase debug response buffer size. Enables retrieving more debug info in fewer transactions. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h index 2a63308..4cc315d 100644 --- a/sound/pci/asihpi/hpi_internal.h +++ b/sound/pci/asihpi/hpi_internal.h @@ -1132,7 +1132,7 @@ struct hpi_res_adapter_get_info { struct hpi_res_adapter_debug_read { struct hpi_response_header h; - u8 bytes[256]; + u8 bytes[1024]; }; struct hpi_msg_cobranet_hmi { -- cgit v1.1 From 7036b92d303a01477e27a5a9b2d582a5df3cc8ef Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:43 +1300 Subject: ALSA: asihpi - Remove redundant struct members. Structs hpi_adapter and snd_card_asihpi had members that duplicate those in underlying hpi_adapter_obj or whose info can be retrieved using hpi_adapter_get_info(). Print less info in probe function, it can be retrieved from /proc. Avoid name redundancy: hpi_adapter_obj.adapter_type renamed to .type Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 143 +++++++++++++++++++++------------------------ sound/pci/asihpi/hpi6000.c | 59 +++++++++---------- sound/pci/asihpi/hpi6205.c | 8 +-- sound/pci/asihpi/hpicmn.c | 20 +++---- sound/pci/asihpi/hpicmn.h | 11 ++-- sound/pci/asihpi/hpioctl.c | 62 +++++++++----------- sound/pci/asihpi/hpios.h | 14 ++--- 7 files changed, 147 insertions(+), 170 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index f56a1b8..2402801 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -25,6 +25,8 @@ #include "hpi_internal.h" #include "hpimsginit.h" #include "hpioctl.h" +#include "hpicmn.h" + #include #include @@ -119,12 +121,7 @@ struct clk_cache { struct snd_card_asihpi { struct snd_card *card; struct pci_dev *pci; - u16 adapter_index; - u32 serial_number; - u16 type; - u16 version; - u16 num_outstreams; - u16 num_instreams; + struct hpi_adapter *hpi; u32 h_mixer; struct clk_cache cc; @@ -497,6 +494,7 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream, snd_printdd("stream_host_buffer_attach status 0x%x\n", dpcm->hpi_buffer_attached); + } bytes_per_sec = params_rate(params) * params_channels(params); width = snd_pcm_format_width(params_format(params)); @@ -993,7 +991,7 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) return -ENOMEM; err = - hpi_outstream_open(card->adapter_index, + hpi_outstream_open(card->hpi->adapter->index, substream->number, &dpcm->h_stream); hpi_handle_error(err); if (err) @@ -1174,10 +1172,10 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream) return -ENOMEM; snd_printdd("capture open adapter %d stream %d\n", - card->adapter_index, substream->number); + card->hpi->adapter->index, substream->number); err = hpi_handle_error( - hpi_instream_open(card->adapter_index, + hpi_instream_open(card->hpi->adapter->index, substream->number, &dpcm->h_stream)); if (err) kfree(dpcm); @@ -1186,7 +1184,6 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream) if (err) return -EIO; - init_timer(&dpcm->timer); dpcm->timer.data = (unsigned long) dpcm; dpcm->timer.function = snd_card_asihpi_timer_function; @@ -1243,15 +1240,20 @@ static struct snd_pcm_ops snd_card_asihpi_capture_mmap_ops = { .pointer = snd_card_asihpi_capture_pointer, }; -static int __devinit snd_card_asihpi_pcm_new(struct snd_card_asihpi *asihpi, - int device, int substreams) +static int __devinit snd_card_asihpi_pcm_new( + struct snd_card_asihpi *asihpi, int device) { struct snd_pcm *pcm; int err; + u16 num_instreams, num_outstreams, x16; + u32 x32; + + err = hpi_adapter_get_info(asihpi->hpi->adapter->index, + &num_outstreams, &num_instreams, + &x16, &x32, &x16); err = snd_pcm_new(asihpi->card, "Asihpi PCM", device, - asihpi->num_outstreams, asihpi->num_instreams, - &pcm); + num_outstreams, num_instreams, &pcm); if (err < 0) return err; /* pointer to ops struct is stored, dont change ops afterwards! */ @@ -2561,7 +2563,7 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) strcpy(card->mixername, "Asihpi Mixer"); err = - hpi_mixer_open(asihpi->adapter_index, + hpi_mixer_open(asihpi->hpi->adapter->index, &asihpi->h_mixer); hpi_handle_error(err); if (err) @@ -2679,24 +2681,33 @@ snd_asihpi_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { struct snd_card_asihpi *asihpi = entry->private_data; - u16 version; u32 h_control; u32 rate = 0; u16 source = 0; + + u16 num_outstreams; + u16 num_instreams; + u16 version; + u32 serial_number; + u16 type; + int err; snd_iprintf(buffer, "ASIHPI driver proc file\n"); + + hpi_handle_error(hpi_adapter_get_info(asihpi->hpi->adapter->index, + &num_outstreams, &num_instreams, + &version, &serial_number, &type)); + snd_iprintf(buffer, - "adapter ID=%4X\n_index=%d\n" - "num_outstreams=%d\n_num_instreams=%d\n", - asihpi->type, asihpi->adapter_index, - asihpi->num_outstreams, asihpi->num_instreams); + "Adapter type ASI%4X\nHardware Index %d\n" + "%d outstreams\n%d instreams\n", + type, asihpi->hpi->adapter->index, + num_outstreams, num_instreams); - version = asihpi->version; snd_iprintf(buffer, - "serial#=%d\n_hw version %c%d\nDSP code version %03d\n", - asihpi->serial_number, ((version >> 3) & 0xf) + 'A', - version & 0x7, + "Serial#%d\nHardware version %c%d\nDSP code version %03d\n", + serial_number, ((version >> 3) & 0xf) + 'A', version & 0x7, ((version >> 13) * 100) + ((version >> 7) & 0x3f)); err = hpi_mixer_get_control(asihpi->h_mixer, @@ -2704,18 +2715,15 @@ snd_asihpi_proc_read(struct snd_info_entry *entry, HPI_CONTROL_SAMPLECLOCK, &h_control); if (!err) { - err = hpi_sample_clock_get_sample_rate( - h_control, &rate); + err = hpi_sample_clock_get_sample_rate(h_control, &rate); err += hpi_sample_clock_get_source(h_control, &source); if (!err) - snd_iprintf(buffer, "sample_clock=%d_hz, source %s\n", + snd_iprintf(buffer, "Sample Clock %dHz, source %s\n", rate, sampleclock_sources[source]); } - } - static void __devinit snd_asihpi_proc_init(struct snd_card_asihpi *asihpi) { struct snd_info_entry *entry; @@ -2787,35 +2795,34 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_id) { int err; - - u16 version; - int pcm_substreams; - - struct hpi_adapter *hpi_card; + struct hpi_adapter *hpi; struct snd_card *card; struct snd_card_asihpi *asihpi; u32 h_control; u32 h_stream; + u32 adapter_index; static int dev; if (dev >= SNDRV_CARDS) return -ENODEV; - /* Should this be enable[hpi_card->index] ? */ + /* Should this be enable[hpi->index] ? */ if (!enable[dev]) { dev++; return -ENOENT; } + /* Initialise low-level HPI driver */ err = asihpi_adapter_probe(pci_dev, pci_id); if (err < 0) return err; - hpi_card = pci_get_drvdata(pci_dev); + hpi = pci_get_drvdata(pci_dev); + adapter_index = hpi->adapter->index; /* first try to give the card the same index as its hardware index */ - err = snd_card_create(hpi_card->index, - id[hpi_card->index], THIS_MODULE, + err = snd_card_create(adapter_index, + id[adapter_index], THIS_MODULE, sizeof(struct snd_card_asihpi), &card); if (err < 0) { @@ -2829,50 +2836,32 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev, return err; snd_printk(KERN_WARNING "**** WARNING **** Adapter index %d->ALSA index %d\n", - hpi_card->index, card->number); + adapter_index, card->number); } snd_card_set_dev(card, &pci_dev->dev); - asihpi = (struct snd_card_asihpi *) card->private_data; + asihpi = card->private_data; asihpi->card = card; asihpi->pci = pci_dev; - asihpi->adapter_index = hpi_card->index; - hpi_handle_error(hpi_adapter_get_info( - asihpi->adapter_index, - &asihpi->num_outstreams, - &asihpi->num_instreams, - &asihpi->version, - &asihpi->serial_number, &asihpi->type)); - - version = asihpi->version; - snd_printk(KERN_INFO "adapter ID=%4X index=%d num_outstreams=%d " - "num_instreams=%d S/N=%d\n" - "Hw Version %c%d DSP code version %03d\n", - asihpi->type, asihpi->adapter_index, - asihpi->num_outstreams, - asihpi->num_instreams, asihpi->serial_number, - ((version >> 3) & 0xf) + 'A', - version & 0x7, - ((version >> 13) * 100) + ((version >> 7) & 0x3f)); - - pcm_substreams = asihpi->num_outstreams; - if (pcm_substreams < asihpi->num_instreams) - pcm_substreams = asihpi->num_instreams; - - err = hpi_adapter_get_property(asihpi->adapter_index, + asihpi->hpi = hpi; + + snd_printk(KERN_INFO "adapter ID=%4X index=%d\n", + asihpi->hpi->adapter->type, adapter_index); + + err = hpi_adapter_get_property(adapter_index, HPI_ADAPTER_PROPERTY_CAPS1, NULL, &asihpi->support_grouping); if (err) asihpi->support_grouping = 0; - err = hpi_adapter_get_property(asihpi->adapter_index, + err = hpi_adapter_get_property(adapter_index, HPI_ADAPTER_PROPERTY_CAPS2, &asihpi->support_mrx, NULL); if (err) asihpi->support_mrx = 0; - err = hpi_adapter_get_property(asihpi->adapter_index, + err = hpi_adapter_get_property(adapter_index, HPI_ADAPTER_PROPERTY_INTERVAL, NULL, &asihpi->update_interval_frames); if (err) @@ -2881,7 +2870,7 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev, if (!asihpi->can_dma) asihpi->update_interval_frames *= 2; - hpi_handle_error(hpi_instream_open(asihpi->adapter_index, + hpi_handle_error(hpi_instream_open(adapter_index, 0, &h_stream)); err = hpi_instream_host_buffer_free(h_stream); @@ -2889,7 +2878,7 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev, hpi_handle_error(hpi_instream_close(h_stream)); - err = hpi_adapter_get_property(asihpi->adapter_index, + err = hpi_adapter_get_property(adapter_index, HPI_ADAPTER_PROPERTY_CURCHANNELS, &asihpi->in_max_chans, &asihpi->out_max_chans); if (err) { @@ -2906,13 +2895,13 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev, asihpi->in_min_chans = 1; } - snd_printk(KERN_INFO "has dma:%d, grouping:%d, mrx:%d\n", + snd_printk(KERN_INFO "Has dma:%d, grouping:%d, mrx:%d\n", asihpi->can_dma, asihpi->support_grouping, asihpi->support_mrx ); - err = snd_card_asihpi_pcm_new(asihpi, 0, pcm_substreams); + err = snd_card_asihpi_pcm_new(asihpi, 0); if (err < 0) { snd_printk(KERN_ERR "pcm_new failed\n"); goto __nodev; @@ -2939,13 +2928,14 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev, strcpy(card->driver, "ASIHPI"); - sprintf(card->shortname, "AudioScience ASI%4X", asihpi->type); + sprintf(card->shortname, "AudioScience ASI%4X", + asihpi->hpi->adapter->type); sprintf(card->longname, "%s %i", - card->shortname, asihpi->adapter_index); + card->shortname, adapter_index); err = snd_card_register(card); if (!err) { - hpi_card->snd_card_asihpi = card; + hpi->snd_card = card; dev++; return 0; } @@ -2958,10 +2948,9 @@ __nodev: static void __devexit snd_asihpi_remove(struct pci_dev *pci_dev) { - struct hpi_adapter *hpi_card = pci_get_drvdata(pci_dev); - - snd_card_free(hpi_card->snd_card_asihpi); - hpi_card->snd_card_asihpi = NULL; + struct hpi_adapter *hpi = pci_get_drvdata(pci_dev); + snd_card_free(hpi->snd_card); + hpi->snd_card = NULL; asihpi_adapter_remove(pci_dev); } diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c index 278bec8..2414d7a 100644 --- a/sound/pci/asihpi/hpi6000.c +++ b/sound/pci/asihpi/hpi6000.c @@ -231,6 +231,8 @@ static void subsys_message(struct hpi_message *phm, struct hpi_response *phr) static void control_message(struct hpi_adapter_obj *pao, struct hpi_message *phm, struct hpi_response *phr) { + struct hpi_hw_obj *phw = pao->priv; + switch (phm->function) { case HPI_CONTROL_GET_STATE: if (pao->has_control_cache) { @@ -248,17 +250,14 @@ static void control_message(struct hpi_adapter_obj *pao, break; } - if (hpi_check_control_cache(((struct hpi_hw_obj *) - pao->priv)->p_cache, phm, - phr)) + if (hpi_check_control_cache(phw->p_cache, phm, phr)) break; } hw_message(pao, phm, phr); break; case HPI_CONTROL_SET_STATE: hw_message(pao, phm, phr); - hpi_cmn_control_cache_sync_to_msg(((struct hpi_hw_obj *)pao-> - priv)->p_cache, phm, phr); + hpi_cmn_control_cache_sync_to_msg(phw->p_cache, phm, phr); break; case HPI_CONTROL_GET_INFO: @@ -451,11 +450,11 @@ static void subsys_create_adapter(struct hpi_message *phm, } for (dsp_index = 0; dsp_index < MAX_DSPS; dsp_index++) { - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; + struct hpi_hw_obj *phw = pao->priv; phw->ado[dsp_index].pa_parent_adapter = pao; } - phr->u.s.adapter_type = ao.adapter_type; + phr->u.s.adapter_type = ao.type; phr->u.s.adapter_index = ao.index; phr->error = 0; } @@ -476,7 +475,7 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao, u32 dsp_index = 0; u32 control_cache_size = 0; u32 control_cache_count = 0; - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; + struct hpi_hw_obj *phw = pao->priv; /* The PCI2040 has the following address map */ /* BAR0 - 4K = HPI control and status registers on PCI2040 (HPI CSR) */ @@ -559,7 +558,7 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao, if (error) return error; } - pao->adapter_type = hr0.u.ax.info.adapter_type; + pao->type = hr0.u.ax.info.adapter_type; pao->index = hr0.u.ax.info.adapter_index; } @@ -584,9 +583,8 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao, pao->has_control_cache = 1; } - HPI_DEBUG_LOG(DEBUG, "get adapter info ASI%04X index %d\n", - pao->adapter_type, pao->index); - pao->open = 0; /* upon creation the adapter is closed */ + HPI_DEBUG_LOG(DEBUG, "get adapter info ASI%04X index %d\n", pao->type, + pao->index); if (phw->p_cache) phw->p_cache->adap_idx = pao->index; @@ -596,7 +594,7 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao, static void delete_adapter_obj(struct hpi_adapter_obj *pao) { - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; + struct hpi_hw_obj *phw = pao->priv; if (pao->has_control_cache) hpi_free_control_cache(phw->p_cache); @@ -639,7 +637,7 @@ static void adapter_get_asserts(struct hpi_adapter_obj *pao, static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao, u32 *pos_error_code) { - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; + struct hpi_hw_obj *phw = pao->priv; short error; u32 timeout; u32 read = 0; @@ -1220,8 +1218,8 @@ static void hpi_read_block(struct dsp_obj *pdo, u32 address, u32 *pdata, static u16 hpi6000_dsp_block_write32(struct hpi_adapter_obj *pao, u16 dsp_index, u32 hpi_address, u32 *source, u32 count) { - struct dsp_obj *pdo = - &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; + struct hpi_hw_obj *phw = pao->priv; + struct dsp_obj *pdo = &phw->ado[dsp_index]; u32 time_out = PCI_TIMEOUT; int c6711_burst_size = 128; u32 local_hpi_address = hpi_address; @@ -1258,8 +1256,8 @@ static u16 hpi6000_dsp_block_write32(struct hpi_adapter_obj *pao, static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao, u16 dsp_index, u32 hpi_address, u32 *dest, u32 count) { - struct dsp_obj *pdo = - &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; + struct hpi_hw_obj *phw = pao->priv; + struct dsp_obj *pdo = &phw->ado[dsp_index]; u32 time_out = PCI_TIMEOUT; int c6711_burst_size = 16; u32 local_hpi_address = hpi_address; @@ -1298,7 +1296,7 @@ static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao, static short hpi6000_message_response_sequence(struct hpi_adapter_obj *pao, u16 dsp_index, struct hpi_message *phm, struct hpi_response *phr) { - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; + struct hpi_hw_obj *phw = pao->priv; struct dsp_obj *pdo = &phw->ado[dsp_index]; u32 timeout; u16 ack; @@ -1414,8 +1412,8 @@ static short hpi6000_send_data_check_adr(u32 address, u32 length_in_dwords) static short hpi6000_send_data(struct hpi_adapter_obj *pao, u16 dsp_index, struct hpi_message *phm, struct hpi_response *phr) { - struct dsp_obj *pdo = - &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; + struct hpi_hw_obj *phw = pao->priv; + struct dsp_obj *pdo = &phw->ado[dsp_index]; u32 data_sent = 0; u16 ack; u32 length, address; @@ -1487,8 +1485,8 @@ static short hpi6000_send_data(struct hpi_adapter_obj *pao, u16 dsp_index, static short hpi6000_get_data(struct hpi_adapter_obj *pao, u16 dsp_index, struct hpi_message *phm, struct hpi_response *phr) { - struct dsp_obj *pdo = - &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; + struct hpi_hw_obj *phw = pao->priv; + struct dsp_obj *pdo = &phw->ado[dsp_index]; u32 data_got = 0; u16 ack; u32 length, address; @@ -1551,8 +1549,8 @@ static void hpi6000_send_dsp_interrupt(struct dsp_obj *pdo) static short hpi6000_send_host_command(struct hpi_adapter_obj *pao, u16 dsp_index, u32 host_cmd) { - struct dsp_obj *pdo = - &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; + struct hpi_hw_obj *phw = pao->priv; + struct dsp_obj *pdo = &phw->ado[dsp_index]; u32 timeout = TIMEOUT; /* set command */ @@ -1577,7 +1575,7 @@ static short hpi6000_check_PCI2040_error_flag(struct hpi_adapter_obj *pao, { u32 hPI_error; - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; + struct hpi_hw_obj *phw = pao->priv; /* read the error bits from the PCI2040 */ hPI_error = ioread32(phw->dw2040_HPICSR + HPI_ERROR_REPORT); @@ -1597,8 +1595,8 @@ static short hpi6000_check_PCI2040_error_flag(struct hpi_adapter_obj *pao, static short hpi6000_wait_dsp_ack(struct hpi_adapter_obj *pao, u16 dsp_index, u32 ack_value) { - struct dsp_obj *pdo = - &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; + struct hpi_hw_obj *phw = pao->priv; + struct dsp_obj *pdo = &phw->ado[dsp_index]; u32 ack = 0L; u32 timeout; u32 hPIC = 0L; @@ -1640,7 +1638,7 @@ static short hpi6000_update_control_cache(struct hpi_adapter_obj *pao, struct hpi_message *phm) { const u16 dsp_index = 0; - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; + struct hpi_hw_obj *phw = pao->priv; struct dsp_obj *pdo = &phw->ado[dsp_index]; u32 timeout; u32 cache_dirty_flag; @@ -1740,7 +1738,8 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm, { u16 error = 0; u16 dsp_index = 0; - u16 num_dsp = ((struct hpi_hw_obj *)pao->priv)->num_dsp; + struct hpi_hw_obj *phw = pao->priv; + u16 num_dsp = phw->num_dsp; if (num_dsp < 2) dsp_index = 0; diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c index 95d1cd5..e3d0f55 100644 --- a/sound/pci/asihpi/hpi6205.c +++ b/sound/pci/asihpi/hpi6205.c @@ -488,7 +488,7 @@ static void subsys_create_adapter(struct hpi_message *phm, return; } - phr->u.s.adapter_type = ao.adapter_type; + phr->u.s.adapter_type = ao.type; phr->u.s.adapter_index = ao.index; phr->error = 0; } @@ -503,7 +503,7 @@ static void adapter_delete(struct hpi_adapter_obj *pao, phr->error = HPI_ERROR_INVALID_OBJ_INDEX; return; } - phw = (struct hpi_hw_obj *)pao->priv; + phw = pao->priv; /* reset adapter h/w */ /* Reset C6713 #1 */ boot_loader_write_mem32(pao, 0, C6205_BAR0_TIMER1_CTL, 0); @@ -652,7 +652,7 @@ static u16 create_adapter_obj(struct hpi_adapter_obj *pao, if (hr.error) return hr.error; - pao->adapter_type = hr.u.ax.info.adapter_type; + pao->type = hr.u.ax.info.adapter_type; pao->index = hr.u.ax.info.adapter_index; max_streams = @@ -665,8 +665,6 @@ static u16 create_adapter_obj(struct hpi_adapter_obj *pao, hr.u.ax.info.serial_number); } - pao->open = 0; /* upon creation the adapter is closed */ - if (phw->p_cache) phw->p_cache->adap_idx = pao->index; diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c index 358853a..c54a49f 100644 --- a/sound/pci/asihpi/hpicmn.c +++ b/sound/pci/asihpi/hpicmn.c @@ -68,7 +68,7 @@ u16 hpi_validate_response(struct hpi_message *phm, struct hpi_response *phr) u16 hpi_add_adapter(struct hpi_adapter_obj *pao) { u16 retval = 0; - /*HPI_ASSERT(pao->wAdapterType); */ + /*HPI_ASSERT(pao->type); */ hpios_alistlock_lock(&adapters); @@ -77,13 +77,13 @@ u16 hpi_add_adapter(struct hpi_adapter_obj *pao) goto unlock; } - if (adapters.adapter[pao->index].adapter_type) { + if (adapters.adapter[pao->index].type) { int a; for (a = HPI_MAX_ADAPTERS - 1; a >= 0; a--) { - if (!adapters.adapter[a].adapter_type) { + if (!adapters.adapter[a].type) { HPI_DEBUG_LOG(WARNING, "ASI%X duplicate index %d moved to %d\n", - pao->adapter_type, pao->index, a); + pao->type, pao->index, a); pao->index = a; break; } @@ -104,13 +104,13 @@ unlock: void hpi_delete_adapter(struct hpi_adapter_obj *pao) { - if (!pao->adapter_type) { + if (!pao->type) { HPI_DEBUG_LOG(ERROR, "removing null adapter?\n"); return; } hpios_alistlock_lock(&adapters); - if (adapters.adapter[pao->index].adapter_type) + if (adapters.adapter[pao->index].type) adapters.gw_num_adapters--; memset(&adapters.adapter[pao->index], 0, sizeof(adapters.adapter[0])); hpios_alistlock_unlock(&adapters); @@ -132,7 +132,7 @@ struct hpi_adapter_obj *hpi_find_adapter(u16 adapter_index) } pao = &adapters.adapter[adapter_index]; - if (pao->adapter_type != 0) { + if (pao->type != 0) { /* HPI_DEBUG_LOG(VERBOSE, "Found adapter index %d\n", wAdapterIndex); @@ -165,7 +165,7 @@ static void subsys_get_adapter(struct hpi_message *phm, /* find the nCount'th nonzero adapter in array */ for (index = 0; index < HPI_MAX_ADAPTERS; index++) { - if (adapters.adapter[index].adapter_type) { + if (adapters.adapter[index].type) { if (!count) break; count--; @@ -174,11 +174,11 @@ static void subsys_get_adapter(struct hpi_message *phm, if (index < HPI_MAX_ADAPTERS) { phr->u.s.adapter_index = adapters.adapter[index].index; - phr->u.s.adapter_type = adapters.adapter[index].adapter_type; + phr->u.s.adapter_type = adapters.adapter[index].type; } else { phr->u.s.adapter_index = 0; phr->u.s.adapter_type = 0; - phr->error = HPI_ERROR_BAD_ADAPTER_NUMBER; + phr->error = HPI_ERROR_INVALID_OBJ_INDEX; } } diff --git a/sound/pci/asihpi/hpicmn.h b/sound/pci/asihpi/hpicmn.h index 67cc1b0..e441212 100644 --- a/sound/pci/asihpi/hpicmn.h +++ b/sound/pci/asihpi/hpicmn.h @@ -18,12 +18,15 @@ */ +struct hpi_adapter_obj; + +/* a function that takes an adapter obj and returns an int */ +typedef int adapter_int_func(struct hpi_adapter_obj *pao); + struct hpi_adapter_obj { struct hpi_pci pci; /* PCI info - bus#,dev#,address etc */ - u16 adapter_type; /* ASI6701 etc */ - u16 index; /* */ - u16 open; /* =1 when adapter open */ - u16 mixer_open; + u16 type; /* 0x6644 == ASI6644 etc */ + u16 index; struct hpios_spinlock dsp_lock; diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c index 75f7a2d..6091562 100644 --- a/sound/pci/asihpi/hpioctl.c +++ b/sound/pci/asihpi/hpioctl.c @@ -66,9 +66,7 @@ static struct hpi_adapter adapters[HPI_MAX_ADAPTERS]; static void hpi_send_recv_f(struct hpi_message *phm, struct hpi_response *phr, struct file *file) { - int adapter = phm->adapter_index; - - if ((adapter >= HPI_MAX_ADAPTERS || adapter < 0) + if ((phm->adapter_index >= HPI_MAX_ADAPTERS) && (phm->object != HPI_OBJ_SUBSYSTEM)) phr->error = HPI_ERROR_INVALID_OBJ_INDEX; else @@ -179,19 +177,14 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } else { u16 __user *ptr = NULL; u32 size = 0; - u32 adapter_present; /* -1=no data 0=read from user mem, 1=write to user mem */ int wrflag = -1; - struct hpi_adapter *pa; + struct hpi_adapter *pa = NULL; - if (hm->h.adapter_index < HPI_MAX_ADAPTERS) { + if (hm->h.adapter_index < ARRAY_SIZE(adapters)) pa = &adapters[hm->h.adapter_index]; - adapter_present = pa->type; - } else { - adapter_present = 0; - } - if (!adapter_present) { + if (!pa || !pa->adapter || !pa->adapter->type) { hpi_init_response(&hr->r0, hm->h.object, hm->h.function, HPI_ERROR_BAD_ADAPTER_NUMBER); @@ -318,6 +311,7 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_id) { int idx, nm; + int adapter_index; unsigned int memlen; struct hpi_message hm; struct hpi_response hr; @@ -346,8 +340,6 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev, hm.adapter_index = HPI_ADAPTER_INDEX_INVALID; - adapter.pci = pci_dev; - nm = HPI_MAX_ADAPTER_MEM_SPACES; for (idx = 0; idx < nm; idx++) { @@ -356,18 +348,16 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev, if (pci_resource_flags(pci_dev, idx) & IORESOURCE_MEM) { memlen = pci_resource_len(pci_dev, idx); - adapter.ap_remapped_mem_base[idx] = + pci.ap_mem_base[idx] = ioremap(pci_resource_start(pci_dev, idx), memlen); - if (!adapter.ap_remapped_mem_base[idx]) { + if (!pci.ap_mem_base[idx]) { HPI_DEBUG_LOG(ERROR, "ioremap failed, aborting\n"); /* unmap previously mapped pci mem space */ goto err; } } - - pci.ap_mem_base[idx] = adapter.ap_remapped_mem_base[idx]; } pci.pci_dev = pci_dev; @@ -379,6 +369,9 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev, if (hr.error) goto err; + adapter_index = hr.u.s.adapter_index; + adapter.adapter = hpi_find_adapter(adapter_index); + if (prealloc_stream_buf) { adapter.p_buffer = vmalloc(prealloc_stream_buf); if (!adapter.p_buffer) { @@ -390,36 +383,32 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev, } } - adapter.index = hr.u.s.adapter_index; - adapter.type = hr.u.s.adapter_type; - hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER, HPI_ADAPTER_OPEN); - hm.adapter_index = adapter.index; + hm.adapter_index = adapter.adapter->index; hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); if (hr.error) goto err; - adapter.snd_card_asihpi = NULL; /* WARNING can't init mutex in 'adapter' * and then copy it to adapters[] ?!?! */ - adapters[adapter.index] = adapter; - mutex_init(&adapters[adapter.index].mutex); - pci_set_drvdata(pci_dev, &adapters[adapter.index]); + adapters[adapter_index] = adapter; + mutex_init(&adapters[adapter_index].mutex); + pci_set_drvdata(pci_dev, &adapters[adapter_index]); dev_printk(KERN_INFO, &pci_dev->dev, - "probe succeeded for ASI%04X HPI index %d\n", adapter.type, - adapter.index); + "probe succeeded for ASI%04X HPI index %d\n", + adapter.adapter->type, adapter_index); return 0; err: for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) { - if (adapter.ap_remapped_mem_base[idx]) { - iounmap(adapter.ap_remapped_mem_base[idx]); - adapter.ap_remapped_mem_base[idx] = NULL; + if (pci.ap_mem_base[idx]) { + iounmap(pci.ap_mem_base[idx]); + pci.ap_mem_base[idx] = NULL; } } @@ -438,19 +427,20 @@ void __devexit asihpi_adapter_remove(struct pci_dev *pci_dev) struct hpi_message hm; struct hpi_response hr; struct hpi_adapter *pa; + struct hpi_pci pci; + pa = pci_get_drvdata(pci_dev); + pci = pa->adapter->pci; hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER, HPI_ADAPTER_DELETE); - hm.adapter_index = pa->index; + hm.adapter_index = pa->adapter->index; hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); /* unmap PCI memory space, mapped during device init. */ for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) { - if (pa->ap_remapped_mem_base[idx]) { - iounmap(pa->ap_remapped_mem_base[idx]); - pa->ap_remapped_mem_base[idx] = NULL; - } + if (pci.ap_mem_base[idx]) + iounmap(pci.ap_mem_base[idx]); } if (pa->p_buffer) @@ -462,7 +452,7 @@ void __devexit asihpi_adapter_remove(struct pci_dev *pci_dev) "remove %04x:%04x,%04x:%04x,%04x," " HPI index %d.\n", pci_dev->vendor, pci_dev->device, pci_dev->subsystem_vendor, pci_dev->subsystem_device, - pci_dev->devfn, pa->index); + pci_dev->devfn, pa->adapter->index); memset(pa, 0, sizeof(*pa)); } diff --git a/sound/pci/asihpi/hpios.h b/sound/pci/asihpi/hpios.h index d59a059..c5cef11 100644 --- a/sound/pci/asihpi/hpios.h +++ b/sound/pci/asihpi/hpios.h @@ -149,20 +149,18 @@ static inline void cond_unlock(struct hpios_spinlock *l) #define hpios_alistlock_lock(obj) spin_lock(&((obj)->list_lock.lock)) #define hpios_alistlock_unlock(obj) spin_unlock(&((obj)->list_lock.lock)) +struct snd_card; + +/** pci drvdata points to an instance of this struct */ struct hpi_adapter { + struct hpi_adapter_obj *adapter; + struct snd_card *snd_card; + /* mutex prevents contention for one card between multiple user programs (via ioctl) */ struct mutex mutex; - u16 index; - u16 type; - - /* ALSA card structure */ - void *snd_card_asihpi; - char *p_buffer; size_t buffer_size; - struct pci_dev *pci; - void __iomem *ap_remapped_mem_base[HPI_MAX_ADAPTER_MEM_SPACES]; }; #endif -- cgit v1.1 From 50d5f773ecc42fec029530f0e2e22686ccdf0ac7 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:44 +1300 Subject: ALSA: asihpi - Simplify dsp code close. dsp_code struct is not created if firmware is invalid, so check and zero of firmware pointer is not necessary Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpidspcd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/hpidspcd.c b/sound/pci/asihpi/hpidspcd.c index 21cdb9e..456a758 100644 --- a/sound/pci/asihpi/hpidspcd.c +++ b/sound/pci/asihpi/hpidspcd.c @@ -109,11 +109,8 @@ error1: /*-------------------------------------------------------------------*/ void hpi_dsp_code_close(struct dsp_code *dsp_code) { - if (dsp_code->pvt->firmware) { - HPI_DEBUG_LOG(DEBUG, "dsp code closed\n"); - release_firmware(dsp_code->pvt->firmware); - dsp_code->pvt->firmware = NULL; - } + HPI_DEBUG_LOG(DEBUG, "dsp code closed\n"); + release_firmware(dsp_code->pvt->firmware); kfree(dsp_code->pvt); } -- cgit v1.1 From 862e14185b46e1d65d560c7dbaa0f2c842b71d20 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:45 +1300 Subject: ALSA: asihpi - Add autofade query. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi.h | 3 +++ sound/pci/asihpi/hpifunc.c | 10 ++++++++++ 2 files changed, 13 insertions(+) (limited to 'sound') diff --git a/sound/pci/asihpi/hpi.h b/sound/pci/asihpi/hpi.h index 867c144..f2f1d98 100644 --- a/sound/pci/asihpi/hpi.h +++ b/sound/pci/asihpi/hpi.h @@ -1347,6 +1347,9 @@ u16 hpi_volume_auto_fade_profile(u32 h_control, short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms, u16 profile); +u16 hpi_volume_query_auto_fade_profile(const u32 h_control, const u32 i, + u16 *profile); + /*****************/ /* Level control */ /*****************/ diff --git a/sound/pci/asihpi/hpifunc.c b/sound/pci/asihpi/hpifunc.c index ebb568d..510e56c 100644 --- a/sound/pci/asihpi/hpifunc.c +++ b/sound/pci/asihpi/hpifunc.c @@ -2826,6 +2826,16 @@ u16 hpi_volume_auto_fade(u32 h_control, duration_ms, HPI_VOLUME_AUTOFADE_LOG); } +u16 hpi_volume_query_auto_fade_profile(const u32 h_volume, const u32 i, + u16 *profile) +{ + u16 e; + u32 u; + e = hpi_control_query(h_volume, HPI_VOLUME_AUTOFADE, i, 0, &u); + *profile = (u16)u; + return e; +} + u16 hpi_vox_set_threshold(u32 h_control, short an_gain0_01dB) { struct hpi_message hm; -- cgit v1.1 From 812550e9efd149062fdc6cc8bf00b5f15d0734b7 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:46 +1300 Subject: ALSA: asihpi - New defs and comments. Add new error codes, and adapter properties. Clean up some comments. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi.h | 48 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/hpi.h b/sound/pci/asihpi/hpi.h index f2f1d98..2088724 100644 --- a/sound/pci/asihpi/hpi.h +++ b/sound/pci/asihpi/hpi.h @@ -431,7 +431,19 @@ Indicates that the adapter in it's current mode supports interrupts across the host bus. Note, this does not imply that interrupts are enabled. Instead it indicates that they can be enabled. */ - HPI_ADAPTER_PROPERTY_SUPPORTS_IRQ = 272 + HPI_ADAPTER_PROPERTY_SUPPORTS_IRQ = 272, +/** Readonly supports firmware updating. +Indicates that the adapter implements an interface to update firmware +on the adapter. +*/ + HPI_ADAPTER_PROPERTY_SUPPORTS_FW_UPDATE = 273, +/** Readonly Firmware IDs +Identifiy firmware independent of individual adapter type. +May be used as a filter for firmware update images. +Property 1 = Bootloader ID +Property 2 = Main program ID +*/ + HPI_ADAPTER_PROPERTY_FIRMWARE_ID = 274 }; /** Adapter mode commands @@ -619,7 +631,7 @@ enum HPI_MIXER_STORE_COMMAND { HPI_MIXER_STORE_ENABLE = 4, /** Disable auto storage of some control settings. */ HPI_MIXER_STORE_DISABLE = 5, -/** Save the attributes of a single control. */ +/** Unimplemented - save the attributes of a single control. */ HPI_MIXER_STORE_SAVE_SINGLE = 6 }; @@ -922,7 +934,7 @@ enum HPI_ERROR_CODES { HPI_ERROR_BAD_ADAPTER_NUMBER = 202, /** 2 adapters with the same adapter number. */ HPI_ERROR_DUPLICATE_ADAPTER_NUMBER = 203, - /** DSP code failed to bootload. (unused?) */ + /** DSP code failed to bootload. Usually a DSP memory test failure. */ HPI_ERROR_DSP_BOOTLOAD = 204, /** Couldn't find or open the DSP code file. */ HPI_ERROR_DSP_FILE_NOT_FOUND = 206, @@ -959,6 +971,9 @@ enum HPI_ERROR_CODES { HPI_ERROR_FLASH_VERIFY = 225, HPI_ERROR_FLASH_TYPE = 226, HPI_ERROR_FLASH_START = 227, + HPI_ERROR_FLASH_READ = 228, + HPI_ERROR_FLASH_READ_NO_FILE = 229, + HPI_ERROR_FLASH_SIZE = 230, /** Reserved for OEMs. */ HPI_ERROR_RESERVED_1 = 290, @@ -1001,6 +1016,8 @@ enum HPI_ERROR_CODES { HPI_ERROR_NO_INTERDSP_GROUPS = 315, /** Stream wait cancelled before threshold reached. */ HPI_ERROR_WAIT_CANCELLED = 316, + /** A character string is invalid. */ + HPI_ERROR_INVALID_STRING = 317, /** Invalid mixer node for this adapter. */ HPI_ERROR_INVALID_NODE = 400, @@ -1027,11 +1044,15 @@ enum HPI_ERROR_CODES { /** I2C */ HPI_ERROR_I2C_BAD_ADR = 460, - /** Entity errors */ + /** Entity type did not match requested type */ HPI_ERROR_ENTITY_TYPE_MISMATCH = 470, + /** Entity item count did not match requested count */ HPI_ERROR_ENTITY_ITEM_COUNT = 471, + /** Entity type is not one of the valid types */ HPI_ERROR_ENTITY_TYPE_INVALID = 472, + /** Entity role is not one of the valid roles */ HPI_ERROR_ENTITY_ROLE_INVALID = 473, + /** Entity size doesn't match target size */ HPI_ERROR_ENTITY_SIZE_MISMATCH = 474, /* AES18 specific errors were 500..507 */ @@ -1059,8 +1080,7 @@ enum HPI_ERROR_CODES { /** \defgroup maximums HPI maximum values \{ */ -/** Maximum number of adapters per HPI sub-system - WARNING: modifying this value changes the response structure size.*/ +/** Maximum number of PCI HPI adapters */ #define HPI_MAX_ADAPTERS 20 /** Maximum number of in or out streams per adapter */ #define HPI_MAX_STREAMS 16 @@ -1071,6 +1091,9 @@ enum HPI_ERROR_CODES { #define HPI_MAX_ANC_BYTES_PER_FRAME (64) #define HPI_STRING_LEN 16 +/** Networked adapters have index >= 100 */ +#define HPI_MIN_NETWORK_ADAPTER_IDX 100 + /** Velocity units */ #define HPI_OSTREAM_VELOCITY_UNITS 4096 /** OutStream timescale units */ @@ -1092,14 +1115,14 @@ enum HPI_ERROR_CODES { struct hpi_format { u32 sample_rate; /**< 11025, 32000, 44100 ... */ - u32 bit_rate; /**< for MPEG */ + u32 bit_rate; /**< for MPEG */ u32 attributes; /**< Stereo/JointStereo/Mono */ u16 mode_legacy; /**< Legacy ancillary mode or idle bit */ - u16 unused; /**< Unused */ - u16 channels; /**< 1,2..., (or ancillary mode or idle bit */ - u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see #HPI_FORMATS. */ + u16 unused; /**< Unused */ + u16 channels; /**< 1,2..., (or ancillary mode or idle bit */ + u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see #HPI_FORMATS. */ }; struct hpi_anc_frame { @@ -1125,9 +1148,6 @@ struct hpi_async_event { } u; }; -/* skip host side function declarations for - DSP compile and documentation extraction */ - #ifndef DISABLE_PRAGMA_PACK1 #pragma pack(pop) #endif @@ -1338,7 +1358,7 @@ u16 hpi_volume_get_mute(u32 h_control, u32 *mute); u16 hpi_volume_query_range(u32 h_control, short *min_gain_01dB, short *max_gain_01dB, short *step_gain_01dB); -u16 hpi_volume_query_channels(const u32 h_volume, u32 *p_channels); +u16 hpi_volume_query_channels(const u32 h_control, u32 *p_channels); u16 hpi_volume_auto_fade(u32 h_control, short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms); -- cgit v1.1 From 4e225e2649660af1510aa06f20b32e1dcc45545e Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:47 +1300 Subject: ALSA: asihpi - Distinguish four different emif init errors. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpi6205.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c index e3d0f55..4f28738 100644 --- a/sound/pci/asihpi/hpi6205.c +++ b/sound/pci/asihpi/hpi6205.c @@ -45,18 +45,21 @@ #define HPI6205_ERROR_MSG_RESP_TIMEOUT 1016 /* initialization/bootload errors */ -#define HPI6205_ERROR_6205_NO_IRQ 1002 -#define HPI6205_ERROR_6205_INIT_FAILED 1003 -#define HPI6205_ERROR_6205_REG 1006 -#define HPI6205_ERROR_6205_DSPPAGE 1007 -#define HPI6205_ERROR_C6713_HPIC 1009 -#define HPI6205_ERROR_C6713_HPIA 1010 -#define HPI6205_ERROR_C6713_PLL 1011 -#define HPI6205_ERROR_DSP_INTMEM 1012 -#define HPI6205_ERROR_DSP_EXTMEM 1013 -#define HPI6205_ERROR_DSP_PLD 1014 -#define HPI6205_ERROR_6205_EEPROM 1017 -#define HPI6205_ERROR_DSP_EMIF 1018 +#define HPI6205_ERROR_6205_NO_IRQ 1002 +#define HPI6205_ERROR_6205_INIT_FAILED 1003 +#define HPI6205_ERROR_6205_REG 1006 +#define HPI6205_ERROR_6205_DSPPAGE 1007 +#define HPI6205_ERROR_C6713_HPIC 1009 +#define HPI6205_ERROR_C6713_HPIA 1010 +#define HPI6205_ERROR_C6713_PLL 1011 +#define HPI6205_ERROR_DSP_INTMEM 1012 +#define HPI6205_ERROR_DSP_EXTMEM 1013 +#define HPI6205_ERROR_DSP_PLD 1014 +#define HPI6205_ERROR_6205_EEPROM 1017 +#define HPI6205_ERROR_DSP_EMIF1 1018 +#define HPI6205_ERROR_DSP_EMIF2 1019 +#define HPI6205_ERROR_DSP_EMIF3 1020 +#define HPI6205_ERROR_DSP_EMIF4 1021 /*****************************************************************************/ /* for C6205 PCI i/f */ @@ -1612,7 +1615,7 @@ static u16 boot_loader_config_emif(struct hpi_adapter_obj *pao, int dsp_index) boot_loader_write_mem32(pao, dsp_index, 0x01800008, setting); if (setting != boot_loader_read_mem32(pao, dsp_index, 0x01800008)) - return HPI6205_ERROR_DSP_EMIF; + return HPI6205_ERROR_DSP_EMIF1; /* EMIF CE1 setup - 32 bit async. This is 6713 #1 HPI, */ /* which occupies D15..0. 6713 starts at 27MHz, so need */ @@ -1625,7 +1628,7 @@ static u16 boot_loader_config_emif(struct hpi_adapter_obj *pao, int dsp_index) boot_loader_write_mem32(pao, dsp_index, 0x01800004, setting); if (setting != boot_loader_read_mem32(pao, dsp_index, 0x01800004)) - return HPI6205_ERROR_DSP_EMIF; + return HPI6205_ERROR_DSP_EMIF2; /* EMIF CE2 setup - 32 bit async. This is 6713 #2 HPI, */ /* which occupies D15..0. 6713 starts at 27MHz, so need */ @@ -1637,7 +1640,7 @@ static u16 boot_loader_config_emif(struct hpi_adapter_obj *pao, int dsp_index) boot_loader_write_mem32(pao, dsp_index, 0x01800010, setting); if (setting != boot_loader_read_mem32(pao, dsp_index, 0x01800010)) - return HPI6205_ERROR_DSP_EMIF; + return HPI6205_ERROR_DSP_EMIF3; /* EMIF CE3 setup - 32 bit async. */ /* This is the PLD on the ASI5000 cards only */ @@ -1648,7 +1651,7 @@ static u16 boot_loader_config_emif(struct hpi_adapter_obj *pao, int dsp_index) boot_loader_write_mem32(pao, dsp_index, 0x01800014, setting); if (setting != boot_loader_read_mem32(pao, dsp_index, 0x01800014)) - return HPI6205_ERROR_DSP_EMIF; + return HPI6205_ERROR_DSP_EMIF4; /* set EMIF SDRAM control for 2Mx32 SDRAM (512x32x4 bank) */ /* need to use this else DSP code crashes? */ -- cgit v1.1 From f50efa2d9b10e32bf9ccd1a4692df3096512dcfc Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:48 +1300 Subject: ALSA: asihpi - Add HPI version to module description. It is useful to know the HPI version without having to load the module, in order to determine the matching firmware version. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 2402801..c94d5d5 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -23,6 +23,7 @@ */ #include "hpi_internal.h" +#include "hpi_version.h" #include "hpimsginit.h" #include "hpioctl.h" #include "hpicmn.h" @@ -46,7 +47,8 @@ MODULE_LICENSE("GPL"); MODULE_AUTHOR("AudioScience inc. "); -MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx"); +MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx " + HPI_VER_STRING); #if defined CONFIG_SND_DEBUG_VERBOSE /** -- cgit v1.1 From 8637bc94f6a36c138229ac1ea09faca343f48bd7 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:49 +1300 Subject: ALSA: asihpi - Correct headers in cached control responses. Previously, only payload and size were correct, sufficient for reading, but other fields produced spurious debug output. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/hpicmn.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c index c54a49f..7ed5c26 100644 --- a/sound/pci/asihpi/hpicmn.c +++ b/sound/pci/asihpi/hpicmn.c @@ -324,6 +324,8 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache, } phr->error = 0; + phr->specific_error = 0; + phr->version = 0; /* set the default response size */ response_size = @@ -531,8 +533,12 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache, found ? "Cached" : "Uncached", phm->adapter_index, pI->control_index, pI->control_type, phm->u.c.attribute); - if (found) + if (found) { phr->size = (u16)response_size; + phr->type = HPI_TYPE_RESPONSE; + phr->object = phm->object; + phr->function = phm->function; + } return found; } -- cgit v1.1 From c1d70dd9c44d7554b97f38b5ce8001d3cbe10f61 Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:50 +1300 Subject: ALSA: asihpi - Use valid channel count in format enumeration. Since introduction of mono and low latency modes, fixed channel count of 2 is not always valid. Use reported max_channels instead. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index c94d5d5..fdec4aa 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -961,14 +961,12 @@ static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi, for (format = HPI_FORMAT_PCM8_UNSIGNED; format <= HPI_FORMAT_PCM24_SIGNED; format++) { - err = hpi_format_create(&hpi_format, - 2, format, sample_rate, 128000, 0); + err = hpi_format_create(&hpi_format, asihpi->out_max_chans, + format, sample_rate, 128000, 0); if (!err) - err = hpi_outstream_query_format(h_stream, - &hpi_format); + err = hpi_outstream_query_format(h_stream, &hpi_format); if (!err && (hpi_to_alsa_formats[format] != -1)) - pcmhw->formats |= - (1ULL << hpi_to_alsa_formats[format]); + pcmhw->formats |= (1ULL << hpi_to_alsa_formats[format]); } } @@ -1141,14 +1139,12 @@ static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi, for (format = HPI_FORMAT_PCM8_UNSIGNED; format <= HPI_FORMAT_PCM24_SIGNED; format++) { - err = hpi_format_create(&hpi_format, 2, format, - sample_rate, 128000, 0); + err = hpi_format_create(&hpi_format, asihpi->in_max_chans, + format, sample_rate, 128000, 0); if (!err) - err = hpi_instream_query_format(h_stream, - &hpi_format); + err = hpi_instream_query_format(h_stream, &hpi_format); if (!err) - pcmhw->formats |= - (1ULL << hpi_to_alsa_formats[format]); + pcmhw->formats |= (1ULL << hpi_to_alsa_formats[format]); } } -- cgit v1.1 From 68d533932217c6b3da4ab9abb15ab79d3a79474c Mon Sep 17 00:00:00 2001 From: Eliot Blennerhassett Date: Thu, 22 Dec 2011 13:38:51 +1300 Subject: ALSA: asihpi - Fix format validity check. Sharing and not reinitialising static pcm_hardware struct resulted in stream format validity flags being incorrectly shared between cards. Fix and clarify by declaring locally and initialising in the open functions. Signed-off-by: Eliot Blennerhassett Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 69 +++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 36 deletions(-) (limited to 'sound') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index fdec4aa..fd3926f 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -938,15 +938,15 @@ snd_card_asihpi_playback_pointer(struct snd_pcm_substream *substream) return ptr; } -static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi, - u32 h_stream, - struct snd_pcm_hardware *pcmhw) +static u64 snd_card_asihpi_playback_formats(struct snd_card_asihpi *asihpi, + u32 h_stream) { struct hpi_format hpi_format; u16 format; u16 err; u32 h_control; u32 sample_rate = 48000; + u64 formats = 0; /* on cards without SRC, must query at valid rate, * maybe set by external sync @@ -966,32 +966,24 @@ static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi, if (!err) err = hpi_outstream_query_format(h_stream, &hpi_format); if (!err && (hpi_to_alsa_formats[format] != -1)) - pcmhw->formats |= (1ULL << hpi_to_alsa_formats[format]); + formats |= (1ULL << hpi_to_alsa_formats[format]); } + return formats; } -static struct snd_pcm_hardware snd_card_asihpi_playback = { - .buffer_bytes_max = BUFFER_BYTES_MAX, - .period_bytes_min = PERIOD_BYTES_MIN, - .period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN, - .periods_min = PERIODS_MIN, - .periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN, - .fifo_size = 0, -}; - static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct snd_card_asihpi_pcm *dpcm; struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); + struct snd_pcm_hardware snd_card_asihpi_playback; int err; dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); if (dpcm == NULL) return -ENOMEM; - err = - hpi_outstream_open(card->hpi->adapter->index, + err = hpi_outstream_open(card->hpi->adapter->index, substream->number, &dpcm->h_stream); hpi_handle_error(err); if (err) @@ -1013,13 +1005,19 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) runtime->private_data = dpcm; runtime->private_free = snd_card_asihpi_runtime_free; - snd_card_asihpi_playback.channels_max = card->out_max_chans; - snd_card_asihpi_playback.channels_min = card->out_min_chans; + memset(&snd_card_asihpi_playback, 0, sizeof(snd_card_asihpi_playback)); + snd_card_asihpi_playback.buffer_bytes_max = BUFFER_BYTES_MAX; + snd_card_asihpi_playback.period_bytes_min = PERIOD_BYTES_MIN; /*?snd_card_asihpi_playback.period_bytes_min = card->out_max_chans * 4096; */ - - snd_card_asihpi_playback_format(card, dpcm->h_stream, - &snd_card_asihpi_playback); + snd_card_asihpi_playback.period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN; + snd_card_asihpi_playback.periods_min = PERIODS_MIN; + snd_card_asihpi_playback.periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN; + /* snd_card_asihpi_playback.fifo_size = 0; */ + snd_card_asihpi_playback.channels_max = card->out_max_chans; + snd_card_asihpi_playback.channels_min = card->out_min_chans; + snd_card_asihpi_playback.formats = + snd_card_asihpi_playback_formats(card, dpcm->h_stream); snd_card_asihpi_pcm_samplerates(card, &snd_card_asihpi_playback); @@ -1116,15 +1114,15 @@ static int snd_card_asihpi_capture_prepare(struct snd_pcm_substream *substream) -static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi, - u32 h_stream, - struct snd_pcm_hardware *pcmhw) +static u64 snd_card_asihpi_capture_formats(struct snd_card_asihpi *asihpi, + u32 h_stream) { struct hpi_format hpi_format; u16 format; u16 err; u32 h_control; u32 sample_rate = 48000; + u64 formats = 0; /* on cards without SRC, must query at valid rate, maybe set by external sync */ @@ -1144,25 +1142,17 @@ static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi, if (!err) err = hpi_instream_query_format(h_stream, &hpi_format); if (!err) - pcmhw->formats |= (1ULL << hpi_to_alsa_formats[format]); + formats |= (1ULL << hpi_to_alsa_formats[format]); } + return formats; } - -static struct snd_pcm_hardware snd_card_asihpi_capture = { - .buffer_bytes_max = BUFFER_BYTES_MAX, - .period_bytes_min = PERIOD_BYTES_MIN, - .period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN, - .periods_min = PERIODS_MIN, - .periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN, - .fifo_size = 0, -}; - static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); struct snd_card_asihpi_pcm *dpcm; + struct snd_pcm_hardware snd_card_asihpi_capture; int err; dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); @@ -1189,10 +1179,17 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream) runtime->private_data = dpcm; runtime->private_free = snd_card_asihpi_runtime_free; + memset(&snd_card_asihpi_capture, 0, sizeof(snd_card_asihpi_capture)); + snd_card_asihpi_capture.buffer_bytes_max = BUFFER_BYTES_MAX; + snd_card_asihpi_capture.period_bytes_min = PERIOD_BYTES_MIN; + snd_card_asihpi_capture.period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN; + snd_card_asihpi_capture.periods_min = PERIODS_MIN; + snd_card_asihpi_capture.periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN; + /* snd_card_asihpi_capture.fifo_size = 0; */ snd_card_asihpi_capture.channels_max = card->in_max_chans; snd_card_asihpi_capture.channels_min = card->in_min_chans; - snd_card_asihpi_capture_format(card, dpcm->h_stream, - &snd_card_asihpi_capture); + snd_card_asihpi_capture.formats = + snd_card_asihpi_capture_formats(card, dpcm->h_stream); snd_card_asihpi_pcm_samplerates(card, &snd_card_asihpi_capture); snd_card_asihpi_capture.info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP | -- cgit v1.1 From 5a5049637cf08c4c17805be679c19544bb27fb92 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Wed, 21 Dec 2011 10:40:59 -0700 Subject: ASoC: Allow DAI links to be specified using device tree nodes DAI link endpoints and platform (DMA) devices are currently specified by name. When instantiating sound cards from device tree, it may be more convenient to refer to these devices by phandle in the device tree, and for code to describe DAI links using the "struct device_node *" ("of_node") those phandles map to. This change adds new fields to snd_soc_dai_link which can "name" devices using of_node, enhances soc_bind_dai_link() to allow binding based on of_node, and enhances snd_soc_register_card() to ensure that illegal combinations of name and of_node are not used. Signed-off-by: Stephen Warren Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 42ad2db..a4592cb 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -764,8 +764,13 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) } /* no, then find CPU DAI from registered DAIs*/ list_for_each_entry(cpu_dai, &dai_list, list) { - if (strcmp(cpu_dai->name, dai_link->cpu_dai_name)) - continue; + if (dai_link->cpu_dai_of_node) { + if (cpu_dai->dev->of_node != dai_link->cpu_dai_of_node) + continue; + } else { + if (strcmp(cpu_dai->name, dai_link->cpu_dai_name)) + continue; + } rtd->cpu_dai = cpu_dai; goto find_codec; @@ -781,8 +786,13 @@ find_codec: /* no, then find CODEC from registered CODECs*/ list_for_each_entry(codec, &codec_list, list) { - if (strcmp(codec->name, dai_link->codec_name)) - continue; + if (dai_link->codec_of_node) { + if (codec->dev->of_node != dai_link->codec_of_node) + continue; + } else { + if (strcmp(codec->name, dai_link->codec_name)) + continue; + } rtd->codec = codec; @@ -814,13 +824,19 @@ find_platform: /* if there's no platform we match on the empty platform */ platform_name = dai_link->platform_name; - if (!platform_name) + if (!platform_name && !dai_link->platform_of_node) platform_name = "snd-soc-dummy"; /* no, then find one from the set of registered platforms */ list_for_each_entry(platform, &platform_list, list) { - if (strcmp(platform->name, platform_name)) - continue; + if (dai_link->platform_of_node) { + if (platform->dev->of_node != + dai_link->platform_of_node) + continue; + } else { + if (strcmp(platform->name, platform_name)) + continue; + } rtd->platform = platform; goto out; @@ -2831,6 +2847,40 @@ int snd_soc_register_card(struct snd_soc_card *card) if (!card->name || !card->dev) return -EINVAL; + for (i = 0; i < card->num_links; i++) { + struct snd_soc_dai_link *link = &card->dai_link[i]; + + /* + * Codec must be specified by 1 of name or OF node, + * not both or neither. + */ + if (!!link->codec_name == !!link->codec_of_node) { + dev_err(card->dev, + "Neither/both codec name/of_node are set\n"); + return -EINVAL; + } + + /* + * Platform may be specified by either name or OF node, but + * can be left unspecified, and a dummy platform will be used. + */ + if (link->platform_name && link->platform_of_node) { + dev_err(card->dev, + "Both platform name/of_node are set\n"); + return -EINVAL; + } + + /* + * CPU DAI must be specified by 1 of name or OF node, + * not both or neither. + */ + if (!!link->cpu_dai_name == !!link->cpu_dai_of_node) { + dev_err(card->dev, + "Neither/both cpu_dai name/of_node are set\n"); + return -EINVAL; + } + } + dev_set_drvdata(card->dev, card); snd_soc_initialize_card_lists(card); -- cgit v1.1 From 561c6a172f065fa918d0ff3cecdca1b22dca893f Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 22 Dec 2011 09:44:43 +0800 Subject: ASoC: pxa: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missed .owner of struct snd_soc_card will prevent the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/corgi.c | 1 + sound/soc/pxa/e740_wm9705.c | 1 + sound/soc/pxa/e750_wm9705.c | 1 + sound/soc/pxa/e800_wm9712.c | 1 + sound/soc/pxa/em-x270.c | 1 + sound/soc/pxa/hx4700.c | 1 + sound/soc/pxa/imote2.c | 1 + sound/soc/pxa/magician.c | 1 + sound/soc/pxa/mioa701_wm9713.c | 1 + sound/soc/pxa/palm27x.c | 1 + sound/soc/pxa/raumfeld.c | 2 ++ sound/soc/pxa/saarb.c | 1 + sound/soc/pxa/spitz.c | 1 + sound/soc/pxa/tavorevb3.c | 1 + sound/soc/pxa/tosa.c | 1 + sound/soc/pxa/z2.c | 1 + sound/soc/pxa/zylonite.c | 1 + 17 files changed, 18 insertions(+) (limited to 'sound') diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index b0e2fb7..5e5004a 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c @@ -317,6 +317,7 @@ static struct snd_soc_dai_link corgi_dai = { /* corgi audio machine driver */ static struct snd_soc_card snd_soc_corgi = { .name = "Corgi", + .owner = THIS_MODULE, .dai_link = &corgi_dai, .num_links = 1, }; diff --git a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c index 203ab78a..7b1bc23 100644 --- a/sound/soc/pxa/e740_wm9705.c +++ b/sound/soc/pxa/e740_wm9705.c @@ -133,6 +133,7 @@ static struct snd_soc_dai_link e740_dai[] = { static struct snd_soc_card e740 = { .name = "Toshiba e740", + .owner = THIS_MODULE, .dai_link = e740_dai, .num_links = ARRAY_SIZE(e740_dai), }; diff --git a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c index 27f90cc..47b89d7 100644 --- a/sound/soc/pxa/e750_wm9705.c +++ b/sound/soc/pxa/e750_wm9705.c @@ -116,6 +116,7 @@ static struct snd_soc_dai_link e750_dai[] = { static struct snd_soc_card e750 = { .name = "Toshiba e750", + .owner = THIS_MODULE, .dai_link = e750_dai, .num_links = ARRAY_SIZE(e750_dai), }; diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c index 858bf94..ea9707e 100644 --- a/sound/soc/pxa/e800_wm9712.c +++ b/sound/soc/pxa/e800_wm9712.c @@ -106,6 +106,7 @@ static struct snd_soc_dai_link e800_dai[] = { static struct snd_soc_card e800 = { .name = "Toshiba e800", + .owner = THIS_MODULE, .dai_link = e800_dai, .num_links = ARRAY_SIZE(e800_dai), }; diff --git a/sound/soc/pxa/em-x270.c b/sound/soc/pxa/em-x270.c index b13a425..64743a0 100644 --- a/sound/soc/pxa/em-x270.c +++ b/sound/soc/pxa/em-x270.c @@ -54,6 +54,7 @@ static struct snd_soc_dai_link em_x270_dai[] = { static struct snd_soc_card em_x270 = { .name = "EM-X270", + .owner = THIS_MODULE, .dai_link = em_x270_dai, .num_links = ARRAY_SIZE(em_x270_dai), }; diff --git a/sound/soc/pxa/hx4700.c b/sound/soc/pxa/hx4700.c index 8260207..2a342c9 100644 --- a/sound/soc/pxa/hx4700.c +++ b/sound/soc/pxa/hx4700.c @@ -169,6 +169,7 @@ static struct snd_soc_dai_link hx4700_dai = { /* hx4700 audio machine driver */ static struct snd_soc_card snd_soc_card_hx4700 = { .name = "iPAQ hx4700", + .owner = THIS_MODULE, .dai_link = &hx4700_dai, .num_links = 1, .dapm_widgets = hx4700_dapm_widgets, diff --git a/sound/soc/pxa/imote2.c b/sound/soc/pxa/imote2.c index dc905ae..b93dafd 100644 --- a/sound/soc/pxa/imote2.c +++ b/sound/soc/pxa/imote2.c @@ -60,6 +60,7 @@ static struct snd_soc_dai_link imote2_dai = { static struct snd_soc_card imote2 = { .name = "Imote2", + .owner = THIS_MODULE, .dai_link = &imote2_dai, .num_links = 1, }; diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c index e79f516..3f7a8ec 100644 --- a/sound/soc/pxa/magician.c +++ b/sound/soc/pxa/magician.c @@ -452,6 +452,7 @@ static struct snd_soc_dai_link magician_dai[] = { /* magician audio machine driver */ static struct snd_soc_card snd_soc_card_magician = { .name = "Magician", + .owner = THIS_MODULE, .dai_link = magician_dai, .num_links = ARRAY_SIZE(magician_dai), diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c index 0e73a7f..9c585af 100644 --- a/sound/soc/pxa/mioa701_wm9713.c +++ b/sound/soc/pxa/mioa701_wm9713.c @@ -181,6 +181,7 @@ static struct snd_soc_dai_link mioa701_dai[] = { static struct snd_soc_card mioa701 = { .name = "MioA701", + .owner = THIS_MODULE, .dai_link = mioa701_dai, .num_links = ARRAY_SIZE(mioa701_dai), }; diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c index f313eca..db24bc6 100644 --- a/sound/soc/pxa/palm27x.c +++ b/sound/soc/pxa/palm27x.c @@ -146,6 +146,7 @@ static struct snd_soc_dai_link palm27x_dai[] = { static struct snd_soc_card palm27x_asoc = { .name = "Palm/PXA27x", + .owner = THIS_MODULE, .dai_link = palm27x_dai, .num_links = ARRAY_SIZE(palm27x_dai), }; diff --git a/sound/soc/pxa/raumfeld.c b/sound/soc/pxa/raumfeld.c index b899a3b..ba15451 100644 --- a/sound/soc/pxa/raumfeld.c +++ b/sound/soc/pxa/raumfeld.c @@ -260,6 +260,7 @@ static struct snd_soc_dai_link snd_soc_raumfeld_speaker_dai[] = static struct snd_soc_card snd_soc_raumfeld_connector = { .name = "Raumfeld Connector", + .owner = THIS_MODULE, .dai_link = snd_soc_raumfeld_connector_dai, .num_links = ARRAY_SIZE(snd_soc_raumfeld_connector_dai), .suspend_post = raumfeld_analog_suspend, @@ -268,6 +269,7 @@ static struct snd_soc_card snd_soc_raumfeld_connector = { static struct snd_soc_card snd_soc_raumfeld_speaker = { .name = "Raumfeld Speaker", + .owner = THIS_MODULE, .dai_link = snd_soc_raumfeld_speaker_dai, .num_links = ARRAY_SIZE(snd_soc_raumfeld_speaker_dai), .suspend_post = raumfeld_analog_suspend, diff --git a/sound/soc/pxa/saarb.c b/sound/soc/pxa/saarb.c index d9467a2..2e21712 100644 --- a/sound/soc/pxa/saarb.c +++ b/sound/soc/pxa/saarb.c @@ -125,6 +125,7 @@ static struct snd_soc_dai_link saarb_dai[] = { static struct snd_soc_card snd_soc_card_saarb = { .name = "Saarb", + .owner = THIS_MODULE, .dai_link = saarb_dai, .num_links = ARRAY_SIZE(saarb_dai), }; diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index c2d6ff9..bb06048 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c @@ -319,6 +319,7 @@ static struct snd_soc_dai_link spitz_dai = { /* spitz audio machine driver */ static struct snd_soc_card snd_soc_spitz = { .name = "Spitz", + .owner = THIS_MODULE, .dai_link = &spitz_dai, .num_links = 1, }; diff --git a/sound/soc/pxa/tavorevb3.c b/sound/soc/pxa/tavorevb3.c index eeec892..4bef12c 100644 --- a/sound/soc/pxa/tavorevb3.c +++ b/sound/soc/pxa/tavorevb3.c @@ -125,6 +125,7 @@ static struct snd_soc_dai_link evb3_dai[] = { static struct snd_soc_card snd_soc_card_evb3 = { .name = "Tavor EVB3", + .owner = THIS_MODULE, .dai_link = evb3_dai, .num_links = ARRAY_SIZE(evb3_dai), }; diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index 3f394de..564ef08 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c @@ -236,6 +236,7 @@ static struct snd_soc_dai_link tosa_dai[] = { static struct snd_soc_card tosa = { .name = "Tosa", + .owner = THIS_MODULE, .dai_link = tosa_dai, .num_links = ARRAY_SIZE(tosa_dai), }; diff --git a/sound/soc/pxa/z2.c b/sound/soc/pxa/z2.c index b311ffe..d6807e0 100644 --- a/sound/soc/pxa/z2.c +++ b/sound/soc/pxa/z2.c @@ -202,6 +202,7 @@ static struct snd_soc_dai_link z2_dai = { /* z2 audio machine driver */ static struct snd_soc_card snd_soc_z2 = { .name = "Z2", + .owner = THIS_MODULE, .dai_link = &z2_dai, .num_links = 1, }; diff --git a/sound/soc/pxa/zylonite.c b/sound/soc/pxa/zylonite.c index 580aae3..ceb6566 100644 --- a/sound/soc/pxa/zylonite.c +++ b/sound/soc/pxa/zylonite.c @@ -249,6 +249,7 @@ static int zylonite_resume_pre(struct snd_soc_card *card) static struct snd_soc_card zylonite = { .name = "Zylonite", + .owner = THIS_MODULE, .probe = &zylonite_probe, .remove = &zylonite_remove, .suspend_post = &zylonite_suspend_post, -- cgit v1.1 From 095d79dc491dab1311978e0efb252bc23da88b32 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 22 Dec 2011 10:53:15 +0800 Subject: ASoC: samsung: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missed .owner of struct snd_soc_card will prevent the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/samsung/goni_wm8994.c | 1 + sound/soc/samsung/h1940_uda1380.c | 1 + sound/soc/samsung/jive_wm8750.c | 1 + sound/soc/samsung/littlemill.c | 1 + sound/soc/samsung/ln2440sbc_alc650.c | 1 + sound/soc/samsung/lowland.c | 1 + sound/soc/samsung/neo1973_wm8753.c | 1 + sound/soc/samsung/rx1950_uda1380.c | 1 + sound/soc/samsung/s3c24xx_simtec_hermes.c | 1 + sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c | 1 + sound/soc/samsung/s3c24xx_uda134x.c | 1 + sound/soc/samsung/smartq_wm8987.c | 1 + sound/soc/samsung/smdk2443_wm9710.c | 1 + sound/soc/samsung/smdk_spdif.c | 1 + sound/soc/samsung/smdk_wm8580.c | 1 + sound/soc/samsung/smdk_wm8580pcm.c | 1 + sound/soc/samsung/smdk_wm8994.c | 1 + sound/soc/samsung/smdk_wm8994pcm.c | 1 + sound/soc/samsung/smdk_wm9713.c | 1 + sound/soc/samsung/speyside.c | 1 + sound/soc/samsung/tobermory.c | 1 + 21 files changed, 21 insertions(+) (limited to 'sound') diff --git a/sound/soc/samsung/goni_wm8994.c b/sound/soc/samsung/goni_wm8994.c index 84f9c3c..c23c2ae 100644 --- a/sound/soc/samsung/goni_wm8994.c +++ b/sound/soc/samsung/goni_wm8994.c @@ -244,6 +244,7 @@ static struct snd_soc_dai_link goni_dai[] = { static struct snd_soc_card goni = { .name = "goni", + .owner = THIS_MODULE, .dai_link = goni_dai, .num_links = ARRAY_SIZE(goni_dai), diff --git a/sound/soc/samsung/h1940_uda1380.c b/sound/soc/samsung/h1940_uda1380.c index 03cfa5f..6e32577 100644 --- a/sound/soc/samsung/h1940_uda1380.c +++ b/sound/soc/samsung/h1940_uda1380.c @@ -215,6 +215,7 @@ static struct snd_soc_dai_link h1940_uda1380_dai[] = { static struct snd_soc_card h1940_asoc = { .name = "h1940", + .owner = THIS_MODULE, .dai_link = h1940_uda1380_dai, .num_links = ARRAY_SIZE(h1940_uda1380_dai), diff --git a/sound/soc/samsung/jive_wm8750.c b/sound/soc/samsung/jive_wm8750.c index 8e523fd..1578663 100644 --- a/sound/soc/samsung/jive_wm8750.c +++ b/sound/soc/samsung/jive_wm8750.c @@ -127,6 +127,7 @@ static struct snd_soc_dai_link jive_dai = { /* jive audio machine driver */ static struct snd_soc_card snd_soc_machine_jive = { .name = "Jive", + .owner = THIS_MODULE, .dai_link = &jive_dai, .num_links = 1, diff --git a/sound/soc/samsung/littlemill.c b/sound/soc/samsung/littlemill.c index 5cea59b..9dd818b 100644 --- a/sound/soc/samsung/littlemill.c +++ b/sound/soc/samsung/littlemill.c @@ -194,6 +194,7 @@ static int littlemill_late_probe(struct snd_soc_card *card) static struct snd_soc_card littlemill = { .name = "Littlemill", + .owner = THIS_MODULE, .dai_link = littlemill_dai, .num_links = ARRAY_SIZE(littlemill_dai), diff --git a/sound/soc/samsung/ln2440sbc_alc650.c b/sound/soc/samsung/ln2440sbc_alc650.c index cde38b8..69c4a59 100644 --- a/sound/soc/samsung/ln2440sbc_alc650.c +++ b/sound/soc/samsung/ln2440sbc_alc650.c @@ -34,6 +34,7 @@ static struct snd_soc_dai_link ln2440sbc_dai[] = { static struct snd_soc_card ln2440sbc = { .name = "LN2440SBC", + .owner = THIS_MODULE, .dai_link = ln2440sbc_dai, .num_links = ARRAY_SIZE(ln2440sbc_dai), }; diff --git a/sound/soc/samsung/lowland.c b/sound/soc/samsung/lowland.c index 4216a06..4adff93 100644 --- a/sound/soc/samsung/lowland.c +++ b/sound/soc/samsung/lowland.c @@ -177,6 +177,7 @@ static struct snd_soc_dapm_route audio_paths[] = { static struct snd_soc_card lowland = { .name = "Lowland", + .owner = THIS_MODULE, .dai_link = lowland_dai, .num_links = ARRAY_SIZE(lowland_dai), .aux_dev = lowland_aux_dev, diff --git a/sound/soc/samsung/neo1973_wm8753.c b/sound/soc/samsung/neo1973_wm8753.c index 7207189..7ac0ba2 100644 --- a/sound/soc/samsung/neo1973_wm8753.c +++ b/sound/soc/samsung/neo1973_wm8753.c @@ -465,6 +465,7 @@ static const struct gpio neo1973_gta02_gpios[] = {}; static struct snd_soc_card neo1973 = { .name = "neo1973", + .owner = THIS_MODULE, .dai_link = neo1973_dai, .num_links = ARRAY_SIZE(neo1973_dai), .aux_dev = neo1973_aux_devs, diff --git a/sound/soc/samsung/rx1950_uda1380.c b/sound/soc/samsung/rx1950_uda1380.c index 71b4c02..21e1236 100644 --- a/sound/soc/samsung/rx1950_uda1380.c +++ b/sound/soc/samsung/rx1950_uda1380.c @@ -114,6 +114,7 @@ static const struct snd_soc_dapm_route audio_map[] = { static struct snd_soc_card rx1950_asoc = { .name = "rx1950", + .owner = THIS_MODULE, .dai_link = rx1950_uda1380_dai, .num_links = ARRAY_SIZE(rx1950_uda1380_dai), diff --git a/sound/soc/samsung/s3c24xx_simtec_hermes.c b/sound/soc/samsung/s3c24xx_simtec_hermes.c index 5027981..7ace6a8 100644 --- a/sound/soc/samsung/s3c24xx_simtec_hermes.c +++ b/sound/soc/samsung/s3c24xx_simtec_hermes.c @@ -89,6 +89,7 @@ static struct snd_soc_dai_link simtec_dai_aic33 = { /* simtec audio machine driver */ static struct snd_soc_card snd_soc_machine_simtec_aic33 = { .name = "Simtec-Hermes", + .owner = THIS_MODULE, .dai_link = &simtec_dai_aic33, .num_links = 1, diff --git a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c index 89b57b5..c42d5f0 100644 --- a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c +++ b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c @@ -78,6 +78,7 @@ static struct snd_soc_dai_link simtec_dai_aic23 = { /* simtec audio machine driver */ static struct snd_soc_card snd_soc_machine_simtec_aic23 = { .name = "Simtec", + .owner = THIS_MODULE, .dai_link = &simtec_dai_aic23, .num_links = 1, diff --git a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c index 62b69fb..d731042 100644 --- a/sound/soc/samsung/s3c24xx_uda134x.c +++ b/sound/soc/samsung/s3c24xx_uda134x.c @@ -229,6 +229,7 @@ static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = { static struct snd_soc_card snd_soc_s3c24xx_uda134x = { .name = "S3C24XX_UDA134X", + .owner = THIS_MODULE, .dai_link = &s3c24xx_uda134x_dai_link, .num_links = 1, }; diff --git a/sound/soc/samsung/smartq_wm8987.c b/sound/soc/samsung/smartq_wm8987.c index a22fc44..f2dcb42 100644 --- a/sound/soc/samsung/smartq_wm8987.c +++ b/sound/soc/samsung/smartq_wm8987.c @@ -198,6 +198,7 @@ static struct snd_soc_dai_link smartq_dai[] = { static struct snd_soc_card snd_soc_smartq = { .name = "SmartQ", + .owner = THIS_MODULE, .dai_link = smartq_dai, .num_links = ARRAY_SIZE(smartq_dai), diff --git a/sound/soc/samsung/smdk2443_wm9710.c b/sound/soc/samsung/smdk2443_wm9710.c index 8bd1dc5..720ba29 100644 --- a/sound/soc/samsung/smdk2443_wm9710.c +++ b/sound/soc/samsung/smdk2443_wm9710.c @@ -30,6 +30,7 @@ static struct snd_soc_dai_link smdk2443_dai[] = { static struct snd_soc_card smdk2443 = { .name = "SMDK2443", + .owner = THIS_MODULE, .dai_link = smdk2443_dai, .num_links = ARRAY_SIZE(smdk2443_dai), }; diff --git a/sound/soc/samsung/smdk_spdif.c b/sound/soc/samsung/smdk_spdif.c index e0fd8ad..beaa9c1 100644 --- a/sound/soc/samsung/smdk_spdif.c +++ b/sound/soc/samsung/smdk_spdif.c @@ -160,6 +160,7 @@ static struct snd_soc_dai_link smdk_dai = { static struct snd_soc_card smdk = { .name = "SMDK-S/PDIF", + .owner = THIS_MODULE, .dai_link = &smdk_dai, .num_links = 1, }; diff --git a/sound/soc/samsung/smdk_wm8580.c b/sound/soc/samsung/smdk_wm8580.c index 81b4478..bff8758 100644 --- a/sound/soc/samsung/smdk_wm8580.c +++ b/sound/soc/samsung/smdk_wm8580.c @@ -203,6 +203,7 @@ static struct snd_soc_dai_link smdk_dai[] = { static struct snd_soc_card smdk = { .name = "SMDK-I2S", + .owner = THIS_MODULE, .dai_link = smdk_dai, .num_links = 2, diff --git a/sound/soc/samsung/smdk_wm8580pcm.c b/sound/soc/samsung/smdk_wm8580pcm.c index 49dfafb..fab5322 100644 --- a/sound/soc/samsung/smdk_wm8580pcm.c +++ b/sound/soc/samsung/smdk_wm8580pcm.c @@ -143,6 +143,7 @@ static struct snd_soc_dai_link smdk_dai[] = { static struct snd_soc_card smdk_pcm = { .name = "SMDK-PCM", + .owner = THIS_MODULE, .dai_link = smdk_dai, .num_links = 2, }; diff --git a/sound/soc/samsung/smdk_wm8994.c b/sound/soc/samsung/smdk_wm8994.c index ad9ac42..8eb309f 100644 --- a/sound/soc/samsung/smdk_wm8994.c +++ b/sound/soc/samsung/smdk_wm8994.c @@ -144,6 +144,7 @@ static struct snd_soc_dai_link smdk_dai[] = { static struct snd_soc_card smdk = { .name = "SMDK-I2S", + .owner = THIS_MODULE, .dai_link = smdk_dai, .num_links = ARRAY_SIZE(smdk_dai), }; diff --git a/sound/soc/samsung/smdk_wm8994pcm.c b/sound/soc/samsung/smdk_wm8994pcm.c index 23c7fb7..77ecba9 100644 --- a/sound/soc/samsung/smdk_wm8994pcm.c +++ b/sound/soc/samsung/smdk_wm8994pcm.c @@ -124,6 +124,7 @@ static struct snd_soc_dai_link smdk_dai[] = { static struct snd_soc_card smdk_pcm = { .name = "SMDK-PCM", + .owner = THIS_MODULE, .dai_link = smdk_dai, .num_links = 1, }; diff --git a/sound/soc/samsung/smdk_wm9713.c b/sound/soc/samsung/smdk_wm9713.c index 31c6daf..8e26a73 100644 --- a/sound/soc/samsung/smdk_wm9713.c +++ b/sound/soc/samsung/smdk_wm9713.c @@ -50,6 +50,7 @@ static struct snd_soc_dai_link smdk_dai = { static struct snd_soc_card smdk = { .name = "SMDK WM9713", + .owner = THIS_MODULE, .dai_link = &smdk_dai, .num_links = 1, }; diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c index 0222d86..f9ab770 100644 --- a/sound/soc/samsung/speyside.c +++ b/sound/soc/samsung/speyside.c @@ -291,6 +291,7 @@ static struct snd_soc_dapm_route audio_paths[] = { static struct snd_soc_card speyside = { .name = "Speyside", + .owner = THIS_MODULE, .dai_link = speyside_dai, .num_links = ARRAY_SIZE(speyside_dai), .aux_dev = speyside_aux_dev, diff --git a/sound/soc/samsung/tobermory.c b/sound/soc/samsung/tobermory.c index 6f91c65..9199649 100644 --- a/sound/soc/samsung/tobermory.c +++ b/sound/soc/samsung/tobermory.c @@ -196,6 +196,7 @@ static int tobermory_late_probe(struct snd_soc_card *card) static struct snd_soc_card tobermory = { .name = "Tobermory", + .owner = THIS_MODULE, .dai_link = tobermory_dai, .num_links = ARRAY_SIZE(tobermory_dai), -- cgit v1.1 From da403f87a2599db34f611f198d744d54ed964e26 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 22 Dec 2011 11:37:03 +0000 Subject: Revert "ASoC: mxs: correct 'direction' of device_prep_dma_cyclic" This reverts commit dbec3b30a601791717bc5bb827e210c3b5d6e067 as it should never have been applied to the ASoC tree at all, let alone 3.2. --- sound/soc/mxs/mxs-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c index 5dfd325..f39d7dd 100644 --- a/sound/soc/mxs/mxs-pcm.c +++ b/sound/soc/mxs/mxs-pcm.c @@ -136,7 +136,7 @@ static int snd_mxs_pcm_hw_params(struct snd_pcm_substream *substream, iprtd->period_bytes * iprtd->periods, iprtd->period_bytes, substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? - DMA_MEM_TO_DEV : DMA_DEV_TO_MEM); + DMA_TO_DEVICE : DMA_FROM_DEVICE); if (!iprtd->desc) { dev_err(&chan->dev->device, "cannot prepare slave dma\n"); return -EINVAL; -- cgit v1.1 From 354a21423d09c2a6afe0fcea9dbbda9cdada6e45 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 22 Dec 2011 12:16:39 +0000 Subject: ASoC: Declare soc_new_pcm() properly Ensure that everything is seeing the same declaration by moving it to a header file rather than putting the declaration in soc-core.c Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- sound/soc/soc-core.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a4592cb..acbb960 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -59,8 +59,6 @@ static LIST_HEAD(dai_list); static LIST_HEAD(platform_list); static LIST_HEAD(codec_list); -int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num); - /* * This is a timeout to do a DAPM powerdown after a stream is closed(). * It can be used to eliminate pops between different playback streams, e.g. -- cgit v1.1 From 4c3c5df05e02bfa774517cebc5b91b07c2a365dc Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 22 Dec 2011 21:04:54 +0800 Subject: ASoC: fsl: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missed .owner of struct snd_soc_card will prevent the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/fsl/efika-audio-fabric.c | 14 +++++++------- sound/soc/fsl/pcm030-audio-fabric.c | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'sound') diff --git a/sound/soc/fsl/efika-audio-fabric.c b/sound/soc/fsl/efika-audio-fabric.c index 108b5d8..b2acd329 100644 --- a/sound/soc/fsl/efika-audio-fabric.c +++ b/sound/soc/fsl/efika-audio-fabric.c @@ -31,8 +31,6 @@ #define DRV_NAME "efika-audio-fabric" -static struct snd_soc_card card; - static struct snd_soc_dai_link efika_fabric_dai[] = { { .name = "AC97", @@ -52,6 +50,13 @@ static struct snd_soc_dai_link efika_fabric_dai[] = { }, }; +static struct snd_soc_card card = { + .name = "Efika", + .owner = THIS_MODULE, + .dai_link = efika_fabric_dai, + .num_links = ARRAY_SIZE(efika_fabric_dai), +}; + static __init int efika_fabric_init(void) { struct platform_device *pdev; @@ -60,11 +65,6 @@ static __init int efika_fabric_init(void) if (!of_machine_is_compatible("bplan,efika")) return -ENODEV; - card.name = "Efika"; - card.dai_link = efika_fabric_dai; - card.num_links = ARRAY_SIZE(efika_fabric_dai); - - pdev = platform_device_alloc("soc-audio", 1); if (!pdev) { pr_err("efika_fabric_init: platform_device_alloc() failed\n"); diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c index ba4d85e..b3af55d 100644 --- a/sound/soc/fsl/pcm030-audio-fabric.c +++ b/sound/soc/fsl/pcm030-audio-fabric.c @@ -31,8 +31,6 @@ #define DRV_NAME "pcm030-audio-fabric" -static struct snd_soc_card card; - static struct snd_soc_dai_link pcm030_fabric_dai[] = { { .name = "AC97", @@ -52,6 +50,13 @@ static struct snd_soc_dai_link pcm030_fabric_dai[] = { }, }; +static struct snd_soc_card card = { + .name = "pcm030", + .owner = THIS_MODULE, + .dai_link = pcm030_fabric_dai, + .num_links = ARRAY_SIZE(pcm030_fabric_dai), +}; + static __init int pcm030_fabric_init(void) { struct platform_device *pdev; @@ -60,11 +65,6 @@ static __init int pcm030_fabric_init(void) if (!of_machine_is_compatible("phytec,pcm030")) return -ENODEV; - - card.name = "pcm030"; - card.dai_link = pcm030_fabric_dai; - card.num_links = ARRAY_SIZE(pcm030_fabric_dai); - pdev = platform_device_alloc("soc-audio", 1); if (!pdev) { pr_err("pcm030_fabric_init: platform_device_alloc() failed\n"); -- cgit v1.1 From 338d68db77aaf90eea9e06517272b7d7a83d95a4 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 22 Dec 2011 21:14:58 +0800 Subject: ASoC: atmel: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missed .owner of struct snd_soc_card will prevent the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/atmel/sam9g20_wm8731.c | 1 + sound/soc/atmel/snd-soc-afeb9260.c | 1 + 2 files changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c index 0377c54..c883514 100644 --- a/sound/soc/atmel/sam9g20_wm8731.c +++ b/sound/soc/atmel/sam9g20_wm8731.c @@ -189,6 +189,7 @@ static struct snd_soc_dai_link at91sam9g20ek_dai = { static struct snd_soc_card snd_soc_at91sam9g20ek = { .name = "AT91SAMG20-EK", + .owner = THIS_MODULE, .dai_link = &at91sam9g20ek_dai, .num_links = 1, .set_bias_level = at91sam9g20ek_set_bias_level, diff --git a/sound/soc/atmel/snd-soc-afeb9260.c b/sound/soc/atmel/snd-soc-afeb9260.c index d427e92..4ca667d 100644 --- a/sound/soc/atmel/snd-soc-afeb9260.c +++ b/sound/soc/atmel/snd-soc-afeb9260.c @@ -135,6 +135,7 @@ static struct snd_soc_dai_link afeb9260_dai = { /* Audio machine driver */ static struct snd_soc_card snd_soc_machine_afeb9260 = { .name = "AFEB9260", + .owner = THIS_MODULE, .dai_link = &afeb9260_dai, .num_links = 1, }; -- cgit v1.1 From 30e4953011fd7a22044a62b9cf77252493b1bd17 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 22 Dec 2011 21:17:22 +0800 Subject: ASoC: blackfin: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missed .owner of struct snd_soc_card will prevent the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/blackfin/bf5xx-ad1836.c | 1 + sound/soc/blackfin/bf5xx-ad193x.c | 1 + sound/soc/blackfin/bf5xx-ad1980.c | 1 + sound/soc/blackfin/bf5xx-ad73311.c | 1 + sound/soc/blackfin/bf5xx-ssm2602.c | 1 + sound/soc/blackfin/bfin-eval-adau1373.c | 1 + sound/soc/blackfin/bfin-eval-adau1701.c | 1 + sound/soc/blackfin/bfin-eval-adav80x.c | 1 + 8 files changed, 8 insertions(+) (limited to 'sound') diff --git a/sound/soc/blackfin/bf5xx-ad1836.c b/sound/soc/blackfin/bf5xx-ad1836.c index f79d165..60962ce 100644 --- a/sound/soc/blackfin/bf5xx-ad1836.c +++ b/sound/soc/blackfin/bf5xx-ad1836.c @@ -91,6 +91,7 @@ static struct snd_soc_dai_link bf5xx_ad1836_dai[] = { static struct snd_soc_card bf5xx_ad1836 = { .name = "bfin-ad1836", + .owner = THIS_MODULE, .dai_link = &bf5xx_ad1836_dai[CONFIG_SND_BF5XX_SPORT_NUM], .num_links = 1, }; diff --git a/sound/soc/blackfin/bf5xx-ad193x.c b/sound/soc/blackfin/bf5xx-ad193x.c index 5956584..2d8d82d 100644 --- a/sound/soc/blackfin/bf5xx-ad193x.c +++ b/sound/soc/blackfin/bf5xx-ad193x.c @@ -119,6 +119,7 @@ static struct snd_soc_dai_link bf5xx_ad193x_dai[] = { static struct snd_soc_card bf5xx_ad193x = { .name = "bfin-ad193x", + .owner = THIS_MODULE, .dai_link = &bf5xx_ad193x_dai[CONFIG_SND_BF5XX_SPORT_NUM], .num_links = 1, }; diff --git a/sound/soc/blackfin/bf5xx-ad1980.c b/sound/soc/blackfin/bf5xx-ad1980.c index 06a84b2..b30f88b 100644 --- a/sound/soc/blackfin/bf5xx-ad1980.c +++ b/sound/soc/blackfin/bf5xx-ad1980.c @@ -74,6 +74,7 @@ static struct snd_soc_dai_link bf5xx_board_dai[] = { static struct snd_soc_card bf5xx_board = { .name = "bfin-ad1980", + .owner = THIS_MODULE, .dai_link = &bf5xx_board_dai[CONFIG_SND_BF5XX_SPORT_NUM], .num_links = 1, }; diff --git a/sound/soc/blackfin/bf5xx-ad73311.c b/sound/soc/blackfin/bf5xx-ad73311.c index b94eb7e..8e49508 100644 --- a/sound/soc/blackfin/bf5xx-ad73311.c +++ b/sound/soc/blackfin/bf5xx-ad73311.c @@ -192,6 +192,7 @@ static struct snd_soc_dai_link bf5xx_ad73311_dai[] = { static struct snd_soc_card bf5xx_ad73311 = { .name = "bfin-ad73311", + .owner = THIS_MODULE, .probe = bf5xx_probe, .dai_link = &bf5xx_ad73311_dai[CONFIG_SND_BF5XX_SPORT_NUM], .num_links = 1, diff --git a/sound/soc/blackfin/bf5xx-ssm2602.c b/sound/soc/blackfin/bf5xx-ssm2602.c index 767e772..0303032 100644 --- a/sound/soc/blackfin/bf5xx-ssm2602.c +++ b/sound/soc/blackfin/bf5xx-ssm2602.c @@ -125,6 +125,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = { static struct snd_soc_card bf5xx_ssm2602 = { .name = "bfin-ssm2602", + .owner = THIS_MODULE, .dai_link = &bf5xx_ssm2602_dai[CONFIG_SND_BF5XX_SPORT_NUM], .num_links = 1, }; diff --git a/sound/soc/blackfin/bfin-eval-adau1373.c b/sound/soc/blackfin/bfin-eval-adau1373.c index 85ed39a..26b271c 100644 --- a/sound/soc/blackfin/bfin-eval-adau1373.c +++ b/sound/soc/blackfin/bfin-eval-adau1373.c @@ -147,6 +147,7 @@ static struct snd_soc_dai_link bfin_eval_adau1373_dai = { static struct snd_soc_card bfin_eval_adau1373 = { .name = "bfin-eval-adau1373", + .owner = THIS_MODULE, .dai_link = &bfin_eval_adau1373_dai, .num_links = 1, diff --git a/sound/soc/blackfin/bfin-eval-adau1701.c b/sound/soc/blackfin/bfin-eval-adau1701.c index 1a88fe9..c0064fa 100644 --- a/sound/soc/blackfin/bfin-eval-adau1701.c +++ b/sound/soc/blackfin/bfin-eval-adau1701.c @@ -84,6 +84,7 @@ static struct snd_soc_dai_link bfin_eval_adau1701_dai[] = { static struct snd_soc_card bfin_eval_adau1701 = { .name = "bfin-eval-adau1701", + .owner = THIS_MODULE, .dai_link = &bfin_eval_adau1701_dai[CONFIG_SND_BF5XX_SPORT_NUM], .num_links = 1, diff --git a/sound/soc/blackfin/bfin-eval-adav80x.c b/sound/soc/blackfin/bfin-eval-adav80x.c index 0bc995f..4ef079f 100644 --- a/sound/soc/blackfin/bfin-eval-adav80x.c +++ b/sound/soc/blackfin/bfin-eval-adav80x.c @@ -93,6 +93,7 @@ static struct snd_soc_dai_link bfin_eval_adav80x_dais[] = { static struct snd_soc_card bfin_eval_adav80x = { .name = "bfin-eval-adav80x", + .owner = THIS_MODULE, .dai_link = bfin_eval_adav80x_dais, .num_links = ARRAY_SIZE(bfin_eval_adav80x_dais), -- cgit v1.1 From 36a16d1ae0735bd95ab86fdf5983ddbaa20c648d Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 22 Dec 2011 21:19:42 +0800 Subject: ASoC: davinci: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missed .owner of struct snd_soc_card will prevent the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/davinci/davinci-evm.c | 6 ++++++ sound/soc/davinci/davinci-sffsdr.c | 1 + 2 files changed, 7 insertions(+) (limited to 'sound') diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c index f78c3f0..10a2d8c 100644 --- a/sound/soc/davinci/davinci-evm.c +++ b/sound/soc/davinci/davinci-evm.c @@ -242,6 +242,7 @@ static struct snd_soc_dai_link da850_evm_dai = { /* davinci dm6446 evm audio machine driver */ static struct snd_soc_card dm6446_snd_soc_card_evm = { .name = "DaVinci DM6446 EVM", + .owner = THIS_MODULE, .dai_link = &dm6446_evm_dai, .num_links = 1, }; @@ -249,6 +250,7 @@ static struct snd_soc_card dm6446_snd_soc_card_evm = { /* davinci dm355 evm audio machine driver */ static struct snd_soc_card dm355_snd_soc_card_evm = { .name = "DaVinci DM355 EVM", + .owner = THIS_MODULE, .dai_link = &dm355_evm_dai, .num_links = 1, }; @@ -256,6 +258,7 @@ static struct snd_soc_card dm355_snd_soc_card_evm = { /* davinci dm365 evm audio machine driver */ static struct snd_soc_card dm365_snd_soc_card_evm = { .name = "DaVinci DM365 EVM", + .owner = THIS_MODULE, .dai_link = &dm365_evm_dai, .num_links = 1, }; @@ -263,18 +266,21 @@ static struct snd_soc_card dm365_snd_soc_card_evm = { /* davinci dm6467 evm audio machine driver */ static struct snd_soc_card dm6467_snd_soc_card_evm = { .name = "DaVinci DM6467 EVM", + .owner = THIS_MODULE, .dai_link = dm6467_evm_dai, .num_links = ARRAY_SIZE(dm6467_evm_dai), }; static struct snd_soc_card da830_snd_soc_card = { .name = "DA830/OMAP-L137 EVM", + .owner = THIS_MODULE, .dai_link = &da830_evm_dai, .num_links = 1, }; static struct snd_soc_card da850_snd_soc_card = { .name = "DA850/OMAP-L138 EVM", + .owner = THIS_MODULE, .dai_link = &da850_evm_dai, .num_links = 1, }; diff --git a/sound/soc/davinci/davinci-sffsdr.c b/sound/soc/davinci/davinci-sffsdr.c index 0fe558c..f71175b 100644 --- a/sound/soc/davinci/davinci-sffsdr.c +++ b/sound/soc/davinci/davinci-sffsdr.c @@ -93,6 +93,7 @@ static struct snd_soc_dai_link sffsdr_dai = { /* davinci-sffsdr audio machine driver */ static struct snd_soc_card snd_soc_sffsdr = { .name = "DaVinci SFFSDR", + .owner = THIS_MODULE, .dai_link = &sffsdr_dai, .num_links = 1, }; -- cgit v1.1 From a76a70232914902e47d289b6d3853ac850097573 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 22 Dec 2011 21:21:37 +0800 Subject: ASoC: ep93xx: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missed .owner of struct snd_soc_card will prevent the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/ep93xx/edb93xx.c | 1 + sound/soc/ep93xx/simone.c | 1 + sound/soc/ep93xx/snappercl15.c | 1 + 3 files changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/soc/ep93xx/edb93xx.c b/sound/soc/ep93xx/edb93xx.c index 9f6fecd..bae5cbb 100644 --- a/sound/soc/ep93xx/edb93xx.c +++ b/sound/soc/ep93xx/edb93xx.c @@ -75,6 +75,7 @@ static struct snd_soc_dai_link edb93xx_dai = { static struct snd_soc_card snd_soc_edb93xx = { .name = "EDB93XX", + .owner = THIS_MODULE, .dai_link = &edb93xx_dai, .num_links = 1, }; diff --git a/sound/soc/ep93xx/simone.c b/sound/soc/ep93xx/simone.c index 1e00b33..dd99709 100644 --- a/sound/soc/ep93xx/simone.c +++ b/sound/soc/ep93xx/simone.c @@ -34,6 +34,7 @@ static struct snd_soc_dai_link simone_dai = { static struct snd_soc_card snd_soc_simone = { .name = "Sim.One", + .owner = THIS_MODULE, .dai_link = &simone_dai, .num_links = 1, }; diff --git a/sound/soc/ep93xx/snappercl15.c b/sound/soc/ep93xx/snappercl15.c index e97cd57..ccae34a 100644 --- a/sound/soc/ep93xx/snappercl15.c +++ b/sound/soc/ep93xx/snappercl15.c @@ -93,6 +93,7 @@ static struct snd_soc_dai_link snappercl15_dai = { static struct snd_soc_card snd_soc_snappercl15 = { .name = "Snapper CL15", + .owner = THIS_MODULE, .dai_link = &snappercl15_dai, .num_links = 1, }; -- cgit v1.1 From b16eaf9fd324a70ecca48faa7ef3f349baf7f0cd Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 22 Dec 2011 21:23:01 +0800 Subject: ASoC: tegra: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missed .owner of struct snd_soc_card will prevent the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/tegra/tegra_alc5632.c | 1 + sound/soc/tegra/tegra_wm8903.c | 1 + sound/soc/tegra/trimslice.c | 1 + 3 files changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/soc/tegra/tegra_alc5632.c b/sound/soc/tegra/tegra_alc5632.c index 9287eb8..4a0e805 100644 --- a/sound/soc/tegra/tegra_alc5632.c +++ b/sound/soc/tegra/tegra_alc5632.c @@ -141,6 +141,7 @@ static struct snd_soc_dai_link tegra_alc5632_dai = { static struct snd_soc_card snd_soc_tegra_alc5632 = { .name = "tegra-alc5632", + .owner = THIS_MODULE, .dai_link = &tegra_alc5632_dai, .num_links = 1, .controls = tegra_alc5632_controls, diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c index 4677f26..566655e 100644 --- a/sound/soc/tegra/tegra_wm8903.c +++ b/sound/soc/tegra/tegra_wm8903.c @@ -363,6 +363,7 @@ static struct snd_soc_dai_link tegra_wm8903_dai = { static struct snd_soc_card snd_soc_tegra_wm8903 = { .name = "tegra-wm8903", + .owner = THIS_MODULE, .dai_link = &tegra_wm8903_dai, .num_links = 1, diff --git a/sound/soc/tegra/trimslice.c b/sound/soc/tegra/trimslice.c index 7d95b76..2bdfc550 100644 --- a/sound/soc/tegra/trimslice.c +++ b/sound/soc/tegra/trimslice.c @@ -127,6 +127,7 @@ static struct snd_soc_dai_link trimslice_tlv320aic23_dai = { static struct snd_soc_card snd_soc_trimslice = { .name = "tegra-trimslice", + .owner = THIS_MODULE, .dai_link = &trimslice_tlv320aic23_dai, .num_links = 1, -- cgit v1.1 From 3eafc959b32f71d3fe6b27c9eae7495a23acfc3a Mon Sep 17 00:00:00 2001 From: Omair Mohammed Abdullah Date: Fri, 23 Dec 2011 10:36:36 +0530 Subject: ALSA: core: add support for compressed devices Use the minor numbers 2 and 3 for audio compressed offload devices. Also add support for these devices in core Signed-off-by: Omair Mohammed Abdullah Signed-off-by: Pierre-Louis Bossart Signed-off-by: Vinod Koul Reviewed-by: Mark Brown Signed-off-by: Takashi Iwai --- sound/core/sound.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/core/sound.c b/sound/core/sound.c index 828af35..28f3559 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c @@ -229,6 +229,7 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev) case SNDRV_DEVICE_TYPE_RAWMIDI: case SNDRV_DEVICE_TYPE_PCM_PLAYBACK: case SNDRV_DEVICE_TYPE_PCM_CAPTURE: + case SNDRV_DEVICE_TYPE_COMPRESS: if (snd_BUG_ON(!card)) return -EINVAL; minor = SNDRV_MINOR(card->number, type + dev); -- cgit v1.1 From b21c60a4edd22e26fbebe7dd7078349a8cfa7273 Mon Sep 17 00:00:00 2001 From: Vinod Koul Date: Fri, 23 Dec 2011 10:36:39 +0530 Subject: ALSA: core: add support for compress_offload This patch adds core.c, the file which implements the ioctls and registers the devices Signed-off-by: Vinod Koul Signed-off-by: Pierre-Louis Bossart Signed-off-by: Takashi Iwai --- sound/core/compress_offload.c | 765 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 765 insertions(+) create mode 100644 sound/core/compress_offload.c (limited to 'sound') diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c new file mode 100644 index 0000000..dac3633 --- /dev/null +++ b/sound/core/compress_offload.c @@ -0,0 +1,765 @@ +/* + * compress_core.c - compress offload core + * + * Copyright (C) 2011 Intel Corporation + * Authors: Vinod Koul + * Pierre-Louis Bossart + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + */ +#define FORMAT(fmt) "%s: %d: " fmt, __func__, __LINE__ +#define pr_fmt(fmt) KBUILD_MODNAME ": " FORMAT(fmt) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* TODO: + * - add substream support for multiple devices in case of + * SND_DYNAMIC_MINORS is not used + * - Multiple node representation + * driver should be able to register multiple nodes + */ + +static DEFINE_MUTEX(device_mutex); + +struct snd_compr_file { + unsigned long caps; + struct snd_compr_stream stream; +}; + +/* + * a note on stream states used: + * we use follwing states in the compressed core + * SNDRV_PCM_STATE_OPEN: When stream has been opened. + * SNDRV_PCM_STATE_SETUP: When stream has been initialized. This is done by + * calling SNDRV_COMPRESS_SET_PARAMS. running streams will come to this + * state at stop by calling SNDRV_COMPRESS_STOP, or at end of drain. + * SNDRV_PCM_STATE_RUNNING: When stream has been started and is + * decoding/encoding and rendering/capturing data. + * SNDRV_PCM_STATE_DRAINING: When stream is draining current data. This is done + * by calling SNDRV_COMPRESS_DRAIN. + * SNDRV_PCM_STATE_PAUSED: When stream is paused. This is done by calling + * SNDRV_COMPRESS_PAUSE. It can be stopped or resumed by calling + * SNDRV_COMPRESS_STOP or SNDRV_COMPRESS_RESUME respectively. + */ +static int snd_compr_open(struct inode *inode, struct file *f) +{ + struct snd_compr *compr; + struct snd_compr_file *data; + struct snd_compr_runtime *runtime; + enum snd_compr_direction dirn; + int maj = imajor(inode); + int ret; + + if (f->f_flags & O_WRONLY) + dirn = SND_COMPRESS_PLAYBACK; + else if (f->f_flags & O_RDONLY) + dirn = SND_COMPRESS_CAPTURE; + else { + pr_err("invalid direction\n"); + return -EINVAL; + } + + if (maj == snd_major) + compr = snd_lookup_minor_data(iminor(inode), + SNDRV_DEVICE_TYPE_COMPRESS); + else + return -EBADFD; + + if (compr == NULL) { + pr_err("no device data!!!\n"); + return -ENODEV; + } + + if (dirn != compr->direction) { + pr_err("this device doesn't support this direction\n"); + return -EINVAL; + } + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + data->stream.ops = compr->ops; + data->stream.direction = dirn; + data->stream.private_data = compr->private_data; + data->stream.device = compr; + runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); + if (!runtime) { + kfree(data); + return -ENOMEM; + } + runtime->state = SNDRV_PCM_STATE_OPEN; + init_waitqueue_head(&runtime->sleep); + data->stream.runtime = runtime; + f->private_data = (void *)data; + mutex_lock(&compr->lock); + ret = compr->ops->open(&data->stream); + mutex_unlock(&compr->lock); + if (ret) { + kfree(runtime); + kfree(data); + } + return ret; +} + +static int snd_compr_free(struct inode *inode, struct file *f) +{ + struct snd_compr_file *data = f->private_data; + data->stream.ops->free(&data->stream); + kfree(data->stream.runtime->buffer); + kfree(data->stream.runtime); + kfree(data); + return 0; +} + +static void snd_compr_update_tstamp(struct snd_compr_stream *stream, + struct snd_compr_tstamp *tstamp) +{ + if (!stream->ops->pointer) + return; + stream->ops->pointer(stream, tstamp); + pr_debug("dsp consumed till %d total %d bytes\n", + tstamp->byte_offset, tstamp->copied_total); + stream->runtime->hw_pointer = tstamp->byte_offset; + stream->runtime->total_bytes_transferred = tstamp->copied_total; +} + +static size_t snd_compr_calc_avail(struct snd_compr_stream *stream, + struct snd_compr_avail *avail) +{ + long avail_calc; /*this needs to be signed variable */ + + snd_compr_update_tstamp(stream, &avail->tstamp); + + /* FIXME: This needs to be different for capture stream, + available is # of compressed data, for playback it's + remainder of buffer */ + + if (stream->runtime->total_bytes_available == 0 && + stream->runtime->state == SNDRV_PCM_STATE_SETUP) { + pr_debug("detected init and someone forgot to do a write\n"); + return stream->runtime->buffer_size; + } + pr_debug("app wrote %lld, DSP consumed %lld\n", + stream->runtime->total_bytes_available, + stream->runtime->total_bytes_transferred); + if (stream->runtime->total_bytes_available == + stream->runtime->total_bytes_transferred) { + pr_debug("both pointers are same, returning full avail\n"); + return stream->runtime->buffer_size; + } + + /* FIXME: this routine isn't consistent, in one test we use + * cumulative values and in the other byte offsets. Do we + * really need the byte offsets if the cumulative values have + * been updated? In the PCM interface app_ptr and hw_ptr are + * already cumulative */ + + avail_calc = stream->runtime->buffer_size - + (stream->runtime->app_pointer - stream->runtime->hw_pointer); + pr_debug("calc avail as %ld, app_ptr %lld, hw+ptr %lld\n", avail_calc, + stream->runtime->app_pointer, + stream->runtime->hw_pointer); + if (avail_calc >= stream->runtime->buffer_size) + avail_calc -= stream->runtime->buffer_size; + pr_debug("ret avail as %ld\n", avail_calc); + avail->avail = avail_calc; + return avail_calc; +} + +static inline size_t snd_compr_get_avail(struct snd_compr_stream *stream) +{ + struct snd_compr_avail avail; + + return snd_compr_calc_avail(stream, &avail); +} + +static int +snd_compr_ioctl_avail(struct snd_compr_stream *stream, unsigned long arg) +{ + struct snd_compr_avail ioctl_avail; + size_t avail; + + avail = snd_compr_calc_avail(stream, &ioctl_avail); + ioctl_avail.avail = avail; + + if (copy_to_user((__u64 __user *)arg, + &ioctl_avail, sizeof(ioctl_avail))) + return -EFAULT; + return 0; +} + +static int snd_compr_write_data(struct snd_compr_stream *stream, + const char __user *buf, size_t count) +{ + void *dstn; + size_t copy; + struct snd_compr_runtime *runtime = stream->runtime; + + dstn = runtime->buffer + runtime->app_pointer; + pr_debug("copying %ld at %lld\n", + (unsigned long)count, runtime->app_pointer); + if (count < runtime->buffer_size - runtime->app_pointer) { + if (copy_from_user(dstn, buf, count)) + return -EFAULT; + runtime->app_pointer += count; + } else { + copy = runtime->buffer_size - runtime->app_pointer; + if (copy_from_user(dstn, buf, copy)) + return -EFAULT; + if (copy_from_user(runtime->buffer, buf + copy, count - copy)) + return -EFAULT; + runtime->app_pointer = count - copy; + } + /* if DSP cares, let it know data has been written */ + if (stream->ops->ack) + stream->ops->ack(stream, count); + return count; +} + +static ssize_t snd_compr_write(struct file *f, const char __user *buf, + size_t count, loff_t *offset) +{ + struct snd_compr_file *data = f->private_data; + struct snd_compr_stream *stream; + size_t avail; + int retval; + + if (snd_BUG_ON(!data)) + return -EFAULT; + + stream = &data->stream; + mutex_lock(&stream->device->lock); + /* write is allowed when stream is running or has been steup */ + if (stream->runtime->state != SNDRV_PCM_STATE_SETUP && + stream->runtime->state != SNDRV_PCM_STATE_RUNNING) { + mutex_unlock(&stream->device->lock); + return -EBADFD; + } + + avail = snd_compr_get_avail(stream); + pr_debug("avail returned %ld\n", (unsigned long)avail); + /* calculate how much we can write to buffer */ + if (avail > count) + avail = count; + + if (stream->ops->copy) + retval = stream->ops->copy(stream, buf, avail); + else + retval = snd_compr_write_data(stream, buf, avail); + if (retval > 0) + stream->runtime->total_bytes_available += retval; + + /* while initiating the stream, write should be called before START + * call, so in setup move state */ + if (stream->runtime->state == SNDRV_PCM_STATE_SETUP) { + stream->runtime->state = SNDRV_PCM_STATE_PREPARED; + pr_debug("stream prepared, Houston we are good to go\n"); + } + + mutex_unlock(&stream->device->lock); + return retval; +} + + +static ssize_t snd_compr_read(struct file *f, char __user *buf, + size_t count, loff_t *offset) +{ + return -ENXIO; +} + +static int snd_compr_mmap(struct file *f, struct vm_area_struct *vma) +{ + return -ENXIO; +} + +static inline int snd_compr_get_poll(struct snd_compr_stream *stream) +{ + if (stream->direction == SND_COMPRESS_PLAYBACK) + return POLLOUT | POLLWRNORM; + else + return POLLIN | POLLRDNORM; +} + +static unsigned int snd_compr_poll(struct file *f, poll_table *wait) +{ + struct snd_compr_file *data = f->private_data; + struct snd_compr_stream *stream; + size_t avail; + int retval = 0; + + if (snd_BUG_ON(!data)) + return -EFAULT; + stream = &data->stream; + if (snd_BUG_ON(!stream)) + return -EFAULT; + + mutex_lock(&stream->device->lock); + if (stream->runtime->state == SNDRV_PCM_STATE_PAUSED || + stream->runtime->state == SNDRV_PCM_STATE_OPEN) { + retval = -EBADFD; + goto out; + } + poll_wait(f, &stream->runtime->sleep, wait); + + avail = snd_compr_get_avail(stream); + pr_debug("avail is %ld\n", (unsigned long)avail); + /* check if we have at least one fragment to fill */ + switch (stream->runtime->state) { + case SNDRV_PCM_STATE_DRAINING: + /* stream has been woken up after drain is complete + * draining done so set stream state to stopped + */ + retval = snd_compr_get_poll(stream); + stream->runtime->state = SNDRV_PCM_STATE_SETUP; + break; + case SNDRV_PCM_STATE_RUNNING: + case SNDRV_PCM_STATE_PREPARED: + case SNDRV_PCM_STATE_PAUSED: + if (avail >= stream->runtime->fragment_size) + retval = snd_compr_get_poll(stream); + break; + default: + if (stream->direction == SND_COMPRESS_PLAYBACK) + retval = POLLOUT | POLLWRNORM | POLLERR; + else + retval = POLLIN | POLLRDNORM | POLLERR; + break; + } +out: + mutex_unlock(&stream->device->lock); + return retval; +} + +static int +snd_compr_get_caps(struct snd_compr_stream *stream, unsigned long arg) +{ + int retval; + struct snd_compr_caps caps; + + if (!stream->ops->get_caps) + return -ENXIO; + + retval = stream->ops->get_caps(stream, &caps); + if (retval) + goto out; + if (copy_to_user((void __user *)arg, &caps, sizeof(caps))) + retval = -EFAULT; +out: + return retval; +} + +static int +snd_compr_get_codec_caps(struct snd_compr_stream *stream, unsigned long arg) +{ + int retval; + struct snd_compr_codec_caps *caps; + + if (!stream->ops->get_codec_caps) + return -ENXIO; + + caps = kmalloc(sizeof(*caps), GFP_KERNEL); + if (!caps) + return -ENOMEM; + + retval = stream->ops->get_codec_caps(stream, caps); + if (retval) + goto out; + if (copy_to_user((void __user *)arg, caps, sizeof(*caps))) + retval = -EFAULT; + +out: + kfree(caps); + return retval; +} + +/* revisit this with snd_pcm_preallocate_xxx */ +static int snd_compr_allocate_buffer(struct snd_compr_stream *stream, + struct snd_compr_params *params) +{ + unsigned int buffer_size; + void *buffer; + + buffer_size = params->buffer.fragment_size * params->buffer.fragments; + if (stream->ops->copy) { + buffer = NULL; + /* if copy is defined the driver will be required to copy + * the data from core + */ + } else { + buffer = kmalloc(buffer_size, GFP_KERNEL); + if (!buffer) + return -ENOMEM; + } + stream->runtime->fragment_size = params->buffer.fragment_size; + stream->runtime->fragments = params->buffer.fragments; + stream->runtime->buffer = buffer; + stream->runtime->buffer_size = buffer_size; + return 0; +} + +static int +snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg) +{ + struct snd_compr_params *params; + int retval; + + if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) { + /* + * we should allow parameter change only when stream has been + * opened not in other cases + */ + params = kmalloc(sizeof(*params), GFP_KERNEL); + if (!params) + return -ENOMEM; + if (copy_from_user(params, (void __user *)arg, sizeof(*params))) + return -EFAULT; + retval = snd_compr_allocate_buffer(stream, params); + if (retval) { + kfree(params); + return -ENOMEM; + } + retval = stream->ops->set_params(stream, params); + if (retval) + goto out; + stream->runtime->state = SNDRV_PCM_STATE_SETUP; + } else + return -EPERM; +out: + kfree(params); + return retval; +} + +static int +snd_compr_get_params(struct snd_compr_stream *stream, unsigned long arg) +{ + struct snd_codec *params; + int retval; + + if (!stream->ops->get_params) + return -EBADFD; + + params = kmalloc(sizeof(*params), GFP_KERNEL); + if (!params) + return -ENOMEM; + retval = stream->ops->get_params(stream, params); + if (retval) + goto out; + if (copy_to_user((char __user *)arg, params, sizeof(*params))) + retval = -EFAULT; + +out: + kfree(params); + return retval; +} + +static inline int +snd_compr_tstamp(struct snd_compr_stream *stream, unsigned long arg) +{ + struct snd_compr_tstamp tstamp; + + snd_compr_update_tstamp(stream, &tstamp); + return copy_to_user((struct snd_compr_tstamp __user *)arg, + &tstamp, sizeof(tstamp)) ? -EFAULT : 0; +} + +static int snd_compr_pause(struct snd_compr_stream *stream) +{ + int retval; + + if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING) + return -EPERM; + retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_PUSH); + if (!retval) { + stream->runtime->state = SNDRV_PCM_STATE_PAUSED; + wake_up(&stream->runtime->sleep); + } + return retval; +} + +static int snd_compr_resume(struct snd_compr_stream *stream) +{ + int retval; + + if (stream->runtime->state != SNDRV_PCM_STATE_PAUSED) + return -EPERM; + retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_RELEASE); + if (!retval) + stream->runtime->state = SNDRV_PCM_STATE_RUNNING; + return retval; +} + +static int snd_compr_start(struct snd_compr_stream *stream) +{ + int retval; + + if (stream->runtime->state != SNDRV_PCM_STATE_PREPARED) + return -EPERM; + retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_START); + if (!retval) + stream->runtime->state = SNDRV_PCM_STATE_RUNNING; + return retval; +} + +static int snd_compr_stop(struct snd_compr_stream *stream) +{ + int retval; + + if (stream->runtime->state == SNDRV_PCM_STATE_PREPARED || + stream->runtime->state == SNDRV_PCM_STATE_SETUP) + return -EPERM; + retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP); + if (!retval) { + stream->runtime->state = SNDRV_PCM_STATE_SETUP; + wake_up(&stream->runtime->sleep); + } + return retval; +} + +static int snd_compr_drain(struct snd_compr_stream *stream) +{ + int retval; + + if (stream->runtime->state == SNDRV_PCM_STATE_PREPARED || + stream->runtime->state == SNDRV_PCM_STATE_SETUP) + return -EPERM; + retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_DRAIN); + if (!retval) { + stream->runtime->state = SNDRV_PCM_STATE_DRAINING; + wake_up(&stream->runtime->sleep); + } + return retval; +} + +static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg) +{ + struct snd_compr_file *data = f->private_data; + struct snd_compr_stream *stream; + int retval = -ENOTTY; + + if (snd_BUG_ON(!data)) + return -EFAULT; + stream = &data->stream; + if (snd_BUG_ON(!stream)) + return -EFAULT; + mutex_lock(&stream->device->lock); + switch (_IOC_NR(cmd)) { + case _IOC_NR(SNDRV_COMPRESS_IOCTL_VERSION): + put_user(SNDRV_COMPRESS_VERSION, + (int __user *)arg) ? -EFAULT : 0; + break; + case _IOC_NR(SNDRV_COMPRESS_GET_CAPS): + retval = snd_compr_get_caps(stream, arg); + break; + case _IOC_NR(SNDRV_COMPRESS_GET_CODEC_CAPS): + retval = snd_compr_get_codec_caps(stream, arg); + break; + case _IOC_NR(SNDRV_COMPRESS_SET_PARAMS): + retval = snd_compr_set_params(stream, arg); + break; + case _IOC_NR(SNDRV_COMPRESS_GET_PARAMS): + retval = snd_compr_get_params(stream, arg); + break; + case _IOC_NR(SNDRV_COMPRESS_TSTAMP): + retval = snd_compr_tstamp(stream, arg); + break; + case _IOC_NR(SNDRV_COMPRESS_AVAIL): + retval = snd_compr_ioctl_avail(stream, arg); + break; + case _IOC_NR(SNDRV_COMPRESS_PAUSE): + retval = snd_compr_pause(stream); + break; + case _IOC_NR(SNDRV_COMPRESS_RESUME): + retval = snd_compr_resume(stream); + break; + case _IOC_NR(SNDRV_COMPRESS_START): + retval = snd_compr_start(stream); + break; + case _IOC_NR(SNDRV_COMPRESS_STOP): + retval = snd_compr_stop(stream); + break; + case _IOC_NR(SNDRV_COMPRESS_DRAIN): + retval = snd_compr_drain(stream); + break; + } + mutex_unlock(&stream->device->lock); + return retval; +} + +static const struct file_operations snd_compr_file_ops = { + .owner = THIS_MODULE, + .open = snd_compr_open, + .release = snd_compr_free, + .write = snd_compr_write, + .read = snd_compr_read, + .unlocked_ioctl = snd_compr_ioctl, + .mmap = snd_compr_mmap, + .poll = snd_compr_poll, +}; + +static int snd_compress_dev_register(struct snd_device *device) +{ + int ret = -EINVAL; + char str[16]; + struct snd_compr *compr; + + if (snd_BUG_ON(!device || !device->device_data)) + return -EBADFD; + compr = device->device_data; + + sprintf(str, "comprC%iD%i", compr->card->number, compr->device); + pr_debug("reg %s for device %s, direction %d\n", str, compr->name, + compr->direction); + /* register compressed device */ + ret = snd_register_device(SNDRV_DEVICE_TYPE_COMPRESS, compr->card, + compr->device, &snd_compr_file_ops, compr, str); + if (ret < 0) { + pr_err("snd_register_device failed\n %d", ret); + return ret; + } + return ret; + +} + +static int snd_compress_dev_disconnect(struct snd_device *device) +{ + struct snd_compr *compr; + + compr = device->device_data; + snd_unregister_device(compr->direction, compr->card, compr->device); + return 0; +} + +/* + * snd_compress_new: create new compress device + * @card: sound card pointer + * @device: device number + * @dirn: device direction, should be of type enum snd_compr_direction + * @compr: compress device pointer + */ +int snd_compress_new(struct snd_card *card, int device, + int dirn, struct snd_compr *compr) +{ + static struct snd_device_ops ops = { + .dev_free = NULL, + .dev_register = snd_compress_dev_register, + .dev_disconnect = snd_compress_dev_disconnect, + }; + + compr->card = card; + compr->device = device; + compr->direction = dirn; + return snd_device_new(card, SNDRV_DEV_COMPRESS, compr, &ops); +} +EXPORT_SYMBOL_GPL(snd_compress_new); + +static int snd_compress_add_device(struct snd_compr *device) +{ + int ret; + + if (!device->card) + return -EINVAL; + + /* register the card */ + ret = snd_card_register(device->card); + if (ret) + goto out; + return 0; + +out: + pr_err("failed with %d\n", ret); + return ret; + +} + +static int snd_compress_remove_device(struct snd_compr *device) +{ + return snd_card_free(device->card); +} + +/** + * snd_compress_register - register compressed device + * + * @device: compressed device to register + */ +int snd_compress_register(struct snd_compr *device) +{ + int retval; + + if (device->name == NULL || device->dev == NULL || device->ops == NULL) + return -EINVAL; + + pr_debug("Registering compressed device %s\n", device->name); + if (snd_BUG_ON(!device->ops->open)) + return -EINVAL; + if (snd_BUG_ON(!device->ops->free)) + return -EINVAL; + if (snd_BUG_ON(!device->ops->set_params)) + return -EINVAL; + if (snd_BUG_ON(!device->ops->trigger)) + return -EINVAL; + + mutex_init(&device->lock); + + /* register a compressed card */ + mutex_lock(&device_mutex); + retval = snd_compress_add_device(device); + mutex_unlock(&device_mutex); + return retval; +} +EXPORT_SYMBOL_GPL(snd_compress_register); + +int snd_compress_deregister(struct snd_compr *device) +{ + pr_debug("Removing compressed device %s\n", device->name); + mutex_lock(&device_mutex); + snd_compress_remove_device(device); + mutex_unlock(&device_mutex); + return 0; +} +EXPORT_SYMBOL_GPL(snd_compress_deregister); + +static int __init snd_compress_init(void) +{ + return 0; +} + +static void __exit snd_compress_exit(void) +{ +} + +module_init(snd_compress_init); +module_exit(snd_compress_exit); + +MODULE_DESCRIPTION("ALSA Compressed offload framework"); +MODULE_AUTHOR("Vinod Koul "); +MODULE_LICENSE("GPL v2"); -- cgit v1.1 From 40741dd5c249449449bfb0528d1d26fe6f16a0bf Mon Sep 17 00:00:00 2001 From: Vinod Koul Date: Fri, 23 Dec 2011 10:36:40 +0530 Subject: ALSA: core: add makefile and kconfig file for compress Signed-off-by: Vinod Koul Signed-off-by: Pierre-Louis Bossart Signed-off-by: Takashi Iwai --- sound/core/Kconfig | 10 ++++++++++ sound/core/Makefile | 4 ++++ 2 files changed, 14 insertions(+) (limited to 'sound') diff --git a/sound/core/Kconfig b/sound/core/Kconfig index 475455c..2dc7776 100644 --- a/sound/core/Kconfig +++ b/sound/core/Kconfig @@ -155,6 +155,16 @@ config SND_DYNAMIC_MINORS If you are unsure about this, say N here. +config SND_COMPRESS_OFFLOAD + tristate "ALSA Compressed audio offload support" + default n + help + If you want support for offloading compressed audio and have such + a hardware, then you should say Y here and also to the DSP driver + of your platform. + + If you are unsure about this, say N here. + config SND_SUPPORT_OLD_API bool "Support old ALSA API" default y diff --git a/sound/core/Makefile b/sound/core/Makefile index 350a08d..67c8e93 100644 --- a/sound/core/Makefile +++ b/sound/core/Makefile @@ -21,6 +21,8 @@ snd-hrtimer-objs := hrtimer.o snd-rtctimer-objs := rtctimer.o snd-hwdep-objs := hwdep.o +snd-compress-objs := compress_offload.o + obj-$(CONFIG_SND) += snd.o obj-$(CONFIG_SND_HWDEP) += snd-hwdep.o obj-$(CONFIG_SND_TIMER) += snd-timer.o @@ -31,3 +33,5 @@ obj-$(CONFIG_SND_RAWMIDI) += snd-rawmidi.o obj-$(CONFIG_SND_OSSEMUL) += oss/ obj-$(CONFIG_SND_SEQUENCER) += seq/ + +obj-$(CONFIG_SND_COMPRESS_OFFLOAD) += snd-compress.o -- cgit v1.1 From 662d4e5c247e9feb2814d9eafc160f42d9035978 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 23 Dec 2011 09:53:55 +0800 Subject: ASoC: au1x: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing .owner of struct snd_soc_card. This prevents the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/au1x/db1000.c | 1 + sound/soc/au1x/db1200.c | 2 ++ 2 files changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/soc/au1x/db1000.c b/sound/soc/au1x/db1000.c index 094a207..511d83c 100644 --- a/sound/soc/au1x/db1000.c +++ b/sound/soc/au1x/db1000.c @@ -29,6 +29,7 @@ static struct snd_soc_dai_link db1000_ac97_dai = { static struct snd_soc_card db1000_ac97 = { .name = "DB1000_AC97", + .owner = THIS_MODULE, .dai_link = &db1000_ac97_dai, .num_links = 1, }; diff --git a/sound/soc/au1x/db1200.c b/sound/soc/au1x/db1200.c index 8073333..1c62939 100644 --- a/sound/soc/au1x/db1200.c +++ b/sound/soc/au1x/db1200.c @@ -45,6 +45,7 @@ static struct snd_soc_dai_link db1200_ac97_dai = { static struct snd_soc_card db1200_ac97_machine = { .name = "DB1200_AC97", + .owner = THIS_MODULE, .dai_link = &db1200_ac97_dai, .num_links = 1, }; @@ -94,6 +95,7 @@ static struct snd_soc_dai_link db1200_i2s_dai = { static struct snd_soc_card db1200_i2s_machine = { .name = "DB1200_I2S", + .owner = THIS_MODULE, .dai_link = &db1200_i2s_dai, .num_links = 1, }; -- cgit v1.1 From 6aff8ccb0cdd14be2acaa7cf397842005752b0f3 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 23 Dec 2011 14:47:08 +0800 Subject: ASoC: imx: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing .owner of struct snd_soc_card. This prevents the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Acked-by: Wolfram Sang Signed-off-by: Mark Brown --- sound/soc/imx/eukrea-tlv320.c | 1 + sound/soc/imx/mx27vis-aic32x4.c | 1 + sound/soc/imx/phycore-ac97.c | 1 + sound/soc/imx/wm1133-ev1.c | 1 + 4 files changed, 4 insertions(+) (limited to 'sound') diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c index 75fb4b8..1c1fdd1 100644 --- a/sound/soc/imx/eukrea-tlv320.c +++ b/sound/soc/imx/eukrea-tlv320.c @@ -87,6 +87,7 @@ static struct snd_soc_dai_link eukrea_tlv320_dai = { static struct snd_soc_card eukrea_tlv320 = { .name = "cpuimx-audio", + .owner = THIS_MODULE, .dai_link = &eukrea_tlv320_dai, .num_links = 1, }; diff --git a/sound/soc/imx/mx27vis-aic32x4.c b/sound/soc/imx/mx27vis-aic32x4.c index 054110b..3c2eed9 100644 --- a/sound/soc/imx/mx27vis-aic32x4.c +++ b/sound/soc/imx/mx27vis-aic32x4.c @@ -86,6 +86,7 @@ static struct snd_soc_dai_link mx27vis_aic32x4_dai = { static struct snd_soc_card mx27vis_aic32x4 = { .name = "visstrim_m10-audio", + .owner = THIS_MODULE, .dai_link = &mx27vis_aic32x4_dai, .num_links = 1, }; diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/imx/phycore-ac97.c index a7deb5c..6ac1211 100644 --- a/sound/soc/imx/phycore-ac97.c +++ b/sound/soc/imx/phycore-ac97.c @@ -38,6 +38,7 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = { static struct snd_soc_card imx_phycore = { .name = "PhyCORE-ac97-audio", + .owner = THIS_MODULE, .dai_link = imx_phycore_dai_ac97, .num_links = ARRAY_SIZE(imx_phycore_dai_ac97), }; diff --git a/sound/soc/imx/wm1133-ev1.c b/sound/soc/imx/wm1133-ev1.c index 490a126..37480c9 100644 --- a/sound/soc/imx/wm1133-ev1.c +++ b/sound/soc/imx/wm1133-ev1.c @@ -255,6 +255,7 @@ static struct snd_soc_dai_link wm1133_ev1_dai = { static struct snd_soc_card wm1133_ev1 = { .name = "WM1133-EV1", + .owner = THIS_MODULE, .dai_link = &wm1133_ev1_dai, .num_links = 1, }; -- cgit v1.1 From 1d9d25b35261af7892df7d339b6c34ed648ccd57 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 23 Dec 2011 14:48:19 +0800 Subject: ASoC: jz4740: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing .owner of struct snd_soc_card. This prevents the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/jz4740/qi_lb60.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/jz4740/qi_lb60.c b/sound/soc/jz4740/qi_lb60.c index c5fc339..0097c3b 100644 --- a/sound/soc/jz4740/qi_lb60.c +++ b/sound/soc/jz4740/qi_lb60.c @@ -81,6 +81,7 @@ static struct snd_soc_dai_link qi_lb60_dai = { static struct snd_soc_card qi_lb60 = { .name = "QI LB60", + .owner = THIS_MODULE, .dai_link = &qi_lb60_dai, .num_links = 1, -- cgit v1.1 From b5a67048d012cc69618140ce31316eedc9c57e8c Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 23 Dec 2011 14:51:17 +0800 Subject: ASoC: nuc900: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing .owner of struct snd_soc_card. This prevents the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/nuc900/nuc900-audio.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/nuc900/nuc900-audio.c b/sound/soc/nuc900/nuc900-audio.c index 38a2d0d8..2f6e6fd 100644 --- a/sound/soc/nuc900/nuc900-audio.c +++ b/sound/soc/nuc900/nuc900-audio.c @@ -32,6 +32,7 @@ static struct snd_soc_dai_link nuc900evb_ac97_dai = { static struct snd_soc_card nuc900evb_audio_machine = { .name = "NUC900EVB_AC97", + .owner = THIS_MODULE, .dai_link = &nuc900evb_ac97_dai, .num_links = 1, }; -- cgit v1.1 From 23bd1ce48f0b2721f0f37087d8acd9fe57f895d7 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 23 Dec 2011 14:52:22 +0800 Subject: ASoC: s6000: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing .owner of struct snd_soc_card. This prevents the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Acked-by: Daniel Glöckner Signed-off-by: Mark Brown --- sound/soc/s6000/s6105-ipcam.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/s6000/s6105-ipcam.c b/sound/soc/s6000/s6105-ipcam.c index 5890e43..58cfb1e 100644 --- a/sound/soc/s6000/s6105-ipcam.c +++ b/sound/soc/s6000/s6105-ipcam.c @@ -187,6 +187,7 @@ static struct snd_soc_dai_link s6105_dai = { /* s6105 audio machine driver */ static struct snd_soc_card snd_soc_card_s6105 = { .name = "Stretch IP Camera", + .owner = THIS_MODULE, .dai_link = &s6105_dai, .num_links = 1, }; -- cgit v1.1 From 4a7042e59908231fc046aac88bd98454d886052d Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 23 Dec 2011 14:53:32 +0800 Subject: ASoC: sh: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing .owner of struct snd_soc_card. This prevents the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/sh/fsi-ak4642.c | 1 + sound/soc/sh/fsi-da7210.c | 1 + sound/soc/sh/fsi-hdmi.c | 1 + sound/soc/sh/migor.c | 1 + sound/soc/sh/sh7760-ac97.c | 1 + 5 files changed, 5 insertions(+) (limited to 'sound') diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c index eb52778..97f540a 100644 --- a/sound/soc/sh/fsi-ak4642.c +++ b/sound/soc/sh/fsi-ak4642.c @@ -49,6 +49,7 @@ static struct snd_soc_dai_link fsi_dai_link = { }; static struct snd_soc_card fsi_soc_card = { + .owner = THIS_MODULE, .dai_link = &fsi_dai_link, .num_links = 1, }; diff --git a/sound/soc/sh/fsi-da7210.c b/sound/soc/sh/fsi-da7210.c index f5586b5b..1dd3354 100644 --- a/sound/soc/sh/fsi-da7210.c +++ b/sound/soc/sh/fsi-da7210.c @@ -44,6 +44,7 @@ static struct snd_soc_dai_link fsi_da7210_dai = { static struct snd_soc_card fsi_soc_card = { .name = "FSI-DA7210", + .owner = THIS_MODULE, .dai_link = &fsi_da7210_dai, .num_links = 1, }; diff --git a/sound/soc/sh/fsi-hdmi.c b/sound/soc/sh/fsi-hdmi.c index 621aea1..6e41908 100644 --- a/sound/soc/sh/fsi-hdmi.c +++ b/sound/soc/sh/fsi-hdmi.c @@ -39,6 +39,7 @@ static struct snd_soc_dai_link fsi_dai_link = { }; static struct snd_soc_card fsi_soc_card = { + .owner = THIS_MODULE, .dai_link = &fsi_dai_link, .num_links = 1, }; diff --git a/sound/soc/sh/migor.c b/sound/soc/sh/migor.c index 6088a6a..9d9ad8d 100644 --- a/sound/soc/sh/migor.c +++ b/sound/soc/sh/migor.c @@ -164,6 +164,7 @@ static struct snd_soc_dai_link migor_dai = { /* migor audio machine driver */ static struct snd_soc_card snd_soc_migor = { .name = "Migo-R", + .owner = THIS_MODULE, .dai_link = &migor_dai, .num_links = 1, }; diff --git a/sound/soc/sh/sh7760-ac97.c b/sound/soc/sh/sh7760-ac97.c index df651e8..4a3568a 100644 --- a/sound/soc/sh/sh7760-ac97.c +++ b/sound/soc/sh/sh7760-ac97.c @@ -28,6 +28,7 @@ static struct snd_soc_dai_link sh7760_ac97_dai = { static struct snd_soc_card sh7760_ac97_soc_machine = { .name = "SH7760 AC97", + .owner = THIS_MODULE, .dai_link = &sh7760_ac97_dai, .num_links = 1, }; -- cgit v1.1 From e181d14ac3f304086e41f8e6601f0bd3c75570b2 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 23 Dec 2011 14:54:30 +0800 Subject: ASoC: txx9: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing .owner of struct snd_soc_card. This prevents the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/txx9/txx9aclc-generic.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/txx9/txx9aclc-generic.c b/sound/soc/txx9/txx9aclc-generic.c index 9b5e283..b056a14 100644 --- a/sound/soc/txx9/txx9aclc-generic.c +++ b/sound/soc/txx9/txx9aclc-generic.c @@ -32,6 +32,7 @@ static struct snd_soc_dai_link txx9aclc_generic_dai = { static struct snd_soc_card txx9aclc_generic_card = { .name = "Generic TXx9 ACLC Audio", + .owner = THIS_MODULE, .dai_link = &txx9aclc_generic_dai, .num_links = 1, }; -- cgit v1.1 From 9b344ce80f8bdf5887d9b5f6d9566d336a8c6ab9 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 23 Dec 2011 14:49:28 +0800 Subject: ASoC: kirkwood: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing .owner of struct snd_soc_card. This prevents the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/kirkwood/kirkwood-openrd.c | 1 + sound/soc/kirkwood/kirkwood-t5325.c | 1 + 2 files changed, 2 insertions(+) (limited to 'sound') diff --git a/sound/soc/kirkwood/kirkwood-openrd.c b/sound/soc/kirkwood/kirkwood-openrd.c index d863afb..8a5a3dd 100644 --- a/sound/soc/kirkwood/kirkwood-openrd.c +++ b/sound/soc/kirkwood/kirkwood-openrd.c @@ -76,6 +76,7 @@ static struct snd_soc_dai_link openrd_client_dai[] = { static struct snd_soc_card openrd_client = { .name = "OpenRD Client", + .owner = THIS_MODULE, .dai_link = openrd_client_dai, .num_links = ARRAY_SIZE(openrd_client_dai), }; diff --git a/sound/soc/kirkwood/kirkwood-t5325.c b/sound/soc/kirkwood/kirkwood-t5325.c index c772b3c..a8930c7 100644 --- a/sound/soc/kirkwood/kirkwood-t5325.c +++ b/sound/soc/kirkwood/kirkwood-t5325.c @@ -98,6 +98,7 @@ static struct snd_soc_dai_link t5325_dai[] = { static struct snd_soc_card t5325 = { .name = "t5325", + .owner = THIS_MODULE, .dai_link = t5325_dai, .num_links = ARRAY_SIZE(t5325_dai), }; -- cgit v1.1 From 8270ba0c96702864cb0451079384e5060537d345 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 23 Dec 2011 14:50:17 +0800 Subject: ASoC: mid-x86: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing .owner of struct snd_soc_card. This prevents the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/mid-x86/mfld_machine.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/mid-x86/mfld_machine.c b/sound/soc/mid-x86/mfld_machine.c index 8ae0574..6f77eef 100644 --- a/sound/soc/mid-x86/mfld_machine.c +++ b/sound/soc/mid-x86/mfld_machine.c @@ -323,6 +323,7 @@ static struct snd_soc_dai_link mfld_msic_dailink[] = { /* SoC card */ static struct snd_soc_card snd_soc_card_mfld = { .name = "medfield_audio", + .owner = THIS_MODULE, .dai_link = mfld_msic_dailink, .num_links = ARRAY_SIZE(mfld_msic_dailink), }; -- cgit v1.1 From c5cf4dbc7f804bb4ff02a065b927bd8688204253 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 8 Dec 2011 16:45:03 +0800 Subject: ASoC: Add trivial pm_runtime usage to Samsung DAI drivers Currently this won't actually do anything but using this will help the core SoC code track when the system is idle. Signed-off-by: Mark Brown --- sound/soc/samsung/i2s.c | 6 +++++- sound/soc/samsung/pcm.c | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index ff5d919..87a874d 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -1095,6 +1096,8 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev) snd_soc_register_dai(&pri_dai->pdev->dev, &pri_dai->i2s_dai_drv); + pm_runtime_enable(&pdev->dev); + return 0; err: release_mem_region(regs_base, resource_size(res)); @@ -1105,6 +1108,7 @@ err: static __devexit int samsung_i2s_remove(struct platform_device *pdev) { struct i2s_dai *i2s, *other; + struct resource *res; i2s = dev_get_drvdata(&pdev->dev); other = i2s->pri_dai ? : i2s->sec_dai; @@ -1113,7 +1117,7 @@ static __devexit int samsung_i2s_remove(struct platform_device *pdev) other->pri_dai = NULL; other->sec_dai = NULL; } else { - struct resource *res; + pm_runtime_disable(&pdev->dev); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res) release_mem_region(res->start, resource_size(res)); diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c index 5776add..56780206c 100644 --- a/sound/soc/samsung/pcm.c +++ b/sound/soc/samsung/pcm.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -580,6 +581,8 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) pcm->dma_capture = &s3c_pcm_stereo_in[pdev->id]; pcm->dma_playback = &s3c_pcm_stereo_out[pdev->id]; + pm_runtime_enable(&pdev->dev); + ret = snd_soc_register_dai(&pdev->dev, &s3c_pcm_dai[pdev->id]); if (ret != 0) { dev_err(&pdev->dev, "failed to get register DAI: %d\n", ret); @@ -609,6 +612,8 @@ static __devexit int s3c_pcm_dev_remove(struct platform_device *pdev) snd_soc_unregister_dai(&pdev->dev); + pm_runtime_disable(&pdev->dev); + iounmap(pcm->regs); mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- cgit v1.1 From b425b88418e302caf27e9cf44aa987b83c04cb2d Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 22 Dec 2011 11:08:59 +0800 Subject: ASoC: omap: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missed .owner of struct snd_soc_card will prevent the module from being removed from underneath its users. Reported-by: Lothar Waßmann Signed-off-by: Axel Lin Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- sound/soc/omap/am3517evm.c | 1 + sound/soc/omap/ams-delta.c | 1 + sound/soc/omap/igep0020.c | 1 + sound/soc/omap/n810.c | 1 + sound/soc/omap/omap3evm.c | 1 + sound/soc/omap/omap3pandora.c | 1 + sound/soc/omap/omap4-hdmi-card.c | 1 + sound/soc/omap/osk5912.c | 1 + sound/soc/omap/overo.c | 1 + sound/soc/omap/rx51.c | 1 + sound/soc/omap/sdp3430.c | 1 + sound/soc/omap/sdp4430.c | 1 + sound/soc/omap/zoom2.c | 1 + 13 files changed, 13 insertions(+) (limited to 'sound') diff --git a/sound/soc/omap/am3517evm.c b/sound/soc/omap/am3517evm.c index c1cd4a0..add4866 100644 --- a/sound/soc/omap/am3517evm.c +++ b/sound/soc/omap/am3517evm.c @@ -107,6 +107,7 @@ static struct snd_soc_dai_link am3517evm_dai = { /* Audio machine driver */ static struct snd_soc_card snd_soc_am3517evm = { .name = "am3517evm", + .owner = THIS_MODULE, .dai_link = &am3517evm_dai, .num_links = 1, diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c index a04a433..3e523a7 100644 --- a/sound/soc/omap/ams-delta.c +++ b/sound/soc/omap/ams-delta.c @@ -597,6 +597,7 @@ static struct snd_soc_dai_link ams_delta_dai_link = { /* Audio card driver */ static struct snd_soc_card ams_delta_audio_card = { .name = "AMS_DELTA", + .owner = THIS_MODULE, .dai_link = &ams_delta_dai_link, .num_links = 1, .set_bias_level = ams_delta_set_bias_level, diff --git a/sound/soc/omap/igep0020.c b/sound/soc/omap/igep0020.c index 591fbf8..ccae58a 100644 --- a/sound/soc/omap/igep0020.c +++ b/sound/soc/omap/igep0020.c @@ -72,6 +72,7 @@ static struct snd_soc_dai_link igep2_dai = { /* Audio machine driver */ static struct snd_soc_card snd_soc_card_igep2 = { .name = "igep2", + .owner = THIS_MODULE, .dai_link = &igep2_dai, .num_links = 1, }; diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c index fc6209b..597be41 100644 --- a/sound/soc/omap/n810.c +++ b/sound/soc/omap/n810.c @@ -289,6 +289,7 @@ static struct snd_soc_dai_link n810_dai = { /* Audio machine driver */ static struct snd_soc_card snd_soc_n810 = { .name = "N810", + .owner = THIS_MODULE, .dai_link = &n810_dai, .num_links = 1, diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c index 6857895..071fcb0 100644 --- a/sound/soc/omap/omap3evm.c +++ b/sound/soc/omap/omap3evm.c @@ -70,6 +70,7 @@ static struct snd_soc_dai_link omap3evm_dai = { /* Audio machine driver */ static struct snd_soc_card snd_soc_omap3evm = { .name = "omap3evm", + .owner = THIS_MODULE, .dai_link = &omap3evm_dai, .num_links = 1, }; diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c index 7605c37..07794bd 100644 --- a/sound/soc/omap/omap3pandora.c +++ b/sound/soc/omap/omap3pandora.c @@ -233,6 +233,7 @@ static struct snd_soc_dai_link omap3pandora_dai[] = { /* SoC card */ static struct snd_soc_card snd_soc_card_omap3pandora = { .name = "omap3pandora", + .owner = THIS_MODULE, .dai_link = omap3pandora_dai, .num_links = ARRAY_SIZE(omap3pandora_dai), }; diff --git a/sound/soc/omap/omap4-hdmi-card.c b/sound/soc/omap/omap4-hdmi-card.c index 52d471c..28d689b 100644 --- a/sound/soc/omap/omap4-hdmi-card.c +++ b/sound/soc/omap/omap4-hdmi-card.c @@ -74,6 +74,7 @@ static struct snd_soc_dai_link omap4_hdmi_dai = { static struct snd_soc_card snd_soc_omap4_hdmi = { .name = "OMAP4HDMI", + .owner = THIS_MODULE, .dai_link = &omap4_hdmi_dai, .num_links = 1, }; diff --git a/sound/soc/omap/osk5912.c b/sound/soc/omap/osk5912.c index 351ec9d..d859b59 100644 --- a/sound/soc/omap/osk5912.c +++ b/sound/soc/omap/osk5912.c @@ -108,6 +108,7 @@ static struct snd_soc_dai_link osk_dai = { /* Audio machine driver */ static struct snd_soc_card snd_soc_card_osk = { .name = "OSK5912", + .owner = THIS_MODULE, .dai_link = &osk_dai, .num_links = 1, diff --git a/sound/soc/omap/overo.c b/sound/soc/omap/overo.c index c3550ae..2ee889c 100644 --- a/sound/soc/omap/overo.c +++ b/sound/soc/omap/overo.c @@ -72,6 +72,7 @@ static struct snd_soc_dai_link overo_dai = { /* Audio machine driver */ static struct snd_soc_card snd_soc_card_overo = { .name = "overo", + .owner = THIS_MODULE, .dai_link = &overo_dai, .num_links = 1, }; diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c index ad16db5..fada6ef 100644 --- a/sound/soc/omap/rx51.c +++ b/sound/soc/omap/rx51.c @@ -383,6 +383,7 @@ static struct snd_soc_codec_conf rx51_codec_conf[] = { /* Audio card */ static struct snd_soc_card rx51_sound_card = { .name = "RX-51", + .owner = THIS_MODULE, .dai_link = rx51_dai, .num_links = ARRAY_SIZE(rx51_dai), .aux_dev = rx51_aux_dev, diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c index e8fbf8e..2c85066 100644 --- a/sound/soc/omap/sdp3430.c +++ b/sound/soc/omap/sdp3430.c @@ -213,6 +213,7 @@ static struct snd_soc_dai_link sdp3430_dai[] = { /* Audio machine driver */ static struct snd_soc_card snd_soc_sdp3430 = { .name = "SDP3430", + .owner = THIS_MODULE, .dai_link = sdp3430_dai, .num_links = ARRAY_SIZE(sdp3430_dai), diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c index 2735fa03..175ba9a 100644 --- a/sound/soc/omap/sdp4430.c +++ b/sound/soc/omap/sdp4430.c @@ -226,6 +226,7 @@ static struct snd_soc_dai_link sdp4430_dai[] = { /* Audio machine driver */ static struct snd_soc_card snd_soc_sdp4430 = { .name = "SDP4430", + .owner = THIS_MODULE, .dai_link = sdp4430_dai, .num_links = ARRAY_SIZE(sdp4430_dai), diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c index 7641a7f..981616d 100644 --- a/sound/soc/omap/zoom2.c +++ b/sound/soc/omap/zoom2.c @@ -157,6 +157,7 @@ static struct snd_soc_dai_link zoom2_dai[] = { /* Audio machine driver */ static struct snd_soc_card snd_soc_zoom2 = { .name = "Zoom2", + .owner = THIS_MODULE, .dai_link = zoom2_dai, .num_links = ARRAY_SIZE(zoom2_dai), -- cgit v1.1 From 306bf6b19ee3da824fbdbdb2dc4e5d62a8983a2c Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 26 Dec 2011 20:54:04 +0800 Subject: ASoC: Convert da7210 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/da7210.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index e4ca61c..62e6a9c 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c @@ -944,7 +944,8 @@ static int __devinit da7210_i2c_probe(struct i2c_client *i2c, struct da7210_priv *da7210; int ret; - da7210 = kzalloc(sizeof(struct da7210_priv), GFP_KERNEL); + da7210 = devm_kzalloc(&i2c->dev, sizeof(struct da7210_priv), + GFP_KERNEL); if (!da7210) return -ENOMEM; @@ -953,16 +954,12 @@ static int __devinit da7210_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_da7210, &da7210_dai, 1); - if (ret < 0) - kfree(da7210); - return ret; } static int __devexit da7210_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From eb3bb97ce73ac666d9c3d16fc250fa0b78e3b8f2 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 26 Dec 2011 20:56:25 +0800 Subject: ASoC: Convert lm4857 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/lm4857.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/lm4857.c b/sound/soc/codecs/lm4857.c index c387daf..3190392 100644 --- a/sound/soc/codecs/lm4857.c +++ b/sound/soc/codecs/lm4857.c @@ -215,7 +215,7 @@ static int __devinit lm4857_i2c_probe(struct i2c_client *i2c, struct lm4857 *lm4857; int ret; - lm4857 = kzalloc(sizeof(*lm4857), GFP_KERNEL); + lm4857 = devm_kzalloc(&i2c->dev, sizeof(*lm4857), GFP_KERNEL); if (!lm4857) return -ENOMEM; @@ -225,21 +225,12 @@ static int __devinit lm4857_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_lm4857, NULL, 0); - if (ret) { - kfree(lm4857); - return ret; - } - - return 0; + return ret; } static int __devexit lm4857_i2c_remove(struct i2c_client *i2c) { - struct lm4857 *lm4857 = i2c_get_clientdata(i2c); - snd_soc_unregister_codec(&i2c->dev); - kfree(lm4857); - return 0; } -- cgit v1.1 From 6ce91ad4d8d7370be4f9ca3d7ded866cb1e2430d Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 26 Dec 2011 20:58:14 +0800 Subject: ASoC: Convert uda1380 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/uda1380.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index 8f734d6..4f1b23d 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c @@ -803,7 +803,8 @@ static __devinit int uda1380_i2c_probe(struct i2c_client *i2c, struct uda1380_priv *uda1380; int ret; - uda1380 = kzalloc(sizeof(struct uda1380_priv), GFP_KERNEL); + uda1380 = devm_kzalloc(&i2c->dev, sizeof(struct uda1380_priv), + GFP_KERNEL); if (uda1380 == NULL) return -ENOMEM; @@ -812,15 +813,12 @@ static __devinit int uda1380_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_uda1380, uda1380_dai, ARRAY_SIZE(uda1380_dai)); - if (ret < 0) - kfree(uda1380); return ret; } static int __devexit uda1380_i2c_remove(struct i2c_client *i2c) { snd_soc_unregister_codec(&i2c->dev); - kfree(i2c_get_clientdata(i2c)); return 0; } -- cgit v1.1 From 6ab7e71a9cbcd31f5ee09da384bcfcf0fa11b8c9 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 26 Dec 2011 20:48:48 +0800 Subject: ASoC: Convert 88pm860x-codec to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/88pm860x-codec.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index 99ca53c..9fd3b68 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c @@ -1430,7 +1430,8 @@ static int __devinit pm860x_codec_probe(struct platform_device *pdev) struct resource *res; int i, ret; - pm860x = kzalloc(sizeof(struct pm860x_priv), GFP_KERNEL); + pm860x = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_priv), + GFP_KERNEL); if (pm860x == NULL) return -ENOMEM; @@ -1459,17 +1460,13 @@ static int __devinit pm860x_codec_probe(struct platform_device *pdev) out: platform_set_drvdata(pdev, NULL); - kfree(pm860x); return -EINVAL; } static int __devexit pm860x_codec_remove(struct platform_device *pdev) { - struct pm860x_priv *pm860x = platform_get_drvdata(pdev); - snd_soc_unregister_codec(&pdev->dev); platform_set_drvdata(pdev, NULL); - kfree(pm860x); return 0; } -- cgit v1.1 From d4d9820b4ad6d6227cad090a9f695eea37814215 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 28 Dec 2011 16:05:22 +0800 Subject: ASoC: Fix build error in sound/soc/kirkwood/kirkwood-i2s.c Since commit db33f4de "ARM: Orion: Remove address map info from all platform data structures", the dram is removed from struct kirkwood_asoc_platform_data. This patch fixes below build error: CC sound/soc/kirkwood/kirkwood-i2s.o sound/soc/kirkwood/kirkwood-i2s.c: In function 'kirkwood_i2s_dev_probe': sound/soc/kirkwood/kirkwood-i2s.c:444: error: 'struct kirkwood_asoc_platform_data' has no member named 'dram' sound/soc/kirkwood/kirkwood-i2s.c:450: error: 'struct kirkwood_asoc_platform_data' has no member named 'dram' make[3]: *** [sound/soc/kirkwood/kirkwood-i2s.o] Error 1 make[2]: *** [sound/soc/kirkwood] Error 2 make[1]: *** [sound/soc] Error 2 make: *** [sound] Error 2 Signed-off-by: Axel Lin Cc: Andrew Lunn Cc: Nicolas Pitre Signed-off-by: Mark Brown --- sound/soc/kirkwood/kirkwood-i2s.c | 3 +-- sound/soc/kirkwood/kirkwood.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index f6bb211..3cb9aa4 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c @@ -441,13 +441,12 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev) goto err_ioremap; } - if (!data || !data->dram) { + if (!data) { dev_err(&pdev->dev, "no platform data ?!\n"); err = -EINVAL; goto err_ioremap; } - priv->dram = data->dram; priv->burst = data->burst; return snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai); diff --git a/sound/soc/kirkwood/kirkwood.h b/sound/soc/kirkwood/kirkwood.h index bb6e6a5..9047436 100644 --- a/sound/soc/kirkwood/kirkwood.h +++ b/sound/soc/kirkwood/kirkwood.h @@ -123,7 +123,6 @@ struct kirkwood_dma_data { void __iomem *io; int irq; int burst; - struct mbus_dram_target_info *dram; }; #endif -- cgit v1.1 From 077a2ba4c8e40e6256948c3b4cc60608a284f555 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 28 Dec 2011 18:58:17 +0800 Subject: ASoC: Use dai_fmt in kirkwood-openrd machine driver Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/kirkwood/kirkwood-openrd.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/soc/kirkwood/kirkwood-openrd.c b/sound/soc/kirkwood/kirkwood-openrd.c index 8a5a3dd..55d2ed3 100644 --- a/sound/soc/kirkwood/kirkwood-openrd.c +++ b/sound/soc/kirkwood/kirkwood-openrd.c @@ -26,18 +26,7 @@ static int openrd_client_hw_params(struct snd_pcm_substream *substream, { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *codec_dai = rtd->codec_dai; - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; - int ret; - unsigned int freq, fmt; - - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS; - ret = snd_soc_dai_set_fmt(cpu_dai, fmt); - if (ret < 0) - return ret; - - ret = snd_soc_dai_set_fmt(codec_dai, fmt); - if (ret < 0) - return ret; + unsigned int freq; switch (params_rate(params)) { default: @@ -69,6 +58,7 @@ static struct snd_soc_dai_link openrd_client_dai[] = { .platform_name = "kirkwood-pcm-audio", .codec_dai_name = "cs42l51-hifi", .codec_name = "cs42l51-codec.0-004a", + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS, .ops = &openrd_client_ops, }, }; -- cgit v1.1 From 7e0d6ac0d894ebae2ff85ea6108dd065a274dfb9 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 28 Dec 2011 18:59:30 +0800 Subject: ASoC: Use dai_fmt in kirkwood-t5325 machine driver Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/kirkwood/kirkwood-t5325.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/soc/kirkwood/kirkwood-t5325.c b/sound/soc/kirkwood/kirkwood-t5325.c index a8930c7..6e99230 100644 --- a/sound/soc/kirkwood/kirkwood-t5325.c +++ b/sound/soc/kirkwood/kirkwood-t5325.c @@ -25,18 +25,7 @@ static int t5325_hw_params(struct snd_pcm_substream *substream, { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *codec_dai = rtd->codec_dai; - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; - int ret; - unsigned int freq, fmt; - - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS; - ret = snd_soc_dai_set_fmt(cpu_dai, fmt); - if (ret < 0) - return ret; - - ret = snd_soc_dai_set_fmt(codec_dai, fmt); - if (ret < 0) - return ret; + unsigned int freq; freq = params_rate(params) * 256; @@ -90,6 +79,7 @@ static struct snd_soc_dai_link t5325_dai[] = { .platform_name = "kirkwood-pcm-audio", .codec_dai_name = "alc5621-hifi", .codec_name = "alc562x-codec.0-001a", + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS, .ops = &t5325_ops, .init = t5325_dai_init, }, -- cgit v1.1 From 5f5de18a7f81382fead581efc489dfcfa34601af Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Wed, 28 Dec 2011 19:03:23 +0800 Subject: ASoC: Convert kirkwood-t5325 to table based DAPM init Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/kirkwood/kirkwood-t5325.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/kirkwood/kirkwood-t5325.c b/sound/soc/kirkwood/kirkwood-t5325.c index 6e99230..b47cc4e 100644 --- a/sound/soc/kirkwood/kirkwood-t5325.c +++ b/sound/soc/kirkwood/kirkwood-t5325.c @@ -59,11 +59,6 @@ static int t5325_dai_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; - snd_soc_dapm_new_controls(dapm, t5325_dapm_widgets, - ARRAY_SIZE(t5325_dapm_widgets)); - - snd_soc_dapm_add_routes(dapm, t5325_route, ARRAY_SIZE(t5325_route)); - snd_soc_dapm_enable_pin(dapm, "Mic Jack"); snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); snd_soc_dapm_enable_pin(dapm, "Speaker"); @@ -91,6 +86,11 @@ static struct snd_soc_card t5325 = { .owner = THIS_MODULE, .dai_link = t5325_dai, .num_links = ARRAY_SIZE(t5325_dai), + + .dapm_widgets = t5325_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(t5325_dapm_widgets), + .dapm_routes = t5325_route, + .num_dapm_routes = ARRAY_SIZE(t5325_route), }; static struct platform_device *t5325_snd_device; -- cgit v1.1 From cf1ee98d800459e6f055742f84355b1aa9e937ae Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Wed, 28 Dec 2011 09:55:15 -0200 Subject: ASoC: sgtl5000: Fix voltage units in dev_err message vdda, vddio and vddd are voltages expressed in milivolts (mV), so use the proper annotation. Signed-off-by: Fabio Estevam Signed-off-by: Mark Brown --- sound/soc/codecs/sgtl5000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 2501757..827a43b 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1076,7 +1076,7 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec) /* according to datasheet, maximum voltage of supplies */ if (vdda > 3600 || vddio > 3600 || vddd > 1980) { dev_err(codec->dev, - "exceed max voltage vdda %dmv vddio %dma vddd %dma\n", + "exceed max voltage vdda %dmV vddio %dmV vddd %dmV\n", vdda, vddio, vddd); return -EINVAL; -- cgit v1.1 From 512fa7c40b9e808000eac31458668369e131a243 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Wed, 28 Dec 2011 11:30:11 -0200 Subject: ASoC: Convert sgtl5000 to use devm_kzalloc() Convert sgtl5000 codec driver to use devm_kzalloc(). Signed-off-by: Fabio Estevam Signed-off-by: Mark Brown --- sound/soc/codecs/sgtl5000.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 827a43b..fc9b127 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1401,7 +1401,8 @@ static __devinit int sgtl5000_i2c_probe(struct i2c_client *client, struct sgtl5000_priv *sgtl5000; int ret; - sgtl5000 = kzalloc(sizeof(struct sgtl5000_priv), GFP_KERNEL); + sgtl5000 = devm_kzalloc(&client->dev, sizeof(struct sgtl5000_priv), + GFP_KERNEL); if (!sgtl5000) return -ENOMEM; @@ -1409,22 +1410,13 @@ static __devinit int sgtl5000_i2c_probe(struct i2c_client *client, ret = snd_soc_register_codec(&client->dev, &sgtl5000_driver, &sgtl5000_dai, 1); - if (ret) { - dev_err(&client->dev, "Failed to register codec: %d\n", ret); - kfree(sgtl5000); - return ret; - } - - return 0; + return ret; } static __devexit int sgtl5000_i2c_remove(struct i2c_client *client) { - struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client); - snd_soc_unregister_codec(&client->dev); - kfree(sgtl5000); return 0; } -- cgit v1.1 From a5b683489fd3c83f3951eccdc6aee14f50474dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= Date: Wed, 28 Dec 2011 20:06:21 +0800 Subject: ASoC: mxs: Add .owner to struct snd_soc_card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add missing .owner of struct snd_soc_card. This prevents the module from being removed from underneath its users. Signed-off-by: Lothar Waßmann Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/mxs/mxs-sgtl5000.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c index 259278f..60f052b 100644 --- a/sound/soc/mxs/mxs-sgtl5000.c +++ b/sound/soc/mxs/mxs-sgtl5000.c @@ -105,6 +105,7 @@ static struct snd_soc_dai_link mxs_sgtl5000_dai[] = { static struct snd_soc_card mxs_sgtl5000 = { .name = "mxs_sgtl5000", + .owner = THIS_MODULE, .dai_link = mxs_sgtl5000_dai, .num_links = ARRAY_SIZE(mxs_sgtl5000_dai), }; -- cgit v1.1 From 30c88f2ca89d6c0706ab585beca3730c9d7524de Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 26 Dec 2011 20:51:16 +0800 Subject: ASoC: Convert ad193x to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/ad193x.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c index c1b7d92..a4a6bef 100644 --- a/sound/soc/codecs/ad193x.c +++ b/sound/soc/codecs/ad193x.c @@ -385,14 +385,15 @@ static int __devinit ad193x_spi_probe(struct spi_device *spi) struct ad193x_priv *ad193x; int ret; - ad193x = kzalloc(sizeof(struct ad193x_priv), GFP_KERNEL); + ad193x = devm_kzalloc(&spi->dev, sizeof(struct ad193x_priv), + GFP_KERNEL); if (ad193x == NULL) return -ENOMEM; ad193x->regmap = regmap_init_spi(spi, &ad193x_spi_regmap_config); if (IS_ERR(ad193x->regmap)) { ret = PTR_ERR(ad193x->regmap); - goto err_free; + goto err_out; } spi_set_drvdata(spi, ad193x); @@ -406,9 +407,7 @@ static int __devinit ad193x_spi_probe(struct spi_device *spi) err_regmap_exit: regmap_exit(ad193x->regmap); -err_free: - kfree(ad193x); - +err_out: return ret; } @@ -418,7 +417,6 @@ static int __devexit ad193x_spi_remove(struct spi_device *spi) snd_soc_unregister_codec(&spi->dev); regmap_exit(ad193x->regmap); - kfree(ad193x); return 0; } @@ -455,14 +453,15 @@ static int __devinit ad193x_i2c_probe(struct i2c_client *client, struct ad193x_priv *ad193x; int ret; - ad193x = kzalloc(sizeof(struct ad193x_priv), GFP_KERNEL); + ad193x = devm_kzalloc(&client->dev, sizeof(struct ad193x_priv), + GFP_KERNEL); if (ad193x == NULL) return -ENOMEM; ad193x->regmap = regmap_init_i2c(client, &ad193x_i2c_regmap_config); if (IS_ERR(ad193x->regmap)) { ret = PTR_ERR(ad193x->regmap); - goto err_free; + goto err_out; } i2c_set_clientdata(client, ad193x); @@ -476,8 +475,7 @@ static int __devinit ad193x_i2c_probe(struct i2c_client *client, err_regmap_exit: regmap_exit(ad193x->regmap); -err_free: - kfree(ad193x); +err_out: return ret; } @@ -487,7 +485,6 @@ static int __devexit ad193x_i2c_remove(struct i2c_client *client) snd_soc_unregister_codec(&client->dev); regmap_exit(ad193x->regmap); - kfree(ad193x); return 0; } -- cgit v1.1 From 80c2f9da4ecba2ba2ab65ddc058190b1be28d9e5 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 26 Dec 2011 20:52:13 +0800 Subject: ASoC: Convert adau1373 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/adau1373.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c index 637b114..971ba45 100644 --- a/sound/soc/codecs/adau1373.c +++ b/sound/soc/codecs/adau1373.c @@ -1360,7 +1360,7 @@ static int __devinit adau1373_i2c_probe(struct i2c_client *client, struct adau1373 *adau1373; int ret; - adau1373 = kzalloc(sizeof(*adau1373), GFP_KERNEL); + adau1373 = devm_kzalloc(&client->dev, sizeof(*adau1373), GFP_KERNEL); if (!adau1373) return -ENOMEM; @@ -1368,16 +1368,12 @@ static int __devinit adau1373_i2c_probe(struct i2c_client *client, ret = snd_soc_register_codec(&client->dev, &adau1373_codec_driver, adau1373_dai_driver, ARRAY_SIZE(adau1373_dai_driver)); - if (ret < 0) - kfree(adau1373); - return ret; } static int __devexit adau1373_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(dev_get_drvdata(&client->dev)); return 0; } -- cgit v1.1 From 6e4f17cb2b7e8a5327ccc5a6a32442acd408c190 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 26 Dec 2011 20:50:02 +0800 Subject: ASoC: Convert ad1836 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/ad1836.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c index 919322d..982d201 100644 --- a/sound/soc/codecs/ad1836.c +++ b/sound/soc/codecs/ad1836.c @@ -341,7 +341,8 @@ static int __devinit ad1836_spi_probe(struct spi_device *spi) struct ad1836_priv *ad1836; int ret; - ad1836 = kzalloc(sizeof(struct ad1836_priv), GFP_KERNEL); + ad1836 = devm_kzalloc(&spi->dev, sizeof(struct ad1836_priv), + GFP_KERNEL); if (ad1836 == NULL) return -ENOMEM; @@ -351,17 +352,15 @@ static int __devinit ad1836_spi_probe(struct spi_device *spi) ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_ad1836, &ad183x_dais[ad1836->type], 1); - if (ret < 0) - kfree(ad1836); return ret; } static int __devexit ad1836_spi_remove(struct spi_device *spi) { snd_soc_unregister_codec(&spi->dev); - kfree(spi_get_drvdata(spi)); return 0; } + static const struct spi_device_id ad1836_ids[] = { { "ad1835", AD1835 }, { "ad1836", AD1836 }, -- cgit v1.1 From 38b81c1d2517d7c4a6685d49136474bcd0105ab9 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 26 Dec 2011 20:53:09 +0800 Subject: ASoC: Convert adau1701 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/adau1701.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index 6a6af56..6b325ea 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c @@ -496,23 +496,19 @@ static __devinit int adau1701_i2c_probe(struct i2c_client *client, struct adau1701 *adau1701; int ret; - adau1701 = kzalloc(sizeof(*adau1701), GFP_KERNEL); + adau1701 = devm_kzalloc(&client->dev, sizeof(*adau1701), GFP_KERNEL); if (!adau1701) return -ENOMEM; i2c_set_clientdata(client, adau1701); ret = snd_soc_register_codec(&client->dev, &adau1701_codec_drv, &adau1701_dai, 1); - if (ret < 0) - kfree(adau1701); - return ret; } static __devexit int adau1701_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From 558460c65af17f70a0d7adece0f73b8ab968a0f8 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 26 Dec 2011 20:55:01 +0800 Subject: ASoC: Convert jz4740 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/jz4740.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index d73d283..4624e75 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c @@ -353,7 +353,8 @@ static int __devinit jz4740_codec_probe(struct platform_device *pdev) struct jz4740_codec *jz4740_codec; struct resource *mem; - jz4740_codec = kzalloc(sizeof(*jz4740_codec), GFP_KERNEL); + jz4740_codec = devm_kzalloc(&pdev->dev, sizeof(*jz4740_codec), + GFP_KERNEL); if (!jz4740_codec) return -ENOMEM; @@ -361,14 +362,14 @@ static int __devinit jz4740_codec_probe(struct platform_device *pdev) if (!mem) { dev_err(&pdev->dev, "Failed to get mmio memory resource\n"); ret = -ENOENT; - goto err_free_codec; + goto err_out; } mem = request_mem_region(mem->start, resource_size(mem), pdev->name); if (!mem) { dev_err(&pdev->dev, "Failed to request mmio memory region\n"); ret = -EBUSY; - goto err_free_codec; + goto err_out; } jz4740_codec->base = ioremap(mem->start, resource_size(mem)); @@ -394,9 +395,7 @@ err_iounmap: iounmap(jz4740_codec->base); err_release_mem_region: release_mem_region(mem->start, resource_size(mem)); -err_free_codec: - kfree(jz4740_codec); - +err_out: return ret; } @@ -411,7 +410,6 @@ static int __devexit jz4740_codec_remove(struct platform_device *pdev) release_mem_region(mem->start, resource_size(mem)); platform_set_drvdata(pdev, NULL); - kfree(jz4740_codec); return 0; } -- cgit v1.1 From 658ecf7784e9bd081ed49a17274ff36bc15ff4d3 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 26 Dec 2011 20:57:24 +0800 Subject: ASoC: Convert tlv320aic32x4 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/tlv320aic32x4.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index 81a26e1..eb401ef 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c @@ -709,7 +709,8 @@ static __devinit int aic32x4_i2c_probe(struct i2c_client *i2c, struct aic32x4_priv *aic32x4; int ret; - aic32x4 = kzalloc(sizeof(struct aic32x4_priv), GFP_KERNEL); + aic32x4 = devm_kzalloc(&i2c->dev, sizeof(struct aic32x4_priv), + GFP_KERNEL); if (aic32x4 == NULL) return -ENOMEM; @@ -728,15 +729,12 @@ static __devinit int aic32x4_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_aic32x4, &aic32x4_dai, 1); - if (ret < 0) - kfree(aic32x4); return ret; } static __devexit int aic32x4_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From a421a0e41c28ec4bfc719194e95065ec1cb4aee4 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 29 Dec 2011 11:08:34 +0000 Subject: ASoC: Remove unused label from wm8994 probe() Signed-off-by: Mark Brown --- sound/soc/codecs/wm8994.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index a993690..71472b6 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3759,7 +3759,7 @@ err_irq: wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec); wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec); wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec); -err: + return ret; } -- cgit v1.1 From 1b39bf3468e03016ffdcadef3dac1fd75d2db6fa Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 29 Dec 2011 12:18:53 +0000 Subject: ASoC: Enable ASoC register map dump for some regmap CODECs It's still useful to be able to poke around in the register map at runtime. Signed-off-by: Mark Brown --- sound/soc/codecs/wm5100.c | 9 +++++++++ sound/soc/codecs/wm8962.c | 9 +++++++++ sound/soc/codecs/wm8994.c | 8 ++++++++ sound/soc/codecs/wm8996.c | 8 ++++++++ 4 files changed, 34 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index a234b70..8b24323 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c @@ -2568,6 +2568,13 @@ static int wm5100_remove(struct snd_soc_codec *codec) return 0; } +static int wm5100_soc_volatile(struct snd_soc_codec *codec, + unsigned int reg) +{ + return true; +} + + static struct snd_soc_codec_driver soc_codec_dev_wm5100 = { .probe = wm5100_probe, .remove = wm5100_remove, @@ -2576,6 +2583,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm5100 = { .set_pll = wm5100_set_fll, .set_bias_level = wm5100_set_bias_level, .idle_bias_off = 1, + .reg_cache_size = WM5100_MAX_REGISTER, + .volatile_register = wm5100_soc_volatile, .seq_notifier = wm5100_seq_notifier, .controls = wm5100_snd_controls, diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index be35b64..1be4eb3 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -4123,11 +4123,20 @@ static int wm8962_remove(struct snd_soc_codec *codec) return 0; } +static int wm8962_soc_volatile(struct snd_soc_codec *codec, + unsigned int reg) +{ + return true; +} + + static struct snd_soc_codec_driver soc_codec_dev_wm8962 = { .probe = wm8962_probe, .remove = wm8962_remove, .set_bias_level = wm8962_set_bias_level, .set_pll = wm8962_set_fll, + .reg_cache_size = WM8962_MAX_REGISTER, + .volatile_register = wm8962_soc_volatile, }; static const struct regmap_config wm8962_regmap = { diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 71472b6..93d27b6 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c @@ -3815,12 +3815,20 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec) return 0; } +static int wm8994_soc_volatile(struct snd_soc_codec *codec, + unsigned int reg) +{ + return true; +} + static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { .probe = wm8994_codec_probe, .remove = wm8994_codec_remove, .suspend = wm8994_suspend, .resume = wm8994_resume, .set_bias_level = wm8994_set_bias_level, + .reg_cache_size = WM8994_MAX_REGISTER, + .volatile_register = wm8994_soc_volatile, }; static int __devinit wm8994_probe(struct platform_device *pdev) diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index da7acae..d8da10f 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c @@ -3039,6 +3039,12 @@ static int wm8996_remove(struct snd_soc_codec *codec) return 0; } +static int wm8996_soc_volatile_register(struct snd_soc_codec *codec, + unsigned int reg) +{ + return true; +} + static struct snd_soc_codec_driver soc_codec_dev_wm8996 = { .probe = wm8996_probe, .remove = wm8996_remove, @@ -3051,6 +3057,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8996 = { .dapm_routes = wm8996_dapm_routes, .num_dapm_routes = ARRAY_SIZE(wm8996_dapm_routes), .set_pll = wm8996_set_fll, + .reg_cache_size = WM8996_MAX_REGISTER, + .volatile_register = wm8996_soc_volatile_register, }; #define WM8996_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ -- cgit v1.1 From 2445ecc3c036ae5f1cc0c3dfed4731d9519a3811 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 09:16:11 +0800 Subject: ASoC: pxa: Convert poodle to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Acked-by: Haojian Zhuang Signed-off-by: Mark Brown --- sound/soc/pxa/poodle.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index 4c29bc1..c9e24bf 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c @@ -281,22 +281,18 @@ static struct snd_soc_dai_link poodle_dai = { }; /* poodle audio machine driver */ -static struct snd_soc_card snd_soc_poodle = { +static struct snd_soc_card poodle = { .name = "Poodle", .dai_link = &poodle_dai, .num_links = 1, .owner = THIS_MODULE, }; -static struct platform_device *poodle_snd_device; - -static int __init poodle_init(void) +static int __devinit poodle_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &poodle; int ret; - if (!machine_is_poodle()) - return -ENODEV; - locomo_gpio_set_dir(&poodle_locomo_device.dev, POODLE_LOCOMO_GPIO_AMP_ON, 0); /* should we mute HP at startup - burning power ?*/ @@ -305,28 +301,36 @@ static int __init poodle_init(void) locomo_gpio_set_dir(&poodle_locomo_device.dev, POODLE_LOCOMO_GPIO_MUTE_R, 0); - poodle_snd_device = platform_device_alloc("soc-audio", -1); - if (!poodle_snd_device) - return -ENOMEM; - - platform_set_drvdata(poodle_snd_device, &snd_soc_poodle); - ret = platform_device_add(poodle_snd_device); + card->dev = &pdev->dev; + ret = snd_soc_register_card(card); if (ret) - platform_device_put(poodle_snd_device); - + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); return ret; } -static void __exit poodle_exit(void) +static int __devexit poodle_remove(struct platform_device *pdev) { - platform_device_unregister(poodle_snd_device); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + return 0; } -module_init(poodle_init); -module_exit(poodle_exit); +static struct platform_driver poodle_driver = { + .driver = { + .name = "poodle-audio", + .owner = THIS_MODULE, + }, + .probe = poodle_probe, + .remove = __devexit_p(poodle_remove), +}; + +module_platform_driver(poodle_driver); /* Module information */ MODULE_AUTHOR("Richard Purdie"); MODULE_DESCRIPTION("ALSA SoC Poodle"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:poodle-audio"); -- cgit v1.1 From fe366d067409d7633ca1186b533289828e5f4161 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 09:19:32 +0800 Subject: ASoC: Convert poodle to table based DAPM and control init Signed-off-by: Axel Lin Acked-by: Haojian Zhuang Signed-off-by: Mark Brown --- sound/soc/pxa/poodle.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index c9e24bf..a321b4d 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c @@ -214,7 +214,7 @@ SND_SOC_DAPM_SPK("Ext Spk", poodle_amp_event), }; /* Corgi machine connections to the codec pins */ -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route poodle_audio_map[] = { /* headphone connected to LHPOUT1, RHPOUT1 */ {"Headphone Jack", NULL, "LHPOUT"}, @@ -246,25 +246,11 @@ static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; - int err; snd_soc_dapm_nc_pin(dapm, "LLINEIN"); snd_soc_dapm_nc_pin(dapm, "RLINEIN"); snd_soc_dapm_enable_pin(dapm, "MICIN"); - /* Add poodle specific controls */ - err = snd_soc_add_controls(codec, wm8731_poodle_controls, - ARRAY_SIZE(wm8731_poodle_controls)); - if (err < 0) - return err; - - /* Add poodle specific widgets */ - snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets, - ARRAY_SIZE(wm8731_dapm_widgets)); - - /* Set up poodle specific audio path audio_map */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - return 0; } @@ -286,6 +272,13 @@ static struct snd_soc_card poodle = { .dai_link = &poodle_dai, .num_links = 1, .owner = THIS_MODULE, + + .controls = wm8731_poodle_controls, + .num_controls = ARRAY_SIZE(wm8731_poodle_controls), + .dapm_widgets = wm8731_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets), + .dapm_routes = poodle_audio_map, + .num_dapm_routes = ARRAY_SIZE(poodle_audio_map), }; static int __devinit poodle_probe(struct platform_device *pdev) -- cgit v1.1 From 87063dfcea80316ff4647b9906d146b5c7969766 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 09:20:40 +0800 Subject: ASoC: Use dai_fmt in poodle machine driver Signed-off-by: Axel Lin Acked-by: Haojian Zhuang Signed-off-by: Mark Brown --- sound/soc/pxa/poodle.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c index a321b4d..fd0ed10 100644 --- a/sound/soc/pxa/poodle.c +++ b/sound/soc/pxa/poodle.c @@ -121,18 +121,6 @@ static int poodle_hw_params(struct snd_pcm_substream *substream, break; } - /* set codec DAI configuration */ - ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); - if (ret < 0) - return ret; - - /* set cpu DAI configuration */ - ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); - if (ret < 0) - return ret; - /* set the codec system clock for DAC and ADC */ ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, clk, SND_SOC_CLOCK_IN); @@ -263,6 +251,8 @@ static struct snd_soc_dai_link poodle_dai = { .platform_name = "pxa-pcm-audio", .codec_name = "wm8731.0-001b", .init = poodle_wm8731_init, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, .ops = &poodle_ops, }; -- cgit v1.1 From 74f4dd56ffab34f280b83d18a5343ac96a7b91ad Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 11:13:24 +0800 Subject: ASoC: Use dai_fmt in corgi machine driver Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/corgi.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index 5e5004a..5ff6dac 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c @@ -142,18 +142,6 @@ static int corgi_hw_params(struct snd_pcm_substream *substream, break; } - /* set codec DAI configuration */ - ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); - if (ret < 0) - return ret; - - /* set cpu DAI configuration */ - ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); - if (ret < 0) - return ret; - /* set the codec system clock for DAC and ADC */ ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, clk, SND_SOC_CLOCK_IN); @@ -311,6 +299,8 @@ static struct snd_soc_dai_link corgi_dai = { .platform_name = "pxa-pcm-audio", .codec_name = "wm8731.0-001b", .init = corgi_wm8731_init, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, .ops = &corgi_ops, }; -- cgit v1.1 From 32696af13724aaf7651d1cf95bc1a7a8af97a5c8 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 11:16:32 +0800 Subject: ASoC: Convert corgi to table based DAPM and control init Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/corgi.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index 5ff6dac..30ebce2 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c @@ -227,7 +227,7 @@ SND_SOC_DAPM_HP("Headset Jack", NULL), }; /* Corgi machine audio map (connections to the codec pins) */ -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route corgi_audio_map[] = { /* headset Jack - in = micin, out = LHPOUT*/ {"Headset Jack", NULL, "LHPOUT"}, @@ -269,24 +269,10 @@ static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; - int err; snd_soc_dapm_nc_pin(dapm, "LLINEIN"); snd_soc_dapm_nc_pin(dapm, "RLINEIN"); - /* Add corgi specific controls */ - err = snd_soc_add_controls(codec, wm8731_corgi_controls, - ARRAY_SIZE(wm8731_corgi_controls)); - if (err < 0) - return err; - - /* Add corgi specific widgets */ - snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets, - ARRAY_SIZE(wm8731_dapm_widgets)); - - /* Set up corgi specific audio path audio_map */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - return 0; } @@ -310,6 +296,13 @@ static struct snd_soc_card snd_soc_corgi = { .owner = THIS_MODULE, .dai_link = &corgi_dai, .num_links = 1, + + .controls = wm8731_corgi_controls, + .num_controls = ARRAY_SIZE(wm8731_corgi_controls), + .dapm_widgets = wm8731_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets), + .dapm_routes = corgi_audio_map, + .num_dapm_routes = ARRAY_SIZE(corgi_audio_map), }; static struct platform_device *corgi_snd_device; -- cgit v1.1 From 09904b9506e56579282a16ac38d313f2dd08d0f1 Mon Sep 17 00:00:00 2001 From: Li Peng Date: Wed, 28 Dec 2011 15:17:26 +0000 Subject: ALSA: hda_intel: Add Oaktrail identifiers Oaktrail has 0x8086, 0x080a - AZX_DRIVER_SCH Taken from the Meego patches for Oaktrail Signed-off-by: Li Peng Signed-off-by: Alan Cox Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 4045b0c..c6c896b 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2995,6 +2995,9 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { { PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Poulsbo */ + { PCI_DEVICE(0x8086, 0x080a), + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | + AZX_DCAPS_BUFSIZE}, /* ICH */ { PCI_DEVICE(0x8086, 0x2668), .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | -- cgit v1.1 From dcc2cf7507861476c874cc7974e5d4557a32475f Mon Sep 17 00:00:00 2001 From: Tim Yamin Date: Thu, 29 Dec 2011 18:50:56 +0000 Subject: ALSA: emu10k1 - add another Audigy 2 ZS ID 0x20051102 is an Audigy 2 ZS. Signed-off-by: Tim Yamin Signed-off-by: Takashi Iwai --- sound/pci/emu10k1/emu10k1_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sound') diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 6a3e567..7549240 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -1480,6 +1480,18 @@ static struct snd_emu_chip_details emu_chip_details[] = { .spdif_bug = 1, .invert_shared_spdif = 1, /* digital/analog switch swapped */ .ac97_chip = 1} , + /* 0x20051102 also has SB0350 written on it, treated as Audigy 2 ZS by + Creative's Windows driver */ + {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20051102, + .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0350a]", + .id = "Audigy2", + .emu10k2_chip = 1, + .ca0102_chip = 1, + .ca0151_chip = 1, + .spk71 = 1, + .spdif_bug = 1, + .invert_shared_spdif = 1, /* digital/analog switch swapped */ + .ac97_chip = 1} , {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102, .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0350]", .id = "Audigy2", -- cgit v1.1 From 24b6f263d97cd2f1f2d579021af97fcd1d632a98 Mon Sep 17 00:00:00 2001 From: Ashish Chavan Date: Mon, 2 Jan 2012 17:35:52 +0530 Subject: ASoC: da7210: Add support for line input and mic DA7210 has three line inputs (AUX1 Left, AUX1 Right and AUX2) and a stereo MIC. This patch adds gain controls for MIC, AUX1, AUX2 as well as INPGA. Signed-off-by: Ashish Chavan Signed-off-by: David Dajun Chen Signed-off-by: Mark Brown --- sound/soc/codecs/da7210.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index 62e6a9c..ab38e93 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c @@ -181,9 +181,14 @@ /* AUX1_L bit fields */ #define DA7210_AUX1_L_VOL (0x3F << 0) +#define DA7210_AUX1_L_EN (1 << 7) /* AUX1_R bit fields */ #define DA7210_AUX1_R_VOL (0x3F << 0) +#define DA7210_AUX1_R_EN (1 << 7) + +/* AUX2 bit fields */ +#define DA7210_AUX2_EN (1 << 3) /* Minimum INPGA and AUX1 volume to enable noise suppression */ #define DA7210_INPGA_MIN_VOL_NS 0x0A /* 10.5dB */ @@ -234,9 +239,19 @@ static const unsigned int mono_vol_tlv[] = { 0x3, 0x7, TLV_DB_SCALE_ITEM(-1800, 600, 0) }; +static const unsigned int aux1_vol_tlv[] = { + TLV_DB_RANGE_HEAD(2), + 0x0, 0x10, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1), + /* -48dB to 21dB */ + 0x11, 0x3f, TLV_DB_SCALE_ITEM(-4800, 150, 0) +}; + static const DECLARE_TLV_DB_SCALE(eq_gain_tlv, -1050, 150, 0); static const DECLARE_TLV_DB_SCALE(adc_eq_master_gain_tlv, -1800, 600, 1); static const DECLARE_TLV_DB_SCALE(dac_gain_tlv, -7725, 75, 0); +static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, -600, 600, 0); +static const DECLARE_TLV_DB_SCALE(aux2_vol_tlv, -600, 600, 0); +static const DECLARE_TLV_DB_SCALE(inpga_gain_tlv, -450, 150, 0); /* ADC and DAC high pass filter f0 value */ static const char * const da7210_hpf_cutoff_txt[] = { @@ -344,6 +359,17 @@ static const struct snd_kcontrol_new da7210_snd_controls[] = { SOC_SINGLE_TLV("Mono Playback Volume", DA7210_OUT2, 0, 0x7, 0, mono_vol_tlv), + SOC_DOUBLE_R_TLV("Mic Capture Volume", + DA7210_MIC_L, DA7210_MIC_R, + 0, 0x5, 0, mic_vol_tlv), + SOC_DOUBLE_R_TLV("Aux1 Capture Volume", + DA7210_AUX1_L, DA7210_AUX1_R, + 0, 0x3f, 0, aux1_vol_tlv), + SOC_SINGLE_TLV("Aux2 Capture Volume", DA7210_AUX2, 0, 0x3, 0, + aux2_vol_tlv), + SOC_DOUBLE_TLV("In PGA Capture Volume", DA7210_IN_GAIN, 0, 4, 0xF, 0, + inpga_gain_tlv), + /* DAC Equalizer controls */ SOC_SINGLE("DAC EQ Switch", DA7210_DAC_EQ5, 7, 1, 0), SOC_SINGLE_TLV("DAC EQ1 Volume", DA7210_DAC_EQ1_2, 0, 0xf, 1, @@ -421,26 +447,42 @@ static const struct snd_kcontrol_new da7210_snd_controls[] = { static const struct snd_kcontrol_new da7210_dapm_inmixl_controls[] = { SOC_DAPM_SINGLE("Mic Left Switch", DA7210_INMIX_L, 0, 1, 0), SOC_DAPM_SINGLE("Mic Right Switch", DA7210_INMIX_L, 1, 1, 0), + SOC_DAPM_SINGLE("Aux1 Left Switch", DA7210_INMIX_L, 2, 1, 0), + SOC_DAPM_SINGLE("Aux2 Switch", DA7210_INMIX_L, 3, 1, 0), + SOC_DAPM_SINGLE("Outmix Left Switch", DA7210_INMIX_L, 4, 1, 0), }; /* In Mixer Right */ static const struct snd_kcontrol_new da7210_dapm_inmixr_controls[] = { SOC_DAPM_SINGLE("Mic Right Switch", DA7210_INMIX_R, 0, 1, 0), SOC_DAPM_SINGLE("Mic Left Switch", DA7210_INMIX_R, 1, 1, 0), + SOC_DAPM_SINGLE("Aux1 Right Switch", DA7210_INMIX_R, 2, 1, 0), + SOC_DAPM_SINGLE("Aux2 Switch", DA7210_INMIX_R, 3, 1, 0), + SOC_DAPM_SINGLE("Outmix Right Switch", DA7210_INMIX_R, 4, 1, 0), }; /* Out Mixer Left */ static const struct snd_kcontrol_new da7210_dapm_outmixl_controls[] = { + SOC_DAPM_SINGLE("Aux1 Left Switch", DA7210_OUTMIX_L, 0, 1, 0), + SOC_DAPM_SINGLE("Aux2 Switch", DA7210_OUTMIX_L, 1, 1, 0), + SOC_DAPM_SINGLE("INPGA Left Switch", DA7210_OUTMIX_L, 2, 1, 0), + SOC_DAPM_SINGLE("INPGA Right Switch", DA7210_OUTMIX_L, 3, 1, 0), SOC_DAPM_SINGLE("DAC Left Switch", DA7210_OUTMIX_L, 4, 1, 0), }; /* Out Mixer Right */ static const struct snd_kcontrol_new da7210_dapm_outmixr_controls[] = { + SOC_DAPM_SINGLE("Aux1 Right Switch", DA7210_OUTMIX_R, 0, 1, 0), + SOC_DAPM_SINGLE("Aux2 Switch", DA7210_OUTMIX_R, 1, 1, 0), + SOC_DAPM_SINGLE("INPGA Left Switch", DA7210_OUTMIX_R, 2, 1, 0), + SOC_DAPM_SINGLE("INPGA Right Switch", DA7210_OUTMIX_R, 3, 1, 0), SOC_DAPM_SINGLE("DAC Right Switch", DA7210_OUTMIX_R, 4, 1, 0), }; /* Mono Mixer */ static const struct snd_kcontrol_new da7210_dapm_monomix_controls[] = { + SOC_DAPM_SINGLE("INPGA Right Switch", DA7210_OUT2, 3, 1, 0), + SOC_DAPM_SINGLE("INPGA Left Switch", DA7210_OUT2, 4, 1, 0), SOC_DAPM_SINGLE("Outmix Right Switch", DA7210_OUT2, 5, 1, 0), SOC_DAPM_SINGLE("Outmix Left Switch", DA7210_OUT2, 6, 1, 0), }; @@ -451,14 +493,23 @@ static const struct snd_soc_dapm_widget da7210_dapm_widgets[] = { /* Input Lines */ SND_SOC_DAPM_INPUT("MICL"), SND_SOC_DAPM_INPUT("MICR"), + SND_SOC_DAPM_INPUT("AUX1L"), + SND_SOC_DAPM_INPUT("AUX1R"), + SND_SOC_DAPM_INPUT("AUX2"), /* Input PGAs */ SND_SOC_DAPM_PGA("Mic Left", DA7210_STARTUP3, 0, 1, NULL, 0), SND_SOC_DAPM_PGA("Mic Right", DA7210_STARTUP3, 1, 1, NULL, 0), + SND_SOC_DAPM_PGA("Aux1 Left", DA7210_STARTUP3, 2, 1, NULL, 0), + SND_SOC_DAPM_PGA("Aux1 Right", DA7210_STARTUP3, 3, 1, NULL, 0), + SND_SOC_DAPM_PGA("Aux2 Mono", DA7210_STARTUP3, 4, 1, NULL, 0), SND_SOC_DAPM_PGA("INPGA Left", DA7210_INMIX_L, 7, 0, NULL, 0), SND_SOC_DAPM_PGA("INPGA Right", DA7210_INMIX_R, 7, 0, NULL, 0), + /* MICBIAS */ + SND_SOC_DAPM_SUPPLY("Mic Bias", DA7210_MIC_L, 6, 0, NULL, 0), + /* Input Mixers */ SND_SOC_DAPM_MIXER("In Mixer Left", SND_SOC_NOPM, 0, 0, &da7210_dapm_inmixl_controls[0], @@ -514,12 +565,21 @@ static const struct snd_soc_dapm_route da7210_audio_map[] = { /* Input path */ {"Mic Left", NULL, "MICL"}, {"Mic Right", NULL, "MICR"}, + {"Aux1 Left", NULL, "AUX1L"}, + {"Aux1 Right", NULL, "AUX1R"}, + {"Aux2 Mono", NULL, "AUX2"}, {"In Mixer Left", "Mic Left Switch", "Mic Left"}, {"In Mixer Left", "Mic Right Switch", "Mic Right"}, + {"In Mixer Left", "Aux1 Left Switch", "Aux1 Left"}, + {"In Mixer Left", "Aux2 Switch", "Aux2 Mono"}, + {"In Mixer Left", "Outmix Left Switch", "Out Mixer Left"}, {"In Mixer Right", "Mic Right Switch", "Mic Right"}, {"In Mixer Right", "Mic Left Switch", "Mic Left"}, + {"In Mixer Right", "Aux1 Right Switch", "Aux1 Right"}, + {"In Mixer Right", "Aux2 Switch", "Aux2 Mono"}, + {"In Mixer Right", "Outmix Right Switch", "Out Mixer Right"}, {"INPGA Left", NULL, "In Mixer Left"}, {"ADC Left", NULL, "INPGA Left"}, @@ -528,9 +588,20 @@ static const struct snd_soc_dapm_route da7210_audio_map[] = { {"ADC Right", NULL, "INPGA Right"}, /* Output path */ + {"Out Mixer Left", "Aux1 Left Switch", "Aux1 Left"}, + {"Out Mixer Left", "Aux2 Switch", "Aux2 Mono"}, + {"Out Mixer Left", "INPGA Left Switch", "INPGA Left"}, + {"Out Mixer Left", "INPGA Right Switch", "INPGA Right"}, {"Out Mixer Left", "DAC Left Switch", "DAC Left"}, + + {"Out Mixer Right", "Aux1 Right Switch", "Aux1 Right"}, + {"Out Mixer Right", "Aux2 Switch", "Aux2 Mono"}, + {"Out Mixer Right", "INPGA Right Switch", "INPGA Right"}, + {"Out Mixer Right", "INPGA Left Switch", "INPGA Left"}, {"Out Mixer Right", "DAC Right Switch", "DAC Right"}, + {"Mono Mixer", "INPGA Right Switch", "INPGA Right"}, + {"Mono Mixer", "INPGA Left Switch", "INPGA Left"}, {"Mono Mixer", "Outmix Right Switch", "Out Mixer Right"}, {"Mono Mixer", "Outmix Left Switch", "Out Mixer Left"}, @@ -887,6 +958,12 @@ static int da7210_probe(struct snd_soc_codec *codec) snd_soc_write(codec, DA7210_OUT2, DA7210_OUT2_EN | DA7210_OUT2_OUTMIX_L | DA7210_OUT2_OUTMIX_R); + /* Enable Aux1 */ + snd_soc_write(codec, DA7210_AUX1_L, DA7210_AUX1_L_EN); + snd_soc_write(codec, DA7210_AUX1_R, DA7210_AUX1_R_EN); + /* Enable Aux2 */ + snd_soc_write(codec, DA7210_AUX2, DA7210_AUX2_EN); + /* Diable PLL and bypass it */ snd_soc_write(codec, DA7210_PLL, DA7210_PLL_FS_48000); -- cgit v1.1 From 021b918efb204b1deda7cfc7edef2972d98ffc46 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 12:00:13 +0800 Subject: ASoC: Convert cs42l51 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l51.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index ffce9f2..a8bf588 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c @@ -577,7 +577,8 @@ static int cs42l51_i2c_probe(struct i2c_client *i2c_client, dev_info(&i2c_client->dev, "found device cs42l51 rev %d\n", ret & 7); - cs42l51 = kzalloc(sizeof(struct cs42l51_private), GFP_KERNEL); + cs42l51 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l51_private), + GFP_KERNEL); if (!cs42l51) { dev_err(&i2c_client->dev, "could not allocate codec\n"); return -ENOMEM; @@ -588,18 +589,13 @@ static int cs42l51_i2c_probe(struct i2c_client *i2c_client, ret = snd_soc_register_codec(&i2c_client->dev, &soc_codec_device_cs42l51, &cs42l51_dai, 1); - if (ret < 0) - kfree(cs42l51); error: return ret; } static int cs42l51_i2c_remove(struct i2c_client *client) { - struct cs42l51_private *cs42l51 = i2c_get_clientdata(client); - snd_soc_unregister_codec(&client->dev); - kfree(cs42l51); return 0; } -- cgit v1.1 From 49ba7673243013103bde4706c506bda2c631a39b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 12:01:07 +0800 Subject: ASoC: Convert max98088 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/max98088.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index ba4f6f1..006efcf 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c @@ -2069,7 +2069,8 @@ static int max98088_i2c_probe(struct i2c_client *i2c, struct max98088_priv *max98088; int ret; - max98088 = kzalloc(sizeof(struct max98088_priv), GFP_KERNEL); + max98088 = devm_kzalloc(&i2c->dev, sizeof(struct max98088_priv), + GFP_KERNEL); if (max98088 == NULL) return -ENOMEM; @@ -2080,15 +2081,12 @@ static int max98088_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_max98088, &max98088_dai[0], 2); - if (ret < 0) - kfree(max98088); return ret; } static int __devexit max98088_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From b1b548824ba7e182424da6e4655c1904be7dc6fa Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 12:02:21 +0800 Subject: ASoC: Convert max98095 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/max98095.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c index c69dd02..fcfa749 100644 --- a/sound/soc/codecs/max98095.c +++ b/sound/soc/codecs/max98095.c @@ -2340,7 +2340,8 @@ static int max98095_i2c_probe(struct i2c_client *i2c, struct max98095_priv *max98095; int ret; - max98095 = kzalloc(sizeof(struct max98095_priv), GFP_KERNEL); + max98095 = devm_kzalloc(&i2c->dev, sizeof(struct max98095_priv), + GFP_KERNEL); if (max98095 == NULL) return -ENOMEM; @@ -2350,16 +2351,12 @@ static int max98095_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_max98095, max98095_dai, ARRAY_SIZE(max98095_dai)); - if (ret < 0) - kfree(max98095); return ret; } static int __devexit max98095_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); - return 0; } -- cgit v1.1 From bf791bdb383fdf159c2282d958682b92a2601170 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 12:03:16 +0800 Subject: ASoC: Convert max9850 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/max9850.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/max9850.c b/sound/soc/codecs/max9850.c index 47060d2..a191309 100644 --- a/sound/soc/codecs/max9850.c +++ b/sound/soc/codecs/max9850.c @@ -335,7 +335,8 @@ static int __devinit max9850_i2c_probe(struct i2c_client *i2c, struct max9850_priv *max9850; int ret; - max9850 = kzalloc(sizeof(struct max9850_priv), GFP_KERNEL); + max9850 = devm_kzalloc(&i2c->dev, sizeof(struct max9850_priv), + GFP_KERNEL); if (max9850 == NULL) return -ENOMEM; @@ -343,15 +344,12 @@ static int __devinit max9850_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_max9850, &max9850_dai, 1); - if (ret < 0) - kfree(max9850); return ret; } static __devexit int max9850_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From a92b0a0803a40f91689fa479b7a169d0467ba33f Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 12:04:15 +0800 Subject: ASoC: Convert rt5631 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/rt5631.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index f6e4f5e..20c324c 100644 --- a/sound/soc/codecs/rt5631.c +++ b/sound/soc/codecs/rt5631.c @@ -1724,7 +1724,8 @@ static int rt5631_i2c_probe(struct i2c_client *i2c, struct rt5631_priv *rt5631; int ret; - rt5631 = kzalloc(sizeof(struct rt5631_priv), GFP_KERNEL); + rt5631 = devm_kzalloc(&i2c->dev, sizeof(struct rt5631_priv), + GFP_KERNEL); if (NULL == rt5631) return -ENOMEM; @@ -1732,16 +1733,12 @@ static int rt5631_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5631, rt5631_dai, ARRAY_SIZE(rt5631_dai)); - if (ret < 0) - kfree(rt5631); - return ret; } static __devexit int rt5631_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From 8eeffe9891dbb74aedcb9a82da4733961d7b432f Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 12:05:20 +0800 Subject: ASoC: Convert ssm2602 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/ssm2602.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index 7dfc7b0..333dd98 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c @@ -652,7 +652,8 @@ static int __devinit ssm2602_spi_probe(struct spi_device *spi) struct ssm2602_priv *ssm2602; int ret; - ssm2602 = kzalloc(sizeof(struct ssm2602_priv), GFP_KERNEL); + ssm2602 = devm_kzalloc(&spi->dev, sizeof(struct ssm2602_priv), + GFP_KERNEL); if (ssm2602 == NULL) return -ENOMEM; @@ -662,15 +663,12 @@ static int __devinit ssm2602_spi_probe(struct spi_device *spi) ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_ssm2602, &ssm2602_dai, 1); - if (ret < 0) - kfree(ssm2602); return ret; } static int __devexit ssm2602_spi_remove(struct spi_device *spi) { snd_soc_unregister_codec(&spi->dev); - kfree(spi_get_drvdata(spi)); return 0; } @@ -697,7 +695,8 @@ static int __devinit ssm2602_i2c_probe(struct i2c_client *i2c, struct ssm2602_priv *ssm2602; int ret; - ssm2602 = kzalloc(sizeof(struct ssm2602_priv), GFP_KERNEL); + ssm2602 = devm_kzalloc(&i2c->dev, sizeof(struct ssm2602_priv), + GFP_KERNEL); if (ssm2602 == NULL) return -ENOMEM; @@ -707,15 +706,12 @@ static int __devinit ssm2602_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ssm2602, &ssm2602_dai, 1); - if (ret < 0) - kfree(ssm2602); return ret; } static int __devexit ssm2602_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From d999c021b64289b571e5d295deade44e40cbcc4f Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 12:06:39 +0800 Subject: ASoC: Convert sta32x to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/sta32x.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index 6648af6..fbd1450 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -968,28 +968,23 @@ static __devinit int sta32x_i2c_probe(struct i2c_client *i2c, struct sta32x_priv *sta32x; int ret; - sta32x = kzalloc(sizeof(struct sta32x_priv), GFP_KERNEL); + sta32x = devm_kzalloc(&i2c->dev, sizeof(struct sta32x_priv), + GFP_KERNEL); if (!sta32x) return -ENOMEM; i2c_set_clientdata(i2c, sta32x); ret = snd_soc_register_codec(&i2c->dev, &sta32x_codec, &sta32x_dai, 1); - if (ret != 0) { + if (ret != 0) dev_err(&i2c->dev, "Failed to register codec (%d)\n", ret); - kfree(sta32x); - return ret; - } - return 0; + return ret; } static __devexit int sta32x_i2c_remove(struct i2c_client *client) { - struct sta32x_priv *sta32x = i2c_get_clientdata(client); - snd_soc_unregister_codec(&client->dev); - kfree(sta32x); return 0; } -- cgit v1.1 From 099830608a04a7194d00228084bb08130f761084 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 12:07:30 +0800 Subject: ASoC: Convert tlv320aic23 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/tlv320aic23.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index 60d08ae..dfa41a9 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c @@ -634,7 +634,7 @@ static int tlv320aic23_codec_probe(struct i2c_client *i2c, if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EINVAL; - aic23 = kzalloc(sizeof(struct aic23), GFP_KERNEL); + aic23 = devm_kzalloc(&i2c->dev, sizeof(struct aic23), GFP_KERNEL); if (aic23 == NULL) return -ENOMEM; @@ -643,14 +643,11 @@ static int tlv320aic23_codec_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_tlv320aic23, &tlv320aic23_dai, 1); - if (ret < 0) - kfree(aic23); return ret; } static int __exit tlv320aic23_i2c_remove(struct i2c_client *i2c) { snd_soc_unregister_codec(&i2c->dev); - kfree(i2c_get_clientdata(i2c)); return 0; } -- cgit v1.1 From a8163023d29c1439a2447f5203694bef3ed1c61c Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 12:08:36 +0800 Subject: ASoC: Convert tlv320aic26 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/tlv320aic26.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c index 86d1fa3..a038dae 100644 --- a/sound/soc/codecs/tlv320aic26.c +++ b/sound/soc/codecs/tlv320aic26.c @@ -416,7 +416,7 @@ static int aic26_spi_probe(struct spi_device *spi) dev_dbg(&spi->dev, "probing tlv320aic26 spi device\n"); /* Allocate driver data */ - aic26 = kzalloc(sizeof *aic26, GFP_KERNEL); + aic26 = devm_kzalloc(&spi->dev, sizeof *aic26, GFP_KERNEL); if (!aic26) return -ENOMEM; @@ -427,18 +427,12 @@ static int aic26_spi_probe(struct spi_device *spi) ret = snd_soc_register_codec(&spi->dev, &aic26_soc_codec_dev, &aic26_dai, 1); - if (ret < 0) - kfree(aic26); return ret; - - dev_dbg(&spi->dev, "SPI device initialized\n"); - return 0; } static int aic26_spi_remove(struct spi_device *spi) { snd_soc_unregister_codec(&spi->dev); - kfree(spi_get_drvdata(spi)); return 0; } -- cgit v1.1 From e2257db325e8031a149c0f8e3f228d02d08ae578 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 12:10:04 +0800 Subject: ASoC: Convert tlv320aic3x to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/tlv320aic3x.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 6f963c5..492f22f 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c @@ -1504,7 +1504,7 @@ static int aic3x_i2c_probe(struct i2c_client *i2c, struct aic3x_priv *aic3x; int ret; - aic3x = kzalloc(sizeof(struct aic3x_priv), GFP_KERNEL); + aic3x = devm_kzalloc(&i2c->dev, sizeof(struct aic3x_priv), GFP_KERNEL); if (aic3x == NULL) { dev_err(&i2c->dev, "failed to create private data\n"); return -ENOMEM; @@ -1524,15 +1524,12 @@ static int aic3x_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_aic3x, &aic3x_dai, 1); - if (ret < 0) - kfree(aic3x); return ret; } static int aic3x_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - kfree(i2c_get_clientdata(client)); return 0; } -- cgit v1.1 From 360b70ca5e4668c9b9e24d8b200e7069bec83b4e Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 11:56:23 +0800 Subject: ASoC: Convert alc5623 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/alc5623.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c index 6a9b621..3feee56 100644 --- a/sound/soc/codecs/alc5623.c +++ b/sound/soc/codecs/alc5623.c @@ -1022,7 +1022,8 @@ static int alc5623_i2c_probe(struct i2c_client *client, dev_dbg(&client->dev, "Found codec id : alc56%02x\n", vid2); - alc5623 = kzalloc(sizeof(struct alc5623_priv), GFP_KERNEL); + alc5623 = devm_kzalloc(&client->dev, sizeof(struct alc5623_priv), + GFP_KERNEL); if (alc5623 == NULL) return -ENOMEM; @@ -1044,7 +1045,6 @@ static int alc5623_i2c_probe(struct i2c_client *client, alc5623_dai.name = "alc5623-hifi"; break; default: - kfree(alc5623); return -EINVAL; } @@ -1053,20 +1053,15 @@ static int alc5623_i2c_probe(struct i2c_client *client, ret = snd_soc_register_codec(&client->dev, &soc_codec_device_alc5623, &alc5623_dai, 1); - if (ret != 0) { + if (ret != 0) dev_err(&client->dev, "Failed to register codec: %d\n", ret); - kfree(alc5623); - } return ret; } static int alc5623_i2c_remove(struct i2c_client *client) { - struct alc5623_priv *alc5623 = i2c_get_clientdata(client); - snd_soc_unregister_codec(&client->dev); - kfree(alc5623); return 0; } -- cgit v1.1 From 7fd8a67446aded9d25e0ae1d94d19105f1620af5 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 11:58:22 +0800 Subject: ASoC: Convert cs4270 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/cs4270.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index fef0f48..0555366 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c @@ -671,7 +671,8 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client, i2c_client->addr); dev_info(&i2c_client->dev, "hardware revision %X\n", ret & 0xF); - cs4270 = kzalloc(sizeof(struct cs4270_private), GFP_KERNEL); + cs4270 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs4270_private), + GFP_KERNEL); if (!cs4270) { dev_err(&i2c_client->dev, "could not allocate codec\n"); return -ENOMEM; @@ -682,8 +683,6 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client, ret = snd_soc_register_codec(&i2c_client->dev, &soc_codec_device_cs4270, &cs4270_dai, 1); - if (ret < 0) - kfree(cs4270); return ret; } @@ -696,7 +695,6 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client, static int cs4270_i2c_remove(struct i2c_client *i2c_client) { snd_soc_unregister_codec(&i2c_client->dev); - kfree(i2c_get_clientdata(i2c_client)); return 0; } -- cgit v1.1 From a54877d7456ffa88c95d7eb587971792cb1892d6 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 12:11:00 +0800 Subject: ASoC: Convert tlv320dac33 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/tlv320dac33.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index c7a61fb..f0aad26 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c @@ -1532,7 +1532,8 @@ static int __devinit dac33_i2c_probe(struct i2c_client *client, } pdata = client->dev.platform_data; - dac33 = kzalloc(sizeof(struct tlv320dac33_priv), GFP_KERNEL); + dac33 = devm_kzalloc(&client->dev, sizeof(struct tlv320dac33_priv), + GFP_KERNEL); if (dac33 == NULL) return -ENOMEM; @@ -1587,7 +1588,6 @@ err_get: if (dac33->power_gpio >= 0) gpio_free(dac33->power_gpio); err_gpio: - kfree(dac33); return ret; } @@ -1604,8 +1604,6 @@ static int __devexit dac33_i2c_remove(struct i2c_client *client) regulator_bulk_free(ARRAY_SIZE(dac33->supplies), dac33->supplies); snd_soc_unregister_codec(&client->dev); - kfree(dac33); - return 0; } -- cgit v1.1 From 6945e9f9dfee897891a8ac620ce1621a2daf7e02 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 29 Dec 2011 12:12:29 +0800 Subject: ASoC: Convert tpa6130a2 to devm_kzalloc() Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/tpa6130a2.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 7eeca79..363b99d 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c @@ -376,7 +376,7 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client, return -ENODEV; } - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); if (data == NULL) { dev_err(dev, "Can not allocate memory\n"); return -ENOMEM; @@ -450,7 +450,6 @@ err_regulator: if (data->power_gpio >= 0) gpio_free(data->power_gpio); err_gpio: - kfree(data); tpa6130a2_client = NULL; return ret; @@ -466,8 +465,6 @@ static int __devexit tpa6130a2_remove(struct i2c_client *client) gpio_free(data->power_gpio); regulator_put(data->supply); - - kfree(data); tpa6130a2_client = NULL; return 0; -- cgit v1.1 From a3bb8f3f818667872728085497b3a3ab3caba371 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 29 Dec 2011 17:51:20 +0100 Subject: ASoC: davinci-vcif.c: use devm_ functions The various devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_kzalloc, devm_request_mem_region and devm_ioremap for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia Lawall Signed-off-by: Mark Brown --- sound/soc/davinci/davinci-vcif.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/soc/davinci/davinci-vcif.c b/sound/soc/davinci/davinci-vcif.c index 70ce10c..da030ff 100644 --- a/sound/soc/davinci/davinci-vcif.c +++ b/sound/soc/davinci/davinci-vcif.c @@ -210,7 +210,9 @@ static int davinci_vcif_probe(struct platform_device *pdev) struct davinci_vcif_dev *davinci_vcif_dev; int ret; - davinci_vcif_dev = kzalloc(sizeof(struct davinci_vcif_dev), GFP_KERNEL); + davinci_vcif_dev = devm_kzalloc(&pdev->dev, + sizeof(struct davinci_vcif_dev), + GFP_KERNEL); if (!davinci_vcif_dev) { dev_dbg(&pdev->dev, "could not allocate memory for private data\n"); @@ -235,23 +237,15 @@ static int davinci_vcif_probe(struct platform_device *pdev) ret = snd_soc_register_dai(&pdev->dev, &davinci_vcif_dai); if (ret != 0) { dev_err(&pdev->dev, "could not register dai\n"); - goto fail; + return ret; } return 0; - -fail: - kfree(davinci_vcif_dev); - - return ret; } static int davinci_vcif_remove(struct platform_device *pdev) { - struct davinci_vcif_dev *davinci_vcif_dev = dev_get_drvdata(&pdev->dev); - snd_soc_unregister_dai(&pdev->dev); - kfree(davinci_vcif_dev); return 0; } -- cgit v1.1 From 96d31e2b128e2adc7c4907e259a2d58b2f5edb32 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 29 Dec 2011 17:51:21 +0100 Subject: ASoC: davinci-mcasp.c: use devm_ functions The various devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_kzalloc, devm_request_mem_region and devm_ioremap for data that is allocated in the probe function of a platform device and is only freed in the remove function. In this case, the original code did not contain a call to iounmap, nor does one appear anywhere else in the file. I have assumed that it is safe to use devm_ioremap for the allocation in any case. Signed-off-by: Julia Lawall Signed-off-by: Mark Brown --- sound/soc/davinci/davinci-mcasp.c | 40 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) (limited to 'sound') diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 2152ff5..95441bf 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -865,38 +865,35 @@ static int davinci_mcasp_probe(struct platform_device *pdev) struct resource *mem, *ioarea, *res; struct snd_platform_data *pdata; struct davinci_audio_dev *dev; - int ret = 0; + int ret; - dev = kzalloc(sizeof(struct davinci_audio_dev), GFP_KERNEL); + dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_audio_dev), + GFP_KERNEL); if (!dev) return -ENOMEM; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(&pdev->dev, "no mem resource?\n"); - ret = -ENODEV; - goto err_release_data; + return -ENODEV; } - ioarea = request_mem_region(mem->start, + ioarea = devm_request_mem_region(&pdev->dev, mem->start, resource_size(mem), pdev->name); if (!ioarea) { dev_err(&pdev->dev, "Audio region already claimed\n"); - ret = -EBUSY; - goto err_release_data; + return -EBUSY; } pdata = pdev->dev.platform_data; dev->clk = clk_get(&pdev->dev, NULL); - if (IS_ERR(dev->clk)) { - ret = -ENODEV; - goto err_release_region; - } + if (IS_ERR(dev->clk)) + return -ENODEV; clk_enable(dev->clk); dev->clk_active = 1; - dev->base = ioremap(mem->start, resource_size(mem)); + dev->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); if (!dev->base) { dev_err(&pdev->dev, "ioremap failed\n"); ret = -ENOMEM; @@ -924,7 +921,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) if (!res) { dev_err(&pdev->dev, "no DMA resource\n"); ret = -ENODEV; - goto err_iounmap; + goto err_release_clk; } dma_data->channel = res->start; @@ -940,7 +937,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev) if (!res) { dev_err(&pdev->dev, "no DMA resource\n"); ret = -ENODEV; - goto err_iounmap; + goto err_release_clk; } dma_data->channel = res->start; @@ -948,37 +945,24 @@ static int davinci_mcasp_probe(struct platform_device *pdev) ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]); if (ret != 0) - goto err_iounmap; + goto err_release_clk; return 0; -err_iounmap: - iounmap(dev->base); err_release_clk: clk_disable(dev->clk); clk_put(dev->clk); -err_release_region: - release_mem_region(mem->start, resource_size(mem)); -err_release_data: - kfree(dev); - return ret; } static int davinci_mcasp_remove(struct platform_device *pdev) { struct davinci_audio_dev *dev = dev_get_drvdata(&pdev->dev); - struct resource *mem; snd_soc_unregister_dai(&pdev->dev); clk_disable(dev->clk); clk_put(dev->clk); dev->clk = NULL; - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(mem->start, resource_size(mem)); - - kfree(dev); - return 0; } -- cgit v1.1 From cd0ff7eff08e7daeba278cf58392aac519edff60 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 29 Dec 2011 17:51:22 +0100 Subject: ASoC: davinci-i2s.c: use devm_ functions The various devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_kzalloc, devm_request_mem_region and devm_ioremap for data that is allocated in the probe function of a platform device and is only freed in the remove function. In this case, the original code did not contain a call to iounmap, nor does one appear anywhere else in the file. I have assumed that it is safe to use devm_ioremap for the allocation in any case. Signed-off-by: Julia Lawall Signed-off-by: Mark Brown --- sound/soc/davinci/davinci-i2s.c | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) (limited to 'sound') diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index ec18710..0a74b95 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c @@ -661,18 +661,18 @@ static int davinci_i2s_probe(struct platform_device *pdev) return -ENODEV; } - ioarea = request_mem_region(mem->start, resource_size(mem), - pdev->name); + ioarea = devm_request_mem_region(&pdev->dev, mem->start, + resource_size(mem), + pdev->name); if (!ioarea) { dev_err(&pdev->dev, "McBSP region already claimed\n"); return -EBUSY; } - dev = kzalloc(sizeof(struct davinci_mcbsp_dev), GFP_KERNEL); - if (!dev) { - ret = -ENOMEM; - goto err_release_region; - } + dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_mcbsp_dev), + GFP_KERNEL); + if (!dev) + return -ENOMEM; if (pdata) { dev->enable_channel_combine = pdata->enable_channel_combine; dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].sram_size = @@ -691,13 +691,11 @@ static int davinci_i2s_probe(struct platform_device *pdev) dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].ram_chan_q = ram_chan_q; dev->clk = clk_get(&pdev->dev, NULL); - if (IS_ERR(dev->clk)) { - ret = -ENODEV; - goto err_free_mem; - } + if (IS_ERR(dev->clk)) + return -ENODEV; clk_enable(dev->clk); - dev->base = ioremap(mem->start, resource_size(mem)); + dev->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); if (!dev->base) { dev_err(&pdev->dev, "ioremap failed\n"); ret = -ENOMEM; @@ -715,7 +713,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) if (!res) { dev_err(&pdev->dev, "no DMA resource\n"); ret = -ENXIO; - goto err_iounmap; + goto err_release_clk; } dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start; @@ -723,7 +721,7 @@ static int davinci_i2s_probe(struct platform_device *pdev) if (!res) { dev_err(&pdev->dev, "no DMA resource\n"); ret = -ENXIO; - goto err_iounmap; + goto err_release_clk; } dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; dev->dev = &pdev->dev; @@ -732,35 +730,24 @@ static int davinci_i2s_probe(struct platform_device *pdev) ret = snd_soc_register_dai(&pdev->dev, &davinci_i2s_dai); if (ret != 0) - goto err_iounmap; + goto err_release_clk; return 0; -err_iounmap: - iounmap(dev->base); err_release_clk: clk_disable(dev->clk); clk_put(dev->clk); -err_free_mem: - kfree(dev); -err_release_region: - release_mem_region(mem->start, resource_size(mem)); - return ret; } static int davinci_i2s_remove(struct platform_device *pdev) { struct davinci_mcbsp_dev *dev = dev_get_drvdata(&pdev->dev); - struct resource *mem; snd_soc_unregister_dai(&pdev->dev); clk_disable(dev->clk); clk_put(dev->clk); dev->clk = NULL; - kfree(dev); - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - release_mem_region(mem->start, resource_size(mem)); return 0; } -- cgit v1.1 From aa4079c110133e5ed86895a07bffb20dd20ed40e Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 29 Dec 2011 17:51:24 +0100 Subject: ASoC: psc-i2s.c: use devm_ functions The various devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_kzalloc, devm_request_mem_region and devm_ioremap for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia Lawall Signed-off-by: Mark Brown --- sound/soc/au1x/psc-i2s.c | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) (limited to 'sound') diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c index 5c1dc8a..0607ba3 100644 --- a/sound/soc/au1x/psc-i2s.c +++ b/sound/soc/au1x/psc-i2s.c @@ -295,33 +295,34 @@ static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev) int ret; struct au1xpsc_audio_data *wd; - wd = kzalloc(sizeof(struct au1xpsc_audio_data), GFP_KERNEL); + wd = devm_kzalloc(&pdev->dev, sizeof(struct au1xpsc_audio_data), + GFP_KERNEL); if (!wd) return -ENOMEM; iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!iores) { - ret = -ENODEV; - goto out0; - } + if (!iores) + return -ENODEV; ret = -EBUSY; - if (!request_mem_region(iores->start, resource_size(iores), - pdev->name)) - goto out0; + if (!devm_request_mem_region(&pdev->dev, iores->start, + resource_size(iores), + pdev->name)) + return -EBUSY; - wd->mmio = ioremap(iores->start, resource_size(iores)); + wd->mmio = devm_ioremap(&pdev->dev, iores->start, + resource_size(iores)); if (!wd->mmio) - goto out1; + return -EBUSY; dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); if (!dmares) - goto out2; + return -EBUSY; wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start; dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!dmares) - goto out2; + return -EBUSY; wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start; /* preserve PSC clock source set up by platform (dev.platform_data @@ -349,23 +350,12 @@ static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev) platform_set_drvdata(pdev, wd); - ret = snd_soc_register_dai(&pdev->dev, &wd->dai_drv); - if (!ret) - return 0; - -out2: - iounmap(wd->mmio); -out1: - release_mem_region(iores->start, resource_size(iores)); -out0: - kfree(wd); - return ret; + return snd_soc_register_dai(&pdev->dev, &wd->dai_drv); } static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev) { struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); - struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); snd_soc_unregister_dai(&pdev->dev); @@ -374,10 +364,6 @@ static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev) au_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd)); au_sync(); - iounmap(wd->mmio); - release_mem_region(r->start, resource_size(r)); - kfree(wd); - return 0; } -- cgit v1.1 From 8d9626d72833bf68791e4cf9ac151c96c44c0f87 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 29 Dec 2011 17:51:25 +0100 Subject: ASoC: psc-ac97.c: use devm_ functions The various devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_kzalloc, devm_request_mem_region and devm_ioremap for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia Lawall Signed-off-by: Mark Brown --- sound/soc/au1x/psc-ac97.c | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) (limited to 'sound') diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c index 87daf45..476b79a 100644 --- a/sound/soc/au1x/psc-ac97.c +++ b/sound/soc/au1x/psc-ac97.c @@ -368,35 +368,35 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev) unsigned long sel; struct au1xpsc_audio_data *wd; - wd = kzalloc(sizeof(struct au1xpsc_audio_data), GFP_KERNEL); + wd = devm_kzalloc(&pdev->dev, sizeof(struct au1xpsc_audio_data), + GFP_KERNEL); if (!wd) return -ENOMEM; mutex_init(&wd->lock); iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!iores) { - ret = -ENODEV; - goto out0; - } + if (!iores) + return -ENODEV; - ret = -EBUSY; - if (!request_mem_region(iores->start, resource_size(iores), - pdev->name)) - goto out0; + if (!devm_request_mem_region(&pdev->dev, iores->start, + resource_size(iores), + pdev->name)) + return -EBUSY; - wd->mmio = ioremap(iores->start, resource_size(iores)); + wd->mmio = devm_ioremap(&pdev->dev, iores->start, + resource_size(iores)); if (!wd->mmio) - goto out1; + return -EBUSY; dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); if (!dmares) - goto out2; + return -EBUSY; wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start; dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!dmares) - goto out2; + return -EBUSY; wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start; /* configuration: max dma trigger threshold, enable ac97 */ @@ -421,24 +421,15 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev) ret = snd_soc_register_dai(&pdev->dev, &wd->dai_drv); if (ret) - goto out2; + return ret; au1xpsc_ac97_workdata = wd; return 0; - -out2: - iounmap(wd->mmio); -out1: - release_mem_region(iores->start, resource_size(iores)); -out0: - kfree(wd); - return ret; } static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev) { struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); - struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); snd_soc_unregister_dai(&pdev->dev); @@ -448,10 +439,6 @@ static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev) au_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd)); au_sync(); - iounmap(wd->mmio); - release_mem_region(r->start, resource_size(r)); - kfree(wd); - au1xpsc_ac97_workdata = NULL; /* MDEV */ return 0; -- cgit v1.1 From 6d8955262ab4cbfcb3ddaca4f978d27d9c088a75 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 29 Dec 2011 17:51:26 +0100 Subject: ASoC: i2sc.c: use devm_ functions The various devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_kzalloc, devm_request_mem_region and devm_ioremap for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia Lawall Signed-off-by: Mark Brown --- sound/soc/au1x/i2sc.c | 45 +++++++++++++-------------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) (limited to 'sound') diff --git a/sound/soc/au1x/i2sc.c b/sound/soc/au1x/i2sc.c index cb53ad8..d4b9e36 100644 --- a/sound/soc/au1x/i2sc.c +++ b/sound/soc/au1x/i2sc.c @@ -227,69 +227,50 @@ static struct snd_soc_dai_driver au1xi2s_dai_driver = { static int __devinit au1xi2s_drvprobe(struct platform_device *pdev) { - int ret; struct resource *iores, *dmares; struct au1xpsc_audio_data *ctx; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM; iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!iores) { - ret = -ENODEV; - goto out0; - } + if (!iores) + return -ENODEV; - ret = -EBUSY; - if (!request_mem_region(iores->start, resource_size(iores), - pdev->name)) - goto out0; + if (!devm_request_mem_region(&pdev->dev, iores->start, + resource_size(iores), + pdev->name)) + return -EBUSY; - ctx->mmio = ioremap_nocache(iores->start, resource_size(iores)); + ctx->mmio = devm_ioremap_nocache(&pdev->dev, iores->start, + resource_size(iores)); if (!ctx->mmio) - goto out1; + return -EBUSY; dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); if (!dmares) - goto out2; + return -EBUSY; ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start; dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!dmares) - goto out2; + return -EBUSY; ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start; platform_set_drvdata(pdev, ctx); - ret = snd_soc_register_dai(&pdev->dev, &au1xi2s_dai_driver); - if (ret) - goto out2; - - return 0; - -out2: - iounmap(ctx->mmio); -out1: - release_mem_region(iores->start, resource_size(iores)); -out0: - kfree(ctx); - return ret; + return snd_soc_register_dai(&pdev->dev, &au1xi2s_dai_driver); } static int __devexit au1xi2s_drvremove(struct platform_device *pdev) { struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev); - struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); snd_soc_unregister_dai(&pdev->dev); WR(ctx, I2S_ENABLE, EN_D); /* clock off, disable */ - iounmap(ctx->mmio); - release_mem_region(r->start, resource_size(r)); - kfree(ctx); - return 0; } -- cgit v1.1 From 46c3a02cc93083cb946872896428798cfb8609c0 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 29 Dec 2011 17:51:27 +0100 Subject: ASoC: dma.c: use devm_ functions The various devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_kzalloc, devm_request_mem_region and devm_ioremap for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia Lawall Signed-off-by: Mark Brown --- sound/soc/au1x/dma.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/soc/au1x/dma.c b/sound/soc/au1x/dma.c index c4017bd..0a91b18 100644 --- a/sound/soc/au1x/dma.c +++ b/sound/soc/au1x/dma.c @@ -325,27 +325,19 @@ static struct snd_soc_platform_driver alchemy_pcm_soc_platform = { static int __devinit alchemy_pcm_drvprobe(struct platform_device *pdev) { struct alchemy_pcm_ctx *ctx; - int ret; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM; platform_set_drvdata(pdev, ctx); - ret = snd_soc_register_platform(&pdev->dev, &alchemy_pcm_soc_platform); - if (ret) - kfree(ctx); - - return ret; + return snd_soc_register_platform(&pdev->dev, &alchemy_pcm_soc_platform); } static int __devexit alchemy_pcm_drvremove(struct platform_device *pdev) { - struct alchemy_pcm_ctx *ctx = platform_get_drvdata(pdev); - snd_soc_unregister_platform(&pdev->dev); - kfree(ctx); return 0; } -- cgit v1.1 From be547dd1727fce22ec001006ea4da169df32b6c6 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 29 Dec 2011 17:51:28 +0100 Subject: ASoC: dbdma2.c: use devm_ functions The various devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_kzalloc, devm_request_mem_region and devm_ioremap for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia Lawall Signed-off-by: Mark Brown --- sound/soc/au1x/dbdma2.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c index 92bc1b0..8372cd3 100644 --- a/sound/soc/au1x/dbdma2.c +++ b/sound/soc/au1x/dbdma2.c @@ -350,27 +350,21 @@ static struct snd_soc_platform_driver au1xpsc_soc_platform = { static int __devinit au1xpsc_pcm_drvprobe(struct platform_device *pdev) { struct au1xpsc_audio_dmadata *dmadata; - int ret; - dmadata = kzalloc(2 * sizeof(struct au1xpsc_audio_dmadata), GFP_KERNEL); + dmadata = devm_kzalloc(&pdev->dev, + 2 * sizeof(struct au1xpsc_audio_dmadata), + GFP_KERNEL); if (!dmadata) return -ENOMEM; platform_set_drvdata(pdev, dmadata); - ret = snd_soc_register_platform(&pdev->dev, &au1xpsc_soc_platform); - if (ret) - kfree(dmadata); - - return ret; + return snd_soc_register_platform(&pdev->dev, &au1xpsc_soc_platform); } static int __devexit au1xpsc_pcm_drvremove(struct platform_device *pdev) { - struct au1xpsc_audio_dmadata *dmadata = platform_get_drvdata(pdev); - snd_soc_unregister_platform(&pdev->dev); - kfree(dmadata); return 0; } -- cgit v1.1 From 6065abf5ce8ba0ad945d21255a1d581ca30f2e18 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 29 Dec 2011 17:51:29 +0100 Subject: ASoC: ac97c.c: use devm_ functions The various devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_kzalloc, devm_request_mem_region and devm_ioremap for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia Lawall Signed-off-by: Mark Brown --- sound/soc/au1x/ac97c.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) (limited to 'sound') diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c index 7771934..c5ac244 100644 --- a/sound/soc/au1x/ac97c.c +++ b/sound/soc/au1x/ac97c.c @@ -229,35 +229,34 @@ static int __devinit au1xac97c_drvprobe(struct platform_device *pdev) struct resource *iores, *dmares; struct au1xpsc_audio_data *ctx; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM; mutex_init(&ctx->lock); iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!iores) { - ret = -ENODEV; - goto out0; - } + if (!iores) + return -ENODEV; - ret = -EBUSY; - if (!request_mem_region(iores->start, resource_size(iores), - pdev->name)) - goto out0; + if (!devm_request_mem_region(&pdev->dev, iores->start, + resource_size(iores), + pdev->name)) + return -EBUSY; - ctx->mmio = ioremap_nocache(iores->start, resource_size(iores)); + ctx->mmio = devm_ioremap_nocache(&pdev->dev, iores->start, + resource_size(iores)); if (!ctx->mmio) - goto out1; + return -EBUSY; dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); if (!dmares) - goto out2; + return -EBUSY; ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start; dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!dmares) - goto out2; + return -EBUSY; ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start; /* switch it on */ @@ -271,33 +270,20 @@ static int __devinit au1xac97c_drvprobe(struct platform_device *pdev) ret = snd_soc_register_dai(&pdev->dev, &au1xac97c_dai_driver); if (ret) - goto out2; + return ret; ac97c_workdata = ctx; return 0; - -out2: - iounmap(ctx->mmio); -out1: - release_mem_region(iores->start, resource_size(iores)); -out0: - kfree(ctx); - return ret; } static int __devexit au1xac97c_drvremove(struct platform_device *pdev) { struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev); - struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); snd_soc_unregister_dai(&pdev->dev); WR(ctx, AC97_ENABLE, EN_D); /* clock off, disable */ - iounmap(ctx->mmio); - release_mem_region(r->start, resource_size(r)); - kfree(ctx); - ac97c_workdata = NULL; /* MDEV */ return 0; -- cgit v1.1 From 16aff769d73c6b66a79450d7218f31dc46962536 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 23:34:54 +0800 Subject: ASoC: Fix return value of ak4641_pcm_set_dai_fmt() We can't just pass back the return value of snd_soc_update_bits() as it will be 1 if a bit changed rather than zero. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/ak4641.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c index 266ebea..c4d165a 100644 --- a/sound/soc/codecs/ak4641.c +++ b/sound/soc/codecs/ak4641.c @@ -339,6 +339,7 @@ static int ak4641_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai, { struct snd_soc_codec *codec = codec_dai->codec; u8 btif; + int ret; /* interface format */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { @@ -358,7 +359,11 @@ static int ak4641_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai, return -EINVAL; } - return snd_soc_update_bits(codec, AK4641_BTIF, (0x3 << 5), btif); + ret = snd_soc_update_bits(codec, AK4641_BTIF, (0x3 << 5), btif); + if (ret < 0) + return ret; + + return 0; } static int ak4641_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai, -- cgit v1.1 From fe75fe0e041bd5badc6a0be0c3918590198df2a0 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 23:38:03 +0800 Subject: ASoC: Fix return value of wm8962_gpio_direction_out() We can't just pass back the return value of snd_soc_update_bits() as it will be 1 if a bit changed rather than zero. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/wm8962.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 1be4eb3..296de4e 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -3878,13 +3878,17 @@ static int wm8962_gpio_direction_out(struct gpio_chip *chip, { struct wm8962_priv *wm8962 = gpio_to_wm8962(chip); struct snd_soc_codec *codec = wm8962->codec; - int val; + int ret, val; /* Force function 1 (logic output) */ val = (1 << WM8962_GP2_FN_SHIFT) | (value << WM8962_GP2_LVL_SHIFT); - return snd_soc_update_bits(codec, WM8962_GPIO_BASE + offset, - WM8962_GP2_FN_MASK | WM8962_GP2_LVL, val); + ret = snd_soc_update_bits(codec, WM8962_GPIO_BASE + offset, + WM8962_GP2_FN_MASK | WM8962_GP2_LVL, val); + if (ret < 0) + return ret; + + return 0; } static struct gpio_chip wm8962_template_chip = { -- cgit v1.1 From 2ce7f207c33578ba147c359ccf173b88271d992b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 23:41:54 +0800 Subject: ASoC: Use dai_fmt in saarb machine driver Signed-off-by: Axel Lin Acked-by: Haojian Zhuang Signed-off-by: Mark Brown --- sound/soc/pxa/saarb.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/saarb.c b/sound/soc/pxa/saarb.c index 2e21712..b2be225 100644 --- a/sound/soc/pxa/saarb.c +++ b/sound/soc/pxa/saarb.c @@ -92,15 +92,6 @@ static int saarb_i2s_hw_params(struct snd_pcm_substream *substream, if (ret < 0) return ret; - ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); - if (ret < 0) - return ret; - ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); - if (ret < 0) - return ret; - ret = snd_soc_dai_set_tdm_slot(cpu_dai, 3, 3, 2, width); return ret; @@ -119,6 +110,8 @@ static struct snd_soc_dai_link saarb_dai[] = { .platform_name = "pxa-pcm-audio", .codec_name = "88pm860x-codec", .init = saarb_pm860x_init, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBM_CFM, .ops = &saarb_i2s_ops, }, }; -- cgit v1.1 From c0e942310a0a8881ace0a8bf0aa9e7efbb988309 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 23:42:55 +0800 Subject: ASoC: Use dai_fmt in spitz machine driver Signed-off-by: Axel Lin Acked-by: Haojian Zhuang Signed-off-by: Mark Brown --- sound/soc/pxa/spitz.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index bb06048..76288ad 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c @@ -143,18 +143,6 @@ static int spitz_hw_params(struct snd_pcm_substream *substream, break; } - /* set codec DAI configuration */ - ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); - if (ret < 0) - return ret; - - /* set cpu DAI configuration */ - ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); - 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); @@ -313,6 +301,8 @@ static struct snd_soc_dai_link spitz_dai = { .platform_name = "pxa-pcm-audio", .codec_name = "wm8750.0-001b", .init = spitz_wm8750_init, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, .ops = &spitz_ops, }; -- cgit v1.1 From 36c1b400188266be737392c1ce9b74e3e7136be2 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 23:44:37 +0800 Subject: ASoC: Use dai_fmt in z2 machine driver Signed-off-by: Axel Lin Acked-by: Haojian Zhuang Signed-off-by: Mark Brown --- sound/soc/pxa/z2.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/z2.c b/sound/soc/pxa/z2.c index d6807e0..e8f15ce 100644 --- a/sound/soc/pxa/z2.c +++ b/sound/soc/pxa/z2.c @@ -56,18 +56,6 @@ static int z2_hw_params(struct snd_pcm_substream *substream, break; } - /* set codec DAI configuration */ - ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); - if (ret < 0) - return ret; - - /* set cpu DAI configuration */ - ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); - 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); @@ -196,6 +184,8 @@ static struct snd_soc_dai_link z2_dai = { .platform_name = "pxa-pcm-audio", .codec_name = "wm8750.0-001b", .init = z2_wm8750_init, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBS_CFS, .ops = &z2_ops, }; -- cgit v1.1 From 38b437be0b16517c8b6db66d82d63f5c20927116 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 31 Dec 2011 08:40:30 +0800 Subject: ASoC: Convert saarb to table based DAPM init Also remove a unused ret variable to silence the build warning. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/saarb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/saarb.c b/sound/soc/pxa/saarb.c index b2be225..c34146b 100644 --- a/sound/soc/pxa/saarb.c +++ b/sound/soc/pxa/saarb.c @@ -51,7 +51,7 @@ static const struct snd_soc_dapm_widget saarb_dapm_widgets[] = { }; /* saarb machine audio map */ -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route saarb_audio_map[] = { {"Headset Stereophone", NULL, "HS1"}, {"Headset Stereophone", NULL, "HS2"}, @@ -121,17 +121,17 @@ static struct snd_soc_card snd_soc_card_saarb = { .owner = THIS_MODULE, .dai_link = saarb_dai, .num_links = ARRAY_SIZE(saarb_dai), + + .dapm_widgets = saarb_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(saarb_dapm_widgets), + .dapm_routes = saarb_audio_map, + .num_dapm_routes = ARRAY_SIZE(saarb_audio_map), }; static int saarb_pm860x_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; - int ret; - - snd_soc_dapm_new_controls(dapm, saarb_dapm_widgets, - ARRAY_SIZE(saarb_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); /* connected pins */ snd_soc_dapm_enable_pin(dapm, "Ext Speaker"); -- cgit v1.1 From 7c27426356c185ac9f8af8c77889b51d1442a2ac Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 31 Dec 2011 08:44:04 +0800 Subject: ASoC: Convert spitz to table based DAPM and control init Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/spitz.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index 76288ad..90c5245 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c @@ -222,7 +222,7 @@ static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = { }; /* Spitz machine audio_map */ -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route spitz_audio_map[] = { /* headphone connected to LOUT1, ROUT1 */ {"Headphone Jack", NULL, "LOUT1"}, @@ -265,7 +265,6 @@ static int spitz_wm8750_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; - int err; /* NC codec pins */ snd_soc_dapm_nc_pin(dapm, "RINPUT1"); @@ -276,19 +275,6 @@ static int spitz_wm8750_init(struct snd_soc_pcm_runtime *rtd) snd_soc_dapm_nc_pin(dapm, "OUT3"); snd_soc_dapm_nc_pin(dapm, "MONO1"); - /* Add spitz specific controls */ - err = snd_soc_add_controls(codec, wm8750_spitz_controls, - ARRAY_SIZE(wm8750_spitz_controls)); - if (err < 0) - return err; - - /* Add spitz specific widgets */ - snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets, - ARRAY_SIZE(wm8750_dapm_widgets)); - - /* Set up spitz specific audio paths */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - return 0; } @@ -312,6 +298,13 @@ static struct snd_soc_card snd_soc_spitz = { .owner = THIS_MODULE, .dai_link = &spitz_dai, .num_links = 1, + + .controls = wm8750_spitz_controls, + .num_controls = ARRAY_SIZE(wm8750_spitz_controls), + .dapm_widgets = wm8750_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets), + .dapm_routes = spitz_audio_map, + .num_dapm_routes = ARRAY_SIZE(spitz_audio_map), }; static struct platform_device *spitz_snd_device; -- cgit v1.1 From 1a2dbcbe0491bdfd4fc2484a9853a019f9e21a9c Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 31 Dec 2011 08:45:01 +0800 Subject: ASoC: Convert tavorevb3 to table based DAPM init Also remove a unsued ret variable to silence the build warning. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/tavorevb3.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/tavorevb3.c b/sound/soc/pxa/tavorevb3.c index 4bef12c..56ee82f 100644 --- a/sound/soc/pxa/tavorevb3.c +++ b/sound/soc/pxa/tavorevb3.c @@ -51,7 +51,7 @@ static const struct snd_soc_dapm_widget evb3_dapm_widgets[] = { }; /* tavorevb3 machine audio map */ -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route evb3_audio_map[] = { {"Headset Stereophone", NULL, "HS1"}, {"Headset Stereophone", NULL, "HS2"}, @@ -128,17 +128,17 @@ static struct snd_soc_card snd_soc_card_evb3 = { .owner = THIS_MODULE, .dai_link = evb3_dai, .num_links = ARRAY_SIZE(evb3_dai), + + .dapm_widgets = evb3_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(evb3_dapm_widgets), + .dapm_routes = evb3_audio_map, + .num_dapm_routes = ARRAY_SIZE(evb3_audio_map), }; static int evb3_pm860x_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dapm_context *dapm = &codec->dapm; - int ret; - - snd_soc_dapm_new_controls(dapm, evb3_dapm_widgets, - ARRAY_SIZE(evb3_dapm_widgets)); - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); /* connected pins */ snd_soc_dapm_enable_pin(dapm, "Ext Speaker"); -- cgit v1.1 From 3c3f51f6a37ff9c3f8ffef2ab600d1482a9f30c8 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 31 Dec 2011 08:45:49 +0800 Subject: ASoC: Convert z2 to table based DAPM init Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/pxa/z2.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/z2.c b/sound/soc/pxa/z2.c index e8f15ce..76ccb172 100644 --- a/sound/soc/pxa/z2.c +++ b/sound/soc/pxa/z2.c @@ -112,7 +112,7 @@ static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = { }; /* Z2 machine audio_map */ -static const struct snd_soc_dapm_route audio_map[] = { +static const struct snd_soc_dapm_route z2_audio_map[] = { /* headphone connected to LOUT1, ROUT1 */ {"Headphone Jack", NULL, "LOUT1"}, @@ -142,13 +142,6 @@ static int z2_wm8750_init(struct snd_soc_pcm_runtime *rtd) snd_soc_dapm_disable_pin(dapm, "OUT3"); snd_soc_dapm_disable_pin(dapm, "MONO1"); - /* Add z2 specific widgets */ - snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets, - ARRAY_SIZE(wm8750_dapm_widgets)); - - /* Set up z2 specific audio paths */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - /* Jack detection API stuff */ ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, &hs_jack); @@ -195,6 +188,11 @@ static struct snd_soc_card snd_soc_z2 = { .owner = THIS_MODULE, .dai_link = &z2_dai, .num_links = 1, + + .dapm_widgets = wm8750_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets), + .dapm_routes = z2_audio_map, + .num_dapm_routes = ARRAY_SIZE(z2_audio_map), }; static struct platform_device *z2_snd_device; -- cgit v1.1 From 385bd9379babaf0982c76e4c073d928e830df6ad Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 31 Dec 2011 11:01:41 +0800 Subject: ASoC: Fix return value of wm8903_gpio_direction_in() and wm8903_gpio_direction_out() We can't just pass back the return value of snd_soc_update_bits() as it will be 1 if a bit changed rather than zero. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/wm8903.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index d88b727..c91fb2f 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c @@ -1777,13 +1777,18 @@ static int wm8903_gpio_direction_in(struct gpio_chip *chip, unsigned offset) struct wm8903_priv *wm8903 = gpio_to_wm8903(chip); struct snd_soc_codec *codec = wm8903->codec; unsigned int mask, val; + int ret; mask = WM8903_GP1_FN_MASK | WM8903_GP1_DIR_MASK; val = (WM8903_GPn_FN_GPIO_INPUT << WM8903_GP1_FN_SHIFT) | WM8903_GP1_DIR; - return snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset, - mask, val); + ret = snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset, + mask, val); + if (ret < 0) + return ret; + + return 0; } static int wm8903_gpio_get(struct gpio_chip *chip, unsigned offset) @@ -1803,13 +1808,18 @@ static int wm8903_gpio_direction_out(struct gpio_chip *chip, struct wm8903_priv *wm8903 = gpio_to_wm8903(chip); struct snd_soc_codec *codec = wm8903->codec; unsigned int mask, val; + int ret; mask = WM8903_GP1_FN_MASK | WM8903_GP1_DIR_MASK | WM8903_GP1_LVL_MASK; val = (WM8903_GPn_FN_GPIO_OUTPUT << WM8903_GP1_FN_SHIFT) | (value << WM8903_GP2_LVL_SHIFT); - return snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset, - mask, val); + ret = snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset, + mask, val); + if (ret < 0) + return ret; + + return 0; } static void wm8903_gpio_set(struct gpio_chip *chip, unsigned offset, int value) -- cgit v1.1 From c49c7f0cf91c8506d0a0ed61227a0da3b243384d Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 23:43:44 +0800 Subject: ASoC: Use dai_fmt in tavorevb3 machine driver Signed-off-by: Axel Lin Acked-by: Haojian Zhuang Signed-off-by: Mark Brown --- sound/soc/pxa/tavorevb3.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/tavorevb3.c b/sound/soc/pxa/tavorevb3.c index 56ee82f..8b5ab8f 100644 --- a/sound/soc/pxa/tavorevb3.c +++ b/sound/soc/pxa/tavorevb3.c @@ -92,16 +92,6 @@ static int evb3_i2s_hw_params(struct snd_pcm_substream *substream, if (ret < 0) return ret; - ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); - if (ret < 0) - return ret; - - ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | - SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM); - if (ret < 0) - return ret; - ret = snd_soc_dai_set_tdm_slot(cpu_dai, 3, 3, 2, width); return ret; } @@ -119,6 +109,8 @@ static struct snd_soc_dai_link evb3_dai[] = { .platform_name = "pxa-pcm-audio", .codec_name = "88pm860x-codec", .init = evb3_pm860x_init, + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_CBM_CFM, .ops = &evb3_i2s_ops, }, }; -- cgit v1.1 From 748b217827974d34a7341142599f0db631a3e45a Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 23:36:23 +0800 Subject: ASoC: Fix return value of wm8580_set_sysclk() We can't just pass back the return value of snd_soc_update_bits() as it will be 1 if a bit changed rather than zero. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/wm8580.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index b1c8d3d..2112851 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c @@ -670,7 +670,7 @@ static int wm8580_set_sysclk(struct snd_soc_dai *dai, int clk_id, { struct snd_soc_codec *codec = dai->codec; struct wm8580_priv *wm8580 = snd_soc_codec_get_drvdata(codec); - int sel, sel_mask, sel_shift; + int ret, sel, sel_mask, sel_shift; switch (dai->driver->id) { case WM8580_DAI_PAIFRX: @@ -711,7 +711,11 @@ static int wm8580_set_sysclk(struct snd_soc_dai *dai, int clk_id, /* We really should validate PLL settings but not yet */ wm8580->sysclk[dai->driver->id] = freq; - return snd_soc_update_bits(codec, WM8580_CLKSEL, sel_mask, sel); + ret = snd_soc_update_bits(codec, WM8580_CLKSEL, sel_mask, sel); + if (ret < 0) + return ret; + + return 0; } static int wm8580_digital_mute(struct snd_soc_dai *codec_dai, int mute) -- cgit v1.1 From 34be9244c7d8107ab9a46af53869f826648fccc8 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 30 Dec 2011 11:18:13 +0800 Subject: ASoC: pxa: Convert corgi to use snd_soc_register_card() Use snd_soc_register_card() instead of creating a "soc-audio" platform device. Signed-off-by: Axel Lin Acked-by: Haojian Zhuang Signed-off-by: Mark Brown --- sound/soc/pxa/corgi.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'sound') diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c index 30ebce2..bc21944 100644 --- a/sound/soc/pxa/corgi.c +++ b/sound/soc/pxa/corgi.c @@ -291,7 +291,7 @@ static struct snd_soc_dai_link corgi_dai = { }; /* corgi audio machine driver */ -static struct snd_soc_card snd_soc_corgi = { +static struct snd_soc_card corgi = { .name = "Corgi", .owner = THIS_MODULE, .dai_link = &corgi_dai, @@ -305,38 +305,41 @@ static struct snd_soc_card snd_soc_corgi = { .num_dapm_routes = ARRAY_SIZE(corgi_audio_map), }; -static struct platform_device *corgi_snd_device; - -static int __init corgi_init(void) +static int __devinit corgi_probe(struct platform_device *pdev) { + struct snd_soc_card *card = &corgi; int ret; - if (!(machine_is_corgi() || machine_is_shepherd() || - machine_is_husky())) - return -ENODEV; - - corgi_snd_device = platform_device_alloc("soc-audio", -1); - if (!corgi_snd_device) - return -ENOMEM; - - platform_set_drvdata(corgi_snd_device, &snd_soc_corgi); - ret = platform_device_add(corgi_snd_device); + card->dev = &pdev->dev; + ret = snd_soc_register_card(card); if (ret) - platform_device_put(corgi_snd_device); - + dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", + ret); return ret; } -static void __exit corgi_exit(void) +static int __devexit corgi_remove(struct platform_device *pdev) { - platform_device_unregister(corgi_snd_device); + struct snd_soc_card *card = platform_get_drvdata(pdev); + + snd_soc_unregister_card(card); + return 0; } -module_init(corgi_init); -module_exit(corgi_exit); +static struct platform_driver corgi_driver = { + .driver = { + .name = "corgi-audio", + .owner = THIS_MODULE, + }, + .probe = corgi_probe, + .remove = __devexit_p(corgi_remove), +}; + +module_platform_driver(corgi_driver); /* Module information */ MODULE_AUTHOR("Richard Purdie"); MODULE_DESCRIPTION("ALSA SoC Corgi"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:corgi-audio"); -- cgit v1.1 From a500231da461cfe29541cb4b8422eb9bf59aa6ac Mon Sep 17 00:00:00 2001 From: Sangsu Park Date: Mon, 2 Jan 2012 17:15:10 +0900 Subject: ASoC: soc-pcm: Allocate PCM operations dynamically to support multiple DAIs The original code does not cover the case that two DAIs(CPU) have different ASoC core PCM operations(like mmap, pointer...). Currently we have only one global soc_pcm_ops for ASoC core PCM operation. When two DAIs have different pointer functions, second DAI's pointer function is set for both first DAI and second DAI in case of original code. This patch uses runtime's pcm_ops instead of global pcm_ops for each DAIs. So each DAIs can have different ASoC core PCM operations. This is needed to support multiple DAIs. Signed-off-by: Sangsu Park Signed-off-by: Mark Brown --- sound/soc/soc-pcm.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'sound') diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 8aa7cec..cdc860a 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -598,17 +598,6 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream) return offset; } -/* ASoC PCM operations */ -static struct snd_pcm_ops soc_pcm_ops = { - .open = soc_pcm_open, - .close = soc_pcm_close, - .hw_params = soc_pcm_hw_params, - .hw_free = soc_pcm_hw_free, - .prepare = soc_pcm_prepare, - .trigger = soc_pcm_trigger, - .pointer = soc_pcm_pointer, -}; - /* create a new pcm */ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) { @@ -616,10 +605,19 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) struct snd_soc_platform *platform = rtd->platform; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_dai *cpu_dai = rtd->cpu_dai; + struct snd_pcm_ops *soc_pcm_ops = &rtd->ops; struct snd_pcm *pcm; char new_name[64]; int ret = 0, playback = 0, capture = 0; + soc_pcm_ops->open = soc_pcm_open; + soc_pcm_ops->close = soc_pcm_close; + soc_pcm_ops->hw_params = soc_pcm_hw_params; + soc_pcm_ops->hw_free = soc_pcm_hw_free; + soc_pcm_ops->prepare = soc_pcm_prepare; + soc_pcm_ops->trigger = soc_pcm_trigger; + soc_pcm_ops->pointer = soc_pcm_pointer; + /* check client and interface hw capabilities */ snprintf(new_name, sizeof(new_name), "%s %s-%d", rtd->dai_link->stream_name, codec_dai->name, num); @@ -643,20 +641,20 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) rtd->pcm = pcm; pcm->private_data = rtd; if (platform->driver->ops) { - soc_pcm_ops.mmap = platform->driver->ops->mmap; - soc_pcm_ops.pointer = platform->driver->ops->pointer; - soc_pcm_ops.ioctl = platform->driver->ops->ioctl; - soc_pcm_ops.copy = platform->driver->ops->copy; - soc_pcm_ops.silence = platform->driver->ops->silence; - soc_pcm_ops.ack = platform->driver->ops->ack; - soc_pcm_ops.page = platform->driver->ops->page; + soc_pcm_ops->mmap = platform->driver->ops->mmap; + soc_pcm_ops->pointer = platform->driver->ops->pointer; + soc_pcm_ops->ioctl = platform->driver->ops->ioctl; + soc_pcm_ops->copy = platform->driver->ops->copy; + soc_pcm_ops->silence = platform->driver->ops->silence; + soc_pcm_ops->ack = platform->driver->ops->ack; + soc_pcm_ops->page = platform->driver->ops->page; } if (playback) - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &soc_pcm_ops); + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, soc_pcm_ops); if (capture) - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &soc_pcm_ops); + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, soc_pcm_ops); if (platform->driver->pcm_new) { ret = platform->driver->pcm_new(rtd); -- cgit v1.1 From 7a748e4318909e680b3900e3b97ea42a92724c68 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sun, 1 Jan 2012 18:36:14 +0800 Subject: ASoC: sta32x: Optimize the array work to find rate_min and rate_max For a given ir and fs, there is at most one possible match for the case mclk_ratios[ir][j].ratio * fs == freq. Thus we can break from the inner loop once a match is found. Signed-off-by: Axel Lin Acked-by: Johannes Stezenbach Signed-off-by: Mark Brown --- sound/soc/codecs/sta32x.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index fbd1450..7db6fa5 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -522,6 +522,7 @@ static int sta32x_set_dai_sysclk(struct snd_soc_dai *codec_dai, rate_min = fs; if (fs > rate_max) rate_max = fs; + break; } } } -- cgit v1.1 From 739be96ab83755e10fd0c2b6a34c8a73254527f7 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 6 Jan 2012 14:54:24 +0800 Subject: ASoC: Fix build dependency for SND_ATMEL_SOC_SSC Make SND_ATMEL_SOC_SSC select ATMEL_SSC to fix below build errors: LD .tmp_vmlinux1 sound/built-in.o: In function `atmel_ssc_remove': sound/soc/atmel/atmel_ssc_dai.c:713: undefined reference to `ssc_free' sound/built-in.o: In function `atmel_ssc_probe': sound/soc/atmel/atmel_ssc_dai.c:700: undefined reference to `ssc_request' sound/built-in.o: In function `atmel_ssc_set_audio': sound/soc/atmel/atmel_ssc_dai.c:845: undefined reference to `ssc_request' sound/soc/atmel/atmel_ssc_dai.c:851: undefined reference to `ssc_free' make: *** [.tmp_vmlinux1] Error 1 Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/atmel/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig index d1fcc81..a4d6742 100644 --- a/sound/soc/atmel/Kconfig +++ b/sound/soc/atmel/Kconfig @@ -9,6 +9,7 @@ config SND_ATMEL_SOC config SND_ATMEL_SOC_SSC tristate depends on SND_ATMEL_SOC + select ATMEL_SSC help Say Y or M if you want to add support for codecs the ATMEL SSC interface. You will also needs to select the individual -- cgit v1.1 From 25e9e7565f9aa9e4b976387a3fab60bfaa4efac8 Mon Sep 17 00:00:00 2001 From: Joachim Eastwood Date: Sun, 1 Jan 2012 01:58:44 +0100 Subject: ASoC: check for substream not channels_min in pcm engines This is a follow up on 53dea36c70c1857 which fixes the other affected pcm engines. Description from 53dea36c70c1857: Don't rely on the codec's channels_min information to decide wheter or not allocate a substream's DMA buffer. Rather check if the substream itself was allocated previously. Without this patch I was seeing null-pointer dereferenc in atmel-pcm. Signed-off-by: Joachim Eastwood Signed-off-by: Mark Brown --- sound/soc/atmel/atmel-pcm.c | 5 ++--- sound/soc/blackfin/bf5xx-ac97-pcm.c | 5 ++--- sound/soc/blackfin/bf5xx-i2s-pcm.c | 5 ++--- sound/soc/blackfin/bf5xx-tdm-pcm.c | 5 ++--- sound/soc/davinci/davinci-pcm.c | 5 ++--- sound/soc/ep93xx/ep93xx-pcm.c | 5 ++--- sound/soc/jz4740/jz4740-pcm.c | 5 ++--- sound/soc/kirkwood/kirkwood-dma.c | 5 ++--- sound/soc/mid-x86/sst_platform.c | 5 ++--- sound/soc/omap/omap-pcm.c | 5 ++--- sound/soc/samsung/dma.c | 5 ++--- sound/soc/samsung/idma.c | 3 +-- sound/soc/tegra/tegra_pcm.c | 5 ++--- 13 files changed, 25 insertions(+), 38 deletions(-) (limited to 'sound') diff --git a/sound/soc/atmel/atmel-pcm.c b/sound/soc/atmel/atmel-pcm.c index 60de055..a21ff45 100644 --- a/sound/soc/atmel/atmel-pcm.c +++ b/sound/soc/atmel/atmel-pcm.c @@ -367,7 +367,6 @@ static u64 atmel_pcm_dmamask = 0xffffffff; static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; - struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int ret = 0; @@ -376,14 +375,14 @@ static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd) if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = 0xffffffff; - if (dai->driver->playback.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = atmel_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) goto out; } - if (dai->driver->capture.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { pr_debug("atmel-pcm:" "Allocating PCM capture DMA buffer\n"); ret = atmel_pcm_preallocate_dma_buffer(pcm, diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c index fcff583..d7dc9bd 100644 --- a/sound/soc/blackfin/bf5xx-ac97-pcm.c +++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c @@ -421,7 +421,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; - struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int ret = 0; @@ -431,14 +430,14 @@ static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd) if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = DMA_BIT_MASK(32); - if (dai->driver->playback.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = bf5xx_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) goto out; } - if (dai->driver->capture.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ret = bf5xx_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE); if (ret) diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c index 6ec3d41..63205d7 100644 --- a/sound/soc/blackfin/bf5xx-i2s-pcm.c +++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c @@ -260,7 +260,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; - struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int ret = 0; @@ -270,14 +269,14 @@ static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd) if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = DMA_BIT_MASK(32); - if (dai->driver->playback.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = bf5xx_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) goto out; } - if (dai->driver->capture.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ret = bf5xx_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE); if (ret) diff --git a/sound/soc/blackfin/bf5xx-tdm-pcm.c b/sound/soc/blackfin/bf5xx-tdm-pcm.c index 4406f9a..254490c 100644 --- a/sound/soc/blackfin/bf5xx-tdm-pcm.c +++ b/sound/soc/blackfin/bf5xx-tdm-pcm.c @@ -286,7 +286,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; - struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int ret = 0; @@ -295,14 +294,14 @@ static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd) if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = DMA_BIT_MASK(32); - if (dai->driver->playback.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = bf5xx_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) goto out; } - if (dai->driver->capture.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ret = bf5xx_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE); if (ret) diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c index 65bff3d..b26401f 100644 --- a/sound/soc/davinci/davinci-pcm.c +++ b/sound/soc/davinci/davinci-pcm.c @@ -831,7 +831,6 @@ static u64 davinci_pcm_dmamask = 0xffffffff; static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; - struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int ret; @@ -840,7 +839,7 @@ static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd) if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = 0xffffffff; - if (dai->driver->playback.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = davinci_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK, pcm_hardware_playback.buffer_bytes_max); @@ -848,7 +847,7 @@ static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd) return ret; } - if (dai->driver->capture.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ret = davinci_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE, pcm_hardware_capture.buffer_bytes_max); diff --git a/sound/soc/ep93xx/ep93xx-pcm.c b/sound/soc/ep93xx/ep93xx-pcm.c index a2de9c4..3fc9613 100644 --- a/sound/soc/ep93xx/ep93xx-pcm.c +++ b/sound/soc/ep93xx/ep93xx-pcm.c @@ -286,7 +286,6 @@ static u64 ep93xx_pcm_dmamask = 0xffffffff; static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; - struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int ret = 0; @@ -295,14 +294,14 @@ static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd) if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = 0xffffffff; - if (dai->driver->playback.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = ep93xx_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) return ret; } - if (dai->driver->capture.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ret = ep93xx_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE); if (ret) diff --git a/sound/soc/jz4740/jz4740-pcm.c b/sound/soc/jz4740/jz4740-pcm.c index 50cda9e..9b8cf25 100644 --- a/sound/soc/jz4740/jz4740-pcm.c +++ b/sound/soc/jz4740/jz4740-pcm.c @@ -302,7 +302,6 @@ static u64 jz4740_pcm_dmamask = DMA_BIT_MASK(32); static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; - struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int ret = 0; @@ -312,14 +311,14 @@ static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd) if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = DMA_BIT_MASK(32); - if (dai->driver->playback.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = jz4740_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) goto err; } - if (dai->driver->capture.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ret = jz4740_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE); if (ret) diff --git a/sound/soc/kirkwood/kirkwood-dma.c b/sound/soc/kirkwood/kirkwood-dma.c index 2104382..d4a1778 100644 --- a/sound/soc/kirkwood/kirkwood-dma.c +++ b/sound/soc/kirkwood/kirkwood-dma.c @@ -315,7 +315,6 @@ static int kirkwood_dma_preallocate_dma_buffer(struct snd_pcm *pcm, static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; - struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int ret; @@ -324,14 +323,14 @@ static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd) if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = 0xffffffff; - if (dai->driver->playback.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = kirkwood_dma_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) return ret; } - if (dai->driver->capture.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ret = kirkwood_dma_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE); if (ret) diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c index c2bf172..d34563b 100644 --- a/sound/soc/mid-x86/sst_platform.c +++ b/sound/soc/mid-x86/sst_platform.c @@ -446,13 +446,12 @@ static void sst_pcm_free(struct snd_pcm *pcm) static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) { - struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int retval = 0; pr_debug("sst_pcm_new called\n"); - if (dai->driver->playback.channels_min || - dai->driver->capture.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || + pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { retval = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_dma_continuous_data(GFP_KERNEL), diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index 52a0f63..a59bd35 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c @@ -378,7 +378,6 @@ static void omap_pcm_free_dma_buffers(struct snd_pcm *pcm) static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; - struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int ret = 0; @@ -387,14 +386,14 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd) if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = DMA_BIT_MASK(64); - if (dai->driver->playback.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = omap_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) goto out; } - if (dai->driver->capture.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ret = omap_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE); if (ret) diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c index 797c3d5..427ae0d 100644 --- a/sound/soc/samsung/dma.c +++ b/sound/soc/samsung/dma.c @@ -403,7 +403,6 @@ static u64 dma_mask = DMA_BIT_MASK(32); static int dma_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; - struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int ret = 0; @@ -414,14 +413,14 @@ static int dma_new(struct snd_soc_pcm_runtime *rtd) if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = 0xffffffff; - if (dai->driver->playback.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) goto out; } - if (dai->driver->capture.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ret = preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE); if (ret) diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c index 2bcf758..3ba6aba 100644 --- a/sound/soc/samsung/idma.c +++ b/sound/soc/samsung/idma.c @@ -387,7 +387,6 @@ static u64 idma_mask = DMA_BIT_MASK(32); static int idma_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; - struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int ret = 0; @@ -396,7 +395,7 @@ static int idma_new(struct snd_soc_pcm_runtime *rtd) if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = DMA_BIT_MASK(32); - if (dai->driver->playback.channels_min) + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = preallocate_idma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c index 90345ee..c224315 100644 --- a/sound/soc/tegra/tegra_pcm.c +++ b/sound/soc/tegra/tegra_pcm.c @@ -330,7 +330,6 @@ static u64 tegra_dma_mask = DMA_BIT_MASK(32); static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd) { struct snd_card *card = rtd->card->snd_card; - struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; int ret = 0; @@ -339,14 +338,14 @@ static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd) if (!card->dev->coherent_dma_mask) card->dev->coherent_dma_mask = 0xffffffff; - if (dai->driver->playback.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = tegra_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); if (ret) goto err; } - if (dai->driver->capture.channels_min) { + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { ret = tegra_pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE); if (ret) -- cgit v1.1 From 716e5db48861be408f9bbb5b49c72818ba85e4d2 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Wed, 4 Jan 2012 10:12:54 +0100 Subject: ALSA: HDA: Use LPIB position fix for Oaktrail According to the thread on alsa-devel, the LPIB method is to prefer for Oaktrail controller chip. Reference: http://mailman.alsa-project.org/pipermail/alsa-devel/2012-January/047800.html Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index c6c896b..bdc4336 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2997,7 +2997,7 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Poulsbo */ { PCI_DEVICE(0x8086, 0x080a), .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | - AZX_DCAPS_BUFSIZE}, + AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Oaktrail */ /* ICH */ { PCI_DEVICE(0x8086, 0x2668), .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | -- cgit v1.1 From 40d03e63e91af8ddccdfd5a536cc2a6e51433e1d Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Mon, 2 Jan 2012 12:40:15 +0100 Subject: ALSA: HDA: Fix master control for Cirrus Logic 421X The control name "HP/Speakers" is non-standard, and since there is only one DAC on this chip there is no need for a virtual master anyway. Cc: stable@kernel.org Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_cirrus.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index acfb645..9139558 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c @@ -1779,30 +1779,19 @@ static int build_cs421x_output(struct hda_codec *codec) struct auto_pin_cfg *cfg = &spec->autocfg; struct snd_kcontrol *kctl; int err; - char *name = "HP/Speakers"; + char *name = "Master"; fix_volume_caps(codec, dac); - if (!spec->vmaster_sw) { - err = add_vmaster(codec, dac); - if (err < 0) - return err; - } err = add_mute(codec, name, 0, HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl); if (err < 0) return err; - err = snd_ctl_add_slave(spec->vmaster_sw, kctl); - if (err < 0) - return err; err = add_volume(codec, name, 0, HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl); if (err < 0) return err; - err = snd_ctl_add_slave(spec->vmaster_vol, kctl); - if (err < 0) - return err; if (cfg->speaker_outs) { err = snd_hda_ctl_add(codec, 0, -- cgit v1.1 From 78e2a928e377d5124932d4399c6c581908b027a0 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Mon, 2 Jan 2012 12:40:16 +0100 Subject: ALSA: HDA: Fix automute for Cirrus Logic 421x There was a bug in the automute logic causing speakers not to mute when headphones were plugged in. Cc: stable@kernel.org Tested-by: Hsin-Yi Chen Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_cirrus.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 9139558..ea66042 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c @@ -922,16 +922,14 @@ static void cs_automute(struct hda_codec *codec) /* mute speakers if spdif or hp jack is plugged in */ for (i = 0; i < cfg->speaker_outs; i++) { + int pin_ctl = hp_present ? 0 : PIN_OUT; + /* detect on spdif is specific to CS421x */ + if (spdif_present && (spec->vendor_nid == CS421X_VENDOR_NID)) + pin_ctl = 0; + nid = cfg->speaker_pins[i]; snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, - hp_present ? 0 : PIN_OUT); - /* detect on spdif is specific to CS421x */ - if (spec->vendor_nid == CS421X_VENDOR_NID) { - snd_hda_codec_write(codec, nid, 0, - AC_VERB_SET_PIN_WIDGET_CONTROL, - spdif_present ? 0 : PIN_OUT); - } + AC_VERB_SET_PIN_WIDGET_CONTROL, pin_ctl); } if (spec->gpio_eapd_hp) { unsigned int gpio = hp_present ? -- cgit v1.1 From 5660ffd06935e564404412997a703279e325fa64 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Mon, 2 Jan 2012 12:40:17 +0100 Subject: ALSA: HDA: Add support for Cirrus Logic 4213 The CS4213 chip is similar to the CS4210, but it does not have SPDIF capabilities. Also, it has fewer pins, and the vendor specific nid is different. With this patch, we have working inputs and outputs (and automute/autoswitch). However, we don't know anything about the vendor specific processing coefficients, so we don't read or write to that node in this patch. BugLink: https://bugs.launchpad.net/bugs/910792 Tested-by: Hsin-Yi Chen Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_cirrus.c | 105 ++++++++++++++++++++++++++++--------------- 1 file changed, 70 insertions(+), 35 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index ea66042..036056c4 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c @@ -138,7 +138,7 @@ enum { */ #define CS4210_DAC_NID 0x02 #define CS4210_ADC_NID 0x03 -#define CS421X_VENDOR_NID 0x0B +#define CS4210_VENDOR_NID 0x0B #define CS421X_DMIC_PIN_NID 0x09 /* Port E */ #define CS421X_SPDIF_PIN_NID 0x0A /* Port H */ @@ -149,6 +149,10 @@ enum { #define SPDIF_EVENT 0x04 +/* Cirrus Logic CS4213 is like CS4210 but does not have SPDIF input/output */ +#define CS4213_VENDOR_NID 0x09 + + static inline int cs_vendor_coef_get(struct hda_codec *codec, unsigned int idx) { struct cs_spec *spec = codec->spec; @@ -923,8 +927,8 @@ static void cs_automute(struct hda_codec *codec) /* mute speakers if spdif or hp jack is plugged in */ for (i = 0; i < cfg->speaker_outs; i++) { int pin_ctl = hp_present ? 0 : PIN_OUT; - /* detect on spdif is specific to CS421x */ - if (spdif_present && (spec->vendor_nid == CS421X_VENDOR_NID)) + /* detect on spdif is specific to CS4210 */ + if (spdif_present && (spec->vendor_nid == CS4210_VENDOR_NID)) pin_ctl = 0; nid = cfg->speaker_pins[i]; @@ -938,8 +942,8 @@ static void cs_automute(struct hda_codec *codec) AC_VERB_SET_GPIO_DATA, gpio); } - /* specific to CS421x */ - if (spec->vendor_nid == CS421X_VENDOR_NID) { + /* specific to CS4210 */ + if (spec->vendor_nid == CS4210_VENDOR_NID) { /* mute HPs if spdif jack (SENSE_B) is present */ for (i = 0; i < cfg->hp_outs; i++) { nid = cfg->hp_pins[i]; @@ -976,7 +980,12 @@ static void cs_automic(struct hda_codec *codec) present = snd_hda_jack_detect(codec, nid); /* specific to CS421x, single ADC */ - if (spec->vendor_nid == CS421X_VENDOR_NID) { + if (spec->vendor_nid == CS420X_VENDOR_NID) { + if (present) + change_cur_input(codec, spec->automic_idx, 0); + else + change_cur_input(codec, !spec->automic_idx, 0); + } else { if (present) { spec->last_input = spec->cur_input; spec->cur_input = spec->automic_idx; @@ -984,11 +993,6 @@ static void cs_automic(struct hda_codec *codec) spec->cur_input = spec->last_input; } cs_update_input_select(codec); - } else { - if (present) - change_cur_input(codec, spec->automic_idx, 0); - else - change_cur_input(codec, !spec->automic_idx, 0); } } @@ -1070,15 +1074,8 @@ static void init_input(struct hda_codec *codec) if (spec->mic_detect && spec->automic_idx == i) snd_hda_jack_detect_enable(codec, pin, MIC_EVENT); } - /* specific to CS421x */ - if (spec->vendor_nid == CS421X_VENDOR_NID) { - if (spec->mic_detect) - cs_automic(codec); - else { - spec->cur_adc = spec->adc_nid[spec->cur_input]; - cs_update_input_select(codec); - } - } else { + /* CS420x has multiple ADC, CS421x has single ADC */ + if (spec->vendor_nid == CS420X_VENDOR_NID) { change_cur_input(codec, spec->cur_input, 1); if (spec->mic_detect) cs_automic(codec); @@ -1092,6 +1089,13 @@ static void init_input(struct hda_codec *codec) * selected in IDX_SPDIF_CTL. */ cs_vendor_coef_set(codec, IDX_ADC_CFG, coef); + } else { + if (spec->mic_detect) + cs_automic(codec); + else { + spec->cur_adc = spec->adc_nid[spec->cur_input]; + cs_update_input_select(codec); + } } } @@ -1565,7 +1569,7 @@ static const struct snd_kcontrol_new cs421x_speaker_bost_ctl = { .tlv = { .p = cs421x_speaker_boost_db_scale }, }; -static void cs421x_pinmux_init(struct hda_codec *codec) +static void cs4210_pinmux_init(struct hda_codec *codec) { struct cs_spec *spec = codec->spec; unsigned int def_conf, coef; @@ -1620,10 +1624,11 @@ static int cs421x_init(struct hda_codec *codec) { struct cs_spec *spec = codec->spec; - snd_hda_sequence_write(codec, cs421x_coef_init_verbs); - snd_hda_sequence_write(codec, cs421x_coef_init_verbs_A1_silicon_fixes); - - cs421x_pinmux_init(codec); + if (spec->vendor_nid == CS4210_VENDOR_NID) { + snd_hda_sequence_write(codec, cs421x_coef_init_verbs); + snd_hda_sequence_write(codec, cs421x_coef_init_verbs_A1_silicon_fixes); + cs4210_pinmux_init(codec); + } if (spec->gpio_mask) { snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, @@ -1791,7 +1796,7 @@ static int build_cs421x_output(struct hda_codec *codec) if (err < 0) return err; - if (cfg->speaker_outs) { + if (cfg->speaker_outs && (spec->vendor_nid == CS4210_VENDOR_NID)) { err = snd_hda_ctl_add(codec, 0, snd_ctl_new1(&cs421x_speaker_bost_ctl, codec)); if (err < 0) @@ -1888,6 +1893,7 @@ static int cs421x_parse_auto_config(struct hda_codec *codec) */ static int cs421x_suspend(struct hda_codec *codec, pm_message_t state) { + struct cs_spec *spec = codec->spec; unsigned int coef; snd_hda_shutup_pins(codec); @@ -1897,15 +1903,17 @@ static int cs421x_suspend(struct hda_codec *codec, pm_message_t state) snd_hda_codec_write(codec, CS4210_ADC_NID, 0, AC_VERB_SET_POWER_STATE, AC_PWRST_D3); - coef = cs_vendor_coef_get(codec, CS421X_IDX_DEV_CFG); - coef |= 0x0004; /* PDREF */ - cs_vendor_coef_set(codec, CS421X_IDX_DEV_CFG, coef); + if (spec->vendor_nid == CS4210_VENDOR_NID) { + coef = cs_vendor_coef_get(codec, CS421X_IDX_DEV_CFG); + coef |= 0x0004; /* PDREF */ + cs_vendor_coef_set(codec, CS421X_IDX_DEV_CFG, coef); + } return 0; } #endif -static struct hda_codec_ops cs4210_patch_ops = { +static struct hda_codec_ops cs421x_patch_ops = { .build_controls = cs421x_build_controls, .build_pcms = cs_build_pcms, .init = cs421x_init, @@ -1916,7 +1924,7 @@ static struct hda_codec_ops cs4210_patch_ops = { #endif }; -static int patch_cs421x(struct hda_codec *codec) +static int patch_cs4210(struct hda_codec *codec) { struct cs_spec *spec; int err; @@ -1926,7 +1934,7 @@ static int patch_cs421x(struct hda_codec *codec) return -ENOMEM; codec->spec = spec; - spec->vendor_nid = CS421X_VENDOR_NID; + spec->vendor_nid = CS4210_VENDOR_NID; spec->board_config = snd_hda_check_board_config(codec, CS421X_MODELS, @@ -1954,14 +1962,39 @@ static int patch_cs421x(struct hda_codec *codec) is auto-parsed. If GPIO or SENSE_B is forced, DMIC input is disabled. */ - cs421x_pinmux_init(codec); + cs4210_pinmux_init(codec); err = cs421x_parse_auto_config(codec); if (err < 0) goto error; - codec->patch_ops = cs4210_patch_ops; + codec->patch_ops = cs421x_patch_ops; + + return 0; + + error: + kfree(codec->spec); + codec->spec = NULL; + return err; +} + +static int patch_cs4213(struct hda_codec *codec) +{ + struct cs_spec *spec; + int err; + + spec = kzalloc(sizeof(*spec), GFP_KERNEL); + if (!spec) + return -ENOMEM; + codec->spec = spec; + + spec->vendor_nid = CS4213_VENDOR_NID; + + err = cs421x_parse_auto_config(codec); + if (err < 0) + goto error; + codec->patch_ops = cs421x_patch_ops; return 0; error: @@ -1977,13 +2010,15 @@ static int patch_cs421x(struct hda_codec *codec) static const struct hda_codec_preset snd_hda_preset_cirrus[] = { { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x }, { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x }, - { .id = 0x10134210, .name = "CS4210", .patch = patch_cs421x }, + { .id = 0x10134210, .name = "CS4210", .patch = patch_cs4210 }, + { .id = 0x10134213, .name = "CS4213", .patch = patch_cs4213 }, {} /* terminator */ }; MODULE_ALIAS("snd-hda-codec-id:10134206"); MODULE_ALIAS("snd-hda-codec-id:10134207"); MODULE_ALIAS("snd-hda-codec-id:10134210"); +MODULE_ALIAS("snd-hda-codec-id:10134213"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Cirrus Logic HD-audio codec"); -- cgit v1.1 From 2267ea9762c7b0080d5747726f95cdd32d521361 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Tue, 3 Jan 2012 08:45:56 +0100 Subject: ALSA: HDA: Fix typo for ALC269VB_FIXUP_DMIC This fixup is not actually used, so in practice this is just a cosmetic fix. Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d24adbd..5e82acf 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -5320,7 +5320,7 @@ static const struct alc_fixup alc269_fixups[] = { { } }, }, - [ALC269_FIXUP_DMIC] = { + [ALC269VB_FIXUP_DMIC] = { .type = ALC_FIXUP_PINS, .v.pins = (const struct alc_pincfg[]) { { 0x12, 0x99a3092f }, /* int-mic */ -- cgit v1.1 From f16c2cc3c40ea8b7860f3abb9c7bb887a1bdd703 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Wed, 4 Jan 2012 10:48:27 +0100 Subject: ALSA: HDA: Remove Poulsbo position fix quirks Now that we have changed the poulsbo chip to use LPIB position fix, we can remove the individual machine quirks that do the same thing. Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_intel.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index bdc4336..8a46450 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2493,12 +2493,10 @@ static int azx_dev_free(struct snd_device *device) static struct snd_pci_quirk position_fix_list[] __devinitdata = { SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), - SND_PCI_QUIRK(0x1028, 0x02c6, "Dell Inspiron 1010", POS_FIX_LPIB), SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), - SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS 1101HA", POS_FIX_LPIB), SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), -- cgit v1.1 From e7848163aa2a649d9065f230fadff80dc3519775 Mon Sep 17 00:00:00 2001 From: Pavel Hofman Date: Thu, 5 Jan 2012 23:05:18 +0100 Subject: ALSA: ice1724 - Check for ac97 to avoid kernel oops Cards with identical PCI ids but no AC97 config in EEPROM do not have the ac97 field initialized. We must check for this case to avoid kernel oops. Signed-off-by: Pavel Hofman Cc: Signed-off-by: Takashi Iwai --- sound/pci/ice1712/amp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/ice1712/amp.c b/sound/pci/ice1712/amp.c index e328cfb..e525da2 100644 --- a/sound/pci/ice1712/amp.c +++ b/sound/pci/ice1712/amp.c @@ -68,8 +68,11 @@ static int __devinit snd_vt1724_amp_init(struct snd_ice1712 *ice) static int __devinit snd_vt1724_amp_add_controls(struct snd_ice1712 *ice) { - /* we use pins 39 and 41 of the VT1616 for left and right read outputs */ - snd_ac97_write_cache(ice->ac97, 0x5a, snd_ac97_read(ice->ac97, 0x5a) & ~0x8000); + if (ice->ac97) + /* we use pins 39 and 41 of the VT1616 for left and right + read outputs */ + snd_ac97_write_cache(ice->ac97, 0x5a, + snd_ac97_read(ice->ac97, 0x5a) & ~0x8000); return 0; } -- cgit v1.1 From 219e2cd41b5014c5a6ed4d1748f65f55f74a862f Mon Sep 17 00:00:00 2001 From: Pavel Hofman Date: Thu, 5 Jan 2012 22:01:56 +0100 Subject: ALSA: ice1724 - External clock item only for cards with SPDIF_IN Append the external clock item to the clock list only if the SPDIF_IN capability is defined in the SPDIF register. Signed-off-by: Pavel Hofman Signed-off-by: Takashi Iwai --- sound/pci/ice1712/ice1724.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 4dc5124..9e18d3a 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -1825,7 +1825,12 @@ static int snd_vt1724_pro_internal_clock_info(struct snd_kcontrol *kcontrol, uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; - uinfo->value.enumerated.items = hw_rates_count + ice->ext_clock_count; + /* internal clocks */ + uinfo->value.enumerated.items = hw_rates_count; + /* external clocks */ + if (ice->force_rdma1 || + (ice->eeprom.data[ICE_EEP2_SPDIF] & VT1724_CFG_SPDIF_IN)) + uinfo->value.enumerated.items += ice->ext_clock_count; /* upper limit - keep at top */ if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; -- cgit v1.1 From 9489f2c63f4b59e0cc1db6a5fd136df5cbb6fe0a Mon Sep 17 00:00:00 2001 From: Raymond Yau Date: Wed, 4 Jan 2012 15:42:44 +0800 Subject: ALSA: Au88x0 - Xtalk - fix write/read of eq and xt instates Signed-off-by: Raymond Yau Signed-off-by: Takashi Iwai --- sound/pci/au88x0/au88x0_xtalk.c | 64 ++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'sound') diff --git a/sound/pci/au88x0/au88x0_xtalk.c b/sound/pci/au88x0/au88x0_xtalk.c index b4151e2..e55312e 100644 --- a/sound/pci/au88x0/au88x0_xtalk.c +++ b/sound/pci/au88x0/au88x0_xtalk.c @@ -306,10 +306,10 @@ vortex_XtalkHw_SetLeftEQStates(vortex_t * vortex, hwwrite(vortex->mmio, 0x2421C + i * 0x24, coefs[i][2]); hwwrite(vortex->mmio, 0x24220 + i * 0x24, coefs[i][3]); } - hwwrite(vortex->mmio, 0x244F8 + i * 0x24, arg_0[0]); - hwwrite(vortex->mmio, 0x244FC + i * 0x24, arg_0[1]); - hwwrite(vortex->mmio, 0x24500 + i * 0x24, arg_0[2]); - hwwrite(vortex->mmio, 0x24504 + i * 0x24, arg_0[3]); + hwwrite(vortex->mmio, 0x244F8, arg_0[0]); + hwwrite(vortex->mmio, 0x244FC, arg_0[1]); + hwwrite(vortex->mmio, 0x24500, arg_0[2]); + hwwrite(vortex->mmio, 0x24504, arg_0[3]); } static void @@ -325,10 +325,10 @@ vortex_XtalkHw_SetRightEQStates(vortex_t * vortex, hwwrite(vortex->mmio, 0x242D0 + i * 0x24, coefs[i][2]); hwwrite(vortex->mmio, 0x244D4 + i * 0x24, coefs[i][3]); } - hwwrite(vortex->mmio, 0x24508 + i * 0x24, arg_0[0]); - hwwrite(vortex->mmio, 0x2450C + i * 0x24, arg_0[1]); - hwwrite(vortex->mmio, 0x24510 + i * 0x24, arg_0[2]); - hwwrite(vortex->mmio, 0x24514 + i * 0x24, arg_0[3]); + hwwrite(vortex->mmio, 0x24508, arg_0[0]); + hwwrite(vortex->mmio, 0x2450C, arg_0[1]); + hwwrite(vortex->mmio, 0x24510, arg_0[2]); + hwwrite(vortex->mmio, 0x24514, arg_0[3]); } static void @@ -344,10 +344,10 @@ vortex_XtalkHw_SetLeftXTStates(vortex_t * vortex, hwwrite(vortex->mmio, 0x24384 + i * 0x24, coefs[i][2]); hwwrite(vortex->mmio, 0x24388 + i * 0x24, coefs[i][3]); } - hwwrite(vortex->mmio, 0x24518 + i * 0x24, arg_0[0]); - hwwrite(vortex->mmio, 0x2451C + i * 0x24, arg_0[1]); - hwwrite(vortex->mmio, 0x24520 + i * 0x24, arg_0[2]); - hwwrite(vortex->mmio, 0x24524 + i * 0x24, arg_0[3]); + hwwrite(vortex->mmio, 0x24518, arg_0[0]); + hwwrite(vortex->mmio, 0x2451C, arg_0[1]); + hwwrite(vortex->mmio, 0x24520, arg_0[2]); + hwwrite(vortex->mmio, 0x24524, arg_0[3]); } static void @@ -363,10 +363,10 @@ vortex_XtalkHw_SetRightXTStates(vortex_t * vortex, hwwrite(vortex->mmio, 0x24438 + i * 0x24, coefs[i][2]); hwwrite(vortex->mmio, 0x2443C + i * 0x24, coefs[i][3]); } - hwwrite(vortex->mmio, 0x24528 + i * 0x24, arg_0[0]); - hwwrite(vortex->mmio, 0x2452C + i * 0x24, arg_0[1]); - hwwrite(vortex->mmio, 0x24530 + i * 0x24, arg_0[2]); - hwwrite(vortex->mmio, 0x24534 + i * 0x24, arg_0[3]); + hwwrite(vortex->mmio, 0x24528, arg_0[0]); + hwwrite(vortex->mmio, 0x2452C, arg_0[1]); + hwwrite(vortex->mmio, 0x24530, arg_0[2]); + hwwrite(vortex->mmio, 0x24534, arg_0[3]); } #if 0 @@ -450,10 +450,10 @@ vortex_XtalkHw_GetLeftEQStates(vortex_t * vortex, xtalk_instate_t arg_0, coefs[i][2] = hwread(vortex->mmio, 0x2421C + i * 0x24); coefs[i][3] = hwread(vortex->mmio, 0x24220 + i * 0x24); } - arg_0[0] = hwread(vortex->mmio, 0x244F8 + i * 0x24); - arg_0[1] = hwread(vortex->mmio, 0x244FC + i * 0x24); - arg_0[2] = hwread(vortex->mmio, 0x24500 + i * 0x24); - arg_0[3] = hwread(vortex->mmio, 0x24504 + i * 0x24); + arg_0[0] = hwread(vortex->mmio, 0x244F8); + arg_0[1] = hwread(vortex->mmio, 0x244FC); + arg_0[2] = hwread(vortex->mmio, 0x24500); + arg_0[3] = hwread(vortex->mmio, 0x24504); } static void @@ -468,10 +468,10 @@ vortex_XtalkHw_GetRightEQStates(vortex_t * vortex, xtalk_instate_t arg_0, coefs[i][2] = hwread(vortex->mmio, 0x242D0 + i * 0x24); coefs[i][3] = hwread(vortex->mmio, 0x242D4 + i * 0x24); } - arg_0[0] = hwread(vortex->mmio, 0x24508 + i * 0x24); - arg_0[1] = hwread(vortex->mmio, 0x2450C + i * 0x24); - arg_0[2] = hwread(vortex->mmio, 0x24510 + i * 0x24); - arg_0[3] = hwread(vortex->mmio, 0x24514 + i * 0x24); + arg_0[0] = hwread(vortex->mmio, 0x24508); + arg_0[1] = hwread(vortex->mmio, 0x2450C); + arg_0[2] = hwread(vortex->mmio, 0x24510); + arg_0[3] = hwread(vortex->mmio, 0x24514); } static void @@ -486,10 +486,10 @@ vortex_XtalkHw_GetLeftXTStates(vortex_t * vortex, xtalk_instate_t arg_0, coefs[i][2] = hwread(vortex->mmio, 0x24384 + i * 0x24); coefs[i][3] = hwread(vortex->mmio, 0x24388 + i * 0x24); } - arg_0[0] = hwread(vortex->mmio, 0x24518 + i * 0x24); - arg_0[1] = hwread(vortex->mmio, 0x2451C + i * 0x24); - arg_0[2] = hwread(vortex->mmio, 0x24520 + i * 0x24); - arg_0[3] = hwread(vortex->mmio, 0x24524 + i * 0x24); + arg_0[0] = hwread(vortex->mmio, 0x24518); + arg_0[1] = hwread(vortex->mmio, 0x2451C); + arg_0[2] = hwread(vortex->mmio, 0x24520); + arg_0[3] = hwread(vortex->mmio, 0x24524); } static void @@ -504,10 +504,10 @@ vortex_XtalkHw_GetRightXTStates(vortex_t * vortex, xtalk_instate_t arg_0, coefs[i][2] = hwread(vortex->mmio, 0x24438 + i * 0x24); coefs[i][3] = hwread(vortex->mmio, 0x2443C + i * 0x24); } - arg_0[0] = hwread(vortex->mmio, 0x24528 + i * 0x24); - arg_0[1] = hwread(vortex->mmio, 0x2452C + i * 0x24); - arg_0[2] = hwread(vortex->mmio, 0x24530 + i * 0x24); - arg_0[3] = hwread(vortex->mmio, 0x24534 + i * 0x24); + arg_0[0] = hwread(vortex->mmio, 0x24528); + arg_0[1] = hwread(vortex->mmio, 0x2452C); + arg_0[2] = hwread(vortex->mmio, 0x24530); + arg_0[3] = hwread(vortex->mmio, 0x24534); } #endif -- cgit v1.1 From 76474da05ff7b1729b36cd2b6d7aa6b1865d68f1 Mon Sep 17 00:00:00 2001 From: Raymond Yau Date: Wed, 4 Jan 2012 16:16:26 +0800 Subject: ALSA: Au88x0 - Fix Xtalk's constants - Fix XtalkGainsDefault, XtalkGains1Chn - Fix XtalkWideCoefsLeftEQ, XtalkWideCoefsRightEQ - Fix XtlakWideCoefsLeftXT, XtalkWideCoefsRightXT Signed-off-by: Raymond Yau Signed-off-by: Takashi Iwai --- sound/pci/au88x0/au88x0_xtalk.c | 87 ++++++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 31 deletions(-) (limited to 'sound') diff --git a/sound/pci/au88x0/au88x0_xtalk.c b/sound/pci/au88x0/au88x0_xtalk.c index e55312e..b278e28 100644 --- a/sound/pci/au88x0/au88x0_xtalk.c +++ b/sound/pci/au88x0/au88x0_xtalk.c @@ -48,43 +48,61 @@ static unsigned short const wXtalkNarrowLeftDelay = 0x7; static unsigned short const wXtalkNarrowRightDelay = 0x7; static xtalk_gains_t const asXtalkGainsDefault = { - 0x4000, 0x4000, 4000, 0x4000, 4000, 0x4000, 4000, 0x4000, 4000, - 0x4000 + 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, + 0x4000, 0x4000, 0x4000, 0x4000, 0x4000 }; static xtalk_gains_t const asXtalkGainsTest = { - 0x8000, 0x7FFF, 0, 0xFFFF, 0x0001, 0xC000, 0x4000, 0xFFFE, 0x0002, - 0 + 0x7fff, 0x8000, 0x0000, 0x0000, 0x0001, + 0xffff, 0x4000, 0xc000, 0x0002, 0xfffe }; + static xtalk_gains_t const asXtalkGains1Chan = { - 0x7FFF, 0, 0, 0, 0x7FFF, 0, 0, 0, 0, 0 + 0x7FFF, 0, 0, 0, 0, + 0x7FFF, 0, 0, 0, 0, }; // Input gain for 4 A3D slices. One possible input pair is left zero. static xtalk_gains_t const asXtalkGainsAllChan = { - 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, - 0 - //0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7fff,0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7fff + 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0, + 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0 +}; + +static xtalk_gains_t const asXtalkGainsZeros = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -static xtalk_gains_t const asXtalkGainsZeros; -static xtalk_dline_t const alXtalkDlineZeros; +static xtalk_dline_t const alXtalkDlineZeros = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; static xtalk_dline_t const alXtalkDlineTest = { - 0xFC18, 0x03E8FFFF, 0x186A0, 0x7960FFFE, 1, 0xFFFFFFFF, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x0000fc18, 0xfff03e8, 0x000186a0, 0xfffe7960, 1, 0xffffffff, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static xtalk_instate_t const asXtalkInStateZeros = { 0, 0, 0, 0 }; -static xtalk_instate_t const asXtalkInStateZeros; -static xtalk_instate_t const asXtalkInStateTest = - { 0xFF80, 0x0080, 0xFFFF, 0x0001 }; -static xtalk_state_t const asXtalkOutStateZeros; +static xtalk_instate_t const asXtalkInStateTest = { + 0x0080, 0xff80, 0x0001, 0xffff +}; + +static xtalk_state_t const asXtalkOutStateZeros = { + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0} +}; static short const sDiamondKLeftEq = 0x401d; static short const sDiamondKRightEq = 0x401d; static short const sDiamondKLeftXt = 0xF90E; static short const sDiamondKRightXt = 0xF90E; -static short const sDiamondShiftLeftEq = 1; /* 0xF90E Is this a bug ??? */ +static short const sDiamondShiftLeftEq = 1; static short const sDiamondShiftRightEq = 1; static short const sDiamondShiftLeftXt = 0; static short const sDiamondShiftRightXt = 0; @@ -94,29 +112,29 @@ static unsigned short const wDiamondRightDelay = 0xb; static xtalk_coefs_t const asXtalkWideCoefsLeftEq = { {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0}, {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0}, - {0x340B, 0xf504, 0x6CE8, 0x0D23, 0x00E4}, - {0xD500, 0x8D76, 0xACC7, 0x5B05, 0x00FA}, + {0x340B, 0xe8f5, 0x236c, 0xe40d, 0}, + {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0}, {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0} }; static xtalk_coefs_t const asXtalkWideCoefsRightEq = { {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0}, {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0}, - {0x340B, 0xF504, 0x6CE8, 0x0D23, 0x00E4}, - {0xD500, 0x8D76, 0xACC7, 0x5B05, 0x00FA}, + {0x340B, 0xe8f5, 0x236c, 0xe40d, 0}, + {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0}, {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0} }; static xtalk_coefs_t const asXtalkWideCoefsLeftXt = { - {0x86C3, 0x7B55, 0x89C3, 0x005B, 0x0047}, - {0x6000, 0x206A, 0xC6CA, 0x40FF, 0}, - {0x1100, 0x1164, 0xA1D7, 0x90FC, 0x0001}, - {0xDC00, 0x9E77, 0xB8C7, 0x0AFF, 0}, + {0x55c6, 0xc97b, 0x005b, 0x0047, 0}, + {0x6a60, 0xca20, 0xffc6, 0x0040, 0}, + {0x6411, 0xd711, 0xfca1, 0x0190, 0}, + {0x77dc, 0xc79e, 0xffb8, 0x000a, 0}, {0, 0, 0, 0, 0} }; static xtalk_coefs_t const asXtalkWideCoefsRightXt = { - {0x86C3, 0x7B55, 0x89C3, 0x005B, 0x0047}, - {0x6000, 0x206A, 0xC6CA, 0x40FF, 0}, - {0x1100, 0x1164, 0xA1D7, 0x90FC, 0x0001}, - {0xDC00, 0x9E77, 0xB8C7, 0x0AFF, 0}, + {0x55c6, 0xc97b, 0x005b, 0x0047, 0}, + {0x6a60, 0xca20, 0xffc6, 0x0040, 0}, + {0x6411, 0xd711, 0xfca1, 0x0190, 0}, + {0x77dc, 0xc79e, 0xffb8, 0x000a, 0}, {0, 0, 0, 0, 0} }; static xtalk_coefs_t const asXtalkNarrowCoefsLeftEq = { @@ -151,7 +169,14 @@ static xtalk_coefs_t const asXtalkNarrowCoefsRightXt = { {0, 0, 0, 0, 0} }; -static xtalk_coefs_t const asXtalkCoefsZeros; +static xtalk_coefs_t const asXtalkCoefsZeros = { + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + static xtalk_coefs_t const asXtalkCoefsPipe = { {0, 0, 0x0FA0, 0, 0}, {0, 0, 0x0FA0, 0, 0}, @@ -186,7 +211,7 @@ static xtalk_coefs_t const asXtalkCoefsDenTest = { static xtalk_state_t const asXtalkOutStateTest = { {0x7FFF, 0x0004, 0xFFFC, 0}, {0xFE00, 0x0008, 0xFFF8, 0x4000}, - {0x200, 0x0010, 0xFFF0, 0xC000}, + {0x0200, 0x0010, 0xFFF0, 0xC000}, {0x8000, 0x0020, 0xFFE0, 0}, {0, 0, 0, 0} }; -- cgit v1.1 From 3ae4e1f7a0dab95f7e6049272cdb59c7bdc34365 Mon Sep 17 00:00:00 2001 From: Raymond Yau Date: Fri, 6 Jan 2012 09:19:29 +0800 Subject: ALSA: Au88x0 - Fix IRQ fifo error and channels swap of 4 channels playback Fix IRQ fifo error when playing stereo by set stereo flag of fifo control. This also fix the swap of front and rear channels on au8830. Signed-off-by: Raymond Yau Signed-off-by: Takashi Iwai --- sound/pci/au88x0/au88x0_core.c | 8 ++++---- sound/pci/au88x0/au88x0_pcm.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c index 4891503..d49e2c5 100644 --- a/sound/pci/au88x0/au88x0_core.c +++ b/sound/pci/au88x0/au88x0_core.c @@ -805,7 +805,7 @@ static void vortex_fifo_setadbvalid(vortex_t * vortex, int fifo, int en) } static void -vortex_fifo_setadbctrl(vortex_t * vortex, int fifo, int b, int priority, +vortex_fifo_setadbctrl(vortex_t * vortex, int fifo, int stereo, int priority, int empty, int valid, int f) { int temp, lifeboat = 0; @@ -837,7 +837,7 @@ vortex_fifo_setadbctrl(vortex_t * vortex, int fifo, int b, int priority, #else temp = (this_4 & 0x3f) << 0xc; #endif - temp = (temp & 0xfffffffd) | ((b & 1) << 1); + temp = (temp & 0xfffffffd) | ((stereo & 1) << 1); temp = (temp & 0xfffffff3) | ((priority & 3) << 2); temp = (temp & 0xffffffef) | ((valid & 1) << 4); temp |= FIFO_U1; @@ -1148,11 +1148,11 @@ vortex_adbdma_setbuffers(vortex_t * vortex, int adbdma, static void vortex_adbdma_setmode(vortex_t * vortex, int adbdma, int ie, int dir, - int fmt, int d, u32 offset) + int fmt, int stereo, u32 offset) { stream_t *dma = &vortex->dma_adb[adbdma]; - dma->dma_unknown = d; + dma->dma_unknown = stereo; dma->dma_ctrl = ((offset & OFFSET_MASK) | (dma->dma_ctrl & ~OFFSET_MASK)); /* Enable PCMOUT interrupts. */ diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c index c5f7ae4..5099690 100644 --- a/sound/pci/au88x0/au88x0_pcm.c +++ b/sound/pci/au88x0/au88x0_pcm.c @@ -307,8 +307,8 @@ static int snd_vortex_pcm_prepare(struct snd_pcm_substream *substream) fmt = vortex_alsafmt_aspfmt(runtime->format); spin_lock_irq(&chip->lock); if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) { - vortex_adbdma_setmode(chip, dma, 1, dir, fmt, 0 /*? */ , - 0); + vortex_adbdma_setmode(chip, dma, 1, dir, fmt, + runtime->channels == 1 ? 0 : 1, 0); vortex_adbdma_setstartbuffer(chip, dma, 0); if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_SPDIF) vortex_adb_setsrc(chip, dma, runtime->rate, dir); -- cgit v1.1 From fb65c2dfe60d38be6b9193d0b85e66e780cd4373 Mon Sep 17 00:00:00 2001 From: Raymond Yau Date: Sat, 7 Jan 2012 14:35:17 +0800 Subject: ALSA: Au88x0 - Fix channels swapping of 4 channels playback Fix channels swapping of 4 channels playback by using vortex_adbdma_stopfifo instead of vortex_adbdma_pausefifo for SNDRV_PCM_TRIGGER_STOP event Signed-off-by: Raymond Yau Signed-off-by: Takashi Iwai --- sound/pci/au88x0/au88x0_core.c | 2 -- sound/pci/au88x0/au88x0_pcm.c | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c index d49e2c5..6933a27 100644 --- a/sound/pci/au88x0/au88x0_core.c +++ b/sound/pci/au88x0/au88x0_core.c @@ -1336,7 +1336,6 @@ static void vortex_adbdma_pausefifo(vortex_t * vortex, int adbdma) dma->fifo_status = FIFO_PAUSE; } -#if 0 // Using pause instead static void vortex_adbdma_stopfifo(vortex_t * vortex, int adbdma) { stream_t *dma = &vortex->dma_adb[adbdma]; @@ -1351,7 +1350,6 @@ static void vortex_adbdma_stopfifo(vortex_t * vortex, int adbdma) dma->fifo_enabled = 0; } -#endif /* WTDMA */ #ifndef CHIP_AU8810 diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c index 5099690..0488633 100644 --- a/sound/pci/au88x0/au88x0_pcm.c +++ b/sound/pci/au88x0/au88x0_pcm.c @@ -353,8 +353,7 @@ static int snd_vortex_pcm_trigger(struct snd_pcm_substream *substream, int cmd) //printk(KERN_INFO "vortex: stop %d\n", dma); stream->fifo_enabled = 0; if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) - vortex_adbdma_pausefifo(chip, dma); - //vortex_adbdma_stopfifo(chip, dma); + vortex_adbdma_stopfifo(chip, dma); #ifndef CHIP_AU8810 else { printk(KERN_INFO "vortex: wt stop %d\n", dma); -- cgit v1.1 From 4fa0e81b83503900be277e6273a79651b375e288 Mon Sep 17 00:00:00 2001 From: Xi Wang Date: Sun, 8 Jan 2012 09:02:52 -0500 Subject: ALSA: usb-audio: fix possible hang and overflow in parse_uac2_sample_rate_range() A malicious USB device may feed in carefully crafted min/max/res values, so that the inner loop in parse_uac2_sample_rate_range() could run for a long time or even never terminate, e.g., given max = INT_MAX. Also nr_rates could be a large integer, which causes an integer overflow in the subsequent call to kmalloc() in parse_audio_format_rates_v2(). Thus, kmalloc() would allocate a smaller buffer than expected, leading to a memory corruption. To exploit the two vulnerabilities, an attacker needs physical access to the machine to plug in a malicious USB device. This patch makes two changes. 1) The type of "rate" is changed to unsigned int, so that the loop could stop once "rate" is larger than INT_MAX. 2) Limit nr_rates to 1024. Suggested-by: Takashi Iwai Signed-off-by: Xi Wang Signed-off-by: Takashi Iwai --- sound/usb/format.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/format.c b/sound/usb/format.c index 89421d1..e09aba1 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -209,6 +209,8 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof return 0; } +#define MAX_UAC2_NR_RATES 1024 + /* * Helper function to walk the array of sample rate triplets reported by * the device. The problem is that we need to parse whole array first to @@ -226,7 +228,7 @@ static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets, int min = combine_quad(&data[2 + 12 * i]); int max = combine_quad(&data[6 + 12 * i]); int res = combine_quad(&data[10 + 12 * i]); - int rate; + unsigned int rate; if ((max < 0) || (min < 0) || (res < 0) || (max < min)) continue; @@ -253,6 +255,10 @@ static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets, fp->rates |= snd_pcm_rate_to_rate_bit(rate); nr_rates++; + if (nr_rates >= MAX_UAC2_NR_RATES) { + snd_printk(KERN_ERR "invalid uac2 rates\n"); + break; + } /* avoid endless loop */ if (res == 0) -- cgit v1.1 From 7d53a631ed92abd19d3c948a5daa535e53bd2bff Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Wed, 4 Jan 2012 14:31:16 +0100 Subject: ALSA: hdspm - Refactor serial number to avoid code duplication The serial number is used multiple times in hdspm.c. Since it belongs to the card, let's store it in struct hdspm and refer to it whenever necessary. Signed-off-by: Adrian Knoth Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdspm.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index d623451..1609253 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -941,6 +941,8 @@ struct hdspm { cycles_t last_interrupt; + unsigned int serial; + struct hdspm_peak_rms peak_rms; }; @@ -4694,7 +4696,7 @@ snd_hdspm_proc_read_madi(struct snd_info_entry * entry, snd_iprintf(buffer, "HW Serial: 0x%06x%06x\n", (hdspm_read(hdspm, HDSPM_midiStatusIn1)>>8) & 0xFFFFFF, - (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF); + hdspm->serial); snd_iprintf(buffer, "IRQ: %d Registers bus: 0x%lx VM: 0x%lx\n", hdspm->irq, hdspm->port, (unsigned long)hdspm->iobase); @@ -6266,8 +6268,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, hdspm_version.card_type = hdspm->io_type; strncpy(hdspm_version.cardname, hdspm->card_name, sizeof(hdspm_version.cardname)); - hdspm_version.serial = (hdspm_read(hdspm, - HDSPM_midiStatusIn0)>>8) & 0xFFFFFF; + hdspm_version.serial = hdspm->serial; hdspm_version.firmware_rev = hdspm->firmware_rev; hdspm_version.addons = 0; if (hdspm->tco) @@ -6866,12 +6867,14 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci, } if (hdspm->io_type != MADIface) { + hdspm->serial = (hdspm_read(hdspm, + HDSPM_midiStatusIn0)>>8) & 0xFFFFFF; sprintf(card->shortname, "%s_%x", hdspm->card_name, - (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF); + hdspm->serial); sprintf(card->longname, "%s S/N 0x%x at 0x%lx, irq %d", hdspm->card_name, - (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF, + hdspm->serial, hdspm->port, hdspm->irq); } else { sprintf(card->shortname, "%s", hdspm->card_name); -- cgit v1.1 From b2ed1b0bc69e53d68aa01b79ca0944311b553fc1 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 8 Jan 2012 22:50:00 -0800 Subject: ASoC: Fix idma build after update for channel count check Signed-off-by: Mark Brown --- sound/soc/samsung/idma.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c index 3ba6aba..c227c31 100644 --- a/sound/soc/samsung/idma.c +++ b/sound/soc/samsung/idma.c @@ -398,6 +398,7 @@ static int idma_new(struct snd_soc_pcm_runtime *rtd) if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { ret = preallocate_idma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK); + } return ret; } -- cgit v1.1 From d0f3a2eb9062560bebca8b923424f3ca02a331ba Mon Sep 17 00:00:00 2001 From: Karsten Wiese Date: Fri, 30 Dec 2011 01:42:01 +0100 Subject: ALSA: snd-usb-us122l: Delete calls to preempt_disable They are not needed here. Signed-off-by: Karsten Wiese Cc: stable@kernel.org Signed-off-by: Takashi Iwai --- sound/usb/usx2y/usb_stream.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c index c400ade..1e7a47a 100644 --- a/sound/usb/usx2y/usb_stream.c +++ b/sound/usb/usx2y/usb_stream.c @@ -674,7 +674,7 @@ dotry: inurb->transfer_buffer_length = inurb->number_of_packets * inurb->iso_frame_desc[0].length; - preempt_disable(); + if (u == 0) { int now; struct usb_device *dev = inurb->dev; @@ -686,19 +686,17 @@ dotry: } err = usb_submit_urb(inurb, GFP_ATOMIC); if (err < 0) { - preempt_enable(); snd_printk(KERN_ERR"usb_submit_urb(sk->inurb[%i])" " returned %i\n", u, err); return err; } err = usb_submit_urb(outurb, GFP_ATOMIC); if (err < 0) { - preempt_enable(); snd_printk(KERN_ERR"usb_submit_urb(sk->outurb[%i])" " returned %i\n", u, err); return err; } - preempt_enable(); + if (inurb->start_frame != outurb->start_frame) { snd_printd(KERN_DEBUG "u[%i] start_frames differ in:%u out:%u\n", -- cgit v1.1 From 80c8a2a372599e604b04a9c568952fe39cd1851d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Jan 2012 11:37:20 +0100 Subject: ALSA: usb-audio - Avoid flood of frame-active debug messages With some buggy devices, the usb-audio driver may give "frame xxx active" kernel messages too often. Better to keep it as debug-only using snd_printdd(), and also add the rate-limit for avoiding floods. Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=738681 Cc: Signed-off-by: Takashi Iwai --- sound/usb/endpoint.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 81c6ede..08dcce5 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -458,8 +459,8 @@ static int retire_capture_urb(struct snd_usb_substream *subs, for (i = 0; i < urb->number_of_packets; i++) { cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset; - if (urb->iso_frame_desc[i].status) { - snd_printd(KERN_ERR "frame %d active: %d\n", i, urb->iso_frame_desc[i].status); + if (urb->iso_frame_desc[i].status && printk_ratelimit()) { + snd_printdd("frame %d active: %d\n", i, urb->iso_frame_desc[i].status); // continue; } bytes = urb->iso_frame_desc[i].actual_length; -- cgit v1.1 From f75a8ff67d161b5166a2c2360bb2ffaefd5eb853 Mon Sep 17 00:00:00 2001 From: Janusz Krzysztofik Date: Fri, 30 Dec 2011 04:04:54 +0100 Subject: ASoC: cx20442: add bias control over a platform provided regulator Now that a regulator device for controlling the codec chip reset state over a platform agnostic regulator API is available on the only board using this driver so far, extend the driver with a bias control function which will request virtual power to the codec chip from that virtual regulator, and will supersede the present implementation existing at the sound card level. Thanks to the regulator sharing mechanism, both the old (the sound card) and the new (the codec) implementations should coexist smoothly until the sound card file is updated. For this to work as expected, update the sound card .set_bias_level callback to not touch codec->dapm.bias_level. While extending the cx20442 structure, drop unused control_type member. Created against linxu-3.2-rc6, tested on top of patch 1/4 "ARM: OMAP1: ams-delta: set up a regulator over the modem reset GPIO pin". Signed-off-by: Janusz Krzysztofik Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- sound/soc/codecs/cx20442.c | 48 ++++++++++++++++++++++++++++++++++++++++++++-- sound/soc/omap/ams-delta.c | 8 +++----- 2 files changed, 49 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index ae55e31..d5fd00a 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -25,8 +26,8 @@ struct cx20442_priv { - enum snd_soc_control_type control_type; void *control_data; + struct regulator *por; }; #define CX20442_PM 0x0 @@ -324,6 +325,38 @@ static struct snd_soc_dai_driver cx20442_dai = { }, }; +static int cx20442_set_bias_level(struct snd_soc_codec *codec, + enum snd_soc_bias_level level) +{ + struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec); + int err = 0; + + switch (level) { + case SND_SOC_BIAS_PREPARE: + if (codec->dapm.bias_level != SND_SOC_BIAS_STANDBY) + break; + if (IS_ERR(cx20442->por)) + err = PTR_ERR(cx20442->por); + else + err = regulator_enable(cx20442->por); + break; + case SND_SOC_BIAS_STANDBY: + if (codec->dapm.bias_level != SND_SOC_BIAS_PREPARE) + break; + if (IS_ERR(cx20442->por)) + err = PTR_ERR(cx20442->por); + else + err = regulator_disable(cx20442->por); + break; + default: + break; + } + if (!err) + codec->dapm.bias_level = level; + + return err; +} + static int cx20442_codec_probe(struct snd_soc_codec *codec) { struct cx20442_priv *cx20442; @@ -331,9 +364,13 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec) cx20442 = kzalloc(sizeof(struct cx20442_priv), GFP_KERNEL); if (cx20442 == NULL) return -ENOMEM; - snd_soc_codec_set_drvdata(codec, cx20442); + cx20442->por = regulator_get(codec->dev, "POR"); + if (IS_ERR(cx20442->por)) + dev_warn(codec->dev, "failed to get the regulator"); cx20442->control_data = NULL; + + snd_soc_codec_set_drvdata(codec, cx20442); codec->hw_write = NULL; codec->card->pop_time = 0; @@ -350,6 +387,12 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec) tty_hangup(tty); } + if (!IS_ERR(cx20442->por)) { + /* should be already in STANDBY, hence disabled */ + regulator_put(cx20442->por); + } + + snd_soc_codec_set_drvdata(codec, NULL); kfree(cx20442); return 0; } @@ -359,6 +402,7 @@ static const u8 cx20442_reg; static struct snd_soc_codec_driver cx20442_codec_dev = { .probe = cx20442_codec_probe, .remove = cx20442_codec_remove, + .set_bias_level = cx20442_set_bias_level, .reg_cache_default = &cx20442_reg, .reg_cache_size = 1, .reg_word_size = sizeof(u8), diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c index 3e523a7..a67f437 100644 --- a/sound/soc/omap/ams-delta.c +++ b/sound/soc/omap/ams-delta.c @@ -431,22 +431,20 @@ static int ams_delta_set_bias_level(struct snd_soc_card *card, struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) { - struct snd_soc_codec *codec = card->rtd->codec; - switch (level) { case SND_SOC_BIAS_ON: case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_STANDBY: - if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) + if (card->dapm.bias_level == SND_SOC_BIAS_OFF) ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, AMS_DELTA_LATCH2_MODEM_NRESET); break; case SND_SOC_BIAS_OFF: - if (codec->dapm.bias_level != SND_SOC_BIAS_OFF) + if (card->dapm.bias_level != SND_SOC_BIAS_OFF) ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, 0); } - codec->dapm.bias_level = level; + card->dapm.bias_level = level; return 0; } -- cgit v1.1 From 7e5bea19aed376855eb2928c6d3c9ab0b35b5af7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lal?= Date: Mon, 9 Jan 2012 17:19:45 +0100 Subject: ALSA: hda/cirrus - support for iMac12,2 model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This early 2011 model just need to have headphones on GPI02 instead of GPI01, and use BIOS pincfgs. It is detected by codec SSID. The iMac12,1 model is known to work the same way, although maybe not with the same codec SSID. Signed-off-by: Jérémy Lal Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_cirrus.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 036056c4..0e99357 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c @@ -79,6 +79,7 @@ enum { CS420X_MBP53, CS420X_MBP55, CS420X_IMAC27, + CS420X_IMAC27_122, CS420X_APPLE, CS420X_AUTO, CS420X_MODELS @@ -1290,6 +1291,7 @@ static const char * const cs420x_models[CS420X_MODELS] = { [CS420X_MBP53] = "mbp53", [CS420X_MBP55] = "mbp55", [CS420X_IMAC27] = "imac27", + [CS420X_IMAC27_122] = "imac27_122", [CS420X_APPLE] = "apple", [CS420X_AUTO] = "auto", }; @@ -1306,6 +1308,7 @@ static const struct snd_pci_quirk cs420x_cfg_tbl[] = { }; static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = { + SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122), SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), {} /* terminator */ }; @@ -1405,6 +1408,12 @@ static int patch_cs420x(struct hda_codec *codec) spec->gpio_mask = spec->gpio_dir = spec->gpio_eapd_hp | spec->gpio_eapd_speaker; break; + case CS420X_IMAC27_122: + spec->gpio_eapd_hp = 4; /* GPIO2 = headphones */ + spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ + spec->gpio_mask = spec->gpio_dir = + spec->gpio_eapd_hp | spec->gpio_eapd_speaker; + break; } err = cs_parse_auto_config(codec); -- cgit v1.1 From 9badda0a0afffebbe1cb30565800896534a6c5bd Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Jan 2012 18:22:35 +0100 Subject: ALSA: hdsp - Fix potential Oops in snd_hdsp_info_pref_sync_ref() Dan Carpenter reported that setting 0 to uinfo->value.enumerated.items in snd_hdsp_info_pref_sync_ref() may lead to Oops. This function should return an error immediately in such a case instead. Cc: Dan Carpenter Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdsp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 0111203..b68cdec 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -2640,8 +2640,7 @@ static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd uinfo->value.enumerated.items = 3; break; default: - uinfo->value.enumerated.items = 0; - break; + return -EINVAL; } if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) -- cgit v1.1 From 74eeb141d3bdf5a9a65c84dd637c41f12c40f41c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 9 Jan 2012 18:26:05 +0100 Subject: ALSA: asihpi - Fix potential Oops in snd_asihpi_cmode_info() Dan Carpenter reported that setting 0 to uinfo->value.enumerated.items in snd_asihpi_cmode_info() may lead to Oops. This function should return an error immediately in such a case instead. Cc: Dan Carpenter Signed-off-by: Takashi Iwai --- sound/pci/asihpi/asihpi.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sound') diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index fd3926f..e8de831 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -2259,6 +2259,9 @@ static int snd_asihpi_cmode_info(struct snd_kcontrol *kcontrol, valid_modes++; } + if (!valid_modes) + return -EINVAL; + uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; uinfo->value.enumerated.items = valid_modes; -- cgit v1.1 From de4da59e480cdf1075b33dbaf8078fc87bc52241 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Jan 2012 08:59:56 +0100 Subject: ALSA: hda - Use auto-parser for HP laptops with cx20459 codec These laptops can work well with the auto-parser and their BIOS setups, and in addition, the auto-parser fixes the problem with S3/S4 where the unsol event handling is killed after resume due to fallback to the single-cmd mode. Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=740115 Cc: [v3.1+] Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index bf14a0a..8a32a69 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -1086,8 +1086,6 @@ static const char * const cxt5045_models[CXT5045_MODELS] = { static const struct snd_pci_quirk cxt5045_cfg_tbl[] = { SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530), - SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series", - CXT5045_LAPTOP_HPSENSE), SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT5045_LAPTOP_MICSENSE), SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ), SND_PCI_QUIRK(0x1734, 0x10ad, "Fujitsu Si1520", CXT5045_LAPTOP_MICSENSE), -- cgit v1.1 From 3a90274de3548ebb2aabfbf488cea8e275a73dc6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Jan 2012 12:41:22 +0100 Subject: ALSA: hda - Return the error from get_wcaps_type() for invalid NIDs When an invalid NID is given, get_wcaps() returns zero as the error, but get_wcaps_type() takes it as the normal value and returns a bogus AC_WID_AUD_OUT value. This confuses the parser. With this patch, get_wcaps_type() returns -1 when value 0 is given, i.e. an invalid NID is passed to get_wcaps(). Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=740118 Cc: Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_local.h | 7 ++++++- sound/pci/hda/hda_proc.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index e1abc07..aca8d31 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -488,7 +488,12 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid) } /* get the widget type from widget capability bits */ -#define get_wcaps_type(wcaps) (((wcaps) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT) +static inline int get_wcaps_type(unsigned int wcaps) +{ + if (!wcaps) + return -1; /* invalid type */ + return (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; +} static inline unsigned int get_wcaps_channels(u32 wcaps) { diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 2c981b5..254ab52 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c @@ -54,6 +54,8 @@ static const char *get_wid_type_name(unsigned int wid_value) [AC_WID_BEEP] = "Beep Generator Widget", [AC_WID_VENDOR] = "Vendor Defined Widget", }; + if (wid_value == -1) + return "UNKNOWN Widget"; wid_value &= 0xf; if (names[wid_value]) return names[wid_value]; -- cgit v1.1 From 4808d12d1dddb046ec86425e5f6766f02e950292 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 10 Jan 2012 15:16:02 +0100 Subject: ALSA: hda - Fix the detection of "Loopback Mixing" control for VIA codecs Currently the driver checks only the out_mix_path[] for the primary output route for judging whether to create the loopback-mixing control or not. But, there are cases where aamix-routing is available only on headphone or speaker paths but not on the primary output path. So, the driver ignores such cases inappropriately. This patch fixes the check of the loopback-mixing control by testing all mix-routing paths. Cc: Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_via.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index ab56866..03e63fe 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -2208,7 +2208,10 @@ static int via_auto_create_loopback_switch(struct hda_codec *codec) { struct via_spec *spec = codec->spec; - if (!spec->aa_mix_nid || !spec->out_mix_path.depth) + if (!spec->aa_mix_nid) + return 0; /* no loopback switching available */ + if (!(spec->out_mix_path.depth || spec->hp_mix_path.depth || + spec->speaker_path.depth)) return 0; /* no loopback switching available */ if (!via_clone_control(spec, &via_aamix_ctl_enum)) return -ENOMEM; -- cgit v1.1 From e4e9e05409280b50003280afffe27ade21480dd7 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Tue, 10 Jan 2012 14:19:12 +0800 Subject: ASoC: Fix recursive dependency due to select ATMEL_SSC in SND_ATMEL_SOC_SSC commit 739be96 "ASoC: Fix build dependency for SND_ATMEL_SOC_SSC" introduces below build warnings: drivers/misc/Kconfig:212:error: recursive dependency detected! drivers/misc/Kconfig:212: symbol ATMEL_SSC is selected by SND_ATMEL_SOC_SSC sound/soc/atmel/Kconfig:9: symbol SND_ATMEL_SOC_SSC is selected by SND_AT91_SOC_SAM9G20_WM8731 sound/soc/atmel/Kconfig:18: symbol SND_AT91_SOC_SAM9G20_WM8731 depends on ATMEL_SSC SND_ATMEL_SOC_SSC needs ATMEL_SSC to pass compilation. This patch remove the "select ATMEL_SSC" from SND_ATMEL_SOC_SSC to avoid above warnings. And then ensures all the machine drivers that select SND_ATMEL_SOC_SSC need to depend on ATMEL_SSC. Reported-by: Stephen Rothwell Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/atmel/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig index a4d6742..72b09cf 100644 --- a/sound/soc/atmel/Kconfig +++ b/sound/soc/atmel/Kconfig @@ -9,7 +9,6 @@ config SND_ATMEL_SOC config SND_ATMEL_SOC_SSC tristate depends on SND_ATMEL_SOC - select ATMEL_SSC help Say Y or M if you want to add support for codecs the ATMEL SSC interface. You will also needs to select the individual @@ -27,7 +26,7 @@ config SND_AT91_SOC_SAM9G20_WM8731 config SND_AT91_SOC_AFEB9260 tristate "SoC Audio support for AFEB9260 board" - depends on ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC + depends on ATMEL_SSC && ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC select SND_ATMEL_SOC_SSC select SND_SOC_TLV320AIC23 help -- cgit v1.1 From 36ae1a96c4dcb0f6581d595cc5d43cf3a7e648c7 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 6 Jan 2012 17:12:45 -0800 Subject: ASoC: Dynamically allocate the rtd device for a non-empty release() The device model needs a release() function so it can free devices when they become dereferenced. Do that for rtds. Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 44 +++++++++++++++++++++++++------------------- sound/soc/soc-dapm.c | 3 +-- 2 files changed, 26 insertions(+), 21 deletions(-) (limited to 'sound') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index acbb960..3986520 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -169,8 +169,7 @@ static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf, static ssize_t codec_reg_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct snd_soc_pcm_runtime *rtd = - container_of(dev, struct snd_soc_pcm_runtime, dev); + struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); return soc_codec_reg_show(rtd->codec, buf, PAGE_SIZE, 0); } @@ -180,8 +179,7 @@ static DEVICE_ATTR(codec_reg, 0444, codec_reg_show, NULL); static ssize_t pmdown_time_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct snd_soc_pcm_runtime *rtd = - container_of(dev, struct snd_soc_pcm_runtime, dev); + struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); return sprintf(buf, "%ld\n", rtd->pmdown_time); } @@ -190,8 +188,7 @@ static ssize_t pmdown_time_set(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct snd_soc_pcm_runtime *rtd = - container_of(dev, struct snd_soc_pcm_runtime, dev); + struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); int ret; ret = strict_strtol(buf, 10, &rtd->pmdown_time); @@ -884,9 +881,9 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order) /* unregister the rtd device */ if (rtd->dev_registered) { - device_remove_file(&rtd->dev, &dev_attr_pmdown_time); - device_remove_file(&rtd->dev, &dev_attr_codec_reg); - device_unregister(&rtd->dev); + device_remove_file(rtd->dev, &dev_attr_pmdown_time); + device_remove_file(rtd->dev, &dev_attr_codec_reg); + device_unregister(rtd->dev); rtd->dev_registered = 0; } @@ -1061,7 +1058,10 @@ err_probe: return ret; } -static void rtd_release(struct device *dev) {} +static void rtd_release(struct device *dev) +{ + kfree(dev); +} static int soc_post_component_init(struct snd_soc_card *card, struct snd_soc_codec *codec, @@ -1104,11 +1104,17 @@ static int soc_post_component_init(struct snd_soc_card *card, /* register the rtd device */ rtd->codec = codec; - rtd->dev.parent = card->dev; - rtd->dev.release = rtd_release; - rtd->dev.init_name = name; + + rtd->dev = kzalloc(sizeof(struct device), GFP_KERNEL); + if (!rtd->dev) + return -ENOMEM; + device_initialize(rtd->dev); + rtd->dev->parent = card->dev; + rtd->dev->release = rtd_release; + rtd->dev->init_name = name; + dev_set_drvdata(rtd->dev, rtd); mutex_init(&rtd->pcm_mutex); - ret = device_register(&rtd->dev); + ret = device_add(rtd->dev); if (ret < 0) { dev_err(card->dev, "asoc: failed to register runtime device: %d\n", ret); @@ -1117,14 +1123,14 @@ static int soc_post_component_init(struct snd_soc_card *card, rtd->dev_registered = 1; /* add DAPM sysfs entries for this codec */ - ret = snd_soc_dapm_sys_add(&rtd->dev); + ret = snd_soc_dapm_sys_add(rtd->dev); if (ret < 0) dev_err(codec->dev, "asoc: failed to add codec dapm sysfs entries: %d\n", ret); /* add codec sysfs entries */ - ret = device_create_file(&rtd->dev, &dev_attr_codec_reg); + ret = device_create_file(rtd->dev, &dev_attr_codec_reg); if (ret < 0) dev_err(codec->dev, "asoc: failed to add codec sysfs files: %d\n", ret); @@ -1213,7 +1219,7 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num, int order) if (ret) return ret; - ret = device_create_file(&rtd->dev, &dev_attr_pmdown_time); + ret = device_create_file(rtd->dev, &dev_attr_pmdown_time); if (ret < 0) printk(KERN_WARNING "asoc: failed to add pmdown_time sysfs\n"); @@ -1311,8 +1317,8 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num) /* unregister the rtd device */ if (rtd->dev_registered) { - device_remove_file(&rtd->dev, &dev_attr_codec_reg); - device_unregister(&rtd->dev); + device_remove_file(rtd->dev, &dev_attr_codec_reg); + device_del(rtd->dev); rtd->dev_registered = 0; } diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index e174d08..3ad1f59 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -1738,8 +1738,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, static ssize_t dapm_widget_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct snd_soc_pcm_runtime *rtd = - container_of(dev, struct snd_soc_pcm_runtime, dev); + struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); struct snd_soc_codec *codec =rtd->codec; struct snd_soc_dapm_widget *w; int count = 0; -- cgit v1.1 From f7de8ba3fcf19487d2f0af9aee0c510fc79efa15 Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Tue, 10 Jan 2012 20:58:40 +0100 Subject: ALSA: hdspm - Provide unique driver id based on card serial Before, /proc/asound looked like this: 2 [Default ]: HDSPM - RME RayDAT_f1cd85 RME RayDAT S/N 0xf1cd85 at 0xf7300000, irq 18 In case of a second HDSPM card, its name would be Default_1. This is cumbersome, because the order of the cards isn't stable across reboots. To help userspace tools referring to the correct card, this commit provides a unique id for each card: 2 [HDSPMxf1cd85 ]: HDSPM - RME RayDAT_f1cd85 RME RayDAT S/N 0xf1cd85 at 0xf7300000, irq 18 In this example, userspace (configuration files) would then use hw:HDSPMxf1cd85 to choose the right card. The serial is masked to 24bits, so this string is always shorter than sixteen chars. Signed-off-by: Adrian Knoth Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdspm.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 1609253..cc9f6c8 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -6783,6 +6783,25 @@ static int __devinit snd_hdspm_create(struct snd_card *card, tasklet_init(&hdspm->midi_tasklet, hdspm_midi_tasklet, (unsigned long) hdspm); + + if (hdspm->io_type != MADIface) { + hdspm->serial = (hdspm_read(hdspm, + HDSPM_midiStatusIn0)>>8) & 0xFFFFFF; + /* id contains either a user-provided value or the default + * NULL. If it's the default, we're safe to + * fill card->id with the serial number. + * + * If the serial number is 0xFFFFFF, then we're dealing with + * an old PCI revision that comes without a sane number. In + * this case, we don't set card->id to avoid collisions + * when running with multiple cards. + */ + if (NULL == id[hdspm->dev] && hdspm->serial != 0xFFFFFF) { + sprintf(card->id, "HDSPMx%06x", hdspm->serial); + snd_card_set_id(card, card->id); + } + } + snd_printdd("create alsa devices.\n"); err = snd_hdspm_create_alsa_devices(card, hdspm); if (err < 0) @@ -6867,8 +6886,6 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci, } if (hdspm->io_type != MADIface) { - hdspm->serial = (hdspm_read(hdspm, - HDSPM_midiStatusIn0)>>8) & 0xFFFFFF; sprintf(card->shortname, "%s_%x", hdspm->card_name, hdspm->serial); -- cgit v1.1 From ffd364ddd3090e2ef0d4882970c1e342db8b482f Mon Sep 17 00:00:00 2001 From: Pavel Hofman Date: Tue, 10 Jan 2012 20:45:28 +0100 Subject: ALSA: ice1724 - Create capture pcm only for ADC-enabled configurations Add the capture pcm only if there is at least one ADC configured in the SYSCONF register. Signed-off-by: Pavel Hofman Signed-off-by: Takashi Iwai --- sound/pci/ice1712/envy24ht.h | 1 + sound/pci/ice1712/ice1724.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/ice1712/envy24ht.h b/sound/pci/ice1712/envy24ht.h index a0c5e00..4ca33a8 100644 --- a/sound/pci/ice1712/envy24ht.h +++ b/sound/pci/ice1712/envy24ht.h @@ -66,6 +66,7 @@ enum { #define VT1724_CFG_CLOCK384 0x40 /* 16.9344Mhz, 44.1kHz*384 */ #define VT1724_CFG_MPU401 0x20 /* MPU401 UARTs */ #define VT1724_CFG_ADC_MASK 0x0c /* one, two or one and S/PDIF, stereo ADCs */ +#define VT1724_CFG_ADC_NONE 0x0c /* no ADCs */ #define VT1724_CFG_DAC_MASK 0x03 /* one, two, three, four stereo DACs */ #define VT1724_REG_AC97_CFG 0x05 /* byte */ diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 9e18d3a..e797823 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -1117,14 +1117,21 @@ static struct snd_pcm_ops snd_vt1724_capture_pro_ops = { static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device) { struct snd_pcm *pcm; - int err; + int capt, err; - err = snd_pcm_new(ice->card, "ICE1724", device, 1, 1, &pcm); + if ((ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_ADC_MASK) == + VT1724_CFG_ADC_NONE) + capt = 0; + else + capt = 1; + err = snd_pcm_new(ice->card, "ICE1724", device, 1, capt, &pcm); if (err < 0) return err; snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_vt1724_playback_pro_ops); - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_vt1724_capture_pro_ops); + if (capt) + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, + &snd_vt1724_capture_pro_ops); pcm->private_data = ice; pcm->info_flags = 0; -- cgit v1.1 From 2b151ef734b1be749e355f32f94f649acfde0f48 Mon Sep 17 00:00:00 2001 From: Pavel Hofman Date: Tue, 10 Jan 2012 20:28:47 +0100 Subject: ALSA: ice1724 - Allow card info based on model only When two different cards share the same PCI vendor/subvendor identification, allow card info based on model only. Do not require subvendor ID. Signed-off-by: Pavel Hofman Signed-off-by: Takashi Iwai --- sound/pci/ice1712/ice1724.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index e797823..352f3ff 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -2282,7 +2282,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, } } for (tbl = card_tables; *tbl; tbl++) { - for (c = *tbl; c->subvendor; c++) { + for (c = *tbl; c->name; c++) { if (modelname && c->model && !strcmp(modelname, c->model)) { printk(KERN_INFO "ice1724: Using board model %s\n", @@ -2591,8 +2591,10 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, ice->ext_clock_count = 0; for (tbl = card_tables; *tbl; tbl++) { - for (c = *tbl; c->subvendor; c++) { - if (c->subvendor == ice->eeprom.subvendor) { + for (c = *tbl; c->name; c++) { + if ((model[dev] && c->model && + !strcmp(model[dev], c->model)) || + (c->subvendor == ice->eeprom.subvendor)) { strcpy(card->shortname, c->name); if (c->driver) /* specific driver? */ strcpy(card->driver, c->driver); -- cgit v1.1 From 52cd0a76fd7e7b47f0b0ad594ad5fd3b69949f76 Mon Sep 17 00:00:00 2001 From: Pavel Hofman Date: Tue, 10 Jan 2012 20:28:48 +0100 Subject: ALSA: ice1724 - Support for ooAoo SQ210a This card shares PCI ids with Chaintec AV710. Therefore, it will not be detected automatically, it can only be activated by the module parameter model=sq210a. Signed-off-by: Pavel Hofman Signed-off-by: Takashi Iwai --- sound/pci/ice1712/ice1724.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'sound') diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 352f3ff..9236297 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -2185,6 +2185,40 @@ static struct snd_kcontrol_new snd_vt1724_mixer_pro_peak __devinitdata = { static struct snd_ice1712_card_info no_matched __devinitdata; + +/* + ooAoo cards with no controls +*/ +static unsigned char ooaoo_sq210_eeprom[] __devinitdata = { + [ICE_EEP2_SYSCONF] = 0x4c, /* 49MHz crystal, no mpu401, no ADC, + 1xDACs */ + [ICE_EEP2_ACLINK] = 0x80, /* I2S */ + [ICE_EEP2_I2S] = 0x78, /* no volume, 96k, 24bit, 192k */ + [ICE_EEP2_SPDIF] = 0xc1, /* out-en, out-int, out-ext */ + [ICE_EEP2_GPIO_DIR] = 0x00, /* no GPIOs are used */ + [ICE_EEP2_GPIO_DIR1] = 0x00, + [ICE_EEP2_GPIO_DIR2] = 0x00, + [ICE_EEP2_GPIO_MASK] = 0xff, + [ICE_EEP2_GPIO_MASK1] = 0xff, + [ICE_EEP2_GPIO_MASK2] = 0xff, + + [ICE_EEP2_GPIO_STATE] = 0x00, /* inputs */ + [ICE_EEP2_GPIO_STATE1] = 0x00, /* all 1, but GPIO_CPLD_RW + and GPIO15 always zero */ + [ICE_EEP2_GPIO_STATE2] = 0x00, /* inputs */ +}; + + +struct snd_ice1712_card_info snd_vt1724_ooaoo_cards[] __devinitdata = { + { + .name = "ooAoo SQ210a", + .model = "sq210a", + .eeprom_size = sizeof(ooaoo_sq210_eeprom), + .eeprom_data = ooaoo_sq210_eeprom, + }, + { } /* terminator */ +}; + static struct snd_ice1712_card_info *card_tables[] __devinitdata = { snd_vt1724_revo_cards, snd_vt1724_amp_cards, @@ -2199,6 +2233,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = { snd_vt1724_wtm_cards, snd_vt1724_se_cards, snd_vt1724_qtet_cards, + snd_vt1724_ooaoo_cards, NULL, }; -- cgit v1.1 From 56225e4cc88a24d3e1632bdfb901a3c38615fc42 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 6 Dec 2011 10:07:43 +0100 Subject: ALSA: virtuoso: add S/PDIF input support for all Xonars All Xonar cards support S/PDIF input, but the cards without optical or coaxial plugs have only undocumented pin connectors. Support for the ST/STX was already added in a previous patch; this adds support for the D1/DX (JP2), DG (J5), DS (J5), and HDAV Slim (J12). Many thanks to Zoltan Miklos for testing the DS and DX. Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/pci/oxygen/xonar_cs43xx.c | 1 + sound/pci/oxygen/xonar_dg.c | 3 ++- sound/pci/oxygen/xonar_wm87x6.c | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/oxygen/xonar_cs43xx.c b/sound/pci/oxygen/xonar_cs43xx.c index 2527191..c8febf4 100644 --- a/sound/pci/oxygen/xonar_cs43xx.c +++ b/sound/pci/oxygen/xonar_cs43xx.c @@ -418,6 +418,7 @@ static const struct oxygen_model model_xonar_d1 = { .device_config = PLAYBACK_0_TO_I2S | PLAYBACK_1_TO_SPDIF | CAPTURE_0_FROM_I2S_2 | + CAPTURE_1_FROM_SPDIF | AC97_FMIC_SWITCH, .dac_channels_pcm = 8, .dac_channels_mixer = 8, diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c index bc6eb58..793bdf0 100644 --- a/sound/pci/oxygen/xonar_dg.c +++ b/sound/pci/oxygen/xonar_dg.c @@ -597,7 +597,8 @@ struct oxygen_model model_xonar_dg = { .model_data_size = sizeof(struct dg), .device_config = PLAYBACK_0_TO_I2S | PLAYBACK_1_TO_SPDIF | - CAPTURE_0_FROM_I2S_2, + CAPTURE_0_FROM_I2S_2 | + CAPTURE_1_FROM_SPDIF, .dac_channels_pcm = 6, .dac_channels_mixer = 0, .function_flags = OXYGEN_FUNCTION_SPI, diff --git a/sound/pci/oxygen/xonar_wm87x6.c b/sound/pci/oxygen/xonar_wm87x6.c index 42d1ab1..478303e 100644 --- a/sound/pci/oxygen/xonar_wm87x6.c +++ b/sound/pci/oxygen/xonar_wm87x6.c @@ -1274,7 +1274,8 @@ static const struct oxygen_model model_xonar_ds = { .model_data_size = sizeof(struct xonar_wm87x6), .device_config = PLAYBACK_0_TO_I2S | PLAYBACK_1_TO_SPDIF | - CAPTURE_0_FROM_I2S_1, + CAPTURE_0_FROM_I2S_1 | + CAPTURE_1_FROM_SPDIF, .dac_channels_pcm = 8, .dac_channels_mixer = 8, .dac_volume_min = 255 - 2*60, @@ -1306,7 +1307,8 @@ static const struct oxygen_model model_xonar_hdav_slim = { .model_data_size = sizeof(struct xonar_wm87x6), .device_config = PLAYBACK_0_TO_I2S | PLAYBACK_1_TO_SPDIF | - CAPTURE_0_FROM_I2S_1, + CAPTURE_0_FROM_I2S_1 | + CAPTURE_1_FROM_SPDIF, .dac_channels_pcm = 8, .dac_channels_mixer = 2, .dac_volume_min = 255 - 2*60, -- cgit v1.1 From 8c3f5d8a9b7d0d8506bc2a0525e012eae02b1853 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 19 Dec 2011 23:09:15 +0100 Subject: ALSA: usb-audio: add Yamaha MOX6/MOX8 support Signed-off-by: Clemens Ladisch Signed-off-by: Takashi Iwai --- sound/usb/quirks-table.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'sound') diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index 99b8c88..8edc503 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -269,6 +269,32 @@ YAMAHA_DEVICE(0x105a, NULL), YAMAHA_DEVICE(0x105b, NULL), YAMAHA_DEVICE(0x105c, NULL), YAMAHA_DEVICE(0x105d, NULL), +{ + USB_DEVICE(0x0499, 0x1503), + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { + /* .vendor_name = "Yamaha", */ + /* .product_name = "MOX6/MOX8", */ + .ifnum = QUIRK_ANY_INTERFACE, + .type = QUIRK_COMPOSITE, + .data = (const struct snd_usb_audio_quirk[]) { + { + .ifnum = 1, + .type = QUIRK_AUDIO_STANDARD_INTERFACE + }, + { + .ifnum = 2, + .type = QUIRK_AUDIO_STANDARD_INTERFACE + }, + { + .ifnum = 3, + .type = QUIRK_MIDI_YAMAHA + }, + { + .ifnum = -1 + } + } + } +}, YAMAHA_DEVICE(0x2000, "DGP-7"), YAMAHA_DEVICE(0x2001, "DGP-5"), YAMAHA_DEVICE(0x2002, NULL), -- cgit v1.1 From f2cbba7602383cd9cdd21f0a5d0b8bd1aad47b33 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 11 Jan 2012 12:34:11 +0100 Subject: ALSA: hda - Fix the lost power-setup of seconary pins after PM resume When multiple headphone or other detectable output pins are present, the power-map has to be updated after resume appropriately, but the current driver doesn't check all pins but only the first pin (since it's enough to check it for the mute-behavior). This resulted in the silent output from the secondary outputs after PM resume. This patch fixes the problem by checking all pins at (re-)init time. Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=740347 Cc: Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 03145ae..87e684f 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -4236,6 +4236,27 @@ static void stac_store_hints(struct hda_codec *codec) } } +static void stac_issue_unsol_events(struct hda_codec *codec, int num_pins, + const hda_nid_t *pins) +{ + while (num_pins--) + stac_issue_unsol_event(codec, *pins++); +} + +/* fake event to set up pins */ +static void stac_fake_hp_events(struct hda_codec *codec) +{ + struct sigmatel_spec *spec = codec->spec; + + if (spec->autocfg.hp_outs) + stac_issue_unsol_events(codec, spec->autocfg.hp_outs, + spec->autocfg.hp_pins); + if (spec->autocfg.line_outs && + spec->autocfg.line_out_pins[0] != spec->autocfg.hp_pins[0]) + stac_issue_unsol_events(codec, spec->autocfg.line_outs, + spec->autocfg.line_out_pins); +} + static int stac92xx_init(struct hda_codec *codec) { struct sigmatel_spec *spec = codec->spec; @@ -4286,10 +4307,7 @@ static int stac92xx_init(struct hda_codec *codec) stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], AC_PINCTL_OUT_EN); /* fake event to set up pins */ - if (cfg->hp_pins[0]) - stac_issue_unsol_event(codec, cfg->hp_pins[0]); - else if (cfg->line_out_pins[0]) - stac_issue_unsol_event(codec, cfg->line_out_pins[0]); + stac_fake_hp_events(codec); } else { stac92xx_auto_init_multi_out(codec); stac92xx_auto_init_hp_out(codec); @@ -4948,19 +4966,11 @@ static void stac927x_proc_hook(struct snd_info_buffer *buffer, #ifdef CONFIG_PM static int stac92xx_resume(struct hda_codec *codec) { - struct sigmatel_spec *spec = codec->spec; - stac92xx_init(codec); snd_hda_codec_resume_amp(codec); snd_hda_codec_resume_cache(codec); /* fake event to set up pins again to override cached values */ - if (spec->hp_detect) { - if (spec->autocfg.hp_pins[0]) - stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0]); - else if (spec->autocfg.line_out_pins[0]) - stac_issue_unsol_event(codec, - spec->autocfg.line_out_pins[0]); - } + stac_fake_hp_events(codec); return 0; } -- cgit v1.1 From e48b46ba169181dc88ea48e31dcb4afcf8778397 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Wed, 11 Jan 2012 12:43:24 +0000 Subject: ASoC: twl6040 - Add method to query optimum PDM_DL1 gain The DL1 PDM interface adds a little gain depending on the output device. Add a method to retrieve the gain value for machine driver usage. Signed-off-by: Liam Girdwood --- sound/soc/codecs/twl6040.c | 23 +++++++++++++++++++++++ sound/soc/codecs/twl6040.h | 1 + 2 files changed, 24 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 3376e6f..5b9c79b 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -1012,6 +1013,28 @@ static int twl6040_pll_put_enum(struct snd_kcontrol *kcontrol, return 0; } +int twl6040_get_dl1_gain(struct snd_soc_codec *codec) +{ + struct snd_soc_dapm_context *dapm = &codec->dapm; + + if (snd_soc_dapm_get_pin_status(dapm, "EP")) + return -1; /* -1dB */ + + if (snd_soc_dapm_get_pin_status(dapm, "HSOR") || + snd_soc_dapm_get_pin_status(dapm, "HSOL")) { + + u8 val = snd_soc_read(codec, TWL6040_REG_HSLCTL); + if (val & TWL6040_HSDACMODE) + /* HSDACL in LP mode */ + return -8; /* -8dB */ + else + /* HSDACL in HP mode */ + return -1; /* -1dB */ + } + return 0; /* 0dB */ +} +EXPORT_SYMBOL_GPL(twl6040_get_dl1_gain); + int twl6040_get_clk_id(struct snd_soc_codec *codec) { struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); diff --git a/sound/soc/codecs/twl6040.h b/sound/soc/codecs/twl6040.h index a83277b..ef273f1 100644 --- a/sound/soc/codecs/twl6040.h +++ b/sound/soc/codecs/twl6040.h @@ -34,6 +34,7 @@ enum twl6040_trim { #define TWL6040_HSF_TRIM_LEFT(x) (x & 0x0f) #define TWL6040_HSF_TRIM_RIGHT(x) ((x >> 4) & 0x0f) +int twl6040_get_dl1_gain(struct snd_soc_codec *codec); void twl6040_hs_jack_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, int report); int twl6040_get_clk_id(struct snd_soc_codec *codec); -- cgit v1.1