All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] mfd: tps65910: dt: cleanups in device node parsing
@ 2012-05-18 20:31 Laxman Dewangan
  2012-05-18 20:31 ` [PATCH 1/3] mfd: save device node parsed platform data for sub devices Laxman Dewangan
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Laxman Dewangan @ 2012-05-18 20:31 UTC (permalink / raw)
  To: grant.likely, linus.walleij, sameo, broonie, lrg
  Cc: linux-kernel, Laxman Dewangan

In this patch series organizing the processing of device node locally specific
to driver.
- The gpio specific processing is moved to gpio driver.
- Core will only process the non-subdevices information.
- Also keep the allocated pointer for device node in to global structure
  so that sub devices can use this.

This patch series is generated on-top of Samuel's mfd subsystem tree.


Laxman Dewangan (3):
  mfd: save device node parsed platform data for sub devices
  mfd: remove the parsing of dt info for gpio
  gpio: tps65910: dt: process gpio specific device node info

 drivers/gpio/gpio-tps65910.c |   36 ++++++++++++++++++++++++++++++++++++
 drivers/mfd/tps65910.c       |   21 +++++----------------
 include/linux/mfd/tps65910.h |    3 +++
 3 files changed, 44 insertions(+), 16 deletions(-)


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

* [PATCH 1/3] mfd: save device node parsed platform data for sub devices
  2012-05-18 20:31 [PATCH 0/3] mfd: tps65910: dt: cleanups in device node parsing Laxman Dewangan
@ 2012-05-18 20:31 ` Laxman Dewangan
  2012-05-18 20:31 ` [PATCH 2/3] mfd: remove the parsing of dt info for gpio Laxman Dewangan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Laxman Dewangan @ 2012-05-18 20:31 UTC (permalink / raw)
  To: grant.likely, linus.walleij, sameo, broonie, lrg
  Cc: linux-kernel, Laxman Dewangan

Save the allocated memory to store the parsed device node information
to the global device structure so that sub devices can directly use this
pointer.
In this way, the sub devices does not require to re-allocate the
memory for storing the sub-devices specific device node information.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
 drivers/mfd/tps65910.c       |    6 +++++-
 include/linux/mfd/tps65910.h |    3 +++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
index 18b30cf..05d449b 100644
--- a/drivers/mfd/tps65910.c
+++ b/drivers/mfd/tps65910.c
@@ -209,14 +209,17 @@ static __devinit int tps65910_i2c_probe(struct i2c_client *i2c,
 {
 	struct tps65910 *tps65910;
 	struct tps65910_board *pmic_plat_data;
+	struct tps65910_board *of_pmic_plat_data = NULL;
 	struct tps65910_platform_data *init_data;
 	int ret = 0;
 	int chip_id = id->driver_data;
 
 	pmic_plat_data = dev_get_platdata(&i2c->dev);
 
-	if (!pmic_plat_data && i2c->dev.of_node)
+	if (!pmic_plat_data && i2c->dev.of_node) {
 		pmic_plat_data = tps65910_parse_dt(i2c, &chip_id);
+		of_pmic_plat_data = pmic_plat_data;
+	}
 
 	if (!pmic_plat_data)
 		return -EINVAL;
@@ -229,6 +232,7 @@ static __devinit int tps65910_i2c_probe(struct i2c_client *i2c,
 	if (tps65910 == NULL)
 		return -ENOMEM;
 
+	tps65910->of_plat_data = of_pmic_plat_data;
 	i2c_set_clientdata(i2c, tps65910);
 	tps65910->dev = &i2c->dev;
 	tps65910->i2c_client = i2c;
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index ab04e90..dd8dc0a 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -830,6 +830,9 @@ struct tps65910 {
 	struct tps65910_rtc *rtc;
 	struct tps65910_power *power;
 
+	/* Device node parsed board data */
+	struct tps65910_board *of_plat_data;
+
 	/* IRQ Handling */
 	struct mutex irq_lock;
 	int chip_irq;
-- 
1.7.1.1


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

* [PATCH 2/3] mfd: remove the parsing of dt info for gpio
  2012-05-18 20:31 [PATCH 0/3] mfd: tps65910: dt: cleanups in device node parsing Laxman Dewangan
  2012-05-18 20:31 ` [PATCH 1/3] mfd: save device node parsed platform data for sub devices Laxman Dewangan
