mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 06:31:31 +00:00
gpio: pca953x: Fix register reading past 8th GPIO
A bug in the pca953x driver prevents correct reading of GPIO input values beyond the 8th GPIO; all values are reported as zero. Setting of GPIO output values is not affected. This patch fixes the reading behavior. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Peng Fan <van.freenix@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
5aeedebc33
commit
fc76b69873
1 changed files with 3 additions and 1 deletions
|
@ -148,11 +148,13 @@ static int pca953x_get_value(struct udevice *dev, unsigned offset)
|
||||||
int ret;
|
int ret;
|
||||||
u8 val = 0;
|
u8 val = 0;
|
||||||
|
|
||||||
|
int off = offset % BANK_SZ;
|
||||||
|
|
||||||
ret = pca953x_read_single(dev, PCA953X_INPUT, &val, offset);
|
ret = pca953x_read_single(dev, PCA953X_INPUT, &val, offset);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
return (val >> offset) & 0x1;
|
return (val >> off) & 0x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pca953x_set_value(struct udevice *dev, unsigned offset,
|
static int pca953x_set_value(struct udevice *dev, unsigned offset,
|
||||||
|
|
Loading…
Add table
Reference in a new issue