From patchwork Wed Mar 18 17:21:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 45983 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D2E282153C for ; Wed, 18 Mar 2015 17:21:55 +0000 (UTC) Received: by wivz2 with SMTP id z2sf8901800wiv.1 for ; Wed, 18 Mar 2015 10:21:55 -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=o5K0OhqQwDiGvZFYYIDPz/nm37kyoFGnZSzPHqKLKEM=; b=h/ucE5zOJ/cthW32yzh+p/VGnNid/Lk/EqJqI2aJdD/4JxBeUPL8GmYl+imv8PbjQW sRUKZEW3c4Z0QyWkVnLS2E9IWRyhASL1YtAxpKor24EtOnjPmidwlcDejaMcdx+hkXdq eq6n0Ih2gdcHs0NqbdtaOE8GH9mTnXpqnCU+6uD8I8QeAfu7LRKnYtV9iievcxSQg4FE QTzI2WdGnYq5C37OBKGQoxqiKJ8r6X2M7a/DFrrPGOeDnDuVYylpBCu58Zk3iGTsfJE0 +jqmc7wxCn8sJ4sRQD207VhT/LNInGqJDSqxBEdHiO5rIVrJdgBsxtUevzysjAb+fAkp udQg== X-Gm-Message-State: ALoCoQk5VKzA29jVyKovBQ1H3L+jQDfkgqw+c9Qtp8u4w7FtArG20L5ClIAhSvhiEBWYY+IfDoQA X-Received: by 10.112.41.131 with SMTP id f3mr11495196lbl.20.1426699315079; Wed, 18 Mar 2015 10:21:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.246.38 with SMTP id xt6ls174286lac.102.gmail; Wed, 18 Mar 2015 10:21:54 -0700 (PDT) X-Received: by 10.112.205.103 with SMTP id lf7mr16322878lbc.37.1426699314861; Wed, 18 Mar 2015 10:21:54 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id dv6si13370516lbc.94.2015.03.18.10.21.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 10:21:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by lbblx11 with SMTP id lx11so12690834lbb.3 for ; Wed, 18 Mar 2015 10:21:54 -0700 (PDT) X-Received: by 10.152.8.15 with SMTP id n15mr38016170laa.41.1426699314762; Wed, 18 Mar 2015 10:21:54 -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 h5csp1294563lbj; Wed, 18 Mar 2015 10:21:53 -0700 (PDT) X-Received: by 10.70.102.8 with SMTP id fk8mr43393408pdb.141.1426699310280; Wed, 18 Mar 2015 10:21:50 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rh12si37261231pdb.159.2015.03.18.10.21.49; Wed, 18 Mar 2015 10:21:50 -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 S964812AbbCRRVn (ORCPT + 27 others); Wed, 18 Mar 2015 13:21:43 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:35094 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756567AbbCRRVd (ORCPT ); Wed, 18 Mar 2015 13:21:33 -0400 Received: by wibdy8 with SMTP id dy8so96150500wib.0 for ; Wed, 18 Mar 2015 10:21:32 -0700 (PDT) X-Received: by 10.180.76.4 with SMTP id g4mr8714110wiw.43.1426699292197; Wed, 18 Mar 2015 10:21:32 -0700 (PDT) Received: from localhost.localdomain ([81.134.86.251]) by mx.google.com with ESMTPSA id v13sm4021936wij.10.2015.03.18.10.21.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Mar 2015 10:21:31 -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 v2 5/6] pinctrl: st: Show correct pin direction -- even when in GPIO mode Date: Wed, 18 Mar 2015 17:21:18 +0000 Message-Id: <1426699279-9258-6-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426699279-9258-1-git-send-email-lee.jones@linaro.org> References: <1426699279-9258-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.217.180 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 Acked-by: Maxime Coquelin 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),