@ 2012-05-18 20:31 ` Laxman Dewangan
  2012-05-18 20:31 ` [PATCH 3/3] gpio: tps65910: dt: process gpio specific device node info Laxman Dewangan
  2012-05-22 21:51 ` [PATCH 0/3] mfd: tps65910: dt: cleanups in device node parsing Samuel Ortiz
  3 siblings, 0 replies; 6+ messages in thread
From: Laxman Dewangan @ 2012-05-18 20:31 UTC (permalink / raw)
  To: grant.likely, linus.walleij, sameo, broonie, lrg
  Cc: linux-kernel, Laxman Dewangan

Remove the parsing of device node information for sub devices
from core file.
The sub devices will parse the information as per the sub-devices
specific information.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
 drivers/mfd/tps65910.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
index 05d449b..be9e07b 100644
--- a/drivers/mfd/tps65910.c
+++ b/drivers/mfd/tps65910.c
@@ -146,9 +146,7 @@ static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client,
 	struct tps65910_board *board_info;
 	unsigned int prop;
 	const struct of_device_id *match;
-	unsigned int prop_array[TPS6591X_MAX_NUM_GPIO];
 	int ret = 0;
-	int idx;
 
 	match = of_match_device(tps65910_of_match, &client->dev);
 	if (!match) {
@@ -177,21 +175,8 @@ static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client,
 	else if (*chip_id == TPS65911)
 		dev_warn(&client->dev, "VMBCH2-Threshold not specified");
 
-	ret = of_property_read_u32_array(np, "ti,en-gpio-sleep",
-				   prop_array, TPS6591X_MAX_NUM_GPIO);
-	if (!ret)
-		for (idx = 0; idx < ARRAY_SIZE(prop_array); idx++)
-			board_info->en_gpio_sleep[idx] = (prop_array[idx] != 0);
-	else if (ret != -EINVAL) {
-		dev_err(&client->dev,
-			"error reading property ti,en-gpio-sleep: %d\n.", ret);
-		return NULL;
-	}
-
-
 	board_info->irq = client->irq;
 	board_info->irq_base = -1;
-	board_info->gpio_base = -1;
 
 	return board_info;
 }
-- 
1.7.1.1


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

* [PATCH 3/3] gpio: tps65910: dt: process gpio specific device node info
  2012-05-18 20:31 [PATCH 0/3] mfd: tps65910: dt: cleanups in device node parsing Laxman Dewangan
  2012-05-18 20:31 ` [PATCH 1/3] mfd: save device node parsed platform data for sub devices Laxman Dewangan
  2012-05-18 20:31 ` [PATCH 2/3] mfd: remove the parsing of dt info for gpio Laxman Dewangan
@ 2012-05-18 20:31 ` Laxman Dewangan
  2012-05-18 23:31   ` Grant Likely
  2012-05-22 21:51 ` [PATCH 0/3] mfd: tps65910: dt: cleanups in device node parsing Samuel Ortiz
  3 siblings, 1 reply; 6+ messages in thread
From: Laxman Dewangan @ 2012-05-18 20:31 UTC (permalink / raw)
  To: grant.likely, linus.walleij, sameo, broonie, lrg
  Cc: linux-kernel, Laxman Dewangan

Parse the gpio specific device node information locally.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
 drivers/gpio/gpio-tps65910.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c
index af6dc83..c1ad288 100644
--- a/drivers/gpio/gpio-tps65910.c
+++ b/drivers/gpio/gpio-tps65910.c
@@ -20,6 +20,7 @@
 #include <linux/i2c.h>
 #include <linux/platform_device.h>
 #include <linux/mfd/tps65910.h>
