Lines Matching +full:a +full:- +full:gpio

1 /* SPDX-License-Identifier: GPL-2.0 */
12 #include <linux/pinctrl/pinconf-generic.h>
49 * struct gpio_irq_chip - GPIO interrupt controller
55 * GPIO IRQ chip implementation, provided by GPIO driver.
62 * Interrupt translation domain; responsible for mapping between GPIO
79 * If non-NULL, will be set as the parent of this GPIO interrupt
80 * controller's IRQ domain to establish a hierarchical interrupt
89 * This callback translates a child hardware IRQ offset to a parent
90 * hardware IRQ offset on a hierarchical interrupt chip. The child
91 * hardware IRQs correspond to the GPIO index 0..ngpio-1 (see the
95 * a lookup table or whatever method is best for this chip. Return
98 * If some ranges of hardware IRQs do not have a corresponding parent
99 * HWIRQ, return -EINVAL, but also make sure to fill in @valid_mask and
100 * @need_valid_mask to make these GPIO lines unavailable for
114 * &gpiochip_populate_parent_fwspec_twocell will be used. A four-cell
126 * This optional callback is used to translate the child's GPIO line
127 * offset on the GPIO chip to an IRQ number for the GPIO to_irq()
128 * callback. If this is not specified, then a default callback will be
137 * The IRQ domain operations that will be used for this GPIO IRQ
148 * The IRQ handler to use (often a predefined IRQ core function) for
149 * GPIO IRQs, provided by GPIO driver.
156 * Default IRQ triggering type applied during GPIO driver
157 * initialization, provided by GPIO driver.
164 * Per GPIO IRQ chip lockdep class for IRQ lock.
171 * Per GPIO IRQ chip lockdep class for IRQ request.
178 * The interrupt handler for the GPIO chip's parent interrupts, may be
187 * If @per_parent_data is false, @parent_handler_data is a
207 * The number of interrupt parents of a GPIO chip.
214 * A list of interrupt parents of a GPIO chip. This is owned by the
222 * A list of interrupt parents for each line of a GPIO chip.
236 * True if parent_handler_data_array describes a @num_parents
244 * Flag to track GPIO chip irq member's initialization.
245 * This flag will make sure GPIO chip irq members are not used
261 * a particular driver wants to clear IRQ related registers
268 * used if not all GPIO lines are valid interrupts. Sometimes some
270 * is passed a bitmap in "valid_mask" and it will have ngpios
271 * bits from 0..(ngpios-1) set to "1" as in valid. The callback can
324 * struct gpio_chip - abstract a GPIO controller
325 * @label: a functional name for the GPIO device, such as a part
326 * number or the name of the SoC IP-block implementing it.
331 * @request: optional hook for chip-specific activation, such as
334 * @free: optional hook for chip-specific deactivation, such as
339 * function, even on input-only or output-only gpio chips.
341 * or a negative error number. This can be omitted on input-only or
342 * output-only gpio chips.
344 * success or a negative error number. This can be omitted on input-only
345 * or output-only gpio chips.
349 * @set: **DEPRECATED** - please use set_rv() instead
350 * @set_multiple: **DEPRECATED** - please use set_multiple_rv() instead
357 * a negative error number on failure.
358 * @to_irq: optional hook supporting non-static gpiod_to_irq() mappings;
366 * requires special mapping of the pins that provides GPIO functionality.
367 * It is called after adding GPIO chip and before adding IRQ chip.
368 * @en_hw_timestamp: Dependent on GPIO chip, an optional routine to
370 * @dis_hw_timestamp: Dependent on GPIO chip, an optional routine to
372 * @base: identifies the first GPIO number handled by this chip;
374 * DEPRECATION: providing anything non-negative and nailing the base
375 * offset of GPIO chips is deprecated. Please pass -1 as base to
377 * get rid of the static GPIO number space in the long run.
378 * @ngpio: the number of GPIOs handled by this controller; the last GPIO
379 * handled is (base + ngpio - 1).
380 * @offset: when multiple gpio chips belong to the same device this
385 * may be NULL if there is no alias for the GPIO, however the
388 * must while accessing GPIO expander chips over I2C or SPI. This
392 * @read_reg: reader function for generic GPIO
393 * @write_reg: writer function for generic GPIO
394 * @be_bits: if the generic GPIO has big endian bit order (bit 31 is representing
396 * generic GPIO core. It is for internal housekeeping only.
397 * @reg_dat: data (in) register for generic GPIO
398 * @reg_set: output set register (out=high) for generic GPIO
399 * @reg_clr: output clear register (out=low) for generic GPIO
400 * @reg_dir_out: direction out setting register for generic GPIO
401 * @reg_dir_in: direction in setting register for generic GPIO
404 * @bgpio_pinctrl: the generic GPIO uses a pin control backend.
405 * @bgpio_bits: number of register bits used for a generic GPIO i.e.
407 * @bgpio_lock: used to lock chip->bgpio_data. Also, this is needed to keep
409 * @bgpio_data: shadowed data register for generic GPIO to clear/set bits
411 * @bgpio_dir: shadowed direction register for generic GPIO to clear/set
412 * direction safely. A "1" in this word means the line is set as
415 * A gpio_chip can help platforms abstract various sources of GPIOs so
416 * they can all be accessed through a common programming interface.
418 * chips, dedicated GPIO expanders, and so on.
420 * Each chip controls a number of signals, identified in method calls
421 * by "offset" values in the range 0..(@ngpio - 1). When those signals
422 * are referenced through calls like gpio_get_value(gpio), the offset
423 * is calculated by subtracting @base from the gpio number.
511 * Integrates interrupt chip functionality with the GPIO chip. Can be
519 * If CONFIG_OF_GPIO is enabled, then all GPIO controllers described in
526 * Number of cells used to form the GPIO specifier. The standard is 2
529 * gpios = <&gpio offset flags>;
531 * some complex GPIO controllers instantiate more than one chip per
534 * gpios = <&gpio instance offset flags>;
536 * Legacy GPIO controllers may even have 1 cell:
538 * gpios = <&gpio offset>;
545 * Determine if a chip is the right instance. Must be implemented by
548 * first cell in the phandles for GPIO lines and gpio-ranges).
555 * Callback to translate a device tree GPIO specifier into a chip-
556 * relative GPIO number and flags.
582 * for_each_hwgpio_in_range - Iterates over all GPIOs in a given range
585 * @_base: First GPIO in the ranger.
587 * @_label: Place to store the address of the label if the GPIO is requested.
597 * for_each_hwgpio - Iterates over all GPIOs for given chip.
600 * @_label: Place to store the address of the label if the GPIO is requested.
604 for_each_hwgpio_in_range(_chip, _i, 0, _chip->ngpio, _label)
607 * for_each_requested_gpio_in_range - iterates over requested GPIOs in a given range
610 * @_base: first GPIO in the range
612 * @_label: label of current GPIO
618 /* Iterates over all requested GPIO of the given @chip */
620 for_each_requested_gpio_in_range(chip, i, 0, chip->ngpio, label)
628 * gpiochip_add_data() - register a gpio_chip
629 * @gc: the chip to register, with gc->base initialized
630 * @data: driver-private data associated with this chip
635 * can be freely used, the gc->parent device must be registered before
636 * the gpio framework's arch_initcall(). Otherwise sysfs initialization
642 * If gc->base is negative, this requests dynamic assignment of
643 * a range of valid GPIOs.
646 * A negative errno if the chip can't be registered, such as because the
647 * gc->base is invalid or already associated with a different chip.
648 * Otherwise it returns zero as a success code.
704 /* Yes, dropping const is ugly, but it isn't like we have a choice */ in gpio_irq_chip_set_chip()
705 girq->chip = (struct irq_chip *)chip; in gpio_irq_chip_set_chip()
764 return -EINVAL; in gpiochip_irqchip_add_domain()
774 * struct gpio_pin_range - pin range controlled by a gpio chip
777 * @range: actual range of pins controlled by a gpio controller
853 /* GPIO can never have been requested */ in gpiod_to_chip()
855 return ERR_PTR(-ENODEV); in gpiod_to_chip()
861 return ERR_PTR(-ENODEV); in gpiod_to_gpio_device()
867 return -ENODEV; in gpio_device_get_base()
892 return -EINVAL; in gpiochip_lock_as_irq()
904 for_each_if(fwnode_property_present(child, "gpio-controller"))