Lines Matching refs:gpio
7 #include <linux/gpio/driver.h>
23 * offset = (gpio / XLP_GPIO_REGSZ) * 4;
26 * where addr is base address of the that feature register and gpio is the pin.
68 static int xlp_gpio_get_reg(void __iomem *addr, unsigned gpio)
72 pos = gpio % XLP_GPIO_REGSZ;
73 regset = (gpio / XLP_GPIO_REGSZ) * 4;
77 static void xlp_gpio_set_reg(void __iomem *addr, unsigned gpio, int state)
81 pos = gpio % XLP_GPIO_REGSZ;
82 regset = (gpio / XLP_GPIO_REGSZ) * 4;
186 int gpio, regoff;
193 for_each_set_bit(gpio, priv->gpio_enabled_mask, XLP_MAX_NR_GPIO) {
194 if (regoff != gpio / XLP_GPIO_REGSZ) {
195 regoff = gpio / XLP_GPIO_REGSZ;
199 if (gpio_stat & BIT(gpio % XLP_GPIO_REGSZ))
200 generic_handle_domain_irq(priv->chip.irq.domain, gpio);
205 static int xlp_gpio_dir_output(struct gpio_chip *gc, unsigned gpio, int state)
209 BUG_ON(gpio >= gc->ngpio);
210 xlp_gpio_set_reg(priv->gpio_out_en, gpio, 0x1);
215 static int xlp_gpio_dir_input(struct gpio_chip *gc, unsigned gpio)
219 BUG_ON(gpio >= gc->ngpio);
220 xlp_gpio_set_reg(priv->gpio_out_en, gpio, 0x0);
225 static int xlp_gpio_get(struct gpio_chip *gc, unsigned gpio)
229 BUG_ON(gpio >= gc->ngpio);
230 return xlp_gpio_get_reg(priv->gpio_paddrv, gpio);
233 static void xlp_gpio_set(struct gpio_chip *gc, unsigned gpio, int state)
237 BUG_ON(gpio >= gc->ngpio);
238 xlp_gpio_set_reg(priv->gpio_paddrv, gpio, state);
318 .name = "xlp-gpio",