Skip to content

Commit

Permalink
ASoC: intel/skl/hda - fix probe regression on systems without i915
Browse files Browse the repository at this point in the history
Starting in commit cbc7a6b ("ASoC: soc-card: add
snd_soc_card_add_dai_link()"), error value from ASoc add_dai_link() is
no longer ignored.

The generic HDA machine driver relied on the old semantics to disable
i915 HDMI/DP audio codec at runtime. If no display codec was present,
add_dai_link() returned an error, but this was ignored and rest of the
card was successfully probed.

Fix the problem by changing the machine driver add_dai_link() to not
return an error in this case.

Fixes: cbc7a6b ("ASoC: soc-card: add snd_soc_card_add_dai_link()")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
BugLink: thesofproject#2261
Link: https://lore.kernel.org/r/20200714132804.3638221-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
kv2019i authored and broonie committed Jul 22, 2020
1 parent 04a646f commit ffc6d45
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions sound/soc/intel/boards/skl_hda_dsp_common.h
Expand Up @@ -33,6 +33,7 @@ struct skl_hda_private {
int dai_index;
const char *platform_name;
bool common_hdmi_codec_drv;
bool idisp_codec;
};

extern struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS];
Expand Down
17 changes: 11 additions & 6 deletions sound/soc/intel/boards/skl_hda_dsp_generic.c
Expand Up @@ -79,6 +79,9 @@ skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link)
link->platforms->name = ctx->platform_name;
link->nonatomic = 1;

if (!ctx->idisp_codec)
return 0;

if (strstr(link->name, "HDMI")) {
ret = skl_hda_hdmi_add_pcm(card, ctx->pcm_count);

Expand Down Expand Up @@ -118,19 +121,20 @@ static char hda_soc_components[30];
static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params)
{
struct snd_soc_card *card = &hda_soc_card;
struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card);
struct snd_soc_dai_link *dai_link;
u32 codec_count, codec_mask, idisp_mask;
u32 codec_count, codec_mask;
int i, num_links, num_route;

codec_mask = mach_params->codec_mask;
codec_count = hweight_long(codec_mask);
idisp_mask = codec_mask & IDISP_CODEC_MASK;
ctx->idisp_codec = !!(codec_mask & IDISP_CODEC_MASK);

if (!codec_count || codec_count > 2 ||
(codec_count == 2 && !idisp_mask))
(codec_count == 2 && !ctx->idisp_codec))
return -EINVAL;

if (codec_mask == idisp_mask) {
if (codec_mask == IDISP_CODEC_MASK) {
/* topology with iDisp as the only HDA codec */
num_links = IDISP_DAI_COUNT + DMIC_DAI_COUNT;
num_route = IDISP_ROUTE_COUNT;
Expand All @@ -152,7 +156,7 @@ static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params)
num_route = ARRAY_SIZE(skl_hda_map);
card->dapm_widgets = skl_hda_widgets;
card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets);
if (!idisp_mask) {
if (!ctx->idisp_codec) {
for (i = 0; i < IDISP_DAI_COUNT; i++) {
skl_hda_be_dai_links[i].codecs = dummy_codec;
skl_hda_be_dai_links[i].num_codecs =
Expand Down Expand Up @@ -211,6 +215,8 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
if (!mach)
return -EINVAL;

snd_soc_card_set_drvdata(&hda_soc_card, ctx);

ret = skl_hda_fill_card_info(&mach->mach_params);
if (ret < 0) {
dev_err(&pdev->dev, "Unsupported HDAudio/iDisp configuration found\n");
Expand All @@ -223,7 +229,6 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv;

hda_soc_card.dev = &pdev->dev;
snd_soc_card_set_drvdata(&hda_soc_card, ctx);

if (mach->mach_params.dmic_num > 0) {
snprintf(hda_soc_components, sizeof(hda_soc_components),
Expand Down

0 comments on commit ffc6d45

Please sign in to comment.