All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] sound: soc: codecs: wcd-mbhc-v2: expose ALSA control for jack
@ 2022-10-07 15:57 ` Dylan Van Assche
  0 siblings, 0 replies; 6+ messages in thread
From: Dylan Van Assche @ 2022-10-07 15:57 UTC (permalink / raw)
  To: alsa-devel, linux-kernel
  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 1911750f7445..1b75f49b2858 100644
--- a/sound/soc/codecs/wcd-mbhc-v2.c
+++ b/sound/soc/codecs/wcd-mbhc-v2.c
@@ -725,6 +725,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] 6+ messages in thread

* [PATCH v2] sound: soc: codecs: wcd-mbhc-v2: expose ALSA control for jack
@ 2022-10-07 15:57 ` Dylan Van Assche
  0 siblings, 0 replies; 6+ messages in thread
From: Dylan Van Assche @ 2022-10-07 15:57 UTC (permalink / raw)
  To: alsa-devel, linux-kernel
  Cc: linux-arm-msm, phone-devel, ~postmarketos/upstreaming, 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 1911750f7445..1b75f49b2858 100644
--- a/sound/soc/codecs/wcd-mbhc-v2.c
+++ b/sound/soc/codecs/wcd-mbhc-v2.c
@@ -725,6 +725,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] 6+ messages in thread

* Re: [PATCH v2] sound: soc: codecs: wcd-mbhc-v2: expose ALSA control for jack
  2022-10-07 15:57 ` Dylan Van Assche
@ 2022-10-09  0:48   ` Joel Selvaraj
  -1 siblings, 0 replies; 6+ messages in thread
From: Joel Selvaraj @ 2022-10-09  0:48 UTC (permalink / raw)
  To: Dylan Van Assche, alsa-devel, linux-kernel
  Cc: ~postmarketos/upstreaming, linux-arm-msm, phone-devel

Can confirm that this is required for Pulseaudio to pick up the
headphones properly. I tested this in my Xiaomi Poco F1 running
postmarketOS (Phosh Mobile Desktop Environment). You can check the
following pulseaudio issue for some more info.

Link: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1377

Tested-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>

On 07/10/22 10:57, 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>
> ---
>  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 1911750f7445..1b75f49b2858 100644
> --- a/sound/soc/codecs/wcd-mbhc-v2.c
> +++ b/sound/soc/codecs/wcd-mbhc-v2.c
> @@ -725,6 +725,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,

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

* Re: [PATCH v2] sound: soc: codecs: wcd-mbhc-v2: expose ALSA control for jack
@ 2022-10-09  0:48   ` Joel Selvaraj
  0 siblings, 0 replies; 6+ messages in thread
From: Joel Selvaraj @ 2022-10-09  0:48 UTC (permalink / raw)
  To: Dylan Van Assche, alsa-devel, linux-kernel
  Cc: linux-arm-msm, phone-devel, ~postmarketos/upstreaming

Can confirm that this is required for Pulseaudio to pick up the
headphones properly. I tested this in my Xiaomi Poco F1 running
postmarketOS (Phosh Mobile Desktop Environment). You can check the
following pulseaudio issue for some more info.

Link: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1377

Tested-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>

On 07/10/22 10:57, 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>
> ---
>  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 1911750f7445..1b75f49b2858 100644
> --- a/sound/soc/codecs/wcd-mbhc-v2.c
> +++ b/sound/soc/codecs/wcd-mbhc-v2.c
> @@ -725,6 +725,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,

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

* Re: [PATCH v2] sound: soc: codecs: wcd-mbhc-v2: expose ALSA control for jack
  2022-10-07 15:57 ` Dylan Van Assche
@ 2022-10-09  2:01   ` Caleb Connolly
  -1 siblings, 0 replies; 6+ messages in thread
From: Caleb Connolly @ 2022-10-09  2:01 UTC (permalink / raw)
  To: Dylan Van Assche, alsa-devel, linux-kernel
  Cc: ~postmarketos/upstreaming, linux-arm-msm, phone-devel

Tested on a OnePlus 6 running postmarketOS!

On 07/10/2022 16:57, 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>

Tested-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 1911750f7445..1b75f49b2858 100644
> --- a/sound/soc/codecs/wcd-mbhc-v2.c
> +++ b/sound/soc/codecs/wcd-mbhc-v2.c
> @@ -725,6 +725,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
>

--
Kind Regards,
Caleb


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

* Re: [PATCH v2] sound: soc: codecs: wcd-mbhc-v2: expose ALSA control for jack
@ 2022-10-09  2:01   ` Caleb Connolly
  0 siblings, 0 replies; 6+ messages in thread
From: Caleb Connolly @ 2022-10-09  2:01 UTC (permalink / raw)
  To: Dylan Van Assche, alsa-devel, linux-kernel
  Cc: linux-arm-msm, phone-devel, ~postmarketos/upstreaming

Tested on a OnePlus 6 running postmarketOS!

On 07/10/2022 16:57, 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>

Tested-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 1911750f7445..1b75f49b2858 100644
> --- a/sound/soc/codecs/wcd-mbhc-v2.c
> +++ b/sound/soc/codecs/wcd-mbhc-v2.c
> @@ -725,6 +725,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
>

--
Kind Regards,
Caleb


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

end of thread, other threads:[~2022-10-11  6:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-07 15:57 [PATCH v2] sound: soc: codecs: wcd-mbhc-v2: expose ALSA control for jack Dylan Van Assche
2022-10-07 15:57 ` Dylan Van Assche
2022-10-09  0:48 ` Joel Selvaraj
2022-10-09  0:48   ` Joel Selvaraj
2022-10-09  2:01 ` Caleb Connolly
2022-10-09  2:01   ` 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.