David Brownell | e58b9e2 | 2008-02-04 22:28:25 -0800 | [diff] [blame] | 1 | |
David Brownell | 8f1cc3b | 2008-07-25 01:46:09 -0700 | [diff] [blame] | 2 | /* FIXME driver should be able to handle IRQs... */ |
| 3 | |
| 4 | struct mcp23s08_chip_info { |
| 5 | bool is_present; /* true iff populated */ |
| 6 | u8 pullups; /* BIT(x) means enable pullup x */ |
| 7 | }; |
David Brownell | e58b9e2 | 2008-02-04 22:28:25 -0800 | [diff] [blame] | 8 | |
| 9 | struct mcp23s08_platform_data { |
David Brownell | 8f1cc3b | 2008-07-25 01:46:09 -0700 | [diff] [blame] | 10 | /* Four slaves (numbered 0..3) can share one SPI chipselect, and |
| 11 | * will provide 8..32 GPIOs using 1..4 gpio_chip instances. |
| 12 | */ |
| 13 | struct mcp23s08_chip_info chip[4]; |
David Brownell | e58b9e2 | 2008-02-04 22:28:25 -0800 | [diff] [blame] | 14 | |
David Brownell | 8f1cc3b | 2008-07-25 01:46:09 -0700 | [diff] [blame] | 15 | /* "base" is the number of the first GPIO. Dynamic assignment is |
| 16 | * not currently supported, and even if there are gaps in chip |
| 17 | * addressing the GPIO numbers are sequential .. so for example |
| 18 | * if only slaves 0 and 3 are present, their GPIOs range from |
| 19 | * base to base+15. |
| 20 | */ |
David Brownell | e58b9e2 | 2008-02-04 22:28:25 -0800 | [diff] [blame] | 21 | unsigned base; |
| 22 | |
David Brownell | e58b9e2 | 2008-02-04 22:28:25 -0800 | [diff] [blame] | 23 | void *context; /* param to setup/teardown */ |
| 24 | |
| 25 | int (*setup)(struct spi_device *spi, |
| 26 | int gpio, unsigned ngpio, |
| 27 | void *context); |
| 28 | int (*teardown)(struct spi_device *spi, |
| 29 | int gpio, unsigned ngpio, |
| 30 | void *context); |
| 31 | }; |