LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Cc: Stanimir Varbanov <svarbanov@mm-sol.com>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Stephen Boyd <sboyd@codeaurora.org>
Subject: Re: [PATCH 3/3] pinctrl: qcom: handle input-enable pinconf property
Date: Wed, 4 Feb 2015 11:03:36 +0100	[thread overview]
Message-ID: <CACRpkdYsy5R60NKhDvCUuyq-oV2FnuF1GQBvyNfr0YECUXn7zw@mail.gmail.com> (raw)
In-Reply-To: <20150130162004.GT11960@sonymobile.com>

On Fri, Jan 30, 2015 at 5:20 PM, Bjorn Andersson
<bjorn.andersson@sonymobile.com> wrote:
> On Fri 30 Jan 02:27 PST 2015, Stanimir Varbanov wrote:
>
>> +     case PIN_CONFIG_INPUT_ENABLE:
>> +             /* Pin is output */
>> +             if (arg)
>> +                     return -EINVAL;
>> +             arg = 1;
>> +             break;
>
> My idea of this function is to query if we have the specific option
> enabled, so I don't like the fact that we're returning an error here, we
> should just return 0 with arg 0 (or something like that).
>
> However, that would not give the results we expect and your patch is
> "correct".
>
> Linus, conf_items in pinconf_generic_dump_one() seems to represent
> boolean properties of the pins. Returning 0 from pin_config_*_get()
> should in my view then be treated as it not being active.
>
> Is this in line with your view and should we modify
> pinconf_generic_dump_one() to continue for these values if the getter
> returns 0?
>
> If not, at least all the bias properties here should return -EINVAL as
> well. (which I think is wrong)

Well currently the semantics are:

- ENOTSUPP = this property is not even supported
- EINVAL       = this value exists but can not be determined

It has this form primarily to serve the non-boolean properties.
For example pull-up can return -EINVAL if pull-up is supported
but pull-down is currently active, so it cannot say what
resistance it is pulled up with, as it is "infinite" (NAN,
thus translated -EINVAL).

It just folds over to the boolean props doing things in the
same way to simplify things... -EINVAL just means
"false". If we should return 1/0 from boolean props we need
to handle them as a special case in the pinconf-generic.
code, by extending the struct pinconf_generic_params,
which is possible of course.

Further: as of now pinconf_generic_dump_one() doesn't print
anything for inactive pulls etc return -EINVAL, but maybe
it should? It was just handy on some system to only see
the stuff that was really active, not to get a list of stuff that
was not active as well.

Yours,
Linus Walleij

  reply	other threads:[~2015-02-04 10:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 10:27 [PATCH 0/3] pinctrl: qcom: enable generic pinconf and input-enable Stanimir Varbanov
2015-01-30 10:27 ` [PATCH 1/3] pinctrl: qcom: delete pin_config_get/set pinconf operations Stanimir Varbanov
2015-01-30 13:37   ` Linus Walleij
2015-01-30 10:27 ` [PATCH 2/3] pinctrl: qcom: enable generic pinconf Stanimir Varbanov
2015-01-30 13:39   ` Linus Walleij
2015-01-30 10:27 ` [PATCH 3/3] pinctrl: qcom: handle input-enable pinconf property Stanimir Varbanov
2015-01-30 16:20   ` Bjorn Andersson
2015-02-04 10:03     ` Linus Walleij [this message]
2015-02-04 17:49       ` Bjorn Andersson

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=CACRpkdYsy5R60NKhDvCUuyq-oV2FnuF1GQBvyNfr0YECUXn7zw@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=bjorn.andersson@sonymobile.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=svarbanov@mm-sol.com \
    --subject='Re: [PATCH 3/3] pinctrl: qcom: handle input-enable pinconf property' \
    /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

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).