1 From 8781ba7f45695af3ab8e8d1b55a31f527c9201a3 Mon Sep 17 00:00:00 2001
2 From: Aren Moynihan <aren@peacevolution.org>
3 Date: Thu, 8 Dec 2022 17:02:26 -0500
4 Subject: [PATCH] mfd: axp20x: Fix order of pek rise and fall events
6 The power button can get "stuck" if the rising edge and falling edge irq
7 are read in the same pass. This can often be triggered when resuming
8 from suspend if the power button is released before the kernel handles
11 Swapping the order of the rise and fall events makes sure that the press
12 event is handled first, which prevents this situation.
14 Signed-off-by: Aren Moynihan <aren@peacevolution.org>
15 Reviewed-by: Samuel Holland <samuel@sholland.org>
16 Tested-by: Samuel Holland <samuel@sholland.org>
17 Acked-by: Chen-Yu Tsai <wens@csie.org>
18 Signed-off-by: Lee Jones <lee@kernel.org>
19 Link: https://lore.kernel.org/r/20221208220225.635414-1-aren@peacevolution.org
21 include/linux/mfd/axp20x.h | 15 ++++++++++-----
22 1 file changed, 10 insertions(+), 5 deletions(-)
24 --- a/include/linux/mfd/axp20x.h
25 +++ b/include/linux/mfd/axp20x.h
26 @@ -432,8 +432,9 @@ enum {
30 - AXP152_IRQ_PEK_RIS_EDGE,
31 + /* out of bit order to make sure the press event is handled first */
32 AXP152_IRQ_PEK_FAL_EDGE,
33 + AXP152_IRQ_PEK_RIS_EDGE,
34 AXP152_IRQ_GPIO3_INPUT,
35 AXP152_IRQ_GPIO2_INPUT,
36 AXP152_IRQ_GPIO1_INPUT,
37 @@ -472,8 +473,9 @@ enum {
38 AXP20X_IRQ_LOW_PWR_LVL1,
39 AXP20X_IRQ_LOW_PWR_LVL2,
41 - AXP20X_IRQ_PEK_RIS_EDGE,
42 + /* out of bit order to make sure the press event is handled first */
43 AXP20X_IRQ_PEK_FAL_EDGE,
44 + AXP20X_IRQ_PEK_RIS_EDGE,
45 AXP20X_IRQ_GPIO3_INPUT,
46 AXP20X_IRQ_GPIO2_INPUT,
47 AXP20X_IRQ_GPIO1_INPUT,
48 @@ -502,8 +504,9 @@ enum axp22x_irqs {
49 AXP22X_IRQ_LOW_PWR_LVL1,
50 AXP22X_IRQ_LOW_PWR_LVL2,
52 - AXP22X_IRQ_PEK_RIS_EDGE,
53 + /* out of bit order to make sure the press event is handled first */
54 AXP22X_IRQ_PEK_FAL_EDGE,
55 + AXP22X_IRQ_PEK_RIS_EDGE,
56 AXP22X_IRQ_GPIO1_INPUT,
57 AXP22X_IRQ_GPIO0_INPUT,
59 @@ -571,8 +574,9 @@ enum axp803_irqs {
60 AXP803_IRQ_LOW_PWR_LVL1,
61 AXP803_IRQ_LOW_PWR_LVL2,
63 - AXP803_IRQ_PEK_RIS_EDGE,
64 + /* out of bit order to make sure the press event is handled first */
65 AXP803_IRQ_PEK_FAL_EDGE,
66 + AXP803_IRQ_PEK_RIS_EDGE,
69 AXP803_IRQ_PEK_OVER_OFF,
70 @@ -623,8 +627,9 @@ enum axp809_irqs {
71 AXP809_IRQ_LOW_PWR_LVL1,
72 AXP809_IRQ_LOW_PWR_LVL2,
74 - AXP809_IRQ_PEK_RIS_EDGE,
75 + /* out of bit order to make sure the press event is handled first */
76 AXP809_IRQ_PEK_FAL_EDGE,
77 + AXP809_IRQ_PEK_RIS_EDGE,
80 AXP809_IRQ_PEK_OVER_OFF,