Skip to content

Commit

Permalink
ASoC: rk3399_gru_sound: Add DAPM pins, kcontrols for jack detection
Browse files Browse the repository at this point in the history
PulseAudio (and perhaps other userspace utilities) can not detect any
jack for rk3399_gru_sound as the driver doesn't expose related Jack
kcontrols.

This patch adds two DAPM pins to the headset jack, where the
snd_soc_card_jack_new() call automatically creates "Headphones Jack" and
"Headset Mic Jack" kcontrols from them.

With an appropriate ALSA UCM config specifying JackControl fields for
the "Headphones" and "Headset" (mic) devices, PulseAudio can detect
plug/unplug events for both of them after this patch.

Signed-off-by: Alper Nebi Yasak <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
alpernebbi authored and broonie committed Jul 30, 2020
1 parent 658bb29 commit d0508b4
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion sound/soc/rockchip/rk3399_gru_sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ static unsigned int dmic_wakeup_delay;

static struct snd_soc_jack rockchip_sound_jack;

/* Headset jack detection DAPM pins */
static struct snd_soc_jack_pin rockchip_sound_jack_pins[] = {
{
.pin = "Headphones",
.mask = SND_JACK_HEADPHONE,
},
{
.pin = "Headset Mic",
.mask = SND_JACK_MICROPHONE,
},

};

static const struct snd_soc_dapm_widget rockchip_dapm_widgets[] = {
SND_SOC_DAPM_HP("Headphones", NULL),
SND_SOC_DAPM_SPK("Speakers", NULL),
Expand Down Expand Up @@ -176,7 +189,9 @@ static int rockchip_sound_da7219_init(struct snd_soc_pcm_runtime *rtd)
SND_JACK_HEADSET | SND_JACK_LINEOUT |
SND_JACK_BTN_0 | SND_JACK_BTN_1 |
SND_JACK_BTN_2 | SND_JACK_BTN_3,
&rockchip_sound_jack, NULL, 0);
&rockchip_sound_jack,
rockchip_sound_jack_pins,
ARRAY_SIZE(rockchip_sound_jack_pins));

if (ret) {
dev_err(rtd->card->dev, "New Headset Jack failed! (%d)\n", ret);
Expand Down

0 comments on commit d0508b4

Please sign in to comment.