linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: timur@codeaurora.org (Timur Tabi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/2] [v5] pinctrl: qcom: add support for sparse GPIOs
Date: Fri, 22 Sep 2017 08:37:07 -0500	[thread overview]
Message-ID: <255ad0dc-2d16-ae7f-0b45-500e23cff1a4@codeaurora.org> (raw)
In-Reply-To: <CACRpkdZFunwQ=tiQqsapap7Ozz42hr=df5vqbC0S5xy5Wn+ZWw@mail.gmail.com>

On 09/22/2017 08:29 AM, Linus Walleij wrote:
> 
> What is your response to Stephen's comment:
> 
>> [Stephen Boyd]
>> Perhaps we can add another hook for our purposes here that
>> tells gpiolib that the gpio is not usable and to skip it. The
>> semantics would be clear, it's just about probing availability of
>> this pin as a gpio and doesn't mux any pins.

> I think this kind of related to my response (after I realized it
> was not just about IRQs):

We already have 95% of this.  We can already specify individual pin 
ranges, and the vast majority of the code recognizes the ranges.  There 
is only one small loophole, and that's in gpiochip_add_data().  The 
for-loop iterates over all GPIOs:

	for (i = 0; i < chip->ngpio; i++) {
		struct gpio_desc *desc = &gdev->descs[i];

		desc->gdev = gdev;
		/*
		 * REVISIT: most hardware initializes GPIOs as inputs
		 * (often with pullups enabled) so power usage is
		 * minimized. Linux code should set the gpio direction
		 * first thing; but until it does, and in case
		 * chip->get_direction is not set, we may expose the
		 * wrong direction in sysfs.
		 */

I believe the real problem is that this for-loop should be moved from 
gpiochip_add_data() into some other function that is called *after* the 
pin ranges are defined.  We can put it in gpiochip_add_pin_range(), maybe.

My patch covers the loophole by adding a check inside get_direction(). 
If we fix gpiochip_add_data(), I can remove that patch.

However, I think that change is risky and will require a lot of testing 
and review.

-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

  reply	other threads:[~2017-09-22 13:37 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-07 15:33 [PATCH 0/2] [v5] pinctrl: qcom: add support for sparse GPIOs Timur Tabi
2017-09-07 15:33 ` [PATCH 1/2] [v5] pinctrl: qcom: disable GPIO groups with no pins Timur Tabi
2017-10-02 17:44   ` Bjorn Andersson
2017-10-02 20:47     ` Timur Tabi
2017-10-07 11:07       ` Linus Walleij
2017-10-13 23:35         ` Timur Tabi
2017-10-19 22:44         ` Timur Tabi
2017-10-16  8:01   ` Thierry Reding
2017-10-16 13:52     ` Timur Tabi
2017-09-07 15:33 ` [PATCH 2/2] [v3] pinctrl: qcom: qdf2xxx: add support for new ACPI HID QCOM8002 Timur Tabi
2017-09-08 12:50 ` [PATCH 0/2] [v5] pinctrl: qcom: add support for sparse GPIOs Linus Walleij
2017-09-13 17:09   ` Timur Tabi
2017-09-19  7:04 ` Stephen Boyd
2017-09-19  8:15   ` Linus Walleij
2017-09-19 12:32     ` Timur Tabi
2017-09-20 11:43       ` Linus Walleij
2017-09-20 13:04         ` Timur Tabi
2017-09-21 12:08           ` Linus Walleij
2017-09-21 12:12             ` Timur Tabi
2017-09-22 13:29               ` Linus Walleij
2017-09-22 13:37                 ` Timur Tabi [this message]
2017-10-03 22:03                   ` Stephen Boyd
2017-10-03 22:12                     ` Timur Tabi
2017-10-04 21:50                       ` Stephen Boyd
2017-10-04 22:41                         ` Timur Tabi
2017-10-05 21:30                           ` Stephen Boyd
2017-10-11  7:51                     ` Linus Walleij
2017-10-12  7:39                       ` Stephen Boyd
2017-10-14 22:43                         ` Linus Walleij
2017-10-16 13:42                           ` Timur Tabi
2017-10-13 23:26                     ` Timur Tabi
2017-10-15 20:18                       ` Thierry Reding
2017-10-15 21:09                         ` Timur Tabi
2017-10-02 16:02                 ` Timur Tabi

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=255ad0dc-2d16-ae7f-0b45-500e23cff1a4@codeaurora.org \
    --to=timur@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.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).