"cell-index" vs. "index" vs. no index in I2C device nodes

Grant Likely grant.likely at secretlab.ca
Fri Jun 6 02:00:04 EST 2008


On Thu, Jun 5, 2008 at 9:43 AM, Timur Tabi <timur at freescale.com> 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.
>
> 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.

That is still Linux internal artifacts leaking out.  Don't encode that
data into the device tree.

Besides, the whole thing looks bass ackwards and doesn't match the
Linux driver model.  'busses' should register 'devices'.  'drivers'
should then bind to those 'devices'.  Where ASoC is concerned, the i2c
bus should register its own child devices, which includes the codecs,
and an ASoC codec driver should bind against it.  The fabric driver
should then use the codec's exported API.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.



More information about the Linuxppc-dev mailing list