Skip to content

Commit 8a78050

Browse files
jwrdegoededtor
authored andcommitted
Input: axp20x-pek - revert "always register interrupt handlers" change
The power button on Cherry Trail systems with an AXP288 PMIC is connected to both the power button pin of the PMIC as well as to a power button GPIO on the Cherry Trail SoC itself. This leads to double power button event reporting which is a problem. Since reporting power button presses through the PMIC is not supported on all PMICs used on Cherry Trail systems, we want to keep the GPIO power button events, so the axp20x-pek code checks for the presence of a GPIO power button and in that case does not register its input-device. On most systems the GPIO power button also can wake-up the system from suspend, so the axp20x-pek driver would also not register its interrupt handler. But on some systems there was a bug causing wakeup by the GPIO power button handler to not work. Commit 9747070 ("Input: axp20x-pek - always register interrupt handlers") was added as a work around for this registering the axp20x-pek interrupts, but not the input-device on Cherry Trail systems. In the mean time the root-cause of the GPIO power button wakeup events not working has been found and fixed by the "pinctrl: cherryview: Do not allow the same interrupt line to be used by 2 pins" patch, so this is no longer necessary. This reverts the workaround going back to only registering the interrupt handlers on systems where we also register the input-device. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Link: https://lore.kernel.org/r/20220106111647.66520-1-hdegoede@redhat.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 08a6df0 commit 8a78050

1 file changed

Lines changed: 35 additions & 37 deletions

File tree

drivers/input/misc/axp20x-pek.c

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,8 @@ ATTRIBUTE_GROUPS(axp20x);
205205

206206
static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
207207
{
208-
struct axp20x_pek *axp20x_pek = pwr;
209-
struct input_dev *idev = axp20x_pek->input;
210-
211-
if (!idev)
212-
return IRQ_HANDLED;
208+
struct input_dev *idev = pwr;
209+
struct axp20x_pek *axp20x_pek = input_get_drvdata(idev);
213210

214211
/*
215212
* The power-button is connected to ground so a falling edge (dbf)
@@ -228,9 +225,22 @@ static irqreturn_t axp20x_pek_irq(int irq, void *pwr)
228225
static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
229226
struct platform_device *pdev)
230227
{
228+
struct axp20x_dev *axp20x = axp20x_pek->axp20x;
231229
struct input_dev *idev;
232230
int error;
233231

232+
axp20x_pek->irq_dbr = platform_get_irq_byname(pdev, "PEK_DBR");
233+
if (axp20x_pek->irq_dbr < 0)
234+
return axp20x_pek->irq_dbr;
235+
axp20x_pek->irq_dbr = regmap_irq_get_virq(axp20x->regmap_irqc,
236+
axp20x_pek->irq_dbr);
237+
238+
axp20x_pek->irq_dbf = platform_get_irq_byname(pdev, "PEK_DBF");
239+
if (axp20x_pek->irq_dbf < 0)
240+
return axp20x_pek->irq_dbf;
241+
axp20x_pek->irq_dbf = regmap_irq_get_virq(axp20x->regmap_irqc,
242+
axp20x_pek->irq_dbf);
243+
234244
axp20x_pek->input = devm_input_allocate_device(&pdev->dev);
235245
if (!axp20x_pek->input)
236246
return -ENOMEM;
@@ -245,13 +255,33 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
245255

246256
input_set_drvdata(idev, axp20x_pek);
247257

258+
error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbr,
259+
axp20x_pek_irq, 0,
260+
"axp20x-pek-dbr", idev);
261+
if (error < 0) {
262+
dev_err(&pdev->dev, "Failed to request dbr IRQ#%d: %d\n",
263+
axp20x_pek->irq_dbr, error);
264+
return error;
265+
}
266+
267+
error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbf,
268+
axp20x_pek_irq, 0,
269+
"axp20x-pek-dbf", idev);
270+
if (error < 0) {
271+
dev_err(&pdev->dev, "Failed to request dbf IRQ#%d: %d\n",
272+
axp20x_pek->irq_dbf, error);
273+
return error;
274+
}
275+
248276
error = input_register_device(idev);
249277
if (error) {
250278
dev_err(&pdev->dev, "Can't register input device: %d\n",
251279
error);
252280
return error;
253281
}
254282

283+
device_init_wakeup(&pdev->dev, true);
284+
255285
return 0;
256286
}
257287

@@ -309,18 +339,6 @@ static int axp20x_pek_probe(struct platform_device *pdev)
309339

310340
axp20x_pek->axp20x = dev_get_drvdata(pdev->dev.parent);
311341

312-
axp20x_pek->irq_dbr = platform_get_irq_byname(pdev, "PEK_DBR");
313-
if (axp20x_pek->irq_dbr < 0)
314-
return axp20x_pek->irq_dbr;
315-
axp20x_pek->irq_dbr = regmap_irq_get_virq(
316-
axp20x_pek->axp20x->regmap_irqc, axp20x_pek->irq_dbr);
317-
318-
axp20x_pek->irq_dbf = platform_get_irq_byname(pdev, "PEK_DBF");
319-
if (axp20x_pek->irq_dbf < 0)
320-
return axp20x_pek->irq_dbf;
321-
axp20x_pek->irq_dbf = regmap_irq_get_virq(
322-
axp20x_pek->axp20x->regmap_irqc, axp20x_pek->irq_dbf);
323-
324342
if (axp20x_pek_should_register_input(axp20x_pek, pdev)) {
325343
error = axp20x_pek_probe_input_device(axp20x_pek, pdev);
326344
if (error)
@@ -329,26 +347,6 @@ static int axp20x_pek_probe(struct platform_device *pdev)
329347

330348
axp20x_pek->info = (struct axp20x_info *)match->driver_data;
331349

332-
error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbr,
333-
axp20x_pek_irq, 0,
334-
"axp20x-pek-dbr", axp20x_pek);
335-
if (error < 0) {
336-
dev_err(&pdev->dev, "Failed to request dbr IRQ#%d: %d\n",
337-
axp20x_pek->irq_dbr, error);
338-
return error;
339-
}
340-
341-
error = devm_request_any_context_irq(&pdev->dev, axp20x_pek->irq_dbf,
342-
axp20x_pek_irq, 0,
343-
"axp20x-pek-dbf", axp20x_pek);
344-
if (error < 0) {
345-
dev_err(&pdev->dev, "Failed to request dbf IRQ#%d: %d\n",
346-
axp20x_pek->irq_dbf, error);
347-
return error;
348-
}
349-
350-
device_init_wakeup(&pdev->dev, true);
351-
352350
platform_set_drvdata(pdev, axp20x_pek);
353351

354352
return 0;

0 commit comments

Comments
 (0)