~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/sound/soc-jack.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0
  2  *
  3  * soc-jack.h
  4  *
  5  * Copyright (C) 2019 Renesas Electronics Corp.
  6  * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  7  */
  8 #ifndef __SOC_JACK_H
  9 #define __SOC_JACK_H
 10 
 11 /**
 12  * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
 13  *
 14  * @pin:    name of the pin to update
 15  * @mask:   bits to check for in reported jack status
 16  * @invert: if non-zero then pin is enabled when status is not reported
 17  * @list:   internal list entry
 18  */
 19 struct snd_soc_jack_pin {
 20         struct list_head list;
 21         const char *pin;
 22         int mask;
 23         bool invert;
 24 };
 25 
 26 /**
 27  * struct snd_soc_jack_zone - Describes voltage zones of jack detection
 28  *
 29  * @min_mv: start voltage in mv
 30  * @max_mv: end voltage in mv
 31  * @jack_type: type of jack that is expected for this voltage
 32  * @debounce_time: debounce_time for jack, codec driver should wait for this
 33  *              duration before reading the adc for voltages
 34  * @list:   internal list entry
 35  */
 36 struct snd_soc_jack_zone {
 37         unsigned int min_mv;
 38         unsigned int max_mv;
 39         unsigned int jack_type;
 40         unsigned int debounce_time;
 41         struct list_head list;
 42 };
 43 
 44 /**
 45  * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
 46  *
 47  * @idx:          gpio descriptor index within the function of the GPIO
 48  *                consumer device
 49  * @gpiod_dev:    GPIO consumer device
 50  * @name:         gpio name. Also as connection ID for the GPIO consumer
 51  *                device function name lookup
 52  * @report:       value to report when jack detected
 53  * @invert:       report presence in low state
 54  * @debounce_time: debounce time in ms
 55  * @wake:         enable as wake source
 56  * @jack_status_check: callback function which overrides the detection
 57  *                     to provide more complex checks (eg, reading an
 58  *                     ADC).
 59  */
 60 struct snd_soc_jack_gpio {
 61         unsigned int idx;
 62         struct device *gpiod_dev;
 63         const char *name;
 64         int report;
 65         int invert;
 66         int debounce_time;
 67         bool wake;
 68 
 69         /* private: */
 70         struct snd_soc_jack *jack;
 71         struct delayed_work work;
 72         struct notifier_block pm_notifier;
 73         struct gpio_desc *desc;
 74 
 75         void *data;
 76         /* public: */
 77         int (*jack_status_check)(void *data);
 78 };
 79 
 80 struct snd_soc_jack {
 81         struct mutex mutex;
 82         struct snd_jack *jack;
 83         struct snd_soc_card *card;
 84         struct list_head pins;
 85         int status;
 86         struct blocking_notifier_head notifier;
 87         struct list_head jack_zones;
 88 };
 89 
 90 /* Jack reporting */
 91 void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
 92 int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
 93                           struct snd_soc_jack_pin *pins);
 94 void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
 95                                     struct notifier_block *nb);
 96 void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
 97                                       struct notifier_block *nb);
 98 int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count,
 99                            struct snd_soc_jack_zone *zones);
100 int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage);
101 #ifdef CONFIG_GPIOLIB
102 int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
103                            struct snd_soc_jack_gpio *gpios);
104 int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
105                             struct snd_soc_jack *jack,
106                             int count, struct snd_soc_jack_gpio *gpios);
107 void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
108                              struct snd_soc_jack_gpio *gpios);
109 #else
110 static inline int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
111                                          struct snd_soc_jack_gpio *gpios)
112 {
113         return 0;
114 }
115 
116 static inline int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
117                                           struct snd_soc_jack *jack,
118                                           int count,
119                                           struct snd_soc_jack_gpio *gpios)
120 {
121         return 0;
122 }
123 
124 static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
125                                            struct snd_soc_jack_gpio *gpios)
126 {
127 }
128 #endif
129 
130 #endif /* __SOC_JACK_H */
131 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php