Skip to content

[RFC] ASoC: Intel: boards: hda_dsp_common: switch to use config item _HDA_L… - #1680

Closed
keyonjie wants to merge 1 commit into
thesofproject:topic/sof-devfrom
keyonjie:topic/sof-dev
Closed

keyonjie wants to merge 1 commit into
thesofproject:topic/sof-devfrom
keyonjie:topic/sof-dev

Conversation

@keyonjie

@keyonjie keyonjie commented Jan 9, 2020

Copy link
Copy Markdown

…INK for hdmi

The config item CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC is originally
designed for HDA analog codec only, so it is not selected in I2S + HDMI
platforms, this will lead to late_probe() fail and sound card not
created issue on these platform. e.g.

[ 5.034912] sof_rt5682 sof_rt5682: ASoC: sof-rt5682 late_probe() failed: -22

At the same time, the item CONFIG_SND_SOC_SOF_HDA_LINK is the more
common one for HDMI as we suppose all HDA platforms will have HDMI at
least. Switch to use this item for HDMI related controls building will
fix the issue mentioned above.

Signed-off-by: Keyon Jie yang.jie@linux.intel.com

…INK for hdmi

The config item CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC is originally
designed for HDA analog codec only, so it is not selected in I2S + HDMI
platforms, this will lead to late_probe() fail and sound card not
created issue on these platform. e.g.

[    5.034912] sof_rt5682 sof_rt5682: ASoC: sof-rt5682 late_probe() failed: -22

At the same time, the item CONFIG_SND_SOC_SOF_HDA_LINK is the more
common one for HDMI as we suppose all HDA platforms will have HDMI at
least. Switch to use this item for HDMI related controls building will
fix the issue mentioned above.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
@keyonjie

keyonjie commented Jan 9, 2020

Copy link
Copy Markdown
Author

Hi @kv2019i this is marked with RFC as I am not sure if it is consistent with what you originally wanted to illustrate here, please help to review it.

@keyonjie
keyonjie requested a review from ranj063 January 9, 2020 14:52

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct

}

#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC)
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_LINK)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the commit message states an incorrect fact. Look at the sound/soc/intel/boards/Kconfig and you'll see that even I2S machine drivers do rely on HDA_AUDIO_CODEC.

This is the default and it'd probably more that the Chrome configuration is incorrect.

@ranj063

ranj063 commented Jan 9, 2020

Copy link
Copy Markdown
Collaborator

@keyonjie @plbossart I had something else in mind. In the SOF Kconfig today we expect the HDA_LINK option to be selected for HDMI. Can we make the selection of HDA_AUDIO_CODEC automatic if HDA_LINK is selected?

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keyonjie wrote:

Hi @kv2019i this is marked with RFC as I am not sure if it is consistent with what you originally wanted to illustrate here, please help to review it.

Not using HDA_LINK was intentional. The #ifdef'ed hda_dsp_hdmi_build_controls() calls function snd_hda_codec_build_controls() which is implemented in snd-hda-codec. So if the ifdef is changed, you will get errors from kconfigs where HDA_LINK is defined but HDA_AUDIO_CODEC not. I hit this during testing my patchset.

@kv2019i

kv2019i commented Jan 9, 2020 •

Copy link
Copy Markdown
Collaborator

@ranj063 wrote:

@keyonjie @plbossart I had something else in mind. In the SOF Kconfig today we expect the HDA_LINK option to be selected for HDMI. Can we make the selection of HDA_AUDIO_CODEC automatic if HDA_LINK is selected?

Or just merge the two. Now that HDMI is just another HDA codec, I'm not sure whether we have any need for a separate HDA_LINK config option. If you look at current code, HDA_LINK is only used in board files to select the old hdac-hdmi. With common hdmi, HDMI goes through the same stack as other HDA codecs, so you need the same HDA stack in both cases.

Do we have any other uses where HDA_LINK would be "yes" but HDA_AUDIO_CODEC still "no"?

@plbossart

Copy link
Copy Markdown
Member

@ranj063 wrote:

@keyonjie @plbossart I had something else in mind. In the SOF Kconfig today we expect the HDA_LINK option to be selected for HDMI. Can we make the selection of HDA_AUDIO_CODEC automatic if HDA_LINK is selected?

Or just merge the two. Now that HDMI is just another HDA codec, I'm not sure whether we have any need for a separate HDA_LINK config option. If you look at current code, HDA_LINK is only used in board files to select the old hdac-hdmi. With common hdmi, HDMI goes through the same stack as other HDA codecs, so you need the same HDA stack in both cases.

Do we have any other uses where HDA_LINK would be "yes" but HDA_AUDIO_CODEC still "no"?

@ranj063 and I talked about having a pretend nocodec mode for HDaudio link DMAs. we haven't worked on it but I would like to avoid coupling the controller parts and the codec parts for now.

@ranj063

ranj063 commented Jan 9, 2020 •

Copy link
Copy Markdown
Collaborator

@ranj063 wrote:

@keyonjie @plbossart I had something else in mind. In the SOF Kconfig today we expect the HDA_LINK option to be selected for HDMI. Can we make the selection of HDA_AUDIO_CODEC automatic if HDA_LINK is selected?

Or just merge the two. Now that HDMI is just another HDA codec, I'm not sure whether we have any need for a separate HDA_LINK config option. If you look at current code, HDA_LINK is only used in board files to select the old hdac-hdmi. With common hdmi, HDMI goes through the same stack as other HDA codecs, so you need the same HDA stack in both cases.
Do we have any other uses where HDA_LINK would be "yes" but HDA_AUDIO_CODEC still "no"?

@ranj063 and I talked about having a pretend nocodec mode for HDaudio link DMAs. we haven't worked on it but I would like to avoid coupling the controller parts and the codec parts for now.

