aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-pxa/include/mach/audio.h3
-rw-r--r--include/sound/ac97_codec.h3
-rw-r--r--sound/arm/pxa2xx-ac97.c10
-rw-r--r--sound/soc/pxa/pxa2xx-ac97.c12
4 files changed, 27 insertions, 1 deletions
diff --git a/arch/arm/mach-pxa/include/mach/audio.h b/arch/arm/mach-pxa/include/mach/audio.h
index 16eb02552d5d..a3449e35a6f5 100644
--- a/arch/arm/mach-pxa/include/mach/audio.h
+++ b/arch/arm/mach-pxa/include/mach/audio.h
@@ -3,10 +3,12 @@
3 3
4#include <sound/core.h> 4#include <sound/core.h>
5#include <sound/pcm.h> 5#include <sound/pcm.h>
6#include <sound/ac97_codec.h>
6 7
7/* 8/*
8 * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95) 9 * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95)
9 * a -1 value means no gpio will be used for reset 10 * a -1 value means no gpio will be used for reset
11 * @codec_pdata: AC97 codec platform_data
10 12
11 * reset_gpio should only be specified for pxa27x CPUs where a silicon 13 * reset_gpio should only be specified for pxa27x CPUs where a silicon
12 * bug prevents correct operation of the reset line. If not specified, 14 * bug prevents correct operation of the reset line. If not specified,
@@ -20,6 +22,7 @@ typedef struct {
20 void (*resume)(void *); 22 void (*resume)(void *);
21 void *priv; 23 void *priv;
22 int reset_gpio; 24 int reset_gpio;
25 void *codec_pdata[AC97_BUS_MAX_DEVICES];
23} pxa2xx_audio_ops_t; 26} pxa2xx_audio_ops_t;
24 27
25extern void pxa_set_ac97_info(pxa2xx_audio_ops_t *ops); 28extern void pxa_set_ac97_info(pxa2xx_audio_ops_t *ops);
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 9b1c0985480c..3dae3f799b9b 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -32,6 +32,9 @@
32#include "control.h" 32#include "control.h"
33#include "info.h" 33#include "info.h"
34 34
35/* maximum number of devices on the AC97 bus */
36#define AC97_BUS_MAX_DEVICES 4
37
35/* 38/*
36 * AC'97 codec registers 39 * AC'97 codec registers
37 */ 40 */
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)
170 struct snd_ac97_bus *ac97_bus; 170 struct snd_ac97_bus *ac97_bus;
171 struct snd_ac97_template ac97_template; 171 struct snd_ac97_template ac97_template;
172 int ret; 172 int ret;
173 pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
174
175 if (dev->id >= 0) {
176 dev_err(&dev->dev, "PXA2xx has only one AC97 port.\n");
177 ret = -ENXIO;
178 goto err_dev;
179 }
173 180
174 ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, 181 ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
175 THIS_MODULE, 0, &card); 182 THIS_MODULE, 0, &card);
@@ -200,6 +207,8 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
200 snprintf(card->longname, sizeof(card->longname), 207 snprintf(card->longname, sizeof(card->longname),
201 "%s (%s)", dev->dev.driver->name, card->mixername); 208 "%s (%s)", dev->dev.driver->name, card->mixername);
202 209
210 if (pdata && pdata->codec_data)
211 snd_ac97_dev_add_pdata(ac97_bus->codec[0], pdata->codec_pdata);
203 snd_card_set_dev(card, &dev->dev); 212 snd_card_set_dev(card, &dev->dev);
204 ret = snd_card_register(card); 213 ret = snd_card_register(card);
205 if (ret == 0) { 214 if (ret == 0) {
@@ -212,6 +221,7 @@ err_remove:
212err: 221err:
213 if (card) 222 if (card)
214 snd_card_free(card); 223 snd_card_free(card);
224err_dev:
215 return ret; 225 return ret;
216} 226}
217 227
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index d9c94d71fa61..7330e5c5b9df 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -22,6 +22,7 @@
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <mach/regs-ac97.h> 23#include <mach/regs-ac97.h>
24#include <mach/dma.h> 24#include <mach/dma.h>
25#include <mach/audio.h>
25 26
26#include "pxa2xx-pcm.h" 27#include "pxa2xx-pcm.h"
27#include "pxa2xx-ac97.h" 28#include "pxa2xx-ac97.h"
@@ -241,9 +242,18 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops);
241static int __devinit pxa2xx_ac97_dev_probe(struct platform_device *pdev) 242static int __devinit pxa2xx_ac97_dev_probe(struct platform_device *pdev)
242{ 243{
243 int i; 244 int i;
245 pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data;
244 246
245 for (i = 0; i < ARRAY_SIZE(pxa_ac97_dai); i++) 247 if (pdev->id >= 0) {
248 dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n");
249 return -ENXIO;
250 }
251
252 for (i = 0; i < ARRAY_SIZE(pxa_ac97_dai); i++) {
246 pxa_ac97_dai[i].dev = &pdev->dev; 253 pxa_ac97_dai[i].dev = &pdev->dev;
254 if (pdata && pdata->codec_pdata)
255 pxa_ac97_dai[i].ac97_pdata = pdata->codec_pdata;
256 }
247 257
248 /* Punt most of the init to the SoC probe; we may need the machine 258 /* Punt most of the init to the SoC probe; we may need the machine
249 * driver to do interesting things with the clocking to get us up 259 * driver to do interesting things with the clocking to get us up