From: Eduardo Valentin <edubezval@gmail.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
ubrindis56@gmail.com, Fabio Estevam <fabio.estevam@freescale.com>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] gpio/mxc: implement reading output gpio value
Date: Wed, 5 Aug 2015 11:02:18 -0700 [thread overview]
Message-ID: <20150805180215.GA4161@localhost.localdomain> (raw)
In-Reply-To: <CAOMZO5C3mh+vYV_ZHA8hAq2UwY_TcO5sZxqLQDyNvs0VuVvJAg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1528 bytes --]
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
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
next prev parent reply other threads:[~2015-08-05 18:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-05 17:23 [PATCH 0/2] couple of fixes on IMX gpio driver Eduardo Valentin
2015-08-05 17:23 ` [PATCH 1/2] gpio/mxc: mask gpio interrupts in suspend Eduardo Valentin
2015-08-13 12:47 ` Linus Walleij
2015-08-05 17:23 ` [PATCH 2/2] gpio/mxc: implement reading output gpio value Eduardo Valentin
2015-08-05 17:43 ` Fabio Estevam
2015-08-05 18:02 ` Eduardo Valentin [this message]
2015-08-05 18:11 ` Fabio Estevam
2015-08-05 19:46 ` Eduardo Valentin
2015-08-05 20:44 ` Fabio Estevam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150805180215.GA4161@localhost.localdomain \
--to=edubezval@gmail.com \
--cc=fabio.estevam@freescale.com \
--cc=festevam@gmail.com \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ubrindis56@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).