looks like it uses include/linux/gpio.h from within the kernel source tree,
however, I think for this module you want to have a look at
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/gpio/gpio-legacy.txt
> Is the "pinctrl-sunxi" module used to setup/configure pins? .... or are
> their functions first defined in the DTS and then "enabled" via the
> "pinctrl-sunxi" module?
err.. yes to both :)
from the POV of a driver wanting to access some gpios perhaps you need to
have a look at
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/gpio/consumer.txt
the devicetree part only comes into play for drivers that understand how
to look up their resources in DT. This makes the difference that you don't
have to hard-code the pins you want to use in the driver source code.
The driver can just lookup it's compatible string in DT and use that to
bind to the specific resources defined in the DT.
Yes, however that documents how to access them from userspace via /sys, your
driver is a kernel module so it needs to use the proper internal kernel
interface
> Excuse all the questions but I'm struggling to understand how or what
> gpio.h I would use to implement the servodrive module.
This one I expect:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/gpio.h
To build your driver you need to do something like
make -C <path_to_kernel_src> M=$PWD
where you replace <path_to_kernel_src> with the directory you built your
kernel in. It's possible this can be /lib/modules/`uname -r`/build
if the kernel you want the module built for is the currently running
kernel, but this gets somewhat complex if you're cross compiling for
Arm on an x86 PC.
https://www.kernel.org/doc/Documentation/kbuild/modules.txt gives some
hints on how to go about building external modules like your servodrive.
note that the servodrive module seems to date from 2010, it's quite possible
you'll have some work to do to make it compile and work with the 3.18-rc3
you're running. Out-of-tree drivers like this can bit-rot quite quickly.
good luck!