Subject: Re: "cell-index" vs. "index" vs. no index in I2C device nodes

From: Benjamin Herrenschmidt <[email-masked]>
Date: Fri, 06 Jun 2008 14:20:40 +1000

On Thu, 2008-06-05 at 10:43 -0500, Timur Tabi wrote:
> Grant Likely wrote:
> 
> > if you need explicit indexing then use an alias.  My opinion however
> > is that explicit indexing is unnecessary and is just an artifact of
> > current i2c subsystem internals.  There is already enough information
> > in the device tree to match i2c devices with i2c busses without
> > resorting to indexes.
> 
> Not for ALSA SoC V2 devices.  In ASoC V2, the "fabric" driver needs to identify
> the codec by its specific I2C bus and address number.  The codec driver is not
> an OF driver (normally), so it doesn't have access to any OF data.  It's just an
> I2C driver, so its given an I2C address and some number that represents an adapter.

Any struct device can have an OF node. We need to fix things so they get
filled properly.

> Therefore, the fabric driver and the codec driver need to independently
> determine the I2C bus number, and they need to match.  The fabric driver parses
> the OF tree and looks up the cell-index property.  The codec driver uses the
> adapter->nr variable.  The patch I posted ensures that the two contain the same
> number.

No, the fabric driver should get to its device node in a way or another,
and from there, find a pointer (via a phandle) to it's codec, and match
that to an i2c device.

If the current infrastructure doesn't allow that kind of matching, it
needs to be fixed.

Ben.