All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] input: keyboard: snvs_pwrkey: Add key-release-only
@ 2022-03-07 14:24 ` Alifer Moraes
  0 siblings, 0 replies; 6+ messages in thread
From: Alifer Moraes @ 2022-03-07 14:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: devicetree, dmitry.torokhov, eran.m, festevam, kernel,
	linux-arm-kernel, linux-imx, linux-input, pierluigi.p, robh+dt,
	s.hauer, shawnguo, u.kleine-koenig, mcontenti, Alifer Moraes

From: Eran Matityahu <eran.m@variscite.com>

On imx6qdl the interrupt only triggers on the release of the key.
Normally, the driver is looking for a change in the state of the key,
but since the interrupt triggers on release the key value is always 0,
so there was no event.

Add "key-release-only" boolean dts property to address this issue,
and create both key press and key release events when the key
is actually released.

Signed-off-by: Eran Matityahu <eran.m@variscite.com>
Signed-off-by: mcontenti <marco.c@variscite.com>
Signed-off-by: Alifer Moraes <alifer.m@variscite.com>
---
 arch/arm/boot/dts/imx6qdl.dtsi       |  1 +
 drivers/input/keyboard/snvs_pwrkey.c | 21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index d27beb47f9a3..9811e6bfd8e5 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -845,6 +845,7 @@ snvs_pwrkey: snvs-powerkey {
 					regmap = <&snvs>;
 					interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
 					linux,keycode = <KEY_POWER>;
+					key-release-only;
 					wakeup-source;
 					status = "disabled";
 				};
diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
index 65286762b02a..b558e6f898fa 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -66,6 +66,22 @@ static void imx_imx_snvs_check_for_events(struct timer_list *t)
 	}
 }
 
+static void imx_imx_snvs_check_for_release_events(struct timer_list *t)
+{
+	struct pwrkey_drv_data *pdata = from_timer(pdata, t, check_timer);
+	struct input_dev *input = pdata->input;
+	u32 state;
+
+	/* interrupt only reports release of key so do not wait for state change */
+	state = 1;
+	input_event(input, EV_KEY, pdata->keycode, state);
+	input_sync(input);
+
+	state = 0;
+	input_event(input, EV_KEY, pdata->keycode, state);
+	input_sync(input);
+}
+
 static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)
 {
 	struct platform_device *pdev = dev_id;
@@ -177,7 +193,10 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
 	/* clear the unexpected interrupt before driver ready */
 	regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
 
-	timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events, 0);
+	if (of_property_read_bool(np, "key-release-only"))
+		timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_release_events, 0);
+	else
+		timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events, 0);
 
 	input = devm_input_allocate_device(&pdev->dev);
 	if (!input) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] input: keyboard: snvs_pwrkey: Add key-release-only
@ 2022-03-07 14:24 ` Alifer Moraes
  0 siblings, 0 replies; 6+ messages in thread
From: Alifer Moraes @ 2022-03-07 14:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: devicetree, dmitry.torokhov, eran.m, festevam, kernel,
	linux-arm-kernel, linux-imx, linux-input, pierluigi.p, robh+dt,
	s.hauer, shawnguo, u.kleine-koenig, mcontenti, Alifer Moraes

From: Eran Matityahu <eran.m@variscite.com>

On imx6qdl the interrupt only triggers on the release of the key.
Normally, the driver is looking for a change in the state of the key,
but since the interrupt triggers on release the key value is always 0,
so there was no event.

Add "key-release-only" boolean dts property to address this issue,
and create both key press and key release events when the key
is actually released.

Signed-off-by: Eran Matityahu <eran.m@variscite.com>
Signed-off-by: mcontenti <marco.c@variscite.com>
Signed-off-by: Alifer Moraes <alifer.m@variscite.com>
---
 arch/arm/boot/dts/imx6qdl.dtsi       |  1 +
 drivers/input/keyboard/snvs_pwrkey.c | 21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index d27beb47f9a3..9811e6bfd8e5 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -845,6 +845,7 @@ snvs_pwrkey: snvs-powerkey {
 					regmap = <&snvs>;
 					interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
 					linux,keycode = <KEY_POWER>;
+					key-release-only;
 					wakeup-source;
 					status = "disabled";
 				};
diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
index 65286762b02a..b558e6f898fa 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -66,6 +66,22 @@ static void imx_imx_snvs_check_for_events(struct timer_list *t)
 	}
 }
 
+static void imx_imx_snvs_check_for_release_events(struct timer_list *t)
+{
+	struct pwrkey_drv_data *pdata = from_timer(pdata, t, check_timer);
+	struct input_dev *input = pdata->input;
+	u32 state;
+
+	/* interrupt only reports release of key so do not wait for state change */
+	state = 1;
+	input_event(input, EV_KEY, pdata->keycode, state);
+	input_sync(input);
+
+	state = 0;
+	input_event(input, EV_KEY, pdata->keycode, state);
+	input_sync(input);
+}
+
 static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)
 {
 	struct platform_device *pdev = dev_id;
@@ -177,7 +193,10 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
 	/* clear the unexpected interrupt before driver ready */
 	regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
 
-	timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events, 0);
+	if (of_property_read_bool(np, "key-release-only"))
+		timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_release_events, 0);
+	else
+		timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events, 0);
 
 	input = devm_input_allocate_device(&pdev->dev);
 	if (!input) {
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH] input: keyboard: snvs_pwrkey: Add key-release-only
  2022-03-07 14:24 ` Alifer Moraes
@ 2022-03-08  1:16   ` Jacky Bai
  -1 siblings, 0 replies; 6+ messages in thread
From: Jacky Bai @ 2022-03-08  1:16 UTC (permalink / raw)
  To: Alifer Moraes, linux-kernel
  Cc: devicetree, dmitry.torokhov, eran.m, festevam, kernel,
	linux-arm-kernel, dl-linux-imx, linux-input, Pierluigi Passaro,
	robh+dt, s.hauer, shawnguo, u.kleine-koenig, mcontenti

> Subject: [PATCH] input: keyboard: snvs_pwrkey: Add key-release-only
> 
> From: Eran Matityahu <eran.m@variscite.com>
> 
> On imx6qdl the interrupt only triggers on the release of the key.
> Normally, the driver is looking for a change in the state of the key, but since the
> interrupt triggers on release the key value is always 0, so there was no event.
> 
> Add "key-release-only" boolean dts property to address this issue, and create
> both key press and key release events when the key is actually released.
> 
> Signed-off-by: Eran Matityahu <eran.m@variscite.com>
> Signed-off-by: mcontenti <marco.c@variscite.com>
> Signed-off-by: Alifer Moraes <alifer.m@variscite.com>
> ---
>  arch/arm/boot/dts/imx6qdl.dtsi       |  1 +
>  drivers/input/keyboard/snvs_pwrkey.c | 21 ++++++++++++++++++++-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
> index d27beb47f9a3..9811e6bfd8e5 100644
> --- a/arch/arm/boot/dts/imx6qdl.dtsi
> +++ b/arch/arm/boot/dts/imx6qdl.dtsi
> @@ -845,6 +845,7 @@ snvs_pwrkey: snvs-powerkey {
>  					regmap = <&snvs>;
>  					interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
>  					linux,keycode = <KEY_POWER>;
> +					key-release-only;
>  					wakeup-source;
>  					status = "disabled";
>  				};

dts changes should be in a separate patch.

