linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] gpio-twl4030: add new device tree properties
@ 2012-09-03 13:54 Florian Vaussard
  2012-09-03 13:54 ` [PATCH 1/3] gpio-twl4030: get platform data from device tree Florian Vaussard
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Florian Vaussard @ 2012-09-03 13:54 UTC (permalink / raw)
  To: linux-arm-kernel

A number of platform data are missing when using twl4030/gpio from a
device tree. This patchset adds the missing properties, updates
existing device trees and updates the documentation of bindings.
It mainly enables LEDA and LEDB outputs, as well as pullups /
pulldowns on GPIOs.

The 1st patch changes the device driver.
The 2nd patch updates the device trees for BeagleBoard and omap3-evm.
The 3rd patch updates the documentation of bindings.

Tested:
- Boot tested on Gumstix Overo for "ti,use-leds". Corresponding
  patch is not provided, as the device tree is not yet merged.
  The support can be found in the git tree [1], branch
  omap3-devel-dt-overo.
- Device trees for BeagleBoard and omap3-evm were compiled, but not
  tested on hardware.

Would someone be willing to test on BeagleBoard / omap3-evm?

Regards,
Florian

[1] https://github.com/vaussard/linux.git (not safe for merge)


Florian Vaussard (3):
  gpio-twl4030: get platform data from device tree
  gpio-twl4030: new dt properties for BeagleBoard and omap3-EVM
  gpio-twl4030: updates the bindings for new dt properties

 .../devicetree/bindings/gpio/gpio-twl4030.txt      |    6 ++
 arch/arm/boot/dts/omap3-beagle.dts                 |   20 +++++
 arch/arm/boot/dts/omap3-evm.dts                    |   13 +++
 drivers/gpio/gpio-twl4030.c                        |   86 +++++++++++++------
 4 files changed, 98 insertions(+), 27 deletions(-)

-- 
1.7.5.4

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

* [PATCH 1/3] gpio-twl4030: get platform data from device tree
  2012-09-03 13:54 [PATCH 0/3] gpio-twl4030: add new device tree properties Florian Vaussard
@ 2012-09-03 13:54 ` Florian Vaussard
  2012-09-04  7:27   ` Vaibhav Hiremath
  2012-09-04  7:30   ` Linus Walleij
  2012-09-03 13:54 ` [PATCH 2/3] gpio-twl4030: new dt properties for BeagleBoard and omap3-EVM Florian Vaussard
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 14+ messages in thread
From: Florian Vaussard @ 2012-09-03 13:54 UTC (permalink / raw)
  To: linux-arm-kernel

Adds a number of missing properties to the device tree of
twl4030/gpio:
- "ti,use-leds"  -> .use_leds
- "ti,debounce"  -> .debounce
- "ti,mmc-cd"    -> .mmc_cd
- "ti,pullups"   -> .pullups
- "ti,pulldowns" -> .pulldowns

Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
---
 drivers/gpio/gpio-twl4030.c |   86 +++++++++++++++++++++++++++++-------------
 1 files changed, 59 insertions(+), 27 deletions(-)

diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index 94256fe..dabe76b 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -395,6 +395,33 @@ static int __devinit gpio_twl4030_debounce(u32 debounce, u8 mmc_cd)
 
 static int gpio_twl4030_remove(struct platform_device *pdev);
 
+static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev)
+{
+	struct twl4030_gpio_platform_data *omap_twl_info;
+	const char *of_use_leds;
+
+	omap_twl_info = devm_kzalloc(dev, sizeof(*omap_twl_info), GFP_KERNEL);
+	if (!omap_twl_info)
+		return NULL;
+
+	omap_twl_info->gpio_base = -1;
+
+	of_property_read_string(dev->of_node, "ti,use-leds", &of_use_leds);
+	if (!strcmp(of_use_leds, "true"))
+		omap_twl_info->use_leds = true;
+
+	of_property_read_u32(dev->of_node, "ti,debounce",
+				&omap_twl_info->debounce);
+	of_property_read_u32(dev->of_node, "ti,mmc-cd",
+				(u32 *)&omap_twl_info->mmc_cd);
+	of_property_read_u32(dev->of_node, "ti,pullups",
+				&omap_twl_info->pullups);
+	of_property_read_u32(dev->of_node, "ti,pulldowns",
+				&omap_twl_info->pulldowns);
+
+	return omap_twl_info;
+}
+
 static int __devinit gpio_twl4030_probe(struct platform_device *pdev)
 {
 	struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data;
@@ -423,39 +450,44 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev)
 	twl4030_gpio_irq_base = irq_base;
 
 no_irqs:
-	twl_gpiochip.base = -1;
 	twl_gpiochip.ngpio = TWL4030_GPIO_MAX;
 	twl_gpiochip.dev = &pdev->dev;
 
-	if (pdata) {
-		twl_gpiochip.base = pdata->gpio_base;
+	if (node)
+		pdata = of_gpio_twl4030(&pdev->dev);
 
-		/*
-		 * NOTE:  boards may waste power if they don't set pullups
-		 * and pulldowns correctly ... default for non-ULPI pins is
-		 * pulldown, and some other pins may have external pullups
-		 * or pulldowns.  Careful!
-		 */
-		ret = gpio_twl4030_pulls(pdata->pullups, pdata->pulldowns);
-		if (ret)
-			dev_dbg(&pdev->dev, "pullups %.05x %.05x --> %d\n",
-					pdata->pullups, pdata->pulldowns,
-					ret);
-
-		ret = gpio_twl4030_debounce(pdata->debounce, pdata->mmc_cd);
-		if (ret)
-			dev_dbg(&pdev->dev, "debounce %.03x %.01x --> %d\n",
-					pdata->debounce, pdata->mmc_cd,
-					ret);
-
-		/*
-		 * NOTE: we assume VIBRA_CTL.VIBRA_EN, in MODULE_AUDIO_VOICE,
-		 * is (still) clear if use_leds is set.
-		 */
-		if (pdata->use_leds)
-			twl_gpiochip.ngpio += 2;
+	if (pdata == NULL) {
+		dev_err(&pdev->dev, "Platform data is missing\n");
+		return -ENXIO;
 	}
 
+	twl_gpiochip.base = pdata->gpio_base;
+
+	/*
+	 * NOTE:  boards may waste power if they don't set pullups
+	 * and pulldowns correctly ... default for non-ULPI pins is
+	 * pulldown, and some other pins may have external pullups
+	 * or pulldowns.  Careful!
+	 */
+	ret = gpio_twl4030_pulls(pdata->pullups, pdata->pulldowns);
+	if (ret)
+		dev_dbg(&pdev->dev, "pullups %.05x %.05x --> %d\n",
+				pdata->pullups, pdata->pulldowns,
+				ret);
+
+	ret = gpio_twl4030_debounce(pdata->debounce, pdata->mmc_cd);
+	if (ret)
+		dev_dbg(&pdev->dev, "debounce %.03x %.01x --> %d\n",
+				pdata->debounce, pdata->mmc_cd,
+				ret);
+
+	/*
+	 * NOTE: we assume VIBRA_CTL.VIBRA_EN, in MODULE_AUDIO_VOICE,
+	 * is (still) clear if use_leds is set.
+	 */
+	if (pdata->use_leds)
+		twl_gpiochip.ngpio += 2;
+
 	ret = gpiochip_add(&twl_gpiochip);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret);
-- 
1.7.5.4

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

* [PATCH 2/3] gpio-twl4030: new dt properties for BeagleBoard and omap3-EVM
  2012-09-03 13:54 [PATCH 0/3] gpio-twl4030: add new device tree properties Florian Vaussard
  2012-09-03 13:54 ` [PATCH 1/3] gpio-twl4030: get platform data from device tree Florian Vaussard
