aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-17 15:04:41 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-23 10:13:54 -0500
commitafad95f82582cdd685cc9ba919eb55150a0ec909 (patch)
treeef01b6739729d43ec018df2e0a802eae8d6a6c8f /sound/soc
parent95a771ca16ad63cfd665bebadbc543857db6fa4e (diff)
ASoC: ak4104: Use snd_soc_update_bits() for read/modify/write
Don't use the internal I/O functions directly. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Daniel Mack <zonque@gmail.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/ak4104.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c
index f12c11548495..d6d9e40cbdee 100644
--- a/sound/soc/codecs/ak4104.c
+++ b/sound/soc/codecs/ak4104.c
@@ -110,12 +110,6 @@ static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai,
110 struct snd_soc_codec *codec = codec_dai->codec; 110 struct snd_soc_codec *codec = codec_dai->codec;
111 int val = 0; 111 int val = 0;
112 112
113 val = ak4104_read_reg_cache(codec, AK4104_REG_CONTROL1);
114 if (val < 0)
115 return val;
116
117 val &= ~(AK4104_CONTROL1_DIF0 | AK4104_CONTROL1_DIF1);
118
119 /* set DAI format */ 113 /* set DAI format */
120 switch (format & SND_SOC_DAIFMT_FORMAT_MASK) { 114 switch (format & SND_SOC_DAIFMT_FORMAT_MASK) {
121 case SND_SOC_DAIFMT_RIGHT_J: 115 case SND_SOC_DAIFMT_RIGHT_J:
@@ -135,7 +129,13 @@ static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai,
135 if ((format & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS) 129 if ((format & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS)
136 return -EINVAL; 130 return -EINVAL;
137 131
138 return ak4104_spi_write(codec, AK4104_REG_CONTROL1, val); 132 ret = snd_soc_update_bits(codec, AK4104_REG_CONTROL1,
133 AK4104_CONTROL1_DIF0 | AK4104_CONTROL1_DIF1,
134 val);
135 if (ret < 0)
136 return ret;
137
138 return 0;
139} 139}
140 140
141static int ak4104_hw_params(struct snd_pcm_substream *substream, 141static int ak4104_hw_params(struct snd_pcm_substream *substream,
@@ -211,16 +211,15 @@ static int ak4104_probe(struct snd_soc_codec *codec)
211 return -ENODEV; 211 return -ENODEV;
212 212
213 /* set power-up and non-reset bits */ 213 /* set power-up and non-reset bits */
214 val = ak4104_read_reg_cache(codec, AK4104_REG_CONTROL1); 214 ret = snd_soc_update_bits(codec, AK4104_REG_CONTROL1,
215 val |= AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN; 215 AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN,
216 ret = ak4104_spi_write(codec, AK4104_REG_CONTROL1, val); 216 AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN);
217 if (ret < 0) 217 if (ret < 0)
218 return ret; 218 return ret;
219 219
220 /* enable transmitter */ 220 /* enable transmitter */
221 val = ak4104_read_reg_cache(codec, AK4104_REG_TX); 221 ret = snd_soc_update_bits(codec, AK4104_REG_TX,
222 val |= AK4104_TX_TXE; 222 AK4104_TX_TXE, AK4104_TX_TXE);
223 ret = ak4104_spi_write(codec, AK4104_REG_TX, val);
224 if (ret < 0) 223 if (ret < 0)
225 return ret; 224 return ret;
226 225
@@ -229,17 +228,10 @@ static int ak4104_probe(struct snd_soc_codec *codec)
229 228
230static int ak4104_remove(struct snd_soc_codec *codec) 229static int ak4104_remove(struct snd_soc_codec *codec)
231{ 230{
232 int val, ret; 231 snd_soc_update_bits(codec, AK4104_REG_CONTROL1,
233 232 AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN, 0);
234 val = ak4104_read_reg_cache(codec, AK4104_REG_CONTROL1);
235 if (val < 0)
236 return val;
237
238 /* clear power-up and non-reset bits */
239 val &= ~(AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN);
240 ret = ak4104_spi_write(codec, AK4104_REG_CONTROL1, val);
241 233
242 return ret; 234 return 0;
243} 235}
244 236
245static struct snd_soc_codec_driver soc_codec_device_ak4104 = { 237static struct snd_soc_codec_driver soc_codec_device_ak4104 = {