+#include <linux/of_device.h>
 
 struct tps65910_gpio {
 	struct gpio_chip gpio_chip;
@@ -81,6 +82,37 @@ static int tps65910_gpio_input(struct gpio_chip *gc, unsigned offset)
 						GPIO_CFG_MASK);
 }
 
+#ifdef CONFIG_OF
+static struct tps65910_board *tps65910_parse_dt_for_gpio(struct device *dev,
+		struct tps65910 *tps65910, int chip_ngpio)
+{
+	struct tps65910_board *tps65910_board = tps65910->of_plat_data;
+	unsigned int prop_array[TPS6591X_MAX_NUM_GPIO];
+	int ngpio = min(chip_ngpio, TPS6591X_MAX_NUM_GPIO);
+	int ret;
+	int idx;
+
+	tps65910_board->gpio_base = -1;
+	ret = of_property_read_u32_array(tps65910->dev->of_node,
+			"ti,en-gpio-sleep", prop_array, ngpio);
+	if (ret < 0) {
+		dev_dbg(dev, "ti,en-gpio-sleep not specified\n");
+		return tps65910_board;
+	}
+
+	for (idx = 0; idx < ngpio; idx++)
+		tps65910_board->en_gpio_sleep[idx] = (prop_array[idx] != 0);
+
+	return tps65910_board;
+}
+#else
+static struct tps65910_board *tps65910_parse_dt_for_gpio(struct device *dev,
+		struct tps65910 *tps65910, int chip_ngpio)
+{
+	return NULL;
+}
+#endif
+
 static int __devinit tps65910_gpio_probe(struct platform_device *pdev)
 {
 	struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent);
@@ -122,6 +154,10 @@ static int __devinit tps65910_gpio_probe(struct platform_device *pdev)
 	else
 		tps65910_gpio->gpio_chip.base = -1;
 
+	if (!pdata && tps65910->dev->of_node)
+		pdata = tps65910_parse_dt_for_gpio(&pdev->dev, tps65910,
+			tps65910_gpio->gpio_chip.ngpio);
+
 	if (!pdata)
 		goto skip_init;
 
-- 
1.7.1.1


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

* Re: [PATCH 3/3] gpio: tps65910: dt: process gpio specific device node info
  2012-05-18 20:31 ` [PATCH 3/3] gpio: tps65910: dt: process gpio specific device node info Laxman Dewangan
@ 2012-05-18 23:31   ` Grant Likely
  0 siblings, 0 replies; 6+ messages in thread
From: Grant Likely @ 2012-05-18 23:31 UTC (permalink / raw)
  To: Laxman Dewangan, linus.walleij, sameo, broonie, lrg
  Cc: linux-kernel, Laxman Dewangan

On Sat, 19 May 2012 02:01:43 +0530, Laxman Dewangan <ldewangan@nvidia.com> wrote:
> Parse the gpio specific device node information locally.
> 
> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

I expect this needs to go in via Samuel's tree with the mfd patches?

g.

