diff options
author | Ola Lilja <ola.o.lilja@stericsson.com> | 2012-06-12 02:50:08 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-17 15:46:12 -0400 |
commit | e0690385a86cac5403a62d91dc146f2508416ded (patch) | |
tree | 05a1e5b22c404f0dab9dc963f18fa9ea96b6bfd9 /sound/soc/ux500/mop500.c | |
parent | 62ae68fa5d6d6f93d8ca8d00e21ad7ac410f9d58 (diff) |
ASoC: Ux500: Add machine-driver
Add machine-driver for ST-Ericsson U8500 platform, including
support for the AB8500-codec.
Signed-off-by: Ola Lilja <ola.o.lilja@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/ux500/mop500.c')
-rw-r--r-- | sound/soc/ux500/mop500.c | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c new file mode 100644 index 000000000000..31c4d26d0359 --- /dev/null +++ b/sound/soc/ux500/mop500.c | |||
@@ -0,0 +1,113 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2012 | ||
3 | * | ||
4 | * Author: Ola Lilja (ola.o.lilja@stericsson.com) | ||
5 | * for ST-Ericsson. | ||
6 | * | ||
7 | * License terms: | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as published | ||
11 | * by the Free Software Foundation. | ||
12 | */ | ||
13 | |||
14 | #include <asm/mach-types.h> | ||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/spi/spi.h> | ||
19 | |||
20 | #include <sound/soc.h> | ||
21 | #include <sound/initval.h> | ||
22 | |||
23 | #include "ux500_pcm.h" | ||
24 | #include "ux500_msp_dai.h" | ||
25 | |||
26 | #include <mop500_ab8500.h> | ||
27 | |||
28 | /* Define the whole MOP500 soundcard, linking platform to the codec-drivers */ | ||
29 | struct snd_soc_dai_link mop500_dai_links[] = { | ||
30 | { | ||
31 | .name = "ab8500_0", | ||
32 | .stream_name = "ab8500_0", | ||
33 | .cpu_dai_name = "ux500-msp-i2s.1", | ||
34 | .codec_dai_name = "ab8500-codec-dai.0", | ||
35 | .platform_name = "ux500-pcm.0", | ||
36 | .codec_name = "ab8500-codec.0", | ||
37 | .init = mop500_ab8500_machine_init, | ||
38 | .ops = mop500_ab8500_ops, | ||
39 | }, | ||
40 | { | ||
41 | .name = "ab8500_1", | ||
42 | .stream_name = "ab8500_1", | ||
43 | .cpu_dai_name = "ux500-msp-i2s.3", | ||
44 | .codec_dai_name = "ab8500-codec-dai.1", | ||
45 | .platform_name = "ux500-pcm.0", | ||
46 | .codec_name = "ab8500-codec.0", | ||
47 | .init = NULL, | ||
48 | .ops = mop500_ab8500_ops, | ||
49 | }, | ||
50 | }; | ||
51 | |||
52 | static struct snd_soc_card mop500_card = { | ||
53 | .name = "MOP500-card", | ||
54 | .probe = NULL, | ||
55 | .dai_link = mop500_dai_links, | ||
56 | .num_links = ARRAY_SIZE(mop500_dai_links), | ||
57 | }; | ||
58 | |||
59 | static int __devinit mop500_probe(struct platform_device *pdev) | ||
60 | { | ||
61 | int ret; | ||
62 | |||
63 | pr_debug("%s: Enter.\n", __func__); | ||
64 | |||
65 | dev_dbg(&pdev->dev, "%s: Enter.\n", __func__); | ||
66 | |||
67 | mop500_card.dev = &pdev->dev; | ||
68 | |||
69 | dev_dbg(&pdev->dev, "%s: Card %s: Set platform drvdata.\n", | ||
70 | __func__, mop500_card.name); | ||
71 | platform_set_drvdata(pdev, &mop500_card); | ||
72 | |||
73 | snd_soc_card_set_drvdata(&mop500_card, NULL); | ||
74 | |||
75 | dev_dbg(&pdev->dev, "%s: Card %s: num_links = %d\n", | ||
76 | __func__, mop500_card.name, mop500_card.num_links); | ||
77 | dev_dbg(&pdev->dev, "%s: Card %s: DAI-link 0: name = %s\n", | ||
78 | __func__, mop500_card.name, mop500_card.dai_link[0].name); | ||
79 | dev_dbg(&pdev->dev, "%s: Card %s: DAI-link 0: stream_name = %s\n", | ||
80 | __func__, mop500_card.name, | ||
81 | mop500_card.dai_link[0].stream_name); | ||
82 | |||
83 | ret = snd_soc_register_card(&mop500_card); | ||
84 | if (ret) | ||
85 | dev_err(&pdev->dev, | ||
86 | "Error: snd_soc_register_card failed (%d)!\n", | ||
87 | ret); | ||
88 | |||
89 | return ret; | ||
90 | } | ||
91 | |||
92 | static int __devexit mop500_remove(struct platform_device *pdev) | ||
93 | { | ||
94 | struct snd_soc_card *mop500_card = platform_get_drvdata(pdev); | ||
95 | |||
96 | pr_debug("%s: Enter.\n", __func__); | ||
97 | |||
98 | snd_soc_unregister_card(mop500_card); | ||
99 | mop500_ab8500_remove(mop500_card); | ||
100 | |||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static struct platform_driver snd_soc_mop500_driver = { | ||
105 | .driver = { | ||
106 | .owner = THIS_MODULE, | ||
107 | .name = "snd-soc-mop500", | ||
108 | }, | ||
109 | .probe = mop500_probe, | ||
110 | .remove = __devexit_p(mop500_remove), | ||
111 | }; | ||
112 | |||
113 | module_platform_driver(snd_soc_mop500_driver); | ||