Commit 5cfe9ed2 authored by Brent Lu's avatar Brent Lu Committed by Mark Brown

ASoC: Intel: sof_sdw: use sof_hdmi_private to init HDMI

Use sof_hdmi_private structure instead of a link list of sof_hdmi_pcm
structure for HDMI dai link initialization since hdac-hdmi support is
removed.
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarBrent Lu <brent.lu@intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231012190826.142619-18-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent d8fc8176
...@@ -1542,8 +1542,6 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, ...@@ -1542,8 +1542,6 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index,
return 0; return 0;
} }
#define IDISP_CODEC_MASK 0x4
static int sof_card_dai_links_create(struct snd_soc_card *card) static int sof_card_dai_links_create(struct snd_soc_card *card)
{ {
struct device *dev = card->dev; struct device *dev = card->dev;
...@@ -1587,7 +1585,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) ...@@ -1587,7 +1585,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
} }
if (mach_params->codec_mask & IDISP_CODEC_MASK) { if (mach_params->codec_mask & IDISP_CODEC_MASK) {
ctx->idisp_codec = true; ctx->hdmi.idisp_codec = true;
if (sof_sdw_quirk & SOF_SDW_TGL_HDMI) if (sof_sdw_quirk & SOF_SDW_TGL_HDMI)
hdmi_num = SOF_TGL_HDMI_COUNT; hdmi_num = SOF_TGL_HDMI_COUNT;
...@@ -1757,7 +1755,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) ...@@ -1757,7 +1755,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d", i + 1); name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d", i + 1);
cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d Pin", i + 1); cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "iDisp%d Pin", i + 1);
if (ctx->idisp_codec) { if (ctx->hdmi.idisp_codec) {
codec_name = "ehdaudio0D2"; codec_name = "ehdaudio0D2";
codec_dai_name = devm_kasprintf(dev, GFP_KERNEL, codec_dai_name = devm_kasprintf(dev, GFP_KERNEL,
"intel-hdmi-hifi%d", i + 1); "intel-hdmi-hifi%d", i + 1);
...@@ -1769,7 +1767,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) ...@@ -1769,7 +1767,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, name, ret = init_simple_dai_link(dev, dai_links + link_index, &be_id, name,
1, 0, // HDMI only supports playback 1, 0, // HDMI only supports playback
cpu_dai_name, codec_name, codec_dai_name, cpu_dai_name, codec_name, codec_dai_name,
sof_sdw_hdmi_init, NULL); i == 0 ? sof_sdw_hdmi_init : NULL, NULL);
if (ret) if (ret)
return ret; return ret;
...@@ -1814,7 +1812,7 @@ static int sof_sdw_card_late_probe(struct snd_soc_card *card) ...@@ -1814,7 +1812,7 @@ static int sof_sdw_card_late_probe(struct snd_soc_card *card)
} }
} }
if (ctx->idisp_codec) if (ctx->hdmi.idisp_codec)
ret = sof_sdw_hdmi_card_late_probe(card); ret = sof_sdw_hdmi_card_late_probe(card);
return ret; return ret;
...@@ -1893,8 +1891,6 @@ static int mc_probe(struct platform_device *pdev) ...@@ -1893,8 +1891,6 @@ static int mc_probe(struct platform_device *pdev)
if (!ctx) if (!ctx)
return -ENOMEM; return -ENOMEM;
INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
snd_soc_card_set_drvdata(card, ctx); snd_soc_card_set_drvdata(card, ctx);
dmi_check_system(sof_sdw_quirk_table); dmi_check_system(sof_sdw_quirk_table);
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/bits.h> #include <linux/bits.h>
#include <linux/types.h> #include <linux/types.h>
#include <sound/soc.h> #include <sound/soc.h>
#include "sof_hdmi_common.h"
#define MAX_NO_PROPS 2 #define MAX_NO_PROPS 2
#define MAX_HDMI_NUM 4 #define MAX_HDMI_NUM 4
...@@ -94,9 +95,8 @@ struct sof_sdw_codec_info { ...@@ -94,9 +95,8 @@ struct sof_sdw_codec_info {
}; };
struct mc_private { struct mc_private {
struct list_head hdmi_pcm_list;
bool idisp_codec;
struct snd_soc_jack sdw_headset; struct snd_soc_jack sdw_headset;
struct sof_hdmi_private hdmi;
struct device *headset_codec_dev; /* only one headset per card */ struct device *headset_codec_dev; /* only one headset per card */
struct device *amp_dev1, *amp_dev2; struct device *amp_dev1, *amp_dev2;
/* To store SDW Pin index for each SoundWire link */ /* To store SDW Pin index for each SoundWire link */
......
...@@ -15,47 +15,25 @@ ...@@ -15,47 +15,25 @@
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
#include "hda_dsp_common.h" #include "hda_dsp_common.h"
struct hdmi_pcm {
struct list_head head;
struct snd_soc_dai *codec_dai;
int device;
};
int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd) int sof_sdw_hdmi_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct mc_private *ctx = snd_soc_card_get_drvdata(rtd->card); struct mc_private *ctx = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *dai = snd_soc_rtd_to_codec(rtd, 0); struct snd_soc_dai *dai = snd_soc_rtd_to_codec(rtd, 0);
struct hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
if (!pcm)
return -ENOMEM;
/* dai_link id is 1:1 mapped to the PCM device */ ctx->hdmi.hdmi_comp = dai->component;
pcm->device = rtd->dai_link->id;
pcm->codec_dai = dai;
list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
return 0; return 0;
} }
#define NAME_SIZE 32
int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card) int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card)
{ {
struct mc_private *ctx = snd_soc_card_get_drvdata(card); struct mc_private *ctx = snd_soc_card_get_drvdata(card);
struct hdmi_pcm *pcm;
struct snd_soc_component *component = NULL;
if (!ctx->idisp_codec) if (!ctx->hdmi.idisp_codec)
return 0; return 0;
if (list_empty(&ctx->hdmi_pcm_list)) if (!ctx->hdmi.hdmi_comp)
return -EINVAL; return -EINVAL;
pcm = list_first_entry(&ctx->hdmi_pcm_list, struct hdmi_pcm, return hda_dsp_hdmi_build_controls(card, ctx->hdmi.hdmi_comp);
head);
component = pcm->codec_dai->component;
return hda_dsp_hdmi_build_controls(card, 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