BR
Jacky Bai
> diff --git a/drivers/input/keyboard/snvs_pwrkey.c
> b/drivers/input/keyboard/snvs_pwrkey.c
> index 65286762b02a..b558e6f898fa 100644
> --- a/drivers/input/keyboard/snvs_pwrkey.c
> +++ b/drivers/input/keyboard/snvs_pwrkey.c
> @@ -66,6 +66,22 @@ static void imx_imx_snvs_check_for_events(struct
> timer_list *t)
>  	}
>  }
> 
> +static void imx_imx_snvs_check_for_release_events(struct timer_list *t)
> +{
> +	struct pwrkey_drv_data *pdata = from_timer(pdata, t, check_timer);
> +	struct input_dev *input = pdata->input;
> +	u32 state;
> +
> +	/* interrupt only reports release of key so do not wait for state change */
> +	state = 1;
> +	input_event(input, EV_KEY, pdata->keycode, state);
> +	input_sync(input);
> +
> +	state = 0;
> +	input_event(input, EV_KEY, pdata->keycode, state);
> +	input_sync(input);
> +}
> +
>  static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)  {
>  	struct platform_device *pdev = dev_id; @@ -177,7 +193,10 @@ static int
> imx_snvs_pwrkey_probe(struct platform_device *pdev)
>  	/* clear the unexpected interrupt before driver ready */
>  	regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
> 
> -	timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events, 0);
> +	if (of_property_read_bool(np, "key-release-only"))
> +		timer_setup(&pdata->check_timer,
> imx_imx_snvs_check_for_release_events, 0);
> +	else
> +		timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events,
> 0);
> 
>  	input = devm_input_allocate_device(&pdev->dev);
>  	if (!input) {
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] input: keyboard: snvs_pwrkey: Add key-release-only
@ 2022-03-08  1:16   ` Jacky Bai
  0 siblings, 0 replies; 6+ messages in thread
From: Jacky Bai @ 2022-03-08  1:16 UTC (permalink / raw)
  To: Alifer Moraes, linux-kernel
  Cc: devicetree, dmitry.torokhov, eran.m, festevam, kernel,
	linux-arm-kernel, dl-linux-imx, linux-input, Pierluigi Passaro,
	robh+dt, s.hauer, shawnguo, u.kleine-koenig, mcontenti

> Subject: [PATCH] input: keyboard: snvs_pwrkey: Add key-release-only
> 
> From: Eran Matityahu <eran.m@variscite.com>
> 
> On imx6qdl the interrupt only triggers on the release of the key.
> Normally, the driver is looking for a change in the state of the key, but since the
> interrupt triggers on release the key value is always 0, so there was no event.
> 
> Add "key-release-only" boolean dts property to address this issue, and create
> both key press and key release events when the key is actually released.
> 
> Signed-off-by: Eran Matityahu <eran.m@variscite.com>
> Signed-off-by: mcontenti <marco.c@variscite.com>
> Signed-off-by: Alifer Moraes <alifer.m@variscite.com>
> ---
>  arch/arm/boot/dts/imx6qdl.dtsi       |  1 +
>  drivers/input/keyboard/snvs_pwrkey.c | 21 ++++++++++++++++++++-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
> index d27beb47f9a3..9811e6bfd8e5 100644
> --- a/arch/arm/boot/dts/imx6qdl.dtsi
> +++ b/arch/arm/boot/dts/imx6qdl.dtsi
> @@ -845,6 +845,7 @@ snvs_pwrkey: snvs-powerkey {
>  					regmap = <&snvs>;
>  					interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
>  					linux,keycode = <KEY_POWER>;
> +					key-release-only;
>  					wakeup-source;
>  					status = "disabled";
>  				};

dts changes should be in a separate patch.

BR
Jacky Bai
> diff --git a/drivers/input/keyboard/snvs_pwrkey.c
> b/drivers/input/keyboard/snvs_pwrkey.c
> index 65286762b02a..b558e6f898fa 100644
> --- a/drivers/input/keyboard/snvs_pwrkey.c
> +++ b/drivers/input/keyboard/snvs_pwrkey.c
> @@ -66,6 +66,22 @@ static void imx_imx_snvs_check_for_events(struct
> timer_list *t)
>  	}
>  }
> 
> +static void imx_imx_snvs_check_for_release_events(struct timer_list *t)
> +{
> +	struct pwrkey_drv_data *pdata = from_timer(pdata, t, check_timer);
> +	struct input_dev *input = pdata->input;
> +	u32 state;
> +
> +	/* interrupt only reports release of key so do not wait for state change */
> +	state = 1;
> +	input_event(input, EV_KEY, pdata->keycode, state);
> +	input_sync(input);
> +
> +	state = 0;
> +	input_event(input, EV_KEY, pdata->keycode, state);
> +	input_sync(input);
> +}
> +
>  static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)  {
>  	struct platform_device *pdev = dev_id; @@ -177,7 +193,10 @@ static int
> imx_snvs_pwrkey_probe(struct platform_device *pdev)
>  	/* clear the unexpected interrupt before driver ready */
>  	regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
> 
> -	timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events, 0);
> +	if (of_property_read_bool(np, "key-release-only"))
> +		timer_setup(&pdata->check_timer,
> imx_imx_snvs_check_for_release_events, 0);
> +	else
> +		timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events,
> 0);
> 
>  	input = devm_input_allocate_device(&pdev->dev);
>  	if (!input) {
> --
> 2.25.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] input: keyboard: snvs_pwrkey: Add key-release-only
  2022-03-08  1:16   ` Jacky Bai
