All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] MFD: twl6040: Remove support for legacy (pdata) mode
@ 2013-07-12 11:32 Peter Ujfalusi
  2013-07-12 11:32 ` [PATCH 2/3] MFD: twl6040: Cosmetic, parameter alignment change Peter Ujfalusi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Peter Ujfalusi @ 2013-07-12 11:32 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones; +Cc: linux-kernel

TWL6040 is used only with OMAP4/5 SoCs and they can only boot in in DT mode.
The support for pdata/legacy boot can be removed.

Add TODO comment to the header file that all pdata struct can be removed in
the next merge window (after the sub driver updates are in).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/mfd/twl6040.c       | 55 +++++++++++----------------------------------
 include/linux/mfd/twl6040.h |  1 +
 2 files changed, 14 insertions(+), 42 deletions(-)

diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index 492ee2c..a4034ed 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -44,17 +44,12 @@
 #define VIBRACTRL_MEMBER(reg) ((reg == TWL6040_REG_VIBCTLL) ? 0 : 1)
 #define TWL6040_NUM_SUPPLIES	(2)
 
-static bool twl6040_has_vibra(struct twl6040_platform_data *pdata,
-			      struct device_node *node)
+static bool twl6040_has_vibra(struct device_node *node)
 {
-	if (pdata && pdata->vibra)
-		return true;
-
 #ifdef CONFIG_OF
 	if (of_find_node_by_name(node, "vibra"))
 		return true;
 #endif
-
 	return false;
 }
 
@@ -520,14 +515,13 @@ static struct regmap_irq_chip twl6040_irq_chip = {
 static int twl6040_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	struct twl6040_platform_data *pdata = client->dev.platform_data;
 	struct device_node *node = client->dev.of_node;
 	struct twl6040 *twl6040;
 	struct mfd_cell *cell = NULL;
 	int irq, ret, children = 0;
 
-	if (!pdata && !node) {
-		dev_err(&client->dev, "Platform data is missing\n");
+	if (!node) {
+		dev_err(&client->dev, "of node is missing\n");
 		return -EINVAL;
 	}
 
@@ -576,13 +570,10 @@ static int twl6040_probe(struct i2c_client *client,
 	twl6040->rev = twl6040_reg_read(twl6040, TWL6040_REG_ASICREV);
 
 	/* ERRATA: Automatic power-up is not possible in ES1.0 */
-	if (twl6040_get_revid(twl6040) > TWL6040_REV_ES1_0) {
-		if (pdata)
-			twl6040->audpwron = pdata->audpwron_gpio;
-		else
-			twl6040->audpwron = of_get_named_gpio(node,
-						"ti,audpwron-gpio", 0);
-	} else
+	if (twl6040_get_revid(twl6040) > TWL6040_REV_ES1_0)
+		twl6040->audpwron = of_get_named_gpio(node,
+						      "ti,audpwron-gpio", 0);
+	else
 		twl6040->audpwron = -EINVAL;
 
 	if (gpio_is_valid(twl6040->audpwron)) {
@@ -625,8 +616,6 @@ static int twl6040_probe(struct i2c_client *client,
 	/*
 	 * The main functionality of twl6040 to provide audio on OMAP4+ systems.
 	 * We can add the ASoC codec child whenever this driver has been loaded.
-	 * The ASoC codec can work without pdata, pass the platform_data only if
-	 * it has been provided.
 	 */
 	irq = regmap_irq_get_virq(twl6040->irq_data, TWL6040_IRQ_PLUG);
 	cell = &twl6040->cells[children];
@@ -635,13 +624,10 @@ static int twl6040_probe(struct i2c_client *client,
 	twl6040_codec_rsrc[0].end = irq;
 	cell->resources = twl6040_codec_rsrc;
 	cell->num_resources = ARRAY_SIZE(twl6040_codec_rsrc);
-	if (pdata && pdata->codec) {
-		cell->platform_data = pdata->codec;
-		cell->pdata_size = sizeof(*pdata->codec);
-	}
 	children++;
 
-	if (twl6040_has_vibra(pdata, node)) {
+	/* Vibra input driver support */
+	if (twl6040_has_vibra(node)) {
 		irq = regmap_irq_get_virq(twl6040->irq_data, TWL6040_IRQ_VIB);
 
 		cell = &twl6040->cells[children];
@@ -650,28 +636,13 @@ static int twl6040_probe(struct i2c_client *client,
 		twl6040_vibra_rsrc[0].end = irq;
 		cell->resources = twl6040_vibra_rsrc;
 		cell->num_resources = ARRAY_SIZE(twl6040_vibra_rsrc);
-
-		if (pdata && pdata->vibra) {
-			cell->platform_data = pdata->vibra;
-			cell->pdata_size = sizeof(*pdata->vibra);
-		}
 		children++;
 	}
 
-	/*
-	 * Enable the GPO driver in the following cases:
-	 * DT booted kernel or legacy boot with valid gpo platform_data
-	 */
-	if (!pdata || (pdata && pdata->gpo)) {
-		cell = &twl6040->cells[children];
-		cell->name = "twl6040-gpo";
-
-		if (pdata) {
-			cell->platform_data = pdata->gpo;
-			cell->pdata_size = sizeof(*pdata->gpo);
-		}
-		children++;
-	}
+	/* GPO support */
+	cell = &twl6040->cells[children];
+	cell->name = "twl6040-gpo";
+	children++;
 
 	ret = mfd_add_devices(&client->dev, -1, twl6040->cells, children,
 			      NULL, 0, NULL);
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 7e7fbce..6dd8893 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -185,6 +185,7 @@
 
 #define TWL6040_GPO_MAX	3
 
+/* TODO: All platform data struct can be removed */
 struct twl6040_codec_data {
 	u16 hs_left_step;
 	u16 hs_right_step;
-- 
1.8.2.1


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

* [PATCH 2/3] MFD: twl6040: Cosmetic, parameter alignment change
  2013-07-12 11:32 [PATCH 1/3] MFD: twl6040: Remove support for legacy (pdata) mode Peter Ujfalusi
@ 2013-07-12 11:32 ` Peter Ujfalusi
  2013-07-12 13:50   ` Lee Jones
  2013-07-12 11:32 ` [PATCH 3/3] MFD: twl6040: Cleanup in early error handling in probe function Peter Ujfalusi
  2013-07-12 13:49 ` [PATCH 1/3] MFD: twl6040: Remove support for legacy (pdata) mode Lee Jones
  2 siblings, 1 reply; 6+ messages in thread
From: Peter Ujfalusi @ 2013-07-12 11:32 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones; +Cc: linux-kernel

To comply with coding style.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/mfd/twl6040.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index a4034ed..3bd110e 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -549,7 +549,7 @@ static int twl6040_probe(struct i2c_client *client,
 	twl6040->supplies[0].supply = "vio";
 	twl6040->supplies[1].supply = "v2v1";
 	ret = devm_regulator_bulk_get(&client->dev, TWL6040_NUM_SUPPLIES,
-				 twl6040->supplies);
+				      twl6040->supplies);
 	if (ret != 0) {
 		dev_err(&client->dev, "Failed to get supplies: %d\n", ret);
 		goto regulator_get_err;
@@ -578,33 +578,32 @@ static int twl6040_probe(struct i2c_client *client,
 
 	if (gpio_is_valid(twl6040->audpwron)) {
 		ret = devm_gpio_request_one(&client->dev, twl6040->audpwron,
-					GPIOF_OUT_INIT_LOW, "audpwron");
+					    GPIOF_OUT_INIT_LOW, "audpwron");
 		if (ret)
 			goto gpio_err;
 	}
 
-	ret = regmap_add_irq_chip(twl6040->regmap, twl6040->irq,
-			IRQF_ONESHOT, 0, &twl6040_irq_chip,
-			&twl6040->irq_data);
+	ret = regmap_add_irq_chip(twl6040->regmap, twl6040->irq, IRQF_ONESHOT,
+				  0, &twl6040_irq_chip,&twl6040->irq_data);
 	if (ret < 0)
 		goto gpio_err;
 
 	twl6040->irq_ready = regmap_irq_get_virq(twl6040->irq_data,
-					       TWL6040_IRQ_READY);
+						 TWL6040_IRQ_READY);
 	twl6040->irq_th = regmap_irq_get_virq(twl6040->irq_data,
-					       TWL6040_IRQ_TH);
+					      TWL6040_IRQ_TH);
 
 	ret = devm_request_threaded_irq(twl6040->dev, twl6040->irq_ready, NULL,
-				   twl6040_readyint_handler, IRQF_ONESHOT,
-				   "twl6040_irq_ready", twl6040);
+					twl6040_readyint_handler, IRQF_ONESHOT,
+					"twl6040_irq_ready", twl6040);
 	if (ret) {
 		dev_err(twl6040->dev, "READY IRQ request failed: %d\n", ret);
 		goto readyirq_err;
 	}
 
 	ret = devm_request_threaded_irq(twl6040->dev, twl6040->irq_th, NULL,
-				   twl6040_thint_handler, IRQF_ONESHOT,
-				   "twl6040_irq_th", twl6040);
+					twl6040_thint_handler, IRQF_ONESHOT,
+					"twl6040_irq_th", twl6040);
 	if (ret) {
 		dev_err(twl6040->dev, "Thermal IRQ request failed: %d\n", ret);
 		goto thirq_err;
-- 
1.8.2.1


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

* [PATCH 3/3] MFD: twl6040: Cleanup in early error handling in probe function
  2013-07-12 11:32 [PATCH 1/3] MFD: twl6040: Remove support for legacy (pdata) mode Peter Ujfalusi
  2013-07-12 11:32 ` [PATCH 2/3] MFD: twl6040: Cosmetic, parameter alignment change Peter Ujfalusi
