Skip to contentSkip to conversation

Input: pm8941-pwrkey: add resin key capabilities

PATCH In review Tirupathi Reddy 5 participants 8 messages Mar 23, 2018 – May 15, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Input: pm8941-pwrkey: add resin key capabilities

Add resin key support to handle different types of key events defined in different platforms.

---
 .../bindings/input/qcom,pm8941-pwrkey.txt          | 32 +++++++++
 drivers/input/misc/pm8941-pwrkey.c                 | 81 ++++++++++++++++++++++
 2 files changed, 113 insertions(+)
Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt +32 -0
index 07bf55f..c671636 100644
@@ -32,6 +32,32 @@ PROPERTIES
 	Definition: presence of this property indicates that the KPDPWR_N pin
 		    should be configured for pull up.
 
+RESIN SUBNODE
+
+The HW module can generate other optional key events like RESIN(reset-in pin).
+The RESIN pin can be configured to support different key events on different
+platforms. The resin key is described by the following properties.
+
+- 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.
+
+- linux,code:
+	Usage: required
+	Value type: <u32>
+	Definition: The input key-code associated with the resin key.
+		    Use the linux event codes defined in
+		    include/dt-bindings/input/linux-event-codes.h
+
+- bias-pull-up:
+	Usage: optional
+	Value type: <empty>
+	Definition: presence of this property indicates that the RESIN pin
+		    should be configured for pull up.
+
 EXAMPLE
 
 	pwrkey@800 {
@@ -40,4 +66,10 @@ EXAMPLE
 		interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
 		debounce = <15625>;
 		bias-pull-up;
+
+		resin {
+			interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
+			linux,code = <KEY_VOLUMEDOWN>;
+			bias-pull-up;
+		};
 	};
drivers/input/misc/pm8941-pwrkey.c +81 -0

126 lines not on this page · raw message

Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#1 lore raw

Hi Tirupathi,

Quoted 80 lines
drivers/input/misc/pm8941-pwrkey.c +65 -0
+static irqreturn_t pm8941_resinkey_irq(int irq, void *_data)
+{
+	struct pm8941_pwrkey *pwrkey = _data;
+	unsigned int sts;
+	int error;
+	u32 key_code = pwrkey->resin_key_code;
+
+	error = regmap_read(pwrkey->regmap,
+			    pwrkey->baseaddr + PON_RT_STS, &sts);
+	if (error)
+		return IRQ_HANDLED;
+
+	input_report_key(pwrkey->input, key_code, !!(sts & PON_RESIN_N_SET));
+	input_sync(pwrkey->input);
+
+	return IRQ_HANDLED;
+}
+
  static int __maybe_unused pm8941_pwrkey_suspend(struct device *dev)
  {
  	struct pm8941_pwrkey *pwrkey = dev_get_drvdata(dev);
@@ -153,9 +175,56 @@ static int __maybe_unused pm8941_pwrkey_resume(struct device *dev)
  static SIMPLE_DEV_PM_OPS(pm8941_pwr_key_pm_ops,
  			 pm8941_pwrkey_suspend, pm8941_pwrkey_resume);
 
+static int pm8941_resin_key_init(struct pm8941_pwrkey *pwrkey,
+			struct device_node *np)
+{
+	int error, irq;
+	bool pull_up;
+
+	/*
+	 * Get the standard-key parameters. This might not be
+	 * specified if there is no key mapping on the reset line.
+	 */
+	error = of_property_read_u32(np, "linux,code", &pwrkey->resin_key_code);
+	if (error) {
+		dev_err(pwrkey->dev, "failed to read key-code for resin key\n");
+		return error;
+	}
+
+	pull_up = of_property_read_bool(np, "bias-pull-up");
+
+	irq = irq_of_parse_and_map(np, 0);
+	if (irq < 0) {
+		dev_err(pwrkey->dev, "failed to get resin irq\n");
+		return -EINVAL;
+	}
+
+	/* Register key configuration */
+	input_set_capability(pwrkey->input, EV_KEY, pwrkey->resin_key_code);
+
+	error = regmap_update_bits(pwrkey->regmap,
+				   pwrkey->baseaddr + PON_PULL_CTL,
+				   PON_RESIN_PULL_UP,
+				   pull_up ? PON_RESIN_PULL_UP : 0);
+	if (error) {
+		dev_err(pwrkey->dev, "failed to set resin pull: %d\n", error);
+		return error;
+	}
+
+	error = devm_request_threaded_irq(pwrkey->dev, irq, NULL,
+					  pm8941_resinkey_irq, IRQF_ONESHOT,
+					  "pm8941_resinkey", pwrkey);
+	if (error)
+		dev_err(pwrkey->dev, "failed requesting resin key IRQ: %d\n",
+			error);
+
+	return error;
+}
+
  static int pm8941_pwrkey_probe(struct platform_device *pdev)
  {
  	struct pm8941_pwrkey *pwrkey;
+	struct device_node *np = NULL;
  	bool pull_up;
  	u32 req_delay;
  	int error;

drivers/input/misc/pm8941-pwrkey.c static int pm8941_pwrkey_probe(struct platform_device *pdev) · line 316

Quoted 7 lines
drivers/input/misc/pm8941-pwrkey.c +4 -0
@@ -241,6 +310,18 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev)
  		return error;
  	}
 
