linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/3] novatek-nvt-ts: add support for NT36672A touchscreen
@ 2024-06-01 20:44 Joel Selvaraj via B4 Relay
  2024-06-01 20:44 ` [PATCH v5 1/3] Input: novatek-nvt-ts: replace generic i2c device id with specific IC variant Joel Selvaraj via B4 Relay
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Joel Selvaraj via B4 Relay @ 2024-06-01 20:44 UTC (permalink / raw)
  To: Hans de Goede, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86,
	Joel Selvaraj, Krzysztof Kozlowski

Extend the novatek touchscreen driver to support NT36672A chip which
is found in phones like qcom/sdm845-xiaomi-beryllium-tianma.dts.
Added devicetree support for the driver and used i2c chip data to handle
the variation in chip id and wake type. Also added vcc and iovcc
regulators which are used to power the touchscreen hardware.

Signed-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>
---
Changes in v5:
- Made the chip data a local variable as it is only used during probe.
- Handle the regulator disable correctly for all exit paths in probe.
- Link to v4: https://lore.kernel.org/r/20240601-nvt-ts-devicetree-regulator-support-v4-0-e0c0174464c4@gmail.com

Changes in v4:
- Use lowercase i2c device id as suggested by Hans de Goede.
- Disable the regulators after nvt_ts_read_data during probe.
- Link to v3: https://lore.kernel.org/r/20240526-nvt-ts-devicetree-regulator-support-v3-0-aa88d10ccd9a@gmail.com

Changes in v3:
- Fix indentation in the binding as suggested by Krzysztof Kozlowski.
- Picked up Krzysztof Kozlowski's Reviewed-by tag for the binding.
- Link to v2: https://lore.kernel.org/r/20240524-nvt-ts-devicetree-regulator-support-v2-0-b74947038c44@gmail.com

Changes in v2:
- The generic i2c device id is now replaced with the correct IC variant
  provided by Hans de Goede
- Updated the bindings to reflect the latest changes and also incorporated
  the suggestions provided by Krzysztof Kozlowski
- Link to v1: https://lore.kernel.org/r/20240521-nvt-ts-devicetree-regulator-support-v1-0-8d766c639dca@gmail.com

---
Joel Selvaraj (3):
      Input: novatek-nvt-ts: replace generic i2c device id with specific IC variant
      dt-bindings: input: document Novatek NVT touchscreen controller
      Input: novatek-nvt-ts: add support for NT36672A touchscreen

 .../bindings/input/touchscreen/novatek,nvt-ts.yaml | 62 ++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 drivers/input/touchscreen/novatek-nvt-ts.c         | 67 ++++++++++++++++++++--
 drivers/platform/x86/x86-android-tablets/other.c   |  2 +-
 4 files changed, 125 insertions(+), 7 deletions(-)
---
base-commit: 6578aac6a270bd6deb9f9319b991dd430de263dd
change-id: 20240518-nvt-ts-devicetree-regulator-support-ac9e49b78a16

Best regards,
-- 
Joel Selvaraj <joelselvaraj.oss@gmail.com>



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

* [PATCH v5 1/3] Input: novatek-nvt-ts: replace generic i2c device id with specific IC variant
  2024-06-01 20:44 [PATCH v5 0/3] novatek-nvt-ts: add support for NT36672A touchscreen Joel Selvaraj via B4 Relay
@ 2024-06-01 20:44 ` Joel Selvaraj via B4 Relay
  2024-06-02 13:11   ` Hans de Goede
  2024-06-02 13:23   ` Hans de Goede
  2024-06-01 20:44 ` [PATCH v5 2/3] dt-bindings: input: document Novatek NVT touchscreen controller Joel Selvaraj via B4 Relay
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 12+ messages in thread
From: Joel Selvaraj via B4 Relay @ 2024-06-01 20:44 UTC (permalink / raw)
  To: Hans de Goede, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86,
	Joel Selvaraj

From: Joel Selvaraj <joelselvaraj.oss@gmail.com>

This is done in preparation to introduce other variants of the Novatek NVT
touchscreen controller that can be supported by the driver.

Signed-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>
---
 drivers/input/touchscreen/novatek-nvt-ts.c       | 2 +-
 drivers/platform/x86/x86-android-tablets/other.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/novatek-nvt-ts.c b/drivers/input/touchscreen/novatek-nvt-ts.c
index 1a797e410a3fa..9bee3a0c122fb 100644
--- a/drivers/input/touchscreen/novatek-nvt-ts.c
+++ b/drivers/input/touchscreen/novatek-nvt-ts.c
@@ -278,7 +278,7 @@ static int nvt_ts_probe(struct i2c_client *client)
 }
 
 static const struct i2c_device_id nvt_ts_i2c_id[] = {
-	{ "NVT-ts" },
+	{ "nt11205-ts" },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, nvt_ts_i2c_id);
diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c
index eb0e55c69dfed..129273df0fdeb 100644
--- a/drivers/platform/x86/x86-android-tablets/other.c
+++ b/drivers/platform/x86/x86-android-tablets/other.c
@@ -40,7 +40,7 @@ static const struct x86_i2c_client_info acer_b1_750_i2c_clients[] __initconst =
 	{
 		/* Novatek NVT-ts touchscreen */
 		.board_info = {
-			.type = "NVT-ts",
+			.type = "nt11205-ts",
 			.addr = 0x34,
 			.dev_name = "NVT-ts",
 		},

-- 
2.45.1



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

* [PATCH v5 2/3] dt-bindings: input: document Novatek NVT touchscreen controller
  2024-06-01 20:44 [PATCH v5 0/3] novatek-nvt-ts: add support for NT36672A touchscreen Joel Selvaraj via B4 Relay
  2024-06-01 20:44 ` [PATCH v5 1/3] Input: novatek-nvt-ts: replace generic i2c device id with specific IC variant Joel Selvaraj via B4 Relay
