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: 10310133 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 75710600F6 for ; Tue, 27 Mar 2018 13:58:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66E5226AE3 for ; Tue, 27 Mar 2018 13:58:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B4BE29789; Tue, 27 Mar 2018 13:58:20 +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 DEABD26AE3 for ; Tue, 27 Mar 2018 13:58:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752691AbeC0N6R (ORCPT ); Tue, 27 Mar 2018 09:58:17 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:33566 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752665AbeC0N6O (ORCPT ); Tue, 27 Mar 2018 09:58:14 -0400 Received: by mail-pl0-f65.google.com with SMTP id c11-v6so14125521plo.0; 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=KHGhPdO4MgwP4w5QrESNQkWHCnvuoe3ajVlgmVpZz/EWvemFxZMvUra1QGBaAgQisl dQDcUEwhCBnIT8ZGuq/q8wnrn0C6s5M1Sid4bkNXiKldDZJI9JT0iMF7O8pB73n3lcTq sOo94s9igVWXe1Zz9p5SFXMEmeno884YNQfPA1oIRiLvpJktDSFJMliEhQN/Owljhq6y XuwaYfMZLUmp0Ie91FlnLF2AZ+3h7O191Jw93U3zP/GMuBSkP5UpcOKakBoKeqrFhucp NQ7AmJT/LPCYjqtGAbE3FWABf5MNSGEcwKLltrkm1Btjm8tuLsyV/Lua2gceRC9ug+H7 yKRA== X-Gm-Message-State: AElRT7Gll0hY4gOvfEUTaSnb3UN/KLc/mz5ylBVcznsmxPyemalw6Hm6 fZ5yvEI66B9Q9h7FDnomUdg= 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 Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org, Chanho Park 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 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 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 */