Skip to content

Commit 5e6f395

Browse files
committed
Merge: [HP FEAT 10.1] [TI AMP TAS2781] fix early issues
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/495 JIRA: https://issues.redhat.com/browse/RHEL-81723 * 2afd96a ALSA: hda/tas2781: Update tas2781 hda SPI driver * 325735e ALSA: hda/tas2781: Fix index issue in tas2781 hda SPI driver Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com> --- <small>Created 2025-02-28 13:13 UTC by backporter - [KWF FAQ](https://red.ht/kernel_workflow_doc) - [Slack #team-kernel-workflow](https://redhat-internal.slack.com/archives/C04LRUPMJQ5) - [Source](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/webhook/utils/backporter.py) - [Documentation](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/docs/README.backporter.md) - [Report an issue](https://gitlab.com/cki-project/kernel-workflow/-/issues/new?issue%5Btitle%5D=backporter%20webhook%20issue)</small> Approved-by: Jaroslav Kysela <jkysela@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: John W. Linville <linville@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Julio Faracco <jfaracco@redhat.com>
2 parents 2f8d560 + df70591 commit 5e6f395

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

sound/pci/hda/tas2781_hda_spi.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)
912912
struct tasdevice_priv *tas_priv = context;
913913
struct tas2781_hda *tas_hda = dev_get_drvdata(tas_priv->dev);
914914
struct hda_codec *codec = tas_priv->codec;
915-
int i, j, ret;
915+
int i, j, ret, val;
916916

917917
pm_runtime_get_sync(tas_priv->dev);
918918
guard(mutex)(&tas_priv->codec_lock);
@@ -981,13 +981,16 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)
981981

982982
/* Perform AMP reset before firmware download. */
983983
tas_priv->rcabin.profile_cfg_id = TAS2781_PRE_POST_RESET_CFG;
984-
tasdevice_spi_tuning_switch(tas_priv, 0);
985984
tas2781_spi_reset(tas_priv);
986985
tas_priv->rcabin.profile_cfg_id = 0;
987-
tasdevice_spi_tuning_switch(tas_priv, 1);
988986

989987
tas_priv->fw_state = TASDEVICE_DSP_FW_ALL_OK;
990-
ret = tasdevice_spi_prmg_load(tas_priv, 0);
988+
ret = tasdevice_spi_dev_read(tas_priv, TAS2781_REG_CLK_CONFIG, &val);
989+
if (ret < 0)
990+
goto out;
991+
992+
if (val == TAS2781_REG_CLK_CONFIG_RESET)
993+
ret = tasdevice_spi_prmg_load(tas_priv, 0);
991994
if (ret < 0) {
992995
dev_err(tas_priv->dev, "FW download failed = %d\n", ret);
993996
goto out;
@@ -1001,7 +1004,6 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context)
10011004
* If calibrated data occurs error, dsp will still works with default
10021005
* calibrated data inside algo.
10031006
*/
1004-
tas_priv->save_calibration(tas_priv);
10051007

10061008
out:
10071009
if (fmw)
@@ -1160,7 +1162,8 @@ static int tas2781_runtime_suspend(struct device *dev)
11601162

11611163
guard(mutex)(&tas_hda->priv->codec_lock);
11621164

1163-
tasdevice_spi_tuning_switch(tas_hda->priv, 1);
1165+
if (tas_hda->priv->playback_started)
1166+
tasdevice_spi_tuning_switch(tas_hda->priv, 1);
11641167

11651168
tas_hda->priv->cur_book = -1;
11661169
tas_hda->priv->cur_conf = -1;
@@ -1174,7 +1177,8 @@ static int tas2781_runtime_resume(struct device *dev)
11741177

11751178
guard(mutex)(&tas_hda->priv->codec_lock);
11761179

1177-
tasdevice_spi_tuning_switch(tas_hda->priv, 0);
1180+
if (tas_hda->priv->playback_started)
1181+
tasdevice_spi_tuning_switch(tas_hda->priv, 0);
11781182

11791183
return 0;
11801184
}
@@ -1189,12 +1193,9 @@ static int tas2781_system_suspend(struct device *dev)
11891193
return ret;
11901194

11911195
/* Shutdown chip before system suspend */
1192-
tasdevice_spi_tuning_switch(tas_hda->priv, 1);
1193-
tas2781_spi_reset(tas_hda->priv);
1194-
/*
1195-
* Reset GPIO may be shared, so cannot reset here.
1196-
* However beyond this point, amps may be powered down.
1197-
*/
1196+
if (tas_hda->priv->playback_started)
1197+
tasdevice_spi_tuning_switch(tas_hda->priv, 1);
1198+
11981199
return 0;
11991200
}
12001201

sound/pci/hda/tas2781_spi_fwlib.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// TAS2781 HDA SPI driver
44
//
5-
// Copyright 2024 Texas Instruments, Inc.
5+
// Copyright 2024-2025 Texas Instruments, Inc.
66
//
77
// Author: Baojun Xu <baojun.xu@ti.com>
88

@@ -771,19 +771,19 @@ static int tasdevice_process_block(void *context, unsigned char *data,
771771
switch (subblk_typ) {
772772
case TASDEVICE_CMD_SING_W:
773773
subblk_offset = tasdevice_single_byte_wr(tas_priv,
774-
dev_idx & 0x4f, data, sublocksize);
774+
dev_idx & 0x3f, data, sublocksize);
775775
break;
776776
case TASDEVICE_CMD_BURST:
777777
subblk_offset = tasdevice_burst_wr(tas_priv,
778-
dev_idx & 0x4f, data, sublocksize);
778+
dev_idx & 0x3f, data, sublocksize);
779779
break;
780780
case TASDEVICE_CMD_DELAY:
781781
subblk_offset = tasdevice_delay(tas_priv,
782-
dev_idx & 0x4f, data, sublocksize);
782+
dev_idx & 0x3f, data, sublocksize);
783783
break;
784784
case TASDEVICE_CMD_FIELD_W:
785785
subblk_offset = tasdevice_field_wr(tas_priv,
786-
dev_idx & 0x4f, data, sublocksize);
786+
dev_idx & 0x3f, data, sublocksize);
787787
break;
788788
default:
789789
subblk_offset = 2;

0 commit comments

Comments
 (0)