Skip to content

Commit d0508b4

Browse files
alpernebbibroonie
authored andcommitted
ASoC: rk3399_gru_sound: Add DAPM pins, kcontrols for jack detection
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]>
1 parent 658bb29 commit d0508b4

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

sound/soc/rockchip/rk3399_gru_sound.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@ static unsigned int dmic_wakeup_delay;
3232

3333
static struct snd_soc_jack rockchip_sound_jack;
3434

35+
/* Headset jack detection DAPM pins */
36+
static struct snd_soc_jack_pin rockchip_sound_jack_pins[] = {
37+
{
38+
.pin = "Headphones",
39+
.mask = SND_JACK_HEADPHONE,
40+
},
41+
{
42+
.pin = "Headset Mic",
43+
.mask = SND_JACK_MICROPHONE,
44+
},
45+
46+
};
47+
3548
static const struct snd_soc_dapm_widget rockchip_dapm_widgets[] = {
3649
SND_SOC_DAPM_HP("Headphones", NULL),
3750
SND_SOC_DAPM_SPK("Speakers", NULL),
@@ -176,7 +189,9 @@ static int rockchip_sound_da7219_init(struct snd_soc_pcm_runtime *rtd)
176189
SND_JACK_HEADSET | SND_JACK_LINEOUT |
177190
SND_JACK_BTN_0 | SND_JACK_BTN_1 |
178191
SND_JACK_BTN_2 | SND_JACK_BTN_3,
179-
&rockchip_sound_jack, NULL, 0);
192+
&rockchip_sound_jack,
193+
rockchip_sound_jack_pins,
194+
ARRAY_SIZE(rockchip_sound_jack_pins));
180195

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

0 commit comments

Comments
 (0)