public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Jani Nikula <ext-jani.1.nikula@nokia.com>
Cc: "Trilok Soni" <soni.trilok@gmail.com>,
	"Juha Yrjölä" <juha.yrjola@solidboot.com>,
	linux-omap@vger.kernel.org,
	"Brian Swetland" <swetland@google.com>,
	lockwood@android.com
Subject: Re: GPIO switch framework (was: Re: [PATCH] ARM: OMAP: Add support for dynamic GPIO switch update)
Date: Sun, 21 Dec 2008 12:26:14 -0800	[thread overview]
Message-ID: <200812211226.14555.david-b@pacbell.net> (raw)
In-Reply-To: <1229600573.5895.432.camel@jani-desktop>

On Thursday 18 December 2008, Jani Nikula wrote:
> On Tue, 2008-12-16 at 11:35 +0530, ext Trilok Soni wrote:
> 
> > OK, I found other guys (android ??) using such home brew frameworks.
> > Time to write a switch framework.
> 
> To start a discussion on what such a GPIO switch framework should be
> like if someone were to write it, here's a list of the kind of things
> I'd like to see in it (mostly from gpio-switch.c):
> 
> * Based on or integrated in the gpiolib.

As noted earlier:  such a thing should be a "switch" framework,
with "gpio" just on implementation.  Not every switch will be
implemented as a GPIO.


> * Dynamically changeable notification callbacks in kernel.

Not clear what this means.  Reconfigure the switch type
on the fly?  I'm not a big fan of the event namespace
which <linux/notifier.h> defines, I hope that's not what
is meant here ... though maybe its callback model is OK,
adding and removing callbacks is easy enough.

Current OMAP gpio-switch has a single callback, and
that might be part of the problem.  Linux has a single
callback for things like timers and request completions;
but these switches have different lifecycle model.

Decoupling caller/switch and callee(s)/callbacks() may
provide a better model.


> * Sysfs notifications to userspace.

Why sysfs in particular, rather than some /dev/input/*
event channel?  Note that input devices already decouple
the event reporters and event receivers fairly well.


> * Debouncing for the notifications to filter spurious events.
> 
> * Dynamically adjustable debounce timeouts.

Debouncing might not be a framework issue; at first
thought, it seems like something the GPIO glue into
that framework might need to handle.


> * Arbitrary names for the GPIOs in sysfs instead of (or in addition to)
> the gpiolib style "gpioN".

This mostly sounds to me like an input device...

Except maybe for the notion that in-kernel software
needs to be responsive to the events too.  I seem to
recall "push those policies to userspace" arguments
cropping up in similar cases.  (My two cents:  kernel
is full of policy, sometimes reconfigurable; easy to
believe system integrity can require a few more.)


> Anything else? I didn't see anything in the Android source that couldn't
> be covered with this.

The Android stuff seems already split into a class
and GPIO glue.  (Hence my CC to Mike Lockwood, the
author of that drivers/switch code.)

Any reason you couldn't use that as-is, maybe after
updating it a bit?  Add some GPIO debouncing, use
input framework not miscdev in the core, different
headset issues, etc.

- Dave


> 
> 
> Jani.
> 
> 
> 



      parent reply	other threads:[~2008-12-21 20:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-15 12:08 [PATCH] ARM: OMAP: Add support for dynamic GPIO switch update Jani Nikula
2008-12-15 12:14 ` Trilok Soni
2008-12-15 13:31   ` Felipe Balbi
2008-12-15 13:22 ` Felipe Balbi
2008-12-15 13:44   ` Jani Nikula
2008-12-15 13:56     ` Felipe Balbi
2008-12-15 13:40 ` Juha Yrjölä
2008-12-15 14:52   ` Jani Nikula
2008-12-15 15:29     ` Juha Yrjölä
2008-12-15 15:58       ` Jani Nikula
2008-12-16  6:05         ` Trilok Soni
2008-12-18 11:42           ` GPIO switch framework (was: Re: [PATCH] ARM: OMAP: Add support for dynamic GPIO switch update) Jani Nikula
2008-12-18 13:00             ` Trilok Soni
2008-12-18 13:40               ` Jani Nikula
2008-12-19  8:47                 ` Trilok Soni
2008-12-19  8:51                   ` Brian Swetland
2008-12-21 20:26             ` David Brownell [this message]

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=200812211226.14555.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=ext-jani.1.nikula@nokia.com \
    --cc=juha.yrjola@solidboot.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=lockwood@android.com \
    --cc=soni.trilok@gmail.com \
    --cc=swetland@google.com \
    /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