@ 2012-09-03 13:54 ` Florian Vaussard
  2012-09-04  7:27   ` Vaibhav Hiremath
  2012-09-04  7:30   ` Linus Walleij
  2012-09-03 13:54 ` [PATCH 3/3] gpio-twl4030: updates the bindings for new dt properties Florian Vaussard
  2012-09-03 14:28 ` [PATCH 0/3] gpio-twl4030: add new device tree properties Benoit Cousson
  3 siblings, 2 replies; 14+ messages in thread
From: Florian Vaussard @ 2012-09-03 13:54 UTC (permalink / raw)
  To: linux-arm-kernel

Add device tree properties for twl4030/gpio, according to the
platform data of corresponding boards. This enables the led
connected to LEDB output for both boards, as well as
pullups/pulldowns on GPIO for the BeagleBoard.

Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
---
 arch/arm/boot/dts/omap3-beagle.dts |   20 ++++++++++++++++++++
 arch/arm/boot/dts/omap3-evm.dts    |   13 +++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
index cdcb98c..16bff8b 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -17,6 +17,14 @@
 		device_type = "memory";
 		reg = <0x80000000 0x20000000>; /* 512 MB */
 	};
+
+	leds {
+		compatible = "gpio-leds";
+		pmu_stat {
+			label = "beagleboard::pmu_stat";
+			gpios = <&twl_gpio 19 0>; /* LEDB */
+		};
+	};
 };
 
 &i2c1 {
@@ -67,3 +75,15 @@
 &mmc3 {
 	status = "disabled";
 };
+
+&twl_gpio {
+	ti,use-leds = "true";
+	/* pullups: BIT(1) */
+	ti,pullups = <2>;
+	/*
+	 * pulldowns:
+	 * BIT(2), BIT(6), BIT(7), BIT(8), BIT(13)
+	 * BIT(15), BIT(16), BIT(17)
+	 */
+	ti,pulldowns = <238020>;
+};
diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts
index f349ee9..f1e18fe 100644
--- a/arch/arm/boot/dts/omap3-evm.dts
+++ b/arch/arm/boot/dts/omap3-evm.dts
@@ -17,6 +17,15 @@
 		device_type = "memory";
 		reg = <0x80000000 0x10000000>; /* 256 MB */
 	};
+
+	leds {
+		compatible = "gpio-leds";
+		ledb {
+			label = "omap3evm::ledb";
+			gpios = <&twl_gpio 19 0>; /* LEDB */
+			linux,default-trigger = "default-on";
+		};
+	};
 };
 
 &i2c1 {
@@ -46,3 +55,7 @@
 		reg = <0x5c>;
 	};
 };
+
+&twl_gpio {
+	ti,use-leds = "true";
+};
-- 
1.7.5.4

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

* [PATCH 3/3] gpio-twl4030: updates the bindings for new dt properties
  2012-09-03 13:54 [PATCH 0/3] gpio-twl4030: add new device tree properties Florian Vaussard
  2012-09-03 13:54 ` [PATCH 1/3] gpio-twl4030: get platform data from device tree Florian Vaussard
  2012-09-03 13:54 ` [PATCH 2/3] gpio-twl4030: new dt properties for BeagleBoard and omap3-EVM Florian Vaussard
@ 2012-09-03 13:54 ` Florian Vaussard
  2012-09-04  7:31   ` Linus Walleij
  2012-09-03 14:28 ` [PATCH 0/3] gpio-twl4030: add new device tree properties Benoit Cousson
  3 siblings, 1 reply; 14+ messages in thread
