diff mbox

[v3] ASoC: AMD: Support headset button on Stoney DA7219

Message ID 1523527031-6132-1-git-send-email-akshu.agrawal@amd.com (mailing list archive)
State Accepted
Commit 923859e3f6b281cc280214854a44dfd04cb7f65d
Headers show

Commit Message

Akshu Agrawal April 12, 2018, 9:57 a.m. UTC
Adds headset button support.

TEST=Tested Volume UP/Down, Play/Pause functionality

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
---
v2: Changed KEY_MEDIA to KEY_PLAYPAUSE
v3: Using cz_jack.jack instead of jack->jack

 sound/soc/amd/acp-da7219-max98357a.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Daniel Kurtz April 12, 2018, 4:52 p.m. UTC | #1
On Thu, Apr 12, 2018 at 3:58 AM Akshu Agrawal <akshu.agrawal@amd.com> wrote:

> Adds headset button support.

> TEST=Tested Volume UP/Down, Play/Pause functionality

> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>

Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>

> ---
> v2: Changed KEY_MEDIA to KEY_PLAYPAUSE
> v3: Using cz_jack.jack instead of jack->jack

>   sound/soc/amd/acp-da7219-max98357a.c | 6 ++++++
>   1 file changed, 6 insertions(+)

> diff --git a/sound/soc/amd/acp-da7219-max98357a.c
b/sound/soc/amd/acp-da7219-max98357a.c
> index b205c78..d281c22 100644
> --- a/sound/soc/amd/acp-da7219-max98357a.c
> +++ b/sound/soc/amd/acp-da7219-max98357a.c
> @@ -33,6 +33,7 @@
>   #include <linux/gpio.h>
>   #include <linux/module.h>
>   #include <linux/i2c.h>
> +#include <linux/input.h>
>   #include <linux/acpi.h>

>   #include "../codecs/da7219.h"
> @@ -80,6 +81,11 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime
*rtd)
>                  return ret;
>          }

> +       snd_jack_set_key(cz_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
> +       snd_jack_set_key(cz_jack.jack, SND_JACK_BTN_1, KEY_VOLUMEUP);
> +       snd_jack_set_key(cz_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN);
> +       snd_jack_set_key(cz_jack.jack, SND_JACK_BTN_3, KEY_VOICECOMMAND);
> +
>          da7219_aad_jack_det(component, &cz_jack);

>          return 0;
> --
> 1.9.1
diff mbox

Patch

diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c
index b205c78..d281c22 100644
--- a/sound/soc/amd/acp-da7219-max98357a.c
+++ b/sound/soc/amd/acp-da7219-max98357a.c
@@ -33,6 +33,7 @@ 
 #include <linux/gpio.h>
 #include <linux/module.h>
 #include <linux/i2c.h>
+#include <linux/input.h>
 #include <linux/acpi.h>
 
 #include "../codecs/da7219.h"
@@ -80,6 +81,11 @@  static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
 		return ret;
 	}
 
+	snd_jack_set_key(cz_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
+	snd_jack_set_key(cz_jack.jack, SND_JACK_BTN_1, KEY_VOLUMEUP);
+	snd_jack_set_key(cz_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN);
+	snd_jack_set_key(cz_jack.jack, SND_JACK_BTN_3, KEY_VOICECOMMAND);
+
 	da7219_aad_jack_det(component, &cz_jack);
 
 	return 0;