From: Gary Thomas <gary@mlbassoc.com>
To: meta-freescale@yoctoproject.org
Subject: Re: Incorrect GPIO value with Kernel 3.14.28
Date: Wed, 20 May 2015 07:34:11 -0600 [thread overview]
Message-ID: <555C8D53.6040008@mlbassoc.com> (raw)
In-Reply-To: <CAOMZO5BJY87u6Mr=SvGRTR18RxyC9K22E+91JKHvsMM7URXFCg@mail.gmail.com>
On 2015-05-20 07:25, Fabio Estevam wrote:
> On Wed, May 20, 2015 at 10:17 AM, Yannick Calmettes
> <yannick.calmettes@analogway.com> wrote:
>> Sorry Fabio, it stills return 512.
>
> How do you read the pins exactly? From kernel or from userspace?
>
> What was the response in 3.10.53?
I assume he's using SYSFS
The GPIO driver (drivers/gpio/gpiolib.c) changed behaviour between
these two versions. In 3.10.53, it will show either 0 or 1. In
3.14.28 it will show the exact bit value as Yannick is experiencing.
You could try this patch (untested):
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 50c4922..45aa695 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -376,7 +376,7 @@ static ssize_t gpio_value_show(struct device *dev,
if (!test_bit(FLAG_EXPORT, &desc->flags))
status = -EIO;
else
- status = sprintf(buf, "%d\n", gpiod_get_value_cansleep(desc));
+ status = sprintf(buf, "%d\n", !!gpiod_get_value_cansleep(desc));
mutex_unlock(&sysfs_lock);
return status;
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
next prev parent reply other threads:[~2015-05-20 13:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 12:40 Incorrect GPIO value with Kernel 3.14.28 Yannick Calmettes
2015-05-20 12:50 ` Otavio Salvador
2015-05-20 12:50 ` Fabio Estevam
2015-05-20 12:59 ` Yannick Calmettes
2015-05-20 13:07 ` Fabio Estevam
2015-05-20 13:17 ` Yannick Calmettes
2015-05-20 13:25 ` Fabio Estevam
2015-05-20 13:23 ` Yannick Calmettes
2015-05-20 13:34 ` Gary Thomas [this message]
2015-05-20 15:15 ` Yannick Calmettes
2015-05-20 15:32 ` Gary Thomas
2015-05-20 15:36 ` 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=555C8D53.6040008@mlbassoc.com \
--to=gary@mlbassoc.com \
--cc=meta-freescale@yoctoproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.