From: Florian Vaussard @ 2012-09-03 13:54 UTC (permalink / raw)
  To: linux-arm-kernel

Add the new properties to the documentation of bindings.

Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
---
 .../devicetree/bindings/gpio/gpio-twl4030.txt      |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-twl4030.txt b/Documentation/devicetree/bindings/gpio/gpio-twl4030.txt
index 16695d9..690a32e 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-twl4030.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-twl4030.txt
@@ -11,6 +11,11 @@ Required properties:
 - interrupt-controller: Mark the device node as an interrupt controller
   The first cell is the GPIO number.
   The second cell is not used.
+- ti,use-leds : Enables LEDA and LEDB outputs if set to "true"
+- ti,debounce : if n-th bit is set, debounces GPIO-n
+- ti,mmc-cd : if n-th bit is set, GPIO-n controls VMMC(n+1)
+- ti,pullups : if n-th bit is set, set a pullup on GPIO-n
+- ti,pulldowns : if n-th bit is set, set a pulldown on GPIO-n
 
 Example:
 
@@ -20,4 +25,5 @@ twl_gpio: gpio {
     gpio-controller;
     #interrupt-cells = <2>;
     interrupt-controller;
+    ti,use-leds = "true";
 };
-- 
1.7.5.4

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

* [PATCH 0/3] gpio-twl4030: add new device tree properties
  2012-09-03 13:54 [PATCH 0/3] gpio-twl4030: add new device tree properties Florian Vaussard
                   ` (2 preceding siblings ...)
  2012-09-03 13:54 ` [PATCH 3/3] gpio-twl4030: updates the bindings for new dt properties Florian Vaussard
