[PATCH 2/2] gpio: add driver for stmpe io-expander

Sascha Hauer s.hauer at pengutronix.de
Mon Sep 3 03:08:24 EDT 2012


On Fri, Aug 31, 2012 at 11:14:07AM +0200, Steffen Trumtrar wrote:
> Add a driver for the stmpe1601 gpio block. The stmpe io-expanders have multiple
> blocks (keypad, gpio...) that can be enabled and used. Only gpio is supported atm.
> 
> This was only tested on a stmpe connected via i2c. It is also possible to connect
> via spi.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar at pengutronix.de>
> ---
> +
> +static int stmpe_gpio_probe(struct device_d *dev)
> +{
> +	struct stmpe_gpio_chip *stmpegpio;
> +
> +	stmpegpio = xzalloc(sizeof(*stmpegpio));
> +
> +	stmpegpio->base = dev_request_mem_region(dev, 0);
> +	stmpegpio->chip.ops = &stmpe_gpio_ops;
> +	stmpegpio->chip.base = 224;

This is not a good idea. Configure the base from platform_data instead.
Maybe we can add an optional -1 for dynamic base, but having hardcoded
bases so that board code knows the correct gpio numbers seems more
important for now.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list