public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: "Fred-WY Chen (陳威宇)" <Fred-WY.Chen@mediatek.com>
To: "Mandeep S" <Mandeep.S@mediatek.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Deep Pani" <Deep.Pani@mediatek.com>,
	"sean.wang@kernel.org" <sean.wang@kernel.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"Lei Xue (薛磊)" <Lei.Xue@mediatek.com>,
	"linus.walleij@linaro.org" <linus.walleij@linaro.org>
Cc: "Qingliang Li (黎晴亮)" <Qingliang.Li@mediatek.com>,
	"Ye Wang (王叶)" <ot_ye.wang@mediatek.com>,
	"Yaoy Wang (王瑶瑶)" <ot_yaoy.wang@mediatek.com>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"Yong Mao (毛勇)" <yong.mao@mediatek.com>,
	"Shunxi Zhang (章顺喜)" <ot_shunxi.zhang@mediatek.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"Cathy Xu (许华婷)" <ot_cathy.xu@mediatek.com>
Subject: Re: [PATCH 3/3] pinctrl: mediatek: mt8901: Add pinctrl driver for MT8901
Date: Thu, 26 Mar 2026 12:36:18 +0000	[thread overview]
Message-ID: <0df339f15f4ba7e55880194edfdec1155f2f20f7.camel@mediatek.com> (raw)
In-Reply-To: <df11bbf1-09d1-40fc-be56-6a98d90abcb6@collabora.com>

