linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/4] Add support for PMK8350 PON_HLOS PMIC peripheral
@ 2021-04-08 11:31 satya priya
  2021-04-08 11:31 ` [PATCH V2 1/4] input: pm8941-pwrkey: add " satya priya
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: satya priya @ 2021-04-08 11:31 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	Sebastian Reichel
  Cc: David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm, 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 (2):
  dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml
  dt-bindings: input: pm8941-pwrkey: Convert pm8941 power key binding to
    yaml

 .../bindings/input/qcom,pm8941-pwrkey.txt          |  53 -----------
 .../bindings/input/qcom,pm8941-pwrkey.yaml         |  88 ++++++++++++++++++
 .../devicetree/bindings/power/reset/qcom,pon.txt   |  49 ----------
 .../devicetree/bindings/power/reset/qcom,pon.yaml  |  41 ++++++++
 drivers/input/misc/pm8941-pwrkey.c                 | 103 ++++++++++++++-------
 5 files changed, 201 insertions(+), 133 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
 create mode 100644 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
 delete mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.txt
 create mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.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] 18+ messages in thread

* [PATCH V2 1/4] input: pm8941-pwrkey: add support for PMK8350 PON_HLOS PMIC peripheral
  2021-04-08 11:31 [PATCH V2 0/4] Add support for PMK8350 PON_HLOS PMIC peripheral satya priya
@ 2021-04-08 11:31 ` satya priya
  2021-04-13  3:00   ` Bjorn Andersson
  2021-04-08 11:31 ` [PATCH V2 2/4] dt-bindings: input: pm8941-pwrkey: add pmk8350 compatible strings satya priya
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 18+ messages in thread
From: satya priya @ 2021-04-08 11:31 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	Sebastian Reichel
  Cc: David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm, 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>
---
Changes in V2:
 - No change.

 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..10e3fc0 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-2021, 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] 18+ messages in thread

* [PATCH V2 2/4] dt-bindings: input: pm8941-pwrkey: add pmk8350 compatible strings
  2021-04-08 11:31 [PATCH V2 0/4] Add support for PMK8350 PON_HLOS PMIC peripheral satya priya
  2021-04-08 11:31 ` [PATCH V2 1/4] input: pm8941-pwrkey: add " satya priya
@ 2021-04-08 11:31 ` satya priya
  2021-04-09 18:46   ` Rob Herring
  2021-04-08 11:31 ` [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml satya priya
  2021-04-08 11:31 ` [PATCH V2 4/4] dt-bindings: input: pm8941-pwrkey: Convert pm8941 power key " satya priya
  3 siblings, 1 reply; 18+ messages in thread
From: satya priya @ 2021-04-08 11:31 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	Sebastian Reichel
  Cc: David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm, 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>
---
Chnages in V2:
 - Moved this patch before the conversion patches.

 Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
index 34ab576..6cd08bc 100644
--- a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
+++ b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
@@ -8,6 +8,8 @@ PROPERTIES
 	Definition: must be one of:
 		    "qcom,pm8941-pwrkey"
 		    "qcom,pm8941-resin"
+		    "qcom,pmk8350-pwrkey"
+		    "qcom,pmk8350-resin"
 
 - reg:
 	Usage: required
-- 
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] 18+ messages in thread

* [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml
  2021-04-08 11:31 [PATCH V2 0/4] Add support for PMK8350 PON_HLOS PMIC peripheral satya priya
  2021-04-08 11:31 ` [PATCH V2 1/4] input: pm8941-pwrkey: add " satya priya
  2021-04-08 11:31 ` [PATCH V2 2/4] dt-bindings: input: pm8941-pwrkey: add pmk8350 compatible strings satya priya
@ 2021-04-08 11:31 ` satya priya
  2021-04-08 13:00   ` Sebastian Reichel
  2021-04-08 11:31 ` [PATCH V2 4/4] dt-bindings: input: pm8941-pwrkey: Convert pm8941 power key " satya priya
  3 siblings, 1 reply; 18+ messages in thread
From: satya priya @ 2021-04-08 11:31 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	Sebastian Reichel
  Cc: David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm, satya priya

Convert qcom PON binding from .txt to .yaml format.

Signed-off-by: satya priya <skakit@codeaurora.org>
---
Changes in V2:
 - As per Rob's comments, converted the main PON binding and added in V2.

 .../devicetree/bindings/power/reset/qcom,pon.txt   | 49 ----------------------
 .../devicetree/bindings/power/reset/qcom,pon.yaml  | 41 ++++++++++++++++++
 2 files changed, 41 insertions(+), 49 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.txt
 create mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.yaml

diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt b/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
deleted file mode 100644
index 0c0dc3a..0000000
--- a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-Qualcomm PON Device
-
-The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
-and resin along with the Android reboot-mode.
-
-This DT node has pwrkey and resin as sub nodes.
-
-Required Properties:
--compatible: Must be one of:
-	"qcom,pm8916-pon"
-	"qcom,pms405-pon"
-	"qcom,pm8998-pon"
-
--reg: Specifies the physical address of the pon register
-
-Optional subnode:
--pwrkey: Specifies the subnode pwrkey and should follow the
- qcom,pm8941-pwrkey.txt description.
--resin: Specifies the subnode resin and should follow the
- qcom,pm8xxx-pwrkey.txt description.
-
-The rest of the properties should follow the generic reboot-mode description
-found in reboot-mode.txt
-
-Example:
-
-	pon@800 {
-		compatible = "qcom,pm8916-pon";
-
-		reg = <0x800>;
-		mode-bootloader = <0x2>;
-		mode-recovery = <0x1>;
-
-		pwrkey {
-			compatible = "qcom,pm8941-pwrkey";
-			interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
-			debounce = <15625>;
-			bias-pull-up;
-			linux,code = <KEY_POWER>;
-		};
-
-		resin {
-			compatible = "qcom,pm8941-resin";
-			interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
-			debounce = <15625>;
-			bias-pull-up;
-			linux,code = <KEY_VOLUMEDOWN>;
-		};
-	};
diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
new file mode 100644
index 0000000..40eea5f1
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/reset/qcom,pon.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm PON Device
+
+maintainers:
+  - Vinod Koul <vkoul@kernel.org>
+
+description: |
+  The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
+  and resin along with the Android reboot-mode.
+
+  This DT node has pwrkey and resin as sub nodes.
+
+properties:
+  compatible:
+    enum:
+      - qcom,pm8916-pon
+      - qcom,pms405-pon
+      - qcom,pm8998-pon
+
+  reg:
+    description: Specifies the physical address of the pon register
+
+  pwrkey:
+    type: object
+    $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
+
+  resin:
+    type: object
+    $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: true
+...
-- 
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] 18+ messages in thread

