All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Ardelean <alex@shruggie.ro>
To: devicetree@vger.kernel.org, alsa-devel@alsa-project.org
Cc: broonie@kernel.org, lgirdwood@gmail.com,
	krzysztof.kozlowski+dt@linaro.org, perex@perex.cz,
	tiwai@suse.com, steffen.aschbacher@stihl.de,
	Alexandru Ardelean <alex@shruggie.ro>
Subject: [PATCH 3/4] ASoC: tas5720: set bit 7 in ANALOG_CTRL_REG for TAS5720A-Q1 during probe
Date: Sun, 15 Jan 2023 21:33:46 +0200	[thread overview]
Message-ID: <20230115193347.24190-3-alex@shruggie.ro> (raw)
In-Reply-To: <20230115193347.24190-1-alex@shruggie.ro>

From: Steffen Aschbacher <steffen.aschbacher@stihl.de>

Set the reserved bit 7 in the ANALOG_CTRL_REG for the TAS5720A-Q1 device,
when probing.
The datasheet mentions that the bit should be 1 during reset/powerup.

The device did not initialize before setting this value to 1. So, this
could be a quirk of this device. Or it could be a quirk with the board on
which it was tested.

That is why this patch is separate from the patch that adds support for the
TAS5720A-Q1 device.
It's unclear whether this change is the proper way to do it.

Signed-off-by: Steffen Aschbacher <steffen.aschbacher@stihl.de>
Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
---
 sound/soc/codecs/tas5720.c | 13 +++++++++++++
 sound/soc/codecs/tas5720.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c
index d9d08593ff7a..0a7ad35c3b9b 100644
--- a/sound/soc/codecs/tas5720.c
+++ b/sound/soc/codecs/tas5720.c
@@ -350,6 +350,19 @@ static int tas5720_codec_probe(struct snd_soc_component *component)
 	if (ret < 0)
 		goto error_snd_soc_component_update_bits;
 
+	/* Set Bit 7 in TAS5720_ANALOG_CTRL_REG to 1 for TAS5720A_Q1 */
+	switch (tas5720->devtype) {
+	case TAS5720A_Q1:
+		ret = snd_soc_component_update_bits(component, TAS5720_ANALOG_CTRL_REG,
+						    TAS5720_Q1_RESERVED7_BIT,
+						    TAS5720_Q1_RESERVED7_BIT);
+		break;
+	default:
+		break;
+	}
+	if (ret < 0)
+		goto error_snd_soc_component_update_bits;
+
 	/*
 	 * Enter shutdown mode - our default when not playing audio - to
 	 * minimize current consumption. On the TAS5720 there is no real down
diff --git a/sound/soc/codecs/tas5720.h b/sound/soc/codecs/tas5720.h
index b38459570241..54b59b05ef0a 100644
--- a/sound/soc/codecs/tas5720.h
+++ b/sound/soc/codecs/tas5720.h
@@ -81,6 +81,7 @@
 #define TAS5720_ANALOG_GAIN_SHIFT	(0x2)
 
 /* TAS5720_Q1_ANALOG_CTRL_REG */
+#define TAS5720_Q1_RESERVED7_BIT	BIT(7)
 #define TAS5720_Q1_CHAN_SEL		BIT(1)
 
 /* TAS5720_FAULT_REG */
-- 
2.34.1


WARNING: multiple messages have this Message-ID (diff)
From: Alexandru Ardelean <alex@shruggie.ro>
To: devicetree@vger.kernel.org, alsa-devel@alsa-project.org
Cc: steffen.aschbacher@stihl.de, tiwai@suse.com, lgirdwood@gmail.com,
	broonie@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	Alexandru Ardelean <alex@shruggie.ro>
Subject: [PATCH 3/4] ASoC: tas5720: set bit 7 in ANALOG_CTRL_REG for TAS5720A-Q1 during probe
Date: Sun, 15 Jan 2023 21:33:46 +0200	[thread overview]
Message-ID: <20230115193347.24190-3-alex@shruggie.ro> (raw)
In-Reply-To: <20230115193347.24190-1-alex@shruggie.ro>

