[meta-freescale] Incorrect GPIO value with Kernel 3.14.28

Yannick Calmettes yannick.calmettes at analogway.com
Wed May 20 08:15:21 PDT 2015


Thank you Gary and Fabio, it works.

Yannick
**
Le 20/05/2015 15:34, Gary Thomas a écrit :
> 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;
>
>


 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/meta-freescale/attachments/20150520/586bf55a/attachment.html>


More information about the meta-freescale mailing list