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


Groups > linux.kernel > #1201031

Re: [PATCH 2/2] gpio/mxc: implement reading output gpio value

From Eduardo Valentin <edubezval@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] gpio/mxc: implement reading output gpio value
Date 2015-08-05 20:10 +0200
Message-ID <pUbix-xJ-1@gated-at.bofh.it> (permalink)
References <pUaFQ-811-3@gated-at.bofh.it> <pUaFQ-811-11@gated-at.bofh.it> <pUaZb-8nv-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello Fabio,

On Wed, Aug 05, 2015 at 02:43:05PM -0300, Fabio Estevam wrote:
> Hi Eduardo,
> 
> On Wed, Aug 5, 2015 at 2:23 PM, Eduardo Valentin <edubezval@gmail.com> wrote:
> > In current implementation, reading the value of an output gpio
> > always return 0. The reason is because when a gpio is configured
> 
> Have you tried setting the SION bit for the pad?

No, I haven't. From the bit description, it looks like it does a
different thing of what we would achieve with this patch. The SION bit
is a overwrite to the pad configuration. That is, the pin will be INPUT
always.

We don't want to force it to be input. We simply want to be able to read
the value of an output GPIO. That is achievable by reading a different
register. In case the GPIO is configured as output, the GPIO block
documentation states its value can be read from GPIO_PSR.
This approach works fine, as the GPIO will be output and we can still
read its value.

Spotting this is very simple. A quick try on /sys/class/gpio/export on
a spare gpio would do it:

# echo $SPARE_GPIO > /sys/class/gpio/export
# echo out > /sys/class/gpio/gpio$SPARE_GPIO/direction
# echo 1 > /sys/class/gpio/gpio$SPARE_GPIO/value
# cat /sys/class/gpio/gpio$SPARE_GPIO/value

without the patch it would always return 0. With the patch in, you see
the read value corresponding the output of that pin (checked on scope,
for instance).



> 
> This should fix the problem.
> 
> Regards,
> 
> Fabio Estevam

BR,

Eduardo Valentin

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] couple of fixes on IMX gpio driver Eduardo Valentin <edubezval@gmail.com> - 2015-08-05 19:30 +0200
  [PATCH 1/2] gpio/mxc: mask gpio interrupts in suspend Eduardo Valentin <edubezval@gmail.com> - 2015-08-05 19:30 +0200
    Re: [PATCH 1/2] gpio/mxc: mask gpio interrupts in suspend Linus Walleij <linus.walleij@linaro.org> - 2015-08-13 14:50 +0200
  [PATCH 2/2] gpio/mxc: implement reading output gpio value Eduardo Valentin <edubezval@gmail.com> - 2015-08-05 19:30 +0200
    Re: [PATCH 2/2] gpio/mxc: implement reading output gpio value Fabio Estevam <festevam@gmail.com> - 2015-08-05 19:50 +0200
      Re: [PATCH 2/2] gpio/mxc: implement reading output gpio value Eduardo Valentin <edubezval@gmail.com> - 2015-08-05 20:10 +0200
        Re: [PATCH 2/2] gpio/mxc: implement reading output gpio value Fabio Estevam <festevam@gmail.com> - 2015-08-05 20:20 +0200
          Re: [PATCH 2/2] gpio/mxc: implement reading output gpio value Eduardo Valentin <edubezval@gmail.com> - 2015-08-05 21:50 +0200
            Re: [PATCH 2/2] gpio/mxc: implement reading output gpio value Fabio Estevam <festevam@gmail.com> - 2015-08-05 22:50 +0200

csiph-web