linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Add support for PMK8350 PON_HLOS PMIC peripheral
@ 2021-03-05  5:38 satya priya
  2021-03-05  5:38 ` [PATCH 1/3] input: pm8941-pwrkey: add " satya priya
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: satya priya @ 2021-03-05  5:38 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson
  Cc: David Collins, kgunda, linux-input, linux-kernel, devicetree,
	linux-arm-msm, satya priya

David Collins (2):
  input: pm8941-pwrkey: add support for PMK8350 PON_HLOS PMIC peripheral
  dt-bindings: input: pm8941-pwrkey: Add pmk8350 compatible strings

satya priya (1):
  dt-bindings: input: pm8941-pwrkey: Convert power key bindings to yaml

 .../bindings/input/qcom,pm8941-pwrkey.txt          |  53 -----------
 .../bindings/input/qcom,pm8941-pwrkey.yaml         |  78 ++++++++++++++++
 drivers/input/misc/pm8941-pwrkey.c                 | 103 ++++++++++++++-------
 3 files changed, 150 insertions(+), 84 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
 create mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


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

* [PATCH 1/3] input: pm8941-pwrkey: add support for PMK8350 PON_HLOS PMIC peripheral
  2021-03-05  5:38 [PATCH 0/3] Add support for PMK8350 PON_HLOS PMIC peripheral satya priya
@ 2021-03-05  5:38 ` satya priya
  2021-04-07 15:29   ` skakit
  2021-03-05  5:38 ` [PATCH 2/3] dt-bindings: input: pm8941-pwrkey: Convert power key bindings to yaml satya priya
  2021-03-05  5:38 ` [PATCH 3/3] dt-bindings: input: pm8941-pwrkey: Add pmk8350 compatible strings satya priya
  2 siblings, 1 reply; 9+ messages in thread
From: satya priya @ 2021-03-05  5:38 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson
  Cc: David Collins, kgunda, linux-input, linux-kernel, devicetree,
	linux-arm-msm, satya priya

From: David Collins <collinsd@codeaurora.org>

On Qualcomm Technologies, Inc. PMIC PMK8350, the PON peripheral
is split into two peripherals: PON_HLOS and PON_PBS.  The
application processor only has write access to PON_HLOS which
limits it to only receiving PON interrupts.

Add support for the PMK8350 PON_HLOS peripheral so that its
KPDPWR_N and RESIN_N interrupts can be used to detect key
presses.

Signed-off-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: satya priya <skakit@codeaurora.org>
---
 drivers/input/misc/pm8941-pwrkey.c | 103 ++++++++++++++++++++++++++-----------
 1 file changed, 72 insertions(+), 31 deletions(-)

diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c
index cf81044..2044d187 100644
--- a/drivers/input/misc/pm8941-pwrkey.c
+++ b/drivers/input/misc/pm8941-pwrkey.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2010-2011, 2020, The Linux Foundation. All rights reserved.
  * Copyright (c) 2014, Sony Mobile Communications Inc.
  */
 
@@ -22,6 +22,8 @@
 #define PON_RT_STS			0x10
 #define  PON_KPDPWR_N_SET		BIT(0)
 #define  PON_RESIN_N_SET		BIT(1)
+#define  PON_GEN3_RESIN_N_SET		BIT(6)
+#define  PON_GEN3_KPDPWR_N_SET		BIT(7)
 
 #define PON_PS_HOLD_RST_CTL		0x5a
 #define PON_PS_HOLD_RST_CTL2		0x5b
@@ -38,8 +40,12 @@
 #define  PON_DBC_DELAY_MASK		0x7
 
 struct pm8941_data {
-	unsigned int pull_up_bit;
-	unsigned int status_bit;
+	unsigned int	pull_up_bit;
+	unsigned int	status_bit;
+	bool		supports_ps_hold_poff_config;
+	bool		supports_debounce_config;
+	const char	*name;
+	const char	*phys;
 };
 
 struct pm8941_pwrkey {
@@ -231,34 +237,40 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev)
 
 	input_set_capability(pwrkey->input, EV_KEY, pwrkey->code);
 
-	pwrkey->input->name = "pm8941_pwrkey";
-	pwrkey->input->phys = "pm8941_pwrkey/input0";
-
-	req_delay = (req_delay << 6) / USEC_PER_SEC;
-	req_delay = ilog2(req_delay);
-
-	error = regmap_update_bits(pwrkey->regmap,
-				   pwrkey->baseaddr + PON_DBC_CTL,
-				   PON_DBC_DELAY_MASK,
-				   req_delay);
-	if (error) {
-		dev_err(&pdev->dev, "failed to set debounce: %d\n", error);
-		return error;
+	pwrkey->input->name = pwrkey->data->name;
+	pwrkey->input->phys = pwrkey->data->phys;
+
+	if (pwrkey->data->supports_debounce_config) {
+		req_delay = (req_delay << 6) / USEC_PER_SEC;
+		req_delay = ilog2(req_delay);
+
+		error = regmap_update_bits(pwrkey->regmap,
+					   pwrkey->baseaddr + PON_DBC_CTL,
+					   PON_DBC_DELAY_MASK,
+					   req_delay);
+		if (error) {
+			dev_err(&pdev->dev, "failed to set debounce: %d\n",
+				error);
+			return error;
+		}
 	}
 
-	error = regmap_update_bits(pwrkey->regmap,
-				   pwrkey->baseaddr + PON_PULL_CTL,
-				   pwrkey->data->pull_up_bit,
-				   pull_up ? pwrkey->data->pull_up_bit : 0);
-	if (error) {
-		dev_err(&pdev->dev, "failed to set pull: %d\n", error);
-		return error;
+	if (pwrkey->data->pull_up_bit) {
+		error = regmap_update_bits(pwrkey->regmap,
+					   pwrkey->baseaddr + PON_PULL_CTL,
+					   pwrkey->data->pull_up_bit,
+					   pull_up ? pwrkey->data->pull_up_bit :
+						     0);
+		if (error) {
+			dev_err(&pdev->dev, "failed to set pull: %d\n", error);
+			return error;
+		}
 	}
 
 	error = devm_request_threaded_irq(&pdev->dev, pwrkey->irq,
 					  NULL, pm8941_pwrkey_irq,
 					  IRQF_ONESHOT,
-					  "pm8941_pwrkey", pwrkey);
+					  pwrkey->data->name, pwrkey);
 	if (error) {
 		dev_err(&pdev->dev, "failed requesting IRQ: %d\n", error);
 		return error;
@@ -271,12 +283,14 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev)
 		return error;
 	}
 
-	pwrkey->reboot_notifier.notifier_call = pm8941_reboot_notify,
-	error = register_reboot_notifier(&pwrkey->reboot_notifier);
-	if (error) {
-		dev_err(&pdev->dev, "failed to register reboot notifier: %d\n",
-			error);
-		return error;
+	if (pwrkey->data->supports_ps_hold_poff_config) {
+		pwrkey->reboot_notifier.notifier_call = pm8941_reboot_notify,
+		error = register_reboot_notifier(&pwrkey->reboot_notifier);
+		if (error) {
+			dev_err(&pdev->dev, "failed to register reboot notifier: %d\n",
+				error);
+			return error;
+		}
 	}
 
 	platform_set_drvdata(pdev, pwrkey);
@@ -289,7 +303,8 @@ static int pm8941_pwrkey_remove(struct platform_device *pdev)
 {
 	struct pm8941_pwrkey *pwrkey = platform_get_drvdata(pdev);
 
-	unregister_reboot_notifier(&pwrkey->reboot_notifier);
+	if (pwrkey->data->supports_ps_hold_poff_config)
+		unregister_reboot_notifier(&pwrkey->reboot_notifier);
 
 	return 0;
 }
@@ -297,16 +312,42 @@ static int pm8941_pwrkey_remove(struct platform_device *pdev)
 static const struct pm8941_data pwrkey_data = {
 	.pull_up_bit = PON_KPDPWR_PULL_UP,
 	.status_bit = PON_KPDPWR_N_SET,
+	.name = "pm8941_pwrkey",
+	.phys = "pm8941_pwrkey/input0",
+	.supports_ps_hold_poff_config = true,
+	.supports_debounce_config = true,
 };
 
 static const struct pm8941_data resin_data = {
 	.pull_up_bit = PON_RESIN_PULL_UP,
 	.status_bit = PON_RESIN_N_SET,
+	.name = "pm8941_resin",
+	.phys = "pm8941_resin/input0",
+	.supports_ps_hold_poff_config = true,
+	.supports_debounce_config = true,
+};
+
+static const struct pm8941_data pon_gen3_pwrkey_data = {
+	.status_bit = PON_GEN3_KPDPWR_N_SET,
+	.name = "pmic_pwrkey",
+	.phys = "pmic_pwrkey/input0",
+	.supports_ps_hold_poff_config = false,
+	.supports_debounce_config = false,
+};
+
+static const struct pm8941_data pon_gen3_resin_data = {
+	.status_bit = PON_GEN3_RESIN_N_SET,
+	.name = "pmic_resin",
+	.phys = "pmic_resin/input0",
+	.supports_ps_hold_poff_config = false,
+	.supports_debounce_config = false,
 };
 
 static const struct of_device_id pm8941_pwr_key_id_table[] = {
 	{ .compatible = "qcom,pm8941-pwrkey", .data = &pwrkey_data },
 	{ .compatible = "qcom,pm8941-resin", .data = &resin_data },
+	{ .compatible = "qcom,pmk8350-pwrkey", .data = &pon_gen3_pwrkey_data },
+	{ .compatible = "qcom,pmk8350-resin", .data = &pon_gen3_resin_data },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, pm8941_pwr_key_id_table);
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


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

* [PATCH 2/3] dt-bindings: input: pm8941-pwrkey: Convert power key bindings to yaml
  2021-03-05  5:38 [PATCH 0/3] Add support for PMK8350 PON_HLOS PMIC peripheral satya priya
  2021-03-05  5:38 ` [PATCH 1/3] input: pm8941-pwrkey: add " satya priya
