[PATCH] ASoC: tas571x: add separate tas5733 controls

Bram Vlerick posted 1 patch 6 months, 3 weeks ago
sound/soc/codecs/tas571x.c | 65 +++++++++++++++++++++++++++++++++++++++++++++-
sound/soc/codecs/tas571x.h | 34 ++++++++++++++++++++++++
2 files changed, 98 insertions(+), 1 deletion(-)
[PATCH] ASoC: tas571x: add separate tas5733 controls
Posted by Bram Vlerick 6 months, 3 weeks ago
The controls between the tas5717 and tas5733 should not be shared since
the biquad and register setup is not identical. For example, writing to
0x5c on the tas5717 modifies ch2_bq[10] while on the tas5733 this is
ch1_cross_bq[3].

see https://www.ti.com/lit/ds/symlink/tas5733l.pdf and
https://www.ti.com/lit/ds/symlink/tas5717.pdf for more details on the
register maps.

Signed-off-by: Bram Vlerick <bram.vlerick@openpixelsystems.org>
---
 sound/soc/codecs/tas571x.c | 65 +++++++++++++++++++++++++++++++++++++++++++++-
 sound/soc/codecs/tas571x.h | 34 ++++++++++++++++++++++++
 2 files changed, 98 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tas571x.c b/sound/soc/codecs/tas571x.c
index 6c6e7ae07d80eeeefd0fdf713e09ec097ccda6a0..00b131294547812f1406056d17e6c42ddf92003f 100644
--- a/sound/soc/codecs/tas571x.c
+++ b/sound/soc/codecs/tas571x.c
@@ -718,6 +718,69 @@ static const struct regmap_config tas5721_regmap_config = {
 	.volatile_table			= &tas571x_volatile_regs,
 };
 