@ 2024-06-01 20:44 ` Joel Selvaraj via B4 Relay
  2024-06-01 20:44 ` [PATCH v5 3/3] Input: novatek-nvt-ts: add support for NT36672A touchscreen Joel Selvaraj via B4 Relay
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Joel Selvaraj via B4 Relay @ 2024-06-01 20:44 UTC (permalink / raw)
  To: Hans de Goede, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86,
	Joel Selvaraj, Krzysztof Kozlowski

From: Joel Selvaraj <joelselvaraj.oss@gmail.com>

Document the Novatek NVT touchscreen controller present in devices like
qcom/sdm845-xiaomi-beryllium-tianma.dts. Also, include the devictree
binding file in the MAINTAINERS file.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>
---
 .../bindings/input/touchscreen/novatek,nvt-ts.yaml | 62 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 63 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/novatek,nvt-ts.yaml b/Documentation/devicetree/bindings/input/touchscreen/novatek,nvt-ts.yaml
new file mode 100644
index 0000000000000..bd6a60486d1f1
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/novatek,nvt-ts.yaml
@@ -0,0 +1,62 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/novatek,nvt-ts.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Novatek NVT Touchscreen Controller
+
+maintainers:
+  - Hans de Goede <hdegoede@redhat.com>
+
+allOf:
+  - $ref: touchscreen.yaml#
+
+properties:
+  compatible:
+    enum:
+      - novatek,nt11205-ts
+      - novatek,nt36672a-ts
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  vcc-supply: true
+  iovcc-supply: true
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        touchscreen@1 {
+            compatible = "novatek,nt36672a-ts";
+            reg = <0x01>;
+            interrupts-extended = <&tlmm 31 IRQ_TYPE_EDGE_RISING>;
+            reset-gpios = <&tlmm 32 GPIO_ACTIVE_LOW>;
+            vcc-supply = <&vreg_l22a_2p85>;
+            iovcc-supply = <&vreg_l14a_1p8>;
+            pinctrl-0 = <&ts_int_default &ts_reset_default>;
+            pinctrl-1 = <&ts_int_sleep &ts_reset_sleep>;
+            pinctrl-names = "default", "sleep";
+            touchscreen-size-x = <1080>;
+            touchscreen-size-y = <2246>;
+        };
+    };
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 90754a451bcfc..e1f744992b15f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15942,6 +15942,7 @@ NOVATEK NVT-TS I2C TOUCHSCREEN DRIVER
 M:	Hans de Goede <hdegoede@redhat.com>
 L:	linux-input@vger.kernel.org
 S:	Maintained
+F:	Documentation/devicetree/bindings/input/touchscreen/novatek,nvt-ts.yaml
 F:	drivers/input/touchscreen/novatek-nvt-ts.c
 
 NSDEPS

-- 
2.45.1



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

* [PATCH v5 3/3] Input: novatek-nvt-ts: add support for NT36672A touchscreen
  2024-06-01 20:44 [PATCH v5 0/3] novatek-nvt-ts: add support for NT36672A touchscreen Joel Selvaraj via B4 Relay
  2024-06-01 20:44 ` [PATCH v5 1/3] Input: novatek-nvt-ts: replace generic i2c device id with specific IC variant Joel Selvaraj via B4 Relay
  2024-06-01 20:44 ` [PATCH v5 2/3] dt-bindings: input: document Novatek NVT touchscreen controller Joel Selvaraj via B4 Relay
@ 2024-06-01 20:44 ` Joel Selvaraj via B4 Relay
  2024-06-02 13:12   ` Hans de Goede
  2024-09-28  5:45 ` [PATCH v5 0/3] " Joel Selvaraj
  2024-09-30  2:14 ` Dmitry Torokhov
  4 siblings, 1 reply; 12+ messages in thread
From: Joel Selvaraj via B4 Relay @ 2024-06-01 20:44 UTC (permalink / raw)
  To: Hans de Goede, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86,
	Joel Selvaraj

From: Joel Selvaraj <joelselvaraj.oss@gmail.com>

Extend the novatek touchscreen driver to support NT36672A chip which
is found in phones like qcom/sdm845-xiaomi-beryllium-tianma.dts.
Added devicetree support for the driver and used i2c chip data to handle
the variation in chip id and wake type. Also added vcc and iovcc
regulators which are used to power the touchscreen hardware.

