Skip to content

Commit 7aacbc7

Browse files
larsclausenbroonie
authored andcommitted
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 <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 6bbf787 commit 7aacbc7

File tree

1 file changed

+11
-29
lines changed

1 file changed

+11
-29
lines changed

sound/soc/codecs/stac9766.c

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -165,57 +165,39 @@ static const struct snd_kcontrol_new stac9766_snd_ac97_controls[] = {
165165
SOC_ENUM("Pop Bypass Mux", stac9766_popbypass_enum),
166166
};
167167

168-
static 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-
174-
static unsigned int stac9766_ac97_read(struct snd_soc_codec *codec,
175-
unsigned int reg)
176-
{
177-
return snd_soc_read(codec, reg);
178-
}
179-
180168
static int ac97_analog_prepare(struct snd_pcm_substream *substream,
181169
struct snd_soc_dai *dai)
182170
{
183171
struct snd_soc_codec *codec = dai->codec;
184172
struct snd_pcm_runtime *runtime = substream->runtime;
185-
unsigned short reg, vra;
186-
187-
vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS);
173+
unsigned short reg;
188174

189-
vra |= 0x1; /* enable variable rate audio */
190-
vra &= ~0x4; /* disable SPDIF output */
191-
192-
stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra);
175+
/* enable variable rate audio, disable SPDIF output */
176+
snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x5, 0x1);
193177

194178
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
195179
reg = AC97_PCM_FRONT_DAC_RATE;
196180
else
197181
reg = AC97_PCM_LR_ADC_RATE;
198182

199-
return stac9766_ac97_write(codec, reg, runtime->rate);
183+
return snd_soc_write(codec, reg, runtime->rate);
200184
}
201185

202186
static int ac97_digital_prepare(struct snd_pcm_substream *substream,
203187
struct snd_soc_dai *dai)
204188
{
205189
struct snd_soc_codec *codec = dai->codec;
206190
struct snd_pcm_runtime *runtime = substream->runtime;
207-
unsigned short reg, vra;
208-
209-
stac9766_ac97_write(codec, AC97_SPDIF, 0x2002);
191+
unsigned short reg;
210192

211-
vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS);
212-
vra |= 0x5; /* Enable VRA and SPDIF out */
193+
snd_soc_write(codec, AC97_SPDIF, 0x2002);
213194

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);
215197

216198
reg = AC97_PCM_FRONT_DAC_RATE;
217199

218-
return stac9766_ac97_write(codec, reg, runtime->rate);
200+
return snd_soc_write(codec, reg, runtime->rate);
219201
}
220202

221203
static 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,
225207
case SND_SOC_BIAS_ON: /* full On */
226208
case SND_SOC_BIAS_PREPARE: /* partial On */
227209
case SND_SOC_BIAS_STANDBY: /* Off, with power */
228-
stac9766_ac97_write(codec, AC97_POWERDOWN, 0x0000);
210+
snd_soc_write(codec, AC97_POWERDOWN, 0x0000);
229211
break;
230212
case SND_SOC_BIAS_OFF: /* Off, without power */
231213
/* disable everything including AC link */
232-
stac9766_ac97_write(codec, AC97_POWERDOWN, 0xffff);
214+
snd_soc_write(codec, AC97_POWERDOWN, 0xffff);
233215
break;
234216
}
235217
return 0;

0 commit comments

Comments
 (0)