@ 2021-03-05  5:38 ` satya priya
  2021-03-05 14:15   ` Rob Herring
  2021-03-05 14:40   ` Rob Herring
  2021-03-05  5:38 ` [PATCH 3/3] dt-bindings: input: pm8941-pwrkey: Add pmk8350 compatible strings satya priya
  2 siblings, 2 replies; 9+ messages in thread
From: satya priya @ 2021-03-05  5:38 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson
  Cc: David Collins, kgunda, linux-input, linux-kernel, devicetree,
	linux-arm-msm, satya priya

Convert power key bindings from .txt to .yaml format.

Signed-off-by: satya priya <skakit@codeaurora.org>
---
 .../bindings/input/qcom,pm8941-pwrkey.txt          | 53 ---------------
 .../bindings/input/qcom,pm8941-pwrkey.yaml         | 76 ++++++++++++++++++++++
 2 files changed, 76 insertions(+), 53 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
 create mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml

diff --git a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
deleted file mode 100644
index 34ab576..0000000
--- a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-Qualcomm PM8941 PMIC Power Key
-
-PROPERTIES
-
-- compatible:
-	Usage: required
-	Value type: <string>
-	Definition: must be one of:
-		    "qcom,pm8941-pwrkey"
-		    "qcom,pm8941-resin"
-
-- reg:
-	Usage: required
-	Value type: <prop-encoded-array>
-	Definition: base address of registers for block
-
-- interrupts:
-	Usage: required
-	Value type: <prop-encoded-array>
-	Definition: key change interrupt; The format of the specifier is
-		    defined by the binding document describing the node's
-		    interrupt parent.
-
-- debounce:
-	Usage: optional
-	Value type: <u32>
-	Definition: time in microseconds that key must be pressed or released
-		    for state change interrupt to trigger.
-
-- bias-pull-up:
-	Usage: optional
-	Value type: <empty>
-	Definition: presence of this property indicates that the KPDPWR_N pin
-		    should be configured for pull up.
-
-- linux,code:
-	Usage: optional
-	Value type: <u32>
-	Definition: The input key-code associated with the power key.
-		    Use the linux event codes defined in
-		    include/dt-bindings/input/linux-event-codes.h
-		    When property is omitted KEY_POWER is assumed.
-
-EXAMPLE
-
-	pwrkey@800 {
-		compatible = "qcom,pm8941-pwrkey";
-		reg = <0x800>;
-		interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
-		debounce = <15625>;
-		bias-pull-up;
-		linux,code = <KEY_POWER>;
-	};
diff --git a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
new file mode 100644
index 0000000..302866d
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/qcom,pm8941-pwrkey.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm PM8941 PMIC Power Key
+
+maintainers:
+ - Courtney Cavin <courtney.cavin@sonymobile.com>
+ - Vinod Koul <vkoul@kernel.org>
+
+properties:
+  compatible:
+    enum:
+      - qcom,pm8941-pwrkey
+      - qcom,pm8941-resin
+
+  interrupts:
+    description: |
+          Key change interrupt; The format of the specifier is
+          defined by the binding document describing the node's
+          interrupt parent.
+
+  debounce:
+    description: |
+          Time in microseconds that key must be pressed or
+          released for state change interrupt to trigger.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  bias-pull-up:
+    description: |
+           Presence of this property indicates that the KPDPWR_N
+           pin should be configured for pull up.
+    $ref: /schemas/types.yaml#/definitions/flag
+
+  linux,code:
+    description: |
+           The input key-code associated with the power key.
+           Use the linux event codes defined in
+           include/dt-bindings/input/linux-event-codes.h
+           When property is omitted KEY_POWER is assumed.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+required:
+ - compatible
+ - interrupts
+
+additionalProperties: false
+
+examples:
+ - |
+   #include <dt-bindings/interrupt-controller/irq.h>
+   #include <dt-bindings/input/linux-event-codes.h>
+   #include <dt-bindings/spmi/spmi.h>
+   spmi_bus: spmi@c440000 {
+     reg = <0x0c440000 0x1100>;
+     #address-cells = <2>;
+     #size-cells = <0>;
+     pmk8350: pmic@0 {
+       reg = <0x0 SPMI_USID>;
+       #address-cells = <1>;
+       #size-cells = <0>;
+       pmk8350_pon: pon_hlos@1300 {
+         reg = <0x1300>;
+         pwrkey {
+            compatible = "qcom,pm8941-pwrkey";
+            interrupts = < 0x0 0x8 0 IRQ_TYPE_EDGE_BOTH >;
+            debounce = <15625>;
+            bias-pull-up;
+            linux,code = <KEY_POWER>;
+         };
+       };
+     };
+   };
+...
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


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

