* [PATCH 3/3] gpio-vx855: Add device tree binding
@ 2011-09-21 12:02 Daniel Drake
2011-09-21 12:50 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Drake @ 2011-09-21 12:02 UTC (permalink / raw)
To: grant.likely, sameo; +Cc: linux-kernel, devicetree-discuss, dilinger
This is needed to enable the HDD LED on the OLPC XO-1.5 laptop,
enabled through devicetree and the gpio-leds driver.
Signed-off-by: Daniel Drake <dsd@laptop.org>
---
.../devicetree/bindings/gpio/gpio_vx855.txt | 20 ++++++++++++++++++++
drivers/gpio/gpio-vx855.c | 9 +++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
create mode 100644 Documentation/devicetree/bindings/gpio/gpio_vx855.txt
diff --git a/Documentation/devicetree/bindings/gpio/gpio_vx855.txt b/Documentation/devicetree/bindings/gpio/gpio_vx855.txt
new file mode 100644
index 0000000..17285a5
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio_vx855.txt
@@ -0,0 +1,20 @@
+VIA VX855 GPIO controller
+
+Required properties:
+- compatible : "via,vx855-gpio"
+- #gpio-cells : Should be two. The first cell is the pin number and the
+ second cell is used to specify optional parameters:
+ - bit 0 specifies polarity (0 for normal, 1 for inverted)
+- gpio-controller : Marks the device node as a GPIO controller.
+
+As VIA differentiates between GPI, GPO and GPIO on its 42 available pins,
+with each pin type restarting numbering at 0, the following numbering scheme
+is used in the device tree for the pin number:
+
+PIN NO VIA NAME
+0..13 GPI 0..13
+14..26 GPO 0..12
+27..41 GPIO 0..14
+
+For example, GPIO 11 (VIA name) is referred to with pin number 38 in the
+device tree.
diff --git a/drivers/gpio/gpio-vx855.c b/drivers/gpio/gpio-vx855.c
index ef5aabd..2c300c9 100644
--- a/drivers/gpio/gpio-vx855.c
+++ b/drivers/gpio/gpio-vx855.c
@@ -201,7 +201,8 @@ static const char *vx855gpio_names[NR_VX855_GP] = {
"VX855_GPIO12", "VX855_GPIO13", "VX855_GPIO14"
};
-static void vx855gpio_gpio_setup(struct vx855_gpio *vg)
+static void vx855gpio_gpio_setup(struct vx855_gpio *vg,
+ struct platform_device *pdev)
{
struct gpio_chip *c = &vg->gpio;
@@ -216,6 +217,10 @@ static void vx855gpio_gpio_setup(struct vx855_gpio *vg)
c->ngpio = NR_VX855_GP;
c->can_sleep = 0;
c->names = vx855gpio_names;
+
+#ifdef CONFIG_OF_GPIO
+ c->of_node = pdev->dev.of_node;
+#endif
}
/* This platform device is ordinarily registered by the vx855 mfd driver */
@@ -264,7 +269,7 @@ static __devinit int vx855gpio_probe(struct platform_device *pdev)
else
vg->gpo_reserved = true;
- vx855gpio_gpio_setup(vg);
+ vx855gpio_gpio_setup(vg, pdev);
ret = gpiochip_add(&vg->gpio);
if (ret) {
--
1.7.6.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] gpio-vx855: Add device tree binding
2011-09-21 12:02 [PATCH 3/3] gpio-vx855: Add device tree binding Daniel Drake
@ 2011-09-21 12:50 ` Mark Brown
2011-09-21 13:04 ` Daniel Drake
2011-09-21 16:29 ` Grant Likely
0 siblings, 2 replies; 6+ messages in thread
From: Mark Brown @ 2011-09-21 12:50 UTC (permalink / raw)
To: Daniel Drake
Cc: grant.likely, sameo, devicetree-discuss, linux-kernel, dilinger
On Wed, Sep 21, 2011 at 01:02:14PM +0100, Daniel Drake wrote:
> +- #gpio-cells : Should be two. The first cell is the pin number and the
> + second cell is used to specify optional parameters:
> + - bit 0 specifies polarity (0 for normal, 1 for inverted)
Shouldn't we just have a property for the polarity?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] gpio-vx855: Add device tree binding
2011-09-21 12:50 ` Mark Brown
@ 2011-09-21 13:04 ` Daniel Drake
2011-09-21 16:29 ` Grant Likely
1 sibling, 0 replies; 6+ messages in thread
From: Daniel Drake @ 2011-09-21 13:04 UTC (permalink / raw)
To: Mark Brown
Cc: grant.likely, sameo, devicetree-discuss, linux-kernel, dilinger
On Wed, Sep 21, 2011 at 1:50 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Wed, Sep 21, 2011 at 01:02:14PM +0100, Daniel Drake wrote:
>
>> +- #gpio-cells : Should be two. The first cell is the pin number and the
>> + second cell is used to specify optional parameters:
>> + - bit 0 specifies polarity (0 for normal, 1 for inverted)
>
> Shouldn't we just have a property for the polarity?
Can't comment on the general design, but the way it is
described/implemented in the patch is consistent with GPIO controllers
in general in the kernel. e.g. its the same as gpio_nvidia, and it is
then driven by the generic gpio/dt code rather than having to
implement extra stuff in the vx855 driver.
Daniel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] gpio-vx855: Add device tree binding
2011-09-21 12:50 ` Mark Brown
2011-09-21 13:04 ` Daniel Drake
@ 2011-09-21 16:29 ` Grant Likely
2011-09-21 16:37 ` Mark Brown
1 sibling, 1 reply; 6+ messages in thread
From: Grant Likely @ 2011-09-21 16:29 UTC (permalink / raw)
To: Mark Brown
Cc: Daniel Drake, sameo, devicetree-discuss, linux-kernel, dilinger
On Wed, Sep 21, 2011 at 01:50:52PM +0100, Mark Brown wrote:
> On Wed, Sep 21, 2011 at 01:02:14PM +0100, Daniel Drake wrote:
>
> > +- #gpio-cells : Should be two. The first cell is the pin number and the
> > + second cell is used to specify optional parameters:
> > + - bit 0 specifies polarity (0 for normal, 1 for inverted)
>
> Shouldn't we just have a property for the polarity?
A flags cell in gpio specifiers (and irq specifiers for that matter) is
well established practice.
g.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] gpio-vx855: Add device tree binding
2011-09-21 16:29 ` Grant Likely
@ 2011-09-21 16:37 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2011-09-21 16:37 UTC (permalink / raw)
To: Grant Likely
Cc: Daniel Drake, sameo, devicetree-discuss, linux-kernel, dilinger
On Wed, Sep 21, 2011 at 10:29:06AM -0600, Grant Likely wrote:
> On Wed, Sep 21, 2011 at 01:50:52PM +0100, Mark Brown wrote:
> > Shouldn't we just have a property for the polarity?
> A flags cell in gpio specifiers (and irq specifiers for that matter) is
> well established practice.
Oh, well :( We need to establish what the general style is for stuff
like this, it feels like there's frequent conflict between existing
practice and what people want to do with new bindings (in addition to
the cases like the arrays where there's some issues in general).
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] gpio-vx855: Add device tree binding
@ 2011-09-28 9:08 Daniel Drake
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Drake @ 2011-09-28 9:08 UTC (permalink / raw)
To: sameo, grant.likely; +Cc: devicetree-discuss, linux-kernel, dilinger, broonie
This is needed to enable the HDD LED on the OLPC XO-1.5 laptop,
enabled through devicetree and the gpio-leds driver.
Signed-off-by: Daniel Drake <dsd@laptop.org>
---
.../devicetree/bindings/gpio/gpio_vx855.txt | 20 ++++++++++++++++++++
drivers/gpio/gpio-vx855.c | 9 +++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
create mode 100644 Documentation/devicetree/bindings/gpio/gpio_vx855.txt
diff --git a/Documentation/devicetree/bindings/gpio/gpio_vx855.txt b/Documentation/devicetree/bindings/gpio/gpio_vx855.txt
new file mode 100644
index 0000000..17285a5
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio_vx855.txt
@@ -0,0 +1,20 @@
+VIA VX855 GPIO controller
+
+Required properties:
+- compatible : "via,vx855-gpio"
+- #gpio-cells : Should be two. The first cell is the pin number and the
+ second cell is used to specify optional parameters:
+ - bit 0 specifies polarity (0 for normal, 1 for inverted)
+- gpio-controller : Marks the device node as a GPIO controller.
+
+As VIA differentiates between GPI, GPO and GPIO on its 42 available pins,
+with each pin type restarting numbering at 0, the following numbering scheme
+is used in the device tree for the pin number:
+
+PIN NO VIA NAME
+0..13 GPI 0..13
+14..26 GPO 0..12
+27..41 GPIO 0..14
+
+For example, GPIO 11 (VIA name) is referred to with pin number 38 in the
+device tree.
diff --git a/drivers/gpio/gpio-vx855.c b/drivers/gpio/gpio-vx855.c
index ef5aabd..2c300c9 100644
--- a/drivers/gpio/gpio-vx855.c
+++ b/drivers/gpio/gpio-vx855.c
@@ -201,7 +201,8 @@ static const char *vx855gpio_names[NR_VX855_GP] = {
"VX855_GPIO12", "VX855_GPIO13", "VX855_GPIO14"
};
-static void vx855gpio_gpio_setup(struct vx855_gpio *vg)
+static void vx855gpio_gpio_setup(struct vx855_gpio *vg,
+ struct platform_device *pdev)
{
struct gpio_chip *c = &vg->gpio;
@@ -216,6 +217,10 @@ static void vx855gpio_gpio_setup(struct vx855_gpio *vg)
c->ngpio = NR_VX855_GP;
c->can_sleep = 0;
c->names = vx855gpio_names;
+
+#ifdef CONFIG_OF_GPIO
+ c->of_node = pdev->dev.of_node;
+#endif
}
/* This platform device is ordinarily registered by the vx855 mfd driver */
@@ -264,7 +269,7 @@ static __devinit int vx855gpio_probe(struct platform_device *pdev)
else
vg->gpo_reserved = true;
- vx855gpio_gpio_setup(vg);
+ vx855gpio_gpio_setup(vg, pdev);
ret = gpiochip_add(&vg->gpio);
if (ret) {
--
1.7.6.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-09-28 9:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-21 12:02 [PATCH 3/3] gpio-vx855: Add device tree binding Daniel Drake
2011-09-21 12:50 ` Mark Brown
2011-09-21 13:04 ` Daniel Drake
2011-09-21 16:29 ` Grant Likely
2011-09-21 16:37 ` Mark Brown
-- strict thread matches above, loose matches on Subject: below --
2011-09-28 9:08 Daniel Drake
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).