All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@zonque.org>
To: broonie@kernel.org, ryan.lee.analog@gmail.com
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
	robh+dt@kernel.org, Daniel Mack <daniel@zonque.org>
Subject: [PATCH 7/8] ASoC: max98396: Implement DSP speaker monitor
Date: Fri, 24 Jun 2022 12:47:11 +0200	[thread overview]
Message-ID: <20220624104712.1934484-8-daniel@zonque.org> (raw)
In-Reply-To: <20220624104712.1934484-1-daniel@zonque.org>

Allow the selection of the TDM slot that is used to send back speaker
monitor data. The DT property adi,spkfb-slot-no can be used to configure
this setting which defaults to 2.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 sound/soc/codecs/max98396.c | 8 ++++++++
 sound/soc/codecs/max98396.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/sound/soc/codecs/max98396.c b/sound/soc/codecs/max98396.c
index 0a1d98279a3e..f28831f4e74b 100644
--- a/sound/soc/codecs/max98396.c
+++ b/sound/soc/codecs/max98396.c
@@ -1377,6 +1377,9 @@ static int max98396_probe(struct snd_soc_component *component)
 	regmap_write(max98396->regmap,
 		     MAX98396_R2045_PCM_TX_CTRL_2,
 		     max98396->i_slot);
+	regmap_write(max98396->regmap,
+		     MAX98396_R204A_PCM_TX_CTRL_7,
+		     max98396->spkfb_slot);
 
 	if (max98396->v_slot < 8)
 		if (max98396->device_id == CODEC_TYPE_MAX98396)