* [PATCH 3/3] dt-bindings: input: pm8941-pwrkey: Add pmk8350 compatible strings
  2021-03-05  5:38 [PATCH 0/3] Add support for PMK8350 PON_HLOS PMIC peripheral satya priya
  2021-03-05  5:38 ` [PATCH 1/3] input: pm8941-pwrkey: add " satya priya
  2021-03-05  5:38 ` [PATCH 2/3] dt-bindings: input: pm8941-pwrkey: Convert power key bindings to yaml satya priya
@ 2021-03-05  5:38 ` satya priya
  2 siblings, 0 replies; 9+ messages in thread
From: satya priya @ 2021-03-05  5:38 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson
  Cc: David Collins, kgunda, linux-input, linux-kernel, devicetree,
	linux-arm-msm, satya priya

From: David Collins <collinsd@codeaurora.org>

Add power key and resin compatible strings for the PMK8350 PMIC.
These are needed to distinguish key PON_HLOS register differences
between PMK8350 and previous PMIC PON modules.

Signed-off-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: satya priya <skakit@codeaurora.org>
---
 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
index 302866d..32ac762 100644
--- a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
+++ b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
@@ -15,6 +15,8 @@ properties:
     enum:
       - qcom,pm8941-pwrkey
       - qcom,pm8941-resin
+      - qcom,pmk8350-pwrkey
+      - qcom,pmk8350-resin
 
   interrupts:
     description: |
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation


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

* Re: [PATCH 2/3] dt-bindings: input: pm8941-pwrkey: Convert power key bindings to yaml
  2021-03-05  5:38 ` [PATCH 2/3] dt-bindings: input: pm8941-pwrkey: Convert power key bindings to yaml satya priya
