diff options
| author | Ian Ray <ian.ray@gehealthcare.com> | 2025-04-30 20:51:50 -0700 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2025-04-30 21:03:14 -0700 |
| commit | 95ea0cf3f6137f6596002fd524580e481b5507c1 (patch) | |
| tree | 4f483ceac6a29e7759dee89095a95d112c6f7bde | |
| parent | dt-bindings: crypto: fsl,sec-v4.0-mon: Add "power-off-time-sec" (diff) | |
| download | linux-95ea0cf3f6137f6596002fd524580e481b5507c1.tar.gz linux-95ea0cf3f6137f6596002fd524580e481b5507c1.zip | |
Input: snvs_pwrkey - support power-off-time-sec
The power-off time is configured in LPCR[17:16] BTN_PRESS_TIME:
* b00: 5 seconds (SoC default)
* b01: 10 seconds
* b10: 15 seconds
* b11: PMIC is not disabled
Signed-off-by: Ian Ray <ian.ray@gehealthcare.com>
Link: https://lore.kernel.org/r/20250315093455.1100-3-ian.ray@gehealthcare.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
| -rw-r--r-- | drivers/input/keyboard/snvs_pwrkey.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c index f7b5f1e25c80..ce006108184f 100644 --- a/drivers/input/keyboard/snvs_pwrkey.c +++ b/drivers/input/keyboard/snvs_pwrkey.c @@ -27,6 +27,8 @@ #define SNVS_HPSR_BTN BIT(6) #define SNVS_LPSR_SPO BIT(18) #define SNVS_LPCR_DEP_EN BIT(5) +#define SNVS_LPCR_BPT_SHIFT 16 +#define SNVS_LPCR_BPT_MASK (3 << SNVS_LPCR_BPT_SHIFT) #define DEBOUNCE_TIME 30 #define REPEAT_INTERVAL 60 @@ -114,6 +116,8 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) struct device_node *np; struct clk *clk; int error; + unsigned int val; + unsigned int bpt; u32 vid; /* Get SNVS register Page */ @@ -148,6 +152,27 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) if (pdata->irq < 0) return -EINVAL; + error = of_property_read_u32(np, "power-off-time-sec", &val); + if (!error) { + switch (val) { + case 0: + bpt = 0x3; + break; + case 5: + case 10: + case 15: + bpt = (val / 5) - 1; + break; + default: + dev_err(&pdev->dev, + "power-off-time-sec %d out of range\n", val); + return -EINVAL; + } + + regmap_update_bits(pdata->snvs, SNVS_LPCR_REG, SNVS_LPCR_BPT_MASK, + bpt << SNVS_LPCR_BPT_SHIFT); + } + regmap_read(pdata->snvs, SNVS_HPVIDR1_REG, &vid); pdata->minor_rev = vid & 0xff; |
