diff options
| author | Wolfram Sang <wsa@the-dreams.de> | 2017-05-21 17:57:26 -0400 |
|---|---|---|
| committer | Linus Walleij <linus.walleij@linaro.org> | 2017-05-23 05:35:02 -0400 |
| commit | b6480faeee234829b315168aebcb281ecf95f178 (patch) | |
| tree | cac4252bad21591f65f062b4c2e0308f68f558b5 /include/linux/platform_data | |
| parent | 0a848d638a25b4f2767b260ed83c271854e93cce (diff) | |
gpio: pcf857x: move header file out of I2C realm
include/linux/i2c is not for client devices. Move the header file to a
more appropriate location.
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/platform_data')
| -rw-r--r-- | include/linux/platform_data/pcf857x.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/linux/platform_data/pcf857x.h b/include/linux/platform_data/pcf857x.h new file mode 100644 index 000000000000..0767a2a6b2f1 --- /dev/null +++ b/include/linux/platform_data/pcf857x.h | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | #ifndef __LINUX_PCF857X_H | ||
| 2 | #define __LINUX_PCF857X_H | ||
| 3 | |||
| 4 | /** | ||
| 5 | * struct pcf857x_platform_data - data to set up pcf857x driver | ||
| 6 | * @gpio_base: number of the chip's first GPIO | ||
| 7 | * @n_latch: optional bit-inverse of initial register value; if | ||
| 8 | * you leave this initialized to zero the driver will act | ||
| 9 | * like the chip was just reset | ||
| 10 | * @setup: optional callback issued once the GPIOs are valid | ||
| 11 | * @teardown: optional callback issued before the GPIOs are invalidated | ||
| 12 | * @context: optional parameter passed to setup() and teardown() | ||
| 13 | * | ||
| 14 | * In addition to the I2C_BOARD_INFO() state appropriate to each chip, | ||
| 15 | * the i2c_board_info used with the pcf875x driver must provide its | ||
| 16 | * platform_data (pointer to one of these structures) with at least | ||
| 17 | * the gpio_base value initialized. | ||
| 18 | * | ||
| 19 | * The @setup callback may be used with the kind of board-specific glue | ||
| 20 | * which hands the (now-valid) GPIOs to other drivers, or which puts | ||
| 21 | * devices in their initial states using these GPIOs. | ||
| 22 | * | ||
| 23 | * These GPIO chips are only "quasi-bidirectional"; read the chip specs | ||
| 24 | * to understand the behavior. They don't have separate registers to | ||
| 25 | * record which pins are used for input or output, record which output | ||
| 26 | * values are driven, or provide access to input values. That must be | ||
| 27 | * inferred by reading the chip's value and knowing the last value written | ||
| 28 | * to it. If you leave n_latch initialized to zero, that last written | ||
| 29 | * value is presumed to be all ones (as if the chip were just reset). | ||
| 30 | */ | ||
| 31 | struct pcf857x_platform_data { | ||
| 32 | unsigned gpio_base; | ||
| 33 | unsigned n_latch; | ||
| 34 | |||
| 35 | int (*setup)(struct i2c_client *client, | ||
| 36 | int gpio, unsigned ngpio, | ||
| 37 | void *context); | ||
| 38 | int (*teardown)(struct i2c_client *client, | ||
| 39 | int gpio, unsigned ngpio, | ||
| 40 | void *context); | ||
| 41 | void *context; | ||
| 42 | }; | ||
| 43 | |||
| 44 | #endif /* __LINUX_PCF857X_H */ | ||
