aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/adau1701.c
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-06-24 10:31:29 -0400
committerMark Brown <broonie@linaro.org>2013-06-25 05:32:03 -0400
commitde9fc724daaf5ceaf0af6ef23b2b3b1d933273e3 (patch)
tree92905f54879539c4390067a09340f6ee883474d2 /sound/soc/codecs/adau1701.c
parentf724ba3b07aa5a012b7b0be323484195b5026282 (diff)
ASoC: adau1701: move firmware download to adau1701_reset()
The chip needs a new download after each reset, so the code to do that needs to live in adau1701_reset(). Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/codecs/adau1701.c')
-rw-r--r--sound/soc/codecs/adau1701.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c
index b6b1a773bd37..997fc3b881fe 100644
--- a/sound/soc/codecs/adau1701.c
+++ b/sound/soc/codecs/adau1701.c
@@ -184,27 +184,20 @@ static unsigned int adau1701_read(struct snd_soc_codec *codec, unsigned int reg)
184 return value; 184 return value;
185} 185}
186 186
187static void adau1701_reset(struct snd_soc_codec *codec) 187static int adau1701_reset(struct snd_soc_codec *codec)
188{ 188{
189 struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); 189 struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec);
190
191 if (!gpio_is_valid(adau1701->gpio_nreset))
192 return;
193
194 gpio_set_value(adau1701->gpio_nreset, 0);
195 /* minimum reset time is 20ns */
196 udelay(1);
197 gpio_set_value(adau1701->gpio_nreset, 1);
198 /* power-up time may be as long as 85ms */
199 mdelay(85);
200}
201
202static int adau1701_init(struct snd_soc_codec *codec)
203{
204 int ret;
205 struct i2c_client *client = to_i2c_client(codec->dev); 190 struct i2c_client *client = to_i2c_client(codec->dev);
191 int ret;
206 192
207 adau1701_reset(codec); 193 if (gpio_is_valid(adau1701->gpio_nreset)) {
194 gpio_set_value(adau1701->gpio_nreset, 0);
195 /* minimum reset time is 20ns */
196 udelay(1);
197 gpio_set_value(adau1701->gpio_nreset, 1);
198 /* power-up time may be as long as 85ms */
199 mdelay(85);
200 }
208 201
209 ret = process_sigma_firmware(client, ADAU1701_FIRMWARE); 202 ret = process_sigma_firmware(client, ADAU1701_FIRMWARE);
210 if (ret) { 203 if (ret) {
@@ -213,6 +206,7 @@ static int adau1701_init(struct snd_soc_codec *codec)
213 } 206 }
214 207
215 snd_soc_write(codec, ADAU1701_DACSET, ADAU1701_DACSET_DACINIT); 208 snd_soc_write(codec, ADAU1701_DACSET, ADAU1701_DACSET_DACINIT);
209 snd_soc_write(codec, ADAU1701_DSPCTRL, ADAU1701_DSPCTRL_CR);
216 210
217 return 0; 211 return 0;
218} 212}
@@ -498,12 +492,10 @@ static int adau1701_probe(struct snd_soc_codec *codec)
498 492
499 codec->control_data = to_i2c_client(codec->dev); 493 codec->control_data = to_i2c_client(codec->dev);
500 494
501 ret = adau1701_init(codec); 495 ret = adau1701_reset(codec);
502 if (ret) 496 if (ret)
503 return ret; 497 return ret;
504 498
505 snd_soc_write(codec, ADAU1701_DSPCTRL, ADAU1701_DSPCTRL_CR);
506
507 return 0; 499 return 0;
508} 500}
509 501