aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/jack.h
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-07-28 14:05:35 -0400
committerJaroslav Kysela <perex@perex.cz>2008-07-29 15:32:03 -0400
commite76d8ceaaff9d7fc1ba2b1963a9f34151832223b (patch)
tree4041759593dbc10c35c96976e60ee759de3f9dbe /include/sound/jack.h
parent0b18cb1854152a62492aae088cb80cbeb5c0288d (diff)
ALSA: Add jack reporting API
Currently very few systems provide information about jack status to user space, even though many have hardware facilities to do detection. Those systems that do use an input device with the existing SW_HEADPHONE_INSERT switch type to do so, often independently of ALSA. This patch introduces a standard method for representing jacks to user space into ALSA. It allows drivers to register jacks for a sound card with the input subsystem, binding the input device to the card to help user space associate the input devices with their sound cards. The created input devices are named in the form "card longname jack" where jack is provided by the driver when allocating a jack. By default the parent for the input device is the sound card but this can be overridden by the card driver. The existing user space API with SW_HEADPHONE_INSERT is preserved. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'include/sound/jack.h')
-rw-r--r--include/sound/jack.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/include/sound/jack.h b/include/sound/jack.h
new file mode 100644
index 000000000000..b1b2b8b59adb
--- /dev/null
+++ b/include/sound/jack.h
@@ -0,0 +1,75 @@
1#ifndef __SOUND_JACK_H
2#define __SOUND_JACK_H
3
4/*
5 * Jack abstraction layer
6 *
7 * Copyright 2008 Wolfson Microelectronics plc
8 *
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26#include <sound/core.h>
27
28struct input_dev;
29
30/**
31 * Jack types which can be reported. These values are used as a
32 * bitmask.
33 */
34enum snd_jack_types {
35 SND_JACK_HEADPHONE = 0x0001,
36 SND_JACK_MICROPHONE = 0x0002,
37 SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
38};
39
40struct snd_jack {
41 struct input_dev *input_dev;
42 int registered;
43 int type;
44 const char *id;
45 char name[100];
46};
47
48#ifdef CONFIG_SND_JACK
49
50int snd_jack_new(struct snd_card *card, const char *id, int type,
51 struct snd_jack **jack);
52void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
53
54void snd_jack_report(struct snd_jack *jack, int status);
55
56#else
57
58static inline int snd_jack_new(struct snd_card *card, const char *id, int type,
59 struct snd_jack **jack)
60{
61 return 0;
62}
63
64static inline void snd_jack_set_parent(struct snd_jack *jack,
65 struct device *parent)
66{
67}
68
69static inline void snd_jack_report(struct snd_jack *jack, int status)
70{
71}
72
73#endif
74
75#endif