Add a convenience function to get a gpio pin's capabilties.

This commit is contained in:
ian 2016-05-26 22:35:52 +00:00
parent a8f815c9b3
commit d2d471b50a
2 changed files with 10 additions and 0 deletions

View File

@ -123,6 +123,7 @@ int gpio_pin_get_by_ofw_idx(device_t consumer, phandle_t node,
int gpio_pin_get_by_ofw_property(device_t consumer, phandle_t node,
char *name, gpio_pin_t *gpio);
void gpio_pin_release(gpio_pin_t gpio);
int gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps);
int gpio_pin_is_active(gpio_pin_t pin, bool *active);
int gpio_pin_set_active(gpio_pin_t pin, bool active);
int gpio_pin_setflags(gpio_pin_t pin, uint32_t flags);

View File

@ -154,6 +154,15 @@ gpio_pin_release(gpio_pin_t gpio)
free(gpio, M_DEVBUF);
}
int
gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps)
{
KASSERT(pin != NULL, ("GPIO pin is NULL."));
KASSERT(pin->dev != NULL, ("GPIO pin device is NULL."));
return (GPIO_PIN_GETCAPS(pin->dev, pin->pin, caps));
}
int
gpio_pin_is_active(gpio_pin_t pin, bool *active)
{