linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dt-bindings: input: sitronix-st1232: document optional reset-gpios property
@ 2019-01-29 10:23 Martin Kepplinger
  2019-01-29 10:23 ` [PATCH 2/2] Input: st1232 - switch to gpiod API Martin Kepplinger
  2019-02-25 14:43 ` [PATCH 1/2] dt-bindings: input: sitronix-st1232: document optional reset-gpios property Rob Herring
  0 siblings, 2 replies; 6+ messages in thread
From: Martin Kepplinger @ 2019-01-29 10:23 UTC (permalink / raw)
  To: devicetree, linux-input
  Cc: dmitry.torokhov, robh+dt, mark.rutland, linux-kernel, Martin Kepplinger

From: Martin Kepplinger <martin.kepplinger@ginzinger.com>

The st1232 driver reads this via gpiod.

Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
---
 .../devicetree/bindings/input/touchscreen/sitronix-st1232.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/input/touchscreen/sitronix-st1232.txt b/Documentation/devicetree/bindings/input/touchscreen/sitronix-st1232.txt
index e73e826e0f2a..365b32d30d4b 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/sitronix-st1232.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/sitronix-st1232.txt
@@ -8,7 +8,7 @@ Required properties:
 - interrupts: interrupt to which the chip is connected
 
 Optional properties:
-- gpios: a phandle to the reset GPIO
+- reset-gpios: a phandle to the reset GPIO
 
 Example:
 
@@ -19,7 +19,7 @@ Example:
 			compatible = "sitronix,st1232";
 			reg = <0x55>;
 			interrupts = <2 0>;
-			gpios = <&gpio1 166 0>;
+			reset-gpios = <&gpio1 166 0>;
 		};
 
 		/* ... */
-- 
2.20.1


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

* [PATCH 2/2] Input: st1232 - switch to gpiod API
  2019-01-29 10:23 [PATCH 1/2] dt-bindings: input: sitronix-st1232: document optional reset-gpios property Martin Kepplinger
@ 2019-01-29 10:23 ` Martin Kepplinger
  2019-02-05 10:20   ` Martin Kepplinger
  2019-02-25 14:43 ` [PATCH 1/2] dt-bindings: input: sitronix-st1232: document optional reset-gpios property Rob Herring
  1 sibling, 1 reply; 6+ messages in thread
From: Martin Kepplinger @ 2019-01-29 10:23 UTC (permalink / raw)
  To: devicetree, linux-input
  Cc: dmitry.torokhov, robh+dt, mark.rutland, linux-kernel, Martin Kepplinger

From: Martin Kepplinger <martin.kepplinger@ginzinger.com>

Use devm_gpiod_get_optional() and gpiod_set_value_cansleep() instead
of the old API. The st1232_ts_power() now passes on the inverted "poweron"
value to reflect the correct logical value.

Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
---

Tested and works. thanks for your help Dmitry,

                          martin



 drivers/input/touchscreen/st1232.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c
index 777df903605d..04d75b08be44 100644
--- a/drivers/input/touchscreen/st1232.c
+++ b/drivers/input/touchscreen/st1232.c
@@ -45,7 +45,7 @@ struct st1232_ts_data {
 	struct i2c_client *client;
 	struct input_dev *input_dev;
 	struct dev_pm_qos_request low_latency_req;
-	int reset_gpio;
+	struct gpio_desc *reset_gpio;
 	const struct st_chip_info *chip_info;
 	int read_buf_len;
 	u8 *read_buf;
@@ -142,8 +142,8 @@ static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id)
 
 static void st1232_ts_power(struct st1232_ts_data *ts, bool poweron)
 {
-	if (gpio_is_valid(ts->reset_gpio))
-		gpio_direction_output(ts->reset_gpio, poweron);
+	if (ts->reset_gpio)
+		gpiod_set_value_cansleep(ts->reset_gpio, !poweron);
 }
 
 static const struct st_chip_info st1232_chip_info = {
@@ -215,15 +215,13 @@ static int st1232_ts_probe(struct i2c_client *client,
 	ts->client = client;
 	ts->input_dev = input_dev;
 
-	ts->reset_gpio = of_get_gpio(client->dev.of_node, 0);
-	if (gpio_is_valid(ts->reset_gpio)) {
-		error = devm_gpio_request(&client->dev, ts->reset_gpio, NULL);
-		if (error) {
-			dev_err(&client->dev,
-				"Unable to request GPIO pin %d.\n",
-				ts->reset_gpio);
-				return error;
-		}
+	ts->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset",
+						 GPIOD_OUT_HIGH);
+	if (IS_ERR(ts->reset_gpio)) {
+		error = PTR_ERR(ts->reset_gpio);
+		dev_err(&client->dev, "Unable to request GPIO pin: %d.\n",
+			error);
+		return error;
 	}
 
 	st1232_ts_power(ts, true);
-- 
2.20.1


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

* Re: [PATCH 2/2] Input: st1232 - switch to gpiod API
  2019-01-29 10:23 ` [PATCH 2/2] Input: st1232 - switch to gpiod API Martin Kepplinger