* [PATCH V2 4/4] dt-bindings: input: pm8941-pwrkey: Convert pm8941 power key binding to yaml
  2021-04-08 11:31 [PATCH V2 0/4] Add support for PMK8350 PON_HLOS PMIC peripheral satya priya
                   ` (2 preceding siblings ...)
  2021-04-08 11:31 ` [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml satya priya
@ 2021-04-08 11:31 ` satya priya
  2021-04-09 18:50   ` Rob Herring
  3 siblings, 1 reply; 18+ messages in thread
From: satya priya @ 2021-04-08 11:31 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	Sebastian Reichel
  Cc: David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm, satya priya

Convert qcom pm8941 power key binding from .txt to .yaml format.

Signed-off-by: satya priya <skakit@codeaurora.org>
---
Changes in V2:
 - Fixed bot errors, took reference from input.yaml for "linux,code"
 - Added one complete example for powerkey and resin, and referenced it
   in main PON binding.
 - Moved this patch to the end of the series.

 .../bindings/input/qcom,pm8941-pwrkey.txt          | 55 --------------
 .../bindings/input/qcom,pm8941-pwrkey.yaml         | 88 ++++++++++++++++++++++
 2 files changed, 88 insertions(+), 55 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 6cd08bc..0000000
--- a/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
+++ /dev/null
@@ -1,55 +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"
-		    "qcom,pmk8350-pwrkey"
-		    "qcom,pmk8350-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..fb6cbe8
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
@@ -0,0 +1,88 @@
+# 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
+      - qcom,pmk8350-pwrkey
+      - qcom,pmk8350-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: "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>;
+         compatible = "qcom,pm8998-pon";
+
+         pwrkey {
+            compatible = "qcom,pm8941-pwrkey";
+            interrupts = < 0x0 0x8 0 IRQ_TYPE_EDGE_BOTH >;
+            debounce = <15625>;
+            bias-pull-up;
+            linux,code = <KEY_POWER>;
+         };
+
+         resin {
+            compatible = "qcom,pm8941-resin";
+            interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
+            debounce = <15625>;
+            bias-pull-up;
+            linux,code = <KEY_VOLUMEDOWN>;
+         };
+       };
+     };
+   };
+...
-- 
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] 18+ messages in thread

