2022-12-19 13:04:03

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 01/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.

Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/pinctrl/intel/pinctrl-intel.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

diff --git a/drivers/pinctrl/intel/pinctrl-intel.h b/drivers/pinctrl/intel/pinctrl-intel.h
index 65628423bf63..b0f2be4c1fd1 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.h
+++ b/drivers/pinctrl/intel/pinctrl-intel.h
@@ -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
--
2.35.1


2022-12-19 13:08:07

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 08/17] pinctrl: emmitsburg: Replace EBG_COMMUNITY() by INTEL_COMMUNITY_GPPS()

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

Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/pinctrl/intel/pinctrl-emmitsburg.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-emmitsburg.c b/drivers/pinctrl/intel/pinctrl-emmitsburg.c
index f6114dbf7520..cc8f0baabc91 100644
--- a/drivers/pinctrl/intel/pinctrl-emmitsburg.c
+++ b/drivers/pinctrl/intel/pinctrl-emmitsburg.c
@@ -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[] = {
--
2.35.1

2022-12-19 13:08:45

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 16/17] pinctrl: sunrisepoint: Replace SPT_COMMUNITY() by INTEL_COMMUNITY_*()

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

Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/pinctrl/intel/pinctrl-sunrisepoint.c | 37 +++++++-------------
1 file changed, 13 insertions(+), 24 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-sunrisepoint.c b/drivers/pinctrl/intel/pinctrl-sunrisepoint.c
index 292b660067e9..f91e27feb7c3 100644
--- a/drivers/pinctrl/intel/pinctrl-sunrisepoint.c
+++ b/drivers/pinctrl/intel/pinctrl-sunrisepoint.c
@@ -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[] = {
--
2.35.1

2022-12-19 13:09:28

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 09/17] pinctrl: geminilake: Replace GLK_COMMUNITY() by INTEL_COMMUNITY_SIZE()

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

Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/pinctrl/intel/pinctrl-geminilake.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-geminilake.c b/drivers/pinctrl/intel/pinctrl-geminilake.c
index df02028b40f3..918cc9f261cf 100644
--- a/drivers/pinctrl/intel/pinctrl-geminilake.c
+++ b/drivers/pinctrl/intel/pinctrl-geminilake.c
@@ -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 = {
--
2.35.1

2022-12-19 13:26:36

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 10/17] pinctrl: icelake: Replace ICL_COMMUNITY() by INTEL_COMMUNITY_GPPS()

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

Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/pinctrl/intel/pinctrl-icelake.c | 35 +++++++++----------------
1 file changed, 13 insertions(+), 22 deletions(-)

diff --git a/drivers/pinctrl/intel/pinctrl-icelake.c b/drivers/pinctrl/intel/pinctrl-icelake.c
index 84a56d9ae47e..1c64b4a1c491 100644
--- a/drivers/pinctrl/intel/pinctrl-icelake.c
+++ b/drivers/pinctrl/intel/pinctrl-icelake.c
@@ -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[] = {
--
2.35.1

2022-12-19 14:59:20

by Mika Westerberg

[permalink] [raw]
Subject: Re: [PATCH v1 01/17] pinctrl: intel: Introduce INTEL_COMMUNITY_*() to unify community macros

Hi Andy,

On Mon, Dec 19, 2022 at 02:26:27PM +0200, Andy Shevchenko wrote:
> 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.

2022-12-19 15:01:54

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 01/17] pinctrl: intel: Introduce INTEL_COMMUNITY_*() to unify community macros

On Mon, Dec 19, 2022 at 04:32:55PM +0200, Mika Westerberg wrote:
> On Mon, Dec 19, 2022 at 02:26:27PM +0200, Andy Shevchenko wrote:
> > 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.

> 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(-)

> The series looks good to me, though.

Thank you!

--
With Best Regards,
Andy Shevchenko


2022-12-27 19:33:13

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 01/17] pinctrl: intel: Introduce INTEL_COMMUNITY_*() to unify community macros

On Mon, Dec 19, 2022 at 04:32:55PM +0200, Mika Westerberg wrote:
> On Mon, Dec 19, 2022 at 02:26:27PM +0200, Andy Shevchenko wrote:
> > 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.

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.

--
With Best Regards,
Andy Shevchenko


2022-12-28 06:55:35

by Mika Westerberg

[permalink] [raw]
Subject: Re: [PATCH v1 01/17] pinctrl: intel: Introduce INTEL_COMMUNITY_*() to unify community macros

On Tue, Dec 27, 2022 at 09:19:12PM +0200, Andy Shevchenko wrote:
> On Mon, Dec 19, 2022 at 04:32:55PM +0200, Mika Westerberg wrote:
> > On Mon, Dec 19, 2022 at 02:26:27PM +0200, Andy Shevchenko wrote:
> > > 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.
>
> 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 :)