@ 2022-03-08  1:43     ` Jacky Bai
  -1 siblings, 0 replies; 6+ messages in thread
From: Jacky Bai @ 2022-03-08  1:43 UTC (permalink / raw)
  To: Alifer Moraes, linux-kernel
  Cc: devicetree, dmitry.torokhov, eran.m, festevam, kernel,
	linux-arm-kernel, dl-linux-imx, linux-input, Pierluigi Passaro,
	robh+dt, s.hauer, shawnguo, u.kleine-koenig, mcontenti

> Subject: RE: [PATCH] input: keyboard: snvs_pwrkey: Add key-release-only
> 
> > Subject: [PATCH] input: keyboard: snvs_pwrkey: Add key-release-only
> >
> > From: Eran Matityahu <eran.m@variscite.com>
> >
> > On imx6qdl the interrupt only triggers on the release of the key.
> > Normally, the driver is looking for a change in the state of the key,
> > but since the interrupt triggers on release the key value is always 0, so there
> was no event.
> >
> > Add "key-release-only" boolean dts property to address this issue, and
> > create both key press and key release events when the key is actually released.
> >
> > Signed-off-by: Eran Matityahu <eran.m@variscite.com>
> > Signed-off-by: mcontenti <marco.c@variscite.com>
> > Signed-off-by: Alifer Moraes <alifer.m@variscite.com>
> > ---
> >  arch/arm/boot/dts/imx6qdl.dtsi       |  1 +
> >  drivers/input/keyboard/snvs_pwrkey.c | 21 ++++++++++++++++++++-
> >  2 files changed, 21 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/arm/boot/dts/imx6qdl.dtsi
> > b/arch/arm/boot/dts/imx6qdl.dtsi index d27beb47f9a3..9811e6bfd8e5
> > 100644
> > --- a/arch/arm/boot/dts/imx6qdl.dtsi
> > +++ b/arch/arm/boot/dts/imx6qdl.dtsi
> > @@ -845,6 +845,7 @@ snvs_pwrkey: snvs-powerkey {
> >  					regmap = <&snvs>;
> >  					interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
> >  					linux,keycode = <KEY_POWER>;
> > +					key-release-only;
> >  					wakeup-source;
> >  					status = "disabled";
> >  				};
> 
> dts changes should be in a separate patch.
> 
> BR
> Jacky Bai
> > diff --git a/drivers/input/keyboard/snvs_pwrkey.c
> > b/drivers/input/keyboard/snvs_pwrkey.c
> > index 65286762b02a..b558e6f898fa 100644
> > --- a/drivers/input/keyboard/snvs_pwrkey.c
> > +++ b/drivers/input/keyboard/snvs_pwrkey.c
> > @@ -66,6 +66,22 @@ static void imx_imx_snvs_check_for_events(struct
> > timer_list *t)
> >  	}
> >  }
> >
> > +static void imx_imx_snvs_check_for_release_events(struct timer_list
> > +*t) {
> > +	struct pwrkey_drv_data *pdata = from_timer(pdata, t, check_timer);
> > +	struct input_dev *input = pdata->input;
> > +	u32 state;
> > +
> > +	/* interrupt only reports release of key so do not wait for state change */
> > +	state = 1;
> > +	input_event(input, EV_KEY, pdata->keycode, state);
> > +	input_sync(input);
> > +
> > +	state = 0;
> > +	input_event(input, EV_KEY, pdata->keycode, state);
> > +	input_sync(input);
> > +}
> > +
> >  static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)  {
> >  	struct platform_device *pdev = dev_id; @@ -177,7 +193,10 @@ static
> > int imx_snvs_pwrkey_probe(struct platform_device *pdev)
> >  	/* clear the unexpected interrupt before driver ready */
> >  	regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
> >
> > -	timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events, 0);
> > +	if (of_property_read_bool(np, "key-release-only"))

And for older imx6qdl, there is a "emulate-press" property to handle the similar issue.
Why do you need to add a new property to handle the similar thing?

BR
Jacky Bai
> > +		timer_setup(&pdata->check_timer,
> > imx_imx_snvs_check_for_release_events, 0);
> > +	else
> > +		timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events,
> > 0);
> >
> >  	input = devm_input_allocate_device(&pdev->dev);
> >  	if (!input) {
> > --
> > 2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] input: keyboard: snvs_pwrkey: Add key-release-only
@ 2022-03-08  1:43     ` Jacky Bai
  0 siblings, 0 replies; 6+ messages in thread
