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/wm8750.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/wm8750.c')
-rw-r--r-- | sound/soc/codecs/wm8750.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index 4bbc512c0836..60d7cf88bf1d 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c | |||
@@ -482,7 +482,7 @@ static int wm8750_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
482 | int clk_id, unsigned int freq, int dir) | 482 | int clk_id, unsigned int freq, int dir) |
483 | { | 483 | { |
484 | struct snd_soc_codec *codec = codec_dai->codec; | 484 | struct snd_soc_codec *codec = codec_dai->codec; |
485 | struct wm8750_priv *wm8750 = codec->private_data; | 485 | struct wm8750_priv *wm8750 = snd_soc_codec_get_drvdata(codec); |
486 | 486 | ||
487 | switch (freq) { | 487 | switch (freq) { |
488 | case 11289600: | 488 | case 11289600: |
@@ -561,7 +561,7 @@ static int wm8750_pcm_hw_params(struct snd_pcm_substream *substream, | |||
561 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 561 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
562 | struct snd_soc_device *socdev = rtd->socdev; | 562 | struct snd_soc_device *socdev = rtd->socdev; |
563 | struct snd_soc_codec *codec = socdev->card->codec; | 563 | struct snd_soc_codec *codec = socdev->card->codec; |
564 | struct wm8750_priv *wm8750 = codec->private_data; | 564 | struct wm8750_priv *wm8750 = snd_soc_codec_get_drvdata(codec); |
565 | u16 iface = snd_soc_read(codec, WM8750_IFACE) & 0x1f3; | 565 | u16 iface = snd_soc_read(codec, WM8750_IFACE) & 0x1f3; |
566 | u16 srate = snd_soc_read(codec, WM8750_SRATE) & 0x1c0; | 566 | u16 srate = snd_soc_read(codec, WM8750_SRATE) & 0x1c0; |
567 | int coeff = get_coeff(wm8750->sysclk, params_rate(params)); | 567 | int coeff = get_coeff(wm8750->sysclk, params_rate(params)); |
@@ -775,10 +775,9 @@ static int wm8750_register(struct wm8750_priv *wm8750, | |||
775 | codec->set_bias_level = wm8750_set_bias_level; | 775 | codec->set_bias_level = wm8750_set_bias_level; |
776 | codec->dai = &wm8750_dai; | 776 | codec->dai = &wm8750_dai; |
777 | codec->num_dai = 1; | 777 | codec->num_dai = 1; |
778 | codec->private_data = wm8750; | ||
779 | codec->reg_cache_size = ARRAY_SIZE(wm8750->reg_cache) + 1; | 778 | codec->reg_cache_size = ARRAY_SIZE(wm8750->reg_cache) + 1; |
780 | codec->reg_cache = &wm8750->reg_cache; | 779 | codec->reg_cache = &wm8750->reg_cache; |
781 | codec->private_data = wm8750; | 780 | snd_soc_codec_set_drvdata(codec, wm8750); |
782 | 781 | ||
783 | memcpy(codec->reg_cache, wm8750_reg, sizeof(wm8750->reg_cache)); | 782 | memcpy(codec->reg_cache, wm8750_reg, sizeof(wm8750->reg_cache)); |
784 | 783 | ||