diff options
| author | Anthony Olech <anthony.olech.opensource@diasemi.com> | 2014-02-17 14:23:39 -0500 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-02-17 14:29:01 -0500 |
| commit | 70b0052425ffd549bb27fb08649a4d30daaf40e4 (patch) | |
| tree | 8c5fd35e8209f2cb4eeb4542fea8782b54f4e88c /drivers/input/misc | |
| parent | 910a9f5636f5c128c02bf9ccd71ac03325700b57 (diff) | |
Input: da9052_onkey - use correct register bit for key status
The wrong register bit of the DA9052/3 PMIC registers was
used to determine the status on the ONKEY.
Also a failure in reading the status register will no longer
result in the work queue being rescheduled as that would result
in a (potentially) endless retry.
Signed-off-by: Anthony Olech <anthony.olech.opensource@diasemi.com>
Acked-by: David Dajun Chen <david.chen@diasemi.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/misc')
| -rw-r--r-- | drivers/input/misc/da9052_onkey.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/input/misc/da9052_onkey.c b/drivers/input/misc/da9052_onkey.c index 1f695f229ea8..184c8f21ab59 100644 --- a/drivers/input/misc/da9052_onkey.c +++ b/drivers/input/misc/da9052_onkey.c | |||
| @@ -27,29 +27,32 @@ struct da9052_onkey { | |||
| 27 | 27 | ||
| 28 | static void da9052_onkey_query(struct da9052_onkey *onkey) | 28 | static void da9052_onkey_query(struct da9052_onkey *onkey) |
| 29 | { | 29 | { |
| 30 | int key_stat; | 30 | int ret; |
| 31 | 31 | ||
| 32 | key_stat = da9052_reg_read(onkey->da9052, DA9052_EVENT_B_REG); | 32 | ret = da9052_reg_read(onkey->da9052, DA9052_STATUS_A_REG); |
| 33 | if (key_stat < 0) { | 33 | if (ret < 0) { |
| 34 | dev_err(onkey->da9052->dev, | 34 | dev_err(onkey->da9052->dev, |
| 35 | "Failed to read onkey event %d\n", key_stat); | 35 | "Failed to read onkey event err=%d\n", ret); |
| 36 | } else { | 36 | } else { |
| 37 | /* | 37 | /* |
| 38 | * Since interrupt for deassertion of ONKEY pin is not | 38 | * Since interrupt for deassertion of ONKEY pin is not |
| 39 | * generated, onkey event state determines the onkey | 39 | * generated, onkey event state determines the onkey |
| 40 | * button state. | 40 | * button state. |
| 41 | */ | 41 | */ |
| 42 | key_stat &= DA9052_EVENTB_ENONKEY; | 42 | bool pressed = !(ret & DA9052_STATUSA_NONKEY); |
| 43 | input_report_key(onkey->input, KEY_POWER, key_stat); | 43 | |
| 44 | input_report_key(onkey->input, KEY_POWER, pressed); | ||
| 44 | input_sync(onkey->input); | 45 | input_sync(onkey->input); |
| 45 | } | ||
| 46 | 46 | ||
| 47 | /* | 47 | /* |
| 48 | * Interrupt is generated only when the ONKEY pin is asserted. | 48 | * Interrupt is generated only when the ONKEY pin |
| 49 | * Hence the deassertion of the pin is simulated through work queue. | 49 | * is asserted. Hence the deassertion of the pin |
| 50 | */ | 50 | * is simulated through work queue. |
| 51 | if (key_stat) | 51 | */ |
| 52 | schedule_delayed_work(&onkey->work, msecs_to_jiffies(50)); | 52 | if (pressed) |
| 53 | schedule_delayed_work(&onkey->work, | ||
| 54 | msecs_to_jiffies(50)); | ||
| 55 | } | ||
| 53 | } | 56 | } |
| 54 | 57 | ||
| 55 | static void da9052_onkey_work(struct work_struct *work) | 58 | static void da9052_onkey_work(struct work_struct *work) |
