Skip to content

Commit ffc6d45

Browse files
kv2019ibroonie
authored andcommitted
ASoC: intel/skl/hda - fix probe regression on systems without i915
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 <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Rander Wang <[email protected]> Reviewed-by: Guennadi Liakhovetski <[email protected]> BugLink: thesofproject#2261 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 04a646f commit ffc6d45

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

sound/soc/intel/boards/skl_hda_dsp_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ struct skl_hda_private {
3333
int dai_index;
3434
const char *platform_name;
3535
bool common_hdmi_codec_drv;
36+
bool idisp_codec;
3637
};
3738

3839
extern struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS];

sound/soc/intel/boards/skl_hda_dsp_generic.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link)
7979
link->platforms->name = ctx->platform_name;
8080
link->nonatomic = 1;
8181

82+
if (!ctx->idisp_codec)
83+
return 0;
84+
8285
if (strstr(link->name, "HDMI")) {
8386
ret = skl_hda_hdmi_add_pcm(card, ctx->pcm_count);
8487

@@ -118,19 +121,20 @@ static char hda_soc_components[30];
118121
static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params)
119122
{
120123
struct snd_soc_card *card = &hda_soc_card;
124+
struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card);
121125
struct snd_soc_dai_link *dai_link;
122-
u32 codec_count, codec_mask, idisp_mask;
126+
u32 codec_count, codec_mask;
123127
int i, num_links, num_route;
124128

125129
codec_mask = mach_params->codec_mask;
126130
codec_count = hweight_long(codec_mask);
127-
idisp_mask = codec_mask & IDISP_CODEC_MASK;
131+
ctx->idisp_codec = !!(codec_mask & IDISP_CODEC_MASK);
128132

129133
if (!codec_count || codec_count > 2 ||
130-
(codec_count == 2 && !idisp_mask))
134+
(codec_count == 2 && !ctx->idisp_codec))
131135
return -EINVAL;
132136

133-
if (codec_mask == idisp_mask) {
137+
if (codec_mask == IDISP_CODEC_MASK) {
134138
/* topology with iDisp as the only HDA codec */
135139
num_links = IDISP_DAI_COUNT + DMIC_DAI_COUNT;
136140
num_route = IDISP_ROUTE_COUNT;
@@ -152,7 +156,7 @@ static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params)
152156
num_route = ARRAY_SIZE(skl_hda_map);
153157
card->dapm_widgets = skl_hda_widgets;
154158
card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets);
155-
if (!idisp_mask) {
159+
if (!ctx->idisp_codec) {
156160
for (i = 0; i < IDISP_DAI_COUNT; i++) {
157161
skl_hda_be_dai_links[i].codecs = dummy_codec;
158162
skl_hda_be_dai_links[i].num_codecs =
@@ -211,6 +215,8 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
211215
if (!mach)
212216
return -EINVAL;
213217

218+
snd_soc_card_set_drvdata(&hda_soc_card, ctx);
219+
214220
ret = skl_hda_fill_card_info(&mach->mach_params);
215221
if (ret < 0) {
216222
dev_err(&pdev->dev, "Unsupported HDAudio/iDisp configuration found\n");
@@ -223,7 +229,6 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
223229
ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv;
224230

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

228233
if (mach->mach_params.dmic_num > 0) {
229234
snprintf(hda_soc_components, sizeof(hda_soc_components),

0 commit comments

Comments
 (0)