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

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: default avatarDaniel Mack <zonque@gmail.com>
Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent f724ba3b
...@@ -184,27 +184,20 @@ static unsigned int adau1701_read(struct snd_soc_codec *codec, unsigned int reg) ...@@ -184,27 +184,20 @@ static unsigned int adau1701_read(struct snd_soc_codec *codec, unsigned int reg)
return value; return value;
} }
static void adau1701_reset(struct snd_soc_codec *codec) static int adau1701_reset(struct snd_soc_codec *codec)
{ {
struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec);
if (!gpio_is_valid(adau1701->gpio_nreset))
return;
gpio_set_value(adau1701->gpio_nreset, 0);
/* minimum reset time is 20ns */
udelay(1);
gpio_set_value(adau1701->gpio_nreset, 1);
/* power-up time may be as long as 85ms */
mdelay(85);
}
static int adau1701_init(struct snd_soc_codec *codec)
{
int ret;
struct i2c_client *client = to_i2c_client(codec->dev); struct i2c_client *client = to_i2c_client(codec->dev);
int ret;
adau1701_reset(codec); if (gpio_is_valid(adau1701->gpio_nreset)) {
gpio_set_value(adau1701->gpio_nreset, 0);
/* minimum reset time is 20ns */
udelay(1);
gpio_set_value(adau1701->gpio_nreset, 1);
/* power-up time may be as long as 85ms */
mdelay(85);
}
ret = process_sigma_firmware(client, ADAU1701_FIRMWARE); ret = process_sigma_firmware(client, ADAU1701_FIRMWARE);
if (ret) { if (ret) {
...@@ -213,6 +206,7 @@ static int adau1701_init(struct snd_soc_codec *codec) ...@@ -213,6 +206,7 @@ static int adau1701_init(struct snd_soc_codec *codec)
} }
snd_soc_write(codec, ADAU1701_DACSET, ADAU1701_DACSET_DACINIT); snd_soc_write(codec, ADAU1701_DACSET, ADAU1701_DACSET_DACINIT);
snd_soc_write(codec, ADAU1701_DSPCTRL, ADAU1701_DSPCTRL_CR);
return 0; return 0;
} }
...@@ -498,12 +492,10 @@ static int adau1701_probe(struct snd_soc_codec *codec) ...@@ -498,12 +492,10 @@ static int adau1701_probe(struct snd_soc_codec *codec)
codec->control_data = to_i2c_client(codec->dev); codec->control_data = to_i2c_client(codec->dev);
ret = adau1701_init(codec); ret = adau1701_reset(codec);
if (ret) if (ret)
return ret; return ret;
snd_soc_write(codec, ADAU1701_DSPCTRL, ADAU1701_DSPCTRL_CR);
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