@ 2021-03-05 14:15   ` Rob Herring
  2021-03-05 14:40   ` Rob Herring
  1 sibling, 0 replies; 9+ messages in thread
From: Rob Herring @ 2021-03-05 14:15 UTC (permalink / raw)
  To: satya priya
  Cc: linux-arm-msm, linux-kernel, Bjorn Andersson, Dmitry Torokhov,
	David Collins, Andy Gross, devicetree, kgunda, Rob Herring,
	linux-input

On Fri, 05 Mar 2021 11:08:40 +0530, satya priya wrote:
> Convert power key bindings from .txt to .yaml format.
> 
> Signed-off-by: satya priya <skakit@codeaurora.org>
> ---
>  .../bindings/input/qcom,pm8941-pwrkey.txt          | 53 ---------------
>  .../bindings/input/qcom,pm8941-pwrkey.yaml         | 76 ++++++++++++++++++++++
>  2 files changed, 76 insertions(+), 53 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
>  create mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:
./Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml:10:2: [warning] wrong indentation: expected 2 but found 1 (indentation)
./Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml:46:2: [warning] wrong indentation: expected 2 but found 1 (indentation)
./Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml:52:2: [warning] wrong indentation: expected 2 but found 1 (indentation)

dtschema/dtc warnings/errors:

