diff mbox

[2/4] Input: zforce - swap reset and interrupt GPIO

Message ID 1437396997-3182-3-git-send-email-dirk.behme@de.bosch.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dirk Behme July 20, 2015, 12:56 p.m. UTC
From: Dirk Behme <dirk.behme@gmail.com>

Swap the order of the reset and interrupt GPIO. This is the preparation
to make the interrupt GPIO optional.

Note that this needs the same change in the device tree. But as mainline
doesn't contain any zforce device tree entries, nothing has to be done
for us, here.

All non-mainline device trees have to be adapted, though.

Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
---
 .../bindings/input/touchscreen/zforce_ts.txt         |  4 ++--
 drivers/input/touchscreen/zforce_ts.c                | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)

Comments

Dmitry Torokhov July 24, 2015, 9:32 p.m. UTC | #1
On Mon, Jul 20, 2015 at 02:56:35PM +0200, Dirk Behme wrote:
> From: Dirk Behme <dirk.behme@gmail.com>
> 
> Swap the order of the reset and interrupt GPIO. This is the preparation
> to make the interrupt GPIO optional.
> 
> Note that this needs the same change in the device tree. But as mainline
> doesn't contain any zforce device tree entries, nothing has to be done
> for us, here.
> 
> All non-mainline device trees have to be adapted, though.

No, we can not do that. We will have to switch to using named gpios
(probably call then attn-gpio and reset-gpio respectively and
handle old-style DTSes with unnamed 2-entry gpios list).

Thanks.

