Support Lenovo laptop with rt722 and rt1320#5707
Support Lenovo laptop with rt722 and rt1320#5707oortcomet wants to merge 3 commits intothesofproject:topic/sof-devfrom
Conversation
…bles Use functional topologies to support RT722 topologies with/without amplifiers, e.g. sof-ptl-rt722.tplg, sof-ptl-rt722-rt1320.tplg... If these entries are not removed, they will find the first same link of sof-ptl-rt722.tplg. Signed-off-by: Mac Chiang <mac.chiang@intel.com> Co-developed-by: Derek Fang <derek.fang@realtek.com> Signed-off-by: Derek Fang <derek.fang@realtek.com>
|
Can one of the admins verify this patch?
|
|
test this please |
There was a problem hiding this comment.
Pull request overview
Adds SoundWire plumbing to support a Lenovo platform using an rt722 on Link3 (UAJ) and an rt1320 on Link2 (AMP + MIC), primarily by expanding codec metadata and improving runtime component-string generation.
Changes:
- Mark rt1320 as an “amp-class” codec and add an additional MIC DAI definition (
rt1320-aif2) incodec_info_list. - Extend the Realtek DMIC runtime init to optionally append
cfg-mics:<n>for rt1320-based DMIC discovery using SDCA function types. - Remove a set of PTL ACPI match-table entries for rt722-only configurations.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| sound/soc/sof/intel/hda.c | Tweaks amp/non-amp classification logic used during dynamic link/ADR generation. |
| sound/soc/sdw_utils/soc_sdw_utils.c | Updates rt1320 codec metadata: adds is_amp flag and a second (MIC) DAI. |
| sound/soc/sdw_utils/soc_sdw_rt_dmic.c | Adds rt1320-specific SDCA-based counting to append cfg-mics into card->components. |
| sound/soc/intel/common/soc-acpi-intel-ptl-match.c | Removes rt722-only endpoint/ADR/link tables and related machine entries. |
| include/sound/soc_sdw_utils.h | Extends asoc_sdw_codec_info with a new is_amp field. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| part_id = codec_info->part_id; | ||
|
|
||
| // count the rt1320 with SDCA function SmartMic type in this card | ||
| for_each_card_components(card, component) { | ||
| sdw_peripheral = dev_to_sdw_dev(component->dev); | ||
| if (sdw_peripheral->id.part_id != part_id) | ||
| continue; | ||
| for (i = 0; i < sdw_peripheral->sdca_data.num_functions; i++) { | ||
| if (sdw_peripheral->sdca_data.function[i].type == | ||
| SDCA_FUNCTION_TYPE_SMART_MIC) { | ||
| rt1320_dmic_num++; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| card->components = devm_kasprintf(card->dev, GFP_KERNEL, | ||
| "%s mic:%s cfg-mics:%d", card->components, | ||
| mic_name, rt1320_dmic_num); |
There was a problem hiding this comment.
asoc_sdw_find_codec_info_dai() can return NULL; the new code dereferences codec_info->part_id unconditionally. Please add a NULL check and return an error (e.g., -EINVAL) or fall back to the previous card->components formatting when the DAI isn't found.
| part_id = codec_info->part_id; | |
| // count the rt1320 with SDCA function SmartMic type in this card | |
| for_each_card_components(card, component) { | |
| sdw_peripheral = dev_to_sdw_dev(component->dev); | |
| if (sdw_peripheral->id.part_id != part_id) | |
| continue; | |
| for (i = 0; i < sdw_peripheral->sdca_data.num_functions; i++) { | |
| if (sdw_peripheral->sdca_data.function[i].type == | |
| SDCA_FUNCTION_TYPE_SMART_MIC) { | |
| rt1320_dmic_num++; | |
| break; | |
| } | |
| } | |
| } | |
| card->components = devm_kasprintf(card->dev, GFP_KERNEL, | |
| "%s mic:%s cfg-mics:%d", card->components, | |
| mic_name, rt1320_dmic_num); | |
| if (!codec_info) { | |
| card->components = devm_kasprintf(card->dev, GFP_KERNEL, | |
| "%s mic:%s", card->components, | |
| mic_name); | |
| } else { | |
| part_id = codec_info->part_id; | |
| // count the rt1320 with SDCA function SmartMic type in this card | |
| for_each_card_components(card, component) { | |
| sdw_peripheral = dev_to_sdw_dev(component->dev); | |
| if (sdw_peripheral->id.part_id != part_id) | |
| continue; | |
| for (i = 0; i < sdw_peripheral->sdca_data.num_functions; i++) { | |
| if (sdw_peripheral->sdca_data.function[i].type == | |
| SDCA_FUNCTION_TYPE_SMART_MIC) { | |
| rt1320_dmic_num++; | |
| break; | |
| } | |
| } | |
| } | |
| card->components = devm_kasprintf(card->dev, GFP_KERNEL, | |
| "%s mic:%s cfg-mics:%d", card->components, | |
| mic_name, rt1320_dmic_num); | |
| } |
| for_each_card_components(card, component) { | ||
| sdw_peripheral = dev_to_sdw_dev(component->dev); | ||
| if (sdw_peripheral->id.part_id != part_id) | ||
| continue; |
There was a problem hiding this comment.
for_each_card_components() iterates over all card components (CPU/platform/codecs). The new logic unconditionally calls dev_to_sdw_dev(component->dev), which is only valid for SoundWire slave devices and can lead to invalid casts/crashes. Please check is_sdw_slave(component->dev) (and possibly the parent like in asoc_sdw_rtd_init()) before converting, and skip non-SoundWire components.
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>
Add 'rt1320-aif2' dai info for rt1320 dmic function. Signed-off-by: Derek Fang <derek.fang@realtek.com>
556b9b7 to
75cb60c
Compare
These commits support the combination with rt722 and rt1320 soundwire devices.