From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id CCD8FE009FA; Wed, 20 May 2015 06:34:19 -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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mail.chez-thomas.org (mail.mlbassoc.com [65.100.170.105]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 87599E00982 for ; Wed, 20 May 2015 06:34:00 -0700 (PDT) Received: by mail.chez-thomas.org (Postfix, from userid 1998) id 8A07CF811E9; Wed, 20 May 2015 07:33:59 -0600 (MDT) Received: from [192.168.1.114] (zeus [192.168.1.114]) by mail.chez-thomas.org (Postfix) with ESMTP id 1658AF811E9; Wed, 20 May 2015 07:33:59 -0600 (MDT) Message-ID: <555C8D53.6040008@mlbassoc.com> Date: Wed, 20 May 2015 07:34:11 -0600 From: Gary Thomas User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: meta-freescale@yoctoproject.org References: <555C80AE.2010806@analogway.com> <555C853B.6070805@analogway.com> <555C8971.4060708@analogway.com> In-Reply-To: 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 13:34:19 -0000 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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; -- ------------------------------------------------------------ Gary Thomas | Consulting for the MLB Associates | Embedded world ------------------------------------------------------------