diff mbox

[1/2] ASoC: AMD: Support headset button on Stoney DA7219

Message ID 1522404297-7555-1-git-send-email-akshu.agrawal@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Akshu Agrawal March 30, 2018, 10:04 a.m. UTC
Adds headset button support.

TEST=Tested Volume UP/Down functionality

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
---
 sound/soc/amd/acp-da7219-max98357a.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Daniel Kurtz April 5, 2018, 6:04 p.m. UTC | #1
Hi Akshu,

On Fri, Mar 30, 2018 at 4:05 AM Akshu Agrawal <akshu.agrawal@amd.com> wrote:

> Adds headset button support.

> TEST=Tested Volume UP/Down functionality

> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
> ---
>    sound/soc/amd/acp-da7219-max98357a.c | 8 ++++++++
>    1 file changed, 8 insertions(+)

> diff --git a/sound/soc/amd/acp-da7219-max98357a.c
b/sound/soc/amd/acp-da7219-max98357a.c
> index b205c78..d9491e1 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"
> @@ -51,6 +52,7 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime
*rtd)
>           struct snd_soc_card *card = rtd->card;
>           struct snd_soc_dai *codec_dai = rtd->codec_dai;
>           struct snd_soc_component *component = codec_dai->component;
> +       struct snd_soc_jack *jack;

>           dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);

> @@ -80,6 +82,12 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime
*rtd)
>                   return ret;
>           }

> +       jack = &cz_jack;
> +       snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA);

I think this should be KEY_PLAYPAUSE.

Thanks!
-Dan
Akshu Agrawal April 9, 2018, 8:55 a.m. UTC | #2
On 4/5/2018 11:34 PM, Daniel Kurtz wrote:
> Hi Akshu,
> 
> On Fri, Mar 30, 2018 at 4:05 AM Akshu Agrawal <akshu.agrawal@amd.com> wrote:
> 
>> Adds headset button support.
> 
>> TEST=Tested Volume UP/Down functionality
> 
>> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
>> ---
>>     sound/soc/amd/acp-da7219-max98357a.c | 8 ++++++++
>>     1 file changed, 8 insertions(+)
> 
>> diff --git a/sound/soc/amd/acp-da7219-max98357a.c
> b/sound/soc/amd/acp-da7219-max98357a.c
>> index b205c78..d9491e1 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"
>> @@ -51,6 +52,7 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime
> *rtd)
>>            struct snd_soc_card *card = rtd->card;
>>            struct snd_soc_dai *codec_dai = rtd->codec_dai;
>>            struct snd_soc_component *component = codec_dai->component;
>> +       struct snd_soc_jack *jack;
> 
>>            dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
> 
>> @@ -80,6 +82,12 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime
> *rtd)
>>                    return ret;
>>            }
> 
>> +       jack = &cz_jack;
>> +       snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA);
> 
> I think this should be KEY_PLAYPAUSE.
> 
Yes, re-spinning the patch with the change.

> Thanks!
> -Dan
>
diff mbox

Patch

diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c
index b205c78..d9491e1 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"
@@ -51,6 +52,7 @@  static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
 	struct snd_soc_card *card = rtd->card;
 	struct snd_soc_dai *codec_dai = rtd->codec_dai;
 	struct snd_soc_component *component = codec_dai->component;
+	struct snd_soc_jack *jack;
 
 	dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
 
@@ -80,6 +82,12 @@  static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd)
 		return ret;
 	}
 
+	jack = &cz_jack;
+	snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA);
+	snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOLUMEUP);
+	snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN);
+	snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOICECOMMAND);
+
 	da7219_aad_jack_det(component, &cz_jack);
 
 	return 0;