aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/gpio/driver.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 12:40:46 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 13:09:12 -0500
commit8e5096607280d4e103389bfe8f8b7decbf538ff6 (patch)
tree60352a466e96c7b36d41263d7590ee79e0aaff35 /include/linux/gpio/driver.h
parent02d0a752460ea5dab34ce36c9ddc9c682e846a0d (diff)
parentde755c330512364d3396c7da0c20b1c20b3b08b2 (diff)
Merge tag 'gpio-v3.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO tree bulk changes from Linus Walleij: "A big set this merge window, as we have much going on in this subsystem. The changes to other subsystems (notably a slew of ARM machines as I am doing away with their custom APIs) have all been ACKed to the extent possible. Major changes this time: - Some core improvements and cleanups to the new GPIO descriptor API. This seems to be working now so we can start the exodus to this API, moving gradually away from the global GPIO numberspace. - Incremental improvements to the ACPI GPIO core, and move the few GPIO ACPI clients we have to the GPIO descriptor API right *now* before we go any further. We actually managed to contain this *before* we started to litter the kernel with yet another hackish global numberspace for the ACPI GPIOs, which is a big win. - The RFkill GPIO driver and all platforms using it have been migrated to use the GPIO descriptors rather than fixed number assignments. Tegra machine has been migrated as part of this. - New drivers for MOXA ART, Xtensa GPIO32 and SMSC SCH311x. Those should be really good examples of how I expect a nice GPIO driver to look these days. - Do away with custom GPIO implementations on a major part of the ARM machines: ks8695, lpc32xx, mv78xx0. Make a first step towards the same in the horribly convoluted Samsung S3C include forest. We expect to continue to clean this up as we move forward. - Flag GPIO lines used for IRQ on adnp, bcm-kona, em, intel-mid and lynxpoint. This makes the GPIOlib core aware that a certain GPIO line is used for IRQs and can then enforce some semantics such as disallowing a GPIO line marked as in use for IRQ to be switched to output mode. - Drop all use of irq_set_chip_and_handler_name(). The name provided in these cases were just unhelpful tags like "mux" or "demux". - Extend the MCP23s08 driver to handle interrupts. - Minor incremental improvements for rcar, lynxpoint, em 74x164 and msm drivers. - Some non-urgent bug fixes here and there, duplicate #includes and that usual kind of cleanups" Fix up broken Kconfig file manually to make this all compile. * tag 'gpio-v3.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (71 commits) gpio: mcp23s08: fix casting caused build warning gpio: mcp23s08: depend on OF_GPIO gpio: mcp23s08: Add irq functionality for i2c chips ARM: S5P[v210|c100|64x0]: Fix build error gpio: pxa: clamp gpio get value to [0,1] ARM: s3c24xx: explicit dependency on <plat/gpio-cfg.h> ARM: S3C[24|64]xx: move includes back under <mach/> scope Documentation / ACPI: update to GPIO descriptor API gpio / ACPI: get rid of acpi_gpio.h gpio / ACPI: register to ACPI events automatically mmc: sdhci-acpi: convert to use GPIO descriptor API ARM: s3c24xx: fix build error gpio: f7188x: set can_sleep attribute gpio: samsung: Update documentation gpio: samsung: Remove hardware.h inclusion gpio: xtensa: depend on HAVE_XTENSA_GPIO32 gpio: clps711x: Enable driver compilation with COMPILE_TEST gpio: clps711x: Use of_match_ptr() net: rfkill: gpio: convert to descriptor-based GPIO interface leds: s3c24xx: Fix build failure ...
Diffstat (limited to 'include/linux/gpio/driver.h')
-rw-r--r--include/linux/gpio/driver.h56
1 files changed, 24 insertions, 32 deletions
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 3ea2cf6b0e6c..a3e181e09636 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -39,14 +39,15 @@ struct seq_file;
39 * @ngpio: the number of GPIOs handled by this controller; the last GPIO 39 * @ngpio: the number of GPIOs handled by this controller; the last GPIO
40 * handled is (base + ngpio - 1). 40 * handled is (base + ngpio - 1).
41 * @desc: array of ngpio descriptors. Private. 41 * @desc: array of ngpio descriptors. Private.
42 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
43 * must while accessing GPIO expander chips over I2C or SPI
44 * @names: if set, must be an array of strings to use as alternative 42 * @names: if set, must be an array of strings to use as alternative
45 * names for the GPIOs in this chip. Any entry in the array 43 * names for the GPIOs in this chip. Any entry in the array
46 * may be NULL if there is no alias for the GPIO, however the 44 * may be NULL if there is no alias for the GPIO, however the
47 * array must be @ngpio entries long. A name can include a single printk 45 * array must be @ngpio entries long. A name can include a single printk
48 * format specifier for an unsigned int. It is substituted by the actual 46 * format specifier for an unsigned int. It is substituted by the actual
49 * number of the gpio. 47 * number of the gpio.
48 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
49 * must while accessing GPIO expander chips over I2C or SPI
50 * @exported: flags if the gpiochip is exported for use from sysfs. Private.
50 * 51 *
51 * A gpio_chip can help platforms abstract various sources of GPIOs so 52 * A gpio_chip can help platforms abstract various sources of GPIOs so
52 * they can all be accessed through a common programing interface. 53 * they can all be accessed through a common programing interface.
@@ -91,8 +92,8 @@ struct gpio_chip {
91 u16 ngpio; 92 u16 ngpio;
92 struct gpio_desc *desc; 93 struct gpio_desc *desc;
93 const char *const *names; 94 const char *const *names;
94 unsigned can_sleep:1; 95 bool can_sleep;
95 unsigned exported:1; 96 bool exported;
96 97
97#if defined(CONFIG_OF_GPIO) 98#if defined(CONFIG_OF_GPIO)
98 /* 99 /*
@@ -136,59 +137,50 @@ enum gpio_lookup_flags {
136}; 137};
137 138
138/** 139/**
139 * Lookup table for associating GPIOs to specific devices and functions using 140 * struct gpiod_lookup - lookup table
140 * platform data. 141 * @chip_label: name of the chip the GPIO belongs to
142 * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO
143 * @con_id: name of the GPIO from the device's point of view
144 * @idx: index of the GPIO in case several GPIOs share the same name
145 * @flags: mask of GPIO_* values
146 *
147 * gpiod_lookup is a lookup table for associating GPIOs to specific devices and
148 * functions using platform data.
141 */ 149 */
142struct gpiod_lookup { 150struct gpiod_lookup {
143 struct list_head list;
144 /*
145 * name of the chip the GPIO belongs to
146 */
147 const char *chip_label; 151 const char *chip_label;
148 /*
149 * hardware number (i.e. relative to the chip) of the GPIO
150 */
151 u16 chip_hwnum; 152 u16 chip_hwnum;
152 /*
153 * name of device that can claim this GPIO
154 */
155 const char *dev_id;
156 /*
157 * name of the GPIO from the device's point of view
158 */
159 const char *con_id; 153 const char *con_id;
160 /*
161 * index of the GPIO in case several GPIOs share the same name
162 */
163 unsigned int idx; 154 unsigned int idx;
164 /*
165 * mask of GPIO_* values
166 */
167 enum gpio_lookup_flags flags; 155 enum gpio_lookup_flags flags;
168}; 156};
169 157
158struct gpiod_lookup_table {
159 struct list_head list;
160 const char *dev_id;
161 struct gpiod_lookup table[];
162};
163
170/* 164/*
171 * Simple definition of a single GPIO under a con_id 165 * Simple definition of a single GPIO under a con_id
172 */ 166 */
173#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _dev_id, _con_id, _flags) \ 167#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _con_id, _flags) \
174 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _dev_id, _con_id, 0, _flags) 168 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, 0, _flags)
175 169
176/* 170/*
177 * Use this macro if you need to have several GPIOs under the same con_id. 171 * Use this macro if you need to have several GPIOs under the same con_id.
178 * Each GPIO needs to use a different index and can be accessed using 172 * Each GPIO needs to use a different index and can be accessed using
179 * gpiod_get_index() 173 * gpiod_get_index()
180 */ 174 */
181#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _dev_id, _con_id, _idx, \ 175#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, _idx, _flags) \
182 _flags) \
183{ \ 176{ \
184 .chip_label = _chip_label, \ 177 .chip_label = _chip_label, \
185 .chip_hwnum = _chip_hwnum, \ 178 .chip_hwnum = _chip_hwnum, \
186 .dev_id = _dev_id, \
187 .con_id = _con_id, \ 179 .con_id = _con_id, \
188 .idx = _idx, \ 180 .idx = _idx, \
189 .flags = _flags, \ 181 .flags = _flags, \
190} 182}
191 183
192void gpiod_add_table(struct gpiod_lookup *table, size_t size); 184void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
193 185
194#endif 186#endif