From patchwork Wed Feb 17 22:14:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 384090 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=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 9D324C433DB for ; Wed, 17 Feb 2021 22:16:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 760E464E5F for ; Wed, 17 Feb 2021 22:16:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233318AbhBQWP6 (ORCPT ); Wed, 17 Feb 2021 17:15:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233252AbhBQWP4 (ORCPT ); Wed, 17 Feb 2021 17:15:56 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CD4FC061788 for ; Wed, 17 Feb 2021 14:15:16 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id a24so81023plm.11 for ; Wed, 17 Feb 2021 14:15:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beagleboard-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OBtTzri1cScqDnwkEDlkQhcrUhTCJcMkyhXW4hdMGZI=; b=xzOKEC/SvVdiXMn25hWsWw23Gk5wWdb3cEWX6ZuKUYsfO2/RdTEmhWpcTLHjHdxciq cf21DYRNUX4EkMAMDWOPNruvDQueIRp7GDA5Uz5RjMx3Kk1bD6QK/n1Xlxc3El5iOX6D TYzW5qKmROR9wFtYT3pm2pA4o4HRBtE7KwxBbUyeG08+jQC21mkCapX2yrgRIZbePN8G hcsgcCElR5M/PopZUVQLYrENTwi2KkbSNHz2wFiKWU+BYUeC4g23ffqbv3wQWjTimsGY J41wxRkz7725JRUVhQhx61/0uLnVr3/jdX2wZRsnWmFM/EV9N2ygY1Q4qWP+BjRlMwNx NfBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OBtTzri1cScqDnwkEDlkQhcrUhTCJcMkyhXW4hdMGZI=; b=UQE7CitcgFdryWmZTWUzk4nW2yQ5ddLEhkU54R8v7C70iSruzHTf+vxuqItbfl0EGk W/4hkJdvdYunCYG32t6rFq3iPgsDW0kEcOrhM9Mm84v5mvSzADmGFvQWleFA4OyvFgS/ h51UmMEcWiM6uB8Y/tzrtBvaf0UBQj3xJL4FMSzwRi8fwVNaYHcKyNM6t1xQcKp/0lrX bKyNiHKgjpnlATT82DJfU4KZCG0bvCP87izfnv8ZG9NJT3jL7CRd0uKHzUpA0w3bibZm oyLjA/dgI6xcGfeRigwKjmgTRZwA/63Xa5WXVxmRmtCu9tAGFWmdSHNosf8fdp6BE9RO 1LNw== X-Gm-Message-State: AOAM531c/wAXuYbTUX6eAmsKQcaeCV0hD6pO/wjzJNpKQD49TBqeHQzJ X/0XtYqDa7jBGGN+15KbQBiSJw== X-Google-Smtp-Source: ABdhPJz1gMcAGBc39Tdv9NaB9LZDjuNdp5Iy9QEFHfsF4ZOaXNQD0NUFpLnvx67EADxYSZ4rssQfag== X-Received: by 2002:a17:90a:6549:: with SMTP id f9mr932739pjs.17.1613600115969; Wed, 17 Feb 2021 14:15:15 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c0:4701:ae70:c31f:9bea:96ec:ef07]) by smtp.gmail.com with ESMTPSA id q43sm3142591pjq.25.2021.02.17.14.15.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 14:15:15 -0800 (PST) From: Drew Fustini To: Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Tony Lindgren , Andy Shevchenko , Alexandre Belloni , Geert Uytterhoeven , Pantelis Antoniou , Jason Kridner , Robert Nelson , Joe Perches , Dan Carpenter , Jonathan Corbet , linux-doc@vger.kernel.org Cc: Drew Fustini , Geert Uytterhoeven Subject: [PATCH v7 1/3] pinctrl: use to octal permissions for debugfs files Date: Wed, 17 Feb 2021 14:14:56 -0800 Message-Id: <20210217221457.1827266-2-drew@beagleboard.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217221457.1827266-1-drew@beagleboard.org> References: <20210217221457.1827266-1-drew@beagleboard.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Switch over pinctrl debugfs files to use octal permissions as they are preferred over symbolic permissions. Refer to commit f90774e1fd27 ("checkpatch: look for symbolic permissions and suggest octal instead"). Note: S_IFREG flag is added to the mode by __debugfs_create_file() in fs/debugfs/inode.c Suggested-by: Joe Perches Suggested-by: Andy Shevchenko Reviewed-by: Andy Shevchenko Reviewed-by: Geert Uytterhoeven Reviewed-by: Tony Lindgren Signed-off-by: Drew Fustini --- drivers/pinctrl/core.c | 12 ++++++------ drivers/pinctrl/pinconf.c | 4 ++-- drivers/pinctrl/pinmux.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 3663d87f51a0..07458742bc0f 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -1888,11 +1888,11 @@ static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev) dev_name(pctldev->dev)); return; } - debugfs_create_file("pins", S_IFREG | S_IRUGO, + debugfs_create_file("pins", 0444, device_root, pctldev, &pinctrl_pins_fops); - debugfs_create_file("pingroups", S_IFREG | S_IRUGO, + debugfs_create_file("pingroups", 0444, device_root, pctldev, &pinctrl_groups_fops); - debugfs_create_file("gpio-ranges", S_IFREG | S_IRUGO, + debugfs_create_file("gpio-ranges", 0444, device_root, pctldev, &pinctrl_gpioranges_fops); if (pctldev->desc->pmxops) pinmux_init_device_debugfs(device_root, pctldev); @@ -1914,11 +1914,11 @@ static void pinctrl_init_debugfs(void) return; } - debugfs_create_file("pinctrl-devices", S_IFREG | S_IRUGO, + debugfs_create_file("pinctrl-devices", 0444, debugfs_root, NULL, &pinctrl_devices_fops); - debugfs_create_file("pinctrl-maps", S_IFREG | S_IRUGO, + debugfs_create_file("pinctrl-maps", 0444, debugfs_root, NULL, &pinctrl_maps_fops); - debugfs_create_file("pinctrl-handles", S_IFREG | S_IRUGO, + debugfs_create_file("pinctrl-handles", 0444, debugfs_root, NULL, &pinctrl_fops); } diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c index 02c075cc010b..d9d54065472e 100644 --- a/drivers/pinctrl/pinconf.c +++ b/drivers/pinctrl/pinconf.c @@ -370,9 +370,9 @@ DEFINE_SHOW_ATTRIBUTE(pinconf_groups); void pinconf_init_device_debugfs(struct dentry *devroot, struct pinctrl_dev *pctldev) { - debugfs_create_file("pinconf-pins", S_IFREG | S_IRUGO, + debugfs_create_file("pinconf-pins", 0444, devroot, pctldev, &pinconf_pins_fops); - debugfs_create_file("pinconf-groups", S_IFREG | S_IRUGO, + debugfs_create_file("pinconf-groups", 0444, devroot, pctldev, &pinconf_groups_fops); } diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index bab888fe3f8e..c651b2db0925 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c @@ -676,9 +676,9 @@ DEFINE_SHOW_ATTRIBUTE(pinmux_pins); void pinmux_init_device_debugfs(struct dentry *devroot, struct pinctrl_dev *pctldev) { - debugfs_create_file("pinmux-functions", S_IFREG | S_IRUGO, + debugfs_create_file("pinmux-functions", 0444, devroot, pctldev, &pinmux_functions_fops); - debugfs_create_file("pinmux-pins", S_IFREG | S_IRUGO, + debugfs_create_file("pinmux-pins", 0444, devroot, pctldev, &pinmux_pins_fops); } From patchwork Wed Feb 17 22:14:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 384613 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 4059EC433DB for ; Wed, 17 Feb 2021 22:16:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A28364E5F for ; Wed, 17 Feb 2021 22:16:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233390AbhBQWQj (ORCPT ); Wed, 17 Feb 2021 17:16:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233328AbhBQWQg (ORCPT ); Wed, 17 Feb 2021 17:16:36 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBC12C061793 for ; Wed, 17 Feb 2021 14:15:17 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id lw17so2102390pjb.0 for ; Wed, 17 Feb 2021 14:15:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beagleboard-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mYrs5q+oZ0V8NFKgrQvhQijPLQDbqQrnbdDwL86thTE=; b=v7itPVT/J8mcy/0YO0mjmXVgBZzDH0nevKAgtlM/qRxHJSQn89poN+TW42IJvBeaKS GK+lk5HR45pihNvKh1tmaQnt58AbBOfsj8PYqYlNWoSuggCj6qIdI9QycWQ+LyQEoGrw QpkcRXDPg5Iq2Ymc8iOTh5h59sNHVXO35khqgqxzzf4fLjZbeMLKSy7f8MF1vhMcsNjL ixROEJYs4/3Ua316RElrE1p1HnsdxjQHb48Egt2h9w0wHPB5jKijKw9fVHXje5UDJ4Yn IJAx9SBwAEScAH4jJ1ykrhKzzkJo6XlbJglc4kOMcszgD/GieKDuY9bzaEtfWgBjSfX9 FYJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mYrs5q+oZ0V8NFKgrQvhQijPLQDbqQrnbdDwL86thTE=; b=IJyDbE8jU+UOIcoSPJhW6neuo8lPKgvI7sVUrWfTPiKcf4lNtrnd2OAD1SIfAcmbt6 R1c/1YUDk23TKIRQDepufkQW8FSz3B51FuTLz82S+MyyEU78OJlVw/yaFEOmHxxh6LnD q6T7kkJYTBttBCehv5PyBHvfoUoNmSJJ5Sl1vRoPMbcfkb6TApqfyesOfLFCrNWuh3o5 gp2ThlOjL50837jVloJ2JyjOV7NodR4Qosi7NNXpy/yJOEvfUGKCurZiwT0CRalMrz1+ lMFZGNvTi+N43b2dp2J2yLo3+ARczS2rR7NdrZ30EY+lRZZ1j1DKhCUWSIXkYRN7C7mo akAQ== X-Gm-Message-State: AOAM5313sdLWYL2i/vxSRb0l4/VaehtUUjBOjgIAwMw/M5MzLHofI7kz Ixv2ktOpbDWpUPYauRZu0TdZSag3ObObe/e/ X-Google-Smtp-Source: ABdhPJy2/Tf3ok1xGYPk1DmYcXvIRcZR/fpzrZbZrSxVAJdxLDhAX8flR3kKxBH3+EH1+uJJD+ThVA== X-Received: by 2002:a17:90a:67ca:: with SMTP id g10mr957292pjm.28.1613600117391; Wed, 17 Feb 2021 14:15:17 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c0:4701:ae70:c31f:9bea:96ec:ef07]) by smtp.gmail.com with ESMTPSA id q43sm3142591pjq.25.2021.02.17.14.15.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 14:15:16 -0800 (PST) From: Drew Fustini To: Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Tony Lindgren , Andy Shevchenko , Alexandre Belloni , Geert Uytterhoeven , Pantelis Antoniou , Jason Kridner , Robert Nelson , Joe Perches , Dan Carpenter , Jonathan Corbet , linux-doc@vger.kernel.org Cc: Drew Fustini Subject: [PATCH v7 2/3] pinctrl: pinmux: Add pinmux-select debugfs file Date: Wed, 17 Feb 2021 14:14:57 -0800 Message-Id: <20210217221457.1827266-3-drew@beagleboard.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217221457.1827266-1-drew@beagleboard.org> References: <20210217221457.1827266-1-drew@beagleboard.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Add "pinmux-select" to debugfs which will activate a function and group: echo "" > pinmux-select The write operation pinmux_select() handles this by checking that the names map to valid selectors and then calling ops->set_mux(). The existing "pinmux-functions" debugfs file lists the pin functions registered for the pin controller. For example: function: pinmux-uart0, groups = [ pinmux-uart0-pins ] function: pinmux-mmc0, groups = [ pinmux-mmc0-pins ] function: pinmux-mmc1, groups = [ pinmux-mmc1-pins ] function: pinmux-i2c0, groups = [ pinmux-i2c0-pins ] function: pinmux-i2c1, groups = [ pinmux-i2c1-pins ] function: pinmux-spi1, groups = [ pinmux-spi1-pins ] To activate function pinmux-i2c1 and group pinmux-i2c1-pins: echo "pinmux-i2c1 pinmux-i2c1-pins" > pinmux-select Reviewed-by: Andy Shevchenko Reviewed-by: Tony Lindgren Signed-off-by: Drew Fustini Reviewed-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven --- drivers/pinctrl/pinmux.c | 102 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index c651b2db0925..39770af56562 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c @@ -12,6 +12,7 @@ */ #define pr_fmt(fmt) "pinmux core: " fmt +#include #include #include #include @@ -673,6 +674,105 @@ void pinmux_show_setting(struct seq_file *s, DEFINE_SHOW_ATTRIBUTE(pinmux_functions); DEFINE_SHOW_ATTRIBUTE(pinmux_pins); +#define PINMUX_SELECT_MAX 50 +static ssize_t pinmux_select(struct file *file, const char __user *user_buf, + size_t len, loff_t *ppos) +{ + struct seq_file *sfile = file->private_data; + struct pinctrl_dev *pctldev = sfile->private; + const struct pinmux_ops *pmxops = pctldev->desc->pmxops; + const char *const *groups; + char *buf, *fname, *gname; + unsigned int num_groups; + int fsel, gsel, ret; + + if (len > PINMUX_SELECT_MAX) + return -ENOMEM; + + buf = kzalloc(PINMUX_SELECT_MAX, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + ret = strncpy_from_user(buf, user_buf, PINMUX_SELECT_MAX); + if (ret < 0) + goto exit_free_buf; + buf[len-1] = '\0'; + + /* remove leading and trailing spaces of input buffer */ + fname = strstrip(buf); + if (*fname == '\0') { + ret = -EINVAL; + goto exit_free_buf; + } + + /* find a separator which is a spacelike character */ + for (gname = fname; !isspace(*gname); gname++) { + if (*gname == '\0') { + ret = -EINVAL; + goto exit_free_buf; + } + } + *gname = '\0'; + + /* drop extra spaces between function and group names */ + gname = skip_spaces(gname + 1); + if (*gname == '\0') { + ret = -EINVAL; + goto exit_free_buf; + } + + ret = pinmux_func_name_to_selector(pctldev, fname); + if (ret < 0) { + dev_err(pctldev->dev, "invalid function %s in map table\n", fname); + goto exit_free_buf; + } + fsel = ret; + + ret = pmxops->get_function_groups(pctldev, fsel, &groups, &num_groups); + if (ret) { + dev_err(pctldev->dev, "no groups for function %d (%s)", fsel, fname); + goto exit_free_buf; + } + + ret = match_string(groups, num_groups, gname); + if (ret < 0) { + dev_err(pctldev->dev, "invalid group %s", gname); + goto exit_free_buf; + } + + ret = pinctrl_get_group_selector(pctldev, gname); + if (ret < 0) { + dev_err(pctldev->dev, "failed to get group selector for %s", gname); + goto exit_free_buf; + } + gsel = ret; + + ret = pmxops->set_mux(pctldev, fsel, gsel); + if (ret) { + dev_err(pctldev->dev, "set_mux() failed: %d", ret); + goto exit_free_buf; + } + ret = len; + +exit_free_buf: + kfree(buf); + + return ret; +} + +static int pinmux_select_open(struct inode *inode, struct file *file) +{ + return single_open(file, NULL, inode->i_private); +} + +static const struct file_operations pinmux_select_ops = { + .owner = THIS_MODULE, + .open = pinmux_select_open, + .write = pinmux_select, + .llseek = no_llseek, + .release = single_release, +}; + void pinmux_init_device_debugfs(struct dentry *devroot, struct pinctrl_dev *pctldev) { @@ -680,6 +780,8 @@ void pinmux_init_device_debugfs(struct dentry *devroot, devroot, pctldev, &pinmux_functions_fops); debugfs_create_file("pinmux-pins", 0444, devroot, pctldev, &pinmux_pins_fops); + debugfs_create_file("pinmux-select", 0200, + devroot, pctldev, &pinmux_select_ops); } #endif /* CONFIG_DEBUG_FS */ From patchwork Wed Feb 17 22:14:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Drew Fustini X-Patchwork-Id: 384089 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=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 EEB0BC43381 for ; Wed, 17 Feb 2021 22:16:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BCCDF64E5F for ; Wed, 17 Feb 2021 22:16:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233398AbhBQWQk (ORCPT ); Wed, 17 Feb 2021 17:16:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233389AbhBQWQi (ORCPT ); Wed, 17 Feb 2021 17:16:38 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C774C0617A7 for ; Wed, 17 Feb 2021 14:15:19 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id z9so137848pjl.5 for ; Wed, 17 Feb 2021 14:15:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beagleboard-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y9rWQpGXIz66daXxWsY1gOWjvlN/z304wIufJTlMDGo=; b=KxHon1W8x3c1Lf5e3+SIMFIcGK+3MYlyYBNOs1EzakzAbVFcOgAV5T3A/GQBBEPNxC Won0BbFPxtwnDFkP1UoxPsTL0sK7uaqqo+bmvNsjyEireyD22g6THwD7ERhjlNs+ALb4 G77Z21EVUT2GFaXXWI3yDY2FDU9gky60rC2cMyPpc9HmsdzDaE0gEgNRlLe2+5LxrOHX bLMq8+G+B4cqtz6Wrf7ecyHKBjCrehDo26vSBYvIBGRQuUK/0cGYEE08en+/Df0HoH4y ANJS1myo0PyvHEbb4WQX7DhYRnO+Pe0FHz3HTpFV7gQVW1GbTO7QqqhL2bTFHhbuBfgp OV8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y9rWQpGXIz66daXxWsY1gOWjvlN/z304wIufJTlMDGo=; b=BJiZrMNkNiucdsP/TixfxzMiU3ESJFs4nsaa4LUjrElcQ40SfVWLXEO+en9KoStUiw vja3B/lnphSE0I8cGaLw/CKL04gyB6ywE2oyWIovD07caCHADgtxwi2XXWJVAEAIY1F2 Sj05rs7kwuddv8XHycC21IJvdLFM/x5CfMZCrMq2y2MgdwwPZKXj5wQ3krgIPif65mCJ xyowl8aaMA975m5QEyxZhxqlwIS0HmBb8zVcrkvwDLaZoJbEXI2r5atrZ0jUW5BoaZqg E0pATbFKgqcTu/6ju7TgO74p61CMKH7ygee0v9d8AxvoR22AAIS2/Do/NQbqqGh4UX5U pqoQ== X-Gm-Message-State: AOAM532XeVswla+Qwql9euMfFGNtshtArPEfxuZNKa3nCDtLW3zuCBYE mdrfHjilRjNZSZUECulOo2BsrA== X-Google-Smtp-Source: ABdhPJx7a2TKoUOvKWFwYDqvHzZTQEJxsPaU8z/ZcnkpVNh44lma3zVa8OXhOGi1PvaG0JWX7SVdtw== X-Received: by 2002:a17:90b:618:: with SMTP id gb24mr874830pjb.163.1613600118771; Wed, 17 Feb 2021 14:15:18 -0800 (PST) Received: from x1.hsd1.or.comcast.net ([2601:1c0:4701:ae70:c31f:9bea:96ec:ef07]) by smtp.gmail.com with ESMTPSA id q43sm3142591pjq.25.2021.02.17.14.15.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 14:15:18 -0800 (PST) From: Drew Fustini To: Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Tony Lindgren , Andy Shevchenko , Alexandre Belloni , Geert Uytterhoeven , Pantelis Antoniou , Jason Kridner , Robert Nelson , Joe Perches , Dan Carpenter , Jonathan Corbet , linux-doc@vger.kernel.org Cc: Drew Fustini Subject: [PATCH v7 3/3] docs/pinctrl: document debugfs files Date: Wed, 17 Feb 2021 14:14:58 -0800 Message-Id: <20210217221457.1827266-4-drew@beagleboard.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217221457.1827266-1-drew@beagleboard.org> References: <20210217221457.1827266-1-drew@beagleboard.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Document debugfs directories and files created for pinctrl subsystem. Suggested-by: Andy Shevchenko Reviewed-by: Andy Shevchenko Reviewed-by: Tony Lindgren Signed-off-by: Drew Fustini --- Documentation/driver-api/pinctl.rst | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Documentation/driver-api/pinctl.rst b/Documentation/driver-api/pinctl.rst index 3d2deaf48841..37bc3bd64cd8 100644 --- a/Documentation/driver-api/pinctl.rst +++ b/Documentation/driver-api/pinctl.rst @@ -1428,3 +1428,40 @@ on the pins defined by group B:: The above has to be done from process context. The reservation of the pins will be done when the state is activated, so in effect one specific pin can be used by different functions at different times on a running system. + + +Debugfs files +============= +These files are created in ``/sys/kernel/debug/pinctrl``: + +- ``pinctrl-devices``: prints each pin controller device along with columns to + indicate support for pinmux and pinconf + +- ``pinctrl-handles``: iterate through the list of pin controller handles and + print the corresponding pinmux maps + +- ``pinctrl-maps``: print all pinctrl maps + +A sub-directory is created inside of ``/sys/kernel/debug/pinctrl`` for each pin +controller device containing these files: + +- ``pins``: prints a line for each pin registered on the pin controller. The + pinctrl driver may add additional information such as register contents. + +- ``gpio-ranges``: print ranges that map gpio lines to pins on the controller + +- ``pingroups``: print all pin groups registered on the pin controller + +- ``pinconf-pins``: print pin config settings for each pin + +- ``pinconf-groups``: print pin config settings per pin group + +- ``pinmux-functions``: print each pin function along with the pin groups that + map to the pin function + +- ``pinmux-pins``: iterate through all pins and print mux owner, gpio owner + and if the pin is a hog + +- ``pinmux-select``: write to this file to activate a pin function and group:: + + echo "" > pinmux-select