> ---
>  drivers/gpio/gpio-tps65910.c |   36 ++++++++++++++++++++++++++++++++++++
>  1 files changed, 36 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c
> index af6dc83..c1ad288 100644
> --- a/drivers/gpio/gpio-tps65910.c
> +++ b/drivers/gpio/gpio-tps65910.c
> @@ -20,6 +20,7 @@
>  #include <linux/i2c.h>
>  #include <linux/platform_device.h>
>  #include <linux/mfd/tps65910.h>
> +#include <linux/of_device.h>
>  
>  struct tps65910_gpio {
>  	struct gpio_chip gpio_chip;
> @@ -81,6 +82,37 @@ static int tps65910_gpio_input(struct gpio_chip *gc, unsigned offset)
>  						GPIO_CFG_MASK);
>  }
>  
> +#ifdef CONFIG_OF
> +static struct tps65910_board *tps65910_parse_dt_for_gpio(struct device *dev,
> +		struct tps65910 *tps65910, int chip_ngpio)
> +{
> +	struct tps65910_board *tps65910_board = tps65910->of_plat_data;
> +	unsigned int prop_array[TPS6591X_MAX_NUM_GPIO];
> +	int ngpio = min(chip_ngpio, TPS6591X_MAX_NUM_GPIO);
> +	int ret;
> +	int idx;
> +
> +	tps65910_board->gpio_base = -1;
> +	ret = of_property_read_u32_array(tps65910->dev->of_node,
> +			"ti,en-gpio-sleep", prop_array, ngpio);
> +	if (ret < 0) {
> +		dev_dbg(dev, "ti,en-gpio-sleep not specified\n");
> +		return tps65910_board;
> +	}
> +
> +	for (idx = 0; idx < ngpio; idx++)
> +		tps65910_board->en_gpio_sleep[idx] = (prop_array[idx] != 0);
> +
> +	return tps65910_board;
> +}
> +#else
> +static struct tps65910_board *tps65910_parse_dt_for_gpio(struct device *dev,
> +		struct tps65910 *tps65910, int chip_ngpio)
> +{
> +	return NULL;
> +}
> +#endif
> +
>  static int __devinit tps65910_gpio_probe(struct platform_device *pdev)
>  {
>  	struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent);
> @@ -122,6 +154,10 @@ static int __devinit tps65910_gpio_probe(struct platform_device *pdev)
>  	else
>  		tps65910_gpio->gpio_chip.base = -1;
>  
> +	if (!pdata && tps65910->dev->of_node)
> +		pdata = tps65910_parse_dt_for_gpio(&pdev->dev, tps65910,
> +			tps65910_gpio->gpio_chip.ngpio);
> +
>  	if (!pdata)
>  		goto skip_init;
>  
> -- 
> 1.7.1.1
> 

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.

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

* Re: [PATCH 0/3] mfd: tps65910: dt: cleanups in device node parsing
  2012-05-18 20:31 [PATCH 0/3] mfd: tps65910: dt: cleanups in device node parsing Laxman Dewangan
                   ` (2 preceding siblings ...)
  2012-05-18 20:31 ` [PATCH 3/3] gpio: tps65910: dt: process gpio specific device node info Laxman Dewangan
@ 2012-05-22 21:51 ` Samuel Ortiz
  3 siblings, 0 replies; 6+ messages in thread
From: Samuel Ortiz @ 2012-05-22 21:51 UTC (permalink / raw)
  To: Laxman Dewangan; +Cc: grant.likely, linus.walleij, broonie, lrg, linux-kernel

Hi Laxman,

On Sat, May 19, 2012 at 02:01:40AM +0530, Laxman Dewangan wrote:
> In this patch series organizing the processing of device node locally specific
> to driver.
> - The gpio specific processing is moved to gpio driver.
> - Core will only process the non-subdevices information.
> - Also keep the allocated pointer for device node in to global structure
>   so that sub devices can use this.
> 
> This patch series is generated on-top of Samuel's mfd subsystem tree.
Thanks, all 3 patches applied.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2012-05-22 21:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-18 20:31 [PATCH 0/3] mfd: tps65910: dt: cleanups in device node parsing Laxman Dewangan
2012-05-18 20:31 ` [PATCH 1/3] mfd: save device node parsed platform data for sub devices Laxman Dewangan
2012-05-18 20:31 ` [PATCH 2/3] mfd: remove the parsing of dt info for gpio Laxman Dewangan
2012-05-18 20:31 ` [PATCH 3/3] gpio: tps65910: dt: process gpio specific device node info Laxman Dewangan
2012-05-18 23:31   ` Grant Likely
2012-05-22 21:51 ` [PATCH 0/3] mfd: tps65910: dt: cleanups in device node parsing Samuel Ortiz

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.