gpio-mt7621 offset fix for 5.10 kernel series

Peter Naulls peter at chocky.org
Tue Oct 18 12:30:05 PDT 2022


Looks like there was some code loss when the driver came from an earlier kernel 
series. Without this, my MT7621 board starts its GPIO offsets at 416 (why that
number, I don't know):

--- a/drivers/gpio/gpio-mt7621.c    2022-10-18 15:03:42.596454871 -0400
+++ b/drivers/gpio/gpio-mt7621.c    2022-10-18 13:51:23.628305673 -0400
@@ -234,6 +234,7 @@
          return ret;
      }

+    rg->chip.base = rg->bank * MTK_BANK_WIDTH;
      rg->chip.of_gpio_n_cells = 2;
      rg->chip.of_xlate = mediatek_gpio_xlate;
      rg->chip.label = devm_kasprintf(dev, GFP_KERNEL, "%s-bank%d",


I'm using 5.10 in the current OpenWrt 22.03.

Before

# ls -l /sys/class/gpio/gpiochip4*
lrwxrwxrwx    1 root     root             0 Jan  1  1970 
/sys/class/gpio/gpiochip416 -> 
../../devices/platform/1e000000.palmbus/1e000600.gpio/gpio6
lrwxrwxrwx    1 root     root             0 Jan  1  1970 
/sys/class/gpio/gpiochip448 -> 
../../devices/platform/1e000000.palmbus/1e000600.gpio/gpio8
lrwxrwxrwx    1 root     root             0 Jan  1  1970 
/sys/class/gpio/gpiochip480 -> 
../../devices/platform/1e000000.palmbus/1e000600.gpio/gpio0

After:

# ls -l /sys/class/gpio/
--w-------    1 root     root          4096 Jan  1  1970 export
lrwxrwxrwx    1 root     root             0 Jan  1  1970 gpiochip0 -> 
../../devices/platform/1e000000.palmbus/1e000600.gpio/gpio/gpiochip0
lrwxrwxrwx    1 root     root             0 Jan  1  1970 gpiochip32 -> 
../../devices/platform/1e000000.palmbus/1e000600.gpio/gpio/gpiochip32
lrwxrwxrwx    1 root     root             0 Jan  1  1970 gpiochip64 -> 
../../devices/platform/1e000000.palmbus/1e000600.gpio/gpio/gpiochip64
--w-------    1 root     root          4096 Jan  1  1970 unexport

Which is consistent with what I had in 4.14 series.



More information about the openwrt-devel mailing list