@ 2012-09-03 14:28 ` Benoit Cousson
  2012-09-03 20:45   ` Florian Vaussard
  2012-09-04  4:51   ` Hiremath, Vaibhav
  3 siblings, 2 replies; 14+ messages in thread
From: Benoit Cousson @ 2012-09-03 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

+ Vaibhav for the omap3-evm

Hi Florian,

On 09/03/2012 03:54 PM, Florian Vaussard wrote:
> A number of platform data are missing when using twl4030/gpio from a
> device tree.

Yeah, I know, I was too lazy when I did the DT conversion at that time :-)

Many thanks for completing the work.

>  This patchset adds the missing properties, updates
> existing device trees and updates the documentation of bindings.
> It mainly enables LEDA and LEDB outputs, as well as pullups /
> pulldowns on GPIOs.
> 
> The 1st patch changes the device driver.
> The 2nd patch updates the device trees for BeagleBoard and omap3-evm.
> The 3rd patch updates the documentation of bindings.

OK, that's a nit, but in general, you'd better introduce the binding
before using it.

The binding documentation could/should be updated along with the driver
change that does introduce the binding. You could just merged patch #1
and #3.

> Tested:
> - Boot tested on Gumstix Overo for "ti,use-leds". Corresponding
>   patch is not provided, as the device tree is not yet merged.
>   The support can be found in the git tree [1], branch
>   omap3-devel-dt-overo.
> - Device trees for BeagleBoard and omap3-evm were compiled, but not
>   tested on hardware.
> 
> Would someone be willing to test on BeagleBoard / omap3-evm?

I'll try to do it on Beagle. This is the least I can do since I did not
do the job myself :-)

I added vaibhav as well since I do not have any omap3-evm board.

> 
> Regards,
> Florian
> 
> [1] https://github.com/vaussard/linux.git (not safe for merge)
> 
> 
> Florian Vaussard (3):
>   gpio-twl4030: get platform data from device tree
>   gpio-twl4030: new dt properties for BeagleBoard and omap3-EVM

Nit #2: the DTS file does not belong to the gpio subsystem. So you
should prefix them using the *convention* for ARM DTS patches:

arm/dts: omap3: Add gpio-twl4030 properties for BeagleBoard and omap3-EVM

Or maybe "ARM: dts: " because it looks like most people are using that
nowadays.

The convention for the gpio directory is similar:
gpio/twl4030: get platform data from device tree

>   gpio-twl4030: updates the bindings for new dt properties
> 
>  .../devicetree/bindings/gpio/gpio-twl4030.txt      |    6 ++
>  arch/arm/boot/dts/omap3-beagle.dts                 |   20 +++++
>  arch/arm/boot/dts/omap3-evm.dts                    |   13 +++
>  drivers/gpio/gpio-twl4030.c                        |   86 +++++++++++++------
>  4 files changed, 98 insertions(+), 27 deletions(-)

Thanks,
Benoit

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

* [PATCH 0/3] gpio-twl4030: add new device tree properties
  2012-09-03 14:28 ` [PATCH 0/3] gpio-twl4030: add new device tree properties Benoit Cousson
@ 2012-09-03 20:45   ` Florian Vaussard
  2012-09-04  4:51   ` Hiremath, Vaibhav
  1 sibling, 0 replies; 14+ messages in thread
From: Florian Vaussard @ 2012-09-03 20:45 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Benoit,

> Nit #2: the DTS file does not belong to the gpio subsystem. So you
> should prefix them using the *convention* for ARM DTS patches:
>
> arm/dts: omap3: Add gpio-twl4030 properties for BeagleBoard and omap3-EVM
>
> Or maybe "ARM: dts: " because it looks like most people are using that
> nowadays.
>
> The convention for the gpio directory is similar:
> gpio/twl4030: get platform data from device tree
>
>>    gpio-twl4030: updates the bindings for new dt properties
>>
>>   .../devicetree/bindings/gpio/gpio-twl4030.txt      |    6 ++
>>   arch/arm/boot/dts/omap3-beagle.dts                 |   20 +++++
>>   arch/arm/boot/dts/omap3-evm.dts                    |   13 +++
>>   drivers/gpio/gpio-twl4030.c                        |   86 +++++++++++++------
>>   4 files changed, 98 insertions(+), 27 deletions(-)
> Thanks,
> Benoit
>
Thank you for your review, I will send a new version soon.

Regards,
Florian

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

* [PATCH 0/3] gpio-twl4030: add new device tree properties
  2012-09-03 14:28 ` [PATCH 0/3] gpio-twl4030: add new device tree properties Benoit Cousson
  2012-09-03 20:45   ` Florian Vaussard
