Subject: Re: Device trees and audio codecs

From: Segher Boessenkool <[email-masked]>
Date: Sun, 21 Oct 2007 21:14:44 +0200

> I'm working on ALSA ASoC support for a codec chip on my mpc5200 based
> target hardware.

What is ASoC?

> Under ASoC the device drivers for the codec chips are platform
> independent.  In the current ASoC model there are three device
> drivers: i2s (or spi, etc), the generic codec, and a platform specific
> 'fabric' driver.  Some codecs are linked to both i2c and i2s.

The i2s driver is simply for data transport, the codec driver does,
well, what codecs do; and what is the fabric driver for?  Just to
know which output ports are which, etc.?

> The fabric driver corresponds to the 'layout-id' in the Apple model.
> It tells how to configure the generic codec driver for the specific
> configuration needed by the actual platform hardware.

The apple layout-id selects one of several tables with *lots* of info.
I think you want a subset of that only.

> My target hardware has a codec that is linked to both i2s and i2c. How
> should it be represented?

Since the codec is addressable on i2c, and not on i2s, it should be
a child node of the i2c bus it sits on; and then you put a property
in the codec node pointing to the i2s bus node it is connected to.
Multiple of those (or multiple entries) if it is connected to more
than one i2s bus.  "i2s-parent" might be a good name for such a prop.

> Apple has three entries. One for i2s, one for the codec, and one for
> soundchip. What is the soundchip entry, does it correspond to real
> hardware?
>
> /proc/device-tree/pci@f2000000/mac-io@17/i2s@0/i2s-a@10000:

This is one of the i2s channels on the macio.  Dunno why they put
all those platform-XXX entries in here, (most of) these don't
logically belong here.

> /proc/device-tree/pci@f2000000/mac-io@17/i2s@0/i2s-a@10000/sound:

The codec.  I guess Apple puts this here for their weirdo platform-do
stuff; don't imitate this :-)

> /proc/device-tree/pci@f2000000/mac-io@17/i2c@18000/i2c-bus@0/codec@6a:

The codec.  _Do_ put it here in your tree :-)

Segher