0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __SOC_JACK_H
0009 #define __SOC_JACK_H
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 struct snd_soc_jack_pin {
0020 struct list_head list;
0021 const char *pin;
0022 int mask;
0023 bool invert;
0024 };
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 struct snd_soc_jack_zone {
0037 unsigned int min_mv;
0038 unsigned int max_mv;
0039 unsigned int jack_type;
0040 unsigned int debounce_time;
0041 struct list_head list;
0042 };
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061 struct snd_soc_jack_gpio {
0062 unsigned int gpio;
0063 unsigned int idx;
0064 struct device *gpiod_dev;
0065 const char *name;
0066 int report;
0067 int invert;
0068 int debounce_time;
0069 bool wake;
0070
0071
0072 struct snd_soc_jack *jack;
0073 struct delayed_work work;
0074 struct notifier_block pm_notifier;
0075 struct gpio_desc *desc;
0076
0077 void *data;
0078
0079 int (*jack_status_check)(void *data);
0080 };
0081
0082 struct snd_soc_jack {
0083 struct mutex mutex;
0084 struct snd_jack *jack;
0085 struct snd_soc_card *card;
0086 struct list_head pins;
0087 int status;
0088 struct blocking_notifier_head notifier;
0089 struct list_head jack_zones;
0090 };
0091
0092
0093 void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
0094 int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
0095 struct snd_soc_jack_pin *pins);
0096 void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
0097 struct notifier_block *nb);
0098 void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
0099 struct notifier_block *nb);
0100 int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count,
0101 struct snd_soc_jack_zone *zones);
0102 int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage);
0103 #ifdef CONFIG_GPIOLIB
0104 int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
0105 struct snd_soc_jack_gpio *gpios);
0106 int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
0107 struct snd_soc_jack *jack,
0108 int count, struct snd_soc_jack_gpio *gpios);
0109 void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
0110 struct snd_soc_jack_gpio *gpios);
0111 #else
0112 static inline int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
0113 struct snd_soc_jack_gpio *gpios)
0114 {
0115 return 0;
0116 }
0117
0118 static inline int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
0119 struct snd_soc_jack *jack,
0120 int count,
0121 struct snd_soc_jack_gpio *gpios)
0122 {
0123 return 0;
0124 }
0125
0126 static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
0127 struct snd_soc_jack_gpio *gpios)
0128 {
0129 }
0130 #endif
0131
0132 #endif