Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp32060pxu; Tue, 15 Dec 2020 14:40:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxV40qk7fQ1xkNASIA4cT4GSBFNjAfoA+n7L2vOTz3H02tAdLQn1g0n8Bc+y4uarFRQDld X-Received: by 2002:a17:906:234d:: with SMTP id m13mr28784738eja.270.1608072021252; Tue, 15 Dec 2020 14:40:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608072021; cv=none; d=google.com; s=arc-20160816; b=MEdfY/FUe6TFZGWtlUY3Ubd+k6DkukijxseJSeTqs9eucF5Mdj7tC0xjeOa2B9dTs8 5XrsHx01EbiZgwmZcFF17xd3u+vRm8w2q+zN6EzVZH+CZzIjVUW7/fX68ruXY6mDfMms ZgbEVqnQtbqS4qErAYt5vP/+3b9Ozc3QOo2or8irKBkOyBWy7G3ldgzddMtx2Sym1n79 MYLtQn5xtfjMaf6/AhMo/Le6O+iSt2Dkudip5OCt/XSV1opPlcj0uKxYKVHOEQ3+yNYN cgOX42HmUStqhLMuLYl7y4NHcK4Ot19R52mHBeeD1mhaMbHdkpSm5oOkS4cb0UpOVybl voQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0adbEDIlGgsdZMwpeHsz68fadhy77HxizGrK/I/zuAw=; b=sUOhOVefqf10ixQFwl4TvA0USdY+RF5Sw0wKx42SUQF3W8AheRMpQX9dx1SuS+sd65 gp1t+sE9RxiAjFUJ8zDoJEmYTRsxqDT0mbYi8UuD3OIq9pso/WRXb4evkVkrS/affc3b B0jj/Iq1FF5i4mc0OEs639YLyyZOWQgga74bxJ25DsFYphVMTGpnek+iUJtFUpNBVxjg 7aJFXFgPZt46rvCpe7FxlTBUb8XhZp0x1uspjPvfIkPB2XoZERK0CBEdGuCusrfZTbA8 gDFtAWSUE8PQfUKQgp06+R/DjHHz1mqfzs5K4Vf8vuGzzrAakoa9PlyIYQYQOsbRRlu0 1VrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@beagleboard-org.20150623.gappssmtp.com header.s=20150623 header.b="q29BeMk/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i34si1572204edd.44.2020.12.15.14.39.57; Tue, 15 Dec 2020 14:40:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@beagleboard-org.20150623.gappssmtp.com header.s=20150623 header.b="q29BeMk/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728694AbgLOWia (ORCPT + 99 others); Tue, 15 Dec 2020 17:38:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728002AbgLOWia (ORCPT ); Tue, 15 Dec 2020 17:38:30 -0500 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C68FC061793 for ; Tue, 15 Dec 2020 14:37:50 -0800 (PST) Received: by mail-pj1-x1044.google.com with SMTP id lj6so398091pjb.0 for ; Tue, 15 Dec 2020 14:37:50 -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=0adbEDIlGgsdZMwpeHsz68fadhy77HxizGrK/I/zuAw=; b=q29BeMk/EX9TIUtaX+v7VZEkfnWRuK6tLcFjPrUlsn4jSjyLKB2EhYxqP8D8b8+C0P HU87AVsEQS9XBhz0h0FGL7Kom4UCSsadGv75EWksBjE4l0TYdhHB37cV/kT2UqwnrSF3 nRPYNZHjFZwDKUC2ADQRY6rBKcJI8QT0Bvv94dqaI7BxPBJBIeDGmTS33hWUh2ju/tF3 emUqHpd13OToX3LyN44KZ0XHRbt8SJwNal5enRDCY8mt+Wqn/b+ahiUJBf37a1ExTjSW 5Tz/wNxgkmxyHf3+GPdv8hnX8yuwJ6mhseFYhp2p2tpQs12UX6rxLFJtALQvKGogwYzB KWWA== 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=0adbEDIlGgsdZMwpeHsz68fadhy77HxizGrK/I/zuAw=; b=m6YmC0MCD45tHGQBk5vZ0ZniJOUGkToOSNUNyXHbTeLcSNsvQxH3caq51VuhaDH2W4 AY+AU1Gna3/ArkKbayeB4Pfb9eJVIatv/YPnvwSggB0NsSraZvfNzOIyoEEt7H08kB+C J8eSwLQXjvpQWzmDBKFy9XD7ZOG/6+koCeH7oiryXU0WUz8QDGi97oh78trQKgNAiuij LkOgJtqiSmZ9ImGWhLIh2F0aM2DGyM9YfotRNl5jezF5EZyP8/AzCHrm0mVmeYgiTuSn Y3oxwtXV8fZmqhohQ0rz5HfefDPplpeJLf0RMWcjTX0UdlXkczkxHXTa9jgW7gQbRFzN EhNQ== X-Gm-Message-State: AOAM531PObnSLCvlFVBD0+l0TpqfvmL7DGMQn8GZ3cPY4tk5PFwWMVV3 xlhsZ1169dDZXt+q9G2/5xOYEw== X-Received: by 2002:a17:90a:5894:: with SMTP id j20mr682847pji.107.1608071869691; Tue, 15 Dec 2020 14:37:49 -0800 (PST) Received: from x1 ([2601:1c0:4701:ae70:d679:3889:5fae:ca68]) by smtp.gmail.com with ESMTPSA id m77sm136746pfd.105.2020.12.15.14.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Dec 2020 14:37:48 -0800 (PST) Date: Tue, 15 Dec 2020 14:37:47 -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: <20201215223747.GA2086329@x1> References: <20201211042625.129255-1-drew@beagleboard.org> <20201211234304.GA189853@x1> <20201214214419.GA1196223@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 Tue, Dec 15, 2020 at 09:36:33PM +0200, 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: > > > On Sat, Dec 12, 2020 at 1:43 AM Drew Fustini wrote: > > > > On Fri, Dec 11, 2020 at 11:15:21PM +0200, Andy Shevchenko wrote: > > > > > On Fri, Dec 11, 2020 at 1:54 PM Drew Fustini wrote: > > ... > > > > > > But I'm wondering, why it requires this kind of thing and can't be > > > > > simply always part of the kernel based on configuration option? > > > > > > > > Do you mean not having a new CONFIG option for this driver and just have > > > > it be enabled by CONFIG_PINCTRL? > > > > > > No, configuration option stays, but no compatible strings no nothing > > > like that. Just probed always when loaded. > > > > I first started down the route of implementing this inside of > > pinctrl-single. I found it didn't work because devm_pinctrl_get() would > > fail. I think was because it was happening too early for pinctrl to be > > ready. > > > > I do think it seems awkward to have to add this to dts and have the > > driver get probed for each entry: > > > > P1_04_pinmux { > > compatible = "pinctrl,state-helper"; > > status = "okay"; > > pinctrl-names = "default", "gpio", "gpio_pu", "gpio_pd", "gpio_input", "pruout", "pruin"; > > pinctrl-0 = <&P1_04_default_pin>; > > pinctrl-1 = <&P1_04_gpio_pin>; > > pinctrl-2 = <&P1_04_gpio_pu_pin>; > > pinctrl-3 = <&P1_04_gpio_pd_pin>; > > pinctrl-4 = <&P1_04_gpio_input_pin>; > > pinctrl-5 = <&P1_04_pruout_pin>; > > pinctrl-6 = <&P1_04_pruin_pin>; > > }; > > > > But I am having a hard time figuring out another way of doing it. > > I'm not a DT expert and I have no clue why you need all this. To me it > looks over engineered to engage DT for debugging things. OTOH, you may > add a property to allow debug mux (but it prevent ACPI enabled > platforms to utilize this). There needs to be some mechanism through which to list the possible valid pinctrl states for each pin on the expansion connectors (P1/P2 for PocketBeagle and P8/P9 for BeagleBones). For these ARM boards, device tree pinctrl bindings are the only way I can see to do this. I am not familiar enough with ACPI to understand if this needs to be extended for boards without device tree. > > ... > > > Any ideas as to what would trigger the probe() if there was not a match > > on a compatible like "pinctrl,state-helper"? > > > > > Actually not even sure we want to have it as a module. > > > > And have just be a part of one of the existing pinctrl files like core.c? > > Separate file, but in conjunction with core.c and pinmux and so on. > > ... > > > > > > Shouldn't it be rather a part of a certain pin control folder: > > > > > debug/pinctrl/.../mux/... > > > > > ? > > > > > > > > Yes, I think that would make sense, but I was struggling to figure out > > > > how to do that. pinctrl_init_debugfs() in pinctrl/core.c does create the > > > > "pinctrl" directory, but I could not figure out how to use this as the > > > > parent dir when calling debugfs_create_dir() in this driver's probe(). > > > > > > > > I thought there might be a way in debugfs API to use existing directory > > > > path as a parent but I couldn't figure anything like that. I would > > > > appreciate any advice. > > > > > > If the option is boolean from the beginning then you just call it from > > > the corresponding pin control instantiation chain. > > > > Sorry, I am not sure I understand what you mean here. What does > > "option" mean in this context? I don't think there is any value that is > > boolean invovled. The pinctrl states are strings. > > config PINMUX_DEBUG > bool "..." > depends on PINMUX Okay, thanks for califying. There is already DEBUG_PINCTRL which just adds -DDEBUG compile option. The existing debugfs logic in pinctrl core and drivers is gated by CONFIG_DEBUG_FS. It seems for this new capability to expose pinctrl state in debugfs that I should use something like: #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_PINMUX_DEBUG) Does that seem reasonable? > > > > > > > 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.. > > > -- > With Best Regards, > Andy Shevchenko thanks, drew