From: Matthijs Kooijman <matthijs@stdin.nl>
To: Linus Walleij <linusw@kernel.org>
Cc: Jonas Karlman <jonas@kwiboo.se>, Heiko Stuebner <heiko@sntech.de>,
Bartosz Golaszewski <brgl@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linux-rockchip@lists.infradead.org"
<linux-rockchip@lists.infradead.org>
Subject: Re: [PATCH RESEND 1/2] arm64: dts: rockchip: rk3308: Add gpio-ranges properties
Date: Tue, 10 Mar 2026 10:13:24 +0100 [thread overview]
Message-ID: <aa_gs9RgvXkcZCa3@login.tika.stderr.nl> (raw)
In-Reply-To: <CAD++jLmFt6N=v4RsxWqWKcsOonxbyoe7F__j+xNr4c8LWdgR7g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1357 bytes --]
Hey Linus,
> We do not like it when people depend on the global GPIO numbering.
Yeah, I know. That's also why this patch is useful: It stops relying on
global numbering for auto-defining gpio-ranges and instead defines them
explicitly (for this particular DT at least).
Looking at the code (rockchip_gpiolib_register()), I do think it could
be rewritten to use dynamic GPIO numbering (since the same code
currently sets gc->base based on the bank->pin_base, and then defines
gpio-ranges based on gc->base, but I think it could just use
bank->pin_base directly and *not* set gc->base at all to use dynamic
numbering). However, actually making such invasive changes is out of
scope (and time budget) for me :-)
> > but I see in the code that
> > GPIO drivers decide themselves (by setting gc->base statically or maybe
> > based on DT).
>
> They *can* but they really shouldn't. This mechanism exists for
> legacy reasons.
I did read this comment today:
/* dynamic allocation of GPIOs, e.g. on a hotplugged device */
static int gpiochip_find_base_unlocked(u16 ngpio)
Which suggested to me that static allocation was still the recommended
default and dynamic allocation primarily used for cases where static
allocation cannot work (like hotplug). But your messages suggests that
static allocation is discouraged more actively than that.
Gr.
Matthijs
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-03-10 9:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 20:17 [PATCH RESEND] rockchip: Make gpiod pin control work and add gpio-ranges Matthijs Kooijman
2026-03-02 20:17 ` [PATCH RESEND 1/2] arm64: dts: rockchip: rk3308: Add gpio-ranges properties Matthijs Kooijman
2026-03-02 21:56 ` Jonas Karlman
2026-03-10 8:53 ` Matthijs Kooijman
2026-03-10 8:59 ` Linus Walleij
2026-03-10 9:13 ` Matthijs Kooijman [this message]
2026-03-10 12:15 ` Jonas Karlman
2026-03-02 20:17 ` [PATCH RESEND 2/2] gpio: rockchip: Call pinctrl for gpio config Matthijs Kooijman
2026-03-03 7:36 ` Linus Walleij
2026-03-02 20:23 ` [PATCH RESEND] rockchip: Make gpiod pin control work and add gpio-ranges Matthijs Kooijman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aa_gs9RgvXkcZCa3@login.tika.stderr.nl \
--to=matthijs@stdin.nl \
--cc=brgl@kernel.org \
--cc=heiko@sntech.de \
--cc=jonas@kwiboo.se \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®