See https://patchwork.ozlabs.org/patch/1447638

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.


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

* Re: [PATCH 2/3] dt-bindings: input: pm8941-pwrkey: Convert power key bindings to yaml
  2021-03-05  5:38 ` [PATCH 2/3] dt-bindings: input: pm8941-pwrkey: Convert power key bindings to yaml satya priya
  2021-03-05 14:15   ` Rob Herring
@ 2021-03-05 14:40   ` Rob Herring
  2021-03-25  6:12     ` skakit
  1 sibling, 1 reply; 9+ messages in thread
From: Rob Herring @ 2021-03-05 14:40 UTC (permalink / raw)
  To: satya priya
  Cc: Dmitry Torokhov, Andy Gross, Bjorn Andersson, David Collins,
	kgunda, linux-input, linux-kernel, devicetree, linux-arm-msm

On Fri, Mar 05, 2021 at 11:08:40AM +0530, satya priya wrote:
> Convert power key bindings from .txt to .yaml format.
> 
> Signed-off-by: satya priya <skakit@codeaurora.org>
> ---
>  .../bindings/input/qcom,pm8941-pwrkey.txt          | 53 ---------------
>  .../bindings/input/qcom,pm8941-pwrkey.yaml         | 76 ++++++++++++++++++++++
>  2 files changed, 76 insertions(+), 53 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
>  create mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml

You need to convert the main pm8941 binding first if not done already 
and then reference this binding from it.

And let's have 1 complete example instead of fragments.

> 
> diff --git a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
> deleted file mode 100644
> index 34ab576..0000000
> --- a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
> +++ /dev/null
> @@ -1,53 +0,0 @@
> -Qualcomm PM8941 PMIC Power Key
> -
> -PROPERTIES
> -
> -- compatible:
> -	Usage: required
> -	Value type: <string>
> -	Definition: must be one of:
> -		    "qcom,pm8941-pwrkey"
> -		    "qcom,pm8941-resin"
> -
> -- reg:
> -	Usage: required
> -	Value type: <prop-encoded-array>
> -	Definition: base address of registers for block
> -
> -- interrupts:
> -	Usage: required
> -	Value type: <prop-encoded-array>
> -	Definition: key change interrupt; The format of the specifier is
> -		    defined by the binding document describing the node's
> -		    interrupt parent.
> -
> -- debounce:
> -	Usage: optional
> -	Value type: <u32>
> -	Definition: time in microseconds that key must be pressed or released
> -		    for state change interrupt to trigger.
> -
> -- bias-pull-up:
> -	Usage: optional
> -	Value type: <empty>
> -	Definition: presence of this property indicates that the KPDPWR_N pin
> -		    should be configured for pull up.
> -
> -- linux,code:
> -	Usage: optional
> -	Value type: <u32>
> -	Definition: The input key-code associated with the power key.
> -		    Use the linux event codes defined in
> -		    include/dt-bindings/input/linux-event-codes.h
> -		    When property is omitted KEY_POWER is assumed.
> -
> -EXAMPLE
> -
> -	pwrkey@800 {
> -		compatible = "qcom,pm8941-pwrkey";
> -		reg = <0x800>;
> -		interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
> -		debounce = <15625>;
> -		bias-pull-up;
> -		linux,code = <KEY_POWER>;
> -	};
> diff --git a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
> new file mode 100644
> index 0000000..302866d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
> @@ -0,0 +1,76 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/qcom,pm8941-pwrkey.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm PM8941 PMIC Power Key
> +
> +maintainers:
> + - Courtney Cavin <courtney.cavin@sonymobile.com>
> + - Vinod Koul <vkoul@kernel.org>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - qcom,pm8941-pwrkey
> +      - qcom,pm8941-resin
> +
> +  interrupts:
> +    description: |
> +          Key change interrupt; The format of the specifier is
> +          defined by the binding document describing the node's
> +          interrupt parent.
> +
> +  debounce:
> +    description: |
> +          Time in microseconds that key must be pressed or
> +          released for state change interrupt to trigger.
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +
> +  bias-pull-up:
> +    description: |
> +           Presence of this property indicates that the KPDPWR_N
> +           pin should be configured for pull up.
> +    $ref: /schemas/types.yaml#/definitions/flag
> +
> +  linux,code:
> +    description: |
> +           The input key-code associated with the power key.
> +           Use the linux event codes defined in
> +           include/dt-bindings/input/linux-event-codes.h
> +           When property is omitted KEY_POWER is assumed.
> +    $ref: /schemas/types.yaml#/definitions/uint32

Already has a type definition. Need to reference input.yaml.

> +
> +required:
> + - compatible
> + - interrupts
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> +   #include <dt-bindings/interrupt-controller/irq.h>
> +   #include <dt-bindings/input/linux-event-codes.h>
> +   #include <dt-bindings/spmi/spmi.h>
> +   spmi_bus: spmi@c440000 {
> +     reg = <0x0c440000 0x1100>;
> +     #address-cells = <2>;
> +     #size-cells = <0>;
> +     pmk8350: pmic@0 {
> +       reg = <0x0 SPMI_USID>;
> +       #address-cells = <1>;
> +       #size-cells = <0>;
> +       pmk8350_pon: pon_hlos@1300 {
> +         reg = <0x1300>;
> +         pwrkey {
> +            compatible = "qcom,pm8941-pwrkey";
> +            interrupts = < 0x0 0x8 0 IRQ_TYPE_EDGE_BOTH >;
> +            debounce = <15625>;
> +            bias-pull-up;
> +            linux,code = <KEY_POWER>;
> +         };
> +       };
> +     };
> +   };
> +...
> -- 
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
> of Code Aurora Forum, hosted by The Linux Foundation
> 

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

* Re: [PATCH 2/3] dt-bindings: input: pm8941-pwrkey: Convert power key bindings to yaml
  2021-03-05 14:40   ` Rob Herring
@ 2021-03-25  6:12     ` skakit
  0 siblings, 0 replies; 9+ messages in thread
From: skakit @ 2021-03-25  6:12 UTC (permalink / raw)
  To: Rob Herring
  Cc: Dmitry Torokhov, Andy Gross, Bjorn Andersson, David Collins,
	kgunda, linux-input, linux-kernel, devicetree, linux-arm-msm

Hi Rob,

On 2021-03-05 20:10, Rob Herring wrote:
> On Fri, Mar 05, 2021 at 11:08:40AM +0530, satya priya wrote:
>> Convert power key bindings from .txt to .yaml format.
>> 
>> Signed-off-by: satya priya <skakit@codeaurora.org>
>> ---
>>  .../bindings/input/qcom,pm8941-pwrkey.txt          | 53 
>> ---------------
>>  .../bindings/input/qcom,pm8941-pwrkey.yaml         | 76 
>> ++++++++++++++++++++++
>>  2 files changed, 76 insertions(+), 53 deletions(-)
>>  delete mode 100644 
>> Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
>>  create mode 100644 
>> Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
> 
> You need to convert the main pm8941 binding first if not done already
> and then reference this binding from it.
> 

