gpio: Add helpers for optional GPIOs