]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Input: axp20x-pek - only check for "INTCFD9" ACPI device on Cherry Trail
authorHans de Goede <hdegoede@redhat.com>
Sat, 3 Jun 2017 00:18:47 +0000 (17:18 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 3 Jun 2017 00:53:19 +0000 (17:53 -0700)
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>
drivers/input/misc/axp20x-pek.c

index f11807db69792a1c19661b6921caceee247fbaf5..c0a763a70a00a433c39e70d61e9e57d39e4fa6f8 100644 (file)
@@ -256,6 +256,41 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
        return 0;
 }
 
+#ifdef CONFIG_ACPI
+static bool axp20x_pek_should_register_input(struct axp20x_pek *axp20x_pek,
+                                            struct platform_device *pdev)
+{
+       unsigned long long hrv = 0;
+       acpi_status status;
+
+       if (IS_ENABLED(CONFIG_INPUT_SOC_BUTTON_ARRAY) &&
+           axp20x_pek->axp20x->variant == AXP288_ID) {
+               status = acpi_evaluate_integer(ACPI_HANDLE(pdev->dev.parent),
+                                              "_HRV", NULL, &hrv);
+               if (ACPI_FAILURE(status))
+                       dev_err(&pdev->dev, "Failed to get PMIC hardware revision\n");
+
+               /*
+                * On Cherry Trail platforms (hrv == 3), do not register the
+                * input device if there is an "INTCFD9" gpio
+                * button ACPI device, as that handles the power button too,
+                * and otherwise we end up reporting all presses twice.
+                */
+               if (hrv == 3 && acpi_dev_found("INTCFD9"))
+                       return false;
+
+       }
+
+       return true;
+}
+#else
+static bool axp20x_pek_should_register_input(struct axp20x_pek *axp20x_pek,
+                                            struct platform_device *pdev)
+{
+       return true;
+}
+#endif
+
 static int axp20x_pek_probe(struct platform_device *pdev)
 {
        struct axp20x_pek *axp20x_pek;
@@ -268,13 +303,7 @@ static int axp20x_pek_probe(struct platform_device *pdev)
 
        axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent);
 
-       /*
-        * Do not register the input device if there is an "INTCFD9"
-        * gpio button ACPI device, that handles the power button too,
-        * and otherwise we end up reporting all presses twice.
-        */
-       if (!acpi_dev_found("INTCFD9") ||
-           !IS_ENABLED(CONFIG_INPUT_SOC_BUTTON_ARRAY)) {
+       if (axp20x_pek_should_register_input(axp20x_pek, pdev)) {
                error = axp20x_pek_probe_input_device(axp20x_pek, pdev);
                if (error)
                        return error;