Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753175AbcKOLxQ (ORCPT ); Tue, 15 Nov 2016 06:53:16 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:4601 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751225AbcKOLxO (ORCPT ); Tue, 15 Nov 2016 06:53:14 -0500 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Mon, 14 Nov 2016 15:52:15 -0800 Message-ID: <582AF350.1000007@nvidia.com> Date: Tue, 15 Nov 2016 17:06:48 +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: Linus Walleij CC: Alexandre Courbot , Arnd Bergmann , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" Subject: Re: [PATCH 1/1] gpio: lib: Add gpio_is_enabled() to get pin mode References: <1478089037-26441-1-git-send-email-ldewangan@nvidia.com> <5825B6D4.1000600@nvidia.com> In-Reply-To: X-Originating-IP: [10.19.65.30] X-ClientProxiedBy: DRBGMAIL101.nvidia.com (10.18.16.20) 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 Content-Length: 1981 Lines: 44 On Tuesday 15 November 2016 02:33 PM, Linus Walleij wrote: > On Fri, Nov 11, 2016 at 1:17 PM, Laxman Dewangan wrote: > >>> Yeah but since pinctrl and pinmux has its own debugfs files why is this >>> necessary? I understand it is convenient but only for debugging >>> right? They the inconvenience of using pinctrls debugfs files should >>> be bearable. >> Yes, it is debugging and capturing all the info at single place. Currently, >> gpio debugFs shows the gpio related stuff and the pinctrl on pinconfig but >> there is not any dump which shows the complete pin mapping. >> The effort is to compile all the data in single place with proper message to >> avoid any manual work for decoding multiple outputs. > I don't know if this is a good idea. I don't want to clutter the > gpiolib ABI for no good reason. > > For certain this should only be available for drivers using pin > control as a back-end for their GPIOs. > > For that purpose we have (in : > > /* External interface to pin control */ > extern int pinctrl_request_gpio(unsigned gpio); > extern void pinctrl_free_gpio(unsigned gpio); > extern int pinctrl_gpio_direction_input(unsigned gpio); > extern int pinctrl_gpio_direction_output(unsigned gpio); > > It would be more natural to add a function pinctrl_is_gpio(unsigned gpio) > to call back to the pin controller, then that can be called from > the generic or driver-specific debug print callback. We have two type of IPs, GPIO mode is configured in the register which is part of GPIO controller and in other IP, it is configured in register which is in pincontroller registers. Your suggested API pinctrl_is_gpio() will definitely help on second case and I will work on this once we will have the new IP driver in mainline. This will be in coming T186 patches. For T210 SoC, the configuration is done in gpio controller and we need to have debug utility outside of driver and hence the requirements was.