From patchwork Wed Mar 18 10:51:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 45927 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A7BA02153B for ; Wed, 18 Mar 2015 10:52:14 +0000 (UTC) Received: by lams18 with SMTP id s18sf6618984lam.2 for ; Wed, 18 Mar 2015 03:52:13 -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=PVKvtcgkta0KxWz43FV6ItP3B/dTiXKJN8AljO/Bw/I=; b=IrfUdkanslfFUlDuYssILOQB5IKeMe9RE9a5Y9ztpOhiAQqzBxAW0UR3OgspdBmLBm VZg4TAm0N5OHEYoPgNekZ6/eUuGlbh46YUwoVrzQXZVvbr0gMf+/Na/1Zv+O/vTMQ4BS eapVrh0mB2Qc9iiUwlWIjmWMEUs9++UlV/SWKgproIk7ybga5jNZcje4UDVAasI4+Ve7 uf/bF2Os6/cwcN9Rnwnn1RrT7INL/9AKNoWpiv/mPEmOfYo2MtztdammRCudUWLqvvhj mCVNtp+T1SVEcrAR0RtQSv49vd9f49V3nr2TsqwHd5ZafF3LaVz8LqltE3xzci01628m xAyQ== X-Gm-Message-State: ALoCoQl0nzrsE1mXHkqHX8mrQZvqQNnU7XpbzzvUe7aydRn2LCHvRWCUQ/AOjZ2LNnBVHsGLZHEc X-Received: by 10.112.41.131 with SMTP id f3mr11130172lbl.20.1426675933603; Wed, 18 Mar 2015 03:52:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.25.193 with SMTP id e1ls145134lag.80.gmail; Wed, 18 Mar 2015 03:52:13 -0700 (PDT) X-Received: by 10.112.154.3 with SMTP id vk3mr32179211lbb.26.1426675933331; Wed, 18 Mar 2015 03:52:13 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id js9si12629602lbc.9.2015.03.18.03.52.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 03:52:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbbsy1 with SMTP id sy1so26561780lbb.1 for ; Wed, 18 Mar 2015 03:52:13 -0700 (PDT) X-Received: by 10.152.178.197 with SMTP id da5mr65488143lac.56.1426675933223; Wed, 18 Mar 2015 03:52:13 -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 h5csp1072182lbj; Wed, 18 Mar 2015 03:52:12 -0700 (PDT) X-Received: by 10.66.63.7 with SMTP id c7mr162754213pas.13.1426675931436; Wed, 18 Mar 2015 03:52:11 -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.09; Wed, 18 Mar 2015 03:52:11 -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 S1756016AbbCRKv5 (ORCPT + 27 others); Wed, 18 Mar 2015 06:51:57 -0400 Received: from mail-we0-f172.google.com ([74.125.82.172]:33512 "EHLO mail-we0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755717AbbCRKvx (ORCPT ); Wed, 18 Mar 2015 06:51:53 -0400 Received: by weop45 with SMTP id p45so28980549weo.0 for ; Wed, 18 Mar 2015 03:51:52 -0700 (PDT) X-Received: by 10.180.90.166 with SMTP id bx6mr5533885wib.65.1426675912202; Wed, 18 Mar 2015 03:51:52 -0700 (PDT) Received: from localhost.localdomain ([81.134.86.251]) by mx.google.com with ESMTPSA id gz3sm2665532wib.1.2015.03.18.03.51.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Mar 2015 03:51:51 -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 2/6] pinctrl: st: Introduce a 'get pin function' call Date: Wed, 18 Mar 2015 10:51:35 +0000 Message-Id: <1426675899-19882-3-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.217.179 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: , This call fetches the numerical function value a specified pin is currently operating in. Function zero is more often than not the GPIO function. Greater than zero values represent an alternative function. You'd need to either look those up in the Device Tree sources or the Programmer's Manual. Signed-off-by: Lee Jones --- drivers/pinctrl/pinctrl-st.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c index 9e5ec00..5362e45 100644 --- a/drivers/pinctrl/pinctrl-st.c +++ b/drivers/pinctrl/pinctrl-st.c @@ -460,6 +460,20 @@ static void st_pctl_set_function(struct st_pio_control *pc, regmap_field_write(alt, val); } +static unsigned int st_pctl_get_pin_function(struct st_pio_control *pc, int pin) +{ + struct regmap_field *alt = pc->alt; + unsigned int val; + int offset = pin * 4; + + if (!alt) + return 0; + + regmap_field_read(alt, &val); + + return (val >> offset) & 0xf; +} + static unsigned long st_pinconf_delay_to_bit(unsigned int delay, const struct st_pctl_data *data, unsigned long config) {