Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2214908pxu; Fri, 18 Dec 2020 08:04:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfiKqZL5s8r/lUEyyqFGUbIdsb1kMhFiND5rd/1ymCDqXbYO1DFeRzD2MTU1+an61BjsDx X-Received: by 2002:a50:c209:: with SMTP id n9mr5077881edf.123.1608307475348; Fri, 18 Dec 2020 08:04:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608307475; cv=none; d=google.com; s=arc-20160816; b=UVMqnMHCaGObli4Xsww6IOPeTn0J8qpn1mfAsRFTrtqqfEdCCWZGCjC6vNNvf9xGDs 8gE7lcOisnMqOR7M6atJ+seOEtzuPJJxSIzCffV3rk/hmQYYJmMsp2h9vqDW9aufmNMP 54gZfMghn6u4us5cE13p3vjhgcqfJYBg7nmSGXlq742RuoRMJcr8f/LkKOYDN8x6mQsx 2WKXvTEO/bI6gMSAtNpgpi6vGd1y/QvJhiioekmQIsfDClEFmEr/0a3SemUIwqfY7ksy lv7+tgSS2P7b7duA+jrugUKRQrk1i4mmTkllZ9q6Q5wmb/88pVdBhOrtVqLQURrx0hP3 Gvbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=kdhRqI/BEp6A9Y3itWAvkzj42aOw+qxe3o4UvhUzO2c=; b=JaIpuOiWW5YsowYSFg2e+qJLhAA8xSMNsWRVE7/5e225bk34NN8QIP2mMIj2028TbP bWshER5lzvf6DhjmwtR/VvcO05hndpwevjLXsrfhPII7QojgED026AnIZwBQK71WFUpw 22eTYSR9piIWIGv5dCZjK3klUJX7pApkP4ASUfIwO/yu4MRVT7ZhGFdeRi2LIsXtTocW EmMy5oYknYo9Ry+noBkJLPNAABrzOGRRNPbd2jeyouYmexMIZXg7hRrE/dUPxbdr7KOC 56h2eQzVpFujcanwLR3cT54d6RsQRZ9DynnQXVuragMDqskItIfk7fZJBHx5iuiP7pyq 4kYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nBtlnt0Y; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz24si5094138ejc.72.2020.12.18.08.04.12; Fri, 18 Dec 2020 08:04:35 -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=@gmail.com header.s=20161025 header.b=nBtlnt0Y; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727966AbgLRQCX (ORCPT + 99 others); Fri, 18 Dec 2020 11:02:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725792AbgLRQCW (ORCPT ); Fri, 18 Dec 2020 11:02:22 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46303C06138C; Fri, 18 Dec 2020 08:01:42 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id j1so1635546pld.3; Fri, 18 Dec 2020 08:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kdhRqI/BEp6A9Y3itWAvkzj42aOw+qxe3o4UvhUzO2c=; b=nBtlnt0YZCdhNgp2AwY1ZTgERaxW949bJa4cRB7Tj4RRl3wPk7UQOoFysxLqp34Lht W17XbcjNxj2MczWVlPTxczeszRf/NrqmJFRg3tfYAwRUUJTRz8FZ/UYljmsK6AL8M4// U79dXgsAs7p3OulI7OHKbHqjZu1wj504DOi/4dthUIAgs9DMg91eyOBMAu5js4GxiNQi bW5T76VhtDNPDAV6UcInsyKQRbU/EKfQK1sPudQPZeYZnMPKIeXb4CSnwStXb0+7VkGp B8JhgSQNhNh3k59xasBAAL4UX0k3sgBEsi/Gx8dYUnyyoMQ5MXjuCUW/Ixg9S6mDT6tL qEfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kdhRqI/BEp6A9Y3itWAvkzj42aOw+qxe3o4UvhUzO2c=; b=P5iTMAmJKH5ryCxhUYwqhClW8WKRppky87zl7j518ZUSeiQu1UagAUiW93TR9c19V6 ej1+WIS1POvmC3U61YD3pQ/hpbdV3aizM6gCMEsIw+mQNNxQQFLASLTSjZxDcuOvapzp p+6WkCiMrDipQye06kZtNbztUEd8IZY+bofo+dhjMlhtKKhCVA7yf4qhCn+IoHx0yy6I N669n+egMiswuPS+VPxImg1MiKY1WjCyirqVTbMEwnkKOYqEXa27hIKAfru62tl2dX+b I+IsJI5/Pigj9sbpWtXpiMCvIT82+Xgi16knwntt0+p5AUyUqR8VAW8Cm/BM/Czi7xWj hSxQ== X-Gm-Message-State: AOAM5311EinIR5IaVtQJcpt99+JJOfoksLbjgav0GGTOOgn0fXGX7659 sKTSn80sK9pDTGya1s0IvhmXUadJrJgdo4nN0XZP3FkbKjg= X-Received: by 2002:a17:902:c244:b029:da:e63c:cede with SMTP id 4-20020a170902c244b02900dae63ccedemr5078018plg.0.1608307301846; Fri, 18 Dec 2020 08:01:41 -0800 (PST) MIME-Version: 1.0 References: <20201218045134.4158709-1-drew@beagleboard.org> In-Reply-To: <20201218045134.4158709-1-drew@beagleboard.org> From: Andy Shevchenko Date: Fri, 18 Dec 2020 18:01:25 +0200 Message-ID: Subject: Re: [RFC PATCH v2] pinctrl: add helper to expose pinctrl state in debugfs To: Drew Fustini Cc: "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Pantelis Antoniou , Pantelis Antoniou , Pantelis Antoniou , Jason Kridner , Robert Nelson , Linus Walleij , Tony Lindgren Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 18, 2020 at 6:52 AM Drew Fustini wrote: > > BeagleBoard.org [0] currently uses an out-of-tree driver called > bone-pinmux-helper [1] developed by Pantelis Antoniou [2] back in 2013. > The driver assists users of our BeagleBone and PocketBeagle boards in > rapid prototyping by allowing them to change at run-time between defined > set of pinctrl states [3] for each pin on the expansion connectors [4]. > This is achieved by exposing a 'state' file in sysfs for each pin which > is used by our 'config-pin' utility [5]. > > Our goal is to eliminate all out-of-tree drivers for BeagleBoard.org > boards and thus I have been working to replace bone-pinmux-helper with a > new driver that could be acceptable upstream. My understanding is that > debugfs, unlike sysfs, could be the appropriate mechanism to expose such > functionality. No objections here. > I used the compatible string "pinctrl,state-helper" but would appreciate > advice on how to best name this. Should I create a new vendor prefix? Here is the first concern. Why does this require to be a driver with a compatible string? > The P9_14_pinmux entry would cause pinctrl-state-helper to be probed. > The driver would create the corresponding pinctrl state file in debugfs > for the pin. Here is an example of how the state can be read and > written from userspace: > > root@beaglebone:~# cat /sys/kernel/debug/pinctrl/pinctrl_state/ocp:P9_14_pinmux/state > default > root@beaglebone:~# echo pwm > /sys/kernel/debug/pinctrl/pinctrl_state/ocp:P9_14_pinmux/state > root@beaglebone:~# cat /sys/kernel/debug/pinctrl/pinctrl_state/ocp:P9_14_pinmux/state > pwm > > I would very much appreciate feedback on both this general concept, and > also specific areas in which the code should be changed to be acceptable > upstream. Two more concerns: - why is it OF only? - why has it been separated from pin control per device debug folder? > [0] http://beagleboard.org/latest-images > [1] https://github.com/beagleboard/linux/blob/5.4/drivers/misc/cape/beaglebone/bone-pinmux-helper.c > [2] https://github.com/RobertCNelson/linux-dev/blob/master/patches/drivers/ti/gpio/0001-BeagleBone-pinmux-helper.patch > [3] https://github.com/beagleboard/BeagleBoard-DeviceTrees/blob/v5.4.x-ti-overlays/src/arm/am335x-bone-common-univ.dtsi#L2084 > [4] https://github.com/beagleboard/beaglebone-black/wiki/System-Reference-Manual#section-7-1 > [5] https://github.com/beagleboard/bb.org-overlays/blob/master/tools/beaglebone-universal-io/config-pin -- With Best Regards, Andy Shevchenko