* [PATCH v1] gpio: mt7621: Assign base field in gpio_chip @ 2021-06-13 12:06 Reto Schneider [not found] ` <CAHp75Vc5LRRLc-1A5W4BVQ3QQx-+4Y5CUjG3ksosVdPEecEyqA@mail.gmail.com> 0 siblings, 1 reply; 4+ messages in thread From: Reto Schneider @ 2021-06-13 12:06 UTC (permalink / raw) To: linux-gpio, linux-mediatek Cc: Stefan Roese, Reto Schneider, Bartosz Golaszewski, Linus Walleij, Matthias Brugger, linux-arm-kernel, linux-kernel From: Reto Schneider <reto.schneider@husqvarnagroup.com> This is needed for gpiochip_sysfs_register() to properly export /sys/class/gpio/gpiochip{0,32,64}. Without this fix, the field base in gpio_device remains at its initialization value, which is -1. This causes gpiochip_add_data_with_key() to call gpiochip_find_base(), which in turn dynamically determines the base to be at ARCH_NR_GPIOS - 32/64/96, resulting in gpiochip{480,448,416}. Detected/fixed/tested on a MediaTek MT7688 based GARDENA smart gateway. Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com> --- drivers/gpio/gpio-mt7621.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c index 82fb20dca53a..403d64cd65a6 100644 --- a/drivers/gpio/gpio-mt7621.c +++ b/drivers/gpio/gpio-mt7621.c @@ -234,6 +234,7 @@ mediatek_gpio_bank_probe(struct device *dev, 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", -- 2.30.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <CAHp75Vc5LRRLc-1A5W4BVQ3QQx-+4Y5CUjG3ksosVdPEecEyqA@mail.gmail.com>]
* Re: [PATCH v1] gpio: mt7621: Assign base field in gpio_chip [not found] ` <CAHp75Vc5LRRLc-1A5W4BVQ3QQx-+4Y5CUjG3ksosVdPEecEyqA@mail.gmail.com> @ 2021-06-13 15:51 ` Reto Schneider 2021-06-13 23:24 ` Linus Walleij 0 siblings, 1 reply; 4+ messages in thread From: Reto Schneider @ 2021-06-13 15:51 UTC (permalink / raw) To: Andy Shevchenko Cc: linux-gpio, linux-mediatek, Stefan Roese, Reto Schneider, Bartosz Golaszewski, Linus Walleij, Matthias Brugger, linux-arm-kernel, linux-kernel Hi Andy, On 13.06.21 14:44, Andy Shevchenko wrote: > It smells like a fixing non-existing bug. Yes, I understand that there > is some custom hardware with custom firmware which is using Linux kernel > with some never upstreamed patches. On top of this sysfs interface is > deprecated for already a few years and shouldn’t be considered as 1st > class citizen. > > That’s said, if there is no Fixes tag provided with clear point that _at > some point_ it was like this in upstream, I would tend to NAK this patch. I did some digging and indeed, it turned out that I used the pre-mainline GPIO driver from OpenWRT even on Kernel 4.19 (for which the current driver already got mainlined). Surely do agree on not breaking the interface in mainline, and the NAK. Sorry for wasting your time! Kind regards, Reto ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] gpio: mt7621: Assign base field in gpio_chip 2021-06-13 15:51 ` Reto Schneider @ 2021-06-13 23:24 ` Linus Walleij 2021-06-13 23:57 ` Reto Schneider 0 siblings, 1 reply; 4+ messages in thread From: Linus Walleij @ 2021-06-13 23:24 UTC (permalink / raw) To: Reto Schneider Cc: Andy Shevchenko, linux-gpio, linux-mediatek, Stefan Roese, Reto Schneider, Bartosz Golaszewski, Matthias Brugger, linux-arm-kernel, linux-kernel On Sun, Jun 13, 2021 at 5:51 PM Reto Schneider <code@reto-schneider.ch> wrote: > I did some digging and indeed, it turned out that I used the > pre-mainline GPIO driver from OpenWRT even on Kernel 4.19 (for which the > current driver already got mainlined). Hm isn't OpenWrt switched to the mainline driver? Another thing we should do is to add libgpiod to the OpenWrt base distribution so as to encourage people to use the character device ABI. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] gpio: mt7621: Assign base field in gpio_chip 2021-06-13 23:24 ` Linus Walleij @ 2021-06-13 23:57 ` Reto Schneider 0 siblings, 0 replies; 4+ messages in thread From: Reto Schneider @ 2021-06-13 23:57 UTC (permalink / raw) To: Linus Walleij Cc: Andy Shevchenko, linux-gpio, linux-mediatek, Stefan Roese, Reto Schneider, Bartosz Golaszewski, Matthias Brugger, linux-arm-kernel, linux-kernel Hi Linus, On 14.06.21 01:24, Linus Walleij wrote: > Hm isn't OpenWrt switched to the mainline driver? They did, and people are now seeing this "issue" too [1]. Which got me to post my "fix" [2] and then trying to upstream it here. :) Kind regards, Reto [1] https://lists.openwrt.org/pipermail/openwrt-devel/2020-May/028926.html [2] https://lists.openwrt.org/pipermail/openwrt-devel/2021-June/035497.html ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-13 23:57 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-06-13 12:06 [PATCH v1] gpio: mt7621: Assign base field in gpio_chip Reto Schneider [not found] ` <CAHp75Vc5LRRLc-1A5W4BVQ3QQx-+4Y5CUjG3ksosVdPEecEyqA@mail.gmail.com> 2021-06-13 15:51 ` Reto Schneider 2021-06-13 23:24 ` Linus Walleij 2021-06-13 23:57 ` Reto Schneider
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).