[lkml]   [2012]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: RFC: pca953 new platform specific changes
On Thu, Jun 21, 2012 at 4:43 AM, Darren Hart <> wrote:

> I'm working on support for a device which combines a pair of PCA9555
> gpio chips with an LIS331DLH accelerometer on an I2C bus.

What we usually do in these cases is create a root device of MFD
class (see drivers/mfd/* for examples) which spawns children, in this
case two PCA9555 and one LIS331DLH devices. The MFD device
typically gets to funnel all requests to (e.g.) read and write registers
on the subdevices.

Now since IIUC, the PCA9555 already has a driver which sits directly
on I2C, and I think my friend Srinidhi is working on a IIO driver for
the LIS331DLH (maybe I confused named, tell me if I misunderstood)
and each of these may be parked directly on top of I2C, they need
different bus backends.

In the pca953x the register reads/writes are already nicely split off
into functions named pca953x_read_reg()/pca953x_write_reg()
so as a first step split out the I2C bus adoption and whatever
goes into that layer as a separate file named

Then as a second step abstract the register read+write functions
totally and have the I2C portions fill in a vtable when calling up
to the main driver, so the main portion of the driver has no clue
it is sitting on I2C, this is all abstracted away and hidden.

Then as a third step add your MFD backend which provides an
MFD funnel to the same functions by providing another set
of functions to the vtable, that will not talk to the I2C bus but to
your MFD funnel, so instead of probing to the I2C bus, it will
probe from an MFD cell instatiated from the MFD funnel driver.

Linus Walleij

 \ /
  Last update: 2012-07-05 16:01    [W:0.040 / U:0.928 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site