Skip to content

Commit

Permalink
UPSTREAM: ASoC: intel/skl/hda - add no-HDMI cases to generic HDA driver
Browse files Browse the repository at this point in the history
Extend the generic HDA driver to support systems where iDisp/HDMI
audio codecs are disabled for some reason. Switch codecs to
SoC dummy in the affected DAI links. This allows to reuse
existing topologies for this case.

Signed-off-by: Kai Vehmanen <[email protected]>
Reviewed-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206085
BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1163677
BugLink: thesofproject#1658
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
(cherry picked from commit d2ad9d6)
Signed-off-by: Chintan Patel <[email protected]>

BUG=b:153422295
TEST=No audio regression on TGL/JSL devices

Change-Id: I2ba96f9af98d1f4e2f4ada283eb34b1f2ac7100a
Signed-off-by: Curtis Malainey <[email protected]>
  • Loading branch information
kv2019i authored and cujomalainey committed Apr 16, 2020
1 parent 4b051da commit 153f9ca
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
4 changes: 4 additions & 0 deletions sound/soc/intel/boards/skl_hda_dsp_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ static inline int skl_hda_hdmi_build_controls(struct snd_soc_card *card)
struct snd_soc_component *component;
struct skl_hda_hdmi_pcm *pcm;

/* HDMI disabled, do not create controls */
if (list_empty(&ctx->hdmi_pcm_list))
return 0;

pcm = list_first_entry(&ctx->hdmi_pcm_list, struct skl_hda_hdmi_pcm,
head);
component = pcm->codec_dai->component;
Expand Down
25 changes: 20 additions & 5 deletions sound/soc/intel/boards/skl_hda_dsp_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ static const struct snd_soc_dapm_route skl_hda_map[] = {
{ "Alt Analog CPU Capture", NULL, "Alt Analog Codec Capture" },
};

SND_SOC_DAILINK_DEF(dummy_codec,
DAILINK_COMP_ARRAY(COMP_CODEC("snd-soc-dummy", "snd-soc-dummy-dai")));

static int skl_hda_card_late_probe(struct snd_soc_card *card)
{
return skl_hda_hdmi_jack_init(card);
Expand Down Expand Up @@ -114,13 +117,19 @@ static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params)
{
struct snd_soc_card *card = &hda_soc_card;
struct snd_soc_dai_link *dai_link;
u32 codec_count, codec_mask;
u32 codec_count, codec_mask, idisp_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;

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

if (codec_count == 1 && codec_mask & IDISP_CODEC_MASK) {
if (codec_mask == idisp_mask) {
/* topology with iDisp as the only HDA codec */
num_links = IDISP_DAI_COUNT + DMIC_DAI_COUNT;
num_route = IDISP_ROUTE_COUNT;

Expand All @@ -135,13 +144,19 @@ static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params)
skl_hda_be_dai_links[IDISP_DAI_COUNT +
HDAC_DAI_COUNT + i];
}
} else if (codec_count == 2 && codec_mask & IDISP_CODEC_MASK) {
} else {
/* topology with external and iDisp HDA codecs */
num_links = ARRAY_SIZE(skl_hda_be_dai_links);
num_route = ARRAY_SIZE(skl_hda_map);
card->dapm_widgets = skl_hda_widgets;
card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets);
} else {
return -EINVAL;
if (!idisp_mask) {
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 =
ARRAY_SIZE(dummy_codec);
}
}
}

card->num_links = num_links;
Expand Down

0 comments on commit 153f9ca

Please sign in to comment.