diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2011-03-07 02:04:59 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-03-07 07:20:01 -0500 |
commit | a077ff9034897232ab4208f55880221390bd6877 (patch) | |
tree | 04ff533fc1bd53c69252efc811523f67e2fc9a39 | |
parent | f5c4ffbd65892829f7ec503a89ea24eb0fc952dc (diff) |
ASoC: Add driver for the dfbmcs320 bluetooth module
This patch adds a codec driver for the dfbmcs320 bluetooth module, which is used
on the neo1973 boards.
The patch also modifies the neo1937_wm8753 sound board driver to use the new
driver instead of registering the bluetooth DAI manually.
Previously there was a name mismatch between the bluetooth DAI and the bluetooth
DAI link and the sound card was not instantiated, with this patch the issue is
no longer present and sound support works again.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/codecs/Kconfig | 5 | ||||
-rw-r--r-- | sound/soc/codecs/Makefile | 2 | ||||
-rw-r--r-- | sound/soc/codecs/dfbmcs320.c | 72 | ||||
-rw-r--r-- | sound/soc/samsung/Kconfig | 1 | ||||
-rw-r--r-- | sound/soc/samsung/neo1973_wm8753.c | 35 |
5 files changed, 86 insertions, 29 deletions
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 37035e6984bb..212859cf19aa 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -29,6 +29,7 @@ config SND_SOC_ALL_CODECS | |||
29 | select SND_SOC_CS4271 if SND_SOC_I2C_AND_SPI | 29 | select SND_SOC_CS4271 if SND_SOC_I2C_AND_SPI |
30 | select SND_SOC_CX20442 | 30 | select SND_SOC_CX20442 |
31 | select SND_SOC_DA7210 if I2C | 31 | select SND_SOC_DA7210 if I2C |
32 | select SND_SOC_DFBMCS320 | ||
32 | select SND_SOC_JZ4740_CODEC if SOC_JZ4740 | 33 | select SND_SOC_JZ4740_CODEC if SOC_JZ4740 |
33 | select SND_SOC_MAX98088 if I2C | 34 | select SND_SOC_MAX98088 if I2C |
34 | select SND_SOC_MAX9877 if I2C | 35 | select SND_SOC_MAX9877 if I2C |
@@ -175,6 +176,9 @@ config SND_SOC_L3 | |||
175 | config SND_SOC_DA7210 | 176 | config SND_SOC_DA7210 |
176 | tristate | 177 | tristate |
177 | 178 | ||
179 | config SND_SOC_DFBMCS320 | ||
180 | tristate | ||
181 | |||
178 | config SND_SOC_DMIC | 182 | config SND_SOC_DMIC |
179 | tristate | 183 | tristate |
180 | 184 | ||
@@ -361,4 +365,3 @@ config SND_SOC_WM2000 | |||
361 | 365 | ||
362 | config SND_SOC_WM9090 | 366 | config SND_SOC_WM9090 |
363 | tristate | 367 | tristate |
364 | |||
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 0663d22e86be..ebb059c0eefc 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile | |||
@@ -15,6 +15,7 @@ snd-soc-cs4270-objs := cs4270.o | |||
15 | snd-soc-cs4271-objs := cs4271.o | 15 | snd-soc-cs4271-objs := cs4271.o |
16 | snd-soc-cx20442-objs := cx20442.o | 16 | snd-soc-cx20442-objs := cx20442.o |
17 | snd-soc-da7210-objs := da7210.o | 17 | snd-soc-da7210-objs := da7210.o |
18 | snd-soc-dfbmcs320-objs := dfbmcs320.o | ||
18 | snd-soc-dmic-objs := dmic.o | 19 | snd-soc-dmic-objs := dmic.o |
19 | snd-soc-l3-objs := l3.o | 20 | snd-soc-l3-objs := l3.o |
20 | snd-soc-max98088-objs := max98088.o | 21 | snd-soc-max98088-objs := max98088.o |
@@ -101,6 +102,7 @@ obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o | |||
101 | obj-$(CONFIG_SND_SOC_CS4271) += snd-soc-cs4271.o | 102 | obj-$(CONFIG_SND_SOC_CS4271) += snd-soc-cs4271.o |
102 | obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o | 103 | obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o |
103 | obj-$(CONFIG_SND_SOC_DA7210) += snd-soc-da7210.o | 104 | obj-$(CONFIG_SND_SOC_DA7210) += snd-soc-da7210.o |
105 | obj-$(CONFIG_SND_SOC_DFBMCS320) += snd-soc-dfbmcs320.o | ||
104 | obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o | 106 | obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o |
105 | obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o | 107 | obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o |
106 | obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o | 108 | obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o |
diff --git a/sound/soc/codecs/dfbmcs320.c b/sound/soc/codecs/dfbmcs320.c new file mode 100644 index 000000000000..704bbde65737 --- /dev/null +++ b/sound/soc/codecs/dfbmcs320.c | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Driver for the DFBM-CS320 bluetooth module | ||
3 | * Copyright 2011 Lars-Peter Clausen <lars@metafoo.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #include <linux/init.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | |||
16 | #include <sound/soc.h> | ||
17 | |||
18 | static struct snd_soc_dai_driver dfbmcs320_dai = { | ||
19 | .name = "dfbmcs320-pcm", | ||
20 | .playback = { | ||
21 | .channels_min = 1, | ||
22 | .channels_max = 1, | ||
23 | .rates = SNDRV_PCM_RATE_8000, | ||
24 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
25 | }, | ||
26 | .capture = { | ||
27 | .channels_min = 1, | ||
28 | .channels_max = 1, | ||
29 | .rates = SNDRV_PCM_RATE_8000, | ||
30 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | ||
31 | }, | ||
32 | }; | ||
33 | |||
34 | static struct snd_soc_codec_driver soc_codec_dev_dfbmcs320; | ||
35 | |||
36 | static int __devinit dfbmcs320_probe(struct platform_device *pdev) | ||
37 | { | ||
38 | return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_dfbmcs320, | ||
39 | &dfbmcs320_dai, 1); | ||
40 | } | ||
41 | |||
42 | static int __devexit dfbmcs320_remove(struct platform_device *pdev) | ||
43 | { | ||
44 | snd_soc_unregister_codec(&pdev->dev); | ||
45 | |||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | static struct platform_driver dfmcs320_driver = { | ||
50 | .driver = { | ||
51 | .name = "dfbmcs320", | ||
52 | .owner = THIS_MODULE, | ||
53 | }, | ||
54 | .probe = dfbmcs320_probe, | ||
55 | .remove = __devexit_p(dfbmcs320_remove), | ||
56 | }; | ||
57 | |||
58 | static int __init dfbmcs320_init(void) | ||
59 | { | ||
60 | return platform_driver_register(&dfmcs320_driver); | ||
61 | } | ||
62 | module_init(dfbmcs320_init); | ||
63 | |||
64 | static void __exit dfbmcs320_exit(void) | ||
65 | { | ||
66 | platform_driver_unregister(&dfmcs320_driver); | ||
67 | } | ||
68 | module_exit(dfbmcs320_exit); | ||
69 | |||
70 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); | ||
71 | MODULE_DESCRIPTION("ASoC DFBM-CS320 bluethooth module driver"); | ||
72 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index c3014e821570..a08237acc53b 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig | |||
@@ -40,6 +40,7 @@ config SND_SOC_SAMSUNG_NEO1973_WM8753 | |||
40 | select SND_S3C24XX_I2S | 40 | select SND_S3C24XX_I2S |
41 | select SND_SOC_WM8753 | 41 | select SND_SOC_WM8753 |
42 | select SND_SOC_LM4857 if MACH_NEO1973_GTA01 | 42 | select SND_SOC_LM4857 if MACH_NEO1973_GTA01 |
43 | select SND_SOC_DFBMCS320 | ||
43 | help | 44 | help |
44 | Say Y here to enable audio support for the Openmoko Neo1973 | 45 | Say Y here to enable audio support for the Openmoko Neo1973 |
45 | Smartphones. | 46 | Smartphones. |
diff --git a/sound/soc/samsung/neo1973_wm8753.c b/sound/soc/samsung/neo1973_wm8753.c index 37cfbb8ca39f..78bfdb3f5d7e 100644 --- a/sound/soc/samsung/neo1973_wm8753.c +++ b/sound/soc/samsung/neo1973_wm8753.c | |||
@@ -418,23 +418,6 @@ static int neo1973_lm4857_init(struct snd_soc_dapm_context *dapm) | |||
418 | static int neo1973_lm4857_init(struct snd_soc_dapm_context *dapm) { return 0; }; | 418 | static int neo1973_lm4857_init(struct snd_soc_dapm_context *dapm) { return 0; }; |
419 | #endif | 419 | #endif |
420 | 420 | ||
421 | /* | ||
422 | * BT Codec DAI | ||
423 | */ | ||
424 | static struct snd_soc_dai_driver bt_dai = { | ||
425 | .name = "bluetooth-dai", | ||
426 | .playback = { | ||
427 | .channels_min = 1, | ||
428 | .channels_max = 1, | ||
429 | .rates = SNDRV_PCM_RATE_8000, | ||
430 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | ||
431 | .capture = { | ||
432 | .channels_min = 1, | ||
433 | .channels_max = 1, | ||
434 | .rates = SNDRV_PCM_RATE_8000, | ||
435 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | ||
436 | }; | ||
437 | |||
438 | static struct snd_soc_dai_link neo1973_dai[] = { | 421 | static struct snd_soc_dai_link neo1973_dai[] = { |
439 | { /* Hifi Playback - for similatious use with voice below */ | 422 | { /* Hifi Playback - for similatious use with voice below */ |
440 | .name = "WM8753", | 423 | .name = "WM8753", |
@@ -450,7 +433,7 @@ static struct snd_soc_dai_link neo1973_dai[] = { | |||
450 | .name = "Bluetooth", | 433 | .name = "Bluetooth", |
451 | .stream_name = "Voice", | 434 | .stream_name = "Voice", |
452 | .platform_name = "samsung-audio", | 435 | .platform_name = "samsung-audio", |
453 | .cpu_dai_name = "bluetooth-dai", | 436 | .cpu_dai_name = "dfbmcs320-pcm", |
454 | .codec_dai_name = "wm8753-voice", | 437 | .codec_dai_name = "wm8753-voice", |
455 | .codec_name = "wm8753-codec.0-001a", | 438 | .codec_name = "wm8753-codec.0-001a", |
456 | .ops = &neo1973_voice_ops, | 439 | .ops = &neo1973_voice_ops, |
@@ -459,6 +442,10 @@ static struct snd_soc_dai_link neo1973_dai[] = { | |||
459 | 442 | ||
460 | static struct snd_soc_aux_dev neo1973_aux_devs[] = { | 443 | static struct snd_soc_aux_dev neo1973_aux_devs[] = { |
461 | { | 444 | { |
445 | .name = "dfbmcs320", | ||
446 | .codec_name = "dfbmcs320.0", | ||
447 | }, | ||
448 | { | ||
462 | .name = "lm4857", | 449 | .name = "lm4857", |
463 | .codec_name = "lm4857.0-007c", | 450 | .codec_name = "lm4857.0-007c", |
464 | .init = neo1973_lm4857_init, | 451 | .init = neo1973_lm4857_init, |
@@ -502,7 +489,7 @@ static int __init neo1973_init(void) | |||
502 | 489 | ||
503 | if (machine_is_neo1973_gta02()) { | 490 | if (machine_is_neo1973_gta02()) { |
504 | neo1973.name = "neo1973gta02"; | 491 | neo1973.name = "neo1973gta02"; |
505 | neo1973.num_aux_devs = 0; | 492 | neo1973.num_aux_devs = 1; |
506 | 493 | ||
507 | ret = gpio_request_array(neo1973_gta02_gpios, | 494 | ret = gpio_request_array(neo1973_gta02_gpios, |
508 | ARRAY_SIZE(neo1973_gta02_gpios)); | 495 | ARRAY_SIZE(neo1973_gta02_gpios)); |
@@ -516,21 +503,14 @@ static int __init neo1973_init(void) | |||
516 | goto err_gpio_free; | 503 | goto err_gpio_free; |
517 | } | 504 | } |
518 | 505 | ||
519 | /* register bluetooth DAI here */ | ||
520 | ret = snd_soc_register_dai(&neo1973_snd_device->dev, &bt_dai); | ||
521 | if (ret) | ||
522 | goto err_put_device; | ||
523 | |||
524 | platform_set_drvdata(neo1973_snd_device, &neo1973); | 506 | platform_set_drvdata(neo1973_snd_device, &neo1973); |
525 | ret = platform_device_add(neo1973_snd_device); | 507 | ret = platform_device_add(neo1973_snd_device); |
526 | 508 | ||
527 | if (ret) | 509 | if (ret) |
528 | goto err_unregister_dai; | 510 | goto err_put_device; |
529 | 511 | ||
530 | return 0; | 512 | return 0; |
531 | 513 | ||
532 | err_unregister_dai: | ||
533 | snd_soc_unregister_dai(&neo1973_snd_device->dev); | ||
534 | err_put_device: | 514 | err_put_device: |
535 | platform_device_put(neo1973_snd_device); | 515 | platform_device_put(neo1973_snd_device); |
536 | err_gpio_free: | 516 | err_gpio_free: |
@@ -544,7 +524,6 @@ module_init(neo1973_init); | |||
544 | 524 | ||
545 | static void __exit neo1973_exit(void) | 525 | static void __exit neo1973_exit(void) |
546 | { | 526 | { |
547 | snd_soc_unregister_dai(&neo1973_snd_device->dev); | ||
548 | platform_device_unregister(neo1973_snd_device); | 527 | platform_device_unregister(neo1973_snd_device); |
549 | 528 | ||
550 | if (machine_is_neo1973_gta02()) { | 529 | if (machine_is_neo1973_gta02()) { |