Skip to content

Commit 690640e

Browse files
brentlubroonie
authored andcommitted
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: Brent Lu <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Kai Vehmanen <[email protected]> Signed-off-by: Bard Liao <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent a2a0312 commit 690640e

File tree

3 files changed

+15
-30
lines changed

3 files changed

+15
-30
lines changed

sound/soc/intel/boards/skl_hda_dsp_common.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,16 @@
2121
int skl_hda_hdmi_add_pcm(struct snd_soc_card *card, int device)
2222
{
2323
struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card);
24-
struct skl_hda_hdmi_pcm *pcm;
24+
struct snd_soc_dai *dai;
2525
char dai_name[NAME_SIZE];
2626

27-
pcm = devm_kzalloc(card->dev, sizeof(*pcm), GFP_KERNEL);
28-
if (!pcm)
29-
return -ENOMEM;
30-
3127
snprintf(dai_name, sizeof(dai_name), "intel-hdmi-hifi%d",
3228
ctx->dai_index);
33-
pcm->codec_dai = snd_soc_card_get_codec_dai(card, dai_name);
34-
if (!pcm->codec_dai)
29+
dai = snd_soc_card_get_codec_dai(card, dai_name);
30+
if (!dai)
3531
return -EINVAL;
3632

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

3935
return 0;
4036
}
@@ -148,18 +144,13 @@ struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS] = {
148144
int skl_hda_hdmi_jack_init(struct snd_soc_card *card)
149145
{
150146
struct skl_hda_private *ctx = snd_soc_card_get_drvdata(card);
151-
struct snd_soc_component *component;
152-
struct skl_hda_hdmi_pcm *pcm;
153147

154148
/* HDMI disabled, do not create controls */
155-
if (list_empty(&ctx->hdmi_pcm_list))
149+
if (!ctx->hdmi.idisp_codec)
156150
return 0;
157151

158-
pcm = list_first_entry(&ctx->hdmi_pcm_list, struct skl_hda_hdmi_pcm,
159-
head);
160-
component = pcm->codec_dai->component;
161-
if (!component)
152+
if (!ctx->hdmi.hdmi_comp)
162153
return -EINVAL;
163154

164-
return hda_dsp_hdmi_build_controls(card, component);
155+
return hda_dsp_hdmi_build_controls(card, ctx->hdmi.hdmi_comp);
165156
}

sound/soc/intel/boards/skl_hda_dsp_common.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,16 @@
1717
#include <sound/hda_codec.h>
1818
#include "../../codecs/hdac_hda.h"
1919
#include "hda_dsp_common.h"
20+
#include "sof_hdmi_common.h"
2021

2122
#define HDA_DSP_MAX_BE_DAI_LINKS 8
2223

23-
struct skl_hda_hdmi_pcm {
24-
struct list_head head;
25-
struct snd_soc_dai *codec_dai;
26-
};
27-
2824
struct skl_hda_private {
2925
struct snd_soc_card card;
30-
struct list_head hdmi_pcm_list;
26+
struct sof_hdmi_private hdmi;
3127
int pcm_count;
3228
int dai_index;
3329
const char *platform_name;
34-
bool idisp_codec;
3530
bool bt_offload_present;
3631
int ssp_bt;
3732
};

sound/soc/intel/boards/skl_hda_dsp_generic.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link)
7575
link->platforms->name = ctx->platform_name;
7676
link->nonatomic = 1;
7777

78-
if (!ctx->idisp_codec)
78+
if (!ctx->hdmi.idisp_codec)
7979
return 0;
8080

8181
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)
9898

9999
/* there are two routes per iDisp output */
100100
#define IDISP_ROUTE_COUNT (IDISP_DAI_COUNT * 2)
101-
#define IDISP_CODEC_MASK 0x4
102101

103102
#define HDA_CODEC_AUTOSUSPEND_DELAY_MS 1000
104103

@@ -113,10 +112,9 @@ static int skl_hda_fill_card_info(struct device *dev, struct snd_soc_card *card,
113112

114113
codec_mask = mach_params->codec_mask;
115114
codec_count = hweight_long(codec_mask);
116-
ctx->idisp_codec = !!(codec_mask & IDISP_CODEC_MASK);
117115

118116
if (!codec_count || codec_count > 2 ||
119-
(codec_count == 2 && !ctx->idisp_codec))
117+
(codec_count == 2 && !ctx->hdmi.idisp_codec))
120118
return -EINVAL;
121119

122120
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,
141139
num_route = ARRAY_SIZE(skl_hda_map);
142140
card->dapm_widgets = skl_hda_widgets;
143141
card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets);
144-
if (!ctx->idisp_codec) {
142+
if (!ctx->hdmi.idisp_codec) {
145143
card->dapm_routes = &skl_hda_map[IDISP_ROUTE_COUNT];
146144
num_route -= IDISP_ROUTE_COUNT;
147145
for (i = 0; i < IDISP_DAI_COUNT; i++) {
@@ -218,8 +216,6 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
218216
if (!ctx)
219217
return -ENOMEM;
220218

221-
INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
222-
223219
card = &ctx->card;
224220
card->name = "hda-dsp",
225221
card->owner = THIS_MODULE,
@@ -232,6 +228,9 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
232228

233229
snd_soc_card_set_drvdata(card, ctx);
234230

231+
if (mach->mach_params.codec_mask & IDISP_CODEC_MASK)
232+
ctx->hdmi.idisp_codec = true;
233+
235234
if (hweight_long(mach->mach_params.bt_link_mask) == 1) {
236235
ctx->bt_offload_present = true;
237236
ctx->ssp_bt = fls(mach->mach_params.bt_link_mask) - 1;

0 commit comments

Comments
 (0)