* [PATCH] input: axp20x-pek: Fix reporting button state as inverted
@ 2015-06-14 10:42 Hans de Goede
[not found] ` <1434278541-21355-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Hans de Goede @ 2015-06-14 10:42 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Ripard, Carlo Caione, Chen-Yu Tsai, linux-input,
linux-arm-kernel, devicetree, linux-sunxi, 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 <hdegoede@redhat.com>
---
drivers/input/misc/axp20x-pek.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
index f1c8447..10e140a 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)
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);
--
2.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] input: axp20x-pek: Fix reporting button state as inverted
[not found] ` <1434278541-21355-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-06-22 21:30 ` Dmitry Torokhov
2015-06-24 1:42 ` [linux-sunxi] " Chen-Yu Tsai
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2015-06-22 21:30 UTC (permalink / raw)
To: Hans de Goede
Cc: Maxime Ripard, Carlo Caione, Chen-Yu Tsai,
linux-input-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, devicetree,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
On Sun, Jun 14, 2015 at 12:42:21PM +0200, Hans de Goede wrote:
> 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-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Carlo, Chen-Yu, could you please give this patch a spin and let us know
if it works on your boards?
Thanks!
> ---
> drivers/input/misc/axp20x-pek.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
> index f1c8447..10e140a 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)
> 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);
> --
> 2.4.3
>
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [linux-sunxi] Re: [PATCH] input: axp20x-pek: Fix reporting button state as inverted
2015-06-22 21:30 ` Dmitry Torokhov
@ 2015-06-24 1:42 ` Chen-Yu Tsai
2015-06-24 9:19 ` Carlo Caione
0 siblings, 1 reply; 5+ messages in thread
From: Chen-Yu Tsai @ 2015-06-24 1:42 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Hans de Goede, Maxime Ripard, Carlo Caione, Chen-Yu Tsai,
linux-input@vger.kernel.org, linux-arm-kernel, devicetree,
linux-sunxi
On Tue, Jun 23, 2015 at 5:30 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Sun, Jun 14, 2015 at 12:42:21PM +0200, Hans de Goede wrote:
>> 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>
>
> 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.
Acked-by: Chen-Yu Tsai <wens@csie.org>
> Thanks!
>
>> ---
>> drivers/input/misc/axp20x-pek.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
>> index f1c8447..10e140a 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)
>> 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);
>> --
>> 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@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [linux-sunxi] Re: [PATCH] input: axp20x-pek: Fix reporting button state as inverted
2015-06-24 1:42 ` [linux-sunxi] " Chen-Yu Tsai
@ 2015-06-24 9:19 ` Carlo Caione
[not found] ` <CAOQ7t2a+3TvmgfW3dJBc=FJk1sXNAT+SE6qP0r5ovG7yx9fYHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Carlo Caione @ 2015-06-24 9:19 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: Dmitry Torokhov, Hans de Goede, Maxime Ripard, Carlo Caione,
linux-input@vger.kernel.org, linux-arm-kernel, devicetree,
linux-sunxi
On Wed, Jun 24, 2015 at 3:42 AM, Chen-Yu Tsai <wens@csie.org> wrote:
> On Tue, Jun 23, 2015 at 5:30 AM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
>> On Sun, Jun 14, 2015 at 12:42:21PM +0200, Hans de Goede wrote:
>>> 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>
>>
>> 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.
>
> Acked-by: Chen-Yu Tsai <wens@csie.org>
Same here (I don't have the board anymore)
Acked-by: Carlo Caione <carlo@caione.org>
--
Carlo Caione
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: [PATCH] input: axp20x-pek: Fix reporting button state as inverted
[not found] ` <CAOQ7t2a+3TvmgfW3dJBc=FJk1sXNAT+SE6qP0r5ovG7yx9fYHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-06-24 21:28 ` Dmitry Torokhov
0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2015-06-24 21:28 UTC (permalink / raw)
To: Carlo Caione
Cc: Chen-Yu Tsai, Hans de Goede, Maxime Ripard,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel, devicetree, linux-sunxi
On Wed, Jun 24, 2015 at 11:19:39AM +0200, Carlo Caione wrote:
> On Wed, Jun 24, 2015 at 3:42 AM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> > On Tue, Jun 23, 2015 at 5:30 AM, Dmitry Torokhov
> > <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >> On Sun, Jun 14, 2015 at 12:42:21PM +0200, Hans de Goede wrote:
> >>> 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-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> >>
> >> 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.
> >
> > Acked-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
>
> Same here (I don't have the board anymore)
>
> Acked-by: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-06-24 21:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-14 10:42 [PATCH] input: axp20x-pek: Fix reporting button state as inverted Hans de Goede
[not found] ` <1434278541-21355-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-06-22 21:30 ` Dmitry Torokhov
2015-06-24 1:42 ` [linux-sunxi] " Chen-Yu Tsai
2015-06-24 9:19 ` Carlo Caione
[not found] ` <CAOQ7t2a+3TvmgfW3dJBc=FJk1sXNAT+SE6qP0r5ovG7yx9fYHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-24 21:28 ` Dmitry Torokhov
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).