@ 2012-09-04  4:51   ` Hiremath, Vaibhav
  1 sibling, 0 replies; 14+ messages in thread
From: Hiremath, Vaibhav @ 2012-09-04  4:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 03, 2012 at 19:58:09, Cousson, Benoit wrote:
> + Vaibhav for the omap3-evm
> 

Reviewing and testing it now...

Thanks,
Vaibhav


> Hi Florian,
> 
> On 09/03/2012 03:54 PM, Florian Vaussard wrote:
> > A number of platform data are missing when using twl4030/gpio from a
> > device tree.
> 
> Yeah, I know, I was too lazy when I did the DT conversion at that time :-)
> 
> Many thanks for completing the work.
> 
> >  This patchset adds the missing properties, updates
> > existing device trees and updates the documentation of bindings.
> > It mainly enables LEDA and LEDB outputs, as well as pullups /
> > pulldowns on GPIOs.
> > 
> > The 1st patch changes the device driver.
> > The 2nd patch updates the device trees for BeagleBoard and omap3-evm.
> > The 3rd patch updates the documentation of bindings.
> 
> OK, that's a nit, but in general, you'd better introduce the binding
> before using it.
> 
> The binding documentation could/should be updated along with the driver
> change that does introduce the binding. You could just merged patch #1
> and #3.
> 
> > Tested:
> > - Boot tested on Gumstix Overo for "ti,use-leds". Corresponding
> >   patch is not provided, as the device tree is not yet merged.
> >   The support can be found in the git tree [1], branch
> >   omap3-devel-dt-overo.
> > - Device trees for BeagleBoard and omap3-evm were compiled, but not
> >   tested on hardware.
> > 
> > Would someone be willing to test on BeagleBoard / omap3-evm?
> 
> I'll try to do it on Beagle. This is the least I can do since I did not
> do the job myself :-)
> 
> I added vaibhav as well since I do not have any omap3-evm board.
> 
> > 
> > Regards,
> > Florian
> > 
> > [1] https://github.com/vaussard/linux.git (not safe for merge)
> > 
> > 
> > Florian Vaussard (3):
> >   gpio-twl4030: get platform data from device tree
> >   gpio-twl4030: new dt properties for BeagleBoard and omap3-EVM
> 
> Nit #2: the DTS file does not belong to the gpio subsystem. So you
> should prefix them using the *convention* for ARM DTS patches:
> 
> arm/dts: omap3: Add gpio-twl4030 properties for BeagleBoard and omap3-EVM
> 
> Or maybe "ARM: dts: " because it looks like most people are using that
> nowadays.
> 
> The convention for the gpio directory is similar:
> gpio/twl4030: get platform data from device tree
> 
> >   gpio-twl4030: updates the bindings for new dt properties
> > 
> >  .../devicetree/bindings/gpio/gpio-twl4030.txt      |    6 ++
> >  arch/arm/boot/dts/omap3-beagle.dts                 |   20 +++++
> >  arch/arm/boot/dts/omap3-evm.dts                    |   13 +++
> >  drivers/gpio/gpio-twl4030.c                        |   86 +++++++++++++------
> >  4 files changed, 98 insertions(+), 27 deletions(-)
> 
> Thanks,
> Benoit
> 
> 

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

* [PATCH 1/3] gpio-twl4030: get platform data from device tree
  2012-09-03 13:54 ` [PATCH 1/3] gpio-twl4030: get platform data from device tree Florian Vaussard
