All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] input: touchscreen: Add goodix GT5553 CTP support
@ 2019-02-12 11:24 Jagan Teki
  2019-02-12 11:24 ` [PATCH v4 1/4] dt-bindings: input: touchscreen: goodix: Document AVDD28-supply property Jagan Teki
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Jagan Teki @ 2019-02-12 11:24 UTC (permalink / raw)
  To: Dmitry Torokhov, Bastien Nocera, Rob Herring
  Cc: Henrik Rydberg, linux-input, linux-kernel, devicetree,
	Mark Rutland, Jagan Teki

This patchset support goodix GT5553 CTP.

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

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

 .../bindings/input/touchscreen/goodix.txt     |  2 +
 drivers/input/touchscreen/goodix.c            | 46 +++++++++++++++++--
 2 files changed, 43 insertions(+), 5 deletions(-)

-- 
2.18.0.321.gffc6fa0e3


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

* [PATCH v4 1/4] dt-bindings: input: touchscreen: goodix: Document AVDD28-supply property
  2019-02-12 11:24 [PATCH v4 0/4] input: touchscreen: Add goodix GT5553 CTP support Jagan Teki
@ 2019-02-12 11:24 ` Jagan Teki
  2019-02-12 11:24 ` [PATCH v4 2/4] Input: goodix - Add AVDD28-supply regulator support Jagan Teki
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Jagan Teki @ 2019-02-12 11:24 UTC (permalink / raw)
  To: Dmitry Torokhov, Bastien Nocera, Rob Herring
  Cc: Henrik Rydberg, linux-input, linux-kernel, devicetree,
	Mark Rutland, Jagan Teki

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 require boards
that used on GT5663 can enable it via device tree.

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 f7e95c52f3c7..c4622c983e08 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
@@ -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:
 
-- 
2.18.0.321.gffc6fa0e3


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

* [PATCH v4 2/4] Input: goodix - Add AVDD28-supply regulator support
  2019-02-12 11:24 [PATCH v4 0/4] input: touchscreen: Add goodix GT5553 CTP support Jagan Teki
  2019-02-12 11:24 ` [PATCH v4 1/4] dt-bindings: input: touchscreen: goodix: Document AVDD28-supply property Jagan Teki
@ 2019-02-12 11:24 ` Jagan Teki
  2019-02-18  7:08   ` Dmitry Torokhov
  2019-02-12 11:24 ` [PATCH v4 3/4] dt-bindings: input: touchscreen: goodix: Add GT5663 compatible Jagan Teki
  2019-02-12 11:24 ` [PATCH v4 4/4] Input: goodix - Add GT5663 CTP support Jagan Teki
  3 siblings, 1 reply; 8+ messages in thread
From: Jagan Teki @ 2019-02-12 11:24 UTC (permalink / raw)
  To: Dmitry Torokhov, Bastien Nocera, Rob Herring
  Cc: Henrik Rydberg, linux-input, linux-kernel, devicetree,
	Mark Rutland, 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.

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

diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index f2d9c2c41885..e92b90be1ac2 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>
@@ -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;
@@ -761,6 +763,13 @@ 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_disable(ts->avdd28);
+}
+
 static int goodix_ts_probe(struct i2c_client *client,
 			   const struct i2c_device_id *id)
 {
@@ -786,25 +795,46 @@ 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;
+	}
+
+	error = devm_add_action_or_reset(&client->dev,
+					 goodix_disable_regulator, ts);
+	if (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 +853,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_disable(ts->avdd28);
+	return error;
 }
 
 static int goodix_ts_remove(struct i2c_client *client)
-- 
2.18.0.321.gffc6fa0e3


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

* [PATCH v4 3/4] dt-bindings: input: touchscreen: goodix: Add GT5663 compatible
  2019-02-12 11:24 [PATCH v4 0/4] input: touchscreen: Add goodix GT5553 CTP support Jagan Teki
  2019-02-12 11:24 ` [PATCH v4 1/4] dt-bindings: input: touchscreen: goodix: Document AVDD28-supply property Jagan Teki
  2019-02-12 11:24 ` [PATCH v4 2/4] Input: goodix - Add AVDD28-supply regulator support Jagan Teki
