From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grygorii Strashko Subject: Re: [RFC PATCH] gpio-pca953x driver and PCA9536 chip Date: Mon, 7 Sep 2015 15:36:10 +0300 Message-ID: <55ED84BA.9090202@ti.com> References: <55E4641D.7050603@elpromaelectronics.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: Sender: linux-gpio-owner@vger.kernel.org To: Linus Walleij , =?UTF-8?Q?Janusz_U=c5=bcycki?= , "linux-gpio@vger.kernel.org" , Joshua Scott , Toby Smith , Gregory Clement Cc: Grant Likely , Rob Herring , "devicetree@vger.kernel.org" , Krzysztof Borgulski List-Id: devicetree@vger.kernel.org On 09/06/2015 12:15 AM, Linus Walleij wrote: > Adding linux-gpio and some people that have been patching > this driver to TO-line. >=20 > Grygorii et al, does this look correct? Anyone who can test and > send a patch for mainline? >=20 > Yours, > Linus Walleij >=20 > On Mon, Aug 31, 2015 at 4:26 PM, Janusz U=C5=BCycki > wrote: >> Hi, >> >> The driver sets register #02 (inversion) to 0x01 instead of 0x00 on = my >> board. >> Reason: device_pca953x_init() does not initialize val buffer because= NBANK() >> returns >> for PCA9536 ngpio=3D4 value 0 instead of 1. >> >> My proposed code-patch for 3.14.17 is below. >> Because I don't work on stable/next I can't deliver complete/ready p= atch. >> Please for comments. >> >> best regards >> Janusz >> >> --- a/drivers/gpio/gpio-pca953x.c >> +++ b/drivers/gpio/gpio-pca953x.c >> @@ -75,7 +75,7 @@ MODULE_DEVICE_TABLE(i2c, pca953x_id); >> #define MAX_BANK 5 >> #define BANK_SZ 8 >> >> -#define NBANK(chip) (chip->gpio_chip.ngpio / BANK_SZ) >> +#define NBANK(chip) DIV_ROUND_UP(chip->gpio_chip.ngpio, BANK_SZ) >> >> struct pca953x_chip { >> unsigned gpio_start; Seems yes, but I can't test it - have no such HW now. As per code, NBANK(chip) expected to return number of 8-bit banks, but = now it returns NBANK-1. Additional info: - Corresponding code was changed by Gregory CLEMENT commit: f5f0b7aa897ebf6b0d077356a787526212460dd7 --=20 regards, -grygorii -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" i= n the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html