From: Jacky Bai @ 2022-03-08  1:43 UTC (permalink / raw)
  To: Alifer Moraes, linux-kernel
  Cc: devicetree, dmitry.torokhov, eran.m, festevam, kernel,
	linux-arm-kernel, dl-linux-imx, linux-input, Pierluigi Passaro,
	robh+dt, s.hauer, shawnguo, u.kleine-koenig, mcontenti

> Subject: RE: [PATCH] input: keyboard: snvs_pwrkey: Add key-release-only
> 
> > Subject: [PATCH] input: keyboard: snvs_pwrkey: Add key-release-only
> >
> > From: Eran Matityahu <eran.m@variscite.com>
> >
> > On imx6qdl the interrupt only triggers on the release of the key.
> > Normally, the driver is looking for a change in the state of the key,
> > but since the interrupt triggers on release the key value is always 0, so there
> was no event.
> >
> > Add "key-release-only" boolean dts property to address this issue, and
> > create both key press and key release events when the key is actually released.
> >
> > Signed-off-by: Eran Matityahu <eran.m@variscite.com>
> > Signed-off-by: mcontenti <marco.c@variscite.com>
> > Signed-off-by: Alifer Moraes <alifer.m@variscite.com>
> > ---
> >  arch/arm/boot/dts/imx6qdl.dtsi       |  1 +
> >  drivers/input/keyboard/snvs_pwrkey.c | 21 ++++++++++++++++++++-
> >  2 files changed, 21 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/arm/boot/dts/imx6qdl.dtsi
> > b/arch/arm/boot/dts/imx6qdl.dtsi index d27beb47f9a3..9811e6bfd8e5
> > 100644
> > --- a/arch/arm/boot/dts/imx6qdl.dtsi
> > +++ b/arch/arm/boot/dts/imx6qdl.dtsi
> > @@ -845,6 +845,7 @@ snvs_pwrkey: snvs-powerkey {
> >  					regmap = <&snvs>;
> >  					interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
> >  					linux,keycode = <KEY_POWER>;
> > +					key-release-only;
> >  					wakeup-source;
> >  					status = "disabled";
> >  				};
> 
> dts changes should be in a separate patch.
> 
> BR
> Jacky Bai
> > diff --git a/drivers/input/keyboard/snvs_pwrkey.c
> > b/drivers/input/keyboard/snvs_pwrkey.c
> > index 65286762b02a..b558e6f898fa 100644
> > --- a/drivers/input/keyboard/snvs_pwrkey.c
> > +++ b/drivers/input/keyboard/snvs_pwrkey.c
> > @@ -66,6 +66,22 @@ static void imx_imx_snvs_check_for_events(struct
> > timer_list *t)
> >  	}
> >  }
> >
> > +static void imx_imx_snvs_check_for_release_events(struct timer_list
> > +*t) {
> > +	struct pwrkey_drv_data *pdata = from_timer(pdata, t, check_timer);
> > +	struct input_dev *input = pdata->input;
> > +	u32 state;
> > +
> > +	/* interrupt only reports release of key so do not wait for state change */
> > +	state = 1;
> > +	input_event(input, EV_KEY, pdata->keycode, state);
> > +	input_sync(input);
> > +
> > +	state = 0;
> > +	input_event(input, EV_KEY, pdata->keycode, state);
> > +	input_sync(input);
> > +}
> > +
> >  static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id)  {
> >  	struct platform_device *pdev = dev_id; @@ -177,7 +193,10 @@ static
> > int imx_snvs_pwrkey_probe(struct platform_device *pdev)
> >  	/* clear the unexpected interrupt before driver ready */
> >  	regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO);
> >
> > -	timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events, 0);
> > +	if (of_property_read_bool(np, "key-release-only"))

And for older imx6qdl, there is a "emulate-press" property to handle the similar issue.
Why do you need to add a new property to handle the similar thing?

BR
Jacky Bai
> > +		timer_setup(&pdata->check_timer,
> > imx_imx_snvs_check_for_release_events, 0);
> > +	else
> > +		timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events,
> > 0);
> >
> >  	input = devm_input_allocate_device(&pdev->dev);
> >  	if (!input) {
> > --
> > 2.25.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-08  2:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07 14:24 [PATCH] input: keyboard: snvs_pwrkey: Add key-release-only Alifer Moraes
2022-03-07 14:24 ` Alifer Moraes
2022-03-08  1:16 ` Jacky Bai
2022-03-08  1:16   ` Jacky Bai
2022-03-08  1:43   ` Jacky Bai
2022-03-08  1:43     ` Jacky Bai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.