blob: 0cbcaf3d1e83c601ecd98c4aabc2d3f0f11f146a [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12#include <linux/platform_device.h>
13#include <linux/slab.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070014#include <linux/module.h>
Phani Kumar Uppalapati87841c82012-06-14 21:28:43 -070015#include <linux/of_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070016#include <sound/core.h>
17#include <sound/pcm.h>
18#include <sound/soc.h>
19
20/* A dummy driver useful only to advertise hardware parameters */
21static struct snd_soc_dai_driver msm_stub_dais[] = {
22 {
23 .name = "msm-stub-rx",
24 .playback = { /* Support maximum range */
25 .stream_name = "Playback",
26 .channels_min = 1,
27 .channels_max = 8,
28 .rates = SNDRV_PCM_RATE_8000_48000,
29 .formats = SNDRV_PCM_FMTBIT_S16_LE,
30 },
31 },
32 {
33 .name = "msm-stub-tx",
34 .capture = { /* Support maximum range */
35 .stream_name = "Record",
36 .channels_min = 1,
Phani Kumar Uppalapati5d26c9f2012-11-12 19:43:24 -080037 .channels_max = 8,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070038 .rates = SNDRV_PCM_RATE_8000_48000,
39 .formats = SNDRV_PCM_FMTBIT_S16_LE,
40 },
Steve Mucklef132c6c2012-06-06 18:30:57 -070041 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042};
43
44static struct snd_soc_codec_driver soc_msm_stub = {};
45
46static int __devinit msm_stub_dev_probe(struct platform_device *pdev)
47{
Phani Kumar Uppalapati87841c82012-06-14 21:28:43 -070048 if (pdev->dev.of_node)
49 dev_set_name(&pdev->dev, "%s.%d", "msm-stub-codec", 1);
50
51 dev_dbg(&pdev->dev, "dev name %s\n", dev_name(&pdev->dev));
52
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070053 return snd_soc_register_codec(&pdev->dev,
54 &soc_msm_stub, msm_stub_dais, ARRAY_SIZE(msm_stub_dais));
55}
56
57static int __devexit msm_stub_dev_remove(struct platform_device *pdev)
58{
59 snd_soc_unregister_codec(&pdev->dev);
60 return 0;
61}
Phani Kumar Uppalapati87841c82012-06-14 21:28:43 -070062static const struct of_device_id msm_stub_codec_dt_match[] = {
63 { .compatible = "qcom,msm-stub-codec", },
64 {}
65};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070066
67static struct platform_driver msm_stub_driver = {
68 .driver = {
69 .name = "msm-stub-codec",
70 .owner = THIS_MODULE,
Phani Kumar Uppalapati87841c82012-06-14 21:28:43 -070071 .of_match_table = msm_stub_codec_dt_match,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070072 },
73 .probe = msm_stub_dev_probe,
74 .remove = __devexit_p(msm_stub_dev_remove),
75};
76
77static int __init msm_stub_init(void)
78{
79 return platform_driver_register(&msm_stub_driver);
80}
81module_init(msm_stub_init);
82
83static void __exit msm_stub_exit(void)
84{
85 platform_driver_unregister(&msm_stub_driver);
86}
87module_exit(msm_stub_exit);
88
89MODULE_DESCRIPTION("Generic MSM CODEC driver");
90MODULE_VERSION("1.0");
91MODULE_LICENSE("GPL v2");