linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] mfd: Provide MACRO to declare commonly defined MFD cell attributes
@ 2016-07-13 11:26 Lee Jones
  2016-07-13 11:26 ` [PATCH 1/3] " Lee Jones
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Lee Jones @ 2016-07-13 11:26 UTC (permalink / raw)
  To: linux-arm-kernel

Not a lot to it really.  The idea is to save lines.

Lee Jones (3):
  mfd: Provide MACRO to declare commonly defined MFD cell attributes
  mfd: ab8500: Example using new OF_MFD_CELL MACRO
  mfd: db8500-prcmu: Example using new OF_MFD_CELL/MFD_CELL_BASIC MACROs

 drivers/mfd/ab8500-core.c  | 138 ++++++++++++++-------------------------------
 drivers/mfd/db8500-prcmu.c |  33 ++++-------
 include/linux/mfd/core.h   |  29 ++++++++++
 3 files changed, 81 insertions(+), 119 deletions(-)

-- 
2.9.0

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

* [PATCH 1/3] mfd: Provide MACRO to declare commonly defined MFD cell attributes
  2016-07-13 11:26 [PATCH 0/3] mfd: Provide MACRO to declare commonly defined MFD cell attributes Lee Jones
@ 2016-07-13 11:26 ` Lee Jones
  2016-07-15 13:09   ` Laxman Dewangan
  2016-07-13 11:26 ` [PATCH 2/3] mfd: ab8500: Example using new OF_MFD_CELL MACRO Lee Jones
  2016-07-13 11:26 ` [PATCH 3/3] mfd: db8500-prcmu: Example using new OF_MFD_CELL/MFD_CELL_BASIC MACROs Lee Jones
  2 siblings, 1 reply; 8+ messages in thread
From: Lee Jones @ 2016-07-13 11:26 UTC (permalink / raw)
  To: linux-arm-kernel

Cc: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 include/linux/mfd/core.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 99c0395..c6018f4 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -16,6 +16,35 @@
 
 #include <linux/platform_device.h>
 
+#define MFD_RES_SIZE(arr) (sizeof(arr) / sizeof(struct resource))
+
+#define MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, _match)\
+	{								\
+		.name = (_name),					\
+		.resources = (_res),					\
+		.num_resources = MFD_RES_SIZE((_res)),			\
+		.platform_data = (_pdata),				\
+		.pdata_size = (_pdsize),				\
+		.of_compatible = (_compat),				\
+		.acpi_match = (_match),					\
+		.id = (_id),						\
+	}
+
+#define OF_MFD_CELL(_name, _res, _pdata, _pdsize,_id, _compat)		\
+	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, NULL)	\
+
+#define ACPI_MFD_CELL(_name, _res, _pdata, _pdsize, _id, _match)	\
+	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, _match)	\
+
+#define MFD_CELL_BASIC(_name, _res, _pdata, _pdsize, _id)		\
+	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, NULL)	\
+
+#define MFD_CELL_RES(_name, _res)					\
+	MFD_CELL_ALL(_name, _res, _pdata, 0, 0, NULL, NULL)		\
+
+#define MFD_CELL_NAME(_name)						\
+	MFD_CELL_ALL(_name, NULL, NULL, 0, 0, NULL, NULL)		\
+
 struct irq_domain;
 struct property_entry;
 
-- 
2.9.0

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

* [PATCH 2/3] mfd: ab8500: Example using new OF_MFD_CELL MACRO
  2016-07-13 11:26 [PATCH 0/3] mfd: Provide MACRO to declare commonly defined MFD cell attributes Lee Jones
  2016-07-13 11:26 ` [PATCH 1/3] " Lee Jones
@ 2016-07-13 11:26 ` Lee Jones
  2016-07-13 11:26 ` [PATCH 3/3] mfd: db8500-prcmu: Example using new OF_MFD_CELL/MFD_CELL_BASIC MACROs Lee Jones
  2 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2016-07-13 11:26 UTC (permalink / raw)
  To: linux-arm-kernel

... with and without platform ID.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/ab8500-core.c | 138 ++++++++++++++--------------------------------
 1 file changed, 42 insertions(+), 96 deletions(-)

diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index f3d6891..ed92e5a 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -606,107 +606,53 @@ int ab8500_suspend(struct ab8500 *ab8500)
 }
 
 static const struct mfd_cell ab8500_bm_devs[] = {
-	{
-		.name = "ab8500-charger",
-		.of_compatible = "stericsson,ab8500-charger",
-		.platform_data = &ab8500_bm_data,
-		.pdata_size = sizeof(ab8500_bm_data),
-	},
-	{
-		.name = "ab8500-btemp",
-		.of_compatible = "stericsson,ab8500-btemp",
-		.platform_data = &ab8500_bm_data,
-		.pdata_size = sizeof(ab8500_bm_data),
-	},
-	{
-		.name = "ab8500-fg",
-		.of_compatible = "stericsson,ab8500-fg",
-		.platform_data = &ab8500_bm_data,
-		.pdata_size = sizeof(ab8500_bm_data),
-	},
-	{
-		.name = "ab8500-chargalg",
-		.of_compatible = "stericsson,ab8500-chargalg",
-		.platform_data = &ab8500_bm_data,
-		.pdata_size = sizeof(ab8500_bm_data),
-	},
+	OF_MFD_CELL("ab8500-charger", NULL, &ab8500_bm_data,
+		    sizeof(ab8500_bm_data), 0, "stericsson,ab8500-charger"),
+	OF_MFD_CELL("ab8500-btemp", NULL, &ab8500_bm_data,
+		    sizeof(ab8500_bm_data), 0, "stericsson,ab8500-btemp"),
+	OF_MFD_CELL("ab8500-fg", NULL, &ab8500_bm_data,
+		    sizeof(ab8500_bm_data), 0, "stericsson,ab8500-fg"),
+	OF_MFD_CELL("ab8500-chargalg", NULL, &ab8500_bm_data,
+		    sizeof(ab8500_bm_data), 0, "stericsson,ab8500-chargalg"),
 };
 
 static const struct mfd_cell ab8500_devs[] = {
 #ifdef CONFIG_DEBUG_FS
-	{
-		.name = "ab8500-debug",
-		.of_compatible = "stericsson,ab8500-debug",
-	},
+	OF_MFD_CELL("ab8500-debug",
+		    NULL, NULL, 0, 0, "stericsson,ab8500-debug"),
 #endif
-	{
-		.name = "ab8500-sysctrl",
-		.of_compatible = "stericsson,ab8500-sysctrl",
-	},
-	{
-		.name = "ab8500-ext-regulator",
-		.of_compatible = "stericsson,ab8500-ext-regulator",
-	},
-	{
-		.name = "ab8500-regulator",
-		.of_compatible = "stericsson,ab8500-regulator",
-	},
-	{
-		.name = "abx500-clk",
-		.of_compatible = "stericsson,abx500-clk",
-	},
-	{
-		.name = "ab8500-gpadc",
-		.of_compatible = "stericsson,ab8500-gpadc",
-	},
-	{
-		.name = "ab8500-rtc",
-		.of_compatible = "stericsson,ab8500-rtc",
-	},
-	{
-		.name = "ab8500-acc-det",
-		.of_compatible = "stericsson,ab8500-acc-det",
-	},
-	{
-
-		.name = "ab8500-poweron-key",
-		.of_compatible = "stericsson,ab8500-poweron-key",
-	},
-	{
-		.name = "ab8500-pwm",
-		.of_compatible = "stericsson,ab8500-pwm",
-		.id = 1,
-	},
-	{
-		.name = "ab8500-pwm",
-		.of_compatible = "stericsson,ab8500-pwm",
-		.id = 2,
-	},
-	{
-		.name = "ab8500-pwm",
-		.of_compatible = "stericsson,ab8500-pwm",
-		.id = 3,
-	},
-	{
-		.name = "ab8500-denc",
-		.of_compatible = "stericsson,ab8500-denc",
-	},
-	{
-		.name = "pinctrl-ab8500",
-		.of_compatible = "stericsson,ab8500-gpio",
-	},
-	{
-		.name = "abx500-temp",
-		.of_compatible = "stericsson,abx500-temp",
-	},
-	{
-		.name = "ab8500-usb",
-		.of_compatible = "stericsson,ab8500-usb",
-	},
-	{
-		.name = "ab8500-codec",
-		.of_compatible = "stericsson,ab8500-codec",
-	},
+	OF_MFD_CELL("ab8500-sysctrl",
+		    NULL, NULL, 0, 0, "stericsson,ab8500-sysctrl"),
+	OF_MFD_CELL("ab8500-ext-regulator",
+		    NULL, NULL, 0, 0, "stericsson,ab8500-ext-regulator"),
+	OF_MFD_CELL("ab8500-regulator",
+		    NULL, NULL, 0, 0, "stericsson,ab8500-regulator"),
+	OF_MFD_CELL("abx500-clk",
+		    NULL, NULL, 0, 0, "stericsson,abx500-clk"),
+	OF_MFD_CELL("ab8500-gpadc",
+		    NULL, NULL, 0, 0, "stericsson,ab8500-gpadc"),
+	OF_MFD_CELL("ab8500-rtc",
+		    NULL, NULL, 0, 0, "stericsson,ab8500-rtc"),
+	OF_MFD_CELL("ab8500-acc-det",
+		    NULL, NULL, 0, 0, "stericsson,ab8500-acc-det"),
+	OF_MFD_CELL("ab8500-poweron-key",
+		    NULL, NULL, 0, 0, "stericsson,ab8500-poweron-key"),
+	OF_MFD_CELL("ab8500-pwm",
+		    NULL, NULL, 0, 1, "stericsson,ab8500-pwm"),
+	OF_MFD_CELL("ab8500-pwm",
+		    NULL, NULL, 0, 2, "stericsson,ab8500-pwm"),
+	OF_MFD_CELL("ab8500-pwm",
+		    NULL, NULL, 0, 3, "stericsson,ab8500-pwm"),
+	OF_MFD_CELL("ab8500-denc",
+		    NULL, NULL, 0, 0, "stericsson,ab8500-denc"),
+	OF_MFD_CELL("pinctrl-ab8500",
+		    NULL, NULL, 0, 0, "stericsson,ab8500-gpio"),
+	OF_MFD_CELL("abx500-temp",
+		    NULL, NULL, 0, 0, "stericsson,abx500-temp"),
+	OF_MFD_CELL("ab8500-usb",
+		    NULL, NULL, 0, 0, "stericsson,ab8500-usb"),
+	OF_MFD_CELL("ab8500-codec",
+		    NULL, NULL, 0, 0, "stericsson,ab8500-codec"),
 };
 
 static const struct mfd_cell ab9540_devs[] = {
-- 
2.9.0

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

* [PATCH 3/3] mfd: db8500-prcmu: Example using new OF_MFD_CELL/MFD_CELL_BASIC MACROs
  2016-07-13 11:26 [PATCH 0/3] mfd: Provide MACRO to declare commonly defined MFD cell attributes Lee Jones
  2016-07-13 11:26 ` [PATCH 1/3] " Lee Jones
  2016-07-13 11:26 ` [PATCH 2/3] mfd: ab8500: Example using new OF_MFD_CELL MACRO Lee Jones
@ 2016-07-13 11:26 ` Lee Jones
  2016-08-04  7:47   ` Linus Walleij
  2 siblings, 1 reply; 8+ messages in thread
From: Lee Jones @ 2016-07-13 11:26 UTC (permalink / raw)
  To: linux-arm-kernel

... with and without 'resources'.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/db8500-prcmu.c | 33 ++++++++++-----------------------
 1 file changed, 10 insertions(+), 23 deletions(-)

diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index c0a86ae..4c9c951 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -3061,29 +3061,16 @@ static const struct mfd_cell common_prcmu_devs[] = {
 };
 
 static const struct mfd_cell db8500_prcmu_devs[] = {
-	{
-		.name = "db8500-prcmu-regulators",
-		.of_compatible = "stericsson,db8500-prcmu-regulator",
-		.platform_data = &db8500_regulators,
-		.pdata_size = sizeof(db8500_regulators),
-	},
-	{
-		.name = "cpufreq-ux500",
-		.of_compatible = "stericsson,cpufreq-ux500",
-		.platform_data = &db8500_cpufreq_table,
-		.pdata_size = sizeof(db8500_cpufreq_table),
-	},
-	{
-		.name = "cpuidle-dbx500",
-		.of_compatible = "stericsson,cpuidle-dbx500",
-	},
-	{
-		.name = "db8500-thermal",
-		.num_resources = ARRAY_SIZE(db8500_thsens_resources),
-		.resources = db8500_thsens_resources,
-		.platform_data = &db8500_thsens_data,
-		.pdata_size = sizeof(db8500_thsens_data),
-	},
+	OF_MFD_CELL("db8500-prcmu-regulators", NULL, &db8500_regulators,
+		    sizeof(db8500_regulators), 0,
+		    "stericsson,db8500-prcmu-regulator"),
+	OF_MFD_CELL("cpufreq-ux500", NULL, &db8500_cpufreq_table,
+		    sizeof(db8500_cpufreq_table), 0,
+		    "stericsson,cpufreq-ux500"),
+	OF_MFD_CELL("cpuidle-dbx500", NULL, NULL, 0, 0,
+		    "stericsson,cpuidle-dbx500"),
+	MFD_CELL_BASIC("db8500-thermal", db8500_thsens_resources,
+		       &db8500_thsens_data, sizeof(db8500_thsens_data), 0),
 };
 
 static void db8500_prcmu_update_cpufreq(void)
-- 
2.9.0

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

* [PATCH 1/3] mfd: Provide MACRO to declare commonly defined MFD cell attributes
  2016-07-13 11:26 ` [PATCH 1/3] " Lee Jones
@ 2016-07-15 13:09   ` Laxman Dewangan
  2016-07-18 13:25     ` Lee Jones
  0 siblings, 1 reply; 8+ messages in thread
From: Laxman Dewangan @ 2016-07-15 13:09 UTC (permalink / raw)
  To: linux-arm-kernel


On Wednesday 13 July 2016 04:56 PM, Lee Jones wrote:
> Cc: Laxman Dewangan <ldewangan@nvidia.com>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>   include/linux/mfd/core.h | 29 +++++++++++++++++++++++++++++
>   1 file changed, 29 insertions(+)
>
> diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
> index 99c0395..c6018f4 100644
> --- a/include/linux/mfd/core.h
> +++ b/include/linux/mfd/core.h
> @@ -16,6 +16,35 @@
>   
>   #include <linux/platform_device.h>

> +#define MFD_CELL_BASIC(_name, _res, _pdata, _pdsize, _id)		\
> +	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, NULL)	\
> +
> +#define MFD_CELL_RES(_name, _res)					\
> +	MFD_CELL_ALL(_name, _res, _pdata, 0, 0, NULL, NULL)		\
> +
Here _pdata should not be used. Instead it should be NULL.

I corrected it locally and then compiled and teste.

Once above fixed, you can take my ack and tested by

Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>

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

* [PATCH 1/3] mfd: Provide MACRO to declare commonly defined MFD cell attributes
  2016-07-15 13:09   ` Laxman Dewangan
@ 2016-07-18 13:25     ` Lee Jones
  0 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2016-07-18 13:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 15 Jul 2016, Laxman Dewangan wrote:

> 
> On Wednesday 13 July 2016 04:56 PM, Lee Jones wrote:
> > Cc: Laxman Dewangan <ldewangan@nvidia.com>
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >   include/linux/mfd/core.h | 29 +++++++++++++++++++++++++++++
> >   1 file changed, 29 insertions(+)
> > 
> > diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
> > index 99c0395..c6018f4 100644
> > --- a/include/linux/mfd/core.h
> > +++ b/include/linux/mfd/core.h
> > @@ -16,6 +16,35 @@
> >   #include <linux/platform_device.h>
> 
> > +#define MFD_CELL_BASIC(_name, _res, _pdata, _pdsize, _id)		\
> > +	MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, NULL)	\
> > +
> > +#define MFD_CELL_RES(_name, _res)					\
> > +	MFD_CELL_ALL(_name, _res, _pdata, 0, 0, NULL, NULL)		\
> > +
> Here _pdata should not be used. Instead it should be NULL.

Yes, it should.  Thanks for the review.

> I corrected it locally and then compiled and teste.

Wonderful, thanks.

> Once above fixed, you can take my ack and tested by
> 
> Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
> Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* [PATCH 3/3] mfd: db8500-prcmu: Example using new OF_MFD_CELL/MFD_CELL_BASIC MACROs
  2016-07-13 11:26 ` [PATCH 3/3] mfd: db8500-prcmu: Example using new OF_MFD_CELL/MFD_CELL_BASIC MACROs Lee Jones
@ 2016-08-04  7:47   ` Linus Walleij
  2016-08-05  7:40     ` Lee Jones
  0 siblings, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2016-08-04  7:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jul 13, 2016 at 1:26 PM, Lee Jones <lee.jones@linaro.org> wrote:

> ... with and without 'resources'.
>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

I'm not 100% sure what is going on but the result sure looks
neat and I'll be happy to test the result and complain if anything
breaks ;)

Yours,
Linus Walleij

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

* [PATCH 3/3] mfd: db8500-prcmu: Example using new OF_MFD_CELL/MFD_CELL_BASIC MACROs
  2016-08-04  7:47   ` Linus Walleij
@ 2016-08-05  7:40     ` Lee Jones
  0 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2016-08-05  7:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 04 Aug 2016, Linus Walleij wrote:

> On Wed, Jul 13, 2016 at 1:26 PM, Lee Jones <lee.jones@linaro.org> wrote:
> 
> > ... with and without 'resources'.
> >
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> 
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> 
> I'm not 100% sure what is going on but the result sure looks
> neat and I'll be happy to test the result and complain if anything
> breaks ;)

:)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2016-08-05  7:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-13 11:26 [PATCH 0/3] mfd: Provide MACRO to declare commonly defined MFD cell attributes Lee Jones
2016-07-13 11:26 ` [PATCH 1/3] " Lee Jones
2016-07-15 13:09   ` Laxman Dewangan
2016-07-18 13:25     ` Lee Jones
2016-07-13 11:26 ` [PATCH 2/3] mfd: ab8500: Example using new OF_MFD_CELL MACRO Lee Jones
2016-07-13 11:26 ` [PATCH 3/3] mfd: db8500-prcmu: Example using new OF_MFD_CELL/MFD_CELL_BASIC MACROs Lee Jones
2016-08-04  7:47   ` Linus Walleij
2016-08-05  7:40     ` Lee Jones

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