aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeert Uytterhoeven <[email protected]>2021-12-23 15:41:15 +0100
committerGeert Uytterhoeven <[email protected]>2022-02-22 09:55:56 +0100
commit49a7a2742580ccd6194fc2bb26e6777cba9cac58 (patch)
treed835bc7d780833f541fa7931e1aa2b7367dacfb7
parenta0894be3e017c009736e648887579e363f3b6ed1 (diff)
pinctrl: renesas: Add generic support for pin group subsets
It is fairly common for the pins in a pin group to be a subset of the pins in another pin group. Add a macro for defining a pin group that refers to a subset of an array of pins. This allows pin groups to share pin data, and thus save memory. Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/b56c4257aee1eab698bae2cf7a08aa05775c0a77.1640269757.git.geert+renesas@glider.be
-rw-r--r--drivers/pinctrl/renesas/sh_pfc.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/pinctrl/renesas/sh_pfc.h b/drivers/pinctrl/renesas/sh_pfc.h
index d6292a79282f..6f7fe21c982e 100644
--- a/drivers/pinctrl/renesas/sh_pfc.h
+++ b/drivers/pinctrl/renesas/sh_pfc.h
@@ -58,6 +58,18 @@ struct sh_pfc_pin {
}
#define SH_PFC_PIN_GROUP(name) SH_PFC_PIN_GROUP_ALIAS(name, name)
+/*
+ * Define a pin group referring to a subset of an array of pins.
+ */
+#define SH_PFC_PIN_GROUP_SUBSET(_name, data, first, n) { \
+ .name = #_name, \
+ .pins = data##_pins + first, \
+ .mux = data##_mux + first, \
+ .nr_pins = n + \
+ BUILD_BUG_ON_ZERO(first + n > ARRAY_SIZE(data##_pins)) + \
+ BUILD_BUG_ON_ZERO(first + n > ARRAY_SIZE(data##_mux)), \
+}
+
struct sh_pfc_pin_group {
const char *name;
const unsigned int *pins;