@ 2012-09-04  7:27   ` Vaibhav Hiremath
  2012-09-05  7:10     ` Florian Vaussard
  2012-09-04  7:30   ` Linus Walleij
  1 sibling, 1 reply; 14+ messages in thread
From: Vaibhav Hiremath @ 2012-09-04  7:27 UTC (permalink / raw)
  To: linux-arm-kernel



On 9/3/2012 7:24 PM, Florian Vaussard wrote:
> Adds a number of missing properties to the device tree of
> twl4030/gpio:
> - "ti,use-leds"  -> .use_leds
> - "ti,debounce"  -> .debounce
> - "ti,mmc-cd"    -> .mmc_cd
> - "ti,pullups"   -> .pullups
> - "ti,pulldowns" -> .pulldowns
> 
> Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
> ---
>  drivers/gpio/gpio-twl4030.c |   86 +++++++++++++++++++++++++++++-------------
>  1 files changed, 59 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
> index 94256fe..dabe76b 100644
> --- a/drivers/gpio/gpio-twl4030.c
> +++ b/drivers/gpio/gpio-twl4030.c
> @@ -395,6 +395,33 @@ static int __devinit gpio_twl4030_debounce(u32 debounce, u8 mmc_cd)
>  
>  static int gpio_twl4030_remove(struct platform_device *pdev);
>  
> +static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev)
> +{
> +	struct twl4030_gpio_platform_data *omap_twl_info;
> +	const char *of_use_leds;
> +
> +	omap_twl_info = devm_kzalloc(dev, sizeof(*omap_twl_info), GFP_KERNEL);
> +	if (!omap_twl_info)
> +		return NULL;
> +
> +	omap_twl_info->gpio_base = -1;
> +
> +	of_property_read_string(dev->of_node, "ti,use-leds", &of_use_leds);
> +	if (!strcmp(of_use_leds, "true"))
> +		omap_twl_info->use_leds = true;
> +

You can replace this with

omap_twl_info->use_leds = of_property_read_bool(dev->of_node,
"ti,use-leds");

Otherwise looks OK to me, also I have tested it on OMAP3EVM.

Tested-&-Acked-By: Vaibhav Hiremath <hvaibhav@ti.com>


Thanks,
Vaibhav
> +	of_property_read_u32(dev->of_node, "ti,debounce",
> +				&omap_twl_info->debounce);
> +	of_property_read_u32(dev->of_node, "ti,mmc-cd",
> +				(u32 *)&omap_twl_info->mmc_cd);
> +	of_property_read_u32(dev->of_node, "ti,pullups",
> +				&omap_twl_info->pullups);
> +	of_property_read_u32(dev->of_node, "ti,pulldowns",
> +				&omap_twl_info->pulldowns);
> +
> +	return omap_twl_info;
> +}
> +
>  static int __devinit gpio_twl4030_probe(struct platform_device *pdev)
>  {
>  	struct twl4030_gpio_platform_data *pdata = pdev->dev.platform_data;
> @@ -423,39 +450,44 @@ static int __devinit gpio_twl4030_probe(struct platform_device *pdev)
>  	twl4030_gpio_irq_base = irq_base;
>  
>  no_irqs:
> -	twl_gpiochip.base = -1;
>  	twl_gpiochip.ngpio = TWL4030_GPIO_MAX;
>  	twl_gpiochip.dev = &pdev->dev;
>  
> -	if (pdata) {
> -		twl_gpiochip.base = pdata->gpio_base;
> +	if (node)
> +		pdata = of_gpio_twl4030(&pdev->dev);
>  
> -		/*
> -		 * NOTE:  boards may waste power if they don't set pullups
> -		 * and pulldowns correctly ... default for non-ULPI pins is
> -		 * pulldown, and some other pins may have external pullups
> -		 * or pulldowns.  Careful!
> -		 */
> -		ret = gpio_twl4030_pulls(pdata->pullups, pdata->pulldowns);
> -		if (ret)
> -			dev_dbg(&pdev->dev, "pullups %.05x %.05x --> %d\n",
> -					pdata->pullups, pdata->pulldowns,
> -					ret);
> -
> -		ret = gpio_twl4030_debounce(pdata->debounce, pdata->mmc_cd);
> -		if (ret)
> -			dev_dbg(&pdev->dev, "debounce %.03x %.01x --> %d\n",
> -					pdata->debounce, pdata->mmc_cd,
> -					ret);
> -
> -		/*
> -		 * NOTE: we assume VIBRA_CTL.VIBRA_EN, in MODULE_AUDIO_VOICE,
> -		 * is (still) clear if use_leds is set.
> -		 */
> -		if (pdata->use_leds)
> -			twl_gpiochip.ngpio += 2;
> +	if (pdata == NULL) {
> +		dev_err(&pdev->dev, "Platform data is missing\n");
> +		return -ENXIO;
>  	}
>  
> +	twl_gpiochip.base = pdata->gpio_base;
> +
> +	/*
> +	 * NOTE:  boards may waste power if they don't set pullups
> +	 * and pulldowns correctly ... default for non-ULPI pins is
> +	 * pulldown, and some other pins may have external pullups
> +	 * or pulldowns.  Careful!
> +	 */
> +	ret = gpio_twl4030_pulls(pdata->pullups, pdata->pulldowns);
> +	if (ret)
> +		dev_dbg(&pdev->dev, "pullups %.05x %.05x --> %d\n",
> +				pdata->pullups, pdata->pulldowns,
> +				ret);
> +
> +	ret = gpio_twl4030_debounce(pdata->debounce, pdata->mmc_cd);
> +	if (ret)
> +		dev_dbg(&pdev->dev, "debounce %.03x %.01x --> %d\n",
> +				pdata->debounce, pdata->mmc_cd,
> +				ret);
> +
> +	/*
> +	 * NOTE: we assume VIBRA_CTL.VIBRA_EN, in MODULE_AUDIO_VOICE,
> +	 * is (still) clear if use_leds is set.
> +	 */
> +	if (pdata->use_leds)
> +		twl_gpiochip.ngpio += 2;
> +
>  	ret = gpiochip_add(&twl_gpiochip);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret);
> 

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

* [PATCH 2/3] gpio-twl4030: new dt properties for BeagleBoard and omap3-EVM
  2012-09-03 13:54 ` [PATCH 2/3] gpio-twl4030: new dt properties for BeagleBoard and omap3-EVM Florian Vaussard
@ 2012-09-04  7:27   ` Vaibhav Hiremath
  2012-09-04  7:30   ` Linus Walleij
  1 sibling, 0 replies; 14+ messages in thread
From: Vaibhav Hiremath @ 2012-09-04  7:27 UTC (permalink / raw)
  To: linux-arm-kernel