+static const struct snd_kcontrol_new tas5733_controls[] = {
+	/* MVOL LSB is ignored - see comments in tas571x_i2c_probe() */
+	SOC_SINGLE_TLV("Master Volume",
+		       TAS571X_MVOL_REG, 1, 0x1ff, 1,
+		       tas5717_volume_tlv),
+	SOC_DOUBLE_R_TLV("Speaker Volume",
+			 TAS571X_CH1_VOL_REG, TAS571X_CH2_VOL_REG,
+			 1, 0x1ff, 1, tas5717_volume_tlv),
+	SOC_DOUBLE("Speaker Switch",
+		   TAS571X_SOFT_MUTE_REG,
+		   TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT,
+		   1, 1),
+
+	SOC_DOUBLE_R_RANGE("CH1 Mixer Volume",
+			   TAS5717_CH1_LEFT_CH_MIX_REG,
+			   TAS5717_CH1_RIGHT_CH_MIX_REG,
+			   16, 0, 0x80, 0),
+
+	SOC_DOUBLE_R_RANGE("CH2 Mixer Volume",
+			   TAS5717_CH2_LEFT_CH_MIX_REG,
+			   TAS5717_CH2_RIGHT_CH_MIX_REG,
+			   16, 0, 0x80, 0),
+
+	/*
+	 * The biquads are named according to the register names.
+	 * Please note that TI's TAS57xx Graphical Development Environment
+	 * tool names them different.
+	 */
+	BIQUAD_COEFS("CH1 - Biquad 0", TAS5733_CH1_BQ0_REG),
+	BIQUAD_COEFS("CH1 - Biquad 1", TAS5733_CH1_BQ1_REG),
+	BIQUAD_COEFS("CH1 - Biquad 2", TAS5733_CH1_BQ2_REG),
+	BIQUAD_COEFS("CH1 - Biquad 3", TAS5733_CH1_BQ3_REG),
+	BIQUAD_COEFS("CH1 - Biquad 4", TAS5733_CH1_BQ4_REG),
+	BIQUAD_COEFS("CH1 - Biquad 5", TAS5733_CH1_BQ5_REG),
+	BIQUAD_COEFS("CH1 - Biquad 6", TAS5733_CH1_BQ6_REG),
+	BIQUAD_COEFS("CH1 - Biquad 7", TAS5733_CH1_BQ7_REG),
+	BIQUAD_COEFS("CH1 - Biquad 8", TAS5733_CH1_BQ8_REG),
+	BIQUAD_COEFS("CH1 - Biquad 9", TAS5733_CH1_BQ9_REG),
+	BIQUAD_COEFS("CH1 - Biquad 10", TAS5733_CH1_BQ10_REG),
+
+	BIQUAD_COEFS("CH2 - Biquad 0", TAS5733_CH2_BQ0_REG),
+	BIQUAD_COEFS("CH2 - Biquad 1", TAS5733_CH2_BQ1_REG),
+	BIQUAD_COEFS("CH2 - Biquad 2", TAS5733_CH2_BQ2_REG),
+	BIQUAD_COEFS("CH2 - Biquad 3", TAS5733_CH2_BQ3_REG),
+	BIQUAD_COEFS("CH2 - Biquad 4", TAS5733_CH2_BQ4_REG),
+	BIQUAD_COEFS("CH2 - Biquad 5", TAS5733_CH2_BQ5_REG),
+	BIQUAD_COEFS("CH2 - Biquad 6", TAS5733_CH2_BQ6_REG),
+	BIQUAD_COEFS("CH2 - Biquad 7", TAS5733_CH2_BQ7_REG),
+	BIQUAD_COEFS("CH2 - Biquad 8", TAS5733_CH2_BQ8_REG),
+	BIQUAD_COEFS("CH2 - Biquad 9", TAS5733_CH2_BQ9_REG),
+	BIQUAD_COEFS("CH2 - Biquad 10", TAS5733_CH2_BQ10_REG),
+
+	BIQUAD_COEFS("CH1 - Cross Biquad 0", TAS5733_CH1_CBQ0_REG),
+	BIQUAD_COEFS("CH1 - Cross Biquad 1", TAS5733_CH1_CBQ1_REG),
+	BIQUAD_COEFS("CH1 - Cross Biquad 2", TAS5733_CH1_CBQ2_REG),
+	BIQUAD_COEFS("CH1 - Cross Biquad 3", TAS5733_CH1_CBQ3_REG),
+
+	BIQUAD_COEFS("CH2 - Cross Biquad 0", TAS5733_CH2_CBQ0_REG),
+	BIQUAD_COEFS("CH2 - Cross Biquad 1", TAS5733_CH2_CBQ1_REG),
+	BIQUAD_COEFS("CH2 - Cross Biquad 2", TAS5733_CH2_CBQ2_REG),
+	BIQUAD_COEFS("CH2 - Cross Biquad 3", TAS5733_CH2_CBQ3_REG),
+};
+
 static const char *const tas5733_supply_names[] = {
 	"AVDD",
 	"DVDD",
@@ -770,7 +833,7 @@ static const struct regmap_config tas5733_regmap_config = {
 static const struct tas571x_chip tas5733_chip = {
 	.supply_names                   = tas5733_supply_names,
 	.num_supply_names               = ARRAY_SIZE(tas5733_supply_names),
-	.controls                       = tas5717_controls,
+	.controls                       = tas5733_controls,
 	.num_controls                   = ARRAY_SIZE(tas5717_controls),
 	.regmap_config                  = &tas5733_regmap_config,
 	.vol_reg_size                   = 2,
diff --git a/sound/soc/codecs/tas571x.h b/sound/soc/codecs/tas571x.h
index 5340d3bec31dfdee0be234aa80dab27b44037304..2b3eff4023b9fb3193e55c0c970b3f71b7b7620b 100644
--- a/sound/soc/codecs/tas571x.h
+++ b/sound/soc/codecs/tas571x.h
@@ -104,4 +104,38 @@
 #define TAS5717_CH2_LEFT_CH_MIX_REG	0x76
 #define TAS5717_CH2_RIGHT_CH_MIX_REG	0x77
 
+#define TAS5733_CH1_BQ0_REG		0x26
+#define TAS5733_CH1_BQ1_REG		0x27
+#define TAS5733_CH1_BQ2_REG		0x28
+#define TAS5733_CH1_BQ3_REG		0x29
+#define TAS5733_CH1_BQ4_REG		0x2a
+#define TAS5733_CH1_BQ5_REG		0x2b
+#define TAS5733_CH1_BQ6_REG		0x2c
+#define TAS5733_CH1_BQ7_REG		0x2d
+#define TAS5733_CH1_BQ8_REG		0x2e
+#define TAS5733_CH1_BQ9_REG		0x2f
+
+#define TAS5733_CH2_BQ0_REG		0x30
+#define TAS5733_CH2_BQ1_REG		0x31
+#define TAS5733_CH2_BQ2_REG		0x32
+#define TAS5733_CH2_BQ3_REG		0x33
+#define TAS5733_CH2_BQ4_REG		0x34
+#define TAS5733_CH2_BQ5_REG		0x35
+#define TAS5733_CH2_BQ6_REG		0x36
+#define TAS5733_CH2_BQ7_REG		0x37
+#define TAS5733_CH2_BQ8_REG		0x38
+#define TAS5733_CH2_BQ9_REG		0x39
+
+#define TAS5733_CH1_BQ10_REG		0x58
+#define TAS5733_CH1_CBQ0_REG		0x59
+#define TAS5733_CH1_CBQ1_REG		0x5a
+#define TAS5733_CH1_CBQ2_REG		0x5b
+#define TAS5733_CH1_CBQ3_REG		0x5c
+
+#define TAS5733_CH2_BQ10_REG		0x5d
+#define TAS5733_CH2_CBQ0_REG		0x5e
+#define TAS5733_CH2_CBQ1_REG		0x5f
+#define TAS5733_CH2_CBQ2_REG		0x60
+#define TAS5733_CH2_CBQ3_REG		0x61
+
 #endif /* _TAS571X_H */

---
base-commit: 914873bc7df913db988284876c16257e6ab772c6
change-id: 20250527-tas5733-biquad-fix-72be988daeaf

Best regards,
-- 
Bram Vlerick <bram.vlerick@openpixelsystems.org>
Re: [PATCH] ASoC: tas571x: add separate tas5733 controls
Posted by Mark Brown 6 months, 3 weeks ago
On Tue, 27 May 2025 13:08:49 +0200, Bram Vlerick wrote:
> The controls between the tas5717 and tas5733 should not be shared since
> the biquad and register setup is not identical. For example, writing to
> 0x5c on the tas5717 modifies ch2_bq[10] while on the tas5733 this is
> ch1_cross_bq[3].
> 
> see https://www.ti.com/lit/ds/symlink/tas5733l.pdf and
> https://www.ti.com/lit/ds/symlink/tas5717.pdf for more details on the
> register maps.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: tas571x: add separate tas5733 controls
      commit: e3de7984e45155888eebbca5a32c1cc5f29fa859

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Re: [PATCH] ASoC: tas571x: add separate tas5733 controls
Posted by Bram Vlerick 6 months, 3 weeks ago
Add Kamel Bouhara