From patchwork Tue May 8 09:44:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 8447 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id ED62323E20 for ; Tue, 8 May 2012 09:45:10 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id BC935A18370 for ; Tue, 8 May 2012 09:45:10 +0000 (UTC) Received: by yhpp61 with SMTP id p61so1224073yhp.11 for ; Tue, 08 May 2012 02:45:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=yhdaGNUGOJClaeFXd6T0s9/ZrZEya9OLnMqdGGnO60A=; b=CVsFoQCcVkQds2C5kE+bTwYOWdSkdeJGG2/BaLo/17exQ5xMFI/aCpXMrn9scS9Puy /Twkylnnb3Ek4UO+OKKYX/2+OZDudXSVmnQsPzNZTKYsqLaRFaL4T1zc8OQb81WFwMzL bXOe33LDcT3ggDS9Hd3Z6JgvRAhBRNq65/1Y0xLuUijxHhorlfVfnFJnf6BQDIPk3C0Y WF3/QQRvGHKuJ568rZNqDGNucO98PHEbnSbKfmda7nEZhM9SbDRAb34D9mZzFWA4TRuD 1Ea38qr+GijTLDyptlv8NHpbj7IBc+gvqBt70v/CzfDgAYwh4InHggG905bzq2KvU2nx SzsA== Received: by 10.42.122.76 with SMTP id m12mr1533323icr.38.1336470310179; Tue, 08 May 2012 02:45:10 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.73.147 with SMTP id q19csp187487ibj; Tue, 8 May 2012 02:45:09 -0700 (PDT) Received: by 10.213.33.193 with SMTP id i1mr1561224ebd.45.1336470308991; Tue, 08 May 2012 02:45:08 -0700 (PDT) Received: from eu1sys200aog112.obsmtp.com (eu1sys200aog112.obsmtp.com. [207.126.144.133]) by mx.google.com with SMTP id q51si5982577eef.26.2012.05.08.02.44.56 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 May 2012 02:45:08 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.133 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.133; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.133 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob112.postini.com ([207.126.147.11]) with SMTP ID DSNKT6jrFny3VGZ3IKchBKgnKQqwCzzd0Bsj@postini.com; Tue, 08 May 2012 09:45:08 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id C3AB6D6; Tue, 8 May 2012 09:36:29 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 4538223A; Tue, 8 May 2012 09:44:50 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id ED8F624C2E7; Tue, 8 May 2012 11:44:43 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 8 May 2012 11:44:49 +0200 From: Linus Walleij To: , Cc: Stephen Warren , Shawn Guo , Thomas Abraham , Dong Aisheng , Rajendra Nayak , Haojian Zhuang , Linus Walleij Subject: [PATCH 04/12] pinctrl/nomadik: reuse GPIO debug function for pins Date: Tue, 8 May 2012 11:44:46 +0200 Message-ID: <1336470286-23589-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.9.2 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQm0NWTDVl9YoZH3TphJ9Vwl20SAwIpCUYHaxTigS0bVFSXvyFasi+EQzGoXodqLm0tA/gSL From: Linus Walleij Since all pins we can control are GPIOs, match a GPIO range to each pin in the debug function and call into the GPIO debug print function to have the per-pin information. Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-nomadik.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index d9e41c9..750703f 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c @@ -1332,10 +1332,36 @@ static int nmk_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector, return 0; } +static struct pinctrl_gpio_range * +nmk_match_gpio_range(struct pinctrl_dev *pctldev, unsigned offset) +{ + struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); + int i; + + for (i = 0; i < npct->soc->gpio_num_ranges; i++) { + struct pinctrl_gpio_range *range; + + range = &npct->soc->gpio_ranges[i]; + if (offset >= range->pin_base && + offset <= (range->pin_base + range->npins - 1)) + return range; + } + return NULL; +} + static void nmk_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, unsigned offset) { - seq_printf(s, " Nomadik GPIO"); + struct pinctrl_gpio_range *range; + struct gpio_chip *chip; + + range = nmk_match_gpio_range(pctldev, offset); + if (!range || !range->gc) { + seq_printf(s, "invalid pin offset"); + return; + } + chip = range->gc; + nmk_gpio_dbg_show_one(s, chip, offset - chip->base, offset); } static struct pinctrl_ops nmk_pinctrl_ops = {