Lines Matching refs:gpio
57 static inline int xgpio_index(struct xgpio_instance *chip, int gpio) in xgpio_index() argument
59 if (gpio >= chip->gpio_width[0]) in xgpio_index()
65 static inline int xgpio_regoffset(struct xgpio_instance *chip, int gpio) in xgpio_regoffset() argument
67 if (xgpio_index(chip, gpio)) in xgpio_regoffset()
73 static inline int xgpio_offset(struct xgpio_instance *chip, int gpio) in xgpio_offset() argument
75 if (xgpio_index(chip, gpio)) in xgpio_offset()
76 return gpio - chip->gpio_width[0]; in xgpio_offset()
78 return gpio; in xgpio_offset()
92 static int xgpio_get(struct gpio_chip *gc, unsigned int gpio) in xgpio_get() argument
100 xgpio_regoffset(chip, gpio)); in xgpio_get()
102 return !!(val & BIT(xgpio_offset(chip, gpio))); in xgpio_get()
114 static void xgpio_set(struct gpio_chip *gc, unsigned int gpio, int val) in xgpio_set() argument
120 int index = xgpio_index(chip, gpio); in xgpio_set()
121 int offset = xgpio_offset(chip, gpio); in xgpio_set()
132 xgpio_regoffset(chip, gpio), chip->gpio_state[index]); in xgpio_set()
146 static int xgpio_dir_in(struct gpio_chip *gc, unsigned int gpio) in xgpio_dir_in() argument
152 int index = xgpio_index(chip, gpio); in xgpio_dir_in()
153 int offset = xgpio_offset(chip, gpio); in xgpio_dir_in()
160 xgpio_regoffset(chip, gpio), chip->gpio_dir[index]); in xgpio_dir_in()
179 static int xgpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) in xgpio_dir_out() argument
185 int index = xgpio_index(chip, gpio); in xgpio_dir_out()
186 int offset = xgpio_offset(chip, gpio); in xgpio_dir_out()
196 xgpio_regoffset(chip, gpio), chip->gpio_state[index]); in xgpio_dir_out()
201 xgpio_regoffset(chip, gpio), chip->gpio_dir[index]); in xgpio_dir_out()