diff options
author | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2008-08-30 16:45:02 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-09-01 02:34:46 -0400 |
commit | 6e5ea7015c62b672020ee0a7c2764942fe63fa25 (patch) | |
tree | a5302ce6e74c68f3bc9cb5ae92e7d25e3a7622db /sound | |
parent | 20f5f95ded9cdab62c26efb146967a75e12533ec (diff) |
ALSA: ASoC: fix pxa2xx-i2s clk_get call
pxa2xx-i2s: probe actual device and use it for clk_get call
thus fixing error during startup hook
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/pxa/pxa2xx-i2s.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index 8548818eea08..c796b1882776 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
19 | #include <linux/platform_device.h> | ||
19 | #include <sound/core.h> | 20 | #include <sound/core.h> |
20 | #include <sound/pcm.h> | 21 | #include <sound/pcm.h> |
21 | #include <sound/initval.h> | 22 | #include <sound/initval.h> |
@@ -81,7 +82,6 @@ static int pxa2xx_i2s_startup(struct snd_pcm_substream *substream) | |||
81 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 82 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
82 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 83 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
83 | 84 | ||
84 | clk_i2s = clk_get(NULL, "I2SCLK"); | ||
85 | if (IS_ERR(clk_i2s)) | 85 | if (IS_ERR(clk_i2s)) |
86 | return PTR_ERR(clk_i2s); | 86 | return PTR_ERR(clk_i2s); |
87 | 87 | ||
@@ -152,6 +152,7 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
152 | pxa_gpio_mode(gpio_bus[pxa_i2s.master].tx); | 152 | pxa_gpio_mode(gpio_bus[pxa_i2s.master].tx); |
153 | pxa_gpio_mode(gpio_bus[pxa_i2s.master].frm); | 153 | pxa_gpio_mode(gpio_bus[pxa_i2s.master].frm); |
154 | pxa_gpio_mode(gpio_bus[pxa_i2s.master].clk); | 154 | pxa_gpio_mode(gpio_bus[pxa_i2s.master].clk); |
155 | BUG_ON(IS_ERR(clk_i2s)); | ||
155 | clk_enable(clk_i2s); | 156 | clk_enable(clk_i2s); |
156 | pxa_i2s_wait(); | 157 | pxa_i2s_wait(); |
157 | 158 | ||
@@ -317,6 +318,43 @@ struct snd_soc_dai pxa_i2s_dai = { | |||
317 | 318 | ||
318 | EXPORT_SYMBOL_GPL(pxa_i2s_dai); | 319 | EXPORT_SYMBOL_GPL(pxa_i2s_dai); |
319 | 320 | ||
321 | static int pxa2xx_i2s_probe(struct platform_device *dev) | ||
322 | { | ||
323 | clk_i2s = clk_get(&dev->dev, "I2SCLK"); | ||
324 | return IS_ERR(clk_i2s) ? PTR_ERR(clk_i2s) : 0; | ||
325 | } | ||
326 | |||
327 | static int __devexit pxa2xx_i2s_remove(struct platform_device *dev) | ||
328 | { | ||
329 | clk_put(clk_i2s); | ||
330 | clk_i2s = ERR_PTR(-ENOENT); | ||
331 | return 0; | ||
332 | } | ||
333 | |||
334 | static struct platform_driver pxa2xx_i2s_driver = { | ||
335 | .probe = pxa2xx_i2s_probe, | ||
336 | .remove = __devexit_p(pxa2xx_i2s_remove), | ||
337 | |||
338 | .driver = { | ||
339 | .name = "pxa2xx-i2s", | ||
340 | .owner = THIS_MODULE, | ||
341 | }, | ||
342 | }; | ||
343 | |||
344 | static int __init pxa2xx_i2s_init(void) | ||
345 | { | ||
346 | clk_i2s = ERR_PTR(-ENOENT); | ||
347 | return platform_driver_register(&pxa2xx_i2s_driver); | ||
348 | } | ||
349 | |||
350 | static void __exit pxa2xx_i2s_exit(void) | ||
351 | { | ||
352 | platform_driver_unregister(&pxa2xx_i2s_driver); | ||
353 | } | ||
354 | |||
355 | module_init(pxa2xx_i2s_init); | ||
356 | module_exit(pxa2xx_i2s_exit); | ||
357 | |||
320 | /* Module information */ | 358 | /* Module information */ |
321 | MODULE_AUTHOR("Liam Girdwood, liam.girdwood@wolfsonmicro.com, www.wolfsonmicro.com"); | 359 | MODULE_AUTHOR("Liam Girdwood, liam.girdwood@wolfsonmicro.com, www.wolfsonmicro.com"); |
322 | MODULE_DESCRIPTION("pxa2xx I2S SoC Interface"); | 360 | MODULE_DESCRIPTION("pxa2xx I2S SoC Interface"); |