Commit e052a1f7 authored by Shenghao Ding's avatar Shenghao Ding Committed by Takashi Iwai
Browse files

ALSA: hda/tas2781: Fix incorrect bit update for non-book-zero or book 0 pages >1



In TAS2781 SPI mode, when accessing non-book-zero or page numbers greater
than 1 in book 0, an additional byte must be read. The first byte in such
cases is a dummy byte and should be ignored.

Fixes: 9fa6a693 ("ALSA: hda/tas2781: Remove tas2781_spi_fwlib.c and leverage SND_SOC_TAS2781_FMWLIB")
Signed-off-by: default avatarShenghao Ding <shenghao-ding@ti.com>
Link: https://patch.msgid.link/20260429054206.429-1-shenghao-ding@ti.com


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 90df4957
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -132,10 +132,18 @@ static int tasdevice_spi_dev_update_bits(struct tasdevice_priv *tas_priv,
	int ret, val;

	/*
	 * In our TAS2781 SPI mode, read/write was masked in last bit of
	 * address, it cause regmap_update_bits() not work as expected.
	 * In TAS2781 SPI mode, when accessing non-book-zero or page numbers
	 * greater than 1 in book 0, an additional byte must be read. The
	 * first byte in such cases is a dummy byte and should be ignored.
	 */
	if ((TASDEVICE_BOOK_ID(reg) > 0) || (TASDEVICE_PAGE_ID(reg) > 1)) {
		unsigned char buf[2];

		ret = tasdevice_dev_bulk_read(tas_priv, chn, reg, buf, 2);
		val = buf[1];
	} else {
		ret = tasdevice_dev_read(tas_priv, chn, reg, &val);
	}
	if (ret < 0) {
		dev_err(tas_priv->dev, "%s, E=%d\n", __func__, ret);
		return ret;