Commit 690640ef authored by Brent Lu's avatar Brent Lu Committed by Mark Brown

ASoC: Intel: skl_hda_dsp_generic: use sof_hdmi_private to init HDMI

Use sof_hdmi_private structure instead of a link list of
skl_hda_hdmi_pcm structure for HDMI dai link initialization since
hdac-hdmi support is removed.
Signed-off-by: default avatarBrent Lu <brent.lu@intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Link: https://patch.msgid.link/20240827123215.258859-14-yung-chuan.liao@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a2a0312a
...@@ -21,20 +21,16 @@ ...@@ -21,20 +21,16 @@
int skl_hda_hdmi_add_pcm(struct snd_soc_card *card, int device) int skl_hda_hdmi_add_pcm(struct snd_soc_card *card, int device)
{ {
struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card); struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card);
struct skl_hda_hdmi_pcm *pcm; struct snd_soc_dai *dai;
char dai_name[NAME_SIZE]; char dai_name[NAME_SIZE];
pcm = devm_kzalloc(card->dev, sizeof(*pcm), GFP_KERNEL);
if (!pcm)
return -ENOMEM;
snprintf(dai_name, sizeof(dai_name), "intel-hdmi-hifi%d", snprintf(dai_name, sizeof(dai_name), "intel-hdmi-hifi%d",
ctx->dai_index); ctx->dai_index);
pcm->codec_dai = snd_soc_card_get_codec_dai(card, dai_name); dai = snd_soc_card_get_codec_dai(card, dai_name);
if (!pcm->codec_dai) if (!dai)
return -EINVAL; return -EINVAL;
list_add_tail(&pcm->head, &ctx->hdmi_pcm_list); ctx->hdmi.hdmi_comp = dai->component;
return 0; return 0;
} }
...@@ -148,18 +144,13 @@ struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS] = { ...@@ -148,18 +144,13 @@ struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS] = {
int skl_hda_hdmi_jack_init(struct snd_soc_card *card) int skl_hda_hdmi_jack_init(struct snd_soc_card *card)
{ {
struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card); struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card);
struct snd_soc_component *component;
struct skl_hda_hdmi_pcm *pcm;
/* HDMI disabled, do not create controls */ /* HDMI disabled, do not create controls */
if (list_empty(&ctx->hdmi_pcm_list)) if (!ctx->hdmi.idisp_codec)
return 0; return 0;
pcm = list_first_entry(&ctx->hdmi_pcm_list, struct skl_hda_hdmi_pcm, if (!ctx->hdmi.hdmi_comp)
head);
component = pcm->codec_dai->component;
if (!component)
return -EINVAL; return -EINVAL;
return hda_dsp_hdmi_build_controls(card, component); return hda_dsp_hdmi_build_controls(card, ctx->hdmi.hdmi_comp);
} }
...@@ -17,21 +17,16 @@ ...@@ -17,21 +17,16 @@
#include <sound/hda_codec.h> #include <sound/hda_codec.h>
#include "../../codecs/hdac_hda.h" #include "../../codecs/hdac_hda.h"
#include "hda_dsp_common.h" #include "hda_dsp_common.h"
#include "sof_hdmi_common.h"
#define HDA_DSP_MAX_BE_DAI_LINKS 8 #define HDA_DSP_MAX_BE_DAI_LINKS 8
struct skl_hda_hdmi_pcm {
struct list_head head;
struct snd_soc_dai *codec_dai;
};
struct skl_hda_private { struct skl_hda_private {
struct snd_soc_card card; struct snd_soc_card card;
struct list_head hdmi_pcm_list; struct sof_hdmi_private hdmi;
int pcm_count; int pcm_count;
int dai_index; int dai_index;
const char *platform_name; const char *platform_name;
bool idisp_codec;
bool bt_offload_present; bool bt_offload_present;
int ssp_bt; int ssp_bt;
}; };
......
...@@ -75,7 +75,7 @@ skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link) ...@@ -75,7 +75,7 @@ skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link)
link->platforms->name = ctx->platform_name; link->platforms->name = ctx->platform_name;
link->nonatomic = 1; link->nonatomic = 1;
if (!ctx->idisp_codec) if (!ctx->hdmi.idisp_codec)
return 0; return 0;
if (strstr(link->name, "HDMI")) { if (strstr(link->name, "HDMI")) {
...@@ -98,7 +98,6 @@ skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link) ...@@ -98,7 +98,6 @@ skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link)
/* there are two routes per iDisp output */ /* there are two routes per iDisp output */
#define IDISP_ROUTE_COUNT (IDISP_DAI_COUNT * 2) #define IDISP_ROUTE_COUNT (IDISP_DAI_COUNT * 2)
#define IDISP_CODEC_MASK 0x4
#define HDA_CODEC_AUTOSUSPEND_DELAY_MS 1000 #define HDA_CODEC_AUTOSUSPEND_DELAY_MS 1000
...@@ -113,10 +112,9 @@ static int skl_hda_fill_card_info(struct device *dev, struct snd_soc_card *card, ...@@ -113,10 +112,9 @@ static int skl_hda_fill_card_info(struct device *dev, struct snd_soc_card *card,
codec_mask = mach_params->codec_mask; codec_mask = mach_params->codec_mask;
codec_count = hweight_long(codec_mask); codec_count = hweight_long(codec_mask);
ctx->idisp_codec = !!(codec_mask & IDISP_CODEC_MASK);
if (!codec_count || codec_count > 2 || if (!codec_count || codec_count > 2 ||
(codec_count == 2 && !ctx->idisp_codec)) (codec_count == 2 && !ctx->hdmi.idisp_codec))
return -EINVAL; return -EINVAL;
if (codec_mask == IDISP_CODEC_MASK) { if (codec_mask == IDISP_CODEC_MASK) {
...@@ -141,7 +139,7 @@ static int skl_hda_fill_card_info(struct device *dev, struct snd_soc_card *card, ...@@ -141,7 +139,7 @@ static int skl_hda_fill_card_info(struct device *dev, struct snd_soc_card *card,
num_route = ARRAY_SIZE(skl_hda_map); num_route = ARRAY_SIZE(skl_hda_map);
card->dapm_widgets = skl_hda_widgets; card->dapm_widgets = skl_hda_widgets;
card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets); card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets);
if (!ctx->idisp_codec) { if (!ctx->hdmi.idisp_codec) {
card->dapm_routes = &skl_hda_map[IDISP_ROUTE_COUNT]; card->dapm_routes = &skl_hda_map[IDISP_ROUTE_COUNT];
num_route -= IDISP_ROUTE_COUNT; num_route -= IDISP_ROUTE_COUNT;
for (i = 0; i < IDISP_DAI_COUNT; i++) { for (i = 0; i < IDISP_DAI_COUNT; i++) {
...@@ -218,8 +216,6 @@ static int skl_hda_audio_probe(struct platform_device *pdev) ...@@ -218,8 +216,6 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
if (!ctx) if (!ctx)
return -ENOMEM; return -ENOMEM;
INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
card = &ctx->card; card = &ctx->card;
card->name = "hda-dsp", card->name = "hda-dsp",
card->owner = THIS_MODULE, card->owner = THIS_MODULE,
...@@ -232,6 +228,9 @@ static int skl_hda_audio_probe(struct platform_device *pdev) ...@@ -232,6 +228,9 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
snd_soc_card_set_drvdata(card, ctx); snd_soc_card_set_drvdata(card, ctx);
if (mach->mach_params.codec_mask & IDISP_CODEC_MASK)
ctx->hdmi.idisp_codec = true;
if (hweight_long(mach->mach_params.bt_link_mask) == 1) { if (hweight_long(mach->mach_params.bt_link_mask) == 1) {
ctx->bt_offload_present = true; ctx->bt_offload_present = true;
ctx->ssp_bt = fls(mach->mach_params.bt_link_mask) - 1; ctx->ssp_bt = fls(mach->mach_params.bt_link_mask) - 1;
......
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