aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-02-16 15:49:16 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-02-18 06:55:22 -0500
commit5998102b9095fdb7c67755812038612afea315c5 (patch)
tree9b536a80336f526d7a7d206d272527f6789e449e /sound/soc/pxa
parenta8035c8f04477895207b92915b908344749be336 (diff)
ASoC: Refactor WM8731 device registration
Move the WM8731 driver to use a more standard device registration scheme where the device can be registered independantly of the ASoC probe. As a transition measure push the current manual code for registering the WM8731 into the individual machine driver probes. This allows separate patches to update the relevant architecture files with less risk of merge issues. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/pxa')
-rw-r--r--sound/soc/pxa/corgi.c43
-rw-r--r--sound/soc/pxa/poodle.c41
2 files changed, 71 insertions, 13 deletions
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c
index 0d41be33d572..eaa66915a324 100644
--- a/sound/soc/pxa/corgi.c
+++ b/sound/soc/pxa/corgi.c
@@ -317,19 +317,44 @@ static struct snd_soc_card snd_soc_corgi = {
317 .num_links = 1, 317 .num_links = 1,
318}; 318};
319 319
320/* corgi audio private data */
321static struct wm8731_setup_data corgi_wm8731_setup = {
322 .i2c_bus = 0,
323 .i2c_address = 0x1b,
324};
325
326/* corgi audio subsystem */ 320/* corgi audio subsystem */
327static struct snd_soc_device corgi_snd_devdata = { 321static struct snd_soc_device corgi_snd_devdata = {
328 .card = &snd_soc_corgi, 322 .card = &snd_soc_corgi,
329 .codec_dev = &soc_codec_dev_wm8731, 323 .codec_dev = &soc_codec_dev_wm8731,
330 .codec_data = &corgi_wm8731_setup,
331}; 324};
332 325
326/*
327 * FIXME: This is a temporary bodge to avoid cross-tree merge issues.
328 * New drivers should register the wm8731 I2C device in the machine
329 * setup code (under arch/arm for ARM systems).
330 */
331static int wm8731_i2c_register(void)
332{
333 struct i2c_board_info info;
334 struct i2c_adapter *adapter;
335 struct i2c_client *client;
336
337 memset(&info, 0, sizeof(struct i2c_board_info));
338 info.addr = 0x1b;
339 strlcpy(info.type, "wm8731", I2C_NAME_SIZE);
340
341 adapter = i2c_get_adapter(0);
342 if (!adapter) {
343 printk(KERN_ERR "can't get i2c adapter 0\n");
344 return -ENODEV;
345 }
346
347 client = i2c_new_device(adapter, &info);
348 i2c_put_adapter(adapter);
349 if (!client) {
350 printk(KERN_ERR "can't add i2c device at 0x%x\n",
351 (unsigned int)info.addr);
352 return -ENODEV;
353 }
354
355 return 0;
356}
357
333static struct platform_device *corgi_snd_device; 358static struct platform_device *corgi_snd_device;
334 359
335static int __init corgi_init(void) 360static int __init corgi_init(void)
@@ -340,6 +365,10 @@ static int __init corgi_init(void)
340 machine_is_husky())) 365 machine_is_husky()))
341 return -ENODEV; 366 return -ENODEV;
342 367
368 ret = wm8731_i2c_setup();
369 if (ret != 0)
370 return ret;
371
343 corgi_snd_device = platform_device_alloc("soc-audio", -1); 372 corgi_snd_device = platform_device_alloc("soc-audio", -1);
344 if (!corgi_snd_device) 373 if (!corgi_snd_device)
345 return -ENOMEM; 374 return -ENOMEM;
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index 3a62d4354ef6..fd683a0b742d 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -283,17 +283,42 @@ static struct snd_soc_card snd_soc_poodle = {
283 .num_links = 1, 283 .num_links = 1,
284}; 284};
285 285
286/* poodle audio private data */ 286/*
287static struct wm8731_setup_data poodle_wm8731_setup = { 287 * FIXME: This is a temporary bodge to avoid cross-tree merge issues.
288 .i2c_bus = 0, 288 * New drivers should register the wm8731 I2C device in the machine
289 .i2c_address = 0x1b, 289 * setup code (under arch/arm for ARM systems).
290}; 290 */
291static int wm8731_i2c_register(void)
292{
293 struct i2c_board_info info;
294 struct i2c_adapter *adapter;
295 struct i2c_client *client;
296
297 memset(&info, 0, sizeof(struct i2c_board_info));
298 info.addr = 0x1b;
299 strlcpy(info.type, "wm8731", I2C_NAME_SIZE);
300
301 adapter = i2c_get_adapter(0);
302 if (!adapter) {
303 printk(KERN_ERR "can't get i2c adapter 0\n");
304 return -ENODEV;
305 }
306
307 client = i2c_new_device(adapter, &info);
308 i2c_put_adapter(adapter);
309 if (!client) {
310 printk(KERN_ERR "can't add i2c device at 0x%x\n",
311 (unsigned int)info.addr);
312 return -ENODEV;
313 }
314
315 return 0;
316}
291 317
292/* poodle audio subsystem */ 318/* poodle audio subsystem */
293static struct snd_soc_device poodle_snd_devdata = { 319static struct snd_soc_device poodle_snd_devdata = {
294 .card = &snd_soc_poodle, 320 .card = &snd_soc_poodle,
295 .codec_dev = &soc_codec_dev_wm8731, 321 .codec_dev = &soc_codec_dev_wm8731,
296 .codec_data = &poodle_wm8731_setup,
297}; 322};
298 323
299static struct platform_device *poodle_snd_device; 324static struct platform_device *poodle_snd_device;
@@ -305,6 +330,10 @@ static int __init poodle_init(void)
305 if (!machine_is_poodle()) 330 if (!machine_is_poodle())
306 return -ENODEV; 331 return -ENODEV;
307 332
333 ret = wm8731_i2c_setup();
334 if (ret != 0)
335 return ret;
336
308 locomo_gpio_set_dir(&poodle_locomo_device.dev, 337 locomo_gpio_set_dir(&poodle_locomo_device.dev,
309 POODLE_LOCOMO_GPIO_AMP_ON, 0); 338 POODLE_LOCOMO_GPIO_AMP_ON, 0);
310 /* should we mute HP at startup - burning power ?*/ 339 /* should we mute HP at startup - burning power ?*/