Re: [PATCH v2 1/4] gpiolib: Add "unknown" direction support

From: Alexander Stein
Date: Mon Feb 21 2011 - 04:37:31 EST


On Monday 21 February 2011, 10:19:16 Wolfram Sang wrote:
> > > Sharing GPIOs in read-only mode, is indeed something that is not
> > > covered by the GPIO API. It might be worth adding a
> > > gpio_request_shared, which would only permit setting the direction to
> > > input. Futher gpio_request_shared calls would be allowed but
> > > gpio_request calls would fail.
> >
> > gpio_request_shared sounds interesting, but in this case an implicit
>
> Can you name a use-case? One reason is that we won't need to implement
> it if there is no user, another one is that it could potentially weaken
> abstractions?

We had exported our 5V_enable gpio to sysfs to allow a user-space application
to enable/disable devices connected to 5V circuit.
But on the other hand we had to read the current status of this gpio in the
power-fail interrupt handler to distinguish between false-positive (5V
disabled) and a correct detection.
As the sysfs export requests the gpio we cannot gpio_request it in the power-
fail driver and just used gpio_get_value without request.
We set the direction already in the machine startup code and never touched it
again.

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