diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-02-16 15:49:16 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-02-18 06:55:22 -0500 |
commit | 5998102b9095fdb7c67755812038612afea315c5 (patch) | |
tree | 9b536a80336f526d7a7d206d272527f6789e449e /sound/soc/pxa/corgi.c | |
parent | a8035c8f04477895207b92915b908344749be336 (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/corgi.c')
-rw-r--r-- | sound/soc/pxa/corgi.c | 43 |
1 files changed, 36 insertions, 7 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 */ | ||
321 | static 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 */ |
327 | static struct snd_soc_device corgi_snd_devdata = { | 321 | static 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 | */ | ||
331 | static 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 | |||
333 | static struct platform_device *corgi_snd_device; | 358 | static struct platform_device *corgi_snd_device; |
334 | 359 | ||
335 | static int __init corgi_init(void) | 360 | static 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; |