On Wed, Jan 28, 2015 at 7:54 PM, Robert Jarzmik <robert.jarzmik@xxxxxxx> wrote: > Felipe Balbi <balbi@xxxxxx> writes: > >>> nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset"); >>> if (gpiod_is_active_low(nop->gpiod_reset)) >>> gpiod_direction_output(nop->gpiod_reset, GPIOD_OUT_LOW); >>> else >>> gpiod_direction_output(nop->gpiod_reset, GPIOD_OUT_HIGH); >> >> won't the descriptor itself handle that for us ? Linus ? >> >> I want to hear from Linus W first. > > Yes, so do I. > > Let's add a bit of context for Linus : > 1) In the past, the driver was doing a ; > gpio_request_one() > -> gpiod_direction_output_raw() > 2) After the conversion to gpio descriptors, it is doing : > gpiod_get_optional(dev, "reset"); > -> ... > -> __gpiod_get_index(dev, "reset", 0, 0) > -> this of course doesn't call gpiod_direction() But wait. __gpiod_get_index() does call gpiod_direction_output() if any dir bits are set. > The problem is that we cannot call: > gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); > because we don't know before the call if the GPIO is active high or low. The call __gpiod_get_index() first sets the inversion flag if applicable and if you pass GPIOD_OUT_HIGH it should set the raw value to 0 if it was inverted. Else find the bug... is the GPIO line clearly marked as inverted wherever it is described? Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html