@ 2019-02-12 11:24 ` Jagan Teki
  2019-02-13 21:52     ` Rob Herring
  2019-02-12 11:24 ` [PATCH v4 4/4] Input: goodix - Add GT5663 CTP support Jagan Teki
  3 siblings, 1 reply; 8+ messages in thread
From: Jagan Teki @ 2019-02-12 11:24 UTC (permalink / raw)
  To: Dmitry Torokhov, Bastien Nocera, Rob Herring
  Cc: Henrik Rydberg, linux-input, linux-kernel, devicetree,
	Mark Rutland, 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 c4622c983e08..59c89276e6bb 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] 8+ messages in thread

* [PATCH v4 4/4] Input: goodix - Add GT5663 CTP support
  2019-02-12 11:24 [PATCH v4 0/4] input: touchscreen: Add goodix GT5553 CTP support Jagan Teki
                   ` (2 preceding siblings ...)
  2019-02-12 11:24 ` [PATCH v4 3/4] dt-bindings: input: touchscreen: goodix: Add GT5663 compatible Jagan Teki
@ 2019-02-12 11:24 ` Jagan Teki
  3 siblings, 0 replies; 8+ messages in thread
From: Jagan Teki @ 2019-02-12 11:24 UTC (permalink / raw)
  To: Dmitry Torokhov, Bastien Nocera, Rob Herring
  Cc: Henrik Rydberg, linux-input, linux-kernel, devicetree,
	Mark Rutland, 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 e92b90be1ac2..9a676dec79c6 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -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:
@@ -976,6 +977,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] 8+ messages in thread

* Re: [PATCH v4 3/4] dt-bindings: input: touchscreen: goodix: Add GT5663 compatible
  2019-02-12 11:24 ` [PATCH v4 3/4] dt-bindings: input: touchscreen: goodix: Add GT5663 compatible Jagan Teki
@ 2019-02-13 21:52     ` Rob Herring
  0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2019-02-13 21:52 UTC (permalink / raw)
  To: Jagan Teki
  Cc: Dmitry Torokhov, Bastien Nocera, Henrik Rydberg, linux-input,
	linux-kernel, devicetree, Mark Rutland, Jagan Teki

On Tue, 12 Feb 2019 16:54:38 +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] 8+ messages in thread

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

On Tue, 12 Feb 2019 16:54:38 +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] 8+ messages in thread

* Re: [PATCH v4 2/4] Input: goodix - Add AVDD28-supply regulator support
  2019-02-12 11:24 ` [PATCH v4 2/4] Input: goodix - Add AVDD28-supply regulator support Jagan Teki
@ 2019-02-18  7:08   ` Dmitry Torokhov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Torokhov @ 2019-02-18  7:08 UTC (permalink / raw)
  To: Jagan Teki
  Cc: Bastien Nocera, Rob Herring, Henrik Rydberg, linux-input,
	linux-kernel, devicetree, Mark Rutland

Hi Jagan,

On Tue, Feb 12, 2019 at 04:54:37PM +0530, Jagan Teki wrote:
> 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.
> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  drivers/input/touchscreen/goodix.c | 44 ++++++++++++++++++++++++++----
>  1 file changed, 39 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
> index f2d9c2c41885..e92b90be1ac2 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>
> @@ -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;
> @@ -761,6 +763,13 @@ 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_disable(ts->avdd28);
> +}
> +
>  static int goodix_ts_probe(struct i2c_client *client,
>  			   const struct i2c_device_id *id)
>  {
> @@ -786,25 +795,46 @@ 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;
> +	}
> +
> +	error = devm_add_action_or_reset(&client->dev,
> +					 goodix_disable_regulator, ts);
> +	if (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;

Why are you changing this? You added goodix_disable_regulator() as
custom devm action, so it will fire if probe() returns with error.

Thanks.

-- 
Dmitry

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-12 11:24 [PATCH v4 0/4] input: touchscreen: Add goodix GT5553 CTP support Jagan Teki
2019-02-12 11:24 ` [PATCH v4 1/4] dt-bindings: input: touchscreen: goodix: Document AVDD28-supply property Jagan Teki
2019-02-12 11:24 ` [PATCH v4 2/4] Input: goodix - Add AVDD28-supply regulator support Jagan Teki
2019-02-18  7:08   ` Dmitry Torokhov
2019-02-12 11:24 ` [PATCH v4 3/4] dt-bindings: input: touchscreen: goodix: Add GT5663 compatible Jagan Teki
2019-02-13 21:52   ` Rob Herring
2019-02-13 21:52     ` Rob Herring
2019-02-12 11:24 ` [PATCH v4 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.