Commit 22cefca3 authored by Yong Zhi's avatar Yong Zhi Committed by Mark Brown

ASoC: Intel: sof_rt5682: add support for systems without i915 audio

Add support to systems where iDisp HDMI/DP audio codec is disabled for some
reason, switch codecs to SoC dummy in the affected DAI links. This allows
to reuse existing topologies as hdmi_num is 3 by default.
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: default avatarYong Zhi <yong.zhi@intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220120230226.175906-2-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6cbff4b3
...@@ -81,6 +81,7 @@ struct sof_card_private { ...@@ -81,6 +81,7 @@ struct sof_card_private {
struct snd_soc_jack sof_headset; struct snd_soc_jack sof_headset;
struct list_head hdmi_pcm_list; struct list_head hdmi_pcm_list;
bool common_hdmi_codec_drv; bool common_hdmi_codec_drv;
bool idisp_codec;
}; };
static int sof_rt5682_quirk_cb(const struct dmi_system_id *id) static int sof_rt5682_quirk_cb(const struct dmi_system_id *id)
...@@ -417,7 +418,7 @@ static int sof_card_late_probe(struct snd_soc_card *card) ...@@ -417,7 +418,7 @@ static int sof_card_late_probe(struct snd_soc_card *card)
int i = 0; int i = 0;
/* HDMI is not supported by SOF on Baytrail/CherryTrail */ /* HDMI is not supported by SOF on Baytrail/CherryTrail */
if (is_legacy_cpu) if (is_legacy_cpu || !ctx->idisp_codec)
return 0; return 0;
if (list_empty(&ctx->hdmi_pcm_list)) if (list_empty(&ctx->hdmi_pcm_list))
...@@ -558,11 +559,14 @@ static struct snd_soc_dai_link_component dummy_component[] = { ...@@ -558,11 +559,14 @@ static struct snd_soc_dai_link_component dummy_component[] = {
} }
}; };
#define IDISP_CODEC_MASK 0x4
static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
int ssp_codec, int ssp_codec,
int ssp_amp, int ssp_amp,
int dmic_be_num, int dmic_be_num,
int hdmi_num) int hdmi_num,
bool idisp_codec)
{ {
struct snd_soc_dai_link_component *idisp_components; struct snd_soc_dai_link_component *idisp_components;
struct snd_soc_dai_link_component *cpus; struct snd_soc_dai_link_component *cpus;
...@@ -676,6 +680,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, ...@@ -676,6 +680,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
if (!links[id].cpus->dai_name) if (!links[id].cpus->dai_name)
goto devm_err; goto devm_err;
if (idisp_codec) {
idisp_components[i - 1].name = "ehdaudio0D2"; idisp_components[i - 1].name = "ehdaudio0D2";
idisp_components[i - 1].dai_name = devm_kasprintf(dev, idisp_components[i - 1].dai_name = devm_kasprintf(dev,
GFP_KERNEL, GFP_KERNEL,
...@@ -683,6 +688,10 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, ...@@ -683,6 +688,10 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
i); i);
if (!idisp_components[i - 1].dai_name) if (!idisp_components[i - 1].dai_name)
goto devm_err; goto devm_err;
} else {
idisp_components[i - 1].name = "snd-soc-dummy";
idisp_components[i - 1].dai_name = "snd-soc-dummy-dai";
}
links[id].codecs = &idisp_components[i - 1]; links[id].codecs = &idisp_components[i - 1];
links[id].num_codecs = 1; links[id].num_codecs = 1;
...@@ -838,6 +847,9 @@ static int sof_audio_probe(struct platform_device *pdev) ...@@ -838,6 +847,9 @@ static int sof_audio_probe(struct platform_device *pdev)
/* default number of HDMI DAI's */ /* default number of HDMI DAI's */
if (!hdmi_num) if (!hdmi_num)
hdmi_num = 3; hdmi_num = 3;
if (mach->mach_params.codec_mask & IDISP_CODEC_MASK)
ctx->idisp_codec = true;
} }
/* need to get main clock from pmc */ /* need to get main clock from pmc */
...@@ -892,7 +904,7 @@ static int sof_audio_probe(struct platform_device *pdev) ...@@ -892,7 +904,7 @@ static int sof_audio_probe(struct platform_device *pdev)
sof_audio_card_rt5682.num_links++; sof_audio_card_rt5682.num_links++;
dai_links = sof_card_dai_links_create(&pdev->dev, ssp_codec, ssp_amp, dai_links = sof_card_dai_links_create(&pdev->dev, ssp_codec, ssp_amp,
dmic_be_num, hdmi_num); dmic_be_num, hdmi_num, ctx->idisp_codec);
if (!dai_links) if (!dai_links)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment