linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mfd: axp20x: fix order of pek rise and fall events
@ 2022-12-08 22:02 Aren Moynihan
  2022-12-09  7:49 ` Chen-Yu Tsai
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Aren Moynihan @ 2022-12-08 22:02 UTC (permalink / raw)
  To: Lee Jones, Chen-Yu Tsai, linux-kernel
  Cc: Ondrej Jirman, Samuel Holland, Aren Moynihan

The power button can get "stuck" if the rising edge and falling edge irq
are read in the same pass. This can often be triggered when resuming
from suspend if the power button is released before the kernel handles
the interrupt.

Swapping the order of the rise and fall events makes sure that the press
event is handled first, which prevents this situation.

Signed-off-by: Aren Moynihan <aren@peacevolution.org>
---
changes in v2:
  - add comments describing the reason these are out of bit order

previous version:
https://lore.kernel.org/lkml/20221123230741.2430813-1-aren@peacevolution.org/T/

 include/linux/mfd/axp20x.h | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 9ab0e2fca7ea..2058194807bd 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -432,8 +432,9 @@ enum {
 	AXP152_IRQ_PEK_SHORT,
 	AXP152_IRQ_PEK_LONG,
 	AXP152_IRQ_TIMER,
-	AXP152_IRQ_PEK_RIS_EDGE,
+	/* out of bit order to make sure the press event is handled first */
 	AXP152_IRQ_PEK_FAL_EDGE,
+	AXP152_IRQ_PEK_RIS_EDGE,
 	AXP152_IRQ_GPIO3_INPUT,
 	AXP152_IRQ_GPIO2_INPUT,
 	AXP152_IRQ_GPIO1_INPUT,
@@ -472,8 +473,9 @@ enum {
 	AXP20X_IRQ_LOW_PWR_LVL1,
 	AXP20X_IRQ_LOW_PWR_LVL2,
 	AXP20X_IRQ_TIMER,
-	AXP20X_IRQ_PEK_RIS_EDGE,
+	/* out of bit order to make sure the press event is handled first */
 	AXP20X_IRQ_PEK_FAL_EDGE,
+	AXP20X_IRQ_PEK_RIS_EDGE,
 	AXP20X_IRQ_GPIO3_INPUT,
 	AXP20X_IRQ_GPIO2_INPUT,
 	AXP20X_IRQ_GPIO1_INPUT,
@@ -502,8 +504,9 @@ enum axp22x_irqs {
 	AXP22X_IRQ_LOW_PWR_LVL1,
 	AXP22X_IRQ_LOW_PWR_LVL2,
 	AXP22X_IRQ_TIMER,
-	AXP22X_IRQ_PEK_RIS_EDGE,
+	/* out of bit order to make sure the press event is handled first */
 	AXP22X_IRQ_PEK_FAL_EDGE,
+	AXP22X_IRQ_PEK_RIS_EDGE,
 	AXP22X_IRQ_GPIO1_INPUT,
 	AXP22X_IRQ_GPIO0_INPUT,
 };
@@ -571,8 +574,9 @@ enum axp803_irqs {
 	AXP803_IRQ_LOW_PWR_LVL1,
 	AXP803_IRQ_LOW_PWR_LVL2,
 	AXP803_IRQ_TIMER,
-	AXP803_IRQ_PEK_RIS_EDGE,
+	/* out of bit order to make sure the press event is handled first */
 	AXP803_IRQ_PEK_FAL_EDGE,
+	AXP803_IRQ_PEK_RIS_EDGE,
 	AXP803_IRQ_PEK_SHORT,
 	AXP803_IRQ_PEK_LONG,
 	AXP803_IRQ_PEK_OVER_OFF,
@@ -623,8 +627,9 @@ enum axp809_irqs {
 	AXP809_IRQ_LOW_PWR_LVL1,
 	AXP809_IRQ_LOW_PWR_LVL2,
 	AXP809_IRQ_TIMER,
-	AXP809_IRQ_PEK_RIS_EDGE,
+	/* out of bit order to make sure the press event is handled first */
 	AXP809_IRQ_PEK_FAL_EDGE,
+	AXP809_IRQ_PEK_RIS_EDGE,
 	AXP809_IRQ_PEK_SHORT,
 	AXP809_IRQ_PEK_LONG,
 	AXP809_IRQ_PEK_OVER_OFF,
-- 
2.38.1


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

* Re: [PATCH v2] mfd: axp20x: fix order of pek rise and fall events
  2022-12-08 22:02 [PATCH v2] mfd: axp20x: fix order of pek rise and fall events Aren Moynihan
@ 2022-12-09  7:49 ` Chen-Yu Tsai
  2022-12-28  3:56 ` Samuel Holland
  2023-01-03 12:20 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Chen-Yu Tsai @ 2022-12-09  7:49 UTC (permalink / raw)
  To: Aren Moynihan; +Cc: Lee Jones, linux-kernel, Ondrej Jirman, Samuel Holland

On Fri, Dec 9, 2022 at 6:20 AM Aren Moynihan <aren@peacevolution.org> wrote:
>
> The power button can get "stuck" if the rising edge and falling edge irq
> are read in the same pass. This can often be triggered when resuming
> from suspend if the power button is released before the kernel handles
> the interrupt.
>
> Swapping the order of the rise and fall events makes sure that the press
> event is handled first, which prevents this situation.
>
> Signed-off-by: Aren Moynihan <aren@peacevolution.org>

Acked-by: Chen-Yu Tsai <wens@csie.org>

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

* Re: [PATCH v2] mfd: axp20x: fix order of pek rise and fall events
  2022-12-08 22:02 [PATCH v2] mfd: axp20x: fix order of pek rise and fall events Aren Moynihan
  2022-12-09  7:49 ` Chen-Yu Tsai
@ 2022-12-28  3:56 ` Samuel Holland
  2023-01-03 12:20 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Samuel Holland @ 2022-12-28  3:56 UTC (permalink / raw)
  To: Aren Moynihan, Lee Jones; +Cc: Ondrej Jirman, linux-kernel, Chen-Yu Tsai

On 12/8/22 16:02, Aren Moynihan wrote:
> The power button can get "stuck" if the rising edge and falling edge irq
> are read in the same pass. This can often be triggered when resuming
> from suspend if the power button is released before the kernel handles
> the interrupt.
> 
> Swapping the order of the rise and fall events makes sure that the press
> event is handled first, which prevents this situation.
> 
> Signed-off-by: Aren Moynihan <aren@peacevolution.org>
> ---
> changes in v2:
>   - add comments describing the reason these are out of bit order
> 
> previous version:
> https://lore.kernel.org/lkml/20221123230741.2430813-1-aren@peacevolution.org/T/
> 
>  include/linux/mfd/axp20x.h | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)

Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>


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

* Re: [PATCH v2] mfd: axp20x: fix order of pek rise and fall events
  2022-12-08 22:02 [PATCH v2] mfd: axp20x: fix order of pek rise and fall events Aren Moynihan
  2022-12-09  7:49 ` Chen-Yu Tsai
  2022-12-28  3:56 ` Samuel Holland
@ 2023-01-03 12:20 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2023-01-03 12:20 UTC (permalink / raw)
  To: Aren Moynihan; +Cc: Chen-Yu Tsai, linux-kernel, Ondrej Jirman, Samuel Holland

On Thu, 08 Dec 2022, Aren Moynihan wrote:

> The power button can get "stuck" if the rising edge and falling edge irq
> are read in the same pass. This can often be triggered when resuming
> from suspend if the power button is released before the kernel handles
> the interrupt.
> 
> Swapping the order of the rise and fall events makes sure that the press
> event is handled first, which prevents this situation.
> 
> Signed-off-by: Aren Moynihan <aren@peacevolution.org>
> ---
> changes in v2:
>   - add comments describing the reason these are out of bit order
> 
> previous version:
> https://lore.kernel.org/lkml/20221123230741.2430813-1-aren@peacevolution.org/T/
> 
>  include/linux/mfd/axp20x.h | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)

Applied, thanks

-- 
Lee Jones [李琼斯]

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

end of thread, other threads:[~2023-01-03 12:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08 22:02 [PATCH v2] mfd: axp20x: fix order of pek rise and fall events Aren Moynihan
2022-12-09  7:49 ` Chen-Yu Tsai
2022-12-28  3:56 ` Samuel Holland
2023-01-03 12:20 ` Lee Jones

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).