linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Add polling mode to the MPR121 touchkey
@ 2019-10-01 14:29 Michal Vokáč
  2019-10-01 14:29 ` [PATCH v2 1/5] dt-bindings: input: Add common input binding in json-schema Michal Vokáč
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Michal Vokáč @ 2019-10-01 14:29 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring
  Cc: Shawn Guo, Fabio Estevam, linux-input, devicetree,
	Michal Vokáč

This series is another attempt to use the MPR121 touch sensor
controller in polling mode. This version uses the brand new
input-poller API.

Michal Vokáč (5):
  dt-bindings: input: Add common input binding in json-schema
  dt-bindings: input: Convert mpr121 binding to json-schema
  dt-bindings: input: Add poll-interval property
  Input: mpr121: Add polling mode
  ARM: dts: imx6dl-yapp4: Enable the MPR121 touchkey controller on Hydra

 .../bindings/input/fsl,mpr121-touchkey.yaml        | 89 ++++++++++++++++++++++
 Documentation/devicetree/bindings/input/input.yaml | 29 +++++++
 .../devicetree/bindings/input/mpr121-touchkey.txt  | 30 --------
 arch/arm/boot/dts/imx6dl-yapp4-common.dtsi         | 13 ++++
 arch/arm/boot/dts/imx6dl-yapp4-hydra.dts           |  4 +
 drivers/input/keyboard/mpr121_touchkey.c           | 69 ++++++++++++-----
 6 files changed, 186 insertions(+), 48 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
 create mode 100644 Documentation/devicetree/bindings/input/input.yaml
 delete mode 100644 Documentation/devicetree/bindings/input/mpr121-touchkey.txt

-- 
2.1.4


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

* [PATCH v2 1/5] dt-bindings: input: Add common input binding in json-schema
  2019-10-01 14:29 [PATCH v2 0/5] Add polling mode to the MPR121 touchkey Michal Vokáč
@ 2019-10-01 14:29 ` Michal Vokáč
  2019-10-01 15:03   ` Rob Herring
  2019-10-01 14:29 ` [PATCH v2 2/5] dt-bindings: input: Convert mpr121 binding to json-schema Michal Vokáč
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Michal Vokáč @ 2019-10-01 14:29 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring
  Cc: Shawn Guo, Fabio Estevam, linux-input, devicetree,
	Michal Vokáč

Create schema for the common input properties.

Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
---
Changes since v1:
 - New patch in the series.

Rob, you suggested to extract the common properties from
fsl,mpr121-touchkey.yaml into this file. In the meantime I realized that
the linux,keycodes property is already documented in keys.txt.

What do you suggest to do? Some possible options:
 - Just remove the linux,keycodes propery from keys.txt.
 - Merge this input.yaml with all content of keys.txt. How to name the result?
 - Something else?

 Documentation/devicetree/bindings/input/input.yaml | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/input.yaml

diff --git a/Documentation/devicetree/bindings/input/input.yaml b/Documentation/devicetree/bindings/input/input.yaml
new file mode 100644
index 000000000000..494e7d031ea3
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/input.yaml
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/input.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Common input schema binding
+
+maintainers:
+  - Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+properties:
+  linux,keycodes:
+    description:
+      Specifies an array of numeric keycode values to be used for reporting
+      button presses. The array can contain up to 12 entries.
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32-array
+      - items:
+          minimum: 0
+          maximum: 0xff
+
+  autorepeat:
+    description: Enable autorepeat when key is pressed and held down.
+    type: boolean
-- 
2.1.4


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

* [PATCH v2 2/5] dt-bindings: input: Convert mpr121 binding to json-schema
  2019-10-01 14:29 [PATCH v2 0/5] Add polling mode to the MPR121 touchkey Michal Vokáč
  2019-10-01 14:29 ` [PATCH v2 1/5] dt-bindings: input: Add common input binding in json-schema Michal Vokáč
@ 2019-10-01 14:29 ` Michal Vokáč
  2019-10-03 19:09   ` Rob Herring
  2019-10-01 14:29 ` [PATCH v2 3/5] dt-bindings: input: Add poll-interval property Michal Vokáč
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Michal Vokáč @ 2019-10-01 14:29 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring
  Cc: Shawn Guo, Fabio Estevam, linux-input, devicetree,
	Michal Vokáč

Convert the mpr121 binding to DT schema format using json-schema.

Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
---
Changes since v1:
 - Extract the common input properties into the input.yaml schema.
 - Fix the wakeup-source description.
 - Fix the example to pass validation. Put the mpr121 device sub-node
   into a i2c {} node.

Rob, the linux,keycodes property is not valid as it is.
If I put the minItems and maxItems into the common schema, it is valid
and the min/max length check works fine. What could be wrong?

The error is not very specific..

$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
  SCHEMA  Documentation/devicetree/bindings/processed-schema.yaml
/home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml: ignoring, error in schema 'linux,keycodes'
warning: no schema found in file: /home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
/home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/Makefile:33: recipe for target 'Documentation/devicetree/bindings/processed-schema.yaml' failed
make[3]: *** [Documentation/devicetree/bindings/processed-schema.yaml] Error 255
/home/vokac/development/sources/linux-fslc/Makefile:1264: recipe for target 'dt_binding_check' failed

 .../bindings/input/fsl,mpr121-touchkey.yaml        | 66 ++++++++++++++++++++++
 .../devicetree/bindings/input/mpr121-touchkey.txt  | 30 ----------
 2 files changed, 66 insertions(+), 30 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
 delete mode 100644 Documentation/devicetree/bindings/input/mpr121-touchkey.txt

diff --git a/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml b/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
new file mode 100644
index 000000000000..c6fbcdf78556
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/fsl,mpr121-touchkey.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale MPR121 capacitive touch sensor controller
+
+maintainers:
+  - Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+description: |
+  The MPR121 supports up to 12 completely independent electrodes/capacitance
+  sensing inputs in which 8 are multifunctional for LED driving and GPIO.
+  https://www.nxp.com/docs/en/data-sheet/MPR121.pdf
+
+allOf:
+  - $ref: input.yaml#
+
+properties:
+  compatible:
+    const: fsl,mpr121-touchkey
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  vdd-supply:
+    maxItems: 1
+
+  linux,keycodes:
+    minItems: 1
+    maxItems: 12
+
+  wakeup-source:
+    description: Use any event on keypad as wakeup event.
+    type: boolean
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - vdd-supply
+  - linux,keycodes
+
+examples:
+  - |
+    #include "dt-bindings/input/input.h"
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        mpr121@5a {
+            compatible = "fsl,mpr121-touchkey";
+            reg = <0x5a>;
+            interrupt-parent = <&gpio1>;
+            interrupts = <28 2>;
+            autorepeat;
+            vdd-supply = <&ldo4_reg>;
+            linux,keycodes = <KEY_0>, <KEY_1>, <KEY_2>, <KEY_3>,
+                             <KEY_4>, <KEY_5>, <KEY_6>, <KEY_7>,
+                             <KEY_8>, <KEY_9>, <KEY_A>, <KEY_B>;
+        };
+    };
diff --git a/Documentation/devicetree/bindings/input/mpr121-touchkey.txt b/Documentation/devicetree/bindings/input/mpr121-touchkey.txt
deleted file mode 100644
index b7c61ee5841b..000000000000
--- a/Documentation/devicetree/bindings/input/mpr121-touchkey.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-* Freescale MPR121 Controllor
-
-Required Properties:
-- compatible:		Should be "fsl,mpr121-touchkey"
-- reg:			The I2C slave address of the device.
-- interrupts:		The interrupt number to the cpu.
-- vdd-supply:		Phandle to the Vdd power supply.
-- linux,keycodes:	Specifies an array of numeric keycode values to
-			be used for reporting button presses. The array can
-			contain up to 12 entries.
-
-Optional Properties:
-- wakeup-source:	Use any event on keypad as wakeup event.
-- autorepeat:		Enable autorepeat feature.
-
-Example:
-
-#include "dt-bindings/input/input.h"
-
-	touchkey: mpr121@5a {
-		compatible = "fsl,mpr121-touchkey";
-		reg = <0x5a>;
-		interrupt-parent = <&gpio1>;
-		interrupts = <28 2>;
-		autorepeat;
-		vdd-supply = <&ldo4_reg>;
-		linux,keycodes = <KEY_0>, <KEY_1>, <KEY_2>, <KEY_3>,
-				<KEY_4> <KEY_5>, <KEY_6>, <KEY_7>,
-				<KEY_8>, <KEY_9>, <KEY_A>, <KEY_B>;
-	};
-- 
2.1.4


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

* [PATCH v2 3/5] dt-bindings: input: Add poll-interval property
  2019-10-01 14:29 [PATCH v2 0/5] Add polling mode to the MPR121 touchkey Michal Vokáč
  2019-10-01 14:29 ` [PATCH v2 1/5] dt-bindings: input: Add common input binding in json-schema Michal Vokáč
  2019-10-01 14:29 ` [PATCH v2 2/5] dt-bindings: input: Convert mpr121 binding to json-schema Michal Vokáč
