提交 fc76b698 编写于 作者: M mario.six@gdsys.cc 提交者: Simon Glass

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: NMario Six <mario.six@gdsys.cc>
Reviewed-by: NPeng Fan <van.freenix@gmail.com>
Acked-by: NSimon Glass <sjg@chromium.org>
上级 5aeedebc
......@@ -148,11 +148,13 @@ static int pca953x_get_value(struct udevice *dev, unsigned offset)
int ret;
u8 val = 0;
int off = offset % BANK_SZ;
ret = pca953x_read_single(dev, PCA953X_INPUT, &val, offset);
if (ret)
return ret;
return (val >> offset) & 0x1;
return (val >> off) & 0x1;
}
static int pca953x_set_value(struct udevice *dev, unsigned offset,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册