All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sound: soc: codecs: wcd-mbhc-v2: expose ALSA control for jack
@ 2022-09-17 14:44 Dylan Van Assche
  2022-09-17 15:14 ` Caleb Connolly
  0 siblings, 1 reply; 2+ messages in thread
From: Dylan Van Assche @ 2022-09-17 14:44 UTC (permalink / raw)
  To: Srinivas Kandagatla, Banajit Goswami, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai
  Cc: ~postmarketos/upstreaming, linux-arm-msm, phone-devel, Dylan Van Assche

Jack detection is currently fully functional via the input
interface together with multimedia buttons, but is not exposed
as an ALSA control. Therefore, ALSA clients such as PulseAudio
do not pick up the jack detection events as they only support
one of the possible interface (ALSA control or input interface,
but not both). Expose the jack events as an ALSA control and input
interface to provide ALSA clients both interfaces.

Signed-off-by: Dylan Van Assche <me@dylanvanassche.be>
---
 sound/soc/codecs/wcd-mbhc-v2.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c
index 98baef594bf3..e741b522cf10 100644
--- a/sound/soc/codecs/wcd-mbhc-v2.c
+++ b/sound/soc/codecs/wcd-mbhc-v2.c
@@ -724,6 +724,10 @@ static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc)
 
 	mutex_lock(&mbhc->lock);
 
+	ret = snd_jack_add_new_kctl (mbhc->jack->jack, "Headset Jack", WCD_MBHC_JACK_MASK);
+	if (ret)
+		dev_warn(component->dev, "failed creating Headset Jack kctl with err: %d\n", ret);
+
 	/* enable HS detection */
 	if (mbhc->mbhc_cb->hph_pull_up_control_v2)
 		mbhc->mbhc_cb->hph_pull_up_control_v2(component,
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sound: soc: codecs: wcd-mbhc-v2: expose ALSA control for jack
  2022-09-17 14:44 [PATCH] sound: soc: codecs: wcd-mbhc-v2: expose ALSA control for jack Dylan Van Assche
@ 2022-09-17 15:14 ` Caleb Connolly
  0 siblings, 0 replies; 2+ messages in thread
From: Caleb Connolly @ 2022-09-17 15:14 UTC (permalink / raw)
  To: Dylan Van Assche, Srinivas Kandagatla, Banajit Goswami,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: ~postmarketos/upstreaming, linux-arm-msm, phone-devel



On 17/09/2022 15:44, Dylan Van Assche wrote:
> Jack detection is currently fully functional via the input
> interface together with multimedia buttons, but is not exposed
> as an ALSA control. Therefore, ALSA clients such as PulseAudio
> do not pick up the jack detection events as they only support
> one of the possible interface (ALSA control or input interface,
> but not both). Expose the jack events as an ALSA control and input
> interface to provide ALSA clients both interfaces.
>
> Signed-off-by: Dylan Van Assche <me@dylanvanassche.be>

Reviewed-by: Caleb Connolly <caleb@connolly.tech>
> ---
>   sound/soc/codecs/wcd-mbhc-v2.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c
> index 98baef594bf3..e741b522cf10 100644
> --- a/sound/soc/codecs/wcd-mbhc-v2.c
> +++ b/sound/soc/codecs/wcd-mbhc-v2.c
> @@ -724,6 +724,10 @@ static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc)
>
>   	mutex_lock(&mbhc->lock);
>
> +	ret = snd_jack_add_new_kctl (mbhc->jack->jack, "Headset Jack", WCD_MBHC_JACK_MASK);
> +	if (ret)
> +		dev_warn(component->dev, "failed creating Headset Jack kctl with err: %d\n", ret);
> +
>   	/* enable HS detection */
>   	if (mbhc->mbhc_cb->hph_pull_up_control_v2)
>   		mbhc->mbhc_cb->hph_pull_up_control_v2(component,
> --
> 2.37.3
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-17 15:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-17 14:44 [PATCH] sound: soc: codecs: wcd-mbhc-v2: expose ALSA control for jack Dylan Van Assche
2022-09-17 15:14 ` Caleb Connolly

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.