From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3C52C77B7C for ; Fri, 5 May 2023 08:54:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231200AbjEEIya (ORCPT ); Fri, 5 May 2023 04:54:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjEEIya (ORCPT ); Fri, 5 May 2023 04:54:30 -0400 Received: from muru.com (muru.com [72.249.23.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2D7BB150FF; Fri, 5 May 2023 01:54:29 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 7A93C80FC; Fri, 5 May 2023 08:54:28 +0000 (UTC) Date: Fri, 5 May 2023 11:54:27 +0300 From: Tony Lindgren To: Linus Walleij Cc: "Niedermayr, BENEDIKT" , "linux-omap@vger.kernel.org" , "haojian.zhuang@linaro.org" , linux-gpio@vger.kernel.org Subject: Re: Pinconf issues on AMxxx plattforms Message-ID: <20230505085427.GR14287@atomide.com> References: <20230504053509.GN14287@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org * Linus Walleij [230504 08:31]: > On Thu, May 4, 2023 at 7:35 AM Tony Lindgren wrote: > > * Niedermayr, BENEDIKT [230503 08:38]: > > > > We encountered some issues when accessing the gpiochardev interface on an > > > AM65xx plaform. > > Thank you for using contemporary APIs! > > > > The pinctrl offers 3 different options for muxing: > > > > > > 1. Using the generic kernel APIs: > > > Call pinctrl_select_state() function as stated > > > in Documentation/driver-api/pin-control.rst (section "Pin control requests > > > from drivers"). > > > This function will select a defined state which has been defined in DTB > > > with "pinctrl-0", "pinctrl-1", "pinctrl-x" > > > 2. Mux pins with debugfs: > > > Write the desired pingroup and pinfunction into the "pinmux-select" > > > file of the related pin controller. > > > 3. Mux the GPIO function of a requested GPIO pin by calling the pinctrl > > > drivers pcs_request_gpio() function. > > > > > > The problem now is that only option 1. will store the current mux > > > information in the pinctrl subsystems core. > > > The pinctrl-single driver highly depends on that information, which is not > > > available at all wenn muxing with options 2&3. > > > > > > I was able to fix that for option 2 but not for option 3. The problem here > > > is that the pcs_request_gpio() function just does not provide enough > > > parameters with sufficient information for achieving that task. > > The fact that 3) doesn't work has to do with how pinctrl-single has > been engineered I think, what the pinctrl_ops .gpio_request_enable/ > .gpio_disable_free/.gpio_set_direction provide is a "shortcut" > for drivers that want to take it, in case they can provide the right > information. > > The pinctrl-single driver only implements .gpio_request_enable() > but often that is enough. > > Then it is the callbacks for generic config that you said you already > added to gpio-davinci.c, so that part should be fine, patches welcome! Thanks for explaining. Sounds like pinctrl-single should possibly implement the missing functions and update pinctrl core with the changes when a gpio is requested. Regards, Tony