linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Input: snvs_pwrkey - add configurable force shutdown time
@ 2025-03-15  9:34 Ian Ray
  2025-03-15  9:34 ` [PATCH v3 1/2] dt-bindings: crypto: fsl,sec-v4.0-mon: Add "power-off-time-sec" Ian Ray
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Ian Ray @ 2025-03-15  9:34 UTC (permalink / raw)
  To: dmitry.torokhov, robh, krzk+dt, conor+dt
  Cc: ian.ray, linux-input, devicetree, linux-kernel

PATCH 1 - update binding
PATCH 2 - add support to driver

Changes since v2:
* Fix dtbs_check (thank you, Krzysztof, for pointing this out)

Changes since v1:
* Drop binding

Ian Ray (2):
  dt-bindings: crypto: fsl,sec-v4.0-mon: Add "power-off-time-sec"
  Input: snvs_pwrkey - support power-off-time-sec

 .../bindings/crypto/fsl,sec-v4.0-mon.yaml     |  5 +++++
 drivers/input/keyboard/snvs_pwrkey.c          | 22 +++++++++++++++++++
 2 files changed, 27 insertions(+)

-- 
2.39.5


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/2] dt-bindings: crypto: fsl,sec-v4.0-mon: Add "power-off-time-sec"
  2025-03-15  9:34 [PATCH v3 0/2] Input: snvs_pwrkey - add configurable force shutdown time Ian Ray
@ 2025-03-15  9:34 ` Ian Ray
  2025-03-17  9:35   ` Krzysztof Kozlowski
  2025-05-01  4:22   ` Dmitry Torokhov
  2025-03-15  9:34 ` [PATCH v3 2/2] Input: snvs_pwrkey - support power-off-time-sec Ian Ray
  2025-04-26  8:02 ` [PATCH v3 0/2] Input: snvs_pwrkey - add configurable force shutdown time Ian Ray
  2 siblings, 2 replies; 7+ messages in thread
From: Ian Ray @ 2025-03-15  9:34 UTC (permalink / raw)
  To: dmitry.torokhov, robh, krzk+dt, conor+dt
  Cc: ian.ray, linux-input, devicetree, linux-kernel

Update to reference the input.yaml schema, thus enabling the use of the
common 'power-off-time' property.

The hardware supports one of four fixed values, and the new property is
optional.

Signed-off-by: Ian Ray <ian.ray@gehealthcare.com>
---
 .../devicetree/bindings/crypto/fsl,sec-v4.0-mon.yaml         | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/crypto/fsl,sec-v4.0-mon.yaml b/Documentation/devicetree/bindings/crypto/fsl,sec-v4.0-mon.yaml
index e879bc0be8e2..9f8e6689cd94 100644
--- a/Documentation/devicetree/bindings/crypto/fsl,sec-v4.0-mon.yaml
+++ b/Documentation/devicetree/bindings/crypto/fsl,sec-v4.0-mon.yaml
@@ -83,6 +83,8 @@ properties:
       by SNVS ONOFF, the driver can report the status of POWER key and wakeup
       system if pressed after system suspend.
 
+    $ref: /schemas/input/input.yaml
+
     properties:
       compatible:
         const: fsl,sec-v4.0-pwrkey
@@ -111,6 +113,9 @@ properties:
         maxItems: 1
         default: 116
 
+      power-off-time-sec:
+        enum: [0, 5, 10, 15]
+
     required:
       - compatible
       - interrupts
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 2/2] Input: snvs_pwrkey - support power-off-time-sec
  2025-03-15  9:34 [PATCH v3 0/2] Input: snvs_pwrkey - add configurable force shutdown time Ian Ray
  2025-03-15  9:34 ` [PATCH v3 1/2] dt-bindings: crypto: fsl,sec-v4.0-mon: Add "power-off-time-sec" Ian Ray
@ 2025-03-15  9:34 ` Ian Ray
  2025-05-01  4:23   ` Dmitry Torokhov
  2025-04-26  8:02 ` [PATCH v3 0/2] Input: snvs_pwrkey - add configurable force shutdown time Ian Ray
  2 siblings, 1 reply; 7+ messages in thread
From: Ian Ray @ 2025-03-15  9:34 UTC (permalink / raw)
  To: dmitry.torokhov, robh, krzk+dt, conor+dt
  Cc: ian.ray, linux-input, devicetree, linux-kernel

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>
---
 drivers/input/keyboard/snvs_pwrkey.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
index f7b5f1e25c80..d7372ace694a 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,24 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
 	if (pdata->irq < 0)
 		return -EINVAL;
 
