ASoC: Intel: Headset button support in kabylake machine driver
authorHarsha Priya N <harshapriya.n@intel.com>
Mon, 21 Aug 2017 19:26:52 +0000 (12:26 -0700)
committerMark Brown <broonie@kernel.org>
Tue, 22 Aug 2017 11:09:42 +0000 (12:09 +0100)
This patch adds headset button support for kabylake machine driver
(kbl_rt5663_rt5514_max98927).

Signed-off-by: Hsin-yu Chao <hychao@google.com>
Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Acked-By: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c

index b51dff6fe25b9941aaf2bb2635dc9a4c5e666326..69681b04d7fc8de8a800b179d2e0edb8abd8214d 100644 (file)
@@ -18,6 +18,7 @@
  * GNU General Public License for more details.
  */
 
+#include <linux/input.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <sound/core.h>
@@ -176,6 +177,7 @@ static int kabylake_rt5663_codec_init(struct snd_soc_pcm_runtime *rtd)
        int ret;
        struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card);
        struct snd_soc_codec *codec = rtd->codec;
+       struct snd_soc_jack *jack;
 
        /*
         * Headset buttons map to the google Reference headset.
@@ -190,6 +192,12 @@ static int kabylake_rt5663_codec_init(struct snd_soc_pcm_runtime *rtd)
                return ret;
        }
 
+       jack = &ctx->kabylake_headset;
+       snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA);
+       snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
+       snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
+       snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
+
        rt5663_set_jack_detect(codec, &ctx->kabylake_headset);
 
        ret = snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "DMIC");