* Re: [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml
  2021-04-08 11:31 ` [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml satya priya
@ 2021-04-08 13:00   ` Sebastian Reichel
  2021-04-09  8:18     ` skakit
  0 siblings, 1 reply; 18+ messages in thread
From: Sebastian Reichel @ 2021-04-08 13:00 UTC (permalink / raw)
  To: satya priya
  Cc: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm

[-- Attachment #1: Type: text/plain, Size: 3965 bytes --]

Hi,

On Thu, Apr 08, 2021 at 05:01:08PM +0530, satya priya wrote:
> Convert qcom PON binding from .txt to .yaml format.
> 
> Signed-off-by: satya priya <skakit@codeaurora.org>
> ---

Thanks for doing this.

> Changes in V2:
>  - As per Rob's comments, converted the main PON binding and added in V2.
> 
>  .../devicetree/bindings/power/reset/qcom,pon.txt   | 49 ----------------------
>  .../devicetree/bindings/power/reset/qcom,pon.yaml  | 41 ++++++++++++++++++
>  2 files changed, 41 insertions(+), 49 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.txt
>  create mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> 
> diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt b/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
> deleted file mode 100644
> index 0c0dc3a..0000000
> --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
> +++ /dev/null
> @@ -1,49 +0,0 @@
> -Qualcomm PON Device
> -
> -The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
> -and resin along with the Android reboot-mode.
> -
> -This DT node has pwrkey and resin as sub nodes.
> -
> -Required Properties:
> --compatible: Must be one of:
> -	"qcom,pm8916-pon"
> -	"qcom,pms405-pon"
> -	"qcom,pm8998-pon"
> -
> --reg: Specifies the physical address of the pon register
> -
> -Optional subnode:
> --pwrkey: Specifies the subnode pwrkey and should follow the
> - qcom,pm8941-pwrkey.txt description.
> --resin: Specifies the subnode resin and should follow the
> - qcom,pm8xxx-pwrkey.txt description.
> -
> -The rest of the properties should follow the generic reboot-mode description
> -found in reboot-mode.txt
> -
> -Example:
> -
> -	pon@800 {
> -		compatible = "qcom,pm8916-pon";
> -
> -		reg = <0x800>;
> -		mode-bootloader = <0x2>;
> -		mode-recovery = <0x1>;
> -
> -		pwrkey {
> -			compatible = "qcom,pm8941-pwrkey";
> -			interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
> -			debounce = <15625>;
> -			bias-pull-up;
> -			linux,code = <KEY_POWER>;
> -		};
> -
> -		resin {
> -			compatible = "qcom,pm8941-resin";
> -			interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
> -			debounce = <15625>;
> -			bias-pull-up;
> -			linux,code = <KEY_VOLUMEDOWN>;
> -		};
> -	};
> diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> new file mode 100644
> index 0000000..40eea5f1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
> @@ -0,0 +1,41 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/reset/qcom,pon.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm PON Device
> +
> +maintainers:
> +  - Vinod Koul <vkoul@kernel.org>
> +
> +description: |
> +  The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
> +  and resin along with the Android reboot-mode.
> +
> +  This DT node has pwrkey and resin as sub nodes.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - qcom,pm8916-pon
> +      - qcom,pms405-pon
> +      - qcom,pm8998-pon
> +
> +  reg:
> +    description: Specifies the physical address of the pon register

That description is obvious and pointless. Instead add

maxItems: 1

> +  pwrkey:
> +    type: object
> +    $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
> +
> +  resin:
> +    type: object
> +    $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: true

Instead of allowing arbitrary properties, only valid modes
should be allowed. So drop additionalProperties and do this
instead:

allOf:
  - $ref: reboot-mode.yaml#

unevaluatedProperties: false

> +...

Please do not drop the example :)

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml
  2021-04-08 13:00   ` Sebastian Reichel
@ 2021-04-09  8:18     ` skakit
  2021-04-09 11:57       ` Sebastian Reichel
  2021-04-27  6:15       ` skakit
  0 siblings, 2 replies; 18+ messages in thread
From: skakit @ 2021-04-09  8:18 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm

Hi Sebastian,

On 2021-04-08 18:30, Sebastian Reichel wrote:
> Hi,
> 
> On Thu, Apr 08, 2021 at 05:01:08PM +0530, satya priya wrote:
>> Convert qcom PON binding from .txt to .yaml format.
>> 
>> Signed-off-by: satya priya <skakit@codeaurora.org>
>> ---
> 
> Thanks for doing this.
> 
>> Changes in V2:
>>  - As per Rob's comments, converted the main PON binding and added in 
>> V2.
>> 
>>  .../devicetree/bindings/power/reset/qcom,pon.txt   | 49 
>> ----------------------
>>  .../devicetree/bindings/power/reset/qcom,pon.yaml  | 41 
>> ++++++++++++++++++
>>  2 files changed, 41 insertions(+), 49 deletions(-)
>>  delete mode 100644 
>> Documentation/devicetree/bindings/power/reset/qcom,pon.txt
>>  create mode 100644 
>> Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
>> 
>> diff --git 
>> a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt 
>> b/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
>> deleted file mode 100644
>> index 0c0dc3a..0000000
>> --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt
>> +++ /dev/null
>> @@ -1,49 +0,0 @@
>> -Qualcomm PON Device
>> -
>> -The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
>> -and resin along with the Android reboot-mode.
>> -
>> -This DT node has pwrkey and resin as sub nodes.
>> -
>> -Required Properties:
>> --compatible: Must be one of:
>> -	"qcom,pm8916-pon"
>> -	"qcom,pms405-pon"
>> -	"qcom,pm8998-pon"
>> -
>> --reg: Specifies the physical address of the pon register
>> -
>> -Optional subnode:
>> --pwrkey: Specifies the subnode pwrkey and should follow the
>> - qcom,pm8941-pwrkey.txt description.
>> --resin: Specifies the subnode resin and should follow the
>> - qcom,pm8xxx-pwrkey.txt description.
>> -
>> -The rest of the properties should follow the generic reboot-mode 
>> description
>> -found in reboot-mode.txt
>> -
>> -Example:
>> -
>> -	pon@800 {
>> -		compatible = "qcom,pm8916-pon";
>> -
>> -		reg = <0x800>;
>> -		mode-bootloader = <0x2>;
>> -		mode-recovery = <0x1>;
>> -
>> -		pwrkey {
>> -			compatible = "qcom,pm8941-pwrkey";
>> -			interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
>> -			debounce = <15625>;
>> -			bias-pull-up;
>> -			linux,code = <KEY_POWER>;
>> -		};
>> -
>> -		resin {
>> -			compatible = "qcom,pm8941-resin";
>> -			interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
>> -			debounce = <15625>;
>> -			bias-pull-up;
>> -			linux,code = <KEY_VOLUMEDOWN>;
>> -		};
>> -	};
>> diff --git 
>> a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml 
>> b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
>> new file mode 100644
>> index 0000000..40eea5f1
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
>> @@ -0,0 +1,41 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/power/reset/qcom,pon.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Qualcomm PON Device
>> +
>> +maintainers:
>> +  - Vinod Koul <vkoul@kernel.org>
>> +
>> +description: |
>> +  The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
>> +  and resin along with the Android reboot-mode.
>> +
>> +  This DT node has pwrkey and resin as sub nodes.
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - qcom,pm8916-pon
>> +      - qcom,pms405-pon
>> +      - qcom,pm8998-pon
>> +
>> +  reg:
>> +    description: Specifies the physical address of the pon register
> 
> That description is obvious and pointless. Instead add
> 
> maxItems: 1
> 

Okay.

>> +  pwrkey:
>> +    type: object
>> +    $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
>> +
>> +  resin:
>> +    type: object
>> +    $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +
>> +additionalProperties: true
> 
> Instead of allowing arbitrary properties, only valid modes
> should be allowed. So drop additionalProperties and do this
> instead:
> 
> allOf:
>   - $ref: reboot-mode.yaml#
> 
> unevaluatedProperties: false
> 

Okay.

>> +...
> 
> Please do not drop the example :)
> 

As per my understanding on Rob's comments [1] I have added one complete 
example in qcom,pm8941-pwrkey.yaml (see patch 4/4) and dropped it here.

[1] https://lore.kernel.org/patchwork/patch/1390062/#1588027

> -- Sebastian

Thanks,
Satya Priya

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

* Re: [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml
  2021-04-09  8:18     ` skakit
@ 2021-04-09 11:57       ` Sebastian Reichel
  2021-04-09 13:38         ` skakit
  2021-04-27  6:15       ` skakit
  1 sibling, 1 reply; 18+ messages in thread
From: Sebastian Reichel @ 2021-04-09 11:57 UTC (permalink / raw)
  To: skakit
  Cc: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]

Hi,

On Fri, Apr 09, 2021 at 01:48:58PM +0530, skakit@codeaurora.org wrote:
>> Please do not drop the example :)
> 
> As per my understanding on Rob's comments [1] I have added one complete
> example in qcom,pm8941-pwrkey.yaml (see patch 4/4) and dropped it here.
> 
> [1] https://lore.kernel.org/patchwork/patch/1390062/#1588027

Ok, please add a note about this in the commit message.
Something like:

The example has been removed in favour of full example being
available in the qcom,pm8941-pwrkey binding.

Thanks,

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml
  2021-04-09 11:57       ` Sebastian Reichel
@ 2021-04-09 13:38         ` skakit
  0 siblings, 0 replies; 18+ messages in thread
From: skakit @ 2021-04-09 13:38 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm

On 2021-04-09 17:27, Sebastian Reichel wrote:
> Hi,
> 
> On Fri, Apr 09, 2021 at 01:48:58PM +0530, skakit@codeaurora.org wrote:
>>> Please do not drop the example :)
>> 
>> As per my understanding on Rob's comments [1] I have added one 
>> complete
>> example in qcom,pm8941-pwrkey.yaml (see patch 4/4) and dropped it 
>> here.
>> 
>> [1] https://lore.kernel.org/patchwork/patch/1390062/#1588027
> 
> Ok, please add a note about this in the commit message.
> Something like:
> 
> The example has been removed in favour of full example being
> available in the qcom,pm8941-pwrkey binding.
> 

Okay.

> Thanks,
> 
> -- Sebastian

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

* Re: [PATCH V2 2/4] dt-bindings: input: pm8941-pwrkey: add pmk8350 compatible strings
  2021-04-08 11:31 ` [PATCH V2 2/4] dt-bindings: input: pm8941-pwrkey: add pmk8350 compatible strings satya priya
@ 2021-04-09 18:46   ` Rob Herring
  0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2021-04-09 18:46 UTC (permalink / raw)
  To: satya priya
  Cc: Courtney Cavin, linux-kernel, Sebastian Reichel, Bjorn Andersson,
	Rob Herring, David Collins, linux-arm-msm, Vinod Koul, linux-pm,
	kgunda, Andy Gross, linux-input, devicetree, Dmitry Torokhov

On Thu, 08 Apr 2021 17:01:07 +0530, satya priya wrote:
> 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>
> ---
> Chnages in V2:
>  - Moved this patch before the conversion patches.
> 
>  Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH V2 4/4] dt-bindings: input: pm8941-pwrkey: Convert pm8941 power key binding to yaml
  2021-04-08 11:31 ` [PATCH V2 4/4] dt-bindings: input: pm8941-pwrkey: Convert pm8941 power key " satya priya
@ 2021-04-09 18:50   ` Rob Herring
  2021-04-21  6:23     ` skakit
  0 siblings, 1 reply; 18+ messages in thread
From: Rob Herring @ 2021-04-09 18:50 UTC (permalink / raw)
  To: satya priya
  Cc: Dmitry Torokhov, Andy Gross, Bjorn Andersson, Sebastian Reichel,
	David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm

On Thu, Apr 08, 2021 at 05:01:09PM +0530, satya priya wrote:
> Convert qcom pm8941 power key binding from .txt to .yaml format.
> 
> Signed-off-by: satya priya <skakit@codeaurora.org>
> ---
> Changes in V2:
>  - Fixed bot errors, took reference from input.yaml for "linux,code"
>  - Added one complete example for powerkey and resin, and referenced it
>    in main PON binding.
>  - Moved this patch to the end of the series.
> 
>  .../bindings/input/qcom,pm8941-pwrkey.txt          | 55 --------------
>  .../bindings/input/qcom,pm8941-pwrkey.yaml         | 88 ++++++++++++++++++++++
>  2 files changed, 88 insertions(+), 55 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.yaml b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
> new file mode 100644
> index 0000000..fb6cbe8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
> @@ -0,0 +1,88 @@
> +# 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
> +      - qcom,pmk8350-pwrkey
> +      - qcom,pmk8350-resin
> +
> +  interrupts:

How many?

> +    description: |
> +          Key change interrupt; The format of the specifier is
> +          defined by the binding document describing the node's
> +          interrupt parent.

The 2nd sentence is every 'interrupts' property. Drop.

> +
> +  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: "input.yaml#"

You've just defined that 'linux,code' is a node with properties defined 
in input.yaml. Need to move this up to the top level.

> +
> +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>;
> +         compatible = "qcom,pm8998-pon";
> +
> +         pwrkey {
> +            compatible = "qcom,pm8941-pwrkey";
> +            interrupts = < 0x0 0x8 0 IRQ_TYPE_EDGE_BOTH >;
> +            debounce = <15625>;
> +            bias-pull-up;
> +            linux,code = <KEY_POWER>;
> +         };
> +
> +         resin {
> +            compatible = "qcom,pm8941-resin";
> +            interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
> +            debounce = <15625>;
> +            bias-pull-up;
> +            linux,code = <KEY_VOLUMEDOWN>;
> +         };
> +       };
> +     };
> +   };
> +...
> -- 
> 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] 18+ messages in thread

