Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1506039 > unrolled thread

[PATCH] gpio: mcp23s08: Add option to configure pullups.

Started byEnric Balletbo i Serra <enric.balletbo@collabora.com>
First post2016-10-21 17:10 +0200
Last post2016-10-26 12:00 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] gpio: mcp23s08: Add option to configure pullups. Enric Balletbo i Serra <enric.balletbo@collabora.com> - 2016-10-21 17:10 +0200
    Re: [PATCH] gpio: mcp23s08: Add option to configure pullups. Linus Walleij <linus.walleij@linaro.org> - 2016-10-24 03:00 +0200
      Re: [PATCH] gpio: mcp23s08: Add option to configure pullups. Alexander Stein <alexander.stein@systec-electronic.com> - 2016-10-24 08:20 +0200
        Re: [PATCH] gpio: mcp23s08: Add option to configure pullups. Enric Balletbo Serra <eballetbo@gmail.com> - 2016-10-26 12:00 +0200

#1506039 — [PATCH] gpio: mcp23s08: Add option to configure pullups.

FromEnric Balletbo i Serra <enric.balletbo@collabora.com>
Date2016-10-21 17:10 +0200
Subject[PATCH] gpio: mcp23s08: Add option to configure pullups.
Message-ID<suJCi-7mB-11@gated-at.bofh.it>
Default is without pullups, but if property is specified in DT and the bit
is set, set a pullup on GPIO-n.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
 Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt | 1 +
 drivers/gpio/gpio-mcp23s08.c                             | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt b/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt
index c934106..40306b1 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-mcp23s08.txt
@@ -57,6 +57,7 @@ Optional device specific properties:
         On devices with only one interrupt output this property is useless.
 - microchip,irq-active-high: Sets the INTPOL flag in the IOCON register. This
         configures the IRQ output polarity as active high.
+- microchip,pullups : If n-th bit is set, set a pullup on GPIO-n.
 
 Example I2C (with interrupt):
 gpiom1: gpio@20 {
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index 99d37b5..0cedf82 100644
--- a/drivers/gpio/gpio-mcp23s08.c
+++ b/drivers/gpio/gpio-mcp23s08.c
@@ -766,7 +766,8 @@ static int mcp230xx_probe(struct i2c_client *client,
 	if (match) {
 		pdata = &local_pdata;
 		pdata->base = -1;
-		pdata->chip[0].pullups = 0;
+		of_property_read_u32(client->dev.of_node, "microchip,pullups",
+				     &pdata->chip[0].pullups);
 		pdata->irq_controller =	of_property_read_bool(
 					client->dev.of_node,
 					"interrupt-controller");
-- 
2.1.0

[toc] | [next] | [standalone]


#1506812

FromLinus Walleij <linus.walleij@linaro.org>
Date2016-10-24 03:00 +0200
Message-ID<svBMl-eA-1@gated-at.bofh.it>
In reply to#1506039
On Fri, Oct 21, 2016 at 5:00 PM, Enric Balletbo i Serra
<enric.balletbo@collabora.com> wrote:

> Default is without pullups, but if property is specified in DT and the bit
> is set, set a pullup on GPIO-n.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

I don't generally like this.

In device tree it is the consumer that specifies how the line is used,
not the producer (gpiochip).

We currently only specify polarity, open drain and open source
for consumers though.

And the entire pin control system came into being *exactly* because
Grant didn't like me adding these things to the GPIO drivers.

So how many other things does the MCP support? Drive strength?
Schmitt trigger? Is there a datasheet?

Yours,
Linus Walleij

[toc] | [prev] | [next] | [standalone]


#1506923

FromAlexander Stein <alexander.stein@systec-electronic.com>
Date2016-10-24 08:20 +0200
Message-ID<svGM1-3MP-7@gated-at.bofh.it>
In reply to#1506812
On Monday 24 October 2016 02:53:31, Linus Walleij wrote:
> On Fri, Oct 21, 2016 at 5:00 PM, Enric Balletbo i Serra
> 
> <enric.balletbo@collabora.com> wrote:
> > Default is without pullups, but if property is specified in DT and the bit
> > is set, set a pullup on GPIO-n.
> > 
> > Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> 
> I don't generally like this.
> 
> In device tree it is the consumer that specifies how the line is used,
> not the producer (gpiochip).
> 
> We currently only specify polarity, open drain and open source
> for consumers though.
> 
> And the entire pin control system came into being *exactly* because
> Grant didn't like me adding these things to the GPIO drivers.
> 
> So how many other things does the MCP support? Drive strength?
> Schmitt trigger? Is there a datasheet?

Some unsupported features (AFAIK):
* Input polarity (IPOL register)
* open-drain interrupt pin
* pullup on pins (proposed patch)

Datasheet is here: http://ww1.microchip.com/downloads/en/DeviceDoc/21919e.pdf

Best regards,
Alexander

[toc] | [prev] | [next] | [standalone]


#1509019

FromEnric Balletbo Serra <eballetbo@gmail.com>
Date2016-10-26 12:00 +0200
Message-ID<swta2-1Sm-25@gated-at.bofh.it>
In reply to#1506923
Hi Linus,

2016-10-24 8:13 GMT+02:00 Alexander Stein
<alexander.stein@systec-electronic.com>:
> On Monday 24 October 2016 02:53:31, Linus Walleij wrote:
>> On Fri, Oct 21, 2016 at 5:00 PM, Enric Balletbo i Serra
>>
>> <enric.balletbo@collabora.com> wrote:
>> > Default is without pullups, but if property is specified in DT and the bit
>> > is set, set a pullup on GPIO-n.
>> >
>> > Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>>
>> I don't generally like this.
>>

I tried to use the same approach as used in gpio-twl4030.c because is
what I knew before. Maybe you can point me to a better approach?

>> In device tree it is the consumer that specifies how the line is used,
>> not the producer (gpiochip).
>>
>> We currently only specify polarity, open drain and open source
>> for consumers though.
>>
>> And the entire pin control system came into being *exactly* because
>> Grant didn't like me adding these things to the GPIO drivers.
>>
>> So how many other things does the MCP support? Drive strength?
>> Schmitt trigger? Is there a datasheet?
>
> Some unsupported features (AFAIK):
> * Input polarity (IPOL register)
> * open-drain interrupt pin
> * pullup on pins (proposed patch)
>
> Datasheet is here: http://ww1.microchip.com/downloads/en/DeviceDoc/21919e.pdf
>
> Best regards,
> Alexander
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web