[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150805180215.GA4161@localhost.localdomain>
Date: Wed, 5 Aug 2015 11:02:18 -0700
From: Eduardo Valentin <edubezval@...il.com>
To: Fabio Estevam <festevam@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Alexandre Courbot <gnurou@...il.com>, ubrindis56@...il.com,
Fabio Estevam <fabio.estevam@...escale.com>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] gpio/mxc: implement reading output gpio value
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@...il.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
Download attachment "signature.asc" of type "application/pgp-signature" (491 bytes)
Powered by blists - more mailing lists