Lines Matching defs:offset
207 static int twl_request(struct gpio_chip *chip, unsigned offset)
215 if (offset >= TWL4030_GPIO_MAX) {
220 offset -= TWL4030_GPIO_MAX;
221 if (offset) {
269 priv->usage_count |= BIT(offset);
275 static void twl_free(struct gpio_chip *chip, unsigned offset)
280 if (offset >= TWL4030_GPIO_MAX) {
281 twl4030_led_set_value(offset - TWL4030_GPIO_MAX, 1);
285 priv->usage_count &= ~BIT(offset);
295 static int twl_direction_in(struct gpio_chip *chip, unsigned offset)
301 if (offset < TWL4030_GPIO_MAX)
302 ret = twl4030_set_gpio_direction(offset, 1);
307 priv->direction &= ~BIT(offset);
314 static int twl_get(struct gpio_chip *chip, unsigned offset)
321 if (!(priv->usage_count & BIT(offset))) {
326 if (priv->direction & BIT(offset))
327 status = priv->out_state & BIT(offset);
329 status = twl4030_get_gpio_datain(offset);
337 static void twl_set(struct gpio_chip *chip, unsigned offset, int value)
342 if (offset < TWL4030_GPIO_MAX)
343 twl4030_set_gpio_dataout(offset, value);
345 twl4030_led_set_value(offset - TWL4030_GPIO_MAX, value);
348 priv->out_state |= BIT(offset);
350 priv->out_state &= ~BIT(offset);
355 static int twl_direction_out(struct gpio_chip *chip, unsigned offset, int value)
361 if (offset < TWL4030_GPIO_MAX) {
362 ret = twl4030_set_gpio_direction(offset, 0);
370 * LED gpios i.e. offset >= TWL4030_GPIO_MAX are always output
373 priv->direction |= BIT(offset);
376 twl_set(chip, offset, value);
381 static int twl_get_direction(struct gpio_chip *chip, unsigned offset)
391 if (offset < TWL4030_GPIO_MAX) {
392 ret = twl4030_get_gpio_direction(offset);
403 static int twl_to_irq(struct gpio_chip *chip, unsigned offset)
407 return (priv->irq_base && (offset < TWL4030_GPIO_MAX))
408 ? (priv->irq_base + offset)