aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm9712.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-01-23 17:55:23 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-01-27 05:30:54 -0500
commit6627a653bceb3a54e55e5cdc478ec5b8d5c9cc44 (patch)
tree9a6f157ad1123e4f047689bbf3c4ef88ec1259a4 /sound/soc/codecs/wm9712.c
parent0db4d0705260dd4bddf1e5a5441c58bdf08bdc9f (diff)
ASoC: Push the codec runtime storage into the card structure
This is a further stage on the road to refactoring away the ASoC platform device. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm9712.c')
-rw-r--r--sound/soc/codecs/wm9712.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 4dc90d67530e..b3a8be77676e 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -478,7 +478,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream,
478 struct snd_pcm_runtime *runtime = substream->runtime; 478 struct snd_pcm_runtime *runtime = substream->runtime;
479 struct snd_soc_pcm_runtime *rtd = substream->private_data; 479 struct snd_soc_pcm_runtime *rtd = substream->private_data;
480 struct snd_soc_device *socdev = rtd->socdev; 480 struct snd_soc_device *socdev = rtd->socdev;
481 struct snd_soc_codec *codec = socdev->codec; 481 struct snd_soc_codec *codec = socdev->card->codec;
482 int reg; 482 int reg;
483 u16 vra; 483 u16 vra;
484 484
@@ -499,7 +499,7 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream,
499 struct snd_pcm_runtime *runtime = substream->runtime; 499 struct snd_pcm_runtime *runtime = substream->runtime;
500 struct snd_soc_pcm_runtime *rtd = substream->private_data; 500 struct snd_soc_pcm_runtime *rtd = substream->private_data;
501 struct snd_soc_device *socdev = rtd->socdev; 501 struct snd_soc_device *socdev = rtd->socdev;
502 struct snd_soc_codec *codec = socdev->codec; 502 struct snd_soc_codec *codec = socdev->card->codec;
503 u16 vra, xsle; 503 u16 vra, xsle;
504 504
505 vra = ac97_read(codec, AC97_EXTENDED_STATUS); 505 vra = ac97_read(codec, AC97_EXTENDED_STATUS);
@@ -592,7 +592,7 @@ static int wm9712_soc_suspend(struct platform_device *pdev,
592 pm_message_t state) 592 pm_message_t state)
593{ 593{
594 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 594 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
595 struct snd_soc_codec *codec = socdev->codec; 595 struct snd_soc_codec *codec = socdev->card->codec;
596 596
597 wm9712_set_bias_level(codec, SND_SOC_BIAS_OFF); 597 wm9712_set_bias_level(codec, SND_SOC_BIAS_OFF);
598 return 0; 598 return 0;
@@ -601,7 +601,7 @@ static int wm9712_soc_suspend(struct platform_device *pdev,
601static int wm9712_soc_resume(struct platform_device *pdev) 601static int wm9712_soc_resume(struct platform_device *pdev)
602{ 602{
603 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 603 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
604 struct snd_soc_codec *codec = socdev->codec; 604 struct snd_soc_codec *codec = socdev->card->codec;
605 int i, ret; 605 int i, ret;
606 u16 *cache = codec->reg_cache; 606 u16 *cache = codec->reg_cache;
607 607
@@ -637,10 +637,11 @@ static int wm9712_soc_probe(struct platform_device *pdev)
637 637
638 printk(KERN_INFO "WM9711/WM9712 SoC Audio Codec %s\n", WM9712_VERSION); 638 printk(KERN_INFO "WM9711/WM9712 SoC Audio Codec %s\n", WM9712_VERSION);
639 639
640 socdev->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); 640 socdev->card->codec = kzalloc(sizeof(struct snd_soc_codec),
641 if (socdev->codec == NULL) 641 GFP_KERNEL);
642 if (socdev->card->codec == NULL)
642 return -ENOMEM; 643 return -ENOMEM;
643 codec = socdev->codec; 644 codec = socdev->card->codec;
644 mutex_init(&codec->mutex); 645 mutex_init(&codec->mutex);
645 646
646 codec->reg_cache = kmemdup(wm9712_reg, sizeof(wm9712_reg), GFP_KERNEL); 647 codec->reg_cache = kmemdup(wm9712_reg, sizeof(wm9712_reg), GFP_KERNEL);
@@ -704,15 +705,15 @@ codec_err:
704 kfree(codec->reg_cache); 705 kfree(codec->reg_cache);
705 706
706cache_err: 707cache_err:
707 kfree(socdev->codec); 708 kfree(socdev->card->codec);
708 socdev->codec = NULL; 709 socdev->card->codec = NULL;
709 return ret; 710 return ret;
710} 711}
711 712
712static int wm9712_soc_remove(struct platform_device *pdev) 713static int wm9712_soc_remove(struct platform_device *pdev)
713{ 714{
714 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 715 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
715 struct snd_soc_codec *codec = socdev->codec; 716 struct snd_soc_codec *codec = socdev->card->codec;
716 717
717 if (codec == NULL) 718 if (codec == NULL)
718 return 0; 719 return 0;