@ 2019-10-01 14:29 ` Michal Vokáč
  2019-10-01 14:29 ` [PATCH v2 4/5] Input: mpr121: Add polling mode Michal Vokáč
  2019-10-01 14:29 ` [PATCH v2 5/5] ARM: dts: imx6dl-yapp4: Enable the MPR121 touchkey controller on Hydra Michal Vokáč
  4 siblings, 0 replies; 12+ messages in thread
From: Michal Vokáč @ 2019-10-01 14:29 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring
  Cc: Shawn Guo, Fabio Estevam, linux-input, devicetree,
	Michal Vokáč

Add an option to periodicaly poll the device to get state of the inputs
as the interrupt line may not be used on some platforms.

Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
---
Changes since v1:
 - Use poll-interval instead of linux,poll-interval.
 - Place the poll-interval binding into the common schema.
 - Properly describe that either interrupts or poll-interval property is
   required.
 - Fix the example to pass validation.

 .../bindings/input/fsl,mpr121-touchkey.yaml        | 25 +++++++++++++++++++++-
 Documentation/devicetree/bindings/input/input.yaml |  4 ++++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml b/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
index c6fbcdf78556..035b2fee4491 100644
--- a/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
+++ b/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
@@ -17,6 +17,10 @@ description: |
 allOf:
   - $ref: input.yaml#
 
+oneOf:
+  - required: [ interrupts ]
+  - required: [ poll-interval ]
+
 properties:
   compatible:
     const: fsl,mpr121-touchkey
@@ -41,12 +45,12 @@ properties:
 required:
   - compatible
   - reg
-  - interrupts
   - vdd-supply
   - linux,keycodes
 
 examples:
   - |
+    // Example with interrupts
     #include "dt-bindings/input/input.h"
     i2c {
         #address-cells = <1>;
@@ -64,3 +68,22 @@ examples:
                              <KEY_8>, <KEY_9>, <KEY_A>, <KEY_B>;
         };
     };
+
+  - |
+    // Example with polling
+    #include "dt-bindings/input/input.h"
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        mpr121@5a {
+            compatible = "fsl,mpr121-touchkey";
+            reg = <0x5a>;
+            poll-interval = <20>;
+            autorepeat;
+            vdd-supply = <&ldo4_reg>;
+            linux,keycodes = <KEY_0>, <KEY_1>, <KEY_2>, <KEY_3>,
+                             <KEY_4>, <KEY_5>, <KEY_6>, <KEY_7>,
+                             <KEY_8>, <KEY_9>, <KEY_A>, <KEY_B>;
+        };
+    };
diff --git a/Documentation/devicetree/bindings/input/input.yaml b/Documentation/devicetree/bindings/input/input.yaml
index 494e7d031ea3..cc5f9e8a3c01 100644
--- a/Documentation/devicetree/bindings/input/input.yaml
+++ b/Documentation/devicetree/bindings/input/input.yaml
@@ -23,3 +23,7 @@ properties:
   autorepeat:
     description: Enable autorepeat when key is pressed and held down.
     type: boolean
+
+  poll-interval:
+    description: Poll interval time in milliseconds.
+    $ref: /schemas/types.yaml#/definitions/uint32
-- 
2.1.4


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

* [PATCH v2 4/5] Input: mpr121: Add polling mode
  2019-10-01 14:29 [PATCH v2 0/5] Add polling mode to the MPR121 touchkey Michal Vokáč
                   ` (2 preceding siblings ...)
  2019-10-01 14:29 ` [PATCH v2 3/5] dt-bindings: input: Add poll-interval property Michal Vokáč
@ 2019-10-01 14:29 ` Michal Vokáč
  2019-10-01 14:29 ` [PATCH v2 5/5] ARM: dts: imx6dl-yapp4: Enable the MPR121 touchkey controller on Hydra Michal Vokáč
  4 siblings, 0 replies; 12+ messages in thread
From: Michal Vokáč @ 2019-10-01 14:29 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring
  Cc: Shawn Guo, Fabio Estevam, linux-input, devicetree,
	Michal Vokáč

In case the interrupt line is not available, polling can be used
to read out the state of the keys. Period of the polling needs to
be configured by the poll-interval DT property.

Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
---
Changes since v1:
 - Use poll-interval property name instead of linux,poll-interval.

 drivers/input/keyboard/mpr121_touchkey.c | 69 +++++++++++++++++++++++---------
 1 file changed, 51 insertions(+), 18 deletions(-)

diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c
index ee80de44ce3f..40d6e5087cde 100644
--- a/drivers/input/keyboard/mpr121_touchkey.c
+++ b/drivers/input/keyboard/mpr121_touchkey.c
@@ -54,6 +54,9 @@
 /* MPR121 has 12 keys */
 #define MPR121_MAX_KEY_COUNT		12
 
+#define MPR121_MIN_POLL_INTERVAL	10
+#define MPR121_MAX_POLL_INTERVAL	200
+
 struct mpr121_touchkey {
 	struct i2c_client	*client;
 	struct input_dev	*input_dev;
@@ -115,11 +118,11 @@ static struct regulator *mpr121_vdd_supply_init(struct device *dev)
 	return vdd_supply;
 }
 
-static irqreturn_t mpr_touchkey_interrupt(int irq, void *dev_id)
+static void mpr_touchkey_report(struct input_dev *dev)
 {
-	struct mpr121_touchkey *mpr121 = dev_id;
-	struct i2c_client *client = mpr121->client;
+	struct mpr121_touchkey *mpr121 = input_get_drvdata(dev);
 	struct input_dev *input = mpr121->input_dev;
+	struct i2c_client *client = mpr121->client;
 	unsigned long bit_changed;
 	unsigned int key_num;
 	int reg;
@@ -127,14 +130,14 @@ static irqreturn_t mpr_touchkey_interrupt(int irq, void *dev_id)
 	reg = i2c_smbus_read_byte_data(client, ELE_TOUCH_STATUS_1_ADDR);
 	if (reg < 0) {
 		dev_err(&client->dev, "i2c read error [%d]\n", reg);
-		goto out;
+		return;
 	}
 
 	reg <<= 8;
 	reg |= i2c_smbus_read_byte_data(client, ELE_TOUCH_STATUS_0_ADDR);
 	if (reg < 0) {
 		dev_err(&client->dev, "i2c read error [%d]\n", reg);
-		goto out;
+		return;
 	}
 
 	reg &= TOUCH_STATUS_MASK;
@@ -155,8 +158,14 @@ static irqreturn_t mpr_touchkey_interrupt(int irq, void *dev_id)
 
 	}
 	input_sync(input);
+}
+
+static irqreturn_t mpr_touchkey_interrupt(int irq, void *dev_id)
+{
+	struct mpr121_touchkey *mpr121 = dev_id;
+
+	mpr_touchkey_report(mpr121->input_dev);
 
-out:
 	return IRQ_HANDLED;
 }
 
@@ -229,14 +238,10 @@ static int mpr_touchkey_probe(struct i2c_client *client,
 	int vdd_uv;
 	struct mpr121_touchkey *mpr121;
 	struct input_dev *input_dev;
+	u32 poll_interval = 0;
 	int error;
 	int i;
 
-	if (!client->irq) {
-		dev_err(dev, "irq number should not be zero\n");
-		return -EINVAL;
-	}
-
 	vdd_supply = mpr121_vdd_supply_init(dev);
 	if (IS_ERR(vdd_supply))
 		return PTR_ERR(vdd_supply);
@@ -274,6 +279,7 @@ static int mpr_touchkey_probe(struct i2c_client *client,
 	if (device_property_read_bool(dev, "autorepeat"))
 		__set_bit(EV_REP, input_dev->evbit);
 	input_set_capability(input_dev, EV_MSC, MSC_SCAN);
+	input_set_drvdata(input_dev, mpr121);
 
 	input_dev->keycode = mpr121->keycodes;
 	input_dev->keycodesize = sizeof(mpr121->keycodes[0]);
@@ -288,13 +294,40 @@ static int mpr_touchkey_probe(struct i2c_client *client,
 		return error;
 	}
 
-	error = devm_request_threaded_irq(dev, client->irq, NULL,
-					  mpr_touchkey_interrupt,
-					  IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
-					  dev->driver->name, mpr121);
-	if (error) {
-		dev_err(dev, "Failed to register interrupt\n");
-		return error;
+	device_property_read_u32(dev, "poll-interval", &poll_interval);
+
+	if (client->irq) {
+		error = devm_request_threaded_irq(dev, client->irq, NULL,
+						  mpr_touchkey_interrupt,
+						  IRQF_TRIGGER_FALLING |
+						  IRQF_ONESHOT,
+						  dev->driver->name, mpr121);
+		if (error) {
+			dev_err(dev, "Failed to register interrupt\n");
+			return error;
+		}
+	} else if (poll_interval) {
+		if (poll_interval < MPR121_MIN_POLL_INTERVAL)
+			return -EINVAL;
+
+		if (poll_interval > MPR121_MAX_POLL_INTERVAL)
+			return -EINVAL;
+
+		error = input_setup_polling(input_dev, mpr_touchkey_report);
+		if (error) {
+			dev_err(dev, "Failed to setup polling\n");
+			return error;
+		}
+
+		input_set_poll_interval(input_dev, poll_interval);
+		input_set_min_poll_interval(input_dev,
+					    MPR121_MIN_POLL_INTERVAL);
+		input_set_max_poll_interval(input_dev,
+					    MPR121_MAX_POLL_INTERVAL);
+	} else {
+		dev_err(dev,
+			"invalid IRQ number and polling not configured\n");
+		return -EINVAL;
 	}
 
 	error = input_register_device(input_dev);
-- 
2.1.4


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

* [PATCH v2 5/5] ARM: dts: imx6dl-yapp4: Enable the MPR121 touchkey controller on Hydra
  2019-10-01 14:29 [PATCH v2 0/5] Add polling mode to the MPR121 touchkey Michal Vokáč
                   ` (3 preceding siblings ...)
  2019-10-01 14:29 ` [PATCH v2 4/5] Input: mpr121: Add polling mode Michal Vokáč
@ 2019-10-01 14:29 ` Michal Vokáč
  4 siblings, 0 replies; 12+ messages in thread
From: Michal Vokáč @ 2019-10-01 14:29 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring
  Cc: Shawn Guo, Fabio Estevam, linux-input, devicetree,
	Michal Vokáč

Add the touch keyboard present on Hydra board. The controller
is connected only using I2C lines. The interrupt line is not
available hence we use the polling mode.

Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
---
Changes since v1:
 - Use poll-interval property name instead of linux,poll-interval.

 arch/arm/boot/dts/imx6dl-yapp4-common.dtsi | 13 +++++++++++++
 arch/arm/boot/dts/imx6dl-yapp4-hydra.dts   |  4 ++++
 2 files changed, 17 insertions(+)

diff --git a/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi b/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi
index e8d800fec637..6507bfc0141a 100644
--- a/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi
+++ b/arch/arm/boot/dts/imx6dl-yapp4-common.dtsi
@@ -4,6 +4,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/pwm/pwm.h>
 
 / {
@@ -330,6 +331,18 @@
 		vcc-supply = <&sw2_reg>;
 		status = "disabled";
 	};
+
+	touchkeys: keys@5a {
+		compatible = "fsl,mpr121-touchkey";
+		reg = <0x5a>;
+		vdd-supply = <&sw2_reg>;
+		autorepeat;
+		linux,keycodes = <KEY_1>, <KEY_2>, <KEY_3>, <KEY_4>, <KEY_5>,
+				<KEY_6>, <KEY_7>, <KEY_8>, <KEY_9>,
+				<KEY_BACKSPACE>, <KEY_0>, <KEY_ENTER>;
+		poll-interval = <50>;
+		status = "disabled";
+	};
 };
 
 &iomuxc {
diff --git a/arch/arm/boot/dts/imx6dl-yapp4-hydra.dts b/arch/arm/boot/dts/imx6dl-yapp4-hydra.dts
index f97927064750..84c275bfdd38 100644
--- a/arch/arm/boot/dts/imx6dl-yapp4-hydra.dts
+++ b/arch/arm/boot/dts/imx6dl-yapp4-hydra.dts
@@ -45,6 +45,10 @@
 	status = "okay";
 };
 
+&touchkeys {
+	status = "okay";
+};
+
 &usdhc3 {
 	status = "okay";
 };
-- 
2.1.4


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

* Re: [PATCH v2 1/5] dt-bindings: input: Add common input binding in json-schema
  2019-10-01 14:29 ` [PATCH v2 1/5] dt-bindings: input: Add common input binding in json-schema Michal Vokáč
@ 2019-10-01 15:03   ` Rob Herring
  2019-10-02  6:17     ` Michal Vokáč
  0 siblings, 1 reply; 12+ messages in thread
From: Rob Herring @ 2019-10-01 15:03 UTC (permalink / raw)
  To: Michal Vokáč
  Cc: Dmitry Torokhov, Shawn Guo, Fabio Estevam, Linux Input,
	devicetree

On Tue, Oct 1, 2019 at 9:29 AM Michal Vokáč <michal.vokac@ysoft.com> wrote:
>
> Create schema for the common input properties.
>
> Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
> ---
> Changes since v1:
>  - New patch in the series.
>
> Rob, you suggested to extract the common properties from
> fsl,mpr121-touchkey.yaml into this file. In the meantime I realized that
> the linux,keycodes property is already documented in keys.txt.
>
> What do you suggest to do? Some possible options:
>  - Just remove the linux,keycodes propery from keys.txt.
>  - Merge this input.yaml with all content of keys.txt. How to name the result?

Yes. input.yaml is fine. Looks like there's only 3 references to
keys.txt to update.

>  - Something else?
>
>  Documentation/devicetree/bindings/input/input.yaml | 25 ++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/input.yaml
>
> diff --git a/Documentation/devicetree/bindings/input/input.yaml b/Documentation/devicetree/bindings/input/input.yaml
> new file mode 100644
> index 000000000000..494e7d031ea3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/input.yaml
> @@ -0,0 +1,25 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/input.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Common input schema binding
> +
> +maintainers:
> +  - Dmitry Torokhov <dmitry.torokhov@gmail.com>
> +
> +properties:
> +  linux,keycodes:
> +    description:
> +      Specifies an array of numeric keycode values to be used for reporting
> +      button presses. The array can contain up to 12 entries.

12 is specific to your device.

> +    allOf:
> +      - $ref: /schemas/types.yaml#/definitions/uint32-array
> +      - items:
> +          minimum: 0
> +          maximum: 0xff
> +
> +  autorepeat:
> +    description: Enable autorepeat when key is pressed and held down.
> +    type: boolean
> --
> 2.1.4
>

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

* Re: [PATCH v2 1/5] dt-bindings: input: Add common input binding in json-schema
  2019-10-01 15:03   ` Rob Herring
@ 2019-10-02  6:17     ` Michal Vokáč
  0 siblings, 0 replies; 12+ messages in thread
From: Michal Vokáč @ 2019-10-02  6:17 UTC (permalink / raw)
  To: Rob Herring
  Cc: Dmitry Torokhov, Shawn Guo, Fabio Estevam, Linux Input,
	devicetree

On 01. 10. 19 17:03, Rob Herring wrote:
> On Tue, Oct 1, 2019 at 9:29 AM Michal Vokáč <michal.vokac@ysoft.com> wrote:
>>
>> Create schema for the common input properties.
>>
>> Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
>> ---
>> Changes since v1:
>>   - New patch in the series.
>>
>> Rob, you suggested to extract the common properties from
>> fsl,mpr121-touchkey.yaml into this file. In the meantime I realized that
>> the linux,keycodes property is already documented in keys.txt.
>>
>> What do you suggest to do? Some possible options:
>>   - Just remove the linux,keycodes propery from keys.txt.
>>   - Merge this input.yaml with all content of keys.txt. How to name the result?
> 
> Yes. input.yaml is fine. Looks like there's only 3 references to
> keys.txt to update.

OK.
Thanks for mentioning the references, I would surely forget to update those.

>>   - Something else?
>>
>>   Documentation/devicetree/bindings/input/input.yaml | 25 ++++++++++++++++++++++
>>   1 file changed, 25 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/input/input.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/input/input.yaml b/Documentation/devicetree/bindings/input/input.yaml
>> new file mode 100644
>> index 000000000000..494e7d031ea3
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/input/input.yaml
>> @@ -0,0 +1,25 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/input/input.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Common input schema binding
>> +
>> +maintainers:
>> +  - Dmitry Torokhov <dmitry.torokhov@gmail.com>
>> +
>> +properties:
>> +  linux,keycodes:
>> +    description:
>> +      Specifies an array of numeric keycode values to be used for reporting
>> +      button presses. The array can contain up to 12 entries.
> 
> 12 is specific to your device.

Sure, I will remove this.
I also had question in patch 2/5 regarding the additional minItems and
maxItems constrains. I tried various methods to add the constrains but
all fail to pass the validation with the same error message.

Thanks a lot,
Michal

>> +    allOf:
>> +      - $ref: /schemas/types.yaml#/definitions/uint32-array
>> +      - items:
>> +          minimum: 0
>> +          maximum: 0xff
>> +
>> +  autorepeat:
>> +    description: Enable autorepeat when key is pressed and held down.
>> +    type: boolean
>> --
>> 2.1.4
>>


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

* Re: [PATCH v2 2/5] dt-bindings: input: Convert mpr121 binding to json-schema
  2019-10-01 14:29 ` [PATCH v2 2/5] dt-bindings: input: Convert mpr121 binding to json-schema Michal Vokáč
@ 2019-10-03 19:09   ` Rob Herring
  2019-10-04  7:40     ` Michal Vokáč
  0 siblings, 1 reply; 12+ messages in thread
From: Rob Herring @ 2019-10-03 19:09 UTC (permalink / raw)
  To: Michal Vokáč
  Cc: Dmitry Torokhov, Shawn Guo, Fabio Estevam, Linux Input,
	devicetree

