blob: e8d51ac955284ab4c6c3691837def84fe0be01e5 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* sound/soc/msm/msm-dai.c
2 *
3 * Copyright (C) 2008 Google, Inc.
4 * Copyright (C) 2008 HTC Corporation
5 * Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved.
6 *
7 * Derived from msm-pcm.c and msm7201.c.
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 * See the GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you can find it at http://www.fsf.org.
20 */
21
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/device.h>
25#include <linux/delay.h>
26#include <linux/clk.h>
27#include <linux/platform_device.h>
28#include <linux/slab.h>
29#include <sound/core.h>
30#include <sound/pcm.h>
31#include <sound/initval.h>
32#include <sound/soc.h>
33#include <linux/slab.h>
34#include "msm7kv2-pcm.h"
35
36static struct snd_soc_dai_driver msm_pcm_codec_dais[] = {
37{
38 .name = "msm-codec-dai",
39 .playback = {
40 .channels_max = USE_CHANNELS_MAX,
41 .rate_min = USE_RATE_MIN,
42 .rate_max = USE_RATE_MAX,
43 .rates = SNDRV_PCM_RATE_8000_48000,
44 .formats = SNDRV_PCM_FMTBIT_S16_LE,
45 },
46 .capture = {
47 .channels_max = USE_CHANNELS_MAX,
48 .rate_min = USE_RATE_MIN,
49 .rate_max = USE_RATE_MAX,
50 .rates = SNDRV_PCM_RATE_8000_48000,
51 .formats = SNDRV_PCM_FMTBIT_S16_LE,
52 },
53},
54};
55static struct snd_soc_dai_driver msm_pcm_cpu_dais[] = {
56{
57 .name = "msm-cpu-dai",
58 .playback = {
59 .channels_max = USE_CHANNELS_MAX,
60 .rate_min = USE_RATE_MIN,
61 .rate_max = USE_RATE_MAX,
62 .rates = SNDRV_PCM_RATE_8000_48000,
63 .formats = SNDRV_PCM_FMTBIT_S16_LE,
64 },
65 .capture = {
66 .channels_max = USE_CHANNELS_MAX,
67 .rate_min = USE_RATE_MIN,
68 .rate_max = USE_RATE_MAX,
69 .rates = SNDRV_PCM_RATE_8000_48000,
70 .formats = SNDRV_PCM_FMTBIT_S16_LE,
71 },
72},
73};
74
75static struct snd_soc_codec_driver soc_codec_dev_msm = {
76 .compress_type = SND_SOC_FLAT_COMPRESSION,
77};
78
79static __devinit int asoc_msm_codec_probe(struct platform_device *pdev)
80{
81 dev_info(&pdev->dev, "%s: dev name %s\n", __func__, dev_name(&pdev->dev));
82 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_msm,
83 msm_pcm_codec_dais, ARRAY_SIZE(msm_pcm_codec_dais));
84}
85
86static int __devexit asoc_msm_codec_remove(struct platform_device *pdev)
87{
88 snd_soc_unregister_dai(&pdev->dev);
89 return 0;
90}
91
92static __devinit int asoc_msm_cpu_probe(struct platform_device *pdev)
93{
94 dev_info(&pdev->dev, "%s: dev name %s\n", __func__, dev_name(&pdev->dev));
95 return snd_soc_register_dai(&pdev->dev, msm_pcm_cpu_dais);
96}
97
98static int __devexit asoc_msm_cpu_remove(struct platform_device *pdev)
99{
100 snd_soc_unregister_dai(&pdev->dev);
101 return 0;
102}
103
104static struct platform_driver asoc_msm_codec_driver = {
105 .probe = asoc_msm_codec_probe,
106 .remove = __devexit_p(asoc_msm_codec_remove),
107 .driver = {
108 .name = "msm-codec-dai",
109 .owner = THIS_MODULE,
110 },
111};
112
113static struct platform_driver asoc_msm_cpu_driver = {
114 .probe = asoc_msm_cpu_probe,
115 .remove = __devexit_p(asoc_msm_cpu_remove),
116 .driver = {
117 .name = "msm-cpu-dai",
118 .owner = THIS_MODULE,
119 },
120};
121
122static int __init msm_codec_dai_init(void)
123{
124 return platform_driver_register(&asoc_msm_codec_driver);
125}
126
127static void __exit msm_codec_dai_exit(void)
128{
129 platform_driver_unregister(&asoc_msm_codec_driver);
130}
131
132static int __init msm_cpu_dai_init(void)
133{
134 return platform_driver_register(&asoc_msm_cpu_driver);
135}
136
137static void __exit msm_cpu_dai_exit(void)
138{
139 platform_driver_unregister(&asoc_msm_cpu_driver);
140}
141
142module_init(msm_codec_dai_init);
143module_exit(msm_codec_dai_exit);
144module_init(msm_cpu_dai_init);
145module_exit(msm_cpu_dai_exit);
146
147/* Module information */
148MODULE_DESCRIPTION("MSM Codec/Cpu Dai driver");
149MODULE_LICENSE("GPL v2");