aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa/poodle.c
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/poodle.c
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/poodle.c')
-rw-r--r--sound/soc/pxa/poodle.c41
1 files changed, 35 insertions, 6 deletions
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 ?*/