Okay.

> And let's have 1 complete example instead of fragments.
> 

Sure.

>> 
>> diff --git 
>> a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt 
>> b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
>> deleted file mode 100644
>> index 34ab576..0000000
>> --- a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
>> +++ /dev/null
>> @@ -1,53 +0,0 @@
>> -Qualcomm PM8941 PMIC Power Key
>> -
>> -PROPERTIES
>> -
>> -- compatible:
>> -	Usage: required
>> -	Value type: <string>
>> -	Definition: must be one of:
>> -		    "qcom,pm8941-pwrkey"
>> -		    "qcom,pm8941-resin"
>> -
>> -- reg:
>> -	Usage: required
>> -	Value type: <prop-encoded-array>
>> -	Definition: base address of registers for block
>> -
>> -- interrupts:
>> -	Usage: required
>> -	Value type: <prop-encoded-array>
>> -	Definition: key change interrupt; The format of the specifier is
>> -		    defined by the binding document describing the node's
>> -		    interrupt parent.
>> -
>> -- debounce:
>> -	Usage: optional
>> -	Value type: <u32>
>> -	Definition: time in microseconds that key must be pressed or 
>> released
>> -		    for state change interrupt to trigger.
>> -
>> -- bias-pull-up:
>> -	Usage: optional
>> -	Value type: <empty>
>> -	Definition: presence of this property indicates that the KPDPWR_N 
>> pin
>> -		    should be configured for pull up.
>> -
>> -- linux,code:
>> -	Usage: optional
>> -	Value type: <u32>
>> -	Definition: The input key-code associated with the power key.
>> -		    Use the linux event codes defined in
>> -		    include/dt-bindings/input/linux-event-codes.h
>> -		    When property is omitted KEY_POWER is assumed.
>> -
>> -EXAMPLE
>> -
>> -	pwrkey@800 {
>> -		compatible = "qcom,pm8941-pwrkey";
>> -		reg = <0x800>;
>> -		interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
>> -		debounce = <15625>;
>> -		bias-pull-up;
>> -		linux,code = <KEY_POWER>;
>> -	};
>> diff --git 
>> a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml 
>> b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
>> new file mode 100644
>> index 0000000..302866d
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
>> @@ -0,0 +1,76 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/input/qcom,pm8941-pwrkey.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Qualcomm PM8941 PMIC Power Key
>> +
>> +maintainers:
>> + - Courtney Cavin <courtney.cavin@sonymobile.com>
>> + - Vinod Koul <vkoul@kernel.org>
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - qcom,pm8941-pwrkey
>> +      - qcom,pm8941-resin
>> +
>> +  interrupts:
>> +    description: |
>> +          Key change interrupt; The format of the specifier is
>> +          defined by the binding document describing the node's
>> +          interrupt parent.
>> +
>> +  debounce:
>> +    description: |
>> +          Time in microseconds that key must be pressed or
>> +          released for state change interrupt to trigger.
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +
>> +  bias-pull-up:
>> +    description: |
>> +           Presence of this property indicates that the KPDPWR_N
>> +           pin should be configured for pull up.
>> +    $ref: /schemas/types.yaml#/definitions/flag
>> +
>> +  linux,code:
>> +    description: |
>> +           The input key-code associated with the power key.
>> +           Use the linux event codes defined in
>> +           include/dt-bindings/input/linux-event-codes.h
>> +           When property is omitted KEY_POWER is assumed.
>> +    $ref: /schemas/types.yaml#/definitions/uint32
> 
> Already has a type definition. Need to reference input.yaml.
> 

Okay.

