#include <linux/device.h>
#include <linux/module.h>
#include <linux/gpio/consumer.h>
#include <linux/of_address.h>
#include <linux/of_gpio.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/gpio/machine.h>
static int of_gpiochip_match_node_and_xlate(struct gpio_chip *chip, void *data)
struct of_phandle_args *gpiospec = data;
return chip->gpiodev->dev.of_node == gpiospec->np &&
chip->of_xlate(chip, gpiospec, NULL) >= 0;
static struct gpio_chip *of_find_gpiochip_by_xlate(
struct of_phandle_args *gpiospec)
return gpiochip_find(gpiospec, of_gpiochip_match_node_and_xlate);
static struct gpio_desc *of_xlate_and_get_gpiod_flags(struct gpio_chip *chip,
struct of_phandle_args *gpiospec,
enum of_gpio_flags *flags)
if (chip->of_gpio_n_cells != gpiospec->args_count)
ret = chip->of_xlate(chip, gpiospec, flags);
return gpiochip_get_desc(chip, ret);
static void of_gpio_flags_quirks(struct device_node *np,
enum of_gpio_flags *flags,