Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Brownell
Date: Friday, November 30, 2007 - 11:40 am

On Friday 30 November 2007, Jean Delvare wrote:

I've got patches in my queue too, sigh ...

Thanks for the review.  I'll snip out typos and similar trivial
comments (and fix them!), using responses here for more the
substantive feedback.

- Dave



I'll take that out, to avoid the question.  The answer is still mostly
TBD, but the gpiolib infrastructure provides a number of the hooks
that such a userspace interface would need.



Updated description:

 * @n_latch: optional bit-inverse of initial register value; if
 *      you leave this initialized to zero, the driver will treat
 *      all bits as inputs as if the chip was just reset

This chip is documented as being "pseudo-bidirectional", which is
a sign that there are some confusing mechanisms lurking...


Conventions for naming negative-true signals include a "#" suffix
(illegal for C), a overbar (not expressible in ASCII), and prefixes
including "/" (illegal for C) and "n" (aha!).  I morphed the latter
into "n_" since it's often paired with all-caps signal names, as
in "nRESET", which are bad kernel coding style.

Latches hold values; http://en.wikipedia.org/wiki/Latch_%28electronics%29
talks about bit-level latching, but GPIO controllers use register-wide
latches to record the value that should be driven on output pins.
(As opposed to input pins, whose values are read without latching.)



It's a wierd little arrangement, maybe you have a better explanation.
I tried hitting the confusing points more directly:

 * These GPIO chips are only "pseudo-bidirectional"; read the chip specs
 * to understand the behavior.  They don't have separate registers to
 * record which pins are used for input or output, record which output
 * values are driven, or provide access to input values.  That must all
 * be inferred by reading the chip's value and knowing the last value
 * written to it.  If you don't initialize n_latch, that last written
 * value is presumed to be all ones (as if the chip were just reset).



For alphabetical order it would go much sooner.
GPIO precedes SENSOR.  ;)



I'll do that -- but note that the names *are* spelled out later.



I was thinking more like <linux/i2c/...> myself.  There are many more
I2C chips than GPIO expanders.



No can do; return types differ, which means that on some platforms
the calling conventions have significant differences.



To share (current code) three copies of the "<3>%s %s: %s --> %d\n"
string.  Every little bit of kernel bloat prevention helps.  ;)
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch/rfc 2/4] pcf875x I2C GPIO expander driver, David Brownell, (Mon Oct 29, 6:51 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Jean Delvare, (Fri Nov 30, 5:32 am)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Bill Gatliff, (Fri Nov 30, 6:04 am)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Jean Delvare, (Fri Nov 30, 6:36 am)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Bill Gatliff, (Fri Nov 30, 7:09 am)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, David Brownell, (Fri Nov 30, 11:40 am)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Jean Delvare, (Fri Nov 30, 1:13 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, David Brownell, (Fri Nov 30, 1:59 pm)
Re: [patch/rfc 2/4] pcf857x I2C GPIO expander driver, David Brownell, (Wed Dec 5, 8:03 pm)
Re: [patch/rfc 2/4] pcf857x I2C GPIO expander driver, Jean Delvare, (Thu Dec 6, 4:17 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Trent Piepho, (Thu Apr 3, 7:06 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Ben Nizette, (Thu Apr 3, 7:45 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Trent Piepho, (Thu Apr 3, 8:33 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Ben Nizette, (Thu Apr 3, 9:57 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Jean Delvare, (Fri Apr 4, 1:09 am)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Trent Piepho, (Fri Apr 4, 12:07 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Jean Delvare, (Fri Apr 4, 12:36 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, Trent Piepho, (Fri Apr 4, 1:18 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, David Brownell, (Fri Apr 4, 7:51 pm)
Re: [patch/rfc 2/4] pcf875x I2C GPIO expander driver, David Brownell, (Fri Apr 4, 7:53 pm)