Skip to content

Commit 434a6a6

Browse files
oortcometbardliao
authored andcommitted
ASoC: SOF: Intel: Add a is_amp flag to fix the wrong name prefix
According to the Intel sof design, it will create the name prefix appended with amp index for the amp codec only, such as: rt1318-1, rt1318-2, etc... But the rt1320 is a codec with amp and mic codec functions, it doesn't have the amp index in its name prefix as above. And then it will be hard to identify the codec if in multi-rt1320 case. So we add a flag to force the amp index to be appended. Signed-off-by: Derek Fang <derek.fang@realtek.com>
1 parent 518d3c7 commit 434a6a6

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

include/sound/soc_sdw_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ struct asoc_sdw_codec_info {
8282
const int dai_num;
8383
struct asoc_sdw_aux_info auxs[SOC_SDW_MAX_AUX_NUM];
8484
const int aux_num;
85+
/* Force AMP-style name_prefix handling (append AMP index) even if MIC/Jack DAIs exist */
86+
const bool is_amp;
8587

8688
int (*codec_card_late_probe)(struct snd_soc_card *card);
8789

sound/soc/sof/intel/hda.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,16 @@ static struct snd_soc_acpi_adr_device *find_acpi_adr_device(struct device *dev,
12291229
return NULL;
12301230
}
12311231

1232+
/*
1233+
* codec_info_list[].is_amp is a codec-level override: for multi-function
1234+
* codecs we must treat the whole codec as an AMP when it is described as
1235+
* such in the codec info table, even if some endpoints were detected as
1236+
* non-AMP above. Callers/UCM rely on this to keep name_prefix and AMP
1237+
* indexing stable and backwards compatible.
1238+
*/
1239+
if (codec_info_list[i].is_amp)
1240+
is_amp = true;
1241+
12321242
adr_dev[index].adr = ((u64)sdw_device->id.class_id & 0xFF) |
12331243
((u64)sdw_device->id.part_id & 0xFFFF) << 8 |
12341244
((u64)sdw_device->id.mfg_id & 0xFFFF) << 24 |

0 commit comments

Comments
 (0)