2 #include <asm-generic/gpio.h>
4 int gpio_request_one(unsigned int gpio, enum gpio_flags flags,
9 ret = gpio_request(gpio, label);
13 if (flags == GPIOFLAG_INPUT)
14 gpio_direction_input(gpio);
15 else if (flags == GPIOFLAG_OUTPUT_INIT_LOW)
16 gpio_direction_output(gpio, 0);
17 else if (flags == GPIOFLAG_OUTPUT_INIT_HIGH)
18 gpio_direction_output(gpio, 1);
23 int gpio_request_array(const struct gpio *gpios, int count)
28 for (i = 0; i < count; i++) {
29 ret = gpio_request_one(gpios[i].gpio, gpios[i].flags,
32 printf("Failed to request GPIO%d (%u of %u): %d\n",
33 gpios[i].gpio, i, count, ret);
41 gpio_free(gpios[i].gpio);
46 int gpio_free_array(const struct gpio *gpios, int count)
51 for (i = 0; i < count; i++)
52 ret |= gpio_free(gpios[i].gpio);