Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Match data improvements for palmas driver
@ 2023-08-28 15:31 Biju Das
  2023-08-28 15:31 ` [PATCH v2 1/2] mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chip Biju Das
  2023-08-28 15:31 ` [PATCH v2 2/2] mfd: palmas: Make similar OF and ID table Biju Das
  0 siblings, 2 replies; 7+ messages in thread
From: Biju Das @ 2023-08-28 15:31 UTC (permalink / raw)
  To: Tony Lindgren, Lee Jones
  Cc: Biju Das, linux-omap, linux-kernel, Andy Shevchenko

This patch series aims to add match data improvements for palmas driver.

This patch is only compile tested.

v1->v2:
 * Moved the OF table just above its user.
 * Removed trailing comma from the terminator entry for the OF table.

Biju Das (2):
  mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chip
  mfd: palmas: Make similar OF and ID table

 drivers/mfd/palmas.c | 60 +++++++++++++++++---------------------------
 1 file changed, 23 insertions(+), 37 deletions(-)

-- 
2.25.1


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

* [PATCH v2 1/2] mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chip
  2023-08-28 15:31 [PATCH v2 0/2] Match data improvements for palmas driver Biju Das
@ 2023-08-28 15:31 ` Biju Das
  2023-08-29 14:47   ` Andy Shevchenko
  2023-08-28 15:31 ` [PATCH v2 2/2] mfd: palmas: Make similar OF and ID table Biju Das
  1 sibling, 1 reply; 7+ messages in thread
From: Biju Das @ 2023-08-28 15:31 UTC (permalink / raw)
  To: Tony Lindgren, Lee Jones
  Cc: Biju Das, linux-omap, linux-kernel, Andy Shevchenko

Constify .data in OF table and {palmas,tps65917}_irq_chip and replace
the variable *features->features in struct palmas_driver_data and
drop the {palmas,tps659038}_features variables and use their values
directly in the named initialization.

While at it, drop the inner leading commas for OF match table.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v1->v2:
 * Moved the OF table just above its user.
 * Removed trailing comma from the terminator entry for the OF table.
---
 drivers/mfd/palmas.c | 52 ++++++++++++++++----------------------------
 1 file changed, 19 insertions(+), 33 deletions(-)

diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index 6e562bab62e4..3ac9dec2b117 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -296,7 +296,7 @@ static const struct regmap_irq palmas_irqs[] = {
 	},
 };
 
-static struct regmap_irq_chip palmas_irq_chip = {
+static const struct regmap_irq_chip palmas_irq_chip = {
 	.name = "palmas",
 	.irqs = palmas_irqs,
 	.num_irqs = ARRAY_SIZE(palmas_irqs),
@@ -309,7 +309,7 @@ static struct regmap_irq_chip palmas_irq_chip = {
 			PALMAS_INT1_MASK),
 };
 
-static struct regmap_irq_chip tps65917_irq_chip = {
+static const struct regmap_irq_chip tps65917_irq_chip = {
 	.name = "tps65917",
 	.irqs = tps65917_irqs,
 	.num_irqs = ARRAY_SIZE(tps65917_irqs),
@@ -463,51 +463,29 @@ static void palmas_power_off(void)
 				__func__, ret);
 }
 
-static unsigned int palmas_features = PALMAS_PMIC_FEATURE_SMPS10_BOOST;
-static unsigned int tps659038_features;
-
 struct palmas_driver_data {
-	unsigned int *features;
-	struct regmap_irq_chip *irq_chip;
+	unsigned int features;
+	const struct regmap_irq_chip *irq_chip;
 };
 
-static struct palmas_driver_data palmas_data = {
-	.features = &palmas_features,
+static const struct palmas_driver_data palmas_data = {
+	.features = PALMAS_PMIC_FEATURE_SMPS10_BOOST,
 	.irq_chip = &palmas_irq_chip,
 };
 
-static struct palmas_driver_data tps659038_data = {
-	.features = &tps659038_features,
+static const struct palmas_driver_data tps659038_data = {
 	.irq_chip = &palmas_irq_chip,
 };
 
-static struct palmas_driver_data tps65917_data = {
-	.features = &tps659038_features,
+static const struct palmas_driver_data tps65917_data = {
 	.irq_chip = &tps65917_irq_chip,
 };
 
-static const struct of_device_id of_palmas_match_tbl[] = {
-	{
-		.compatible = "ti,palmas",
-		.data = &palmas_data,
-	},
-	{
-		.compatible = "ti,tps659038",
-		.data = &tps659038_data,
-	},
-	{
-		.compatible = "ti,tps65917",
-		.data = &tps65917_data,
-	},
-	{ },
-};
-MODULE_DEVICE_TABLE(of, of_palmas_match_tbl);
-
 static int palmas_i2c_probe(struct i2c_client *i2c)
 {
 	struct palmas *palmas;
 	struct palmas_platform_data *pdata;
-	struct palmas_driver_data *driver_data;
+	const struct palmas_driver_data *driver_data;
 	struct device_node *node = i2c->dev.of_node;
 	int ret = 0, i;
 	unsigned int reg, addr;
@@ -535,8 +513,8 @@ static int palmas_i2c_probe(struct i2c_client *i2c)
 	palmas->dev = &i2c->dev;
 	palmas->irq = i2c->irq;
 
-	driver_data = (struct palmas_driver_data *) device_get_match_data(&i2c->dev);
-	palmas->features = *driver_data->features;
+	driver_data = device_get_match_data(&i2c->dev);
+	palmas->features = driver_data->features;
 
 	for (i = 0; i < PALMAS_NUM_CLIENTS; i++) {
 		if (i == 0)
@@ -712,6 +690,14 @@ static void palmas_i2c_remove(struct i2c_client *i2c)
 	}
 }
 
+static const struct of_device_id of_palmas_match_tbl[] = {
+	{ .compatible = "ti,palmas", .data = &palmas_data },
+	{ .compatible = "ti,tps659038", .data = &tps659038_data },
+	{ .compatible = "ti,tps65917", .data = &tps65917_data },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, of_palmas_match_tbl);
+
 static const struct i2c_device_id palmas_i2c_id[] = {
 	{ "palmas", },
 	{ "twl6035", },
-- 
2.25.1


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

* [PATCH v2 2/2] mfd: palmas: Make similar OF and ID table
  2023-08-28 15:31 [PATCH v2 0/2] Match data improvements for palmas driver Biju Das
  2023-08-28 15:31 ` [PATCH v2 1/2] mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chip Biju Das
