Skip to content

Commit accf0d7

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 1d66dcd commit accf0d7

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
@@ -357,6 +357,8 @@ static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
357357
}
358358

359359
static struct gpio_chip atmel_gpio_chip = {
360+
.request = gpiochip_generic_request,
361+
.free = gpiochip_generic_free,
360362
.direction_input = atmel_gpio_direction_input,
361363
.get = atmel_gpio_get,
362364
.direction_output = atmel_gpio_direction_output,
@@ -643,11 +645,27 @@ static int atmel_pmx_set_mux(struct pinctrl_dev *pctldev,
643645
return 0;
644646
}
645647

648+
static int atmel_pmx_gpio_request_enable(struct pinctrl_dev *pctldev,
649+
struct pinctrl_gpio_range *range,
650+
unsigned offset)
651+
{
652+
u32 conf;
653+
654+
conf = atmel_pin_config_read(pctldev, offset);
655+
conf &= (~ATMEL_PIO_CFGR_FUNC_MASK);
656+
atmel_pin_config_write(pctldev, offset, conf);
657+
658+
dev_dbg(pctldev->dev, "enable pin %u as GPIO\n", offset);
659+
660+
return 0;
661+
}
662+
646663
static const struct pinmux_ops atmel_pmxops = {
647664
.get_functions_count = atmel_pmx_get_functions_count,
648665
.get_function_name = atmel_pmx_get_function_name,
649666
.get_function_groups = atmel_pmx_get_function_groups,
650667
.set_mux = atmel_pmx_set_mux,
668+
.gpio_request_enable = atmel_pmx_gpio_request_enable,
651669
};
652670

653671
static int atmel_conf_pin_config_group_get(struct pinctrl_dev *pctldev,

0 commit comments

Comments
 (0)