diff options
author | Subhransu S. Prusty <subhransu.s.prusty@intel.com> | 2016-04-14 00:37:31 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-04-28 13:49:24 -0400 |
commit | 1a10612fc3f5eb5cfa89af3f6b8181d69f79a371 (patch) | |
tree | ddf8fcc62d253732801a9f611c5b7ca9e676a475 | |
parent | bcced704788312360c0413d13b11611ae00a91c8 (diff) |
ASoC: skl_rt286: Fix to support hdmi channel map support
HDMI registers channel map controls per PCM. As PCMs are not
registered during dai_link init callback, store the pcm ids and
codec DAIs during this init callback.
Register for late probe and call the jack_init API which also
registers channel map in the late probe callback handler.
The patch following the machine driver changes adds the channel
map control in the hdac_hdmi codec driver.
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/intel/boards/skl_rt286.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/sound/soc/intel/boards/skl_rt286.c b/sound/soc/intel/boards/skl_rt286.c index 2016397a8e75..06de802898fb 100644 --- a/sound/soc/intel/boards/skl_rt286.c +++ b/sound/soc/intel/boards/skl_rt286.c | |||
@@ -30,6 +30,16 @@ | |||
30 | 30 | ||
31 | static struct snd_soc_jack skylake_headset; | 31 | static struct snd_soc_jack skylake_headset; |
32 | 32 | ||
33 | struct skl_hdmi_pcm { | ||
34 | struct list_head head; | ||
35 | struct snd_soc_dai *codec_dai; | ||
36 | int device; | ||
37 | }; | ||
38 | |||
39 | struct skl_rt286_private { | ||
40 | struct list_head hdmi_pcm_list; | ||
41 | }; | ||
42 | |||
33 | enum { | 43 | enum { |
34 | SKL_DPCM_AUDIO_PB = 0, | 44 | SKL_DPCM_AUDIO_PB = 0, |
35 | SKL_DPCM_AUDIO_CP, | 45 | SKL_DPCM_AUDIO_CP, |
@@ -142,9 +152,20 @@ static int skylake_rt286_codec_init(struct snd_soc_pcm_runtime *rtd) | |||
142 | 152 | ||
143 | static int skylake_hdmi_init(struct snd_soc_pcm_runtime *rtd) | 153 | static int skylake_hdmi_init(struct snd_soc_pcm_runtime *rtd) |
144 | { | 154 | { |
155 | struct skl_rt286_private *ctx = snd_soc_card_get_drvdata(rtd->card); | ||
145 | struct snd_soc_dai *dai = rtd->codec_dai; | 156 | struct snd_soc_dai *dai = rtd->codec_dai; |
157 | struct skl_hdmi_pcm *pcm; | ||
158 | |||
159 | pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL); | ||
160 | if (!pcm) | ||
161 | return -ENOMEM; | ||
146 | 162 | ||
147 | return hdac_hdmi_jack_init(dai, SKL_DPCM_AUDIO_HDMI1_PB + dai->id); | 163 | pcm->device = SKL_DPCM_AUDIO_HDMI1_PB + dai->id; |
164 | pcm->codec_dai = dai; | ||
165 | |||
166 | list_add_tail(&pcm->head, &ctx->hdmi_pcm_list); | ||
167 | |||
168 | return 0; | ||
148 | } | 169 | } |
149 | 170 | ||
150 | static unsigned int rates[] = { | 171 | static unsigned int rates[] = { |
@@ -438,6 +459,21 @@ static struct snd_soc_dai_link skylake_rt286_dais[] = { | |||
438 | }, | 459 | }, |
439 | }; | 460 | }; |
440 | 461 | ||
462 | static int skylake_card_late_probe(struct snd_soc_card *card) | ||
463 | { | ||
464 | struct skl_rt286_private *ctx = snd_soc_card_get_drvdata(card); | ||
465 | struct skl_hdmi_pcm *pcm; | ||
466 | int err; | ||
467 | |||
468 | list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { | ||
469 | err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device); | ||
470 | if (err < 0) | ||
471 | return err; | ||
472 | } | ||
473 | |||
474 | return 0; | ||
475 | } | ||
476 | |||
441 | /* skylake audio machine driver for SPT + RT286S */ | 477 | /* skylake audio machine driver for SPT + RT286S */ |
442 | static struct snd_soc_card skylake_rt286 = { | 478 | static struct snd_soc_card skylake_rt286 = { |
443 | .name = "skylake-rt286", | 479 | .name = "skylake-rt286", |
@@ -451,11 +487,21 @@ static struct snd_soc_card skylake_rt286 = { | |||
451 | .dapm_routes = skylake_rt286_map, | 487 | .dapm_routes = skylake_rt286_map, |
452 | .num_dapm_routes = ARRAY_SIZE(skylake_rt286_map), | 488 | .num_dapm_routes = ARRAY_SIZE(skylake_rt286_map), |
453 | .fully_routed = true, | 489 | .fully_routed = true, |
490 | .late_probe = skylake_card_late_probe, | ||
454 | }; | 491 | }; |
455 | 492 | ||
456 | static int skylake_audio_probe(struct platform_device *pdev) | 493 | static int skylake_audio_probe(struct platform_device *pdev) |
457 | { | 494 | { |
495 | struct skl_rt286_private *ctx; | ||
496 | |||
497 | ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_ATOMIC); | ||
498 | if (!ctx) | ||
499 | return -ENOMEM; | ||
500 | |||
501 | INIT_LIST_HEAD(&ctx->hdmi_pcm_list); | ||
502 | |||
458 | skylake_rt286.dev = &pdev->dev; | 503 | skylake_rt286.dev = &pdev->dev; |
504 | snd_soc_card_set_drvdata(&skylake_rt286, ctx); | ||
459 | 505 | ||
460 | return devm_snd_soc_register_card(&pdev->dev, &skylake_rt286); | 506 | return devm_snd_soc_register_card(&pdev->dev, &skylake_rt286); |
461 | } | 507 | } |