Merge tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / sound / soc / codecs / ac97.c
index bd9b1839c8b0e6843d858d93a15d9d440abdc86f..d0ac723eee321a6f36c4f49fb398098a053fede1 100644 (file)
@@ -37,10 +37,11 @@ static int ac97_prepare(struct snd_pcm_substream *substream,
                        struct snd_soc_dai *dai)
 {
        struct snd_soc_codec *codec = dai->codec;
+       struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
 
        int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
                  AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE;
-       return snd_ac97_set_rate(codec->ac97, reg, substream->runtime->rate);
+       return snd_ac97_set_rate(ac97, reg, substream->runtime->rate);
 }
 
 #define STD_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
@@ -53,7 +54,6 @@ static const struct snd_soc_dai_ops ac97_dai_ops = {
 
 static struct snd_soc_dai_driver ac97_dai = {
        .name = "ac97-hifi",
-       .ac97_control = 1,
        .playback = {
                .stream_name = "AC97 Playback",
                .channels_min = 1,
@@ -71,6 +71,7 @@ static struct snd_soc_dai_driver ac97_dai = {
 
 static int ac97_soc_probe(struct snd_soc_codec *codec)
 {
+       struct snd_ac97 *ac97;
        struct snd_ac97_bus *ac97_bus;
        struct snd_ac97_template ac97_template;
        int ret;
@@ -82,24 +83,31 @@ static int ac97_soc_probe(struct snd_soc_codec *codec)
                return ret;
 
        memset(&ac97_template, 0, sizeof(struct snd_ac97_template));
-       ret = snd_ac97_mixer(ac97_bus, &ac97_template, &codec->ac97);
+       ret = snd_ac97_mixer(ac97_bus, &ac97_template, &ac97);
        if (ret < 0)
                return ret;
 
+       snd_soc_codec_set_drvdata(codec, ac97);
+
        return 0;
 }
 
 #ifdef CONFIG_PM
 static int ac97_soc_suspend(struct snd_soc_codec *codec)
 {
-       snd_ac97_suspend(codec->ac97);
+       struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
+
+       snd_ac97_suspend(ac97);
 
        return 0;
 }
 
 static int ac97_soc_resume(struct snd_soc_codec *codec)
 {
-       snd_ac97_resume(codec->ac97);
+
+       struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
+
+       snd_ac97_resume(ac97);
 
        return 0;
 }
@@ -134,7 +142,6 @@ static int ac97_remove(struct platform_device *pdev)
 static struct platform_driver ac97_codec_driver = {
        .driver = {
                .name = "ac97-codec",
-               .owner = THIS_MODULE,
        },
 
        .probe = ac97_probe,