880-v6.3-mfd-axp20x-Fix-order-of-pek-rise-and-fall-events.patch 2.7 KB

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