>> +
>> +required:
>> + - compatible
>> + - interrupts
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> + - |
>> +   #include <dt-bindings/interrupt-controller/irq.h>
>> +   #include <dt-bindings/input/linux-event-codes.h>
>> +   #include <dt-bindings/spmi/spmi.h>
>> +   spmi_bus: spmi@c440000 {
>> +     reg = <0x0c440000 0x1100>;
>> +     #address-cells = <2>;
>> +     #size-cells = <0>;
>> +     pmk8350: pmic@0 {
>> +       reg = <0x0 SPMI_USID>;
>> +       #address-cells = <1>;
>> +       #size-cells = <0>;
>> +       pmk8350_pon: pon_hlos@1300 {
>> +         reg = <0x1300>;
>> +         pwrkey {
>> +            compatible = "qcom,pm8941-pwrkey";
>> +            interrupts = < 0x0 0x8 0 IRQ_TYPE_EDGE_BOTH >;
>> +            debounce = <15625>;
>> +            bias-pull-up;
>> +            linux,code = <KEY_POWER>;
>> +         };
>> +       };
>> +     };
>> +   };
>> +...
>> --
>> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a 
>> member
>> of Code Aurora Forum, hosted by The Linux Foundation
>> 

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

* Re: [PATCH 1/3] input: pm8941-pwrkey: add support for PMK8350 PON_HLOS PMIC peripheral
  2021-03-05  5:38 ` [PATCH 1/3] input: pm8941-pwrkey: add " satya priya
@ 2021-04-07 15:29   ` skakit
  2021-04-08  6:24     ` Dmitry Torokhov
  0 siblings, 1 reply; 9+ messages in thread
From: skakit @ 2021-04-07 15:29 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson
  Cc: David Collins, kgunda, linux-input, linux-kernel, devicetree,
	linux-arm-msm

Gentle Reminder!

Thanks,
Satya Priya
On 2021-03-05 11:08, satya priya wrote:
> From: David Collins <collinsd@codeaurora.org>
> 
> On Qualcomm Technologies, Inc. PMIC PMK8350, the PON peripheral
> is split into two peripherals: PON_HLOS and PON_PBS.  The
> application processor only has write access to PON_HLOS which
> limits it to only receiving PON interrupts.
> 
> Add support for the PMK8350 PON_HLOS peripheral so that its
> KPDPWR_N and RESIN_N interrupts can be used to detect key
> presses.
> 
> Signed-off-by: David Collins <collinsd@codeaurora.org>
> Signed-off-by: satya priya <skakit@codeaurora.org>
> ---
>  drivers/input/misc/pm8941-pwrkey.c | 103 
> ++++++++++++++++++++++++++-----------
>  1 file changed, 72 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/input/misc/pm8941-pwrkey.c
> b/drivers/input/misc/pm8941-pwrkey.c
> index cf81044..2044d187 100644
> --- a/drivers/input/misc/pm8941-pwrkey.c
> +++ b/drivers/input/misc/pm8941-pwrkey.c

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

* Re: [PATCH 1/3] input: pm8941-pwrkey: add support for PMK8350 PON_HLOS PMIC peripheral
  2021-04-07 15:29   ` skakit
@ 2021-04-08  6:24     ` Dmitry Torokhov
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2021-04-08  6:24 UTC (permalink / raw)
  To: skakit
  Cc: Rob Herring, Andy Gross, Bjorn Andersson, David Collins, kgunda,
	linux-input, linux-kernel, devicetree, linux-arm-msm

Hi Satya,

On Wed, Apr 07, 2021 at 08:59:39PM +0530, skakit@codeaurora.org wrote:
> Gentle Reminder!

Sorry, please address Rob's comments on the bindings, the driver code
looks OK to me.

Thanks.

-- 
Dmitry

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

end of thread, other threads:[~2021-04-08  6:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05  5:38 [PATCH 0/3] Add support for PMK8350 PON_HLOS PMIC peripheral satya priya
2021-03-05  5:38 ` [PATCH 1/3] input: pm8941-pwrkey: add " satya priya
2021-04-07 15:29   ` skakit
2021-04-08  6:24     ` Dmitry Torokhov
2021-03-05  5:38 ` [PATCH 2/3] dt-bindings: input: pm8941-pwrkey: Convert power key bindings to yaml satya priya
2021-03-05 14:15   ` Rob Herring
2021-03-05 14:40   ` Rob Herring
2021-03-25  6:12     ` skakit
2021-03-05  5:38 ` [PATCH 3/3] dt-bindings: input: pm8941-pwrkey: Add pmk8350 compatible strings satya priya

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).