* [PATCH v2 1/1] input: imx_sc_key: Enable wakeup according to dts property wakeup-source
@ 2024-07-19 15:22 Frank Li
2024-07-24 18:21 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Frank Li @ 2024-07-19 15:22 UTC (permalink / raw)
To: Dmitry Torokhov, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Nitin Garg, Abel Vesa,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
open list
Cc: imx
From: Abel Vesa <abel.vesa@nxp.com>
Enable default wakeup according to dts property 'wakeup-source'.
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Reviewed-by: Nitin Garg <nitin.garg@nxp.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
Change from v1 to v2
- change int to bool
- move of_property_read_bool() just before device_init_wakeup()
- drop !!
---
drivers/input/keyboard/imx_sc_key.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
index d18839f1f4f60..fc1492088b645 100644
--- a/drivers/input/keyboard/imx_sc_key.c
+++ b/drivers/input/keyboard/imx_sc_key.c
@@ -110,8 +110,10 @@ static void imx_sc_key_action(void *data)
static int imx_sc_key_probe(struct platform_device *pdev)
{
+ struct device_node *np = pdev->dev.of_node;
struct imx_key_drv_data *priv;
struct input_dev *input;
+ bool wakeup;
int error;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
@@ -151,6 +153,9 @@ static int imx_sc_key_probe(struct platform_device *pdev)
priv->input = input;
platform_set_drvdata(pdev, priv);
+ wakeup = of_property_read_bool(np, "wakeup-source");
+ device_init_wakeup(&pdev->dev, wakeup);
+
error = imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON,
true);
if (error) {
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] input: imx_sc_key: Enable wakeup according to dts property wakeup-source
2024-07-19 15:22 [PATCH v2 1/1] input: imx_sc_key: Enable wakeup according to dts property wakeup-source Frank Li
@ 2024-07-24 18:21 ` Dmitry Torokhov
2024-07-24 18:54 ` Frank Li
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2024-07-24 18:21 UTC (permalink / raw)
To: Frank Li
Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Nitin Garg, Abel Vesa,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
open list
Hi Frank,
On Fri, Jul 19, 2024 at 11:22:58AM -0400, Frank Li wrote:
> From: Abel Vesa <abel.vesa@nxp.com>
>
> Enable default wakeup according to dts property 'wakeup-source'.
>
> Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
> Reviewed-by: Nitin Garg <nitin.garg@nxp.com>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
> Change from v1 to v2
> - change int to bool
> - move of_property_read_bool() just before device_init_wakeup()
> - drop !!
> ---
> drivers/input/keyboard/imx_sc_key.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
> index d18839f1f4f60..fc1492088b645 100644
> --- a/drivers/input/keyboard/imx_sc_key.c
> +++ b/drivers/input/keyboard/imx_sc_key.c
> @@ -110,8 +110,10 @@ static void imx_sc_key_action(void *data)
>
> static int imx_sc_key_probe(struct platform_device *pdev)
> {
> + struct device_node *np = pdev->dev.of_node;
> struct imx_key_drv_data *priv;
> struct input_dev *input;
> + bool wakeup;
> int error;
>
> priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> @@ -151,6 +153,9 @@ static int imx_sc_key_probe(struct platform_device *pdev)
> priv->input = input;
> platform_set_drvdata(pdev, priv);
>
> + wakeup = of_property_read_bool(np, "wakeup-source");
The driver uses generic device properties, why do you use OF-specific
variant here?
> + device_init_wakeup(&pdev->dev, wakeup);
> +
How does this actually work? Doesn't the call directly below
unconditionally configures button as a wakeup source?
> error = imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON,
> true);
> if (error) {
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] input: imx_sc_key: Enable wakeup according to dts property wakeup-source
2024-07-24 18:21 ` Dmitry Torokhov
@ 2024-07-24 18:54 ` Frank Li
0 siblings, 0 replies; 3+ messages in thread
From: Frank Li @ 2024-07-24 18:54 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Nitin Garg, Abel Vesa,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
open list
On Wed, Jul 24, 2024 at 11:21:27AM -0700, Dmitry Torokhov wrote:
> Hi Frank,
>
> On Fri, Jul 19, 2024 at 11:22:58AM -0400, Frank Li wrote:
> > From: Abel Vesa <abel.vesa@nxp.com>
> >
> > Enable default wakeup according to dts property 'wakeup-source'.
> >
> > Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
> > Reviewed-by: Nitin Garg <nitin.garg@nxp.com>
> > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > ---
> > Change from v1 to v2
> > - change int to bool
> > - move of_property_read_bool() just before device_init_wakeup()
> > - drop !!
> > ---
> > drivers/input/keyboard/imx_sc_key.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
> > index d18839f1f4f60..fc1492088b645 100644
> > --- a/drivers/input/keyboard/imx_sc_key.c
> > +++ b/drivers/input/keyboard/imx_sc_key.c
> > @@ -110,8 +110,10 @@ static void imx_sc_key_action(void *data)
> >
> > static int imx_sc_key_probe(struct platform_device *pdev)
> > {
> > + struct device_node *np = pdev->dev.of_node;
> > struct imx_key_drv_data *priv;
> > struct input_dev *input;
> > + bool wakeup;
> > int error;
> >
> > priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> > @@ -151,6 +153,9 @@ static int imx_sc_key_probe(struct platform_device *pdev)
> > priv->input = input;
> > platform_set_drvdata(pdev, priv);
> >
> > + wakeup = of_property_read_bool(np, "wakeup-source");
>
> The driver uses generic device properties, why do you use OF-specific
> variant here?
I think it just show default if it is wakeup source.
Do you think we just need call device_init_wakeup(&pdev->dev, wakeup) to
maintance consisent between software wakeup enable status with SCU wakeup
enable status?
Since most case power-key should be wakeup source.
>
> > + device_init_wakeup(&pdev->dev, wakeup);
> > +
>
> How does this actually work? Doesn't the call directly below
> unconditionally configures button as a wakeup source?
Good capture, I am also strange why it can wakeup even dts have not set
wakeup-source.
Frank
>
> > error = imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON,
> > true);
> > if (error) {
>
> Thanks.
>
> --
> Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-24 18:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-19 15:22 [PATCH v2 1/1] input: imx_sc_key: Enable wakeup according to dts property wakeup-source Frank Li
2024-07-24 18:21 ` Dmitry Torokhov
2024-07-24 18:54 ` Frank Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox