Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+12 −20
Original line number Diff line number Diff line
@@ -184,13 +184,13 @@ static unsigned int adau1701_read(struct snd_soc_codec *codec, unsigned int reg)
	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 i2c_client *client = to_i2c_client(codec->dev);
	int ret;

	if (!gpio_is_valid(adau1701->gpio_nreset))
		return;

	if (gpio_is_valid(adau1701->gpio_nreset)) {
		gpio_set_value(adau1701->gpio_nreset, 0);
		/* minimum reset time is 20ns */
		udelay(1);
@@ -199,13 +199,6 @@ static void adau1701_reset(struct snd_soc_codec *codec)
		mdelay(85);
	}

static int adau1701_init(struct snd_soc_codec *codec)
{
	int ret;
	struct i2c_client *client = to_i2c_client(codec->dev);

	adau1701_reset(codec);

	ret = process_sigma_firmware(client, ADAU1701_FIRMWARE);
	if (ret) {
		dev_warn(codec->dev, "Failed to load firmware\n");
@@ -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_DSPCTRL, ADAU1701_DSPCTRL_CR);

	return 0;
}
@@ -498,12 +492,10 @@ static int adau1701_probe(struct snd_soc_codec *codec)

	codec->control_data = to_i2c_client(codec->dev);

	ret = adau1701_init(codec);
	ret = adau1701_reset(codec);
	if (ret)
		return ret;

	snd_soc_write(codec, ADAU1701_DSPCTRL, ADAU1701_DSPCTRL_CR);

	return 0;
}