]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - drivers/pinctrl/pinctrl-bcm2835.c
pinctrl: Pass all configs to driver on pin_config_set()
[mirror_ubuntu-jammy-kernel.git] / drivers / pinctrl / pinctrl-bcm2835.c
index a1c88b30f71f9aafa603860592e05a06df4a896d..c05c1ef2cc3c8526a886ccefb3f874f795b40807 100644 (file)
@@ -893,28 +893,35 @@ static int bcm2835_pinconf_get(struct pinctrl_dev *pctldev,
 }
 
 static int bcm2835_pinconf_set(struct pinctrl_dev *pctldev,
-                       unsigned pin, unsigned long config)
+                       unsigned pin, unsigned long *configs,
+                       unsigned num_configs)
 {
        struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev);
-       enum bcm2835_pinconf_param param = BCM2835_PINCONF_UNPACK_PARAM(config);
-       u16 arg = BCM2835_PINCONF_UNPACK_ARG(config);
+       enum bcm2835_pinconf_param param;
+       u16 arg;
        u32 off, bit;
+       int i;
 
-       if (param != BCM2835_PINCONF_PARAM_PULL)
-               return -EINVAL;
-
-       off = GPIO_REG_OFFSET(pin);
-       bit = GPIO_REG_SHIFT(pin);
-
-       bcm2835_gpio_wr(pc, GPPUD, arg & 3);
-       /*
-        * Docs say to wait 150 cycles, but not of what. We assume a
-        * 1 MHz clock here, which is pretty slow...
-        */
-       udelay(150);
-       bcm2835_gpio_wr(pc, GPPUDCLK0 + (off * 4), BIT(bit));
-       udelay(150);
-       bcm2835_gpio_wr(pc, GPPUDCLK0 + (off * 4), 0);
+       for (i = 0; i < num_configs; i++) {
+               param = BCM2835_PINCONF_UNPACK_PARAM(configs[i]);
+               arg = BCM2835_PINCONF_UNPACK_ARG(configs[i]);
+
+               if (param != BCM2835_PINCONF_PARAM_PULL)
+                       return -EINVAL;
+
+               off = GPIO_REG_OFFSET(pin);
+               bit = GPIO_REG_SHIFT(pin);
+
+               bcm2835_gpio_wr(pc, GPPUD, arg & 3);
+               /*
+                * Docs say to wait 150 cycles, but not of what. We assume a
+                * 1 MHz clock here, which is pretty slow...
+                */
+               udelay(150);
+               bcm2835_gpio_wr(pc, GPPUDCLK0 + (off * 4), BIT(bit));
+               udelay(150);
+               bcm2835_gpio_wr(pc, GPPUDCLK0 + (off * 4), 0);
+       } /* for each config */
 
        return 0;
 }