@@ -1552,6 +1555,11 @@ static void max98396_read_device_property(struct device *dev,
 	else
 		max98396->i_slot = 1;
 
+	if (!device_property_read_u32(dev, "adi,spkfb-slot-no", &value))
+		max98396->spkfb_slot = value & 0xF;
+	else
+		max98396->spkfb_slot = 2;
+
 	if (!device_property_read_u32(dev, "adi,bypass-slot-no", &value))
 		max98396->bypass_slot = value & 0xF;
 	else
diff --git a/sound/soc/codecs/max98396.h b/sound/soc/codecs/max98396.h
index 8fa081f5d2d3..ff330ef61568 100644
--- a/sound/soc/codecs/max98396.h
+++ b/sound/soc/codecs/max98396.h
@@ -303,6 +303,7 @@ struct max98396_priv {
 	struct regulator *pvdd, *vbat;
 	unsigned int v_slot;
 	unsigned int i_slot;
+	unsigned int spkfb_slot;
 	unsigned int bypass_slot;
 	bool interleave_mode;
 	unsigned int ch_size;
-- 
2.36.1


WARNING: multiple messages have this Message-ID (diff)
From: Daniel Mack <daniel@zonque.org>
To: broonie@kernel.org, ryan.lee.analog@gmail.com
Cc: robh+dt@kernel.org, alsa-devel@alsa-project.org,
	devicetree@vger.kernel.org, Daniel Mack <daniel@zonque.org>
Subject: [PATCH 7/8] ASoC: max98396: Implement DSP speaker monitor
Date: Fri, 24 Jun 2022 12:47:11 +0200	[thread overview]
Message-ID: <20220624104712.1934484-8-daniel@zonque.org> (raw)
In-Reply-To: <20220624104712.1934484-1-daniel@zonque.org>

Allow the selection of the TDM slot that is used to send back speaker
monitor data. The DT property adi,spkfb-slot-no can be used to configure
this setting which defaults to 2.

Signed-off-by: Daniel Mack <daniel@zonque.org>
---
 sound/soc/codecs/max98396.c | 8 ++++++++
 sound/soc/codecs/max98396.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/sound/soc/codecs/max98396.c b/sound/soc/codecs/max98396.c
index 0a1d98279a3e..f28831f4e74b 100644
--- a/sound/soc/codecs/max98396.c
+++ b/sound/soc/codecs/max98396.c
@@ -1377,6 +1377,9 @@ static int max98396_probe(struct snd_soc_component *component)
 	regmap_write(max98396->regmap,
 		     MAX98396_R2045_PCM_TX_CTRL_2,
 		     max98396->i_slot);
+	regmap_write(max98396->regmap,
+		     MAX98396_R204A_PCM_TX_CTRL_7,
+		     max98396->spkfb_slot);
 
 	if (max98396->v_slot < 8)
 		if (max98396->device_id == CODEC_TYPE_MAX98396)
@@ -1552,6 +1555,11 @@ static void max98396_read_device_property(struct device *dev,
 	else
 		max98396->i_slot = 1;
 
+	if (!device_property_read_u32(dev, "adi,spkfb-slot-no", &value))
+		max98396->spkfb_slot = value & 0xF;
+	else
+		max98396->spkfb_slot = 2;
+
 	if (!device_property_read_u32(dev, "adi,bypass-slot-no", &value))
 		max98396->bypass_slot = value & 0xF;
 	else
diff --git a/sound/soc/codecs/max98396.h b/sound/soc/codecs/max98396.h
index 8fa081f5d2d3..ff330ef61568 100644
--- a/sound/soc/codecs/max98396.h
+++ b/sound/soc/codecs/max98396.h
@@ -303,6 +303,7 @@ struct max98396_priv {
 	struct regulator *pvdd, *vbat;
 	unsigned int v_slot;
 	unsigned int i_slot;
+	unsigned int spkfb_slot;
 	unsigned int bypass_slot;
 	bool interleave_mode;
 	unsigned int ch_size;
-- 
2.36.1


  parent reply	other threads:[~2022-06-24 10:51 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24 10:47 [PATCH 0/8] ASoC: max98396: Some assorted fixes and additions Daniel Mack
2022-06-24 10:47 ` Daniel Mack
2022-06-24 10:47 ` [PATCH 1/8] ASoC: dt-bindings: max98396: add voltage supplies Daniel Mack
2022-06-24 10:47   ` Daniel Mack
2022-06-24 10:47 ` [PATCH 2/8] ASoC: dt-bindings: max98396: Add #sound-dai-cells Daniel Mack
2022-06-24 10:47   ` Daniel Mack
2022-06-24 17:26   ` Rob Herring
2022-06-24 17:26     ` Rob Herring
2022-06-24 10:47 ` [PATCH 3/8] ASoC: dt-bindings: max98396: Document adi,bypass-slot-no Daniel Mack
2022-06-24 10:47   ` Daniel Mack
2022-06-24 12:42   ` Mark Brown
2022-06-24 12:42     ` Mark Brown
2022-06-24 10:47 ` [PATCH 4/8] ASoC: max98396: add voltage regulators Daniel Mack
2022-06-24 10:47   ` Daniel Mack
2022-06-24 10:47 ` [PATCH 5/8] ASoC: max98396: Improve some error prints Daniel Mack
2022-06-24 10:47   ` Daniel Mack
2022-06-24 10:47 ` [PATCH 6/8] ASoC: max98396: Fix register access for PCM format settings Daniel Mack
2022-06-24 10:47   ` Daniel Mack
2022-06-24 12:52   ` Mark Brown
2022-06-24 12:52     ` Mark Brown
2022-06-24 10:47 ` Daniel Mack [this message]
2022-06-24 10:47   ` [PATCH 7/8] ASoC: max98396: Implement DSP speaker monitor Daniel Mack
2022-06-24 10:47 ` [PATCH 8/8] ASoC: max98396: Fix TDM mode BSEL settings Daniel Mack
2022-06-24 10:47   ` Daniel Mack
2022-06-24 11:34   ` Daniel Mack
2022-06-24 11:34     ` Daniel Mack
2022-06-24 12:54   ` Mark Brown
2022-06-24 12:54     ` Mark Brown
2022-06-27 20:19 ` (subset) [PATCH 0/8] ASoC: max98396: Some assorted fixes and additions Mark Brown
2022-06-27 20:19   ` Mark Brown
2022-06-27 20:26   ` Daniel Mack
2022-06-27 20:26     ` Daniel Mack
2022-06-27 22:23     ` Mark Brown
2022-06-27 22:23       ` Mark Brown

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=20220624104712.1934484-8-daniel@zonque.org \
    --to=daniel@zonque.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=ryan.lee.analog@gmail.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.