i am quiet new at writing kernel drivers and there is something bothering me a lot. It would be great if you could kcik me into the right direction.
I am writing a module for a device, that has to be powered via putting a GPIO to HIGH-State.
In Documentation/gpio/* are texts, which say i should use the new descriptor-based interface of the GPIO Framework. But how to use it? When i make an include like #include it compiles and i can run the driver. But using gpiod_get(...) just returns fffffffffffffffe. It makes sense somehow, as the implentation of that function within linux/gpio/consumer.h is
static inline struct gpio_desc *__must_check gpiod_get(struct device *dev, const char *con_id,enum gpiod_flags flags){ return ERR_PTR(-ENOSYS); }
The implementation of the function exists in drivers/gpio/devres.c as well. How can i use that one?
It looks to me as i am not supposed to use that implementation.
I hope you can help me as it is getting really irritating.
linux/gpio/consumer.h, it has two declarations ofgpiod_getfunction: the first one is simple declaration, and the second one is declaration with definition. The first one corresponds toCONFIG_GPIOLIBconfiguration option enabled, and has usefull implementation indrivers/gpio/devres.c. The second one corresponds to the disabled option, and its implementation means just "not implemented". So you need to haveCONFIG_GPIOLIBoption enabled for use GPIO. - Tsyvarev