+	np = of_find_node_by_name(pdev->dev.of_node, "resin");
+	if (np) {
+		/* resin key capabilities are defined in device node */
+		error = pm8941_resin_key_init(pwrkey, np);

What happens if interrupts comes as soon as you have done the key_init(..) here? I see that you are registering the input device after it, right? Looks like you should do this at the end of probe?

Quoted 12 lines
drivers/input/misc/pm8941-pwrkey.c +8 -0
+		of_node_put(np);
+		if (error) {
+			dev_err(&pdev->dev, "failed resin key initialization: %d\n",
+				error);
+			return error;
+		}
+	}
+
  	error = input_register_device(pwrkey->input);
  	if (error) {
  		dev_err(&pdev->dev, "failed to register input device: %d\n",
Signature · 2 lines
---Trilok Soni
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
maintainer
#2 lore raw
Quoted 83 lines · Trilok Soni

Hi Tirupathi,

Quoted 81 lines
drivers/input/misc/pm8941-pwrkey.c +66 -0
+static irqreturn_t pm8941_resinkey_irq(int irq, void *_data)
+{
+	struct pm8941_pwrkey *pwrkey = _data;
+	unsigned int sts;
+	int error;
+	u32 key_code = pwrkey->resin_key_code;
+
+	error = regmap_read(pwrkey->regmap,
+			    pwrkey->baseaddr + PON_RT_STS, &sts);
+	if (error)
+		return IRQ_HANDLED;
+
+	input_report_key(pwrkey->input, key_code, !!(sts & PON_RESIN_N_SET));
+	input_sync(pwrkey->input);
+
+	return IRQ_HANDLED;
+}
+
  static int __maybe_unused pm8941_pwrkey_suspend(struct device *dev)
  {
  	struct pm8941_pwrkey *pwrkey = dev_get_drvdata(dev);
@@ -153,9 +175,56 @@ static int __maybe_unused pm8941_pwrkey_resume(struct device *dev)
  static SIMPLE_DEV_PM_OPS(pm8941_pwr_key_pm_ops,
  			 pm8941_pwrkey_suspend, pm8941_pwrkey_resume);
+static int pm8941_resin_key_init(struct pm8941_pwrkey *pwrkey,
+			struct device_node *np)
+{
+	int error, irq;
+	bool pull_up;
+
+	/*
+	 * Get the standard-key parameters. This might not be
+	 * specified if there is no key mapping on the reset line.
+	 */
+	error = of_property_read_u32(np, "linux,code", &pwrkey->resin_key_code);
+	if (error) {
+		dev_err(pwrkey->dev, "failed to read key-code for resin key\n");
+		return error;
+	}
+
+	pull_up = of_property_read_bool(np, "bias-pull-up");
+
+	irq = irq_of_parse_and_map(np, 0);
+	if (irq < 0) {
+		dev_err(pwrkey->dev, "failed to get resin irq\n");
+		return -EINVAL;
+	}
+
+	/* Register key configuration */
+	input_set_capability(pwrkey->input, EV_KEY, pwrkey->resin_key_code);
+
+	error = regmap_update_bits(pwrkey->regmap,
+				   pwrkey->baseaddr + PON_PULL_CTL,
+				   PON_RESIN_PULL_UP,
+				   pull_up ? PON_RESIN_PULL_UP : 0);
+	if (error) {
+		dev_err(pwrkey->dev, "failed to set resin pull: %d\n", error);
+		return error;
+	}
+
+	error = devm_request_threaded_irq(pwrkey->dev, irq, NULL,
+					  pm8941_resinkey_irq, IRQF_ONESHOT,
+					  "pm8941_resinkey", pwrkey);
+	if (error)
+		dev_err(pwrkey->dev, "failed requesting resin key IRQ: %d\n",
+			error);
+
+	return error;
+}
+
  static int pm8941_pwrkey_probe(struct platform_device *pdev)
  {
  	struct pm8941_pwrkey *pwrkey;
+	struct device_node *np = NULL;
  	bool pull_up;
  	u32 req_delay;
  	int error;
@@ -241,6 +310,18 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev)
  		return error;
  	}
+	np = of_find_node_by_name(pdev->dev.of_node, "resin");
Quoted 8 lines

drivers/input/misc/pm8941-pwrkey.c static int pm8941_pwrkey_probe(struct platform_device *pdev) · line 316

Quoted 3 lines
drivers/input/misc/pm8941-pwrkey.c +3 -0
+	if (np) {
+		/* resin key capabilities are defined in device node */
+		error = pm8941_resin_key_init(pwrkey, np);

What happens if interrupts comes as soon as you have done the key_init(..) here? I see that you are registering the input device after it, right? Looks like you should do this at the end of probe?

It should be fine, input devices properly allocated (with input_allocate_device() or devm- version) are able to accept events even if input device has not been registered yet. It is and advertised feature:

drivers/input/input.c:

"
* input_event() - report new input event
...
* NOTE: input_event() may be safely used right after input device was
* allocated with input_allocate_device(), even before it is registered
* with input_register_device(), but the event will not reach any of the
* input handlers. Such early invocation of input_event() may be used
* to 'seed' initial state of a switch or initial position of absolute
* axis, etc.
"

Thanks.

Signature · 1 line
Dmitry
#3 lore raw

Hi Dmitry,

Quoted 13 lines
Quoted 5 lines

What happens if interrupts comes as soon as you have done the key_init(..) here? I see that you are registering the input device after it, right? Looks like you should do this at the end of probe?

It should be fine, input devices properly allocated (with input_allocate_device() or devm- version) are able to accept events even if input device has not been registered yet. It is and advertised feature:

drivers/input/input.c:

Quoted 9 lines

"
* input_event() - report new input event
...
* NOTE: input_event() may be safely used right after input device was
* allocated with input_allocate_device(), even before it is registered
* with input_register_device(), but the event will not reach any of the
* input handlers. Such early invocation of input_event() may be used
* to 'seed' initial state of a switch or initial position of absolute
* axis, etc.

Thanks. Looks good since input_allocate_device(...) is called before the init.

Signature · 2 lines
---Trilok Soni
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
maintainer Reviewed-by on v3 1/1
#4 lore raw
In reply to Tirupathi Reddy
Quoted 6 lines · Tirupathi Reddy

Add resin key support to handle different types of key events defined in different platforms.

---
 .../bindings/input/qcom,pm8941-pwrkey.txt          | 32 +++++++++
Quoted 2 lines
 drivers/input/misc/pm8941-pwrkey.c                 | 81 ++++++++++++++++++++++
 2 files changed, 113 insertions(+)
maintainer
#5 lore raw
In reply to Tirupathi Reddy

Hi Tirupathi,

Quoted 47 lines · Tirupathi Reddy

Add resin key support to handle different types of key events defined in different platforms.

---
 .../bindings/input/qcom,pm8941-pwrkey.txt          | 32 +++++++++
 drivers/input/misc/pm8941-pwrkey.c                 | 81 ++++++++++++++++++++++
 2 files changed, 113 insertions(+)
Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt +26 -0
index 07bf55f..c671636 100644
@@ -32,6 +32,32 @@ PROPERTIES
 	Definition: presence of this property indicates that the KPDPWR_N pin
 		    should be configured for pull up.
 
+RESIN SUBNODE
+
+The HW module can generate other optional key events like RESIN(reset-in pin).
+The RESIN pin can be configured to support different key events on different
+platforms. The resin key is described by the following properties.
+
+- 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.
+
+- linux,code:
+	Usage: required
+	Value type: <u32>
+	Definition: The input key-code associated with the resin key.
+		    Use the linux event codes defined in
+		    include/dt-bindings/input/linux-event-codes.h
+
+- bias-pull-up:
+	Usage: optional
+	Value type: <empty>
+	Definition: presence of this property indicates that the RESIN pin
+		    should be configured for pull up.
+
 EXAMPLE
 
 	pwrkey@800 {

Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt EXAMPLE · line 75

Quoted 10 lines
Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt +6 -0
@@ -40,4 +66,10 @@ EXAMPLE
 		interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
 		debounce = <15625>;
 		bias-pull-up;
+
+		resin {
+			interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
+			linux,code = <KEY_VOLUMEDOWN>;
+			bias-pull-up;
+		};
 	};

The new key and power key bindings are very similar, I would prefer if we shared the parsing code and our new DTS looked like:

		power {
			...
		};
 
		resin {
			...
		};

(we can easily keep backward compatibility with power properties being in device node).

Quoted 74 lines
drivers/input/misc/pm8941-pwrkey.c +31 -0
index 18ad956..6e45d01 100644
@@ -20,6 +20,7 @@
 #include <linux/log2.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/of_irq.h>
 #include <linux/platform_device.h>
 #include <linux/reboot.h>
 #include <linux/regmap.h>
@@ -28,6 +29,7 @@
 
 #define PON_RT_STS			0x10
 #define  PON_KPDPWR_N_SET		BIT(0)
+#define  PON_RESIN_N_SET		BIT(1)
 
 #define PON_PS_HOLD_RST_CTL		0x5a
 #define PON_PS_HOLD_RST_CTL2		0x5b
@@ -37,6 +39,7 @@
 #define  PON_PS_HOLD_TYPE_HARD_RESET	7
 
 #define PON_PULL_CTL			0x70
+#define  PON_RESIN_PULL_UP		BIT(0)
 #define  PON_KPDPWR_PULL_UP		BIT(1)
 
 #define PON_DBC_CTL			0x71
@@ -46,6 +49,7 @@
 struct pm8941_pwrkey {
 	struct device *dev;
 	int irq;
+	u32 resin_key_code;
 	u32 baseaddr;
 	struct regmap *regmap;
 	struct input_dev *input;
@@ -130,6 +134,24 @@ static irqreturn_t pm8941_pwrkey_irq(int irq, void *_data)
 	return IRQ_HANDLED;
 }
 
+static irqreturn_t pm8941_resinkey_irq(int irq, void *_data)
+{
+	struct pm8941_pwrkey *pwrkey = _data;
+	unsigned int sts;
+	int error;
+	u32 key_code = pwrkey->resin_key_code;
+
+	error = regmap_read(pwrkey->regmap,
+			    pwrkey->baseaddr + PON_RT_STS, &sts);
+	if (error)
+		return IRQ_HANDLED;
+
+	input_report_key(pwrkey->input, key_code, !!(sts & PON_RESIN_N_SET));
+	input_sync(pwrkey->input);
+
+	return IRQ_HANDLED;
+}
+
 static int __maybe_unused pm8941_pwrkey_suspend(struct device *dev)
 {
 	struct pm8941_pwrkey *pwrkey = dev_get_drvdata(dev);
@@ -153,9 +175,56 @@ static int __maybe_unused pm8941_pwrkey_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(pm8941_pwr_key_pm_ops,
 			 pm8941_pwrkey_suspend, pm8941_pwrkey_resume);
 
+static int pm8941_resin_key_init(struct pm8941_pwrkey *pwrkey,
+			struct device_node *np)
+{
+	int error, irq;
+	bool pull_up;
+
+	/*
+	 * Get the standard-key parameters. This might not be
+	 * specified if there is no key mapping on the reset line.

drivers/input/misc/pm8941-pwrkey.c static int __maybe_unused pm8941_pwrkey_resume(struct device *dev) · line 196

Quoted 10 lines
drivers/input/misc/pm8941-pwrkey.c +10 -0
+	 */
+	error = of_property_read_u32(np, "linux,code", &pwrkey->resin_key_code);
+	if (error) {
+		dev_err(pwrkey->dev, "failed to read key-code for resin key\n");
+		return error;
+	}
+
+	pull_up = of_property_read_bool(np, "bias-pull-up");
+
+	irq = irq_of_parse_and_map(np, 0);

irq_of_parse_and_map() returns unsigned.

Quoted 56 lines
drivers/input/misc/pm8941-pwrkey.c +40 -0
+	if (irq < 0) {
+		dev_err(pwrkey->dev, "failed to get resin irq\n");
+		return -EINVAL;
+	}
+
+	/* Register key configuration */
+	input_set_capability(pwrkey->input, EV_KEY, pwrkey->resin_key_code);
+
+	error = regmap_update_bits(pwrkey->regmap,
+				   pwrkey->baseaddr + PON_PULL_CTL,
+				   PON_RESIN_PULL_UP,
+				   pull_up ? PON_RESIN_PULL_UP : 0);
+	if (error) {
+		dev_err(pwrkey->dev, "failed to set resin pull: %d\n", error);
+		return error;
+	}
+
+	error = devm_request_threaded_irq(pwrkey->dev, irq, NULL,
+					  pm8941_resinkey_irq, IRQF_ONESHOT,
+					  "pm8941_resinkey", pwrkey);
+	if (error)
+		dev_err(pwrkey->dev, "failed requesting resin key IRQ: %d\n",
+			error);
+
+	return error;
+}
+
 static int pm8941_pwrkey_probe(struct platform_device *pdev)
 {
 	struct pm8941_pwrkey *pwrkey;
+	struct device_node *np = NULL;
 	bool pull_up;
 	u32 req_delay;
 	int error;
@@ -241,6 +310,18 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev)
 		return error;
 	}
 
+	np = of_find_node_by_name(pdev->dev.of_node, "resin");
+	if (np) {
+		/* resin key capabilities are defined in device node */
+		error = pm8941_resin_key_init(pwrkey, np);
+		of_node_put(np);
+		if (error) {
+			dev_err(&pdev->dev, "failed resin key initialization: %d\n",
+				error);
+			return error;
+		}
+	}
+
 	error = input_register_device(pwrkey->input);
 	if (error) {
 		dev_err(&pdev->dev, "failed to register input device: %d\n",
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

Can you please try the version below and let me know if it works for you?

Thanks!

Signature · 16 lines
Dmitry


Input: pm8941-pwrkey - add resin key capabilities

From: Tirupathi Reddy <[email protected]>

Add resin key support to handle different types of key events
defined in different platforms.

Signed-off-by: Tirupathi Reddy <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
---
 .../bindings/input/qcom,pm8941-pwrkey.txt          |   56 ++++++-
 drivers/input/misc/pm8941-pwrkey.c                 |  163 +++++++++++++-------
 2 files changed, 161 insertions(+), 58 deletions(-)
Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt +51 -5
index 07bf55f6e0b9a..314bc7fd767d7 100644
@@ -13,6 +13,14 @@ PROPERTIES
 	Value type: <prop-encoded-array>
 	Definition: base address of registers for block
 
+- debounce:
+	Usage: optional
+	Value type: <u32>
+	Definition: time in microseconds that key must be pressed or released
+		    for state change interrupt to trigger.
+
+POWER SUBNODE
+
 - interrupts:
 	Usage: required
 	Value type: <prop-encoded-array>
@@ -20,11 +28,13 @@ PROPERTIES
 		    defined by the binding document describing the node's
 		    interrupt parent.
 
-- debounce:
+- linux,code:
 	Usage: optional
 	Value type: <u32>
-	Definition: time in microseconds that key must be pressed or released
-		    for state change interrupt to trigger.
+	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.
 
 - bias-pull-up:
 	Usage: optional
@@ -32,12 +42,48 @@ PROPERTIES
 	Definition: presence of this property indicates that the KPDPWR_N pin
 		    should be configured for pull up.
 
+RESIN SUBNODE (optional)
+
+The HW module can generate other optional key events like RESIN(reset-in pin).
+The RESIN pin can be configured to support different key events on different
+platforms. The resin key is described by the following properties.
+
+- 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.
+
+- linux,code:
+	Usage: required
+	Value type: <u32>
+	Definition: The input key-code associated with the resin key.
+		    Use the linux event codes defined in
+		    include/dt-bindings/input/linux-event-codes.h
+
+- bias-pull-up:
+	Usage: optional
+	Value type: <empty>
+	Definition: presence of this property indicates that the RESIN pin
+		    should be configured for pull up.
+
 EXAMPLE
 
 	pwrkey@800 {
 		compatible = "qcom,pm8941-pwrkey";
 		reg = <0x800>;
-		interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
 		debounce = <15625>;
-		bias-pull-up;
+
+		power {
+			interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
+			linux,code = <KEY_POWER>;
+			bias-pull-up;
+		};
+
+		resin {
+			interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
+			linux,code = <KEY_VOLUMEDOWN>;
+			bias-pull-up;
+		};
 	};
drivers/input/misc/pm8941-pwrkey.c +110 -53

258 lines not on this page · raw message

#6 lore raw
Quoted 13 lines · Dmitry Torokhov

Hi Tirupathi,

Quoted 10 lines · Tirupathi Reddy

Add resin key support to handle different types of key events defined in different platforms.

---
 .../bindings/input/qcom,pm8941-pwrkey.txt          | 32 +++++++++
 drivers/input/misc/pm8941-pwrkey.c                 | 81 ++++++++++++++++++++++
 2 files changed, 113 insertions(+)
Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt +0 -0

[..]

Quoted 26 lines
Quoted 4 lines

EXAMPLE

Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt +0 -0
 	pwrkey@800 {

Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt EXAMPLE · line 75

Quoted 10 lines
Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt +6 -0
@@ -40,4 +66,10 @@ EXAMPLE
 		interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
 		debounce = <15625>;
 		bias-pull-up;
+
+		resin {
+			interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
+			linux,code = <KEY_VOLUMEDOWN>;
+			bias-pull-up;
+		};
 	};

The new key and power key bindings are very similar, I would prefer if we shared the parsing code and our new DTS looked like:

		power {
			...
		};
 
		resin {
			...
		};
Quoted 3 lines

(we can easily keep backward compatibility with power properties being in device node).

As discussed here https://patchwork.kernel.org/patch/9751627/ the PON block does, in addition to providing power and resin key support also handle the restart reason ("reboot bootloader" in Android).

My interpretation of our conclusion was to come up with a new binding for the "pon" and a driver for this block that instantiates the power key device.

It seems reasonable for such binding to describe the two keys, as you propose here Dmitry, and instantiates the two input devices based on this.

Regards,
Bjorn

maintainer
#7 lore raw
Quoted 50 lines · Bjorn Andersson
Quoted 13 lines · Dmitry Torokhov

Hi Tirupathi,

Quoted 10 lines · Tirupathi Reddy

Add resin key support to handle different types of key events defined in different platforms.

---
 .../bindings/input/qcom,pm8941-pwrkey.txt          | 32 +++++++++
 drivers/input/misc/pm8941-pwrkey.c                 | 81 ++++++++++++++++++++++
 2 files changed, 113 insertions(+)
Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt +0 -0

[..]

Quoted 26 lines
Quoted 4 lines

EXAMPLE

Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt +0 -0
 	pwrkey@800 {

Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt EXAMPLE · line 75

Quoted 10 lines
Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt +6 -0
@@ -40,4 +66,10 @@ EXAMPLE
 		interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
 		debounce = <15625>;
 		bias-pull-up;
+
+		resin {
+			interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
+			linux,code = <KEY_VOLUMEDOWN>;
+			bias-pull-up;
+		};
 	};

The new key and power key bindings are very similar, I would prefer if we shared the parsing code and our new DTS looked like:

		power {
			...
		};
 
		resin {
			...
		};
Quoted 3 lines

(we can easily keep backward compatibility with power properties being in device node).

As discussed here https://patchwork.kernel.org/patch/9751627/ the PON block does, in addition to providing power and resin key support also handle the restart reason ("reboot bootloader" in Android).

Quoted 7 lines

My interpretation of our conclusion was to come up with a new binding for the "pon" and a driver for this block that instantiates the power key device.

It seems reasonable for such binding to describe the two keys, as you propose here Dmitry, and instantiates the two input devices based on this.

OK, I'll wait for the new driver and binding then.

Thanks.

Signature · 1 line
Dmitry