ASoC: au1x: convert to platform drivers.
PATCH 1/1 ASoC: au1x: convert to platform drivers.
Convert psc-ac97,i2s to platform drivers similar to the davinci ones.
---
As suggested by Mark Brown a few months back. Against linus-git. Tested on DB1200.
sound/soc/au1x/dbdma2.c | 117 +++++++++++++++++++++++----- sound/soc/au1x/psc-ac97.c | 194 ++++++++++++++++++++++++++++----------------- sound/soc/au1x/psc-i2s.c | 189 ++++++++++++++++++++++++++++---------------- sound/soc/au1x/psc.h | 7 ++- 4 files changed, 344 insertions(+), 163 deletions(-)
sound/soc/au1x/dbdma2.c +98 -19
@@ -2,7 +2,7 @@* Au12x0/Au1550 PSC ALSA ASoC audio support. * * (c) 2007-2008 MSC Vertriebsges.m.b.H., -* Manuel Lauss <[email protected]> +* Manuel Lauss <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -331,6 +331,30 @@ static int au1xpsc_pcm_new(struct snd_card *card,static int au1xpsc_pcm_probe (struct platform_device *pdev) { +if (!au1xpsc_audio_pcmdma[PCM_TX ] || !au1xpsc_audio_pcmdma[PCM_RX ]) +return -ENODEV ; + +return 0 ; +} + +static int au1xpsc_pcm_remove (struct platform_device *pdev) +{ +return 0 ; +} + +/* au1xpsc audio platform */ +struct snd_soc_platform au1xpsc_soc_platform = { + .name ="au1xpsc-pcm-dbdma" , + .probe = au1xpsc_pcm_probe, + .remove = au1xpsc_pcm_remove, + .pcm_ops = &au1xpsc_pcm_ops, + .pcm_new = au1xpsc_pcm_new, + .pcm_free = au1xpsc_pcm_free_dma_buffers, +}; +EXPORT_SYMBOL_GPL (au1xpsc_soc_platform); + +static int __devinit au1xpsc_pcm_drvprobe (struct platform_device *pdev) +{struct resource *r;int ret;
@@ -363,7 +387,9 @@ static int au1xpsc_pcm_probe(struct platform_device *pdev) } (au1xpsc_audio_pcmdma[PCM_RX ])->ddma_id = r->start; -return 0 ; + ret =snd_soc_register_platform (&au1xpsc_soc_platform); +if (!ret) +return ret; out2:kfree (au1xpsc_audio_pcmdma[PCM_RX ]);
@@ -374,10 +400,12 @@ out1:return ret; } -static int au1xpsc_pcm_remove (struct platform_device *pdev) +static int __devexit au1xpsc_pcm_drvremove(struct platform_device *pdev) {int i; +snd_soc_unregister_platform (&au1xpsc_soc_platform); +for (i =0 ; i <2 ; i++) {if (au1xpsc_audio_pcmdma[i]) {au1x_pcm_dbdma_free (au1xpsc_audio_pcmdma[i]);
@@ -389,32 +417,83 @@ static int au1xpsc_pcm_remove(struct platform_device *pdev)return 0 ; } -/* au1xpsc audio platform */ -struct snd_soc_platform au1xpsc_soc_platform = { - .name ="au1xpsc-pcm-dbdma" , - .probe = au1xpsc_pcm_probe, - .remove = au1xpsc_pcm_remove, - .pcm_ops = &au1xpsc_pcm_ops, - .pcm_new = au1xpsc_pcm_new, - .pcm_free = au1xpsc_pcm_free_dma_buffers, +static struct platform_driver au1xpsc_pcm_driver = { + .driver = { + .name ="au1xpsc-pcm" , + .owner =THIS_MODULE , + }, + .probe = au1xpsc_pcm_drvprobe, + .remove =__devexit_p (au1xpsc_pcm_drvremove), }; -EXPORT_SYMBOL_GPL (au1xpsc_soc_platform); -static int __init au1xpsc_audio_dbdma_init (void ) +static int __init au1xpsc_audio_dbdma_load (void ) { au1xpsc_audio_pcmdma[PCM_TX ] =NULL ; au1xpsc_audio_pcmdma[PCM_RX ] =NULL ; -return snd_soc_register_platform (&au1xpsc_soc_platform); +return platform_driver_register (&au1xpsc_pcm_driver); } -static void __exit au1xpsc_audio_dbdma_exit(void) +static void __exit au1xpsc_audio_dbdma_unload(void) { -snd_soc_unregister_platform (&au1xpsc_soc_platform); +platform_driver_unregister (&au1xpsc_pcm_driver); +} + +module_init (au1xpsc_audio_dbdma_load); +module_exit (au1xpsc_audio_dbdma_unload); + + +struct platform_device *au1xpsc_pcm_add (struct platform_device *pdev) +{ +struct resource *res, *r; +struct platform_device *pd; +int id[2 ]; +int ret; + + r =platform_get_resource (pdev,IORESOURCE_DMA ,0 ); +if (!r) +return NULL ; + id[0 ] = r->start; + + r =platform_get_resource (pdev,IORESOURCE_DMA ,1 ); +if (!r) +return NULL ; + id[1 ] = r->start; + + res =kzalloc (sizeof (struct resource ) *2 ,GFP_KERNEL ); +if (!res) +return NULL ; + + res[0 ].start = res[0 ].end = id[0 ]; + res[1 ].start = res[1 ].end = id[1 ]; + res[0 ].flags = res[1 ].flags =IORESOURCE_DMA ; + + pd =platform_device_alloc ("au1xpsc-pcm" ,-1 ); +if (!pd) + goto out; + + pd->resource = res; + pd->num_resources =2 ; + + ret =platform_device_add (pd); +if (!ret) +return pd; + +out: +kfree (res); +return NULL ; } +EXPORT_SYMBOL_GPL (au1xpsc_pcm_add); -module_init (au1xpsc_audio_dbdma_init); -module_exit (au1xpsc_audio_dbdma_exit); +void au1xpsc_pcm_destroy (struct platform_device *dmapd) +{ +if (dmapd) { +kfree (dmapd->resource); + dmapd->resource =NULL ; +platform_device_unregister (dmapd); + } +} +EXPORT_SYMBOL_GPL (au1xpsc_pcm_destroy);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Au12x0/Au1550 PSC Audio DMA driver" ); -MODULE_AUTHOR ("Manuel Lauss <[email protected]>" ); +MODULE_AUTHOR ("Manuel Lauss" );
sound/soc/au1x/psc-ac97.c +120 -74
268 lines not on this page · raw message
sound/soc/au1x/psc-i2s.c +120 -69
274 lines not on this page · raw message
sound/soc/au1x/psc.h +6 -1
@@ -2,7 +2,7 @@* Au12x0/Au1550 PSC ALSA ASoC audio support. * * (c) 2007-2008 MSC Vertriebsges.m.b.H., -* Manuel Lauss <[email protected]> +* Manuel Lauss <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -21,6 +21,10 @@ extern struct snd_soc_dai au1xpsc_i2s_dai;extern struct snd_soc_platform au1xpsc_soc_platform;extern struct snd_ac97_bus_ops soc_ac97_ops; +/* DBDMA helpers */ +extern struct platform_device *au1xpsc_pcm_add (struct platform_device *pdev); +extern void au1xpsc_pcm_destroy (struct platform_device *dmapd); +struct au1xpsc_audio_data {void __iomem *mmio;
@@ -30,6 +34,7 @@ struct au1xpsc_audio_data {unsigned long pm[2 ];struct resource *ioarea;struct mutex lock; +struct platform_device *dmapd; };#define PCM_TX 0
Signature · 1 line
1.6.5.1
Mark Brown
AppliedQuoted 3 lines · Manuel Lauss
Convert psc-ac97,i2s to platform drivers similar to the davinci ones.
Signed-off-by Manuel Lauss <[email protected]>
Applied, thanks. Please remember to CC maintainers on patch submissions
- sometimes things get missed if they're only on mailing lists.
Quoted 7 lines · Mark Brown
Quoted 3 lines · Manuel Lauss
Convert psc-ac97,i2s to platform drivers similar to the davinci ones.
Signed-off-by Manuel Lauss <[email protected]>Applied, thanks. Please remember to CC maintainers on patch submissions
- sometimes things get missed if they're only on mailing lists.
Great, thanks. I'll add you to all other asoc related patches in the future.
Off-topic: I'm not really up-to-date on ASoC; how is multi-device support coming along? I received a new system which has 2 independet audio systems, one with AC97 WM9715 + touchscreen, the other I2S. Some day I'd like to support the touch interface and I2S at the same time ;-)
Thanks!
Manuel Lauss
Quoted 5 lines · Manuel Lauss
Great, thanks. I'll add you to all other asoc related patches in the future.
Off-topic: I'm not really up-to-date on ASoC; how is multi-device support coming along? I received a new system which has 2 independet audio systems, one with AC97 WM9715 + touchscreen, the other I2S. Some day I'd like to support the touch interface and I2S at the same time ;-)
If they're two completely unrelated audio subsystems then it might actually work at the minute if you register two ASoC devices with different device numbers, I've had reports that people are succesfully doing this.
Quoted 8 lines · Mark Brown
Quoted 5 lines · Manuel Lauss
Great, thanks. I'll add you to all other asoc related patches in the future.
Off-topic: I'm not really up-to-date on ASoC; how is multi-device support coming along? I received a new system which has 2 independet audio systems, one with AC97 WM9715 + touchscreen, the other I2S. Some day I'd like to support the touch interface and I2S at the same time ;-)
Quoted 4 lines
If they're two completely unrelated audio subsystems then it might actually work at the minute if you register two ASoC devices with different device numbers, I've had reports that people are succesfully doing this.
They're independent of each other, attached to 2 of the 4 PSCs. I'll try the most obvious path first.
Thanks!
Manuel Lauss