From 9e60fdcf0c2905d7a8fc4cb2b3711ea5c5acaae1 Mon Sep 17 00:00:00 2001 From: eric miao Date: Mon, 4 Feb 2008 22:28:26 -0800 Subject: gpiolib: pca9539 i2c gpio expander support This adds a new-style I2C driver with basic support for the sixteen bit PCA9539 GPIO expanders. These chips have multiple registers, push-pull output drivers, and (not supported in this patch) pin change interrupts. Board-specific code must provide "pca9539_platform_data" with each chip's "i2c_board_info". That provides the GPIO numbers to be used by that chip, and callbacks for board-specific setup/teardown logic. Derived from drivers/i2c/chips/pca9539.c (which has no current known users). This is faster and simpler; it uses 16-bit register access, and cache the OUTPUT and DIRECTION registers for fast access Signed-off-by: eric miao Signed-off-by: David Brownell Acked-by: Jean Delvare Cc: Sam Ravnborg Cc: Haavard Skinnemoen Cc: Philipp Zabel Cc: Russell King Cc: Ben Gardner Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/i2c/pca9539.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 include/linux/i2c/pca9539.h (limited to 'include') diff --git a/include/linux/i2c/pca9539.h b/include/linux/i2c/pca9539.h new file mode 100644 index 000000000000..611d84ab7a30 --- /dev/null +++ b/include/linux/i2c/pca9539.h @@ -0,0 +1,18 @@ +/* platform data for the PCA9539 16-bit I/O expander driver */ + +struct pca9539_platform_data { + /* number of the first GPIO */ + unsigned gpio_base; + + /* initial polarity inversion setting */ + uint16_t invert; + + void *context; /* param to setup/teardown */ + + int (*setup)(struct i2c_client *client, + unsigned gpio, unsigned ngpio, + void *context); + int (*teardown)(struct i2c_client *client, + unsigned gpio, unsigned ngpio, + void *context); +}; -- cgit v1.2.3