From patchwork Mon Mar 26 15:27:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanho Park X-Patchwork-Id: 10308105 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 F06D6600F6 for ; Mon, 26 Mar 2018 15:27:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFCF0294FC for ; Mon, 26 Mar 2018 15:27:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D29C1295B4; Mon, 26 Mar 2018 15:27:30 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F8F0294FC for ; Mon, 26 Mar 2018 15:27:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752066AbeCZP13 (ORCPT ); Mon, 26 Mar 2018 11:27:29 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:46353 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751865AbeCZP12 (ORCPT ); Mon, 26 Mar 2018 11:27:28 -0400 Received: by mail-pl0-f65.google.com with SMTP id f5-v6so12132950plj.13; Mon, 26 Mar 2018 08:27:28 -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=9a3D2irkxwADL5VkhycEeF6UO4HibE3RonCFnGl6wS4=; b=WAmOXVHhQgLnyB0rOuGhdwnU0kowTYjxjzKzsvADr3l2Pcv7+BIZl/8aXt/6tzkube Gzk+FljSBoXoxQiNrBCJ22qdpdMSJcHLUuq/0h8M2yLOEjPNMC58xlZUMBVz4Z4F/xuC H3DJmmnMjX3WxIsZDBcANRPg+BzcHvurkmSV10dqk/mSy+ArXVlegcJHNkXeuaCDiwAO 5MTifPQSytvFlr1+MO5tG7fckeHRxsmnf+LLkB5tmeF0xqdeWFeSpEuL0s5G6yrUyV5q 8CesI7Vd791DHqm8ld4eMY5xtqRCaGSbPumfiwbTfAgsmoB+po1k+nBocDYbK5CnCHMM f6pw== 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=9a3D2irkxwADL5VkhycEeF6UO4HibE3RonCFnGl6wS4=; b=q8ZwxBWbOdSDf/k/tWBDjOga3WTFxsdiqva4L+Xoj797BEPfZ/7ZfWLcbqM4tVU7mX X3UUqC2GLyOiKBhtMANdxL1rFZ7rpWrbL1AyLUcBVvlvUj4uaj5GIZdw3A9sv0+Hf2hz GVPHdv+liInOueDZjw40b2JKrfO5eH1idt4OxARmMil1yJ239iIMB1BpY2LeqJ1CIByt Pz4qpopbzG10yB/7OTelg8wActaufMpfBB24ANo7lnZMNycXc4jcoYr0BqRgvcCzPIV+ MfXm5eDM0lg7o5YbYKzi81BuRuEcMlxNJ8mnnjAKbItZv2aysQf3hNldgB3Y8DPYE9QR FG/A== X-Gm-Message-State: AElRT7HB+hEtZyI7ptK/AUIHLnA/DAl0aOuce1UEbhfdYY0MPU22mAJi wU+59D4MxVyxeLE12oH9wKM= X-Google-Smtp-Source: AG47ELtChRNjHmOSuQ+5m3aA/Q4TNVu4LyOrjXZWwayuSy1nee9k1dr67O1C+eZROMv6EzF5so3tow== X-Received: by 2002:a17:902:b786:: with SMTP id e6-v6mr41900400pls.58.1522078048146; Mon, 26 Mar 2018 08:27:28 -0700 (PDT) Received: from localhost.localdomain ([211.51.114.54]) by smtp.gmail.com with ESMTPSA id c18sm30894078pfd.100.2018.03.26.08.27.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 08:27:27 -0700 (PDT) From: Chanho Park To: Tomasz Figa , Krzysztof Kozlowski , Sylwester Nawrocki , Linus Walleij Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org, Chanho Park Subject: [PATCH] pinctrl: samsung: add pin_dbg_show callback for debugfs Date: Tue, 27 Mar 2018 00:27:11 +0900 Message-Id: <20180326152711.7780-1-parkch98@gmail.com> X-Mailer: git-send-email 2.14.1 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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 --- drivers/pinctrl/samsung/pinctrl-samsung.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c index 336e88d7bdb9..bdec0cbd64f1 100644 --- a/drivers/pinctrl/samsung/pinctrl-samsung.c +++ b/drivers/pinctrl/samsung/pinctrl-samsung.c @@ -279,6 +279,30 @@ 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_rw(struct pinctrl_dev *pctldev, unsigned int pin, + unsigned long *config, bool set); +static char *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_rw(pctldev, pin, &config, false); + if (ret == -EINVAL) + 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 +310,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 */