Lines Matching refs:offset
31 #define DA9062_TYPE(offset) (4 * (offset % 2)) argument
32 #define DA9062_PIN_SHIFT(offset) (4 * (offset % 2)) argument
46 unsigned int offset) in da9062_pctl_get_pin_mode() argument
51 ret = regmap_read(regmap, DA9062AA_GPIO_0_1 + (offset >> 1), &val); in da9062_pctl_get_pin_mode()
55 val >>= DA9062_PIN_SHIFT(offset); in da9062_pctl_get_pin_mode()
62 unsigned int offset, unsigned int mode_req) in da9062_pctl_set_pin_mode() argument
70 mode <<= DA9062_PIN_SHIFT(offset); in da9062_pctl_set_pin_mode()
71 mask = DA9062AA_GPIO0_PIN_MASK << DA9062_PIN_SHIFT(offset); in da9062_pctl_set_pin_mode()
73 ret = regmap_update_bits(regmap, DA9062AA_GPIO_0_1 + (offset >> 1), in da9062_pctl_set_pin_mode()
76 pctl->pin_config[offset] = mode_req; in da9062_pctl_set_pin_mode()
81 static int da9062_gpio_get(struct gpio_chip *gc, unsigned int offset) in da9062_gpio_get() argument
88 gpio_mode = da9062_pctl_get_pin_mode(pctl, offset); in da9062_gpio_get()
107 return !!(val & BIT(offset)); in da9062_gpio_get()
110 static void da9062_gpio_set(struct gpio_chip *gc, unsigned int offset, in da9062_gpio_set() argument
116 regmap_update_bits(regmap, DA9062AA_GPIO_MODE0_4, BIT(offset), in da9062_gpio_set()
117 value << offset); in da9062_gpio_set()
120 static int da9062_gpio_get_direction(struct gpio_chip *gc, unsigned int offset) in da9062_gpio_get_direction() argument
125 gpio_mode = da9062_pctl_get_pin_mode(pctl, offset); in da9062_gpio_get_direction()
143 unsigned int offset) in da9062_gpio_direction_input() argument
147 struct gpio_desc *desc = gpiochip_get_desc(gc, offset); in da9062_gpio_direction_input()
151 ret = da9062_pctl_set_pin_mode(pctl, offset, DA9062_PIN_GPI); in da9062_gpio_direction_input()
164 return regmap_update_bits(regmap, DA9062AA_GPIO_0_1 + (offset >> 1), in da9062_gpio_direction_input()
165 DA9062AA_GPIO0_TYPE_MASK << DA9062_TYPE(offset), in da9062_gpio_direction_input()
166 gpi_type << DA9062_TYPE(offset)); in da9062_gpio_direction_input()
170 unsigned int offset, int value) in da9062_gpio_direction_output() argument
173 unsigned int pin_config = pctl->pin_config[offset]; in da9062_gpio_direction_output()
176 ret = da9062_pctl_set_pin_mode(pctl, offset, pin_config); in da9062_gpio_direction_output()
180 da9062_gpio_set(gc, offset, value); in da9062_gpio_direction_output()
185 static int da9062_gpio_set_config(struct gpio_chip *gc, unsigned int offset, in da9062_gpio_set_config() argument
203 BIT(offset), 0); in da9062_gpio_set_config()
205 gpio_mode = da9062_pctl_get_pin_mode(pctl, offset); in da9062_gpio_set_config()
211 BIT(offset), BIT(offset)); in da9062_gpio_set_config()
213 gpio_mode = da9062_pctl_get_pin_mode(pctl, offset); in da9062_gpio_set_config()
219 BIT(offset), BIT(offset)); in da9062_gpio_set_config()
221 return da9062_pctl_set_pin_mode(pctl, offset, in da9062_gpio_set_config()
224 return da9062_pctl_set_pin_mode(pctl, offset, in da9062_gpio_set_config()
231 static int da9062_gpio_to_irq(struct gpio_chip *gc, unsigned int offset) in da9062_gpio_to_irq() argument
237 DA9062_IRQ_GPI0 + offset); in da9062_gpio_to_irq()