diff options
author | Hans de Goede <hdegoede@redhat.com> | 2015-06-24 17:25:54 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-06-24 17:55:53 -0400 |
commit | eeeee40fcc3f92745639cfb166854656dddeb040 (patch) | |
tree | 4a842eec593de3d68a0a31f4dc3ab57d2ad3e893 | |
parent | cae705baa40b2c20de8f9bb79ef4bcc6b2418c7c (diff) |
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.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Carlo Caione <carlo@caione.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/misc/axp20x-pek.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c index f1c844739cd7..10e140af5aac 100644 --- a/drivers/input/misc/axp20x-pek.c +++ b/drivers/input/misc/axp20x-pek.c | |||
@@ -167,9 +167,13 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr) | |||
167 | struct input_dev *idev = pwr; | 167 | struct input_dev *idev = pwr; |
168 | struct axp20x_pek *axp20x_pek = input_get_drvdata(idev); | 168 | struct axp20x_pek *axp20x_pek = input_get_drvdata(idev); |
169 | 169 | ||
170 | if (irq == axp20x_pek->irq_dbr) | 170 | /* |
171 | * The power-button is connected to ground so a falling edge (dbf) | ||
172 | * means it is pressed. | ||
173 | */ | ||
174 | if (irq == axp20x_pek->irq_dbf) | ||
171 | input_report_key(idev, KEY_POWER, true); | 175 | input_report_key(idev, KEY_POWER, true); |
172 | else if (irq == axp20x_pek->irq_dbf) | 176 | else if (irq == axp20x_pek->irq_dbr) |
173 | input_report_key(idev, KEY_POWER, false); | 177 | input_report_key(idev, KEY_POWER, false); |
174 | 178 | ||
175 | input_sync(idev); | 179 | input_sync(idev); |