linux/include/linux/platform_data/pcf857x.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2#ifndef __LINUX_PCF857X_H
   3#define __LINUX_PCF857X_H
   4
   5/**
   6 * struct pcf857x_platform_data - data to set up pcf857x driver
   7 * @gpio_base: number of the chip's first GPIO
   8 * @n_latch: optional bit-inverse of initial register value; if
   9 *      you leave this initialized to zero the driver will act
  10 *      like the chip was just reset
  11 * @setup: optional callback issued once the GPIOs are valid
  12 * @teardown: optional callback issued before the GPIOs are invalidated
  13 * @context: optional parameter passed to setup() and teardown()
  14 *
  15 * In addition to the I2C_BOARD_INFO() state appropriate to each chip,
  16 * the i2c_board_info used with the pcf875x driver must provide its
  17 * platform_data (pointer to one of these structures) with at least
  18 * the gpio_base value initialized.
  19 *
  20 * The @setup callback may be used with the kind of board-specific glue
  21 * which hands the (now-valid) GPIOs to other drivers, or which puts
  22 * devices in their initial states using these GPIOs.
  23 *
  24 * These GPIO chips are only "quasi-bidirectional"; read the chip specs
  25 * to understand the behavior.  They don't have separate registers to
  26 * record which pins are used for input or output, record which output
  27 * values are driven, or provide access to input values.  That must be
  28 * inferred by reading the chip's value and knowing the last value written
  29 * to it.  If you leave n_latch initialized to zero, that last written
  30 * value is presumed to be all ones (as if the chip were just reset).
  31 */
  32struct pcf857x_platform_data {
  33        unsigned        gpio_base;
  34        unsigned        n_latch;
  35
  36        int             (*setup)(struct i2c_client *client,
  37                                        int gpio, unsigned ngpio,
  38                                        void *context);
  39        int             (*teardown)(struct i2c_client *client,
  40                                        int gpio, unsigned ngpio,
  41                                        void *context);
  42        void            *context;
  43};
  44
  45#endif /* __LINUX_PCF857X_H */
  46