diff mbox

[V2] input: da9063: report KEY_POWER instead of KEY_SLEEP during power key-press

Message ID 20151210093632.5DF333FBD7@swsrvapps-01.diasemi.com (mailing list archive)
State Accepted
Headers show

Commit Message

Steve Twiss Dec. 10, 2015, 9:37 a.m. UTC
From: Steve Twiss <stwiss.opensource@diasemi.com>

Stop reporting KEY_SLEEP for a short key-press and report KEY_POWER instead
This change applies to both DA9063 and DA9062 ONKEY drivers.

A previous application used for testing by the developer required a KEY_SLEEP
and KEY_POWER input_report_key event to distinguish between a short and
long key-press of the power key.
This is not the general convention and the typical solution is for KEY_POWER
to be used in both cases: suspend and S/W power off.

Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>

---
This patch applies against linux-next and v4.4-rc4

Dmitry,

Now I realise what you meant in a previous review of this driver.

- https://lkml.org/lkml/2015/4/17/618
> Why do we handle KEY_POWER and KEY_SLEEP completely differently?

Because my testing assumed KEY_SLEEP was linked to suspend and KEY_POWER was
linked to S/W power off

- https://lkml.org/lkml/2015/4/29/406
> (1) short press & release -- SLEEP
> (2) long press & release -- POWER

This change removes the reporting of KEY_SLEEP that was specific to my test
framework and replaces it with the intended KEY_POWER.

Regards,
Steve Twiss, Dialog Semiconductor Ltd.


 drivers/input/misc/da9063_onkey.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Steve Twiss Dec. 14, 2015, 10:28 a.m. UTC | #1
Regarding:
> To: Dmitry Torokhov; LINUX-INPUT; LINUXKERNEL
> Subject: [PATCH V2] input: da9063: report KEY_POWER instead of KEY_SLEEP during power key-press

Hi Dmitry,
Thanks for your Signed-off-by and merge.
Regards,
Steve

repo linux-next
tag next-20151214
commit f889beaaab1ce2ff9d018302359abb345f49be29
Author: Steve Twiss <stwiss.opensource@diasemi.com>
Date:   Sat Dec 12 20:43:35 2015 -0800

    Input: da9063 - report KEY_POWER instead of KEY_SLEEP during power key-press
    
    Stop reporting KEY_SLEEP for a short key-press and report KEY_POWER instead
    This change applies to both DA9063 and DA9062 ONKEY drivers.
    
    A previous application used for testing by the developer required a
    KEY_SLEEP and KEY_POWER input_report_key event to distinguish between a
    short and long key-press of the power key.  This is not the general
    convention and the typical solution is for KEY_POWER to be used in both
    cases: suspend and S/W power off.
    
    Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/input/misc/da9063_onkey.c b/drivers/input/misc/da9063_onkey.c
index 8eb697d..bb863e0 100644
--- a/drivers/input/misc/da9063_onkey.c
+++ b/drivers/input/misc/da9063_onkey.c
@@ -179,13 +179,13 @@  static irqreturn_t da9063_onkey_irq_handler(int irq, void *data)
 		input_report_key(onkey->input, KEY_POWER, 1);
 		input_sync(onkey->input);
 		schedule_delayed_work(&onkey->work, 0);
-		dev_dbg(onkey->dev, "KEY_POWER pressed.\n");
+		dev_dbg(onkey->dev, "KEY_POWER long press.\n");
 	} else {
-		input_report_key(onkey->input, KEY_SLEEP, 1);
+		input_report_key(onkey->input, KEY_POWER, 1);
 		input_sync(onkey->input);
-		input_report_key(onkey->input, KEY_SLEEP, 0);
+		input_report_key(onkey->input, KEY_POWER, 0);
 		input_sync(onkey->input);
-		dev_dbg(onkey->dev, "KEY_SLEEP pressed.\n");
+		dev_dbg(onkey->dev, "KEY_POWER short press.\n");
 	}
 
 	return IRQ_HANDLED;