On 9/3/2012 7:24 PM, Florian Vaussard wrote:
> Add device tree properties for twl4030/gpio, according to the
> platform data of corresponding boards. This enables the led
> connected to LEDB output for both boards, as well as
> pullups/pulldowns on GPIO for the BeagleBoard.
> 
> Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
> ---
>  arch/arm/boot/dts/omap3-beagle.dts |   20 ++++++++++++++++++++
>  arch/arm/boot/dts/omap3-evm.dts    |   13 +++++++++++++
>  2 files changed, 33 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
> index cdcb98c..16bff8b 100644
> --- a/arch/arm/boot/dts/omap3-beagle.dts
> +++ b/arch/arm/boot/dts/omap3-beagle.dts
> @@ -17,6 +17,14 @@
>  		device_type = "memory";
>  		reg = <0x80000000 0x20000000>; /* 512 MB */
>  	};
> +
> +	leds {
> +		compatible = "gpio-leds";
> +		pmu_stat {
> +			label = "beagleboard::pmu_stat";
> +			gpios = <&twl_gpio 19 0>; /* LEDB */
> +		};
> +	};
>  };
>  
>  &i2c1 {
> @@ -67,3 +75,15 @@
>  &mmc3 {
>  	status = "disabled";
>  };
> +
> +&twl_gpio {
> +	ti,use-leds = "true";
> +	/* pullups: BIT(1) */
> +	ti,pullups = <2>;
> +	/*
> +	 * pulldowns:
> +	 * BIT(2), BIT(6), BIT(7), BIT(8), BIT(13)
> +	 * BIT(15), BIT(16), BIT(17)
> +	 */
> +	ti,pulldowns = <238020>;

Consider changing above value to hex presentation.
Otherwise looks ok to me, also I have tested it on OMAP3EVM.

Tested-&-Acked-By: Vaibhav Hiremath <hvaibhav@ti.com>

Thanks,
Vaibhav

> +};
> diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts
> index f349ee9..f1e18fe 100644
> --- a/arch/arm/boot/dts/omap3-evm.dts
> +++ b/arch/arm/boot/dts/omap3-evm.dts
> @@ -17,6 +17,15 @@
>  		device_type = "memory";
>  		reg = <0x80000000 0x10000000>; /* 256 MB */
>  	};
> +
> +	leds {
> +		compatible = "gpio-leds";
> +		ledb {
> +			label = "omap3evm::ledb";
> +			gpios = <&twl_gpio 19 0>; /* LEDB */
> +			linux,default-trigger = "default-on";
> +		};
> +	};
>  };
>  
>  &i2c1 {
> @@ -46,3 +55,7 @@
>  		reg = <0x5c>;
>  	};
>  };
> +
> +&twl_gpio {
> +	ti,use-leds = "true";
> +};
> 

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

* [PATCH 1/3] gpio-twl4030: get platform data from device tree
  2012-09-03 13:54 ` [PATCH 1/3] gpio-twl4030: get platform data from device tree Florian Vaussard
  2012-09-04  7:27   ` Vaibhav Hiremath
@ 2012-09-04  7:30   ` Linus Walleij
  2012-09-06 20:47     ` Tony Lindgren
  1 sibling, 1 reply; 14+ messages in thread
From: Linus Walleij @ 2012-09-04  7:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 3, 2012 at 3:54 PM, Florian Vaussard
<florian.vaussard@epfl.ch> wrote:

> Adds a number of missing properties to the device tree of
> twl4030/gpio:
> - "ti,use-leds"  -> .use_leds
> - "ti,debounce"  -> .debounce
> - "ti,mmc-cd"    -> .mmc_cd
> - "ti,pullups"   -> .pullups
> - "ti,pulldowns" -> .pulldowns
>
> Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>

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

Tony will you carry this in the OMAP tree?

Yours,
Linus Walleij

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

* [PATCH 2/3] gpio-twl4030: new dt properties for BeagleBoard and omap3-EVM
  2012-09-03 13:54 ` [PATCH 2/3] gpio-twl4030: new dt properties for BeagleBoard and omap3-EVM Florian Vaussard
  2012-09-04  7:27   ` Vaibhav Hiremath
@ 2012-09-04  7:30   ` Linus Walleij
  1 sibling, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2012-09-04  7:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 3, 2012 at 3:54 PM, Florian Vaussard
<florian.vaussard@epfl.ch> wrote:

> Add device tree properties for twl4030/gpio, according to the
> platform data of corresponding boards. This enables the led
> connected to LEDB output for both boards, as well as
> pullups/pulldowns on GPIO for the BeagleBoard.
>
> Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>

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

Yours,
Linus Walleij

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

* [PATCH 3/3] gpio-twl4030: updates the bindings for new dt properties
  2012-09-03 13:54 ` [PATCH 3/3] gpio-twl4030: updates the bindings for new dt properties Florian Vaussard
@ 2012-09-04  7:31   ` Linus Walleij
  0 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2012-09-04  7:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 3, 2012 at 3:54 PM, Florian Vaussard
<florian.vaussard@epfl.ch> wrote:

> Add the new properties to the documentation of bindings.
>
> Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>

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

Yours,
Linus Walleij

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

* [PATCH 1/3] gpio-twl4030: get platform data from device tree
  2012-09-04  7:27   ` Vaibhav Hiremath
