Skip to content

Commit 2a07804

Browse files
Shenghao-Dingtiwai
authored andcommitted
ALSA: hda/tas2781: Upgrade calibratd-data writing code to support Alpha and Beta dsp firmware
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> Link: https://patch.msgid.link/20250328074326.796-1-shenghao-ding@ti.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 84c3c08 commit 2a07804

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

sound/pci/hda/tas2781_hda_i2c.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -558,28 +558,38 @@ static int tas2563_save_calibration(struct tasdevice_priv *tas_priv)
558558

559559
static void tas2781_apply_calib(struct tasdevice_priv *tas_priv)
560560
{
561-
static const unsigned char page_array[CALIB_MAX] = {
562-
0x17, 0x18, 0x18, 0x13, 0x18,
561+
struct calidata *cali_data = &tas_priv->cali_data;
562+
struct cali_reg *r = &cali_data->cali_reg_array;
563+
unsigned int cali_reg[CALIB_MAX] = {
564+
TASDEVICE_REG(0, 0x17, 0x74),
565+
TASDEVICE_REG(0, 0x18, 0x0c),
566+
TASDEVICE_REG(0, 0x18, 0x14),
567+
TASDEVICE_REG(0, 0x13, 0x70),
568+
TASDEVICE_REG(0, 0x18, 0x7c),
563569
};
564-
static const unsigned char rgno_array[CALIB_MAX] = {
565-
0x74, 0x0c, 0x14, 0x70, 0x7c,
566-
};
567-
int offset = 0;
568570
int i, j, rc;
571+
int oft = 0;
569572
__be32 data;
570573

574+
if (tas_priv->dspbin_typ != TASDEV_BASIC) {
575+
cali_reg[0] = r->r0_reg;
576+
cali_reg[1] = r->invr0_reg;
577+
cali_reg[2] = r->r0_low_reg;
578+
cali_reg[3] = r->pow_reg;
579+
cali_reg[4] = r->tlimit_reg;
580+
}
581+
571582
for (i = 0; i < tas_priv->ndev; i++) {
572583
for (j = 0; j < CALIB_MAX; j++) {
573584
data = cpu_to_be32(
574-
*(uint32_t *)&tas_priv->cali_data.data[offset]);
585+
*(uint32_t *)&tas_priv->cali_data.data[oft]);
575586
rc = tasdevice_dev_bulk_write(tas_priv, i,
576-
TASDEVICE_REG(0, page_array[j], rgno_array[j]),
577-
(unsigned char *)&data, 4);
587+
cali_reg[j], (unsigned char *)&data, 4);
578588
if (rc < 0)
579589
dev_err(tas_priv->dev,
580590
"chn %d calib %d bulk_wr err = %d\n",
581591
i, j, rc);
582-
offset += 4;
592+
oft += 4;
583593
}
584594
}
585595
}

0 commit comments

Comments
 (0)