Skip to contentSkip to conversation

dt-bindings: input: touchscreen: goodix: Document AVDD28-supply property

PATCH Superseded Jagan Teki 1 participant 5 messages Dec 5, 2018 – Dec 6, 2018

Subsystems (4)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

PATCH v2 1/4 dt-bindings: input: touchscreen: goodix: Document AVDD28-supply property

Most of the Goodix CTP controllers are supply with AVDD28 pin. which need to supply for controllers like GT5663 on some boards to trigger the power.

So, document the supply property so-that the required board that used on GT5663 can enable it via device tree.

---
Changes for v2:
- Rename vcc-supply with AVDD28-supply

 Documentation/devicetree/bindings/input/touchscreen/goodix.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/input/touchscreen/goodix.txt +1 -0
index f7e95c52f3c7..c4622c983e08 100644
@@ -23,6 +23,7 @@ Optional properties:
  - touchscreen-inverted-y  : Y axis is inverted (boolean)
  - touchscreen-swapped-x-y : X and Y axis are swapped (boolean)
                              (swapping is done after inverting the axis)
+ - AVDD28-supply	: Analog power supply regulator on AVDD28 pin
 
 Example:
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#1 lore raw

PATCH v2 2/4 Input: goodix - Add ADVV28-supply regulator support

Goodix CTP controllers have AVDD28 pin connected to voltage regulator which may not be turned on by default, like for GT5663.

Add support for such ctp used boards by adding voltage regulator handling code to goodix ctp driver.

---
Changes for v2:
- disable regulator in remove
- fix to setup regulator in probe code

 drivers/input/touchscreen/goodix.c | 33 +++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)
drivers/input/touchscreen/goodix.c +28 -5
index f2d9c2c41885..7371f6946098 100644
@@ -27,6 +27,7 @@
 #include <linux/delay.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
+#include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 #include <linux/acpi.h>
 #include <linux/of.h>
@@ -47,6 +48,7 @@ struct goodix_ts_data {
 	struct touchscreen_properties prop;
 	unsigned int max_touch_num;
 	unsigned int int_trigger_type;
+	struct regulator *avdd28;
 	struct gpio_desc *gpiod_int;
 	struct gpio_desc *gpiod_rst;
 	u16 id;
@@ -786,25 +788,41 @@ static int goodix_ts_probe(struct i2c_client *client,
 	if (error)
 		return error;
 
+	ts->avdd28 = devm_regulator_get(&client->dev, "AVDD28");
+	if (IS_ERR(ts->avdd28)) {
+		error = PTR_ERR(ts->avdd28);
+		if (error != -EPROBE_DEFER)
+			dev_err(&client->dev,
+				"Failed to get AVDD28 regulator: %d\n", error);
+		return error;
+	}
+
+	/* power the controller */
+	error = regulator_enable(ts->avdd28);
+	if (error) {
+		dev_err(&client->dev, "Controller fail to enable AVDD28\n");
+		return error;
+	}
+
 	if (ts->gpiod_int && ts->gpiod_rst) {
 		/* reset the controller */
 		error = goodix_reset(ts);
 		if (error) {
 			dev_err(&client->dev, "Controller reset failed.\n");
-			return error;
+			goto error;
 		}
 	}
 
 	error = goodix_i2c_test(client);
 	if (error) {
 		dev_err(&client->dev, "I2C communication failure: %d\n", error);
-		return error;
+		goto error;
 	}
 
 	error = goodix_read_version(ts);
 	if (error) {
 		dev_err(&client->dev, "Read version failed.\n");
-		return error;
+		goto error;
 	}
 
 	ts->chip = goodix_get_chip_data(ts->id);
@@ -823,23 +841,28 @@ static int goodix_ts_probe(struct i2c_client *client,
 			dev_err(&client->dev,
 				"Failed to invoke firmware loader: %d\n",
 				error);
-			return error;
+			goto error;
 		}
 
 		return 0;
 	} else {
 		error = goodix_configure_dev(ts);
 		if (error)
-			return error;
+			goto error;
 	}
 
 	return 0;
+
+error:
+	regulator_disable(ts->avdd28);
+	return error;
 }
 
 static int goodix_ts_remove(struct i2c_client *client)
 {
 	struct goodix_ts_data *ts = i2c_get_clientdata(client);
 
+	regulator_disable(ts->avdd28);
 	if (ts->gpiod_int && ts->gpiod_rst)
 		wait_for_completion(&ts->firmware_loading_complete);
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#2 lore raw

Re: [PATCH v2 2/4] Input: goodix - Add ADVV28-supply regulator support

Quoted 6 lines · Jagan Teki

Goodix CTP controllers have AVDD28 pin connected to voltage regulator which may not be turned on by default, like for GT5663.

Add support for such ctp used boards by adding voltage regulator handling code to goodix ctp driver.

s/ADVV28/AVDD28 on commit head, let me know if you need another version to update that or is it OK to you to change while applying. sorry.

author
#3 lore raw

PATCH v2 3/4 dt-bindings: input: touchscreen: goodix: Add GT5663 compatible

In reply to Jagan Teki

GT5663 is capacitive touch controller with customized smart wakeup gestures, it support chipdata which is similar to existing GT1151 and require AVDD28 supply for some boards.

Document the compatible for the same.

---
Changes for v2:
- drop example node

 Documentation/devicetree/bindings/input/touchscreen/goodix.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/input/touchscreen/goodix.txt +1 -0
index c4622c983e08..59c89276e6bb 100644
@@ -3,6 +3,7 @@ Device tree bindings for Goodix GT9xx series touchscreen controller
 Required properties:
 
  - compatible		: Should be "goodix,gt1151"
+				 or "goodix,gt5663"
 				 or "goodix,gt911"
 				 or "goodix,gt9110"
 				 or "goodix,gt912"
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#4 lore raw

PATCH v2 4/4 Input: goodix - Add GT5663 CTP support

In reply to Jagan Teki

GT5663 is capacitive touch controller with customized smart wakeup gestures.

Add support for it by adding compatible and supported chip data.

The chip data on GT5663 is similar to GT1151, like
- config data register has 0x8050 address
- config data register max len is 240
- config data checksum has 16-bit

---
Changes for v2:
- add chipdata

 drivers/input/touchscreen/goodix.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/input/touchscreen/goodix.c +2 -0
index 7371f6946098..735ab8e246b6 100644
@@ -218,6 +218,7 @@ static const struct goodix_chip_data *goodix_get_chip_data(u16 id)
 {
 	switch (id) {
 	case 1151:
+	case 5663:
 		return &gt1x_chip_data;
 
 	case 911:
@@ -965,6 +966,7 @@ MODULE_DEVICE_TABLE(acpi, goodix_acpi_match);
 #ifdef CONFIG_OF
 static const struct of_device_id goodix_of_match[] = {
 	{ .compatible = "goodix,gt1151" },
+	{ .compatible = "goodix,gt5663" },
 	{ .compatible = "goodix,gt911" },
 	{ .compatible = "goodix,gt9110" },
 	{ .compatible = "goodix,gt912" },
Signature · 1 line
2.18.0.321.gffc6fa0e3