+	if (!of_property_read_u32(np, "power-off-time-sec", &val)) {
+		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;
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: crypto: fsl,sec-v4.0-mon: Add "power-off-time-sec"
  2025-03-15  9:34 ` [PATCH v3 1/2] dt-bindings: crypto: fsl,sec-v4.0-mon: Add "power-off-time-sec" Ian Ray
@ 2025-03-17  9:35   ` Krzysztof Kozlowski
  2025-05-01  4:22   ` Dmitry Torokhov
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-17  9:35 UTC (permalink / raw)
  To: Ian Ray
  Cc: dmitry.torokhov, robh, krzk+dt, conor+dt, linux-input, devicetree,
	linux-kernel

On Sat, Mar 15, 2025 at 11:34:54AM +0200, Ian Ray wrote:
> Update to reference the input.yaml schema, thus enabling the use of the
> common 'power-off-time' property.
> 
> The hardware supports one of four fixed values, and the new property is
> optional.
> 
> Signed-off-by: Ian Ray <ian.ray@gehealthcare.com>
> ---
>  .../devicetree/bindings/crypto/fsl,sec-v4.0-mon.yaml         | 5 +++++
>  1 file changed, 5 insertions(+)

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

<form letter>
This is an automated instruction, just in case, because many review tags
are being ignored. If you know the process, you can skip it (please do
not feel offended by me posting it here - no bad intentions intended).
If you do not know the process, here is a short explanation:

Please add Acked-by/Reviewed-by/Tested-by tags when posting new
versions of patchset, under or above your Signed-off-by tag, unless
patch changed significantly (e.g. new properties added to the DT
bindings). Tag is "received", when provided in a message replied to you
on the mailing list. Tools like b4 can help here. However, there's no
need to repost patches *only* to add the tags. The upstream maintainer
will do that for tags received on the version they apply.

https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/submitting-patches.rst#L577
</form letter>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 0/2] Input: snvs_pwrkey - add configurable force shutdown time
  2025-03-15  9:34 [PATCH v3 0/2] Input: snvs_pwrkey - add configurable force shutdown time Ian Ray
  2025-03-15  9:34 ` [PATCH v3 1/2] dt-bindings: crypto: fsl,sec-v4.0-mon: Add "power-off-time-sec" Ian Ray
  2025-03-15  9:34 ` [PATCH v3 2/2] Input: snvs_pwrkey - support power-off-time-sec Ian Ray
@ 2025-04-26  8:02 ` Ian Ray
  2 siblings, 0 replies; 7+ messages in thread
From: Ian Ray @ 2025-04-26  8:02 UTC (permalink / raw)
  To: dmitry.torokhov, robh, krzk+dt, conor+dt
  Cc: linux-input, devicetree, linux-kernel

On Sat, Mar 15, 2025 at 11:34:53AM +0200, Ian Ray wrote:
> PATCH 1 - update binding
> PATCH 2 - add support to driver

Hello there,

Would there be any more comments?

Thanks,
Ian


> 
> Changes since v2:
> * Fix dtbs_check (thank you, Krzysztof, for pointing this out)
> 
> Changes since v1:
> * Drop binding
> 
> Ian Ray (2):
>   dt-bindings: crypto: fsl,sec-v4.0-mon: Add "power-off-time-sec"
>   Input: snvs_pwrkey - support power-off-time-sec
> 
>  .../bindings/crypto/fsl,sec-v4.0-mon.yaml     |  5 +++++
>  drivers/input/keyboard/snvs_pwrkey.c          | 22 +++++++++++++++++++
>  2 files changed, 27 insertions(+)
> 
> -- 
> 2.39.5

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: crypto: fsl,sec-v4.0-mon: Add "power-off-time-sec"
  2025-03-15  9:34 ` [PATCH v3 1/2] dt-bindings: crypto: fsl,sec-v4.0-mon: Add "power-off-time-sec" Ian Ray
  2025-03-17  9:35   ` Krzysztof Kozlowski
@ 2025-05-01  4:22   ` Dmitry Torokhov
  1 sibling, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2025-05-01  4:22 UTC (permalink / raw)
  To: Ian Ray; +Cc: robh, krzk+dt, conor+dt, linux-input, devicetree, linux-kernel

On Sat, Mar 15, 2025 at 11:34:54AM +0200, Ian Ray wrote:
> Update to reference the input.yaml schema, thus enabling the use of the
> common 'power-off-time' property.
> 
> The hardware supports one of four fixed values, and the new property is
> optional.
> 
> Signed-off-by: Ian Ray <ian.ray@gehealthcare.com>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/2] Input: snvs_pwrkey - support power-off-time-sec
  2025-03-15  9:34 ` [PATCH v3 2/2] Input: snvs_pwrkey - support power-off-time-sec Ian Ray
@ 2025-05-01  4:23   ` Dmitry Torokhov
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2025-05-01  4:23 UTC (permalink / raw)
  To: Ian Ray; +Cc: robh, krzk+dt, conor+dt, linux-input, devicetree, linux-kernel

On Sat, Mar 15, 2025 at 11:34:55AM +0200, Ian Ray wrote:
> 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>

Applied with formatting changes, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-05-01  4:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-15  9:34 [PATCH v3 0/2] Input: snvs_pwrkey - add configurable force shutdown time Ian Ray
2025-03-15  9:34 ` [PATCH v3 1/2] dt-bindings: crypto: fsl,sec-v4.0-mon: Add "power-off-time-sec" Ian Ray
2025-03-17  9:35   ` Krzysztof Kozlowski
2025-05-01  4:22   ` Dmitry Torokhov
2025-03-15  9:34 ` [PATCH v3 2/2] Input: snvs_pwrkey - support power-off-time-sec Ian Ray
2025-05-01  4:23   ` Dmitry Torokhov
2025-04-26  8:02 ` [PATCH v3 0/2] Input: snvs_pwrkey - add configurable force shutdown time Ian Ray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).