sound: soc: qcom: sdm845: expose ALSA control for jack
Subsystems (3)
PATCH v4 1/1 sound: soc: qcom: sdm845: expose ALSA control for jack
Qualcomm SDM845 features a headphone jack via a Qualcomm WCD9340 codec which has jack detection through the wcd-mbhc-v2 driver. 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 [1] 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). Initialize the audio jack with snd_soc_card_jack_new_pins instead of snd_soc_card_jack_new to make the jack also available as an ALSA control.
[1] https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1377
---
Changes in v4:
- Dropped cover letter because of a single patch.
- Reworked as a patch to the SDM845 Machine driver as suggested by Mark Brown.
Changes in v3:
- Improved cover letter
- Added Tested-by from
https://lore.kernel.org/alsa-devel/[email protected]/
- Properly added maintainers for sending this patch
Kind regards,
Dylan Van Assche
sound/soc/qcom/sdm845.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
sound/soc/qcom/sdm845.c +11 -2
@@ -44,6 +44,14 @@ struct sdm845_snd_data {static unsigned int tdm_slot_offset[8 ] = {0 ,4 ,8 ,12 ,16 ,20 ,24 ,28 }; +static struct snd_soc_jack_pin sdm845_jack_pins[] = { + { + .pin ="Headphone Jack" , + .mask = (SND_JACK_HEADPHONE |SND_JACK_MICROPHONE |SND_JACK_HEADSET | +SND_JACK_MECHANICAL ) + }, +}; +static int sdm845_slim_snd_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params) {
@@ -242,12 +250,13 @@ static int sdm845_dai_init(struct snd_soc_pcm_runtime *rtd)if (!pdata->jack_setup) { - rval =snd_soc_card_jack_new (card,"Headset Jack" , + rval =snd_soc_card_jack_new_pins (card,"Headset Jack" ,SND_JACK_HEADSET |SND_JACK_HEADPHONE |SND_JACK_BTN_0 |SND_JACK_BTN_1 |SND_JACK_BTN_2 |SND_JACK_BTN_3 , - &pdata->jack); + &pdata->jack, sdm845_jack_pins, +ARRAY_SIZE (sdm845_jack_pins));if (rval <0 ) {dev_err (card->dev,"Unable to add Headphone Jack\n" );
Signature · 1 line
2.39.2