diff mbox

[2/2] clk: clk-gpio: Request GPIO descriptor as LOW

Message ID 20170924161919.24832-2-linus.walleij@linaro.org (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Linus Walleij Sept. 24, 2017, 4:19 p.m. UTC
Requesting the GPIOD_OUT_LOW low will make sure the GPIO is
deasserted when requested. The gpiolib core will make sure that
if the GPIO line is active low, it will be logically driven high
when deasserted, see drivers/gpiolib.c gpiod_configure_flags().

Cc: Sergej Sawazki <ce3a@gmx.de>
Cc: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/clk/clk-gpio.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Comments

Stephen Boyd Sept. 29, 2017, 10:53 p.m. UTC | #1
On 09/24, Linus Walleij wrote:
> Requesting the GPIOD_OUT_LOW low will make sure the GPIO is
> deasserted when requested. The gpiolib core will make sure that
> if the GPIO line is active low, it will be logically driven high
> when deasserted, see drivers/gpiolib.c gpiod_configure_flags().
> 
> Cc: Sergej Sawazki <ce3a@gmx.de>
> Cc: Jyri Sarha <jsarha@ti.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/clk/clk-gpio.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/drivers/clk/clk-gpio.c b/drivers/clk/clk-gpio.c
> index 9d057073e110..151513c655c3 100644
> --- a/drivers/clk/clk-gpio.c
> +++ b/drivers/clk/clk-gpio.c
> @@ -109,14 +109,6 @@ static struct clk_hw *clk_register_gpio(struct device *dev, const char *name,
>  	if (!clk_gpio)
>  		return ERR_PTR(-ENOMEM);
>  
> -	/*
> -	 * Set to disabled no matter what: NOTE if the GPIO line is active low
> -	 * the GPIO descriptor knows this and will set it high to deassert the
> -	 * line. This assumes the GPIO descriptor has been requested using
> -	 * GPIOD_ASIS by the callers so we need to initialize it as disabled here.
> -	 */
> -	gpiod_set_value(gpiod, 0);
> -

Is there a reason why we split this patch out and then deleted
the comment that was introduced in the previous patch? Why not
combine these two patches into one?
Linus Walleij Oct. 1, 2017, 2:50 p.m. UTC | #2
On Sat, Sep 30, 2017 at 12:53 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 09/24, Linus Walleij wrote:
>> Requesting the GPIOD_OUT_LOW low will make sure the GPIO is
>> deasserted when requested. The gpiolib core will make sure that
>> if the GPIO line is active low, it will be logically driven high
>> when deasserted, see drivers/gpiolib.c gpiod_configure_flags().
>>
>> Cc: Sergej Sawazki <ce3a@gmx.de>
>> Cc: Jyri Sarha <jsarha@ti.com>
>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>> ---
>>  drivers/clk/clk-gpio.c | 10 +---------
>>  1 file changed, 1 insertion(+), 9 deletions(-)
>>
>> diff --git a/drivers/clk/clk-gpio.c b/drivers/clk/clk-gpio.c
>> index 9d057073e110..151513c655c3 100644
>> --- a/drivers/clk/clk-gpio.c
>> +++ b/drivers/clk/clk-gpio.c
>> @@ -109,14 +109,6 @@ static struct clk_hw *clk_register_gpio(struct device *dev, const char *name,
>>       if (!clk_gpio)
>>               return ERR_PTR(-ENOMEM);
>>
>> -     /*
>> -      * Set to disabled no matter what: NOTE if the GPIO line is active low
>> -      * the GPIO descriptor knows this and will set it high to deassert the
>> -      * line. This assumes the GPIO descriptor has been requested using
>> -      * GPIOD_ASIS by the callers so we need to initialize it as disabled here.
>> -      */
>> -     gpiod_set_value(gpiod, 0);
>> -
>
> Is there a reason why we split this patch out and then deleted
> the comment that was introduced in the previous patch? Why not
> combine these two patches into one?

I was worried about the semantic ordering here (in the old code this pulling
low happens at a different point in the sequence) so bisect would find that.

But maybe it's just me being overly cautious.

If you prefer, feel free to squash them when applying.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Boyd Nov. 2, 2017, 8:21 a.m. UTC | #3
On 09/24, Linus Walleij wrote:
> Requesting the GPIOD_OUT_LOW low will make sure the GPIO is
> deasserted when requested. The gpiolib core will make sure that
> if the GPIO line is active low, it will be logically driven high
> when deasserted, see drivers/gpiolib.c gpiod_configure_flags().
> 
> Cc: Sergej Sawazki <ce3a@gmx.de>
> Cc: Jyri Sarha <jsarha@ti.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---

Applied to clk-next
diff mbox

Patch

diff --git a/drivers/clk/clk-gpio.c b/drivers/clk/clk-gpio.c
index 9d057073e110..151513c655c3 100644
--- a/drivers/clk/clk-gpio.c
+++ b/drivers/clk/clk-gpio.c
@@ -109,14 +109,6 @@  static struct clk_hw *clk_register_gpio(struct device *dev, const char *name,
 	if (!clk_gpio)
 		return ERR_PTR(-ENOMEM);
 
-	/*
-	 * Set to disabled no matter what: NOTE if the GPIO line is active low
-	 * the GPIO descriptor knows this and will set it high to deassert the
-	 * line. This assumes the GPIO descriptor has been requested using
-	 * GPIOD_ASIS by the callers so we need to initialize it as disabled here.
-	 */
-	gpiod_set_value(gpiod, 0);
-
 	init.name = name;
 	init.ops = clk_gpio_ops;
 	init.flags = flags | CLK_IS_BASIC;
@@ -237,7 +229,7 @@  static int gpio_clk_driver_probe(struct platform_device *pdev)
 	is_mux = of_device_is_compatible(node, "gpio-mux-clock");
 
 	gpio_name = is_mux ? "select" : "enable";
-	gpiod = devm_gpiod_get(&pdev->dev, gpio_name, GPIOD_ASIS);
+	gpiod = devm_gpiod_get(&pdev->dev, gpio_name, GPIOD_OUT_LOW);
 	if (IS_ERR(gpiod)) {
 		ret = PTR_ERR(gpiod);
 		if (ret == -EPROBE_DEFER)