On Tue, 2025-11-25 at 10:56 +0100, AngeloGioacchino Del Regno wrote:
> 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> Il 25/11/25 03:36, Lei Xue ha scritto:
> > Add mt8901 pinctrl, gpio and eint driver implementation.
> > 
> > Signed-off-by: Lei Xue <lei.xue@mediatek.com>
> > ---
> >   drivers/pinctrl/mediatek/Kconfig              |   12 +
> >   drivers/pinctrl/mediatek/Makefile             |    1 +
> >   drivers/pinctrl/mediatek/mtk-eint.c           |    4 +
> >   drivers/pinctrl/mediatek/mtk-eint.h           |    1 +
> >   drivers/pinctrl/mediatek/pinctrl-mt8901.c     | 1460 +++++++++++
> >   drivers/pinctrl/mediatek/pinctrl-mtk-mt8901.h | 2130
> > +++++++++++++++++
> >   6 files changed, 3608 insertions(+)
> >   create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt8901.c
> >   create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-mt8901.h
> > 
> > diff --git a/drivers/pinctrl/mediatek/Kconfig
> > b/drivers/pinctrl/mediatek/Kconfig
> > index 4819617d9368..4820ae5197a0 100644
> > --- a/drivers/pinctrl/mediatek/Kconfig
> > +++ b/drivers/pinctrl/mediatek/Kconfig
> > @@ -321,6 +321,18 @@ config PINCTRL_MT8516
> >       default ARM64 && ARCH_MEDIATEK
> >       select PINCTRL_MTK
> > 
> > +config PINCTRL_MT8901
> > +     bool "MediaTek MT8901 pin control"
> > +     depends on ACPI
> > +     depends on ARM64 || COMPILE_TEST
> > +     default ARM64 && ARCH_MEDIATEK
> > +     select PINCTRL_MTK_PARIS
> > +     help
> > +       Say yes here to support pin controller and gpio driver
> > +       on MediaTek MT8901 SoC.
> > +       In MTK platform, we support virtual gpio and use it to
> > +       map specific eint which doesn't have real gpio pin.
> > +
> >   # For PMIC
> >   config PINCTRL_MT6397
> >       bool "MediaTek MT6397 pin control"
> > diff --git a/drivers/pinctrl/mediatek/Makefile
> > b/drivers/pinctrl/mediatek/Makefile
> > index ae765bd99965..57c69b1e5c2d 100644
> > --- a/drivers/pinctrl/mediatek/Makefile
> > +++ b/drivers/pinctrl/mediatek/Makefile
> > @@ -43,3 +43,4 @@ obj-$(CONFIG_PINCTRL_MT8196)                +=
> > pinctrl-mt8196.o
> >   obj-$(CONFIG_PINCTRL_MT8365)                += pinctrl-mt8365.o
> >   obj-$(CONFIG_PINCTRL_MT8516)                += pinctrl-mt8516.o
> >   obj-$(CONFIG_PINCTRL_MT6397)                += pinctrl-mt6397.o
> > +obj-$(CONFIG_PINCTRL_MT8901)         += pinctrl-mt8901.o
> > diff --git a/drivers/pinctrl/mediatek/mtk-eint.c
> > b/drivers/pinctrl/mediatek/mtk-eint.c
> > index c8c5097c11c4..b5a5beebf9cd 100644
> > --- a/drivers/pinctrl/mediatek/mtk-eint.c
> > +++ b/drivers/pinctrl/mediatek/mtk-eint.c
> > @@ -71,6 +71,10 @@ const unsigned int debounce_time_mt6878[] = {
> >   };
> >   EXPORT_SYMBOL_GPL(debounce_time_mt6878);
> > 
> > +const unsigned int debounce_time_mt8901[] = {
> > +     156, 313, 625, 1250, 20000, 40000, 80000, 160000, 320000,
> > 640000, 0};
> > +EXPORT_SYMBOL_GPL(debounce_time_mt8901);
> > +
> >   static void __iomem *mtk_eint_get_offset(struct mtk_eint *eint,
> >                                        unsigned int eint_num,
> >                                        unsigned int offset)
> > diff --git a/drivers/pinctrl/mediatek/mtk-eint.h
> > b/drivers/pinctrl/mediatek/mtk-eint.h
> > index 3cdd6f6310cd..1b185f660aff 100644
> > --- a/drivers/pinctrl/mediatek/mtk-eint.h
> > +++ b/drivers/pinctrl/mediatek/mtk-eint.h
> > @@ -53,6 +53,7 @@ extern const unsigned int debounce_time_mt2701[];
> >   extern const unsigned int debounce_time_mt6765[];
> >   extern const unsigned int debounce_time_mt6795[];
> >   extern const unsigned int debounce_time_mt6878[];
> > +extern const unsigned int debounce_time_mt8901[];
> > 
> >   struct mtk_eint;
> > 
> > diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8901.c
> > b/drivers/pinctrl/mediatek/pinctrl-mt8901.c
> > new file mode 100644
> > index 000000000000..77dec85fe29b
> > --- /dev/null
> > +++ b/drivers/pinctrl/mediatek/pinctrl-mt8901.c
> > @@ -0,0 +1,1460 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Copyright (C) 2025 MediaTek Inc.
> > + *
> > + */
> > +
> > +#include <linux/acpi.h>
> > +#include <linux/module.h>
> > +#include "pinctrl-mtk-mt8901.h"
> > +#include "pinctrl-paris.h"
> > +
> 
> ..snip..
> 
> > +static const char * const mt8901_pinctrl_register_base_name[] = {
> > +     "iocfg0", "iocfg_lt2", "iocfg_lt3", "iocfg_rt1", "iocfg_rt2",
> > "iocfg_rt3",
> > +     "iocfg_tr", "iocfg_rt0", "iocfg_lt1", "iocfg_lb", "iocfg_rb",
> > +};
> > +
> > +static const struct mtk_eint_hw mt8901_eint_hw = {
> > +     .port_mask = 0xf,
> > +     .ports     = 7,
> > +     .ap_num    = 209,
> > +     .db_cnt    = 32,
> > +     .db_time   = debounce_time_mt8901,
> > +};
> > +
> > +static const struct mtk_pin_soc mt8901_data = {
> > +     .reg_cal = mt8901_reg_cals,
> > +     .pins = mtk_pins_mt8901,
> > +     .npins = ARRAY_SIZE(mtk_pins_mt8901),
> > +     .ngrps = ARRAY_SIZE(mtk_pins_mt8901),
> > +     .eint_hw = &mt8901_eint_hw,
> > +     .eint_pin = eint_pins_mt8901,
> > +     .nfuncs = 8,
> > +     .gpio_m = 0,
> > +     .base_names = mt8901_pinctrl_register_base_name,
> > +     .nbase_names = ARRAY_SIZE(mt8901_pinctrl_register_base_name),
> > +     .pull_type = mt8901_pull_type,
> > +     .pin_rsel = mt8901_pin_rsel_val_range,
> > +     .npin_rsel = ARRAY_SIZE(mt8901_pin_rsel_val_range),
> > /*numsel*/
> > +     .bias_set_combo = mtk_pinconf_bias_set_combo,
> > +     .bias_get_combo = mtk_pinconf_bias_get_combo,
> > +     .drive_set = mtk_pinconf_drive_set_rev1,
> > +     .drive_get = mtk_pinconf_drive_get_rev1,
> > +     .adv_drive_set = mtk_pinconf_adv_drive_set_raw,
> > +     .adv_drive_get = mtk_pinconf_adv_drive_get_raw,
> > +};
> > +
> > +static const struct acpi_device_id mt8901_pinctrl_acpi_match[] = {
> > +     {"NVDA9221", (kernel_ulong_t)&mt8901_data },
> > +     { }
> > +};
> > +MODULE_DEVICE_TABLE(acpi, mt8901_pinctrl_acpi_match);
> > +
> > +static struct platform_driver mt8901_pinctrl_driver = {
> > +     .driver = {
> > +             .name = "mt8901-pinctrl",
> > +             .acpi_match_table =
> > ACPI_PTR(mt8901_pinctrl_acpi_match),
> 
> Please also add support for devicetree - I have a hunch (and I'm sure
> that I am
> not the only one) that ACPI may give some issues at the end of the
> day, on ARM64.
> 
> Of course, I'd hope that ACPI is all good on this platform, but
> still.... :-)
> 
> static const struct of_device_id mt8901_pinctrl_of_match[] = {
>         { .compatible = "mediatek,mt8901-pinctrl", .data =
> &mt8901_data },
>         { /* sentinel */ }
> };
> 
>         .of_match_table = mt8901_pinctrl_of_match,
> 
> > +             .pm = pm_sleep_ptr(&mtk_paris_pinctrl_pm_ops)
> > +     },
> > +     .probe = mtk_paris_pinctrl_probe,
> > +};
> 

Hi Deep,

Could you please check and feedback to Angelo?

Regards,
Fred-WY Chen

> Cheers,
> Angelo
> 
> > +
> > +static int __init mt8901_pinctrl_init(void)
> > +{
> > +     return platform_driver_register(&mt8901_pinctrl_driver);
> > +}
> > +
> > +arch_initcall(mt8901_pinctrl_init);
> > +
> > +MODULE_LICENSE("GPL");
> > +MODULE_DESCRIPTION("MediaTek MT8901 Pinctrl Driver");


  reply	other threads:[~2026-03-26 12:36 UTC|newest]

Thread overview: 15+ 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
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
     [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 (陳威宇) [this message]
2026-03-27 13:41       ` 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=0df339f15f4ba7e55880194edfdec1155f2f20f7.camel@mediatek.com \
    --to=fred-wy.chen@mediatek.com \
    --cc=Deep.Pani@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