Skip to content

Commit 9712fe0

Browse files
z3ntudtor
authored andcommitted
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>
1 parent 95e6b0a commit 9712fe0

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

drivers/input/misc/pm8941-pwrkey.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct pm8941_data {
6060
bool supports_ps_hold_poff_config;
6161
bool supports_debounce_config;
6262
bool has_pon_pbs;
63+
bool wakeup_source_default;
6364
const char *name;
6465
const char *phys;
6566
};
@@ -245,7 +246,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(pm8941_pwr_key_pm_ops,
245246
static int pm8941_pwrkey_probe(struct platform_device *pdev)
246247
{
247248
struct pm8941_pwrkey *pwrkey;
248-
bool pull_up;
249+
bool pull_up, wakeup;
249250
struct device *parent;
250251
struct device_node *regmap_node;
251252
const __be32 *addr;
@@ -402,8 +403,11 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev)
402403
}
403404
}
404405

406+
wakeup = pwrkey->data->wakeup_source_default ||
407+
of_property_read_bool(pdev->dev.of_node, "wakeup-source");
408+
405409
platform_set_drvdata(pdev, pwrkey);
406-
device_init_wakeup(&pdev->dev, 1);
410+
device_init_wakeup(&pdev->dev, wakeup);
407411

408412
return 0;
409413
}
@@ -424,6 +428,7 @@ static const struct pm8941_data pwrkey_data = {
424428
.supports_ps_hold_poff_config = true,
425429
.supports_debounce_config = true,
426430
.has_pon_pbs = false,
431+
.wakeup_source_default = true,
427432
};
428433

429434
static const struct pm8941_data resin_data = {
@@ -434,6 +439,7 @@ static const struct pm8941_data resin_data = {
434439
.supports_ps_hold_poff_config = true,
435440
.supports_debounce_config = true,
436441
.has_pon_pbs = false,
442+
.wakeup_source_default = false,
437443
};
438444

439445
static const struct pm8941_data pon_gen3_pwrkey_data = {
@@ -443,6 +449,7 @@ static const struct pm8941_data pon_gen3_pwrkey_data = {
443449
.supports_ps_hold_poff_config = false,
444450
.supports_debounce_config = false,
445451
.has_pon_pbs = true,
452+
.wakeup_source_default = true,
446453
};
447454

448455
static const struct pm8941_data pon_gen3_resin_data = {
@@ -452,6 +459,7 @@ static const struct pm8941_data pon_gen3_resin_data = {
452459
.supports_ps_hold_poff_config = false,
453460
.supports_debounce_config = false,
454461
.has_pon_pbs = true,
462+
.wakeup_source_default = false,
455463
};
456464

457465
static const struct of_device_id pm8941_pwr_key_id_table[] = {

0 commit comments

Comments
 (0)