[U-Boot] [PATCHv3] pca953x: support 16-pin devices
Chris Packham
judge.packham at gmail.com
Wed Dec 15 03:49:50 CET 2010
On Fri, Dec 10, 2010 at 6:08 AM, Peter Tyser <ptyser at xes-inc.com> wrote:
> On Thu, 2010-12-09 at 22:11 +1300, Chris Packham wrote:
>> This adds support for for the PCA9535/PCA9539 family of gpio devices which
>> have 16 output pins.
>>
>> To let the driver know which devices are 16-pin it is necessary to define
>> CONFIG_SYS_I2C_PCA953X_WIDTH in your board config file. This is used to
>> create an array of {chip, ngpio} tuples that are used to determine the
>> width of a particular chip. For backwards compatibility it is assumed that
>> any chip not defined in CONFIG_SYS_I2C_PCA953X_WIDTH has 8 pins.
>>
>> Signed-off-by: Chris Packham <chris.packham at alliedtelesis.co.nz>
>
> Looks good to me and works as advertised.
>
> Acked-by: Peter Tyser <ptyser at xes-inc.com>
> Tested-by: Peter Tyser <ptyser at xes-inc.com>
>
There is one minor fixup we might want to squash into v3 (or if
someone wants me to submit a v4 I can). It makes sense to have
pca953x_ngpio as a function in both cases. The compiler will
auto-inline the function so we won't see a increase in size and having
a function instead of a macro allows the compiler to do proper type
checking.
---8<---
From: Chris Packham <chris.packham at alliedtelesis.co.nz>
Date: Wed, 15 Dec 2010 15:44:17 +1300
Subject: [PATCH] fixup! pca953x: support 16-pin devices
---
drivers/gpio/pca953x.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index c8f5403..359fdee 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -65,7 +65,10 @@ static int pca953x_ngpio(uint8_t chip)
return 8;
}
#else
-#define pca953x_ngpio(chip) 8
+static int pca953x_ngpio(uint8_t chip)
+{
+ return 8;
+}
#endif
/*
--
1.7.3.2
More information about the U-Boot
mailing list