Signed-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>
---
 drivers/input/touchscreen/novatek-nvt-ts.c | 67 +++++++++++++++++++++++++++---
 1 file changed, 61 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/novatek-nvt-ts.c b/drivers/input/touchscreen/novatek-nvt-ts.c
index 9bee3a0c122fb..b9ff97bf4d880 100644
--- a/drivers/input/touchscreen/novatek-nvt-ts.c
+++ b/drivers/input/touchscreen/novatek-nvt-ts.c
@@ -31,9 +31,6 @@
 #define NVT_TS_PARAMS_CHIP_ID		0x0e
 #define NVT_TS_PARAMS_SIZE		0x0f
 
-#define NVT_TS_SUPPORTED_WAKE_TYPE	0x05
-#define NVT_TS_SUPPORTED_CHIP_ID	0x05
-
 #define NVT_TS_MAX_TOUCHES		10
 #define NVT_TS_MAX_SIZE			4096
 
@@ -51,10 +48,16 @@ static const int nvt_ts_irq_type[4] = {
 	IRQF_TRIGGER_HIGH
 };
 
+struct nvt_ts_i2c_chip_data {
+	u8 wake_type;
+	u8 chip_id;
+};
+
 struct nvt_ts_data {
 	struct i2c_client *client;
 	struct input_dev *input;
 	struct gpio_desc *reset_gpio;
+	struct regulator_bulk_data regulators[2];
 	struct touchscreen_properties prop;
 	int max_touches;
 	u8 buf[NVT_TS_TOUCH_SIZE * NVT_TS_MAX_TOUCHES];
@@ -142,6 +145,13 @@ static irqreturn_t nvt_ts_irq(int irq, void *dev_id)
 static int nvt_ts_start(struct input_dev *dev)
 {
 	struct nvt_ts_data *data = input_get_drvdata(dev);
+	int error;
+
+	error = regulator_bulk_enable(ARRAY_SIZE(data->regulators), data->regulators);
+	if (error) {
+		dev_err(&data->client->dev, "failed to enable regulators\n");
+		return error;
+	}
 
 	enable_irq(data->client->irq);
 	gpiod_set_value_cansleep(data->reset_gpio, 0);
@@ -155,6 +165,7 @@ static void nvt_ts_stop(struct input_dev *dev)
 
 	disable_irq(data->client->irq);
 	gpiod_set_value_cansleep(data->reset_gpio, 1);
+	regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
 }
 
 static int nvt_ts_suspend(struct device *dev)
@@ -188,6 +199,7 @@ static int nvt_ts_probe(struct i2c_client *client)
 	struct device *dev = &client->dev;
 	int error, width, height, irq_type;
 	struct nvt_ts_data *data;
+	const struct nvt_ts_i2c_chip_data *chip;
 	struct input_dev *input;
 
 	if (!client->irq) {
@@ -199,12 +211,35 @@ static int nvt_ts_probe(struct i2c_client *client)
 	if (!data)
 		return -ENOMEM;
 
+	chip = device_get_match_data(&client->dev);
+	if (!chip)
+		return -EINVAL;
+
 	data->client = client;
 	i2c_set_clientdata(client, data);
 
+	/*
+	 * VCC is the analog voltage supply
+	 * IOVCC is the digital voltage supply
+	 */
+	data->regulators[0].supply = "vcc";
+	data->regulators[1].supply = "iovcc";
+	error = devm_regulator_bulk_get(dev, ARRAY_SIZE(data->regulators), data->regulators);
+	if (error) {
+		dev_err(dev, "cannot get regulators: %d\n", error);
+		return error;
+	}
+
+	error = regulator_bulk_enable(ARRAY_SIZE(data->regulators), data->regulators);
+	if (error) {
+		dev_err(dev, "failed to enable regulators: %d\n", error);
+		return error;
+	}
+
 	data->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
 	error = PTR_ERR_OR_ZERO(data->reset_gpio);
 	if (error) {
+		regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
 		dev_err(dev, "failed to request reset GPIO: %d\n", error);
 		return error;
 	}
@@ -214,6 +249,7 @@ static int nvt_ts_probe(struct i2c_client *client)
 	error = nvt_ts_read_data(data->client, NVT_TS_PARAMETERS_START,
 				 data->buf, NVT_TS_PARAMS_SIZE);
 	gpiod_set_value_cansleep(data->reset_gpio, 1); /* Put back in reset */
+	regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
 	if (error)
 		return error;
 
@@ -225,8 +261,8 @@ static int nvt_ts_probe(struct i2c_client *client)
 	if (width > NVT_TS_MAX_SIZE || height >= NVT_TS_MAX_SIZE ||
 	    data->max_touches > NVT_TS_MAX_TOUCHES ||
 	    irq_type >= ARRAY_SIZE(nvt_ts_irq_type) ||
-	    data->buf[NVT_TS_PARAMS_WAKE_TYPE] != NVT_TS_SUPPORTED_WAKE_TYPE ||
-	    data->buf[NVT_TS_PARAMS_CHIP_ID] != NVT_TS_SUPPORTED_CHIP_ID) {
+	    data->buf[NVT_TS_PARAMS_WAKE_TYPE] != chip->wake_type ||
+	    data->buf[NVT_TS_PARAMS_CHIP_ID] != chip->chip_id) {
 		dev_err(dev, "Unsupported touchscreen parameters: %*ph\n",
 			NVT_TS_PARAMS_SIZE, data->buf);
 		return -EIO;
@@ -277,8 +313,26 @@ static int nvt_ts_probe(struct i2c_client *client)
 	return 0;
 }
 
+static const struct nvt_ts_i2c_chip_data nvt_nt11205_ts_data = {
+	.wake_type = 0x05,
+	.chip_id = 0x05,
+};
+
+static const struct nvt_ts_i2c_chip_data nvt_nt36672a_ts_data = {
+	.wake_type = 0x01,
+	.chip_id = 0x08,
+};
+
+static const struct of_device_id nvt_ts_of_match[] = {
+	{ .compatible = "novatek,nt11205-ts", .data = &nvt_nt11205_ts_data },
+	{ .compatible = "novatek,nt36672a-ts", .data = &nvt_nt36672a_ts_data },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, nvt_ts_of_match);
+
 static const struct i2c_device_id nvt_ts_i2c_id[] = {
-	{ "nt11205-ts" },
+	{ "nt11205-ts", (unsigned long) &nvt_nt11205_ts_data },
+	{ "nt36672a-ts", (unsigned long) &nvt_nt36672a_ts_data },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, nvt_ts_i2c_id);
@@ -287,6 +341,7 @@ static struct i2c_driver nvt_ts_driver = {
 	.driver = {
 		.name	= "novatek-nvt-ts",
 		.pm	= pm_sleep_ptr(&nvt_ts_pm_ops),
+		.of_match_table = nvt_ts_of_match,
 	},
 	.probe = nvt_ts_probe,
 	.id_table = nvt_ts_i2c_id,

-- 
2.45.1



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

* Re: [PATCH v5 1/3] Input: novatek-nvt-ts: replace generic i2c device id with specific IC variant
  2024-06-01 20:44 ` [PATCH v5 1/3] Input: novatek-nvt-ts: replace generic i2c device id with specific IC variant Joel Selvaraj via B4 Relay
@ 2024-06-02 13:11   ` Hans de Goede
  2024-06-02 13:23   ` Hans de Goede
  1 sibling, 0 replies; 12+ messages in thread
From: Hans de Goede @ 2024-06-02 13:11 UTC (permalink / raw)
  To: joelselvaraj.oss, Dmitry Torokhov, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86

Hi,

On 6/1/24 10:44 PM, Joel Selvaraj via B4 Relay wrote:
> From: Joel Selvaraj <joelselvaraj.oss@gmail.com>
> 
> This is done in preparation to introduce other variants of the Novatek NVT
> touchscreen controller that can be supported by the driver.
> 
> Signed-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  drivers/input/touchscreen/novatek-nvt-ts.c       | 2 +-
>  drivers/platform/x86/x86-android-tablets/other.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/novatek-nvt-ts.c b/drivers/input/touchscreen/novatek-nvt-ts.c
> index 1a797e410a3fa..9bee3a0c122fb 100644
> --- a/drivers/input/touchscreen/novatek-nvt-ts.c
> +++ b/drivers/input/touchscreen/novatek-nvt-ts.c
> @@ -278,7 +278,7 @@ static int nvt_ts_probe(struct i2c_client *client)
>  }
>  
>  static const struct i2c_device_id nvt_ts_i2c_id[] = {
> -	{ "NVT-ts" },
> +	{ "nt11205-ts" },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(i2c, nvt_ts_i2c_id);
> diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c
> index eb0e55c69dfed..129273df0fdeb 100644
> --- a/drivers/platform/x86/x86-android-tablets/other.c
> +++ b/drivers/platform/x86/x86-android-tablets/other.c
> @@ -40,7 +40,7 @@ static const struct x86_i2c_client_info acer_b1_750_i2c_clients[] __initconst =
>  	{
>  		/* Novatek NVT-ts touchscreen */
>  		.board_info = {
> -			.type = "NVT-ts",
> +			.type = "nt11205-ts",
>  			.addr = 0x34,
>  			.dev_name = "NVT-ts",
>  		},
> 


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

* Re: [PATCH v5 3/3] Input: novatek-nvt-ts: add support for NT36672A touchscreen
  2024-06-01 20:44 ` [PATCH v5 3/3] Input: novatek-nvt-ts: add support for NT36672A touchscreen Joel Selvaraj via B4 Relay
@ 2024-06-02 13:12   ` Hans de Goede
  0 siblings, 0 replies; 12+ messages in thread
From: Hans de Goede @ 2024-06-02 13:12 UTC (permalink / raw)
  To: joelselvaraj.oss, Dmitry Torokhov, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86

Hi,

On 6/1/24 10:44 PM, Joel Selvaraj via B4 Relay wrote:
> From: Joel Selvaraj <joelselvaraj.oss@gmail.com>
> 
> Extend the novatek touchscreen driver to support NT36672A chip which
> is found in phones like qcom/sdm845-xiaomi-beryllium-tianma.dts.
> Added devicetree support for the driver and used i2c chip data to handle
> the variation in chip id and wake type. Also added vcc and iovcc
> regulators which are used to power the touchscreen hardware.
> 
> Signed-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans




> ---
>  drivers/input/touchscreen/novatek-nvt-ts.c | 67 +++++++++++++++++++++++++++---
>  1 file changed, 61 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/novatek-nvt-ts.c b/drivers/input/touchscreen/novatek-nvt-ts.c
> index 9bee3a0c122fb..b9ff97bf4d880 100644
> --- a/drivers/input/touchscreen/novatek-nvt-ts.c
> +++ b/drivers/input/touchscreen/novatek-nvt-ts.c
> @@ -31,9 +31,6 @@
>  #define NVT_TS_PARAMS_CHIP_ID		0x0e
>  #define NVT_TS_PARAMS_SIZE		0x0f
>  
> -#define NVT_TS_SUPPORTED_WAKE_TYPE	0x05
> -#define NVT_TS_SUPPORTED_CHIP_ID	0x05
> -
>  #define NVT_TS_MAX_TOUCHES		10
>  #define NVT_TS_MAX_SIZE			4096
>  
> @@ -51,10 +48,16 @@ static const int nvt_ts_irq_type[4] = {
>  	IRQF_TRIGGER_HIGH
>  };
>  
> +struct nvt_ts_i2c_chip_data {
> +	u8 wake_type;
> +	u8 chip_id;
> +};
> +
>  struct nvt_ts_data {
>  	struct i2c_client *client;
>  	struct input_dev *input;
>  	struct gpio_desc *reset_gpio;
> +	struct regulator_bulk_data regulators[2];
>  	struct touchscreen_properties prop;
>  	int max_touches;
>  	u8 buf[NVT_TS_TOUCH_SIZE * NVT_TS_MAX_TOUCHES];
> @@ -142,6 +145,13 @@ static irqreturn_t nvt_ts_irq(int irq, void *dev_id)
>  static int nvt_ts_start(struct input_dev *dev)
>  {
>  	struct nvt_ts_data *data = input_get_drvdata(dev);
> +	int error;
> +
> +	error = regulator_bulk_enable(ARRAY_SIZE(data->regulators), data->regulators);
> +	if (error) {
> +		dev_err(&data->client->dev, "failed to enable regulators\n");
> +		return error;
> +	}
>  
>  	enable_irq(data->client->irq);
>  	gpiod_set_value_cansleep(data->reset_gpio, 0);
> @@ -155,6 +165,7 @@ static void nvt_ts_stop(struct input_dev *dev)
>  
>  	disable_irq(data->client->irq);
>  	gpiod_set_value_cansleep(data->reset_gpio, 1);
> +	regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
>  }
>  
>  static int nvt_ts_suspend(struct device *dev)
> @@ -188,6 +199,7 @@ static int nvt_ts_probe(struct i2c_client *client)
>  	struct device *dev = &client->dev;
>  	int error, width, height, irq_type;
>  	struct nvt_ts_data *data;
> +	const struct nvt_ts_i2c_chip_data *chip;
>  	struct input_dev *input;
>  
>  	if (!client->irq) {
> @@ -199,12 +211,35 @@ static int nvt_ts_probe(struct i2c_client *client)
>  	if (!data)
>  		return -ENOMEM;
>  
> +	chip = device_get_match_data(&client->dev);
> +	if (!chip)
> +		return -EINVAL;
> +
>  	data->client = client;
>  	i2c_set_clientdata(client, data);
>  
> +	/*
> +	 * VCC is the analog voltage supply
> +	 * IOVCC is the digital voltage supply
> +	 */
> +	data->regulators[0].supply = "vcc";
> +	data->regulators[1].supply = "iovcc";
> +	error = devm_regulator_bulk_get(dev, ARRAY_SIZE(data->regulators), data->regulators);
> +	if (error) {
> +		dev_err(dev, "cannot get regulators: %d\n", error);
> +		return error;
> +	}
> +
> +	error = regulator_bulk_enable(ARRAY_SIZE(data->regulators), data->regulators);
> +	if (error) {
> +		dev_err(dev, "failed to enable regulators: %d\n", error);
> +		return error;
> +	}
> +
>  	data->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
>  	error = PTR_ERR_OR_ZERO(data->reset_gpio);
>  	if (error) {
> +		regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
>  		dev_err(dev, "failed to request reset GPIO: %d\n", error);
>  		return error;
>  	}
> @@ -214,6 +249,7 @@ static int nvt_ts_probe(struct i2c_client *client)
>  	error = nvt_ts_read_data(data->client, NVT_TS_PARAMETERS_START,
>  				 data->buf, NVT_TS_PARAMS_SIZE);
>  	gpiod_set_value_cansleep(data->reset_gpio, 1); /* Put back in reset */
> +	regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
>  	if (error)
>  		return error;
>  
> @@ -225,8 +261,8 @@ static int nvt_ts_probe(struct i2c_client *client)
>  	if (width > NVT_TS_MAX_SIZE || height >= NVT_TS_MAX_SIZE ||
>  	    data->max_touches > NVT_TS_MAX_TOUCHES ||
>  	    irq_type >= ARRAY_SIZE(nvt_ts_irq_type) ||
> -	    data->buf[NVT_TS_PARAMS_WAKE_TYPE] != NVT_TS_SUPPORTED_WAKE_TYPE ||
> -	    data->buf[NVT_TS_PARAMS_CHIP_ID] != NVT_TS_SUPPORTED_CHIP_ID) {
> +	    data->buf[NVT_TS_PARAMS_WAKE_TYPE] != chip->wake_type ||
> +	    data->buf[NVT_TS_PARAMS_CHIP_ID] != chip->chip_id) {
>  		dev_err(dev, "Unsupported touchscreen parameters: %*ph\n",
>  			NVT_TS_PARAMS_SIZE, data->buf);
>  		return -EIO;
> @@ -277,8 +313,26 @@ static int nvt_ts_probe(struct i2c_client *client)
>  	return 0;
>  }
>  
> +static const struct nvt_ts_i2c_chip_data nvt_nt11205_ts_data = {
> +	.wake_type = 0x05,
> +	.chip_id = 0x05,
> +};
> +
> +static const struct nvt_ts_i2c_chip_data nvt_nt36672a_ts_data = {
> +	.wake_type = 0x01,
> +	.chip_id = 0x08,
> +};
> +
> +static const struct of_device_id nvt_ts_of_match[] = {
> +	{ .compatible = "novatek,nt11205-ts", .data = &nvt_nt11205_ts_data },
> +	{ .compatible = "novatek,nt36672a-ts", .data = &nvt_nt36672a_ts_data },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, nvt_ts_of_match);
> +
>  static const struct i2c_device_id nvt_ts_i2c_id[] = {
> -	{ "nt11205-ts" },
> +	{ "nt11205-ts", (unsigned long) &nvt_nt11205_ts_data },
> +	{ "nt36672a-ts", (unsigned long) &nvt_nt36672a_ts_data },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(i2c, nvt_ts_i2c_id);
> @@ -287,6 +341,7 @@ static struct i2c_driver nvt_ts_driver = {
>  	.driver = {
>  		.name	= "novatek-nvt-ts",
>  		.pm	= pm_sleep_ptr(&nvt_ts_pm_ops),
> +		.of_match_table = nvt_ts_of_match,
>  	},
>  	.probe = nvt_ts_probe,
>  	.id_table = nvt_ts_i2c_id,
> 


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

* Re: [PATCH v5 1/3] Input: novatek-nvt-ts: replace generic i2c device id with specific IC variant
  2024-06-01 20:44 ` [PATCH v5 1/3] Input: novatek-nvt-ts: replace generic i2c device id with specific IC variant Joel Selvaraj via B4 Relay
  2024-06-02 13:11   ` Hans de Goede
@ 2024-06-02 13:23   ` Hans de Goede
  1 sibling, 0 replies; 12+ messages in thread
From: Hans de Goede @ 2024-06-02 13:23 UTC (permalink / raw)
  To: joelselvaraj.oss, Dmitry Torokhov, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86

Hi,

On 6/1/24 10:44 PM, Joel Selvaraj via B4 Relay wrote:
> From: Joel Selvaraj <joelselvaraj.oss@gmail.com>
> 
> This is done in preparation to introduce other variants of the Novatek NVT
> touchscreen controller that can be supported by the driver.
> 
> Signed-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>

Also:

Acked-by: Hans de Goede <hdegoede@redhat.com>

for merging the drivers/platform/x86/x86-android-tablets/other.c change
through the input tree.

Regards,

Hans




> ---
>  drivers/input/touchscreen/novatek-nvt-ts.c       | 2 +-
>  drivers/platform/x86/x86-android-tablets/other.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/novatek-nvt-ts.c b/drivers/input/touchscreen/novatek-nvt-ts.c
> index 1a797e410a3fa..9bee3a0c122fb 100644
> --- a/drivers/input/touchscreen/novatek-nvt-ts.c
> +++ b/drivers/input/touchscreen/novatek-nvt-ts.c
> @@ -278,7 +278,7 @@ static int nvt_ts_probe(struct i2c_client *client)
>  }
>  
>  static const struct i2c_device_id nvt_ts_i2c_id[] = {
> -	{ "NVT-ts" },
> +	{ "nt11205-ts" },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(i2c, nvt_ts_i2c_id);
> diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c
> index eb0e55c69dfed..129273df0fdeb 100644
> --- a/drivers/platform/x86/x86-android-tablets/other.c
> +++ b/drivers/platform/x86/x86-android-tablets/other.c
> @@ -40,7 +40,7 @@ static const struct x86_i2c_client_info acer_b1_750_i2c_clients[] __initconst =
>  	{
>  		/* Novatek NVT-ts touchscreen */
>  		.board_info = {
> -			.type = "NVT-ts",
> +			.type = "nt11205-ts",
>  			.addr = 0x34,
>  			.dev_name = "NVT-ts",
>  		},
> 


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

* Re: [PATCH v5 0/3] novatek-nvt-ts: add support for NT36672A touchscreen
  2024-06-01 20:44 [PATCH v5 0/3] novatek-nvt-ts: add support for NT36672A touchscreen Joel Selvaraj via B4 Relay
                   ` (2 preceding siblings ...)
  2024-06-01 20:44 ` [PATCH v5 3/3] Input: novatek-nvt-ts: add support for NT36672A touchscreen Joel Selvaraj via B4 Relay
@ 2024-09-28  5:45 ` Joel Selvaraj
  2024-09-28  7:49   ` Krzysztof Kozlowski
  2024-09-30  2:14 ` Dmitry Torokhov
  4 siblings, 1 reply; 12+ messages in thread
From: Joel Selvaraj @ 2024-09-28  5:45 UTC (permalink / raw)
  To: Hans de Goede, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86,
	Krzysztof Kozlowski

Hi,

A gentle ping to the maintainers/reviewers. I was initially hoping this 
patch would land in 6.11. And it got kind of missed. So I am currently 
hoping it would land in 6.12. But I haven't seen any update in the 
patch. There is no hurry and can wait for 6.13 or future. Just don't 
want the patch to be forgotten/lost/missed. Kindly let me know if any 
further changes are required! I will be happy to fix them.

Thank you,
Joel Selvaraj

On 6/1/24 15:44, Joel Selvaraj via B4 Relay wrote:
> Extend the novatek touchscreen driver to support NT36672A chip which
> is found in phones like qcom/sdm845-xiaomi-beryllium-tianma.dts.
> Added devicetree support for the driver and used i2c chip data to handle
> the variation in chip id and wake type. Also added vcc and iovcc
> regulators which are used to power the touchscreen hardware.
> 
> Signed-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>
> ---
> Changes in v5:
> - Made the chip data a local variable as it is only used during probe.
> - Handle the regulator disable correctly for all exit paths in probe.
> - Link to v4: https://lore.kernel.org/r/20240601-nvt-ts-devicetree-regulator-support-v4-0-e0c0174464c4@gmail.com
> 
> Changes in v4:
> - Use lowercase i2c device id as suggested by Hans de Goede.
> - Disable the regulators after nvt_ts_read_data during probe.
> - Link to v3: https://lore.kernel.org/r/20240526-nvt-ts-devicetree-regulator-support-v3-0-aa88d10ccd9a@gmail.com
> 
> Changes in v3:
> - Fix indentation in the binding as suggested by Krzysztof Kozlowski.
> - Picked up Krzysztof Kozlowski's Reviewed-by tag for the binding.
> - Link to v2: https://lore.kernel.org/r/20240524-nvt-ts-devicetree-regulator-support-v2-0-b74947038c44@gmail.com
> 
> Changes in v2:
> - The generic i2c device id is now replaced with the correct IC variant
>    provided by Hans de Goede
> - Updated the bindings to reflect the latest changes and also incorporated
>    the suggestions provided by Krzysztof Kozlowski
> - Link to v1: https://lore.kernel.org/r/20240521-nvt-ts-devicetree-regulator-support-v1-0-8d766c639dca@gmail.com
> 
> ---
> Joel Selvaraj (3):
>        Input: novatek-nvt-ts: replace generic i2c device id with specific IC variant
>        dt-bindings: input: document Novatek NVT touchscreen controller
>        Input: novatek-nvt-ts: add support for NT36672A touchscreen
> 
>   .../bindings/input/touchscreen/novatek,nvt-ts.yaml | 62 ++++++++++++++++++++
>   MAINTAINERS                                        |  1 +
>   drivers/input/touchscreen/novatek-nvt-ts.c         | 67 ++++++++++++++++++++--
>   drivers/platform/x86/x86-android-tablets/other.c   |  2 +-
>   4 files changed, 125 insertions(+), 7 deletions(-)
> ---
> base-commit: 6578aac6a270bd6deb9f9319b991dd430de263dd
> change-id: 20240518-nvt-ts-devicetree-regulator-support-ac9e49b78a16
> 
> Best regards,


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

* Re: [PATCH v5 0/3] novatek-nvt-ts: add support for NT36672A touchscreen
  2024-09-28  5:45 ` [PATCH v5 0/3] " Joel Selvaraj
@ 2024-09-28  7:49   ` Krzysztof Kozlowski
  2024-09-28 19:50     ` Joel Selvaraj
  0 siblings, 1 reply; 12+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-28  7:49 UTC (permalink / raw)
  To: Joel Selvaraj, Hans de Goede, Dmitry Torokhov, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86

On 28/09/2024 07:45, Joel Selvaraj wrote:
> Hi,
> 
> A gentle ping to the maintainers/reviewers. I was initially hoping this 
> patch would land in 6.11. And it got kind of missed. So I am currently 
> hoping it would land in 6.12. But I haven't seen any update in the 
> patch. There is no hurry and can wait for 6.13 or future. Just don't 
> want the patch to be forgotten/lost/missed. Kindly let me know if any 
> further changes are required! I will be happy to fix them.

We are still in merge window, so nothing can happen with your patches.
Pinging during merge window is not welcomed, just unnecessary noise.
Wait till merge window finishes and then ping, or better resend.

Your patch waited indeed way too long, but if you wanted it to reach
v6.12, then you should have done something earlier. No one has it in
their inbox anymore.

Please resend with accumulated tags, assuming there is no outstanding
review comments, after the merge window.

Best regards,
Krzysztof


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

* Re: [PATCH v5 0/3] novatek-nvt-ts: add support for NT36672A touchscreen
  2024-09-28  7:49   ` Krzysztof Kozlowski
@ 2024-09-28 19:50     ` Joel Selvaraj
  0 siblings, 0 replies; 12+ messages in thread
From: Joel Selvaraj @ 2024-09-28 19:50 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Hans de Goede, Dmitry Torokhov, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Ilpo Järvinen
  Cc: linux-input, devicetree, linux-kernel, platform-driver-x86

Hi Krzysztof Kozlowski,

On 9/28/24 02:49, Krzysztof Kozlowski wrote:
> On 28/09/2024 07:45, Joel Selvaraj wrote:
>> Hi,
>>
>> A gentle ping to the maintainers/reviewers. I was initially hoping this
>> patch would land in 6.11. And it got kind of missed. So I am currently
>> hoping it would land in 6.12. But I haven't seen any update in the
>> patch. There is no hurry and can wait for 6.13 or future. Just don't
>> want the patch to be forgotten/lost/missed. Kindly let me know if any
>> further changes are required! I will be happy to fix them.
> 
> We are still in merge window, so nothing can happen with your patches.
> Pinging during merge window is not welcomed, just unnecessary noise.
> Wait till merge window finishes and then ping, or better resend.

Ah I see. Understood. Sorry for the noise.

> Your patch waited indeed way too long, but if you wanted it to reach
> v6.12, then you should have done something earlier. No one has it in
> their inbox anymore.
> 
> Please resend with accumulated tags, assuming there is no outstanding
> review comments, after the merge window.

Will do. Thanks!
Joel Selvaraj
> 
> Best regards,
> Krzysztof
> 


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

* Re: [PATCH v5 0/3] novatek-nvt-ts: add support for NT36672A touchscreen
  2024-06-01 20:44 [PATCH v5 0/3] novatek-nvt-ts: add support for NT36672A touchscreen Joel Selvaraj via B4 Relay
                   ` (3 preceding siblings ...)
  2024-09-28  5:45 ` [PATCH v5 0/3] " Joel Selvaraj
@ 2024-09-30  2:14 ` Dmitry Torokhov
  2024-09-30 19:56   ` Joel Selvaraj
  4 siblings, 1 reply; 12+ messages in thread
From: Dmitry Torokhov @ 2024-09-30  2:14 UTC (permalink / raw)
  To: joelselvaraj.oss
  Cc: Hans de Goede, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Ilpo Järvinen, linux-input, devicetree, linux-kernel,
	platform-driver-x86, Krzysztof Kozlowski

On Sat, Jun 01, 2024 at 03:44:42PM -0500, Joel Selvaraj via B4 Relay wrote:
> Extend the novatek touchscreen driver to support NT36672A chip which
> is found in phones like qcom/sdm845-xiaomi-beryllium-tianma.dts.
> Added devicetree support for the driver and used i2c chip data to handle
> the variation in chip id and wake type. Also added vcc and iovcc
> regulators which are used to power the touchscreen hardware.
> 
> Signed-off-by: Joel Selvaraj <joelselvaraj.oss@gmail.com>

Applied the series, it will go in the next merge window. Sorry for the
delay.

Thanks.

-- 
Dmitry

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

* Re: [PATCH v5 0/3] novatek-nvt-ts: add support for NT36672A touchscreen
  2024-09-30  2:14 ` Dmitry Torokhov
@ 2024-09-30 19:56   ` Joel Selvaraj
  0 siblings, 0 replies; 12+ messages in thread
From: Joel Selvaraj @ 2024-09-30 19:56 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Hans de Goede, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Ilpo Järvinen, linux-input, devicetree, linux-kernel,
	platform-driver-x86, Krzysztof Kozlowski

> Applied the series, it will go in the next merge window. Sorry for the
> delay.

Nice to know. thank you!
- Joel Selvaraj

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

end of thread, other threads:[~2024-09-30 19:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-01 20:44 [PATCH v5 0/3] novatek-nvt-ts: add support for NT36672A touchscreen Joel Selvaraj via B4 Relay
2024-06-01 20:44 ` [PATCH v5 1/3] Input: novatek-nvt-ts: replace generic i2c device id with specific IC variant Joel Selvaraj via B4 Relay
2024-06-02 13:11   ` Hans de Goede
2024-06-02 13:23   ` Hans de Goede
2024-06-01 20:44 ` [PATCH v5 2/3] dt-bindings: input: document Novatek NVT touchscreen controller Joel Selvaraj via B4 Relay
2024-06-01 20:44 ` [PATCH v5 3/3] Input: novatek-nvt-ts: add support for NT36672A touchscreen Joel Selvaraj via B4 Relay
2024-06-02 13:12   ` Hans de Goede
2024-09-28  5:45 ` [PATCH v5 0/3] " Joel Selvaraj
2024-09-28  7:49   ` Krzysztof Kozlowski
2024-09-28 19:50     ` Joel Selvaraj
2024-09-30  2:14 ` Dmitry Torokhov
2024-09-30 19:56   ` Joel Selvaraj

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