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>

authored by Dmitry Baryshkov and committed by Takashi Iwai 6e5ea701 20f5f95d

+39 -1
+39 -1
sound/soc/pxa/pxa2xx-i2s.c
··· 16 16 #include <linux/device.h> 17 17 #include <linux/delay.h> 18 18 #include <linux/clk.h> 19 + #include <linux/platform_device.h> 19 20 #include <sound/core.h> 20 21 #include <sound/pcm.h> 21 22 #include <sound/initval.h> ··· 82 81 struct snd_soc_pcm_runtime *rtd = substream->private_data; 83 82 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 84 83 85 - clk_i2s = clk_get(NULL, "I2SCLK"); 86 84 if (IS_ERR(clk_i2s)) 87 85 return PTR_ERR(clk_i2s); 88 86 ··· 152 152 pxa_gpio_mode(gpio_bus[pxa_i2s.master].tx); 153 153 pxa_gpio_mode(gpio_bus[pxa_i2s.master].frm); 154 154 pxa_gpio_mode(gpio_bus[pxa_i2s.master].clk); 155 + BUG_ON(IS_ERR(clk_i2s)); 155 156 clk_enable(clk_i2s); 156 157 pxa_i2s_wait(); 157 158 ··· 317 316 }; 318 317 319 318 EXPORT_SYMBOL_GPL(pxa_i2s_dai); 319 + 320 + static int pxa2xx_i2s_probe(struct platform_device *dev) 321 + { 322 + clk_i2s = clk_get(&dev->dev, "I2SCLK"); 323 + return IS_ERR(clk_i2s) ? PTR_ERR(clk_i2s) : 0; 324 + } 325 + 326 + static int __devexit pxa2xx_i2s_remove(struct platform_device *dev) 327 + { 328 + clk_put(clk_i2s); 329 + clk_i2s = ERR_PTR(-ENOENT); 330 + return 0; 331 + } 332 + 333 + static struct platform_driver pxa2xx_i2s_driver = { 334 + .probe = pxa2xx_i2s_probe, 335 + .remove = __devexit_p(pxa2xx_i2s_remove), 336 + 337 + .driver = { 338 + .name = "pxa2xx-i2s", 339 + .owner = THIS_MODULE, 340 + }, 341 + }; 342 + 343 + static int __init pxa2xx_i2s_init(void) 344 + { 345 + clk_i2s = ERR_PTR(-ENOENT); 346 + return platform_driver_register(&pxa2xx_i2s_driver); 347 + } 348 + 349 + static void __exit pxa2xx_i2s_exit(void) 350 + { 351 + platform_driver_unregister(&pxa2xx_i2s_driver); 352 + } 353 + 354 + module_init(pxa2xx_i2s_init); 355 + module_exit(pxa2xx_i2s_exit); 320 356 321 357 /* Module information */ 322 358 MODULE_AUTHOR("Liam Girdwood, liam.girdwood@wolfsonmicro.com, www.wolfsonmicro.com");