On Fri, Mar 23, 2018 at 07:29:01AM -0700, Tony Lindgren wrote: > Hi, > > * Ralf Göbel <ralf.goebel@xxxxxxxxxxxxxxxxxxxxxx> [180322 17:22]: > > Hi, > > > > I'm using Kernel 4.9.59 and came across a problem using TPS65218 gpio3 with > > the gpio-poweroff driver. > > > > In the device tree I have configured the gpio for open-drain: > > > > gpio_poweroff { > > compatible = "gpio-poweroff"; > > gpios = <&tps65218_gpio 2 GPIO_OPEN_DRAIN>; > > }; > > > > This is the result: > > [ 3.075343] omap_i2c 44e0b000.i2c: bus 0 rev0.12 at 100 kHz > > [ 3.081907] tps65218-gpio tps65218-gpio.1.auto: GPO3 works only as open > > drain > > [ 3.089262] poweroff-gpio: probe of gpio_poweroff failed with error -22 > > > > > > It seem that there was a change in gpiolib that forbids any checks on the > > gpio flags inside the request callback: > > https://patchwork.kernel.org/patch/9247097/ > > The gpio-tps65218 driver is actually mentioned doing this. > > > > After removing the sanity checks in tps65218_gpio_request(), the gpio is > > working properly with gpio-poweroff. I'm not sure if this is the solution. > > Adding Johan and Linus to Cc, maybe they know what's going on > here. The background story can be found in this thread: https://lkml.kernel.org/r/1467563525-30227-1-git-send-email-johan@xxxxxxxxxx To summarise the state of things, there's currently no way for a gpio driver to do sanity checks on the line flags at request time. Only the tps65218_gpio driver tries to do that and dropping those checks seems like the right thing to do, at least until someone implements an interface that once again allows the driver to verify flags early (but in a non-broken way). Johan -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html