* Re: [PATCH V2 1/4] input: pm8941-pwrkey: add support for PMK8350 PON_HLOS PMIC peripheral
  2021-04-08 11:31 ` [PATCH V2 1/4] input: pm8941-pwrkey: add " satya priya
@ 2021-04-13  3:00   ` Bjorn Andersson
  0 siblings, 0 replies; 18+ messages in thread
From: Bjorn Andersson @ 2021-04-13  3:00 UTC (permalink / raw)
  To: satya priya
  Cc: Dmitry Torokhov, Rob Herring, Andy Gross, Sebastian Reichel,
	David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm

On Thu 08 Apr 06:31 CDT 2021, 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.
> 

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> Signed-off-by: David Collins <collinsd@codeaurora.org>
> Signed-off-by: satya priya <skakit@codeaurora.org>
> ---
> Changes in V2:
>  - No change.
> 
>  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..10e3fc0 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-2021, 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	[flat|nested] 18+ messages in thread

* Re: [PATCH V2 4/4] dt-bindings: input: pm8941-pwrkey: Convert pm8941 power key binding to yaml
  2021-04-09 18:50   ` Rob Herring
@ 2021-04-21  6:23     ` skakit
  0 siblings, 0 replies; 18+ messages in thread
From: skakit @ 2021-04-21  6:23 UTC (permalink / raw)
  To: Rob Herring
  Cc: Dmitry Torokhov, Andy Gross, Bjorn Andersson, Sebastian Reichel,
	David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm

Hi Rob,

On 2021-04-10 00:20, Rob Herring wrote:
> On Thu, Apr 08, 2021 at 05:01:09PM +0530, satya priya wrote:
>> Convert qcom pm8941 power key binding from .txt to .yaml format.
>> 
>> Signed-off-by: satya priya <skakit@codeaurora.org>
[...]
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - qcom,pm8941-pwrkey
>> +      - qcom,pm8941-resin
>> +      - qcom,pmk8350-pwrkey
>> +      - qcom,pmk8350-resin
>> +
>> +  interrupts:
> 
> How many?
> 

ok, will add maxItems.

>> +    description: |
>> +          Key change interrupt; The format of the specifier is
>> +          defined by the binding document describing the node's
>> +          interrupt parent.
> 
> The 2nd sentence is every 'interrupts' property. Drop.
> 

Will remove the description.

>> +
>> +  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: "input.yaml#"
> 
> You've just defined that 'linux,code' is a node with properties defined
> in input.yaml. Need to move this up to the top level.
> 

allOf:
   $ref: "input.yaml#"
That means I should add like this at the beginning? please correct me if 
wrong.

>> +
>> +required:
>> +  - compatible
>> +  - interrupts
>> +
>> +additionalProperties: false
[...]

Thanks,
Satya Priya

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

* Re: [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml
  2021-04-09  8:18     ` skakit
  2021-04-09 11:57       ` Sebastian Reichel
@ 2021-04-27  6:15       ` skakit
  2021-04-27  8:37         ` Sebastian Reichel
  1 sibling, 1 reply; 18+ messages in thread
From: skakit @ 2021-04-27  6:15 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm

Hi Sebastian,

On 2021-04-09 13:48, skakit@codeaurora.org wrote:
> Hi Sebastian,
> 
> On 2021-04-08 18:30, Sebastian Reichel wrote:
>> Hi,
>> 
>> On Thu, Apr 08, 2021 at 05:01:08PM +0530, satya priya wrote:
>>> Convert qcom PON binding from .txt to .yaml format.
>>> 
>>> Signed-off-by: satya priya <skakit@codeaurora.org>
>>> ---
>> 
>> Thanks for doing this.
>> 
>>> Changes in V2:
>>>  - As per Rob's comments, converted the main PON binding and added in 
>>> V2.
>>> 
[...]
>>> +  reg:
>>> +    description: Specifies the physical address of the pon register
>> 
>> That description is obvious and pointless. Instead add
>> 
>> maxItems: 1
>> 
> 
> Okay.
> 
>>> +  pwrkey:
>>> +    type: object
>>> +    $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
>>> +
>>> +  resin:
>>> +    type: object
>>> +    $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
>>> +
>>> +required:
>>> +  - compatible
>>> +  - reg
>>> +
>>> +additionalProperties: true
>> 
>> Instead of allowing arbitrary properties, only valid modes
>> should be allowed. So drop additionalProperties and do this
>> instead:
>> 
>> allOf:
>>   - $ref: reboot-mode.yaml#
>> 
>> unevaluatedProperties: false
>> 
> 
> Okay.
> 

I am not able to use 'allOf' to refer reboot-mode.yaml as some of the 
properties do not match with reboot-mode.yaml properties. Can we use 
oneOf like below?

oneOf:
   - $ref: "reboot-mode.yaml#"
   - $ref: "../../input/qcom,pm8941-pwrkey.yaml#"

Also, If I drop additionalProperties I am getting below error.

kernel/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml: 
'additionalProperties' is a required property

Thanks,
Satya Priya

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

* Re: [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml
  2021-04-27  6:15       ` skakit
@ 2021-04-27  8:37         ` Sebastian Reichel
  2021-05-05  5:08           ` skakit
  0 siblings, 1 reply; 18+ messages in thread
From: Sebastian Reichel @ 2021-04-27  8:37 UTC (permalink / raw)
  To: skakit
  Cc: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm

[-- Attachment #1: Type: text/plain, Size: 2678 bytes --]

Hi,

On Tue, Apr 27, 2021 at 11:45:44AM +0530, skakit@codeaurora.org wrote:
> Hi Sebastian,
> 
> On 2021-04-09 13:48, skakit@codeaurora.org wrote:
> > Hi Sebastian,
> > 
> > On 2021-04-08 18:30, Sebastian Reichel wrote:
> > > Hi,
> > > 
> > > On Thu, Apr 08, 2021 at 05:01:08PM +0530, satya priya wrote:
> > > > Convert qcom PON binding from .txt to .yaml format.
> > > > 
> > > > Signed-off-by: satya priya <skakit@codeaurora.org>
> > > > ---
> > > 
> > > Thanks for doing this.
> > > 
> > > > Changes in V2:
> > > >  - As per Rob's comments, converted the main PON binding and
> > > > added in V2.
> > > > 
> [...]
> > > > +  reg:
> > > > +    description: Specifies the physical address of the pon register
> > > 
> > > That description is obvious and pointless. Instead add
> > > 
> > > maxItems: 1
> > > 
> > 
> > Okay.
> > 
> > > > +  pwrkey:
> > > > +    type: object
> > > > +    $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
> > > > +
> > > > +  resin:
> > > > +    type: object
> > > > +    $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
> > > > +
> > > > +required:
> > > > +  - compatible
> > > > +  - reg
> > > > +
> > > > +additionalProperties: true
> > > 
> > > Instead of allowing arbitrary properties, only valid modes
> > > should be allowed. So drop additionalProperties and do this
> > > instead:
> > > 
> > > allOf:
> > >   - $ref: reboot-mode.yaml#
> > > 
> > > unevaluatedProperties: false
> > > 
> > 
> > Okay.
> 
> I am not able to use 'allOf' to refer reboot-mode.yaml as some of the
> properties do not match with reboot-mode.yaml properties. Can we use oneOf
> like below?
> 
> oneOf:
>   - $ref: "reboot-mode.yaml#"
>   - $ref: "../../input/qcom,pm8941-pwrkey.yaml#"

That does not make sense.

The reference to reboot-mode.yaml is needed because it adds valid
mode properties, so that you can set unevaluatedProperties to false.
You need it at the root of the PON binding. They are not added to
the required list, so it's fine if not all of them are used. Also
there can (and usually is) more than one mode, so using oneOf is not
ok.

Last but not least the pwrkey reference is needed to describe
specific nodes (resin, pwrkey) and should not appear at the root
of the PON binding.

> Also, If I drop additionalProperties I am getting below error.
> 
> kernel/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml:
> 'additionalProperties' is a required property

You need to add 'unevaluatedProperties: false'. It is basically
the same as 'additionalProperties: false', but also accepts
properties from the referenced bindings.

Thanks,

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml
  2021-04-27  8:37         ` Sebastian Reichel
@ 2021-05-05  5:08           ` skakit
  2021-05-07  9:45             ` skakit
  0 siblings, 1 reply; 18+ messages in thread
From: skakit @ 2021-05-05  5:08 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm

On 2021-04-27 14:07, Sebastian Reichel wrote:
> Hi,
> 
> On Tue, Apr 27, 2021 at 11:45:44AM +0530, skakit@codeaurora.org wrote:
>> Hi Sebastian,
>> 
>> On 2021-04-09 13:48, skakit@codeaurora.org wrote:
>> > Hi Sebastian,
>> >
>> > On 2021-04-08 18:30, Sebastian Reichel wrote:
>> > > Hi,
>> > >
>> > > On Thu, Apr 08, 2021 at 05:01:08PM +0530, satya priya wrote:
>> > > > Convert qcom PON binding from .txt to .yaml format.
>> > > >
>> > > > Signed-off-by: satya priya <skakit@codeaurora.org>
>> > > > ---
>> > >
>> > > Thanks for doing this.
>> > >
>> > > > Changes in V2:
>> > > >  - As per Rob's comments, converted the main PON binding and
>> > > > added in V2.
>> > > >
>> [...]
>> > > > +  reg:
>> > > > +    description: Specifies the physical address of the pon register
>> > >
>> > > That description is obvious and pointless. Instead add
>> > >
>> > > maxItems: 1
>> > >
>> >
>> > Okay.
>> >
>> > > > +  pwrkey:
>> > > > +    type: object
>> > > > +    $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
>> > > > +
>> > > > +  resin:
>> > > > +    type: object
>> > > > +    $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
>> > > > +
>> > > > +required:
>> > > > +  - compatible
>> > > > +  - reg
>> > > > +
>> > > > +additionalProperties: true
>> > >
>> > > Instead of allowing arbitrary properties, only valid modes
>> > > should be allowed. So drop additionalProperties and do this
>> > > instead:
>> > >
>> > > allOf:
>> > >   - $ref: reboot-mode.yaml#
>> > >
>> > > unevaluatedProperties: false
>> > >
>> >
>> > Okay.
>> 
>> I am not able to use 'allOf' to refer reboot-mode.yaml as some of the
>> properties do not match with reboot-mode.yaml properties. Can we use 
>> oneOf
>> like below?
>> 
>> oneOf:
>>   - $ref: "reboot-mode.yaml#"
>>   - $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
> 
> That does not make sense.
> 
> The reference to reboot-mode.yaml is needed because it adds valid
> mode properties, so that you can set unevaluatedProperties to false.
> You need it at the root of the PON binding. They are not added to
> the required list, so it's fine if not all of them are used. Also
> there can (and usually is) more than one mode, so using oneOf is not
> ok.
> 

Okay, but I am getting errors like below during make dtbs_check.

kernel/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-ganges-kirin.dt.yaml: 
pon@800: 'compatible', 'pwrkey', 'reg' do not match any of the regexes: 
'^mode-.*$', 'pinctrl-[0-9]+'

As suggested I have added

allOf:
  - $ref: reboot-mode.yaml#

at the root of binding and also added unevaluatedProperties: false

> Last but not least the pwrkey reference is needed to describe
> specific nodes (resin, pwrkey) and should not appear at the root
> of the PON binding.
> 
>> Also, If I drop additionalProperties I am getting below error.
>> 
>> kernel/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml:
>> 'additionalProperties' is a required property
> 
> You need to add 'unevaluatedProperties: false'. It is basically
> the same as 'additionalProperties: false', but also accepts
> properties from the referenced bindings.
> 
> Thanks,
> 
> -- Sebastian

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

* Re: [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml
  2021-05-05  5:08           ` skakit
@ 2021-05-07  9:45             ` skakit
  2021-05-07 11:29               ` Sebastian Reichel
  0 siblings, 1 reply; 18+ messages in thread
From: skakit @ 2021-05-07  9:45 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm

Hi,
[...]
>>> > > > +
>>> > > > +required:
>>> > > > +  - compatible
>>> > > > +  - reg
>>> > > > +
>>> > > > +additionalProperties: true
>>> > >
>>> > > Instead of allowing arbitrary properties, only valid modes
>>> > > should be allowed. So drop additionalProperties and do this
>>> > > instead:
>>> > >
>>> > > allOf:
>>> > >   - $ref: reboot-mode.yaml#
>>> > >
>>> > > unevaluatedProperties: false
>>> > >
>>> >
>>> > Okay.
>>> 
>>> I am not able to use 'allOf' to refer reboot-mode.yaml as some of the
>>> properties do not match with reboot-mode.yaml properties. Can we use 
>>> oneOf
>>> like below?
>>> 
>>> oneOf:
>>>   - $ref: "reboot-mode.yaml#"
>>>   - $ref: "../../input/qcom,pm8941-pwrkey.yaml#"
>> 
>> That does not make sense.
>> 
>> The reference to reboot-mode.yaml is needed because it adds valid
>> mode properties, so that you can set unevaluatedProperties to false.
>> You need it at the root of the PON binding. They are not added to
>> the required list, so it's fine if not all of them are used. Also
>> there can (and usually is) more than one mode, so using oneOf is not
>> ok.
>> 
> 
> Okay, but I am getting errors like below during make dtbs_check.
> 
> kernel/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-ganges-kirin.dt.yaml:
> pon@800: 'compatible', 'pwrkey', 'reg' do not match any of the
> regexes: '^mode-.*$', 'pinctrl-[0-9]+'
> 

Seems like I have to make 'additionalProperties' as true in 
reboot-mode.yaml
I have checked other yaml binding docs where allOf is used, and they 
have 'additionalProperties' as true in the file which is being referred. 
Please let me know if this is not correct way to do it.

> As suggested I have added
> 
> allOf:
>  - $ref: reboot-mode.yaml#
> 
> at the root of binding and also added unevaluatedProperties: false
> 
>> Last but not least the pwrkey reference is needed to describe
>> specific nodes (resin, pwrkey) and should not appear at the root
>> of the PON binding.
>> 
>>> Also, If I drop additionalProperties I am getting below error.
>>> 
>>> kernel/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml:
>>> 'additionalProperties' is a required property
>> 
>> You need to add 'unevaluatedProperties: false'. It is basically
>> the same as 'additionalProperties: false', but also accepts
>> properties from the referenced bindings.
>> 
>> Thanks,
>> 
>> -- Sebastian

Thanks,
Satya Priya

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

* Re: [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml
  2021-05-07  9:45             ` skakit
@ 2021-05-07 11:29               ` Sebastian Reichel
  0 siblings, 0 replies; 18+ messages in thread
From: Sebastian Reichel @ 2021-05-07 11:29 UTC (permalink / raw)
  To: skakit
  Cc: Dmitry Torokhov, Rob Herring, Andy Gross, Bjorn Andersson,
	David Collins, kgunda, Vinod Koul, Courtney Cavin, linux-input,
	linux-kernel, devicetree, linux-arm-msm, linux-pm

[-- Attachment #1: Type: text/plain, Size: 525 bytes --]

Hi,

On Fri, May 07, 2021 at 03:15:55PM +0530, skakit@codeaurora.org wrote:
> Seems like I have to make 'additionalProperties' as true in reboot-mode.yaml
> I have checked other yaml binding docs where allOf is used, and they have
> 'additionalProperties' as true in the file which is being referred. Please
> let me know if this is not correct way to do it.

Yes, reboot-mode.yaml should have additionalProperties = true. I
think Rob missed, that the binding is a generic one when he added
it in f84e2c5c528d.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2021-05-07 11:30 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 11:31 [PATCH V2 0/4] Add support for PMK8350 PON_HLOS PMIC peripheral satya priya
2021-04-08 11:31 ` [PATCH V2 1/4] input: pm8941-pwrkey: add " satya priya
2021-04-13  3:00   ` Bjorn Andersson
2021-04-08 11:31 ` [PATCH V2 2/4] dt-bindings: input: pm8941-pwrkey: add pmk8350 compatible strings satya priya
2021-04-09 18:46   ` Rob Herring
2021-04-08 11:31 ` [PATCH V2 3/4] dt-bindings: power: reset: qcom-pon: Convert qcom PON binding to yaml satya priya
2021-04-08 13:00   ` Sebastian Reichel
2021-04-09  8:18     ` skakit
2021-04-09 11:57       ` Sebastian Reichel
2021-04-09 13:38         ` skakit
2021-04-27  6:15       ` skakit
2021-04-27  8:37         ` Sebastian Reichel
2021-05-05  5:08           ` skakit
2021-05-07  9:45             ` skakit
2021-05-07 11:29               ` Sebastian Reichel
2021-04-08 11:31 ` [PATCH V2 4/4] dt-bindings: input: pm8941-pwrkey: Convert pm8941 power key " satya priya
2021-04-09 18:50   ` Rob Herring
2021-04-21  6:23     ` skakit

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