blob: 8130f071443fbfa49c78a669f7e6db59d9be6009 [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) 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 "msm8x60-pcm.h"
34
35static struct snd_soc_dai_driver msm_pcm_codec_dais[] = {
36{
37 .name = "msm-codec-dai",
38 .playback = {
39 .channels_max = 2,
40 .rates = SNDRV_PCM_RATE_8000_48000,
41 .rate_min = 8000,
42 .rate_max = 48000,
43 .formats = SNDRV_PCM_FMTBIT_S16_LE,
44 },
45 .capture = {
46 .channels_max = 2,
47 .rate_min = 8000,
48 .rates = SNDRV_PCM_RATE_8000_48000,
49 .formats = SNDRV_PCM_FMTBIT_S16_LE,
50 },
51},
52};
53static struct snd_soc_dai_driver msm_pcm_cpu_dais[] = {
54{
55 .name = "msm-cpu-dai",
56 .playback = {
57 .channels_min = 1,
58 .channels_max = 2,
59 .rates = SNDRV_PCM_RATE_8000_48000,
60 .rate_min = 8000,
61 .rate_max = 48000,
62 .formats = SNDRV_PCM_FMTBIT_S16_LE,
63 },
64 .capture = {
65 .channels_min = 1,
66 .channels_max = 2,
67 .rate_min = 8000,
68 .rates = SNDRV_PCM_RATE_8000_48000,
69 .formats = SNDRV_PCM_FMTBIT_S16_LE,
70 },
71},
72};
73
74static struct snd_soc_codec_driver soc_codec_dev_msm = {
75 .compress_type = SND_SOC_FLAT_COMPRESSION,
76};
77
78static __devinit int asoc_msm_codec_probe(struct platform_device *pdev)
79{
80 dev_info(&pdev->dev, "%s: dev name %s\n", __func__, dev_name(&pdev->dev));
81 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_msm,
82 msm_pcm_codec_dais, ARRAY_SIZE(msm_pcm_codec_dais));
83}
84
85static int __devexit asoc_msm_codec_remove(struct platform_device *pdev)
86{
87 snd_soc_unregister_dai(&pdev->dev);
88 return 0;
89}
90
91static __devinit int asoc_msm_cpu_probe(struct platform_device *pdev)
92{
93 dev_info(&pdev->dev, "%s: dev name %s\n", __func__, dev_name(&pdev->dev));
94 return snd_soc_register_dai(&pdev->dev, msm_pcm_cpu_dais);
95}
96
97static int __devexit asoc_msm_cpu_remove(struct platform_device *pdev)
98{
99 snd_soc_unregister_dai(&pdev->dev);
100 return 0;
101}
102
103static struct platform_driver asoc_msm_codec_driver = {
104 .probe = asoc_msm_codec_probe,
105 .remove = __devexit_p(asoc_msm_codec_remove),
106 .driver = {
107 .name = "msm-codec-dai",
108 .owner = THIS_MODULE,
109 },
110};
111
112static struct platform_driver asoc_msm_cpu_driver = {
113 .probe = asoc_msm_cpu_probe,
114 .remove = __devexit_p(asoc_msm_cpu_remove),
115 .driver = {
116 .name = "msm-cpu-dai",
117 .owner = THIS_MODULE,
118 },
119};
120
121static int __init msm_codec_dai_init(void)
122{
123 return platform_driver_register(&asoc_msm_codec_driver);
124}
125
126static void __exit msm_codec_dai_exit(void)
127{
128 platform_driver_unregister(&asoc_msm_codec_driver);
129}
130
131static int __init msm_cpu_dai_init(void)
132{
133 return platform_driver_register(&asoc_msm_cpu_driver);
134}
135
136static void __exit msm_cpu_dai_exit(void)
137{
138 platform_driver_unregister(&asoc_msm_cpu_driver);
139}
140
141module_init(msm_codec_dai_init);
142module_exit(msm_codec_dai_exit);
143module_init(msm_cpu_dai_init);
144module_exit(msm_cpu_dai_exit);
145
146/* Module information */
147MODULE_DESCRIPTION("MSM Codec/Cpu Dai driver");
148MODULE_LICENSE("GPL v2");