Commit 7aacbc7f authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown

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: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6bbf787b
...@@ -165,38 +165,22 @@ static const struct snd_kcontrol_new stac9766_snd_ac97_controls[] = { ...@@ -165,38 +165,22 @@ static const struct snd_kcontrol_new stac9766_snd_ac97_controls[] = {
SOC_ENUM("Pop Bypass Mux", stac9766_popbypass_enum), SOC_ENUM("Pop Bypass Mux", stac9766_popbypass_enum),
}; };
static int stac9766_ac97_write(struct snd_soc_codec *codec, unsigned int reg,
unsigned int val)
{
return snd_soc_write(codec, reg, val);
}
static unsigned int stac9766_ac97_read(struct snd_soc_codec *codec,
unsigned int reg)
{
return snd_soc_read(codec, reg);
}
static int ac97_analog_prepare(struct snd_pcm_substream *substream, static int ac97_analog_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_codec *codec = dai->codec;
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
unsigned short reg, vra; unsigned short reg;
vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS);
vra |= 0x1; /* enable variable rate audio */ /* enable variable rate audio, disable SPDIF output */
vra &= ~0x4; /* disable SPDIF output */ snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x5, 0x1);
stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
reg = AC97_PCM_FRONT_DAC_RATE; reg = AC97_PCM_FRONT_DAC_RATE;
else else
reg = AC97_PCM_LR_ADC_RATE; reg = AC97_PCM_LR_ADC_RATE;
return stac9766_ac97_write(codec, reg, runtime->rate); return snd_soc_write(codec, reg, runtime->rate);
} }
static int ac97_digital_prepare(struct snd_pcm_substream *substream, static int ac97_digital_prepare(struct snd_pcm_substream *substream,
...@@ -204,18 +188,16 @@ static int ac97_digital_prepare(struct snd_pcm_substream *substream, ...@@ -204,18 +188,16 @@ static int ac97_digital_prepare(struct snd_pcm_substream *substream,
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_codec *codec = dai->codec;
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
unsigned short reg, vra; unsigned short reg;
stac9766_ac97_write(codec, AC97_SPDIF, 0x2002);
vra = stac9766_ac97_read(codec, AC97_EXTENDED_STATUS); snd_soc_write(codec, AC97_SPDIF, 0x2002);
vra |= 0x5; /* Enable VRA and SPDIF out */
stac9766_ac97_write(codec, AC97_EXTENDED_STATUS, vra); /* Enable VRA and SPDIF out */
snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x5, 0x5);
reg = AC97_PCM_FRONT_DAC_RATE; reg = AC97_PCM_FRONT_DAC_RATE;
return stac9766_ac97_write(codec, reg, runtime->rate); return snd_soc_write(codec, reg, runtime->rate);
} }
static int stac9766_set_bias_level(struct snd_soc_codec *codec, 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, ...@@ -225,11 +207,11 @@ static int stac9766_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_ON: /* full On */ case SND_SOC_BIAS_ON: /* full On */
case SND_SOC_BIAS_PREPARE: /* partial On */ case SND_SOC_BIAS_PREPARE: /* partial On */
case SND_SOC_BIAS_STANDBY: /* Off, with power */ case SND_SOC_BIAS_STANDBY: /* Off, with power */
stac9766_ac97_write(codec, AC97_POWERDOWN, 0x0000); snd_soc_write(codec, AC97_POWERDOWN, 0x0000);
break; break;
case SND_SOC_BIAS_OFF: /* Off, without power */ case SND_SOC_BIAS_OFF: /* Off, without power */
/* disable everything including AC link */ /* disable everything including AC link */
stac9766_ac97_write(codec, AC97_POWERDOWN, 0xffff); snd_soc_write(codec, AC97_POWERDOWN, 0xffff);
break; break;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment