From patchwork Tue Mar 27 13:58:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 10310139 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1DABD60353 for ; Tue, 27 Mar 2018 13:58:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B26029B8E for ; Tue, 27 Mar 2018 13:58:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1634299ED; Tue, 27 Mar 2018 13:58:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6FE4726AE3 for ; Tue, 27 Mar 2018 13:58:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=vFQtrsKFVuAA//yCcAf2GHk/5qANDVRl9KMaa/xxfgI=; b=t4W mVOPPLbNMmCwUhI5gy+XentkMuhni4UTF6WxA/PCqtDBOre8X0azHt5Q1m96X6gZO5GfNCdl24Qw/ GuP2PlzCewV+oAFrCA3hA+QvxkQBsgtQlBSoyxCXL6HhP8bCrEKh+cV79JX5DPbH/+wsEi4+G74Ox CdMaSEKobndHV1EaOmSscZUi+JFFteat50ApVxMP6TMoMTwJbu342F+vF001DOlxujlMbXclV4fKW k0HWR9Rx7WWKGbsCWAjoA84eJnbBmeUIOqsITu4lAT0PWGJsSXgww/bjJgF8L3/b0jFqo5L+oNEgV oG9CHSTsGtOfw1pibtkRz/Gm2w8eQXg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f0p7L-00047e-5T; Tue, 27 Mar 2018 13:58:27 +0000 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f0p7I-00045z-Fu for linux-arm-kernel@lists.infradead.org; Tue, 27 Mar 2018 13:58:25 +0000 Received: by mail-pl0-x244.google.com with SMTP id f23-v6so14124104plr.10 for ; Tue, 27 Mar 2018 06:58:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=HXbG/Jnci9yfJVKZBo7Qk3qYOx7P6XKZbt0+QIMXITI=; b=sNi8cKMc0byOXtUNk2ay/H5HQZfZfE4d61TVyIvZvUJq45yzv9WIA45iAbwrpXv3aK f2x/NiuOrQ2SN5JUaIFOYzECmJM/ORy+RaMfklTCpO8QMTcgB1qG5acusf3jzDh+BHIu 4zJavs04Q13wtHU6zod5QS/d6hQ9FPLpuwWPKntu7PJ+1MITvj03/d8TutCXsR9+Gq/c iSJd484cph/d31QSF2wdsdEUEMSZ20WRkp/XK9D+DSRHq3MuuOn+9zYqLE+mcamEdDyn Sm5u8cO2lTljDRGdOvEmXZ4+k/N5Ecg6Spji6gy1qQOMgBUy+CB0t6TjR1LwkbSDB5Tw 97eg== 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; bh=HXbG/Jnci9yfJVKZBo7Qk3qYOx7P6XKZbt0+QIMXITI=; b=cld0Kmxrj2l4qmzdDFw+04yK32JcW85D41R+O0dRSpj7LrFzp9p8ctPc10cvklZ1MN F5et6c3lAvleJyiiBielz652kPfj+T5yJ+6aclp5NbRLBTssoB9rPxwv3OFnCcqBe6HM AlcnL12XnG70JNfw6f+uz0EWG011H6OunorFiGHyIwoPYgfDxABSdqWhgUwUaxO1DEmZ eBTf3am/7tLVENvhDXrUvr5TmBAxQMbtNmqSj69PMR/s2/dsAEdbavVpUdMGYrznkjoQ wX4q4CzdC7kf7QghfsbTurXjMHTvSS7sVVngttT4NqZKJj5ny82nqrAg/0gj+u+vGmln SHOQ== X-Gm-Message-State: AElRT7G02NfL5LsAx2ZbmHS6rjKbDpIjUflR9fpnWhVhRK8tr/w39sA/ HFc1ubKo/3DC2kx7nnkkIFk= X-Google-Smtp-Source: AG47ELsGhlm9dya+rPIosGh0O7pXmv7vj4VZ9LYiCdDEbpwsfdvqBBBdeiRgYMv6PvYRTm0c+FOITA== X-Received: by 2002:a17:902:59c9:: with SMTP id d9-v6mr45828055plj.251.1522159093922; Tue, 27 Mar 2018 06:58:13 -0700 (PDT) Received: from localhost.localdomain ([211.51.114.54]) by smtp.gmail.com with ESMTPSA id k2sm3366208pfb.123.2018.03.27.06.58.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Mar 2018 06:58:12 -0700 (PDT) From: Chanho Park To: Tomasz Figa , Krzysztof Kozlowski , Sylwester Nawrocki , Linus Walleij Subject: [PATCHv2] pinctrl: samsung: add pin_dbg_show callback for debugfs Date: Tue, 27 Mar 2018 22:58:01 +0900 Message-Id: <20180327135801.9556-1-parkch98@gmail.com> X-Mailer: git-send-email 2.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180327_065824_529802_304CF634 X-CRM114-Status: GOOD ( 15.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-gpio@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Chanho Park MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a samsung_pin_dbg_show function to implement the pin_dbg_show callback function which can be used to show pin confuration values. Basically, it can show pin setting values by accessing the "pins" node like below: $ cat pins pin 0 (gpy7-0) CON(0x0) DAT(0x1) PUD(0x1) DRV(0x0) CON_PDN(0x0) PUD_PDN(0x0) Signed-off-by: Chanho Park Reviewed-by: Krzysztof Kozlowski Tested-by: Sylwester Nawrocki --- Changes from v1: - use samsung_pinconf_get instead of samsung_pinconf_rw - use "static const char * const" type declaration of reg_names - skip condition change drivers/pinctrl/samsung/pinctrl-samsung.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index 336e88d7bdb9..618945a0fd38 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -279,6 +279,32 @@ static int samsung_dt_node_to_map(struct pinctrl_dev *pctldev, return 0; } +#ifdef CONFIG_DEBUG_FS +/* Forward declaration which can be used by samsung_pin_dbg_show */ +static int samsung_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin, + unsigned long *config); +static const char * const reg_names[] = {"CON", "DAT", "PUD", "DRV", "CON_PDN", + "PUD_PDN"}; + +static void samsung_pin_dbg_show(struct pinctrl_dev *pctldev, + struct seq_file *s, unsigned int pin) +{ + enum pincfg_type cfg_type; + unsigned long config; + int ret; + + for (cfg_type = 0; cfg_type < PINCFG_TYPE_NUM; cfg_type++) { + config = PINCFG_PACK(cfg_type, 0); + ret = samsung_pinconf_get(pctldev, pin, &config); + if (ret < 0) + continue; + + seq_printf(s, " %s(0x%lx)", reg_names[cfg_type], + PINCFG_UNPACK_VALUE(config)); + } +} +#endif + /* list of pinctrl callbacks for the pinctrl core */ static const struct pinctrl_ops samsung_pctrl_ops = { .get_groups_count = samsung_get_group_count, @@ -286,6 +312,9 @@ static const struct pinctrl_ops samsung_pctrl_ops = { .get_group_pins = samsung_get_group_pins, .dt_node_to_map = samsung_dt_node_to_map, .dt_free_map = samsung_dt_free_map, +#ifdef CONFIG_DEBUG_FS + .pin_dbg_show = samsung_pin_dbg_show, +#endif }; /* check if the selector is a valid pin function selector */