aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8350.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-04-14 02:35:19 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-04-16 21:46:22 -0400
commitb2c812e22de88bb79c290c0e718280f10b64a48d (patch)
tree4a5d967714cfb771db351cde525e6946897cca08 /sound/soc/codecs/wm8350.c
parent890c681275ab02623de1187f2d97fc355d76f372 (diff)
ASoC: Add indirection for CODEC private data
One of the features of the multi CODEC work is that it embeds a struct device in the CODEC to provide diagnostics via a sysfs class rather than via the device tree, at which point it's much better to use the struct device private data rather than having two places to store it. Provide an accessor function to allow this change to be made more easily, and update all the CODEC drivers are updated. To ensure use of the accessor the private data structure member is renamed, meaning that if code developed with older an older core that still uses private_data is merged it will fail to build. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/codecs/wm8350.c')
-rw-r--r--sound/soc/codecs/wm8350.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 8ac92f5e4f91..145467d37054 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -95,7 +95,7 @@ static int wm8350_codec_write(struct snd_soc_codec *codec, unsigned int reg,
95 */ 95 */
96static inline int wm8350_out1_ramp_step(struct snd_soc_codec *codec) 96static inline int wm8350_out1_ramp_step(struct snd_soc_codec *codec)
97{ 97{
98 struct wm8350_data *wm8350_data = codec->private_data; 98 struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
99 struct wm8350_output *out1 = &wm8350_data->out1; 99 struct wm8350_output *out1 = &wm8350_data->out1;
100 struct wm8350 *wm8350 = codec->control_data; 100 struct wm8350 *wm8350 = codec->control_data;
101 int left_complete = 0, right_complete = 0; 101 int left_complete = 0, right_complete = 0;
@@ -161,7 +161,7 @@ static inline int wm8350_out1_ramp_step(struct snd_soc_codec *codec)
161 */ 161 */
162static inline int wm8350_out2_ramp_step(struct snd_soc_codec *codec) 162static inline int wm8350_out2_ramp_step(struct snd_soc_codec *codec)
163{ 163{
164 struct wm8350_data *wm8350_data = codec->private_data; 164 struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
165 struct wm8350_output *out2 = &wm8350_data->out2; 165 struct wm8350_output *out2 = &wm8350_data->out2;
166 struct wm8350 *wm8350 = codec->control_data; 166 struct wm8350 *wm8350 = codec->control_data;
167 int left_complete = 0, right_complete = 0; 167 int left_complete = 0, right_complete = 0;
@@ -231,7 +231,7 @@ static void wm8350_pga_work(struct work_struct *work)
231{ 231{
232 struct snd_soc_codec *codec = 232 struct snd_soc_codec *codec =
233 container_of(work, struct snd_soc_codec, delayed_work.work); 233 container_of(work, struct snd_soc_codec, delayed_work.work);
234 struct wm8350_data *wm8350_data = codec->private_data; 234 struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
235 struct wm8350_output *out1 = &wm8350_data->out1, 235 struct wm8350_output *out1 = &wm8350_data->out1,
236 *out2 = &wm8350_data->out2; 236 *out2 = &wm8350_data->out2;
237 int i, out1_complete, out2_complete; 237 int i, out1_complete, out2_complete;
@@ -278,7 +278,7 @@ static int pga_event(struct snd_soc_dapm_widget *w,
278 struct snd_kcontrol *kcontrol, int event) 278 struct snd_kcontrol *kcontrol, int event)
279{ 279{
280 struct snd_soc_codec *codec = w->codec; 280 struct snd_soc_codec *codec = w->codec;
281 struct wm8350_data *wm8350_data = codec->private_data; 281 struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec);
282 struct wm8350_output *out; 282 struct wm8350_output *out;
283 283
284 switch (w->shift) { 284 switch (w->shift) {
@@ -323,7 +323,7 @@ static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol,
323 struct snd_ctl_elem_value *ucontrol) 323 struct snd_ctl_elem_value *ucontrol)
324{ 324{
325 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 325 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
326 struct wm8350_data *wm8350_priv = codec->private_data; 326 struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec);
327 struct wm8350_output *out = NULL; 327 struct wm8350_output *out = NULL;
328 struct soc_mixer_control *mc = 328 struct soc_mixer_control *mc =
329 (struct soc_mixer_control *)kcontrol->private_value; 329 (struct soc_mixer_control *)kcontrol->private_value;
@@ -366,7 +366,7 @@ static int wm8350_get_volsw_2r(struct snd_kcontrol *kcontrol,
366 struct snd_ctl_elem_value *ucontrol) 366 struct snd_ctl_elem_value *ucontrol)
367{ 367{
368 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 368 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
369 struct wm8350_data *wm8350_priv = codec->private_data; 369 struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec);
370 struct wm8350_output *out1 = &wm8350_priv->out1; 370 struct wm8350_output *out1 = &wm8350_priv->out1;
371 struct wm8350_output *out2 = &wm8350_priv->out2; 371 struct wm8350_output *out2 = &wm8350_priv->out2;
372 struct soc_mixer_control *mc = 372 struct soc_mixer_control *mc =
@@ -1108,7 +1108,7 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai,
1108{ 1108{
1109 struct snd_soc_codec *codec = codec_dai->codec; 1109 struct snd_soc_codec *codec = codec_dai->codec;
1110 struct wm8350 *wm8350 = codec->control_data; 1110 struct wm8350 *wm8350 = codec->control_data;
1111 struct wm8350_data *priv = codec->private_data; 1111 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
1112 struct _fll_div fll_div; 1112 struct _fll_div fll_div;
1113 int ret = 0; 1113 int ret = 0;
1114 u16 fll_1, fll_4; 1114 u16 fll_1, fll_4;
@@ -1160,7 +1160,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec,
1160 enum snd_soc_bias_level level) 1160 enum snd_soc_bias_level level)
1161{ 1161{
1162 struct wm8350 *wm8350 = codec->control_data; 1162 struct wm8350 *wm8350 = codec->control_data;
1163 struct wm8350_data *priv = codec->private_data; 1163 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
1164 struct wm8350_audio_platform_data *platform = 1164 struct wm8350_audio_platform_data *platform =
1165 wm8350->codec.platform_data; 1165 wm8350->codec.platform_data;
1166 u16 pm1; 1166 u16 pm1;
@@ -1399,7 +1399,7 @@ static irqreturn_t wm8350_hp_jack_handler(int irq, void *data)
1399int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which, 1399int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which,
1400 struct snd_soc_jack *jack, int report) 1400 struct snd_soc_jack *jack, int report)
1401{ 1401{
1402 struct wm8350_data *priv = codec->private_data; 1402 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
1403 struct wm8350 *wm8350 = codec->control_data; 1403 struct wm8350 *wm8350 = codec->control_data;
1404 int irq; 1404 int irq;
1405 int ena; 1405 int ena;
@@ -1471,7 +1471,7 @@ int wm8350_mic_jack_detect(struct snd_soc_codec *codec,
1471 struct snd_soc_jack *jack, 1471 struct snd_soc_jack *jack,
1472 int detect_report, int short_report) 1472 int detect_report, int short_report)
1473{ 1473{
1474 struct wm8350_data *priv = codec->private_data; 1474 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
1475 struct wm8350 *wm8350 = codec->control_data; 1475 struct wm8350 *wm8350 = codec->control_data;
1476 1476
1477 priv->mic.jack = jack; 1477 priv->mic.jack = jack;
@@ -1508,7 +1508,7 @@ static int wm8350_probe(struct platform_device *pdev)
1508 socdev->card->codec = wm8350_codec; 1508 socdev->card->codec = wm8350_codec;
1509 codec = socdev->card->codec; 1509 codec = socdev->card->codec;
1510 wm8350 = codec->control_data; 1510 wm8350 = codec->control_data;
1511 priv = codec->private_data; 1511 priv = snd_soc_codec_get_drvdata(codec);
1512 1512
1513 /* Enable the codec */ 1513 /* Enable the codec */
1514 wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); 1514 wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
@@ -1579,7 +1579,7 @@ static int wm8350_remove(struct platform_device *pdev)
1579 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1579 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1580 struct snd_soc_codec *codec = socdev->card->codec; 1580 struct snd_soc_codec *codec = socdev->card->codec;
1581 struct wm8350 *wm8350 = codec->control_data; 1581 struct wm8350 *wm8350 = codec->control_data;
1582 struct wm8350_data *priv = codec->private_data; 1582 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
1583 int ret; 1583 int ret;
1584 1584
1585 wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, 1585 wm8350_clear_bits(wm8350, WM8350_JACK_DETECT,
@@ -1698,7 +1698,7 @@ static __devinit int wm8350_codec_probe(struct platform_device *pdev)
1698 codec->dai = &wm8350_dai; 1698 codec->dai = &wm8350_dai;
1699 codec->num_dai = 1; 1699 codec->num_dai = 1;
1700 codec->reg_cache_size = WM8350_MAX_REGISTER; 1700 codec->reg_cache_size = WM8350_MAX_REGISTER;
1701 codec->private_data = priv; 1701 snd_soc_codec_set_drvdata(codec, priv);
1702 codec->control_data = wm8350; 1702 codec->control_data = wm8350;
1703 1703
1704 /* Put the codec into reset if it wasn't already */ 1704 /* Put the codec into reset if it wasn't already */
@@ -1730,7 +1730,7 @@ static int __devexit wm8350_codec_remove(struct platform_device *pdev)
1730{ 1730{
1731 struct wm8350 *wm8350 = platform_get_drvdata(pdev); 1731 struct wm8350 *wm8350 = platform_get_drvdata(pdev);
1732 struct snd_soc_codec *codec = wm8350->codec.codec; 1732 struct snd_soc_codec *codec = wm8350->codec.codec;
1733 struct wm8350_data *priv = codec->private_data; 1733 struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec);
1734 1734
1735 snd_soc_unregister_dai(&wm8350_dai); 1735 snd_soc_unregister_dai(&wm8350_dai);
1736 snd_soc_unregister_codec(codec); 1736 snd_soc_unregister_codec(codec);