From patchwork Tue Sep 30 13:06:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 38142 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8B0D92032C for ; Tue, 30 Sep 2014 13:07:09 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id k14sf7878945wgh.7 for ; Tue, 30 Sep 2014 06:07:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=A4Sqjbb/lO1Bme/xWOQgql9rezIEEl/4TwvnRF4Py+c=; b=bxJ7hG/ThVvzjvfDAf4j9s9Usl9RSsjL9l//BGUztnXc4bb5SCNhvq1Ta5ZhVVsG1o PF4vu4GOc6cyuyIADFvjWPu3mb0T/EdmUAt1+j1h0NOkjw9rbhLRj4SwPgDNqimfRmFe F2GwyF/NeRbqCnZYh/1AiGkQsPOD6KdAxJglG/PkRIGiGaNY1JN7fjLosOT/+LjgBuq0 1gR0Yyfx1GKqANigjsh6jag47W39c5BPP0fFeRw1CABqREmVoYnSmBCs6MB5XDFR4Fq2 UfycRla2V4hyuLBgy2wAVOxuq8zGomrVM7w2U4gecOxut7qI7Qq0ygt9Wfrp5blUoSDe ZFYA== X-Gm-Message-State: ALoCoQlyv6/YD+pcyds238+abMKSQc7qGiwtTTj7SL8m5xwb4QN1OefTEOkFggjbLduCxKICZwWd X-Received: by 10.112.184.197 with SMTP id ew5mr6929291lbc.0.1412082428738; Tue, 30 Sep 2014 06:07:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.132 with SMTP id c4ls34943lac.88.gmail; Tue, 30 Sep 2014 06:07:08 -0700 (PDT) X-Received: by 10.152.45.8 with SMTP id i8mr47456365lam.31.1412082428059; Tue, 30 Sep 2014 06:07:08 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id c2si22724524lae.48.2014.09.30.06.07.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Sep 2014 06:07:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id s18so4637799lam.9 for ; Tue, 30 Sep 2014 06:07:07 -0700 (PDT) X-Received: by 10.112.134.229 with SMTP id pn5mr18604363lbb.22.1412082427111; Tue, 30 Sep 2014 06:07:07 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp341886lbb; Tue, 30 Sep 2014 06:07:06 -0700 (PDT) X-Received: by 10.68.105.197 with SMTP id go5mr69582189pbb.73.1412082425563; Tue, 30 Sep 2014 06:07:05 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kj6si9097918pdb.233.2014.09.30.06.07.04 for ; Tue, 30 Sep 2014 06:07:05 -0700 (PDT) Received-SPF: none (google.com: linux-gpio-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751064AbaI3NHE (ORCPT ); Tue, 30 Sep 2014 09:07:04 -0400 Received: from mail-wg0-f43.google.com ([74.125.82.43]:53985 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750836AbaI3NHD (ORCPT ); Tue, 30 Sep 2014 09:07:03 -0400 Received: by mail-wg0-f43.google.com with SMTP id a1so3663289wgh.14 for ; Tue, 30 Sep 2014 06:07:01 -0700 (PDT) X-Received: by 10.180.19.193 with SMTP id h1mr5735971wie.14.1412082421450; Tue, 30 Sep 2014 06:07:01 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id c7sm15124511wib.12.2014.09.30.06.06.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Sep 2014 06:07:00 -0700 (PDT) From: Linus Walleij To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: linux-gpio@vger.kernel.org, Linus Walleij Subject: [PATCH] pinctrl: nomadik: improve GPIO debug prints Date: Tue, 30 Sep 2014 15:06:57 +0200 Message-Id: <1412082417-10178-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-gpio@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The debugfs file would only define if the line was "pulled" and not which direction (pull up or pull down). Improve this by taking two print paths depending on whether the pin is set as input or output and use the data register directly to figure out whether the pin is set for pull up or pull down. Signed-off-by: Linus Walleij --- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 36 +++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c index c4d9c5daa21b..3b7c733de489 100644 --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c @@ -986,6 +986,7 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s, container_of(chip, struct nmk_gpio_chip, chip); int mode; bool is_out; + bool data_out; bool pull; u32 bit = 1 << offset; const char *modes[] = { @@ -998,28 +999,41 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s, [NMK_GPIO_ALT_C+3] = "altC3", [NMK_GPIO_ALT_C+4] = "altC4", }; + const char *pulls[] = { + "none ", + "pull down", + "pull up ", + }; clk_enable(nmk_chip->clk); is_out = !!(readl(nmk_chip->addr + NMK_GPIO_DIR) & bit); pull = !(readl(nmk_chip->addr + NMK_GPIO_PDIS) & bit); + data_out = !!(readl(nmk_chip->addr + NMK_GPIO_DAT) & bit); mode = nmk_gpio_get_mode(gpio); if ((mode == NMK_GPIO_ALT_C) && pctldev) mode = nmk_prcm_gpiocr_get_mode(pctldev, gpio); - seq_printf(s, " gpio-%-3d (%-20.20s) %s %s %s %s", - gpio, label ?: "(none)", - is_out ? "out" : "in ", - chip->get - ? (chip->get(chip, offset) ? "hi" : "lo") - : "? ", - (mode < 0) ? "unknown" : modes[mode], - pull ? "pull" : "none"); - - if (!is_out) { + if (is_out) { + seq_printf(s, " gpio-%-3d (%-20.20s) out %s %s", + gpio, + label ?: "(none)", + data_out ? "hi" : "lo", + (mode < 0) ? "unknown" : modes[mode]); + } else { int irq = gpio_to_irq(gpio); struct irq_desc *desc = irq_to_desc(irq); + int pullidx = 0; - /* This races with request_irq(), set_irq_type(), + if (pull) + pullidx = data_out ? 1 : 2; + + seq_printf(s, " gpio-%-3d (%-20.20s) in %s %s", + gpio, + label ?: "(none)", + pulls[pullidx], + (mode < 0) ? "unknown" : modes[mode]); + /* + * This races with request_irq(), set_irq_type(), * and set_irq_wake() ... but those are "rare". */ if (irq > 0 && desc && desc->action) {