aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/intel/boards/skl_nau88l25_ssm4567.c73
1 files changed, 70 insertions, 3 deletions
diff --git a/sound/soc/intel/boards/skl_nau88l25_ssm4567.c b/sound/soc/intel/boards/skl_nau88l25_ssm4567.c
index 5f1ca99ae9b0..bde85bf989b8 100644
--- a/sound/soc/intel/boards/skl_nau88l25_ssm4567.c
+++ b/sound/soc/intel/boards/skl_nau88l25_ssm4567.c
@@ -34,6 +34,15 @@
34static struct snd_soc_jack skylake_headset; 34static struct snd_soc_jack skylake_headset;
35static struct snd_soc_card skylake_audio_card; 35static struct snd_soc_card skylake_audio_card;
36 36
37struct skl_hdmi_pcm {
38 struct list_head head;
39 struct snd_soc_dai *codec_dai;
40 int device;
41};
42
43struct skl_nau88125_private {
44 struct list_head hdmi_pcm_list;
45};
37enum { 46enum {
38 SKL_DPCM_AUDIO_PB = 0, 47 SKL_DPCM_AUDIO_PB = 0,
39 SKL_DPCM_AUDIO_CP, 48 SKL_DPCM_AUDIO_CP,
@@ -222,24 +231,57 @@ static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
222 231
223static int skylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd) 232static int skylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
224{ 233{
234 struct skl_nau88125_private *ctx = snd_soc_card_get_drvdata(rtd->card);
225 struct snd_soc_dai *dai = rtd->codec_dai; 235 struct snd_soc_dai *dai = rtd->codec_dai;
236 struct skl_hdmi_pcm *pcm;
237
238 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
239 if (!pcm)
240 return -ENOMEM;
241
242 pcm->device = SKL_DPCM_AUDIO_HDMI1_PB;
243 pcm->codec_dai = dai;
244
245 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
226 246
227 return hdac_hdmi_jack_init(dai, SKL_DPCM_AUDIO_HDMI1_PB); 247 return 0;
228} 248}
229 249
230static int skylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd) 250static int skylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
231{ 251{
252 struct skl_nau88125_private *ctx = snd_soc_card_get_drvdata(rtd->card);
232 struct snd_soc_dai *dai = rtd->codec_dai; 253 struct snd_soc_dai *dai = rtd->codec_dai;
254 struct skl_hdmi_pcm *pcm;
255
256 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
257 if (!pcm)
258 return -ENOMEM;
259
260 pcm->device = SKL_DPCM_AUDIO_HDMI2_PB;
261 pcm->codec_dai = dai;
233 262
234 return hdac_hdmi_jack_init(dai, SKL_DPCM_AUDIO_HDMI2_PB); 263 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
264
265 return 0;
235} 266}
236 267
237 268
238static int skylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd) 269static int skylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
239{ 270{
271 struct skl_nau88125_private *ctx = snd_soc_card_get_drvdata(rtd->card);
240 struct snd_soc_dai *dai = rtd->codec_dai; 272 struct snd_soc_dai *dai = rtd->codec_dai;
273 struct skl_hdmi_pcm *pcm;
274
275 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
276 if (!pcm)
277 return -ENOMEM;
241 278
242 return hdac_hdmi_jack_init(dai, SKL_DPCM_AUDIO_HDMI3_PB); 279 pcm->device = SKL_DPCM_AUDIO_HDMI3_PB;
280 pcm->codec_dai = dai;
281
282 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
283
284 return 0;
243} 285}
244 286
245static int skylake_nau8825_fe_init(struct snd_soc_pcm_runtime *rtd) 287static int skylake_nau8825_fe_init(struct snd_soc_pcm_runtime *rtd)
@@ -585,6 +627,21 @@ static struct snd_soc_dai_link skylake_dais[] = {
585 }, 627 },
586}; 628};
587 629
630static int skylake_card_late_probe(struct snd_soc_card *card)
631{
632 struct skl_nau88125_private *ctx = snd_soc_card_get_drvdata(card);
633 struct skl_hdmi_pcm *pcm;
634 int err;
635
636 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
637 err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device);
638 if (err < 0)
639 return err;
640 }
641
642 return 0;
643}
644
588/* skylake audio machine driver for SPT + NAU88L25 */ 645/* skylake audio machine driver for SPT + NAU88L25 */
589static struct snd_soc_card skylake_audio_card = { 646static struct snd_soc_card skylake_audio_card = {
590 .name = "sklnau8825adi", 647 .name = "sklnau8825adi",
@@ -600,11 +657,21 @@ static struct snd_soc_card skylake_audio_card = {
600 .codec_conf = ssm4567_codec_conf, 657 .codec_conf = ssm4567_codec_conf,
601 .num_configs = ARRAY_SIZE(ssm4567_codec_conf), 658 .num_configs = ARRAY_SIZE(ssm4567_codec_conf),
602 .fully_routed = true, 659 .fully_routed = true,
660 .late_probe = skylake_card_late_probe,
603}; 661};
604 662
605static int skylake_audio_probe(struct platform_device *pdev) 663static int skylake_audio_probe(struct platform_device *pdev)
606{ 664{
665 struct skl_nau88125_private *ctx;
666
667 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_ATOMIC);
668 if (!ctx)
669 return -ENOMEM;
670
671 INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
672
607 skylake_audio_card.dev = &pdev->dev; 673 skylake_audio_card.dev = &pdev->dev;
674 snd_soc_card_set_drvdata(&skylake_audio_card, ctx);
608 675
609 return devm_snd_soc_register_card(&pdev->dev, &skylake_audio_card); 676 return devm_snd_soc_register_card(&pdev->dev, &skylake_audio_card);
610} 677}