summaryrefslogtreecommitdiff
path: root/sound/arm
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2009-07-30 04:55:01 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-08-14 01:19:37 +0400
commit4ac0478f2afaf8e778b4190d6218459a9dbf2a8f (patch)
tree97caf69480c6fcf9a3d294e650a7548f137e5d44 /sound/arm
parent30230f4cd7c002a40c13758d12c1c6d96100461d (diff)
downloadlinux-4ac0478f2afaf8e778b4190d6218459a9dbf2a8f.tar.xz
ALSA: Allow passing platform_data for pxa2xx-ac97
This patch adds support for passing platform data to ac97 bus devices from PXA2xx-AC97 driver.. Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/arm')
-rw-r--r--sound/arm/pxa2xx-ac97.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index c570ebd9d177..6c00ea45d5cb 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -170,6 +170,13 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
struct snd_ac97_bus *ac97_bus;
struct snd_ac97_template ac97_template;
int ret;
+ pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
+
+ if (dev->id >= 0) {
+ dev_err(&dev->dev, "PXA2xx has only one AC97 port.\n");
+ ret = -ENXIO;
+ goto err_dev;
+ }
ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, 0, &card);
@@ -200,6 +207,8 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
snprintf(card->longname, sizeof(card->longname),
"%s (%s)", dev->dev.driver->name, card->mixername);
+ if (pdata && pdata->codec_data)
+ snd_ac97_dev_add_pdata(ac97_bus->codec[0], pdata->codec_pdata);
snd_card_set_dev(card, &dev->dev);
ret = snd_card_register(card);
if (ret == 0) {
@@ -212,6 +221,7 @@ err_remove:
err:
if (card)
snd_card_free(card);
+err_dev:
return ret;
}