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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BD48C4361B for ; Sat, 19 Dec 2020 20:19:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 08EC1235FA for ; Sat, 19 Dec 2020 20:19:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727561AbgLSUTe (ORCPT ); Sat, 19 Dec 2020 15:19:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726332AbgLSUTd (ORCPT ); Sat, 19 Dec 2020 15:19:33 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A3E5C0617B0 for ; Sat, 19 Dec 2020 12:18:51 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id r5so5827490eda.12 for ; Sat, 19 Dec 2020 12:18:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beagleboard-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=tKCl0hm0vvH+bc+bs6mggnl10AKwI3SRXVyRLi1L6B0=; b=YkElHEyKIBezI2/M0lST03n4UaWAm+ZaGQtYuFO/ZLe6P8I4ePURUmGxXR4/v98UsM 7bO8WF5a/2AzFsxnJMxy/eXfOwKvHzss6OI/TzUw6669P3OY7NpYN8ybfz8a+Cg7FG/J 5WKhi7Y4B5ooPa4aBEV+8jv1QEE7Iq3blQveKUqPFkw7P758qToOX4lDIx0TAZmEHxoq y3utvAIUWihjq4MLQoOMVP6lFBtv29vY+y0o0faBgJM7VowajCXuk1ncUrTgL7lKROuD fJZq1ONhrvkRf9CdEDKqEOFM1f+DXnrMjVVdYbt3O0g1Gt35SvKLxbrikDxfwrdwwAdl HQZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=tKCl0hm0vvH+bc+bs6mggnl10AKwI3SRXVyRLi1L6B0=; b=sD94Fd+9bc4PQr+Z59f56gFp7PzELuHTls7I0nPx1o/drwf3gXpLTeg5g7qEpXFfAF lmZVt2q6Tto7ZyK7oTGoCOzqxDkEvMMtzTPn7iahHGzbd7LYepqWWF+Q78Xkeywl0N6W BreAO0YR/yMhTimP8SihxnNGpq6zrR47IuXAsWm0YwYOtF70GaPpm5gwGIU50+2c4/N3 PPPADN9m/5nG+YFkzNM0do6jFy/CsqgBC79uXPITuTyjw4p0mzv/qBStTgLAxcWs82xN BfFX45LS2GXMuy14KmMayLi+G74aZ6Ld/pWt+eb30ihRNWzvS7DjBG73gN6hqXqd0QUj vuvQ== X-Gm-Message-State: AOAM531gGGRVftJ3/A2lfY3YqDu/LV50jWGDvvgN73AUQhoWKabCcSm4 PzQ6xANUEha5nR9h9HuYv7/ktw== X-Google-Smtp-Source: ABdhPJw4eR6HmRiSxLwzn4C2F0zFfTelQ4QG6LgKw8DWmcXSI7zpMEB4aR3Y6ruvmi9uQ7O5LLLE7Q== X-Received: by 2002:aa7:d74d:: with SMTP id a13mr10243116eds.78.1608409129551; Sat, 19 Dec 2020 12:18:49 -0800 (PST) Received: from x1 ([37.235.97.56]) by smtp.gmail.com with ESMTPSA id lr24sm7163904ejb.41.2020.12.19.12.18.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Dec 2020 12:18:48 -0800 (PST) Date: Sat, 19 Dec 2020 12:18:42 -0800 From: Drew Fustini To: Andy Shevchenko Cc: "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Linus Walleij , Tony Lindgren Subject: Re: [RFC PATCH] pinctrl: add helper to expose pinctrl state in debugfs Message-ID: <20201219201842.GA30242@x1> References: <20201211042625.129255-1-drew@beagleboard.org> <20201211234304.GA189853@x1> <20201214214419.GA1196223@x1> <20201215224212.GB2086329@x1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 18, 2020 at 06:00:49PM +0200, Andy Shevchenko wrote: > On Wed, Dec 16, 2020 at 12:42 AM Drew Fustini wrote: > > On Tue, Dec 15, 2020 at 09:39:18PM +0200, Andy Shevchenko wrote: > > > On Tue, Dec 15, 2020 at 9:36 PM Andy Shevchenko > > > wrote: > > > > On Mon, Dec 14, 2020 at 11:44 PM Drew Fustini wrote: > > > > > On Mon, Dec 14, 2020 at 07:55:12PM +0200, Andy Shevchenko wrote: > > > > > > ... > > > > > > > > With regards to parent directory, I did discover there is > > > > > debugfs_lookup(), so I can get the dentry for "pinctrl" and create new > > > > > subdirectory inside of it. This is the structure now: > > > > > > > > > > /sys/kernel/debug/pinctrl/pinctrl_state/ocp:P2_35_pinmux/state > > > > > /sys/kernel/debug/pinctrl/pinctrl_state/ocp:P2_34_pinmux/state > > > > > /sys/kernel/debug/pinctrl/pinctrl_state/ocp:P2_33_pinmux/state > > > > > /sys/kernel/debug/pinctrl/pinctrl_state/ocp:P2_32_pinmux/state > > > > > etc.. > > > > > > Missed part to comment. > > > > > > I was talking about > > > > > > /sys/kernel/debug/pinctrl/<$PINCTRL>/mux/<$PIN> (maybe folder, maybe node) > > > > Thanks for the example. > > > > What would the value be "<$PINCTRL>"? The name of the driver? > > The name of the device instance. This is already done in the pin control code. Ah, so for the BeagleBone, that would be 44e10800.pinmux-pinctrl-single: /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/ > > > The "ocp:Px_yy_pinmux" directory name comes from dev_name(dev). Is that > > the name you were referencing in "<$PIN>"? > > No, the <$PIN> is an actual pin on this controller. However, I think > we probably don't need this, just supply it as tuple of the parameters > to be set: like > echo $PIN $STATE > .../<$PINCTRL>/mux or alike. Do you mean not having a debugfs file for each pin, but instead just using the existing combined file? /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pinmux-pins There is one line in there for each pin in the pinctrl-single instance. For example: pin 105 (PIN105): ocp:P2_34_pinmux (GPIO UNCLAIMED) function pinmux_P2_34_default_pin group pinmux_P2_34_default_pin So maybe one solution to changing pinctrl state could to: echo "105 gpio_pu" > /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pinmux-pins I'll make an attempt at implementing that. > > -- > With Best Regards, > Andy Shevchenko