Lines Matching refs:offset
333 static int bcm2835_gpio_request(struct gpio_chip *chip, unsigned offset) in bcm2835_gpio_request() argument
335 return pinctrl_request_gpio(chip->base + offset); in bcm2835_gpio_request()
338 static void bcm2835_gpio_free(struct gpio_chip *chip, unsigned offset) in bcm2835_gpio_free() argument
340 pinctrl_free_gpio(chip->base + offset); in bcm2835_gpio_free()
343 static int bcm2835_gpio_direction_input(struct gpio_chip *chip, unsigned offset) in bcm2835_gpio_direction_input() argument
345 return pinctrl_gpio_direction_input(chip->base + offset); in bcm2835_gpio_direction_input()
348 static int bcm2835_gpio_get(struct gpio_chip *chip, unsigned offset) in bcm2835_gpio_get() argument
352 return bcm2835_gpio_get_bit(pc, GPLEV0, offset); in bcm2835_gpio_get()
356 unsigned offset, int value) in bcm2835_gpio_direction_output() argument
358 return pinctrl_gpio_direction_output(chip->base + offset); in bcm2835_gpio_direction_output()
361 static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) in bcm2835_gpio_set() argument
365 bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset); in bcm2835_gpio_set()
368 static int bcm2835_gpio_to_irq(struct gpio_chip *chip, unsigned offset) in bcm2835_gpio_to_irq() argument
372 return irq_linear_revmap(pc->irq_domain, offset); in bcm2835_gpio_to_irq()
396 unsigned offset; in bcm2835_gpio_irq_handler() local
402 for_each_set_bit(offset, &events, 32) { in bcm2835_gpio_irq_handler()
403 gpio = (32 * bank) + offset; in bcm2835_gpio_irq_handler()
412 unsigned reg, unsigned offset, bool enable) in __bcm2835_gpio_irq_config() argument
415 reg += GPIO_REG_OFFSET(offset) * 4; in __bcm2835_gpio_irq_config()
418 value |= BIT(GPIO_REG_SHIFT(offset)); in __bcm2835_gpio_irq_config()
420 value &= ~(BIT(GPIO_REG_SHIFT(offset))); in __bcm2835_gpio_irq_config()
426 unsigned offset, bool enable) in bcm2835_gpio_irq_config() argument
428 switch (pc->irq_type[offset]) { in bcm2835_gpio_irq_config()
430 __bcm2835_gpio_irq_config(pc, GPREN0, offset, enable); in bcm2835_gpio_irq_config()
434 __bcm2835_gpio_irq_config(pc, GPFEN0, offset, enable); in bcm2835_gpio_irq_config()
438 __bcm2835_gpio_irq_config(pc, GPREN0, offset, enable); in bcm2835_gpio_irq_config()
439 __bcm2835_gpio_irq_config(pc, GPFEN0, offset, enable); in bcm2835_gpio_irq_config()
443 __bcm2835_gpio_irq_config(pc, GPHEN0, offset, enable); in bcm2835_gpio_irq_config()
447 __bcm2835_gpio_irq_config(pc, GPLEN0, offset, enable); in bcm2835_gpio_irq_config()
456 unsigned offset = GPIO_REG_SHIFT(gpio); in bcm2835_gpio_irq_enable() local
461 set_bit(offset, &pc->enabled_irq_map[bank]); in bcm2835_gpio_irq_enable()
470 unsigned offset = GPIO_REG_SHIFT(gpio); in bcm2835_gpio_irq_disable() local
476 clear_bit(offset, &pc->enabled_irq_map[bank]); in bcm2835_gpio_irq_disable()
481 unsigned offset, unsigned int type) in __bcm2835_gpio_irq_set_type_disabled() argument
490 pc->irq_type[offset] = type; in __bcm2835_gpio_irq_set_type_disabled()
501 unsigned offset, unsigned int type) in __bcm2835_gpio_irq_set_type_enabled() argument
505 if (pc->irq_type[offset] != type) { in __bcm2835_gpio_irq_set_type_enabled()
506 bcm2835_gpio_irq_config(pc, offset, false); in __bcm2835_gpio_irq_set_type_enabled()
507 pc->irq_type[offset] = type; in __bcm2835_gpio_irq_set_type_enabled()
512 if (pc->irq_type[offset] == IRQ_TYPE_EDGE_BOTH) { in __bcm2835_gpio_irq_set_type_enabled()
514 pc->irq_type[offset] = IRQ_TYPE_EDGE_FALLING; in __bcm2835_gpio_irq_set_type_enabled()
515 bcm2835_gpio_irq_config(pc, offset, false); in __bcm2835_gpio_irq_set_type_enabled()
516 pc->irq_type[offset] = type; in __bcm2835_gpio_irq_set_type_enabled()
517 } else if (pc->irq_type[offset] != type) { in __bcm2835_gpio_irq_set_type_enabled()
518 bcm2835_gpio_irq_config(pc, offset, false); in __bcm2835_gpio_irq_set_type_enabled()
519 pc->irq_type[offset] = type; in __bcm2835_gpio_irq_set_type_enabled()
520 bcm2835_gpio_irq_config(pc, offset, true); in __bcm2835_gpio_irq_set_type_enabled()
525 if (pc->irq_type[offset] == IRQ_TYPE_EDGE_BOTH) { in __bcm2835_gpio_irq_set_type_enabled()
527 pc->irq_type[offset] = IRQ_TYPE_EDGE_RISING; in __bcm2835_gpio_irq_set_type_enabled()
528 bcm2835_gpio_irq_config(pc, offset, false); in __bcm2835_gpio_irq_set_type_enabled()
529 pc->irq_type[offset] = type; in __bcm2835_gpio_irq_set_type_enabled()
530 } else if (pc->irq_type[offset] != type) { in __bcm2835_gpio_irq_set_type_enabled()
531 bcm2835_gpio_irq_config(pc, offset, false); in __bcm2835_gpio_irq_set_type_enabled()
532 pc->irq_type[offset] = type; in __bcm2835_gpio_irq_set_type_enabled()
533 bcm2835_gpio_irq_config(pc, offset, true); in __bcm2835_gpio_irq_set_type_enabled()
538 if (pc->irq_type[offset] == IRQ_TYPE_EDGE_RISING) { in __bcm2835_gpio_irq_set_type_enabled()
540 pc->irq_type[offset] = IRQ_TYPE_EDGE_FALLING; in __bcm2835_gpio_irq_set_type_enabled()
541 bcm2835_gpio_irq_config(pc, offset, true); in __bcm2835_gpio_irq_set_type_enabled()
542 pc->irq_type[offset] = type; in __bcm2835_gpio_irq_set_type_enabled()
543 } else if (pc->irq_type[offset] == IRQ_TYPE_EDGE_FALLING) { in __bcm2835_gpio_irq_set_type_enabled()
545 pc->irq_type[offset] = IRQ_TYPE_EDGE_RISING; in __bcm2835_gpio_irq_set_type_enabled()
546 bcm2835_gpio_irq_config(pc, offset, true); in __bcm2835_gpio_irq_set_type_enabled()
547 pc->irq_type[offset] = type; in __bcm2835_gpio_irq_set_type_enabled()
548 } else if (pc->irq_type[offset] != type) { in __bcm2835_gpio_irq_set_type_enabled()
549 bcm2835_gpio_irq_config(pc, offset, false); in __bcm2835_gpio_irq_set_type_enabled()
550 pc->irq_type[offset] = type; in __bcm2835_gpio_irq_set_type_enabled()
551 bcm2835_gpio_irq_config(pc, offset, true); in __bcm2835_gpio_irq_set_type_enabled()
557 if (pc->irq_type[offset] != type) { in __bcm2835_gpio_irq_set_type_enabled()
558 bcm2835_gpio_irq_config(pc, offset, false); in __bcm2835_gpio_irq_set_type_enabled()
559 pc->irq_type[offset] = type; in __bcm2835_gpio_irq_set_type_enabled()
560 bcm2835_gpio_irq_config(pc, offset, true); in __bcm2835_gpio_irq_set_type_enabled()
574 unsigned offset = GPIO_REG_SHIFT(gpio); in bcm2835_gpio_irq_set_type() local
581 if (test_bit(offset, &pc->enabled_irq_map[bank])) in bcm2835_gpio_irq_set_type()
638 unsigned offset) in bcm2835_pctl_pin_dbg_show() argument
641 enum bcm2835_fsel fsel = bcm2835_pinctrl_fsel_get(pc, offset); in bcm2835_pctl_pin_dbg_show()
643 int value = bcm2835_gpio_get_bit(pc, GPLEV0, offset); in bcm2835_pctl_pin_dbg_show()
644 int irq = irq_find_mapping(pc->irq_domain, offset); in bcm2835_pctl_pin_dbg_show()
648 irq, irq_type_names[pc->irq_type[offset]]); in bcm2835_pctl_pin_dbg_show()
854 unsigned offset) in bcm2835_pmx_gpio_disable_free() argument
859 bcm2835_pinctrl_fsel_set(pc, offset, BCM2835_FSEL_GPIO_IN); in bcm2835_pmx_gpio_disable_free()
864 unsigned offset, in bcm2835_pmx_gpio_set_direction() argument
871 bcm2835_pinctrl_fsel_set(pc, offset, fsel); in bcm2835_pmx_gpio_set_direction()
995 unsigned offset; in bcm2835_pinctrl_probe() local
1009 for_each_set_bit(offset, &events, 32) in bcm2835_pinctrl_probe()
1010 bcm2835_gpio_wr(pc, GPEDS0 + i * 4, BIT(offset)); in bcm2835_pinctrl_probe()