aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2016-11-04 13:26:57 -0400
committerMark Brown <broonie@kernel.org>2016-11-04 13:43:08 -0400
commit7aacbc7ff7f6da9ec6deb833154f0883497ab82f (patch)
tree3901d8931a825d570ebde003c17b9d5aaf8ae585
parent6bbf787bb70c8a16509a2d51182423a6f6977742 (diff)
ASoC: stac9766: Remove ac97_read/ac97_write wrappers
Since the regmap conversion ac97_read/ac97_write are just simple wrappers around snd_soc_read/snd_soc_write. Use those instead directly and remove the wrappers. Also use snd_soc_update_bits() where appropriate. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/stac9766.c40
1 files changed, 11 insertions, 29 deletions
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c
index 62cbeedf93b9..9de7fe8af255 100644
--- a/sound/soc/codecs/stac9766.c
+++ b/sound/soc/codecs/stac9766.c
@@ -165,38 +165,22 @@ static const struct snd_kcontrol_new stac9766_snd_ac97_controls[] = {
165 SOC_ENUM("Pop Bypass Mux", stac9766_popbypass_enum), 165 SOC_ENUM("Pop Bypass Mux", stac9766_popbypass_enum),
166}; 166};
167 167
168static int stac9766_ac97_write(struct snd_soc_codec *codec, unsigned int reg,
169 unsigned int val)
170{
171 return snd_soc_write(codec, reg, val);
172}
173
174static unsigned int stac9766_ac97_read(struct snd_soc_codec *codec,
175 unsigned int reg)
176{
177 return snd_soc_read(codec, reg);
178}
179
180static int ac97_analog_prepare(struct snd_pcm_substream *substream, 168static int ac97_analog_prepare(struct snd_pcm_substream *substream,
181 struct snd_soc_dai *dai) 169 struct snd_soc_dai *dai)
182{ 170{
183 struct snd_soc_codec *codec = dai->codec; 171 struct snd_soc_codec *codec = dai->codec;
184 struct snd_pcm_runtime *runtime = substream->runtime; 172 struct snd_pcm_runtime *runtime = substream->runtime;
185 unsigned short reg, vra; 173 unsigned short reg;
186
187 vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS);
188 174
189 vra |= 0x1; /* enable variable rate audio */ 175 /* enable variable rate audio, disable SPDIF output */
190 vra &= ~0x4; /* disable SPDIF output */ 176 snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x5, 0x1);
191
192 stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra);
193 177
194 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 178 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
195 reg = AC97_PCM_FRONT_DAC_RATE; 179 reg = AC97_PCM_FRONT_DAC_RATE;
196 else 180 else
197 reg = AC97_PCM_LR_ADC_RATE; 181 reg = AC97_PCM_LR_ADC_RATE;
198 182
199 return stac9766_ac97_write(codec, reg, runtime->rate); 183 return snd_soc_write(codec, reg, runtime->rate);
200} 184}
201 185
202static int ac97_digital_prepare(struct snd_pcm_substream *substream, 186static int ac97_digital_prepare(struct snd_pcm_substream *substream,
@@ -204,18 +188,16 @@ static int ac97_digital_prepare(struct snd_pcm_substream *substream,
204{ 188{
205 struct snd_soc_codec *codec = dai->codec; 189 struct snd_soc_codec *codec = dai->codec;
206 struct snd_pcm_runtime *runtime = substream->runtime; 190 struct snd_pcm_runtime *runtime = substream->runtime;
207 unsigned short reg, vra; 191 unsigned short reg;
208
209 stac9766_ac97_write(codec, AC97_SPDIF, 0x2002);
210 192
211 vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS); 193 snd_soc_write(codec, AC97_SPDIF, 0x2002);
212 vra |= 0x5; /* Enable VRA and SPDIF out */
213 194
214 stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra); 195 /* Enable VRA and SPDIF out */
196 snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x5, 0x5);
215 197
216 reg = AC97_PCM_FRONT_DAC_RATE; 198 reg = AC97_PCM_FRONT_DAC_RATE;
217 199
218 return stac9766_ac97_write(codec, reg, runtime->rate); 200 return snd_soc_write(codec, reg, runtime->rate);
219} 201}
220 202
221static int stac9766_set_bias_level(struct snd_soc_codec *codec, 203static int stac9766_set_bias_level(struct snd_soc_codec *codec,
@@ -225,11 +207,11 @@ static int stac9766_set_bias_level(struct snd_soc_codec *codec,
225 case SND_SOC_BIAS_ON: /* full On */ 207 case SND_SOC_BIAS_ON: /* full On */
226 case SND_SOC_BIAS_PREPARE: /* partial On */ 208 case SND_SOC_BIAS_PREPARE: /* partial On */
227 case SND_SOC_BIAS_STANDBY: /* Off, with power */ 209 case SND_SOC_BIAS_STANDBY: /* Off, with power */
228 stac9766_ac97_write(codec, AC97_POWERDOWN, 0x0000); 210 snd_soc_write(codec, AC97_POWERDOWN, 0x0000);
229 break; 211 break;
230 case SND_SOC_BIAS_OFF: /* Off, without power */ 212 case SND_SOC_BIAS_OFF: /* Off, without power */
231 /* disable everything including AC link */ 213 /* disable everything including AC link */
232 stac9766_ac97_write(codec, AC97_POWERDOWN, 0xffff); 214 snd_soc_write(codec, AC97_POWERDOWN, 0xffff);
233 break; 215 break;
234 } 216 }
235 return 0; 217 return 0;