From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 69BF6E005B9; Wed, 20 May 2015 08:21:26 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [85.31.212.46 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.0 HTML_MESSAGE BODY: HTML included in message Received: from fx302.security-mail.net (mxout.security-mail.net [85.31.212.46]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id EE5C5E0027F for ; Wed, 20 May 2015 08:21:20 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by fx302.security-mail.net (MTA) with SMTP id D459E1C3E440 for ; Wed, 20 May 2015 17:21:15 +0200 (CEST) Received: from fx302 (localhost [127.0.0.1]) by fx302.security-mail.net (MTA) with ESMTP id D13401C3E3F8 for ; Wed, 20 May 2015 17:21:15 +0200 (CEST) X-Virus-Scanned: E-securemail x-secugrey: score=-10 x-secugrey: filter=out_default,id=20150520172115-47901-00016,score=-20 Received: from cg92.security-mail.net (cg92.security-mail.net [172.16.248.92]) by fx302.security-mail.net (MTA) with ESMTPS id 60EC11C3E3DB for ; Wed, 20 May 2015 17:21:15 +0200 (CEST) Received: by cg92.security-mail.net (MTA, from userid 0) id 5E181129CA; Wed, 20 May 2015 17:21:15 +0200 (CEST) Received: from [89.91.77.218] (account yannick.calmettes@analogway.com HELO [192.168.0.39]) by mails.optimails.com (CommuniGate Pro SMTP 6.0.11) with ESMTPSA id 1837985005 for meta-freescale@yoctoproject.org; Wed, 20 May 2015 17:21:15 +0200 Message-ID: <555CA509.9010309@analogway.com> Date: Wed, 20 May 2015 17:15:21 +0200 From: Yannick Calmettes User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: meta-freescale@yoctoproject.org References: <555C80AE.2010806@analogway.com> <555C853B.6070805@analogway.com> <555C8971.4060708@analogway.com> <555C8D53.6040008@mlbassoc.com> In-Reply-To: <555C8D53.6040008@mlbassoc.com> X-Virus-Scanned: by Security-Mail Subject: Re: Incorrect GPIO value with Kernel 3.14.28 X-BeenThere: meta-freescale@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Usage and development list for the meta-fsl-* layers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 May 2015 15:21:26 -0000 Content-Type: multipart/alternative; boundary="------------060408090709030808050307" --------------060408090709030808050307 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit 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 >> 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; > > --------------060408090709030808050307 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit 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@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;




 

--------------060408090709030808050307--