From: Steffen Aschbacher <steffen.aschbacher@stihl.de>

Set the reserved bit 7 in the ANALOG_CTRL_REG for the TAS5720A-Q1 device,
when probing.
The datasheet mentions that the bit should be 1 during reset/powerup.

The device did not initialize before setting this value to 1. So, this
could be a quirk of this device. Or it could be a quirk with the board on
which it was tested.

That is why this patch is separate from the patch that adds support for the
TAS5720A-Q1 device.
It's unclear whether this change is the proper way to do it.

Signed-off-by: Steffen Aschbacher <steffen.aschbacher@stihl.de>
Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
---
 sound/soc/codecs/tas5720.c | 13 +++++++++++++
 sound/soc/codecs/tas5720.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c
index d9d08593ff7a..0a7ad35c3b9b 100644
--- a/sound/soc/codecs/tas5720.c
+++ b/sound/soc/codecs/tas5720.c
@@ -350,6 +350,19 @@ static int tas5720_codec_probe(struct snd_soc_component *component)
 	if (ret < 0)
 		goto error_snd_soc_component_update_bits;
 
+	/* Set Bit 7 in TAS5720_ANALOG_CTRL_REG to 1 for TAS5720A_Q1 */
+	switch (tas5720->devtype) {
+	case TAS5720A_Q1:
+		ret = snd_soc_component_update_bits(component, TAS5720_ANALOG_CTRL_REG,
+						    TAS5720_Q1_RESERVED7_BIT,
+						    TAS5720_Q1_RESERVED7_BIT);
+		break;
+	default:
+		break;
+	}
+	if (ret < 0)
+		goto error_snd_soc_component_update_bits;
+
 	/*
 	 * Enter shutdown mode - our default when not playing audio - to
 	 * minimize current consumption. On the TAS5720 there is no real down
diff --git a/sound/soc/codecs/tas5720.h b/sound/soc/codecs/tas5720.h
index b38459570241..54b59b05ef0a 100644
--- a/sound/soc/codecs/tas5720.h
+++ b/sound/soc/codecs/tas5720.h
@@ -81,6 +81,7 @@
 #define TAS5720_ANALOG_GAIN_SHIFT	(0x2)
 
 /* TAS5720_Q1_ANALOG_CTRL_REG */
+#define TAS5720_Q1_RESERVED7_BIT	BIT(7)
 #define TAS5720_Q1_CHAN_SEL		BIT(1)
 
 /* TAS5720_FAULT_REG */
-- 
2.34.1


  parent reply	other threads:[~2023-01-15 19:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-15 19:33 [PATCH 1/4] ASoC: codecs: tas5720: split a tas5720_mute_soc_component() function Alexandru Ardelean
2023-01-15 19:33 ` Alexandru Ardelean
2023-01-15 19:33 ` [PATCH 2/4] ASoC: codecs: tas5720: add support for TAS5720A-Q1 (automotive) variant Alexandru Ardelean
2023-01-15 19:33   ` Alexandru Ardelean
2023-01-25 14:23   ` Mark Brown
2023-01-25 14:23     ` Mark Brown
2023-01-28  8:17     ` Alexandru Ardelean
2023-01-28  8:17       ` Alexandru Ardelean
2023-01-15 19:33 ` Alexandru Ardelean [this message]
2023-01-15 19:33   ` [PATCH 3/4] ASoC: tas5720: set bit 7 in ANALOG_CTRL_REG for TAS5720A-Q1 during probe Alexandru Ardelean
2023-01-15 19:33 ` [PATCH 4/4] ASoC: dt-bindings: add entry for TAS5720A-Q1 driver Alexandru Ardelean
2023-01-15 19:33   ` Alexandru Ardelean
2023-01-16  8:25   ` Krzysztof Kozlowski
2023-01-16  8:25     ` Krzysztof Kozlowski

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=20230115193347.24190-3-alex@shruggie.ro \
    --to=alex@shruggie.ro \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=perex@perex.cz \
    --cc=steffen.aschbacher@stihl.de \
    --cc=tiwai@suse.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.