Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751234AbeACRhf (ORCPT + 1 other); Wed, 3 Jan 2018 12:37:35 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:40108 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751021AbeACRhd (ORCPT ); Wed, 3 Jan 2018 12:37:33 -0500 Date: Wed, 3 Jan 2018 18:37:26 +0100 From: jacopo mondi To: Fabio Estevam Cc: Jacopo Mondi , Laurent Pinchart , Magnus Damm , geert@glider.be, Mauro Carvalho Chehab , Hans Verkuil , Rob Herring , Mark Rutland , linux-renesas-soc@vger.kernel.org, linux-media , linux-sh@vger.kernel.org, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-kernel Subject: Re: [PATCH v2 9/9] media: i2c: tw9910: Remove soc_camera dependencies Message-ID: <20180103173726.GH9493@w540> References: <1514469681-15602-1-git-send-email-jacopo+renesas@jmondi.org> <1514469681-15602-10-git-send-email-jacopo+renesas@jmondi.org> <20180103171347.GF9493@w540> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi Fabio, On Wed, Jan 03, 2018 at 03:27:53PM -0200, Fabio Estevam wrote: > Hi Jacopo, > > On Wed, Jan 3, 2018 at 3:13 PM, jacopo mondi wrote: > > > That would be true if I would have declared the GPIO to be ACTIVE_LOW. > > See patch [5/9] in this series and search for "rstb". The GPIO (which > > is shared between two devices) is said to be active high... > > Just looked at your patch 5/9 and it seems it only works because you > made two inversions :-) > > Initially the rest GPIO was doing: > > - gpio_set_value(GPIO_PTT3, 0); > - mdelay(10); > - gpio_set_value(GPIO_PTT3, 1); > - mdelay(10); /* wait to let chip come out of reset */ And that's what my driver code does :) > > So this is an active low reset. > Indeed > So you should have converted it to: > > GPIO_LOOKUP("sh7722_pfc", GPIO_PTT3, "rstb", GPIO_ACTIVE_LOW), > > and then in this patch you should do as I said earlier: > > gpiod_set_value(priv->rstb_gpio, 1); > usleep_range(500, 1000); > gpiod_set_value(priv->rstb_gpio, 0); My point is that if I read the manual and I see an active low gpio (0 is reset state) then the driver code uses it as and active high one (1 is the reset state), that would be weird to me. But maybe that's just me, and if that's common practice, I'll happly change this! Thanks j