0001
0002 #ifndef __SOUND_JACK_H
0003 #define __SOUND_JACK_H
0004
0005
0006
0007
0008
0009
0010
0011 #include <sound/core.h>
0012
0013 struct input_dev;
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 enum snd_jack_types {
0038 SND_JACK_HEADPHONE = 0x0001,
0039 SND_JACK_MICROPHONE = 0x0002,
0040 SND_JACK_HEADSET = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
0041 SND_JACK_LINEOUT = 0x0004,
0042 SND_JACK_MECHANICAL = 0x0008,
0043 SND_JACK_VIDEOOUT = 0x0010,
0044 SND_JACK_AVOUT = SND_JACK_LINEOUT | SND_JACK_VIDEOOUT,
0045 SND_JACK_LINEIN = 0x0020,
0046
0047
0048 SND_JACK_BTN_0 = 0x4000,
0049 SND_JACK_BTN_1 = 0x2000,
0050 SND_JACK_BTN_2 = 0x1000,
0051 SND_JACK_BTN_3 = 0x0800,
0052 SND_JACK_BTN_4 = 0x0400,
0053 SND_JACK_BTN_5 = 0x0200,
0054 };
0055
0056
0057 #define SND_JACK_SWITCH_TYPES 6
0058
0059 struct snd_jack {
0060 struct list_head kctl_list;
0061 struct snd_card *card;
0062 const char *id;
0063 #ifdef CONFIG_SND_JACK_INPUT_DEV
0064 struct input_dev *input_dev;
0065 struct mutex input_dev_lock;
0066 int registered;
0067 int type;
0068 char name[100];
0069 unsigned int key[6];
0070 #endif
0071 int hw_status_cache;
0072 void *private_data;
0073 void (*private_free)(struct snd_jack *);
0074 };
0075
0076 #ifdef CONFIG_SND_JACK
0077
0078 int snd_jack_new(struct snd_card *card, const char *id, int type,
0079 struct snd_jack **jack, bool initial_kctl, bool phantom_jack);
0080 int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask);
0081 #ifdef CONFIG_SND_JACK_INPUT_DEV
0082 void snd_jack_set_parent(struct snd_jack *jack, struct device *parent);
0083 int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type,
0084 int keytype);
0085 #endif
0086 void snd_jack_report(struct snd_jack *jack, int status);
0087
0088 #else
0089 static inline int snd_jack_new(struct snd_card *card, const char *id, int type,
0090 struct snd_jack **jack, bool initial_kctl, bool phantom_jack)
0091 {
0092 return 0;
0093 }
0094
0095 static inline int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask)
0096 {
0097 return 0;
0098 }
0099
0100 static inline void snd_jack_report(struct snd_jack *jack, int status)
0101 {
0102 }
0103
0104 #endif
0105
0106 #if !defined(CONFIG_SND_JACK) || !defined(CONFIG_SND_JACK_INPUT_DEV)
0107 static inline void snd_jack_set_parent(struct snd_jack *jack,
0108 struct device *parent)
0109 {
0110 }
0111
0112 static inline int snd_jack_set_key(struct snd_jack *jack,
0113 enum snd_jack_types type,
0114 int keytype)
0115 {
0116 return 0;
0117 }
0118 #endif
0119
0120 #endif