lib/gpio: support pin modes