diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-07-24 07:20:41 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-01 09:21:41 -0500 |
commit | 2a8a856d427fea68a5d538adf52edae4cdbb246b (patch) | |
tree | 8890b384930513adb3f804d64503a89281b83ecd | |
parent | a1691343a397157dd5f67bce50435f64024a462d (diff) |
ASoC: Don't use control_data to get struct wm8994
This will support refactoring to make use of the regmap API more directly
in the core.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/codecs/wm8994.c | 72 | ||||
-rw-r--r-- | sound/soc/codecs/wm8994.h | 5 |
2 files changed, 41 insertions, 36 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 16e2bd7c3cea..d36b62b492c1 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -106,7 +106,7 @@ static void wm8958_micd_set_rate(struct snd_soc_codec *codec) | |||
106 | static int wm8994_readable(struct snd_soc_codec *codec, unsigned int reg) | 106 | static int wm8994_readable(struct snd_soc_codec *codec, unsigned int reg) |
107 | { | 107 | { |
108 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 108 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
109 | struct wm8994 *control = codec->control_data; | 109 | struct wm8994 *control = wm8994->wm8994; |
110 | 110 | ||
111 | switch (reg) { | 111 | switch (reg) { |
112 | case WM8994_GPIO_1: | 112 | case WM8994_GPIO_1: |
@@ -1822,7 +1822,7 @@ static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src, | |||
1822 | unsigned int freq_in, unsigned int freq_out) | 1822 | unsigned int freq_in, unsigned int freq_out) |
1823 | { | 1823 | { |
1824 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 1824 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
1825 | struct wm8994 *control = codec->control_data; | 1825 | struct wm8994 *control = wm8994->wm8994; |
1826 | int reg_offset, ret; | 1826 | int reg_offset, ret; |
1827 | struct fll_div fll; | 1827 | struct fll_div fll; |
1828 | u16 reg, aif1, aif2; | 1828 | u16 reg, aif1, aif2; |
@@ -2071,8 +2071,8 @@ static int wm8994_set_dai_sysclk(struct snd_soc_dai *dai, | |||
2071 | static int wm8994_set_bias_level(struct snd_soc_codec *codec, | 2071 | static int wm8994_set_bias_level(struct snd_soc_codec *codec, |
2072 | enum snd_soc_bias_level level) | 2072 | enum snd_soc_bias_level level) |
2073 | { | 2073 | { |
2074 | struct wm8994 *control = codec->control_data; | ||
2075 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 2074 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
2075 | struct wm8994 *control = wm8994->wm8994; | ||
2076 | 2076 | ||
2077 | switch (level) { | 2077 | switch (level) { |
2078 | case SND_SOC_BIAS_ON: | 2078 | case SND_SOC_BIAS_ON: |
@@ -2174,7 +2174,8 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, | |||
2174 | static int wm8994_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) | 2174 | static int wm8994_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
2175 | { | 2175 | { |
2176 | struct snd_soc_codec *codec = dai->codec; | 2176 | struct snd_soc_codec *codec = dai->codec; |
2177 | struct wm8994 *control = codec->control_data; | 2177 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
2178 | struct wm8994 *control = wm8994->wm8994; | ||
2178 | int ms_reg; | 2179 | int ms_reg; |
2179 | int aif1_reg; | 2180 | int aif1_reg; |
2180 | int ms = 0; | 2181 | int ms = 0; |
@@ -2474,7 +2475,8 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream, | |||
2474 | struct snd_soc_dai *dai) | 2475 | struct snd_soc_dai *dai) |
2475 | { | 2476 | { |
2476 | struct snd_soc_codec *codec = dai->codec; | 2477 | struct snd_soc_codec *codec = dai->codec; |
2477 | struct wm8994 *control = codec->control_data; | 2478 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
2479 | struct wm8994 *control = wm8994->wm8994; | ||
2478 | int aif1_reg; | 2480 | int aif1_reg; |
2479 | int aif1 = 0; | 2481 | int aif1 = 0; |
2480 | 2482 | ||
@@ -2705,7 +2707,7 @@ static struct snd_soc_dai_driver wm8994_dai[] = { | |||
2705 | static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state) | 2707 | static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state) |
2706 | { | 2708 | { |
2707 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 2709 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
2708 | struct wm8994 *control = codec->control_data; | 2710 | struct wm8994 *control = wm8994->wm8994; |
2709 | int i, ret; | 2711 | int i, ret; |
2710 | 2712 | ||
2711 | switch (control->type) { | 2713 | switch (control->type) { |
@@ -2736,7 +2738,7 @@ static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state) | |||
2736 | static int wm8994_resume(struct snd_soc_codec *codec) | 2738 | static int wm8994_resume(struct snd_soc_codec *codec) |
2737 | { | 2739 | { |
2738 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 2740 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
2739 | struct wm8994 *control = codec->control_data; | 2741 | struct wm8994 *control = wm8994->wm8994; |
2740 | int i, ret; | 2742 | int i, ret; |
2741 | unsigned int val, mask; | 2743 | unsigned int val, mask; |
2742 | 2744 | ||
@@ -2958,7 +2960,7 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
2958 | { | 2960 | { |
2959 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 2961 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
2960 | struct wm8994_micdet *micdet; | 2962 | struct wm8994_micdet *micdet; |
2961 | struct wm8994 *control = codec->control_data; | 2963 | struct wm8994 *control = wm8994->wm8994; |
2962 | int reg; | 2964 | int reg; |
2963 | 2965 | ||
2964 | if (control->type != WM8994) | 2966 | if (control->type != WM8994) |
@@ -3115,7 +3117,7 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
3115 | wm8958_micdet_cb cb, void *cb_data) | 3117 | wm8958_micdet_cb cb, void *cb_data) |
3116 | { | 3118 | { |
3117 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 3119 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
3118 | struct wm8994 *control = codec->control_data; | 3120 | struct wm8994 *control = wm8994->wm8994; |
3119 | 3121 | ||
3120 | switch (control->type) { | 3122 | switch (control->type) { |
3121 | case WM1811: | 3123 | case WM1811: |
@@ -3247,6 +3249,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3247 | return -ENOMEM; | 3249 | return -ENOMEM; |
3248 | snd_soc_codec_set_drvdata(codec, wm8994); | 3250 | snd_soc_codec_set_drvdata(codec, wm8994); |
3249 | 3251 | ||
3252 | |||
3253 | wm8994->wm8994 = dev_get_drvdata(codec->dev->parent); | ||
3250 | wm8994->pdata = dev_get_platdata(codec->dev->parent); | 3254 | wm8994->pdata = dev_get_platdata(codec->dev->parent); |
3251 | wm8994->codec = codec; | 3255 | wm8994->codec = codec; |
3252 | 3256 | ||
@@ -3328,14 +3332,14 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3328 | break; | 3332 | break; |
3329 | } | 3333 | } |
3330 | 3334 | ||
3331 | wm8994_request_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR, | 3335 | wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, |
3332 | wm8994_fifo_error, "FIFO error", codec); | 3336 | wm8994_fifo_error, "FIFO error", codec); |
3333 | wm8994_request_irq(codec->control_data, WM8994_IRQ_TEMP_WARN, | 3337 | wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, |
3334 | wm8994_temp_warn, "Thermal warning", codec); | 3338 | wm8994_temp_warn, "Thermal warning", codec); |
3335 | wm8994_request_irq(codec->control_data, WM8994_IRQ_TEMP_SHUT, | 3339 | wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, |
3336 | wm8994_temp_shut, "Thermal shutdown", codec); | 3340 | wm8994_temp_shut, "Thermal shutdown", codec); |
3337 | 3341 | ||
3338 | ret = wm8994_request_irq(codec->control_data, WM8994_IRQ_DCS_DONE, | 3342 | ret = wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE, |
3339 | wm_hubs_dcs_done, "DC servo done", | 3343 | wm_hubs_dcs_done, "DC servo done", |
3340 | &wm8994->hubs); | 3344 | &wm8994->hubs); |
3341 | if (ret == 0) | 3345 | if (ret == 0) |
@@ -3355,7 +3359,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3355 | ret); | 3359 | ret); |
3356 | } | 3360 | } |
3357 | 3361 | ||
3358 | ret = wm8994_request_irq(codec->control_data, | 3362 | ret = wm8994_request_irq(wm8994->wm8994, |
3359 | WM8994_IRQ_MIC1_SHRT, | 3363 | WM8994_IRQ_MIC1_SHRT, |
3360 | wm8994_mic_irq, "Mic 1 short", | 3364 | wm8994_mic_irq, "Mic 1 short", |
3361 | wm8994); | 3365 | wm8994); |
@@ -3364,7 +3368,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3364 | "Failed to request Mic1 short IRQ: %d\n", | 3368 | "Failed to request Mic1 short IRQ: %d\n", |
3365 | ret); | 3369 | ret); |
3366 | 3370 | ||
3367 | ret = wm8994_request_irq(codec->control_data, | 3371 | ret = wm8994_request_irq(wm8994->wm8994, |
3368 | WM8994_IRQ_MIC2_DET, | 3372 | WM8994_IRQ_MIC2_DET, |
3369 | wm8994_mic_irq, "Mic 2 detect", | 3373 | wm8994_mic_irq, "Mic 2 detect", |
3370 | wm8994); | 3374 | wm8994); |
@@ -3373,7 +3377,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3373 | "Failed to request Mic2 detect IRQ: %d\n", | 3377 | "Failed to request Mic2 detect IRQ: %d\n", |
3374 | ret); | 3378 | ret); |
3375 | 3379 | ||
3376 | ret = wm8994_request_irq(codec->control_data, | 3380 | ret = wm8994_request_irq(wm8994->wm8994, |
3377 | WM8994_IRQ_MIC2_SHRT, | 3381 | WM8994_IRQ_MIC2_SHRT, |
3378 | wm8994_mic_irq, "Mic 2 short", | 3382 | wm8994_mic_irq, "Mic 2 short", |
3379 | wm8994); | 3383 | wm8994); |
@@ -3400,7 +3404,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3400 | 3404 | ||
3401 | wm8994->fll_locked_irq = true; | 3405 | wm8994->fll_locked_irq = true; |
3402 | for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) { | 3406 | for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) { |
3403 | ret = wm8994_request_irq(codec->control_data, | 3407 | ret = wm8994_request_irq(wm8994->wm8994, |
3404 | WM8994_IRQ_FLL1_LOCK + i, | 3408 | WM8994_IRQ_FLL1_LOCK + i, |
3405 | wm8994_fll_locked_irq, "FLL lock", | 3409 | wm8994_fll_locked_irq, "FLL lock", |
3406 | &wm8994->fll_locked[i]); | 3410 | &wm8994->fll_locked[i]); |
@@ -3620,19 +3624,19 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3620 | return 0; | 3624 | return 0; |
3621 | 3625 | ||
3622 | err_irq: | 3626 | err_irq: |
3623 | wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_SHRT, wm8994); | 3627 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_SHRT, wm8994); |
3624 | wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_DET, wm8994); | 3628 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_DET, wm8994); |
3625 | wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_SHRT, wm8994); | 3629 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT, wm8994); |
3626 | if (wm8994->micdet_irq) | 3630 | if (wm8994->micdet_irq) |
3627 | free_irq(wm8994->micdet_irq, wm8994); | 3631 | free_irq(wm8994->micdet_irq, wm8994); |
3628 | for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) | 3632 | for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) |
3629 | wm8994_free_irq(codec->control_data, WM8994_IRQ_FLL1_LOCK + i, | 3633 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i, |
3630 | &wm8994->fll_locked[i]); | 3634 | &wm8994->fll_locked[i]); |
3631 | wm8994_free_irq(codec->control_data, WM8994_IRQ_DCS_DONE, | 3635 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE, |
3632 | &wm8994->hubs); | 3636 | &wm8994->hubs); |
3633 | wm8994_free_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR, codec); | 3637 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec); |
3634 | wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_SHUT, codec); | 3638 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec); |
3635 | wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_WARN, codec); | 3639 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec); |
3636 | err: | 3640 | err: |
3637 | kfree(wm8994); | 3641 | kfree(wm8994); |
3638 | return ret; | 3642 | return ret; |
@@ -3641,7 +3645,7 @@ err: | |||
3641 | static int wm8994_codec_remove(struct snd_soc_codec *codec) | 3645 | static int wm8994_codec_remove(struct snd_soc_codec *codec) |
3642 | { | 3646 | { |
3643 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 3647 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
3644 | struct wm8994 *control = codec->control_data; | 3648 | struct wm8994 *control = wm8994->wm8994; |
3645 | int i; | 3649 | int i; |
3646 | 3650 | ||
3647 | wm8994_set_bias_level(codec, SND_SOC_BIAS_OFF); | 3651 | wm8994_set_bias_level(codec, SND_SOC_BIAS_OFF); |
@@ -3649,24 +3653,24 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec) | |||
3649 | pm_runtime_disable(codec->dev); | 3653 | pm_runtime_disable(codec->dev); |
3650 | 3654 | ||
3651 | for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) | 3655 | for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) |
3652 | wm8994_free_irq(codec->control_data, WM8994_IRQ_FLL1_LOCK + i, | 3656 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i, |
3653 | &wm8994->fll_locked[i]); | 3657 | &wm8994->fll_locked[i]); |
3654 | 3658 | ||
3655 | wm8994_free_irq(codec->control_data, WM8994_IRQ_DCS_DONE, | 3659 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE, |
3656 | &wm8994->hubs); | 3660 | &wm8994->hubs); |
3657 | wm8994_free_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR, codec); | 3661 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec); |
3658 | wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_SHUT, codec); | 3662 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec); |
3659 | wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_WARN, codec); | 3663 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec); |
3660 | 3664 | ||
3661 | switch (control->type) { | 3665 | switch (control->type) { |
3662 | case WM8994: | 3666 | case WM8994: |
3663 | if (wm8994->micdet_irq) | 3667 | if (wm8994->micdet_irq) |
3664 | free_irq(wm8994->micdet_irq, wm8994); | 3668 | free_irq(wm8994->micdet_irq, wm8994); |
3665 | wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_DET, | 3669 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_DET, |
3666 | wm8994); | 3670 | wm8994); |
3667 | wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_SHRT, | 3671 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT, |
3668 | wm8994); | 3672 | wm8994); |
3669 | wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_DET, | 3673 | wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_DET, |
3670 | wm8994); | 3674 | wm8994); |
3671 | break; | 3675 | break; |
3672 | 3676 | ||
diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h index 1087425cbac0..c3e71d72eb6a 100644 --- a/sound/soc/codecs/wm8994.h +++ b/sound/soc/codecs/wm8994.h | |||
@@ -70,10 +70,11 @@ struct wm8994_fll_config { | |||
70 | #define WM8994_NUM_DRC 3 | 70 | #define WM8994_NUM_DRC 3 |
71 | #define WM8994_NUM_EQ 3 | 71 | #define WM8994_NUM_EQ 3 |
72 | 72 | ||
73 | struct wm8994; | ||
74 | |||
73 | struct wm8994_priv { | 75 | struct wm8994_priv { |
74 | struct wm_hubs_data hubs; | 76 | struct wm_hubs_data hubs; |
75 | enum snd_soc_control_type control_type; | 77 | struct wm8994 *wm8994; |
76 | void *control_data; | ||
77 | struct snd_soc_codec *codec; | 78 | struct snd_soc_codec *codec; |
78 | int sysclk[2]; | 79 | int sysclk[2]; |
79 | int sysclk_rate[2]; | 80 | int sysclk_rate[2]; |