On Tue, Oct 1, 2019 at 9:29 AM Michal Vokáč <michal.vokac@ysoft.com> wrote:
>
> Convert the mpr121 binding to DT schema format using json-schema.
>
> Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
> ---
> Changes since v1:
>  - Extract the common input properties into the input.yaml schema.
>  - Fix the wakeup-source description.
>  - Fix the example to pass validation. Put the mpr121 device sub-node
>    into a i2c {} node.
>
> Rob, the linux,keycodes property is not valid as it is.
> If I put the minItems and maxItems into the common schema, it is valid
> and the min/max length check works fine. What could be wrong?
>
> The error is not very specific..

That's a side effect of an 'allOf' somewhere in the meta-schema.

> $ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
>   SCHEMA  Documentation/devicetree/bindings/processed-schema.yaml
> /home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml: ignoring, error in schema 'linux,keycodes'
> warning: no schema found in file: /home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
> /home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/Makefile:33: recipe for target 'Documentation/devicetree/bindings/processed-schema.yaml' failed
> make[3]: *** [Documentation/devicetree/bindings/processed-schema.yaml] Error 255
> /home/vokac/development/sources/linux-fslc/Makefile:1264: recipe for target 'dt_binding_check' failed

I'm working on a fix for this. It's a problem in the meta-schema.

Rob

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

* Re: [PATCH v2 2/5] dt-bindings: input: Convert mpr121 binding to json-schema
  2019-10-03 19:09   ` Rob Herring
@ 2019-10-04  7:40     ` Michal Vokáč
  2019-10-04 13:32       ` Rob Herring
  0 siblings, 1 reply; 12+ messages in thread
From: Michal Vokáč @ 2019-10-04  7:40 UTC (permalink / raw)
  To: Rob Herring
  Cc: Dmitry Torokhov, Shawn Guo, Fabio Estevam, Linux Input,
	devicetree

On 03. 10. 19 21:09, Rob Herring wrote:
> On Tue, Oct 1, 2019 at 9:29 AM Michal Vokáč <michal.vokac@ysoft.com> wrote:
>>
>> Convert the mpr121 binding to DT schema format using json-schema.
>>
>> Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
>> ---
>> Changes since v1:
>>   - Extract the common input properties into the input.yaml schema.
>>   - Fix the wakeup-source description.
>>   - Fix the example to pass validation. Put the mpr121 device sub-node
>>     into a i2c {} node.
>>
>> Rob, the linux,keycodes property is not valid as it is.
>> If I put the minItems and maxItems into the common schema, it is valid
>> and the min/max length check works fine. What could be wrong?
>>
>> The error is not very specific..
> 
> That's a side effect of an 'allOf' somewhere in the meta-schema.
> 
>> $ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
>>    SCHEMA  Documentation/devicetree/bindings/processed-schema.yaml
>> /home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml: ignoring, error in schema 'linux,keycodes'
>> warning: no schema found in file: /home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
>> /home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/Makefile:33: recipe for target 'Documentation/devicetree/bindings/processed-schema.yaml' failed
>> make[3]: *** [Documentation/devicetree/bindings/processed-schema.yaml] Error 255
>> /home/vokac/development/sources/linux-fslc/Makefile:1264: recipe for target 'dt_binding_check' failed
> 
> I'm working on a fix for this. It's a problem in the meta-schema.

OK, thanks a lot!
Michal

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

* Re: [PATCH v2 2/5] dt-bindings: input: Convert mpr121 binding to json-schema
  2019-10-04  7:40     ` Michal Vokáč
@ 2019-10-04 13:32       ` Rob Herring
  2019-10-04 13:51         ` Michal Vokáč
  0 siblings, 1 reply; 12+ messages in thread
From: Rob Herring @ 2019-10-04 13:32 UTC (permalink / raw)
  To: Michal Vokáč
  Cc: Dmitry Torokhov, Shawn Guo, Fabio Estevam, Linux Input,
	devicetree

On Fri, Oct 4, 2019 at 2:40 AM Michal Vokáč <michal.vokac@ysoft.com> wrote:
>
> On 03. 10. 19 21:09, Rob Herring wrote:
> > On Tue, Oct 1, 2019 at 9:29 AM Michal Vokáč <michal.vokac@ysoft.com> wrote:
> >>
> >> Convert the mpr121 binding to DT schema format using json-schema.
> >>
> >> Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
> >> ---
> >> Changes since v1:
> >>   - Extract the common input properties into the input.yaml schema.
> >>   - Fix the wakeup-source description.
> >>   - Fix the example to pass validation. Put the mpr121 device sub-node
> >>     into a i2c {} node.
> >>
> >> Rob, the linux,keycodes property is not valid as it is.
> >> If I put the minItems and maxItems into the common schema, it is valid
> >> and the min/max length check works fine. What could be wrong?
> >>
> >> The error is not very specific..
> >
> > That's a side effect of an 'allOf' somewhere in the meta-schema.
> >
> >> $ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
> >>    SCHEMA  Documentation/devicetree/bindings/processed-schema.yaml
> >> /home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml: ignoring, error in schema 'linux,keycodes'
> >> warning: no schema found in file: /home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
> >> /home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/Makefile:33: recipe for target 'Documentation/devicetree/bindings/processed-schema.yaml' failed
> >> make[3]: *** [Documentation/devicetree/bindings/processed-schema.yaml] Error 255
> >> /home/vokac/development/sources/linux-fslc/Makefile:1264: recipe for target 'dt_binding_check' failed
> >
> > I'm working on a fix for this. It's a problem in the meta-schema.
>
> OK, thanks a lot!

I've committed an update to the meta-schema. Please update dtschema
and it should work for you.

Rob

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

* Re: [PATCH v2 2/5] dt-bindings: input: Convert mpr121 binding to json-schema
  2019-10-04 13:32       ` Rob Herring
@ 2019-10-04 13:51         ` Michal Vokáč
  0 siblings, 0 replies; 12+ messages in thread
From: Michal Vokáč @ 2019-10-04 13:51 UTC (permalink / raw)
  To: Rob Herring
  Cc: Dmitry Torokhov, Shawn Guo, Fabio Estevam, Linux Input,
	devicetree

On 04. 10. 19 15:32, Rob Herring wrote:
> On Fri, Oct 4, 2019 at 2:40 AM Michal Vokáč <michal.vokac@ysoft.com> wrote:
>>
>> On 03. 10. 19 21:09, Rob Herring wrote:
>>> On Tue, Oct 1, 2019 at 9:29 AM Michal Vokáč <michal.vokac@ysoft.com> wrote:
>>>>
>>>> Convert the mpr121 binding to DT schema format using json-schema.
>>>>
>>>> Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
>>>> ---
>>>> Changes since v1:
>>>>    - Extract the common input properties into the input.yaml schema.
>>>>    - Fix the wakeup-source description.
>>>>    - Fix the example to pass validation. Put the mpr121 device sub-node
>>>>      into a i2c {} node.
>>>>
>>>> Rob, the linux,keycodes property is not valid as it is.
>>>> If I put the minItems and maxItems into the common schema, it is valid
>>>> and the min/max length check works fine. What could be wrong?
>>>>
>>>> The error is not very specific..
>>>
>>> That's a side effect of an 'allOf' somewhere in the meta-schema.
>>>
>>>> $ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
>>>>     SCHEMA  Documentation/devicetree/bindings/processed-schema.yaml
>>>> /home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml: ignoring, error in schema 'linux,keycodes'
>>>> warning: no schema found in file: /home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
>>>> /home/vokac/development/sources/linux-fslc/Documentation/devicetree/bindings/Makefile:33: recipe for target 'Documentation/devicetree/bindings/processed-schema.yaml' failed
>>>> make[3]: *** [Documentation/devicetree/bindings/processed-schema.yaml] Error 255
>>>> /home/vokac/development/sources/linux-fslc/Makefile:1264: recipe for target 'dt_binding_check' failed
>>>
>>> I'm working on a fix for this. It's a problem in the meta-schema.
>>
>> OK, thanks a lot!
> 
> I've committed an update to the meta-schema. Please update dtschema
> and it should work for you.

Works fine now, thank you!
Michal

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

end of thread, other threads:[~2019-10-04 13:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-01 14:29 [PATCH v2 0/5] Add polling mode to the MPR121 touchkey Michal Vokáč
2019-10-01 14:29 ` [PATCH v2 1/5] dt-bindings: input: Add common input binding in json-schema Michal Vokáč
2019-10-01 15:03   ` Rob Herring
2019-10-02  6:17     ` Michal Vokáč
2019-10-01 14:29 ` [PATCH v2 2/5] dt-bindings: input: Convert mpr121 binding to json-schema Michal Vokáč
2019-10-03 19:09   ` Rob Herring
2019-10-04  7:40     ` Michal Vokáč
2019-10-04 13:32       ` Rob Herring
2019-10-04 13:51         ` Michal Vokáč
2019-10-01 14:29 ` [PATCH v2 3/5] dt-bindings: input: Add poll-interval property Michal Vokáč
2019-10-01 14:29 ` [PATCH v2 4/5] Input: mpr121: Add polling mode Michal Vokáč
2019-10-01 14:29 ` [PATCH v2 5/5] ARM: dts: imx6dl-yapp4: Enable the MPR121 touchkey controller on Hydra Michal Vokáč

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