Skip to content

Commit a53ccab

Browse files
Matthew Ranostaytiwai
authored andcommitted
ALSA: jack: lineout support to jack abstraction layer
This patch introduces support for reporting SW_LINEOUT_INSERT detection events via the jack abstraction layer. Also adds a SND_JACK_LINEOUT define to the input system header. Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com> Cc: Dmitry Torokhov <dtor@mail.ru> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent ebaa047 commit a53ccab

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎include/linux/input.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ struct input_absinfo {
644644
#define SW_RADIO SW_RFKILL_ALL /* deprecated */
645645
#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */
646646
#define SW_DOCK 0x05 /* set = plugged into dock */
647+
#define SW_LINEOUT_INSERT 0x06 /* set = inserted */
647648
#define SW_MAX 0x0f
648649
#define SW_CNT (SW_MAX+1)
649650

‎include/sound/jack.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ enum snd_jack_types {
3535
SND_JACK_HEADPHONE = 0x0001,
3636
SND_JACK_MICROPHONE = 0x0002,
3737
SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
38+
SND_JACK_LINEOUT = 0x0004,
3839
};
3940

4041
struct snd_jack {

‎sound/core/jack.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
102102
if (type & SND_JACK_HEADPHONE)
103103
input_set_capability(jack->input_dev, EV_SW,
104104
SW_HEADPHONE_INSERT);
105+
if (type & SND_JACK_LINEOUT)
106+
input_set_capability(jack->input_dev, EV_SW,
107+
SW_LINEOUT_INSERT);
105108
if (type & SND_JACK_MICROPHONE)
106109
input_set_capability(jack->input_dev, EV_SW,
107110
SW_MICROPHONE_INSERT);
@@ -150,6 +153,9 @@ void snd_jack_report(struct snd_jack *jack, int status)
150153
if (jack->type & SND_JACK_HEADPHONE)
151154
input_report_switch(jack->input_dev, SW_HEADPHONE_INSERT,
152155
status & SND_JACK_HEADPHONE);
156+
if (jack->type & SND_JACK_LINEOUT)
157+
input_report_switch(jack->input_dev, SW_LINEOUT_INSERT,
158+
status & SND_JACK_LINEOUT);
153159
if (jack->type & SND_JACK_MICROPHONE)
154160
input_report_switch(jack->input_dev, SW_MICROPHONE_INSERT,
155161
status & SND_JACK_MICROPHONE);

0 commit comments

Comments
 (0)