All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: c8sectpfe: convert to gpio descriptors
@ 2023-01-30 13:09 ` Arnd Bergmann
  0 siblings, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2023-01-30 13:09 UTC (permalink / raw)
  To: Patrice Chotard, Mauro Carvalho Chehab
  Cc: Arnd Bergmann, Andy Shevchenko, Hans Verkuil, Hugues Fruchet,
	linux-arm-kernel, linux-media, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The gpio usage in the function is fairly straightforward,
but the normal gpiod_get() interface cannot be used here
since the gpio is referenced by a child node of the device.

Using devm_fwnode_gpiod_get_index() is the best alternative
here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 .../st/sti/c8sectpfe/c8sectpfe-core.c         | 30 ++++++++-----------
 .../st/sti/c8sectpfe/c8sectpfe-core.h         |  2 +-
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
index c38b62d4f1ae..86a2c77c5471 100644
--- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
+++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
@@ -22,7 +22,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
-#include <linux/of_gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/of_platform.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pinctrl/pinctrl.h>
@@ -812,30 +812,24 @@ static int c8sectpfe_probe(struct platform_device *pdev)
 		}
 		of_node_put(i2c_bus);
 
-		tsin->rst_gpio = of_get_named_gpio(child, "reset-gpios", 0);
-
-		ret = gpio_is_valid(tsin->rst_gpio);
-		if (!ret) {
-			dev_err(dev,
-				"reset gpio for tsin%d not valid (gpio=%d)\n",
-				tsin->tsin_id, tsin->rst_gpio);
-			ret = -EINVAL;
-			goto err_node_put;
-		}
-
-		ret = devm_gpio_request_one(dev, tsin->rst_gpio,
-					GPIOF_OUT_INIT_LOW, "NIM reset");
+		tsin->rst_gpio = devm_fwnode_gpiod_get_index(dev,
+							     of_node_to_fwnode(child),
+							     "reset-gpios",
+							     0, GPIOD_OUT_LOW,
+							     "NIM reset");
+		ret = PTR_ERR_OR_ZERO(tsin->rst_gpio);
 		if (ret && ret != -EBUSY) {
-			dev_err(dev, "Can't request tsin%d reset gpio\n"
-				, fei->channel_data[index]->tsin_id);
+			dev_err_probe(dev, ret,
+				      "reset gpio for tsin%d not valid\n",
+				      tsin->tsin_id);
 			goto err_node_put;
 		}
 
 		if (!ret) {
 			/* toggle reset lines */
-			gpio_direction_output(tsin->rst_gpio, 0);
+			gpiod_direction_output(tsin->rst_gpio, 0);
 			usleep_range(3500, 5000);
-			gpio_direction_output(tsin->rst_gpio, 1);
+			gpiod_direction_output(tsin->rst_gpio, 1);
 			usleep_range(3000, 5000);
 		}
 
diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h
index c9d6021904cd..f2a6991e064e 100644
--- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h
+++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h
@@ -25,7 +25,7 @@ struct channel_info {
 	int i2c;
 	int dvb_card;
 
-	int rst_gpio;
+	struct gpio_desc *rst_gpio;
 
 	struct i2c_adapter  *i2c_adapter;
 	struct i2c_adapter  *tuner_i2c;
-- 
2.39.0


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

* [PATCH] media: c8sectpfe: convert to gpio descriptors
@ 2023-01-30 13:09 ` Arnd Bergmann
  0 siblings, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2023-01-30 13:09 UTC (permalink / raw)
  To: Patrice Chotard, Mauro Carvalho Chehab
  Cc: Arnd Bergmann, Andy Shevchenko, Hans Verkuil, Hugues Fruchet,
	linux-arm-kernel, linux-media, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The gpio usage in the function is fairly straightforward,
but the normal gpiod_get() interface cannot be used here
since the gpio is referenced by a child node of the device.

Using devm_fwnode_gpiod_get_index() is the best alternative
here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 .../st/sti/c8sectpfe/c8sectpfe-core.c         | 30 ++++++++-----------
 .../st/sti/c8sectpfe/c8sectpfe-core.h         |  2 +-
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
index c38b62d4f1ae..86a2c77c5471 100644
--- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
+++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
@@ -22,7 +22,7 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
-#include <linux/of_gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/of_platform.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pinctrl/pinctrl.h>
@@ -812,30 +812,24 @@ static int c8sectpfe_probe(struct platform_device *pdev)
 		}
 		of_node_put(i2c_bus);
 
-		tsin->rst_gpio = of_get_named_gpio(child, "reset-gpios", 0);
-
-		ret = gpio_is_valid(tsin->rst_gpio);
-		if (!ret) {
-			dev_err(dev,
-				"reset gpio for tsin%d not valid (gpio=%d)\n",
-				tsin->tsin_id, tsin->rst_gpio);
-			ret = -EINVAL;
-			goto err_node_put;
-		}
-
-		ret = devm_gpio_request_one(dev, tsin->rst_gpio,
-					GPIOF_OUT_INIT_LOW, "NIM reset");
+		tsin->rst_gpio = devm_fwnode_gpiod_get_index(dev,
+							     of_node_to_fwnode(child),
+							     "reset-gpios",
+							     0, GPIOD_OUT_LOW,
+							     "NIM reset");
+		ret = PTR_ERR_OR_ZERO(tsin->rst_gpio);
 		if (ret && ret != -EBUSY) {
-			dev_err(dev, "Can't request tsin%d reset gpio\n"
-				, fei->channel_data[index]->tsin_id);
+			dev_err_probe(dev, ret,
+				      "reset gpio for tsin%d not valid\n",
+				      tsin->tsin_id);
 			goto err_node_put;
 		}
 
 		if (!ret) {
 			/* toggle reset lines */
-			gpio_direction_output(tsin->rst_gpio, 0);
+			gpiod_direction_output(tsin->rst_gpio, 0);
 			usleep_range(3500, 5000);
-			gpio_direction_output(tsin->rst_gpio, 1);
+			gpiod_direction_output(tsin->rst_gpio, 1);
 			usleep_range(3000, 5000);
 		}
 
diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h
index c9d6021904cd..f2a6991e064e 100644
--- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h
+++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h
@@ -25,7 +25,7 @@ struct channel_info {
 	int i2c;
 	int dvb_card;
 
-	int rst_gpio;
+	struct gpio_desc *rst_gpio;
 
 	struct i2c_adapter  *i2c_adapter;
 	struct i2c_adapter  *tuner_i2c;
-- 
2.39.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
  2023-01-30 13:09 ` Arnd Bergmann
@ 2023-01-30 17:18   ` Andy Shevchenko
  -1 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2023-01-30 17:18 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Patrice Chotard, Mauro Carvalho Chehab, Arnd Bergmann,
	Hans Verkuil, Hugues Fruchet, linux-arm-kernel, linux-media,
	linux-kernel

On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The gpio usage in the function is fairly straightforward,
> but the normal gpiod_get() interface cannot be used here
> since the gpio is referenced by a child node of the device.
> 
> Using devm_fwnode_gpiod_get_index() is the best alternative
> here.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

One topic to discuss below (but I'm fine with this version).

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  .../st/sti/c8sectpfe/c8sectpfe-core.c         | 30 ++++++++-----------
>  .../st/sti/c8sectpfe/c8sectpfe-core.h         |  2 +-
>  2 files changed, 13 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
> index c38b62d4f1ae..86a2c77c5471 100644
> --- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
> +++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
> @@ -22,7 +22,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
>  #include <linux/module.h>
> -#include <linux/of_gpio.h>
> +#include <linux/gpio/consumer.h>
>  #include <linux/of_platform.h>
>  #include <linux/pinctrl/consumer.h>
>  #include <linux/pinctrl/pinctrl.h>
> @@ -812,30 +812,24 @@ static int c8sectpfe_probe(struct platform_device *pdev)
>  		}
>  		of_node_put(i2c_bus);
>  
> -		tsin->rst_gpio = of_get_named_gpio(child, "reset-gpios", 0);
> -
> -		ret = gpio_is_valid(tsin->rst_gpio);
> -		if (!ret) {
> -			dev_err(dev,
> -				"reset gpio for tsin%d not valid (gpio=%d)\n",
> -				tsin->tsin_id, tsin->rst_gpio);
> -			ret = -EINVAL;
> -			goto err_node_put;
> -		}
> -
> -		ret = devm_gpio_request_one(dev, tsin->rst_gpio,
> -					GPIOF_OUT_INIT_LOW, "NIM reset");
> +		tsin->rst_gpio = devm_fwnode_gpiod_get_index(dev,
> +							     of_node_to_fwnode(child),
> +							     "reset-gpios",
> +							     0, GPIOD_OUT_LOW,
> +							     "NIM reset");

> +		ret = PTR_ERR_OR_ZERO(tsin->rst_gpio);
>  		if (ret && ret != -EBUSY) {
> -			dev_err(dev, "Can't request tsin%d reset gpio\n"
> -				, fei->channel_data[index]->tsin_id);
> +			dev_err_probe(dev, ret,
> +				      "reset gpio for tsin%d not valid\n",
> +				      tsin->tsin_id);
>  			goto err_node_put;
>  		}
>  
>  		if (!ret) {

Can be 

	if (IS_ERR() && PTR_ERR() != -EBUSY) {
		ret = dev_err_probe(dev, PTR_ERR(), ...);
		...
	}

	if (!IS_ERR())

(Up to you)

But -EBUSY check seems strange to me. What was the motivation behind?
(As far as I can read the code the possibility to get this if and only
 if we have requested GPIO too early at initcall level. Would it be
 ever a possibility to get it in real life?)

>  			/* toggle reset lines */
> -			gpio_direction_output(tsin->rst_gpio, 0);
> +			gpiod_direction_output(tsin->rst_gpio, 0);
>  			usleep_range(3500, 5000);
> -			gpio_direction_output(tsin->rst_gpio, 1);
> +			gpiod_direction_output(tsin->rst_gpio, 1);
>  			usleep_range(3000, 5000);
>  		}
>  
> diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h
> index c9d6021904cd..f2a6991e064e 100644
> --- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h
> +++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h
> @@ -25,7 +25,7 @@ struct channel_info {
>  	int i2c;
>  	int dvb_card;
>  
> -	int rst_gpio;
> +	struct gpio_desc *rst_gpio;
>  
>  	struct i2c_adapter  *i2c_adapter;
>  	struct i2c_adapter  *tuner_i2c;
> -- 
> 2.39.0
> 

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
@ 2023-01-30 17:18   ` Andy Shevchenko
  0 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2023-01-30 17:18 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Patrice Chotard, Mauro Carvalho Chehab, Arnd Bergmann,
	Hans Verkuil, Hugues Fruchet, linux-arm-kernel, linux-media,
	linux-kernel

On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The gpio usage in the function is fairly straightforward,
> but the normal gpiod_get() interface cannot be used here
> since the gpio is referenced by a child node of the device.
> 
> Using devm_fwnode_gpiod_get_index() is the best alternative
> here.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

One topic to discuss below (but I'm fine with this version).

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  .../st/sti/c8sectpfe/c8sectpfe-core.c         | 30 ++++++++-----------
>  .../st/sti/c8sectpfe/c8sectpfe-core.h         |  2 +-
>  2 files changed, 13 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
> index c38b62d4f1ae..86a2c77c5471 100644
> --- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
> +++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
> @@ -22,7 +22,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
>  #include <linux/module.h>
> -#include <linux/of_gpio.h>
> +#include <linux/gpio/consumer.h>
>  #include <linux/of_platform.h>
>  #include <linux/pinctrl/consumer.h>
>  #include <linux/pinctrl/pinctrl.h>
> @@ -812,30 +812,24 @@ static int c8sectpfe_probe(struct platform_device *pdev)
>  		}
>  		of_node_put(i2c_bus);
>  
> -		tsin->rst_gpio = of_get_named_gpio(child, "reset-gpios", 0);
> -
> -		ret = gpio_is_valid(tsin->rst_gpio);
> -		if (!ret) {
> -			dev_err(dev,
> -				"reset gpio for tsin%d not valid (gpio=%d)\n",
> -				tsin->tsin_id, tsin->rst_gpio);
> -			ret = -EINVAL;
> -			goto err_node_put;
> -		}
> -
> -		ret = devm_gpio_request_one(dev, tsin->rst_gpio,
> -					GPIOF_OUT_INIT_LOW, "NIM reset");
> +		tsin->rst_gpio = devm_fwnode_gpiod_get_index(dev,
> +							     of_node_to_fwnode(child),
> +							     "reset-gpios",
> +							     0, GPIOD_OUT_LOW,
> +							     "NIM reset");

> +		ret = PTR_ERR_OR_ZERO(tsin->rst_gpio);
>  		if (ret && ret != -EBUSY) {
> -			dev_err(dev, "Can't request tsin%d reset gpio\n"
> -				, fei->channel_data[index]->tsin_id);
> +			dev_err_probe(dev, ret,
> +				      "reset gpio for tsin%d not valid\n",
> +				      tsin->tsin_id);
>  			goto err_node_put;
>  		}
>  
>  		if (!ret) {

Can be 

	if (IS_ERR() && PTR_ERR() != -EBUSY) {
		ret = dev_err_probe(dev, PTR_ERR(), ...);
		...
	}

	if (!IS_ERR())

(Up to you)

But -EBUSY check seems strange to me. What was the motivation behind?
(As far as I can read the code the possibility to get this if and only
 if we have requested GPIO too early at initcall level. Would it be
 ever a possibility to get it in real life?)

>  			/* toggle reset lines */
> -			gpio_direction_output(tsin->rst_gpio, 0);
> +			gpiod_direction_output(tsin->rst_gpio, 0);
>  			usleep_range(3500, 5000);
> -			gpio_direction_output(tsin->rst_gpio, 1);
> +			gpiod_direction_output(tsin->rst_gpio, 1);
>  			usleep_range(3000, 5000);
>  		}
>  
> diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h
> index c9d6021904cd..f2a6991e064e 100644
> --- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h
> +++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.h
> @@ -25,7 +25,7 @@ struct channel_info {
>  	int i2c;
>  	int dvb_card;
>  
> -	int rst_gpio;
> +	struct gpio_desc *rst_gpio;
>  
>  	struct i2c_adapter  *i2c_adapter;
>  	struct i2c_adapter  *tuner_i2c;
> -- 
> 2.39.0
> 

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
  2023-01-30 17:18   ` Andy Shevchenko
@ 2023-01-30 18:17     ` Arnd Bergmann
  -1 siblings, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2023-01-30 18:17 UTC (permalink / raw)
  To: Andy Shevchenko, Arnd Bergmann
  Cc: Patrice Chotard, Mauro Carvalho Chehab, Hans Verkuil,
	Hugues Fruchet, linux-arm-kernel, linux-media, linux-kernel

On Mon, Jan 30, 2023, at 18:18, Andy Shevchenko wrote:
> On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:

>> +		ret = PTR_ERR_OR_ZERO(tsin->rst_gpio);
>>  		if (ret && ret != -EBUSY) {
>> -			dev_err(dev, "Can't request tsin%d reset gpio\n"
>> -				, fei->channel_data[index]->tsin_id);
>> +			dev_err_probe(dev, ret,
>> +				      "reset gpio for tsin%d not valid\n",
>> +				      tsin->tsin_id);
>>  			goto err_node_put;
>>  		}
>>  
>>  		if (!ret) {
>
> Can be 
>
> 	if (IS_ERR() && PTR_ERR() != -EBUSY) {
> 		ret = dev_err_probe(dev, PTR_ERR(), ...);
> 		...
> 	}
>
> 	if (!IS_ERR())
>
> (Up to you)

I prefer the version that only has one PTR_ERR(), but
either way is fine with me.

> But -EBUSY check seems strange to me. What was the motivation behind?
> (As far as I can read the code the possibility to get this if and only
>  if we have requested GPIO too early at initcall level. Would it be
>  ever a possibility to get it in real life?)

I noticed this part as being odd as well, no idea why the
code is like this. I just left the logic unchanged here.

      Arnd

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
@ 2023-01-30 18:17     ` Arnd Bergmann
  0 siblings, 0 replies; 20+ messages in thread
From: Arnd Bergmann @ 2023-01-30 18:17 UTC (permalink / raw)
  To: Andy Shevchenko, Arnd Bergmann
  Cc: Patrice Chotard, Mauro Carvalho Chehab, Hans Verkuil,
	Hugues Fruchet, linux-arm-kernel, linux-media, linux-kernel

On Mon, Jan 30, 2023, at 18:18, Andy Shevchenko wrote:
> On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:

>> +		ret = PTR_ERR_OR_ZERO(tsin->rst_gpio);
>>  		if (ret && ret != -EBUSY) {
>> -			dev_err(dev, "Can't request tsin%d reset gpio\n"
>> -				, fei->channel_data[index]->tsin_id);
>> +			dev_err_probe(dev, ret,
>> +				      "reset gpio for tsin%d not valid\n",
>> +				      tsin->tsin_id);
>>  			goto err_node_put;
>>  		}
>>  
>>  		if (!ret) {
>
> Can be 
>
> 	if (IS_ERR() && PTR_ERR() != -EBUSY) {
> 		ret = dev_err_probe(dev, PTR_ERR(), ...);
> 		...
> 	}
>
> 	if (!IS_ERR())
>
> (Up to you)

I prefer the version that only has one PTR_ERR(), but
either way is fine with me.

> But -EBUSY check seems strange to me. What was the motivation behind?
> (As far as I can read the code the possibility to get this if and only
>  if we have requested GPIO too early at initcall level. Would it be
>  ever a possibility to get it in real life?)

I noticed this part as being odd as well, no idea why the
code is like this. I just left the logic unchanged here.

      Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
  2023-01-30 13:09 ` Arnd Bergmann
@ 2023-02-01  3:29   ` Dmitry Torokhov
  -1 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2023-02-01  3:29 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Patrice Chotard, Mauro Carvalho Chehab, Arnd Bergmann,
	Andy Shevchenko, Hans Verkuil, Hugues Fruchet, linux-arm-kernel,
	linux-media, linux-kernel

On Mon, Jan 30, 2023 at 5:31 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The gpio usage in the function is fairly straightforward,
> but the normal gpiod_get() interface cannot be used here
> since the gpio is referenced by a child node of the device.
>
> Using devm_fwnode_gpiod_get_index() is the best alternative
> here.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  .../st/sti/c8sectpfe/c8sectpfe-core.c         | 30 ++++++++-----------
>  .../st/sti/c8sectpfe/c8sectpfe-core.h         |  2 +-
>  2 files changed, 13 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
> index c38b62d4f1ae..86a2c77c5471 100644
> --- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
> +++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
> @@ -22,7 +22,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
>  #include <linux/module.h>
> -#include <linux/of_gpio.h>
> +#include <linux/gpio/consumer.h>
>  #include <linux/of_platform.h>
>  #include <linux/pinctrl/consumer.h>
>  #include <linux/pinctrl/pinctrl.h>
> @@ -812,30 +812,24 @@ static int c8sectpfe_probe(struct platform_device *pdev)
>                 }
>                 of_node_put(i2c_bus);
>
> -               tsin->rst_gpio = of_get_named_gpio(child, "reset-gpios", 0);
> -
> -               ret = gpio_is_valid(tsin->rst_gpio);
> -               if (!ret) {
> -                       dev_err(dev,
> -                               "reset gpio for tsin%d not valid (gpio=%d)\n",
> -                               tsin->tsin_id, tsin->rst_gpio);
> -                       ret = -EINVAL;
> -                       goto err_node_put;
> -               }
> -
> -               ret = devm_gpio_request_one(dev, tsin->rst_gpio,
> -                                       GPIOF_OUT_INIT_LOW, "NIM reset");
> +               tsin->rst_gpio = devm_fwnode_gpiod_get_index(dev,
> +                                                            of_node_to_fwnode(child),
> +                                                            "reset-gpios",

Wrong name.

> +                                                            0, GPIOD_OUT_LOW,
> +                                                            "NIM reset");
> +               ret = PTR_ERR_OR_ZERO(tsin->rst_gpio);
>                 if (ret && ret != -EBUSY) {
> -                       dev_err(dev, "Can't request tsin%d reset gpio\n"
> -                               , fei->channel_data[index]->tsin_id);
> +                       dev_err_probe(dev, ret,
> +                                     "reset gpio for tsin%d not valid\n",
> +                                     tsin->tsin_id);
>                         goto err_node_put;
>                 }
>
>                 if (!ret) {
>                         /* toggle reset lines */
> -                       gpio_direction_output(tsin->rst_gpio, 0);
> +                       gpiod_direction_output(tsin->rst_gpio, 0);

It is already set up as output, and you either need to use "raw" or
fix polarity.

>                         usleep_range(3500, 5000);
> -                       gpio_direction_output(tsin->rst_gpio, 1);
> +                       gpiod_direction_output(tsin->rst_gpio, 1);
>                         usleep_range(3000, 5000);
>                 }

Thanks.

-- 
Dmitry

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
@ 2023-02-01  3:29   ` Dmitry Torokhov
  0 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2023-02-01  3:29 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Patrice Chotard, Mauro Carvalho Chehab, Arnd Bergmann,
	Andy Shevchenko, Hans Verkuil, Hugues Fruchet, linux-arm-kernel,
	linux-media, linux-kernel

On Mon, Jan 30, 2023 at 5:31 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The gpio usage in the function is fairly straightforward,
> but the normal gpiod_get() interface cannot be used here
> since the gpio is referenced by a child node of the device.
>
> Using devm_fwnode_gpiod_get_index() is the best alternative
> here.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  .../st/sti/c8sectpfe/c8sectpfe-core.c         | 30 ++++++++-----------
>  .../st/sti/c8sectpfe/c8sectpfe-core.h         |  2 +-
>  2 files changed, 13 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
> index c38b62d4f1ae..86a2c77c5471 100644
> --- a/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
> +++ b/drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
> @@ -22,7 +22,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
>  #include <linux/module.h>
> -#include <linux/of_gpio.h>
> +#include <linux/gpio/consumer.h>
>  #include <linux/of_platform.h>
>  #include <linux/pinctrl/consumer.h>
>  #include <linux/pinctrl/pinctrl.h>
> @@ -812,30 +812,24 @@ static int c8sectpfe_probe(struct platform_device *pdev)
>                 }
>                 of_node_put(i2c_bus);
>
> -               tsin->rst_gpio = of_get_named_gpio(child, "reset-gpios", 0);
> -
> -               ret = gpio_is_valid(tsin->rst_gpio);
> -               if (!ret) {
> -                       dev_err(dev,
> -                               "reset gpio for tsin%d not valid (gpio=%d)\n",
> -                               tsin->tsin_id, tsin->rst_gpio);
> -                       ret = -EINVAL;
> -                       goto err_node_put;
> -               }
> -
> -               ret = devm_gpio_request_one(dev, tsin->rst_gpio,
> -                                       GPIOF_OUT_INIT_LOW, "NIM reset");
> +               tsin->rst_gpio = devm_fwnode_gpiod_get_index(dev,
> +                                                            of_node_to_fwnode(child),
> +                                                            "reset-gpios",

Wrong name.

> +                                                            0, GPIOD_OUT_LOW,
> +                                                            "NIM reset");
> +               ret = PTR_ERR_OR_ZERO(tsin->rst_gpio);
>                 if (ret && ret != -EBUSY) {
> -                       dev_err(dev, "Can't request tsin%d reset gpio\n"
> -                               , fei->channel_data[index]->tsin_id);
> +                       dev_err_probe(dev, ret,
> +                                     "reset gpio for tsin%d not valid\n",
> +                                     tsin->tsin_id);
>                         goto err_node_put;
>                 }
>
>                 if (!ret) {
>                         /* toggle reset lines */
> -                       gpio_direction_output(tsin->rst_gpio, 0);
> +                       gpiod_direction_output(tsin->rst_gpio, 0);

It is already set up as output, and you either need to use "raw" or
fix polarity.

>                         usleep_range(3500, 5000);
> -                       gpio_direction_output(tsin->rst_gpio, 1);
> +                       gpiod_direction_output(tsin->rst_gpio, 1);
>                         usleep_range(3000, 5000);
>                 }

Thanks.

-- 
Dmitry

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
  2023-02-01  3:29   ` Dmitry Torokhov
@ 2023-02-01 18:35     ` Andy Shevchenko
  -1 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2023-02-01 18:35 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Arnd Bergmann, Patrice Chotard, Mauro Carvalho Chehab,
	Arnd Bergmann, Hans Verkuil, Hugues Fruchet, linux-arm-kernel,
	linux-media, linux-kernel

On Tue, Jan 31, 2023 at 07:29:37PM -0800, Dmitry Torokhov wrote:
> On Mon, Jan 30, 2023 at 5:31 AM Arnd Bergmann <arnd@kernel.org> wrote:

...

> > +               tsin->rst_gpio = devm_fwnode_gpiod_get_index(dev,
> > +                                                            of_node_to_fwnode(child),

Actually, please use of_fwnode_handle() and not IRQ framework custom grown
duplicate.

> > +                                                            "reset-gpios",
> 
> Wrong name.
> 
> > +                                                            0, GPIOD_OUT_LOW,
> > +                                                            "NIM reset");

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
@ 2023-02-01 18:35     ` Andy Shevchenko
  0 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2023-02-01 18:35 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Arnd Bergmann, Patrice Chotard, Mauro Carvalho Chehab,
	Arnd Bergmann, Hans Verkuil, Hugues Fruchet, linux-arm-kernel,
	linux-media, linux-kernel

On Tue, Jan 31, 2023 at 07:29:37PM -0800, Dmitry Torokhov wrote:
> On Mon, Jan 30, 2023 at 5:31 AM Arnd Bergmann <arnd@kernel.org> wrote:

...

> > +               tsin->rst_gpio = devm_fwnode_gpiod_get_index(dev,
> > +                                                            of_node_to_fwnode(child),

Actually, please use of_fwnode_handle() and not IRQ framework custom grown
duplicate.

> > +                                                            "reset-gpios",
> 
> Wrong name.
> 
> > +                                                            0, GPIOD_OUT_LOW,
> > +                                                            "NIM reset");

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
  2023-01-30 18:17     ` Arnd Bergmann
@ 2023-02-03 23:10       ` Dmitry Torokhov
  -1 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2023-02-03 23:10 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Andy Shevchenko, Arnd Bergmann, Patrice Chotard,
	Mauro Carvalho Chehab, Hans Verkuil, Hugues Fruchet,
	linux-arm-kernel, linux-media, linux-kernel

On Mon, Jan 30, 2023 at 10:19 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Mon, Jan 30, 2023, at 18:18, Andy Shevchenko wrote:
> > On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
>
> >> +            ret = PTR_ERR_OR_ZERO(tsin->rst_gpio);
> >>              if (ret && ret != -EBUSY) {
> >> -                    dev_err(dev, "Can't request tsin%d reset gpio\n"
> >> -                            , fei->channel_data[index]->tsin_id);
> >> +                    dev_err_probe(dev, ret,
> >> +                                  "reset gpio for tsin%d not valid\n",
> >> +                                  tsin->tsin_id);
> >>                      goto err_node_put;
> >>              }
> >>
> >>              if (!ret) {
> >
> > Can be
> >
> >       if (IS_ERR() && PTR_ERR() != -EBUSY) {
> >               ret = dev_err_probe(dev, PTR_ERR(), ...);
> >               ...
> >       }
> >
> >       if (!IS_ERR())
> >
> > (Up to you)
>
> I prefer the version that only has one PTR_ERR(), but
> either way is fine with me.
>
> > But -EBUSY check seems strange to me. What was the motivation behind?
> > (As far as I can read the code the possibility to get this if and only
> >  if we have requested GPIO too early at initcall level. Would it be
> >  ever a possibility to get it in real life?)
>
> I noticed this part as being odd as well, no idea why the
> code is like this. I just left the logic unchanged here.

It could be they were trying to account for the possibility of the
reset line being shared between several blocks, and so the first one
to initialize would grab it and reset all chips, and the followers
would be skipping the reset logic.

-- 
Dmitry

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
@ 2023-02-03 23:10       ` Dmitry Torokhov
  0 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2023-02-03 23:10 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Andy Shevchenko, Arnd Bergmann, Patrice Chotard,
	Mauro Carvalho Chehab, Hans Verkuil, Hugues Fruchet,
	linux-arm-kernel, linux-media, linux-kernel

On Mon, Jan 30, 2023 at 10:19 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Mon, Jan 30, 2023, at 18:18, Andy Shevchenko wrote:
> > On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
>
> >> +            ret = PTR_ERR_OR_ZERO(tsin->rst_gpio);
> >>              if (ret && ret != -EBUSY) {
> >> -                    dev_err(dev, "Can't request tsin%d reset gpio\n"
> >> -                            , fei->channel_data[index]->tsin_id);
> >> +                    dev_err_probe(dev, ret,
> >> +                                  "reset gpio for tsin%d not valid\n",
> >> +                                  tsin->tsin_id);
> >>                      goto err_node_put;
> >>              }
> >>
> >>              if (!ret) {
> >
> > Can be
> >
> >       if (IS_ERR() && PTR_ERR() != -EBUSY) {
> >               ret = dev_err_probe(dev, PTR_ERR(), ...);
> >               ...
> >       }
> >
> >       if (!IS_ERR())
> >
> > (Up to you)
>
> I prefer the version that only has one PTR_ERR(), but
> either way is fine with me.
>
> > But -EBUSY check seems strange to me. What was the motivation behind?
> > (As far as I can read the code the possibility to get this if and only
> >  if we have requested GPIO too early at initcall level. Would it be
> >  ever a possibility to get it in real life?)
>
> I noticed this part as being odd as well, no idea why the
> code is like this. I just left the logic unchanged here.

It could be they were trying to account for the possibility of the
reset line being shared between several blocks, and so the first one
to initialize would grab it and reset all chips, and the followers
would be skipping the reset logic.

-- 
Dmitry

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
  2023-01-30 13:09 ` Arnd Bergmann
@ 2023-05-17 18:21   ` Sakari Ailus
  -1 siblings, 0 replies; 20+ messages in thread
From: Sakari Ailus @ 2023-05-17 18:21 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Patrice Chotard, Mauro Carvalho Chehab, Arnd Bergmann,
	Andy Shevchenko, Hans Verkuil, Hugues Fruchet, linux-arm-kernel,
	linux-media, linux-kernel, Dmitry Torokhov

Hi Arnd,

On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The gpio usage in the function is fairly straightforward,
> but the normal gpiod_get() interface cannot be used here
> since the gpio is referenced by a child node of the device.
> 
> Using devm_fwnode_gpiod_get_index() is the best alternative
> here.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

I've picked
<URL:https://patchwork.linuxtv.org/project/linux-media/patch/20230130131003.668888-1-arnd@kernel.org/>
instead. I hope that's fine. Also cc Dmitry.

-- 
Kind regards,

Sakari Ailus

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
@ 2023-05-17 18:21   ` Sakari Ailus
  0 siblings, 0 replies; 20+ messages in thread
From: Sakari Ailus @ 2023-05-17 18:21 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Patrice Chotard, Mauro Carvalho Chehab, Arnd Bergmann,
	Andy Shevchenko, Hans Verkuil, Hugues Fruchet, linux-arm-kernel,
	linux-media, linux-kernel, Dmitry Torokhov

Hi Arnd,

On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The gpio usage in the function is fairly straightforward,
> but the normal gpiod_get() interface cannot be used here
> since the gpio is referenced by a child node of the device.
> 
> Using devm_fwnode_gpiod_get_index() is the best alternative
> here.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

I've picked
<URL:https://patchwork.linuxtv.org/project/linux-media/patch/20230130131003.668888-1-arnd@kernel.org/>
instead. I hope that's fine. Also cc Dmitry.

-- 
Kind regards,

Sakari Ailus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
  2023-05-17 18:21   ` Sakari Ailus
@ 2023-05-17 19:12     ` Dmitry Torokhov
  -1 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2023-05-17 19:12 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Arnd Bergmann, Patrice Chotard, Mauro Carvalho Chehab,
	Arnd Bergmann, Andy Shevchenko, Hans Verkuil, Hugues Fruchet,
	linux-arm-kernel, linux-media, linux-kernel

On Wed, May 17, 2023 at 09:21:00PM +0300, Sakari Ailus wrote:
> Hi Arnd,
> 
> On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > The gpio usage in the function is fairly straightforward,
> > but the normal gpiod_get() interface cannot be used here
> > since the gpio is referenced by a child node of the device.
> > 
> > Using devm_fwnode_gpiod_get_index() is the best alternative
> > here.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> I've picked
> <URL:https://patchwork.linuxtv.org/project/linux-media/patch/20230130131003.668888-1-arnd@kernel.org/>
> instead. I hope that's fine. Also cc Dmitry.

What do you mean "instead"? This is the exact patch that started this
thread, and it is broken (uses wrong name of the GPIO and wrong polarity).

I'd much rather you picked up
https://lore.kernel.org/all/Y92VLGLQJZ%2FUDRx1@google.com/

Thanks.

-- 
Dmitry

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
@ 2023-05-17 19:12     ` Dmitry Torokhov
  0 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2023-05-17 19:12 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Arnd Bergmann, Patrice Chotard, Mauro Carvalho Chehab,
	Arnd Bergmann, Andy Shevchenko, Hans Verkuil, Hugues Fruchet,
	linux-arm-kernel, linux-media, linux-kernel

On Wed, May 17, 2023 at 09:21:00PM +0300, Sakari Ailus wrote:
> Hi Arnd,
> 
> On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > The gpio usage in the function is fairly straightforward,
> > but the normal gpiod_get() interface cannot be used here
> > since the gpio is referenced by a child node of the device.
> > 
> > Using devm_fwnode_gpiod_get_index() is the best alternative
> > here.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> I've picked
> <URL:https://patchwork.linuxtv.org/project/linux-media/patch/20230130131003.668888-1-arnd@kernel.org/>
> instead. I hope that's fine. Also cc Dmitry.

What do you mean "instead"? This is the exact patch that started this
thread, and it is broken (uses wrong name of the GPIO and wrong polarity).

I'd much rather you picked up
https://lore.kernel.org/all/Y92VLGLQJZ%2FUDRx1@google.com/

Thanks.

-- 
Dmitry

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
  2023-05-17 19:12     ` Dmitry Torokhov
@ 2023-05-17 19:26       ` Sakari Ailus
  -1 siblings, 0 replies; 20+ messages in thread
From: Sakari Ailus @ 2023-05-17 19:26 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Arnd Bergmann, Patrice Chotard, Mauro Carvalho Chehab,
	Arnd Bergmann, Andy Shevchenko, Hans Verkuil, Hugues Fruchet,
	linux-arm-kernel, linux-media, linux-kernel

Hi Dmitry,

On Wed, May 17, 2023 at 12:12:05PM -0700, Dmitry Torokhov wrote:
> On Wed, May 17, 2023 at 09:21:00PM +0300, Sakari Ailus wrote:
> > Hi Arnd,
> > 
> > On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
> > > From: Arnd Bergmann <arnd@arndb.de>
> > > 
> > > The gpio usage in the function is fairly straightforward,
> > > but the normal gpiod_get() interface cannot be used here
> > > since the gpio is referenced by a child node of the device.
> > > 
> > > Using devm_fwnode_gpiod_get_index() is the best alternative
> > > here.
> > > 
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > 
> > I've picked
> > <URL:https://patchwork.linuxtv.org/project/linux-media/patch/20230130131003.668888-1-arnd@kernel.org/>
> > instead. I hope that's fine. Also cc Dmitry.
> 
> What do you mean "instead"? This is the exact patch that started this
> thread, and it is broken (uses wrong name of the GPIO and wrong polarity).
> 
> I'd much rather you picked up
> https://lore.kernel.org/all/Y92VLGLQJZ%2FUDRx1@google.com/
> 
> Thanks.

Ah, the URL in my e-mail was wrong. I have
<URL:https://patchwork.linuxtv.org/project/linux-media/patch/Y92VLGLQJZ/UDRx1@google.com/>,
i.e. the same patch.

-- 
Regards,

Sakari Ailus

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
@ 2023-05-17 19:26       ` Sakari Ailus
  0 siblings, 0 replies; 20+ messages in thread
From: Sakari Ailus @ 2023-05-17 19:26 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Arnd Bergmann, Patrice Chotard, Mauro Carvalho Chehab,
	Arnd Bergmann, Andy Shevchenko, Hans Verkuil, Hugues Fruchet,
	linux-arm-kernel, linux-media, linux-kernel

Hi Dmitry,

On Wed, May 17, 2023 at 12:12:05PM -0700, Dmitry Torokhov wrote:
> On Wed, May 17, 2023 at 09:21:00PM +0300, Sakari Ailus wrote:
> > Hi Arnd,
> > 
> > On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
> > > From: Arnd Bergmann <arnd@arndb.de>
> > > 
> > > The gpio usage in the function is fairly straightforward,
> > > but the normal gpiod_get() interface cannot be used here
> > > since the gpio is referenced by a child node of the device.
> > > 
> > > Using devm_fwnode_gpiod_get_index() is the best alternative
> > > here.
> > > 
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > 
> > I've picked
> > <URL:https://patchwork.linuxtv.org/project/linux-media/patch/20230130131003.668888-1-arnd@kernel.org/>
> > instead. I hope that's fine. Also cc Dmitry.
> 
> What do you mean "instead"? This is the exact patch that started this
> thread, and it is broken (uses wrong name of the GPIO and wrong polarity).
> 
> I'd much rather you picked up
> https://lore.kernel.org/all/Y92VLGLQJZ%2FUDRx1@google.com/
> 
> Thanks.

Ah, the URL in my e-mail was wrong. I have
<URL:https://patchwork.linuxtv.org/project/linux-media/patch/Y92VLGLQJZ/UDRx1@google.com/>,
i.e. the same patch.

-- 
Regards,

Sakari Ailus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
  2023-05-17 19:26       ` Sakari Ailus
@ 2023-05-19  1:05         ` Dmitry Torokhov
  -1 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2023-05-19  1:05 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Arnd Bergmann, Patrice Chotard, Mauro Carvalho Chehab,
	Arnd Bergmann, Andy Shevchenko, Hans Verkuil, Hugues Fruchet,
	linux-arm-kernel, linux-media, linux-kernel

On Wed, May 17, 2023 at 10:26:17PM +0300, Sakari Ailus wrote:
> Hi Dmitry,
> 
> On Wed, May 17, 2023 at 12:12:05PM -0700, Dmitry Torokhov wrote:
> > On Wed, May 17, 2023 at 09:21:00PM +0300, Sakari Ailus wrote:
> > > Hi Arnd,
> > > 
> > > On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
> > > > From: Arnd Bergmann <arnd@arndb.de>
> > > > 
> > > > The gpio usage in the function is fairly straightforward,
> > > > but the normal gpiod_get() interface cannot be used here
> > > > since the gpio is referenced by a child node of the device.
> > > > 
> > > > Using devm_fwnode_gpiod_get_index() is the best alternative
> > > > here.
> > > > 
> > > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > > 
> > > I've picked
> > > <URL:https://patchwork.linuxtv.org/project/linux-media/patch/20230130131003.668888-1-arnd@kernel.org/>
> > > instead. I hope that's fine. Also cc Dmitry.
> > 
> > What do you mean "instead"? This is the exact patch that started this
> > thread, and it is broken (uses wrong name of the GPIO and wrong polarity).
> > 
> > I'd much rather you picked up
> > https://lore.kernel.org/all/Y92VLGLQJZ%2FUDRx1@google.com/
> > 
> > Thanks.
> 
> Ah, the URL in my e-mail was wrong. I have
> <URL:https://patchwork.linuxtv.org/project/linux-media/patch/Y92VLGLQJZ/UDRx1@google.com/>,
> i.e. the same patch.

Ah, I see, thank you.

-- 
Dmitry

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

* Re: [PATCH] media: c8sectpfe: convert to gpio descriptors
@ 2023-05-19  1:05         ` Dmitry Torokhov
  0 siblings, 0 replies; 20+ messages in thread
From: Dmitry Torokhov @ 2023-05-19  1:05 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Arnd Bergmann, Patrice Chotard, Mauro Carvalho Chehab,
	Arnd Bergmann, Andy Shevchenko, Hans Verkuil, Hugues Fruchet,
	linux-arm-kernel, linux-media, linux-kernel

On Wed, May 17, 2023 at 10:26:17PM +0300, Sakari Ailus wrote:
> Hi Dmitry,
> 
> On Wed, May 17, 2023 at 12:12:05PM -0700, Dmitry Torokhov wrote:
> > On Wed, May 17, 2023 at 09:21:00PM +0300, Sakari Ailus wrote:
> > > Hi Arnd,
> > > 
> > > On Mon, Jan 30, 2023 at 02:09:47PM +0100, Arnd Bergmann wrote:
> > > > From: Arnd Bergmann <arnd@arndb.de>
> > > > 
> > > > The gpio usage in the function is fairly straightforward,
> > > > but the normal gpiod_get() interface cannot be used here
> > > > since the gpio is referenced by a child node of the device.
> > > > 
> > > > Using devm_fwnode_gpiod_get_index() is the best alternative
> > > > here.
> > > > 
> > > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > > 
> > > I've picked
> > > <URL:https://patchwork.linuxtv.org/project/linux-media/patch/20230130131003.668888-1-arnd@kernel.org/>
> > > instead. I hope that's fine. Also cc Dmitry.
> > 
> > What do you mean "instead"? This is the exact patch that started this
> > thread, and it is broken (uses wrong name of the GPIO and wrong polarity).
> > 
> > I'd much rather you picked up
> > https://lore.kernel.org/all/Y92VLGLQJZ%2FUDRx1@google.com/
> > 
> > Thanks.
> 
> Ah, the URL in my e-mail was wrong. I have
> <URL:https://patchwork.linuxtv.org/project/linux-media/patch/Y92VLGLQJZ/UDRx1@google.com/>,
> i.e. the same patch.

Ah, I see, thank you.

-- 
Dmitry

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-05-19  1:06 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-30 13:09 [PATCH] media: c8sectpfe: convert to gpio descriptors Arnd Bergmann
2023-01-30 13:09 ` Arnd Bergmann
2023-01-30 17:18 ` Andy Shevchenko
2023-01-30 17:18   ` Andy Shevchenko
2023-01-30 18:17   ` Arnd Bergmann
2023-01-30 18:17     ` Arnd Bergmann
2023-02-03 23:10     ` Dmitry Torokhov
2023-02-03 23:10       ` Dmitry Torokhov
2023-02-01  3:29 ` Dmitry Torokhov
2023-02-01  3:29   ` Dmitry Torokhov
2023-02-01 18:35   ` Andy Shevchenko
2023-02-01 18:35     ` Andy Shevchenko
2023-05-17 18:21 ` Sakari Ailus
2023-05-17 18:21   ` Sakari Ailus
2023-05-17 19:12   ` Dmitry Torokhov
2023-05-17 19:12     ` Dmitry Torokhov
2023-05-17 19:26     ` Sakari Ailus
2023-05-17 19:26       ` Sakari Ailus
2023-05-19  1:05       ` Dmitry Torokhov
2023-05-19  1:05         ` Dmitry Torokhov

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.