Skip to content

Commit 5ecc1e9

Browse files
committed
Input: axp20x-pek - Use new soc_intel_is_cht() helper
Use the new soc_intel_is_cht() helper to find out if we are running on a CHT device rather then checking the ACPI _HRV field. This is more reliable (some CHT devices have been found where the _HRV for the PMIC is 2 rather then 3) and leads to a nice cleanup. Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 693841b commit 5ecc1e9

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

drivers/input/misc/axp20x-pek.c

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/kernel.h>
2323
#include <linux/mfd/axp20x.h>
2424
#include <linux/module.h>
25+
#include <linux/platform_data/x86/soc.h>
2526
#include <linux/platform_device.h>
2627
#include <linux/regmap.h>
2728
#include <linux/slab.h>
@@ -255,41 +256,24 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
255256
return 0;
256257
}
257258

258-
#ifdef CONFIG_ACPI
259-
static bool axp20x_pek_should_register_input(struct axp20x_pek *axp20x_pek,
260-
struct platform_device *pdev)
259+
static bool axp20x_pek_should_register_input(struct axp20x_pek *axp20x_pek)
261260
{
262-
unsigned long long hrv = 0;
263-
acpi_status status;
264-
265261
if (IS_ENABLED(CONFIG_INPUT_SOC_BUTTON_ARRAY) &&
266262
axp20x_pek->axp20x->variant == AXP288_ID) {
267-
status = acpi_evaluate_integer(ACPI_HANDLE(pdev->dev.parent),
268-
"_HRV", NULL, &hrv);
269-
if (ACPI_FAILURE(status))
270-
dev_err(&pdev->dev, "Failed to get PMIC hardware revision\n");
271-
272263
/*
273264
* On Cherry Trail platforms (hrv == 3), do not register the
274265
* input device if there is an "INTCFD9" or "ACPI0011" gpio
275266
* button ACPI device, as that handles the power button too,
276267
* and otherwise we end up reporting all presses twice.
277268
*/
278-
if (hrv == 3 && (acpi_dev_present("INTCFD9", NULL, -1) ||
269+
if (soc_intel_is_cht() &&
270+
(acpi_dev_present("INTCFD9", NULL, -1) ||
279271
acpi_dev_present("ACPI0011", NULL, -1)))
280272
return false;
281-
282273
}
283274

284275
return true;
285276
}
286-
#else
287-
static bool axp20x_pek_should_register_input(struct axp20x_pek *axp20x_pek,
288-
struct platform_device *pdev)
289-
{
290-
return true;
291-
}
292-
#endif
293277

294278
static int axp20x_pek_probe(struct platform_device *pdev)
295279
{
@@ -321,7 +305,7 @@ static int axp20x_pek_probe(struct platform_device *pdev)
321305
axp20x_pek->irq_dbf = regmap_irq_get_virq(
322306
axp20x_pek->axp20x->regmap_irqc, axp20x_pek->irq_dbf);
323307

324-
if (axp20x_pek_should_register_input(axp20x_pek, pdev)) {
308+
if (axp20x_pek_should_register_input(axp20x_pek)) {
325309
error = axp20x_pek_probe_input_device(axp20x_pek, pdev);
326310
if (error)
327311
return error;

0 commit comments

Comments
 (0)