* [PATCH v1] ALSA: hda/tas2781: Upgrade calibratd-data writing code to support Alpha and Beta dsp firmware
@ 2025-03-28 7:43 Shenghao Ding
2025-03-28 12:32 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Shenghao Ding @ 2025-03-28 7:43 UTC (permalink / raw)
To: tiwai
Cc: broonie, andriy.shevchenko, 13564923607, alsa-devel, linux-kernel,
baojun.xu, Baojun.Xu, robinchen, Shenghao Ding
Since 2025, the firmware for tas2781 has been added more audio acoustic
features, such as non-linear compensation, advanced battery guard,
rattle-noise suppression, etc. The version was divided into two different
series. Both series have a slight change on the calibrated data storage
addresses, which becames flexible instead of fixed. In order to support
new firwmares in time, the code have some related upgrades.
Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
---
v2:
- revise the subject and description.
v1:
- Add updating calibration addresses code into tas2781_apply_calib in
case of Alpha and Beta firmware.
---
sound/pci/hda/tas2781_hda_i2c.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c
index 9ed49b0dbe6b..29dc4f500580 100644
--- a/sound/pci/hda/tas2781_hda_i2c.c
+++ b/sound/pci/hda/tas2781_hda_i2c.c
@@ -558,28 +558,38 @@ static int tas2563_save_calibration(struct tasdevice_priv *tas_priv)
static void tas2781_apply_calib(struct tasdevice_priv *tas_priv)
{
- static const unsigned char page_array[CALIB_MAX] = {
- 0x17, 0x18, 0x18, 0x13, 0x18,
+ struct calidata *cali_data = &tas_priv->cali_data;
+ struct cali_reg *r = &cali_data->cali_reg_array;
+ unsigned int cali_reg[CALIB_MAX] = {
+ TASDEVICE_REG(0, 0x17, 0x74),
+ TASDEVICE_REG(0, 0x18, 0x0c),
+ TASDEVICE_REG(0, 0x18, 0x14),
+ TASDEVICE_REG(0, 0x13, 0x70),
+ TASDEVICE_REG(0, 0x18, 0x7c),
};
- static const unsigned char rgno_array[CALIB_MAX] = {
- 0x74, 0x0c, 0x14, 0x70, 0x7c,
- };
- int offset = 0;
int i, j, rc;
+ int oft = 0;
__be32 data;
+ if (tas_priv->dspbin_typ != TASDEV_BASIC) {
+ cali_reg[0] = r->r0_reg;
+ cali_reg[1] = r->invr0_reg;
+ cali_reg[2] = r->r0_low_reg;
+ cali_reg[3] = r->pow_reg;
+ cali_reg[4] = r->tlimit_reg;
+ }
+
for (i = 0; i < tas_priv->ndev; i++) {
for (j = 0; j < CALIB_MAX; j++) {
data = cpu_to_be32(
- *(uint32_t *)&tas_priv->cali_data.data[offset]);
+ *(uint32_t *)&tas_priv->cali_data.data[oft]);
rc = tasdevice_dev_bulk_write(tas_priv, i,
- TASDEVICE_REG(0, page_array[j], rgno_array[j]),
- (unsigned char *)&data, 4);
+ cali_reg[j], (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;
+ oft += 4;
}
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v1] ALSA: hda/tas2781: Upgrade calibratd-data writing code to support Alpha and Beta dsp firmware
2025-03-28 7:43 [PATCH v1] ALSA: hda/tas2781: Upgrade calibratd-data writing code to support Alpha and Beta dsp firmware Shenghao Ding
@ 2025-03-28 12:32 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2025-03-28 12:32 UTC (permalink / raw)
To: Shenghao Ding
Cc: broonie, andriy.shevchenko, 13564923607, alsa-devel, linux-kernel,
baojun.xu, Baojun.Xu, robinchen
On Fri, 28 Mar 2025 08:43:26 +0100,
Shenghao Ding wrote:
>
> Since 2025, the firmware for tas2781 has been added more audio acoustic
> features, such as non-linear compensation, advanced battery guard,
> rattle-noise suppression, etc. The version was divided into two different
> series. Both series have a slight change on the calibrated data storage
> addresses, which becames flexible instead of fixed. In order to support
> new firwmares in time, the code have some related upgrades.
>
> Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
>
> ---
> v2:
> - revise the subject and description.
> v1:
> - Add updating calibration addresses code into tas2781_apply_calib in
> case of Alpha and Beta firmware.
This looks *much* better. Applied now.
thanks,
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-28 12:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-28 7:43 [PATCH v1] ALSA: hda/tas2781: Upgrade calibratd-data writing code to support Alpha and Beta dsp firmware Shenghao Ding
2025-03-28 12:32 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox