add mode handling to gpio_request