Re: [PATCH v1 3/4] ASoC: codecs: pcm179x: Add reset gpio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 27, 2018 at 6:24 PM, Mylène Josserand
<mylene.josserand@xxxxxxxxxxx> wrote:

> +       pcm179x->reset = of_get_named_gpio(np, "reset-gpios", 0);
> +       if (gpio_is_valid(pcm179x->reset)) {
> +               ret = devm_gpio_request_one(dev, pcm179x->reset,
> +                                           GPIOF_OUT_INIT_LOW,
> +                                           "pcm179x reset");
> +               if (ret) {
> +                       dev_err(dev,
> +                               "Failed to request GPIO %d as reset pin, error %d\n",
> +                               pcm179x->reset, ret);
> +                       return ret;
> +               }
> +
> +               gpio_set_value(pcm179x->reset, 1);

It would be better to use the gpiod API, which takes the GPIO polarity
into account.

There may be systems that have an inverter connected to this pin, and
this can be changed in dts via GPIO_ACTIVE_HIGH.

Also, as the reset pin can be connected to an I2C expander, for
example, so it is safer to use the cansleep variant:

gpiod_set_value_cansleep(pcm179x->reset, 0);
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux