Message ID | 1522817219-3750-3-git-send-email-naveen.m@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Naveen, On Wed, Apr 04, 2018 at 10:16:56AM +0530, Naveen Manohar wrote: > Patch adds headset button support for broxton machine driver > (bxt_da7219_max98357a). > > Signed-off-by: Naveen Manohar <naveen.m@intel.com> > --- > sound/soc/intel/boards/bxt_da7219_max98357a.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c > index ce021a3..1c1e70c 100644 > --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c > +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c > @@ -16,6 +16,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> > @@ -168,6 +169,7 @@ static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd, > static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) > { > int ret; > + struct snd_soc_jack *jack; > struct snd_soc_dai *codec_dai = rtd->codec_dai; > struct snd_soc_component *component = rtd->codec_dai->component; > > @@ -192,7 +194,12 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) > return ret; > } > > - da7219_aad_jack_det(component, &broxton_headset); > + jack = &broxton_headset; > + snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA); I recently made a set of changes that replaced KEY_MEDIA usage for BTN_0 with KEY_PLAYPAUSE. See https://lkml.org/lkml/2017/11/22/586 Since this patch may be destined for Chrome OS, you should definitely use KEY_PLAYPAUSE, as the Chrome OS user space doesn't respond to KEY_MEDIA but does respond to KEY_PLAYPAUSE. Thanks, Benson
On Thu, Apr 05, 2018 at 05:30:33PM -0700, Benson Leung wrote: > Hi Naveen, > > On Wed, Apr 04, 2018 at 10:16:56AM +0530, Naveen Manohar wrote: > > Patch adds headset button support for broxton machine driver > > (bxt_da7219_max98357a). > > > > Signed-off-by: Naveen Manohar <naveen.m@intel.com> > > --- > > sound/soc/intel/boards/bxt_da7219_max98357a.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c > > index ce021a3..1c1e70c 100644 > > --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c > > +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c > > @@ -16,6 +16,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> > > @@ -168,6 +169,7 @@ static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd, > > static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) > > { > > int ret; > > + struct snd_soc_jack *jack; > > struct snd_soc_dai *codec_dai = rtd->codec_dai; > > struct snd_soc_component *component = rtd->codec_dai->component; > > > > @@ -192,7 +194,12 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) > > return ret; > > } > > > > - da7219_aad_jack_det(component, &broxton_headset); > > + jack = &broxton_headset; > > + snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA); > > I recently made a set of changes that replaced KEY_MEDIA usage for BTN_0 > with KEY_PLAYPAUSE. See https://lkml.org/lkml/2017/11/22/586 > > Since this patch may be destined for Chrome OS, you should definitely use > KEY_PLAYPAUSE, as the Chrome OS user space doesn't respond to KEY_MEDIA but does > respond to KEY_PLAYPAUSE. > > Thanks, > Benson > Thanks for the review and update. Shall correct this in V2. Also there are other machines which still use KEY_MEDIA - kbl_da7219_max98357a.c, cht_bsw_nau8824.c Shall correct these too. > -- > Benson Leung > Staff Software Engineer > Chrome OS Kernel > Google Inc. > bleung@google.com > Chromium OS Project > bleung@chromium.org
On Fri, 2018-04-06 at 06:45 +0530, Naveen M wrote: > > Thanks for the review and update. Shall correct this in V2. > Also there are other machines which still use KEY_MEDIA - > kbl_da7219_max98357a.c, cht_bsw_nau8824.c > Shall correct these too. kbl_da7219_max98357a and rk3399_gru_sound also seem to have KEY_VOICECOMMAND on BTN_3 and volume up/down on 1/2; is that correct? Until I spotted that, I was going to suggest a generic helper to set all four, since they should *all* be setting the four events to KEY_PLAYPAUSE, KEY_VOICECOMMAND, KEY_VOLUMEUP, KEY_VOLUMEDOWN respectively.
On Fri, Apr 06, 2018 at 08:28:35AM +0100, David Woodhouse wrote: > On Fri, 2018-04-06 at 06:45 +0530, Naveen M wrote: > > Thanks for the review and update. Shall correct this in V2. > > Also there are other machines which still use KEY_MEDIA - > > kbl_da7219_max98357a.c, cht_bsw_nau8824.c > > Shall correct these too. > kbl_da7219_max98357a and rk3399_gru_sound also seem to have > KEY_VOICECOMMAND on BTN_3 and volume up/down on 1/2; is that correct? > Until I spotted that, I was going to suggest a generic helper to set > all four, since they should *all* be setting the four events to > KEY_PLAYPAUSE, KEY_VOICECOMMAND, KEY_VOLUMEUP, KEY_VOLUMEDOWN > respectively. Headsets are very system specific, it's going to depend on both how the manufacturer headset is labelled and how the hardware interprets the buttons on it. There's a diversity of standards for both unfortunately and no way to identify what's plugged in usefully.
diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c index ce021a3..1c1e70c 100644 --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c @@ -16,6 +16,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> @@ -168,6 +169,7 @@ static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd, static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) { int ret; + struct snd_soc_jack *jack; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct snd_soc_component *component = rtd->codec_dai->component; @@ -192,7 +194,12 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) return ret; } - da7219_aad_jack_det(component, &broxton_headset); + jack = &broxton_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); + da7219_aad_jack_det(component, jack); snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC");
Patch adds headset button support for broxton machine driver (bxt_da7219_max98357a). Signed-off-by: Naveen Manohar <naveen.m@intel.com> --- sound/soc/intel/boards/bxt_da7219_max98357a.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)