ASoC: Intel: kbl: Add jack port initialize in kbl machine drivers
authorNaveen M <naveen.m@intel.com>
Fri, 25 Aug 2017 22:34:10 +0000 (04:04 +0530)
committerMark Brown <broonie@kernel.org>
Tue, 29 Aug 2017 18:37:00 +0000 (19:37 +0100)
After the pcm jack is created, create and initialize the pin switch
widget for each port. For hdmi audio, invoke hdac_hdmi_jack_port_init
func() in rt5663_max98927 & rt5663_rt5514_max98927 to enable the pin,
when monitor is connected.

Signed-off-by: Naveen M <naveen.m@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/kbl_rt5663_max98927.c
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c

index 941480c..3fa85c3 100644 (file)
@@ -767,10 +767,12 @@ static int kabylake_card_late_probe(struct snd_soc_card *card)
 {
        struct kbl_rt5663_private *ctx = snd_soc_card_get_drvdata(card);
        struct kbl_hdmi_pcm *pcm;
+       struct snd_soc_codec *codec = NULL;
        int err, i = 0;
        char jack_name[NAME_SIZE];
 
        list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
+               codec = pcm->codec_dai->codec;
                snprintf(jack_name, sizeof(jack_name),
                        "HDMI/DP, pcm=%d Jack", pcm->device);
                err = snd_soc_card_jack_new(card, jack_name,
@@ -788,7 +790,10 @@ static int kabylake_card_late_probe(struct snd_soc_card *card)
                i++;
        }
 
-       return 0;
+       if (!codec)
+               return -EINVAL;
+
+       return hdac_hdmi_jack_port_init(codec, &card->dapm);
 }
 
 /* kabylake audio machine driver for SPT + RT5663 */
index d042255..11bd5ef 100644 (file)
@@ -600,10 +600,12 @@ static int kabylake_card_late_probe(struct snd_soc_card *card)
 {
        struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(card);
        struct kbl_hdmi_pcm *pcm;
+       struct snd_soc_codec *codec = NULL;
        int err, i = 0;
        char jack_name[NAME_SIZE];
 
        list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
+               codec = pcm->codec_dai->codec;
                err = snd_soc_card_jack_new(card, jack_name,
                                SND_JACK_AVOUT, &ctx->kabylake_hdmi[i],
                                NULL, 0);
@@ -617,7 +619,10 @@ static int kabylake_card_late_probe(struct snd_soc_card *card)
                i++;
        }
 
-       return 0;
+       if (!codec)
+               return -EINVAL;
+
+       return hdac_hdmi_jack_port_init(codec, &card->dapm);
 }
 
 /*