* [PATCH v1] ALSA: hda/tas2781: Fix calibration data parser issue
@ 2025-07-05 13:09 Baojun Xu
2025-07-06 8:08 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Baojun Xu @ 2025-07-05 13:09 UTC (permalink / raw)
To: tiwai
Cc: broonie, andriy.shevchenko, alsa-devel, shenghao-ding, navada,
13916275206, v-hampiholi, v-po, linux-sound, linux-kernel,
baojun.xu
Calibration data was overwritten during parser, it cause issue.
Fixes: 4fe238513407 ("ALSA: hda/tas2781: Move and unified the calibrated-data getting function for SPI and I2C into the tas2781_hda lib")
Signed-off-by: Baojun Xu <baojun.xu@ti.com>
---
sound/pci/hda/tas2781_hda.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sound/pci/hda/tas2781_hda.c b/sound/pci/hda/tas2781_hda.c
index 5f1d4b3e9688..34217ce9f28e 100644
--- a/sound/pci/hda/tas2781_hda.c
+++ b/sound/pci/hda/tas2781_hda.c
@@ -44,7 +44,7 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
TASDEVICE_REG(0, 0x13, 0x70),
TASDEVICE_REG(0, 0x18, 0x7c),
};
- unsigned int crc, oft;
+ unsigned int crc, oft, node_num;
unsigned char *buf;
int i, j, k, l;
@@ -80,8 +80,9 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
dev_err(p->dev, "%s: CRC error\n", __func__);
return;
}
+ node_num = tmp_val[1];
- for (j = 0, k = 0; j < tmp_val[1]; j++) {
+ for (j = 0, k = 0; j < node_num; j++) {
oft = j * 6 + 3;
if (tmp_val[oft] == TASDEV_UEFI_CALI_REG_ADDR_FLG) {
for (i = 0; i < TASDEV_CALIB_N; i++) {
@@ -99,8 +100,9 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
}
data[l] = k;
+ oft++;
for (i = 0; i < TASDEV_CALIB_N * 4; i++)
- data[l + i] = data[4 * oft + i];
+ data[l + i + 1] = data[4 * oft + i];
k++;
}
}
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] ALSA: hda/tas2781: Fix calibration data parser issue
2025-07-05 13:09 [PATCH v1] ALSA: hda/tas2781: Fix calibration data parser issue Baojun Xu
@ 2025-07-06 8:08 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2025-07-06 8:08 UTC (permalink / raw)
To: Baojun Xu
Cc: broonie, andriy.shevchenko, alsa-devel, shenghao-ding, navada,
13916275206, v-hampiholi, v-po, linux-sound, linux-kernel
On Sat, 05 Jul 2025 15:09:08 +0200,
Baojun Xu wrote:
>
> Calibration data was overwritten during parser, it cause issue.
It'd be helpful if you can write a bit more clearly what's the issue
and what you've done here.
thanks,
Takashi
> Fixes: 4fe238513407 ("ALSA: hda/tas2781: Move and unified the calibrated-data getting function for SPI and I2C into the tas2781_hda lib")
>
> Signed-off-by: Baojun Xu <baojun.xu@ti.com>
> ---
> sound/pci/hda/tas2781_hda.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/sound/pci/hda/tas2781_hda.c b/sound/pci/hda/tas2781_hda.c
> index 5f1d4b3e9688..34217ce9f28e 100644
> --- a/sound/pci/hda/tas2781_hda.c
> +++ b/sound/pci/hda/tas2781_hda.c
> @@ -44,7 +44,7 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
> TASDEVICE_REG(0, 0x13, 0x70),
> TASDEVICE_REG(0, 0x18, 0x7c),
> };
> - unsigned int crc, oft;
> + unsigned int crc, oft, node_num;
> unsigned char *buf;
> int i, j, k, l;
>
> @@ -80,8 +80,9 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
> dev_err(p->dev, "%s: CRC error\n", __func__);
> return;
> }
> + node_num = tmp_val[1];
>
> - for (j = 0, k = 0; j < tmp_val[1]; j++) {
> + for (j = 0, k = 0; j < node_num; j++) {
> oft = j * 6 + 3;
> if (tmp_val[oft] == TASDEV_UEFI_CALI_REG_ADDR_FLG) {
> for (i = 0; i < TASDEV_CALIB_N; i++) {
> @@ -99,8 +100,9 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
> }
>
> data[l] = k;
> + oft++;
> for (i = 0; i < TASDEV_CALIB_N * 4; i++)
> - data[l + i] = data[4 * oft + i];
> + data[l + i + 1] = data[4 * oft + i];
> k++;
> }
> }
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-06 8:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-05 13:09 [PATCH v1] ALSA: hda/tas2781: Fix calibration data parser issue Baojun Xu
2025-07-06 8:08 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).