From patchwork Wed Mar 18 10:51:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 45928 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6D7E82153B for ; Wed, 18 Mar 2015 10:52:16 +0000 (UTC) Received: by wivz2 with SMTP id z2sf6948956wiv.1 for ; Wed, 18 Mar 2015 03:52:15 -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:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=iZTosYgUE7wyk0ASgiOW64B+xtFLdJF9QkWssdBHLFI=; b=d4OHtOk16D/+i169dd8kXMC327AbLUHhqEFhJSOZKSdZrgoiiQ6UM0VKdhOMU/18oV w1QC8jl0sTIonylicNaKsb3NUxio6KYMQJfYIGA31J0nyxEoZQC2jiKF3tBCZOeadh1A /mGbb67HAadnXm5EEqV32iMTsCvoo59ASqaXwlCUvaMuyiu+3lW392Axlutub90RIJWs wN3pK7lkkeWPi/1oe4x1GxuFmI0/5Rg3ePj/CX97EujkfwqK996mu/cbP5HJKXV/azob IKDSHtETso3SGudL5VXFFnYCjzn8WzYIZv9QJ+LKaDAFq8hR3InLiREFus7j00V01Cpz PAQQ== X-Gm-Message-State: ALoCoQk0cqLQ5W1mzD6uD+Tj6eEYYzJTYk9+p+8N2BgVxPwc0+Jaw/Ay4ACODo0GjTFpZbA19DaD X-Received: by 10.112.40.81 with SMTP id v17mr6965833lbk.5.1426675935683; Wed, 18 Mar 2015 03:52:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.181.137 with SMTP id dw9ls124857lac.85.gmail; Wed, 18 Mar 2015 03:52:15 -0700 (PDT) X-Received: by 10.112.160.165 with SMTP id xl5mr38468241lbb.109.1426675935374; Wed, 18 Mar 2015 03:52:15 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id dg10si12612009lac.80.2015.03.18.03.52.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 03:52:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by labjg1 with SMTP id jg1so32467536lab.2 for ; Wed, 18 Mar 2015 03:52:15 -0700 (PDT) X-Received: by 10.152.30.103 with SMTP id r7mr60001074lah.76.1426675934959; Wed, 18 Mar 2015 03:52:14 -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.35.133 with SMTP id h5csp1072197lbj; Wed, 18 Mar 2015 03:52:14 -0700 (PDT) X-Received: by 10.70.118.134 with SMTP id km6mr156844530pdb.162.1426675933210; Wed, 18 Mar 2015 03:52:13 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rw5si32973210pab.215.2015.03.18.03.52.11; Wed, 18 Mar 2015 03:52:13 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-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 S1756037AbbCRKwG (ORCPT + 27 others); Wed, 18 Mar 2015 06:52:06 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:36821 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755839AbbCRKv7 (ORCPT ); Wed, 18 Mar 2015 06:51:59 -0400 Received: by wibg7 with SMTP id g7so86629298wib.1 for ; Wed, 18 Mar 2015 03:51:57 -0700 (PDT) X-Received: by 10.194.110.69 with SMTP id hy5mr144153403wjb.121.1426675917317; Wed, 18 Mar 2015 03:51:57 -0700 (PDT) Received: from localhost.localdomain ([81.134.86.251]) by mx.google.com with ESMTPSA id gz3sm2665532wib.1.2015.03.18.03.51.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Mar 2015 03:51:56 -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 5/6] pinctrl: st: Show correct pin direction -- even when in GPIO mode Date: Wed, 18 Mar 2015 10:51:38 +0000 Message-Id: <1426675899-19882-6-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-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@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.43 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: , Until now ST's pinconf_dbg_show() call-back has displayed the PIO alternate function direction, which is only relevant if a pin is operating in an alternate function mode i.e not GPIO mode. If a pin is in GPIO mode its direction is both set and status is obtained by a completely different/unrelated bunch of registers. This change ensures that the correct pin direction is shown, even if a pin is operating in GPIO mode. Reported-by: Olivier Clergeaud Signed-off-by: Lee Jones --- drivers/pinctrl/pinctrl-st.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 52a4377..1cda40e 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c @@ -206,6 +206,9 @@ #define gpio_chip_to_bank(chip) \ container_of(chip, struct st_gpio_bank, gpio_chip) +#define pc_to_bank(pc) \ + container_of(pc, struct st_gpio_bank, pc) + enum st_retime_style { st_retime_style_none, st_retime_style_packed, @@ -1053,15 +1056,18 @@ static int st_pinconf_get(struct pinctrl_dev *pctldev, static void st_pinconf_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, unsigned pin_id) { + struct st_pio_control *pc; unsigned long config; + int offset = st_gpio_pin(pin_id); 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" "\t\t[retime:%ld,invclk:%ld,clknotdat:%ld," "de:%ld,rt-clk:%ld,rt-delay:%ld]", - ST_PINCONF_UNPACK_OE(config), + !st_gpio_get_direction(&pc_to_bank(pc)->gpio_chip, offset), ST_PINCONF_UNPACK_PU(config), ST_PINCONF_UNPACK_OD(config), ST_PINCONF_UNPACK_RT(config),