On Sun, Apr 19, 2020 at 9:10 PM Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> wrote: > > On Tue, Mar 10, 2020 at 07:15:35AM +0000, BOUGH CHEN wrote: > > > > > From: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> > > > Sent: 2020年3月10日 12:27 > > > To: BOUGH CHEN <haibo.chen@xxxxxxx> > > > Cc: linux-input@xxxxxxxxxxxxxxx; dl-linux-imx <linux-imx@xxxxxxx> > > > Subject: Re: [PATCH 2/2] input: egalax_ts: free irq resource before request > > > the line as GPIO > > > > > > On Tue, Feb 11, 2020 at 04:41:12PM +0800, haibo.chen@xxxxxxx wrote: > > > > From: Haibo Chen <haibo.chen@xxxxxxx> > > > > > > > > + egalax_free_irq(ts); > > > > > > It sounds to me you want simply disable interrupts in suspend. Does not > > > calling disable_irq() here suffice? > > > > > Here why I want to disable interrupts here is because in the newest > > gpio system, if the gpio is request as an irq, it can't be request as > > a gpio anymore. In the function egalax_wake_up_device(), we need to > > request the irq pin as a gpio for a while, generate a signal to wake > > up the device. So before request the pad as gpio, need first free irq > > resource. > > This seems like a fairly common pattern and I wonder if our GPIO > overlords can help us here. > > Linus, Mika, Andy, would it be possible to have an API that would allow > driver to temporarily "take over" GPIO that is used for interrupts and > drive it as output without resorting to freeing and re-acquiring irq? > I.e. something like gpiod_irq_drive_output_start() and > gpiod_irq_drive_output_end()? Shouldn't it be handled by pinctrl states? sleep state / default state / etc? -- With Best Regards, Andy Shevchenko