@ 2013-07-12 11:32 ` Peter Ujfalusi
  2013-07-12 13:51   ` Lee Jones
  2013-07-12 13:49 ` [PATCH 1/3] MFD: twl6040: Remove support for legacy (pdata) mode Lee Jones
  2 siblings, 1 reply; 6+ messages in thread
From: Peter Ujfalusi @ 2013-07-12 11:32 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones; +Cc: linux-kernel

The err: label is not needed we can just return instead of the jump there.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/mfd/twl6040.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index 3bd110e..4d8d3b7 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -533,16 +533,12 @@ static int twl6040_probe(struct i2c_client *client,
 
 	twl6040 = devm_kzalloc(&client->dev, sizeof(struct twl6040),
 			       GFP_KERNEL);
-	if (!twl6040) {
-		ret = -ENOMEM;
-		goto err;
-	}
+	if (!twl6040)
+		return -ENOMEM;
 
 	twl6040->regmap = devm_regmap_init_i2c(client, &twl6040_regmap_config);
-	if (IS_ERR(twl6040->regmap)) {
-		ret = PTR_ERR(twl6040->regmap);
-		goto err;
-	}
+	if (IS_ERR(twl6040->regmap))
+		return PTR_ERR(twl6040->regmap);
 
 	i2c_set_clientdata(client, twl6040);
 
@@ -660,7 +656,7 @@ gpio_err:
 	regulator_bulk_disable(TWL6040_NUM_SUPPLIES, twl6040->supplies);
 regulator_get_err:
 	i2c_set_clientdata(client, NULL);
-err:
+
 	return ret;
 }
 
-- 
1.8.2.1


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

* Re: [PATCH 1/3] MFD: twl6040: Remove support for legacy (pdata) mode
  2013-07-12 11:32 [PATCH 1/3] MFD: twl6040: Remove support for legacy (pdata) mode Peter Ujfalusi
  2013-07-12 11:32 ` [PATCH 2/3] MFD: twl6040: Cosmetic, parameter alignment change Peter Ujfalusi
  2013-07-12 11:32 ` [PATCH 3/3] MFD: twl6040: Cleanup in early error handling in probe function Peter Ujfalusi
@ 2013-07-12 13:49 ` Lee Jones
  2 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2013-07-12 13:49 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: Samuel Ortiz, linux-kernel

