summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorSubhransu S. Prusty <subhransu.s.prusty@intel.com>2016-04-14 00:37:32 -0400
committerMark Brown <broonie@kernel.org>2016-04-28 13:49:24 -0400
commit0d425b4f900e4dc65bd186387dae32dbbb186e77 (patch)
tree20bfa88f07ae3241bc67ab42fed1876cdf3d7813 /sound
parent1a10612fc3f5eb5cfa89af3f6b8181d69f79a371 (diff)
ASoC: Intel: boards: Update skl_nau88l25_max98357a driver to support chmap
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. 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>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/intel/boards/skl_nau88l25_max98357a.c74
1 files changed, 71 insertions, 3 deletions
diff --git a/sound/soc/intel/boards/skl_nau88l25_max98357a.c b/sound/soc/intel/boards/skl_nau88l25_max98357a.c
index 72176b79a18d..8ccc97c6255f 100644
--- a/sound/soc/intel/boards/skl_nau88l25_max98357a.c
+++ b/sound/soc/intel/boards/skl_nau88l25_max98357a.c
@@ -30,6 +30,16 @@
30static struct snd_soc_jack skylake_headset; 30static struct snd_soc_jack skylake_headset;
31static struct snd_soc_card skylake_audio_card; 31static struct snd_soc_card skylake_audio_card;
32 32
33struct skl_hdmi_pcm {
34 struct list_head head;
35 struct snd_soc_dai *codec_dai;
36 int device;
37};
38
39struct skl_nau8825_private {
40 struct list_head hdmi_pcm_list;
41};
42
33enum { 43enum {
34 SKL_DPCM_AUDIO_PB = 0, 44 SKL_DPCM_AUDIO_PB = 0,
35 SKL_DPCM_AUDIO_CP, 45 SKL_DPCM_AUDIO_CP,
@@ -192,23 +202,56 @@ static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
192 202
193static int skylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd) 203static int skylake_hdmi1_init(struct snd_soc_pcm_runtime *rtd)
194{ 204{
205 struct skl_nau8825_private *ctx = snd_soc_card_get_drvdata(rtd->card);
195 struct snd_soc_dai *dai = rtd->codec_dai; 206 struct snd_soc_dai *dai = rtd->codec_dai;
207 struct skl_hdmi_pcm *pcm;
208
209 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
210 if (!pcm)
211 return -ENOMEM;
212
213 pcm->device = SKL_DPCM_AUDIO_HDMI1_PB;
214 pcm->codec_dai = dai;
196 215
197 return hdac_hdmi_jack_init(dai, SKL_DPCM_AUDIO_HDMI1_PB); 216 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
217
218 return 0;
198} 219}
199 220
200static int skylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd) 221static int skylake_hdmi2_init(struct snd_soc_pcm_runtime *rtd)
201{ 222{
223 struct skl_nau8825_private *ctx = snd_soc_card_get_drvdata(rtd->card);
202 struct snd_soc_dai *dai = rtd->codec_dai; 224 struct snd_soc_dai *dai = rtd->codec_dai;
225 struct skl_hdmi_pcm *pcm;
226
227 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
228 if (!pcm)
229 return -ENOMEM;
203 230
204 return hdac_hdmi_jack_init(dai, SKL_DPCM_AUDIO_HDMI2_PB); 231 pcm->device = SKL_DPCM_AUDIO_HDMI2_PB;
232 pcm->codec_dai = dai;
233
234 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
235
236 return 0;
205} 237}
206 238
207static int skylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd) 239static int skylake_hdmi3_init(struct snd_soc_pcm_runtime *rtd)
208{ 240{
241 struct skl_nau8825_private *ctx = snd_soc_card_get_drvdata(rtd->card);
209 struct snd_soc_dai *dai = rtd->codec_dai; 242 struct snd_soc_dai *dai = rtd->codec_dai;
243 struct skl_hdmi_pcm *pcm;
210 244
211 return hdac_hdmi_jack_init(dai, SKL_DPCM_AUDIO_HDMI3_PB); 245 pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
246 if (!pcm)
247 return -ENOMEM;
248
249 pcm->device = SKL_DPCM_AUDIO_HDMI3_PB;
250 pcm->codec_dai = dai;
251
252 list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
253
254 return 0;
212} 255}
213 256
214static int skylake_nau8825_fe_init(struct snd_soc_pcm_runtime *rtd) 257static int skylake_nau8825_fe_init(struct snd_soc_pcm_runtime *rtd)
@@ -534,6 +577,21 @@ static struct snd_soc_dai_link skylake_dais[] = {
534 }, 577 },
535}; 578};
536 579
580static int skylake_card_late_probe(struct snd_soc_card *card)
581{
582 struct skl_nau8825_private *ctx = snd_soc_card_get_drvdata(card);
583 struct skl_hdmi_pcm *pcm;
584 int err;
585
586 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
587 err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device);
588 if (err < 0)
589 return err;
590 }
591
592 return 0;
593}
594
537/* skylake audio machine driver for SPT + NAU88L25 */ 595/* skylake audio machine driver for SPT + NAU88L25 */
538static struct snd_soc_card skylake_audio_card = { 596static struct snd_soc_card skylake_audio_card = {
539 .name = "sklnau8825max", 597 .name = "sklnau8825max",
@@ -547,11 +605,21 @@ static struct snd_soc_card skylake_audio_card = {
547 .dapm_routes = skylake_map, 605 .dapm_routes = skylake_map,
548 .num_dapm_routes = ARRAY_SIZE(skylake_map), 606 .num_dapm_routes = ARRAY_SIZE(skylake_map),
549 .fully_routed = true, 607 .fully_routed = true,
608 .late_probe = skylake_card_late_probe,
550}; 609};
551 610
552static int skylake_audio_probe(struct platform_device *pdev) 611static int skylake_audio_probe(struct platform_device *pdev)
553{ 612{
613 struct skl_nau8825_private *ctx;
614
615 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_ATOMIC);
616 if (!ctx)
617 return -ENOMEM;
618
619 INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
620
554 skylake_audio_card.dev = &pdev->dev; 621 skylake_audio_card.dev = &pdev->dev;
622 snd_soc_card_set_drvdata(&skylake_audio_card, ctx);
555 623
556 return devm_snd_soc_register_card(&pdev->dev, &skylake_audio_card); 624 return devm_snd_soc_register_card(&pdev->dev, &skylake_audio_card);
557} 625}