@ 2019-02-05 10:20   ` Martin Kepplinger
  2019-02-08  8:05     ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Kepplinger @ 2019-02-05 10:20 UTC (permalink / raw)
  To: Martin Kepplinger, devicetree, linux-input
  Cc: dmitry.torokhov, robh+dt, mark.rutland, linux-kernel

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



Martin Kepplinger | Entwicklung Software 

GINZINGER ELECTRONIC SYSTEMS GMBH

Tel.: +43 7723 5422 157
Mail: martin.kepplinger@ginzinger.com
Web: www.ginzinger.com




On 29.01.19 11:23, Martin Kepplinger wrote:
> From: Martin Kepplinger <martin.kepplinger@ginzinger.com>
> 
> Use devm_gpiod_get_optional() and gpiod_set_value_cansleep() instead
> of the old API. The st1232_ts_power() now passes on the inverted "poweron"
> value to reflect the correct logical value.
> 
> Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
> ---
> 
> Tested and works. thanks for your help Dmitry,
> 

is this what you had in mind? any problems or questions?

thanks
                              martin


> 
> 
> 
>   drivers/input/touchscreen/st1232.c | 22 ++++++++++------------
>   1 file changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c
> index 777df903605d..04d75b08be44 100644
> --- a/drivers/input/touchscreen/st1232.c
> +++ b/drivers/input/touchscreen/st1232.c
> @@ -45,7 +45,7 @@ struct st1232_ts_data {
>   	struct i2c_client *client;
>   	struct input_dev *input_dev;
>   	struct dev_pm_qos_request low_latency_req;
> -	int reset_gpio;
> +	struct gpio_desc *reset_gpio;
>   	const struct st_chip_info *chip_info;
>   	int read_buf_len;
>   	u8 *read_buf;
> @@ -142,8 +142,8 @@ static irqreturn_t st1232_ts_irq_handler(int irq, void *dev_id)
>   
>   static void st1232_ts_power(struct st1232_ts_data *ts, bool poweron)
>   {
> -	if (gpio_is_valid(ts->reset_gpio))
> -		gpio_direction_output(ts->reset_gpio, poweron);
> +	if (ts->reset_gpio)
> +		gpiod_set_value_cansleep(ts->reset_gpio, !poweron);
>   }
>   
>   static const struct st_chip_info st1232_chip_info = {
> @@ -215,15 +215,13 @@ static int st1232_ts_probe(struct i2c_client *client,
>   	ts->client = client;
>   	ts->input_dev = input_dev;
>   
> -	ts->reset_gpio = of_get_gpio(client->dev.of_node, 0);
> -	if (gpio_is_valid(ts->reset_gpio)) {
> -		error = devm_gpio_request(&client->dev, ts->reset_gpio, NULL);
> -		if (error) {
> -			dev_err(&client->dev,
> -				"Unable to request GPIO pin %d.\n",
> -				ts->reset_gpio);
> -				return error;
> -		}
> +	ts->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset",
> +						 GPIOD_OUT_HIGH);
> +	if (IS_ERR(ts->reset_gpio)) {
> +		error = PTR_ERR(ts->reset_gpio);
> +		dev_err(&client->dev, "Unable to request GPIO pin: %d.\n",
> +			error);
> +		return error;
>   	}
>   
>   	st1232_ts_power(ts, true);
> 




________________________________________

Ginzinger electronic systems GmbH
Gewerbegebiet Pirath 16
4952 Weng im Innkreis
www.ginzinger.com

Firmenbuchnummer: FN 364958d
Firmenbuchgericht: Ried im Innkreis
UID-Nr.: ATU66521089


Diese Nachricht ist vertraulich und darf nicht an andere Personen weitergegeben oder von diesen verwendet werden. Verständigen Sie uns, wenn Sie irrtümlich eine Mitteilung empfangen haben.

This message is confidential. It may not be disclosed to, or used by, anyone other than the addressee. If you receive this message by mistake, please advise the sender.

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3616 bytes --]

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

* Re: [PATCH 2/2] Input: st1232 - switch to gpiod API
  2019-02-05 10:20   ` Martin Kepplinger
