* [PATCH input-next 0/4] Add polling mode to the MPR121 touchkey
@ 2019-09-02 11:40 Michal Vokáč
2019-09-02 11:40 ` [PATCH input-next 1/4] dt-bindings: input: Convert mpr121 binding to json-schema Michal Vokáč
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Michal Vokáč @ 2019-09-02 11:40 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 that is currently queued in input/next.
Michal Vokáč (4):
dt-bindings: input: Convert mpr121 binding to json-schema
dt-bindings: input: mpr121: 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 | 82 ++++++++++++++++++++++
.../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 | 68 +++++++++++++-----
5 files changed, 149 insertions(+), 48 deletions(-)
create mode 100644 Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
delete mode 100644 Documentation/devicetree/bindings/input/mpr121-touchkey.txt
--
2.1.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH input-next 1/4] dt-bindings: input: Convert mpr121 binding to json-schema
2019-09-02 11:40 [PATCH input-next 0/4] Add polling mode to the MPR121 touchkey Michal Vokáč
@ 2019-09-02 11:40 ` Michal Vokáč
2019-09-03 6:56 ` Rob Herring
2019-09-02 11:40 ` [PATCH input-next 2/4] dt-bindings: input: mpr121: Add poll-interval property Michal Vokáč
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Michal Vokáč @ 2019-09-02 11:40 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>
---
Hi Rob,
I will appreciate your help converting this binding. Currently
the scheme is not valid and the error output of dt_binding_check
is not really helpful.
Also, who shoud be the maintainer of this binding?
I put Dmitry in there as he is the input subsystem maintainer but
I am not sure it is correct.
Thank you,
Michal
.../bindings/input/fsl,mpr121-touchkey.yaml | 64 ++++++++++++++++++++++
.../devicetree/bindings/input/mpr121-touchkey.txt | 30 ----------
2 files changed, 64 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..c463c1c81755
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
@@ -0,0 +1,64 @@
+# 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
+
+properties:
+ compatible:
+ const: fsl,mpr121-touchkey
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ vdd-supply:
+ maxItems: 1
+
+ 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.
+ minItems: 1
+ maxItems: 12
+
+ wakeup-source: Use any event on keypad as wakeup event.
+ type: boolean
+
+ autorepeat:
+ description: Enable autorepeat when key is pressed and held down.
+ type: boolean
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - vdd-supply
+ - linux,keycodes
+
+examples:
+ - |
+ #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>;
+ };
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] 10+ messages in thread
* [PATCH input-next 2/4] dt-bindings: input: mpr121: Add poll-interval property
2019-09-02 11:40 [PATCH input-next 0/4] Add polling mode to the MPR121 touchkey Michal Vokáč
2019-09-02 11:40 ` [PATCH input-next 1/4] dt-bindings: input: Convert mpr121 binding to json-schema Michal Vokáč
@ 2019-09-02 11:40 ` Michal Vokáč
2019-09-03 7:01 ` Rob Herring
2019-09-02 11:40 ` [PATCH input-next 3/4] Input: mpr121: Add polling mode Michal Vokáč
2019-09-02 11:40 ` [PATCH input-next 4/4] ARM: dts: imx6dl-yapp4: Enable the MPR121 touchkey controller on Hydra Michal Vokáč
3 siblings, 1 reply; 10+ messages in thread
From: Michal Vokáč @ 2019-09-02 11:40 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 the buttons states
as the interrupt line may not be used on some platforms.
Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
---
I am not sure how to propperly handle this.
Either interrupt or linux,poll-interval is required, but not both.
.../bindings/input/fsl,mpr121-touchkey.yaml | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml b/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
index c463c1c81755..2b3073a3c9f4 100644
--- a/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
+++ b/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
@@ -34,6 +34,10 @@ properties:
minItems: 1
maxItems: 12
+ linux,poll-interval:
+ description: Poll interval time in milliseconds.
+ maxItems: 1
+
wakeup-source: Use any event on keypad as wakeup event.
type: boolean
@@ -44,12 +48,12 @@ properties:
required:
- compatible
- reg
- - interrupts
- vdd-supply
- linux,keycodes
examples:
- |
+ // Example with interrupts
#include "dt-bindings/input/input.h"
touchkey: mpr121@5a {
compatible = "fsl,mpr121-touchkey";
@@ -62,3 +66,17 @@ examples:
<KEY_4> <KEY_5>, <KEY_6>, <KEY_7>,
<KEY_8>, <KEY_9>, <KEY_A>, <KEY_B>;
};
+
+ - |
+ // Example with polling
+ #include "dt-bindings/input/input.h"
+ touchkey: mpr121@5a {
+ compatible = "fsl,mpr121-touchkey";
+ reg = <0x5a>;
+ linux,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>;
+ );
--
2.1.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH input-next 3/4] Input: mpr121: Add polling mode
2019-09-02 11:40 [PATCH input-next 0/4] Add polling mode to the MPR121 touchkey Michal Vokáč
2019-09-02 11:40 ` [PATCH input-next 1/4] dt-bindings: input: Convert mpr121 binding to json-schema Michal Vokáč
2019-09-02 11:40 ` [PATCH input-next 2/4] dt-bindings: input: mpr121: Add poll-interval property Michal Vokáč
@ 2019-09-02 11:40 ` Michal Vokáč
2019-09-02 11:40 ` [PATCH input-next 4/4] ARM: dts: imx6dl-yapp4: Enable the MPR121 touchkey controller on Hydra Michal Vokáč
3 siblings, 0 replies; 10+ messages in thread
From: Michal Vokáč @ 2019-09-02 11:40 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 linux,poll-interval DT property.
Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
---
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..2560a7231504 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, "linux,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] 10+ messages in thread
* [PATCH input-next 4/4] ARM: dts: imx6dl-yapp4: Enable the MPR121 touchkey controller on Hydra
2019-09-02 11:40 [PATCH input-next 0/4] Add polling mode to the MPR121 touchkey Michal Vokáč
` (2 preceding siblings ...)
2019-09-02 11:40 ` [PATCH input-next 3/4] Input: mpr121: Add polling mode Michal Vokáč
@ 2019-09-02 11:40 ` Michal Vokáč
3 siblings, 0 replies; 10+ messages in thread
From: Michal Vokáč @ 2019-09-02 11:40 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>
---
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..49e2bcd21a00 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>;
+ linux,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] 10+ messages in thread
* Re: [PATCH input-next 1/4] dt-bindings: input: Convert mpr121 binding to json-schema
2019-09-02 11:40 ` [PATCH input-next 1/4] dt-bindings: input: Convert mpr121 binding to json-schema Michal Vokáč
@ 2019-09-03 6:56 ` Rob Herring
[not found] ` <29307819-fcac-cbf8-0439-23c831d87278@ysoft.com>
0 siblings, 1 reply; 10+ messages in thread
From: Rob Herring @ 2019-09-03 6:56 UTC (permalink / raw)
To: Michal Vokáč
Cc: Dmitry Torokhov, Shawn Guo, Fabio Estevam, linux-input,
devicetree
On Mon, Sep 02, 2019 at 01:40:14PM +0200, Michal Vokáč wrote:
> Convert the mpr121 binding to DT schema format using json-schema.
>
> Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
> ---
> Hi Rob,
>
> I will appreciate your help converting this binding. Currently
> the scheme is not valid and the error output of dt_binding_check
> is not really helpful.
What's the error? I don't see anything obvious.
>
> Also, who shoud be the maintainer of this binding?
> I put Dmitry in there as he is the input subsystem maintainer but
> I am not sure it is correct.
My preference is the author or driver maintainer.
> .../bindings/input/fsl,mpr121-touchkey.yaml | 64 ++++++++++++++++++++++
> .../devicetree/bindings/input/mpr121-touchkey.txt | 30 ----------
> 2 files changed, 64 insertions(+), 30 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
> delete mode 100644 Documentation/devicetree/bindings/input/mpr121-touchkey.txt
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH input-next 2/4] dt-bindings: input: mpr121: Add poll-interval property
2019-09-02 11:40 ` [PATCH input-next 2/4] dt-bindings: input: mpr121: Add poll-interval property Michal Vokáč
@ 2019-09-03 7:01 ` Rob Herring
[not found] ` <c8c909e5-1e1f-23a7-dc22-f112fcaeab4c@ysoft.com>
0 siblings, 1 reply; 10+ messages in thread
From: Rob Herring @ 2019-09-03 7:01 UTC (permalink / raw)
To: Michal Vokáč
Cc: Dmitry Torokhov, Shawn Guo, Fabio Estevam, linux-input,
devicetree
On Mon, Sep 02, 2019 at 01:40:15PM +0200, Michal Vokáč wrote:
> Add an option to periodicaly poll the device to get the buttons states
> as the interrupt line may not be used on some platforms.
>
> Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
> ---
> I am not sure how to propperly handle this.
> Either interrupt or linux,poll-interval is required, but not both.
Add this at the top level:
oneOf:
- required: [ interrupts ]
- required: [ linux,poll-interval ]
>
> .../bindings/input/fsl,mpr121-touchkey.yaml | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml b/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
> index c463c1c81755..2b3073a3c9f4 100644
> --- a/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
> +++ b/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
> @@ -34,6 +34,10 @@ properties:
> minItems: 1
> maxItems: 12
>
> + linux,poll-interval:
> + description: Poll interval time in milliseconds.
> + maxItems: 1
We already have 'poll-interval' in several bindings. Use that.
This should have a type definition and you don't need maxItems:
$ref: /schemas/types.yaml#/definitions/uint32
Really this should go in a common input schema doc.
> +
> wakeup-source: Use any event on keypad as wakeup event.
> type: boolean
>
> @@ -44,12 +48,12 @@ properties:
> required:
> - compatible
> - reg
> - - interrupts
> - vdd-supply
> - linux,keycodes
>
> examples:
> - |
> + // Example with interrupts
> #include "dt-bindings/input/input.h"
> touchkey: mpr121@5a {
> compatible = "fsl,mpr121-touchkey";
> @@ -62,3 +66,17 @@ examples:
> <KEY_4> <KEY_5>, <KEY_6>, <KEY_7>,
> <KEY_8>, <KEY_9>, <KEY_A>, <KEY_B>;
> };
> +
> + - |
> + // Example with polling
> + #include "dt-bindings/input/input.h"
> + touchkey: mpr121@5a {
> + compatible = "fsl,mpr121-touchkey";
> + reg = <0x5a>;
> + linux,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>;
> + );
> --
> 2.1.4
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH input-next 1/4] dt-bindings: input: Convert mpr121 binding to json-schema
[not found] ` <29307819-fcac-cbf8-0439-23c831d87278@ysoft.com>
@ 2019-09-27 6:45 ` Michal Vokáč
0 siblings, 0 replies; 10+ messages in thread
From: Michal Vokáč @ 2019-09-27 6:45 UTC (permalink / raw)
To: Rob Herring
Cc: Dmitry Torokhov, Shawn Guo, Fabio Estevam, linux-input,
devicetree
On 17. 09. 19 16:16, Michal Vokáč wrote:
> On 03. 09. 19 8:56, Rob Herring wrote:
>> On Mon, Sep 02, 2019 at 01:40:14PM +0200, Michal Vokáč wrote:
>>> Convert the mpr121 binding to DT schema format using json-schema.
>>>
>>> Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
>>> ---
>>> Hi Rob,
>>>
>>> I will appreciate your help converting this binding. Currently
>>> the scheme is not valid and the error output of dt_binding_check
>>> is not really helpful.
>>
>> What's the error? I don't see anything obvious.
>
> After some trial & error attempts I found few issues:
>
> - Wrong placement of description for wakeup-source. Solved.
> - Missing coma between <KEY_4>, <KEY_5> values in the example. Solved.
> - DTC complained about invalid reg property length in the example.
> Solved by placing the mpr121 subnode into i2c {}; node and adding
> #address-cells and #size-cells properties.
> - The linux,keycodes property also requires type definition. Unresolved.
>
> What type should be used? Neither uint32-array nor uint32-matrix work.
> The linux,keycodes list is not correctly validated against the maxItems
> value. When I set maxItems less then the number of keycodes, it does not
> complain.
Hi Rob, maybe this went through the cracks unnoticed?
>>> Also, who shoud be the maintainer of this binding?
>>> I put Dmitry in there as he is the input subsystem maintainer but
>>> I am not sure it is correct.
>>
>> My preference is the author or driver maintainer.
>
> Then Dmitry seems to be the best match here I think.
>
>>> .../bindings/input/fsl,mpr121-touchkey.yaml | 64 ++++++++++++++++++++++
>>> .../devicetree/bindings/input/mpr121-touchkey.txt | 30 ----------
>>> 2 files changed, 64 insertions(+), 30 deletions(-)
>>> create mode 100644 Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
>>> delete mode 100644 Documentation/devicetree/bindings/input/mpr121-touchkey.txt
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH input-next 2/4] dt-bindings: input: mpr121: Add poll-interval property
[not found] ` <c8c909e5-1e1f-23a7-dc22-f112fcaeab4c@ysoft.com>
@ 2019-09-27 6:47 ` Michal Vokáč
2019-09-27 12:46 ` Rob Herring
1 sibling, 0 replies; 10+ messages in thread
From: Michal Vokáč @ 2019-09-27 6:47 UTC (permalink / raw)
To: Rob Herring
Cc: Dmitry Torokhov, Shawn Guo, Fabio Estevam, linux-input,
devicetree
On 17. 09. 19 16:17, Michal Vokáč wrote:
> On 03. 09. 19 9:01, Rob Herring wrote:
>> On Mon, Sep 02, 2019 at 01:40:15PM +0200, Michal Vokáč wrote:
>>> Add an option to periodicaly poll the device to get the buttons states
>>> as the interrupt line may not be used on some platforms.
>>>
>>> Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
>>> ---
>>> I am not sure how to propperly handle this.
>>> Either interrupt or linux,poll-interval is required, but not both.
>>
>> Add this at the top level:
>>
>> oneOf:
>> - required: [ interrupts ]
>> - required: [ linux,poll-interval ]
>>
>
> Nice, works as expected.
>
>>>
>>> .../bindings/input/fsl,mpr121-touchkey.yaml | 20 +++++++++++++++++++-
>>> 1 file changed, 19 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml b/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
>>> index c463c1c81755..2b3073a3c9f4 100644
>>> --- a/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
>>> +++ b/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
>>> @@ -34,6 +34,10 @@ properties:
>>> minItems: 1
>>> maxItems: 12
>>> + linux,poll-interval:
>>> + description: Poll interval time in milliseconds.
>>> + maxItems: 1
>>
>> We already have 'poll-interval' in several bindings. Use that.
>
> OK, will do.
> linux,poll-intervall was initially suggested by Dmitry but AFAICT he is OK
> with this.
>
>> This should have a type definition and you don't need maxItems:
>>
>> $ref: /schemas/types.yaml#/definitions/uint32
>
> OK.
>
>> Really this should go in a common input schema doc.
>
> I am not sure how to deal with this. Do you suggest to create
>
> Documentation/devicetree/bindings/input/input.yaml
>
> and put all the common input properties there? Something like:
>
> diff --git a/Documentation/devicetree/bindings/input/input.yaml b/Documentation/devicetree/bindings/input/input.yaml
> new file mode 100644
> index 000000000000..5dc10ebdfdf0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/input.yaml
> @@ -0,0 +1,24 @@
> +# 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.
> + minItems: 1
> + maxItems: 12
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> +
> + poll-interval:
> + description: Poll interval time in milliseconds.
> + $ref: /schemas/types.yaml#/definitions/uint32
> +
> ---
>
> Or something else?
> And what is the impact on the fsl,mpr121-touchkey.yaml content/format?
> I could not find any example in any subsystem of such approach.
Hi Rob, maybe this went through the cracks unnoticed?
> Thank you,
> Michal
>
>>> +
>>> wakeup-source: Use any event on keypad as wakeup event.
>>> type: boolean
>>> @@ -44,12 +48,12 @@ properties:
>>> required:
>>> - compatible
>>> - reg
>>> - - interrupts
>>> - vdd-supply
>>> - linux,keycodes
>>> examples:
>>> - |
>>> + // Example with interrupts
>>> #include "dt-bindings/input/input.h"
>>> touchkey: mpr121@5a {
>>> compatible = "fsl,mpr121-touchkey";
>>> @@ -62,3 +66,17 @@ examples:
>>> <KEY_4> <KEY_5>, <KEY_6>, <KEY_7>,
>>> <KEY_8>, <KEY_9>, <KEY_A>, <KEY_B>;
>>> };
>>> +
>>> + - |
>>> + // Example with polling
>>> + #include "dt-bindings/input/input.h"
>>> + touchkey: mpr121@5a {
>>> + compatible = "fsl,mpr121-touchkey";
>>> + reg = <0x5a>;
>>> + linux,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>;
>>> + );
>>> --
>>> 2.1.4
>>>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH input-next 2/4] dt-bindings: input: mpr121: Add poll-interval property
[not found] ` <c8c909e5-1e1f-23a7-dc22-f112fcaeab4c@ysoft.com>
2019-09-27 6:47 ` Michal Vokáč
@ 2019-09-27 12:46 ` Rob Herring
1 sibling, 0 replies; 10+ messages in thread
From: Rob Herring @ 2019-09-27 12:46 UTC (permalink / raw)
To: Michal Vokáč
Cc: Dmitry Torokhov, Shawn Guo, Fabio Estevam, Linux Input,
devicetree
On Tue, Sep 17, 2019 at 9:17 AM Michal Vokáč <michal.vokac@ysoft.com> wrote:
>
> On 03. 09. 19 9:01, Rob Herring wrote:
> > On Mon, Sep 02, 2019 at 01:40:15PM +0200, Michal Vokáč wrote:
> >> Add an option to periodicaly poll the device to get the buttons states
> >> as the interrupt line may not be used on some platforms.
> >>
> >> Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com>
> >> ---
> >> I am not sure how to propperly handle this.
> >> Either interrupt or linux,poll-interval is required, but not both.
> >
> > Add this at the top level:
> >
> > oneOf:
> > - required: [ interrupts ]
> > - required: [ linux,poll-interval ]
> >
>
> Nice, works as expected.
>
> >>
> >> .../bindings/input/fsl,mpr121-touchkey.yaml | 20 +++++++++++++++++++-
> >> 1 file changed, 19 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml b/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
> >> index c463c1c81755..2b3073a3c9f4 100644
> >> --- a/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
> >> +++ b/Documentation/devicetree/bindings/input/fsl,mpr121-touchkey.yaml
> >> @@ -34,6 +34,10 @@ properties:
> >> minItems: 1
> >> maxItems: 12
> >>
> >> + linux,poll-interval:
> >> + description: Poll interval time in milliseconds.
> >> + maxItems: 1
> >
> > We already have 'poll-interval' in several bindings. Use that.
>
> OK, will do.
> linux,poll-intervall was initially suggested by Dmitry but AFAICT he is OK
> with this.
>
> > This should have a type definition and you don't need maxItems:
> >
> > $ref: /schemas/types.yaml#/definitions/uint32
>
> OK.
>
> > Really this should go in a common input schema doc.
>
> I am not sure how to deal with this. Do you suggest to create
>
> Documentation/devicetree/bindings/input/input.yaml
>
> and put all the common input properties there? Something like:
Yes.
>
> diff --git a/Documentation/devicetree/bindings/input/input.yaml b/Documentation/devicetree/bindings/input/input.yaml
> new file mode 100644
> index 000000000000..5dc10ebdfdf0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/input.yaml
> @@ -0,0 +1,24 @@
> +# 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.
> + minItems: 1
> + maxItems: 12
> + $ref: /schemas/types.yaml#/definitions/uint32-array
When you have additional constraints on a referenced schema, the
reference has to be under an 'allOf':
allOf:
- $ref: /schemas/types.yaml#/definitions/uint32-array
I still really don't get why and I've researched it...
However, for the common schema, you probably want to drop minItems/maxItems.
But you could define the value ranges?
items:
minimum: 0
maximum: 0xff
> +
> + poll-interval:
> + description: Poll interval time in milliseconds.
> + $ref: /schemas/types.yaml#/definitions/uint32
> +
> ---
>
> Or something else?
> And what is the impact on the fsl,mpr121-touchkey.yaml content/format?
> I could not find any example in any subsystem of such approach.
You only need to define any additional constraints on the common
properties (such as minItems/maxItems) and don't need to repeat things
like the type or description.
In order to get the common schema applied, you do at the top-level of
your binding:
allOf:
- $ref: input.yaml#
Sometimes we don't have to do this if we have a reliable way of
matching in the common binding such as the node name.
Rob
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-09-27 12:46 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-02 11:40 [PATCH input-next 0/4] Add polling mode to the MPR121 touchkey Michal Vokáč
2019-09-02 11:40 ` [PATCH input-next 1/4] dt-bindings: input: Convert mpr121 binding to json-schema Michal Vokáč
2019-09-03 6:56 ` Rob Herring
[not found] ` <29307819-fcac-cbf8-0439-23c831d87278@ysoft.com>
2019-09-27 6:45 ` Michal Vokáč
2019-09-02 11:40 ` [PATCH input-next 2/4] dt-bindings: input: mpr121: Add poll-interval property Michal Vokáč
2019-09-03 7:01 ` Rob Herring
[not found] ` <c8c909e5-1e1f-23a7-dc22-f112fcaeab4c@ysoft.com>
2019-09-27 6:47 ` Michal Vokáč
2019-09-27 12:46 ` Rob Herring
2019-09-02 11:40 ` [PATCH input-next 3/4] Input: mpr121: Add polling mode Michal Vokáč
2019-09-02 11:40 ` [PATCH input-next 4/4] ARM: dts: imx6dl-yapp4: Enable the MPR121 touchkey controller on Hydra Michal Vokáč
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.