On Mon, May 6, 2019 at 9:57 AM Harish Jenny K N <harish_kandiga@xxxxxxxxxx> wrote: > Can the userspace consumers define the polarity? Yes. From userspace after opening the GPIO character device: #include <linux/gpio.h> struct gpiohandle_request req; req.flags = GPIOHANDLE_REQUEST_ACTIVE_LOW | GPIOHANDLE_REQUEST_OUTPUT; req.lines = 1; req.lineoffsets[0] = 0; ret = ioctl(fd, GPIO_GET_LINEHANDLE_IOCTL, &req); (...) For more details on how to use the character device see tools/gpio/* in the kernel tree. > Intention was to define polarity for lines which are not having consumers from kernelspace. OK the above should work fine :) > > Even when using GPIOs from userspace (which I do not > > recommend) the character device suppors a polarity flag > > GPIOLINE_FLAG_ACTIVE_LOW so also userspace > > consumers define polarity. > > yes. aware of the GPIOLINE_FLAG_ACTIVE_LOW flag to get the status. Sorry, I was being unclear, GPIOHANDLE_REQUEST_ACTIVE_LOW is what you want to use. Yours, Linus Walleij