@ 2019-02-08  8:05     ` Dmitry Torokhov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2019-02-08  8:05 UTC (permalink / raw)
  To: Martin Kepplinger
  Cc: Martin Kepplinger, devicetree, linux-input, robh+dt,
	mark.rutland, linux-kernel

Hi Martin,

On Tue, Feb 05, 2019 at 11:20:16AM +0100, Martin Kepplinger wrote:
> On 29.01.19 11:23, Martin Kepplinger wrote:
> > From: Martin Kepplinger <martin.kepplinger@ginzinger.com>
> > 
> > Use devm_gpiod_get_optional() and gpiod_set_value_cansleep() instead
> > of the old API. The st1232_ts_power() now passes on the inverted "poweron"
> > value to reflect the correct logical value.
> > 
> > Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
> > ---
> > 
> > Tested and works. thanks for your help Dmitry,
> > 
> 
> is this what you had in mind? any problems or questions?

Yes, that is what I wanted, with one exception:

> > +	ts->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset",
> > +						 GPIOD_OUT_HIGH);

This breaks compatibility with old DTSes, please try changing to:

	devm_gpiod_get_optional(&client->dev, NULL, GPIOD_OUT_HIGH);

Thanks.

-- 
Dmitry

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

* Re: [PATCH 1/2] dt-bindings: input: sitronix-st1232: document optional reset-gpios property
  2019-01-29 10:23 [PATCH 1/2] dt-bindings: input: sitronix-st1232: document optional reset-gpios property Martin Kepplinger
  2019-01-29 10:23 ` [PATCH 2/2] Input: st1232 - switch to gpiod API Martin Kepplinger
@ 2019-02-25 14:43 ` Rob Herring
  2019-02-26  6:18   ` Martin Kepplinger
  1 sibling, 1 reply; 6+ messages in thread
From: Rob Herring @ 2019-02-25 14:43 UTC (permalink / raw)
  To: Martin Kepplinger
  Cc: devicetree, linux-input, dmitry.torokhov, mark.rutland,
	linux-kernel, Martin Kepplinger

On Tue, Jan 29, 2019 at 11:23:46AM +0100, Martin Kepplinger wrote:
> From: Martin Kepplinger <martin.kepplinger@ginzinger.com>
> 
> The st1232 driver reads this via gpiod.

What a driver does is not relevant to the binding. This breaks 
compatibility so you need to mention that and why this is okay.

Either you need to keep 'gpios' as deprecated or you can drop it if 
there aren't any dts files using it.

> 
> Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
> ---
>  .../devicetree/bindings/input/touchscreen/sitronix-st1232.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/sitronix-st1232.txt b/Documentation/devicetree/bindings/input/touchscreen/sitronix-st1232.txt
> index e73e826e0f2a..365b32d30d4b 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/sitronix-st1232.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/sitronix-st1232.txt
> @@ -8,7 +8,7 @@ Required properties:
>  - interrupts: interrupt to which the chip is connected
>  
>  Optional properties:
> -- gpios: a phandle to the reset GPIO
> +- reset-gpios: a phandle to the reset GPIO
>  
>  Example:
>  
> @@ -19,7 +19,7 @@ Example:
>  			compatible = "sitronix,st1232";
>  			reg = <0x55>;
>  			interrupts = <2 0>;
> -			gpios = <&gpio1 166 0>;
> +			reset-gpios = <&gpio1 166 0>;
>  		};
>  
>  		/* ... */
> -- 
> 2.20.1
> 

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

* Re: [PATCH 1/2] dt-bindings: input: sitronix-st1232: document optional reset-gpios property
  2019-02-25 14:43 ` [PATCH 1/2] dt-bindings: input: sitronix-st1232: document optional reset-gpios property Rob Herring
@ 2019-02-26  6:18   ` Martin Kepplinger
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Kepplinger @ 2019-02-26  6:18 UTC (permalink / raw)
  To: Rob Herring, Martin Kepplinger, dmitry.torokhov
  Cc: devicetree, linux-input, mark.rutland, linux-kernel

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

On 25.02.19 15:43, Rob Herring wrote:
> On Tue, Jan 29, 2019 at 11:23:46AM +0100, Martin Kepplinger wrote:
>> From: Martin Kepplinger <martin.kepplinger@ginzinger.com>
>>
>> The st1232 driver reads this via gpiod.
> 
> What a driver does is not relevant to the binding. This breaks 
> compatibility so you need to mention that and why this is okay.
> 
> Either you need to keep 'gpios' as deprecated or you can drop it if 
> there aren't any dts files using it.
> 

Hi Rob,

The patch is outdated. Dmity took the driver-changes without breaking
the current DT bindings.

                                   martin

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3616 bytes --]

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 10:23 [PATCH 1/2] dt-bindings: input: sitronix-st1232: document optional reset-gpios property Martin Kepplinger
2019-01-29 10:23 ` [PATCH 2/2] Input: st1232 - switch to gpiod API Martin Kepplinger
2019-02-05 10:20   ` Martin Kepplinger
2019-02-08  8:05     ` Dmitry Torokhov
2019-02-25 14:43 ` [PATCH 1/2] dt-bindings: input: sitronix-st1232: document optional reset-gpios property Rob Herring
2019-02-26  6:18   ` Martin Kepplinger

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