aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tlv320aic3x.c
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@slimlogic.co.uk>2010-11-05 09:53:46 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-11-06 11:28:29 -0400
commitce6120cca2589ede530200c7cfe11ac9f144333c (patch)
tree6ea7c26ce64dd4753e7cf9a3b048e74614b169dc /sound/soc/codecs/tlv320aic3x.c
parent22e2fda5660cdf62513acabdb5c82a5af415f838 (diff)
ASoC: Decouple DAPM from CODECs
Decoupling Dynamic Audio Power Management (DAPM) from codec devices is required when developing ASoC further. Such as for other ASoC components to have DAPM widgets or when extending DAPM to handle cross-device paths. This patch decouples DAPM related variables from struct snd_soc_codec and moves them to new struct snd_soc_dapm_context that is used to encapsulate DAPM context of a device. ASoC core and API of DAPM functions are modified to use DAPM context instead of codec. This patch does not change current functionality and a large part of changes come because of structure and internal API changes. Core implementation is from Liam Girdwood <lrg@slimlogic.co.uk> with some minor core changes, codecs and machine driver conversions from Jarkko Nikula <jhnikula@gmail.com>. Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Manuel Lauss <manuel.lauss@googlemail.com> Cc: Mike Frysinger <vapier.adi@gmail.com> Cc: Cliff Cai <cliff.cai@analog.com> Cc: Kevin Hilman <khilman@deeprootsystems.com> Cc: Ryan Mallon <ryan@bluewatersys.com> Cc: Timur Tabi <timur@freescale.com> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org> Cc: Wan ZongShun <mcuos.com@gmail.com> Cc: Eric Miao <eric.y.miao@gmail.com> Cc: Jassi Brar <jassi.brar@samsung.com> Cc: Daniel Gloeckner <dg@emlix.com> Cc: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/tlv320aic3x.c')
-rw-r--r--sound/soc/codecs/tlv320aic3x.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index fc687790188b..6173c2b4c364 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -183,7 +183,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
183 183
184 if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) { 184 if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) {
185 /* find dapm widget path assoc with kcontrol */ 185 /* find dapm widget path assoc with kcontrol */
186 list_for_each_entry(path, &widget->codec->dapm_paths, list) { 186 list_for_each_entry(path, &widget->dapm->paths, list) {
187 if (path->kcontrol != kcontrol) 187 if (path->kcontrol != kcontrol)
188 continue; 188 continue;
189 189
@@ -199,7 +199,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
199 } 199 }
200 200
201 if (found) 201 if (found)
202 snd_soc_dapm_sync(widget->codec); 202 snd_soc_dapm_sync(widget->dapm);
203 } 203 }
204 204
205 ret = snd_soc_update_bits(widget->codec, reg, val_mask, val); 205 ret = snd_soc_update_bits(widget->codec, reg, val_mask, val);
@@ -788,17 +788,19 @@ static const struct snd_soc_dapm_route intercon_3007[] = {
788static int aic3x_add_widgets(struct snd_soc_codec *codec) 788static int aic3x_add_widgets(struct snd_soc_codec *codec)
789{ 789{
790 struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); 790 struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
791 struct snd_soc_dapm_context *dapm = &codec->dapm;
791 792
792 snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, 793 snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets,
793 ARRAY_SIZE(aic3x_dapm_widgets)); 794 ARRAY_SIZE(aic3x_dapm_widgets));
794 795
795 /* set up audio path interconnects */ 796 /* set up audio path interconnects */
796 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 797 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
797 798
798 if (aic3x->model == AIC3X_MODEL_3007) { 799 if (aic3x->model == AIC3X_MODEL_3007) {
799 snd_soc_dapm_new_controls(codec, aic3007_dapm_widgets, 800 snd_soc_dapm_new_controls(dapm, aic3007_dapm_widgets,
800 ARRAY_SIZE(aic3007_dapm_widgets)); 801 ARRAY_SIZE(aic3007_dapm_widgets));
801 snd_soc_dapm_add_routes(codec, intercon_3007, ARRAY_SIZE(intercon_3007)); 802 snd_soc_dapm_add_routes(dapm, intercon_3007,
803 ARRAY_SIZE(intercon_3007));
802 } 804 }
803 805
804 return 0; 806 return 0;
@@ -1135,7 +1137,7 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec,
1135 case SND_SOC_BIAS_ON: 1137 case SND_SOC_BIAS_ON:
1136 break; 1138 break;
1137 case SND_SOC_BIAS_PREPARE: 1139 case SND_SOC_BIAS_PREPARE:
1138 if (codec->bias_level == SND_SOC_BIAS_STANDBY && 1140 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY &&
1139 aic3x->master) { 1141 aic3x->master) {
1140 /* enable pll */ 1142 /* enable pll */
1141 reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); 1143 reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG);
@@ -1146,7 +1148,7 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec,
1146 case SND_SOC_BIAS_STANDBY: 1148 case SND_SOC_BIAS_STANDBY:
1147 if (!aic3x->power) 1149 if (!aic3x->power)
1148 aic3x_set_power(codec, 1); 1150 aic3x_set_power(codec, 1);
1149 if (codec->bias_level == SND_SOC_BIAS_PREPARE && 1151 if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE &&
1150 aic3x->master) { 1152 aic3x->master) {
1151 /* disable pll */ 1153 /* disable pll */
1152 reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); 1154 reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG);
@@ -1159,7 +1161,7 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec,
1159 aic3x_set_power(codec, 0); 1161 aic3x_set_power(codec, 0);
1160 break; 1162 break;
1161 } 1163 }
1162 codec->bias_level = level; 1164 codec->dapm.bias_level = level;
1163 1165
1164 return 0; 1166 return 0;
1165} 1167}
@@ -1351,7 +1353,7 @@ static int aic3x_probe(struct snd_soc_codec *codec)
1351 1353
1352 codec->control_data = aic3x->control_data; 1354 codec->control_data = aic3x->control_data;
1353 aic3x->codec = codec; 1355 aic3x->codec = codec;
1354 codec->idle_bias_off = 1; 1356 codec->dapm.idle_bias_off = 1;
1355 1357
1356 ret = snd_soc_codec_set_cache_io(codec, 8, 8, aic3x->control_type); 1358 ret = snd_soc_codec_set_cache_io(codec, 8, 8, aic3x->control_type);
1357 if (ret != 0) { 1359 if (ret != 0) {