* [PATCH v2 0/2] gpio-twl4030: add new device tree properties
@ 2012-09-05 7:46 Florian Vaussard
2012-09-05 7:46 ` [PATCH 1/2] gpio/twl4030: get platform data from device tree Florian Vaussard
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Florian Vaussard @ 2012-09-05 7:46 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
A number of platform data are missing when using twl4030/gpio from a
device tree. This patchset adds the missing properties, updates the
documentation with the new bindings, and updates existing device trees.
It mainly enables LEDA and LEDB outputs, as well as pullups /
pulldowns on GPIOs.
The 1st patch changes the device driver and updates the documentation.
The 2nd patch updates the device trees for BeagleBoard and omap3-evm.
Changes since v1:
- Patches on driver and documentation merged into the same patch
- Put device trees' values in hexadecimal
- Handle bool property using of_property_read_bool()
- Prefix the patches with the correct convention
Tested on Gumstix Overo. V1 was tested on omap3-evm by Vaibhav Hiremath.
BTW: who will merge this?
Regards,
Florian
Florian Vaussard (2):
gpio/twl4030: get platform data from device tree
ARM: dts: omap3: Add gpio-twl4030 properties for BeagleBoard and
omap3-EVM
.../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 | 84 +++++++++++++------
4 files changed, 96 insertions(+), 27 deletions(-)
--
1.7.5.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] gpio/twl4030: get platform data from device tree
2012-09-05 7:46 [PATCH v2 0/2] gpio-twl4030: add new device tree properties Florian Vaussard
@ 2012-09-05 7:46 ` Florian Vaussard
2012-09-07 17:33 ` Benoit Cousson
2012-09-05 7:46 ` [PATCH 2/2] ARM: dts: omap3: Add gpio-twl4030 properties for BeagleBoard and omap3-EVM Florian Vaussard
2012-09-05 14:41 ` [PATCH v2 0/2] gpio-twl4030: add new device tree properties Benoit Cousson
2 siblings, 1 reply; 10+ messages in thread
From: Florian Vaussard @ 2012-09-05 7:46 UTC (permalink / raw)
To: linux-arm-kernel
Adds a number of missing device tree properties for
twl4030/gpio, and update bindings:
- "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>
Acked-by: Vaibhav Hiremath <hvaibhav@ti.com>
---
.../devicetree/bindings/gpio/gpio-twl4030.txt | 6 ++
drivers/gpio/gpio-twl4030.c | 84 +++++++++++++------
2 files changed, 63 insertions(+), 27 deletions(-)
diff --git a/Documentation/devicetree/bindings/gpio/gpio-twl4030.txt b/Documentation/devicetree/bindings/gpio/gpio-twl4030.txt
index 16695d9..66788fd 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
+- 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;
};
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index 94256fe..477c1d9 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -395,6 +395,31 @@ 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;
+
+ omap_twl_info = devm_kzalloc(dev, sizeof(*omap_twl_info), GFP_KERNEL);
+ if (!omap_twl_info)
+ return NULL;
+
+ omap_twl_info->gpio_base = -1;
+
+ omap_twl_info->use_leds = of_property_read_bool(dev->of_node,
+ "ti,use-leds");
+
+ 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 +448,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] 10+ messages in thread
* [PATCH 2/2] ARM: dts: omap3: Add gpio-twl4030 properties for BeagleBoard and omap3-EVM
2012-09-05 7:46 [PATCH v2 0/2] gpio-twl4030: add new device tree properties Florian Vaussard
2012-09-05 7:46 ` [PATCH 1/2] gpio/twl4030: get platform data from device tree Florian Vaussard
@ 2012-09-05 7:46 ` Florian Vaussard
2012-09-05 14:41 ` [PATCH v2 0/2] gpio-twl4030: add new device tree properties Benoit Cousson
2 siblings, 0 replies; 10+ messages in thread
From: Florian Vaussard @ 2012-09-05 7:46 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>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vaibhav Hiremath <hvaibhav@ti.com>
---
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..c7256d5 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;
+ /* pullups: BIT(1) */
+ ti,pullups = <0x000002>;
+ /*
+ * pulldowns:
+ * BIT(2), BIT(6), BIT(7), BIT(8), BIT(13)
+ * BIT(15), BIT(16), BIT(17)
+ */
+ ti,pulldowns = <0x03a1c4>;
+};
diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts
index f349ee9..e8ba1c2 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;
+};
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 0/2] gpio-twl4030: add new device tree properties
2012-09-05 7:46 [PATCH v2 0/2] gpio-twl4030: add new device tree properties Florian Vaussard
2012-09-05 7:46 ` [PATCH 1/2] gpio/twl4030: get platform data from device tree Florian Vaussard
2012-09-05 7:46 ` [PATCH 2/2] ARM: dts: omap3: Add gpio-twl4030 properties for BeagleBoard and omap3-EVM Florian Vaussard
@ 2012-09-05 14:41 ` Benoit Cousson
2012-09-06 20:51 ` Tony Lindgren
2 siblings, 1 reply; 10+ messages in thread
From: Benoit Cousson @ 2012-09-05 14:41 UTC (permalink / raw)
To: linux-arm-kernel
Hi Florian,
On 09/05/2012 09:46 AM, Florian Vaussard wrote:
> Hello,
>
> A number of platform data are missing when using twl4030/gpio from a
> device tree. This patchset adds the missing properties, updates the
> documentation with the new bindings, and updates existing device trees.
> It mainly enables LEDA and LEDB outputs, as well as pullups /
> pulldowns on GPIOs.
>
> The 1st patch changes the device driver and updates the documentation.
> The 2nd patch updates the device trees for BeagleBoard and omap3-evm.
>
> Changes since v1:
> - Patches on driver and documentation merged into the same patch
> - Put device trees' values in hexadecimal
> - Handle bool property using of_property_read_bool()
> - Prefix the patches with the correct convention
Thanks for the update.
> Tested on Gumstix Overo. V1 was tested on omap3-evm by Vaibhav Hiremath.
I've just tested it on beagle xM. I can play with D12 led using:
echo 255 > /sys/class/leds/beagleboard\:\:pmu_stat/brightness
Tested-by: Benoit Cousson <b-cousson@ti.com>
> BTW: who will merge this?
Since Linus already acked it, Tony can merge it.
Tony,
I can add that series in my DTS series for 3.7 if you want.
Regards,
Benoit
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 0/2] gpio-twl4030: add new device tree properties
2012-09-05 14:41 ` [PATCH v2 0/2] gpio-twl4030: add new device tree properties Benoit Cousson
@ 2012-09-06 20:51 ` Tony Lindgren
2012-09-07 8:55 ` Benoit Cousson
0 siblings, 1 reply; 10+ messages in thread
From: Tony Lindgren @ 2012-09-06 20:51 UTC (permalink / raw)
To: linux-arm-kernel
* Benoit Cousson <b-cousson@ti.com> [120905 07:42]:
> Hi Florian,
>
> On 09/05/2012 09:46 AM, Florian Vaussard wrote:
> > Hello,
> >
> > A number of platform data are missing when using twl4030/gpio from a
> > device tree. This patchset adds the missing properties, updates the
> > documentation with the new bindings, and updates existing device trees.
> > It mainly enables LEDA and LEDB outputs, as well as pullups /
> > pulldowns on GPIOs.
> >
> > The 1st patch changes the device driver and updates the documentation.
> > The 2nd patch updates the device trees for BeagleBoard and omap3-evm.
> >
> > Changes since v1:
> > - Patches on driver and documentation merged into the same patch
> > - Put device trees' values in hexadecimal
> > - Handle bool property using of_property_read_bool()
> > - Prefix the patches with the correct convention
>
> Thanks for the update.
>
> > Tested on Gumstix Overo. V1 was tested on omap3-evm by Vaibhav Hiremath.
>
> I've just tested it on beagle xM. I can play with D12 led using:
>
> echo 255 > /sys/class/leds/beagleboard\:\:pmu_stat/brightness
>
> Tested-by: Benoit Cousson <b-cousson@ti.com>
>
>
> > BTW: who will merge this?
>
> Since Linus already acked it, Tony can merge it.
>
>
> Tony,
>
> I can add that series in my DTS series for 3.7 if you want.
Yes please do thanks.
Tony
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 0/2] gpio-twl4030: add new device tree properties
2012-09-06 20:51 ` Tony Lindgren
@ 2012-09-07 8:55 ` Benoit Cousson
0 siblings, 0 replies; 10+ messages in thread
From: Benoit Cousson @ 2012-09-07 8:55 UTC (permalink / raw)
To: linux-arm-kernel
On 09/06/2012 10:51 PM, Tony Lindgren wrote:
> * Benoit Cousson <b-cousson@ti.com> [120905 07:42]:
>> Hi Florian,
>>
>> On 09/05/2012 09:46 AM, Florian Vaussard wrote:
>>> Hello,
>>>
>>> A number of platform data are missing when using twl4030/gpio from a
>>> device tree. This patchset adds the missing properties, updates the
>>> documentation with the new bindings, and updates existing device trees.
>>> It mainly enables LEDA and LEDB outputs, as well as pullups /
>>> pulldowns on GPIOs.
>>>
>>> The 1st patch changes the device driver and updates the documentation.
>>> The 2nd patch updates the device trees for BeagleBoard and omap3-evm.
>>>
>>> Changes since v1:
>>> - Patches on driver and documentation merged into the same patch
>>> - Put device trees' values in hexadecimal
>>> - Handle bool property using of_property_read_bool()
>>> - Prefix the patches with the correct convention
>>
>> Thanks for the update.
>>
>>> Tested on Gumstix Overo. V1 was tested on omap3-evm by Vaibhav Hiremath.
>>
>> I've just tested it on beagle xM. I can play with D12 led using:
>>
>> echo 255 > /sys/class/leds/beagleboard\:\:pmu_stat/brightness
>>
>> Tested-by: Benoit Cousson <b-cousson@ti.com>
>>
>>
>>> BTW: who will merge this?
>>
>> Since Linus already acked it, Tony can merge it.
>>
>>
>> Tony,
>>
>> I can add that series in my DTS series for 3.7 if you want.
>
> Yes please do thanks.
On top of that series, I realized that beagle was missing the other
LEDs. So I've just posted the support for the two missing ones.
[PATCH] ARM: dts: omap3-beagle: Add heartbeat and mmc LEDs support
Regards,
Benoit
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] gpio/twl4030: get platform data from device tree
2012-09-05 7:46 ` [PATCH 1/2] gpio/twl4030: get platform data from device tree Florian Vaussard
@ 2012-09-07 17:33 ` Benoit Cousson
2012-09-10 8:17 ` Florian Vaussard
0 siblings, 1 reply; 10+ messages in thread
From: Benoit Cousson @ 2012-09-07 17:33 UTC (permalink / raw)
To: linux-arm-kernel
Hi Florian,
I've just noticed that this patch is reporting some CHECK issues.
d1f5052 - gpio/twl4030: get platform data from device tree
CHECK: Alignment should match open parenthesis
#66: FILE: drivers/gpio/gpio-twl4030.c:412:
+ of_property_read_u32(dev->of_node, "ti,debounce",
+ &omap_twl_info->debounce);
CHECK: Alignment should match open parenthesis
#68: FILE: drivers/gpio/gpio-twl4030.c:414:
+ of_property_read_u32(dev->of_node, "ti,mmc-cd",
+ (u32 *)&omap_twl_info->mmc_cd);
CHECK: Alignment should match open parenthesis
#70: FILE: drivers/gpio/gpio-twl4030.c:416:
+ of_property_read_u32(dev->of_node, "ti,pullups",
+ &omap_twl_info->pullups);
CHECK: Alignment should match open parenthesis
#72: FILE: drivers/gpio/gpio-twl4030.c:418:
+ of_property_read_u32(dev->of_node, "ti,pulldowns",
+ &omap_twl_info->pulldowns);
CHECK: Alignment should match open parenthesis
+ pdata->pullups, pdata->pulldowns,
CHECK: Alignment should match open parenthesis
#139: FILE: drivers/gpio/gpio-twl4030.c:479:
+ dev_dbg(&pdev->dev, "debounce %.03x %.01x --> %d\n",
+ pdata->debounce, pdata->mmc_cd,
total: 0 errors, 0 warnings, 6 checks, 118 lines checked
I fixed them since it was trivial, but next time you should ensure that the patch pass checkpatch before posting.
Just let me know if you have any issue with the following update.
Regards,
Benoit
---
>From f74ce8fb849e9f9c54a494cff5fc30d53ca4e963 Mon Sep 17 00:00:00 2001
From: Florian Vaussard <florian.vaussard@epfl.ch>
Date: Wed, 5 Sep 2012 09:46:25 +0200
Subject: [PATCH] gpio/twl4030: get platform data from device tree
Adds a number of missing device tree properties for
twl4030/gpio, and update bindings:
- "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>
Acked-by: Vaibhav Hiremath <hvaibhav@ti.com>
[b-cousson at ti.com: Fix some checkpatch CHECK issues]
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
---
.../devicetree/bindings/gpio/gpio-twl4030.txt | 6 ++
drivers/gpio/gpio-twl4030.c | 82 +++++++++++++-------
2 files changed, 61 insertions(+), 27 deletions(-)
diff --git a/Documentation/devicetree/bindings/gpio/gpio-twl4030.txt b/Documentation/devicetree/bindings/gpio/gpio-twl4030.txt
index 16695d9..66788fd 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
+- 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;
};
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index 94256fe..f923252 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -395,6 +395,31 @@ 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;
+
+ omap_twl_info = devm_kzalloc(dev, sizeof(*omap_twl_info), GFP_KERNEL);
+ if (!omap_twl_info)
+ return NULL;
+
+ omap_twl_info->gpio_base = -1;
+
+ omap_twl_info->use_leds = of_property_read_bool(dev->of_node,
+ "ti,use-leds");
+
+ 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 +448,42 @@ 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.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 1/2] gpio/twl4030: get platform data from device tree
2012-09-07 17:33 ` Benoit Cousson
@ 2012-09-10 8:17 ` Florian Vaussard
2012-09-10 8:29 ` Benoit Cousson
0 siblings, 1 reply; 10+ messages in thread
From: Florian Vaussard @ 2012-09-10 8:17 UTC (permalink / raw)
To: linux-arm-kernel
Hello Benoit,
Le 07/09/2012 19:33, Benoit Cousson a ?crit :
> Hi Florian,
>
> I've just noticed that this patch is reporting some CHECK issues.
>
> d1f5052 - gpio/twl4030: get platform data from device tree
> CHECK: Alignment should match open parenthesis
> #66: FILE: drivers/gpio/gpio-twl4030.c:412:
> + of_property_read_u32(dev->of_node, "ti,debounce",
> + &omap_twl_info->debounce);
>
> CHECK: Alignment should match open parenthesis
> #68: FILE: drivers/gpio/gpio-twl4030.c:414:
> + of_property_read_u32(dev->of_node, "ti,mmc-cd",
> + (u32 *)&omap_twl_info->mmc_cd);
>
> CHECK: Alignment should match open parenthesis
> #70: FILE: drivers/gpio/gpio-twl4030.c:416:
> + of_property_read_u32(dev->of_node, "ti,pullups",
> + &omap_twl_info->pullups);
>
> CHECK: Alignment should match open parenthesis
> #72: FILE: drivers/gpio/gpio-twl4030.c:418:
> + of_property_read_u32(dev->of_node, "ti,pulldowns",
> + &omap_twl_info->pulldowns);
>
> CHECK: Alignment should match open parenthesis
> + pdata->pullups, pdata->pulldowns,
>
> CHECK: Alignment should match open parenthesis
> #139: FILE: drivers/gpio/gpio-twl4030.c:479:
> + dev_dbg(&pdev->dev, "debounce %.03x %.01x --> %d\n",
> + pdata->debounce, pdata->mmc_cd,
>
> total: 0 errors, 0 warnings, 6 checks, 118 lines checked
>
>
> I fixed them since it was trivial, but next time you should ensure that the patch pass checkpatch before posting.
Sorry for these errors. I however checked my patches before submitting,
and had no such warnings. I redone, and remarked that these warnings
appear only with the "--strict" option, which is not enabled by default.
Is this the recommended guideline? Thus why not enabling it by default?
>
> Just let me know if you have any issue with the following update.
I will test, but should not have any issue with your fix.
Thank you very much for fixing my patch, I send you a virtual chocolate
from Switzerland!
Regards,
Florian
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] gpio/twl4030: get platform data from device tree
2012-09-10 8:17 ` Florian Vaussard
@ 2012-09-10 8:29 ` Benoit Cousson
2012-09-10 8:40 ` Florian Vaussard
0 siblings, 1 reply; 10+ messages in thread
From: Benoit Cousson @ 2012-09-10 8:29 UTC (permalink / raw)
To: linux-arm-kernel
Hi Florian,
On 09/10/2012 10:17 AM, Florian Vaussard wrote:
> Hello Benoit,
>
> Le 07/09/2012 19:33, Benoit Cousson a ?crit :
>> Hi Florian,
>>
>> I've just noticed that this patch is reporting some CHECK issues.
>>
>> d1f5052 - gpio/twl4030: get platform data from device tree
>> CHECK: Alignment should match open parenthesis
>> #66: FILE: drivers/gpio/gpio-twl4030.c:412:
>> + of_property_read_u32(dev->of_node, "ti,debounce",
>> + &omap_twl_info->debounce);
>>
>> CHECK: Alignment should match open parenthesis
>> #68: FILE: drivers/gpio/gpio-twl4030.c:414:
>> + of_property_read_u32(dev->of_node, "ti,mmc-cd",
>> + (u32 *)&omap_twl_info->mmc_cd);
>>
>> CHECK: Alignment should match open parenthesis
>> #70: FILE: drivers/gpio/gpio-twl4030.c:416:
>> + of_property_read_u32(dev->of_node, "ti,pullups",
>> + &omap_twl_info->pullups);
>>
>> CHECK: Alignment should match open parenthesis
>> #72: FILE: drivers/gpio/gpio-twl4030.c:418:
>> + of_property_read_u32(dev->of_node, "ti,pulldowns",
>> + &omap_twl_info->pulldowns);
>>
>> CHECK: Alignment should match open parenthesis
>> + pdata->pullups, pdata->pulldowns,
>>
>> CHECK: Alignment should match open parenthesis
>> #139: FILE: drivers/gpio/gpio-twl4030.c:479:
>> + dev_dbg(&pdev->dev, "debounce %.03x %.01x --> %d\n",
>> + pdata->debounce, pdata->mmc_cd,
>>
>> total: 0 errors, 0 warnings, 6 checks, 118 lines checked
>>
>>
>> I fixed them since it was trivial, but next time you should ensure
>> that the patch pass checkpatch before posting.
>
> Sorry for these errors. I however checked my patches before submitting,
> and had no such warnings. I redone, and remarked that these warnings
> appear only with the "--strict" option, which is not enabled by default.
> Is this the recommended guideline? Thus why not enabling it by default?
That's a pretty good question :-)
Maybe the --strict is more a nice to have than a strong requirement?
Anyway, we'd better run checkpatch with --strict and thus fix any
cosmetic details that might be in the patch.
>> Just let me know if you have any issue with the following update.
>
> I will test, but should not have any issue with your fix.
>
> Thank you very much for fixing my patch, I send you a virtual chocolate
> from Switzerland!
Cool, I love chocolate. That being said, I'm not sure how tasteful will
be the *virtual* chocolate.
Regards,
Benoit
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] gpio/twl4030: get platform data from device tree
2012-09-10 8:29 ` Benoit Cousson
@ 2012-09-10 8:40 ` Florian Vaussard
0 siblings, 0 replies; 10+ messages in thread
From: Florian Vaussard @ 2012-09-10 8:40 UTC (permalink / raw)
To: linux-arm-kernel
Hello Benoit,
>>
>> I fixed them since it was trivial, but next time you should ensure
>> that the patch pass checkpatch before posting.
>> Sorry for these errors. I however checked my patches before submitting,
>> and had no such warnings. I redone, and remarked that these warnings
>> appear only with the "--strict" option, which is not enabled by default.
>> Is this the recommended guideline? Thus why not enabling it by default?
> That's a pretty good question :-)
>
> Maybe the --strict is more a nice to have than a strong requirement?
> Anyway, we'd better run checkpatch with --strict and thus fix any
> cosmetic details that might be in the patch.
Good to know, I will use --strict for the next submissions.
> Cool, I love chocolate. That being said, I'm not sure how tasteful
> will be the *virtual* chocolate. Regards, Benoit
Even *virtual*, Swiss chocolate will be the most tasteful (hope no Belgium
friends will see this thread) :-)
Regards,
Florian
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-09-10 8:40 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-05 7:46 [PATCH v2 0/2] gpio-twl4030: add new device tree properties Florian Vaussard
2012-09-05 7:46 ` [PATCH 1/2] gpio/twl4030: get platform data from device tree Florian Vaussard
2012-09-07 17:33 ` Benoit Cousson
2012-09-10 8:17 ` Florian Vaussard
2012-09-10 8:29 ` Benoit Cousson
2012-09-10 8:40 ` Florian Vaussard
2012-09-05 7:46 ` [PATCH 2/2] ARM: dts: omap3: Add gpio-twl4030 properties for BeagleBoard and omap3-EVM Florian Vaussard
2012-09-05 14:41 ` [PATCH v2 0/2] gpio-twl4030: add new device tree properties Benoit Cousson
2012-09-06 20:51 ` Tony Lindgren
2012-09-07 8:55 ` Benoit Cousson
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).