From e952805d2d2e706aed182723e5ab3ec0b1f91de3 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Fri, 5 Mar 2010 13:44:33 -0800 Subject: gpio: add driver for MAX7300 I2C GPIO extender Add the MAX7300-I2C variant of the MAX7301-SPI version. Both chips share the same core logic, so the generic part of the in-kernel SPI-driver is refactored into a generic part. The I2C and SPI specific funtions are then wrapped into seperate drivers picking up the generic part. Signed-off-by: Wolfram Sang Cc: Juergen Beisert Cc: David Brownell Cc: Jean Delvare Cc: Anton Vorontsov Cc: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/spi/max7301.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/linux/spi') diff --git a/include/linux/spi/max7301.h b/include/linux/spi/max7301.h index 6dfd83f..34af0a3 100644 --- a/include/linux/spi/max7301.h +++ b/include/linux/spi/max7301.h @@ -1,9 +1,27 @@ #ifndef LINUX_SPI_MAX7301_H #define LINUX_SPI_MAX7301_H +#include + +/* + * Some registers must be read back to modify. + * To save time we cache them here in memory + */ +struct max7301 { + struct mutex lock; + u8 port_config[8]; /* field 0 is unused */ + u32 out_level; /* cached output levels */ + struct gpio_chip chip; + struct device *dev; + int (*write)(struct device *dev, unsigned int reg, unsigned int val); + int (*read)(struct device *dev, unsigned int reg); +}; + struct max7301_platform_data { /* number assigned to the first GPIO */ unsigned base; }; +extern int __max730x_remove(struct device *dev); +extern int __max730x_probe(struct max7301 *ts); #endif -- cgit v1.1