Skip to content

Commit

Permalink
CHROMIUM: ASoc: Intel: boards: support headset button function for na…
Browse files Browse the repository at this point in the history
…u88l25

Map the 4 buttons from the Android reference headset to
KEY_MEDIA, KEY_VOICECOMMAND, KEY_VOLUMEUP, and KEY_VOLUMEDOWN.

Signed-off-by: Benson Leung <bleung@chromium.org>

BUG=chrome-os-partner:49333
TEST=Run evtest, selecting the input event for sklnau8825adi
Using the Nominal headphones from the kit, check that the
buttons for "KEY_VOLUMEDOWN", "KEY_VOLUMEUP", "KEY_MEDIA",
and code 582 (?) (should be voice search, but evtest doesn't understand)
All of these buttons should work properly.

Change-Id: I392c388c0d088f85bea65f6f7a570939ed5e90f4
Reviewed-on: https://chromium-review.googlesource.com/322251
Commit-Ready: Benson Leung <bleung@chromium.org>
Tested-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Anatol Pomazau <anatol@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
  • Loading branch information
Benson Leung authored and chrome-bot committed Jan 15, 2016
1 parent 2484f55 commit e1e985d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sound/soc/intel/boards/skl_nau88l25_ssm4567.c
Original file line number Diff line number Diff line change
@@ -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>
@@ -201,6 +202,7 @@ static int skylake_nau8825_codec_init(struct snd_soc_pcm_runtime *rtd)
{
int ret;
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_jack *jack;

/*
* 4 buttons here map to the google Reference headset
@@ -215,6 +217,12 @@ 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_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);
nau8825_enable_jack_detect(codec, &skylake_headset);

snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC");

0 comments on commit e1e985d

Please sign in to comment.