All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/4] input: touchscreen: Add goodix GT5553 CTP support
@ 2019-02-17  9:14 Jagan Teki
  2019-02-17  9:14 ` [PATCH v5 1/4] dt-bindings: input: touchscreen: goodix: Document regulator properties Jagan Teki
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Jagan Teki @ 2019-02-17  9:14 UTC (permalink / raw)
  To: Dmitry Torokhov, Bastien Nocera, Rob Herring
  Cc: Henrik Rydberg, linux-input, linux-kernel, devicetree,
	Mark Rutland, linux-amarula, Michael Trimarchi, Jagan Teki

This is v5 patchset for supporting goodix GT5553 CTP. Here is the
previous version[1]

Changes for v4:
- document AVDD22, DVDD12, VDDIO as optional properties
- use regulator bulk calls, for get, enable and disable functionalities
Changes for v4:
- devm_add_action_or_reset for disabling regulator
Changes for v3:
- add cover-letter
- s/ADVV28/AVDD28 on commit head
- fix few typo
Changes for v2:
- Rename vcc-supply with AVDD28-supply
- disable regulator in remove
- fix to setup regulator in probe code
- add chipdata
- drop example node in dt-bindings

[1] https://patchwork.kernel.org/cover/10807779/

Jagan Teki (4):
  dt-bindings: input: touchscreen: goodix: Document regulator properties
  Input: goodix - Add regulators support
  dt-bindings: input: touchscreen: goodix: Add GT5663 compatible
  Input: goodix - Add GT5663 CTP support

 .../bindings/input/touchscreen/goodix.txt     |  8 +++
 drivers/input/touchscreen/goodix.c            | 60 +++++++++++++++++--
 2 files changed, 62 insertions(+), 6 deletions(-)

-- 
2.18.0.321.gffc6fa0e3


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

* [PATCH v5 1/4] dt-bindings: input: touchscreen: goodix: Document regulator properties
  2019-02-17  9:14 [PATCH v5 0/4] input: touchscreen: Add goodix GT5553 CTP support Jagan Teki
@ 2019-02-17  9:14 ` Jagan Teki
  2019-02-18 15:45   ` Rob Herring
  2019-02-17  9:14 ` [PATCH v5 2/4] Input: goodix - Add regulators support Jagan Teki
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Jagan Teki @ 2019-02-17  9:14 UTC (permalink / raw)
  To: Dmitry Torokhov, Bastien Nocera, Rob Herring
  Cc: Henrik Rydberg, linux-input, linux-kernel, devicetree,
	Mark Rutland, linux-amarula, Michael Trimarchi, Jagan Teki

Goodix CTP controllers support analog, digital and gpio regulator
supplies on relevant controller pin configurations.

Out of which AVDD28 regulator is mandatory supplied regulator in most
of the board designs, so document AVDD28 as required property and
rest marked as optional regulators.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 .../devicetree/bindings/input/touchscreen/goodix.txt       | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
index f7e95c52f3c7..8f6e6eede64d 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
@@ -23,6 +23,13 @@ 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
+
+Optional properties:
+
+ - AVDD22-supply	: Analog power supply regulator on AVDD22 pin
+ - DVDD12-supply	: Digital power supply regulator on DVDD12 pin
+ - VDDIO-supply		: GPIO power supply regulator on VDDIO pin
 
 Example:
 
-- 
2.18.0.321.gffc6fa0e3


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

* [PATCH v5 2/4] Input: goodix - Add regulators support
  2019-02-17  9:14 [PATCH v5 0/4] input: touchscreen: Add goodix GT5553 CTP support Jagan Teki
  2019-02-17  9:14 ` [PATCH v5 1/4] dt-bindings: input: touchscreen: goodix: Document regulator properties Jagan Teki
@ 2019-02-17  9:14 ` Jagan Teki
  2019-02-17  9:14 ` [PATCH v5 3/4] dt-bindings: input: touchscreen: goodix: Add GT5663 compatible Jagan Teki
  2019-02-17  9:14 ` [PATCH v5 4/4] Input: goodix - Add GT5663 CTP support Jagan Teki
  3 siblings, 0 replies; 9+ messages in thread
