diff options
Diffstat (limited to 'sound/soc/codecs/ac97.c')
-rw-r--r-- | sound/soc/codecs/ac97.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c index fb53e6511af2..b0d4af145b87 100644 --- a/sound/soc/codecs/ac97.c +++ b/sound/soc/codecs/ac97.c | |||
@@ -30,7 +30,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream, | |||
30 | struct snd_pcm_runtime *runtime = substream->runtime; | 30 | struct snd_pcm_runtime *runtime = substream->runtime; |
31 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 31 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
32 | struct snd_soc_device *socdev = rtd->socdev; | 32 | struct snd_soc_device *socdev = rtd->socdev; |
33 | struct snd_soc_codec *codec = socdev->codec; | 33 | struct snd_soc_codec *codec = socdev->card->codec; |
34 | 34 | ||
35 | int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | 35 | int reg = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? |
36 | AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE; | 36 | AC97_PCM_FRONT_DAC_RATE : AC97_PCM_LR_ADC_RATE; |
@@ -41,6 +41,10 @@ static int ac97_prepare(struct snd_pcm_substream *substream, | |||
41 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 |\ | 41 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 |\ |
42 | SNDRV_PCM_RATE_48000) | 42 | SNDRV_PCM_RATE_48000) |
43 | 43 | ||
44 | static struct snd_soc_dai_ops ac97_dai_ops = { | ||
45 | .prepare = ac97_prepare, | ||
46 | }; | ||
47 | |||
44 | struct snd_soc_dai ac97_dai = { | 48 | struct snd_soc_dai ac97_dai = { |
45 | .name = "AC97 HiFi", | 49 | .name = "AC97 HiFi", |
46 | .ac97_control = 1, | 50 | .ac97_control = 1, |
@@ -56,8 +60,7 @@ struct snd_soc_dai ac97_dai = { | |||
56 | .channels_max = 2, | 60 | .channels_max = 2, |
57 | .rates = STD_AC97_RATES, | 61 | .rates = STD_AC97_RATES, |
58 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | 62 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, |
59 | .ops = { | 63 | .ops = &ac97_dai_ops, |
60 | .prepare = ac97_prepare,}, | ||
61 | }; | 64 | }; |
62 | EXPORT_SYMBOL_GPL(ac97_dai); | 65 | EXPORT_SYMBOL_GPL(ac97_dai); |
63 | 66 | ||
@@ -84,10 +87,10 @@ static int ac97_soc_probe(struct platform_device *pdev) | |||
84 | 87 | ||
85 | printk(KERN_INFO "AC97 SoC Audio Codec %s\n", AC97_VERSION); | 88 | printk(KERN_INFO "AC97 SoC Audio Codec %s\n", AC97_VERSION); |
86 | 89 | ||
87 | socdev->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); | 90 | socdev->card->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); |
88 | if (!socdev->codec) | 91 | if (!socdev->card->codec) |
89 | return -ENOMEM; | 92 | return -ENOMEM; |
90 | codec = socdev->codec; | 93 | codec = socdev->card->codec; |
91 | mutex_init(&codec->mutex); | 94 | mutex_init(&codec->mutex); |
92 | 95 | ||
93 | codec->name = "AC97"; | 96 | codec->name = "AC97"; |
@@ -123,23 +126,21 @@ bus_err: | |||
123 | snd_soc_free_pcms(socdev); | 126 | snd_soc_free_pcms(socdev); |
124 | 127 | ||
125 | err: | 128 | err: |
126 | kfree(socdev->codec->reg_cache); | 129 | kfree(socdev->card->codec); |
127 | kfree(socdev->codec); | 130 | socdev->card->codec = NULL; |
128 | socdev->codec = NULL; | ||
129 | return ret; | 131 | return ret; |
130 | } | 132 | } |
131 | 133 | ||
132 | static int ac97_soc_remove(struct platform_device *pdev) | 134 | static int ac97_soc_remove(struct platform_device *pdev) |
133 | { | 135 | { |
134 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 136 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
135 | struct snd_soc_codec *codec = socdev->codec; | 137 | struct snd_soc_codec *codec = socdev->card->codec; |
136 | 138 | ||
137 | if (!codec) | 139 | if (!codec) |
138 | return 0; | 140 | return 0; |
139 | 141 | ||
140 | snd_soc_free_pcms(socdev); | 142 | snd_soc_free_pcms(socdev); |
141 | kfree(socdev->codec->reg_cache); | 143 | kfree(socdev->card->codec); |
142 | kfree(socdev->codec); | ||
143 | 144 | ||
144 | return 0; | 145 | return 0; |
145 | } | 146 | } |
@@ -149,7 +150,7 @@ static int ac97_soc_suspend(struct platform_device *pdev, pm_message_t msg) | |||
149 | { | 150 | { |
150 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 151 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
151 | 152 | ||
152 | snd_ac97_suspend(socdev->codec->ac97); | 153 | snd_ac97_suspend(socdev->card->codec->ac97); |
153 | 154 | ||
154 | return 0; | 155 | return 0; |
155 | } | 156 | } |
@@ -158,7 +159,7 @@ static int ac97_soc_resume(struct platform_device *pdev) | |||
158 | { | 159 | { |
159 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 160 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
160 | 161 | ||
161 | snd_ac97_resume(socdev->codec->ac97); | 162 | snd_ac97_resume(socdev->card->codec->ac97); |
162 | 163 | ||
163 | return 0; | 164 | return 0; |
164 | } | 165 | } |