lkml.org 
[lkml]   [2008]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch/rfc 2/4] pcf875x I2C GPIO expander driver
Date
On Friday 04 April 2008, Trent Piepho wrote:
> >> +    if (test_bit(FLAG_IS_OUT, &gdesc->flags)) {
> >> +            return -EINVAL;
> >> +            /* strcpy(buf, "-1\n"); return 4; */ /* Or this? */
> >
> > Why not just return gpio_get_value(n) in all cases?

That's the right answer...


> > User might want to
> > know which value is currently being output.
>
> I thought the gpiolib layer didn't let you read an output, but I see that's
> not the case now.  Maybe it's changed since the first revision?  I've changed
> this to call gpio_get_value(n) for outputs too.

I don't recall ever disallowing reading output values ... the
exact behavior is platform-specific, though it "should" be the
value actually sensed at the pin, which might not be the same
as what's being driven.


> Though for the MPC8572 GPIO driver I wrote, it doesn't support reading
> outputs.  The hardware doesn't allow it (IMHO, a design flaw), and working
> around this significantly slows down GPIO functions.

Then don't worry about it. Any portable code can't rely on
being able to do that.

- Dave


> What I'm trying to do
> with the GPIO lines is going to be slower than desired no matter how fast I
> make the gpio code (which is almost entirely responsible for the final speed),
> so slowing down reads by a factor of four or more just to read back outputs
> isn't desirable.
>


--
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/

\
 
 \ /
  Last update: 2008-04-05 05:25    [W:0.078 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site