linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shenwei Wang <shenwei.wang@nxp.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Aisheng Dong <aisheng.dong@nxp.com>,
	Fabio Estevam <festevam@gmail.com>,
	Shawn Guo <shawnguo@kernel.org>, Jacky Bai <ping.bai@nxp.com>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>,
	Pengutronix Kernel Team <kernel@pengutronix.de>
Subject: RE: [EXT] Re: [PATCH v2 1/1] gpio: mxc: add suspend/resume support for i.mx8x SoCs
Date: Mon, 17 Oct 2022 13:54:58 +0000	[thread overview]
Message-ID: <PAXPR04MB9185AE67BF20108CFBF0546289299@PAXPR04MB9185.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <CACRpkdaKncznz5qej6owA2OGMeqbrif9e_QO3CWN6+sGhEApDw@mail.gmail.com>



> -----Original Message-----
> From: Linus Walleij <linus.walleij@linaro.org>
> Sent: Monday, October 17, 2022 4:39 AM
> To: Shenwei Wang <shenwei.wang@nxp.com>; Aisheng Dong
> <aisheng.dong@nxp.com>; Fabio Estevam <festevam@gmail.com>; Shawn Guo
> <shawnguo@kernel.org>; Jacky Bai <ping.bai@nxp.com>
> Cc: Bartosz Golaszewski <brgl@bgdev.pl>; linux-gpio@vger.kernel.org;
> imx@lists.linux.dev; Pengutronix Kernel Team <kernel@pengutronix.de>
> Subject: [EXT] Re: [PATCH v2 1/1] gpio: mxc: add suspend/resume support for
> i.mx8x SoCs
> 
> Caution: EXT Email
> 
> On Fri, Oct 7, 2022 at 5:29 PM Shenwei Wang <shenwei.wang@nxp.com> wrote:
> 
> > On i.MX8QM/QXP/DXL SoCs, even a GPIO is selected as the wakeup source,
> > the GPIO block will be powered off when system enters into suspend
> > state. This can greatly reduce the power consumption of suspend state
> > because the whole partition can be shutdown. This is called PAD wakeup
> > feature on i.MX8x platform.
> >
> > This patch enables this wakeup feature on i.MX8QM/QXP/DXL platforms.
> >
> > Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
> > ---
> >  Changes in v2:
> >  - fix a bug when finding the pad index
> 
> This:
> 
> > +#define IMX_SC_PAD_FUNC_GET_WAKEUP     9
> > +#define IMX_SC_PAD_FUNC_SET_WAKEUP     4
> > +#define IMX_SC_IRQ_GROUP_WAKE           3   /* Wakeup interrupts */
> > +#define IMX_SC_IRQ_PAD                 2    /* Pad wakeup */
> > +
> > +#define IMX_SC_PAD_WAKEUP_OFF          0
> > +#define IMX_SC_PAD_WAKEUP_LOW_LVL      4
> > +#define IMX_SC_PAD_WAKEUP_FALL_EDGE    5
> > +#define IMX_SC_PAD_WAKEUP_RISE_EDGE    6
> > +#define IMX_SC_PAD_WAKEUP_HIGH_LVL     7
> (...)
> 
> > +const struct mxc_gpio_pad_map imx8qm_pad_map[] = {
> > +       /* GPIO0 */
> > +       {  0, IMX8QM_SIM0_CLK},
> > +       {  1, IMX8QM_SIM0_RST},
> > +       {  2, IMX8QM_SIM0_IO},
> > +       {  3, IMX8QM_SIM0_PD},
> 
> this is pin control.
> 
> I think you need to think about adding this to the i.MX pin control driver instead,
> possibly cooperaring with the GPIO driver.
> 
> I'm not entirely certain about the relationship between MXC and i.MX so correct
> me if I get this wrong...

This is not pin control. The wakeup function doesn't change any PINCtrl settings.  On i.MX8
platform, there is an extra pad wakeup logic and each pin can be configured as the wakeup source 
during system suspend. Because GPIO module is powered off on i.MX8 platform in suspend 
state, the GPIO's native wakeup won't work anymore. This patch just maps a GPIO wakeup to the 
corresponding PAD wakeup, and this mapping doesn't impact or change any PINCtrl settings.
Also the pad wakeup feature here has a great power consumption advantage comparing with the 
GPIO module's native wakeup.

> 
> To me this looks like two drivers could end up fighting about the control of the
> same hardware if you don't.
> 

It won't. This patch doesn't interact with any pinctrl relating registers at all.

> Also CC i.MX Freescale pin control maintainers on all patches like this, thanks!
> (Added on to-line.)
> 

Will add them in the future.

Regards,
Shenwei

> Yours,
> Linus Walleij

  reply	other threads:[~2022-10-17 13:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-07 15:28 [PATCH v2 1/1] gpio: mxc: add suspend/resume support for i.mx8x SoCs Shenwei Wang
2022-10-17  9:39 ` Linus Walleij
2022-10-17 13:54   ` Shenwei Wang [this message]
2022-10-18  8:20     ` [EXT] " Linus Walleij
2022-10-18 19:42       ` Shenwei Wang
2022-10-21  8:27         ` Linus Walleij
2022-10-24 15:04           ` Shenwei Wang
2022-11-08 10:18             ` Linus Walleij

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=PAXPR04MB9185AE67BF20108CFBF0546289299@PAXPR04MB9185.eurprd04.prod.outlook.com \
    --to=shenwei.wang@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=brgl@bgdev.pl \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=ping.bai@nxp.com \
    --cc=shawnguo@kernel.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;
as well as URLs for NNTP newsgroup(s).