diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-10-08 05:36:09 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-11-23 10:15:08 -0500 |
commit | d9dd4ada0edb96eaf3ba9b69fc2ffdd525ee7e0c (patch) | |
tree | 4fd77750135a4f1c27ca4c59fe47b69d27d47c3e | |
parent | a8a8fc287dd7497b3adb2f2952513849ab6506eb (diff) |
ASoC: wm8994: Use pdata cached in MFD driver
This is better style and facilitates implementation of device tree support
for the driver.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/codecs/wm8958-dsp2.c | 48 | ||||
-rw-r--r-- | sound/soc/codecs/wm8994.c | 50 | ||||
-rw-r--r-- | sound/soc/codecs/wm8994.h | 1 |
3 files changed, 51 insertions, 48 deletions
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c index bff96500c3f3..b0710d817a65 100644 --- a/sound/soc/codecs/wm8958-dsp2.c +++ b/sound/soc/codecs/wm8958-dsp2.c | |||
@@ -195,7 +195,7 @@ ok: | |||
195 | static void wm8958_dsp_start_mbc(struct snd_soc_codec *codec, int path) | 195 | static void wm8958_dsp_start_mbc(struct snd_soc_codec *codec, int path) |
196 | { | 196 | { |
197 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 197 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
198 | struct wm8994_pdata *pdata = wm8994->pdata; | 198 | struct wm8994 *control = wm8994->wm8994; |
199 | int i; | 199 | int i; |
200 | 200 | ||
201 | /* If the DSP is already running then noop */ | 201 | /* If the DSP is already running then noop */ |
@@ -210,9 +210,9 @@ static void wm8958_dsp_start_mbc(struct snd_soc_codec *codec, int path) | |||
210 | WM8958_DSP2_ENA, WM8958_DSP2_ENA); | 210 | WM8958_DSP2_ENA, WM8958_DSP2_ENA); |
211 | 211 | ||
212 | /* If we've got user supplied MBC settings use them */ | 212 | /* If we've got user supplied MBC settings use them */ |
213 | if (pdata && pdata->num_mbc_cfgs) { | 213 | if (control->pdata.num_mbc_cfgs) { |
214 | struct wm8958_mbc_cfg *cfg | 214 | struct wm8958_mbc_cfg *cfg |
215 | = &pdata->mbc_cfgs[wm8994->mbc_cfg]; | 215 | = &control->pdata.mbc_cfgs[wm8994->mbc_cfg]; |
216 | 216 | ||
217 | for (i = 0; i < ARRAY_SIZE(cfg->coeff_regs); i++) | 217 | for (i = 0; i < ARRAY_SIZE(cfg->coeff_regs); i++) |
218 | snd_soc_write(codec, i + WM8958_MBC_BAND_1_K_1, | 218 | snd_soc_write(codec, i + WM8958_MBC_BAND_1_K_1, |
@@ -239,7 +239,7 @@ static void wm8958_dsp_start_mbc(struct snd_soc_codec *codec, int path) | |||
239 | static void wm8958_dsp_start_vss(struct snd_soc_codec *codec, int path) | 239 | static void wm8958_dsp_start_vss(struct snd_soc_codec *codec, int path) |
240 | { | 240 | { |
241 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 241 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
242 | struct wm8994_pdata *pdata = wm8994->pdata; | 242 | struct wm8994 *control = wm8994->wm8994; |
243 | int i, ena; | 243 | int i, ena; |
244 | 244 | ||
245 | if (wm8994->mbc_vss) | 245 | if (wm8994->mbc_vss) |
@@ -249,26 +249,26 @@ static void wm8958_dsp_start_vss(struct snd_soc_codec *codec, int path) | |||
249 | WM8958_DSP2_ENA, WM8958_DSP2_ENA); | 249 | WM8958_DSP2_ENA, WM8958_DSP2_ENA); |
250 | 250 | ||
251 | /* If we've got user supplied settings use them */ | 251 | /* If we've got user supplied settings use them */ |
252 | if (pdata && pdata->num_mbc_cfgs) { | 252 | if (control->pdata.num_mbc_cfgs) { |
253 | struct wm8958_mbc_cfg *cfg | 253 | struct wm8958_mbc_cfg *cfg |
254 | = &pdata->mbc_cfgs[wm8994->mbc_cfg]; | 254 | = &control->pdata.mbc_cfgs[wm8994->mbc_cfg]; |
255 | 255 | ||
256 | for (i = 0; i < ARRAY_SIZE(cfg->combined_regs); i++) | 256 | for (i = 0; i < ARRAY_SIZE(cfg->combined_regs); i++) |
257 | snd_soc_write(codec, i + 0x2800, | 257 | snd_soc_write(codec, i + 0x2800, |
258 | cfg->combined_regs[i]); | 258 | cfg->combined_regs[i]); |
259 | } | 259 | } |
260 | 260 | ||
261 | if (pdata && pdata->num_vss_cfgs) { | 261 | if (control->pdata.num_vss_cfgs) { |
262 | struct wm8958_vss_cfg *cfg | 262 | struct wm8958_vss_cfg *cfg |
263 | = &pdata->vss_cfgs[wm8994->vss_cfg]; | 263 | = &control->pdata.vss_cfgs[wm8994->vss_cfg]; |
264 | 264 | ||
265 | for (i = 0; i < ARRAY_SIZE(cfg->regs); i++) | 265 | for (i = 0; i < ARRAY_SIZE(cfg->regs); i++) |
266 | snd_soc_write(codec, i + 0x2600, cfg->regs[i]); | 266 | snd_soc_write(codec, i + 0x2600, cfg->regs[i]); |
267 | } | 267 | } |
268 | 268 | ||
269 | if (pdata && pdata->num_vss_hpf_cfgs) { | 269 | if (control->pdata.num_vss_hpf_cfgs) { |
270 | struct wm8958_vss_hpf_cfg *cfg | 270 | struct wm8958_vss_hpf_cfg *cfg |
271 | = &pdata->vss_hpf_cfgs[wm8994->vss_hpf_cfg]; | 271 | = &control->pdata.vss_hpf_cfgs[wm8994->vss_hpf_cfg]; |
272 | 272 | ||
273 | for (i = 0; i < ARRAY_SIZE(cfg->regs); i++) | 273 | for (i = 0; i < ARRAY_SIZE(cfg->regs); i++) |
274 | snd_soc_write(codec, i + 0x2400, cfg->regs[i]); | 274 | snd_soc_write(codec, i + 0x2400, cfg->regs[i]); |
@@ -300,7 +300,7 @@ static void wm8958_dsp_start_vss(struct snd_soc_codec *codec, int path) | |||
300 | static void wm8958_dsp_start_enh_eq(struct snd_soc_codec *codec, int path) | 300 | static void wm8958_dsp_start_enh_eq(struct snd_soc_codec *codec, int path) |
301 | { | 301 | { |
302 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 302 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
303 | struct wm8994_pdata *pdata = wm8994->pdata; | 303 | struct wm8994 *control = wm8994->wm8994; |
304 | int i; | 304 | int i; |
305 | 305 | ||
306 | wm8958_dsp2_fw(codec, "ENH_EQ", wm8994->enh_eq, false); | 306 | wm8958_dsp2_fw(codec, "ENH_EQ", wm8994->enh_eq, false); |
@@ -309,9 +309,9 @@ static void wm8958_dsp_start_enh_eq(struct snd_soc_codec *codec, int path) | |||
309 | WM8958_DSP2_ENA, WM8958_DSP2_ENA); | 309 | WM8958_DSP2_ENA, WM8958_DSP2_ENA); |
310 | 310 | ||
311 | /* If we've got user supplied settings use them */ | 311 | /* If we've got user supplied settings use them */ |
312 | if (pdata && pdata->num_enh_eq_cfgs) { | 312 | if (control->pdata.num_enh_eq_cfgs) { |
313 | struct wm8958_enh_eq_cfg *cfg | 313 | struct wm8958_enh_eq_cfg *cfg |
314 | = &pdata->enh_eq_cfgs[wm8994->enh_eq_cfg]; | 314 | = &control->pdata.enh_eq_cfgs[wm8994->enh_eq_cfg]; |
315 | 315 | ||
316 | for (i = 0; i < ARRAY_SIZE(cfg->regs); i++) | 316 | for (i = 0; i < ARRAY_SIZE(cfg->regs); i++) |
317 | snd_soc_write(codec, i + 0x2200, | 317 | snd_soc_write(codec, i + 0x2200, |
@@ -458,7 +458,7 @@ static int wm8958_put_mbc_enum(struct snd_kcontrol *kcontrol, | |||
458 | { | 458 | { |
459 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 459 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
460 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 460 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
461 | struct wm8994_pdata *pdata = wm8994->pdata; | 461 | struct wm8994 *control = wm8994->wm8994; |
462 | int value = ucontrol->value.integer.value[0]; | 462 | int value = ucontrol->value.integer.value[0]; |
463 | int reg; | 463 | int reg; |
464 | 464 | ||
@@ -467,7 +467,7 @@ static int wm8958_put_mbc_enum(struct snd_kcontrol *kcontrol, | |||
467 | if (reg < 0 || reg & WM8958_DSP2CLK_ENA) | 467 | if (reg < 0 || reg & WM8958_DSP2CLK_ENA) |
468 | return -EBUSY; | 468 | return -EBUSY; |
469 | 469 | ||
470 | if (value >= pdata->num_mbc_cfgs) | 470 | if (value >= control->pdata.num_mbc_cfgs) |
471 | return -EINVAL; | 471 | return -EINVAL; |
472 | 472 | ||
473 | wm8994->mbc_cfg = value; | 473 | wm8994->mbc_cfg = value; |
@@ -548,7 +548,7 @@ static int wm8958_put_vss_enum(struct snd_kcontrol *kcontrol, | |||
548 | { | 548 | { |
549 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 549 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
550 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 550 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
551 | struct wm8994_pdata *pdata = wm8994->pdata; | 551 | struct wm8994 *control = wm8994->wm8994; |
552 | int value = ucontrol->value.integer.value[0]; | 552 | int value = ucontrol->value.integer.value[0]; |
553 | int reg; | 553 | int reg; |
554 | 554 | ||
@@ -557,7 +557,7 @@ static int wm8958_put_vss_enum(struct snd_kcontrol *kcontrol, | |||
557 | if (reg < 0 || reg & WM8958_DSP2CLK_ENA) | 557 | if (reg < 0 || reg & WM8958_DSP2CLK_ENA) |
558 | return -EBUSY; | 558 | return -EBUSY; |
559 | 559 | ||
560 | if (value >= pdata->num_vss_cfgs) | 560 | if (value >= control->pdata.num_vss_cfgs) |
561 | return -EINVAL; | 561 | return -EINVAL; |
562 | 562 | ||
563 | wm8994->vss_cfg = value; | 563 | wm8994->vss_cfg = value; |
@@ -581,7 +581,7 @@ static int wm8958_put_vss_hpf_enum(struct snd_kcontrol *kcontrol, | |||
581 | { | 581 | { |
582 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 582 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
583 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 583 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
584 | struct wm8994_pdata *pdata = wm8994->pdata; | 584 | struct wm8994 *control = wm8994->wm8994; |
585 | int value = ucontrol->value.integer.value[0]; | 585 | int value = ucontrol->value.integer.value[0]; |
586 | int reg; | 586 | int reg; |
587 | 587 | ||
@@ -590,7 +590,7 @@ static int wm8958_put_vss_hpf_enum(struct snd_kcontrol *kcontrol, | |||
590 | if (reg < 0 || reg & WM8958_DSP2CLK_ENA) | 590 | if (reg < 0 || reg & WM8958_DSP2CLK_ENA) |
591 | return -EBUSY; | 591 | return -EBUSY; |
592 | 592 | ||
593 | if (value >= pdata->num_vss_hpf_cfgs) | 593 | if (value >= control->pdata.num_vss_hpf_cfgs) |
594 | return -EINVAL; | 594 | return -EINVAL; |
595 | 595 | ||
596 | wm8994->vss_hpf_cfg = value; | 596 | wm8994->vss_hpf_cfg = value; |
@@ -748,7 +748,7 @@ static int wm8958_put_enh_eq_enum(struct snd_kcontrol *kcontrol, | |||
748 | { | 748 | { |
749 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 749 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
750 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 750 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
751 | struct wm8994_pdata *pdata = wm8994->pdata; | 751 | struct wm8994 *control = wm8994->wm8994; |
752 | int value = ucontrol->value.integer.value[0]; | 752 | int value = ucontrol->value.integer.value[0]; |
753 | int reg; | 753 | int reg; |
754 | 754 | ||
@@ -757,7 +757,7 @@ static int wm8958_put_enh_eq_enum(struct snd_kcontrol *kcontrol, | |||
757 | if (reg < 0 || reg & WM8958_DSP2CLK_ENA) | 757 | if (reg < 0 || reg & WM8958_DSP2CLK_ENA) |
758 | return -EBUSY; | 758 | return -EBUSY; |
759 | 759 | ||
760 | if (value >= pdata->num_enh_eq_cfgs) | 760 | if (value >= control->pdata.num_enh_eq_cfgs) |
761 | return -EINVAL; | 761 | return -EINVAL; |
762 | 762 | ||
763 | wm8994->enh_eq_cfg = value; | 763 | wm8994->enh_eq_cfg = value; |
@@ -900,7 +900,8 @@ static void wm8958_mbc_loaded(const struct firmware *fw, void *context) | |||
900 | void wm8958_dsp2_init(struct snd_soc_codec *codec) | 900 | void wm8958_dsp2_init(struct snd_soc_codec *codec) |
901 | { | 901 | { |
902 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 902 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
903 | struct wm8994_pdata *pdata = wm8994->pdata; | 903 | struct wm8994 *control = wm8994->wm8994; |
904 | struct wm8994_pdata *pdata = &control->pdata; | ||
904 | int ret, i; | 905 | int ret, i; |
905 | 906 | ||
906 | wm8994->dsp_active = -1; | 907 | wm8994->dsp_active = -1; |
@@ -924,9 +925,6 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec) | |||
924 | "wm8958_enh_eq.wfw", codec->dev, GFP_KERNEL, | 925 | "wm8958_enh_eq.wfw", codec->dev, GFP_KERNEL, |
925 | codec, wm8958_enh_eq_loaded); | 926 | codec, wm8958_enh_eq_loaded); |
926 | 927 | ||
927 | if (!pdata) | ||
928 | return; | ||
929 | |||
930 | if (pdata->num_mbc_cfgs) { | 928 | if (pdata->num_mbc_cfgs) { |
931 | struct snd_kcontrol_new control[] = { | 929 | struct snd_kcontrol_new control[] = { |
932 | SOC_ENUM_EXT("MBC Mode", wm8994->mbc_enum, | 930 | SOC_ENUM_EXT("MBC Mode", wm8994->mbc_enum, |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index ab332e380fb3..97f550b0e289 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -110,13 +110,13 @@ static const struct wm8958_micd_rate jackdet_rates[] = { | |||
110 | static void wm8958_micd_set_rate(struct snd_soc_codec *codec) | 110 | static void wm8958_micd_set_rate(struct snd_soc_codec *codec) |
111 | { | 111 | { |
112 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 112 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
113 | struct wm8994 *control = wm8994->wm8994; | ||
113 | int best, i, sysclk, val; | 114 | int best, i, sysclk, val; |
114 | bool idle; | 115 | bool idle; |
115 | const struct wm8958_micd_rate *rates; | 116 | const struct wm8958_micd_rate *rates; |
116 | int num_rates; | 117 | int num_rates; |
117 | 118 | ||
118 | if (!(wm8994->pdata && wm8994->pdata->micd_rates) && | 119 | if (wm8994->jack_cb != wm8958_default_micdet) |
119 | wm8994->jack_cb != wm8958_default_micdet) | ||
120 | return; | 120 | return; |
121 | 121 | ||
122 | idle = !wm8994->jack_mic; | 122 | idle = !wm8994->jack_mic; |
@@ -127,9 +127,9 @@ static void wm8958_micd_set_rate(struct snd_soc_codec *codec) | |||
127 | else | 127 | else |
128 | sysclk = wm8994->aifclk[0]; | 128 | sysclk = wm8994->aifclk[0]; |
129 | 129 | ||
130 | if (wm8994->pdata && wm8994->pdata->micd_rates) { | 130 | if (control->pdata.micd_rates) { |
131 | rates = wm8994->pdata->micd_rates; | 131 | rates = control->pdata.micd_rates; |
132 | num_rates = wm8994->pdata->num_micd_rates; | 132 | num_rates = control->pdata.num_micd_rates; |
133 | } else if (wm8994->jackdet) { | 133 | } else if (wm8994->jackdet) { |
134 | rates = jackdet_rates; | 134 | rates = jackdet_rates; |
135 | num_rates = ARRAY_SIZE(jackdet_rates); | 135 | num_rates = ARRAY_SIZE(jackdet_rates); |
@@ -326,7 +326,8 @@ static int wm8994_put_drc_sw(struct snd_kcontrol *kcontrol, | |||
326 | static void wm8994_set_drc(struct snd_soc_codec *codec, int drc) | 326 | static void wm8994_set_drc(struct snd_soc_codec *codec, int drc) |
327 | { | 327 | { |
328 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 328 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
329 | struct wm8994_pdata *pdata = wm8994->pdata; | 329 | struct wm8994 *control = wm8994->wm8994; |
330 | struct wm8994_pdata *pdata = &control->pdata; | ||
330 | int base = wm8994_drc_base[drc]; | 331 | int base = wm8994_drc_base[drc]; |
331 | int cfg = wm8994->drc_cfg[drc]; | 332 | int cfg = wm8994->drc_cfg[drc]; |
332 | int save, i; | 333 | int save, i; |
@@ -362,7 +363,8 @@ static int wm8994_put_drc_enum(struct snd_kcontrol *kcontrol, | |||
362 | { | 363 | { |
363 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 364 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
364 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 365 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
365 | struct wm8994_pdata *pdata = wm8994->pdata; | 366 | struct wm8994 *control = wm8994->wm8994; |
367 | struct wm8994_pdata *pdata = &control->pdata; | ||
366 | int drc = wm8994_get_drc(kcontrol->id.name); | 368 | int drc = wm8994_get_drc(kcontrol->id.name); |
367 | int value = ucontrol->value.integer.value[0]; | 369 | int value = ucontrol->value.integer.value[0]; |
368 | 370 | ||
@@ -394,7 +396,8 @@ static int wm8994_get_drc_enum(struct snd_kcontrol *kcontrol, | |||
394 | static void wm8994_set_retune_mobile(struct snd_soc_codec *codec, int block) | 396 | static void wm8994_set_retune_mobile(struct snd_soc_codec *codec, int block) |
395 | { | 397 | { |
396 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 398 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
397 | struct wm8994_pdata *pdata = wm8994->pdata; | 399 | struct wm8994 *control = wm8994->wm8994; |
400 | struct wm8994_pdata *pdata = &control->pdata; | ||
398 | int base = wm8994_retune_mobile_base[block]; | 401 | int base = wm8994_retune_mobile_base[block]; |
399 | int iface, best, best_val, save, i, cfg; | 402 | int iface, best, best_val, save, i, cfg; |
400 | 403 | ||
@@ -465,7 +468,8 @@ static int wm8994_put_retune_mobile_enum(struct snd_kcontrol *kcontrol, | |||
465 | { | 468 | { |
466 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 469 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
467 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 470 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
468 | struct wm8994_pdata *pdata = wm8994->pdata; | 471 | struct wm8994 *control = wm8994->wm8994; |
472 | struct wm8994_pdata *pdata = &control->pdata; | ||
469 | int block = wm8994_get_retune_mobile_block(kcontrol->id.name); | 473 | int block = wm8994_get_retune_mobile_block(kcontrol->id.name); |
470 | int value = ucontrol->value.integer.value[0]; | 474 | int value = ucontrol->value.integer.value[0]; |
471 | 475 | ||
@@ -3076,7 +3080,8 @@ static int wm8994_codec_resume(struct snd_soc_codec *codec) | |||
3076 | static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994) | 3080 | static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994) |
3077 | { | 3081 | { |
3078 | struct snd_soc_codec *codec = wm8994->hubs.codec; | 3082 | struct snd_soc_codec *codec = wm8994->hubs.codec; |
3079 | struct wm8994_pdata *pdata = wm8994->pdata; | 3083 | struct wm8994 *control = wm8994->wm8994; |
3084 | struct wm8994_pdata *pdata = &control->pdata; | ||
3080 | struct snd_kcontrol_new controls[] = { | 3085 | struct snd_kcontrol_new controls[] = { |
3081 | SOC_ENUM_EXT("AIF1.1 EQ Mode", | 3086 | SOC_ENUM_EXT("AIF1.1 EQ Mode", |
3082 | wm8994->retune_mobile_enum, | 3087 | wm8994->retune_mobile_enum, |
@@ -3143,7 +3148,8 @@ static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994) | |||
3143 | static void wm8994_handle_pdata(struct wm8994_priv *wm8994) | 3148 | static void wm8994_handle_pdata(struct wm8994_priv *wm8994) |
3144 | { | 3149 | { |
3145 | struct snd_soc_codec *codec = wm8994->hubs.codec; | 3150 | struct snd_soc_codec *codec = wm8994->hubs.codec; |
3146 | struct wm8994_pdata *pdata = wm8994->pdata; | 3151 | struct wm8994 *control = wm8994->wm8994; |
3152 | struct wm8994_pdata *pdata = &control->pdata; | ||
3147 | int ret, i; | 3153 | int ret, i; |
3148 | 3154 | ||
3149 | if (!pdata) | 3155 | if (!pdata) |
@@ -3445,7 +3451,7 @@ static void wm8958_default_micdet(u16 status, void *data) | |||
3445 | 3451 | ||
3446 | mutex_unlock(&wm8994->accdet_lock); | 3452 | mutex_unlock(&wm8994->accdet_lock); |
3447 | 3453 | ||
3448 | if (wm8994->pdata->jd_ext_cap) | 3454 | if (wm8994->wm8994->pdata.jd_ext_cap) |
3449 | snd_soc_dapm_disable_pin(&codec->dapm, | 3455 | snd_soc_dapm_disable_pin(&codec->dapm, |
3450 | "MICBIAS2"); | 3456 | "MICBIAS2"); |
3451 | } | 3457 | } |
@@ -3485,12 +3491,13 @@ static void wm1811_mic_work(struct work_struct *work) | |||
3485 | { | 3491 | { |
3486 | struct wm8994_priv *wm8994 = container_of(work, struct wm8994_priv, | 3492 | struct wm8994_priv *wm8994 = container_of(work, struct wm8994_priv, |
3487 | mic_work.work); | 3493 | mic_work.work); |
3494 | struct wm8994 *control = wm8994->wm8994; | ||
3488 | struct snd_soc_codec *codec = wm8994->hubs.codec; | 3495 | struct snd_soc_codec *codec = wm8994->hubs.codec; |
3489 | 3496 | ||
3490 | pm_runtime_get_sync(codec->dev); | 3497 | pm_runtime_get_sync(codec->dev); |
3491 | 3498 | ||
3492 | /* If required for an external cap force MICBIAS on */ | 3499 | /* If required for an external cap force MICBIAS on */ |
3493 | if (wm8994->pdata->jd_ext_cap) { | 3500 | if (control->pdata.jd_ext_cap) { |
3494 | snd_soc_dapm_force_enable_pin(&codec->dapm, | 3501 | snd_soc_dapm_force_enable_pin(&codec->dapm, |
3495 | "MICBIAS2"); | 3502 | "MICBIAS2"); |
3496 | snd_soc_dapm_sync(&codec->dapm); | 3503 | snd_soc_dapm_sync(&codec->dapm); |
@@ -3518,6 +3525,7 @@ static void wm1811_mic_work(struct work_struct *work) | |||
3518 | static irqreturn_t wm1811_jackdet_irq(int irq, void *data) | 3525 | static irqreturn_t wm1811_jackdet_irq(int irq, void *data) |
3519 | { | 3526 | { |
3520 | struct wm8994_priv *wm8994 = data; | 3527 | struct wm8994_priv *wm8994 = data; |
3528 | struct wm8994 *control = wm8994->wm8994; | ||
3521 | struct snd_soc_codec *codec = wm8994->hubs.codec; | 3529 | struct snd_soc_codec *codec = wm8994->hubs.codec; |
3522 | int reg, delay; | 3530 | int reg, delay; |
3523 | bool present; | 3531 | bool present; |
@@ -3550,7 +3558,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data) | |||
3550 | snd_soc_update_bits(codec, WM1811_JACKDET_CTRL, | 3558 | snd_soc_update_bits(codec, WM1811_JACKDET_CTRL, |
3551 | WM1811_JACKDET_DB, 0); | 3559 | WM1811_JACKDET_DB, 0); |
3552 | 3560 | ||
3553 | delay = wm8994->pdata->micdet_delay; | 3561 | delay = control->pdata.micdet_delay; |
3554 | schedule_delayed_work(&wm8994->mic_work, | 3562 | schedule_delayed_work(&wm8994->mic_work, |
3555 | msecs_to_jiffies(delay)); | 3563 | msecs_to_jiffies(delay)); |
3556 | } else { | 3564 | } else { |
@@ -3575,7 +3583,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data) | |||
3575 | mutex_unlock(&wm8994->accdet_lock); | 3583 | mutex_unlock(&wm8994->accdet_lock); |
3576 | 3584 | ||
3577 | /* Turn off MICBIAS if it was on for an external cap */ | 3585 | /* Turn off MICBIAS if it was on for an external cap */ |
3578 | if (wm8994->pdata->jd_ext_cap && !present) | 3586 | if (control->pdata.jd_ext_cap && !present) |
3579 | snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS2"); | 3587 | snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS2"); |
3580 | 3588 | ||
3581 | if (present) | 3589 | if (present) |
@@ -3653,8 +3661,8 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
3653 | wm8958_micd_set_rate(codec); | 3661 | wm8958_micd_set_rate(codec); |
3654 | 3662 | ||
3655 | /* Detect microphones and short circuits by default */ | 3663 | /* Detect microphones and short circuits by default */ |
3656 | if (wm8994->pdata->micd_lvl_sel) | 3664 | if (control->pdata.micd_lvl_sel) |
3657 | micd_lvl_sel = wm8994->pdata->micd_lvl_sel; | 3665 | micd_lvl_sel = control->pdata.micd_lvl_sel; |
3658 | else | 3666 | else |
3659 | micd_lvl_sel = 0x41; | 3667 | micd_lvl_sel = 0x41; |
3660 | 3668 | ||
@@ -3816,8 +3824,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3816 | for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) | 3824 | for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) |
3817 | init_completion(&wm8994->fll_locked[i]); | 3825 | init_completion(&wm8994->fll_locked[i]); |
3818 | 3826 | ||
3819 | if (wm8994->pdata && wm8994->pdata->micdet_irq) | 3827 | wm8994->micdet_irq = control->pdata.micdet_irq; |
3820 | wm8994->micdet_irq = wm8994->pdata->micdet_irq; | ||
3821 | 3828 | ||
3822 | pm_runtime_enable(codec->dev); | 3829 | pm_runtime_enable(codec->dev); |
3823 | pm_runtime_idle(codec->dev); | 3830 | pm_runtime_idle(codec->dev); |
@@ -3830,8 +3837,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3830 | switch (control->type) { | 3837 | switch (control->type) { |
3831 | case WM8994: | 3838 | case WM8994: |
3832 | /* Single ended line outputs should have VMID on. */ | 3839 | /* Single ended line outputs should have VMID on. */ |
3833 | if (!wm8994->pdata->lineout1_diff || | 3840 | if (!control->pdata.lineout1_diff || |
3834 | !wm8994->pdata->lineout2_diff) | 3841 | !control->pdata.lineout2_diff) |
3835 | codec->dapm.idle_bias_off = 0; | 3842 | codec->dapm.idle_bias_off = 0; |
3836 | 3843 | ||
3837 | switch (wm8994->revision) { | 3844 | switch (wm8994->revision) { |
@@ -4266,7 +4273,6 @@ static int __devinit wm8994_probe(struct platform_device *pdev) | |||
4266 | platform_set_drvdata(pdev, wm8994); | 4273 | platform_set_drvdata(pdev, wm8994); |
4267 | 4274 | ||
4268 | wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent); | 4275 | wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent); |
4269 | wm8994->pdata = dev_get_platdata(pdev->dev.parent); | ||
4270 | 4276 | ||
4271 | return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8994, | 4277 | return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8994, |
4272 | wm8994_dai, ARRAY_SIZE(wm8994_dai)); | 4278 | wm8994_dai, ARRAY_SIZE(wm8994_dai)); |
diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index f142ec198db3..f618d16e1a12 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h | |||
@@ -142,7 +142,6 @@ struct wm8994_priv { | |||
142 | int micdet_irq; | 142 | int micdet_irq; |
143 | 143 | ||
144 | int revision; | 144 | int revision; |
145 | struct wm8994_pdata *pdata; | ||
146 | 145 | ||
147 | unsigned int aif1clk_enable:1; | 146 | unsigned int aif1clk_enable:1; |
148 | unsigned int aif2clk_enable:1; | 147 | unsigned int aif2clk_enable:1; |