Re: [PATCH v2] GPIO: add Microchip MCP23017 / MCP23008 GPIO driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 15 Dec 2015 18:28:10 +0100
Florian Vallee <fvallee@xxxxxxxxx> wrote:

> This is based on the I2C implementation of the corresponding linux driver
> 
> v2:
>  - cleanup unused platform_data
>  - fix base gpio number handling
> 
> Signed-off-by: Florian Vallee <fvallee@xxxxxxxxx>
> ---
>  drivers/gpio/Kconfig             |  11 +-
>  drivers/gpio/Makefile            |   1 +
>  drivers/gpio/gpio-mcp23s08.c     | 341 +++++++++++++++++++++++++++++++++++++++
>  include/platform_data/mcp23s08.h |   4 +
>  4 files changed, 356 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpio/gpio-mcp23s08.c
>  create mode 100644 include/platform_data/mcp23s08.h
> 
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 9cb2261..6428f2b 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -121,6 +121,15 @@ config GPIO_DESIGNWARE
>  	help
>  	  Say Y or M here to build support for the Synopsys DesignWare APB
>  	  GPIO block.
> -endmenu
>  
> +config GPIO_MCP23S08
> +	tristate "Microchip MCP23xxx I/O expander"
> +	depends on I2C
> +	help
> +	  I2C driver for Microchip MCP23008/MCP23017
> +	  I/O expanders.
> +	  This provides a GPIO interface supporting inputs and outputs.
> +	  The I2C versions of the chips can be used as interrupt-controller.
> +
> +endmenu
>  endif

...

> --- /dev/null
> +++ b/drivers/gpio/gpio-mcp23s08.c
> @@ -0,0 +1,341 @@

...

> +struct mcp23s08_driver_data {
> +	unsigned		ngpio;
> +	struct mcp23s08		*mcp[8];
> +	struct mcp23s08		chip[];
> +};
> +
> +/*----------------------------------------------------------------------*/
> +
> +#if IS_ENABLED(CONFIG_I2C)


Hmmm.

You already have 'depends on I2C' in your Kconfig.


> +static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device_d *dev,
> +			      void *data, unsigned addr, unsigned type,
> +			      struct mcp23s08_platform_data *pdata, int cs)
> +{
> +	int status;
> +
> +	mcp->data = data;
> +	mcp->addr = addr;
> +
> +	switch (type) {
> +#if IS_ENABLED(CONFIG_I2C)

Just the same thing happened here.


> +	case MCP_TYPE_008:
> +		mcp->ops = &mcp23008_ops;
> +		mcp->chip.ngpio = 8;
> +		break;
> +
> +	case MCP_TYPE_017:
> +		mcp->ops = &mcp23017_ops;
> +		mcp->chip.ngpio = 16;
> +		break;
> +#endif /* CONFIG_I2C */

...

> diff --git a/include/platform_data/mcp23s08.h b/include/platform_data/mcp23s08.h
> new file mode 100644
> index 0000000..b5289ab
> --- /dev/null
> +++ b/include/platform_data/mcp23s08.h
> @@ -0,0 +1,4 @@
> +struct mcp23s08_platform_data {
> +	/* "base" is the number of the first GPIO. */
> +	unsigned	base;
> +};

This header file has no guard macro.
However, linux version of this file has no guard macro either.

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux