Skip to content

Commit

Permalink
ASoC: Intel: skl_hda_dsp_generic: use sof_hdmi_private to init HDMI
Browse files Browse the repository at this point in the history
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: Brent Lu <brent.lu@intel.com>
  • Loading branch information
brentlu authored and bardliao committed Aug 9, 2024
1 parent 421983f commit c6eb0a9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 30 deletions.
23 changes: 7 additions & 16 deletions sound/soc/intel/boards/skl_hda_dsp_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,16 @@
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_hdmi_pcm *pcm;
struct snd_soc_dai *dai;
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",
ctx->dai_index);
pcm->codec_dai = snd_soc_card_get_codec_dai(card, dai_name);
if (!pcm->codec_dai)
dai = snd_soc_card_get_codec_dai(card, dai_name);
if (!dai)
return -EINVAL;

list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
ctx->hdmi.hdmi_comp = dai->component;

return 0;
}
Expand Down Expand Up @@ -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)
{
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 */
if (list_empty(&ctx->hdmi_pcm_list))
if (!ctx->hdmi.idisp_codec)
return 0;

pcm = list_first_entry(&ctx->hdmi_pcm_list, struct skl_hda_hdmi_pcm,
head);
component = pcm->codec_dai->component;
if (!component)
if (!ctx->hdmi.hdmi_comp)
return -EINVAL;

return hda_dsp_hdmi_build_controls(card, component);
return hda_dsp_hdmi_build_controls(card, ctx->hdmi.hdmi_comp);
}
9 changes: 2 additions & 7 deletions sound/soc/intel/boards/skl_hda_dsp_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,16 @@
#include <sound/hda_codec.h>
#include "../../codecs/hdac_hda.h"
#include "hda_dsp_common.h"
#include "sof_hdmi_common.h"

#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 snd_soc_card card;
struct list_head hdmi_pcm_list;
struct sof_hdmi_private hdmi;
int pcm_count;
int dai_index;
const char *platform_name;
bool idisp_codec;
bool bt_offload_present;
int ssp_bt;
};
Expand Down
13 changes: 6 additions & 7 deletions sound/soc/intel/boards/skl_hda_dsp_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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->nonatomic = 1;

if (!ctx->idisp_codec)
if (!ctx->hdmi.idisp_codec)
return 0;

if (strstr(link->name, "HDMI")) {
Expand All @@ -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 */
#define IDISP_ROUTE_COUNT (IDISP_DAI_COUNT * 2)
#define IDISP_CODEC_MASK 0x4

#define HDA_CODEC_AUTOSUSPEND_DELAY_MS 1000

Expand All @@ -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_count = hweight_long(codec_mask);
ctx->idisp_codec = !!(codec_mask & IDISP_CODEC_MASK);

if (!codec_count || codec_count > 2 ||
(codec_count == 2 && !ctx->idisp_codec))
(codec_count == 2 && !ctx->hdmi.idisp_codec))
return -EINVAL;

if (codec_mask == IDISP_CODEC_MASK) {
Expand All @@ -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);
card->dapm_widgets = 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];
num_route -= IDISP_ROUTE_COUNT;
for (i = 0; i < IDISP_DAI_COUNT; i++) {
Expand Down Expand Up @@ -218,8 +216,6 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
if (!ctx)
return -ENOMEM;

INIT_LIST_HEAD(&ctx->hdmi_pcm_list);

card = &ctx->card;
card->name = "hda-dsp",
card->owner = THIS_MODULE,
Expand All @@ -232,6 +228,9 @@ static int skl_hda_audio_probe(struct platform_device *pdev)

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) {
ctx->bt_offload_present = true;
ctx->ssp_bt = fls(mach->mach_params.bt_link_mask) - 1;
Expand Down

0 comments on commit c6eb0a9

Please sign in to comment.