Skip to contentSkip to conversation

pinctrl: intel: Introduce INTEL_COMMUNITY_*() to unify community macros

PATCH In review Andy Shevchenko 2 participants 21 messages Dec 19, 2022 – Dec 28, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/17 pinctrl: intel: Introduce INTEL_COMMUNITY_*() to unify community macros

Now it becomes visible that we can deduplicate SoC specific *_COMMUNITY() macros across the Intel pin control drivers. For that, introduce a common INTEL_COMMUNITY_GPPS() and INTEL_COMMUNITY_SIZE() macros in the pinctrl-intel.h.

---
 drivers/pinctrl/intel/pinctrl-intel.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
drivers/pinctrl/intel/pinctrl-intel.h +22 -0
index 65628423bf63..b0f2be4c1fd1 100644
@@ -143,6 +143,28 @@ struct intel_community {
 #define PINCTRL_FEATURE_BLINK		BIT(4)
 #define PINCTRL_FEATURE_EXP		BIT(5)
 
+#define __INTEL_COMMUNITY(b, s, e, g, n, gs, gn, soc)		\
+	{							\
+		.barno = (b),					\
+		.padown_offset = soc ## _PAD_OWN,		\
+		.padcfglock_offset = soc ## _PADCFGLOCK,	\
+		.hostown_offset = soc ## _HOSTSW_OWN,		\
+		.is_offset = soc ## _GPI_IS,			\
+		.ie_offset = soc ## _GPI_IE,			\
+		.gpp_size = (gs),				\
+		.gpp_num_padown_regs = (gn),			\
+		.pin_base = (s),				\
+		.npins = ((e) - (s) + 1),			\
+		.gpps = (g),					\
+		.ngpps = (n),					\
+	}
+
+#define INTEL_COMMUNITY_GPPS(b, s, e, g, soc)			\
+	__INTEL_COMMUNITY(b, s, e, g, ARRAY_SIZE(g), 0, 0, soc)
+
+#define INTEL_COMMUNITY_SIZE(b, s, e, gs, gn, soc)		\
+	__INTEL_COMMUNITY(b, s, e, NULL, 0, gs, gn, soc)
+
 /**
  * PIN_GROUP - Declare a pin group
  * @n: Name of the group
Signature · 1 line
2.35.1
#1 lore raw

PATCH 2/17 pinctrl: alderlake: Replace ADL_COMMUNITY() by INTEL_COMMUNITY_GPPS()

Use INTEL_COMMUNITY_GPPS() common macro instead custom ADL_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-alderlake.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)
drivers/pinctrl/intel/pinctrl-alderlake.c +2 -16
index 427febe09b69..55bbfd647ba4 100644
@@ -34,25 +34,11 @@
 		.gpio_base = (g),			\
 	}
 
-#define ADL_COMMUNITY(b, s, e, g, v)				\
-	{							\
-		.barno = (b),					\
-		.padown_offset = ADL_##v##_PAD_OWN,		\
-		.padcfglock_offset = ADL_##v##_PADCFGLOCK,	\
-		.hostown_offset = ADL_##v##_HOSTSW_OWN,		\
-		.is_offset = ADL_##v##_GPI_IS,			\
-		.ie_offset = ADL_##v##_GPI_IE,			\
-		.pin_base = (s),				\
-		.npins = ((e) - (s) + 1),			\
-		.gpps = (g),					\
-		.ngpps = ARRAY_SIZE(g),				\
-	}
-
 #define ADL_N_COMMUNITY(b, s, e, g)			\
-	ADL_COMMUNITY(b, s, e, g, N)
+	INTEL_COMMUNITY_GPPS(b, s, e, g, ADL_N)
 
 #define ADL_S_COMMUNITY(b, s, e, g)			\
-	ADL_COMMUNITY(b, s, e, g, S)
+	INTEL_COMMUNITY_GPPS(b, s, e, g, ADL_S)
 
 /* Alder Lake-N */
 static const struct pinctrl_pin_desc adln_pins[] = {
Signature · 1 line
2.35.1
#2 lore raw

PATCH 3/17 pinctrl: broxton: Replace BXT_COMMUNITY() by INTEL_COMMUNITY_SIZE()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_SIZE() common macro instead custom BXT_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-broxton.c | 31 +++++++++----------------
 1 file changed, 11 insertions(+), 20 deletions(-)
drivers/pinctrl/intel/pinctrl-broxton.c +11 -20
index fb15cd10a32f..77e921b2178d 100644
@@ -20,17 +20,8 @@
 #define BXT_GPI_IS	0x100
 #define BXT_GPI_IE	0x110
 
-#define BXT_COMMUNITY(s, e)				\
-	{						\
-		.padown_offset = BXT_PAD_OWN,		\
-		.padcfglock_offset = BXT_PADCFGLOCK,	\
-		.hostown_offset = BXT_HOSTSW_OWN,	\
-		.is_offset = BXT_GPI_IS,		\
-		.ie_offset = BXT_GPI_IE,		\
-		.gpp_size = 32,                         \
-		.pin_base = (s),			\
-		.npins = ((e) - (s) + 1),		\
-	}
+#define BXT_COMMUNITY(b, s, e)				\
+	INTEL_COMMUNITY_SIZE(b, s, e, 32, 4, BXT)
 
 /* BXT */
 static const struct pinctrl_pin_desc bxt_north_pins[] = {
@@ -172,7 +163,7 @@ static const struct intel_function bxt_north_functions[] = {
 };
 
 static const struct intel_community bxt_north_communities[] = {
-	BXT_COMMUNITY(0, 82),
+	BXT_COMMUNITY(0, 0, 82),
 };
 
 static const struct intel_pinctrl_soc_data bxt_north_soc_data = {
@@ -289,7 +280,7 @@ static const struct intel_function bxt_northwest_functions[] = {
 };
 
 static const struct intel_community bxt_northwest_communities[] = {
-	BXT_COMMUNITY(0, 71),
+	BXT_COMMUNITY(0, 0, 71),
 };
 
 static const struct intel_pinctrl_soc_data bxt_northwest_soc_data = {
@@ -396,7 +387,7 @@ static const struct intel_function bxt_west_functions[] = {
 };
 
 static const struct intel_community bxt_west_communities[] = {
-	BXT_COMMUNITY(0, 41),
+	BXT_COMMUNITY(0, 0, 41),
 };
 
 static const struct intel_pinctrl_soc_data bxt_west_soc_data = {
@@ -472,7 +463,7 @@ static const struct intel_function bxt_southwest_functions[] = {
 };
 
 static const struct intel_community bxt_southwest_communities[] = {
-	BXT_COMMUNITY(0, 30),
+	BXT_COMMUNITY(0, 0, 30),
 };
 
 static const struct intel_pinctrl_soc_data bxt_southwest_soc_data = {
@@ -511,7 +502,7 @@ static const struct pinctrl_pin_desc bxt_south_pins[] = {
 };
 
 static const struct intel_community bxt_south_communities[] = {
-	BXT_COMMUNITY(0, 19),
+	BXT_COMMUNITY(0, 0, 19),
 };
 
 static const struct intel_pinctrl_soc_data bxt_south_soc_data = {
@@ -650,7 +641,7 @@ static const struct intel_function apl_north_functions[] = {
 };
 
 static const struct intel_community apl_north_communities[] = {
-	BXT_COMMUNITY(0, 77),
+	BXT_COMMUNITY(0, 0, 77),
 };
 
 static const struct intel_pinctrl_soc_data apl_north_soc_data = {
@@ -770,7 +761,7 @@ static const struct intel_function apl_northwest_functions[] = {
 };
 
 static const struct intel_community apl_northwest_communities[] = {
-	BXT_COMMUNITY(0, 76),
+	BXT_COMMUNITY(0, 0, 76),
 };
 
 static const struct intel_pinctrl_soc_data apl_northwest_soc_data = {
@@ -880,7 +871,7 @@ static const struct intel_function apl_west_functions[] = {
 };
 
 static const struct intel_community apl_west_communities[] = {
-	BXT_COMMUNITY(0, 46),
+	BXT_COMMUNITY(0, 0, 46),
 };
 
 static const struct intel_pinctrl_soc_data apl_west_soc_data = {
@@ -972,7 +963,7 @@ static const struct intel_function apl_southwest_functions[] = {
 };
 
 static const struct intel_community apl_southwest_communities[] = {
-	BXT_COMMUNITY(0, 42),
+	BXT_COMMUNITY(0, 0, 42),
 };
 
 static const struct intel_pinctrl_soc_data apl_southwest_soc_data = {
Signature · 1 line
2.35.1
#3 lore raw

PATCH 4/17 pinctrl: cannonlake: Replace CNL_COMMUNITY() by INTEL_COMMUNITY_GPPS()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_GPPS() common macro instead custom CNL_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-cannonlake.c | 31 ++++++++--------------
 1 file changed, 11 insertions(+), 20 deletions(-)
drivers/pinctrl/intel/pinctrl-cannonlake.c +11 -20
index f8a8b9b14de9..88142ec57b25 100644
@@ -15,12 +15,17 @@
 
 #include "pinctrl-intel.h"
 
-#define CNL_PAD_OWN		0x020
-#define CNL_PADCFGLOCK		0x080
+#define CNL_LP_PAD_OWN		0x020
+#define CNL_LP_PADCFGLOCK	0x080
 #define CNL_LP_HOSTSW_OWN	0x0b0
+#define CNL_LP_GPI_IS		0x100
+#define CNL_LP_GPI_IE		0x120
+
+#define CNL_H_PAD_OWN		0x020
+#define CNL_H_PADCFGLOCK	0x080
 #define CNL_H_HOSTSW_OWN	0x0c0
-#define CNL_GPI_IS		0x100
-#define CNL_GPI_IE		0x120
+#define CNL_H_GPI_IS		0x100
+#define CNL_H_GPI_IE		0x120
 
 #define CNL_GPP(r, s, e, g)				\
 	{						\
@@ -30,25 +35,11 @@
 		.gpio_base = (g),			\
 	}
 
-#define CNL_COMMUNITY(b, s, e, g, v)			\
-	{						\
-		.barno = (b),				\
-		.padown_offset = CNL_PAD_OWN,		\
-		.padcfglock_offset = CNL_PADCFGLOCK,	\
-		.hostown_offset = CNL_##v##_HOSTSW_OWN,	\
-		.is_offset = CNL_GPI_IS,		\
-		.ie_offset = CNL_GPI_IE,		\
-		.pin_base = (s),			\
-		.npins = ((e) - (s) + 1),		\
-		.gpps = (g),				\
-		.ngpps = ARRAY_SIZE(g),			\
-	}
-
 #define CNL_LP_COMMUNITY(b, s, e, g)			\
-	CNL_COMMUNITY(b, s, e, g, LP)
+	INTEL_COMMUNITY_GPPS(b, s, e, g, CNL_LP)
 
 #define CNL_H_COMMUNITY(b, s, e, g)			\
-	CNL_COMMUNITY(b, s, e, g, H)
+	INTEL_COMMUNITY_GPPS(b, s, e, g, CNL_H)
 
 /* Cannon Lake-H */
 static const struct pinctrl_pin_desc cnlh_pins[] = {
Signature · 1 line
2.35.1
#4 lore raw

PATCH 5/17 pinctrl: cedarfork: Replace CDF_COMMUNITY() by INTEL_COMMUNITY_GPPS()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_GPPS() common macro instead custom CDF_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-cedarfork.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/pinctrl/intel/pinctrl-cedarfork.c +1 -12
index aa6f9040d3d8..2ab52b1fbc59 100644
@@ -28,18 +28,7 @@
 	}
 
 #define CDF_COMMUNITY(b, s, e, g)			\
-	{						\
-		.barno = (b),				\
-		.padown_offset = CDF_PAD_OWN,		\
-		.padcfglock_offset = CDF_PADCFGLOCK,	\
-		.hostown_offset = CDF_HOSTSW_OWN,	\
-		.is_offset = CDF_GPI_IS,		\
-		.ie_offset = CDF_GPI_IE,		\
-		.pin_base = (s),			\
-		.npins = ((e) - (s) + 1),		\
-		.gpps = (g),				\
-		.ngpps = ARRAY_SIZE(g),			\
-	}
+	INTEL_COMMUNITY_GPPS(b, s, e, g, CDF)
 
 /* Cedar Fork PCH */
 static const struct pinctrl_pin_desc cdf_pins[] = {
Signature · 1 line
2.35.1
#5 lore raw

PATCH 6/17 pinctrl: denverton: Replace DNV_COMMUNITY() by INTEL_COMMUNITY_GPPS()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_GPPS() common macro instead custom DNV_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-denverton.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/pinctrl/intel/pinctrl-denverton.c +1 -12
index f26d030b9b41..c1a9db091c6e 100644
@@ -28,18 +28,7 @@
 	}
 
 #define DNV_COMMUNITY(b, s, e, g)			\
-	{						\
-		.barno = (b),				\
-		.padown_offset = DNV_PAD_OWN,		\
-		.padcfglock_offset = DNV_PADCFGLOCK,	\
-		.hostown_offset = DNV_HOSTSW_OWN,	\
-		.is_offset = DNV_GPI_IS,		\
-		.ie_offset = DNV_GPI_IE,		\
-		.pin_base = (s),			\
-		.npins = ((e) - (s) + 1),		\
-		.gpps = (g),				\
-		.ngpps = ARRAY_SIZE(g),			\
-	}
+	INTEL_COMMUNITY_GPPS(b, s, e, g, DNV)
 
 /* Denverton */
 static const struct pinctrl_pin_desc dnv_pins[] = {
Signature · 1 line
2.35.1
#6 lore raw

PATCH 7/17 pinctrl: elkhartlake: Replace EHL_COMMUNITY() by INTEL_COMMUNITY_GPPS()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_GPPS() common macro instead custom EHL_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-elkhartlake.c | 24 ++++++---------------
 1 file changed, 7 insertions(+), 17 deletions(-)
drivers/pinctrl/intel/pinctrl-elkhartlake.c +7 -17
index 4702bdfa10e3..64b1997df0be 100644
@@ -27,18 +27,8 @@
 		.size = ((e) - (s) + 1),		\
 	}
 
-#define EHL_COMMUNITY(s, e, g)				\
-	{						\
-		.padown_offset = EHL_PAD_OWN,		\
-		.padcfglock_offset = EHL_PADCFGLOCK,	\
-		.hostown_offset = EHL_HOSTSW_OWN,	\
-		.is_offset = EHL_GPI_IS,		\
-		.ie_offset = EHL_GPI_IE,		\
-		.pin_base = (s),			\
-		.npins = ((e) - (s) + 1),		\
-		.gpps = (g),				\
-		.ngpps = ARRAY_SIZE(g),			\
-	}
+#define EHL_COMMUNITY(b, s, e, g)			\
+	INTEL_COMMUNITY_GPPS(b, s, e, g, EHL)
 
 /* Elkhart Lake */
 static const struct pinctrl_pin_desc ehl_community0_pins[] = {
@@ -121,7 +111,7 @@ static const struct intel_padgroup ehl_community0_gpps[] = {
 };
 
 static const struct intel_community ehl_community0[] = {
-	EHL_COMMUNITY(0, 66, ehl_community0_gpps),
+	EHL_COMMUNITY(0, 0, 66, ehl_community0_gpps),
 };
 
 static const struct intel_pinctrl_soc_data ehl_community0_soc_data = {
@@ -262,7 +252,7 @@ static const struct intel_padgroup ehl_community1_gpps[] = {
 };
 
 static const struct intel_community ehl_community1[] = {
-	EHL_COMMUNITY(0, 112, ehl_community1_gpps),
+	EHL_COMMUNITY(0, 0, 112, ehl_community1_gpps),
 };
 
 static const struct intel_pinctrl_soc_data ehl_community1_soc_data = {
@@ -335,7 +325,7 @@ static const struct intel_padgroup ehl_community3_gpps[] = {
 };
 
 static const struct intel_community ehl_community3[] = {
-	EHL_COMMUNITY(0, 46, ehl_community3_gpps),
+	EHL_COMMUNITY(0, 0, 46, ehl_community3_gpps),
 };
 
 static const struct intel_pinctrl_soc_data ehl_community3_soc_data = {
@@ -441,7 +431,7 @@ static const struct intel_padgroup ehl_community4_gpps[] = {
 };
 
 static const struct intel_community ehl_community4[] = {
-	EHL_COMMUNITY(0, 79, ehl_community4_gpps),
+	EHL_COMMUNITY(0, 0, 79, ehl_community4_gpps),
 };
 
 static const struct intel_pinctrl_soc_data ehl_community4_soc_data = {
@@ -469,7 +459,7 @@ static const struct intel_padgroup ehl_community5_gpps[] = {
 };
 
 static const struct intel_community ehl_community5[] = {
-	EHL_COMMUNITY(0, 7, ehl_community5_gpps),
+	EHL_COMMUNITY(0, 0, 7, ehl_community5_gpps),
 };
 
 static const struct intel_pinctrl_soc_data ehl_community5_soc_data = {
Signature · 1 line
2.35.1
#7 lore raw

PATCH 8/17 pinctrl: emmitsburg: Replace EBG_COMMUNITY() by INTEL_COMMUNITY_GPPS()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_GPPS() common macro instead custom EBG_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-emmitsburg.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/pinctrl/intel/pinctrl-emmitsburg.c +1 -12
index f6114dbf7520..cc8f0baabc91 100644
@@ -28,18 +28,7 @@
 	}
 
 #define EBG_COMMUNITY(b, s, e, g)			\
-	{						\
-		.barno = (b),				\
-		.padown_offset = EBG_PAD_OWN,		\
-		.padcfglock_offset = EBG_PADCFGLOCK,	\
-		.hostown_offset = EBG_HOSTSW_OWN,	\
-		.is_offset = EBG_GPI_IS,		\
-		.ie_offset = EBG_GPI_IE,		\
-		.pin_base = (s),			\
-		.npins = ((e) - (s) + 1),		\
-		.gpps = (g),				\
-		.ngpps = ARRAY_SIZE(g),			\
-	}
+	INTEL_COMMUNITY_GPPS(b, s, e, g, EBG)
 
 /* Emmitsburg */
 static const struct pinctrl_pin_desc ebg_pins[] = {
Signature · 1 line
2.35.1
#8 lore raw

PATCH 9/17 pinctrl: geminilake: Replace GLK_COMMUNITY() by INTEL_COMMUNITY_SIZE()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_SIZE() common macro instead custom GLK_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-geminilake.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)
drivers/pinctrl/intel/pinctrl-geminilake.c +6 -15
index df02028b40f3..918cc9f261cf 100644
@@ -20,17 +20,8 @@
 #define GLK_GPI_IS	0x100
 #define GLK_GPI_IE	0x110
 
-#define GLK_COMMUNITY(s, e)				\
-	{						\
-		.padown_offset = GLK_PAD_OWN,		\
-		.padcfglock_offset = GLK_PADCFGLOCK,	\
-		.hostown_offset = GLK_HOSTSW_OWN,	\
-		.is_offset = GLK_GPI_IS,		\
-		.ie_offset = GLK_GPI_IE,		\
-		.gpp_size = 32,                         \
-		.pin_base = (s),			\
-		.npins = ((e) - (s) + 1),		\
-	}
+#define GLK_COMMUNITY(b, s, e)				\
+	INTEL_COMMUNITY_SIZE(b, s, e, 32, 4, GLK)
 
 /* GLK */
 static const struct pinctrl_pin_desc glk_northwest_pins[] = {
@@ -173,7 +164,7 @@ static const struct intel_function glk_northwest_functions[] = {
 };
 
 static const struct intel_community glk_northwest_communities[] = {
-	GLK_COMMUNITY(0, 79),
+	GLK_COMMUNITY(0, 0, 79),
 };
 
 static const struct intel_pinctrl_soc_data glk_northwest_soc_data = {
@@ -306,7 +297,7 @@ static const struct intel_function glk_north_functions[] = {
 };
 
 static const struct intel_community glk_north_communities[] = {
-	GLK_COMMUNITY(0, 79),
+	GLK_COMMUNITY(0, 0, 79),
 };
 
 static const struct intel_pinctrl_soc_data glk_north_soc_data = {
@@ -345,7 +336,7 @@ static const struct pinctrl_pin_desc glk_audio_pins[] = {
 };
 
 static const struct intel_community glk_audio_communities[] = {
-	GLK_COMMUNITY(0, 19),
+	GLK_COMMUNITY(0, 0, 19),
 };
 
 static const struct intel_pinctrl_soc_data glk_audio_soc_data = {
@@ -427,7 +418,7 @@ static const struct intel_function glk_scc_functions[] = {
 };
 
 static const struct intel_community glk_scc_communities[] = {
-	GLK_COMMUNITY(0, 34),
+	GLK_COMMUNITY(0, 0, 34),
 };
 
 static const struct intel_pinctrl_soc_data glk_scc_soc_data = {
Signature · 1 line
2.35.1
#9 lore raw

PATCH 10/17 pinctrl: icelake: Replace ICL_COMMUNITY() by INTEL_COMMUNITY_GPPS()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_GPPS() common macro instead custom ICL_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-icelake.c | 35 +++++++++----------------
 1 file changed, 13 insertions(+), 22 deletions(-)
drivers/pinctrl/intel/pinctrl-icelake.c +13 -22
index 84a56d9ae47e..1c64b4a1c491 100644
@@ -15,12 +15,17 @@
 
 #include "pinctrl-intel.h"
 
-#define ICL_PAD_OWN	0x020
-#define ICL_PADCFGLOCK	0x080
-#define ICL_HOSTSW_OWN	0x0b0
-#define ICL_GPI_IS	0x100
-#define ICL_LP_GPI_IE	0x110
-#define ICL_N_GPI_IE	0x120
+#define ICL_LP_PAD_OWN		0x020
+#define ICL_LP_PADCFGLOCK	0x080
+#define ICL_LP_HOSTSW_OWN	0x0b0
+#define ICL_LP_GPI_IS		0x100
+#define ICL_LP_GPI_IE		0x110
+
+#define ICL_N_PAD_OWN		0x020
+#define ICL_N_PADCFGLOCK	0x080
+#define ICL_N_HOSTSW_OWN	0x0b0
+#define ICL_N_GPI_IS		0x100
+#define ICL_N_GPI_IE		0x120
 
 #define ICL_GPP(r, s, e, g)				\
 	{						\
@@ -30,25 +35,11 @@
 		.gpio_base = (g),			\
 	}
 
-#define ICL_COMMUNITY(b, s, e, g, v)			\
-	{						\
-		.barno = (b),				\
-		.padown_offset = ICL_PAD_OWN,		\
-		.padcfglock_offset = ICL_PADCFGLOCK,	\
-		.hostown_offset = ICL_HOSTSW_OWN,	\
-		.is_offset = ICL_GPI_IS,		\
-		.ie_offset = ICL_##v##_GPI_IE,		\
-		.pin_base = (s),			\
-		.npins = ((e) - (s) + 1),		\
-		.gpps = (g),				\
-		.ngpps = ARRAY_SIZE(g),			\
-	}
-
 #define ICL_LP_COMMUNITY(b, s, e, g)			\
-	ICL_COMMUNITY(b, s, e, g, LP)
+	INTEL_COMMUNITY_GPPS(b, s, e, g, ICL_LP)
 
 #define ICL_N_COMMUNITY(b, s, e, g)			\
-	ICL_COMMUNITY(b, s, e, g, N)
+	INTEL_COMMUNITY_GPPS(b, s, e, g, ICL_N)
 
 /* Ice Lake-LP */
 static const struct pinctrl_pin_desc icllp_pins[] = {
Signature · 1 line
2.35.1
#10 lore raw

PATCH 11/17 pinctrl: jasperlake: Replace JSL_COMMUNITY() by INTEL_COMMUNITY_GPPS()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_GPPS() common macro instead custom JSL_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-jasperlake.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/pinctrl/intel/pinctrl-jasperlake.c +1 -12
index ec435b7ab392..086ab7fe08dd 100644
@@ -29,18 +29,7 @@
 	}
 
 #define JSL_COMMUNITY(b, s, e, g)			\
-	{						\
-		.barno = (b),				\
-		.padown_offset = JSL_PAD_OWN,		\
-		.padcfglock_offset = JSL_PADCFGLOCK,	\
-		.hostown_offset = JSL_HOSTSW_OWN,	\
-		.is_offset = JSL_GPI_IS,		\
-		.ie_offset = JSL_GPI_IE,		\
-		.pin_base = (s),			\
-		.npins = ((e) - (s) + 1),		\
-		.gpps = (g),				\
-		.ngpps = ARRAY_SIZE(g),			\
-	}
+	INTEL_COMMUNITY_GPPS(b, s, e, g, JSL)
 
 /* Jasper Lake */
 static const struct pinctrl_pin_desc jsl_pins[] = {
Signature · 1 line
2.35.1
#11 lore raw

PATCH 12/17 pinctrl: lakefield: Replace LKF_COMMUNITY() by INTEL_COMMUNITY_GPPS()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_GPPS() common macro instead custom LKF_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-lakefield.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/pinctrl/intel/pinctrl-lakefield.c +1 -12
index 3c6283c4827f..8dac2d6012b1 100644
@@ -29,18 +29,7 @@
 	}
 
 #define LKF_COMMUNITY(b, s, e, g)			\
-	{						\
-		.barno = (b),				\
-		.padown_offset = LKF_PAD_OWN,		\
-		.padcfglock_offset = LKF_PADCFGLOCK,	\
-		.hostown_offset = LKF_HOSTSW_OWN,	\
-		.is_offset = LKF_GPI_IS,		\
-		.ie_offset = LKF_GPI_IE,		\
-		.pin_base = (s),			\
-		.npins = ((e) - (s) + 1),		\
-		.gpps = (g),				\
-		.ngpps = ARRAY_SIZE(g),			\
-	}
+	INTEL_COMMUNITY_GPPS(b, s, e, g, LKF)
 
 /* Lakefield */
 static const struct pinctrl_pin_desc lkf_pins[] = {
Signature · 1 line
2.35.1
#12 lore raw

PATCH 13/17 pinctrl: lewisburg: Replace LBG_COMMUNITY() by INTEL_COMMUNITY_SIZE()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_SIZE() common macro instead custom LBG_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-lewisburg.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/pinctrl/intel/pinctrl-lewisburg.c +1 -11
index ad4b446d588e..7aac1bbde2e9 100644
@@ -21,17 +21,7 @@
 #define LBG_GPI_IE	0x110
 
 #define LBG_COMMUNITY(b, s, e)				\
-	{						\
-		.barno = (b),				\
-		.padown_offset = LBG_PAD_OWN,		\
-		.padcfglock_offset = LBG_PADCFGLOCK,	\
-		.hostown_offset = LBG_HOSTSW_OWN,	\
-		.is_offset = LBG_GPI_IS,		\
-		.ie_offset = LBG_GPI_IE,		\
-		.gpp_size = 24,				\
-		.pin_base = (s),			\
-		.npins = ((e) - (s) + 1),		\
-	}
+	INTEL_COMMUNITY_SIZE(b, s, e, 24, 3, LBG)
 
 /* Lewisburg */
 static const struct pinctrl_pin_desc lbg_pins[] = {
Signature · 1 line
2.35.1
#13 lore raw

PATCH 14/17 pinctrl: meteorlake: Replace MTL_COMMUNITY() by INTEL_COMMUNITY_GPPS()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_GPPS() common macro instead custom MTL_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-meteorlake.c | 23 ++++++----------------
 1 file changed, 6 insertions(+), 17 deletions(-)
drivers/pinctrl/intel/pinctrl-meteorlake.c +6 -17
index 9576dcd1cb29..a82f6754c45b 100644
@@ -14,11 +14,11 @@
 
 #include "pinctrl-intel.h"
 
-#define MTL_PAD_OWN	0x0b0
-#define MTL_PADCFGLOCK	0x110
-#define MTL_HOSTSW_OWN	0x140
-#define MTL_GPI_IS	0x200
-#define MTL_GPI_IE	0x210
+#define MTL_P_PAD_OWN		0x0b0
+#define MTL_P_PADCFGLOCK	0x110
+#define MTL_P_HOSTSW_OWN	0x140
+#define MTL_P_GPI_IS		0x200
+#define MTL_P_GPI_IE		0x210
 
 #define MTL_GPP(r, s, e, g)				\
 	{						\
@@ -29,18 +29,7 @@
 	}
 
 #define MTL_COMMUNITY(b, s, e, g)			\
-	{						\
-		.barno = (b),				\
-		.padown_offset = MTL_PAD_OWN,		\
-		.padcfglock_offset = MTL_PADCFGLOCK,	\
-		.hostown_offset = MTL_HOSTSW_OWN,	\
-		.is_offset = MTL_GPI_IS,		\
-		.ie_offset = MTL_GPI_IE,		\
-		.pin_base = (s),			\
-		.npins = ((e) - (s) + 1),		\
-		.gpps = (g),				\
-		.ngpps = ARRAY_SIZE(g),			\
-	}
+	INTEL_COMMUNITY_GPPS(b, s, e, g, MTL_P)
 
 /* Meteor Lake-P */
 static const struct pinctrl_pin_desc mtlp_pins[] = {
Signature · 1 line
2.35.1
#14 lore raw

PATCH 15/17 pinctrl: tigerlake: Replace TGL_COMMUNITY() by INTEL_COMMUNITY_GPPS()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_GPPS() common macro instead custom TGL_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-tigerlake.c | 30 ++++++++---------------
 1 file changed, 10 insertions(+), 20 deletions(-)
drivers/pinctrl/intel/pinctrl-tigerlake.c +10 -20
index 431352fa2ab5..6e3a651d1241 100644
@@ -15,13 +15,17 @@
 
 #include "pinctrl-intel.h"
 
-#define TGL_PAD_OWN		0x020
+#define TGL_LP_PAD_OWN		0x020
 #define TGL_LP_PADCFGLOCK	0x080
-#define TGL_H_PADCFGLOCK	0x090
 #define TGL_LP_HOSTSW_OWN	0x0b0
+#define TGL_LP_GPI_IS		0x100
+#define TGL_LP_GPI_IE		0x120
+
+#define TGL_H_PAD_OWN		0x020
+#define TGL_H_PADCFGLOCK	0x090
 #define TGL_H_HOSTSW_OWN	0x0c0
-#define TGL_GPI_IS		0x100
-#define TGL_GPI_IE		0x120
+#define TGL_H_GPI_IS		0x100
+#define TGL_H_GPI_IE		0x120
 
 #define TGL_GPP(r, s, e, g)				\
 	{						\
@@ -31,25 +35,11 @@
 		.gpio_base = (g),			\
 	}
 
-#define TGL_COMMUNITY(b, s, e, g, v)				\
-	{							\
-		.barno = (b),					\
-		.padown_offset = TGL_PAD_OWN,			\
-		.padcfglock_offset = TGL_##v##_PADCFGLOCK,	\
-		.hostown_offset = TGL_##v##_HOSTSW_OWN,		\
-		.is_offset = TGL_GPI_IS,			\
-		.ie_offset = TGL_GPI_IE,			\
-		.pin_base = (s),				\
-		.npins = ((e) - (s) + 1),			\
-		.gpps = (g),					\
-		.ngpps = ARRAY_SIZE(g),				\
-	}
-
 #define TGL_LP_COMMUNITY(b, s, e, g)			\
-	TGL_COMMUNITY(b, s, e, g, LP)
+	INTEL_COMMUNITY_GPPS(b, s, e, g, TGL_LP)
 
 #define TGL_H_COMMUNITY(b, s, e, g)			\
-	TGL_COMMUNITY(b, s, e, g, H)
+	INTEL_COMMUNITY_GPPS(b, s, e, g, TGL_H)
 
 /* Tiger Lake-LP */
 static const struct pinctrl_pin_desc tgllp_pins[] = {
Signature · 1 line
2.35.1
#15 lore raw

PATCH 16/17 pinctrl: sunrisepoint: Replace SPT_COMMUNITY() by INTEL_COMMUNITY_*()

In reply to Andy Shevchenko

Use INTEL_COMMUNITY_*() common macro instead custom SPT_COMMUNITY().

---
 drivers/pinctrl/intel/pinctrl-sunrisepoint.c | 37 +++++++-------------
 1 file changed, 13 insertions(+), 24 deletions(-)
drivers/pinctrl/intel/pinctrl-sunrisepoint.c +13 -24
index 292b660067e9..f91e27feb7c3 100644
@@ -15,31 +15,17 @@
 
 #include "pinctrl-intel.h"
 
-#define SPT_PAD_OWN		0x020
+#define SPT_H_PAD_OWN		0x020
 #define SPT_H_PADCFGLOCK	0x090
-#define SPT_LP_PADCFGLOCK	0x0a0
-#define SPT_HOSTSW_OWN		0x0d0
-#define SPT_GPI_IS		0x100
-#define SPT_GPI_IE		0x120
-
-#define SPT_COMMUNITY(b, s, e, g, n, v, gs, gn)			\
-	{							\
-		.barno = (b),					\
-		.padown_offset = SPT_PAD_OWN,			\
-		.padcfglock_offset = SPT_##v##_PADCFGLOCK,	\
-		.hostown_offset = SPT_HOSTSW_OWN,		\
-		.is_offset = SPT_GPI_IS,			\
-		.ie_offset = SPT_GPI_IE,			\
-		.gpp_size = (gs),				\
-		.gpp_num_padown_regs = (gn),			\
-		.pin_base = (s),				\
-		.npins = ((e) - (s) + 1),			\
-		.gpps = (g),					\
-		.ngpps = (n),					\
-	}
+#define SPT_H_HOSTSW_OWN	0x0d0
+#define SPT_H_GPI_IS		0x100
+#define SPT_H_GPI_IE		0x120
 
-#define SPT_LP_COMMUNITY(b, s, e)			\
-	SPT_COMMUNITY(b, s, e, NULL, 0, LP, 24, 4)
+#define SPT_LP_PAD_OWN		0x020
+#define SPT_LP_PADCFGLOCK	0x0a0
+#define SPT_LP_HOSTSW_OWN	0x0d0
+#define SPT_LP_GPI_IS		0x100
+#define SPT_LP_GPI_IE		0x120
 
 #define SPT_H_GPP(r, s, e, g)				\
 	{						\
@@ -50,7 +36,10 @@
 	}
 
 #define SPT_H_COMMUNITY(b, s, e, g)			\
-	SPT_COMMUNITY(b, s, e, g, ARRAY_SIZE(g), H, 0, 0)
+	INTEL_COMMUNITY_GPPS(b, s, e, g, SPT_H)
+
+#define SPT_LP_COMMUNITY(b, s, e)			\
+	INTEL_COMMUNITY_SIZE(b, s, e, 24, 4, SPT_LP)
 
 /* Sunrisepoint-LP */
 static const struct pinctrl_pin_desc sptlp_pins[] = {
Signature · 1 line
2.35.1
#16 lore raw

PATCH 17/17 pinctrl: intel: Always use gpp_num_padown_regs in the main driver

In reply to Andy Shevchenko

For the size-based communities, always use gpp_num_padown_regs, which is now provided explicitly via INTEL_COMMUNITY_SIZE() macro.

---
 drivers/pinctrl/intel/pinctrl-intel.c |  9 +--------
 drivers/pinctrl/intel/pinctrl-intel.h | 13 +++++++------
 2 files changed, 8 insertions(+), 14 deletions(-)
drivers/pinctrl/intel/pinctrl-intel.c +1 -8
index cc3aaba24188..4029891ba628 100644
@@ -1451,14 +1451,7 @@ static int intel_pinctrl_add_padgroups_by_size(struct intel_pinctrl *pctrl,
 		gpps[i].gpio_base = gpps[i].base;
 		gpps[i].padown_num = padown_num;
 
-		/*
-		 * In older hardware the number of padown registers per
-		 * group is fixed regardless of the group size.
-		 */
-		if (community->gpp_num_padown_regs)
-			padown_num += community->gpp_num_padown_regs;
-		else
-			padown_num += DIV_ROUND_UP(gpps[i].size * 4, 32);
+		padown_num += community->gpp_num_padown_regs;
 	}
 
 	community->ngpps = ngpps;
drivers/pinctrl/intel/pinctrl-intel.h +7 -6
index b0f2be4c1fd1..981c1f520f13 100644
@@ -96,8 +96,7 @@ enum {
  * @gpp_size: Maximum number of pads in each group, such as PADCFGLOCK,
  *            HOSTSW_OWN, GPI_IS, GPI_IE. Used when @gpps is %NULL.
  * @gpp_num_padown_regs: Number of pad registers each pad group consumes at
- *			 minimum. Use %0 if the number of registers can be
- *			 determined by the size of the group.
+ *			 minimum. Used when @gpps is %NULL.
  * @gpps: Pad groups if the controller has variable size pad groups
  * @ngpps: Number of pad groups in this community
  * @pad_map: Optional non-linear mapping of the pads
@@ -106,11 +105,13 @@ enum {
  * @regs: Community specific common registers (reserved for core driver)
  * @pad_regs: Community specific pad registers (reserved for core driver)
  *
- * In some of Intel GPIO host controllers this driver supports each pad group
+ * In older Intel GPIO host controllers, this driver supports, each pad group
  * is of equal size (except the last one). In that case the driver can just
- * fill in @gpp_size field and let the core driver to handle the rest. If
- * the controller has pad groups of variable size the client driver can
- * pass custom @gpps and @ngpps instead.
+ * fill in @gpp_size and @gpp_num_padown_regs fields and let the core driver
+ * to handle the rest.
+ *
+ * In newer Intel GPIO host controllers each pad group is of variable size,
+ * so the client driver can pass custom @gpps and @ngpps instead.
  */
 struct intel_community {
 	unsigned int barno;
Signature · 1 line
2.35.1
maintainer
#17 lore raw
In reply to Andy Shevchenko

Hi Andy,

Quoted 4 lines · Andy Shevchenko

Now it becomes visible that we can deduplicate SoC specific *_COMMUNITY() macros across the Intel pin control drivers. For that, introduce a common INTEL_COMMUNITY_GPPS() and INTEL_COMMUNITY_SIZE() macros in the pinctrl-intel.h.

You should really start learning how to use --cover-letter option with git format-patch because for anything more than one patch pretty much requires such. Here I would really like to see how much lines this series ends up removing :)

The series looks good to me, though.

#18 lore raw
Quoted 9 lines · Mika Westerberg
Quoted 4 lines · Andy Shevchenko

Now it becomes visible that we can deduplicate SoC specific *_COMMUNITY() macros across the Intel pin control drivers. For that, introduce a common INTEL_COMMUNITY_GPPS() and INTEL_COMMUNITY_SIZE() macros in the pinctrl-intel.h.

You should really start learning how to use --cover-letter option with git format-patch because for anything more than one patch pretty much requires such.

Oh, indeed.

Quoted 2 lines

Here I would really like to see how much lines this series ends up removing :)

drivers/pinctrl/intel/pinctrl-alderlake.c    | 18 ++----------------
drivers/pinctrl/intel/pinctrl-broxton.c      | 31 +++++++++++--------------------
drivers/pinctrl/intel/pinctrl-cannonlake.c   | 31 +++++++++++--------------------
drivers/pinctrl/intel/pinctrl-cedarfork.c    | 13 +------------
drivers/pinctrl/intel/pinctrl-denverton.c    | 13 +------------
drivers/pinctrl/intel/pinctrl-elkhartlake.c  | 24 +++++++-----------------
drivers/pinctrl/intel/pinctrl-emmitsburg.c   | 13 +------------
drivers/pinctrl/intel/pinctrl-geminilake.c   | 21 ++++++---------------
drivers/pinctrl/intel/pinctrl-icelake.c      | 35 +++++++++++++----------------------
drivers/pinctrl/intel/pinctrl-intel.c        |  9 +--------
drivers/pinctrl/intel/pinctrl-intel.h        | 35 +++++++++++++++++++++++++++++------
drivers/pinctrl/intel/pinctrl-jasperlake.c   | 13 +------------
drivers/pinctrl/intel/pinctrl-lakefield.c    | 13 +------------
drivers/pinctrl/intel/pinctrl-lewisburg.c    | 12 +-----------
drivers/pinctrl/intel/pinctrl-meteorlake.c   | 23 ++++++-----------------
drivers/pinctrl/intel/pinctrl-sunrisepoint.c | 37 +++++++++++++------------------------
drivers/pinctrl/intel/pinctrl-tigerlake.c    | 30 ++++++++++--------------------
17 files changed, 115 insertions(+), 256 deletions(-)
Quoted 1 line

The series looks good to me, though.

Thank you!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#19 lore raw
In reply to Mika Westerberg
Quoted 6 lines · Mika Westerberg
Quoted 4 lines · Andy Shevchenko

Now it becomes visible that we can deduplicate SoC specific *_COMMUNITY() macros across the Intel pin control drivers. For that, introduce a common INTEL_COMMUNITY_GPPS() and INTEL_COMMUNITY_SIZE() macros in the pinctrl-intel.h.

Quoted 6 lines

You should really start learning how to use --cover-letter option with git format-patch because for anything more than one patch pretty much requires such. Here I would really like to see how much lines this series ends up removing :)

The series looks good to me, though.

The series has been pushed to my review and testing branch, thanks!

P.S. I dared to convert the above into your Acked-by tag. Tell me if it must not be the case.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#20 lore raw
Quoted 12 lines · Andy Shevchenko
Quoted 11 lines · Mika Westerberg
Quoted 4 lines · Andy Shevchenko

Now it becomes visible that we can deduplicate SoC specific *_COMMUNITY() macros across the Intel pin control drivers. For that, introduce a common INTEL_COMMUNITY_GPPS() and INTEL_COMMUNITY_SIZE() macros in the pinctrl-intel.h.

You should really start learning how to use --cover-letter option with git format-patch because for anything more than one patch pretty much requires such. Here I would really like to see how much lines this series ends up removing :)

Quoted 6 lines
Quoted 1 line

The series looks good to me, though.

The series has been pushed to my review and testing branch, thanks!

P.S. I dared to convert the above into your Acked-by tag. Tell me if it must not be the case.

That's fine, forgot to add it myself :)