2022-04-22 15:00:47 +00:00
|
|
|
From 66297ecb8fd4cd69e3bd644ce64825a9d67208f7 Mon Sep 17 00:00:00 2001
|
2021-11-24 17:32:01 +00:00
|
|
|
From: Phil Elwell <phil@raspberrypi.com>
|
|
|
|
Date: Tue, 19 Oct 2021 11:23:43 +0100
|
2022-04-22 15:00:47 +00:00
|
|
|
Subject: [PATCH 546/828] gpio: bcm-virt: Fix the get() method
|
2021-11-24 17:32:01 +00:00
|
|
|
|
|
|
|
The get() method does not understand the on-the-wire encoding of the
|
|
|
|
remote GPIO states, thinking they are simple on/off bits when they are
|
|
|
|
really pairs of 16-bit counts. Rewrite the get() handler to return the
|
|
|
|
value last written, which will eventually match the actual GPIO state
|
|
|
|
if there are no other changes.
|
|
|
|
|
|
|
|
See: https://github.com/raspberrypi/linux/issues/4638
|
|
|
|
|
|
|
|
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
|
|
|
|
---
|
|
|
|
drivers/gpio/gpio-bcm-virt.c | 2 +-
|
|
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
|
|
|
|
--- a/drivers/gpio/gpio-bcm-virt.c
|
|
|
|
+++ b/drivers/gpio/gpio-bcm-virt.c
|
2022-04-22 15:00:47 +00:00
|
|
|
@@ -49,7 +49,7 @@ static int brcmvirt_gpio_get(struct gpio
|
2021-11-24 17:32:01 +00:00
|
|
|
unsigned v;
|
|
|
|
gpio = container_of(gc, struct brcmvirt_gpio, gc);
|
|
|
|
v = readl(gpio->ts_base + off);
|
|
|
|
- return (v >> off) & 1;
|
|
|
|
+ return (s16)((v >> 16) - v) > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void brcmvirt_gpio_set(struct gpio_chip *gc, unsigned off, int val)
|