Audio codec device tree entries

Timur Tabi timur at freescale.com
Fri Oct 26 02:14:22 EST 2007


Jon Smirl wrote:

> This could work. The generic codec is a alsa soc_device_driver, not a
> of_device_driver. The codec node could instantiate the fabric as a
> of_device_driver which could then instantiate the soc_device_driver
> for the generic codec.
> 
> The generic codecs are supposed to work cross platform so they can't
> include code that munges the of device tree.

My understanding of ASoC is that the fabric driver is supposed to be OF-aware, 
and the codec and other drivers are not.  The other drivers have ASoC entry 
points that the fabric driver calls to provide information.

Example:

Fabric driver:

static int mpc8610hpcd_startup(struct snd_pcm_substream *substream)
{
	...
	if (codec_dai->dai_ops.set_fmt) {
		ret = codec_dai->dai_ops.set_fmt(codec_dai, machine_data->dai_format);
		if (ret < 0) {
			printk(KERN_ERR "mpc8610-hpcd: could not set codec "
				"driver audio format (ret=%i)\n", ret);
			return ret;
		}
	}

codec driver:

static int cs4270_set_dai_fmt(struct snd_soc_codec_dai *codec_dai,
			      unsigned int format)
{
	...

	switch (format & SND_SOC_DAIFMT_FORMAT_MASK) {
	case SND_SOC_DAIFMT_I2S:
	case SND_SOC_DAIFMT_LEFT_J:
		cs4270->mode = format & SND_SOC_DAIFMT_FORMAT_MASK;
		break;


In my device tree, the I2S node specifies the interface (this node layout is 
what I came up with 6 months ago when I started working on this.)

		ssi at 16000 {
			compatible = "fsl,ssi";
			reg = <16000 100>;
			interrupt-parent = <&mpic>;
			interrupts = <3e 2>;
			/* This is probably not the right way to tell the
			   SSI driver how to configure the interface */
			fsl,mode = "i2s-slave";
			codec {
				compatible = "cs4270";
			};
		};


The fabric driver reads "i2s-slave" and converts that to SND_SOC_DAIFMT_I2S.




More information about the Linuxppc-dev mailing list