* [PATCH v2 0/3] Input: Add ektf2232 support @ 2024-05-05 21:47 Andreas Kemnade 2024-05-05 21:47 ` [PATCH v2 1/3] dt-bindings: touchscreen: convert elan,ektf2127 to json-schema Andreas Kemnade ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Andreas Kemnade @ 2024-05-05 21:47 UTC (permalink / raw) To: dmitry.torokhov, robh, krzk+dt, conor+dt, andreas, u.kleine-koenig, hdegoede, andy.shevchenko, siebren.vroegindeweij, linux-input, devicetree, linux-kernel Add support for the EKTF2232 to the ektf2127 driver which contains support for similar chips. Add the needed compatible to bindings and convert them. Changes in v2: - separate patch for adding compatible - use match data for selecting status shift Andreas Kemnade (3): dt-bindings: touchscreen: convert elan,ektf2127 to json-schema dt-bindings: touchscreen: elan,ektf2127: Add EKTF2232 Input: ektf2127 - add ektf2232 support .../bindings/input/touchscreen/ektf2127.txt | 25 -------- .../input/touchscreen/elan,ektf2127.yaml | 58 +++++++++++++++++++ drivers/input/touchscreen/ektf2127.c | 41 +++++++++++-- 3 files changed, 93 insertions(+), 31 deletions(-) delete mode 100644 Documentation/devicetree/bindings/input/touchscreen/ektf2127.txt create mode 100644 Documentation/devicetree/bindings/input/touchscreen/elan,ektf2127.yaml -- 2.39.2 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/3] dt-bindings: touchscreen: convert elan,ektf2127 to json-schema 2024-05-05 21:47 [PATCH v2 0/3] Input: Add ektf2232 support Andreas Kemnade @ 2024-05-05 21:47 ` Andreas Kemnade 2024-05-06 6:24 ` Krzysztof Kozlowski 2024-05-05 21:47 ` [PATCH v2 2/3] dt-bindings: touchscreen: elan,ektf2127: Add EKTF2232 Andreas Kemnade 2024-05-05 21:47 ` [PATCH v2 3/3] Input: ektf2127 - add ektf2232 support Andreas Kemnade 2 siblings, 1 reply; 10+ messages in thread From: Andreas Kemnade @ 2024-05-05 21:47 UTC (permalink / raw) To: dmitry.torokhov, robh, krzk+dt, conor+dt, andreas, u.kleine-koenig, hdegoede, andy.shevchenko, siebren.vroegindeweij, linux-input, devicetree, linux-kernel Convert EKTF2127 infrared touchscreen controller binding to DT schema and add ektf2232 compatible. Signed-off-by: Andreas Kemnade <andreas@kemnade.info> --- .../bindings/input/touchscreen/ektf2127.txt | 25 -------- .../input/touchscreen/elan,ektf2127.yaml | 57 +++++++++++++++++++ 2 files changed, 57 insertions(+), 25 deletions(-) delete mode 100644 Documentation/devicetree/bindings/input/touchscreen/ektf2127.txt create mode 100644 Documentation/devicetree/bindings/input/touchscreen/elan,ektf2127.yaml diff --git a/Documentation/devicetree/bindings/input/touchscreen/ektf2127.txt b/Documentation/devicetree/bindings/input/touchscreen/ektf2127.txt deleted file mode 100644 index c9f2c9f578e34..0000000000000 --- a/Documentation/devicetree/bindings/input/touchscreen/ektf2127.txt +++ /dev/null @@ -1,25 +0,0 @@ -* Elan eKTF2127 I2C touchscreen controller - -Required properties: - - compatible : "elan,ektf2127" or "elan,ektf2132" - - reg : I2C slave address of the chip (0x40) - - interrupts : interrupt specification for the ektf2127 interrupt - - power-gpios : GPIO specification for the pin connected to the - ektf2127's wake input. This needs to be driven high - to take ektf2127 out of its low power state - -For additional optional properties see: touchscreen.txt - -Example: - -i2c@00000000 { - ektf2127: touchscreen@15 { - compatible = "elan,ektf2127"; - reg = <0x15>; - interrupt-parent = <&pio>; - interrupts = <6 11 IRQ_TYPE_EDGE_FALLING> - power-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; - touchscreen-inverted-x; - touchscreen-swapped-x-y; - }; -}; diff --git a/Documentation/devicetree/bindings/input/touchscreen/elan,ektf2127.yaml b/Documentation/devicetree/bindings/input/touchscreen/elan,ektf2127.yaml new file mode 100644 index 0000000000000..5c4c29da0b11d --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/elan,ektf2127.yaml @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/touchscreen/elan,ektf2127.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Elan eKTF2127 I2C touchscreen controller + +maintainers: + - Siebren Vroegindeweij <siebren.vroegindeweij@hotmail.com> + +allOf: + - $ref: touchscreen.yaml# + +properties: + compatible: + enum: + - elan,ektf2127 + - elan,ektf2132 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + power-gpios: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + - power-gpios + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + #include <dt-bindings/interrupt-controller/irq.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + touchscreen@15 { + compatible = "elan,ektf2127"; + reg = <0x15>; + interrupt-parent = <&pio>; + interrupts = <6 11 IRQ_TYPE_EDGE_FALLING>; + power-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; + touchscreen-inverted-x; + touchscreen-swapped-x-y; + }; + }; +... -- 2.39.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: touchscreen: convert elan,ektf2127 to json-schema 2024-05-05 21:47 ` [PATCH v2 1/3] dt-bindings: touchscreen: convert elan,ektf2127 to json-schema Andreas Kemnade @ 2024-05-06 6:24 ` Krzysztof Kozlowski 0 siblings, 0 replies; 10+ messages in thread From: Krzysztof Kozlowski @ 2024-05-06 6:24 UTC (permalink / raw) To: Andreas Kemnade, dmitry.torokhov, robh, krzk+dt, conor+dt, u.kleine-koenig, hdegoede, andy.shevchenko, siebren.vroegindeweij, linux-input, devicetree, linux-kernel On 05/05/2024 23:47, Andreas Kemnade wrote: > Convert EKTF2127 infrared touchscreen controller binding to DT schema > and add ektf2232 compatible. > > Signed-off-by: Andreas Kemnade <andreas@kemnade.info> > --- Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 2/3] dt-bindings: touchscreen: elan,ektf2127: Add EKTF2232 2024-05-05 21:47 [PATCH v2 0/3] Input: Add ektf2232 support Andreas Kemnade 2024-05-05 21:47 ` [PATCH v2 1/3] dt-bindings: touchscreen: convert elan,ektf2127 to json-schema Andreas Kemnade @ 2024-05-05 21:47 ` Andreas Kemnade 2024-05-06 6:24 ` Krzysztof Kozlowski 2024-05-05 21:47 ` [PATCH v2 3/3] Input: ektf2127 - add ektf2232 support Andreas Kemnade 2 siblings, 1 reply; 10+ messages in thread From: Andreas Kemnade @ 2024-05-05 21:47 UTC (permalink / raw) To: dmitry.torokhov, robh, krzk+dt, conor+dt, andreas, u.kleine-koenig, hdegoede, andy.shevchenko, siebren.vroegindeweij, linux-input, devicetree, linux-kernel Add a compatible for the EKTF2232, which is similar to other chips in this document. Signed-off-by: Andreas Kemnade <andreas@kemnade.info> --- .../devicetree/bindings/input/touchscreen/elan,ektf2127.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/elan,ektf2127.yaml b/Documentation/devicetree/bindings/input/touchscreen/elan,ektf2127.yaml index 5c4c29da0b11d..ff0ec3fd24c5d 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/elan,ektf2127.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/elan,ektf2127.yaml @@ -17,6 +17,7 @@ properties: enum: - elan,ektf2127 - elan,ektf2132 + - elan,ektf2232 reg: maxItems: 1 -- 2.39.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/3] dt-bindings: touchscreen: elan,ektf2127: Add EKTF2232 2024-05-05 21:47 ` [PATCH v2 2/3] dt-bindings: touchscreen: elan,ektf2127: Add EKTF2232 Andreas Kemnade @ 2024-05-06 6:24 ` Krzysztof Kozlowski 0 siblings, 0 replies; 10+ messages in thread From: Krzysztof Kozlowski @ 2024-05-06 6:24 UTC (permalink / raw) To: Andreas Kemnade, dmitry.torokhov, robh, krzk+dt, conor+dt, u.kleine-koenig, hdegoede, andy.shevchenko, siebren.vroegindeweij, linux-input, devicetree, linux-kernel On 05/05/2024 23:47, Andreas Kemnade wrote: > Add a compatible for the EKTF2232, which is similar to other chips in this > document. > > Signed-off-by: Andreas Kemnade <andreas@kemnade.info> > --- Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 3/3] Input: ektf2127 - add ektf2232 support 2024-05-05 21:47 [PATCH v2 0/3] Input: Add ektf2232 support Andreas Kemnade 2024-05-05 21:47 ` [PATCH v2 1/3] dt-bindings: touchscreen: convert elan,ektf2127 to json-schema Andreas Kemnade 2024-05-05 21:47 ` [PATCH v2 2/3] dt-bindings: touchscreen: elan,ektf2127: Add EKTF2232 Andreas Kemnade @ 2024-05-05 21:47 ` Andreas Kemnade 2024-05-06 12:05 ` Andy Shevchenko 2 siblings, 1 reply; 10+ messages in thread From: Andreas Kemnade @ 2024-05-05 21:47 UTC (permalink / raw) To: dmitry.torokhov, robh, krzk+dt, conor+dt, andreas, u.kleine-koenig, hdegoede, andy.shevchenko, siebren.vroegindeweij, linux-input, devicetree, linux-kernel The chip is similar, but has status bits at different positions, so use the correct bits. Signed-off-by: Andreas Kemnade <andreas@kemnade.info> --- drivers/input/touchscreen/ektf2127.c | 41 ++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c index cc3103b9cbfba..028b605d1bb74 100644 --- a/drivers/input/touchscreen/ektf2127.c +++ b/drivers/input/touchscreen/ektf2127.c @@ -13,6 +13,7 @@ * Hans de Goede <hdegoede@redhat.com> */ +#include <linux/bits.h> #include <linux/gpio/consumer.h> #include <linux/interrupt.h> #include <linux/i2c.h> @@ -46,6 +47,11 @@ struct ektf2127_ts { struct input_dev *input; struct gpio_desc *power_gpios; struct touchscreen_properties prop; + int status_shift; +}; + +struct ektf2127_i2c_chip_data { + int status_shift; }; static void ektf2127_parse_coordinates(const u8 *buf, unsigned int touch_count, @@ -112,8 +118,8 @@ static void ektf2127_report2_contact(struct ektf2127_ts *ts, int slot, static void ektf2127_report2_event(struct ektf2127_ts *ts, const u8 *buf) { - ektf2127_report2_contact(ts, 0, &buf[1], !!(buf[7] & 2)); - ektf2127_report2_contact(ts, 1, &buf[4], !!(buf[7] & 4)); + ektf2127_report2_contact(ts, 0, &buf[1], !!(buf[7] & BIT(ts->status_shift))); + ektf2127_report2_contact(ts, 1, &buf[4], !!(buf[7] & BIT(ts->status_shift + 1))); input_mt_sync_frame(ts->input); input_sync(ts->input); @@ -246,7 +252,9 @@ static int ektf2127_query_dimension(struct i2c_client *client, bool width) static int ektf2127_probe(struct i2c_client *client) { + const struct i2c_device_id *id = i2c_client_get_device_id(client); struct device *dev = &client->dev; + const struct ektf2127_i2c_chip_data *chip_data; struct ektf2127_ts *ts; struct input_dev *input; u8 buf[4]; @@ -303,6 +311,17 @@ static int ektf2127_probe(struct i2c_client *client) return error; ts->input = input; + + chip_data = device_get_match_data(&client->dev); + if (!chip_data) + chip_data = (const struct ektf2127_i2c_chip_data *)id->driver_data; + if (!chip_data) { + dev_err(&client->dev, "missing chip data\n"); + return -EINVAL; + } + + ts->status_shift = chip_data->status_shift; + input_set_drvdata(input, ts); error = devm_request_threaded_irq(dev, client->irq, @@ -325,18 +344,28 @@ static int ektf2127_probe(struct i2c_client *client) return 0; } +static const struct ektf2127_i2c_chip_data ektf2127_data = { + .status_shift = 1, +}; + +static const struct ektf2127_i2c_chip_data ektf2232_data = { + .status_shift = 0, +}; + #ifdef CONFIG_OF static const struct of_device_id ektf2127_of_match[] = { - { .compatible = "elan,ektf2127" }, - { .compatible = "elan,ektf2132" }, + { .compatible = "elan,ektf2127", .data = &ektf2127_data}, + { .compatible = "elan,ektf2132", .data = &ektf2127_data}, + { .compatible = "elan,ektf2232", .data = &ektf2232_data}, {} }; MODULE_DEVICE_TABLE(of, ektf2127_of_match); #endif static const struct i2c_device_id ektf2127_i2c_id[] = { - { "ektf2127", 0 }, - { "ektf2132", 0 }, + { .name = "ektf2127", .driver_data = (long)&ektf2127_data }, + { .name = "ektf2132", .driver_data = (long)&ektf2127_data }, + { .name = "ektf2232", .driver_data = (long)&ektf2232_data }, {} }; MODULE_DEVICE_TABLE(i2c, ektf2127_i2c_id); -- 2.39.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 3/3] Input: ektf2127 - add ektf2232 support 2024-05-05 21:47 ` [PATCH v2 3/3] Input: ektf2127 - add ektf2232 support Andreas Kemnade @ 2024-05-06 12:05 ` Andy Shevchenko 2024-05-06 16:21 ` Andreas Kemnade 0 siblings, 1 reply; 10+ messages in thread From: Andy Shevchenko @ 2024-05-06 12:05 UTC (permalink / raw) To: Andreas Kemnade Cc: dmitry.torokhov, robh, krzk+dt, conor+dt, u.kleine-koenig, hdegoede, siebren.vroegindeweij, linux-input, devicetree, linux-kernel On Mon, May 6, 2024 at 12:48 AM Andreas Kemnade <andreas@kemnade.info> wrote: > > The chip is similar, but has status bits at different positions, > so use the correct bits. ... > @@ -46,6 +47,11 @@ struct ektf2127_ts { > struct input_dev *input; > struct gpio_desc *power_gpios; > struct touchscreen_properties prop; > + int status_shift; > +}; > + > +struct ektf2127_i2c_chip_data { > + int status_shift; > }; > > static void ektf2127_parse_coordinates(const u8 *buf, unsigned int touch_count, I'm wondering if you are using --histogram diff algo when preparing the patches. ... > + chip_data = device_get_match_data(&client->dev); > + if (!chip_data) > + chip_data = (const struct ektf2127_i2c_chip_data *)id->driver_data; > + if (!chip_data) { > + dev_err(&client->dev, "missing chip data\n"); > + return -EINVAL; First of all, there is a special combined API for this, please use it instead. Second, use dev_err_probe(). > + } ... > #ifdef CONFIG_OF Side note: Ideally we should kill this ugliness. But it can be done later on. -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 3/3] Input: ektf2127 - add ektf2232 support 2024-05-06 12:05 ` Andy Shevchenko @ 2024-05-06 16:21 ` Andreas Kemnade 2024-05-06 18:43 ` Andy Shevchenko 0 siblings, 1 reply; 10+ messages in thread From: Andreas Kemnade @ 2024-05-06 16:21 UTC (permalink / raw) To: Andy Shevchenko Cc: dmitry.torokhov, robh, krzk+dt, conor+dt, u.kleine-koenig, hdegoede, siebren.vroegindeweij, linux-input, devicetree, linux-kernel On Mon, 6 May 2024 15:05:52 +0300 Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > From: Andy Shevchenko <andy.shevchenko@gmail.com> > To: Andreas Kemnade <andreas@kemnade.info> > Cc: dmitry.torokhov@gmail.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, u.kleine-koenig@pengutronix.de, hdegoede@redhat.com, siebren.vroegindeweij@hotmail.com, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org > Subject: Re: [PATCH v2 3/3] Input: ektf2127 - add ektf2232 support > Date: Mon, 6 May 2024 15:05:52 +0300 > > On Mon, May 6, 2024 at 12:48 AM Andreas Kemnade <andreas@kemnade.info> wrote: > > > > The chip is similar, but has status bits at different positions, > > so use the correct bits. > > ... > > > @@ -46,6 +47,11 @@ struct ektf2127_ts { > > struct input_dev *input; > > struct gpio_desc *power_gpios; > > struct touchscreen_properties prop; > > + int status_shift; > > +}; > > + > > +struct ektf2127_i2c_chip_data { > > + int status_shift; > > }; > > > > static void ektf2127_parse_coordinates(const u8 *buf, unsigned int touch_count, > > I'm wondering if you are using --histogram diff algo when preparing the patches. No, I am not using that, it seems to not make that chunk nicer. Yes, we want + int status_shift; }; + +struct ektf2127_i2c_chip_data { + int status_shift; +}; But that is not shorter or simpler, just more readable. Regards, Andreas ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 3/3] Input: ektf2127 - add ektf2232 support 2024-05-06 16:21 ` Andreas Kemnade @ 2024-05-06 18:43 ` Andy Shevchenko 2024-05-06 20:29 ` Andreas Kemnade 0 siblings, 1 reply; 10+ messages in thread From: Andy Shevchenko @ 2024-05-06 18:43 UTC (permalink / raw) To: Andreas Kemnade Cc: dmitry.torokhov, robh, krzk+dt, conor+dt, u.kleine-koenig, hdegoede, siebren.vroegindeweij, linux-input, devicetree, linux-kernel On Mon, May 6, 2024 at 7:21 PM Andreas Kemnade <andreas@kemnade.info> wrote: > On Mon, 6 May 2024 15:05:52 +0300 > Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > > From: Andy Shevchenko <andy.shevchenko@gmail.com> > > To: Andreas Kemnade <andreas@kemnade.info> > > Date: Mon, 6 May 2024 15:05:52 +0300 > > On Mon, May 6, 2024 at 12:48 AM Andreas Kemnade <andreas@kemnade.info> wrote: ... > > I'm wondering if you are using --histogram diff algo when preparing the patches. > > No, I am not using that, it seems to not make that chunk nicer. > Yes, we want > > + int status_shift; > }; > + > +struct ektf2127_i2c_chip_data { > + int status_shift; > +}; > > But that is not shorter or simpler, just more readable. And that's exactly what histogram is about. I suggest making it default for the Linux kernel project (or globally in your ~/.gitconfig). -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 3/3] Input: ektf2127 - add ektf2232 support 2024-05-06 18:43 ` Andy Shevchenko @ 2024-05-06 20:29 ` Andreas Kemnade 0 siblings, 0 replies; 10+ messages in thread From: Andreas Kemnade @ 2024-05-06 20:29 UTC (permalink / raw) To: Andy Shevchenko Cc: dmitry.torokhov, robh, krzk+dt, conor+dt, u.kleine-koenig, hdegoede, siebren.vroegindeweij, linux-input, devicetree, linux-kernel On Mon, 6 May 2024 21:43:14 +0300 Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > On Mon, May 6, 2024 at 7:21 PM Andreas Kemnade <andreas@kemnade.info> wrote: > > On Mon, 6 May 2024 15:05:52 +0300 > > Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > > > From: Andy Shevchenko <andy.shevchenko@gmail.com> > > > To: Andreas Kemnade <andreas@kemnade.info> > > > Date: Mon, 6 May 2024 15:05:52 +0300 > > > On Mon, May 6, 2024 at 12:48 AM Andreas Kemnade <andreas@kemnade.info> wrote: > > ... > > > > I'm wondering if you are using --histogram diff algo when preparing the patches. > > > > No, I am not using that, it seems to not make that chunk nicer. > > Yes, we want > > > > + int status_shift; > > }; > > + > > +struct ektf2127_i2c_chip_data { > > + int status_shift; > > +}; > > > > But that is not shorter or simpler, just more readable. > > And that's exactly what histogram is about. I suggest making it > default for the Linux kernel project (or globally in your > ~/.gitconfig). > > again, it does not do anything helpful in this case, I tried to run git format-patch --histogram with no improvements. But it might help in other places. Regards, Andreas ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-05-06 20:29 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-05-05 21:47 [PATCH v2 0/3] Input: Add ektf2232 support Andreas Kemnade 2024-05-05 21:47 ` [PATCH v2 1/3] dt-bindings: touchscreen: convert elan,ektf2127 to json-schema Andreas Kemnade 2024-05-06 6:24 ` Krzysztof Kozlowski 2024-05-05 21:47 ` [PATCH v2 2/3] dt-bindings: touchscreen: elan,ektf2127: Add EKTF2232 Andreas Kemnade 2024-05-06 6:24 ` Krzysztof Kozlowski 2024-05-05 21:47 ` [PATCH v2 3/3] Input: ektf2127 - add ektf2232 support Andreas Kemnade 2024-05-06 12:05 ` Andy Shevchenko 2024-05-06 16:21 ` Andreas Kemnade 2024-05-06 18:43 ` Andy Shevchenko 2024-05-06 20:29 ` Andreas Kemnade
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).