From: Jagan Teki @ 2019-02-17  9:14 UTC (permalink / raw)
  To: Dmitry Torokhov, Bastien Nocera, Rob Herring
  Cc: Henrik Rydberg, linux-input, linux-kernel, devicetree,
	Mark Rutland, linux-amarula, Michael Trimarchi, Jagan Teki

Goodix CTP controllers support analog, digital and gpio regulator
supplies on relevant controller pin configurations.

Support them via regulator bulk calls.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 drivers/input/touchscreen/goodix.c | 58 ++++++++++++++++++++++++++----
 1 file changed, 52 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index f2d9c2c41885..294456a53fe0 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -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>
@@ -40,6 +41,15 @@ struct goodix_chip_data {
 	int (*check_config)(struct goodix_ts_data *, const struct firmware *);
 };
 
+static const char * const goodix_supply_names[] = {
+	"AVDD28",
+	"AVDD22",
+	"DVDD12",
+	"VDDIO",
+};
+
+#define GOODIX_NUM_SUPPLIES	ARRAY_SIZE(goodix_supply_names)
+
 struct goodix_ts_data {
 	struct i2c_client *client;
 	struct input_dev *input_dev;
@@ -47,6 +57,7 @@ struct goodix_ts_data {
 	struct touchscreen_properties prop;
 	unsigned int max_touch_num;
 	unsigned int int_trigger_type;
+	struct regulator_bulk_data supplies[GOODIX_NUM_SUPPLIES];
 	struct gpio_desc *gpiod_int;
 	struct gpio_desc *gpiod_rst;
 	u16 id;
@@ -761,11 +772,18 @@ static void goodix_config_cb(const struct firmware *cfg, void *ctx)
 	complete_all(&ts->firmware_loading_complete);
 }
 
+static void goodix_disable_regulator(void *arg)
+{
+	struct goodix_ts_data *ts = arg;
+
+	regulator_bulk_disable(GOODIX_NUM_SUPPLIES, ts->supplies);
+}
+
 static int goodix_ts_probe(struct i2c_client *client,
 			   const struct i2c_device_id *id)
 {
 	struct goodix_ts_data *ts;
-	int error;
+	int error, i;
 
 	dev_dbg(&client->dev, "I2C Address: 0x%02x\n", client->addr);
 
@@ -786,25 +804,49 @@ static int goodix_ts_probe(struct i2c_client *client,
 	if (error)
 		return error;
 
+	for (i = 0; i < GOODIX_NUM_SUPPLIES; i++)
+		ts->supplies[i].supply = goodix_supply_names[i];
+
+	error = devm_regulator_bulk_get(&client->dev, GOODIX_NUM_SUPPLIES,
+					ts->supplies);
+	if (error) {
+		dev_err(&client->dev, "Failed to get regulators (ret=%d)\n",
+			error);
+		return error;
+	}
+
+	error = devm_add_action_or_reset(&client->dev,
+					 goodix_disable_regulator, ts);
+	if (error)
+		return error;
+
+	/* power the controller */
+	error = regulator_bulk_enable(GOODIX_NUM_SUPPLIES, ts->supplies);
+	if (error) {
+		dev_err(&client->dev, "Failed to enable regulators (ret=%d)\n",
+			error);
+		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,17 +865,21 @@ 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_bulk_disable(GOODIX_NUM_SUPPLIES, ts->supplies);
+	return error;
 }
 
 static int goodix_ts_remove(struct i2c_client *client)
-- 
2.18.0.321.gffc6fa0e3


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

* [PATCH v5 3/4] dt-bindings: input: touchscreen: goodix: Add GT5663 compatible
  2019-02-17  9:14 [PATCH v5 0/4] input: touchscreen: Add goodix GT5553 CTP support Jagan Teki
  2019-02-17  9:14 ` [PATCH v5 1/4] dt-bindings: input: touchscreen: goodix: Document regulator properties Jagan Teki
  2019-02-17  9:14 ` [PATCH v5 2/4] Input: goodix - Add regulators support Jagan Teki
@ 2019-02-17  9:14 ` Jagan Teki
  2019-02-18 15:45     ` Rob Herring
  2019-02-17  9:14 ` [PATCH v5 4/4] Input: goodix - Add GT5663 CTP support Jagan Teki
  3 siblings, 1 reply; 9+ messages in thread
From: Jagan Teki @ 2019-02-17  9:14 UTC (permalink / raw)
  To: Dmitry Torokhov, Bastien Nocera, Rob Herring
  Cc: Henrik Rydberg, linux-input, linux-kernel, devicetree,
	Mark Rutland, linux-amarula, Michael Trimarchi, 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.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 Documentation/devicetree/bindings/input/touchscreen/goodix.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
index 8f6e6eede64d..29c149d91a05 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
@@ -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"
-- 
2.18.0.321.gffc6fa0e3


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

* [PATCH v5 4/4] Input: goodix - Add GT5663 CTP support
  2019-02-17  9:14 [PATCH v5 0/4] input: touchscreen: Add goodix GT5553 CTP support Jagan Teki
                   ` (2 preceding siblings ...)
  2019-02-17  9:14 ` [PATCH v5 3/4] dt-bindings: input: touchscreen: goodix: Add GT5663 compatible Jagan Teki
@ 2019-02-17  9:14 ` Jagan Teki
  3 siblings, 0 replies; 9+ messages in thread
From: Jagan Teki @ 2019-02-17  9:14 UTC (permalink / raw)
  To: Dmitry Torokhov, Bastien Nocera, Rob Herring
  Cc: Henrik Rydberg, linux-input, linux-kernel, devicetree,
	Mark Rutland, linux-amarula, Michael Trimarchi, 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

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 drivers/input/touchscreen/goodix.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index 294456a53fe0..80f8b920ef5e 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -227,6 +227,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:
@@ -988,6 +989,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" },
-- 
2.18.0.321.gffc6fa0e3


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

* Re: [PATCH v5 3/4] dt-bindings: input: touchscreen: goodix: Add GT5663 compatible
  2019-02-17  9:14 ` [PATCH v5 3/4] dt-bindings: input: touchscreen: goodix: Add GT5663 compatible Jagan Teki
@ 2019-02-18 15:45     ` Rob Herring
  0 siblings, 0 replies; 9+ messages in thread
From: Rob Herring @ 2019-02-18 15:45 UTC (permalink / raw)
  To: Jagan Teki
  Cc: Dmitry Torokhov, Bastien Nocera, Henrik Rydberg, linux-input,
	linux-kernel, devicetree, Mark Rutland, linux-amarula,
	Michael Trimarchi, Jagan Teki

On Sun, 17 Feb 2019 14:44:35 +0530, Jagan Teki wrote:
> 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.
> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  Documentation/devicetree/bindings/input/touchscreen/goodix.txt | 1 +
>  1 file changed, 1 insertion(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v5 3/4] dt-bindings: input: touchscreen: goodix: Add GT5663 compatible
@ 2019-02-18 15:45     ` Rob Herring
  0 siblings, 0 replies; 9+ messages in thread
From: Rob Herring @ 2019-02-18 15:45 UTC (permalink / raw)
  Cc: Dmitry Torokhov, Bastien Nocera, Henrik Rydberg, linux-input,
	linux-kernel, devicetree, Mark Rutland, linux-amarula,
	Michael Trimarchi, Jagan Teki

On Sun, 17 Feb 2019 14:44:35 +0530, Jagan Teki wrote:
> 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.
> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  Documentation/devicetree/bindings/input/touchscreen/goodix.txt | 1 +
>  1 file changed, 1 insertion(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v5 1/4] dt-bindings: input: touchscreen: goodix: Document regulator properties
  2019-02-17  9:14 ` [PATCH v5 1/4] dt-bindings: input: touchscreen: goodix: Document regulator properties Jagan Teki
@ 2019-02-18 15:45   ` Rob Herring
  2019-02-18 19:04     ` Jagan Teki
  0 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2019-02-18 15:45 UTC (permalink / raw)
  To: Jagan Teki
  Cc: Dmitry Torokhov, Bastien Nocera, Henrik Rydberg, linux-input,
	linux-kernel, devicetree, Mark Rutland, linux-amarula,
	Michael Trimarchi

On Sun, Feb 17, 2019 at 02:44:33PM +0530, Jagan Teki wrote:
> Goodix CTP controllers support analog, digital and gpio regulator
> supplies on relevant controller pin configurations.
> 
> Out of which AVDD28 regulator is mandatory supplied regulator in most
> of the board designs, so document AVDD28 as required property and
> rest marked as optional regulators.
> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  .../devicetree/bindings/input/touchscreen/goodix.txt       | 7 +++++++
>  1 file changed, 7 insertions(+)

Reviewed-by: Rob Herring <robh@kernel.org>


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

* Re: [PATCH v5 1/4] dt-bindings: input: touchscreen: goodix: Document regulator properties
  2019-02-18 15:45   ` Rob Herring
@ 2019-02-18 19:04     ` Jagan Teki
  0 siblings, 0 replies; 9+ messages in thread
From: Jagan Teki @ 2019-02-18 19:04 UTC (permalink / raw)
  To: Rob Herring
  Cc: Dmitry Torokhov, Bastien Nocera, Henrik Rydberg, linux-input,
	linux-kernel, devicetree, Mark Rutland, linux-amarula,
	Michael Trimarchi

[-- Attachment #1: Type: text/plain, Size: 646 bytes --]

Hi Rob,

On Mon, Feb 18, 2019 at 9:15 PM Rob Herring <robh@kernel.org> wrote:
>
> On Sun, Feb 17, 2019 at 02:44:33PM +0530, Jagan Teki wrote:
> > Goodix CTP controllers support analog, digital and gpio regulator
> > supplies on relevant controller pin configurations.
> >
> > Out of which AVDD28 regulator is mandatory supplied regulator in most
> > of the board designs, so document AVDD28 as required property and
> > rest marked as optional regulators.

Look like AVDD22, DVDD12 regulators are not being used in power-up
schema pg. 12 so I would like to drop these two from bindings in next
version set. let me know if you have any questions?

[-- Attachment #2: GT5663 Datasheet_English_20151106_Rev.01(华信科).pdf --]
[-- Type: application/pdf, Size: 1638772 bytes --]

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

end of thread, other threads:[~2019-02-18 19:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-17  9:14 [PATCH v5 0/4] input: touchscreen: Add goodix GT5553 CTP support Jagan Teki
2019-02-17  9:14 ` [PATCH v5 1/4] dt-bindings: input: touchscreen: goodix: Document regulator properties Jagan Teki
2019-02-18 15:45   ` Rob Herring
2019-02-18 19:04     ` Jagan Teki
2019-02-17  9:14 ` [PATCH v5 2/4] Input: goodix - Add regulators support Jagan Teki
2019-02-17  9:14 ` [PATCH v5 3/4] dt-bindings: input: touchscreen: goodix: Add GT5663 compatible Jagan Teki
2019-02-18 15:45   ` Rob Herring
2019-02-18 15:45     ` Rob Herring
2019-02-17  9:14 ` [PATCH v5 4/4] Input: goodix - Add GT5663 CTP support Jagan Teki

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.