@plbossart @kv2019i yes, I agree its better to keep them separate. But today for the nodec case HDA_LINK and NOCODEC options are mutually exclusive. This will likely change if we add the nocodec options for HDA codecs. But maybe we could select HDA_AUDIO_CODEC if HDA_LINK is selected and NOCODEC is not

@kv2019i

kv2019i commented Jan 9, 2020

Copy link
Copy Markdown
Collaborator

@plbossart wrote:

@ranj063 wrote:

@ranj063 and I talked about having a pretend nocodec mode for HDaudio link DMAs. we haven't worked on it but I would like to avoid coupling the controller parts and the codec parts for now.
@plbossart @kv2019i yes, I agree if better to keep them separate. But today for the nodec case HDA_LINK and NOCODEC options are mutually exclusive. This will likely change if we add the

I understand the motivation, but it is confusing to have this abstraction in upstream with no actual use in code. E.g. I will forget your motivation in a month again and will be looking at the code again trying to figure why Ranjani and Pierre wanted to have LINK separate. ;)

Anyways, if we stick to this, then I'd agree with @ranj063 proposal to enable HDA_AUDIO_CODEC automatically if HDA_LINK is selected. This would prevent any misconfiguration by users with current codebase. If and when the pretend-proxy support is added, this automatic enabling can be removed. Even better to mention this in the commit. Sounds good?

@keyonjie

keyonjie commented Jan 10, 2020 •

Copy link
Copy Markdown
Author

Previously we had requirement to support HDMI for automotive with BSD license, that is HDMI + I2S, I think that's why the CONFIG_SND_SOC_SOF_HDA_LINK was added. What is the status with today's code about this?

@plbossart

Copy link
Copy Markdown
Member

Previously we had requirement to support HDMI for automotive with BSD license, that is HDMI + I2S, I think that's why the CONFIG_SND_SOC_SOF_HDA_LINK was added. What is the status with today's code about this?

no, we never had such a requirement. it was for I2S only with the HDMI part explicitly disabled.

@plbossart

plbossart commented Jan 11, 2020 •

Copy link
Copy Markdown
Member

btw we also have a similar issue with HDMI. in our kconfigs we use this:

 # switch to common HDMI codec (patch_hdmi.c)
CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC=y

but some distros don't thesofproject/sof#2265 (comment) https://github.com/thesofproject/sof/files/4049160/default.txt

@keyonjie

Copy link
Copy Markdown
Author

So, @plbossart if the solution you preferred is to ask the distros themselves to make sure they should select the correct Kconfig items, please let me know, I will close this RFC here.

@plbossart

Copy link
Copy Markdown
Member

btw we also have a similar issue with HDMI. in our kconfigs we use this:

 # switch to common HDMI codec (patch_hdmi.c)
CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC=y

but some distros don't thesofproject/sof#2265 (comment) https://github.com/thesofproject/sof/files/4049160/default.txt

@kv2019i should we select this CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC option directly in Kconfigs or should it remain an option?

@kv2019i

kv2019i commented Jan 15, 2020

Copy link
Copy Markdown
Collaborator

@plbossart wrote:

but some distros don't thesofproject/sof#2265 (comment) https://github.com/thesofproject/sof/files/4049160/default.txt
@kv2019i should we select this CONFIG_SND_SOC_SOF_HDA_COMMON_HDMI_CODEC option directly in Kconfigs or should it remain an option?

I'm still puzzled at how to handle this. We are already setting this as default:

config SND_SOC_SOF_HDA_COMMON_HDMI_CODEC
» bool "SOF common HDA HDMI codec driver"
[...]
» default SND_HDA_CODEC_HDMI
[...]
Say Y if you want to use the common codec driver with SOF.
» If unsure select "Y".

So distros should really pick this up already. The next step would be to remove the option altogether (or make it a tristate) and only offer ability to revert back to hdac-hdmi via the kernel module option. But as we did change the user-space interface, I'd prefer to leave distros with the choice still.

We do need to fix the problem that SOF probe fails due to lack of HDMI. This is making this problem more severe now, but it needs to be fixed for other reasons as well (e.g. systems with IGFX disabled).

@plbossart plbossart added the Unclear No agreement on problem statement and resolution label Feb 4, 2020
@keyonjie

keyonjie commented Feb 5, 2020

Copy link
Copy Markdown
Author

Hi @kv2019i @plbossart are we aligned about how to proceed this?

@kv2019i

kv2019i commented Feb 5, 2020

Copy link
Copy Markdown
Collaborator

@keyonjie wrote:

Hi @kv2019i @plbossart are we aligned about how to proceed this?

I'm afraid not. It's true you can have invalid combinations of Kconfig settings now. This is hard to fix with machine drivers that could be used with either SST or SOF, so it gets really ugly to try to describe all dependencies so that if you select a specific machine driver, all dependencies it needs would be selected as well. We are not doing this for all features in any case ... e.g. you can select a SDW machine driver but not enable SDW in SOF, you won't get a functional audio stack.

It would seem the best we can do, would be to make the machine drivers more robust against missing HDMI (like my #1731 for generic hda driver). This doesn't fix the problem of possible invalid Kconfig files, but at least SOF probe will not fail in case some SOF option is missed in Kconfig. If you have an invalid Kconfig combination, you won't get HDMI functionality, but other audio outputs will still work.

@kv2019i

kv2019i commented Feb 7, 2020

Copy link
Copy Markdown
Collaborator

@keyonjie One more option: #1772

@keyonjie

Copy link
Copy Markdown
Author

@keyonjie One more option: #1772

Thanks, please feel free to close this one once you think it is not needed anymore.

@plbossart plbossart closed this Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Unclear No agreement on problem statement and resolution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants