* [PATCH 1/1] input: imx_sc_key: Enable wakeup according to dts property wakeup-source
@ 2024-07-16 21:33 Frank Li
2024-07-19 8:23 ` Marco Felsch
0 siblings, 1 reply; 2+ messages in thread
From: Frank Li @ 2024-07-16 21:33 UTC (permalink / raw)
To: Dmitry Torokhov, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Abel Vesa, Nitin Garg,
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>
---
drivers/input/keyboard/imx_sc_key.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
index d18839f1f4f60..83025407065ba 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;
+ int wakeup;
int error;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
@@ -130,6 +132,8 @@ static int imx_sc_key_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&priv->check_work, imx_sc_check_for_events);
+ wakeup = of_property_read_bool(np, "wakeup-source");
+
input = devm_input_allocate_device(&pdev->dev);
if (!input) {
dev_err(&pdev->dev, "failed to allocate the input device\n");
@@ -151,6 +155,8 @@ static int imx_sc_key_probe(struct platform_device *pdev)
priv->input = input;
platform_set_drvdata(pdev, priv);
+ 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] 2+ messages in thread
* Re: [PATCH 1/1] input: imx_sc_key: Enable wakeup according to dts property wakeup-source
2024-07-16 21:33 [PATCH 1/1] input: imx_sc_key: Enable wakeup according to dts property wakeup-source Frank Li
@ 2024-07-19 8:23 ` Marco Felsch
0 siblings, 0 replies; 2+ messages in thread
From: Marco Felsch @ 2024-07-19 8:23 UTC (permalink / raw)
To: Frank Li
Cc: Dmitry Torokhov, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, Abel Vesa, Nitin Garg,
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 24-07-16, 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>
> ---
> drivers/input/keyboard/imx_sc_key.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
> index d18839f1f4f60..83025407065ba 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;
> + int wakeup;
^
bool
> int error;
>
> priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> @@ -130,6 +132,8 @@ static int imx_sc_key_probe(struct platform_device *pdev)
>
> INIT_DELAYED_WORK(&priv->check_work, imx_sc_check_for_events);
>
> + wakeup = of_property_read_bool(np, "wakeup-source");
Can you move this right infront of the device_init_wakeup() call?
> input = devm_input_allocate_device(&pdev->dev);
> if (!input) {
> dev_err(&pdev->dev, "failed to allocate the input device\n");
> @@ -151,6 +155,8 @@ static int imx_sc_key_probe(struct platform_device *pdev)
> priv->input = input;
> platform_set_drvdata(pdev, priv);
>
> + device_init_wakeup(&pdev->dev, !!wakeup);
^
The !! shouldn't be necessary with type of 'bool'.
Regards,
Marco
> +
> error = imx_scu_irq_group_enable(SC_IRQ_GROUP_WAKE, SC_IRQ_BUTTON,
> true);
> if (error) {
> --
> 2.34.1
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-19 8:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16 21:33 [PATCH 1/1] input: imx_sc_key: Enable wakeup according to dts property wakeup-source Frank Li
2024-07-19 8:23 ` Marco Felsch
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).