Commit b692a436 authored by Daniel Mack's avatar Daniel Mack Committed by Mark Brown

ASoC: ak4104: correct tranceiver enable handling

Move the enabling of the TX diode to hw_params() and disable it again in
hw_free(). This way, the diode is only switched on as long as it needs
to be.
Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent b0ec761b
...@@ -93,7 +93,7 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream, ...@@ -93,7 +93,7 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_codec *codec = dai->codec;
struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec); struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec);
int val = 0; int ret, val = 0;
/* set the IEC958 bits: consumer mode, no copyright bit */ /* set the IEC958 bits: consumer mode, no copyright bit */
val |= IEC958_AES0_CON_NOT_COPYRIGHT; val |= IEC958_AES0_CON_NOT_COPYRIGHT;
...@@ -134,11 +134,33 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream, ...@@ -134,11 +134,33 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
} }
return regmap_write(ak4104->regmap, AK4104_REG_CHN_STATUS(3), val); ret = regmap_write(ak4104->regmap, AK4104_REG_CHN_STATUS(3), val);
if (ret < 0)
return ret;
/* enable transmitter */
ret = regmap_update_bits(ak4104->regmap, AK4104_REG_TX,
AK4104_TX_TXE, AK4104_TX_TXE);
if (ret < 0)
return ret;
return 0;
}
static int ak4104_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct snd_soc_codec *codec = dai->codec;
struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec);
/* disable transmitter */
return regmap_update_bits(ak4104->regmap, AK4104_REG_TX,
AK4104_TX_TXE, 0);
} }
static const struct snd_soc_dai_ops ak4101_dai_ops = { static const struct snd_soc_dai_ops ak4101_dai_ops = {
.hw_params = ak4104_hw_params, .hw_params = ak4104_hw_params,
.hw_free = ak4104_hw_free,
.set_fmt = ak4104_set_dai_fmt, .set_fmt = ak4104_set_dai_fmt,
}; };
......
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