Skip to content

Commit 55f8f2b

Browse files
committed
pinctrl: at91-pio4: allow gpio subsytem to request gpios
gpiolib requests are no longer ignored. Be careful that the strict mode is not enabled. As a conseguence, gpio requests can overlap peripheral pinmuxing. Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
1 parent df15d55 commit 55f8f2b

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

drivers/pinctrl/pinctrl-at91-pio4.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
368368
}
369369

370370
static struct gpio_chip atmel_gpio_chip = {
371+
.request = gpiochip_generic_request,
372+
.free = gpiochip_generic_free,
371373
.direction_input = atmel_gpio_direction_input,
372374
.get = atmel_gpio_get,
373375
.direction_output = atmel_gpio_direction_output,
@@ -653,11 +655,27 @@ static int atmel_pmx_set_mux(struct pinctrl_dev *pctldev,
653655
return 0;
654656
}
655657

658+
static int atmel_pmx_gpio_request_enable(struct pinctrl_dev *pctldev,
659+
struct pinctrl_gpio_range *range,
660+
unsigned offset)
661+
{
662+
u32 conf;
663+
664+
conf = atmel_pin_config_read(pctldev, offset);
665+
conf &= (~ATMEL_PIO_CFGR_FUNC_MASK);
666+
atmel_pin_config_write(pctldev, offset, conf);
667+
668+
dev_dbg(pctldev->dev, "enable pin %u as GPIO\n", offset);
669+
670+
return 0;
671+
}
672+
656673
static const struct pinmux_ops atmel_pmxops = {
657674
.get_functions_count = atmel_pmx_get_functions_count,
658675
.get_function_name = atmel_pmx_get_function_name,
659676
.get_function_groups = atmel_pmx_get_function_groups,
660677
.set_mux = atmel_pmx_set_mux,
678+
.gpio_request_enable = atmel_pmx_gpio_request_enable,
661679
};
662680

663681
static int atmel_conf_pin_config_group_get(struct pinctrl_dev *pctldev,

0 commit comments

Comments
 (0)