> 
> Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
> ---
>  .../bindings/input/touchscreen/zforce_ts.txt         |  4 ++--
>  drivers/input/touchscreen/zforce_ts.c                | 20 ++++++++++----------
>  2 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
> index 80c37df..a19b508 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
> +++ b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
> @@ -23,8 +23,8 @@ Example:
>  			interrupts = <2 0>;
>  			vdd-supply = <&reg_zforce_vdd>;
>  
> -			gpios = <&gpio5 6 0>, /* INT */
> -				<&gpio5 9 0>; /* RST */
> +			gpios = <&gpio5 9 0>, /* RST */
> +				<&gpio5 6 0>; /* INT */
>  
>  			x-size = <800>;
>  			y-size = <600>;
> diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
> index edf01c3..ac7b661 100644
> --- a/drivers/input/touchscreen/zforce_ts.c
> +++ b/drivers/input/touchscreen/zforce_ts.c
> @@ -754,17 +754,8 @@ static int zforce_probe(struct i2c_client *client,
>  	if (!ts)
>  		return -ENOMEM;
>  
> -	/* INT GPIO */
> -	ts->gpio_int = devm_gpiod_get_index(&client->dev, NULL, 0, GPIOD_IN);
> -	if (IS_ERR(ts->gpio_int)) {
> -		ret = PTR_ERR(ts->gpio_int);
> -		dev_err(&client->dev,
> -			"failed to request interrupt GPIO: %d\n", ret);
> -		return ret;
> -	}
> -
>  	/* RST GPIO */
> -	ts->gpio_rst = devm_gpiod_get_index(&client->dev, NULL, 1,
> +	ts->gpio_rst = devm_gpiod_get_index(&client->dev, NULL, 0,
>  					    GPIOD_OUT_HIGH);
>  	if (IS_ERR(ts->gpio_rst)) {
>  		ret = PTR_ERR(ts->gpio_rst);
> @@ -773,6 +764,15 @@ static int zforce_probe(struct i2c_client *client,
>  		return ret;
>  	}
>  
> +	/* INT GPIO */
> +	ts->gpio_int = devm_gpiod_get_index(&client->dev, NULL, 1, GPIOD_IN);
> +	if (IS_ERR(ts->gpio_int)) {
> +		ret = PTR_ERR(ts->gpio_int);
> +		dev_err(&client->dev,
> +			"failed to request interrupt GPIO: %d\n", ret);
> +		return ret;
> +	}
> +
>  	ts->reg_vdd = devm_regulator_get_optional(&client->dev, "vdd");
>  	if (IS_ERR(ts->reg_vdd)) {
>  		ret = PTR_ERR(ts->reg_vdd);
> -- 
> 2.3.4
>
Dirk Behme July 25, 2015, 5:19 a.m. UTC | #2
On 24.07.2015 23:32, Dmitry Torokhov wrote:
> On Mon, Jul 20, 2015 at 02:56:35PM +0200, Dirk Behme wrote:
>> From: Dirk Behme <dirk.behme@gmail.com>
>>
>> Swap the order of the reset and interrupt GPIO. This is the preparation
>> to make the interrupt GPIO optional.
>>
>> Note that this needs the same change in the device tree. But as mainline
>> doesn't contain any zforce device tree entries, nothing has to be done
>> for us, here.
>>
>> All non-mainline device trees have to be adapted, though.
>
> No, we can not do that.


The proposal to make the interrupt GPIO optional and not completely 
drop it came from you. Any other proposal how you like to get this 
implemented? With completely dropping the interrupt GPIO we would 
avoid this.


> We will have to switch to using named gpios
> (probably call then attn-gpio and reset-gpio respectively and
> handle old-style DTSes with unnamed 2-entry gpios list).


Just to understand correctly: You want the driver to support two GPIOs 
DT styles? One with unnamed 2-entry gpios list, where the interrupt 
GPIO can't be optional, and one with two named GPIOs, where the 
attn-gpio can be optional?

Btw, what does 'attn' stand for? I'd name it int-gpio.


Best regards

Dirk


>>
>> Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
>> ---
>>   .../bindings/input/touchscreen/zforce_ts.txt         |  4 ++--
>>   drivers/input/touchscreen/zforce_ts.c                | 20 ++++++++++----------
>>   2 files changed, 12 insertions(+), 12 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
>> index 80c37df..a19b508 100644
>> --- a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
>> +++ b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
>> @@ -23,8 +23,8 @@ Example:
>>   			interrupts = <2 0>;
>>   			vdd-supply = <&reg_zforce_vdd>;
>>
>> -			gpios = <&gpio5 6 0>, /* INT */
>> -				<&gpio5 9 0>; /* RST */
>> +			gpios = <&gpio5 9 0>, /* RST */
>> +				<&gpio5 6 0>; /* INT */
>>
>>   			x-size = <800>;
>>   			y-size = <600>;
>> diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
>> index edf01c3..ac7b661 100644
>> --- a/drivers/input/touchscreen/zforce_ts.c
>> +++ b/drivers/input/touchscreen/zforce_ts.c
>> @@ -754,17 +754,8 @@ static int zforce_probe(struct i2c_client *client,
>>   	if (!ts)
>>   		return -ENOMEM;
>>
>> -	/* INT GPIO */
>> -	ts->gpio_int = devm_gpiod_get_index(&client->dev, NULL, 0, GPIOD_IN);
>> -	if (IS_ERR(ts->gpio_int)) {
>> -		ret = PTR_ERR(ts->gpio_int);
>> -		dev_err(&client->dev,
>> -			"failed to request interrupt GPIO: %d\n", ret);
>> -		return ret;
>> -	}
>> -
>>   	/* RST GPIO */
>> -	ts->gpio_rst = devm_gpiod_get_index(&client->dev, NULL, 1,
>> +	ts->gpio_rst = devm_gpiod_get_index(&client->dev, NULL, 0,
>>   					    GPIOD_OUT_HIGH);
>>   	if (IS_ERR(ts->gpio_rst)) {
>>   		ret = PTR_ERR(ts->gpio_rst);
>> @@ -773,6 +764,15 @@ static int zforce_probe(struct i2c_client *client,
>>   		return ret;
>>   	}
>>
>> +	/* INT GPIO */
>> +	ts->gpio_int = devm_gpiod_get_index(&client->dev, NULL, 1, GPIOD_IN);
>> +	if (IS_ERR(ts->gpio_int)) {
>> +		ret = PTR_ERR(ts->gpio_int);
>> +		dev_err(&client->dev,
>> +			"failed to request interrupt GPIO: %d\n", ret);
>> +		return ret;
>> +	}
>> +
>>   	ts->reg_vdd = devm_regulator_get_optional(&client->dev, "vdd");
>>   	if (IS_ERR(ts->reg_vdd)) {
>>   		ret = PTR_ERR(ts->reg_vdd);
>> --
>> 2.3.4
>>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dmitry Torokhov July 27, 2015, 9:18 p.m. UTC | #3
On Sat, Jul 25, 2015 at 07:19:04AM +0200, Dirk Behme wrote:
> 
> Btw, what does 'attn' stand for?

"attention"

> I'd name it int-gpio.

Works as well.

Thanks.
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
index 80c37df..a19b508 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/zforce_ts.txt
@@ -23,8 +23,8 @@  Example:
 			interrupts = <2 0>;
 			vdd-supply = <&reg_zforce_vdd>;
 
-			gpios = <&gpio5 6 0>, /* INT */
-				<&gpio5 9 0>; /* RST */
+			gpios = <&gpio5 9 0>, /* RST */
+				<&gpio5 6 0>; /* INT */
 
 			x-size = <800>;
 			y-size = <600>;
diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
index edf01c3..ac7b661 100644
--- a/drivers/input/touchscreen/zforce_ts.c
+++ b/drivers/input/touchscreen/zforce_ts.c
@@ -754,17 +754,8 @@  static int zforce_probe(struct i2c_client *client,
 	if (!ts)
 		return -ENOMEM;
 
-	/* INT GPIO */
-	ts->gpio_int = devm_gpiod_get_index(&client->dev, NULL, 0, GPIOD_IN);
-	if (IS_ERR(ts->gpio_int)) {
-		ret = PTR_ERR(ts->gpio_int);
-		dev_err(&client->dev,
-			"failed to request interrupt GPIO: %d\n", ret);
-		return ret;
-	}
-
 	/* RST GPIO */
-	ts->gpio_rst = devm_gpiod_get_index(&client->dev, NULL, 1,
+	ts->gpio_rst = devm_gpiod_get_index(&client->dev, NULL, 0,
 					    GPIOD_OUT_HIGH);
 	if (IS_ERR(ts->gpio_rst)) {
 		ret = PTR_ERR(ts->gpio_rst);
@@ -773,6 +764,15 @@  static int zforce_probe(struct i2c_client *client,
 		return ret;
 	}
 
+	/* INT GPIO */
+	ts->gpio_int = devm_gpiod_get_index(&client->dev, NULL, 1, GPIOD_IN);
+	if (IS_ERR(ts->gpio_int)) {
+		ret = PTR_ERR(ts->gpio_int);
+		dev_err(&client->dev,
+			"failed to request interrupt GPIO: %d\n", ret);
+		return ret;
+	}
+
 	ts->reg_vdd = devm_regulator_get_optional(&client->dev, "vdd");
 	if (IS_ERR(ts->reg_vdd)) {
 		ret = PTR_ERR(ts->reg_vdd);