input: axp20x-pek: Fix reporting button state as inverted
Subsystems (3)
PATCH 1/1 input: axp20x-pek: Fix reporting button state as inverted
Currently we are reporting the button state as inverted on all boards with an axp209 pmic, tested on a ba10-tvbox, bananapi, bananapro, cubietruck and utoo-p66 tablet.
The axp209 datasheet clearly states that the power button must be connected between the PWRON key and ground. Which means that on a press we will get a falling edge (dbf) irq not a rising one, and likewise on release we will get a rising edge (dbr) irq, not a falling one.
This commit swaps the check for the 2 irqs fixing the inverted reporting of the power button state.
--- drivers/input/misc/axp20x-pek.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/input/misc/axp20x-pek.c +6 -2
@@ -167,9 +167,13 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)struct input_dev *idev = pwr;struct axp20x_pek *axp20x_pek =input_get_drvdata (idev); -if (irq == axp20x_pek->irq_dbr) +/* +* The power-button is connected to ground so a falling edge (dbf) +* means it is pressed. +*/ +if (irq == axp20x_pek->irq_dbf)input_report_key (idev,KEY_POWER , true); -else if (irq == axp20x_pek->irq_dbf) +else if (irq == axp20x_pek->irq_dbr)input_report_key (idev,KEY_POWER , false);input_sync (idev);
Signature · 1 line
2.4.3
Dmitry Torokhov
maintainerPATCH 1/1 input: axp20x-pek: Fix reporting button state as inverted
Quoted 9 lines · Hans de Goede
Currently we are reporting the button state as inverted on all boards with an axp209 pmic, tested on a ba10-tvbox, bananapi, bananapro, cubietruck and utoo-p66 tablet.
The axp209 datasheet clearly states that the power button must be connected between the PWRON key and ground. Which means that on a press we will get a falling edge (dbf) irq not a rising one, and likewise on release we will get a rising edge (dbr) irq, not a falling one.
Quoted 4 lines
This commit swaps the check for the 2 irqs fixing the inverted reporting of the power button state.
Signed-off-by Hans de Goede <[email protected]>
Carlo, Chen-Yu, could you please give this patch a spin and let us know if it works on your boards?
Thanks!
Quoted 27 lines
--- drivers/input/misc/axp20x-pek.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/input/misc/axp20x-pek.c +6
-2@@ -167,9 +167,13 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)struct input_dev *idev = pwr;struct axp20x_pek *axp20x_pek =input_get_drvdata (idev); -if (irq == axp20x_pek->irq_dbr) +/* +* The power-button is connected to ground so a falling edge (dbf) +* means it is pressed. +*/ +if (irq == axp20x_pek->irq_dbf)input_report_key (idev,KEY_POWER , true); -else if (irq == axp20x_pek->irq_dbf) +else if (irq == axp20x_pek->irq_dbr)input_report_key (idev,KEY_POWER , false);input_sync (idev);Signature · 1 line
2.4.3
Signature · 1 line
Dmitry
Quoted 10 lines · Dmitry Torokhov
Quoted 9 lines · Hans de Goede
Currently we are reporting the button state as inverted on all boards with an axp209 pmic, tested on a ba10-tvbox, bananapi, bananapro, cubietruck and utoo-p66 tablet.
The axp209 datasheet clearly states that the power button must be connected between the PWRON key and ground. Which means that on a press we will get a falling edge (dbf) irq not a rising one, and likewise on release we will get a rising edge (dbr) irq, not a falling one.
Quoted 7 lines
Quoted 4 lines
This commit swaps the check for the 2 irqs fixing the inverted reporting of the power button state.
Signed-off-by Hans de Goede <[email protected]>Carlo, Chen-Yu, could you please give this patch a spin and let us know if it works on your boards?
I've not actually tested this patch on my boards, but I can confirm that the original code had the state inverted, by checking /proc/interrupts counters, before and after releasing the power button.
Quoted 37 lines
Thanks!
Quoted 25 lines
--- drivers/input/misc/axp20x-pek.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/input/misc/axp20x-pek.c +6
-3@@ -167,9 +167,13 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)struct input_dev *idev = pwr;struct axp20x_pek *axp20x_pek =input_get_drvdata (idev); -if (irq == axp20x_pek->irq_dbr) +/* +* The power-button is connected to ground so a falling edge (dbf) +* means it is pressed. +*/ +if (irq == axp20x_pek->irq_dbf)input_report_key (idev,KEY_POWER , true); -else if (irq == axp20x_pek->irq_dbf) +else if (irq == axp20x_pek->irq_dbr)input_report_key (idev,KEY_POWER , false);input_sync (idev); --Quoted 2 lines
2.4.3
--
Dmitry--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Carlo Caione
Acked-byQuoted 17 lines · Chen-Yu Tsai
Quoted 15 lines · Dmitry Torokhov
Quoted 13 lines · Hans de Goede
Currently we are reporting the button state as inverted on all boards with an axp209 pmic, tested on a ba10-tvbox, bananapi, bananapro, cubietruck and utoo-p66 tablet.
The axp209 datasheet clearly states that the power button must be connected between the PWRON key and ground. Which means that on a press we will get a falling edge (dbf) irq not a rising one, and likewise on release we will get a rising edge (dbr) irq, not a falling one.
This commit swaps the check for the 2 irqs fixing the inverted reporting of the power button state.
Signed-off-by Hans de Goede <[email protected]>
Quoted 8 lines
Quoted 2 lines
Carlo, Chen-Yu, could you please give this patch a spin and let us know if it works on your boards?
I've not actually tested this patch on my boards, but I can confirm that the original code had the state inverted, by checking
/proc/interruptscounters, before and after releasing the power button.Acked-by Chen-Yu Tsai <[email protected]>
Same here (I don't have the board anymore)
Signature · 1 line
Carlo Caione
Quoted 25 lines · Carlo Caione
Quoted 24 lines · Chen-Yu Tsai
Quoted 10 lines · Dmitry Torokhov
Quoted 9 lines · Hans de Goede
Currently we are reporting the button state as inverted on all boards with an axp209 pmic, tested on a ba10-tvbox, bananapi, bananapro, cubietruck and utoo-p66 tablet.
The axp209 datasheet clearly states that the power button must be connected between the PWRON key and ground. Which means that on a press we will get a falling edge (dbf) irq not a rising one, and likewise on release we will get a rising edge (dbr) irq, not a falling one.
Quoted 7 lines
Quoted 4 lines
This commit swaps the check for the 2 irqs fixing the inverted reporting of the power button state.
Signed-off-by Hans de Goede <[email protected]>Carlo, Chen-Yu, could you please give this patch a spin and let us know if it works on your boards?
I've not actually tested this patch on my boards, but I can confirm that the original code had the state inverted, by checking
/proc/interruptscounters, before and after releasing the power button.
Quoted 5 lines
Quoted 1 line
Acked-by Chen-Yu Tsai <[email protected]>Same here (I don't have the board anymore)
Acked-by Carlo Caione <[email protected]>
Applied, thank you.
Signature · 1 line
Dmitry