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: 10308107 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 CF4E5600F6 for ; Mon, 26 Mar 2018 15:27:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC8632624A for ; Mon, 26 Mar 2018 15:27:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B10FC266F3; Mon, 26 Mar 2018 15:27:53 +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 5E9BC2624A for ; Mon, 26 Mar 2018 15:27:53 +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=BI8AZYBaSxSCdRfZ/kgAtPToGsOqSqPnkvP7Rk5mpSk=; b=GcX givvYEM6kZpsHbINvWMRkcWRKCJn2ts2HuynGn8VaJe5dYRjdGR6+dBmlxUe6sd528IJ55IfRA6cA QjuyHN2NXyvSPnpIg8wCoiqESmSfTJFHfOrx+oL2npDo/1pQw/ZzCgrV2BxYnQWwjsaQ6HVa3holR cJumI82wCanemb+rxxD9btQgNcQEg92eaem/3vNyj47gYeMqM3PXMReqAB406eI9y3VxRs+ZpuulE 0EWphWtoQkgwzovfjN3U7iePuo7BY6KUR62q/+pUW46HbLI+n81Zeck/4Tc8JcfXYRkBCYuD7lVM/ jhif055LP17PPlrPk3cWzf1vaR2pPbg==; 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 1f0U2H-00022H-Ct; Mon, 26 Mar 2018 15:27:49 +0000 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f0U28-0001nx-0y for linux-arm-kernel@lists.infradead.org; Mon, 26 Mar 2018 15:27:41 +0000 Received: by mail-pl0-x241.google.com with SMTP id n15-v6so12137359plp.12 for ; 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=cA4RrH8XkmS/AiNTKFVeMsL/bvIEaWFUZz3yuPaLz+JGG75UNvpoLxi6QoKnJgdlfA og+l2SHWCvhF1/ih3SvztB1/0U+B8gpWMY7bMdfpNCNCtowlKrVewy14yo5QJU1dwnFB Rn3lMkkG49iaqKrkKG566MqSgo8UzqcOGUd3N390AHGA/I4TPPaJAK3CruzCuW0Wh1Iv iaaFtZq++U5KqL1nxVjJztJZVnkD6xDYTRLDPA17gJ1GB/RqGYlmGB/P9kWyfeNamXzY Uz18Iap6yvyWeZ/o6SucnXJ+6YRU1QFUYS7uz584BZFvFoqPZMwp1Z5j1nwq+YHsvW8P fjfg== X-Gm-Message-State: AElRT7FJu7I0uD5qzOItkXkhHMnjXF9hTsOyWc021uEsygJGWjUOwQGn VpB51YynGHuR3qK3pPuAkiU= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180326_082740_370776_61018622 X-CRM114-Status: GOOD ( 14.48 ) 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 --- 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 */