* [PATCH v2] ALSA: ASoC/tas2781: fix wrong calibrated data order
@ 2024-08-13 4:37 Shenghao Ding
2024-08-13 6:59 ` Takashi Iwai
2024-08-13 8:23 ` Andy Shevchenko
0 siblings, 2 replies; 3+ messages in thread
From: Shenghao Ding @ 2024-08-13 4:37 UTC (permalink / raw)
To: broonie
Cc: andriy.shevchenko, lgirdwood, perex, pierre-louis.bossart,
13564923607, alsa-devel, linux-kernel, liam.r.girdwood,
cameron.berkenpas, tiwai, baojun.xu, soyer, Baojun.Xu, robinchen
From: Baojun Xu <baojun.xu@ti.com>
Wrong calibration data order cause sound too low in some device.
Fix wrong calibrated data order, add calibration data converssion
by get_unaligned_be32() after reading from UEFI.
Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Signed-off-by: Baojun Xu <baojun.xu@ti.com>
---
v2:
- Change data type from int to __be32.
v1:
- Change copyright date, and add new maintainer.
- Add unaligned.h included for get_unaligned_be32().
- In tas2781_apply_calib(), change data address transfer directly to
get data by get_unaligned_be32(), and send address to device.
---
sound/pci/hda/tas2781_hda_i2c.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c
index 8a7fe48043d2..5a8193285f9f 100644
--- a/sound/pci/hda/tas2781_hda_i2c.c
+++ b/sound/pci/hda/tas2781_hda_i2c.c
@@ -2,10 +2,12 @@
//
// TAS2781 HDA I2C driver
//
-// Copyright 2023 Texas Instruments, Inc.
+// Copyright 2023 - 2024 Texas Instruments, Inc.
//
// Author: Shenghao Ding <shenghao-ding@ti.com>
+// Current maintainer: Baojun Xu <baojun.xu@ti.com>
+#include <asm/unaligned.h>
#include <linux/acpi.h>
#include <linux/crc8.h>
#include <linux/crc32.h>
@@ -519,20 +521,22 @@ static void tas2781_apply_calib(struct tasdevice_priv *tas_priv)
static const unsigned char rgno_array[CALIB_MAX] = {
0x74, 0x0c, 0x14, 0x70, 0x7c,
};
- unsigned char *data;
+ int offset = 0;
int i, j, rc;
+ __be32 data;
for (i = 0; i < tas_priv->ndev; i++) {
- data = tas_priv->cali_data.data +
- i * TASDEVICE_SPEAKER_CALIBRATION_SIZE;
for (j = 0; j < CALIB_MAX; j++) {
+ data = get_unaligned_be32(
+ &tas_priv->cali_data.data[offset]);
rc = tasdevice_dev_bulk_write(tas_priv, i,
TASDEVICE_REG(0, page_array[j], rgno_array[j]),
- &(data[4 * j]), 4);
+ (unsigned char *)&data, 4);
if (rc < 0)
dev_err(tas_priv->dev,
"chn %d calib %d bulk_wr err = %d\n",
i, j, rc);
+ offset += 4;
}
}
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] ALSA: ASoC/tas2781: fix wrong calibrated data order
2024-08-13 4:37 [PATCH v2] ALSA: ASoC/tas2781: fix wrong calibrated data order Shenghao Ding
@ 2024-08-13 6:59 ` Takashi Iwai
2024-08-13 8:23 ` Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2024-08-13 6:59 UTC (permalink / raw)
To: Shenghao Ding
Cc: broonie, andriy.shevchenko, lgirdwood, perex,
pierre-louis.bossart, 13564923607, alsa-devel, linux-kernel,
liam.r.girdwood, cameron.berkenpas, baojun.xu, soyer, Baojun.Xu,
robinchen
On Tue, 13 Aug 2024 06:37:48 +0200,
Shenghao Ding wrote:
>
> From: Baojun Xu <baojun.xu@ti.com>
>
> Wrong calibration data order cause sound too low in some device.
> Fix wrong calibrated data order, add calibration data converssion
> by get_unaligned_be32() after reading from UEFI.
>
> Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
> Signed-off-by: Baojun Xu <baojun.xu@ti.com>
Applied to for-linus branch now.
I corrected the subject prefix, as this is clearly no ASoC change.
thanks,
Takashi
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] ALSA: ASoC/tas2781: fix wrong calibrated data order
2024-08-13 4:37 [PATCH v2] ALSA: ASoC/tas2781: fix wrong calibrated data order Shenghao Ding
2024-08-13 6:59 ` Takashi Iwai
@ 2024-08-13 8:23 ` Andy Shevchenko
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2024-08-13 8:23 UTC (permalink / raw)
To: Shenghao Ding
Cc: broonie, lgirdwood, perex, pierre-louis.bossart, 13564923607,
alsa-devel, linux-kernel, liam.r.girdwood, cameron.berkenpas,
tiwai, baojun.xu, soyer, Baojun.Xu, robinchen
On Tue, Aug 13, 2024 at 12:37:48PM +0800, Shenghao Ding wrote:
> From: Baojun Xu <baojun.xu@ti.com>
>
> Wrong calibration data order cause sound too low in some device.
> Fix wrong calibrated data order, add calibration data converssion
> by get_unaligned_be32() after reading from UEFI.
...
> rc = tasdevice_dev_bulk_write(tas_priv, i,
> TASDEVICE_REG(0, page_array[j], rgno_array[j]),
> - &(data[4 * j]), 4);
> + (unsigned char *)&data, 4);
Casting is not needed if the helper is written in a way how regmap IO accessors
done.
In any case, 4 is sizeof(data)
> + offset += 4;
Ditto.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-13 8:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-13 4:37 [PATCH v2] ALSA: ASoC/tas2781: fix wrong calibrated data order Shenghao Ding
2024-08-13 6:59 ` Takashi Iwai
2024-08-13 8:23 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox