diff options
| author | Lars-Peter Clausen <lars@metafoo.de> | 2015-06-01 04:11:00 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2015-06-01 11:45:40 -0400 |
| commit | 8e09bac78a48f738f3a180fe213198ab225c807e (patch) | |
| tree | f8b2571dc7473e33813f511efdaedbe008ddf815 | |
| parent | f8ae3cf81fb866a0d91e3319f53d6ed0a599616e (diff) | |
ASoC: wm8994: Replace direct snd_soc_codec dapm field access
The dapm field of the snd_soc_codec struct is eventually going to be
removed, in preparation for this replace all manual access to
codec->dapm.bias_level with snd_soc_codec_get_bias_level() and replace all
other manual access to codec->dapm with snd_soc_codec_get_dapm().
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | sound/soc/codecs/wm8994.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 2d32b542f103..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,7 +2542,7 @@ 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 | } |
| @@ -2552,7 +2553,7 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, | |||
| 2552 | 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) |
| 2553 | { | 2554 | { |
| 2554 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 2555 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
| 2555 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 2556 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
| 2556 | 2557 | ||
| 2557 | switch (mode) { | 2558 | switch (mode) { |
| 2558 | case WM8994_VMID_NORMAL: | 2559 | case WM8994_VMID_NORMAL: |
| @@ -3354,6 +3355,7 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994) | |||
| 3354 | 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, |
| 3355 | int micbias) | 3356 | int micbias) |
| 3356 | { | 3357 | { |
| 3358 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
| 3357 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 3359 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
| 3358 | struct wm8994_micdet *micdet; | 3360 | struct wm8994_micdet *micdet; |
| 3359 | struct wm8994 *control = wm8994->wm8994; | 3361 | struct wm8994 *control = wm8994->wm8994; |
| @@ -3368,20 +3370,16 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
| 3368 | case 1: | 3370 | case 1: |
| 3369 | micdet = &wm8994->micdet[0]; | 3371 | micdet = &wm8994->micdet[0]; |
| 3370 | if (jack) | 3372 | if (jack) |
| 3371 | ret = snd_soc_dapm_force_enable_pin(&codec->dapm, | 3373 | ret = snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1"); |
| 3372 | "MICBIAS1"); | ||
| 3373 | else | 3374 | else |
| 3374 | ret = snd_soc_dapm_disable_pin(&codec->dapm, | 3375 | ret = snd_soc_dapm_disable_pin(dapm, "MICBIAS1"); |
| 3375 | "MICBIAS1"); | ||
| 3376 | break; | 3376 | break; |
| 3377 | case 2: | 3377 | case 2: |
| 3378 | micdet = &wm8994->micdet[1]; | 3378 | micdet = &wm8994->micdet[1]; |
| 3379 | if (jack) | 3379 | if (jack) |
| 3380 | ret = snd_soc_dapm_force_enable_pin(&codec->dapm, | 3380 | ret = snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1"); |
| 3381 | "MICBIAS1"); | ||
| 3382 | else | 3381 | else |
| 3383 | ret = snd_soc_dapm_disable_pin(&codec->dapm, | 3382 | ret = snd_soc_dapm_disable_pin(dapm, "MICBIAS1"); |
| 3384 | "MICBIAS1"); | ||
| 3385 | break; | 3383 | break; |
| 3386 | default: | 3384 | default: |
| 3387 | dev_warn(codec->dev, "Invalid MICBIAS %d\n", micbias); | 3385 | dev_warn(codec->dev, "Invalid MICBIAS %d\n", micbias); |
| @@ -3413,7 +3411,7 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
| 3413 | WM8994_MIC2_DET_DB_MASK | WM8994_MIC2_SHRT_DB_MASK, | 3411 | WM8994_MIC2_DET_DB_MASK | WM8994_MIC2_SHRT_DB_MASK, |
| 3414 | WM8994_MIC1_DET_DB | WM8994_MIC1_SHRT_DB); | 3412 | WM8994_MIC1_DET_DB | WM8994_MIC1_SHRT_DB); |
| 3415 | 3413 | ||
| 3416 | snd_soc_dapm_sync(&codec->dapm); | 3414 | snd_soc_dapm_sync(dapm); |
| 3417 | 3415 | ||
| 3418 | return 0; | 3416 | return 0; |
| 3419 | } | 3417 | } |
| @@ -3503,6 +3501,7 @@ static irqreturn_t wm8994_mic_irq(int irq, void *data) | |||
| 3503 | /* Should be called with accdet_lock held */ | 3501 | /* Should be called with accdet_lock held */ |
| 3504 | static void wm1811_micd_stop(struct snd_soc_codec *codec) | 3502 | static void wm1811_micd_stop(struct snd_soc_codec *codec) |
| 3505 | { | 3503 | { |
| 3504 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
| 3506 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 3505 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
| 3507 | 3506 | ||
| 3508 | if (!wm8994->jackdet) | 3507 | if (!wm8994->jackdet) |
| @@ -3513,8 +3512,7 @@ static void wm1811_micd_stop(struct snd_soc_codec *codec) | |||
| 3513 | wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK); | 3512 | wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK); |
| 3514 | 3513 | ||
| 3515 | if (wm8994->wm8994->pdata.jd_ext_cap) | 3514 | if (wm8994->wm8994->pdata.jd_ext_cap) |
| 3516 | snd_soc_dapm_disable_pin(&codec->dapm, | 3515 | snd_soc_dapm_disable_pin(dapm, "MICBIAS2"); |
| 3517 | "MICBIAS2"); | ||
| 3518 | } | 3516 | } |
| 3519 | 3517 | ||
| 3520 | 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) |
| @@ -3623,14 +3621,14 @@ static void wm1811_mic_work(struct work_struct *work) | |||
| 3623 | mic_work.work); | 3621 | mic_work.work); |
| 3624 | struct wm8994 *control = wm8994->wm8994; | 3622 | struct wm8994 *control = wm8994->wm8994; |
| 3625 | 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); | ||
| 3626 | 3625 | ||
| 3627 | pm_runtime_get_sync(codec->dev); | 3626 | pm_runtime_get_sync(codec->dev); |
| 3628 | 3627 | ||
| 3629 | /* If required for an external cap force MICBIAS on */ | 3628 | /* If required for an external cap force MICBIAS on */ |
| 3630 | if (control->pdata.jd_ext_cap) { | 3629 | if (control->pdata.jd_ext_cap) { |
| 3631 | snd_soc_dapm_force_enable_pin(&codec->dapm, | 3630 | snd_soc_dapm_force_enable_pin(dapm, "MICBIAS2"); |
| 3632 | "MICBIAS2"); | 3631 | snd_soc_dapm_sync(dapm); |
| 3633 | snd_soc_dapm_sync(&codec->dapm); | ||
| 3634 | } | 3632 | } |
| 3635 | 3633 | ||
| 3636 | mutex_lock(&wm8994->accdet_lock); | 3634 | mutex_lock(&wm8994->accdet_lock); |
| @@ -3662,6 +3660,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data) | |||
| 3662 | struct wm8994_priv *wm8994 = data; | 3660 | struct wm8994_priv *wm8994 = data; |
| 3663 | struct wm8994 *control = wm8994->wm8994; | 3661 | struct wm8994 *control = wm8994->wm8994; |
| 3664 | 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); | ||
| 3665 | int reg, delay; | 3664 | int reg, delay; |
| 3666 | bool present; | 3665 | bool present; |
| 3667 | 3666 | ||
| @@ -3722,7 +3721,7 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data) | |||
| 3722 | 3721 | ||
| 3723 | /* Turn off MICBIAS if it was on for an external cap */ | 3722 | /* Turn off MICBIAS if it was on for an external cap */ |
| 3724 | if (control->pdata.jd_ext_cap && !present) | 3723 | if (control->pdata.jd_ext_cap && !present) |
| 3725 | snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS2"); | 3724 | snd_soc_dapm_disable_pin(dapm, "MICBIAS2"); |
| 3726 | 3725 | ||
| 3727 | if (present) | 3726 | if (present) |
| 3728 | snd_soc_jack_report(wm8994->micdet[0].jack, | 3727 | snd_soc_jack_report(wm8994->micdet[0].jack, |
| @@ -3768,6 +3767,7 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
| 3768 | wm1811_micdet_cb det_cb, void *det_cb_data, | 3767 | wm1811_micdet_cb det_cb, void *det_cb_data, |
| 3769 | wm1811_mic_id_cb id_cb, void *id_cb_data) | 3768 | wm1811_mic_id_cb id_cb, void *id_cb_data) |
| 3770 | { | 3769 | { |
| 3770 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
| 3771 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 3771 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
| 3772 | struct wm8994 *control = wm8994->wm8994; | 3772 | struct wm8994 *control = wm8994->wm8994; |
| 3773 | u16 micd_lvl_sel; | 3773 | u16 micd_lvl_sel; |
| @@ -3781,8 +3781,8 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
| 3781 | } | 3781 | } |
| 3782 | 3782 | ||
| 3783 | if (jack) { | 3783 | if (jack) { |
| 3784 | snd_soc_dapm_force_enable_pin(&codec->dapm, "CLK_SYS"); | 3784 | snd_soc_dapm_force_enable_pin(dapm, "CLK_SYS"); |
| 3785 | snd_soc_dapm_sync(&codec->dapm); | 3785 | snd_soc_dapm_sync(dapm); |
| 3786 | 3786 | ||
| 3787 | wm8994->micdet[0].jack = jack; | 3787 | wm8994->micdet[0].jack = jack; |
| 3788 | 3788 | ||
| @@ -3817,7 +3817,7 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
| 3817 | snd_soc_update_bits(codec, WM8958_MIC_DETECT_2, | 3817 | snd_soc_update_bits(codec, WM8958_MIC_DETECT_2, |
| 3818 | WM8958_MICD_LVL_SEL_MASK, micd_lvl_sel); | 3818 | WM8958_MICD_LVL_SEL_MASK, micd_lvl_sel); |
| 3819 | 3819 | ||
| 3820 | WARN_ON(codec->dapm.bias_level > SND_SOC_BIAS_STANDBY); | 3820 | WARN_ON(snd_soc_codec_get_bias_level(codec) > SND_SOC_BIAS_STANDBY); |
| 3821 | 3821 | ||
| 3822 | /* | 3822 | /* |
| 3823 | * If we can use jack detection start off with that, | 3823 | * If we can use jack detection start off with that, |
| @@ -3844,8 +3844,8 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
| 3844 | snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, | 3844 | snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, |
| 3845 | WM8958_MICD_ENA, 0); | 3845 | WM8958_MICD_ENA, 0); |
| 3846 | wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_NONE); | 3846 | wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_NONE); |
| 3847 | snd_soc_dapm_disable_pin(&codec->dapm, "CLK_SYS"); | 3847 | snd_soc_dapm_disable_pin(dapm, "CLK_SYS"); |
| 3848 | snd_soc_dapm_sync(&codec->dapm); | 3848 | snd_soc_dapm_sync(dapm); |
| 3849 | } | 3849 | } |
| 3850 | 3850 | ||
| 3851 | return 0; | 3851 | return 0; |
| @@ -3983,9 +3983,9 @@ static irqreturn_t wm8994_temp_shut(int irq, void *data) | |||
| 3983 | 3983 | ||
| 3984 | static int wm8994_codec_probe(struct snd_soc_codec *codec) | 3984 | static int wm8994_codec_probe(struct snd_soc_codec *codec) |
| 3985 | { | 3985 | { |
| 3986 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
| 3986 | struct wm8994 *control = dev_get_drvdata(codec->dev->parent); | 3987 | struct wm8994 *control = dev_get_drvdata(codec->dev->parent); |
| 3987 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 3988 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
| 3988 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
| 3989 | unsigned int reg; | 3989 | unsigned int reg; |
| 3990 | int ret, i; | 3990 | int ret, i; |
| 3991 | 3991 | ||
| @@ -4016,7 +4016,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
| 4016 | wm8994->micdet_irq = control->pdata.micdet_irq; | 4016 | wm8994->micdet_irq = control->pdata.micdet_irq; |
| 4017 | 4017 | ||
| 4018 | /* By default use idle_bias_off, will override for WM8994 */ | 4018 | /* By default use idle_bias_off, will override for WM8994 */ |
| 4019 | codec->dapm.idle_bias_off = 1; | 4019 | dapm->idle_bias_off = 1; |
| 4020 | 4020 | ||
| 4021 | /* Set revision-specific configuration */ | 4021 | /* Set revision-specific configuration */ |
| 4022 | switch (control->type) { | 4022 | switch (control->type) { |
| @@ -4024,7 +4024,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
| 4024 | /* Single ended line outputs should have VMID on. */ | 4024 | /* Single ended line outputs should have VMID on. */ |
| 4025 | if (!control->pdata.lineout1_diff || | 4025 | if (!control->pdata.lineout1_diff || |
| 4026 | !control->pdata.lineout2_diff) | 4026 | !control->pdata.lineout2_diff) |
| 4027 | codec->dapm.idle_bias_off = 0; | 4027 | dapm->idle_bias_off = 0; |
| 4028 | 4028 | ||
| 4029 | switch (control->revision) { | 4029 | switch (control->revision) { |
| 4030 | case 2: | 4030 | case 2: |
