mcp23s08 spi gpio expander
PATCH 3/3 mcp23s08 spi gpio expander
Basic driver for 8-bit SPI based MCP23S08 GPIO expander, without support for IRQs or the shared chipselect mechanism.
Signed-off-by David Brownell <[email protected]>
--- drivers/spi/Kconfig | 7 drivers/spi/Makefile | 1 drivers/spi/mcp23s08.c | 355 +++++++++++++++++++++++++++++++++++++++++++ include/linux/spi/mcp23s08.h | 24 ++ 4 files changed, 387 insertions(+)
drivers/spi/Kconfig +7 -0
@@ -220,6 +220,13 @@ config SPI_AT25 This driver can also be built as a module. If so, the module will be called at25. +config SPI_MCP23S08 + tristate "Microchip MCP23S08 I/O expander" + depends on SPI_MASTER && GPIO_LIB + help + SPI driver for Microchip MCP23S08 I/O expander. This provides + a GPIO interface supporting inputs and outputs. + config SPI_SPIDEV tristate "User mode SPI device driver support" depends on SPI_MASTER && EXPERIMENTAL
drivers/spi/Makefile +1 -0
@@ -31,6 +31,7 @@ obj-$(CONFIG_SPI_XILINX) += xilinx_spi. # SPI protocol drivers (device/link on bus) obj-$(CONFIG_SPI_AT25) += at25.o +obj-$(CONFIG_SPI_MCP23S08) += mcp23s08.o obj-$(CONFIG_SPI_SPIDEV) += spidev.o obj-$(CONFIG_SPI_TLE62X0) += tle62x0.o # ... add above this line ...
drivers/spi/mcp23s08.c new file +355 -0
355 lines not on this page · raw message
include/linux/spi/mcp23s08.h new file +24 -0
@@ -0,0 +1,24 @@ + +/* FIXME driver should be able to handle all four slaves that +* can be hooked up to each chipselect, as well as IRQs... +*/ + +struct mcp23s08_platform_data { +/* four slaves can share one SPI chipselect */ +u8 slave; + +/* number assigned to the first GPIO */ +unsigned base; + +/* pins with pullups */ +u8 pullups; + +void *context;/* param to setup/teardown */ + +int (*setup)(struct spi_device *spi, +int gpio,unsigned ngpio, +void *context); +int (*teardown)(struct spi_device *spi, +int gpio,unsigned ngpio, +void *context); +};
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/