linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/8] pinctrl: Introduce struct pinfunction and PINCTRL_PINFUNCTION() macro
@ 2022-12-19 12:42 Andy Shevchenko
  2022-12-19 12:42 ` [PATCH v1 2/8] pinctrl: intel: Make use of struct pinfunction and PINCTRL_PINFUNCTION() Andy Shevchenko
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Andy Shevchenko @ 2022-12-19 12:42 UTC (permalink / raw)
  To: Andy Shevchenko, Mika Westerberg, linux-gpio, linux-kernel
  Cc: Andy Shevchenko, Linus Walleij

There are many pin control drivers define their own data type for
pin function representation which is the same or embed the same data
as newly introduced one. Provide the data type and convenient macro
for all pin control drivers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/pinctrl/pinctrl.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index a0d39b303431..4d252ea00ed1 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -206,6 +206,26 @@ extern int pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
 				const char *pin_group, const unsigned **pins,
 				unsigned *num_pins);
 
+/**
+ * struct pinfunction - Description about a function
+ * @name: Name of the function
+ * @groups: An array of groups for this function
+ * @ngroups: Number of groups in @groups
+ */
+struct pinfunction {
+	const char *name;
+	const char * const *groups;
+	size_t ngroups;
+};
+
+/* Convenience macro to define a single named pinfunction */
+#define PINCTRL_PINFUNCTION(_name, _groups, _ngroups)	\
+(struct pinfunction) {					\
+		.name = (_name),			\
+		.groups = (_groups),			\
+		.ngroups = (_ngroups),			\
+	}
+
 #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_PINCTRL)
 extern struct pinctrl_dev *of_pinctrl_get(struct device_node *np);
 #else
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-12-29 21:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-19 12:42 [PATCH v1 1/8] pinctrl: Introduce struct pinfunction and PINCTRL_PINFUNCTION() macro Andy Shevchenko
2022-12-19 12:42 ` [PATCH v1 2/8] pinctrl: intel: Make use of struct pinfunction and PINCTRL_PINFUNCTION() Andy Shevchenko
2022-12-19 12:42 ` [PATCH v1 3/8] pinctrl: baytrail: Convert to use new memeber in struct intel_function Andy Shevchenko
2022-12-19 12:42 ` [PATCH v1 4/8] pinctrl: cherryview: " Andy Shevchenko
2022-12-19 12:42 ` [PATCH v1 5/8] pinctrl: lynxpoint: " Andy Shevchenko
2022-12-19 12:42 ` [PATCH v1 6/8] pinctrl: merrifield: " Andy Shevchenko
2022-12-19 12:42 ` [PATCH v1 7/8] pinctrl: moorefield: " Andy Shevchenko
2022-12-19 12:42 ` [PATCH v1 8/8] pinctrl: intel: Get rid of unused members " Andy Shevchenko
2022-12-19 14:42 ` [PATCH v1 1/8] pinctrl: Introduce struct pinfunction and PINCTRL_PINFUNCTION() macro Andy Shevchenko
2022-12-20  6:20   ` Mika Westerberg
2022-12-27 21:46     ` Andy Shevchenko
2022-12-29 21:17 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).