pinctrl: Add pingroup and define PINCTRL_PINGROUP
authorBasavaraj Natikar <Basavaraj.Natikar@amd.com>
Wed, 1 Jun 2022 15:28:55 +0000 (20:58 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 15 Jun 2022 13:54:20 +0000 (15:54 +0200)
Add 'struct pingroup' to represent pingroup and 'PINCTRL_PINGROUP'
macro for inline use. Both are used to manage and represent
larger number of pingroups.

Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220601152900.1012813-2-Basavaraj.Natikar@amd.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
include/linux/pinctrl/pinctrl.h

index 70b45d28e7a9293bc733d13f6241f770f359e3f9..487117ccb1bc26713a11147bf6d623df6145825a 100644 (file)
@@ -26,6 +26,26 @@ struct pin_config_item;
 struct gpio_chip;
 struct device_node;
 
+/**
+ * struct pingroup - provides information on pingroup
+ * @name: a name for pingroup
+ * @pins: an array of pins in the pingroup
+ * @npins: number of pins in the pingroup
+ */
+struct pingroup {
+       const char *name;
+       const unsigned int *pins;
+       size_t npins;
+};
+
+/* Convenience macro to define a single named or anonymous pingroup */
+#define PINCTRL_PINGROUP(_name, _pins, _npins) \
+(struct pingroup){                             \
+       .name = _name,                          \
+       .pins = _pins,                          \
+       .npins = _npins,                        \
+}
+
 /**
  * struct pinctrl_pin_desc - boards/machines provide information on their
  * pins, pads or other muxable units in this struct