[meta-freescale] Incorrect GPIO value with Kernel 3.14.28
Gary Thomas
gary at mlbassoc.com
Wed May 20 06:34:11 PDT 2015
On 2015-05-20 07:25, Fabio Estevam wrote:
> On Wed, May 20, 2015 at 10:17 AM, Yannick Calmettes
> <yannick.calmettes at 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
------------------------------------------------------------
More information about the meta-freescale
mailing list