[alsa-devel] ASOC: Best way to get private data from machine driver to the other drivers?
Liam Girdwood
lg at opensource.wolfsonmicro.com
Mon Oct 1 12:53:41 CEST 2007
On Fri, 2007-09-28 at 16:14 -0500, Timur Tabi wrote:
> I'm writing an ASOC driver. When my machine driver loads, it determines some
> hardware information for the DMA controllers, some other hardware information
> for the I2S controller, and even more information for the codec.
>
> I want to be able to pass all this information to each of the three other
> drivers. Unfortunately, it doesn't appear that I have enough "private_data"
> pointers available to me.
>
> The current ASOC drivers all use statically defined global structures and
> indexes into arrays of these structures to identify individual devices, such
> associating I2S controller #2 with DMA channels 3 and 4. On PowerPC, this
> doesn't work. The actual hardware configuration is determined at runtime (see
> arch/powerpc/boot/dts/), and so the machine driver needs to collect all the
> information and make all the device-to-device associations.
>
> For example, the PCM driver has an open function:
>
> static struct snd_pcm_ops fsl_dma_ops = {
> .open = fsl_dma_open,
> ...
>
> static int fsl_dma_open(struct snd_pcm_substream *substream)
> {
> ...
>
> What I would like is for fsl_dma_open() to be able to obtain pointers to the
> DMA controller's registers (there are two controllers with 4 channels each) by
> looking inside 'substream'. How can I do that?
>
I think we have addressed this now in ASoC V2. Every component driver
now registers as a standard Linux device driver. It would probably be
possible to read the dts configuration at probe() and then configure the
driver with the correct DMA pointers before calling driver_register().
http://opensource.wolfsonmicro.com/cgi-bin/gitweb/gitweb.cgi?p=linux-2.6-asoc;a=shortlog;h=asoc-v2-dev
Could you have a look at the V2 i.mx31 SSI driver and let me know if we
need further changes for better dts support.
Thanks
Liam
More information about the Alsa-devel
mailing list