Commit f3c37847 authored by apoorv's avatar apoorv Committed by Mark Brown

ASoC: Intel: sof_rt5682 add support for HDMI_In capture

Adding support for 2 streams of HDMI-In capture via I2S with rt5682s
codec variant
Reviewed-by: default avatarCBM <balamurugan.c@intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarapoorv <apoorv@intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230731214257.444605-4-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 26d9726f
...@@ -62,6 +62,11 @@ ...@@ -62,6 +62,11 @@
#define SOF_RT1019_SPEAKER_AMP_PRESENT BIT(26) #define SOF_RT1019_SPEAKER_AMP_PRESENT BIT(26)
#define SOF_RT5650_HEADPHONE_CODEC_PRESENT BIT(27) #define SOF_RT5650_HEADPHONE_CODEC_PRESENT BIT(27)
/* HDMI capture*/
#define SOF_NO_OF_HDMI_CAPTURE_SSP_SHIFT 27
#define SOF_SSP_HDMI_CAPTURE_PRESENT_MASK (GENMASK(30, 27))
#define SOF_HDMI_CAPTURE_SSP_MASK(quirk) \
(((quirk) << SOF_NO_OF_HDMI_CAPTURE_SSP_SHIFT) & SOF_SSP_HDMI_CAPTURE_PRESENT_MASK)
/* Default: MCLK on, MCLK 19.2M, SSP0 */ /* Default: MCLK on, MCLK 19.2M, SSP0 */
static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN | static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN |
...@@ -670,6 +675,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, ...@@ -670,6 +675,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
struct snd_soc_dai_link_component *cpus; struct snd_soc_dai_link_component *cpus;
struct snd_soc_dai_link *links; struct snd_soc_dai_link *links;
int i, id = 0; int i, id = 0;
int hdmi_id_offset = 0;
links = devm_kcalloc(dev, sof_audio_card_rt5682.num_links, links = devm_kcalloc(dev, sof_audio_card_rt5682.num_links,
sizeof(struct snd_soc_dai_link), GFP_KERNEL); sizeof(struct snd_soc_dai_link), GFP_KERNEL);
...@@ -891,6 +897,34 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, ...@@ -891,6 +897,34 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
links[id].num_cpus = 1; links[id].num_cpus = 1;
} }
/* HDMI-In SSP */
if (sof_rt5682_quirk & SOF_SSP_HDMI_CAPTURE_PRESENT_MASK) {
unsigned long hdmi_in_ssp = (sof_rt5682_quirk &
SOF_SSP_HDMI_CAPTURE_PRESENT_MASK) >>
SOF_NO_OF_HDMI_CAPTURE_SSP_SHIFT;
int port = 0;
for_each_set_bit(port, &hdmi_in_ssp, 32) {
links[id].cpus = &cpus[id];
links[id].cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL,
"SSP%d Pin", port);
if (!links[id].cpus->dai_name)
return NULL;
links[id].name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-HDMI", port);
if (!links[id].name)
return NULL;
links[id].id = id + hdmi_id_offset;
links[id].codecs = &asoc_dummy_dlc;
links[id].num_codecs = 1;
links[id].platforms = platform_component;
links[id].num_platforms = ARRAY_SIZE(platform_component);
links[id].dpcm_capture = 1;
links[id].no_pcm = 1;
links[id].num_cpus = 1;
id++;
}
}
return links; return links;
devm_err: devm_err:
return NULL; return NULL;
...@@ -997,6 +1031,11 @@ static int sof_audio_probe(struct platform_device *pdev) ...@@ -997,6 +1031,11 @@ static int sof_audio_probe(struct platform_device *pdev)
if (sof_rt5682_quirk & SOF_SSP_BT_OFFLOAD_PRESENT) if (sof_rt5682_quirk & SOF_SSP_BT_OFFLOAD_PRESENT)
sof_audio_card_rt5682.num_links++; sof_audio_card_rt5682.num_links++;
if (sof_rt5682_quirk & SOF_SSP_HDMI_CAPTURE_PRESENT_MASK)
sof_audio_card_rt5682.num_links +=
hweight32((sof_rt5682_quirk & SOF_SSP_HDMI_CAPTURE_PRESENT_MASK) >>
SOF_NO_OF_HDMI_CAPTURE_SSP_SHIFT);
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, ctx->idisp_codec); dmic_be_num, hdmi_num, ctx->idisp_codec);
if (!dai_links) if (!dai_links)
...@@ -1163,6 +1202,14 @@ static const struct platform_device_id board_ids[] = { ...@@ -1163,6 +1202,14 @@ static const struct platform_device_id board_ids[] = {
SOF_BT_OFFLOAD_SSP(2) | SOF_BT_OFFLOAD_SSP(2) |
SOF_SSP_BT_OFFLOAD_PRESENT), SOF_SSP_BT_OFFLOAD_PRESENT),
}, },
{
.name = "adl_rt5682_c1_h02",
.driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
SOF_RT5682_SSP_CODEC(1) |
SOF_RT5682_NUM_HDMIDEV(3) |
/* SSP 0 and SSP 2 are used for HDMI IN */
SOF_HDMI_CAPTURE_SSP_MASK(0x5)),
},
{ {
.name = "rpl_mx98357_rt5682", .name = "rpl_mx98357_rt5682",
.driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN | .driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
......
...@@ -568,6 +568,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = { ...@@ -568,6 +568,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
.quirk_data = &adl_max98390_amp, .quirk_data = &adl_max98390_amp,
.sof_tplg_filename = "sof-adl-max98390-rt5682.tplg", .sof_tplg_filename = "sof-adl-max98390-rt5682.tplg",
}, },
{
.comp_ids = &adl_rt5682_rt5682s_hp,
.drv_name = "adl_rt5682_c1_h02",
.machine_quirk = snd_soc_acpi_codec_list,
.quirk_data = &adl_lt6911_hdmi,
.sof_tplg_filename = "sof-adl-rt5682-ssp1-hdmi-ssp02.tplg",
},
{ {
.comp_ids = &adl_rt5682_rt5682s_hp, .comp_ids = &adl_rt5682_rt5682s_hp,
.drv_name = "adl_rt5682", .drv_name = "adl_rt5682",
......
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