Patchwork [U-Boot,PATCHv3] pca953x: support 16-pin devices

login
register
mail settings
Submitter Chris Packham
Date Dec. 15, 2010, 2:49 a.m.
Message ID <AANLkTi=UrUVinO-Px-yc+7OfskODJADD_QpgRYDRHYxm@mail.gmail.com>
Download mbox | patch
Permalink /patch/75603/
State Changes Requested
Headers show

Comments

Chris Packham - Dec. 15, 2010, 2:49 a.m.
On Fri, Dec 10, 2010 at 6:08 AM, Peter Tyser <ptyser@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@alliedtelesis.co.nz>
>
> Looks good to me and works as advertised.
>
> Acked-by: Peter Tyser <ptyser@xes-inc.com>
> Tested-by: Peter Tyser <ptyser@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@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(-)
Wolfgang Denk - Dec. 18, 2010, 11:26 p.m.
Dear Chris Packham,

In message <AANLkTi=UrUVinO-Px-yc+7OfskODJADD_QpgRYDRHYxm@mail.gmail.com> you wrote:
>
> 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.

Please send a v4.  Thanks.

Best regards,

Wolfgang Denk

Patch

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

 /*