From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754860AbcEBSKm (ORCPT ); Mon, 2 May 2016 14:10:42 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:2330 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754820AbcEBSKb (ORCPT ); Mon, 2 May 2016 14:10:31 -0400 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Mon, 02 May 2016 11:09:32 -0700 Message-ID: <57279534.5010409@nvidia.com> Date: Mon, 2 May 2016 23:28:12 +0530 From: Laxman Dewangan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Stephen Warren , Linus Walleij CC: Alexandre Courbot , Thierry Reding , "linux-gpio@vger.kernel.org" , "linux-tegra@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH V5 0/4] gpio: tegra: Cleanups and support for debounce References: <1461580714-22479-1-git-send-email-ldewangan@nvidia.com> <5723274B.3050209@nvidia.com> <57277C70.5080204@wwwdotorg.org> In-Reply-To: <57277C70.5080204@wwwdotorg.org> X-Originating-IP: [10.19.65.30] X-ClientProxiedBy: DRHKMAIL102.nvidia.com (10.25.59.16) To bgmail102.nvidia.com (10.25.59.11) Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 02 May 2016 09:42 PM, Stephen Warren wrote: > On 04/30/2016 05:07 AM, Linus Walleij wrote: >> On Fri, Apr 29, 2016 at 11:20 AM, Laxman Dewangan >> wrote: >>> On Friday 29 April 2016 02:37 PM, Linus Walleij wrote: >>>> On Mon, Apr 25, 2016 at 12:38 PM, Laxman Dewangan >>>> >>>> wrote: >>>> >>>>> Add support for the debounce as Tegra210 support debounce in HW. >>>>> Also do the clenaups to remove all global variables. >>>> >>>> OK this v5 is applied. >>>> >>>> Laxman does this GPIO also have open drain and/or open source >>>> handling? >>> >>> >>> Some of the pins support the open drain and these are part of pinmux >>> register set. >>> For that we have property for setting open drain. > > IIRC, Tegra has open-drain control in both the GPIO controller for all > pins (OE bit) and in the pinmux controller for a small subset of pins. > For GPIOs, why wouldn't we just use the control bit in the GPIO > controller for all GPIOs. This would avoid any special-cases, and > minimize coupling between the GPIO and pinctrl drivers. Toggling OE bit is something emulating the open drain here. I think idea is that when we configure the pin in open drain then it should be automatically handled by HW when we want to set pin state high or low. When we set low, the pin should be driven and when high then it should be tristated input. We should not need any direction bit setting. Otherwise, if pin is configured as open drain then: Set out = 0 and when it need to set pin to high then oe = 0 else oe =1. Do not toggle any other bits. On this case, we need to store that pin is configured as open drain so that set_value should toggle OE instead of OUT. Or do you want to have different implementation?