summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2017-06-02 20:18:47 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-06-02 20:53:19 -0400
commit8d4b31376974855cd4fb176e5d63ba8e0407928e (patch)
treed3fa2356a1aa37333f33087fbade8aec1f075fdd
parenteadcbfa58ae8693f0d6a0f591d8f51d55cf068e1 (diff)
Input: axp20x-pek - only check for "INTCFD9" ACPI device on Cherry Trail
Commit 9b13a4ca8d2c ("Input: axp20x-pek - do not register input device on some systems") added a check for the INTCFD9 ACPI device which also handles the powerbutton as on some systems the powerbutton is connected to both the PMIC, handled by axp20x-pek, and to a gpio on the SoC, handled by soc_button_array which attaches itself to the INTCFD9 ACPI device. Testing + comparing DSDTs has shown that this only happens on Cherry Trail devices with an AXP288 PMIC, the AXP288 PMIC is also used on Bay Trail devices but there the power button is only connected to the PMIC and not handled by soc_button_array. This means that the INTCFD9 check has caused a regression on Bay Trail devices, causing power-button presses to no longer be seen. This commit fixes this by limiting the check to devices where the ACPI node for the AXP288 contains a _HRV (hardware revision) attribute with a value of 3 which indicates we are dealing with a Cherry Trail platform. Fixes: 9b13a4ca8d2c ("Input: axp20x-pek - do not register input ...") Reported-by: Сергей Трусов <t.rus76@ya.ru> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/misc/axp20x-pek.c43
1 files changed, 36 insertions, 7 deletions
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
index f11807db6979..c0a763a70a00 100644
--- a/drivers/input/misc/axp20x-pek.c
+++ b/drivers/input/misc/axp20x-pek.c
@@ -256,6 +256,41 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
256 return 0; 256 return 0;
257} 257}
258 258
259#ifdef CONFIG_ACPI
260static bool axp20x_pek_should_register_input(struct axp20x_pek *axp20x_pek,
261 struct platform_device *pdev)
262{
263 unsigned long long hrv = 0;
264 acpi_status status;
265
266 if (IS_ENABLED(CONFIG_INPUT_SOC_BUTTON_ARRAY) &&
267 axp20x_pek->axp20x->variant == AXP288_ID) {
268 status = acpi_evaluate_integer(ACPI_HANDLE(pdev->dev.parent),
269 "_HRV", NULL, &hrv);
270 if (ACPI_FAILURE(status))
271 dev_err(&pdev->dev, "Failed to get PMIC hardware revision\n");
272
273 /*
274 * On Cherry Trail platforms (hrv == 3), do not register the
275 * input device if there is an "INTCFD9" gpio
276 * button ACPI device, as that handles the power button too,
277 * and otherwise we end up reporting all presses twice.
278 */
279 if (hrv == 3 && acpi_dev_found("INTCFD9"))
280 return false;
281
282 }
283
284 return true;
285}
286#else
287static bool axp20x_pek_should_register_input(struct axp20x_pek *axp20x_pek,
288 struct platform_device *pdev)
289{
290 return true;
291}
292#endif
293
259static int axp20x_pek_probe(struct platform_device *pdev) 294static int axp20x_pek_probe(struct platform_device *pdev)
260{ 295{
261 struct axp20x_pek *axp20x_pek; 296 struct axp20x_pek *axp20x_pek;
@@ -268,13 +303,7 @@ static int axp20x_pek_probe(struct platform_device *pdev)
268 303
269 axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent); 304 axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent);
270 305
271 /* 306 if (axp20x_pek_should_register_input(axp20x_pek, pdev)) {
272 * Do not register the input device if there is an "INTCFD9"
273 * gpio button ACPI device, that handles the power button too,
274 * and otherwise we end up reporting all presses twice.
275 */
276 if (!acpi_dev_found("INTCFD9") ||
277 !IS_ENABLED(CONFIG_INPUT_SOC_BUTTON_ARRAY)) {
278 error = axp20x_pek_probe_input_device(axp20x_pek, pdev); 307 error = axp20x_pek_probe_input_device(axp20x_pek, pdev);
279 if (error) 308 if (error)
280 return error; 309 return error;