Skip to content

Commit 2f75999

Browse files
pelwellpopcornmix
authored andcommitted
gpio: bcm-virt: Fix the get() method
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: #4638 Signed-off-by: Phil Elwell <[email protected]>
1 parent 378d811 commit 2f75999

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpio/gpio-bcm-virt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static int brcmvirt_gpio_get(struct gpio_chip *gc, unsigned off)
4949
unsigned v;
5050
gpio = container_of(gc, struct brcmvirt_gpio, gc);
5151
v = readl(gpio->ts_base + off);
52-
return (v >> off) & 1;
52+
return (s16)((v >> 16) - v) > 0;
5353
}
5454

5555
static void brcmvirt_gpio_set(struct gpio_chip *gc, unsigned off, int val)

0 commit comments

Comments
 (0)