On Tue, May 9, 2017 at 12:49 PM, Yves Lefloch <YvesMarie_Lefloch@xxxxxxxxxxxxxxxx> wrote: > I was wondering what's the recommended approach to > mutualize code: > 1. Having a driver under drivers/gpio and another on drivers/pinctrl > which depends on the first one. > 2. Having both drivers in the same file under drivers/pinctrl. > 3. Having only one pinctrl driver. All approaches exist. I have no strong opinion, but when possible try to make separation of concerns. > For now I've taken approach 3, but isn't it strange to have pins > dedicated to GPIO like this first group I mentioned controlled > for a pinctrl driver? > What is your opinion on this? Just make sure your driver also provides a gpio_chip and write good looking code. >> But I was not meaning you should collect them all under a >> "pins" node like this, but inside each peripheral. > > OK, I will do that. Although not all alternate functions currently > have a driver, nor a node in the device tree. I guess the best way > to handle that is to declare the pins as GPIO only and not to worry > about the alternate function; which brings me back to the question > above. Do they need a separate GPIO driver? Implement everything you have a data sheet for even if you do not use it right now. It is good to have. Have you read the section "GPIO mode pitfalls" in the documentation? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/pinctrl.txt It is very important that you know for sure whether it is actual GPIO or just named that way by some hardware engineer. Yours, Linus Walleij -- 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