diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-04-14 02:35:19 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-04-16 21:46:22 -0400 |
commit | b2c812e22de88bb79c290c0e718280f10b64a48d (patch) | |
tree | 4a5d967714cfb771db351cde525e6946897cca08 /sound/soc/codecs/wm8955.c | |
parent | 890c681275ab02623de1187f2d97fc355d76f372 (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/wm8955.c')
-rw-r--r-- | sound/soc/codecs/wm8955.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index 615dab2b62ef..5f0bde56cf0d 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c | |||
@@ -234,7 +234,7 @@ static struct { | |||
234 | 234 | ||
235 | static int wm8955_configure_clocking(struct snd_soc_codec *codec) | 235 | static int wm8955_configure_clocking(struct snd_soc_codec *codec) |
236 | { | 236 | { |
237 | struct wm8955_priv *wm8955 = codec->private_data; | 237 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
238 | int i, ret, val; | 238 | int i, ret, val; |
239 | int clocking = 0; | 239 | int clocking = 0; |
240 | int srate = 0; | 240 | int srate = 0; |
@@ -352,7 +352,7 @@ static int deemph_settings[] = { 0, 32000, 44100, 48000 }; | |||
352 | 352 | ||
353 | static int wm8955_set_deemph(struct snd_soc_codec *codec) | 353 | static int wm8955_set_deemph(struct snd_soc_codec *codec) |
354 | { | 354 | { |
355 | struct wm8955_priv *wm8955 = codec->private_data; | 355 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
356 | int val, i, best; | 356 | int val, i, best; |
357 | 357 | ||
358 | /* If we're using deemphasis select the nearest available sample | 358 | /* If we're using deemphasis select the nearest available sample |
@@ -381,7 +381,7 @@ static int wm8955_get_deemph(struct snd_kcontrol *kcontrol, | |||
381 | struct snd_ctl_elem_value *ucontrol) | 381 | struct snd_ctl_elem_value *ucontrol) |
382 | { | 382 | { |
383 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 383 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
384 | struct wm8955_priv *wm8955 = codec->private_data; | 384 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
385 | 385 | ||
386 | return wm8955->deemph; | 386 | return wm8955->deemph; |
387 | } | 387 | } |
@@ -390,7 +390,7 @@ static int wm8955_put_deemph(struct snd_kcontrol *kcontrol, | |||
390 | struct snd_ctl_elem_value *ucontrol) | 390 | struct snd_ctl_elem_value *ucontrol) |
391 | { | 391 | { |
392 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 392 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
393 | struct wm8955_priv *wm8955 = codec->private_data; | 393 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
394 | int deemph = ucontrol->value.enumerated.item[0]; | 394 | int deemph = ucontrol->value.enumerated.item[0]; |
395 | 395 | ||
396 | if (deemph > 1) | 396 | if (deemph > 1) |
@@ -597,7 +597,7 @@ static int wm8955_hw_params(struct snd_pcm_substream *substream, | |||
597 | struct snd_soc_dai *dai) | 597 | struct snd_soc_dai *dai) |
598 | { | 598 | { |
599 | struct snd_soc_codec *codec = dai->codec; | 599 | struct snd_soc_codec *codec = dai->codec; |
600 | struct wm8955_priv *wm8955 = codec->private_data; | 600 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
601 | int ret; | 601 | int ret; |
602 | int wl; | 602 | int wl; |
603 | 603 | ||
@@ -646,7 +646,7 @@ static int wm8955_set_sysclk(struct snd_soc_dai *dai, int clk_id, | |||
646 | unsigned int freq, int dir) | 646 | unsigned int freq, int dir) |
647 | { | 647 | { |
648 | struct snd_soc_codec *codec = dai->codec; | 648 | struct snd_soc_codec *codec = dai->codec; |
649 | struct wm8955_priv *priv = codec->private_data; | 649 | struct wm8955_priv *priv = snd_soc_codec_get_drvdata(codec); |
650 | int div; | 650 | int div; |
651 | 651 | ||
652 | switch (clk_id) { | 652 | switch (clk_id) { |
@@ -769,7 +769,7 @@ static int wm8955_digital_mute(struct snd_soc_dai *codec_dai, int mute) | |||
769 | static int wm8955_set_bias_level(struct snd_soc_codec *codec, | 769 | static int wm8955_set_bias_level(struct snd_soc_codec *codec, |
770 | enum snd_soc_bias_level level) | 770 | enum snd_soc_bias_level level) |
771 | { | 771 | { |
772 | struct wm8955_priv *wm8955 = codec->private_data; | 772 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
773 | int ret, i; | 773 | int ret, i; |
774 | 774 | ||
775 | switch (level) { | 775 | switch (level) { |
@@ -970,7 +970,7 @@ static int wm8955_register(struct wm8955_priv *wm8955, | |||
970 | INIT_LIST_HEAD(&codec->dapm_widgets); | 970 | INIT_LIST_HEAD(&codec->dapm_widgets); |
971 | INIT_LIST_HEAD(&codec->dapm_paths); | 971 | INIT_LIST_HEAD(&codec->dapm_paths); |
972 | 972 | ||
973 | codec->private_data = wm8955; | 973 | snd_soc_codec_set_drvdata(codec, wm8955); |
974 | codec->name = "WM8955"; | 974 | codec->name = "WM8955"; |
975 | codec->owner = THIS_MODULE; | 975 | codec->owner = THIS_MODULE; |
976 | codec->bias_level = SND_SOC_BIAS_OFF; | 976 | codec->bias_level = SND_SOC_BIAS_OFF; |