From: Maxime Coquelin <maxime.coquelin@st.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linus.walleij@linaro.org,
linux-gpio@vger.kernel.org, kernel@stlinux.com
Subject: Re: [STLinux Kernel] [PATCH 2/6] pinctrl: st: Introduce a 'get pin function' call
Date: Wed, 18 Mar 2015 18:00:04 +0100 [thread overview]
Message-ID: <5509AF14.1060200@st.com> (raw)
In-Reply-To: <20150318165116.GR3318@x1>
On 03/18/2015 05:51 PM, Lee Jones wrote:
> On Wed, 18 Mar 2015, Maxime Coquelin wrote:
>
>>
>> On 03/18/2015 11:51 AM, Lee Jones wrote:
>>> 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 <lee.jones@linaro.org>
>>> ---
>>> 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;
>> Shouldn't we print something if alt is NULL?
>> Else we can think we are on alternate 0.
> That is the assumption that I've made. Is there isn't an alt, then a
> pin can only be on Alt-0. Have I made the incorrect assumption here?
Just re-checked the code, and yes you are right.
No alt here means alt field of struct st_pctl_data is -1, which in turn
means the register is not available.
You can forget my remark, and add my:
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
Thanks,
Maxime
next prev parent reply other threads:[~2015-03-18 17:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-18 10:51 [PATCH 0/6] pinctrl: st: Fix disparity between Pinctrl & GPIO in /sysfs Lee Jones
2015-03-18 10:51 ` [PATCH 1/6] ARM: STi: DT: STiH407: Fix retime pin mask for PIO5 and PIO35 Lee Jones
2015-03-18 16:36 ` [STLinux Kernel] " Maxime Coquelin
2015-03-18 10:51 ` [PATCH 2/6] pinctrl: st: Introduce a 'get pin function' call Lee Jones
2015-03-18 16:41 ` [STLinux Kernel] " Maxime Coquelin
2015-03-18 16:51 ` Lee Jones
2015-03-18 17:00 ` Maxime Coquelin [this message]
2015-03-18 10:51 ` [PATCH 3/6] pinctrl: st: Move st_get_pio_control() further up the source file Lee Jones
2015-03-18 16:41 ` [STLinux Kernel] " Maxime Coquelin
2015-03-18 10:51 ` [PATCH 4/6] pinctrl: st: Supply a GPIO get_direction() call-back Lee Jones
2015-03-18 16:43 ` [STLinux Kernel] " Maxime Coquelin
2015-03-18 10:51 ` [PATCH 5/6] pinctrl: st: Show correct pin direction -- even when in GPIO mode Lee Jones
2015-03-18 16:45 ` [STLinux Kernel] " Maxime Coquelin
2015-03-18 10:51 ` [PATCH 6/6] pinctrl: st: Display pin's function when printing pinctrl debug information Lee Jones
2015-03-18 16:35 ` [STLinux Kernel] " Maxime Coquelin
2015-03-18 16:54 ` Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5509AF14.1060200@st.com \
--to=maxime.coquelin@st.com \
--cc=kernel@stlinux.com \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).