ASoC: Intel: Boards: Support headset button function for nau88l25max and nau88l25ssm
Subsystems (3)
PATCH 1/1 ASoC: Intel: Boards: Support headset button function for nau88l25max and nau88l25ssm
Map the buttons from the Android reference headset to KEY_PLAYPAUSE, KEY_VOICECOMMAND, KEY_VOLUMEUP, and KEY_VOLUMEDOWN. KEY_PLAYPAUSE is used instead of KEY_MEDIA for BTN_0 as it is more logical and have much broader userspace support. Like Chrome OS use it to play/pause of video and audio. KEY_PLAYPAUSE is also supported by Android (USB headset spec requires KEY_PLAYPAUSE for BTN_0.)
https://source.android.com/devices/accessories/headset/usb-headset-spec
--- sound/soc/intel/boards/skl_nau88l25_max98357a.c | 7 +++++++ sound/soc/intel/boards/skl_nau88l25_ssm4567.c | 7 +++++++ 2 files changed, 14 insertions(+)
sound/soc/intel/boards/skl_nau88l25_max98357a.c +7 -0
@@ -6,6 +6,7 @@* Copyright (C) 2015, Intel Corporation. All rights reserved. */ +#include <linux/input.h> #include <linux/module.h> #include <linux/platform_device.h> #include <sound/core.h>
@@ -158,6 +159,7 @@ static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd) {int ret;struct snd_soc_component *component =asoc_rtd_to_codec (rtd,0 )->component; +struct snd_soc_jack *jack;/* * Headset buttons map to the google Reference headset.
@@ -172,6 +174,11 @@ static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)return ret; } + jack = &skylake_headset; +snd_jack_set_key (jack->jack,SND_JACK_BTN_0 ,KEY_PLAYPAUSE ); +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 );nau8825_enable_jack_detect (component, &skylake_headset);snd_soc_dapm_ignore_suspend (&rtd->card->dapm,"SoC DMIC" );
sound/soc/intel/boards/skl_nau88l25_ssm4567.c +7 -0
@@ -10,6 +10,7 @@* Copyright (C) 2015, Intel Corporation. All rights reserved. */ +#include <linux/input.h> #include <linux/module.h> #include <linux/platform_device.h> #include <sound/core.h>
@@ -177,6 +178,7 @@ static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd) {int ret;struct snd_soc_component *component =asoc_rtd_to_codec (rtd,0 )->component; +struct snd_soc_jack *jack;/* * 4 buttons here map to the google Reference headset
@@ -191,6 +193,11 @@ static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)return ret; } + jack = &skylake_headset; +snd_jack_set_key (jack->jack,SND_JACK_BTN_0 ,KEY_PLAYPAUSE ); +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 );nau8825_enable_jack_detect (component, &skylake_headset);snd_soc_dapm_ignore_suspend (&rtd->card->dapm,"SoC DMIC" );
base-commit: f8729a41aa17f5eb5291a0e78926154e948bb4ad
Signature · 1 line
2.17.1
Quoted 9 lines · Radoslaw Biernacki
Map the buttons from the Android reference headset to
KEY_PLAYPAUSE,KEY_VOICECOMMAND,KEY_VOLUMEUP, andKEY_VOLUMEDOWN.KEY_PLAYPAUSEis used instead ofKEY_MEDIAforBTN_0as it is more logical and have much broader userspace support. Like Chrome OS use it to play/pause of video and audio.KEY_PLAYPAUSEis also supported by Android (USB headset spec requiresKEY_PLAYPAUSEforBTN_0.)
https://source.android.com/devices/accessories/headset/usb-headset-spec
Quoted 3 lines
Signed-off-by Chinyue Chen <[email protected]>Signed-off-by Benson Leung <[email protected]>Signed-off-by Radoslaw Biernacki <[email protected]>