mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Ben Nizette <bn@niasdigital.com>
Cc: Linus Walleij <linus.walleij@stericsson.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	Lee Jones <lee.jones@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH 1/2] gpio: add pin biasing and drive mode to gpiolib
Date: Tue, 19 Apr 2011 09:38:55 +0100	[thread overview]
Message-ID: <20110419093855.36910400@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <6C3F739A-A157-4796-9572-C6B0FAC2565E@niasdigital.com>

> > It also doesn't solve the real problem which is that you've got to
> > implement platform specific parallel gpio extensions all over the place
> > when you really want it all using the same 'handle' and request logic.
> 
> Fair enough.  Forgive me if you've stated this in a previous conversation
> then but what do you see as being the best way forward here?  Should
> gpiolib enforce itself as the One True Allocator and require all firmware
> drivers call back in to it to get access to the pins rather than gpiolib
> calling back to the platform upon gpio_request()?

We need something to allocate gpios and manage them. gpiolib seems to be
very good at this. We also need gpiolib to route other requests because
gpiolib is the one thing which knows how to turn "gpio 43" a struct and
function calls.

> > And for a lot of this stuff that the gpio layer really doesn't want
> > internal knowledge of other chunks of the kernel have used models like
> > 'get_property/set_property' (eg battery, video4linux etc) so that the mid
> > layer can plumb in a conversation between the handle owner and the driver
> > without getting involved in the conversation.
> 
> Yeah that sounds like a more reasonable way to expose this functionality if
> the driver does indeed need it.

Leaving aside the current input/output and on/off bits I would go for
being able to do

	gpio_get_property(gpio, GPIO_BIAS, GPIO_BIAS_WHATEVER);
	gpio_set_property(gpio, GPIO_BIAS, GPIO_BIAS_WHATEVER_ELSE);

and having gpiolib perform nothing more on these than

	is the gpio allocated 
	does ->get_property() exist
		no -EOPNOTSUPP
		yes return ->get_proprty(gpio struct, op, val)
	
For dynamically configurable features that avoids the 

	gpio_request(35);
	magic_platform_hack(&foo[3], blah); /* foo3 will be gpio35 */

type stuff that becomes unmaintainable.

It would be entirely optional for a driver to support any of this stuff,
but it would both allow drivers to do so and also mean that where there
are multiple devices with a common feature *and* a driver wants to use it
that it will be properly abstracted in the driver itself.


Alan



> 
> 	--Ben.
> 
> > 
> > Alan
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> 


-- 
--
	"Alan, I'm getting a bit worried about you."
				-- Linus Torvalds

  reply	other threads:[~2011-04-19  8:38 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-17 21:37 Linus Walleij
2011-04-17 21:48 ` Alan Cox
2011-04-17 21:58   ` Linus Walleij
2011-04-17 22:03     ` Alan Cox
2011-04-18  0:09 ` Kyungmin Park
2011-04-18  7:17   ` Kurt Van Dijck
2011-04-18  8:04 ` Ben Nizette
2011-04-18  8:19   ` Alan Cox
2011-04-18  8:50     ` Ben Nizette
2011-04-18 11:59       ` Mark Brown
2011-04-18 22:16         ` Ben Nizette
2011-04-18 22:31           ` Mark Brown
2011-04-19  4:50             ` Ben Nizette
2011-04-20 12:11           ` Linus Walleij
2011-04-18 12:26       ` Alan Cox
2011-04-18 22:26         ` Ben Nizette
2011-04-19  8:38           ` Alan Cox [this message]
2011-04-19  8:51             ` Kyungmin Park
2011-04-20 12:32               ` Linus Walleij
2011-04-20 12:38                 ` Kyungmin Park
2011-04-20 14:54                 ` Alan Cox
2011-04-20 14:26               ` Haojian Zhuang
2011-04-20 14:40                 ` Kyungmin Park
2011-04-20 15:04                   ` Haojian Zhuang
2011-04-20 15:17                     ` Linus Walleij
2011-04-20 15:32                       ` Alan Cox
2011-04-20 15:45                         ` Linus Walleij
2011-04-27 21:55                         ` Russell King - ARM Linux
2011-04-27 22:16                           ` H Hartley Sweeten
2011-04-20 15:13                 ` Linus Walleij
2011-04-20 15:29                   ` Alan Cox
2011-04-20 15:39                     ` Linus Walleij
2011-04-20 15:43                       ` Alan Cox
2011-04-27 21:58                         ` Russell King - ARM Linux
2011-04-20  0:09             ` Ben Nizette
2011-04-20  9:45               ` Alan Cox
2011-04-20 12:38               ` Linus Walleij
2011-04-20 14:55                 ` Alan Cox
2011-04-20 12:21           ` Linus Walleij
2011-04-20 23:32             ` Ben Nizette
2011-04-21  6:48               ` Linus Walleij
2011-04-23  8:25                 ` Ben Nizette
2011-04-21  0:29             ` Ben Nizette
2011-04-20 12:19         ` Linus Walleij
2011-04-20 12:22           ` Alan Cox
2011-04-20 12:04   ` Linus Walleij
2011-04-20 23:24     ` Ben Nizette
2011-04-21 15:39 ` Stijn Devriendt
2011-04-22 11:36   ` Linus Walleij
2011-04-22 11:56     ` Alan Cox
2011-04-23  8:35     ` Ben Nizette
2011-04-25 18:52 ` Rohit Vaswani
2011-04-26  7:48   ` Linus Walleij

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=20110419093855.36910400@lxorguk.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=bn@niasdigital.com \
    --cc=grant.likely@secretlab.ca \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.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

all inboxes | Powered by JetHome®