From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756209AbbCRQo2 (ORCPT ); Wed, 18 Mar 2015 12:44:28 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:57281 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754099AbbCRQoZ (ORCPT ); Wed, 18 Mar 2015 12:44:25 -0400 Message-ID: <5509AB49.8040806@st.com> Date: Wed, 18 Mar 2015 17:43:53 +0100 From: Maxime Coquelin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Lee Jones , , , , CC: Subject: Re: [STLinux Kernel] [PATCH 4/6] pinctrl: st: Supply a GPIO get_direction() call-back References: <1426675899-19882-1-git-send-email-lee.jones@linaro.org> <1426675899-19882-5-git-send-email-lee.jones@linaro.org> In-Reply-To: <1426675899-19882-5-git-send-email-lee.jones@linaro.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.201.23.80] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2015-03-18_05:2015-03-18,2015-03-18,1970-01-01 signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/18/2015 11:51 AM, Lee Jones wrote: > ST's hardware differentiates between GPIO mode and Pinctrl alternate > functions. When a pin is in GPIO mode, there are dedicated registers > to set and obtain direction status. However, If a pin's alternate > function is in use then the direction is set and status is derived > from a bunch of syscon registers. The issue is; until now there was > a lack of parity between the two. > > For example: > > Catting the two following information sources could result in > conflicting information (output has been snipped for simplicity): > > $ cat /sys/kernel/debug/gpio > GPIOs 32-39, platform/961f080.pin-controller-sbc, PIO4: > gpio-33 (? ) out hi > > $ cat /sys/kernel/debug/pinctrl//pinconf-pins > pin 33 (PIO4[1]):[OE:0,PU:0,OD:0] > [retime:0,invclk:0,clknotdat:0,de:0,rt-clk:0,rt-delay:0] > > In this example GPIO-33 is a GPIO controlled LED, which is set for > output, as you'd expect. However, when the same information is > drafted from Pinctrl, it clearly states that OE (Output Enable) is > not set i.e. the pin is set for input. This is because OE normally > only represents alternate functions and has no bearing on how the > pin operates when in Alt-0 (GPIO mode). > > This patch changes the current semantics and provides a parity link > between the two subsystems. The get_direction() call-back firstly > determines which function a pin is operating in, then uses the > appropriate helpers for that mode. > > Reported-by: Olivier Clergeaud > Signed-off-by: Lee Jones > --- > drivers/pinctrl/pinctrl-st.c | 31 ++++++++++++++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) > Acked-by: Maxime Coquelin Thanks, Maxime