@ 2023-08-28 15:31 ` Biju Das
  2023-08-29 14:46   ` Andy Shevchenko
  1 sibling, 1 reply; 7+ messages in thread
From: Biju Das @ 2023-08-28 15:31 UTC (permalink / raw)
  To: Tony Lindgren, Lee Jones
  Cc: Biju Das, linux-omap, linux-kernel, Andy Shevchenko

Make similar OF and ID table to extend support for ID match using
i2c_match_data(). Currently it works only for OF match tables as the
driver_data is wrong for ID match.

While at it, drop the inner leading commas for ID  table.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v1->v2:
 * Removed trailing comma in the terminator entry for ID table
---
 drivers/mfd/palmas.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index 3ac9dec2b117..7fc886f4f80e 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -513,7 +513,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c)
 	palmas->dev = &i2c->dev;
 	palmas->irq = i2c->irq;
 
-	driver_data = device_get_match_data(&i2c->dev);
+	driver_data = i2c_get_match_data(i2c);
 	palmas->features = driver_data->features;
 
 	for (i = 0; i < PALMAS_NUM_CLIENTS; i++) {
@@ -699,10 +699,10 @@ static const struct of_device_id of_palmas_match_tbl[] = {
 MODULE_DEVICE_TABLE(of, of_palmas_match_tbl);
 
 static const struct i2c_device_id palmas_i2c_id[] = {
-	{ "palmas", },
-	{ "twl6035", },
-	{ "twl6037", },
-	{ "tps65913", },
+	{ "palmas", (kernel_ulong_t)&palmas_data },
+	{ "twl6035", (kernel_ulong_t)&palmas_data },
+	{ "twl6037", (kernel_ulong_t)&palmas_data },
+	{ "tps65913", (kernel_ulong_t)&palmas_data },
 	{ /* end */ }
 };
 MODULE_DEVICE_TABLE(i2c, palmas_i2c_id);
-- 
2.25.1


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

* Re: [PATCH v2 2/2] mfd: palmas: Make similar OF and ID table
  2023-08-28 15:31 ` [PATCH v2 2/2] mfd: palmas: Make similar OF and ID table Biju Das
@ 2023-08-29 14:46   ` Andy Shevchenko
  2023-08-29 14:51     ` Biju Das
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2023-08-29 14:46 UTC (permalink / raw)
  To: Biju Das; +Cc: Tony Lindgren, Lee Jones, linux-omap, linux-kernel

On Mon, Aug 28, 2023 at 04:31:44PM +0100, Biju Das wrote:
> Make similar OF and ID table to extend support for ID match using
> i2c_match_data(). Currently it works only for OF match tables as the
> driver_data is wrong for ID match.

...

> While at it, drop the inner leading commas for ID  table.

Are you sure?

------------------v
> -	{ "palmas", },
> -	{ "twl6035", },
> -	{ "twl6037", },
> -	{ "tps65913", },
> +	{ "palmas", (kernel_ulong_t)&palmas_data },
> +	{ "twl6035", (kernel_ulong_t)&palmas_data },
> +	{ "twl6037", (kernel_ulong_t)&palmas_data },
> +	{ "tps65913", (kernel_ulong_t)&palmas_data },

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2 1/2] mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chip
  2023-08-28 15:31 ` [PATCH v2 1/2] mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chip Biju Das
@ 2023-08-29 14:47   ` Andy Shevchenko
  2023-08-29 14:52     ` Biju Das
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2023-08-29 14:47 UTC (permalink / raw)
  To: Biju Das; +Cc: Tony Lindgren, Lee Jones, linux-omap, linux-kernel

On Mon, Aug 28, 2023 at 04:31:43PM +0100, Biju Das wrote:
> Constify .data in OF table and {palmas,tps65917}_irq_chip and replace
> the variable *features->features in struct palmas_driver_data and
> drop the {palmas,tps659038}_features variables and use their values
> directly in the named initialization.

> While at it, drop the inner leading commas for OF match table.

s/leading/trailing/

-- 
With Best Regards,
Andy Shevchenko



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

* RE: [PATCH v2 2/2] mfd: palmas: Make similar OF and ID table
  2023-08-29 14:46   ` Andy Shevchenko
@ 2023-08-29 14:51     ` Biju Das
  0 siblings, 0 replies; 7+ messages in thread
From: Biju Das @ 2023-08-29 14:51 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Tony Lindgren, Lee Jones, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org

Hi Andy Shevchenko,

> Subject: Re: [PATCH v2 2/2] mfd: palmas: Make similar OF and ID table
> 
> On Mon, Aug 28, 2023 at 04:31:44PM +0100, Biju Das wrote:
> > Make similar OF and ID table to extend support for ID match using
> > i2c_match_data(). Currently it works only for OF match tables as the
> > driver_data is wrong for ID match.
> 
> ...
> 
> > While at it, drop the inner leading commas for ID  table.
> 
> Are you sure?

Oops. Will drop it.

Cheers,
Biju

> 
> ------------------v
> > -	{ "palmas", },
> > -	{ "twl6035", },
> > -	{ "twl6037", },
> > -	{ "tps65913", },
> > +	{ "palmas", (kernel_ulong_t)&palmas_data },
> > +	{ "twl6035", (kernel_ulong_t)&palmas_data },
> > +	{ "twl6037", (kernel_ulong_t)&palmas_data },
> > +	{ "tps65913", (kernel_ulong_t)&palmas_data },
> 
> --
> With Best Regards,
> Andy Shevchenko
> 


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

* RE: [PATCH v2 1/2] mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chip
  2023-08-29 14:47   ` Andy Shevchenko
@ 2023-08-29 14:52     ` Biju Das
  0 siblings, 0 replies; 7+ messages in thread
From: Biju Das @ 2023-08-29 14:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Tony Lindgren, Lee Jones, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org

Hi Andy Shevchenko,

> Subject: Re: [PATCH v2 1/2] mfd: palmas: Constify .data in OF table and
> {palmas,tps65917}_irq_chip
> 
> On Mon, Aug 28, 2023 at 04:31:43PM +0100, Biju Das wrote:
> > Constify .data in OF table and {palmas,tps65917}_irq_chip and replace
> > the variable *features->features in struct palmas_driver_data and drop
> > the {palmas,tps659038}_features variables and use their values
> > directly in the named initialization.
> 
> > While at it, drop the inner leading commas for OF match table.
> 
> s/leading/trailing/

OK, will send v3, if there is no other comments.

Cheers,
Biju

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

end of thread, other threads:[~2023-08-29 14:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-28 15:31 [PATCH v2 0/2] Match data improvements for palmas driver Biju Das
2023-08-28 15:31 ` [PATCH v2 1/2] mfd: palmas: Constify .data in OF table and {palmas,tps65917}_irq_chip Biju Das
2023-08-29 14:47   ` Andy Shevchenko
2023-08-29 14:52     ` Biju Das
2023-08-28 15:31 ` [PATCH v2 2/2] mfd: palmas: Make similar OF and ID table Biju Das
2023-08-29 14:46   ` Andy Shevchenko
2023-08-29 14:51     ` Biju Das

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox