Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: pm8941-pwrkey - disable wakeup for resin by default

'Resin' (*Res*et *In*put) is usually connected to a volume down button
on devices, which is usually not expected to wake up the device from
suspend.

On the other hand, pwrkey should keep wakeup on. So do not enable wakeup
for resin unless the "wakeup-source" property is specified in
devicetree.

Note, that this does change behavior by turning off wakeup by default
for 'resin' and requiring a new dt property to be added to turn it on
again. But since this is not expected behavior in the first place, and
most users will not expect this, I'd argue this change is acceptable.

Signed-off-by: Luca Weiss <luca@lucaweiss.eu>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250909-resin-wakeup-v1-2-46159940e02b@lucaweiss.eu
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Luca Weiss and committed by
Dmitry Torokhov
9712fe00 95e6b0af

+10 -2
+10 -2
drivers/input/misc/pm8941-pwrkey.c
··· 60 60 bool supports_ps_hold_poff_config; 61 61 bool supports_debounce_config; 62 62 bool has_pon_pbs; 63 + bool wakeup_source_default; 63 64 const char *name; 64 65 const char *phys; 65 66 }; ··· 246 245 static int pm8941_pwrkey_probe(struct platform_device *pdev) 247 246 { 248 247 struct pm8941_pwrkey *pwrkey; 249 - bool pull_up; 248 + bool pull_up, wakeup; 250 249 struct device *parent; 251 250 struct device_node *regmap_node; 252 251 const __be32 *addr; ··· 403 402 } 404 403 } 405 404 405 + wakeup = pwrkey->data->wakeup_source_default || 406 + of_property_read_bool(pdev->dev.of_node, "wakeup-source"); 407 + 406 408 platform_set_drvdata(pdev, pwrkey); 407 - device_init_wakeup(&pdev->dev, 1); 409 + device_init_wakeup(&pdev->dev, wakeup); 408 410 409 411 return 0; 410 412 } ··· 428 424 .supports_ps_hold_poff_config = true, 429 425 .supports_debounce_config = true, 430 426 .has_pon_pbs = false, 427 + .wakeup_source_default = true, 431 428 }; 432 429 433 430 static const struct pm8941_data resin_data = { ··· 439 434 .supports_ps_hold_poff_config = true, 440 435 .supports_debounce_config = true, 441 436 .has_pon_pbs = false, 437 + .wakeup_source_default = false, 442 438 }; 443 439 444 440 static const struct pm8941_data pon_gen3_pwrkey_data = { ··· 449 443 .supports_ps_hold_poff_config = false, 450 444 .supports_debounce_config = false, 451 445 .has_pon_pbs = true, 446 + .wakeup_source_default = true, 452 447 }; 453 448 454 449 static const struct pm8941_data pon_gen3_resin_data = { ··· 459 452 .supports_ps_hold_poff_config = false, 460 453 .supports_debounce_config = false, 461 454 .has_pon_pbs = true, 455 + .wakeup_source_default = false, 462 456 }; 463 457 464 458 static const struct of_device_id pm8941_pwr_key_id_table[] = {