aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8978.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/wm8978.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/wm8978.c')
-rw-r--r--sound/soc/codecs/wm8978.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index 28bb59ea6ea1..6866a6a80fec 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -438,7 +438,7 @@ static int wm8978_enum_mclk(unsigned int f_out, unsigned int f_mclk,
438 */ 438 */
439static int wm8978_configure_pll(struct snd_soc_codec *codec) 439static int wm8978_configure_pll(struct snd_soc_codec *codec)
440{ 440{
441 struct wm8978_priv *wm8978 = codec->private_data; 441 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
442 struct wm8978_pll_div pll_div; 442 struct wm8978_pll_div pll_div;
443 unsigned int f_opclk = wm8978->f_opclk, f_mclk = wm8978->f_mclk, 443 unsigned int f_opclk = wm8978->f_opclk, f_mclk = wm8978->f_mclk,
444 f_256fs = wm8978->f_256fs; 444 f_256fs = wm8978->f_256fs;
@@ -534,7 +534,7 @@ static int wm8978_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
534 int div_id, int div) 534 int div_id, int div)
535{ 535{
536 struct snd_soc_codec *codec = codec_dai->codec; 536 struct snd_soc_codec *codec = codec_dai->codec;
537 struct wm8978_priv *wm8978 = codec->private_data; 537 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
538 int ret = 0; 538 int ret = 0;
539 539
540 switch (div_id) { 540 switch (div_id) {
@@ -579,7 +579,7 @@ static int wm8978_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id,
579 unsigned int freq, int dir) 579 unsigned int freq, int dir)
580{ 580{
581 struct snd_soc_codec *codec = codec_dai->codec; 581 struct snd_soc_codec *codec = codec_dai->codec;
582 struct wm8978_priv *wm8978 = codec->private_data; 582 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
583 int ret = 0; 583 int ret = 0;
584 584
585 dev_dbg(codec->dev, "%s: ID %d, freq %u\n", __func__, clk_id, freq); 585 dev_dbg(codec->dev, "%s: ID %d, freq %u\n", __func__, clk_id, freq);
@@ -691,7 +691,7 @@ static int wm8978_hw_params(struct snd_pcm_substream *substream,
691 struct snd_soc_pcm_runtime *rtd = substream->private_data; 691 struct snd_soc_pcm_runtime *rtd = substream->private_data;
692 struct snd_soc_device *socdev = rtd->socdev; 692 struct snd_soc_device *socdev = rtd->socdev;
693 struct snd_soc_codec *codec = socdev->card->codec; 693 struct snd_soc_codec *codec = socdev->card->codec;
694 struct wm8978_priv *wm8978 = codec->private_data; 694 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
695 /* Word length mask = 0x60 */ 695 /* Word length mask = 0x60 */
696 u16 iface_ctl = snd_soc_read(codec, WM8978_AUDIO_INTERFACE) & ~0x60; 696 u16 iface_ctl = snd_soc_read(codec, WM8978_AUDIO_INTERFACE) & ~0x60;
697 /* Sampling rate mask = 0xe (for filters) */ 697 /* Sampling rate mask = 0xe (for filters) */
@@ -911,7 +911,7 @@ static int wm8978_resume(struct platform_device *pdev)
911{ 911{
912 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 912 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
913 struct snd_soc_codec *codec = socdev->card->codec; 913 struct snd_soc_codec *codec = socdev->card->codec;
914 struct wm8978_priv *wm8978 = codec->private_data; 914 struct wm8978_priv *wm8978 = snd_soc_codec_get_drvdata(codec);
915 int i; 915 int i;
916 u16 *cache = codec->reg_cache; 916 u16 *cache = codec->reg_cache;
917 917
@@ -1019,7 +1019,7 @@ static __devinit int wm8978_register(struct wm8978_priv *wm8978)
1019 INIT_LIST_HEAD(&codec->dapm_widgets); 1019 INIT_LIST_HEAD(&codec->dapm_widgets);
1020 INIT_LIST_HEAD(&codec->dapm_paths); 1020 INIT_LIST_HEAD(&codec->dapm_paths);
1021 1021
1022 codec->private_data = wm8978; 1022 snd_soc_codec_set_drvdata(codec, wm8978);
1023 codec->name = "WM8978"; 1023 codec->name = "WM8978";
1024 codec->owner = THIS_MODULE; 1024 codec->owner = THIS_MODULE;
1025 codec->bias_level = SND_SOC_BIAS_OFF; 1025 codec->bias_level = SND_SOC_BIAS_OFF;