I think that's more a matter of what the hardware makes available. If you have GPIO pins brought out to where you can reach them you could probably use a GPIO special file to access them, something like that. Linux can interface with more than just the "normal" peripherals, but the hardware has to make them available.
What's the SOC you're using?
Joe