Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <zonque@gmail.com>
To: alsa-devel@alsa-project.org
Cc: broonie@kernel.org, lars@metafoo.de, Daniel Mack <zonque@gmail.com>
Subject: [PATCH v4 1/4] ASoC: codecs: adau1701: move firmware download to adau1701_reset()
Date: Mon, 24 Jun 2013 16:31:29 +0200	[thread overview]
Message-ID: <1372084292-4859-2-git-send-email-zonque@gmail.com> (raw)
In-Reply-To: <1372084292-4859-1-git-send-email-zonque@gmail.com>

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>
---
 sound/soc/codecs/adau1701.c | 32 ++++++++++++--------------------
 1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c
index b6b1a77..997fc3b 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)
 	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);
-
-	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);
+	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);
 	if (ret) {
@@ -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;
 }
 
-- 
1.8.1.4

  reply	other threads:[~2013-06-24 14:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24 14:31 [PATCH v4 0/4] ASoC: codecs: some more improvements for adau1701 Daniel Mack
2013-06-24 14:31 ` Daniel Mack [this message]
2013-06-24 17:12   ` [PATCH v4 1/4] ASoC: codecs: adau1701: move firmware download to adau1701_reset() Lars-Peter Clausen
2013-06-24 14:31 ` [PATCH v4 2/4] ASoC: codecs: adau1701: allow configuration of PLL mode pins Daniel Mack
2013-06-24 14:31 ` [PATCH v4 3/4] ASoC: codecs: adau1701: switch to direct regmap API usage Daniel Mack
2013-06-24 17:08   ` Lars-Peter Clausen
2013-06-24 14:31 ` [PATCH v4 4/4] ASoC: codecs: adau1701: add support for pin muxing Daniel Mack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1372084292-4859-2-git-send-email-zonque@gmail.com \
    --to=zonque@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lars@metafoo.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox