Skip to contentSkip to conversation

ASoC: tas2781: Fix TAS2781/TAS5825 PPC version logic conflict

PATCH In review Shenghao Ding 2 participants 4 messages Oct 1

Subsystems (3)
lore
Share & tools
lore

Shenghao Ding

author maintainer
#0 lore raw

PATCH 1/1 ASoC: tas2781: Fix TAS2781/TAS5825 PPC version logic conflict

Fix cross-team code conflict in shared PPC version check path, ensure TAS2781 and TAS5825 apply their respective correct firmware parsing routines, eliminate version matching misbehavior between the two models.

Fixes f4ee43ae6ea8 ("ALSA: hda: Add TAS5825 support")
---
 sound/soc/codecs/tas2781-fmwlib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/codecs/tas2781-fmwlib.c +4 -2
index e8ceeb027e1b..3f12051cb0b5 100644
@@ -1992,7 +1992,8 @@ static void dspbin_type_check(struct tasdevice_priv *tas_priv,
 	if (tas_priv->chip_id == TAS2573)
 		return;
 	if ((tas_priv->dspbin_typ != TASDEV_BASIC) &&
-		(ppcver < PPC3_VERSION_TAS5825_BASE))
+		(ppcver < PPC3_VERSION_TAS5825_BASE ||
+		tas_priv->chip_id == TAS2781))
 		tas_priv->fw_parse_fct_param_address =
 			fw_parse_fct_param_address;
 }
@@ -2003,7 +2004,8 @@ static int dspfw_default_callback(struct tasdevice_priv *tas_priv,
 	int rc = 0;
 
 	if (drv_ver == 0x100) {
-		if (ppcver >= PPC3_VERSION_TAS5825_BASE) {
+		if (ppcver >= PPC3_VERSION_TAS5825_BASE &&
+			tas_priv->chip_id == TAS5825) {
 			tas_priv->fw_parse_variable_header =
 				fw_parse_variable_header_kernel;
 			tas_priv->fw_parse_program_data =
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH 1/1 ASoC: tas2781: Refactor register error log with unified macro

Add reusable TAS_REG_ERR_LOG macro in tas2781 header, replace all duplicated error logging code in register read/write/bulk ops and update_bits functions. Add channel ID to error log for better debuggability.

---
 include/sound/tas2781.h               |  7 +++++++
 sound/soc/codecs/tas2781-comlib-i2c.c |  5 +----
 sound/soc/codecs/tas2781-comlib.c     | 20 ++++----------------
 3 files changed, 12 insertions(+), 20 deletions(-)
include/sound/tas2781.h +7 -0
index 7367c76959aa..f4275226366d 100644
@@ -49,6 +49,13 @@
 #define TASDEVICE_REG(book, page, reg)	(((book * 256 * 128) + \
 					(page * 128)) + reg)
 
+#define TAS_REG_ERR_LOG(dev, chn, reg, ret) \
+	dev_err((dev), "%s, C%uBx%02xPx%02xRx%02x E=%d\n", \
+		__func__, chn, TASDEVICE_BOOK_ID(reg), \
+		TASDEVICE_PAGE_ID(reg), \
+		TASDEVICE_PAGE_REG(reg), \
+		(ret))
+
 /* Software Reset, compatble with new device (TAS5825). */
 #define TASDEVICE_REG_SWRESET		TASDEVICE_REG(0x0, 0x0, 0x01)
 #define TASDEVICE_REG_SWRESET_RESET	BIT(0)
sound/soc/codecs/tas2781-comlib-i2c.c +1 -4
index dd86fc90a7d0..46777be765ef 100644
@@ -131,10 +131,7 @@ int tasdevice_dev_update_bits(
 		ret = regmap_update_bits(map, TASDEVICE_PGRG(reg),
 			mask, value);
 		if (ret < 0)
-			dev_err(tas_priv->dev, "%s, Bx%02xPx%02xRx%02x E=%d\n",
-				__func__, TASDEVICE_BOOK_ID(reg),
-				TASDEVICE_PAGE_ID(reg),
-				TASDEVICE_PAGE_REG(reg), ret);
+			TAS_REG_ERR_LOG(tas_priv->dev, chn, reg, ret);
 	} else {
 		dev_err(tas_priv->dev, "%s, no such channel(%d)\n", __func__,
 			chn);
sound/soc/codecs/tas2781-comlib.c +4 -16
index e4c8a04a9187..58e19d6d1f75 100644
@@ -34,10 +34,7 @@ int tasdevice_dev_read(struct tasdevice_priv *tas_priv,
 
 		ret = regmap_read(map, TASDEVICE_PGRG(reg), val);
 		if (ret < 0)
-			dev_err(tas_priv->dev, "%s, Bx%02xPx%02xRx%02x E=%d\n",
-				__func__, TASDEVICE_BOOK_ID(reg),
-				TASDEVICE_PAGE_ID(reg),
-				TASDEVICE_PAGE_REG(reg), ret);
+			TAS_REG_ERR_LOG(tas_priv->dev, chn, reg, ret);
 	} else {
 		ret = -EINVAL;
 		dev_err(tas_priv->dev, "%s, no such channel(%d)\n", __func__,
@@ -65,10 +62,7 @@ int tasdevice_dev_bulk_read(struct tasdevice_priv *tas_priv,
 
 		ret = regmap_bulk_read(map, TASDEVICE_PGRG(reg), data, len);
 		if (ret < 0)
-			dev_err(tas_priv->dev, "%s, Bx%02xPx%02xRx%02x E=%d\n",
-				__func__, TASDEVICE_BOOK_ID(reg),
-				TASDEVICE_PAGE_ID(reg),
-				TASDEVICE_PAGE_REG(reg), ret);
+			TAS_REG_ERR_LOG(tas_priv->dev, chn, reg, ret);
 	} else
 		dev_err(tas_priv->dev, "%s, no such channel(%d)\n", __func__,
 			chn);
@@ -94,10 +88,7 @@ int tasdevice_dev_write(struct tasdevice_priv *tas_priv,
 		ret = regmap_write(map, TASDEVICE_PGRG(reg),
 			value);
 		if (ret < 0)
-			dev_err(tas_priv->dev, "%s, Bx%02xPx%02xRx%02x E=%d\n",
-				__func__, TASDEVICE_BOOK_ID(reg),
-				TASDEVICE_PAGE_ID(reg),
-				TASDEVICE_PAGE_REG(reg), ret);
+			TAS_REG_ERR_LOG(tas_priv->dev, chn, reg, ret);
 	} else {
 		ret = -EINVAL;
 		dev_err(tas_priv->dev, "%s, no such channel(%d)\n", __func__,
@@ -127,10 +118,7 @@ int tasdevice_dev_bulk_write(
 		ret = regmap_bulk_write(map, TASDEVICE_PGRG(reg),
 			data, len);
 		if (ret < 0)
-			dev_err(tas_priv->dev, "%s, Bx%02xPx%02xRx%02x E=%d\n",
-				__func__, TASDEVICE_BOOK_ID(reg),
-				TASDEVICE_PAGE_ID(reg),
-				TASDEVICE_PAGE_REG(reg), ret);
+			TAS_REG_ERR_LOG(tas_priv->dev, chn, reg, ret);
 	} else {
 		ret = -EINVAL;
 		dev_err(tas_priv->dev, "%s, no such channel(%d)\n", __func__,
Signature · 1 line
2.43.0
maintainer
#2 lore raw

Re: [PATCH v1] ASoC: tas2781: Refactor register error log with unified macro

Quoted 1 line · Shenghao Ding

ASoC: tas2781: Refactor register error log with unified macro

Applied to

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

Thanks!

[1/1] ASoC: tas2781: Refactor register error log with unified macro

      https://git.kernel.org/broonie/sound/c/5367243a37f7

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

maintainer
#3 lore raw
In reply to Shenghao Ding
Quoted 3 lines · Shenghao Ding

Fix cross-team code conflict in shared PPC version check path, ensure TAS2781 and TAS5825 apply their respective correct firmware parsing routines, eliminate version matching misbehavior between the two models.

If you are sending multiple patches threaded together in a series please number the patches in the series, sending them without numbering really confuses tooling. If the patches don't have any dependency it's often preferable to just send them completely separately, not as a series at all, since that stops problems with one patch holding up other patches.

You might want to look at b4 to send the patches, especially it's web submission endpoint which avoids having to configure mail:

https://b4.docs.kernel.org/en/latest/contributor/overview.html