From: "andriy.shevchenko@intel.com" <andriy.shevchenko@intel.com>
To: Deep Pani <Deep.Pani@mediatek.com>
Cc: "Fred-WY Chen (陳威宇)" <Fred-WY.Chen@mediatek.com>,
"Lei Xue (薛磊)" <Lei.Xue@mediatek.com>,
"Mandeep S" <Mandeep.S@mediatek.com>,
"Qingliang Li (黎晴亮)" <Qingliang.Li@mediatek.com>,
"sean.wang@kernel.org" <sean.wang@kernel.org>,
"Yaoy Wang (王瑶瑶)" <ot_yaoy.wang@mediatek.com>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Yong Mao (毛勇)" <yong.mao@mediatek.com>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"Cathy Xu (许华婷)" <ot_cathy.xu@mediatek.com>,
"Shunxi Zhang (章顺喜)" <ot_shunxi.zhang@mediatek.com>,
"Ye Wang (王叶)" <ot_ye.wang@mediatek.com>
Subject: Re: [PATCH 1/3] pinctrl: mediatek: Add gpio-range record in pinctrl driver
Date: Fri, 17 Apr 2026 09:35:14 +0300 [thread overview]
Message-ID: <aeHUog7MXCdtEImh@ashevche-desk.local> (raw)
In-Reply-To: <9e802950ae47071bb34bb373419dc89c9add9d0b.camel@mediatek.com>
On Fri, Mar 27, 2026 at 01:33:09PM +0000, Deep Pani wrote:
> Hi Andy,
>
> You mean gpiochip_add_pin_range(), correct?
>
> IIRC, that adds to gpiochip's range, not the range we are using for our
> pinctrl driver.
>
> The range we are utilizing inside our hardware is of the type struct
> pinctrl_gpio_range. There is no callback in gpiochip that handles this
> type of range
I see, thanks for elaboration.
> I also recall that gpiochip_add_data() doesn't initialize the hw but
> rather initializes the gpiochip from the hw data we will provide in
> mtk_build_gpiochip().
It does for IRQ if one specifies an IRQ chip.
> Thus we need a function which will help
> initialize the pinctrl_gpio_range inside our pinctrl driver structure.
> This is why we make the mtk_pinctrl_gpio_range_init function here.
But this sounds like the solution from other end of a stick.
OTOH there are a few drivers that use this approach.
> For the second question, we are keeping it because before ACPI is
> invoked we still need some other pins to be configured, especially if
> different pins have different styles of pull configuration. The method
> we use is to define those configurations in the pinctrl-mt8901.c file
> which determines the gpio ranges and maps pinctrl device to acpi, one
> set of gpio ranges per configuration, for different type of pull
> configurations we have different gpio ranges, this callback helps add
> them into the pinctrl subsystem such that other device maintainers can
> easily leverage that subsystem to add their resources in their _CRS
> calls using the common interfaces.
>
> Thus we need to keep both the functions.
OK.
> On Thu, 2026-03-26 at 12:33 +0000, Fred-WY Chen (陳威宇) wrote:
> > On Wed, 2025-11-26 at 19:06 +0100, Andy Shevchenko wrote:
> > >
> > > External email : Please do not click links or open attachments
> > > until
> > > you have verified the sender or the content.
Please, get rid of this header, it's not compatible with OSS development
process.
> > > On Tue, Nov 25, 2025 at 10:36:34AM +0800, Lei Xue wrote:
> > > > Kernel GPIO subsystem mapping hardware pin number to a different
> > > > range of gpio number. Add gpio-range structure to hold
> > > > the mapped gpio range in pinctrl driver. That enables the kernel
> > > > to search a range of mapped gpio range against a pinctrl device.
> > >
> > > ...
> > >
> > > > static int mtk_build_gpiochip(struct mtk_pinctrl *hw)
> > > > {
> > > > struct gpio_chip *chip = &hw->chip;
> > >
> > > > if (ret < 0)
> > > > return ret;
> > > >
> > > > + mtk_pinctrl_gpio_range_init(hw, chip);
> > > > +
> > > > return 0;
> > >
> > > We have a callback for that in struct gpio_chip. Any reason not to
> > > use it?
> > >
> > > > }
> > >
> > > ...
> > >
> > > > + pinctrl_add_gpio_range(hw->pctrl, &hw->range);
> > >
> > > Not sure if this is needed.
> >
> > Could you please check this and feedback?
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-04-17 6:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 2:36 [PATCH 0/3] Add pinctrl and GPIO support for MediaTek MT8901 Lei Xue
2025-11-25 2:36 ` [PATCH 1/3] pinctrl: mediatek: Add gpio-range record in pinctrl driver Lei Xue
2025-11-26 18:06 ` Andy Shevchenko
2026-03-26 12:33 ` Fred-WY Chen (陳威宇)
2026-03-27 13:33 ` Deep Pani
2026-04-17 6:02 ` Deep Pani
2026-04-17 6:36 ` andriy.shevchenko
2026-04-17 6:35 ` andriy.shevchenko [this message]
2025-11-25 2:36 ` [PATCH 2/3] pinctrl: mediatek: Add acpi support Lei Xue
2025-11-26 9:10 ` Linus Walleij
2025-11-26 16:52 ` Lorenzo Pieralisi
2025-11-26 18:06 ` Andy Shevchenko
2025-11-27 10:06 ` Lorenzo Pieralisi
2025-11-27 14:29 ` Andy Shevchenko
2025-11-27 15:53 ` Lorenzo Pieralisi
2026-04-17 6:26 ` Andy Shevchenko
[not found] ` <20251125023639.2416546-4-lei.xue@mediatek.com>
2025-11-25 9:56 ` [PATCH 3/3] pinctrl: mediatek: mt8901: Add pinctrl driver for MT8901 AngeloGioacchino Del Regno
2026-03-26 12:36 ` Fred-WY Chen (陳威宇)
2026-03-27 13:41 ` Deep Pani
2026-04-17 6:04 ` Deep Pani
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=aeHUog7MXCdtEImh@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Deep.Pani@mediatek.com \
--cc=Fred-WY.Chen@mediatek.com \
--cc=Lei.Xue@mediatek.com \
--cc=Mandeep.S@mediatek.com \
--cc=Qingliang.Li@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=ot_cathy.xu@mediatek.com \
--cc=ot_shunxi.zhang@mediatek.com \
--cc=ot_yaoy.wang@mediatek.com \
--cc=ot_ye.wang@mediatek.com \
--cc=sean.wang@kernel.org \
--cc=yong.mao@mediatek.com \
/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