On Fri, 12 Jul 2013, Peter Ujfalusi wrote:

> TWL6040 is used only with OMAP4/5 SoCs and they can only boot in in DT mode.
> The support for pdata/legacy boot can be removed.
> 
> Add TODO comment to the header file that all pdata struct can be removed in
> the next merge window (after the sub driver updates are in).
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
>  drivers/mfd/twl6040.c       | 55 +++++++++++----------------------------------
>  include/linux/mfd/twl6040.h |  1 +
>  2 files changed, 14 insertions(+), 42 deletions(-)

Applied, thanks.

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

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

* Re: [PATCH 2/3] MFD: twl6040: Cosmetic, parameter alignment change
  2013-07-12 11:32 ` [PATCH 2/3] MFD: twl6040: Cosmetic, parameter alignment change Peter Ujfalusi
@ 2013-07-12 13:50   ` Lee Jones
  0 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2013-07-12 13:50 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: Samuel Ortiz, linux-kernel

On Fri, 12 Jul 2013, Peter Ujfalusi wrote:

> To comply with coding style.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
>  drivers/mfd/twl6040.c | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)

It's fine indent using tabs as well as squaring up to parentheses.

Patch applied in any case.

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

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

* Re: [PATCH 3/3] MFD: twl6040: Cleanup in early error handling in probe function
  2013-07-12 11:32 ` [PATCH 3/3] MFD: twl6040: Cleanup in early error handling in probe function Peter Ujfalusi
@ 2013-07-12 13:51   ` Lee Jones
  0 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2013-07-12 13:51 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: Samuel Ortiz, linux-kernel

On Fri, 12 Jul 2013, Peter Ujfalusi wrote:

> The err: label is not needed we can just return instead of the jump there.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
>  drivers/mfd/twl6040.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)

Nice little clean-up. Applied, thanks.

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

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

end of thread, other threads:[~2013-07-12 13:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-12 11:32 [PATCH 1/3] MFD: twl6040: Remove support for legacy (pdata) mode Peter Ujfalusi
2013-07-12 11:32 ` [PATCH 2/3] MFD: twl6040: Cosmetic, parameter alignment change Peter Ujfalusi
2013-07-12 13:50   ` Lee Jones
2013-07-12 11:32 ` [PATCH 3/3] MFD: twl6040: Cleanup in early error handling in probe function Peter Ujfalusi
2013-07-12 13:51   ` Lee Jones
2013-07-12 13:49 ` [PATCH 1/3] MFD: twl6040: Remove support for legacy (pdata) mode Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.