From patchwork Wed Mar 18 10:51:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 451369 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7D2E514009B for ; Wed, 18 Mar 2015 21:52:50 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755664AbbCRKwg (ORCPT ); Wed, 18 Mar 2015 06:52:36 -0400 Received: from mail-wg0-f42.google.com ([74.125.82.42]:34845 "EHLO mail-wg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756019AbbCRKwA (ORCPT ); Wed, 18 Mar 2015 06:52:00 -0400 Received: by wgdm6 with SMTP id m6so31672949wgd.2 for ; Wed, 18 Mar 2015 03:51:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gN3up9WVQG1bgYMWBHuNpGpBJrAFPjZHE8aFGhNpzec=; b=e5NFhatG7Lp4q4aCGmkbhrozvjuxGoY720IflOKGfTjt6gLqHTd/l0ojErWhguJAEn fspRty38cP6wj6gSLTVG1KZNF3edfT2ePER+8xole7cBFVxUZX3LuQZ4qVnaKwDpjdny yRe34z/43APX/+dQYuXEeZUQPL9cYAY68CYBULmA2O/pAkH2ft0rfbHK7oczhTIuHPWv jPhzSGjrQs/fb69K5K6gE49LO8Ep0b5+mfBLxh/CKRekNSRwovEcgkEPHz2AmKF3+AWh Z47G64dZsqwSxlUyF4e2/1+8rgm/DVoMOL03hfNXeQx4+yY4OnsWJ6cbdGVdp22uKEHa pR7A== X-Gm-Message-State: ALoCoQk09OHbiO6F/vKl7VQeaIIFKSZNNZOLo7rjwd6oa8DxwUp8QkGkaB15HmGvCAsqanq0zf/q X-Received: by 10.194.21.193 with SMTP id x1mr138809678wje.144.1426675918702; Wed, 18 Mar 2015 03:51:58 -0700 (PDT) Received: from localhost.localdomain ([81.134.86.251]) by mx.google.com with ESMTPSA id gz3sm2665532wib.1.2015.03.18.03.51.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Mar 2015 03:51:57 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linus.walleij@linaro.org, linux-gpio@vger.kernel.org Cc: lee.jones@linaro.org, kernel@stlinux.com Subject: [PATCH 6/6] pinctrl: st: Display pin's function when printing pinctrl debug information Date: Wed, 18 Mar 2015 10:51:39 +0000 Message-Id: <1426675899-19882-7-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426675899-19882-1-git-send-email-lee.jones@linaro.org> References: <1426675899-19882-1-git-send-email-lee.jones@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Great for easily determining which mode a pin is operating in. This patch was particularly helpful when debugging a recent GPIO/ Pinctrl disparity issue. Before: $ cat /sys/kernel/debug/pinctrl//pinconf-pins pin 33 (PIO4[1]):[OE:0,PU:0,OD:0] [retime:0,invclk:0,clknotdat:0,de:0,rt-clk:0,rt-delay:0] After [GPIO]: $ cat /sys/kernel/debug/pinctrl//pinconf-pins pin 33 (PIO4[1]):[OE:0,PU:0,OD:0] GPIO [retime:0,invclk:0,clknotdat:0,de:0,rt-clk:0,rt-delay:0] After [Alt]: $ cat /sys/kernel/debug/pinctrl//pinconf-pins pin 33 (PIO4[1]):[OE:0,PU:0,OD:0] Alt Fn 2 [retime:0,invclk:0,clknotdat:0,de:0,rt-clk:0,rt-delay:0] Signed-off-by: Lee Jones Acked-by: Maxime Coquelin --- drivers/pinctrl/pinctrl-st.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 1cda40e..d5b2ffa 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c @@ -1058,18 +1058,28 @@ static void st_pinconf_dbg_show(struct pinctrl_dev *pctldev, { struct st_pio_control *pc; unsigned long config; + unsigned int function; int offset = st_gpio_pin(pin_id); + char f[64]; mutex_unlock(&pctldev->mutex); pc = st_get_pio_control(pctldev, pin_id); st_pinconf_get(pctldev, pin_id, &config); mutex_lock(&pctldev->mutex); - seq_printf(s, "[OE:%ld,PU:%ld,OD:%ld]\n" + + function = st_pctl_get_pin_function(pc, offset); + if (function) + sprintf(f, "Alt Fn %d", function); + else + sprintf(f, "GPIO"); + + seq_printf(s, "[OE:%d,PU:%ld,OD:%ld]\t%s\n" "\t\t[retime:%ld,invclk:%ld,clknotdat:%ld," "de:%ld,rt-clk:%ld,rt-delay:%ld]", !st_gpio_get_direction(&pc_to_bank(pc)->gpio_chip, offset), ST_PINCONF_UNPACK_PU(config), ST_PINCONF_UNPACK_OD(config), + f, ST_PINCONF_UNPACK_RT(config), ST_PINCONF_UNPACK_RT_INVERTCLK(config), ST_PINCONF_UNPACK_RT_CLKNOTDATA(config),