diff options
author | Marek Vasut <marek.vasut@gmail.com> | 2010-04-08 14:48:51 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-04-09 07:17:42 -0400 |
commit | 6ca0c22ef8a4e988e2487d25964d55e6c37c5785 (patch) | |
tree | 81d76373c822209b0e69559a472cf5ca9f2c239d /sound/soc/pxa | |
parent | 53a61d967a480307db4c8f7950ddb8bb1a0fda9b (diff) |
ASoC: WM8750: Convert to new API
Register the WM8750 as a SPI or I2C device. This patch mostly shuffles code
around. Hugely inspired by WM8753 which was already converted.
Also, this patch fixes the Jive and Spitz machine.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/pxa')
-rw-r--r-- | sound/soc/pxa/spitz.c | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index c4cd2acaacb4..1941a357e8c4 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c | |||
@@ -322,19 +322,44 @@ static struct snd_soc_card snd_soc_spitz = { | |||
322 | .num_links = 1, | 322 | .num_links = 1, |
323 | }; | 323 | }; |
324 | 324 | ||
325 | /* spitz audio private data */ | ||
326 | static struct wm8750_setup_data spitz_wm8750_setup = { | ||
327 | .i2c_bus = 0, | ||
328 | .i2c_address = 0x1b, | ||
329 | }; | ||
330 | |||
331 | /* spitz audio subsystem */ | 325 | /* spitz audio subsystem */ |
332 | static struct snd_soc_device spitz_snd_devdata = { | 326 | static struct snd_soc_device spitz_snd_devdata = { |
333 | .card = &snd_soc_spitz, | 327 | .card = &snd_soc_spitz, |
334 | .codec_dev = &soc_codec_dev_wm8750, | 328 | .codec_dev = &soc_codec_dev_wm8750, |
335 | .codec_data = &spitz_wm8750_setup, | ||
336 | }; | 329 | }; |
337 | 330 | ||
331 | /* | ||
332 | * FIXME: This is a temporary bodge to avoid cross-tree merge issues. | ||
333 | * New drivers should register the wm8750 I2C device in the machine | ||
334 | * setup code (under arch/arm for ARM systems). | ||
335 | */ | ||
336 | static int wm8750_i2c_register(void) | ||
337 | { | ||
338 | struct i2c_board_info info; | ||
339 | struct i2c_adapter *adapter; | ||
340 | struct i2c_client *client; | ||
341 | |||
342 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
343 | info.addr = 0x1b; | ||
344 | strlcpy(info.type, "wm8750", I2C_NAME_SIZE); | ||
345 | |||
346 | adapter = i2c_get_adapter(0); | ||
347 | if (!adapter) { | ||
348 | printk(KERN_ERR "can't get i2c adapter 0\n"); | ||
349 | return -ENODEV; | ||
350 | } | ||
351 | |||
352 | client = i2c_new_device(adapter, &info); | ||
353 | i2c_put_adapter(adapter); | ||
354 | if (!client) { | ||
355 | printk(KERN_ERR "can't add i2c device at 0x%x\n", | ||
356 | (unsigned int)info.addr); | ||
357 | return -ENODEV; | ||
358 | } | ||
359 | |||
360 | return 0; | ||
361 | } | ||
362 | |||
338 | static struct platform_device *spitz_snd_device; | 363 | static struct platform_device *spitz_snd_device; |
339 | 364 | ||
340 | static int __init spitz_init(void) | 365 | static int __init spitz_init(void) |
@@ -344,6 +369,10 @@ static int __init spitz_init(void) | |||
344 | if (!(machine_is_spitz() || machine_is_borzoi() || machine_is_akita())) | 369 | if (!(machine_is_spitz() || machine_is_borzoi() || machine_is_akita())) |
345 | return -ENODEV; | 370 | return -ENODEV; |
346 | 371 | ||
372 | ret = wm8750_i2c_setup(); | ||
373 | if (ret != 0) | ||
374 | return ret; | ||
375 | |||
347 | spitz_snd_device = platform_device_alloc("soc-audio", -1); | 376 | spitz_snd_device = platform_device_alloc("soc-audio", -1); |
348 | if (!spitz_snd_device) | 377 | if (!spitz_snd_device) |
349 | return -ENOMEM; | 378 | return -ENOMEM; |