-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASoC: intel: sof_sdw: Use a fixed DAI link id for AMP #3203
Conversation
thesofproject/sof#4824 is using the dynamic BE id now. Please see thesofproject/sof@6329628 So either this PR or thesofproject/sof@6329628 should be merged. |
sound/soc/intel/boards/sof_sdw.c
Outdated
@@ -895,6 +912,9 @@ static int create_sdw_dailink(struct snd_soc_card *card, | |||
if (codec_info_list[codec_index].ignore_pch_dmic) | |||
*ignore_pch_dmic = true; | |||
|
|||
if (is_amp(codec_info_list[codec_index].part_id) && link_id < SDW_AMP_DAI_ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be simpler to add a field in codec_info_list, so that we have all the information in a single table.
we could even unify the rt715 handling with different flags for smart amp and smart mic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be simpler to add a field in codec_info_list, so that we have all the information in a single table.
we could even unify the rt715 handling with different flags for smart amp and smart mic.
Done
I don't think it makes sense to change the ID in the topology. One main reason: it would prevent us from testing the 'noajck' option on platforms that do have a jack. The rule is that the machine driver can expose as many links as possible, and the topology selects from the links. If we change the topology to match the machine driver we are adding an exception to the rule and creating more problems. It's really simpler if we assume that the machine driver has a pre-defined link numbering. |
50ba7dd
to
5dba5be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some logic to check the sequence of "headphone - AMP - MIC". A error message is helpful to users
Yes, added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry @bardliao my previous comments seem to have be parked, re-adding them.
sound/soc/intel/boards/sof_sdw.c
Outdated
@@ -845,6 +860,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, | |||
struct snd_soc_dai_link_component *codecs; | |||
int cpu_dai_id[SDW_MAX_CPU_DAIS]; | |||
int cpu_dai_num, cpu_dai_index; | |||
static int link_id = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we try to avoid using a static here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we try to avoid using a static here?
I used static is because create_sdw_dailink() will be called multiple time and I want to keep the value of link_id. But I don't like static inside a function either. Using link_id as an argument of create_sdw_dailink() now.
sound/soc/intel/boards/sof_sdw.c
Outdated
* keep sdw DMIC and HDMI setting static in UCM | ||
*/ | ||
if (codec_info_list[codec_index].codec_type == SOF_SDW_CODEC_TYPE_MIC && | ||
link_id < SDW_DMIC_DAI_ID && (sof_sdw_quirk & SOF_RT715_DAI_ID_FIX)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we remove this quirk now and use only the codec_type?
sound/soc/intel/boards/sof_sdw.c
Outdated
@@ -920,7 +907,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, | |||
* keep sdw DMIC and HDMI setting static in UCM | |||
*/ | |||
if (codec_info_list[codec_index].codec_type == SOF_SDW_CODEC_TYPE_MIC && | |||
link_id < SDW_DMIC_DAI_ID && (sof_sdw_quirk & SOF_RT715_DAI_ID_FIX)) | |||
link_id < SDW_DMIC_DAI_ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do this directly in the previous patch, and here only cleanup the quirks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do this directly in the previous patch, and here only cleanup the quirks
Done
1eef822
to
93654fa
Compare
93654fa
to
96e109e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am in bad status and can't figure out link_id, link_index now. Can you test on all sdw platforms to confirm the patch ? thanks.
96e109e
to
cf6c2c2
Compare
I think CI will do it for me. I will check the result once it is finished. |
The only fail on sdw device is https://sof-ci.01.org/linuxpr/PR3203/build6565/devicetest/?model=ADLP_RVP_SDW&testcase=verify-kernel-boot-log. But it seems not be an audio issue, and I checked the dmesg
It is exactly the same as the PASS case on another PR's pr-device-test result. Besides, all other test cases are PASS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit-pick and question below.
I think we should also allow the user to specify a quirk, as we did with bytcr_rt5640, that would allow us to solve user problems without waiting for a patched kernel to be available.
sound/soc/intel/boards/sof_sdw.c
Outdated
/* get BE ID for non-sdw DAI */ | ||
be_id = get_next_be_id(links, be_id); | ||
be_id = get_next_be_id(links, link_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rename this variable 'link_index' to be consistent with the rest of the uses where it's a pointer?
same comment for line 1152
cf6c2c2
to
015aa50
Compare
Sorry @plbossart what bytcr_rt5640 quirk you referring to? We do allow user to overwrite the quirk by module param. Or do you think we miss some quick? Allowing user to specific DAI link ids for example? |
015aa50
to
1c45196
Compare
Discard this comment, I didn't recall we already had a quirk module parameter :-) |
@@ -1157,7 +1176,7 @@ static int sof_card_dai_links_create(struct device *dev, | |||
sdw_cpu_dai_num, cpus, adr_link, | |||
&cpu_id, group_generated, | |||
codec_conf, codec_conf_count, | |||
&codec_conf_index, | |||
&be_id, &codec_conf_index, | |||
&ignore_pch_dmic); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
15 parameters... Can we use a structure? Unrelated, of course...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a welcome change. I have a few minor comments and questions. Please see inline.
@@ -404,6 +404,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { | |||
.direction = {true, true}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit message needs a bit of work:
- "It will varies between" -> "It will vary between"
- "Fix a fixed DAI link can reduce .. possibility of editing topologies" -> ? not sure what this means
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also while you're at it, can you change the first line to something like "Currently, we assign SoundWire DAI link id according to the order in the link address table or array"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "Fix a fixed DAI link can reduce .. possibility of editing topologies" -> ? not sure what this means
That was a typo of "Use a fixed DAI link..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this still seems wrong: "Use a fixed DAI link id can reduce the possibility of editing topologies."
This seems like a pretty important part of the patchset, why are we moving to a fixed DAI link id. I'm not 100% sure what the you mean here. Would this be correct:
"Use of a fixed DAI link id can reduce the need to edit topologies."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggested commit message edit:
Currently, we assign SoundWire DAI link id according to the order in
the link address table, with the assumption that the headset codec is listed first, then amplifiers and last capture devices. If the headset codec is not present in a platform, the dai link for amplifiers will be shifted, which can be handled in two ways
a) modify the topology to renumber the dailink changes
b) keep the dailink numbers constant in topology but also avoid the variations in the machine driver.
This patch adds support for option b), the dailink index for amplifiers and capture devices becomes fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@plbossart Commit message changed. Thanks for the suggestion.
@@ -404,6 +404,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { | |||
.direction = {true, true}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also while you're at it, can you change the first line to something like "Currently, we assign SoundWire DAI link id according to the order in the link address table or array"
1c45196
to
cdcb468
Compare
The link_id variable in sof_card_dai_links_create() and be_index argument in create_sdw_dailink() is actually links' index. Rename them to link_index to be consistent. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
cdcb468
to
269fc52
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good @bardliao
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still one commit message clarification needed.
@@ -404,6 +404,7 @@ static struct sof_sdw_codec_info codec_info_list[] = { | |||
.direction = {true, true}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this still seems wrong: "Use a fixed DAI link id can reduce the possibility of editing topologies."
This seems like a pretty important part of the patchset, why are we moving to a fixed DAI link id. I'm not 100% sure what the you mean here. Would this be correct:
"Use of a fixed DAI link id can reduce the need to edit topologies."
269fc52
to
673928f
Compare
Currently, we assign SoundWire DAI link id according to the order in the link address table, with the assumption that the headset codec is listed first, then amplifiers and last capture devices. If the headset codec is not present in a platform, the dai link for amplifiers will be shifted, which can be handled in two ways a) modify the topology to renumber the dailink changes b) keep the dailink numbers constant in topology but also avoid the variations in the machine driver. This patch adds support for option b), the dailink index for amplifiers and capture devices becomes fixed. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
We can apply the fixed dai link id for DMICs in create_sdw_dailink(). No need to set it in each DMIC's callback. The fixed dai link id is not only for rt715 and rt715-sdca, but for all DMICs, therefore we remove the SOF_RT715_DAI_ID_FIX check as well. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
SOF_RT715_DAI_ID_FIX is not used anywhere. Remove it. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Now, we set DAI link id as SDW_DMIC_DAI_ID for all DMICs. No need to set it in sof_sdw_mic_codec_mockup_init. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
DAI link id will not be set from sdw codec init feedback function, and be_id is changed by create_sdw_dailink() now. So we don't need get_next_be_id() anymore. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
We assume the adr order described in a snd_soc_acpi_link_adr array is jack -> amp -> mic. We follow the same order to implement the topology. We will need a special topology if we configure a snd_soc_acpi_link_adr array with different order. Adding a check and a warning message can remind people to keep the order when adding a new snd_soc_acpi_link_adr array. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
673928f
to
9a1c053
Compare
Currently, we assign SoundWire DAI link id according to the order in
snd_soc_acpi_link_adr. It will varies between devices and we have to
modify topologies for the different DAI link ids. Fix a fixed DAI link id
can reduce the possibility of editing topologies.
This patch has the assumption that the codec order in snd_soc_acpi_link_adr
is always headset -> amp -> mic. We have to follow the order when we
add new link adrs in the future.