@ 2012-09-05  7:10     ` Florian Vaussard
  0 siblings, 0 replies; 14+ messages in thread
From: Florian Vaussard @ 2012-09-05  7:10 UTC (permalink / raw)
  To: linux-arm-kernel



>
> On 9/3/2012 7:24 PM, Florian Vaussard wrote:
>> Adds a number of missing properties to the device tree of
>> twl4030/gpio:
>> - "ti,use-leds"  -> .use_leds
>> - "ti,debounce"  -> .debounce
>> - "ti,mmc-cd"    -> .mmc_cd
>> - "ti,pullups"   -> .pullups
>> - "ti,pulldowns" -> .pulldowns
>>
>> Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
>> ---
>>   drivers/gpio/gpio-twl4030.c |   86 +++++++++++++++++++++++++++++-------------
>>   1 files changed, 59 insertions(+), 27 deletions(-)
>>
>> diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
>> index 94256fe..dabe76b 100644
>> --- a/drivers/gpio/gpio-twl4030.c
>> +++ b/drivers/gpio/gpio-twl4030.c
>> @@ -395,6 +395,33 @@ static int __devinit gpio_twl4030_debounce(u32 debounce, u8 mmc_cd)
>>   
>>   static int gpio_twl4030_remove(struct platform_device *pdev);
>>   
>> +static struct twl4030_gpio_platform_data *of_gpio_twl4030(struct device *dev)
>> +{
>> +	struct twl4030_gpio_platform_data *omap_twl_info;
>> +	const char *of_use_leds;
>> +
>> +	omap_twl_info = devm_kzalloc(dev, sizeof(*omap_twl_info), GFP_KERNEL);
>> +	if (!omap_twl_info)
>> +		return NULL;
>> +
>> +	omap_twl_info->gpio_base = -1;
>> +
>> +	of_property_read_string(dev->of_node, "ti,use-leds", &of_use_leds);
>> +	if (!strcmp(of_use_leds, "true"))
>> +		omap_twl_info->use_leds = true;
>> +
> You can replace this with
>
> omap_twl_info->use_leds = of_property_read_bool(dev->of_node,
> "ti,use-leds");
>
> Otherwise looks OK to me, also I have tested it on OMAP3EVM.
>
> Tested-&-Acked-By: Vaibhav Hiremath <hvaibhav@ti.com>

Thank you Vaibhav for your review. I will send a v2 today.

Regards,
Florian

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

* [PATCH 1/3] gpio-twl4030: get platform data from device tree
  2012-09-04  7:30   ` Linus Walleij
@ 2012-09-06 20:47     ` Tony Lindgren
  0 siblings, 0 replies; 14+ messages in thread
From: Tony Lindgren @ 2012-09-06 20:47 UTC (permalink / raw)
  To: linux-arm-kernel

* Linus Walleij <linus.walleij@linaro.org> [120904 00:31]:
> On Mon, Sep 3, 2012 at 3:54 PM, Florian Vaussard
> <florian.vaussard@epfl.ch> wrote:
> 
> > Adds a number of missing properties to the device tree of
> > twl4030/gpio:
> > - "ti,use-leds"  -> .use_leds
> > - "ti,debounce"  -> .debounce
> > - "ti,mmc-cd"    -> .mmc_cd
> > - "ti,pullups"   -> .pullups
> > - "ti,pulldowns" -> .pulldowns
> >
> > Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
> 
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Tony will you carry this in the OMAP tree?

Yes thanks I can queue this once the acks are there,
I guess Benoit is planning to test the series first.

Regards,

Tony

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

end of thread, other threads:[~2012-09-06 20:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-03 13:54 [PATCH 0/3] gpio-twl4030: add new device tree properties Florian Vaussard
2012-09-03 13:54 ` [PATCH 1/3] gpio-twl4030: get platform data from device tree Florian Vaussard
2012-09-04  7:27   ` Vaibhav Hiremath
2012-09-05  7:10     ` Florian Vaussard
2012-09-04  7:30   ` Linus Walleij
2012-09-06 20:47     ` Tony Lindgren
2012-09-03 13:54 ` [PATCH 2/3] gpio-twl4030: new dt properties for BeagleBoard and omap3-EVM Florian Vaussard
2012-09-04  7:27   ` Vaibhav Hiremath
2012-09-04  7:30   ` Linus Walleij
2012-09-03 13:54 ` [PATCH 3/3] gpio-twl4030: updates the bindings for new dt properties Florian Vaussard
2012-09-04  7:31   ` Linus Walleij
2012-09-03 14:28 ` [PATCH 0/3] gpio-twl4030: add new device tree properties Benoit Cousson
2012-09-03 20:45   ` Florian Vaussard
2012-09-04  4:51   ` Hiremath, Vaibhav

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