summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-at91-pio4.c
diff options
context:
space:
mode:
authorRyan Wanner <Ryan.Wanner@microchip.com>2022-10-07 17:16:46 +0200
committerLinus Walleij <linus.walleij@linaro.org>2022-10-17 11:56:16 +0200
commitfcd7631748575706210ef05a787fccbeb4d79898 (patch)
treee716fcd3590fd09aa72d633d11abe1cc76ee628e /drivers/pinctrl/pinctrl-at91-pio4.c
parentpinctrl: mt7986: allow configuring uart rx/tx and rts/cts separately (diff)
downloadlinux-fcd7631748575706210ef05a787fccbeb4d79898.tar.xz
linux-fcd7631748575706210ef05a787fccbeb4d79898.zip
pinctrl: at91-pio4: Add configuration to userspace
Adding support for line bias flags that have been implented in gpio API. There are functions in the gpiod library that can control line bias from userspace this adds that functionality to this driver. Adding .pin_config_set allows the driver's pin configuration to be accessed from userspace. The general idea for this as been taken from stm32, intel, and rockchip drivers that have userspace access for bias flags. Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com> Tested-by: Nicolas Ferre <nicolas.ferre@microchip.com> # on sama5d27 som1 ek Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Tested-by: Nicolas Ferre <nicolas.ferre@microchip.com> Link: https://lore.kernel.org/r/20221007151647.98222-2-Ryan.Wanner@microchip.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-at91-pio4.c')
-rw-r--r--drivers/pinctrl/pinctrl-at91-pio4.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index 82b921fd630d..a7383b9a309e 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -897,6 +897,25 @@ static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
return 0;
}
+static int atmel_conf_pin_config_set(struct pinctrl_dev *pctldev,
+ unsigned pin,
+ unsigned long *configs,
+ unsigned num_configs)
+{
+ struct atmel_group *grp = atmel_pctl_find_group_by_pin(pctldev, pin);
+
+ return atmel_conf_pin_config_group_set(pctldev, grp->pin, configs, num_configs);
+}
+
+static int atmel_conf_pin_config_get(struct pinctrl_dev *pctldev,
+ unsigned pin,
+ unsigned long *configs)
+{
+ struct atmel_group *grp = atmel_pctl_find_group_by_pin(pctldev, pin);
+
+ return atmel_conf_pin_config_group_get(pctldev, grp->pin, configs);
+}
+
static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev,
struct seq_file *s,
unsigned int pin_id)
@@ -944,6 +963,8 @@ static const struct pinconf_ops atmel_confops = {
.pin_config_group_get = atmel_conf_pin_config_group_get,
.pin_config_group_set = atmel_conf_pin_config_group_set,
.pin_config_dbg_show = atmel_conf_pin_config_dbg_show,
+ .pin_config_set = atmel_conf_pin_config_set,
+ .pin_config_get = atmel_conf_pin_config_get,
};
static struct pinctrl_desc atmel_pinctrl_desc = {
@@ -1134,6 +1155,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
atmel_pioctrl->gpio_chip->label = dev_name(dev);
atmel_pioctrl->gpio_chip->parent = dev;
atmel_pioctrl->gpio_chip->names = atmel_pioctrl->group_names;
+ atmel_pioctrl->gpio_chip->set_config = gpiochip_generic_config;
atmel_pioctrl->pm_wakeup_sources = devm_kcalloc(dev,
atmel_pioctrl->nbanks,