diff options
author | Mark Brown <broonie@kernel.org> | 2015-06-19 06:17:19 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-06-19 06:17:19 -0400 |
commit | 89a6192049050035cbd779d35686cbf29ca9184f (patch) | |
tree | f63c3344dc7ce4da5589d043d6135c7ff81508fd | |
parent | f9f55e31f8a537b7eaccc4fdb243cff938fa428c (diff) | |
parent | cc76e7def0fa27b5f42aea54e34c96b4bddaf30a (diff) |
Merge branches 'topic/adsp' and 'topic/dapm' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-arizona
111 files changed, 683 insertions, 473 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 0bc83647d3fa..b9170e2bc5ab 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -107,6 +107,10 @@ struct device; | |||
107 | { .id = snd_soc_dapm_mux, .name = wname, \ | 107 | { .id = snd_soc_dapm_mux, .name = wname, \ |
108 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ | 108 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ |
109 | .kcontrol_news = wcontrols, .num_kcontrols = 1} | 109 | .kcontrol_news = wcontrols, .num_kcontrols = 1} |
110 | #define SND_SOC_DAPM_DEMUX(wname, wreg, wshift, winvert, wcontrols) \ | ||
111 | { .id = snd_soc_dapm_demux, .name = wname, \ | ||
112 | SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ | ||
113 | .kcontrol_news = wcontrols, .num_kcontrols = 1} | ||
110 | 114 | ||
111 | /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ | 115 | /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ |
112 | #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ | 116 | #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ |
@@ -444,11 +448,15 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, | |||
444 | struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( | 448 | struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( |
445 | struct snd_kcontrol *kcontrol); | 449 | struct snd_kcontrol *kcontrol); |
446 | 450 | ||
451 | int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm, | ||
452 | enum snd_soc_bias_level level); | ||
453 | |||
447 | /* dapm widget types */ | 454 | /* dapm widget types */ |
448 | enum snd_soc_dapm_type { | 455 | enum snd_soc_dapm_type { |
449 | snd_soc_dapm_input = 0, /* input pin */ | 456 | snd_soc_dapm_input = 0, /* input pin */ |
450 | snd_soc_dapm_output, /* output pin */ | 457 | snd_soc_dapm_output, /* output pin */ |
451 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ | 458 | snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ |
459 | snd_soc_dapm_demux, /* connects the input to one of multiple outputs */ | ||
452 | snd_soc_dapm_mixer, /* mixes several analog signals together */ | 460 | snd_soc_dapm_mixer, /* mixes several analog signals together */ |
453 | snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ | 461 | snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ |
454 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ | 462 | snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ |
@@ -585,6 +593,10 @@ struct snd_soc_dapm_update { | |||
585 | int val; | 593 | int val; |
586 | }; | 594 | }; |
587 | 595 | ||
596 | struct snd_soc_dapm_wcache { | ||
597 | struct snd_soc_dapm_widget *widget; | ||
598 | }; | ||
599 | |||
588 | /* DAPM context */ | 600 | /* DAPM context */ |
589 | struct snd_soc_dapm_context { | 601 | struct snd_soc_dapm_context { |
590 | enum snd_soc_bias_level bias_level; | 602 | enum snd_soc_bias_level bias_level; |
@@ -606,6 +618,9 @@ struct snd_soc_dapm_context { | |||
606 | int (*set_bias_level)(struct snd_soc_dapm_context *dapm, | 618 | int (*set_bias_level)(struct snd_soc_dapm_context *dapm, |
607 | enum snd_soc_bias_level level); | 619 | enum snd_soc_bias_level level); |
608 | 620 | ||
621 | struct snd_soc_dapm_wcache path_sink_cache; | ||
622 | struct snd_soc_dapm_wcache path_source_cache; | ||
623 | |||
609 | #ifdef CONFIG_DEBUG_FS | 624 | #ifdef CONFIG_DEBUG_FS |
610 | struct dentry *debugfs_dapm; | 625 | struct dentry *debugfs_dapm; |
611 | #endif | 626 | #endif |
@@ -623,4 +638,35 @@ struct snd_soc_dapm_stats { | |||
623 | int neighbour_checks; | 638 | int neighbour_checks; |
624 | }; | 639 | }; |
625 | 640 | ||
641 | /** | ||
642 | * snd_soc_dapm_init_bias_level() - Initialize DAPM bias level | ||
643 | * @dapm: The DAPM context to initialize | ||
644 | * @level: The DAPM level to initialize to | ||
645 | * | ||
646 | * This function only sets the driver internal state of the DAPM level and will | ||
647 | * not modify the state of the device. Hence it should not be used during normal | ||
648 | * operation, but only to synchronize the internal state to the device state. | ||
649 | * E.g. during driver probe to set the DAPM level to the one corresponding with | ||
650 | * the power-on reset state of the device. | ||
651 | * | ||
652 | * To change the DAPM state of the device use snd_soc_dapm_set_bias_level(). | ||
653 | */ | ||
654 | static inline void snd_soc_dapm_init_bias_level( | ||
655 | struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) | ||
656 | { | ||
657 | dapm->bias_level = level; | ||
658 | } | ||
659 | |||
660 | /** | ||
661 | * snd_soc_dapm_get_bias_level() - Get current DAPM bias level | ||
662 | * @dapm: The context for which to get the bias level | ||
663 | * | ||
664 | * Returns: The current bias level of the passed DAPM context. | ||
665 | */ | ||
666 | static inline enum snd_soc_bias_level snd_soc_dapm_get_bias_level( | ||
667 | struct snd_soc_dapm_context *dapm) | ||
668 | { | ||
669 | return dapm->bias_level; | ||
670 | } | ||
671 | |||
626 | #endif | 672 | #endif |
diff --git a/include/sound/soc.h b/include/sound/soc.h index fcb312b3f258..2f2e59e1513e 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -190,8 +190,12 @@ | |||
190 | #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \ | 190 | #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \ |
191 | { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ | 191 | { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ |
192 | .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues} | 192 | .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues} |
193 | #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xnitmes, xtexts, xvalues) \ | 193 | #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \ |
194 | SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xnitmes, xtexts, xvalues) | 194 | SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xitems, xtexts, xvalues) |
195 | #define SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \ | ||
196 | { .reg = xreg, .shift_l = xshift, .shift_r = xshift, \ | ||
197 | .mask = xmask, .items = xitems, .texts = xtexts, \ | ||
198 | .values = xvalues, .autodisable = 1} | ||
195 | #define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \ | 199 | #define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \ |
196 | SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts) | 200 | SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts) |
197 | #define SOC_ENUM(xname, xenum) \ | 201 | #define SOC_ENUM(xname, xenum) \ |
@@ -312,6 +316,11 @@ | |||
312 | ARRAY_SIZE(xtexts), xtexts, xvalues) | 316 | ARRAY_SIZE(xtexts), xtexts, xvalues) |
313 | #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ | 317 | #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ |
314 | SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) | 318 | SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) |
319 | |||
320 | #define SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ | ||
321 | const struct soc_enum name = SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, \ | ||
322 | xshift, xmask, ARRAY_SIZE(xtexts), xtexts, xvalues) | ||
323 | |||
315 | #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \ | 324 | #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \ |
316 | const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) | 325 | const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) |
317 | 326 | ||
@@ -807,7 +816,7 @@ struct snd_soc_codec { | |||
807 | /* component */ | 816 | /* component */ |
808 | struct snd_soc_component component; | 817 | struct snd_soc_component component; |
809 | 818 | ||
810 | /* dapm */ | 819 | /* Don't access this directly, use snd_soc_codec_get_dapm() */ |
811 | struct snd_soc_dapm_context dapm; | 820 | struct snd_soc_dapm_context dapm; |
812 | 821 | ||
813 | #ifdef CONFIG_DEBUG_FS | 822 | #ifdef CONFIG_DEBUG_FS |
@@ -1188,6 +1197,7 @@ struct soc_enum { | |||
1188 | unsigned int mask; | 1197 | unsigned int mask; |
1189 | const char * const *texts; | 1198 | const char * const *texts; |
1190 | const unsigned int *values; | 1199 | const unsigned int *values; |
1200 | unsigned int autodisable:1; | ||
1191 | }; | 1201 | }; |
1192 | 1202 | ||
1193 | /** | 1203 | /** |
@@ -1270,6 +1280,58 @@ static inline struct snd_soc_dapm_context *snd_soc_component_get_dapm( | |||
1270 | } | 1280 | } |
1271 | 1281 | ||
1272 | /** | 1282 | /** |
1283 | * snd_soc_codec_get_dapm() - Returns the DAPM context for the CODEC | ||
1284 | * @codec: The CODEC for which to get the DAPM context | ||
1285 | * | ||
1286 | * Note: Use this function instead of directly accessing the CODEC's dapm field | ||
1287 | */ | ||
1288 | static inline struct snd_soc_dapm_context *snd_soc_codec_get_dapm( | ||
1289 | struct snd_soc_codec *codec) | ||
1290 | { | ||
1291 | return &codec->dapm; | ||
1292 | } | ||
1293 | |||
1294 | /** | ||
1295 | * snd_soc_dapm_init_bias_level() - Initialize CODEC DAPM bias level | ||
1296 | * @dapm: The CODEC for which to initialize the DAPM bias level | ||
1297 | * @level: The DAPM level to initialize to | ||
1298 | * | ||
1299 | * Initializes the CODEC DAPM bias level. See snd_soc_dapm_init_bias_level(). | ||
1300 | */ | ||
1301 | static inline void snd_soc_codec_init_bias_level(struct snd_soc_codec *codec, | ||
1302 | enum snd_soc_bias_level level) | ||
1303 | { | ||
1304 | snd_soc_dapm_init_bias_level(snd_soc_codec_get_dapm(codec), level); | ||
1305 | } | ||
1306 | |||
1307 | /** | ||
1308 | * snd_soc_dapm_get_bias_level() - Get current CODEC DAPM bias level | ||
1309 | * @codec: The CODEC for which to get the DAPM bias level | ||
1310 | * | ||
1311 | * Returns: The current DAPM bias level of the CODEC. | ||
1312 | */ | ||
1313 | static inline enum snd_soc_bias_level snd_soc_codec_get_bias_level( | ||
1314 | struct snd_soc_codec *codec) | ||
1315 | { | ||
1316 | return snd_soc_dapm_get_bias_level(snd_soc_codec_get_dapm(codec)); | ||
1317 | } | ||
1318 | |||
1319 | /** | ||
1320 | * snd_soc_codec_force_bias_level() - Set the CODEC DAPM bias level | ||
1321 | * @codec: The CODEC for which to set the level | ||
1322 | * @level: The level to set to | ||
1323 | * | ||
1324 | * Forces the CODEC bias level to a specific state. See | ||
1325 | * snd_soc_dapm_force_bias_level(). | ||
1326 | */ | ||
1327 | static inline int snd_soc_codec_force_bias_level(struct snd_soc_codec *codec, | ||
1328 | enum snd_soc_bias_level level) | ||
1329 | { | ||
1330 | return snd_soc_dapm_force_bias_level(snd_soc_codec_get_dapm(codec), | ||
1331 | level); | ||
1332 | } | ||
1333 | |||
1334 | /** | ||
1273 | * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol | 1335 | * snd_soc_dapm_kcontrol_codec() - Returns the codec associated to a kcontrol |
1274 | * @kcontrol: The kcontrol | 1336 | * @kcontrol: The kcontrol |
1275 | * | 1337 | * |
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c index a0f265327fdf..ee31fa77af7b 100644 --- a/sound/soc/codecs/88pm860x-codec.c +++ b/sound/soc/codecs/88pm860x-codec.c | |||
@@ -1140,7 +1140,7 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec, | |||
1140 | break; | 1140 | break; |
1141 | 1141 | ||
1142 | case SND_SOC_BIAS_STANDBY: | 1142 | case SND_SOC_BIAS_STANDBY: |
1143 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1143 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1144 | /* Enable Audio PLL & Audio section */ | 1144 | /* Enable Audio PLL & Audio section */ |
1145 | data = AUDIO_PLL | AUDIO_SECTION_ON; | 1145 | data = AUDIO_PLL | AUDIO_SECTION_ON; |
1146 | pm860x_reg_write(pm860x->i2c, REG_MISC2, data); | 1146 | pm860x_reg_write(pm860x->i2c, REG_MISC2, data); |
@@ -1156,7 +1156,6 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec, | |||
1156 | pm860x_set_bits(pm860x->i2c, REG_MISC2, data, 0); | 1156 | pm860x_set_bits(pm860x->i2c, REG_MISC2, data, 0); |
1157 | break; | 1157 | break; |
1158 | } | 1158 | } |
1159 | codec->dapm.bias_level = level; | ||
1160 | return 0; | 1159 | return 0; |
1161 | } | 1160 | } |
1162 | 1161 | ||
diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c index 88ca9cb0ce79..c7d243db010a 100644 --- a/sound/soc/codecs/ab8500-codec.c +++ b/sound/soc/codecs/ab8500-codec.c | |||
@@ -1209,6 +1209,7 @@ static int anc_status_control_put(struct snd_kcontrol *kcontrol, | |||
1209 | struct snd_ctl_elem_value *ucontrol) | 1209 | struct snd_ctl_elem_value *ucontrol) |
1210 | { | 1210 | { |
1211 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 1211 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
1212 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
1212 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev); | 1213 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev); |
1213 | struct device *dev = codec->dev; | 1214 | struct device *dev = codec->dev; |
1214 | bool apply_fir, apply_iir; | 1215 | bool apply_fir, apply_iir; |
@@ -1234,15 +1235,14 @@ static int anc_status_control_put(struct snd_kcontrol *kcontrol, | |||
1234 | apply_fir = req == ANC_APPLY_FIR || req == ANC_APPLY_FIR_IIR; | 1235 | apply_fir = req == ANC_APPLY_FIR || req == ANC_APPLY_FIR_IIR; |
1235 | apply_iir = req == ANC_APPLY_IIR || req == ANC_APPLY_FIR_IIR; | 1236 | apply_iir = req == ANC_APPLY_IIR || req == ANC_APPLY_FIR_IIR; |
1236 | 1237 | ||
1237 | status = snd_soc_dapm_force_enable_pin(&codec->dapm, | 1238 | status = snd_soc_dapm_force_enable_pin(dapm, "ANC Configure Input"); |
1238 | "ANC Configure Input"); | ||
1239 | if (status < 0) { | 1239 | if (status < 0) { |
1240 | dev_err(dev, | 1240 | dev_err(dev, |
1241 | "%s: ERROR: Failed to enable power (status = %d)!\n", | 1241 | "%s: ERROR: Failed to enable power (status = %d)!\n", |
1242 | __func__, status); | 1242 | __func__, status); |
1243 | goto cleanup; | 1243 | goto cleanup; |
1244 | } | 1244 | } |
1245 | snd_soc_dapm_sync(&codec->dapm); | 1245 | snd_soc_dapm_sync(dapm); |
1246 | 1246 | ||
1247 | anc_configure(codec, apply_fir, apply_iir); | 1247 | anc_configure(codec, apply_fir, apply_iir); |
1248 | 1248 | ||
@@ -1259,8 +1259,8 @@ static int anc_status_control_put(struct snd_kcontrol *kcontrol, | |||
1259 | drvdata->anc_status = ANC_IIR_CONFIGURED; | 1259 | drvdata->anc_status = ANC_IIR_CONFIGURED; |
1260 | } | 1260 | } |
1261 | 1261 | ||
1262 | status = snd_soc_dapm_disable_pin(&codec->dapm, "ANC Configure Input"); | 1262 | status = snd_soc_dapm_disable_pin(dapm, "ANC Configure Input"); |
1263 | snd_soc_dapm_sync(&codec->dapm); | 1263 | snd_soc_dapm_sync(dapm); |
1264 | 1264 | ||
1265 | cleanup: | 1265 | cleanup: |
1266 | mutex_unlock(&drvdata->ctrl_lock); | 1266 | mutex_unlock(&drvdata->ctrl_lock); |
@@ -1947,6 +1947,7 @@ static int ab8500_audio_init_audioblock(struct snd_soc_codec *codec) | |||
1947 | static int ab8500_audio_setup_mics(struct snd_soc_codec *codec, | 1947 | static int ab8500_audio_setup_mics(struct snd_soc_codec *codec, |
1948 | struct amic_settings *amics) | 1948 | struct amic_settings *amics) |
1949 | { | 1949 | { |
1950 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
1950 | u8 value8; | 1951 | u8 value8; |
1951 | unsigned int value; | 1952 | unsigned int value; |
1952 | int status; | 1953 | int status; |
@@ -1973,15 +1974,15 @@ static int ab8500_audio_setup_mics(struct snd_soc_codec *codec, | |||
1973 | dev_dbg(codec->dev, "%s: Mic 1a regulator: %s\n", __func__, | 1974 | dev_dbg(codec->dev, "%s: Mic 1a regulator: %s\n", __func__, |
1974 | amic_micbias_str(amics->mic1a_micbias)); | 1975 | amic_micbias_str(amics->mic1a_micbias)); |
1975 | route = &ab8500_dapm_routes_mic1a_vamicx[amics->mic1a_micbias]; | 1976 | route = &ab8500_dapm_routes_mic1a_vamicx[amics->mic1a_micbias]; |
1976 | status = snd_soc_dapm_add_routes(&codec->dapm, route, 1); | 1977 | status = snd_soc_dapm_add_routes(dapm, route, 1); |
1977 | dev_dbg(codec->dev, "%s: Mic 1b regulator: %s\n", __func__, | 1978 | dev_dbg(codec->dev, "%s: Mic 1b regulator: %s\n", __func__, |
1978 | amic_micbias_str(amics->mic1b_micbias)); | 1979 | amic_micbias_str(amics->mic1b_micbias)); |
1979 | route = &ab8500_dapm_routes_mic1b_vamicx[amics->mic1b_micbias]; | 1980 | route = &ab8500_dapm_routes_mic1b_vamicx[amics->mic1b_micbias]; |
1980 | status |= snd_soc_dapm_add_routes(&codec->dapm, route, 1); | 1981 | status |= snd_soc_dapm_add_routes(dapm, route, 1); |
1981 | dev_dbg(codec->dev, "%s: Mic 2 regulator: %s\n", __func__, | 1982 | dev_dbg(codec->dev, "%s: Mic 2 regulator: %s\n", __func__, |
1982 | amic_micbias_str(amics->mic2_micbias)); | 1983 | amic_micbias_str(amics->mic2_micbias)); |
1983 | route = &ab8500_dapm_routes_mic2_vamicx[amics->mic2_micbias]; | 1984 | route = &ab8500_dapm_routes_mic2_vamicx[amics->mic2_micbias]; |
1984 | status |= snd_soc_dapm_add_routes(&codec->dapm, route, 1); | 1985 | status |= snd_soc_dapm_add_routes(dapm, route, 1); |
1985 | if (status < 0) { | 1986 | if (status < 0) { |
1986 | dev_err(codec->dev, | 1987 | dev_err(codec->dev, |
1987 | "%s: Failed to add AMic-regulator DAPM-routes (%d).\n", | 1988 | "%s: Failed to add AMic-regulator DAPM-routes (%d).\n", |
@@ -2461,6 +2462,7 @@ static void ab8500_codec_of_probe(struct device *dev, struct device_node *np, | |||
2461 | 2462 | ||
2462 | static int ab8500_codec_probe(struct snd_soc_codec *codec) | 2463 | static int ab8500_codec_probe(struct snd_soc_codec *codec) |
2463 | { | 2464 | { |
2465 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
2464 | struct device *dev = codec->dev; | 2466 | struct device *dev = codec->dev; |
2465 | struct device_node *np = dev->of_node; | 2467 | struct device_node *np = dev->of_node; |
2466 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(dev); | 2468 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(dev); |
@@ -2541,7 +2543,7 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec) | |||
2541 | &ab8500_filter_controls[AB8500_FILTER_SID_FIR].private_value; | 2543 | &ab8500_filter_controls[AB8500_FILTER_SID_FIR].private_value; |
2542 | drvdata->sid_fir_values = (long *)fc->value; | 2544 | drvdata->sid_fir_values = (long *)fc->value; |
2543 | 2545 | ||
2544 | (void)snd_soc_dapm_disable_pin(&codec->dapm, "ANC Configure Input"); | 2546 | snd_soc_dapm_disable_pin(dapm, "ANC Configure Input"); |
2545 | 2547 | ||
2546 | mutex_init(&drvdata->ctrl_lock); | 2548 | mutex_init(&drvdata->ctrl_lock); |
2547 | 2549 | ||
diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c index 783dcb57043a..a43160254929 100644 --- a/sound/soc/codecs/adau1373.c +++ b/sound/soc/codecs/adau1373.c | |||
@@ -1444,7 +1444,6 @@ static int adau1373_set_bias_level(struct snd_soc_codec *codec, | |||
1444 | ADAU1373_PWDN_CTRL3_PWR_EN, 0); | 1444 | ADAU1373_PWDN_CTRL3_PWR_EN, 0); |
1445 | break; | 1445 | break; |
1446 | } | 1446 | } |
1447 | codec->dapm.bias_level = level; | ||
1448 | return 0; | 1447 | return 0; |
1449 | } | 1448 | } |
1450 | 1449 | ||
diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index d4e219b6b98f..808b964086e3 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c | |||
@@ -565,7 +565,6 @@ static int adau1701_set_bias_level(struct snd_soc_codec *codec, | |||
565 | break; | 565 | break; |
566 | } | 566 | } |
567 | 567 | ||
568 | codec->dapm.bias_level = level; | ||
569 | return 0; | 568 | return 0; |
570 | } | 569 | } |
571 | 570 | ||
diff --git a/sound/soc/codecs/adau1761.c b/sound/soc/codecs/adau1761.c index a1baeee160f4..5ba24618b576 100644 --- a/sound/soc/codecs/adau1761.c +++ b/sound/soc/codecs/adau1761.c | |||
@@ -466,7 +466,6 @@ static int adau1761_set_bias_level(struct snd_soc_codec *codec, | |||
466 | break; | 466 | break; |
467 | 467 | ||
468 | } | 468 | } |
469 | codec->dapm.bias_level = level; | ||
470 | return 0; | 469 | return 0; |
471 | } | 470 | } |
472 | 471 | ||
diff --git a/sound/soc/codecs/adau1781.c b/sound/soc/codecs/adau1781.c index 35581f43fa6d..9c01ef0de0c0 100644 --- a/sound/soc/codecs/adau1781.c +++ b/sound/soc/codecs/adau1781.c | |||
@@ -339,7 +339,6 @@ static int adau1781_set_bias_level(struct snd_soc_codec *codec, | |||
339 | break; | 339 | break; |
340 | } | 340 | } |
341 | 341 | ||
342 | codec->dapm.bias_level = level; | ||
343 | return 0; | 342 | return 0; |
344 | } | 343 | } |
345 | 344 | ||
diff --git a/sound/soc/codecs/adau1977.c b/sound/soc/codecs/adau1977.c index 7ad8e156e2df..3fb09c165055 100644 --- a/sound/soc/codecs/adau1977.c +++ b/sound/soc/codecs/adau1977.c | |||
@@ -493,12 +493,7 @@ static int adau1977_set_bias_level(struct snd_soc_codec *codec, | |||
493 | break; | 493 | break; |
494 | } | 494 | } |
495 | 495 | ||
496 | if (ret) | 496 | return ret; |
497 | return ret; | ||
498 | |||
499 | codec->dapm.bias_level = level; | ||
500 | |||
501 | return 0; | ||
502 | } | 497 | } |
503 | 498 | ||
504 | static int adau1977_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | 499 | static int adau1977_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, |
diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c index 4373ada95648..260a652e4a43 100644 --- a/sound/soc/codecs/adav80x.c +++ b/sound/soc/codecs/adav80x.c | |||
@@ -714,7 +714,6 @@ static int adav80x_set_bias_level(struct snd_soc_codec *codec, | |||
714 | break; | 714 | break; |
715 | } | 715 | } |
716 | 716 | ||
717 | codec->dapm.bias_level = level; | ||
718 | return 0; | 717 | return 0; |
719 | } | 718 | } |
720 | 719 | ||
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c index 9130d916f2f4..8670861e5bec 100644 --- a/sound/soc/codecs/ak4535.c +++ b/sound/soc/codecs/ak4535.c | |||
@@ -341,7 +341,6 @@ static int ak4535_set_bias_level(struct snd_soc_codec *codec, | |||
341 | snd_soc_update_bits(codec, AK4535_PM1, 0x80, 0); | 341 | snd_soc_update_bits(codec, AK4535_PM1, 0x80, 0); |
342 | break; | 342 | break; |
343 | } | 343 | } |
344 | codec->dapm.bias_level = level; | ||
345 | return 0; | 344 | return 0; |
346 | } | 345 | } |
347 | 346 | ||
diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c index 81b54a270bd8..2d0ff4595ea0 100644 --- a/sound/soc/codecs/ak4641.c +++ b/sound/soc/codecs/ak4641.c | |||
@@ -412,7 +412,7 @@ static int ak4641_set_bias_level(struct snd_soc_codec *codec, | |||
412 | snd_soc_update_bits(codec, AK4641_DAC, 0x20, 0x20); | 412 | snd_soc_update_bits(codec, AK4641_DAC, 0x20, 0x20); |
413 | break; | 413 | break; |
414 | case SND_SOC_BIAS_STANDBY: | 414 | case SND_SOC_BIAS_STANDBY: |
415 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 415 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
416 | if (pdata && gpio_is_valid(pdata->gpio_power)) | 416 | if (pdata && gpio_is_valid(pdata->gpio_power)) |
417 | gpio_set_value(pdata->gpio_power, 1); | 417 | gpio_set_value(pdata->gpio_power, 1); |
418 | mdelay(1); | 418 | mdelay(1); |
@@ -439,7 +439,6 @@ static int ak4641_set_bias_level(struct snd_soc_codec *codec, | |||
439 | regcache_mark_dirty(ak4641->regmap); | 439 | regcache_mark_dirty(ak4641->regmap); |
440 | break; | 440 | break; |
441 | } | 441 | } |
442 | codec->dapm.bias_level = level; | ||
443 | return 0; | 442 | return 0; |
444 | } | 443 | } |
445 | 444 | ||
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 13585e88f597..7c0f6552c229 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c | |||
@@ -482,7 +482,6 @@ static int ak4642_set_bias_level(struct snd_soc_codec *codec, | |||
482 | snd_soc_update_bits(codec, PW_MGMT1, PMVCM, PMVCM); | 482 | snd_soc_update_bits(codec, PW_MGMT1, PMVCM, PMVCM); |
483 | break; | 483 | break; |
484 | } | 484 | } |
485 | codec->dapm.bias_level = level; | ||
486 | 485 | ||
487 | return 0; | 486 | return 0; |
488 | } | 487 | } |
diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c index 2a58b1dccd2f..0e59063aeb6f 100644 --- a/sound/soc/codecs/ak4671.c +++ b/sound/soc/codecs/ak4671.c | |||
@@ -577,7 +577,6 @@ static int ak4671_set_bias_level(struct snd_soc_codec *codec, | |||
577 | snd_soc_write(codec, AK4671_AD_DA_POWER_MANAGEMENT, 0x00); | 577 | snd_soc_write(codec, AK4671_AD_DA_POWER_MANAGEMENT, 0x00); |
578 | break; | 578 | break; |
579 | } | 579 | } |
580 | codec->dapm.bias_level = level; | ||
581 | return 0; | 580 | return 0; |
582 | } | 581 | } |
583 | 582 | ||
diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c index 0e357996864b..0fc24e0d518c 100644 --- a/sound/soc/codecs/alc5623.c +++ b/sound/soc/codecs/alc5623.c | |||
@@ -826,7 +826,6 @@ static int alc5623_set_bias_level(struct snd_soc_codec *codec, | |||
826 | snd_soc_write(codec, ALC5623_PWR_MANAG_ADD1, 0); | 826 | snd_soc_write(codec, ALC5623_PWR_MANAG_ADD1, 0); |
827 | break; | 827 | break; |
828 | } | 828 | } |
829 | codec->dapm.bias_level = level; | ||
830 | return 0; | 829 | return 0; |
831 | } | 830 | } |
832 | 831 | ||
@@ -894,7 +893,7 @@ static int alc5623_resume(struct snd_soc_codec *codec) | |||
894 | static int alc5623_probe(struct snd_soc_codec *codec) | 893 | static int alc5623_probe(struct snd_soc_codec *codec) |
895 | { | 894 | { |
896 | struct alc5623_priv *alc5623 = snd_soc_codec_get_drvdata(codec); | 895 | struct alc5623_priv *alc5623 = snd_soc_codec_get_drvdata(codec); |
897 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 896 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
898 | 897 | ||
899 | alc5623_reset(codec); | 898 | alc5623_reset(codec); |
900 | 899 | ||
diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index db3283abbe18..607a63b9705f 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c | |||
@@ -1000,7 +1000,6 @@ static int alc5632_set_bias_level(struct snd_soc_codec *codec, | |||
1000 | ALC5632_PWR_MANAG_ADD1_MASK, 0); | 1000 | ALC5632_PWR_MANAG_ADD1_MASK, 0); |
1001 | break; | 1001 | break; |
1002 | } | 1002 | } |
1003 | codec->dapm.bias_level = level; | ||
1004 | return 0; | 1003 | return 0; |
1005 | } | 1004 | } |
1006 | 1005 | ||
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index 5939ce467352..88f6df21ad95 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -208,11 +208,12 @@ static const struct snd_soc_dapm_widget arizona_spkr = | |||
208 | 208 | ||
209 | int arizona_init_spk(struct snd_soc_codec *codec) | 209 | int arizona_init_spk(struct snd_soc_codec *codec) |
210 | { | 210 | { |
211 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
211 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); | 212 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); |
212 | struct arizona *arizona = priv->arizona; | 213 | struct arizona *arizona = priv->arizona; |
213 | int ret; | 214 | int ret; |
214 | 215 | ||
215 | ret = snd_soc_dapm_new_controls(&codec->dapm, &arizona_spkl, 1); | 216 | ret = snd_soc_dapm_new_controls(dapm, &arizona_spkl, 1); |
216 | if (ret != 0) | 217 | if (ret != 0) |
217 | return ret; | 218 | return ret; |
218 | 219 | ||
@@ -220,8 +221,7 @@ int arizona_init_spk(struct snd_soc_codec *codec) | |||
220 | case WM8997: | 221 | case WM8997: |
221 | break; | 222 | break; |
222 | default: | 223 | default: |
223 | ret = snd_soc_dapm_new_controls(&codec->dapm, | 224 | ret = snd_soc_dapm_new_controls(dapm, &arizona_spkr, 1); |
224 | &arizona_spkr, 1); | ||
225 | if (ret != 0) | 225 | if (ret != 0) |
226 | return ret; | 226 | return ret; |
227 | break; | 227 | break; |
@@ -258,13 +258,14 @@ static const struct snd_soc_dapm_route arizona_mono_routes[] = { | |||
258 | 258 | ||
259 | int arizona_init_mono(struct snd_soc_codec *codec) | 259 | int arizona_init_mono(struct snd_soc_codec *codec) |
260 | { | 260 | { |
261 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
261 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); | 262 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); |
262 | struct arizona *arizona = priv->arizona; | 263 | struct arizona *arizona = priv->arizona; |
263 | int i; | 264 | int i; |
264 | 265 | ||
265 | for (i = 0; i < ARIZONA_MAX_OUTPUT; ++i) { | 266 | for (i = 0; i < ARIZONA_MAX_OUTPUT; ++i) { |
266 | if (arizona->pdata.out_mono[i]) | 267 | if (arizona->pdata.out_mono[i]) |
267 | snd_soc_dapm_add_routes(&codec->dapm, | 268 | snd_soc_dapm_add_routes(dapm, |
268 | &arizona_mono_routes[i], 1); | 269 | &arizona_mono_routes[i], 1); |
269 | } | 270 | } |
270 | 271 | ||
@@ -274,6 +275,7 @@ EXPORT_SYMBOL_GPL(arizona_init_mono); | |||
274 | 275 | ||
275 | int arizona_init_gpio(struct snd_soc_codec *codec) | 276 | int arizona_init_gpio(struct snd_soc_codec *codec) |
276 | { | 277 | { |
278 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
277 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); | 279 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); |
278 | struct arizona *arizona = priv->arizona; | 280 | struct arizona *arizona = priv->arizona; |
279 | int i; | 281 | int i; |
@@ -281,23 +283,21 @@ int arizona_init_gpio(struct snd_soc_codec *codec) | |||
281 | switch (arizona->type) { | 283 | switch (arizona->type) { |
282 | case WM5110: | 284 | case WM5110: |
283 | case WM8280: | 285 | case WM8280: |
284 | snd_soc_dapm_disable_pin(&codec->dapm, "DRC2 Signal Activity"); | 286 | snd_soc_dapm_disable_pin(dapm, "DRC2 Signal Activity"); |
285 | break; | 287 | break; |
286 | default: | 288 | default: |
287 | break; | 289 | break; |
288 | } | 290 | } |
289 | 291 | ||
290 | snd_soc_dapm_disable_pin(&codec->dapm, "DRC1 Signal Activity"); | 292 | snd_soc_dapm_disable_pin(dapm, "DRC1 Signal Activity"); |
291 | 293 | ||
292 | for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) { | 294 | for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) { |
293 | switch (arizona->pdata.gpio_defaults[i] & ARIZONA_GPN_FN_MASK) { | 295 | switch (arizona->pdata.gpio_defaults[i] & ARIZONA_GPN_FN_MASK) { |
294 | case ARIZONA_GP_FN_DRC1_SIGNAL_DETECT: | 296 | case ARIZONA_GP_FN_DRC1_SIGNAL_DETECT: |
295 | snd_soc_dapm_enable_pin(&codec->dapm, | 297 | snd_soc_dapm_enable_pin(dapm, "DRC1 Signal Activity"); |
296 | "DRC1 Signal Activity"); | ||
297 | break; | 298 | break; |
298 | case ARIZONA_GP_FN_DRC2_SIGNAL_DETECT: | 299 | case ARIZONA_GP_FN_DRC2_SIGNAL_DETECT: |
299 | snd_soc_dapm_enable_pin(&codec->dapm, | 300 | snd_soc_dapm_enable_pin(dapm, "DRC2 Signal Activity"); |
300 | "DRC2 Signal Activity"); | ||
301 | break; | 301 | break; |
302 | default: | 302 | default: |
303 | break; | 303 | break; |
@@ -1619,6 +1619,7 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai, | |||
1619 | int clk_id, unsigned int freq, int dir) | 1619 | int clk_id, unsigned int freq, int dir) |
1620 | { | 1620 | { |
1621 | struct snd_soc_codec *codec = dai->codec; | 1621 | struct snd_soc_codec *codec = dai->codec; |
1622 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
1622 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); | 1623 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); |
1623 | struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1]; | 1624 | struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1]; |
1624 | struct snd_soc_dapm_route routes[2]; | 1625 | struct snd_soc_dapm_route routes[2]; |
@@ -1649,15 +1650,15 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai, | |||
1649 | 1650 | ||
1650 | routes[0].source = arizona_dai_clk_str(dai_priv->clk); | 1651 | routes[0].source = arizona_dai_clk_str(dai_priv->clk); |
1651 | routes[1].source = arizona_dai_clk_str(dai_priv->clk); | 1652 | routes[1].source = arizona_dai_clk_str(dai_priv->clk); |
1652 | snd_soc_dapm_del_routes(&codec->dapm, routes, ARRAY_SIZE(routes)); | 1653 | snd_soc_dapm_del_routes(dapm, routes, ARRAY_SIZE(routes)); |
1653 | 1654 | ||
1654 | routes[0].source = arizona_dai_clk_str(clk_id); | 1655 | routes[0].source = arizona_dai_clk_str(clk_id); |
1655 | routes[1].source = arizona_dai_clk_str(clk_id); | 1656 | routes[1].source = arizona_dai_clk_str(clk_id); |
1656 | snd_soc_dapm_add_routes(&codec->dapm, routes, ARRAY_SIZE(routes)); | 1657 | snd_soc_dapm_add_routes(dapm, routes, ARRAY_SIZE(routes)); |
1657 | 1658 | ||
1658 | dai_priv->clk = clk_id; | 1659 | dai_priv->clk = clk_id; |
1659 | 1660 | ||
1660 | return snd_soc_dapm_sync(&codec->dapm); | 1661 | return snd_soc_dapm_sync(dapm); |
1661 | } | 1662 | } |
1662 | 1663 | ||
1663 | static int arizona_set_tristate(struct snd_soc_dai *dai, int tristate) | 1664 | static int arizona_set_tristate(struct snd_soc_dai *dai, int tristate) |
diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c index d6dedd4eab29..1c895a53001d 100644 --- a/sound/soc/codecs/cq93vc.c +++ b/sound/soc/codecs/cq93vc.c | |||
@@ -92,7 +92,6 @@ static int cq93vc_set_bias_level(struct snd_soc_codec *codec, | |||
92 | DAVINCI_VC_REG12_POWER_ALL_OFF); | 92 | DAVINCI_VC_REG12_POWER_ALL_OFF); |
93 | break; | 93 | break; |
94 | } | 94 | } |
95 | codec->dapm.bias_level = level; | ||
96 | 95 | ||
97 | return 0; | 96 | return 0; |
98 | } | 97 | } |
diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c index cac48ddf3ba6..d7ec4756e45b 100644 --- a/sound/soc/codecs/cs4265.c +++ b/sound/soc/codecs/cs4265.c | |||
@@ -503,7 +503,6 @@ static int cs4265_set_bias_level(struct snd_soc_codec *codec, | |||
503 | CS4265_PWRCTL_PDN); | 503 | CS4265_PWRCTL_PDN); |
504 | break; | 504 | break; |
505 | } | 505 | } |
506 | codec->dapm.bias_level = level; | ||
507 | return 0; | 506 | return 0; |
508 | } | 507 | } |
509 | 508 | ||
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c index 1589e7a881d8..4de52c9957ac 100644 --- a/sound/soc/codecs/cs42l52.c +++ b/sound/soc/codecs/cs42l52.c | |||
@@ -897,7 +897,7 @@ static int cs42l52_set_bias_level(struct snd_soc_codec *codec, | |||
897 | CS42L52_PWRCTL1_PDN_CODEC, 0); | 897 | CS42L52_PWRCTL1_PDN_CODEC, 0); |
898 | break; | 898 | break; |
899 | case SND_SOC_BIAS_STANDBY: | 899 | case SND_SOC_BIAS_STANDBY: |
900 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 900 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
901 | regcache_cache_only(cs42l52->regmap, false); | 901 | regcache_cache_only(cs42l52->regmap, false); |
902 | regcache_sync(cs42l52->regmap); | 902 | regcache_sync(cs42l52->regmap); |
903 | } | 903 | } |
@@ -908,7 +908,6 @@ static int cs42l52_set_bias_level(struct snd_soc_codec *codec, | |||
908 | regcache_cache_only(cs42l52->regmap, true); | 908 | regcache_cache_only(cs42l52->regmap, true); |
909 | break; | 909 | break; |
910 | } | 910 | } |
911 | codec->dapm.bias_level = level; | ||
912 | 911 | ||
913 | return 0; | 912 | return 0; |
914 | } | 913 | } |
@@ -956,7 +955,7 @@ static void cs42l52_beep_work(struct work_struct *work) | |||
956 | struct cs42l52_private *cs42l52 = | 955 | struct cs42l52_private *cs42l52 = |
957 | container_of(work, struct cs42l52_private, beep_work); | 956 | container_of(work, struct cs42l52_private, beep_work); |
958 | struct snd_soc_codec *codec = cs42l52->codec; | 957 | struct snd_soc_codec *codec = cs42l52->codec; |
959 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 958 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
960 | int i; | 959 | int i; |
961 | int val = 0; | 960 | int val = 0; |
962 | int best = 0; | 961 | int best = 0; |
diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c index cbc654fe48c7..1e11ba45a79f 100644 --- a/sound/soc/codecs/cs42l56.c +++ b/sound/soc/codecs/cs42l56.c | |||
@@ -953,7 +953,7 @@ static int cs42l56_set_bias_level(struct snd_soc_codec *codec, | |||
953 | CS42L56_PDN_ALL_MASK, 0); | 953 | CS42L56_PDN_ALL_MASK, 0); |
954 | break; | 954 | break; |
955 | case SND_SOC_BIAS_STANDBY: | 955 | case SND_SOC_BIAS_STANDBY: |
956 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 956 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
957 | regcache_cache_only(cs42l56->regmap, false); | 957 | regcache_cache_only(cs42l56->regmap, false); |
958 | regcache_sync(cs42l56->regmap); | 958 | regcache_sync(cs42l56->regmap); |
959 | ret = regulator_bulk_enable(ARRAY_SIZE(cs42l56->supplies), | 959 | ret = regulator_bulk_enable(ARRAY_SIZE(cs42l56->supplies), |
@@ -978,7 +978,6 @@ static int cs42l56_set_bias_level(struct snd_soc_codec *codec, | |||
978 | cs42l56->supplies); | 978 | cs42l56->supplies); |
979 | break; | 979 | break; |
980 | } | 980 | } |
981 | codec->dapm.bias_level = level; | ||
982 | 981 | ||
983 | return 0; | 982 | return 0; |
984 | } | 983 | } |
@@ -1026,7 +1025,7 @@ static void cs42l56_beep_work(struct work_struct *work) | |||
1026 | struct cs42l56_private *cs42l56 = | 1025 | struct cs42l56_private *cs42l56 = |
1027 | container_of(work, struct cs42l56_private, beep_work); | 1026 | container_of(work, struct cs42l56_private, beep_work); |
1028 | struct snd_soc_codec *codec = cs42l56->codec; | 1027 | struct snd_soc_codec *codec = cs42l56->codec; |
1029 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 1028 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
1030 | int i; | 1029 | int i; |
1031 | int val = 0; | 1030 | int val = 0; |
1032 | int best = 0; | 1031 | int best = 0; |
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 8ecedba79606..b7853b9d3a60 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c | |||
@@ -1208,7 +1208,7 @@ static int cs42l73_set_bias_level(struct snd_soc_codec *codec, | |||
1208 | break; | 1208 | break; |
1209 | 1209 | ||
1210 | case SND_SOC_BIAS_STANDBY: | 1210 | case SND_SOC_BIAS_STANDBY: |
1211 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1211 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1212 | regcache_cache_only(cs42l73->regmap, false); | 1212 | regcache_cache_only(cs42l73->regmap, false); |
1213 | regcache_sync(cs42l73->regmap); | 1213 | regcache_sync(cs42l73->regmap); |
1214 | } | 1214 | } |
@@ -1228,7 +1228,6 @@ static int cs42l73_set_bias_level(struct snd_soc_codec *codec, | |||
1228 | snd_soc_update_bits(codec, CS42L73_DMMCC, CS42L73_MCLKDIS, 1); | 1228 | snd_soc_update_bits(codec, CS42L73_DMMCC, CS42L73_MCLKDIS, 1); |
1229 | break; | 1229 | break; |
1230 | } | 1230 | } |
1231 | codec->dapm.bias_level = level; | ||
1232 | return 0; | 1231 | return 0; |
1233 | } | 1232 | } |
1234 | 1233 | ||
diff --git a/sound/soc/codecs/cs42xx8.c b/sound/soc/codecs/cs42xx8.c index 670ebfe12903..e1d46862e81f 100644 --- a/sound/soc/codecs/cs42xx8.c +++ b/sound/soc/codecs/cs42xx8.c | |||
@@ -380,7 +380,7 @@ EXPORT_SYMBOL_GPL(cs42xx8_regmap_config); | |||
380 | static int cs42xx8_codec_probe(struct snd_soc_codec *codec) | 380 | static int cs42xx8_codec_probe(struct snd_soc_codec *codec) |
381 | { | 381 | { |
382 | struct cs42xx8_priv *cs42xx8 = snd_soc_codec_get_drvdata(codec); | 382 | struct cs42xx8_priv *cs42xx8 = snd_soc_codec_get_drvdata(codec); |
383 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 383 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
384 | 384 | ||
385 | switch (cs42xx8->drvdata->num_adcs) { | 385 | switch (cs42xx8->drvdata->num_adcs) { |
386 | case 3: | 386 | case 3: |
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index 0f334bc1b63c..d6f4abbbf8a7 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c | |||
@@ -333,7 +333,7 @@ static int cx20442_set_bias_level(struct snd_soc_codec *codec, | |||
333 | 333 | ||
334 | switch (level) { | 334 | switch (level) { |
335 | case SND_SOC_BIAS_PREPARE: | 335 | case SND_SOC_BIAS_PREPARE: |
336 | if (codec->dapm.bias_level != SND_SOC_BIAS_STANDBY) | 336 | if (snd_soc_codec_get_bias_level(codec) != SND_SOC_BIAS_STANDBY) |
337 | break; | 337 | break; |
338 | if (IS_ERR(cx20442->por)) | 338 | if (IS_ERR(cx20442->por)) |
339 | err = PTR_ERR(cx20442->por); | 339 | err = PTR_ERR(cx20442->por); |
@@ -341,7 +341,7 @@ static int cx20442_set_bias_level(struct snd_soc_codec *codec, | |||
341 | err = regulator_enable(cx20442->por); | 341 | err = regulator_enable(cx20442->por); |
342 | break; | 342 | break; |
343 | case SND_SOC_BIAS_STANDBY: | 343 | case SND_SOC_BIAS_STANDBY: |
344 | if (codec->dapm.bias_level != SND_SOC_BIAS_PREPARE) | 344 | if (snd_soc_codec_get_bias_level(codec) != SND_SOC_BIAS_PREPARE) |
345 | break; | 345 | break; |
346 | if (IS_ERR(cx20442->por)) | 346 | if (IS_ERR(cx20442->por)) |
347 | err = PTR_ERR(cx20442->por); | 347 | err = PTR_ERR(cx20442->por); |
@@ -351,8 +351,6 @@ static int cx20442_set_bias_level(struct snd_soc_codec *codec, | |||
351 | default: | 351 | default: |
352 | break; | 352 | break; |
353 | } | 353 | } |
354 | if (!err) | ||
355 | codec->dapm.bias_level = level; | ||
356 | 354 | ||
357 | return err; | 355 | return err; |
358 | } | 356 | } |
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c index 9ec577f0edb4..238e48a3a4fe 100644 --- a/sound/soc/codecs/da7213.c +++ b/sound/soc/codecs/da7213.c | |||
@@ -1374,7 +1374,7 @@ static int da7213_set_bias_level(struct snd_soc_codec *codec, | |||
1374 | case SND_SOC_BIAS_PREPARE: | 1374 | case SND_SOC_BIAS_PREPARE: |
1375 | break; | 1375 | break; |
1376 | case SND_SOC_BIAS_STANDBY: | 1376 | case SND_SOC_BIAS_STANDBY: |
1377 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1377 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1378 | /* Enable VMID reference & master bias */ | 1378 | /* Enable VMID reference & master bias */ |
1379 | snd_soc_update_bits(codec, DA7213_REFERENCES, | 1379 | snd_soc_update_bits(codec, DA7213_REFERENCES, |
1380 | DA7213_VMID_EN | DA7213_BIAS_EN, | 1380 | DA7213_VMID_EN | DA7213_BIAS_EN, |
@@ -1387,7 +1387,6 @@ static int da7213_set_bias_level(struct snd_soc_codec *codec, | |||
1387 | DA7213_VMID_EN | DA7213_BIAS_EN, 0); | 1387 | DA7213_VMID_EN | DA7213_BIAS_EN, 0); |
1388 | break; | 1388 | break; |
1389 | } | 1389 | } |
1390 | codec->dapm.bias_level = level; | ||
1391 | return 0; | 1390 | return 0; |
1392 | } | 1391 | } |
1393 | 1392 | ||
diff --git a/sound/soc/codecs/da732x.c b/sound/soc/codecs/da732x.c index 911c26c705fc..207523686bd5 100644 --- a/sound/soc/codecs/da732x.c +++ b/sound/soc/codecs/da732x.c | |||
@@ -1432,7 +1432,7 @@ static int da732x_set_bias_level(struct snd_soc_codec *codec, | |||
1432 | case SND_SOC_BIAS_PREPARE: | 1432 | case SND_SOC_BIAS_PREPARE: |
1433 | break; | 1433 | break; |
1434 | case SND_SOC_BIAS_STANDBY: | 1434 | case SND_SOC_BIAS_STANDBY: |
1435 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1435 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1436 | /* Init Codec */ | 1436 | /* Init Codec */ |
1437 | snd_soc_write(codec, DA732X_REG_REF1, | 1437 | snd_soc_write(codec, DA732X_REG_REF1, |
1438 | DA732X_VMID_FASTCHG); | 1438 | DA732X_VMID_FASTCHG); |
@@ -1502,8 +1502,6 @@ static int da732x_set_bias_level(struct snd_soc_codec *codec, | |||
1502 | break; | 1502 | break; |
1503 | } | 1503 | } |
1504 | 1504 | ||
1505 | codec->dapm.bias_level = level; | ||
1506 | |||
1507 | return 0; | 1505 | return 0; |
1508 | } | 1506 | } |
1509 | 1507 | ||
diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c index ad19cc56702b..66bb446473b8 100644 --- a/sound/soc/codecs/da9055.c +++ b/sound/soc/codecs/da9055.c | |||
@@ -1364,7 +1364,7 @@ static int da9055_set_bias_level(struct snd_soc_codec *codec, | |||
1364 | case SND_SOC_BIAS_PREPARE: | 1364 | case SND_SOC_BIAS_PREPARE: |
1365 | break; | 1365 | break; |
1366 | case SND_SOC_BIAS_STANDBY: | 1366 | case SND_SOC_BIAS_STANDBY: |
1367 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1367 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1368 | /* Enable VMID reference & master bias */ | 1368 | /* Enable VMID reference & master bias */ |
1369 | snd_soc_update_bits(codec, DA9055_REFERENCES, | 1369 | snd_soc_update_bits(codec, DA9055_REFERENCES, |
1370 | DA9055_VMID_EN | DA9055_BIAS_EN, | 1370 | DA9055_VMID_EN | DA9055_BIAS_EN, |
@@ -1377,7 +1377,6 @@ static int da9055_set_bias_level(struct snd_soc_codec *codec, | |||
1377 | DA9055_VMID_EN | DA9055_BIAS_EN, 0); | 1377 | DA9055_VMID_EN | DA9055_BIAS_EN, 0); |
1378 | break; | 1378 | break; |
1379 | } | 1379 | } |
1380 | codec->dapm.bias_level = level; | ||
1381 | return 0; | 1380 | return 0; |
1382 | } | 1381 | } |
1383 | 1382 | ||
diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c index c5f35a07e8e4..6a091016e0fc 100644 --- a/sound/soc/codecs/es8328.c +++ b/sound/soc/codecs/es8328.c | |||
@@ -536,7 +536,7 @@ static int es8328_set_bias_level(struct snd_soc_codec *codec, | |||
536 | break; | 536 | break; |
537 | 537 | ||
538 | case SND_SOC_BIAS_STANDBY: | 538 | case SND_SOC_BIAS_STANDBY: |
539 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 539 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
540 | snd_soc_update_bits(codec, ES8328_CONTROL1, | 540 | snd_soc_update_bits(codec, ES8328_CONTROL1, |
541 | ES8328_CONTROL1_VMIDSEL_MASK | | 541 | ES8328_CONTROL1_VMIDSEL_MASK | |
542 | ES8328_CONTROL1_ENREF, | 542 | ES8328_CONTROL1_ENREF, |
@@ -566,7 +566,6 @@ static int es8328_set_bias_level(struct snd_soc_codec *codec, | |||
566 | 0); | 566 | 0); |
567 | break; | 567 | break; |
568 | } | 568 | } |
569 | codec->dapm.bias_level = level; | ||
570 | return 0; | 569 | return 0; |
571 | } | 570 | } |
572 | 571 | ||
diff --git a/sound/soc/codecs/isabelle.c b/sound/soc/codecs/isabelle.c index 3a89ce66d51d..ebd90283c960 100644 --- a/sound/soc/codecs/isabelle.c +++ b/sound/soc/codecs/isabelle.c | |||
@@ -909,8 +909,6 @@ static int isabelle_set_bias_level(struct snd_soc_codec *codec, | |||
909 | break; | 909 | break; |
910 | } | 910 | } |
911 | 911 | ||
912 | codec->dapm.bias_level = level; | ||
913 | |||
914 | return 0; | 912 | return 0; |
915 | } | 913 | } |
916 | 914 | ||
diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index 933f4476d76c..9363fdbca9cd 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c | |||
@@ -258,7 +258,7 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec, | |||
258 | break; | 258 | break; |
259 | case SND_SOC_BIAS_STANDBY: | 259 | case SND_SOC_BIAS_STANDBY: |
260 | /* The only way to clear the suspend flag is to reset the codec */ | 260 | /* The only way to clear the suspend flag is to reset the codec */ |
261 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) | 261 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) |
262 | jz4740_codec_wakeup(regmap); | 262 | jz4740_codec_wakeup(regmap); |
263 | 263 | ||
264 | mask = JZ4740_CODEC_1_VREF_DISABLE | | 264 | mask = JZ4740_CODEC_1_VREF_DISABLE | |
@@ -281,8 +281,6 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec, | |||
281 | break; | 281 | break; |
282 | } | 282 | } |
283 | 283 | ||
284 | codec->dapm.bias_level = level; | ||
285 | |||
286 | return 0; | 284 | return 0; |
287 | } | 285 | } |
288 | 286 | ||
diff --git a/sound/soc/codecs/lm4857.c b/sound/soc/codecs/lm4857.c index a924bb9d7886..79ad4cbdcdd4 100644 --- a/sound/soc/codecs/lm4857.c +++ b/sound/soc/codecs/lm4857.c | |||
@@ -89,8 +89,6 @@ static int lm4857_set_bias_level(struct snd_soc_codec *codec, | |||
89 | break; | 89 | break; |
90 | } | 90 | } |
91 | 91 | ||
92 | codec->dapm.bias_level = level; | ||
93 | |||
94 | return 0; | 92 | return 0; |
95 | } | 93 | } |
96 | 94 | ||
diff --git a/sound/soc/codecs/lm49453.c b/sound/soc/codecs/lm49453.c index c4dfde9bdf1c..6600aa0a33dc 100644 --- a/sound/soc/codecs/lm49453.c +++ b/sound/soc/codecs/lm49453.c | |||
@@ -1271,7 +1271,7 @@ static int lm49453_set_bias_level(struct snd_soc_codec *codec, | |||
1271 | break; | 1271 | break; |
1272 | 1272 | ||
1273 | case SND_SOC_BIAS_STANDBY: | 1273 | case SND_SOC_BIAS_STANDBY: |
1274 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) | 1274 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) |
1275 | regcache_sync(lm49453->regmap); | 1275 | regcache_sync(lm49453->regmap); |
1276 | 1276 | ||
1277 | snd_soc_update_bits(codec, LM49453_P0_PMC_SETUP_REG, | 1277 | snd_soc_update_bits(codec, LM49453_P0_PMC_SETUP_REG, |
@@ -1284,8 +1284,6 @@ static int lm49453_set_bias_level(struct snd_soc_codec *codec, | |||
1284 | break; | 1284 | break; |
1285 | } | 1285 | } |
1286 | 1286 | ||
1287 | codec->dapm.bias_level = level; | ||
1288 | |||
1289 | return 0; | 1287 | return 0; |
1290 | } | 1288 | } |
1291 | 1289 | ||
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index 805b3f8cd39d..d0f45348bfbb 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c | |||
@@ -1571,7 +1571,7 @@ static int max98088_set_bias_level(struct snd_soc_codec *codec, | |||
1571 | break; | 1571 | break; |
1572 | 1572 | ||
1573 | case SND_SOC_BIAS_STANDBY: | 1573 | case SND_SOC_BIAS_STANDBY: |
1574 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) | 1574 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) |
1575 | regcache_sync(max98088->regmap); | 1575 | regcache_sync(max98088->regmap); |
1576 | 1576 | ||
1577 | snd_soc_update_bits(codec, M98088_REG_4C_PWR_EN_IN, | 1577 | snd_soc_update_bits(codec, M98088_REG_4C_PWR_EN_IN, |
@@ -1584,7 +1584,6 @@ static int max98088_set_bias_level(struct snd_soc_codec *codec, | |||
1584 | regcache_mark_dirty(max98088->regmap); | 1584 | regcache_mark_dirty(max98088->regmap); |
1585 | break; | 1585 | break; |
1586 | } | 1586 | } |
1587 | codec->dapm.bias_level = level; | ||
1588 | return 0; | 1587 | return 0; |
1589 | } | 1588 | } |
1590 | 1589 | ||
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index 3e33ef2acf3c..c2306268cab8 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c | |||
@@ -1500,7 +1500,7 @@ static const struct snd_soc_dapm_route max98091_dapm_routes[] = { | |||
1500 | static int max98090_add_widgets(struct snd_soc_codec *codec) | 1500 | static int max98090_add_widgets(struct snd_soc_codec *codec) |
1501 | { | 1501 | { |
1502 | struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec); | 1502 | struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec); |
1503 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 1503 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
1504 | 1504 | ||
1505 | snd_soc_add_codec_controls(codec, max98090_snd_controls, | 1505 | snd_soc_add_codec_controls(codec, max98090_snd_controls, |
1506 | ARRAY_SIZE(max98090_snd_controls)); | 1506 | ARRAY_SIZE(max98090_snd_controls)); |
@@ -1798,16 +1798,17 @@ static int max98090_set_bias_level(struct snd_soc_codec *codec, | |||
1798 | * away from ON. Disable the clock in that case, otherwise | 1798 | * away from ON. Disable the clock in that case, otherwise |
1799 | * enable it. | 1799 | * enable it. |
1800 | */ | 1800 | */ |
1801 | if (!IS_ERR(max98090->mclk)) { | 1801 | if (IS_ERR(max98090->mclk)) |
1802 | if (codec->dapm.bias_level == SND_SOC_BIAS_ON) | 1802 | break; |
1803 | clk_disable_unprepare(max98090->mclk); | 1803 | |
1804 | else | 1804 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_ON) |
1805 | clk_prepare_enable(max98090->mclk); | 1805 | clk_disable_unprepare(max98090->mclk); |
1806 | } | 1806 | else |
1807 | clk_prepare_enable(max98090->mclk); | ||
1807 | break; | 1808 | break; |
1808 | 1809 | ||
1809 | case SND_SOC_BIAS_STANDBY: | 1810 | case SND_SOC_BIAS_STANDBY: |
1810 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1811 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1811 | ret = regcache_sync(max98090->regmap); | 1812 | ret = regcache_sync(max98090->regmap); |
1812 | if (ret != 0) { | 1813 | if (ret != 0) { |
1813 | dev_err(codec->dev, | 1814 | dev_err(codec->dev, |
@@ -1824,7 +1825,6 @@ static int max98090_set_bias_level(struct snd_soc_codec *codec, | |||
1824 | regcache_mark_dirty(max98090->regmap); | 1825 | regcache_mark_dirty(max98090->regmap); |
1825 | break; | 1826 | break; |
1826 | } | 1827 | } |
1827 | codec->dapm.bias_level = level; | ||
1828 | return 0; | 1828 | return 0; |
1829 | } | 1829 | } |
1830 | 1830 | ||
@@ -2187,7 +2187,6 @@ static void max98090_jack_work(struct work_struct *work) | |||
2187 | struct max98090_priv, | 2187 | struct max98090_priv, |
2188 | jack_work.work); | 2188 | jack_work.work); |
2189 | struct snd_soc_codec *codec = max98090->codec; | 2189 | struct snd_soc_codec *codec = max98090->codec; |
2190 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
2191 | int status = 0; | 2190 | int status = 0; |
2192 | int reg; | 2191 | int reg; |
2193 | 2192 | ||
@@ -2266,8 +2265,6 @@ static void max98090_jack_work(struct work_struct *work) | |||
2266 | 2265 | ||
2267 | snd_soc_jack_report(max98090->jack, status, | 2266 | snd_soc_jack_report(max98090->jack, status, |
2268 | SND_JACK_HEADSET | SND_JACK_BTN_0); | 2267 | SND_JACK_HEADSET | SND_JACK_BTN_0); |
2269 | |||
2270 | snd_soc_dapm_sync(dapm); | ||
2271 | } | 2268 | } |
2272 | 2269 | ||
2273 | static irqreturn_t max98090_interrupt(int irq, void *data) | 2270 | static irqreturn_t max98090_interrupt(int irq, void *data) |
diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c index 8fba0c3db798..2b8b8a5f385f 100644 --- a/sound/soc/codecs/max98095.c +++ b/sound/soc/codecs/max98095.c | |||
@@ -1650,16 +1650,17 @@ static int max98095_set_bias_level(struct snd_soc_codec *codec, | |||
1650 | * away from ON. Disable the clock in that case, otherwise | 1650 | * away from ON. Disable the clock in that case, otherwise |
1651 | * enable it. | 1651 | * enable it. |
1652 | */ | 1652 | */ |
1653 | if (!IS_ERR(max98095->mclk)) { | 1653 | if (IS_ERR(max98095->mclk)) |
1654 | if (codec->dapm.bias_level == SND_SOC_BIAS_ON) | 1654 | break; |
1655 | clk_disable_unprepare(max98095->mclk); | 1655 | |
1656 | else | 1656 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_ON) |
1657 | clk_prepare_enable(max98095->mclk); | 1657 | clk_disable_unprepare(max98095->mclk); |
1658 | } | 1658 | else |
1659 | clk_prepare_enable(max98095->mclk); | ||
1659 | break; | 1660 | break; |
1660 | 1661 | ||
1661 | case SND_SOC_BIAS_STANDBY: | 1662 | case SND_SOC_BIAS_STANDBY: |
1662 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1663 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1663 | ret = regcache_sync(max98095->regmap); | 1664 | ret = regcache_sync(max98095->regmap); |
1664 | 1665 | ||
1665 | if (ret != 0) { | 1666 | if (ret != 0) { |
@@ -1678,7 +1679,6 @@ static int max98095_set_bias_level(struct snd_soc_codec *codec, | |||
1678 | regcache_mark_dirty(max98095->regmap); | 1679 | regcache_mark_dirty(max98095->regmap); |
1679 | break; | 1680 | break; |
1680 | } | 1681 | } |
1681 | codec->dapm.bias_level = level; | ||
1682 | return 0; | 1682 | return 0; |
1683 | } | 1683 | } |
1684 | 1684 | ||
@@ -2198,7 +2198,7 @@ static int max98095_suspend(struct snd_soc_codec *codec) | |||
2198 | if (max98095->headphone_jack || max98095->mic_jack) | 2198 | if (max98095->headphone_jack || max98095->mic_jack) |
2199 | max98095_jack_detect_disable(codec); | 2199 | max98095_jack_detect_disable(codec); |
2200 | 2200 | ||
2201 | max98095_set_bias_level(codec, SND_SOC_BIAS_OFF); | 2201 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); |
2202 | 2202 | ||
2203 | return 0; | 2203 | return 0; |
2204 | } | 2204 | } |
@@ -2208,7 +2208,7 @@ static int max98095_resume(struct snd_soc_codec *codec) | |||
2208 | struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec); | 2208 | struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec); |
2209 | struct i2c_client *client = to_i2c_client(codec->dev); | 2209 | struct i2c_client *client = to_i2c_client(codec->dev); |
2210 | 2210 | ||
2211 | max98095_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 2211 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
2212 | 2212 | ||
2213 | if (max98095->headphone_jack || max98095->mic_jack) { | 2213 | if (max98095->headphone_jack || max98095->mic_jack) { |
2214 | max98095_jack_detect_enable(codec); | 2214 | max98095_jack_detect_enable(codec); |
diff --git a/sound/soc/codecs/max9850.c b/sound/soc/codecs/max9850.c index 10f8e47ce2c2..481d58f1cb3f 100644 --- a/sound/soc/codecs/max9850.c +++ b/sound/soc/codecs/max9850.c | |||
@@ -252,7 +252,7 @@ static int max9850_set_bias_level(struct snd_soc_codec *codec, | |||
252 | case SND_SOC_BIAS_PREPARE: | 252 | case SND_SOC_BIAS_PREPARE: |
253 | break; | 253 | break; |
254 | case SND_SOC_BIAS_STANDBY: | 254 | case SND_SOC_BIAS_STANDBY: |
255 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 255 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
256 | ret = regcache_sync(max9850->regmap); | 256 | ret = regcache_sync(max9850->regmap); |
257 | if (ret) { | 257 | if (ret) { |
258 | dev_err(codec->dev, | 258 | dev_err(codec->dev, |
@@ -264,7 +264,6 @@ static int max9850_set_bias_level(struct snd_soc_codec *codec, | |||
264 | case SND_SOC_BIAS_OFF: | 264 | case SND_SOC_BIAS_OFF: |
265 | break; | 265 | break; |
266 | } | 266 | } |
267 | codec->dapm.bias_level = level; | ||
268 | return 0; | 267 | return 0; |
269 | } | 268 | } |
270 | 269 | ||
diff --git a/sound/soc/codecs/ml26124.c b/sound/soc/codecs/ml26124.c index 711f55039522..62dda2488f14 100644 --- a/sound/soc/codecs/ml26124.c +++ b/sound/soc/codecs/ml26124.c | |||
@@ -523,7 +523,7 @@ static int ml26124_set_bias_level(struct snd_soc_codec *codec, | |||
523 | break; | 523 | break; |
524 | case SND_SOC_BIAS_STANDBY: | 524 | case SND_SOC_BIAS_STANDBY: |
525 | /* VMID ON */ | 525 | /* VMID ON */ |
526 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 526 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
527 | snd_soc_update_bits(codec, ML26124_PW_REF_PW_MNG, | 527 | snd_soc_update_bits(codec, ML26124_PW_REF_PW_MNG, |
528 | ML26124_VMID, ML26124_VMID); | 528 | ML26124_VMID, ML26124_VMID); |
529 | msleep(500); | 529 | msleep(500); |
@@ -536,7 +536,6 @@ static int ml26124_set_bias_level(struct snd_soc_codec *codec, | |||
536 | ML26124_VMID, 0); | 536 | ML26124_VMID, 0); |
537 | break; | 537 | break; |
538 | } | 538 | } |
539 | codec->dapm.bias_level = level; | ||
540 | return 0; | 539 | return 0; |
541 | } | 540 | } |
542 | 541 | ||
diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c index e12764d15431..de16429f0a43 100644 --- a/sound/soc/codecs/pcm512x.c +++ b/sound/soc/codecs/pcm512x.c | |||
@@ -242,7 +242,7 @@ static int pcm512x_overclock_pll_put(struct snd_kcontrol *kcontrol, | |||
242 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 242 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
243 | struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); | 243 | struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); |
244 | 244 | ||
245 | switch (codec->dapm.bias_level) { | 245 | switch (snd_soc_codec_get_bias_level(codec)) { |
246 | case SND_SOC_BIAS_OFF: | 246 | case SND_SOC_BIAS_OFF: |
247 | case SND_SOC_BIAS_STANDBY: | 247 | case SND_SOC_BIAS_STANDBY: |
248 | break; | 248 | break; |
@@ -270,7 +270,7 @@ static int pcm512x_overclock_dsp_put(struct snd_kcontrol *kcontrol, | |||
270 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 270 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
271 | struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); | 271 | struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); |
272 | 272 | ||
273 | switch (codec->dapm.bias_level) { | 273 | switch (snd_soc_codec_get_bias_level(codec)) { |
274 | case SND_SOC_BIAS_OFF: | 274 | case SND_SOC_BIAS_OFF: |
275 | case SND_SOC_BIAS_STANDBY: | 275 | case SND_SOC_BIAS_STANDBY: |
276 | break; | 276 | break; |
@@ -298,7 +298,7 @@ static int pcm512x_overclock_dac_put(struct snd_kcontrol *kcontrol, | |||
298 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 298 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
299 | struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); | 299 | struct pcm512x_priv *pcm512x = snd_soc_codec_get_drvdata(codec); |
300 | 300 | ||
301 | switch (codec->dapm.bias_level) { | 301 | switch (snd_soc_codec_get_bias_level(codec)) { |
302 | case SND_SOC_BIAS_OFF: | 302 | case SND_SOC_BIAS_OFF: |
303 | case SND_SOC_BIAS_STANDBY: | 303 | case SND_SOC_BIAS_STANDBY: |
304 | break; | 304 | break; |
@@ -641,8 +641,6 @@ static int pcm512x_set_bias_level(struct snd_soc_codec *codec, | |||
641 | break; | 641 | break; |
642 | } | 642 | } |
643 | 643 | ||
644 | codec->dapm.bias_level = level; | ||
645 | |||
646 | return 0; | 644 | return 0; |
647 | } | 645 | } |
648 | 646 | ||
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index 0fcda35a3a93..c6cca0639e0d 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c | |||
@@ -301,6 +301,7 @@ static int rt286_support_power_controls[] = { | |||
301 | 301 | ||
302 | static int rt286_jack_detect(struct rt286_priv *rt286, bool *hp, bool *mic) | 302 | static int rt286_jack_detect(struct rt286_priv *rt286, bool *hp, bool *mic) |
303 | { | 303 | { |
304 | struct snd_soc_dapm_context *dapm; | ||
304 | unsigned int val, buf; | 305 | unsigned int val, buf; |
305 | 306 | ||
306 | *hp = false; | 307 | *hp = false; |
@@ -308,6 +309,9 @@ static int rt286_jack_detect(struct rt286_priv *rt286, bool *hp, bool *mic) | |||
308 | 309 | ||
309 | if (!rt286->codec) | 310 | if (!rt286->codec) |
310 | return -EINVAL; | 311 | return -EINVAL; |
312 | |||
313 | dapm = snd_soc_codec_get_dapm(rt286->codec); | ||
314 | |||
311 | if (rt286->pdata.cbj_en) { | 315 | if (rt286->pdata.cbj_en) { |
312 | regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf); | 316 | regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf); |
313 | *hp = buf & 0x80000000; | 317 | *hp = buf & 0x80000000; |
@@ -316,14 +320,11 @@ static int rt286_jack_detect(struct rt286_priv *rt286, bool *hp, bool *mic) | |||
316 | regmap_update_bits(rt286->regmap, | 320 | regmap_update_bits(rt286->regmap, |
317 | RT286_DC_GAIN, 0x200, 0x200); | 321 | RT286_DC_GAIN, 0x200, 0x200); |
318 | 322 | ||
319 | snd_soc_dapm_force_enable_pin(&rt286->codec->dapm, | 323 | snd_soc_dapm_force_enable_pin(dapm, "HV"); |
320 | "HV"); | 324 | snd_soc_dapm_force_enable_pin(dapm, "VREF"); |
321 | snd_soc_dapm_force_enable_pin(&rt286->codec->dapm, | ||
322 | "VREF"); | ||
323 | /* power LDO1 */ | 325 | /* power LDO1 */ |
324 | snd_soc_dapm_force_enable_pin(&rt286->codec->dapm, | 326 | snd_soc_dapm_force_enable_pin(dapm, "LDO1"); |
325 | "LDO1"); | 327 | snd_soc_dapm_sync(dapm); |
326 | snd_soc_dapm_sync(&rt286->codec->dapm); | ||
327 | 328 | ||
328 | regmap_write(rt286->regmap, RT286_SET_MIC1, 0x24); | 329 | regmap_write(rt286->regmap, RT286_SET_MIC1, 0x24); |
329 | msleep(50); | 330 | msleep(50); |
@@ -360,11 +361,11 @@ static int rt286_jack_detect(struct rt286_priv *rt286, bool *hp, bool *mic) | |||
360 | *mic = buf & 0x80000000; | 361 | *mic = buf & 0x80000000; |
361 | } | 362 | } |
362 | 363 | ||
363 | snd_soc_dapm_disable_pin(&rt286->codec->dapm, "HV"); | 364 | snd_soc_dapm_disable_pin(dapm, "HV"); |
364 | snd_soc_dapm_disable_pin(&rt286->codec->dapm, "VREF"); | 365 | snd_soc_dapm_disable_pin(dapm, "VREF"); |
365 | if (!*hp) | 366 | if (!*hp) |
366 | snd_soc_dapm_disable_pin(&rt286->codec->dapm, "LDO1"); | 367 | snd_soc_dapm_disable_pin(dapm, "LDO1"); |
367 | snd_soc_dapm_sync(&rt286->codec->dapm); | 368 | snd_soc_dapm_sync(dapm); |
368 | 369 | ||
369 | return 0; | 370 | return 0; |
370 | } | 371 | } |
@@ -391,6 +392,7 @@ static void rt286_jack_detect_work(struct work_struct *work) | |||
391 | 392 | ||
392 | int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) | 393 | int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) |
393 | { | 394 | { |
395 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
394 | struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec); | 396 | struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec); |
395 | 397 | ||
396 | rt286->jack = jack; | 398 | rt286->jack = jack; |
@@ -398,7 +400,7 @@ int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) | |||
398 | if (jack) { | 400 | if (jack) { |
399 | /* enable IRQ */ | 401 | /* enable IRQ */ |
400 | if (rt286->jack->status & SND_JACK_HEADPHONE) | 402 | if (rt286->jack->status & SND_JACK_HEADPHONE) |
401 | snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO1"); | 403 | snd_soc_dapm_force_enable_pin(dapm, "LDO1"); |
402 | regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x2); | 404 | regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x2); |
403 | /* Send an initial empty report */ | 405 | /* Send an initial empty report */ |
404 | snd_soc_jack_report(rt286->jack, rt286->jack->status, | 406 | snd_soc_jack_report(rt286->jack, rt286->jack->status, |
@@ -406,9 +408,9 @@ int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) | |||
406 | } else { | 408 | } else { |
407 | /* disable IRQ */ | 409 | /* disable IRQ */ |
408 | regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x0); | 410 | regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x0); |
409 | snd_soc_dapm_disable_pin(&codec->dapm, "LDO1"); | 411 | snd_soc_dapm_disable_pin(dapm, "LDO1"); |
410 | } | 412 | } |
411 | snd_soc_dapm_sync(&codec->dapm); | 413 | snd_soc_dapm_sync(dapm); |
412 | 414 | ||
413 | return 0; | 415 | return 0; |
414 | } | 416 | } |
@@ -985,7 +987,7 @@ static int rt286_set_bias_level(struct snd_soc_codec *codec, | |||
985 | { | 987 | { |
986 | switch (level) { | 988 | switch (level) { |
987 | case SND_SOC_BIAS_PREPARE: | 989 | case SND_SOC_BIAS_PREPARE: |
988 | if (SND_SOC_BIAS_STANDBY == codec->dapm.bias_level) { | 990 | if (SND_SOC_BIAS_STANDBY == snd_soc_codec_get_bias_level(codec)) { |
989 | snd_soc_write(codec, | 991 | snd_soc_write(codec, |
990 | RT286_SET_AUDIO_POWER, AC_PWRST_D0); | 992 | RT286_SET_AUDIO_POWER, AC_PWRST_D0); |
991 | snd_soc_update_bits(codec, | 993 | snd_soc_update_bits(codec, |
@@ -1012,7 +1014,6 @@ static int rt286_set_bias_level(struct snd_soc_codec *codec, | |||
1012 | default: | 1014 | default: |
1013 | break; | 1015 | break; |
1014 | } | 1016 | } |
1015 | codec->dapm.bias_level = level; | ||
1016 | 1017 | ||
1017 | return 0; | 1018 | return 0; |
1018 | } | 1019 | } |
diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c index 2c10d77727af..058167c80d71 100644 --- a/sound/soc/codecs/rt5631.c +++ b/sound/soc/codecs/rt5631.c | |||
@@ -1546,7 +1546,7 @@ static int rt5631_set_bias_level(struct snd_soc_codec *codec, | |||
1546 | break; | 1546 | break; |
1547 | 1547 | ||
1548 | case SND_SOC_BIAS_STANDBY: | 1548 | case SND_SOC_BIAS_STANDBY: |
1549 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1549 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1550 | snd_soc_update_bits(codec, RT5631_PWR_MANAG_ADD3, | 1550 | snd_soc_update_bits(codec, RT5631_PWR_MANAG_ADD3, |
1551 | RT5631_PWR_VREF | RT5631_PWR_MAIN_BIAS, | 1551 | RT5631_PWR_VREF | RT5631_PWR_MAIN_BIAS, |
1552 | RT5631_PWR_VREF | RT5631_PWR_MAIN_BIAS); | 1552 | RT5631_PWR_VREF | RT5631_PWR_MAIN_BIAS); |
@@ -1569,7 +1569,6 @@ static int rt5631_set_bias_level(struct snd_soc_codec *codec, | |||
1569 | default: | 1569 | default: |
1570 | break; | 1570 | break; |
1571 | } | 1571 | } |
1572 | codec->dapm.bias_level = level; | ||
1573 | 1572 | ||
1574 | return 0; | 1573 | return 0; |
1575 | } | 1574 | } |
@@ -1615,7 +1614,7 @@ static int rt5631_probe(struct snd_soc_codec *codec) | |||
1615 | RT5631_DMIC_R_CH_LATCH_RISING); | 1614 | RT5631_DMIC_R_CH_LATCH_RISING); |
1616 | } | 1615 | } |
1617 | 1616 | ||
1618 | codec->dapm.bias_level = SND_SOC_BIAS_STANDBY; | 1617 | snd_soc_codec_init_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1619 | 1618 | ||
1620 | return 0; | 1619 | return 0; |
1621 | } | 1620 | } |
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index 178e55d4d481..f40752a6c242 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c | |||
@@ -1870,7 +1870,7 @@ static int rt5640_set_bias_level(struct snd_soc_codec *codec, | |||
1870 | { | 1870 | { |
1871 | switch (level) { | 1871 | switch (level) { |
1872 | case SND_SOC_BIAS_STANDBY: | 1872 | case SND_SOC_BIAS_STANDBY: |
1873 | if (SND_SOC_BIAS_OFF == codec->dapm.bias_level) { | 1873 | if (SND_SOC_BIAS_OFF == snd_soc_codec_get_bias_level(codec)) { |
1874 | snd_soc_update_bits(codec, RT5640_PWR_ANLG1, | 1874 | snd_soc_update_bits(codec, RT5640_PWR_ANLG1, |
1875 | RT5640_PWR_VREF1 | RT5640_PWR_MB | | 1875 | RT5640_PWR_VREF1 | RT5640_PWR_MB | |
1876 | RT5640_PWR_BG | RT5640_PWR_VREF2, | 1876 | RT5640_PWR_BG | RT5640_PWR_VREF2, |
@@ -1902,7 +1902,6 @@ static int rt5640_set_bias_level(struct snd_soc_codec *codec, | |||
1902 | default: | 1902 | default: |
1903 | break; | 1903 | break; |
1904 | } | 1904 | } |
1905 | codec->dapm.bias_level = level; | ||
1906 | 1905 | ||
1907 | return 0; | 1906 | return 0; |
1908 | } | 1907 | } |
@@ -1935,11 +1934,12 @@ EXPORT_SYMBOL_GPL(rt5640_dmic_enable); | |||
1935 | 1934 | ||
1936 | static int rt5640_probe(struct snd_soc_codec *codec) | 1935 | static int rt5640_probe(struct snd_soc_codec *codec) |
1937 | { | 1936 | { |
1937 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
1938 | struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); | 1938 | struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); |
1939 | 1939 | ||
1940 | rt5640->codec = codec; | 1940 | rt5640->codec = codec; |
1941 | 1941 | ||
1942 | rt5640_set_bias_level(codec, SND_SOC_BIAS_OFF); | 1942 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); |
1943 | 1943 | ||
1944 | snd_soc_update_bits(codec, RT5640_DUMMY1, 0x0301, 0x0301); | 1944 | snd_soc_update_bits(codec, RT5640_DUMMY1, 0x0301, 0x0301); |
1945 | snd_soc_update_bits(codec, RT5640_MICBIAS, 0x0030, 0x0030); | 1945 | snd_soc_update_bits(codec, RT5640_MICBIAS, 0x0030, 0x0030); |
@@ -1951,18 +1951,18 @@ static int rt5640_probe(struct snd_soc_codec *codec) | |||
1951 | snd_soc_add_codec_controls(codec, | 1951 | snd_soc_add_codec_controls(codec, |
1952 | rt5640_specific_snd_controls, | 1952 | rt5640_specific_snd_controls, |
1953 | ARRAY_SIZE(rt5640_specific_snd_controls)); | 1953 | ARRAY_SIZE(rt5640_specific_snd_controls)); |
1954 | snd_soc_dapm_new_controls(&codec->dapm, | 1954 | snd_soc_dapm_new_controls(dapm, |
1955 | rt5640_specific_dapm_widgets, | 1955 | rt5640_specific_dapm_widgets, |
1956 | ARRAY_SIZE(rt5640_specific_dapm_widgets)); | 1956 | ARRAY_SIZE(rt5640_specific_dapm_widgets)); |
1957 | snd_soc_dapm_add_routes(&codec->dapm, | 1957 | snd_soc_dapm_add_routes(dapm, |
1958 | rt5640_specific_dapm_routes, | 1958 | rt5640_specific_dapm_routes, |
1959 | ARRAY_SIZE(rt5640_specific_dapm_routes)); | 1959 | ARRAY_SIZE(rt5640_specific_dapm_routes)); |
1960 | break; | 1960 | break; |
1961 | case RT5640_ID_5639: | 1961 | case RT5640_ID_5639: |
1962 | snd_soc_dapm_new_controls(&codec->dapm, | 1962 | snd_soc_dapm_new_controls(dapm, |
1963 | rt5639_specific_dapm_widgets, | 1963 | rt5639_specific_dapm_widgets, |
1964 | ARRAY_SIZE(rt5639_specific_dapm_widgets)); | 1964 | ARRAY_SIZE(rt5639_specific_dapm_widgets)); |
1965 | snd_soc_dapm_add_routes(&codec->dapm, | 1965 | snd_soc_dapm_add_routes(dapm, |
1966 | rt5639_specific_dapm_routes, | 1966 | rt5639_specific_dapm_routes, |
1967 | ARRAY_SIZE(rt5639_specific_dapm_routes)); | 1967 | ARRAY_SIZE(rt5639_specific_dapm_routes)); |
1968 | break; | 1968 | break; |
@@ -1991,7 +1991,7 @@ static int rt5640_suspend(struct snd_soc_codec *codec) | |||
1991 | { | 1991 | { |
1992 | struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); | 1992 | struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); |
1993 | 1993 | ||
1994 | rt5640_set_bias_level(codec, SND_SOC_BIAS_OFF); | 1994 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); |
1995 | rt5640_reset(codec); | 1995 | rt5640_reset(codec); |
1996 | regcache_cache_only(rt5640->regmap, true); | 1996 | regcache_cache_only(rt5640->regmap, true); |
1997 | regcache_mark_dirty(rt5640->regmap); | 1997 | regcache_mark_dirty(rt5640->regmap); |
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 69528ae5410c..ea583675fa00 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
@@ -2409,7 +2409,6 @@ static int rt5645_set_bias_level(struct snd_soc_codec *codec, | |||
2409 | default: | 2409 | default: |
2410 | break; | 2410 | break; |
2411 | } | 2411 | } |
2412 | codec->dapm.bias_level = level; | ||
2413 | 2412 | ||
2414 | return 0; | 2413 | return 0; |
2415 | } | 2414 | } |
@@ -2520,7 +2519,7 @@ static int rt5645_probe(struct snd_soc_codec *codec) | |||
2520 | break; | 2519 | break; |
2521 | } | 2520 | } |
2522 | 2521 | ||
2523 | rt5645_set_bias_level(codec, SND_SOC_BIAS_OFF); | 2522 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); |
2524 | 2523 | ||
2525 | snd_soc_update_bits(codec, RT5645_CHARGE_PUMP, 0x0300, 0x0200); | 2524 | snd_soc_update_bits(codec, RT5645_CHARGE_PUMP, 0x0300, 0x0200); |
2526 | 2525 | ||
diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c index 9f4c7be6d798..a3506e193abc 100644 --- a/sound/soc/codecs/rt5651.c +++ b/sound/soc/codecs/rt5651.c | |||
@@ -1571,7 +1571,7 @@ static int rt5651_set_bias_level(struct snd_soc_codec *codec, | |||
1571 | { | 1571 | { |
1572 | switch (level) { | 1572 | switch (level) { |
1573 | case SND_SOC_BIAS_PREPARE: | 1573 | case SND_SOC_BIAS_PREPARE: |
1574 | if (SND_SOC_BIAS_STANDBY == codec->dapm.bias_level) { | 1574 | if (SND_SOC_BIAS_STANDBY == snd_soc_codec_get_bias_level(codec)) { |
1575 | snd_soc_update_bits(codec, RT5651_PWR_ANLG1, | 1575 | snd_soc_update_bits(codec, RT5651_PWR_ANLG1, |
1576 | RT5651_PWR_VREF1 | RT5651_PWR_MB | | 1576 | RT5651_PWR_VREF1 | RT5651_PWR_MB | |
1577 | RT5651_PWR_BG | RT5651_PWR_VREF2, | 1577 | RT5651_PWR_BG | RT5651_PWR_VREF2, |
@@ -1604,7 +1604,6 @@ static int rt5651_set_bias_level(struct snd_soc_codec *codec, | |||
1604 | default: | 1604 | default: |
1605 | break; | 1605 | break; |
1606 | } | 1606 | } |
1607 | codec->dapm.bias_level = level; | ||
1608 | 1607 | ||
1609 | return 0; | 1608 | return 0; |
1610 | } | 1609 | } |
@@ -1625,7 +1624,7 @@ static int rt5651_probe(struct snd_soc_codec *codec) | |||
1625 | RT5651_PWR_FV1 | RT5651_PWR_FV2, | 1624 | RT5651_PWR_FV1 | RT5651_PWR_FV2, |
1626 | RT5651_PWR_FV1 | RT5651_PWR_FV2); | 1625 | RT5651_PWR_FV1 | RT5651_PWR_FV2); |
1627 | 1626 | ||
1628 | rt5651_set_bias_level(codec, SND_SOC_BIAS_OFF); | 1627 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); |
1629 | 1628 | ||
1630 | return 0; | 1629 | return 0; |
1631 | } | 1630 | } |
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index cc7f84a150a7..840dd6d0003a 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c | |||
@@ -416,12 +416,12 @@ static bool rt5670_readable_register(struct device *dev, unsigned int reg) | |||
416 | static int rt5670_headset_detect(struct snd_soc_codec *codec, int jack_insert) | 416 | static int rt5670_headset_detect(struct snd_soc_codec *codec, int jack_insert) |
417 | { | 417 | { |
418 | int val; | 418 | int val; |
419 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
419 | struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); | 420 | struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); |
420 | 421 | ||
421 | if (jack_insert) { | 422 | if (jack_insert) { |
422 | snd_soc_dapm_force_enable_pin(&codec->dapm, | 423 | snd_soc_dapm_force_enable_pin(dapm, "Mic Det Power"); |
423 | "Mic Det Power"); | 424 | snd_soc_dapm_sync(dapm); |
424 | snd_soc_dapm_sync(&codec->dapm); | ||
425 | snd_soc_update_bits(codec, RT5670_GEN_CTRL3, 0x4, 0x0); | 425 | snd_soc_update_bits(codec, RT5670_GEN_CTRL3, 0x4, 0x0); |
426 | snd_soc_update_bits(codec, RT5670_CJ_CTRL2, | 426 | snd_soc_update_bits(codec, RT5670_CJ_CTRL2, |
427 | RT5670_CBJ_DET_MODE | RT5670_CBJ_MN_JD, | 427 | RT5670_CBJ_DET_MODE | RT5670_CBJ_MN_JD, |
@@ -447,15 +447,15 @@ static int rt5670_headset_detect(struct snd_soc_codec *codec, int jack_insert) | |||
447 | } else { | 447 | } else { |
448 | snd_soc_update_bits(codec, RT5670_GEN_CTRL3, 0x4, 0x4); | 448 | snd_soc_update_bits(codec, RT5670_GEN_CTRL3, 0x4, 0x4); |
449 | rt5670->jack_type = SND_JACK_HEADPHONE; | 449 | rt5670->jack_type = SND_JACK_HEADPHONE; |
450 | snd_soc_dapm_disable_pin(&codec->dapm, "Mic Det Power"); | 450 | snd_soc_dapm_disable_pin(dapm, "Mic Det Power"); |
451 | snd_soc_dapm_sync(&codec->dapm); | 451 | snd_soc_dapm_sync(dapm); |
452 | } | 452 | } |
453 | } else { | 453 | } else { |
454 | snd_soc_update_bits(codec, RT5670_INT_IRQ_ST, 0x8, 0x0); | 454 | snd_soc_update_bits(codec, RT5670_INT_IRQ_ST, 0x8, 0x0); |
455 | snd_soc_update_bits(codec, RT5670_GEN_CTRL3, 0x4, 0x4); | 455 | snd_soc_update_bits(codec, RT5670_GEN_CTRL3, 0x4, 0x4); |
456 | rt5670->jack_type = 0; | 456 | rt5670->jack_type = 0; |
457 | snd_soc_dapm_disable_pin(&codec->dapm, "Mic Det Power"); | 457 | snd_soc_dapm_disable_pin(dapm, "Mic Det Power"); |
458 | snd_soc_dapm_sync(&codec->dapm); | 458 | snd_soc_dapm_sync(dapm); |
459 | } | 459 | } |
460 | 460 | ||
461 | return rt5670->jack_type; | 461 | return rt5670->jack_type; |
@@ -2603,7 +2603,7 @@ static int rt5670_set_bias_level(struct snd_soc_codec *codec, | |||
2603 | 2603 | ||
2604 | switch (level) { | 2604 | switch (level) { |
2605 | case SND_SOC_BIAS_PREPARE: | 2605 | case SND_SOC_BIAS_PREPARE: |
2606 | if (SND_SOC_BIAS_STANDBY == codec->dapm.bias_level) { | 2606 | if (SND_SOC_BIAS_STANDBY == snd_soc_codec_get_bias_level(codec)) { |
2607 | snd_soc_update_bits(codec, RT5670_PWR_ANLG1, | 2607 | snd_soc_update_bits(codec, RT5670_PWR_ANLG1, |
2608 | RT5670_PWR_VREF1 | RT5670_PWR_MB | | 2608 | RT5670_PWR_VREF1 | RT5670_PWR_MB | |
2609 | RT5670_PWR_BG | RT5670_PWR_VREF2, | 2609 | RT5670_PWR_BG | RT5670_PWR_VREF2, |
@@ -2647,30 +2647,30 @@ static int rt5670_set_bias_level(struct snd_soc_codec *codec, | |||
2647 | default: | 2647 | default: |
2648 | break; | 2648 | break; |
2649 | } | 2649 | } |
2650 | codec->dapm.bias_level = level; | ||
2651 | 2650 | ||
2652 | return 0; | 2651 | return 0; |
2653 | } | 2652 | } |
2654 | 2653 | ||
2655 | static int rt5670_probe(struct snd_soc_codec *codec) | 2654 | static int rt5670_probe(struct snd_soc_codec *codec) |
2656 | { | 2655 | { |
2656 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
2657 | struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); | 2657 | struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec); |
2658 | 2658 | ||
2659 | switch (snd_soc_read(codec, RT5670_RESET) & RT5670_ID_MASK) { | 2659 | switch (snd_soc_read(codec, RT5670_RESET) & RT5670_ID_MASK) { |
2660 | case RT5670_ID_5670: | 2660 | case RT5670_ID_5670: |
2661 | case RT5670_ID_5671: | 2661 | case RT5670_ID_5671: |
2662 | snd_soc_dapm_new_controls(&codec->dapm, | 2662 | snd_soc_dapm_new_controls(dapm, |
2663 | rt5670_specific_dapm_widgets, | 2663 | rt5670_specific_dapm_widgets, |
2664 | ARRAY_SIZE(rt5670_specific_dapm_widgets)); | 2664 | ARRAY_SIZE(rt5670_specific_dapm_widgets)); |
2665 | snd_soc_dapm_add_routes(&codec->dapm, | 2665 | snd_soc_dapm_add_routes(dapm, |
2666 | rt5670_specific_dapm_routes, | 2666 | rt5670_specific_dapm_routes, |
2667 | ARRAY_SIZE(rt5670_specific_dapm_routes)); | 2667 | ARRAY_SIZE(rt5670_specific_dapm_routes)); |
2668 | break; | 2668 | break; |
2669 | case RT5670_ID_5672: | 2669 | case RT5670_ID_5672: |
2670 | snd_soc_dapm_new_controls(&codec->dapm, | 2670 | snd_soc_dapm_new_controls(dapm, |
2671 | rt5672_specific_dapm_widgets, | 2671 | rt5672_specific_dapm_widgets, |
2672 | ARRAY_SIZE(rt5672_specific_dapm_widgets)); | 2672 | ARRAY_SIZE(rt5672_specific_dapm_widgets)); |
2673 | snd_soc_dapm_add_routes(&codec->dapm, | 2673 | snd_soc_dapm_add_routes(dapm, |
2674 | rt5672_specific_dapm_routes, | 2674 | rt5672_specific_dapm_routes, |
2675 | ARRAY_SIZE(rt5672_specific_dapm_routes)); | 2675 | ARRAY_SIZE(rt5672_specific_dapm_routes)); |
2676 | break; | 2676 | break; |
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index af182586712d..c0211a1187a5 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c | |||
@@ -817,7 +817,7 @@ static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol, | |||
817 | 817 | ||
818 | rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0]; | 818 | rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0]; |
819 | 819 | ||
820 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) | 820 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) |
821 | rt5677_set_dsp_vad(codec, rt5677->dsp_vad_en); | 821 | rt5677_set_dsp_vad(codec, rt5677->dsp_vad_en); |
822 | 822 | ||
823 | return 0; | 823 | return 0; |
@@ -2476,7 +2476,7 @@ static int rt5677_vref_event(struct snd_soc_dapm_widget *w, | |||
2476 | 2476 | ||
2477 | switch (event) { | 2477 | switch (event) { |
2478 | case SND_SOC_DAPM_POST_PMU: | 2478 | case SND_SOC_DAPM_POST_PMU: |
2479 | if (codec->dapm.bias_level != SND_SOC_BIAS_ON && | 2479 | if (snd_soc_codec_get_bias_level(codec) != SND_SOC_BIAS_ON && |
2480 | !rt5677->is_vref_slow) { | 2480 | !rt5677->is_vref_slow) { |
2481 | mdelay(20); | 2481 | mdelay(20); |
2482 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, | 2482 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, |
@@ -4350,7 +4350,7 @@ static int rt5677_set_bias_level(struct snd_soc_codec *codec, | |||
4350 | break; | 4350 | break; |
4351 | 4351 | ||
4352 | case SND_SOC_BIAS_PREPARE: | 4352 | case SND_SOC_BIAS_PREPARE: |
4353 | if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) { | 4353 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) { |
4354 | rt5677_set_dsp_vad(codec, false); | 4354 | rt5677_set_dsp_vad(codec, false); |
4355 | 4355 | ||
4356 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, | 4356 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, |
@@ -4392,7 +4392,6 @@ static int rt5677_set_bias_level(struct snd_soc_codec *codec, | |||
4392 | default: | 4392 | default: |
4393 | break; | 4393 | break; |
4394 | } | 4394 | } |
4395 | codec->dapm.bias_level = level; | ||
4396 | 4395 | ||
4397 | return 0; | 4396 | return 0; |
4398 | } | 4397 | } |
@@ -4603,22 +4602,23 @@ static void rt5677_free_gpio(struct i2c_client *i2c) | |||
4603 | 4602 | ||
4604 | static int rt5677_probe(struct snd_soc_codec *codec) | 4603 | static int rt5677_probe(struct snd_soc_codec *codec) |
4605 | { | 4604 | { |
4605 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
4606 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 4606 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
4607 | int i; | 4607 | int i; |
4608 | 4608 | ||
4609 | rt5677->codec = codec; | 4609 | rt5677->codec = codec; |
4610 | 4610 | ||
4611 | if (rt5677->pdata.dmic2_clk_pin == RT5677_DMIC_CLK2) { | 4611 | if (rt5677->pdata.dmic2_clk_pin == RT5677_DMIC_CLK2) { |
4612 | snd_soc_dapm_add_routes(&codec->dapm, | 4612 | snd_soc_dapm_add_routes(dapm, |
4613 | rt5677_dmic2_clk_2, | 4613 | rt5677_dmic2_clk_2, |
4614 | ARRAY_SIZE(rt5677_dmic2_clk_2)); | 4614 | ARRAY_SIZE(rt5677_dmic2_clk_2)); |
4615 | } else { /*use dmic1 clock by default*/ | 4615 | } else { /*use dmic1 clock by default*/ |
4616 | snd_soc_dapm_add_routes(&codec->dapm, | 4616 | snd_soc_dapm_add_routes(dapm, |
4617 | rt5677_dmic2_clk_1, | 4617 | rt5677_dmic2_clk_1, |
4618 | ARRAY_SIZE(rt5677_dmic2_clk_1)); | 4618 | ARRAY_SIZE(rt5677_dmic2_clk_1)); |
4619 | } | 4619 | } |
4620 | 4620 | ||
4621 | rt5677_set_bias_level(codec, SND_SOC_BIAS_OFF); | 4621 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); |
4622 | 4622 | ||
4623 | regmap_write(rt5677->regmap, RT5677_DIG_MISC, 0x0020); | 4623 | regmap_write(rt5677->regmap, RT5677_DIG_MISC, 0x0020); |
4624 | regmap_write(rt5677->regmap, RT5677_PWR_DSP2, 0x0c00); | 4624 | regmap_write(rt5677->regmap, RT5677_PWR_DSP2, 0x0c00); |
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 3593a1496056..661ed4d22007 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
@@ -948,7 +948,7 @@ static int sgtl5000_set_bias_level(struct snd_soc_codec *codec, | |||
948 | case SND_SOC_BIAS_PREPARE: | 948 | case SND_SOC_BIAS_PREPARE: |
949 | break; | 949 | break; |
950 | case SND_SOC_BIAS_STANDBY: | 950 | case SND_SOC_BIAS_STANDBY: |
951 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 951 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
952 | ret = regulator_bulk_enable( | 952 | ret = regulator_bulk_enable( |
953 | ARRAY_SIZE(sgtl5000->supplies), | 953 | ARRAY_SIZE(sgtl5000->supplies), |
954 | sgtl5000->supplies); | 954 | sgtl5000->supplies); |
@@ -979,7 +979,6 @@ static int sgtl5000_set_bias_level(struct snd_soc_codec *codec, | |||
979 | break; | 979 | break; |
980 | } | 980 | } |
981 | 981 | ||
982 | codec->dapm.bias_level = level; | ||
983 | return 0; | 982 | return 0; |
984 | } | 983 | } |
985 | 984 | ||
diff --git a/sound/soc/codecs/sirf-audio-codec.c b/sound/soc/codecs/sirf-audio-codec.c index 0a8e43c98a07..29cb44256044 100644 --- a/sound/soc/codecs/sirf-audio-codec.c +++ b/sound/soc/codecs/sirf-audio-codec.c | |||
@@ -395,7 +395,7 @@ struct snd_soc_dai_driver sirf_audio_codec_dai = { | |||
395 | 395 | ||
396 | static int sirf_audio_codec_probe(struct snd_soc_codec *codec) | 396 | static int sirf_audio_codec_probe(struct snd_soc_codec *codec) |
397 | { | 397 | { |
398 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 398 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
399 | 399 | ||
400 | pm_runtime_enable(codec->dev); | 400 | pm_runtime_enable(codec->dev); |
401 | 401 | ||
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index 7947c0ebb1ed..3a7de0159f24 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c | |||
@@ -194,7 +194,7 @@ static int sn95031_set_vaud_bias(struct snd_soc_codec *codec, | |||
194 | break; | 194 | break; |
195 | 195 | ||
196 | case SND_SOC_BIAS_PREPARE: | 196 | case SND_SOC_BIAS_PREPARE: |
197 | if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) { | 197 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) { |
198 | pr_debug("vaud_bias powering up pll\n"); | 198 | pr_debug("vaud_bias powering up pll\n"); |
199 | /* power up the pll */ | 199 | /* power up the pll */ |
200 | snd_soc_write(codec, SN95031_AUDPLLCTRL, BIT(5)); | 200 | snd_soc_write(codec, SN95031_AUDPLLCTRL, BIT(5)); |
@@ -205,17 +205,22 @@ static int sn95031_set_vaud_bias(struct snd_soc_codec *codec, | |||
205 | break; | 205 | break; |
206 | 206 | ||
207 | case SND_SOC_BIAS_STANDBY: | 207 | case SND_SOC_BIAS_STANDBY: |
208 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 208 | switch (snd_soc_codec_get_bias_level(codec)) { |
209 | case SND_SOC_BIAS_OFF: | ||
209 | pr_debug("vaud_bias power up rail\n"); | 210 | pr_debug("vaud_bias power up rail\n"); |
210 | /* power up the rail */ | 211 | /* power up the rail */ |
211 | snd_soc_write(codec, SN95031_VAUD, | 212 | snd_soc_write(codec, SN95031_VAUD, |
212 | BIT(2)|BIT(1)|BIT(0)); | 213 | BIT(2)|BIT(1)|BIT(0)); |
213 | msleep(1); | 214 | msleep(1); |
214 | } else if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE) { | 215 | break; |
216 | case SND_SOC_BIAS_PREPARE: | ||
215 | /* turn off pcm */ | 217 | /* turn off pcm */ |
216 | pr_debug("vaud_bias power dn pcm\n"); | 218 | pr_debug("vaud_bias power dn pcm\n"); |
217 | snd_soc_update_bits(codec, SN95031_PCM2C2, BIT(0), 0); | 219 | snd_soc_update_bits(codec, SN95031_PCM2C2, BIT(0), 0); |
218 | snd_soc_write(codec, SN95031_AUDPLLCTRL, 0); | 220 | snd_soc_write(codec, SN95031_AUDPLLCTRL, 0); |
221 | break; | ||
222 | default: | ||
223 | break; | ||
219 | } | 224 | } |
220 | break; | 225 | break; |
221 | 226 | ||
@@ -226,7 +231,6 @@ static int sn95031_set_vaud_bias(struct snd_soc_codec *codec, | |||
226 | break; | 231 | break; |
227 | } | 232 | } |
228 | 233 | ||
229 | codec->dapm.bias_level = level; | ||
230 | return 0; | 234 | return 0; |
231 | } | 235 | } |
232 | 236 | ||
diff --git a/sound/soc/codecs/ssm2518.c b/sound/soc/codecs/ssm2518.c index 67ea55adb307..13c6ab0f7af0 100644 --- a/sound/soc/codecs/ssm2518.c +++ b/sound/soc/codecs/ssm2518.c | |||
@@ -518,12 +518,7 @@ static int ssm2518_set_bias_level(struct snd_soc_codec *codec, | |||
518 | break; | 518 | break; |
519 | } | 519 | } |
520 | 520 | ||
521 | if (ret) | 521 | return ret; |
522 | return ret; | ||
523 | |||
524 | codec->dapm.bias_level = level; | ||
525 | |||
526 | return 0; | ||
527 | } | 522 | } |
528 | 523 | ||
529 | static int ssm2518_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | 524 | static int ssm2518_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, |
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index 314eaece1b7d..296a140b8c35 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c | |||
@@ -473,7 +473,6 @@ static int ssm2602_set_bias_level(struct snd_soc_codec *codec, | |||
473 | break; | 473 | break; |
474 | 474 | ||
475 | } | 475 | } |
476 | codec->dapm.bias_level = level; | ||
477 | return 0; | 476 | return 0; |
478 | } | 477 | } |
479 | 478 | ||
diff --git a/sound/soc/codecs/ssm4567.c b/sound/soc/codecs/ssm4567.c index a984485108cd..643bcff4a919 100644 --- a/sound/soc/codecs/ssm4567.c +++ b/sound/soc/codecs/ssm4567.c | |||
@@ -361,12 +361,7 @@ static int ssm4567_set_bias_level(struct snd_soc_codec *codec, | |||
361 | break; | 361 | break; |
362 | } | 362 | } |
363 | 363 | ||
364 | if (ret) | 364 | return ret; |
365 | return ret; | ||
366 | |||
367 | codec->dapm.bias_level = level; | ||
368 | |||
369 | return 0; | ||
370 | } | 365 | } |
371 | 366 | ||
372 | static const struct snd_soc_dai_ops ssm4567_dai_ops = { | 367 | static const struct snd_soc_dai_ops ssm4567_dai_ops = { |
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index 007a0e3bc273..ffe6187dce85 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c | |||
@@ -819,7 +819,7 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec, | |||
819 | break; | 819 | break; |
820 | 820 | ||
821 | case SND_SOC_BIAS_STANDBY: | 821 | case SND_SOC_BIAS_STANDBY: |
822 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 822 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
823 | ret = regulator_bulk_enable(ARRAY_SIZE(sta32x->supplies), | 823 | ret = regulator_bulk_enable(ARRAY_SIZE(sta32x->supplies), |
824 | sta32x->supplies); | 824 | sta32x->supplies); |
825 | if (ret != 0) { | 825 | if (ret != 0) { |
@@ -854,7 +854,6 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec, | |||
854 | sta32x->supplies); | 854 | sta32x->supplies); |
855 | break; | 855 | break; |
856 | } | 856 | } |
857 | codec->dapm.bias_level = level; | ||
858 | return 0; | 857 | return 0; |
859 | } | 858 | } |
860 | 859 | ||
@@ -970,7 +969,7 @@ static int sta32x_probe(struct snd_soc_codec *codec) | |||
970 | if (sta32x->pdata->needs_esd_watchdog) | 969 | if (sta32x->pdata->needs_esd_watchdog) |
971 | INIT_DELAYED_WORK(&sta32x->watchdog_work, sta32x_watchdog); | 970 | INIT_DELAYED_WORK(&sta32x->watchdog_work, sta32x_watchdog); |
972 | 971 | ||
973 | sta32x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 972 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
974 | /* Bias level configuration will have done an extra enable */ | 973 | /* Bias level configuration will have done an extra enable */ |
975 | regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); | 974 | regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); |
976 | 975 | ||
diff --git a/sound/soc/codecs/sta350.c b/sound/soc/codecs/sta350.c index 669e3228241e..025f6639330e 100644 --- a/sound/soc/codecs/sta350.c +++ b/sound/soc/codecs/sta350.c | |||
@@ -853,7 +853,7 @@ static int sta350_set_bias_level(struct snd_soc_codec *codec, | |||
853 | break; | 853 | break; |
854 | 854 | ||
855 | case SND_SOC_BIAS_STANDBY: | 855 | case SND_SOC_BIAS_STANDBY: |
856 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 856 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
857 | ret = regulator_bulk_enable( | 857 | ret = regulator_bulk_enable( |
858 | ARRAY_SIZE(sta350->supplies), | 858 | ARRAY_SIZE(sta350->supplies), |
859 | sta350->supplies); | 859 | sta350->supplies); |
@@ -890,7 +890,6 @@ static int sta350_set_bias_level(struct snd_soc_codec *codec, | |||
890 | sta350->supplies); | 890 | sta350->supplies); |
891 | break; | 891 | break; |
892 | } | 892 | } |
893 | codec->dapm.bias_level = level; | ||
894 | return 0; | 893 | return 0; |
895 | } | 894 | } |
896 | 895 | ||
@@ -1037,7 +1036,7 @@ static int sta350_probe(struct snd_soc_codec *codec) | |||
1037 | sta350->coef_shadow[60] = 0x400000; | 1036 | sta350->coef_shadow[60] = 0x400000; |
1038 | sta350->coef_shadow[61] = 0x400000; | 1037 | sta350->coef_shadow[61] = 0x400000; |
1039 | 1038 | ||
1040 | sta350_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1039 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1041 | /* Bias level configuration will have done an extra enable */ | 1040 | /* Bias level configuration will have done an extra enable */ |
1042 | regulator_bulk_disable(ARRAY_SIZE(sta350->supplies), sta350->supplies); | 1041 | regulator_bulk_disable(ARRAY_SIZE(sta350->supplies), sta350->supplies); |
1043 | 1042 | ||
diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c index b0f436d10125..4f70378b2cfb 100644 --- a/sound/soc/codecs/sta529.c +++ b/sound/soc/codecs/sta529.c | |||
@@ -165,7 +165,7 @@ static int sta529_set_bias_level(struct snd_soc_codec *codec, enum | |||
165 | FFX_CLK_ENB); | 165 | FFX_CLK_ENB); |
166 | break; | 166 | break; |
167 | case SND_SOC_BIAS_STANDBY: | 167 | case SND_SOC_BIAS_STANDBY: |
168 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) | 168 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) |
169 | regcache_sync(sta529->regmap); | 169 | regcache_sync(sta529->regmap); |
170 | snd_soc_update_bits(codec, STA529_FFXCFG0, | 170 | snd_soc_update_bits(codec, STA529_FFXCFG0, |
171 | POWER_CNTLMSAK, POWER_STDBY); | 171 | POWER_CNTLMSAK, POWER_STDBY); |
@@ -179,12 +179,6 @@ static int sta529_set_bias_level(struct snd_soc_codec *codec, enum | |||
179 | break; | 179 | break; |
180 | } | 180 | } |
181 | 181 | ||
182 | /* | ||
183 | * store the label for powers down audio subsystem for suspend.This is | ||
184 | * used by soc core layer | ||
185 | */ | ||
186 | codec->dapm.bias_level = level; | ||
187 | |||
188 | return 0; | 182 | return 0; |
189 | 183 | ||
190 | } | 184 | } |
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c index 6464caf72b21..2341e8e6bfc1 100644 --- a/sound/soc/codecs/stac9766.c +++ b/sound/soc/codecs/stac9766.c | |||
@@ -236,7 +236,6 @@ static int stac9766_set_bias_level(struct snd_soc_codec *codec, | |||
236 | stac9766_ac97_write(codec, AC97_POWERDOWN, 0xffff); | 236 | stac9766_ac97_write(codec, AC97_POWERDOWN, 0xffff); |
237 | break; | 237 | break; |
238 | } | 238 | } |
239 | codec->dapm.bias_level = level; | ||
240 | return 0; | 239 | return 0; |
241 | } | 240 | } |
242 | 241 | ||
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c index cc17e7e5126e..cd8c02b6e4de 100644 --- a/sound/soc/codecs/tlv320aic23.c +++ b/sound/soc/codecs/tlv320aic23.c | |||
@@ -506,7 +506,6 @@ static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec, | |||
506 | snd_soc_write(codec, TLV320AIC23_PWR, 0x1ff); | 506 | snd_soc_write(codec, TLV320AIC23_PWR, 0x1ff); |
507 | break; | 507 | break; |
508 | } | 508 | } |
509 | codec->dapm.bias_level = level; | ||
510 | return 0; | 509 | return 0; |
511 | } | 510 | } |
512 | 511 | ||
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index c86dd9aae157..c4c960f592a1 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c | |||
@@ -646,7 +646,7 @@ static int aic31xx_add_controls(struct snd_soc_codec *codec) | |||
646 | 646 | ||
647 | static int aic31xx_add_widgets(struct snd_soc_codec *codec) | 647 | static int aic31xx_add_widgets(struct snd_soc_codec *codec) |
648 | { | 648 | { |
649 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 649 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
650 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); | 650 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); |
651 | int ret = 0; | 651 | int ret = 0; |
652 | 652 | ||
@@ -1027,17 +1027,17 @@ static int aic31xx_set_bias_level(struct snd_soc_codec *codec, | |||
1027 | enum snd_soc_bias_level level) | 1027 | enum snd_soc_bias_level level) |
1028 | { | 1028 | { |
1029 | dev_dbg(codec->dev, "## %s: %d -> %d\n", __func__, | 1029 | dev_dbg(codec->dev, "## %s: %d -> %d\n", __func__, |
1030 | codec->dapm.bias_level, level); | 1030 | snd_soc_codec_get_bias_level(codec), level); |
1031 | 1031 | ||
1032 | switch (level) { | 1032 | switch (level) { |
1033 | case SND_SOC_BIAS_ON: | 1033 | case SND_SOC_BIAS_ON: |
1034 | break; | 1034 | break; |
1035 | case SND_SOC_BIAS_PREPARE: | 1035 | case SND_SOC_BIAS_PREPARE: |
1036 | if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) | 1036 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) |
1037 | aic31xx_clk_on(codec); | 1037 | aic31xx_clk_on(codec); |
1038 | break; | 1038 | break; |
1039 | case SND_SOC_BIAS_STANDBY: | 1039 | case SND_SOC_BIAS_STANDBY: |
1040 | switch (codec->dapm.bias_level) { | 1040 | switch (snd_soc_codec_get_bias_level(codec)) { |
1041 | case SND_SOC_BIAS_OFF: | 1041 | case SND_SOC_BIAS_OFF: |
1042 | aic31xx_power_on(codec); | 1042 | aic31xx_power_on(codec); |
1043 | break; | 1043 | break; |
@@ -1049,11 +1049,10 @@ static int aic31xx_set_bias_level(struct snd_soc_codec *codec, | |||
1049 | } | 1049 | } |
1050 | break; | 1050 | break; |
1051 | case SND_SOC_BIAS_OFF: | 1051 | case SND_SOC_BIAS_OFF: |
1052 | if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) | 1052 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) |
1053 | aic31xx_power_off(codec); | 1053 | aic31xx_power_off(codec); |
1054 | break; | 1054 | break; |
1055 | } | 1055 | } |
1056 | codec->dapm.bias_level = level; | ||
1057 | 1056 | ||
1058 | return 0; | 1057 | return 0; |
1059 | } | 1058 | } |
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c index 015467ed606b..ad6cb90e5f9b 100644 --- a/sound/soc/codecs/tlv320aic32x4.c +++ b/sound/soc/codecs/tlv320aic32x4.c | |||
@@ -564,7 +564,6 @@ static int aic32x4_set_bias_level(struct snd_soc_codec *codec, | |||
564 | case SND_SOC_BIAS_OFF: | 564 | case SND_SOC_BIAS_OFF: |
565 | break; | 565 | break; |
566 | } | 566 | } |
567 | codec->dapm.bias_level = level; | ||
568 | return 0; | 567 | return 0; |
569 | } | 568 | } |
570 | 569 | ||
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index 51c4713ac6e3..a7cf19b53fb2 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -147,6 +147,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol, | |||
147 | struct snd_ctl_elem_value *ucontrol) | 147 | struct snd_ctl_elem_value *ucontrol) |
148 | { | 148 | { |
149 | struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); | 149 | struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); |
150 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
150 | struct soc_mixer_control *mc = | 151 | struct soc_mixer_control *mc = |
151 | (struct soc_mixer_control *)kcontrol->private_value; | 152 | (struct soc_mixer_control *)kcontrol->private_value; |
152 | unsigned int reg = mc->reg; | 153 | unsigned int reg = mc->reg; |
@@ -179,7 +180,7 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol, | |||
179 | update.mask = mask; | 180 | update.mask = mask; |
180 | update.val = val; | 181 | update.val = val; |
181 | 182 | ||
182 | snd_soc_dapm_mixer_update_power(&codec->dapm, kcontrol, connect, | 183 | snd_soc_dapm_mixer_update_power(dapm, kcontrol, connect, |
183 | &update); | 184 | &update); |
184 | } | 185 | } |
185 | 186 | ||
@@ -979,7 +980,7 @@ static const struct snd_soc_dapm_route intercon_3007[] = { | |||
979 | static int aic3x_add_widgets(struct snd_soc_codec *codec) | 980 | static int aic3x_add_widgets(struct snd_soc_codec *codec) |
980 | { | 981 | { |
981 | struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); | 982 | struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); |
982 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 983 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
983 | 984 | ||
984 | switch (aic3x->model) { | 985 | switch (aic3x->model) { |
985 | case AIC3X_MODEL_3X: | 986 | case AIC3X_MODEL_3X: |
@@ -1384,7 +1385,7 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec, | |||
1384 | case SND_SOC_BIAS_ON: | 1385 | case SND_SOC_BIAS_ON: |
1385 | break; | 1386 | break; |
1386 | case SND_SOC_BIAS_PREPARE: | 1387 | case SND_SOC_BIAS_PREPARE: |
1387 | if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY && | 1388 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY && |
1388 | aic3x->master) { | 1389 | aic3x->master) { |
1389 | /* enable pll */ | 1390 | /* enable pll */ |
1390 | snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, | 1391 | snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, |
@@ -1394,7 +1395,7 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec, | |||
1394 | case SND_SOC_BIAS_STANDBY: | 1395 | case SND_SOC_BIAS_STANDBY: |
1395 | if (!aic3x->power) | 1396 | if (!aic3x->power) |
1396 | aic3x_set_power(codec, 1); | 1397 | aic3x_set_power(codec, 1); |
1397 | if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE && | 1398 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE && |
1398 | aic3x->master) { | 1399 | aic3x->master) { |
1399 | /* disable pll */ | 1400 | /* disable pll */ |
1400 | snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, | 1401 | snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, |
@@ -1406,7 +1407,6 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec, | |||
1406 | aic3x_set_power(codec, 0); | 1407 | aic3x_set_power(codec, 0); |
1407 | break; | 1408 | break; |
1408 | } | 1409 | } |
1409 | codec->dapm.bias_level = level; | ||
1410 | 1410 | ||
1411 | return 0; | 1411 | return 0; |
1412 | } | 1412 | } |
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index 4e3e607dec13..d67a311f0e75 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c | |||
@@ -633,7 +633,7 @@ static int dac33_set_bias_level(struct snd_soc_codec *codec, | |||
633 | case SND_SOC_BIAS_PREPARE: | 633 | case SND_SOC_BIAS_PREPARE: |
634 | break; | 634 | break; |
635 | case SND_SOC_BIAS_STANDBY: | 635 | case SND_SOC_BIAS_STANDBY: |
636 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 636 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
637 | /* Coming from OFF, switch on the codec */ | 637 | /* Coming from OFF, switch on the codec */ |
638 | ret = dac33_hard_power(codec, 1); | 638 | ret = dac33_hard_power(codec, 1); |
639 | if (ret != 0) | 639 | if (ret != 0) |
@@ -644,14 +644,13 @@ static int dac33_set_bias_level(struct snd_soc_codec *codec, | |||
644 | break; | 644 | break; |
645 | case SND_SOC_BIAS_OFF: | 645 | case SND_SOC_BIAS_OFF: |
646 | /* Do not power off, when the codec is already off */ | 646 | /* Do not power off, when the codec is already off */ |
647 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) | 647 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) |
648 | return 0; | 648 | return 0; |
649 | ret = dac33_hard_power(codec, 0); | 649 | ret = dac33_hard_power(codec, 0); |
650 | if (ret != 0) | 650 | if (ret != 0) |
651 | return ret; | 651 | return ret; |
652 | break; | 652 | break; |
653 | } | 653 | } |
654 | codec->dapm.bias_level = level; | ||
655 | 654 | ||
656 | return 0; | 655 | return 0; |
657 | } | 656 | } |
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index d04693e9cf9f..90f5f04eca2d 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -1588,14 +1588,13 @@ static int twl4030_set_bias_level(struct snd_soc_codec *codec, | |||
1588 | case SND_SOC_BIAS_PREPARE: | 1588 | case SND_SOC_BIAS_PREPARE: |
1589 | break; | 1589 | break; |
1590 | case SND_SOC_BIAS_STANDBY: | 1590 | case SND_SOC_BIAS_STANDBY: |
1591 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) | 1591 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) |
1592 | twl4030_codec_enable(codec, 1); | 1592 | twl4030_codec_enable(codec, 1); |
1593 | break; | 1593 | break; |
1594 | case SND_SOC_BIAS_OFF: | 1594 | case SND_SOC_BIAS_OFF: |
1595 | twl4030_codec_enable(codec, 0); | 1595 | twl4030_codec_enable(codec, 0); |
1596 | break; | 1596 | break; |
1597 | } | 1597 | } |
1598 | codec->dapm.bias_level = level; | ||
1599 | 1598 | ||
1600 | return 0; | 1599 | return 0; |
1601 | } | 1600 | } |
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index aeec27b6f1af..9db7408f6e05 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c | |||
@@ -533,7 +533,7 @@ static int twl6040_pll_put_enum(struct snd_kcontrol *kcontrol, | |||
533 | 533 | ||
534 | int twl6040_get_dl1_gain(struct snd_soc_codec *codec) | 534 | int twl6040_get_dl1_gain(struct snd_soc_codec *codec) |
535 | { | 535 | { |
536 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 536 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
537 | 537 | ||
538 | if (snd_soc_dapm_get_pin_status(dapm, "EP")) | 538 | if (snd_soc_dapm_get_pin_status(dapm, "EP")) |
539 | return -1; /* -1dB */ | 539 | return -1; /* -1dB */ |
@@ -853,8 +853,6 @@ static int twl6040_set_bias_level(struct snd_soc_codec *codec, | |||
853 | break; | 853 | break; |
854 | } | 854 | } |
855 | 855 | ||
856 | codec->dapm.bias_level = level; | ||
857 | |||
858 | return 0; | 856 | return 0; |
859 | } | 857 | } |
860 | 858 | ||
@@ -1130,7 +1128,7 @@ static int twl6040_probe(struct snd_soc_codec *codec) | |||
1130 | return ret; | 1128 | return ret; |
1131 | } | 1129 | } |
1132 | 1130 | ||
1133 | twl6040_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1131 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1134 | twl6040_init_chip(codec); | 1132 | twl6040_init_chip(codec); |
1135 | 1133 | ||
1136 | return 0; | 1134 | return 0; |
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index f883308c00de..913edf283239 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c | |||
@@ -350,7 +350,6 @@ static int uda134x_set_bias_level(struct snd_soc_codec *codec, | |||
350 | pd->power(0); | 350 | pd->power(0); |
351 | break; | 351 | break; |
352 | } | 352 | } |
353 | codec->dapm.bias_level = level; | ||
354 | return 0; | 353 | return 0; |
355 | } | 354 | } |
356 | 355 | ||
@@ -478,6 +477,7 @@ static struct snd_soc_dai_driver uda134x_dai = { | |||
478 | 477 | ||
479 | static int uda134x_soc_probe(struct snd_soc_codec *codec) | 478 | static int uda134x_soc_probe(struct snd_soc_codec *codec) |
480 | { | 479 | { |
480 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
481 | struct uda134x_priv *uda134x; | 481 | struct uda134x_priv *uda134x; |
482 | struct uda134x_platform_data *pd = codec->component.card->dev->platform_data; | 482 | struct uda134x_platform_data *pd = codec->component.card->dev->platform_data; |
483 | const struct snd_soc_dapm_widget *widgets; | 483 | const struct snd_soc_dapm_widget *widgets; |
@@ -526,7 +526,7 @@ static int uda134x_soc_probe(struct snd_soc_codec *codec) | |||
526 | num_widgets = ARRAY_SIZE(uda1340_dapm_widgets); | 526 | num_widgets = ARRAY_SIZE(uda1340_dapm_widgets); |
527 | } | 527 | } |
528 | 528 | ||
529 | ret = snd_soc_dapm_new_controls(&codec->dapm, widgets, num_widgets); | 529 | ret = snd_soc_dapm_new_controls(dapm, widgets, num_widgets); |
530 | if (ret) { | 530 | if (ret) { |
531 | printk(KERN_ERR "%s failed to register dapm controls: %d", | 531 | printk(KERN_ERR "%s failed to register dapm controls: %d", |
532 | __func__, ret); | 532 | __func__, ret); |
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index dc7778b6dd7f..d708a9c43259 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c | |||
@@ -590,9 +590,6 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec, | |||
590 | int reg; | 590 | int reg; |
591 | struct uda1380_platform_data *pdata = codec->dev->platform_data; | 591 | struct uda1380_platform_data *pdata = codec->dev->platform_data; |
592 | 592 | ||
593 | if (codec->dapm.bias_level == level) | ||
594 | return 0; | ||
595 | |||
596 | switch (level) { | 593 | switch (level) { |
597 | case SND_SOC_BIAS_ON: | 594 | case SND_SOC_BIAS_ON: |
598 | case SND_SOC_BIAS_PREPARE: | 595 | case SND_SOC_BIAS_PREPARE: |
@@ -600,7 +597,7 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec, | |||
600 | uda1380_write(codec, UDA1380_PM, R02_PON_BIAS | pm); | 597 | uda1380_write(codec, UDA1380_PM, R02_PON_BIAS | pm); |
601 | break; | 598 | break; |
602 | case SND_SOC_BIAS_STANDBY: | 599 | case SND_SOC_BIAS_STANDBY: |
603 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 600 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
604 | if (gpio_is_valid(pdata->gpio_power)) { | 601 | if (gpio_is_valid(pdata->gpio_power)) { |
605 | gpio_set_value(pdata->gpio_power, 1); | 602 | gpio_set_value(pdata->gpio_power, 1); |
606 | mdelay(1); | 603 | mdelay(1); |
@@ -623,7 +620,6 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec, | |||
623 | for (reg = UDA1380_MVOL; reg < UDA1380_CACHEREGNUM; reg++) | 620 | for (reg = UDA1380_MVOL; reg < UDA1380_CACHEREGNUM; reg++) |
624 | set_bit(reg - 0x10, &uda1380_cache_dirty); | 621 | set_bit(reg - 0x10, &uda1380_cache_dirty); |
625 | } | 622 | } |
626 | codec->dapm.bias_level = level; | ||
627 | return 0; | 623 | return 0; |
628 | } | 624 | } |
629 | 625 | ||
diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c index f37989ec7cba..6560a66b3f35 100644 --- a/sound/soc/codecs/wm0010.c +++ b/sound/soc/codecs/wm0010.c | |||
@@ -751,13 +751,13 @@ static int wm0010_set_bias_level(struct snd_soc_codec *codec, | |||
751 | 751 | ||
752 | switch (level) { | 752 | switch (level) { |
753 | case SND_SOC_BIAS_ON: | 753 | case SND_SOC_BIAS_ON: |
754 | if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE) | 754 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE) |
755 | wm0010_boot(codec); | 755 | wm0010_boot(codec); |
756 | break; | 756 | break; |
757 | case SND_SOC_BIAS_PREPARE: | 757 | case SND_SOC_BIAS_PREPARE: |
758 | break; | 758 | break; |
759 | case SND_SOC_BIAS_STANDBY: | 759 | case SND_SOC_BIAS_STANDBY: |
760 | if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE) { | 760 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE) { |
761 | mutex_lock(&wm0010->lock); | 761 | mutex_lock(&wm0010->lock); |
762 | wm0010_halt(codec); | 762 | wm0010_halt(codec); |
763 | mutex_unlock(&wm0010->lock); | 763 | mutex_unlock(&wm0010->lock); |
@@ -767,8 +767,6 @@ static int wm0010_set_bias_level(struct snd_soc_codec *codec, | |||
767 | break; | 767 | break; |
768 | } | 768 | } |
769 | 769 | ||
770 | codec->dapm.bias_level = level; | ||
771 | |||
772 | return 0; | 770 | return 0; |
773 | } | 771 | } |
774 | 772 | ||
diff --git a/sound/soc/codecs/wm1250-ev1.c b/sound/soc/codecs/wm1250-ev1.c index 8011f75fb6cb..048f00568260 100644 --- a/sound/soc/codecs/wm1250-ev1.c +++ b/sound/soc/codecs/wm1250-ev1.c | |||
@@ -61,8 +61,6 @@ static int wm1250_ev1_set_bias_level(struct snd_soc_codec *codec, | |||
61 | break; | 61 | break; |
62 | } | 62 | } |
63 | 63 | ||
64 | codec->dapm.bias_level = level; | ||
65 | |||
66 | return 0; | 64 | return 0; |
67 | } | 65 | } |
68 | 66 | ||
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index 96740379b711..98495dd61239 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c | |||
@@ -2101,7 +2101,7 @@ static void wm5100_micd_irq(struct wm5100_priv *wm5100) | |||
2101 | int wm5100_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) | 2101 | int wm5100_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) |
2102 | { | 2102 | { |
2103 | struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); | 2103 | struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); |
2104 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 2104 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
2105 | 2105 | ||
2106 | if (jack) { | 2106 | if (jack) { |
2107 | wm5100->jack = jack; | 2107 | wm5100->jack = jack; |
@@ -2336,6 +2336,7 @@ static void wm5100_free_gpio(struct i2c_client *i2c) | |||
2336 | 2336 | ||
2337 | static int wm5100_probe(struct snd_soc_codec *codec) | 2337 | static int wm5100_probe(struct snd_soc_codec *codec) |
2338 | { | 2338 | { |
2339 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
2339 | struct i2c_client *i2c = to_i2c_client(codec->dev); | 2340 | struct i2c_client *i2c = to_i2c_client(codec->dev); |
2340 | struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); | 2341 | struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); |
2341 | int ret, i; | 2342 | int ret, i; |
@@ -2353,8 +2354,7 @@ static int wm5100_probe(struct snd_soc_codec *codec) | |||
2353 | /* TODO: check if we're symmetric */ | 2354 | /* TODO: check if we're symmetric */ |
2354 | 2355 | ||
2355 | if (i2c->irq) | 2356 | if (i2c->irq) |
2356 | snd_soc_dapm_new_controls(&codec->dapm, | 2357 | snd_soc_dapm_new_controls(dapm, wm5100_dapm_widgets_noirq, |
2357 | wm5100_dapm_widgets_noirq, | ||
2358 | ARRAY_SIZE(wm5100_dapm_widgets_noirq)); | 2358 | ARRAY_SIZE(wm5100_dapm_widgets_noirq)); |
2359 | 2359 | ||
2360 | if (wm5100->pdata.hp_pol) { | 2360 | if (wm5100->pdata.hp_pol) { |
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index 872c2ad88fb7..2f9c88f9fc8f 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c | |||
@@ -1872,6 +1872,7 @@ static struct snd_soc_dai_driver wm5102_dai[] = { | |||
1872 | 1872 | ||
1873 | static int wm5102_codec_probe(struct snd_soc_codec *codec) | 1873 | static int wm5102_codec_probe(struct snd_soc_codec *codec) |
1874 | { | 1874 | { |
1875 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
1875 | struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); | 1876 | struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); |
1876 | int ret; | 1877 | int ret; |
1877 | 1878 | ||
@@ -1882,9 +1883,9 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec) | |||
1882 | arizona_init_spk(codec); | 1883 | arizona_init_spk(codec); |
1883 | arizona_init_gpio(codec); | 1884 | arizona_init_gpio(codec); |
1884 | 1885 | ||
1885 | snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS"); | 1886 | snd_soc_dapm_disable_pin(dapm, "HAPTICS"); |
1886 | 1887 | ||
1887 | priv->core.arizona->dapm = &codec->dapm; | 1888 | priv->core.arizona->dapm = dapm; |
1888 | 1889 | ||
1889 | return 0; | 1890 | return 0; |
1890 | } | 1891 | } |
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index ce7de949a506..226596723418 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c | |||
@@ -1598,10 +1598,11 @@ static struct snd_soc_dai_driver wm5110_dai[] = { | |||
1598 | 1598 | ||
1599 | static int wm5110_codec_probe(struct snd_soc_codec *codec) | 1599 | static int wm5110_codec_probe(struct snd_soc_codec *codec) |
1600 | { | 1600 | { |
1601 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
1601 | struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); | 1602 | struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); |
1602 | int i, ret; | 1603 | int i, ret; |
1603 | 1604 | ||
1604 | priv->core.arizona->dapm = &codec->dapm; | 1605 | priv->core.arizona->dapm = dapm; |
1605 | 1606 | ||
1606 | arizona_init_spk(codec); | 1607 | arizona_init_spk(codec); |
1607 | arizona_init_gpio(codec); | 1608 | arizona_init_gpio(codec); |
@@ -1613,9 +1614,7 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec) | |||
1613 | return ret; | 1614 | return ret; |
1614 | } | 1615 | } |
1615 | 1616 | ||
1616 | snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS"); | 1617 | snd_soc_dapm_disable_pin(dapm, "HAPTICS"); |
1617 | |||
1618 | priv->core.arizona->dapm = &codec->dapm; | ||
1619 | 1618 | ||
1620 | return 0; | 1619 | return 0; |
1621 | } | 1620 | } |
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index c65e5a75fc1a..41c62c1e62db 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
@@ -1102,7 +1102,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec, | |||
1102 | break; | 1102 | break; |
1103 | 1103 | ||
1104 | case SND_SOC_BIAS_STANDBY: | 1104 | case SND_SOC_BIAS_STANDBY: |
1105 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1105 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1106 | ret = regulator_bulk_enable(ARRAY_SIZE(priv->supplies), | 1106 | ret = regulator_bulk_enable(ARRAY_SIZE(priv->supplies), |
1107 | priv->supplies); | 1107 | priv->supplies); |
1108 | if (ret != 0) | 1108 | if (ret != 0) |
@@ -1235,7 +1235,6 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec, | |||
1235 | priv->supplies); | 1235 | priv->supplies); |
1236 | break; | 1236 | break; |
1237 | } | 1237 | } |
1238 | codec->dapm.bias_level = level; | ||
1239 | return 0; | 1238 | return 0; |
1240 | } | 1239 | } |
1241 | 1240 | ||
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index b0d84e552fca..d7555085e7f4 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c | |||
@@ -1145,7 +1145,7 @@ static int wm8400_set_bias_level(struct snd_soc_codec *codec, | |||
1145 | break; | 1145 | break; |
1146 | 1146 | ||
1147 | case SND_SOC_BIAS_STANDBY: | 1147 | case SND_SOC_BIAS_STANDBY: |
1148 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1148 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1149 | ret = regulator_bulk_enable(ARRAY_SIZE(power), | 1149 | ret = regulator_bulk_enable(ARRAY_SIZE(power), |
1150 | &power[0]); | 1150 | &power[0]); |
1151 | if (ret != 0) { | 1151 | if (ret != 0) { |
@@ -1232,7 +1232,6 @@ static int wm8400_set_bias_level(struct snd_soc_codec *codec, | |||
1232 | break; | 1232 | break; |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | codec->dapm.bias_level = level; | ||
1236 | return 0; | 1235 | return 0; |
1237 | } | 1236 | } |
1238 | 1237 | ||
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c index 8736ad094b24..dac5beb4d023 100644 --- a/sound/soc/codecs/wm8510.c +++ b/sound/soc/codecs/wm8510.c | |||
@@ -519,7 +519,7 @@ static int wm8510_set_bias_level(struct snd_soc_codec *codec, | |||
519 | case SND_SOC_BIAS_STANDBY: | 519 | case SND_SOC_BIAS_STANDBY: |
520 | power1 |= WM8510_POWER1_BIASEN | WM8510_POWER1_BUFIOEN; | 520 | power1 |= WM8510_POWER1_BIASEN | WM8510_POWER1_BUFIOEN; |
521 | 521 | ||
522 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 522 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
523 | regcache_sync(wm8510->regmap); | 523 | regcache_sync(wm8510->regmap); |
524 | 524 | ||
525 | /* Initial cap charge at VMID 5k */ | 525 | /* Initial cap charge at VMID 5k */ |
@@ -538,7 +538,6 @@ static int wm8510_set_bias_level(struct snd_soc_codec *codec, | |||
538 | break; | 538 | break; |
539 | } | 539 | } |
540 | 540 | ||
541 | codec->dapm.bias_level = level; | ||
542 | return 0; | 541 | return 0; |
543 | } | 542 | } |
544 | 543 | ||
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c index b1cc94f5fc4b..8c5b9df3e542 100644 --- a/sound/soc/codecs/wm8523.c +++ b/sound/soc/codecs/wm8523.c | |||
@@ -308,7 +308,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec, | |||
308 | break; | 308 | break; |
309 | 309 | ||
310 | case SND_SOC_BIAS_STANDBY: | 310 | case SND_SOC_BIAS_STANDBY: |
311 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 311 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
312 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8523->supplies), | 312 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8523->supplies), |
313 | wm8523->supplies); | 313 | wm8523->supplies); |
314 | if (ret != 0) { | 314 | if (ret != 0) { |
@@ -344,7 +344,6 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec, | |||
344 | wm8523->supplies); | 344 | wm8523->supplies); |
345 | break; | 345 | break; |
346 | } | 346 | } |
347 | codec->dapm.bias_level = level; | ||
348 | return 0; | 347 | return 0; |
349 | } | 348 | } |
350 | 349 | ||
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c index 0a887c5ec83a..759a7928ac3e 100644 --- a/sound/soc/codecs/wm8580.c +++ b/sound/soc/codecs/wm8580.c | |||
@@ -795,7 +795,7 @@ static int wm8580_set_bias_level(struct snd_soc_codec *codec, | |||
795 | break; | 795 | break; |
796 | 796 | ||
797 | case SND_SOC_BIAS_STANDBY: | 797 | case SND_SOC_BIAS_STANDBY: |
798 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 798 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
799 | /* Power up and get individual control of the DACs */ | 799 | /* Power up and get individual control of the DACs */ |
800 | snd_soc_update_bits(codec, WM8580_PWRDN1, | 800 | snd_soc_update_bits(codec, WM8580_PWRDN1, |
801 | WM8580_PWRDN1_PWDN | | 801 | WM8580_PWRDN1_PWDN | |
@@ -812,7 +812,6 @@ static int wm8580_set_bias_level(struct snd_soc_codec *codec, | |||
812 | WM8580_PWRDN1_PWDN, WM8580_PWRDN1_PWDN); | 812 | WM8580_PWRDN1_PWDN, WM8580_PWRDN1_PWDN); |
813 | break; | 813 | break; |
814 | } | 814 | } |
815 | codec->dapm.bias_level = level; | ||
816 | return 0; | 815 | return 0; |
817 | } | 816 | } |
818 | 817 | ||
diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c index 121e46d53779..cc8251f09f8a 100644 --- a/sound/soc/codecs/wm8711.c +++ b/sound/soc/codecs/wm8711.c | |||
@@ -310,7 +310,7 @@ static int wm8711_set_bias_level(struct snd_soc_codec *codec, | |||
310 | case SND_SOC_BIAS_PREPARE: | 310 | case SND_SOC_BIAS_PREPARE: |
311 | break; | 311 | break; |
312 | case SND_SOC_BIAS_STANDBY: | 312 | case SND_SOC_BIAS_STANDBY: |
313 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) | 313 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) |
314 | regcache_sync(wm8711->regmap); | 314 | regcache_sync(wm8711->regmap); |
315 | 315 | ||
316 | snd_soc_write(codec, WM8711_PWR, reg | 0x0040); | 316 | snd_soc_write(codec, WM8711_PWR, reg | 0x0040); |
@@ -320,7 +320,6 @@ static int wm8711_set_bias_level(struct snd_soc_codec *codec, | |||
320 | snd_soc_write(codec, WM8711_PWR, 0xffff); | 320 | snd_soc_write(codec, WM8711_PWR, 0xffff); |
321 | break; | 321 | break; |
322 | } | 322 | } |
323 | codec->dapm.bias_level = level; | ||
324 | return 0; | 323 | return 0; |
325 | } | 324 | } |
326 | 325 | ||
diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c index 55c7fb4fc786..f1a173e6ec33 100644 --- a/sound/soc/codecs/wm8728.c +++ b/sound/soc/codecs/wm8728.c | |||
@@ -170,7 +170,7 @@ static int wm8728_set_bias_level(struct snd_soc_codec *codec, | |||
170 | case SND_SOC_BIAS_ON: | 170 | case SND_SOC_BIAS_ON: |
171 | case SND_SOC_BIAS_PREPARE: | 171 | case SND_SOC_BIAS_PREPARE: |
172 | case SND_SOC_BIAS_STANDBY: | 172 | case SND_SOC_BIAS_STANDBY: |
173 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 173 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
174 | /* Power everything up... */ | 174 | /* Power everything up... */ |
175 | reg = snd_soc_read(codec, WM8728_DACCTL); | 175 | reg = snd_soc_read(codec, WM8728_DACCTL); |
176 | snd_soc_write(codec, WM8728_DACCTL, reg & ~0x4); | 176 | snd_soc_write(codec, WM8728_DACCTL, reg & ~0x4); |
@@ -185,7 +185,6 @@ static int wm8728_set_bias_level(struct snd_soc_codec *codec, | |||
185 | snd_soc_write(codec, WM8728_DACCTL, reg | 0x4); | 185 | snd_soc_write(codec, WM8728_DACCTL, reg | 0x4); |
186 | break; | 186 | break; |
187 | } | 187 | } |
188 | codec->dapm.bias_level = level; | ||
189 | return 0; | 188 | return 0; |
190 | } | 189 | } |
191 | 190 | ||
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 2245b6a32f3d..915ea11ad4b6 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
@@ -387,6 +387,7 @@ static int wm8731_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
387 | int clk_id, unsigned int freq, int dir) | 387 | int clk_id, unsigned int freq, int dir) |
388 | { | 388 | { |
389 | struct snd_soc_codec *codec = codec_dai->codec; | 389 | struct snd_soc_codec *codec = codec_dai->codec; |
390 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
390 | struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); | 391 | struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); |
391 | 392 | ||
392 | switch (clk_id) { | 393 | switch (clk_id) { |
@@ -421,7 +422,7 @@ static int wm8731_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
421 | 422 | ||
422 | wm8731->sysclk = freq; | 423 | wm8731->sysclk = freq; |
423 | 424 | ||
424 | snd_soc_dapm_sync(&codec->dapm); | 425 | snd_soc_dapm_sync(dapm); |
425 | 426 | ||
426 | return 0; | 427 | return 0; |
427 | } | 428 | } |
@@ -501,7 +502,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec, | |||
501 | case SND_SOC_BIAS_PREPARE: | 502 | case SND_SOC_BIAS_PREPARE: |
502 | break; | 503 | break; |
503 | case SND_SOC_BIAS_STANDBY: | 504 | case SND_SOC_BIAS_STANDBY: |
504 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 505 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
505 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies), | 506 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies), |
506 | wm8731->supplies); | 507 | wm8731->supplies); |
507 | if (ret != 0) | 508 | if (ret != 0) |
@@ -523,7 +524,6 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec, | |||
523 | regcache_mark_dirty(wm8731->regmap); | 524 | regcache_mark_dirty(wm8731->regmap); |
524 | break; | 525 | break; |
525 | } | 526 | } |
526 | codec->dapm.bias_level = level; | ||
527 | return 0; | 527 | return 0; |
528 | } | 528 | } |
529 | 529 | ||
@@ -599,7 +599,7 @@ static int wm8731_probe(struct snd_soc_codec *codec) | |||
599 | goto err_regulator_enable; | 599 | goto err_regulator_enable; |
600 | } | 600 | } |
601 | 601 | ||
602 | wm8731_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 602 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
603 | 603 | ||
604 | /* Latch the update bits */ | 604 | /* Latch the update bits */ |
605 | snd_soc_update_bits(codec, WM8731_LOUT1V, 0x100, 0); | 605 | snd_soc_update_bits(codec, WM8731_LOUT1V, 0x100, 0); |
diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c index ada9ac1ba2c6..ff4c8e979e01 100644 --- a/sound/soc/codecs/wm8737.c +++ b/sound/soc/codecs/wm8737.c | |||
@@ -469,7 +469,7 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec, | |||
469 | break; | 469 | break; |
470 | 470 | ||
471 | case SND_SOC_BIAS_STANDBY: | 471 | case SND_SOC_BIAS_STANDBY: |
472 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 472 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
473 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8737->supplies), | 473 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8737->supplies), |
474 | wm8737->supplies); | 474 | wm8737->supplies); |
475 | if (ret != 0) { | 475 | if (ret != 0) { |
@@ -510,7 +510,6 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec, | |||
510 | break; | 510 | break; |
511 | } | 511 | } |
512 | 512 | ||
513 | codec->dapm.bias_level = level; | ||
514 | return 0; | 513 | return 0; |
515 | } | 514 | } |
516 | 515 | ||
@@ -560,7 +559,7 @@ static int wm8737_probe(struct snd_soc_codec *codec) | |||
560 | snd_soc_update_bits(codec, WM8737_RIGHT_PGA_VOLUME, WM8737_RVU, | 559 | snd_soc_update_bits(codec, WM8737_RIGHT_PGA_VOLUME, WM8737_RVU, |
561 | WM8737_RVU); | 560 | WM8737_RVU); |
562 | 561 | ||
563 | wm8737_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 562 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
564 | 563 | ||
565 | /* Bias level configuration will have done an extra enable */ | 564 | /* Bias level configuration will have done an extra enable */ |
566 | regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); | 565 | regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); |
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index eb0a1644ba11..56d89b0865fa 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c | |||
@@ -634,7 +634,7 @@ static int wm8750_set_bias_level(struct snd_soc_codec *codec, | |||
634 | case SND_SOC_BIAS_PREPARE: | 634 | case SND_SOC_BIAS_PREPARE: |
635 | break; | 635 | break; |
636 | case SND_SOC_BIAS_STANDBY: | 636 | case SND_SOC_BIAS_STANDBY: |
637 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 637 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
638 | snd_soc_cache_sync(codec); | 638 | snd_soc_cache_sync(codec); |
639 | 639 | ||
640 | /* Set VMID to 5k */ | 640 | /* Set VMID to 5k */ |
@@ -651,7 +651,6 @@ static int wm8750_set_bias_level(struct snd_soc_codec *codec, | |||
651 | snd_soc_write(codec, WM8750_PWR1, 0x0001); | 651 | snd_soc_write(codec, WM8750_PWR1, 0x0001); |
652 | break; | 652 | break; |
653 | } | 653 | } |
654 | codec->dapm.bias_level = level; | ||
655 | return 0; | 654 | return 0; |
656 | } | 655 | } |
657 | 656 | ||
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index c50a5959345f..feb2997a377a 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -1352,7 +1352,7 @@ static int wm8753_set_bias_level(struct snd_soc_codec *codec, | |||
1352 | flush_delayed_work(&wm8753->charge_work); | 1352 | flush_delayed_work(&wm8753->charge_work); |
1353 | break; | 1353 | break; |
1354 | case SND_SOC_BIAS_STANDBY: | 1354 | case SND_SOC_BIAS_STANDBY: |
1355 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1355 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1356 | /* set vmid to 5k for quick power up */ | 1356 | /* set vmid to 5k for quick power up */ |
1357 | snd_soc_write(codec, WM8753_PWR1, pwr_reg | 0x01c1); | 1357 | snd_soc_write(codec, WM8753_PWR1, pwr_reg | 0x01c1); |
1358 | schedule_delayed_work(&wm8753->charge_work, | 1358 | schedule_delayed_work(&wm8753->charge_work, |
@@ -1367,7 +1367,6 @@ static int wm8753_set_bias_level(struct snd_soc_codec *codec, | |||
1367 | snd_soc_write(codec, WM8753_PWR1, 0x0001); | 1367 | snd_soc_write(codec, WM8753_PWR1, 0x0001); |
1368 | break; | 1368 | break; |
1369 | } | 1369 | } |
1370 | codec->dapm.bias_level = level; | ||
1371 | return 0; | 1370 | return 0; |
1372 | } | 1371 | } |
1373 | 1372 | ||
diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index 53e977da2f86..66c1f151071d 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c | |||
@@ -510,7 +510,7 @@ static int wm8770_set_bias_level(struct snd_soc_codec *codec, | |||
510 | case SND_SOC_BIAS_PREPARE: | 510 | case SND_SOC_BIAS_PREPARE: |
511 | break; | 511 | break; |
512 | case SND_SOC_BIAS_STANDBY: | 512 | case SND_SOC_BIAS_STANDBY: |
513 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 513 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
514 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8770->supplies), | 514 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8770->supplies), |
515 | wm8770->supplies); | 515 | wm8770->supplies); |
516 | if (ret) { | 516 | if (ret) { |
@@ -534,7 +534,6 @@ static int wm8770_set_bias_level(struct snd_soc_codec *codec, | |||
534 | break; | 534 | break; |
535 | } | 535 | } |
536 | 536 | ||
537 | codec->dapm.bias_level = level; | ||
538 | return 0; | 537 | return 0; |
539 | } | 538 | } |
540 | 539 | ||
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c index c13050b77931..ece9b4456767 100644 --- a/sound/soc/codecs/wm8776.c +++ b/sound/soc/codecs/wm8776.c | |||
@@ -344,7 +344,7 @@ static int wm8776_set_bias_level(struct snd_soc_codec *codec, | |||
344 | case SND_SOC_BIAS_PREPARE: | 344 | case SND_SOC_BIAS_PREPARE: |
345 | break; | 345 | break; |
346 | case SND_SOC_BIAS_STANDBY: | 346 | case SND_SOC_BIAS_STANDBY: |
347 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 347 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
348 | regcache_sync(wm8776->regmap); | 348 | regcache_sync(wm8776->regmap); |
349 | 349 | ||
350 | /* Disable the global powerdown; DAPM does the rest */ | 350 | /* Disable the global powerdown; DAPM does the rest */ |
@@ -357,7 +357,6 @@ static int wm8776_set_bias_level(struct snd_soc_codec *codec, | |||
357 | break; | 357 | break; |
358 | } | 358 | } |
359 | 359 | ||
360 | codec->dapm.bias_level = level; | ||
361 | return 0; | 360 | return 0; |
362 | } | 361 | } |
363 | 362 | ||
diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c index 1e403f67cf16..c195c2e8af07 100644 --- a/sound/soc/codecs/wm8804.c +++ b/sound/soc/codecs/wm8804.c | |||
@@ -162,7 +162,7 @@ static int txsrc_put(struct snd_kcontrol *kcontrol, | |||
162 | struct snd_ctl_elem_value *ucontrol) | 162 | struct snd_ctl_elem_value *ucontrol) |
163 | { | 163 | { |
164 | struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); | 164 | struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); |
165 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 165 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
166 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 166 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
167 | unsigned int val = ucontrol->value.enumerated.item[0] << e->shift_l; | 167 | unsigned int val = ucontrol->value.enumerated.item[0] << e->shift_l; |
168 | unsigned int mask = 1 << e->shift_l; | 168 | unsigned int mask = 1 << e->shift_l; |
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index 2eb986c19b88..ecc7b4703617 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c | |||
@@ -1049,7 +1049,7 @@ static int wm8900_set_bias_level(struct snd_soc_codec *codec, | |||
1049 | 1049 | ||
1050 | case SND_SOC_BIAS_STANDBY: | 1050 | case SND_SOC_BIAS_STANDBY: |
1051 | /* Charge capacitors if initial power up */ | 1051 | /* Charge capacitors if initial power up */ |
1052 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1052 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1053 | /* STARTUP_BIAS_ENA on */ | 1053 | /* STARTUP_BIAS_ENA on */ |
1054 | snd_soc_write(codec, WM8900_REG_POWER1, | 1054 | snd_soc_write(codec, WM8900_REG_POWER1, |
1055 | WM8900_REG_POWER1_STARTUP_BIAS_ENA); | 1055 | WM8900_REG_POWER1_STARTUP_BIAS_ENA); |
@@ -1117,7 +1117,6 @@ static int wm8900_set_bias_level(struct snd_soc_codec *codec, | |||
1117 | WM8900_REG_POWER2_SYSCLK_ENA); | 1117 | WM8900_REG_POWER2_SYSCLK_ENA); |
1118 | break; | 1118 | break; |
1119 | } | 1119 | } |
1120 | codec->dapm.bias_level = level; | ||
1121 | return 0; | 1120 | return 0; |
1122 | } | 1121 | } |
1123 | 1122 | ||
@@ -1138,7 +1137,7 @@ static int wm8900_suspend(struct snd_soc_codec *codec) | |||
1138 | wm8900->fll_out = fll_out; | 1137 | wm8900->fll_out = fll_out; |
1139 | wm8900->fll_in = fll_in; | 1138 | wm8900->fll_in = fll_in; |
1140 | 1139 | ||
1141 | wm8900_set_bias_level(codec, SND_SOC_BIAS_OFF); | 1140 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); |
1142 | 1141 | ||
1143 | return 0; | 1142 | return 0; |
1144 | } | 1143 | } |
@@ -1156,7 +1155,7 @@ static int wm8900_resume(struct snd_soc_codec *codec) | |||
1156 | return ret; | 1155 | return ret; |
1157 | } | 1156 | } |
1158 | 1157 | ||
1159 | wm8900_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1158 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1160 | 1159 | ||
1161 | /* Restart the FLL? */ | 1160 | /* Restart the FLL? */ |
1162 | if (wm8900->fll_out) { | 1161 | if (wm8900->fll_out) { |
@@ -1189,7 +1188,7 @@ static int wm8900_probe(struct snd_soc_codec *codec) | |||
1189 | wm8900_reset(codec); | 1188 | wm8900_reset(codec); |
1190 | 1189 | ||
1191 | /* Turn the chip on */ | 1190 | /* Turn the chip on */ |
1192 | wm8900_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1191 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1193 | 1192 | ||
1194 | /* Latch the volume update bits */ | 1193 | /* Latch the volume update bits */ |
1195 | snd_soc_update_bits(codec, WM8900_REG_LINVOL, 0x100, 0x100); | 1194 | snd_soc_update_bits(codec, WM8900_REG_LINVOL, 0x100, 0x100); |
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 04b04f8e147c..b5322c1544fb 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -1105,7 +1105,7 @@ static int wm8903_set_bias_level(struct snd_soc_codec *codec, | |||
1105 | break; | 1105 | break; |
1106 | 1106 | ||
1107 | case SND_SOC_BIAS_STANDBY: | 1107 | case SND_SOC_BIAS_STANDBY: |
1108 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1108 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1109 | snd_soc_update_bits(codec, WM8903_BIAS_CONTROL_0, | 1109 | snd_soc_update_bits(codec, WM8903_BIAS_CONTROL_0, |
1110 | WM8903_POBCTRL | WM8903_ISEL_MASK | | 1110 | WM8903_POBCTRL | WM8903_ISEL_MASK | |
1111 | WM8903_STARTUP_BIAS_ENA | | 1111 | WM8903_STARTUP_BIAS_ENA | |
@@ -1200,8 +1200,6 @@ static int wm8903_set_bias_level(struct snd_soc_codec *codec, | |||
1200 | break; | 1200 | break; |
1201 | } | 1201 | } |
1202 | 1202 | ||
1203 | codec->dapm.bias_level = level; | ||
1204 | |||
1205 | return 0; | 1203 | return 0; |
1206 | } | 1204 | } |
1207 | 1205 | ||
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 215e93c1ddf0..265a4a58a2d1 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -1168,7 +1168,7 @@ static const struct snd_soc_dapm_route wm8912_intercon[] = { | |||
1168 | static int wm8904_add_widgets(struct snd_soc_codec *codec) | 1168 | static int wm8904_add_widgets(struct snd_soc_codec *codec) |
1169 | { | 1169 | { |
1170 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 1170 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); |
1171 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 1171 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
1172 | 1172 | ||
1173 | snd_soc_dapm_new_controls(dapm, wm8904_core_dapm_widgets, | 1173 | snd_soc_dapm_new_controls(dapm, wm8904_core_dapm_widgets, |
1174 | ARRAY_SIZE(wm8904_core_dapm_widgets)); | 1174 | ARRAY_SIZE(wm8904_core_dapm_widgets)); |
@@ -1852,7 +1852,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec, | |||
1852 | break; | 1852 | break; |
1853 | 1853 | ||
1854 | case SND_SOC_BIAS_STANDBY: | 1854 | case SND_SOC_BIAS_STANDBY: |
1855 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1855 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1856 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8904->supplies), | 1856 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8904->supplies), |
1857 | wm8904->supplies); | 1857 | wm8904->supplies); |
1858 | if (ret != 0) { | 1858 | if (ret != 0) { |
@@ -1907,7 +1907,6 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec, | |||
1907 | clk_disable_unprepare(wm8904->mclk); | 1907 | clk_disable_unprepare(wm8904->mclk); |
1908 | break; | 1908 | break; |
1909 | } | 1909 | } |
1910 | codec->dapm.bias_level = level; | ||
1911 | return 0; | 1910 | return 0; |
1912 | } | 1911 | } |
1913 | 1912 | ||
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index e4142b4309eb..98ef0ba5c2a4 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c | |||
@@ -492,7 +492,7 @@ static int wm8940_set_bias_level(struct snd_soc_codec *codec, | |||
492 | ret = snd_soc_write(codec, WM8940_POWER1, pwr_reg | 0x1); | 492 | ret = snd_soc_write(codec, WM8940_POWER1, pwr_reg | 0x1); |
493 | break; | 493 | break; |
494 | case SND_SOC_BIAS_STANDBY: | 494 | case SND_SOC_BIAS_STANDBY: |
495 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 495 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
496 | ret = regcache_sync(wm8940->regmap); | 496 | ret = regcache_sync(wm8940->regmap); |
497 | if (ret < 0) { | 497 | if (ret < 0) { |
498 | dev_err(codec->dev, "Failed to sync cache: %d\n", ret); | 498 | dev_err(codec->dev, "Failed to sync cache: %d\n", ret); |
@@ -510,8 +510,6 @@ static int wm8940_set_bias_level(struct snd_soc_codec *codec, | |||
510 | break; | 510 | break; |
511 | } | 511 | } |
512 | 512 | ||
513 | codec->dapm.bias_level = level; | ||
514 | |||
515 | return ret; | 513 | return ret; |
516 | } | 514 | } |
517 | 515 | ||
@@ -707,7 +705,7 @@ static int wm8940_probe(struct snd_soc_codec *codec) | |||
707 | return ret; | 705 | return ret; |
708 | } | 706 | } |
709 | 707 | ||
710 | wm8940_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 708 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
711 | 709 | ||
712 | ret = snd_soc_write(codec, WM8940_POWER1, 0x180); | 710 | ret = snd_soc_write(codec, WM8940_POWER1, 0x180); |
713 | if (ret < 0) | 711 | if (ret < 0) |
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index 00bec915d652..3a5bf894ff6d 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c | |||
@@ -785,7 +785,7 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec, | |||
785 | break; | 785 | break; |
786 | 786 | ||
787 | case SND_SOC_BIAS_STANDBY: | 787 | case SND_SOC_BIAS_STANDBY: |
788 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 788 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
789 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8955->supplies), | 789 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8955->supplies), |
790 | wm8955->supplies); | 790 | wm8955->supplies); |
791 | if (ret != 0) { | 791 | if (ret != 0) { |
@@ -838,7 +838,6 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec, | |||
838 | wm8955->supplies); | 838 | wm8955->supplies); |
839 | break; | 839 | break; |
840 | } | 840 | } |
841 | codec->dapm.bias_level = level; | ||
842 | return 0; | 841 | return 0; |
843 | } | 842 | } |
844 | 843 | ||
@@ -929,7 +928,7 @@ static int wm8955_probe(struct snd_soc_codec *codec) | |||
929 | WM8955_DMEN, WM8955_DMEN); | 928 | WM8955_DMEN, WM8955_DMEN); |
930 | } | 929 | } |
931 | 930 | ||
932 | wm8955_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 931 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
933 | 932 | ||
934 | /* Bias level configuration will have done an extra enable */ | 933 | /* Bias level configuration will have done an extra enable */ |
935 | regulator_bulk_disable(ARRAY_SIZE(wm8955->supplies), wm8955->supplies); | 934 | regulator_bulk_disable(ARRAY_SIZE(wm8955->supplies), wm8955->supplies); |
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 3035d9856415..edd34db9bd25 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c | |||
@@ -445,7 +445,7 @@ static int wm8960_add_widgets(struct snd_soc_codec *codec) | |||
445 | { | 445 | { |
446 | struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); | 446 | struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); |
447 | struct wm8960_data *pdata = &wm8960->pdata; | 447 | struct wm8960_data *pdata = &wm8960->pdata; |
448 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 448 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
449 | struct snd_soc_dapm_widget *w; | 449 | struct snd_soc_dapm_widget *w; |
450 | 450 | ||
451 | snd_soc_dapm_new_controls(dapm, wm8960_dapm_widgets, | 451 | snd_soc_dapm_new_controls(dapm, wm8960_dapm_widgets, |
@@ -476,7 +476,7 @@ static int wm8960_add_widgets(struct snd_soc_codec *codec) | |||
476 | * and save the result. | 476 | * and save the result. |
477 | */ | 477 | */ |
478 | list_for_each_entry(w, &codec->component.card->widgets, list) { | 478 | list_for_each_entry(w, &codec->component.card->widgets, list) { |
479 | if (w->dapm != &codec->dapm) | 479 | if (w->dapm != dapm) |
480 | continue; | 480 | continue; |
481 | if (strcmp(w->name, "LOUT1 PGA") == 0) | 481 | if (strcmp(w->name, "LOUT1 PGA") == 0) |
482 | wm8960->lout1 = w; | 482 | wm8960->lout1 = w; |
@@ -627,7 +627,7 @@ static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec, | |||
627 | break; | 627 | break; |
628 | 628 | ||
629 | case SND_SOC_BIAS_PREPARE: | 629 | case SND_SOC_BIAS_PREPARE: |
630 | switch (codec->dapm.bias_level) { | 630 | switch (snd_soc_codec_get_bias_level(codec)) { |
631 | case SND_SOC_BIAS_STANDBY: | 631 | case SND_SOC_BIAS_STANDBY: |
632 | if (!IS_ERR(wm8960->mclk)) { | 632 | if (!IS_ERR(wm8960->mclk)) { |
633 | ret = clk_prepare_enable(wm8960->mclk); | 633 | ret = clk_prepare_enable(wm8960->mclk); |
@@ -655,7 +655,7 @@ static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec, | |||
655 | break; | 655 | break; |
656 | 656 | ||
657 | case SND_SOC_BIAS_STANDBY: | 657 | case SND_SOC_BIAS_STANDBY: |
658 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 658 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
659 | regcache_sync(wm8960->regmap); | 659 | regcache_sync(wm8960->regmap); |
660 | 660 | ||
661 | /* Enable anti-pop features */ | 661 | /* Enable anti-pop features */ |
@@ -691,8 +691,6 @@ static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec, | |||
691 | break; | 691 | break; |
692 | } | 692 | } |
693 | 693 | ||
694 | codec->dapm.bias_level = level; | ||
695 | |||
696 | return 0; | 694 | return 0; |
697 | } | 695 | } |
698 | 696 | ||
@@ -707,7 +705,7 @@ static int wm8960_set_bias_level_capless(struct snd_soc_codec *codec, | |||
707 | break; | 705 | break; |
708 | 706 | ||
709 | case SND_SOC_BIAS_PREPARE: | 707 | case SND_SOC_BIAS_PREPARE: |
710 | switch (codec->dapm.bias_level) { | 708 | switch (snd_soc_codec_get_bias_level(codec)) { |
711 | case SND_SOC_BIAS_STANDBY: | 709 | case SND_SOC_BIAS_STANDBY: |
712 | /* Enable anti pop mode */ | 710 | /* Enable anti pop mode */ |
713 | snd_soc_update_bits(codec, WM8960_APOP1, | 711 | snd_soc_update_bits(codec, WM8960_APOP1, |
@@ -778,7 +776,7 @@ static int wm8960_set_bias_level_capless(struct snd_soc_codec *codec, | |||
778 | break; | 776 | break; |
779 | 777 | ||
780 | case SND_SOC_BIAS_STANDBY: | 778 | case SND_SOC_BIAS_STANDBY: |
781 | switch (codec->dapm.bias_level) { | 779 | switch (snd_soc_codec_get_bias_level(codec)) { |
782 | case SND_SOC_BIAS_PREPARE: | 780 | case SND_SOC_BIAS_PREPARE: |
783 | /* Disable HP discharge */ | 781 | /* Disable HP discharge */ |
784 | snd_soc_update_bits(codec, WM8960_APOP2, | 782 | snd_soc_update_bits(codec, WM8960_APOP2, |
@@ -802,8 +800,6 @@ static int wm8960_set_bias_level_capless(struct snd_soc_codec *codec, | |||
802 | break; | 800 | break; |
803 | } | 801 | } |
804 | 802 | ||
805 | codec->dapm.bias_level = level; | ||
806 | |||
807 | return 0; | 803 | return 0; |
808 | } | 804 | } |
809 | 805 | ||
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 95e2c1bfc809..a057662632ff 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c | |||
@@ -758,7 +758,7 @@ static int wm8961_set_bias_level(struct snd_soc_codec *codec, | |||
758 | break; | 758 | break; |
759 | 759 | ||
760 | case SND_SOC_BIAS_PREPARE: | 760 | case SND_SOC_BIAS_PREPARE: |
761 | if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) { | 761 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) { |
762 | /* Enable bias generation */ | 762 | /* Enable bias generation */ |
763 | reg = snd_soc_read(codec, WM8961_ANTI_POP); | 763 | reg = snd_soc_read(codec, WM8961_ANTI_POP); |
764 | reg |= WM8961_BUFIOEN | WM8961_BUFDCOPEN; | 764 | reg |= WM8961_BUFIOEN | WM8961_BUFDCOPEN; |
@@ -773,7 +773,7 @@ static int wm8961_set_bias_level(struct snd_soc_codec *codec, | |||
773 | break; | 773 | break; |
774 | 774 | ||
775 | case SND_SOC_BIAS_STANDBY: | 775 | case SND_SOC_BIAS_STANDBY: |
776 | if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE) { | 776 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE) { |
777 | /* VREF off */ | 777 | /* VREF off */ |
778 | reg = snd_soc_read(codec, WM8961_PWR_MGMT_1); | 778 | reg = snd_soc_read(codec, WM8961_PWR_MGMT_1); |
779 | reg &= ~WM8961_VREF; | 779 | reg &= ~WM8961_VREF; |
@@ -795,8 +795,6 @@ static int wm8961_set_bias_level(struct snd_soc_codec *codec, | |||
795 | break; | 795 | break; |
796 | } | 796 | } |
797 | 797 | ||
798 | codec->dapm.bias_level = level; | ||
799 | |||
800 | return 0; | 798 | return 0; |
801 | } | 799 | } |
802 | 800 | ||
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 118b0034ba23..c5748fd4f296 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
@@ -2361,7 +2361,7 @@ static int wm8962_add_widgets(struct snd_soc_codec *codec) | |||
2361 | { | 2361 | { |
2362 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | 2362 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); |
2363 | struct wm8962_pdata *pdata = &wm8962->pdata; | 2363 | struct wm8962_pdata *pdata = &wm8962->pdata; |
2364 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 2364 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
2365 | 2365 | ||
2366 | snd_soc_add_codec_controls(codec, wm8962_snd_controls, | 2366 | snd_soc_add_codec_controls(codec, wm8962_snd_controls, |
2367 | ARRAY_SIZE(wm8962_snd_controls)); | 2367 | ARRAY_SIZE(wm8962_snd_controls)); |
@@ -2446,13 +2446,13 @@ static void wm8962_configure_bclk(struct snd_soc_codec *codec) | |||
2446 | * So we here provisionally enable it and then disable it afterward | 2446 | * So we here provisionally enable it and then disable it afterward |
2447 | * if current bias_level hasn't reached SND_SOC_BIAS_ON. | 2447 | * if current bias_level hasn't reached SND_SOC_BIAS_ON. |
2448 | */ | 2448 | */ |
2449 | if (codec->dapm.bias_level != SND_SOC_BIAS_ON) | 2449 | if (snd_soc_codec_get_bias_level(codec) != SND_SOC_BIAS_ON) |
2450 | snd_soc_update_bits(codec, WM8962_CLOCKING2, | 2450 | snd_soc_update_bits(codec, WM8962_CLOCKING2, |
2451 | WM8962_SYSCLK_ENA_MASK, WM8962_SYSCLK_ENA); | 2451 | WM8962_SYSCLK_ENA_MASK, WM8962_SYSCLK_ENA); |
2452 | 2452 | ||
2453 | dspclk = snd_soc_read(codec, WM8962_CLOCKING1); | 2453 | dspclk = snd_soc_read(codec, WM8962_CLOCKING1); |
2454 | 2454 | ||
2455 | if (codec->dapm.bias_level != SND_SOC_BIAS_ON) | 2455 | if (snd_soc_codec_get_bias_level(codec) != SND_SOC_BIAS_ON) |
2456 | snd_soc_update_bits(codec, WM8962_CLOCKING2, | 2456 | snd_soc_update_bits(codec, WM8962_CLOCKING2, |
2457 | WM8962_SYSCLK_ENA_MASK, 0); | 2457 | WM8962_SYSCLK_ENA_MASK, 0); |
2458 | 2458 | ||
@@ -2510,9 +2510,6 @@ static void wm8962_configure_bclk(struct snd_soc_codec *codec) | |||
2510 | static int wm8962_set_bias_level(struct snd_soc_codec *codec, | 2510 | static int wm8962_set_bias_level(struct snd_soc_codec *codec, |
2511 | enum snd_soc_bias_level level) | 2511 | enum snd_soc_bias_level level) |
2512 | { | 2512 | { |
2513 | if (level == codec->dapm.bias_level) | ||
2514 | return 0; | ||
2515 | |||
2516 | switch (level) { | 2513 | switch (level) { |
2517 | case SND_SOC_BIAS_ON: | 2514 | case SND_SOC_BIAS_ON: |
2518 | break; | 2515 | break; |
@@ -2530,7 +2527,7 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec, | |||
2530 | snd_soc_update_bits(codec, WM8962_PWR_MGMT_1, | 2527 | snd_soc_update_bits(codec, WM8962_PWR_MGMT_1, |
2531 | WM8962_VMID_SEL_MASK, 0x100); | 2528 | WM8962_VMID_SEL_MASK, 0x100); |
2532 | 2529 | ||
2533 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) | 2530 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) |
2534 | msleep(100); | 2531 | msleep(100); |
2535 | break; | 2532 | break; |
2536 | 2533 | ||
@@ -2538,7 +2535,6 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec, | |||
2538 | break; | 2535 | break; |
2539 | } | 2536 | } |
2540 | 2537 | ||
2541 | codec->dapm.bias_level = level; | ||
2542 | return 0; | 2538 | return 0; |
2543 | } | 2539 | } |
2544 | 2540 | ||
@@ -2614,7 +2610,7 @@ static int wm8962_hw_params(struct snd_pcm_substream *substream, | |||
2614 | dev_dbg(codec->dev, "hw_params set BCLK %dHz LRCLK %dHz\n", | 2610 | dev_dbg(codec->dev, "hw_params set BCLK %dHz LRCLK %dHz\n", |
2615 | wm8962->bclk, wm8962->lrclk); | 2611 | wm8962->bclk, wm8962->lrclk); |
2616 | 2612 | ||
2617 | if (codec->dapm.bias_level == SND_SOC_BIAS_ON) | 2613 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_ON) |
2618 | wm8962_configure_bclk(codec); | 2614 | wm8962_configure_bclk(codec); |
2619 | 2615 | ||
2620 | return 0; | 2616 | return 0; |
@@ -3118,7 +3114,7 @@ static irqreturn_t wm8962_irq(int irq, void *data) | |||
3118 | int wm8962_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) | 3114 | int wm8962_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack) |
3119 | { | 3115 | { |
3120 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | 3116 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); |
3121 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 3117 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
3122 | int irq_mask, enable; | 3118 | int irq_mask, enable; |
3123 | 3119 | ||
3124 | wm8962->jack = jack; | 3120 | wm8962->jack = jack; |
@@ -3164,7 +3160,7 @@ static void wm8962_beep_work(struct work_struct *work) | |||
3164 | struct wm8962_priv *wm8962 = | 3160 | struct wm8962_priv *wm8962 = |
3165 | container_of(work, struct wm8962_priv, beep_work); | 3161 | container_of(work, struct wm8962_priv, beep_work); |
3166 | struct snd_soc_codec *codec = wm8962->codec; | 3162 | struct snd_soc_codec *codec = wm8962->codec; |
3167 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 3163 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
3168 | int i; | 3164 | int i; |
3169 | int reg = 0; | 3165 | int reg = 0; |
3170 | int best = 0; | 3166 | int best = 0; |
@@ -3415,6 +3411,7 @@ static void wm8962_free_gpio(struct snd_soc_codec *codec) | |||
3415 | 3411 | ||
3416 | static int wm8962_probe(struct snd_soc_codec *codec) | 3412 | static int wm8962_probe(struct snd_soc_codec *codec) |
3417 | { | 3413 | { |
3414 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
3418 | int ret; | 3415 | int ret; |
3419 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | 3416 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); |
3420 | int i; | 3417 | int i; |
@@ -3462,7 +3459,7 @@ static int wm8962_probe(struct snd_soc_codec *codec) | |||
3462 | } | 3459 | } |
3463 | if (!dmicclk || !dmicdat) { | 3460 | if (!dmicclk || !dmicdat) { |
3464 | dev_dbg(codec->dev, "DMIC not in use, disabling\n"); | 3461 | dev_dbg(codec->dev, "DMIC not in use, disabling\n"); |
3465 | snd_soc_dapm_nc_pin(&codec->dapm, "DMICDAT"); | 3462 | snd_soc_dapm_nc_pin(dapm, "DMICDAT"); |
3466 | } | 3463 | } |
3467 | if (dmicclk != dmicdat) | 3464 | if (dmicclk != dmicdat) |
3468 | dev_warn(codec->dev, "DMIC GPIOs partially configured\n"); | 3465 | dev_warn(codec->dev, "DMIC GPIOs partially configured\n"); |
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index f9cbabdc6238..b51184c4e816 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c | |||
@@ -577,7 +577,7 @@ static int wm8971_set_bias_level(struct snd_soc_codec *codec, | |||
577 | flush_delayed_work(&wm8971->charge_work); | 577 | flush_delayed_work(&wm8971->charge_work); |
578 | break; | 578 | break; |
579 | case SND_SOC_BIAS_STANDBY: | 579 | case SND_SOC_BIAS_STANDBY: |
580 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 580 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
581 | snd_soc_cache_sync(codec); | 581 | snd_soc_cache_sync(codec); |
582 | /* charge output caps - set vmid to 5k for quick power up */ | 582 | /* charge output caps - set vmid to 5k for quick power up */ |
583 | snd_soc_write(codec, WM8971_PWR1, pwr_reg | 0x01c0); | 583 | snd_soc_write(codec, WM8971_PWR1, pwr_reg | 0x01c0); |
@@ -594,7 +594,6 @@ static int wm8971_set_bias_level(struct snd_soc_codec *codec, | |||
594 | snd_soc_write(codec, WM8971_PWR1, 0x0001); | 594 | snd_soc_write(codec, WM8971_PWR1, 0x0001); |
595 | break; | 595 | break; |
596 | } | 596 | } |
597 | codec->dapm.bias_level = level; | ||
598 | return 0; | 597 | return 0; |
599 | } | 598 | } |
600 | 599 | ||
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c index ff0e4646b934..33b16a7ba82e 100644 --- a/sound/soc/codecs/wm8974.c +++ b/sound/soc/codecs/wm8974.c | |||
@@ -514,7 +514,7 @@ static int wm8974_set_bias_level(struct snd_soc_codec *codec, | |||
514 | case SND_SOC_BIAS_STANDBY: | 514 | case SND_SOC_BIAS_STANDBY: |
515 | power1 |= WM8974_POWER1_BIASEN | WM8974_POWER1_BUFIOEN; | 515 | power1 |= WM8974_POWER1_BIASEN | WM8974_POWER1_BUFIOEN; |
516 | 516 | ||
517 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 517 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
518 | regcache_sync(dev_get_regmap(codec->dev, NULL)); | 518 | regcache_sync(dev_get_regmap(codec->dev, NULL)); |
519 | 519 | ||
520 | /* Initial cap charge at VMID 5k */ | 520 | /* Initial cap charge at VMID 5k */ |
@@ -533,7 +533,6 @@ static int wm8974_set_bias_level(struct snd_soc_codec *codec, | |||
533 | break; | 533 | break; |
534 | } | 534 | } |
535 | 535 | ||
536 | codec->dapm.bias_level = level; | ||
537 | return 0; | 536 | return 0; |
538 | } | 537 | } |
539 | 538 | ||
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c index cf7032911721..cfc8cdf49970 100644 --- a/sound/soc/codecs/wm8978.c +++ b/sound/soc/codecs/wm8978.c | |||
@@ -868,7 +868,7 @@ static int wm8978_set_bias_level(struct snd_soc_codec *codec, | |||
868 | /* bit 3: enable bias, bit 2: enable I/O tie off buffer */ | 868 | /* bit 3: enable bias, bit 2: enable I/O tie off buffer */ |
869 | power1 |= 0xc; | 869 | power1 |= 0xc; |
870 | 870 | ||
871 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 871 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
872 | /* Initial cap charge at VMID 5k */ | 872 | /* Initial cap charge at VMID 5k */ |
873 | snd_soc_write(codec, WM8978_POWER_MANAGEMENT_1, | 873 | snd_soc_write(codec, WM8978_POWER_MANAGEMENT_1, |
874 | power1 | 0x3); | 874 | power1 | 0x3); |
@@ -888,7 +888,6 @@ static int wm8978_set_bias_level(struct snd_soc_codec *codec, | |||
888 | 888 | ||
889 | dev_dbg(codec->dev, "%s: %d, %x\n", __func__, level, power1); | 889 | dev_dbg(codec->dev, "%s: %d, %x\n", __func__, level, power1); |
890 | 890 | ||
891 | codec->dapm.bias_level = level; | ||
892 | return 0; | 891 | return 0; |
893 | } | 892 | } |
894 | 893 | ||
@@ -928,7 +927,7 @@ static int wm8978_suspend(struct snd_soc_codec *codec) | |||
928 | { | 927 | { |
929 | struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec); | 928 | struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec); |
930 | 929 | ||
931 | wm8978_set_bias_level(codec, SND_SOC_BIAS_OFF); | 930 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); |
932 | /* Also switch PLL off */ | 931 | /* Also switch PLL off */ |
933 | snd_soc_write(codec, WM8978_POWER_MANAGEMENT_1, 0); | 932 | snd_soc_write(codec, WM8978_POWER_MANAGEMENT_1, 0); |
934 | 933 | ||
@@ -944,7 +943,7 @@ static int wm8978_resume(struct snd_soc_codec *codec) | |||
944 | /* Sync reg_cache with the hardware */ | 943 | /* Sync reg_cache with the hardware */ |
945 | regcache_sync(wm8978->regmap); | 944 | regcache_sync(wm8978->regmap); |
946 | 945 | ||
947 | wm8978_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 946 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
948 | 947 | ||
949 | if (wm8978->f_pllout) | 948 | if (wm8978->f_pllout) |
950 | /* Switch PLL on */ | 949 | /* Switch PLL on */ |
diff --git a/sound/soc/codecs/wm8983.c b/sound/soc/codecs/wm8983.c index 5d1cf08a72b8..2fdd2c6cc09d 100644 --- a/sound/soc/codecs/wm8983.c +++ b/sound/soc/codecs/wm8983.c | |||
@@ -915,7 +915,7 @@ static int wm8983_set_bias_level(struct snd_soc_codec *codec, | |||
915 | 1 << WM8983_VMIDSEL_SHIFT); | 915 | 1 << WM8983_VMIDSEL_SHIFT); |
916 | break; | 916 | break; |
917 | case SND_SOC_BIAS_STANDBY: | 917 | case SND_SOC_BIAS_STANDBY: |
918 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 918 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
919 | ret = regcache_sync(wm8983->regmap); | 919 | ret = regcache_sync(wm8983->regmap); |
920 | if (ret < 0) { | 920 | if (ret < 0) { |
921 | dev_err(codec->dev, "Failed to sync cache: %d\n", ret); | 921 | dev_err(codec->dev, "Failed to sync cache: %d\n", ret); |
@@ -963,7 +963,6 @@ static int wm8983_set_bias_level(struct snd_soc_codec *codec, | |||
963 | break; | 963 | break; |
964 | } | 964 | } |
965 | 965 | ||
966 | codec->dapm.bias_level = level; | ||
967 | return 0; | 966 | return 0; |
968 | } | 967 | } |
969 | 968 | ||
diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c index 0b3b54c9971d..8a85f5004d41 100644 --- a/sound/soc/codecs/wm8985.c +++ b/sound/soc/codecs/wm8985.c | |||
@@ -897,7 +897,7 @@ static int wm8985_set_bias_level(struct snd_soc_codec *codec, | |||
897 | 1 << WM8985_VMIDSEL_SHIFT); | 897 | 1 << WM8985_VMIDSEL_SHIFT); |
898 | break; | 898 | break; |
899 | case SND_SOC_BIAS_STANDBY: | 899 | case SND_SOC_BIAS_STANDBY: |
900 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 900 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
901 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8985->supplies), | 901 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8985->supplies), |
902 | wm8985->supplies); | 902 | wm8985->supplies); |
903 | if (ret) { | 903 | if (ret) { |
@@ -957,7 +957,6 @@ static int wm8985_set_bias_level(struct snd_soc_codec *codec, | |||
957 | break; | 957 | break; |
958 | } | 958 | } |
959 | 959 | ||
960 | codec->dapm.bias_level = level; | ||
961 | return 0; | 960 | return 0; |
962 | } | 961 | } |
963 | 962 | ||
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index 24968aa8618a..f13a995af277 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c | |||
@@ -738,7 +738,7 @@ static int wm8988_set_bias_level(struct snd_soc_codec *codec, | |||
738 | break; | 738 | break; |
739 | 739 | ||
740 | case SND_SOC_BIAS_STANDBY: | 740 | case SND_SOC_BIAS_STANDBY: |
741 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 741 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
742 | regcache_sync(wm8988->regmap); | 742 | regcache_sync(wm8988->regmap); |
743 | 743 | ||
744 | /* VREF, VMID=2x5k */ | 744 | /* VREF, VMID=2x5k */ |
@@ -756,7 +756,6 @@ static int wm8988_set_bias_level(struct snd_soc_codec *codec, | |||
756 | snd_soc_write(codec, WM8988_PWR1, 0x0000); | 756 | snd_soc_write(codec, WM8988_PWR1, 0x0000); |
757 | break; | 757 | break; |
758 | } | 758 | } |
759 | codec->dapm.bias_level = level; | ||
760 | return 0; | 759 | return 0; |
761 | } | 760 | } |
762 | 761 | ||
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c index c93bffcb3cfb..1993fd2a6f15 100644 --- a/sound/soc/codecs/wm8990.c +++ b/sound/soc/codecs/wm8990.c | |||
@@ -1124,7 +1124,7 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec, | |||
1124 | break; | 1124 | break; |
1125 | 1125 | ||
1126 | case SND_SOC_BIAS_STANDBY: | 1126 | case SND_SOC_BIAS_STANDBY: |
1127 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1127 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1128 | ret = regcache_sync(wm8990->regmap); | 1128 | ret = regcache_sync(wm8990->regmap); |
1129 | if (ret < 0) { | 1129 | if (ret < 0) { |
1130 | dev_err(codec->dev, "Failed to sync cache: %d\n", ret); | 1130 | dev_err(codec->dev, "Failed to sync cache: %d\n", ret); |
@@ -1227,7 +1227,6 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec, | |||
1227 | break; | 1227 | break; |
1228 | } | 1228 | } |
1229 | 1229 | ||
1230 | codec->dapm.bias_level = level; | ||
1231 | return 0; | 1230 | return 0; |
1232 | } | 1231 | } |
1233 | 1232 | ||
@@ -1281,7 +1280,7 @@ static int wm8990_probe(struct snd_soc_codec *codec) | |||
1281 | wm8990_reset(codec); | 1280 | wm8990_reset(codec); |
1282 | 1281 | ||
1283 | /* charge output caps */ | 1282 | /* charge output caps */ |
1284 | wm8990_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1283 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1285 | 1284 | ||
1286 | snd_soc_update_bits(codec, WM8990_AUDIO_INTERFACE_4, | 1285 | snd_soc_update_bits(codec, WM8990_AUDIO_INTERFACE_4, |
1287 | WM8990_ALRCGPIO1, WM8990_ALRCGPIO1); | 1286 | WM8990_ALRCGPIO1, WM8990_ALRCGPIO1); |
diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c index 49df0dc607e6..44a677720828 100644 --- a/sound/soc/codecs/wm8991.c +++ b/sound/soc/codecs/wm8991.c | |||
@@ -1131,7 +1131,7 @@ static int wm8991_set_bias_level(struct snd_soc_codec *codec, | |||
1131 | break; | 1131 | break; |
1132 | 1132 | ||
1133 | case SND_SOC_BIAS_STANDBY: | 1133 | case SND_SOC_BIAS_STANDBY: |
1134 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1134 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1135 | regcache_sync(wm8991->regmap); | 1135 | regcache_sync(wm8991->regmap); |
1136 | /* Enable all output discharge bits */ | 1136 | /* Enable all output discharge bits */ |
1137 | snd_soc_write(codec, WM8991_ANTIPOP1, WM8991_DIS_LLINE | | 1137 | snd_soc_write(codec, WM8991_ANTIPOP1, WM8991_DIS_LLINE | |
@@ -1224,7 +1224,6 @@ static int wm8991_set_bias_level(struct snd_soc_codec *codec, | |||
1224 | break; | 1224 | break; |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | codec->dapm.bias_level = level; | ||
1228 | return 0; | 1227 | return 0; |
1229 | } | 1228 | } |
1230 | 1229 | ||
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index 2e70a270eb28..8a8db8605dc2 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c | |||
@@ -992,7 +992,7 @@ static int wm8993_set_bias_level(struct snd_soc_codec *codec, | |||
992 | break; | 992 | break; |
993 | 993 | ||
994 | case SND_SOC_BIAS_STANDBY: | 994 | case SND_SOC_BIAS_STANDBY: |
995 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 995 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
996 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8993->supplies), | 996 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8993->supplies), |
997 | wm8993->supplies); | 997 | wm8993->supplies); |
998 | if (ret != 0) | 998 | if (ret != 0) |
@@ -1065,8 +1065,6 @@ static int wm8993_set_bias_level(struct snd_soc_codec *codec, | |||
1065 | break; | 1065 | break; |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | codec->dapm.bias_level = level; | ||
1069 | |||
1070 | return 0; | 1068 | return 0; |
1071 | } | 1069 | } |
1072 | 1070 | ||
@@ -1485,7 +1483,7 @@ static struct snd_soc_dai_driver wm8993_dai = { | |||
1485 | static int wm8993_probe(struct snd_soc_codec *codec) | 1483 | static int wm8993_probe(struct snd_soc_codec *codec) |
1486 | { | 1484 | { |
1487 | struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); | 1485 | struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); |
1488 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 1486 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
1489 | 1487 | ||
1490 | wm8993->hubs_data.hp_startup_mode = 1; | 1488 | wm8993->hubs_data.hp_startup_mode = 1; |
1491 | wm8993->hubs_data.dcs_codes_l = -2; | 1489 | wm8993->hubs_data.dcs_codes_l = -2; |
@@ -1539,7 +1537,7 @@ static int wm8993_probe(struct snd_soc_codec *codec) | |||
1539 | * VMID as an output and can disable it. | 1537 | * VMID as an output and can disable it. |
1540 | */ | 1538 | */ |
1541 | if (wm8993->pdata.lineout1_diff && wm8993->pdata.lineout2_diff) | 1539 | if (wm8993->pdata.lineout1_diff && wm8993->pdata.lineout2_diff) |
1542 | codec->dapm.idle_bias_off = 1; | 1540 | dapm->idle_bias_off = 1; |
1543 | 1541 | ||
1544 | return 0; | 1542 | return 0; |
1545 | 1543 | ||
@@ -1563,7 +1561,7 @@ static int wm8993_suspend(struct snd_soc_codec *codec) | |||
1563 | wm8993->fll_fout = fll_fout; | 1561 | wm8993->fll_fout = fll_fout; |
1564 | wm8993->fll_fref = fll_fref; | 1562 | wm8993->fll_fref = fll_fref; |
1565 | 1563 | ||
1566 | wm8993_set_bias_level(codec, SND_SOC_BIAS_OFF); | 1564 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); |
1567 | 1565 | ||
1568 | return 0; | 1566 | return 0; |
1569 | } | 1567 | } |
@@ -1573,7 +1571,7 @@ static int wm8993_resume(struct snd_soc_codec *codec) | |||
1573 | struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); | 1571 | struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); |
1574 | int ret; | 1572 | int ret; |
1575 | 1573 | ||
1576 | wm8993_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1574 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1577 | 1575 | ||
1578 | /* Restart the FLL? */ | 1576 | /* Restart the FLL? */ |
1579 | if (wm8993->fll_fout) { | 1577 | if (wm8993->fll_fout) { |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 4fbc7689339a..99a758a54986 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -212,6 +212,7 @@ static int configure_aif_clock(struct snd_soc_codec *codec, int aif) | |||
212 | 212 | ||
213 | static int configure_clock(struct snd_soc_codec *codec) | 213 | static int configure_clock(struct snd_soc_codec *codec) |
214 | { | 214 | { |
215 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
215 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 216 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
216 | int change, new; | 217 | int change, new; |
217 | 218 | ||
@@ -239,7 +240,7 @@ static int configure_clock(struct snd_soc_codec *codec) | |||
239 | change = snd_soc_update_bits(codec, WM8994_CLOCKING_1, | 240 | change = snd_soc_update_bits(codec, WM8994_CLOCKING_1, |
240 | WM8994_SYSCLK_SRC, new); | 241 | WM8994_SYSCLK_SRC, new); |
241 | if (change) | 242 | if (change) |
242 | snd_soc_dapm_sync(&codec->dapm); | 243 | snd_soc_dapm_sync(dapm); |
243 | 244 | ||
244 | wm8958_micd_set_rate(codec); | 245 | wm8958_micd_set_rate(codec); |
245 | 246 | ||
@@ -2492,12 +2493,12 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, | |||
2492 | break; | 2493 | break; |
2493 | } | 2494 | } |
2494 | 2495 | ||
2495 | if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) | 2496 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) |
2496 | active_reference(codec); | 2497 | active_reference(codec); |
2497 | break; | 2498 | break; |
2498 | 2499 | ||
2499 | case SND_SOC_BIAS_STANDBY: | 2500 | case SND_SOC_BIAS_STANDBY: |
2500 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 2501 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
2501 | switch (control->type) { | 2502 | switch (control->type) { |
2502 | case WM8958: | 2503 | case WM8958: |
2503 | if (control->revision == 0) { | 2504 | if (control->revision == 0) { |
@@ -2521,7 +2522,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, | |||
2521 | WM8994_LINEOUT2_DISCH); | 2522 | WM8994_LINEOUT2_DISCH); |
2522 | } | 2523 | } |
2523 | 2524 | ||
2524 | if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE) | 2525 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE) |
2525 | active_dereference(codec); | 2526 | active_dereference(codec); |
2526 | 2527 | ||
2527 | /* MICBIAS into bypass mode on newer devices */ | 2528 | /* MICBIAS into bypass mode on newer devices */ |
@@ -2541,20 +2542,18 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, | |||
2541 | break; | 2542 | break; |
2542 | 2543 | ||
2543 | case SND_SOC_BIAS_OFF: | 2544 | case SND_SOC_BIAS_OFF: |
2544 | if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) | 2545 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) |
2545 | wm8994->cur_fw = NULL; | 2546 | wm8994->cur_fw = NULL; |
2546 | break; | 2547 | break; |
2547 | } | 2548 | } |
2548 | 2549 | ||
2549 | codec->dapm.bias_level = level; | ||
2550 | |||
2551 | return 0; | 2550 | return 0; |
2552 | } | 2551 | } |
2553 | 2552 | ||
2554 | int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode) | 2553 | int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode) |
2555 | { | 2554 | { |
2556 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 2555 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
2557 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 2556 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
2558 | 2557 | ||
2559 | switch (mode) { | 2558 | switch (mode) { |
2560 | case WM8994_VMID_NORMAL: | 2559 | case WM8994_VMID_NORMAL: |
@@ -3163,7 +3162,7 @@ static int wm8994_codec_suspend(struct snd_soc_codec *codec) | |||
3163 | i + 1, ret); | 3162 | i + 1, ret); |
3164 | } | 3163 | } |
3165 | 3164 | ||
3166 | wm8994_set_bias_level(codec, SND_SOC_BIAS_OFF); | 3165 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); |
3167 | 3166 | ||
3168 | return 0; | 3167 | return 0; |
3169 | } | 3168 | } |
@@ -3356,6 +3355,7 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994) | |||
3356 | int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | 3355 | int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, |
3357 | int micbias) | 3356 | int micbias) |
3358 | { | 3357 | { |
3358 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
3359 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 3359 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
3360 | struct wm8994_micdet *micdet; | 3360 | struct wm8994_micdet *micdet; |
3361 | struct wm8994 *control = wm8994->wm8994; | 3361 | struct wm8994 *control = wm8994->wm8994; |
@@ -3370,20 +3370,16 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
3370 | case 1: | 3370 | case 1: |
3371 | micdet = &wm8994->micdet[0]; | 3371 | micdet = &wm8994->micdet[0]; |
3372 | if (jack) | 3372 | if (jack) |
3373 | ret = snd_soc_dapm_force_enable_pin(&codec->dapm, | 3373 | ret = snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1"); |
3374 | "MICBIAS1"); | ||
3375 | else | 3374 | else |
3376 | ret = snd_soc_dapm_disable_pin(&codec->dapm, | 3375 | ret = snd_soc_dapm_disable_pin(dapm, "MICBIAS1"); |
3377 | "MICBIAS1"); | ||
3378 | break; | 3376 | break; |
3379 | case 2: | 3377 | case 2: |
3380 | micdet = &wm8994->micdet[1]; | 3378 | micdet = &wm8994->micdet[1]; |
3381 | if (jack) | 3379 | if (jack) |
3382 | ret = snd_soc_dapm_force_enable_pin(&codec->dapm, | 3380 | ret = snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1"); |
3383 | "MICBIAS1"); | ||
3384 | else | 3381 | else |
3385 | ret = snd_soc_dapm_disable_pin(&codec->dapm, | 3382 | ret = snd_soc_dapm_disable_pin(dapm, "MICBIAS1"); |
3386 | "MICBIAS1"); | ||
3387 | break; | 3383 | break; |
3388 | default: | 3384 | default: |
3389 | dev_warn(codec->dev, "Invalid MICBIAS %d\n", micbias); | 3385 | dev_warn(codec->dev, "Invalid MICBIAS %d\n", micbias); |
@@ -3415,7 +3411,7 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
3415 | WM8994_MIC2_DET_DB_MASK | WM8994_MIC2_SHRT_DB_MASK, | 3411 | WM8994_MIC2_DET_DB_MASK | WM8994_MIC2_SHRT_DB_MASK, |
3416 | WM8994_MIC1_DET_DB | WM8994_MIC1_SHRT_DB); | 3412 | WM8994_MIC1_DET_DB | WM8994_MIC1_SHRT_DB); |
3417 | 3413 | ||
3418 | snd_soc_dapm_sync(&codec->dapm); | 3414 | snd_soc_dapm_sync(dapm); |
3419 | 3415 | ||
3420 | return 0; | 3416 | return 0; |
3421 | } | 3417 | } |
@@ -3505,6 +3501,7 @@ static irqreturn_t wm8994_mic_irq(int irq, void *data) | |||
3505 | /* Should be called with accdet_lock held */ | 3501 | /* Should be called with accdet_lock held */ |
3506 | static void wm1811_micd_stop(struct snd_soc_codec *codec) | 3502 | static void wm1811_micd_stop(struct snd_soc_codec *codec) |
3507 | { | 3503 | { |
3504 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
3508 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 3505 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
3509 | 3506 | ||
3510 | if (!wm8994->jackdet) | 3507 | if (!wm8994->jackdet) |
@@ -3515,8 +3512,7 @@ static void wm1811_micd_stop(struct snd_soc_codec *codec) | |||
3515 | wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK); | 3512 | wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK); |
3516 | 3513 | ||
3517 | if (wm8994->wm8994->pdata.jd_ext_cap) | 3514 | if (wm8994->wm8994->pdata.jd_ext_cap) |
3518 | snd_soc_dapm_disable_pin(&codec->dapm, | 3515 | snd_soc_dapm_disable_pin(dapm, "MICBIAS2"); |
3519 | "MICBIAS2"); | ||
3520 | } | 3516 | } |
3521 | 3517 | ||
3522 | static void wm8958_button_det(struct snd_soc_codec *codec, u16 status) | 3518 | static void wm8958_button_det(struct snd_soc_codec *codec, u16 status) |
@@ -3625,14 +3621,14 @@ static void wm1811_mic_work(struct work_struct *work) | |||
3625 | mic_work.work); | 3621 | mic_work.work); |
3626 | struct wm8994 *control = wm8994->wm8994; | 3622 | struct wm8994 *control = wm8994->wm8994; |
3627 | struct snd_soc_codec *codec = wm8994->hubs.codec; | 3623 | struct snd_soc_codec *codec = wm8994->hubs.codec; |
3624 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
3628 | 3625 | ||
3629 | pm_runtime_get_sync(codec->dev); | 3626 | pm_runtime_get_sync(codec->dev); |
3630 | 3627 | ||
3631 | /* If required for an external cap force MICBIAS on */ | 3628 | /* If required for an external cap force MICBIAS on */ |
3632 | if (control->pdata.jd_ext_cap) { | 3629 | if (control->pdata.jd_ext_cap) { |
3633 | snd_soc_dapm_force_enable_pin(&codec->dapm, | 3630 | snd_soc_dapm_force_enable_pin(dapm, "MICBIAS2"); |
3634 | "MICBIAS2"); | 3631 | snd_soc_dapm_sync(dapm); |
3635 | snd_soc_dapm_sync(&codec->dapm); | ||
3636 | } | 3632 | } |
3637 | 3633 | ||
3638 | mutex_lock(&wm8994->accdet_lock); | 3634 | mutex_lock(&wm8994->accdet_lock); |
@@ -3664,6 +3660,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data) | |||
3664 | struct wm8994_priv *wm8994 = data; | 3660 | struct wm8994_priv *wm8994 = data; |
3665 | struct wm8994 *control = wm8994->wm8994; | 3661 | struct wm8994 *control = wm8994->wm8994; |
3666 | struct snd_soc_codec *codec = wm8994->hubs.codec; | 3662 | struct snd_soc_codec *codec = wm8994->hubs.codec; |
3663 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
3667 | int reg, delay; | 3664 | int reg, delay; |
3668 | bool present; | 3665 | bool present; |
3669 | 3666 | ||
@@ -3724,7 +3721,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data) | |||
3724 | 3721 | ||
3725 | /* Turn off MICBIAS if it was on for an external cap */ | 3722 | /* Turn off MICBIAS if it was on for an external cap */ |
3726 | if (control->pdata.jd_ext_cap && !present) | 3723 | if (control->pdata.jd_ext_cap && !present) |
3727 | snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS2"); | 3724 | snd_soc_dapm_disable_pin(dapm, "MICBIAS2"); |
3728 | 3725 | ||
3729 | if (present) | 3726 | if (present) |
3730 | snd_soc_jack_report(wm8994->micdet[0].jack, | 3727 | snd_soc_jack_report(wm8994->micdet[0].jack, |
@@ -3770,6 +3767,7 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
3770 | wm1811_micdet_cb det_cb, void *det_cb_data, | 3767 | wm1811_micdet_cb det_cb, void *det_cb_data, |
3771 | wm1811_mic_id_cb id_cb, void *id_cb_data) | 3768 | wm1811_mic_id_cb id_cb, void *id_cb_data) |
3772 | { | 3769 | { |
3770 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
3773 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 3771 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
3774 | struct wm8994 *control = wm8994->wm8994; | 3772 | struct wm8994 *control = wm8994->wm8994; |
3775 | u16 micd_lvl_sel; | 3773 | u16 micd_lvl_sel; |
@@ -3783,8 +3781,8 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
3783 | } | 3781 | } |
3784 | 3782 | ||
3785 | if (jack) { | 3783 | if (jack) { |
3786 | snd_soc_dapm_force_enable_pin(&codec->dapm, "CLK_SYS"); | 3784 | snd_soc_dapm_force_enable_pin(dapm, "CLK_SYS"); |
3787 | snd_soc_dapm_sync(&codec->dapm); | 3785 | snd_soc_dapm_sync(dapm); |
3788 | 3786 | ||
3789 | wm8994->micdet[0].jack = jack; | 3787 | wm8994->micdet[0].jack = jack; |
3790 | 3788 | ||
@@ -3819,7 +3817,7 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
3819 | snd_soc_update_bits(codec, WM8958_MIC_DETECT_2, | 3817 | snd_soc_update_bits(codec, WM8958_MIC_DETECT_2, |
3820 | WM8958_MICD_LVL_SEL_MASK, micd_lvl_sel); | 3818 | WM8958_MICD_LVL_SEL_MASK, micd_lvl_sel); |
3821 | 3819 | ||
3822 | WARN_ON(codec->dapm.bias_level > SND_SOC_BIAS_STANDBY); | 3820 | WARN_ON(snd_soc_codec_get_bias_level(codec) > SND_SOC_BIAS_STANDBY); |
3823 | 3821 | ||
3824 | /* | 3822 | /* |
3825 | * If we can use jack detection start off with that, | 3823 | * If we can use jack detection start off with that, |
@@ -3846,8 +3844,8 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
3846 | snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, | 3844 | snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, |
3847 | WM8958_MICD_ENA, 0); | 3845 | WM8958_MICD_ENA, 0); |
3848 | wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_NONE); | 3846 | wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_NONE); |
3849 | snd_soc_dapm_disable_pin(&codec->dapm, "CLK_SYS"); | 3847 | snd_soc_dapm_disable_pin(dapm, "CLK_SYS"); |
3850 | snd_soc_dapm_sync(&codec->dapm); | 3848 | snd_soc_dapm_sync(dapm); |
3851 | } | 3849 | } |
3852 | 3850 | ||
3853 | return 0; | 3851 | return 0; |
@@ -3985,9 +3983,9 @@ static irqreturn_t wm8994_temp_shut(int irq, void *data) | |||
3985 | 3983 | ||
3986 | static int wm8994_codec_probe(struct snd_soc_codec *codec) | 3984 | static int wm8994_codec_probe(struct snd_soc_codec *codec) |
3987 | { | 3985 | { |
3986 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
3988 | struct wm8994 *control = dev_get_drvdata(codec->dev->parent); | 3987 | struct wm8994 *control = dev_get_drvdata(codec->dev->parent); |
3989 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 3988 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
3990 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
3991 | unsigned int reg; | 3989 | unsigned int reg; |
3992 | int ret, i; | 3990 | int ret, i; |
3993 | 3991 | ||
@@ -4018,7 +4016,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
4018 | wm8994->micdet_irq = control->pdata.micdet_irq; | 4016 | wm8994->micdet_irq = control->pdata.micdet_irq; |
4019 | 4017 | ||
4020 | /* By default use idle_bias_off, will override for WM8994 */ | 4018 | /* By default use idle_bias_off, will override for WM8994 */ |
4021 | codec->dapm.idle_bias_off = 1; | 4019 | dapm->idle_bias_off = 1; |
4022 | 4020 | ||
4023 | /* Set revision-specific configuration */ | 4021 | /* Set revision-specific configuration */ |
4024 | switch (control->type) { | 4022 | switch (control->type) { |
@@ -4026,7 +4024,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
4026 | /* Single ended line outputs should have VMID on. */ | 4024 | /* Single ended line outputs should have VMID on. */ |
4027 | if (!control->pdata.lineout1_diff || | 4025 | if (!control->pdata.lineout1_diff || |
4028 | !control->pdata.lineout2_diff) | 4026 | !control->pdata.lineout2_diff) |
4029 | codec->dapm.idle_bias_off = 0; | 4027 | dapm->idle_bias_off = 0; |
4030 | 4028 | ||
4031 | switch (control->revision) { | 4029 | switch (control->revision) { |
4032 | case 2: | 4030 | case 2: |
diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c index 66103c2b012e..687c4dd7ec99 100644 --- a/sound/soc/codecs/wm8995.c +++ b/sound/soc/codecs/wm8995.c | |||
@@ -721,6 +721,7 @@ static int configure_aif_clock(struct snd_soc_codec *codec, int aif) | |||
721 | 721 | ||
722 | static int configure_clock(struct snd_soc_codec *codec) | 722 | static int configure_clock(struct snd_soc_codec *codec) |
723 | { | 723 | { |
724 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
724 | struct wm8995_priv *wm8995; | 725 | struct wm8995_priv *wm8995; |
725 | int change, new; | 726 | int change, new; |
726 | 727 | ||
@@ -751,7 +752,7 @@ static int configure_clock(struct snd_soc_codec *codec) | |||
751 | if (!change) | 752 | if (!change) |
752 | return 0; | 753 | return 0; |
753 | 754 | ||
754 | snd_soc_dapm_sync(&codec->dapm); | 755 | snd_soc_dapm_sync(dapm); |
755 | 756 | ||
756 | return 0; | 757 | return 0; |
757 | } | 758 | } |
@@ -1965,7 +1966,7 @@ static int wm8995_set_bias_level(struct snd_soc_codec *codec, | |||
1965 | case SND_SOC_BIAS_PREPARE: | 1966 | case SND_SOC_BIAS_PREPARE: |
1966 | break; | 1967 | break; |
1967 | case SND_SOC_BIAS_STANDBY: | 1968 | case SND_SOC_BIAS_STANDBY: |
1968 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1969 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1969 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8995->supplies), | 1970 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8995->supplies), |
1970 | wm8995->supplies); | 1971 | wm8995->supplies); |
1971 | if (ret) | 1972 | if (ret) |
@@ -1990,7 +1991,6 @@ static int wm8995_set_bias_level(struct snd_soc_codec *codec, | |||
1990 | break; | 1991 | break; |
1991 | } | 1992 | } |
1992 | 1993 | ||
1993 | codec->dapm.bias_level = level; | ||
1994 | return 0; | 1994 | return 0; |
1995 | } | 1995 | } |
1996 | 1996 | ||
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 308748a022c5..370459fcf21c 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c | |||
@@ -1590,7 +1590,7 @@ static int wm8996_set_bias_level(struct snd_soc_codec *codec, | |||
1590 | break; | 1590 | break; |
1591 | 1591 | ||
1592 | case SND_SOC_BIAS_STANDBY: | 1592 | case SND_SOC_BIAS_STANDBY: |
1593 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1593 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
1594 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8996->supplies), | 1594 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8996->supplies), |
1595 | wm8996->supplies); | 1595 | wm8996->supplies); |
1596 | if (ret != 0) { | 1596 | if (ret != 0) { |
@@ -1628,8 +1628,6 @@ static int wm8996_set_bias_level(struct snd_soc_codec *codec, | |||
1628 | break; | 1628 | break; |
1629 | } | 1629 | } |
1630 | 1630 | ||
1631 | codec->dapm.bias_level = level; | ||
1632 | |||
1633 | return 0; | 1631 | return 0; |
1634 | } | 1632 | } |
1635 | 1633 | ||
@@ -2247,7 +2245,7 @@ int wm8996_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
2247 | wm8996_polarity_fn polarity_cb) | 2245 | wm8996_polarity_fn polarity_cb) |
2248 | { | 2246 | { |
2249 | struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); | 2247 | struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); |
2250 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 2248 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
2251 | 2249 | ||
2252 | wm8996->jack = jack; | 2250 | wm8996->jack = jack; |
2253 | wm8996->detecting = true; | 2251 | wm8996->detecting = true; |
@@ -2292,6 +2290,7 @@ EXPORT_SYMBOL_GPL(wm8996_detect); | |||
2292 | 2290 | ||
2293 | static void wm8996_hpdet_irq(struct snd_soc_codec *codec) | 2291 | static void wm8996_hpdet_irq(struct snd_soc_codec *codec) |
2294 | { | 2292 | { |
2293 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
2295 | struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); | 2294 | struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); |
2296 | int val, reg, report; | 2295 | int val, reg, report; |
2297 | 2296 | ||
@@ -2345,12 +2344,14 @@ out: | |||
2345 | snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, WM8996_MICD_ENA, | 2344 | snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, WM8996_MICD_ENA, |
2346 | WM8996_MICD_ENA); | 2345 | WM8996_MICD_ENA); |
2347 | 2346 | ||
2348 | snd_soc_dapm_disable_pin(&codec->dapm, "Bandgap"); | 2347 | snd_soc_dapm_disable_pin(dapm, "Bandgap"); |
2349 | snd_soc_dapm_sync(&codec->dapm); | 2348 | snd_soc_dapm_sync(dapm); |
2350 | } | 2349 | } |
2351 | 2350 | ||
2352 | static void wm8996_hpdet_start(struct snd_soc_codec *codec) | 2351 | static void wm8996_hpdet_start(struct snd_soc_codec *codec) |
2353 | { | 2352 | { |
2353 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
2354 | |||
2354 | /* Unclamp the output, we can't measure while we're shorting it */ | 2355 | /* Unclamp the output, we can't measure while we're shorting it */ |
2355 | snd_soc_update_bits(codec, WM8996_ANALOGUE_HP_1, | 2356 | snd_soc_update_bits(codec, WM8996_ANALOGUE_HP_1, |
2356 | WM8996_HPOUT1L_RMV_SHORT | | 2357 | WM8996_HPOUT1L_RMV_SHORT | |
@@ -2359,8 +2360,8 @@ static void wm8996_hpdet_start(struct snd_soc_codec *codec) | |||
2359 | WM8996_HPOUT1R_RMV_SHORT); | 2360 | WM8996_HPOUT1R_RMV_SHORT); |
2360 | 2361 | ||
2361 | /* We need bandgap for HPDET */ | 2362 | /* We need bandgap for HPDET */ |
2362 | snd_soc_dapm_force_enable_pin(&codec->dapm, "Bandgap"); | 2363 | snd_soc_dapm_force_enable_pin(dapm, "Bandgap"); |
2363 | snd_soc_dapm_sync(&codec->dapm); | 2364 | snd_soc_dapm_sync(dapm); |
2364 | 2365 | ||
2365 | /* Go into headphone detect left mode */ | 2366 | /* Go into headphone detect left mode */ |
2366 | snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, WM8996_MICD_ENA, 0); | 2367 | snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, WM8996_MICD_ENA, 0); |
diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c index 2a129dcf5f92..527657e592bb 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c | |||
@@ -1058,13 +1058,14 @@ static struct snd_soc_dai_driver wm8997_dai[] = { | |||
1058 | 1058 | ||
1059 | static int wm8997_codec_probe(struct snd_soc_codec *codec) | 1059 | static int wm8997_codec_probe(struct snd_soc_codec *codec) |
1060 | { | 1060 | { |
1061 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
1061 | struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec); | 1062 | struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec); |
1062 | 1063 | ||
1063 | arizona_init_spk(codec); | 1064 | arizona_init_spk(codec); |
1064 | 1065 | ||
1065 | snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS"); | 1066 | snd_soc_dapm_disable_pin(dapm, "HAPTICS"); |
1066 | 1067 | ||
1067 | priv->core.arizona->dapm = &codec->dapm; | 1068 | priv->core.arizona->dapm = dapm; |
1068 | 1069 | ||
1069 | return 0; | 1070 | return 0; |
1070 | } | 1071 | } |
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 13a3f335ea5b..8a8b1c0f9142 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
@@ -838,7 +838,7 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec, | |||
838 | 838 | ||
839 | case SND_SOC_BIAS_STANDBY: | 839 | case SND_SOC_BIAS_STANDBY: |
840 | /* Initial cold start */ | 840 | /* Initial cold start */ |
841 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 841 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
842 | regcache_cache_only(wm9081->regmap, false); | 842 | regcache_cache_only(wm9081->regmap, false); |
843 | regcache_sync(wm9081->regmap); | 843 | regcache_sync(wm9081->regmap); |
844 | 844 | ||
@@ -898,8 +898,6 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec, | |||
898 | break; | 898 | break; |
899 | } | 899 | } |
900 | 900 | ||
901 | codec->dapm.bias_level = level; | ||
902 | |||
903 | return 0; | 901 | return 0; |
904 | } | 902 | } |
905 | 903 | ||
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c index 60d243c904f5..13d23fc797db 100644 --- a/sound/soc/codecs/wm9090.c +++ b/sound/soc/codecs/wm9090.c | |||
@@ -425,7 +425,7 @@ static const struct snd_soc_dapm_route audio_map_in2_diff[] = { | |||
425 | static int wm9090_add_controls(struct snd_soc_codec *codec) | 425 | static int wm9090_add_controls(struct snd_soc_codec *codec) |
426 | { | 426 | { |
427 | struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec); | 427 | struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec); |
428 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 428 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
429 | int i; | 429 | int i; |
430 | 430 | ||
431 | snd_soc_dapm_new_controls(dapm, wm9090_dapm_widgets, | 431 | snd_soc_dapm_new_controls(dapm, wm9090_dapm_widgets, |
@@ -496,7 +496,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec, | |||
496 | break; | 496 | break; |
497 | 497 | ||
498 | case SND_SOC_BIAS_STANDBY: | 498 | case SND_SOC_BIAS_STANDBY: |
499 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 499 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { |
500 | /* Restore the register cache */ | 500 | /* Restore the register cache */ |
501 | regcache_sync(wm9090->regmap); | 501 | regcache_sync(wm9090->regmap); |
502 | } | 502 | } |
@@ -515,8 +515,6 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec, | |||
515 | break; | 515 | break; |
516 | } | 516 | } |
517 | 517 | ||
518 | codec->dapm.bias_level = level; | ||
519 | |||
520 | return 0; | 518 | return 0; |
521 | } | 519 | } |
522 | 520 | ||
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 98c9525bd751..1fda104dfc45 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c | |||
@@ -610,7 +610,6 @@ static int wm9712_set_bias_level(struct snd_soc_codec *codec, | |||
610 | ac97_write(codec, AC97_POWERDOWN, 0xffff); | 610 | ac97_write(codec, AC97_POWERDOWN, 0xffff); |
611 | break; | 611 | break; |
612 | } | 612 | } |
613 | codec->dapm.bias_level = level; | ||
614 | return 0; | 613 | return 0; |
615 | } | 614 | } |
616 | 615 | ||
@@ -646,7 +645,7 @@ static int wm9712_soc_resume(struct snd_soc_codec *codec) | |||
646 | if (ret < 0) | 645 | if (ret < 0) |
647 | return ret; | 646 | return ret; |
648 | 647 | ||
649 | wm9712_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 648 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
650 | 649 | ||
651 | if (ret == 0) { | 650 | if (ret == 0) { |
652 | /* Sync reg_cache with the hardware after cold reset */ | 651 | /* Sync reg_cache with the hardware after cold reset */ |
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index 79552953e1bd..9d18a0ec4280 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -1171,7 +1171,6 @@ static int wm9713_set_bias_level(struct snd_soc_codec *codec, | |||
1171 | ac97_write(codec, AC97_POWERDOWN, 0xffff); | 1171 | ac97_write(codec, AC97_POWERDOWN, 0xffff); |
1172 | break; | 1172 | break; |
1173 | } | 1173 | } |
1174 | codec->dapm.bias_level = level; | ||
1175 | return 0; | 1174 | return 0; |
1176 | } | 1175 | } |
1177 | 1176 | ||
@@ -1201,7 +1200,7 @@ static int wm9713_soc_resume(struct snd_soc_codec *codec) | |||
1201 | if (ret < 0) | 1200 | if (ret < 0) |
1202 | return ret; | 1201 | return ret; |
1203 | 1202 | ||
1204 | wm9713_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1203 | snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); |
1205 | 1204 | ||
1206 | /* do we need to re-start the PLL ? */ | 1205 | /* do we need to re-start the PLL ? */ |
1207 | if (wm9713->pll_in) | 1206 | if (wm9713->pll_in) |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 8366e19657a7..fd86bd105460 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -1116,7 +1116,7 @@ static const struct snd_soc_dapm_route lineout2_se_routes[] = { | |||
1116 | 1116 | ||
1117 | int wm_hubs_add_analogue_controls(struct snd_soc_codec *codec) | 1117 | int wm_hubs_add_analogue_controls(struct snd_soc_codec *codec) |
1118 | { | 1118 | { |
1119 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 1119 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
1120 | 1120 | ||
1121 | /* Latch volume update bits & default ZC on */ | 1121 | /* Latch volume update bits & default ZC on */ |
1122 | snd_soc_update_bits(codec, WM8993_LEFT_LINE_INPUT_1_2_VOLUME, | 1122 | snd_soc_update_bits(codec, WM8993_LEFT_LINE_INPUT_1_2_VOLUME, |
@@ -1160,7 +1160,7 @@ int wm_hubs_add_analogue_routes(struct snd_soc_codec *codec, | |||
1160 | int lineout1_diff, int lineout2_diff) | 1160 | int lineout1_diff, int lineout2_diff) |
1161 | { | 1161 | { |
1162 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); | 1162 | struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); |
1163 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 1163 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
1164 | 1164 | ||
1165 | hubs->codec = codec; | 1165 | hubs->codec = codec; |
1166 | 1166 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 23732523f87c..95b5f034d864 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -750,23 +750,10 @@ static void soc_resume_deferred(struct work_struct *work) | |||
750 | } | 750 | } |
751 | 751 | ||
752 | list_for_each_entry(codec, &card->codec_dev_list, card_list) { | 752 | list_for_each_entry(codec, &card->codec_dev_list, card_list) { |
753 | /* If the CODEC was idle over suspend then it will have been | ||
754 | * left with bias OFF or STANDBY and suspended so we must now | ||
755 | * resume. Otherwise the suspend was suppressed. | ||
756 | */ | ||
757 | if (codec->suspended) { | 753 | if (codec->suspended) { |
758 | switch (codec->dapm.bias_level) { | 754 | if (codec->driver->resume) |
759 | case SND_SOC_BIAS_STANDBY: | 755 | codec->driver->resume(codec); |
760 | case SND_SOC_BIAS_OFF: | 756 | codec->suspended = 0; |
761 | if (codec->driver->resume) | ||
762 | codec->driver->resume(codec); | ||
763 | codec->suspended = 0; | ||
764 | break; | ||
765 | default: | ||
766 | dev_dbg(codec->dev, | ||
767 | "ASoC: CODEC was on over suspend\n"); | ||
768 | break; | ||
769 | } | ||
770 | } | 757 | } |
771 | } | 758 | } |
772 | 759 | ||
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 549165d5790f..1b4a6eb43174 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -52,10 +52,15 @@ static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm, | |||
52 | const char *control, | 52 | const char *control, |
53 | int (*connected)(struct snd_soc_dapm_widget *source, | 53 | int (*connected)(struct snd_soc_dapm_widget *source, |
54 | struct snd_soc_dapm_widget *sink)); | 54 | struct snd_soc_dapm_widget *sink)); |
55 | static struct snd_soc_dapm_widget * | 55 | |
56 | struct snd_soc_dapm_widget * | ||
56 | snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | 57 | snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, |
57 | const struct snd_soc_dapm_widget *widget); | 58 | const struct snd_soc_dapm_widget *widget); |
58 | 59 | ||
60 | struct snd_soc_dapm_widget * | ||
61 | snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, | ||
62 | const struct snd_soc_dapm_widget *widget); | ||
63 | |||
59 | /* dapm power sequences - make this per codec in the future */ | 64 | /* dapm power sequences - make this per codec in the future */ |
60 | static int dapm_up_seq[] = { | 65 | static int dapm_up_seq[] = { |
61 | [snd_soc_dapm_pre] = 0, | 66 | [snd_soc_dapm_pre] = 0, |
@@ -70,6 +75,7 @@ static int dapm_up_seq[] = { | |||
70 | [snd_soc_dapm_aif_out] = 4, | 75 | [snd_soc_dapm_aif_out] = 4, |
71 | [snd_soc_dapm_mic] = 5, | 76 | [snd_soc_dapm_mic] = 5, |
72 | [snd_soc_dapm_mux] = 6, | 77 | [snd_soc_dapm_mux] = 6, |
78 | [snd_soc_dapm_demux] = 6, | ||
73 | [snd_soc_dapm_dac] = 7, | 79 | [snd_soc_dapm_dac] = 7, |
74 | [snd_soc_dapm_switch] = 8, | 80 | [snd_soc_dapm_switch] = 8, |
75 | [snd_soc_dapm_mixer] = 8, | 81 | [snd_soc_dapm_mixer] = 8, |
@@ -100,6 +106,7 @@ static int dapm_down_seq[] = { | |||
100 | [snd_soc_dapm_mic] = 7, | 106 | [snd_soc_dapm_mic] = 7, |
101 | [snd_soc_dapm_micbias] = 8, | 107 | [snd_soc_dapm_micbias] = 8, |
102 | [snd_soc_dapm_mux] = 9, | 108 | [snd_soc_dapm_mux] = 9, |
109 | [snd_soc_dapm_demux] = 9, | ||
103 | [snd_soc_dapm_aif_in] = 10, | 110 | [snd_soc_dapm_aif_in] = 10, |
104 | [snd_soc_dapm_aif_out] = 10, | 111 | [snd_soc_dapm_aif_out] = 10, |
105 | [snd_soc_dapm_dai_in] = 10, | 112 | [snd_soc_dapm_dai_in] = 10, |
@@ -308,14 +315,13 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, | |||
308 | { | 315 | { |
309 | struct dapm_kcontrol_data *data; | 316 | struct dapm_kcontrol_data *data; |
310 | struct soc_mixer_control *mc; | 317 | struct soc_mixer_control *mc; |
318 | struct soc_enum *e; | ||
319 | const char *name; | ||
320 | int ret; | ||
311 | 321 | ||
312 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 322 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
313 | if (!data) { | 323 | if (!data) |
314 | dev_err(widget->dapm->dev, | ||
315 | "ASoC: can't allocate kcontrol data for %s\n", | ||
316 | widget->name); | ||
317 | return -ENOMEM; | 324 | return -ENOMEM; |
318 | } | ||
319 | 325 | ||
320 | INIT_LIST_HEAD(&data->paths); | 326 | INIT_LIST_HEAD(&data->paths); |
321 | 327 | ||
@@ -328,6 +334,13 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, | |||
328 | if (mc->autodisable) { | 334 | if (mc->autodisable) { |
329 | struct snd_soc_dapm_widget template; | 335 | struct snd_soc_dapm_widget template; |
330 | 336 | ||
337 | name = kasprintf(GFP_KERNEL, "%s %s", kcontrol->id.name, | ||
338 | "Autodisable"); | ||
339 | if (!name) { | ||
340 | ret = -ENOMEM; | ||
341 | goto err_data; | ||
342 | } | ||
343 | |||
331 | memset(&template, 0, sizeof(template)); | 344 | memset(&template, 0, sizeof(template)); |
332 | template.reg = mc->reg; | 345 | template.reg = mc->reg; |
333 | template.mask = (1 << fls(mc->max)) - 1; | 346 | template.mask = (1 << fls(mc->max)) - 1; |
@@ -338,16 +351,53 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, | |||
338 | template.off_val = 0; | 351 | template.off_val = 0; |
339 | template.on_val = template.off_val; | 352 | template.on_val = template.off_val; |
340 | template.id = snd_soc_dapm_kcontrol; | 353 | template.id = snd_soc_dapm_kcontrol; |
341 | template.name = kcontrol->id.name; | 354 | template.name = name; |
342 | 355 | ||
343 | data->value = template.on_val; | 356 | data->value = template.on_val; |
344 | 357 | ||
345 | data->widget = snd_soc_dapm_new_control(widget->dapm, | 358 | data->widget = |
359 | snd_soc_dapm_new_control_unlocked(widget->dapm, | ||
346 | &template); | 360 | &template); |
347 | if (!data->widget) { | 361 | if (!data->widget) { |
348 | kfree(data); | 362 | ret = -ENOMEM; |
349 | return -ENOMEM; | 363 | goto err_name; |
364 | } | ||
365 | } | ||
366 | break; | ||
367 | case snd_soc_dapm_demux: | ||
368 | case snd_soc_dapm_mux: | ||
369 | e = (struct soc_enum *)kcontrol->private_value; | ||
370 | |||
371 | if (e->autodisable) { | ||
372 | struct snd_soc_dapm_widget template; | ||
373 | |||
374 | name = kasprintf(GFP_KERNEL, "%s %s", kcontrol->id.name, | ||
375 | "Autodisable"); | ||
376 | if (!name) { | ||
377 | ret = -ENOMEM; | ||
378 | goto err_data; | ||
350 | } | 379 | } |
380 | |||
381 | memset(&template, 0, sizeof(template)); | ||
382 | template.reg = e->reg; | ||
383 | template.mask = e->mask << e->shift_l; | ||
384 | template.shift = e->shift_l; | ||
385 | template.off_val = snd_soc_enum_item_to_val(e, 0); | ||
386 | template.on_val = template.off_val; | ||
387 | template.id = snd_soc_dapm_kcontrol; | ||
388 | template.name = name; | ||
389 | |||
390 | data->value = template.on_val; | ||
391 | |||
392 | data->widget = snd_soc_dapm_new_control(widget->dapm, | ||
393 | &template); | ||
394 | if (!data->widget) { | ||
395 | ret = -ENOMEM; | ||
396 | goto err_name; | ||
397 | } | ||
398 | |||
399 | snd_soc_dapm_add_path(widget->dapm, data->widget, | ||
400 | widget, NULL, NULL); | ||
351 | } | 401 | } |
352 | break; | 402 | break; |
353 | default: | 403 | default: |
@@ -357,11 +407,19 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, | |||
357 | kcontrol->private_data = data; | 407 | kcontrol->private_data = data; |
358 | 408 | ||
359 | return 0; | 409 | return 0; |
410 | |||
411 | err_name: | ||
412 | kfree(name); | ||
413 | err_data: | ||
414 | kfree(data); | ||
415 | return ret; | ||
360 | } | 416 | } |
361 | 417 | ||
362 | static void dapm_kcontrol_free(struct snd_kcontrol *kctl) | 418 | static void dapm_kcontrol_free(struct snd_kcontrol *kctl) |
363 | { | 419 | { |
364 | struct dapm_kcontrol_data *data = snd_kcontrol_chip(kctl); | 420 | struct dapm_kcontrol_data *data = snd_kcontrol_chip(kctl); |
421 | if (data->widget) | ||
422 | kfree(data->widget->name); | ||
365 | kfree(data->wlist); | 423 | kfree(data->wlist); |
366 | kfree(data); | 424 | kfree(data); |
367 | } | 425 | } |
@@ -405,11 +463,6 @@ static void dapm_kcontrol_add_path(const struct snd_kcontrol *kcontrol, | |||
405 | struct dapm_kcontrol_data *data = snd_kcontrol_chip(kcontrol); | 463 | struct dapm_kcontrol_data *data = snd_kcontrol_chip(kcontrol); |
406 | 464 | ||
407 | list_add_tail(&path->list_kcontrol, &data->paths); | 465 | list_add_tail(&path->list_kcontrol, &data->paths); |
408 | |||
409 | if (data->widget) { | ||
410 | snd_soc_dapm_add_path(data->widget->dapm, data->widget, | ||
411 | path->source, NULL, NULL); | ||
412 | } | ||
413 | } | 466 | } |
414 | 467 | ||
415 | static bool dapm_kcontrol_is_powered(const struct snd_kcontrol *kcontrol) | 468 | static bool dapm_kcontrol_is_powered(const struct snd_kcontrol *kcontrol) |
@@ -525,6 +578,67 @@ static void soc_dapm_async_complete(struct snd_soc_dapm_context *dapm) | |||
525 | snd_soc_component_async_complete(dapm->component); | 578 | snd_soc_component_async_complete(dapm->component); |
526 | } | 579 | } |
527 | 580 | ||
581 | static struct snd_soc_dapm_widget * | ||
582 | dapm_wcache_lookup(struct snd_soc_dapm_wcache *wcache, const char *name) | ||
583 | { | ||
584 | struct snd_soc_dapm_widget *w = wcache->widget; | ||
585 | struct list_head *wlist; | ||
586 | const int depth = 2; | ||
587 | int i = 0; | ||
588 | |||
589 | if (w) { | ||
590 | wlist = &w->dapm->card->widgets; | ||
591 | |||
592 | list_for_each_entry_from(w, wlist, list) { | ||
593 | if (!strcmp(name, w->name)) | ||
594 | return w; | ||
595 | |||
596 | if (++i == depth) | ||
597 | break; | ||
598 | } | ||
599 | } | ||
600 | |||
601 | return NULL; | ||
602 | } | ||
603 | |||
604 | static inline void dapm_wcache_update(struct snd_soc_dapm_wcache *wcache, | ||
605 | struct snd_soc_dapm_widget *w) | ||
606 | { | ||
607 | wcache->widget = w; | ||
608 | } | ||
609 | |||
610 | /** | ||
611 | * snd_soc_dapm_force_bias_level() - Sets the DAPM bias level | ||
612 | * @dapm: The DAPM context for which to set the level | ||
613 | * @level: The level to set | ||
614 | * | ||
615 | * Forces the DAPM bias level to a specific state. It will call the bias level | ||
616 | * callback of DAPM context with the specified level. This will even happen if | ||
617 | * the context is already at the same level. Furthermore it will not go through | ||
618 | * the normal bias level sequencing, meaning any intermediate states between the | ||
619 | * current and the target state will not be entered. | ||
620 | * | ||
621 | * Note that the change in bias level is only temporary and the next time | ||
622 | * snd_soc_dapm_sync() is called the state will be set to the level as | ||
623 | * determined by the DAPM core. The function is mainly intended to be used to | ||
624 | * used during probe or resume from suspend to power up the device so | ||
625 | * initialization can be done, before the DAPM core takes over. | ||
626 | */ | ||
627 | int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm, | ||
628 | enum snd_soc_bias_level level) | ||
629 | { | ||
630 | int ret = 0; | ||
631 | |||
632 | if (dapm->set_bias_level) | ||
633 | ret = dapm->set_bias_level(dapm, level); | ||
634 | |||
635 | if (ret == 0) | ||
636 | dapm->bias_level = level; | ||
637 | |||
638 | return ret; | ||
639 | } | ||
640 | EXPORT_SYMBOL_GPL(snd_soc_dapm_force_bias_level); | ||
641 | |||
528 | /** | 642 | /** |
529 | * snd_soc_dapm_set_bias_level - set the bias level for the system | 643 | * snd_soc_dapm_set_bias_level - set the bias level for the system |
530 | * @dapm: DAPM context | 644 | * @dapm: DAPM context |
@@ -547,10 +661,8 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm, | |||
547 | if (ret != 0) | 661 | if (ret != 0) |
548 | goto out; | 662 | goto out; |
549 | 663 | ||
550 | if (dapm->set_bias_level) | 664 | if (!card || dapm != &card->dapm) |
551 | ret = dapm->set_bias_level(dapm, level); | 665 | ret = snd_soc_dapm_force_bias_level(dapm, level); |
552 | else if (!card || dapm != &card->dapm) | ||
553 | dapm->bias_level = level; | ||
554 | 666 | ||
555 | if (ret != 0) | 667 | if (ret != 0) |
556 | goto out; | 668 | goto out; |
@@ -565,9 +677,10 @@ out: | |||
565 | 677 | ||
566 | /* connect mux widget to its interconnecting audio paths */ | 678 | /* connect mux widget to its interconnecting audio paths */ |
567 | static int dapm_connect_mux(struct snd_soc_dapm_context *dapm, | 679 | static int dapm_connect_mux(struct snd_soc_dapm_context *dapm, |
568 | struct snd_soc_dapm_path *path, const char *control_name) | 680 | struct snd_soc_dapm_path *path, const char *control_name, |
681 | struct snd_soc_dapm_widget *w) | ||
569 | { | 682 | { |
570 | const struct snd_kcontrol_new *kcontrol = &path->sink->kcontrol_news[0]; | 683 | const struct snd_kcontrol_new *kcontrol = &w->kcontrol_news[0]; |
571 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 684 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
572 | unsigned int val, item; | 685 | unsigned int val, item; |
573 | int i; | 686 | int i; |
@@ -707,6 +820,7 @@ static int dapm_create_or_share_mixmux_kcontrol(struct snd_soc_dapm_widget *w, | |||
707 | wname_in_long_name = false; | 820 | wname_in_long_name = false; |
708 | kcname_in_long_name = true; | 821 | kcname_in_long_name = true; |
709 | break; | 822 | break; |
823 | case snd_soc_dapm_demux: | ||
710 | case snd_soc_dapm_mux: | 824 | case snd_soc_dapm_mux: |
711 | wname_in_long_name = true; | 825 | wname_in_long_name = true; |
712 | kcname_in_long_name = false; | 826 | kcname_in_long_name = false; |
@@ -777,6 +891,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w) | |||
777 | { | 891 | { |
778 | int i, ret; | 892 | int i, ret; |
779 | struct snd_soc_dapm_path *path; | 893 | struct snd_soc_dapm_path *path; |
894 | struct dapm_kcontrol_data *data; | ||
780 | 895 | ||
781 | /* add kcontrol */ | 896 | /* add kcontrol */ |
782 | for (i = 0; i < w->num_kcontrols; i++) { | 897 | for (i = 0; i < w->num_kcontrols; i++) { |
@@ -786,16 +901,20 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w) | |||
786 | if (path->name != (char *)w->kcontrol_news[i].name) | 901 | if (path->name != (char *)w->kcontrol_news[i].name) |
787 | continue; | 902 | continue; |
788 | 903 | ||
789 | if (w->kcontrols[i]) { | 904 | if (!w->kcontrols[i]) { |
790 | dapm_kcontrol_add_path(w->kcontrols[i], path); | 905 | ret = dapm_create_or_share_mixmux_kcontrol(w, i); |
791 | continue; | 906 | if (ret < 0) |
907 | return ret; | ||
792 | } | 908 | } |
793 | 909 | ||
794 | ret = dapm_create_or_share_mixmux_kcontrol(w, i); | ||
795 | if (ret < 0) | ||
796 | return ret; | ||
797 | |||
798 | dapm_kcontrol_add_path(w->kcontrols[i], path); | 910 | dapm_kcontrol_add_path(w->kcontrols[i], path); |
911 | |||
912 | data = snd_kcontrol_chip(w->kcontrols[i]); | ||
913 | if (data->widget) | ||
914 | snd_soc_dapm_add_path(data->widget->dapm, | ||
915 | data->widget, | ||
916 | path->source, | ||
917 | NULL, NULL); | ||
799 | } | 918 | } |
800 | } | 919 | } |
801 | 920 | ||
@@ -807,17 +926,32 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w) | |||
807 | { | 926 | { |
808 | struct snd_soc_dapm_context *dapm = w->dapm; | 927 | struct snd_soc_dapm_context *dapm = w->dapm; |
809 | struct snd_soc_dapm_path *path; | 928 | struct snd_soc_dapm_path *path; |
929 | struct list_head *paths; | ||
930 | const char *type; | ||
810 | int ret; | 931 | int ret; |
811 | 932 | ||
933 | switch (w->id) { | ||
934 | case snd_soc_dapm_mux: | ||
935 | paths = &w->sources; | ||
936 | type = "mux"; | ||
937 | break; | ||
938 | case snd_soc_dapm_demux: | ||
939 | paths = &w->sinks; | ||
940 | type = "demux"; | ||
941 | break; | ||
942 | default: | ||
943 | return -EINVAL; | ||
944 | } | ||
945 | |||
812 | if (w->num_kcontrols != 1) { | 946 | if (w->num_kcontrols != 1) { |
813 | dev_err(dapm->dev, | 947 | dev_err(dapm->dev, |
814 | "ASoC: mux %s has incorrect number of controls\n", | 948 | "ASoC: %s %s has incorrect number of controls\n", type, |
815 | w->name); | 949 | w->name); |
816 | return -EINVAL; | 950 | return -EINVAL; |
817 | } | 951 | } |
818 | 952 | ||
819 | if (list_empty(&w->sources)) { | 953 | if (list_empty(paths)) { |
820 | dev_err(dapm->dev, "ASoC: mux %s has no paths\n", w->name); | 954 | dev_err(dapm->dev, "ASoC: %s %s has no paths\n", type, w->name); |
821 | return -EINVAL; | 955 | return -EINVAL; |
822 | } | 956 | } |
823 | 957 | ||
@@ -825,9 +959,16 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w) | |||
825 | if (ret < 0) | 959 | if (ret < 0) |
826 | return ret; | 960 | return ret; |
827 | 961 | ||
828 | list_for_each_entry(path, &w->sources, list_sink) { | 962 | if (w->id == snd_soc_dapm_mux) { |
829 | if (path->name) | 963 | list_for_each_entry(path, &w->sources, list_sink) { |
830 | dapm_kcontrol_add_path(w->kcontrols[0], path); | 964 | if (path->name) |
965 | dapm_kcontrol_add_path(w->kcontrols[0], path); | ||
966 | } | ||
967 | } else { | ||
968 | list_for_each_entry(path, &w->sinks, list_source) { | ||
969 | if (path->name) | ||
970 | dapm_kcontrol_add_path(w->kcontrols[0], path); | ||
971 | } | ||
831 | } | 972 | } |
832 | 973 | ||
833 | return 0; | 974 | return 0; |
@@ -2335,6 +2476,50 @@ static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w) | |||
2335 | } | 2476 | } |
2336 | } | 2477 | } |
2337 | 2478 | ||
2479 | static int snd_soc_dapm_check_dynamic_path(struct snd_soc_dapm_context *dapm, | ||
2480 | struct snd_soc_dapm_widget *source, struct snd_soc_dapm_widget *sink, | ||
2481 | const char *control) | ||
2482 | { | ||
2483 | bool dynamic_source = false; | ||
2484 | bool dynamic_sink = false; | ||
2485 | |||
2486 | if (!control) | ||
2487 | return 0; | ||
2488 | |||
2489 | switch (source->id) { | ||
2490 | case snd_soc_dapm_demux: | ||
2491 | dynamic_source = true; | ||
2492 | break; | ||
2493 | default: | ||
2494 | break; | ||
2495 | } | ||
2496 | |||
2497 | switch (sink->id) { | ||
2498 | case snd_soc_dapm_mux: | ||
2499 | case snd_soc_dapm_switch: | ||
2500 | case snd_soc_dapm_mixer: | ||
2501 | case snd_soc_dapm_mixer_named_ctl: | ||
2502 | dynamic_sink = true; | ||
2503 | break; | ||
2504 | default: | ||
2505 | break; | ||
2506 | } | ||
2507 | |||
2508 | if (dynamic_source && dynamic_sink) { | ||
2509 | dev_err(dapm->dev, | ||
2510 | "Direct connection between demux and mixer/mux not supported for path %s -> [%s] -> %s\n", | ||
2511 | source->name, control, sink->name); | ||
2512 | return -EINVAL; | ||
2513 | } else if (!dynamic_source && !dynamic_sink) { | ||
2514 | dev_err(dapm->dev, | ||
2515 | "Control not supported for path %s -> [%s] -> %s\n", | ||
2516 | source->name, control, sink->name); | ||
2517 | return -EINVAL; | ||
2518 | } | ||
2519 | |||
2520 | return 0; | ||
2521 | } | ||
2522 | |||
2338 | static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm, | 2523 | static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm, |
2339 | struct snd_soc_dapm_widget *wsource, struct snd_soc_dapm_widget *wsink, | 2524 | struct snd_soc_dapm_widget *wsource, struct snd_soc_dapm_widget *wsink, |
2340 | const char *control, | 2525 | const char *control, |
@@ -2365,6 +2550,10 @@ static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm, | |||
2365 | return -EINVAL; | 2550 | return -EINVAL; |
2366 | } | 2551 | } |
2367 | 2552 | ||
2553 | ret = snd_soc_dapm_check_dynamic_path(dapm, wsource, wsink, control); | ||
2554 | if (ret) | ||
2555 | return ret; | ||
2556 | |||
2368 | path = kzalloc(sizeof(struct snd_soc_dapm_path), GFP_KERNEL); | 2557 | path = kzalloc(sizeof(struct snd_soc_dapm_path), GFP_KERNEL); |
2369 | if (!path) | 2558 | if (!path) |
2370 | return -ENOMEM; | 2559 | return -ENOMEM; |
@@ -2384,10 +2573,19 @@ static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm, | |||
2384 | if (control == NULL) { | 2573 | if (control == NULL) { |
2385 | path->connect = 1; | 2574 | path->connect = 1; |
2386 | } else { | 2575 | } else { |
2387 | /* connect dynamic paths */ | 2576 | switch (wsource->id) { |
2577 | case snd_soc_dapm_demux: | ||
2578 | ret = dapm_connect_mux(dapm, path, control, wsource); | ||
2579 | if (ret) | ||
2580 | goto err; | ||
2581 | break; | ||
2582 | default: | ||
2583 | break; | ||
2584 | } | ||
2585 | |||
2388 | switch (wsink->id) { | 2586 | switch (wsink->id) { |
2389 | case snd_soc_dapm_mux: | 2587 | case snd_soc_dapm_mux: |
2390 | ret = dapm_connect_mux(dapm, path, control); | 2588 | ret = dapm_connect_mux(dapm, path, control, wsink); |
2391 | if (ret != 0) | 2589 | if (ret != 0) |
2392 | goto err; | 2590 | goto err; |
2393 | break; | 2591 | break; |
@@ -2399,11 +2597,7 @@ static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm, | |||
2399 | goto err; | 2597 | goto err; |
2400 | break; | 2598 | break; |
2401 | default: | 2599 | default: |
2402 | dev_err(dapm->dev, | 2600 | break; |
2403 | "Control not supported for path %s -> [%s] -> %s\n", | ||
2404 | wsource->name, control, wsink->name); | ||
2405 | ret = -EINVAL; | ||
2406 | goto err; | ||
2407 | } | 2601 | } |
2408 | } | 2602 | } |
2409 | 2603 | ||
@@ -2451,6 +2645,12 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, | |||
2451 | source = route->source; | 2645 | source = route->source; |
2452 | } | 2646 | } |
2453 | 2647 | ||
2648 | wsource = dapm_wcache_lookup(&dapm->path_source_cache, source); | ||
2649 | wsink = dapm_wcache_lookup(&dapm->path_sink_cache, sink); | ||
2650 | |||
2651 | if (wsink && wsource) | ||
2652 | goto skip_search; | ||
2653 | |||
2454 | /* | 2654 | /* |
2455 | * find src and dest widgets over all widgets but favor a widget from | 2655 | * find src and dest widgets over all widgets but favor a widget from |
2456 | * current DAPM context | 2656 | * current DAPM context |
@@ -2458,14 +2658,20 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, | |||
2458 | list_for_each_entry(w, &dapm->card->widgets, list) { | 2658 | list_for_each_entry(w, &dapm->card->widgets, list) { |
2459 | if (!wsink && !(strcmp(w->name, sink))) { | 2659 | if (!wsink && !(strcmp(w->name, sink))) { |
2460 | wtsink = w; | 2660 | wtsink = w; |
2461 | if (w->dapm == dapm) | 2661 | if (w->dapm == dapm) { |
2462 | wsink = w; | 2662 | wsink = w; |
2663 | if (wsource) | ||
2664 | break; | ||
2665 | } | ||
2463 | continue; | 2666 | continue; |
2464 | } | 2667 | } |
2465 | if (!wsource && !(strcmp(w->name, source))) { | 2668 | if (!wsource && !(strcmp(w->name, source))) { |
2466 | wtsource = w; | 2669 | wtsource = w; |
2467 | if (w->dapm == dapm) | 2670 | if (w->dapm == dapm) { |
2468 | wsource = w; | 2671 | wsource = w; |
2672 | if (wsink) | ||
2673 | break; | ||
2674 | } | ||
2469 | } | 2675 | } |
2470 | } | 2676 | } |
2471 | /* use widget from another DAPM context if not found from this */ | 2677 | /* use widget from another DAPM context if not found from this */ |
@@ -2485,6 +2691,10 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, | |||
2485 | return -ENODEV; | 2691 | return -ENODEV; |
2486 | } | 2692 | } |
2487 | 2693 | ||
2694 | skip_search: | ||
2695 | dapm_wcache_update(&dapm->path_sink_cache, wsink); | ||
2696 | dapm_wcache_update(&dapm->path_source_cache, wsource); | ||
2697 | |||
2488 | ret = snd_soc_dapm_add_path(dapm, wsource, wsink, route->control, | 2698 | ret = snd_soc_dapm_add_path(dapm, wsource, wsink, route->control, |
2489 | route->connected); | 2699 | route->connected); |
2490 | if (ret) | 2700 | if (ret) |
@@ -2736,6 +2946,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card) | |||
2736 | dapm_new_mixer(w); | 2946 | dapm_new_mixer(w); |
2737 | break; | 2947 | break; |
2738 | case snd_soc_dapm_mux: | 2948 | case snd_soc_dapm_mux: |
2949 | case snd_soc_dapm_demux: | ||
2739 | dapm_new_mux(w); | 2950 | dapm_new_mux(w); |
2740 | break; | 2951 | break; |
2741 | case snd_soc_dapm_pga: | 2952 | case snd_soc_dapm_pga: |
@@ -2902,16 +3113,21 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, | |||
2902 | struct snd_ctl_elem_value *ucontrol) | 3113 | struct snd_ctl_elem_value *ucontrol) |
2903 | { | 3114 | { |
2904 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); | 3115 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); |
3116 | struct snd_soc_card *card = dapm->card; | ||
2905 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 3117 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
2906 | unsigned int reg_val, val; | 3118 | unsigned int reg_val, val; |
2907 | 3119 | ||
2908 | if (e->reg != SND_SOC_NOPM) { | 3120 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); |
3121 | if (e->reg != SND_SOC_NOPM && dapm_kcontrol_is_powered(kcontrol)) { | ||
2909 | int ret = soc_dapm_read(dapm, e->reg, ®_val); | 3122 | int ret = soc_dapm_read(dapm, e->reg, ®_val); |
2910 | if (ret) | 3123 | if (ret) { |
3124 | mutex_unlock(&card->dapm_mutex); | ||
2911 | return ret; | 3125 | return ret; |
3126 | } | ||
2912 | } else { | 3127 | } else { |
2913 | reg_val = dapm_kcontrol_get_value(kcontrol); | 3128 | reg_val = dapm_kcontrol_get_value(kcontrol); |
2914 | } | 3129 | } |
3130 | mutex_unlock(&card->dapm_mutex); | ||
2915 | 3131 | ||
2916 | val = (reg_val >> e->shift_l) & e->mask; | 3132 | val = (reg_val >> e->shift_l) & e->mask; |
2917 | ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(e, val); | 3133 | ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(e, val); |
@@ -2941,7 +3157,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, | |||
2941 | struct snd_soc_card *card = dapm->card; | 3157 | struct snd_soc_card *card = dapm->card; |
2942 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 3158 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
2943 | unsigned int *item = ucontrol->value.enumerated.item; | 3159 | unsigned int *item = ucontrol->value.enumerated.item; |
2944 | unsigned int val, change; | 3160 | unsigned int val, change, reg_change = 0; |
2945 | unsigned int mask; | 3161 | unsigned int mask; |
2946 | struct snd_soc_dapm_update update; | 3162 | struct snd_soc_dapm_update update; |
2947 | int ret = 0; | 3163 | int ret = 0; |
@@ -2960,19 +3176,20 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, | |||
2960 | 3176 | ||
2961 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | 3177 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); |
2962 | 3178 | ||
3179 | change = dapm_kcontrol_set_value(kcontrol, val); | ||
3180 | |||
2963 | if (e->reg != SND_SOC_NOPM) | 3181 | if (e->reg != SND_SOC_NOPM) |
2964 | change = soc_dapm_test_bits(dapm, e->reg, mask, val); | 3182 | reg_change = soc_dapm_test_bits(dapm, e->reg, mask, val); |
2965 | else | ||
2966 | change = dapm_kcontrol_set_value(kcontrol, val); | ||
2967 | 3183 | ||
2968 | if (change) { | 3184 | if (change || reg_change) { |
2969 | if (e->reg != SND_SOC_NOPM) { | 3185 | if (reg_change) { |
2970 | update.kcontrol = kcontrol; | 3186 | update.kcontrol = kcontrol; |
2971 | update.reg = e->reg; | 3187 | update.reg = e->reg; |
2972 | update.mask = mask; | 3188 | update.mask = mask; |
2973 | update.val = val; | 3189 | update.val = val; |
2974 | card->update = &update; | 3190 | card->update = &update; |
2975 | } | 3191 | } |
3192 | change |= reg_change; | ||
2976 | 3193 | ||
2977 | ret = soc_dapm_mux_update_power(card, kcontrol, item[0], e); | 3194 | ret = soc_dapm_mux_update_power(card, kcontrol, item[0], e); |
2978 | 3195 | ||
@@ -3053,8 +3270,25 @@ int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, | |||
3053 | } | 3270 | } |
3054 | EXPORT_SYMBOL_GPL(snd_soc_dapm_put_pin_switch); | 3271 | EXPORT_SYMBOL_GPL(snd_soc_dapm_put_pin_switch); |
3055 | 3272 | ||
3056 | static struct snd_soc_dapm_widget * | 3273 | struct snd_soc_dapm_widget * |
3057 | snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | 3274 | snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, |
3275 | const struct snd_soc_dapm_widget *widget) | ||
3276 | { | ||
3277 | struct snd_soc_dapm_widget *w; | ||
3278 | |||
3279 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3280 | w = snd_soc_dapm_new_control_unlocked(dapm, widget); | ||
3281 | if (!w) | ||
3282 | dev_err(dapm->dev, | ||
3283 | "ASoC: Failed to create DAPM control %s\n", | ||
3284 | widget->name); | ||
3285 | |||
3286 | mutex_unlock(&dapm->card->dapm_mutex); | ||
3287 | return w; | ||
3288 | } | ||
3289 | |||
3290 | struct snd_soc_dapm_widget * | ||
3291 | snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, | ||
3058 | const struct snd_soc_dapm_widget *widget) | 3292 | const struct snd_soc_dapm_widget *widget) |
3059 | { | 3293 | { |
3060 | struct snd_soc_dapm_widget *w; | 3294 | struct snd_soc_dapm_widget *w; |
@@ -3136,6 +3370,7 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | |||
3136 | w->power_check = dapm_always_on_check_power; | 3370 | w->power_check = dapm_always_on_check_power; |
3137 | break; | 3371 | break; |
3138 | case snd_soc_dapm_mux: | 3372 | case snd_soc_dapm_mux: |
3373 | case snd_soc_dapm_demux: | ||
3139 | case snd_soc_dapm_switch: | 3374 | case snd_soc_dapm_switch: |
3140 | case snd_soc_dapm_mixer: | 3375 | case snd_soc_dapm_mixer: |
3141 | case snd_soc_dapm_mixer_named_ctl: | 3376 | case snd_soc_dapm_mixer_named_ctl: |
@@ -3199,7 +3434,7 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, | |||
3199 | 3434 | ||
3200 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); | 3435 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); |
3201 | for (i = 0; i < num; i++) { | 3436 | for (i = 0; i < num; i++) { |
3202 | w = snd_soc_dapm_new_control(dapm, widget); | 3437 | w = snd_soc_dapm_new_control_unlocked(dapm, widget); |
3203 | if (!w) { | 3438 | if (!w) { |
3204 | dev_err(dapm->dev, | 3439 | dev_err(dapm->dev, |
3205 | "ASoC: Failed to create DAPM control %s\n", | 3440 | "ASoC: Failed to create DAPM control %s\n", |
@@ -3437,7 +3672,7 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card, | |||
3437 | 3672 | ||
3438 | dev_dbg(card->dev, "ASoC: adding %s widget\n", link_name); | 3673 | dev_dbg(card->dev, "ASoC: adding %s widget\n", link_name); |
3439 | 3674 | ||
3440 | w = snd_soc_dapm_new_control(&card->dapm, &template); | 3675 | w = snd_soc_dapm_new_control_unlocked(&card->dapm, &template); |
3441 | if (!w) { | 3676 | if (!w) { |
3442 | dev_err(card->dev, "ASoC: Failed to create %s widget\n", | 3677 | dev_err(card->dev, "ASoC: Failed to create %s widget\n", |
3443 | link_name); | 3678 | link_name); |
@@ -3488,7 +3723,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, | |||
3488 | dev_dbg(dai->dev, "ASoC: adding %s widget\n", | 3723 | dev_dbg(dai->dev, "ASoC: adding %s widget\n", |
3489 | template.name); | 3724 | template.name); |
3490 | 3725 | ||
3491 | w = snd_soc_dapm_new_control(dapm, &template); | 3726 | w = snd_soc_dapm_new_control_unlocked(dapm, &template); |
3492 | if (!w) { | 3727 | if (!w) { |
3493 | dev_err(dapm->dev, "ASoC: Failed to create %s widget\n", | 3728 | dev_err(dapm->dev, "ASoC: Failed to create %s widget\n", |
3494 | dai->driver->playback.stream_name); | 3729 | dai->driver->playback.stream_name); |
@@ -3507,7 +3742,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, | |||
3507 | dev_dbg(dai->dev, "ASoC: adding %s widget\n", | 3742 | dev_dbg(dai->dev, "ASoC: adding %s widget\n", |
3508 | template.name); | 3743 | template.name); |
3509 | 3744 | ||
3510 | w = snd_soc_dapm_new_control(dapm, &template); | 3745 | w = snd_soc_dapm_new_control_unlocked(dapm, &template); |
3511 | if (!w) { | 3746 | if (!w) { |
3512 | dev_err(dapm->dev, "ASoC: Failed to create %s widget\n", | 3747 | dev_err(dapm->dev, "ASoC: Failed to create %s widget\n", |
3513 | dai->driver->capture.stream_name); | 3748 | dai->driver->capture.stream_name); |