Commit 15ef2ea0 authored by Kai Vehmanen's avatar Kai Vehmanen Committed by Mark Brown

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

Extend the generic SOF Soundwire machine driver to support systems where
iDisp HDMI/DP audio codec is disabled for some reason (i915 driver
disabled, HDMI/DP implemented with a discrete GPU, etc). Switch codecs
to SoC dummy in the affected DAI links. This allows to reuse existing
topologies for this case.
Signed-off-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: default avatarRander Wang <rander.wang@linux.intel.com>
Link: https://lore.kernel.org/r/20200717211337.31956-4-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent cf0418cd
...@@ -699,11 +699,14 @@ static inline int get_next_be_id(struct snd_soc_dai_link *links, ...@@ -699,11 +699,14 @@ static inline int get_next_be_id(struct snd_soc_dai_link *links,
return links[be_id - 1].id + 1; return links[be_id - 1].id + 1;
} }
#define IDISP_CODEC_MASK 0x4
static int sof_card_dai_links_create(struct device *dev, static int sof_card_dai_links_create(struct device *dev,
struct snd_soc_acpi_mach *mach, struct snd_soc_acpi_mach *mach,
struct snd_soc_card *card) struct snd_soc_card *card)
{ {
int ssp_num, sdw_be_num = 0, hdmi_num = 0, dmic_num; int ssp_num, sdw_be_num = 0, hdmi_num = 0, dmic_num;
struct mc_private *ctx = snd_soc_card_get_drvdata(card);
struct snd_soc_dai_link_component *idisp_components; struct snd_soc_dai_link_component *idisp_components;
struct snd_soc_dai_link_component *ssp_components; struct snd_soc_dai_link_component *ssp_components;
struct snd_soc_acpi_mach_params *mach_params; struct snd_soc_acpi_mach_params *mach_params;
...@@ -747,12 +750,15 @@ static int sof_card_dai_links_create(struct device *dev, ...@@ -747,12 +750,15 @@ static int sof_card_dai_links_create(struct device *dev,
return ret; return ret;
} }
if (mach_params->codec_mask & IDISP_CODEC_MASK)
ctx->idisp_codec = true;
/* enable dmic01 & dmic16k */ /* enable dmic01 & dmic16k */
dmic_num = (sof_sdw_quirk & SOF_SDW_PCH_DMIC) ? 2 : 0; dmic_num = (sof_sdw_quirk & SOF_SDW_PCH_DMIC) ? 2 : 0;
comp_num += dmic_num; comp_num += dmic_num;
dev_dbg(dev, "sdw %d, ssp %d, dmic %d, hdmi %d", sdw_be_num, ssp_num, dev_dbg(dev, "sdw %d, ssp %d, dmic %d, hdmi %d", sdw_be_num, ssp_num,
dmic_num, hdmi_num); dmic_num, ctx->idisp_codec ? hdmi_num : 0);
/* allocate BE dailinks */ /* allocate BE dailinks */
num_links = comp_num + sdw_be_num; num_links = comp_num + sdw_be_num;
...@@ -901,13 +907,18 @@ static int sof_card_dai_links_create(struct device *dev, ...@@ -901,13 +907,18 @@ static int sof_card_dai_links_create(struct device *dev,
if (!name) if (!name)
return -ENOMEM; return -ENOMEM;
idisp_components[i].name = "ehdaudio0D2"; if (ctx->idisp_codec) {
idisp_components[i].dai_name = devm_kasprintf(dev, idisp_components[i].name = "ehdaudio0D2";
GFP_KERNEL, idisp_components[i].dai_name = devm_kasprintf(dev,
"intel-hdmi-hifi%d", GFP_KERNEL,
i + 1); "intel-hdmi-hifi%d",
if (!idisp_components[i].dai_name) i + 1);
return -ENOMEM; if (!idisp_components[i].dai_name)
return -ENOMEM;
} else {
idisp_components[i].name = "snd-soc-dummy";
idisp_components[i].dai_name = "snd-soc-dummy-dai";
}
cpu_name = devm_kasprintf(dev, GFP_KERNEL, cpu_name = devm_kasprintf(dev, GFP_KERNEL,
"iDisp%d Pin", i + 1); "iDisp%d Pin", i + 1);
...@@ -982,6 +993,7 @@ static int mc_probe(struct platform_device *pdev) ...@@ -982,6 +993,7 @@ static int mc_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&ctx->hdmi_pcm_list); INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
card->dev = &pdev->dev; card->dev = &pdev->dev;
snd_soc_card_set_drvdata(card, ctx);
mach = pdev->dev.platform_data; mach = pdev->dev.platform_data;
ret = sof_card_dai_links_create(&pdev->dev, mach, ret = sof_card_dai_links_create(&pdev->dev, mach,
...@@ -991,8 +1003,6 @@ static int mc_probe(struct platform_device *pdev) ...@@ -991,8 +1003,6 @@ static int mc_probe(struct platform_device *pdev)
ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv;
snd_soc_card_set_drvdata(card, ctx);
/* /*
* the default amp_num is zero for each codec and * the default amp_num is zero for each codec and
* amp_num will only be increased for active amp * amp_num will only be increased for active amp
......
...@@ -70,6 +70,7 @@ struct sof_sdw_codec_info { ...@@ -70,6 +70,7 @@ struct sof_sdw_codec_info {
struct mc_private { struct mc_private {
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;
struct snd_soc_jack sdw_headset; struct snd_soc_jack sdw_headset;
}; };
......
...@@ -52,6 +52,9 @@ int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card) ...@@ -52,6 +52,9 @@ int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card)
int err, i = 0; int err, i = 0;
char jack_name[NAME_SIZE]; char jack_name[NAME_SIZE];
if (!ctx->idisp_codec)
return 0;
pcm = list_first_entry(&ctx->hdmi_pcm_list, struct hdmi_pcm, pcm = list_first_entry(&ctx->hdmi_pcm_list, struct hdmi_pcm,
head); head);
component = pcm->codec_dai->component; component = pcm->codec_dai->component;
......
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