aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-03-06 16:22:16 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-03-06 21:37:38 -0500
commitb692a436e1dc7227f2b7cf447797c3dc6ece5c29 (patch)
treead011568ff8a232bbd1c1bff8ccc10cc55402d9e
parentb0ec761b99291f3c0f28ac370f94c145ec806095 (diff)
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: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/codecs/ak4104.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c
index 58f390d3ea7a..c7cfdf957e4d 100644
--- a/sound/soc/codecs/ak4104.c
+++ b/sound/soc/codecs/ak4104.c
@@ -93,7 +93,7 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
93{ 93{
94 struct snd_soc_codec *codec = dai->codec; 94 struct snd_soc_codec *codec = dai->codec;
95 struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec); 95 struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec);
96 int val = 0; 96 int ret, val = 0;
97 97
98 /* set the IEC958 bits: consumer mode, no copyright bit */ 98 /* set the IEC958 bits: consumer mode, no copyright bit */
99 val |= IEC958_AES0_CON_NOT_COPYRIGHT; 99 val |= IEC958_AES0_CON_NOT_COPYRIGHT;
@@ -134,11 +134,33 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
134 return -EINVAL; 134 return -EINVAL;
135 } 135 }
136 136
137 return regmap_write(ak4104->regmap, AK4104_REG_CHN_STATUS(3), val); 137 ret = regmap_write(ak4104->regmap, AK4104_REG_CHN_STATUS(3), val);
138 if (ret < 0)
139 return ret;
140
141 /* enable transmitter */
142 ret = regmap_update_bits(ak4104->regmap, AK4104_REG_TX,
143 AK4104_TX_TXE, AK4104_TX_TXE);
144 if (ret < 0)
145 return ret;
146
147 return 0;
148}
149
150static int ak4104_hw_free(struct snd_pcm_substream *substream,
151 struct snd_soc_dai *dai)
152{
153 struct snd_soc_codec *codec = dai->codec;
154 struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec);
155
156 /* disable transmitter */
157 return regmap_update_bits(ak4104->regmap, AK4104_REG_TX,
158 AK4104_TX_TXE, 0);
138} 159}
139 160
140static const struct snd_soc_dai_ops ak4101_dai_ops = { 161static const struct snd_soc_dai_ops ak4101_dai_ops = {
141 .hw_params = ak4104_hw_params, 162 .hw_params = ak4104_hw_params,
163 .hw_free = ak4104_hw_free,
142 .set_fmt = ak4104_set_dai_fmt, 164 .set_fmt = ak4104_set_dai_fmt,
143}; 165};
144 166