blob: 68e55ae1da16d1c618204d47bc5bfea2e04275e9 [file] [log] [blame]
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05301/* Copyright (c) 2011-2014, 2017 The Linux Foundation. All rights reserved.
2 *
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>
14#include <linux/module.h>
15#include <linux/of_device.h>
16#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,
37 .channels_max = 8,
38 .rates = SNDRV_PCM_RATE_8000_48000,
39 .formats = (SNDRV_PCM_FMTBIT_S16_LE |
40 SNDRV_PCM_FMTBIT_S24_LE),
41 },
42 },
43};
44
45static struct snd_soc_codec_driver soc_msm_stub = {};
46
47static int msm_stub_dev_probe(struct platform_device *pdev)
48{
49 dev_dbg(&pdev->dev, "dev name %s\n", dev_name(&pdev->dev));
50
51 return snd_soc_register_codec(&pdev->dev,
52 &soc_msm_stub, msm_stub_dais, ARRAY_SIZE(msm_stub_dais));
53}
54
55static int msm_stub_dev_remove(struct platform_device *pdev)
56{
57 snd_soc_unregister_codec(&pdev->dev);
58 return 0;
59}
60static const struct of_device_id msm_stub_codec_dt_match[] = {
61 { .compatible = "qcom,msm-stub-codec", },
62 {}
63};
64
65static struct platform_driver msm_stub_driver = {
66 .driver = {
67 .name = "msm-stub-codec",
68 .owner = THIS_MODULE,
69 .of_match_table = msm_stub_codec_dt_match,
70 },
71 .probe = msm_stub_dev_probe,
72 .remove = msm_stub_dev_remove,
73};
74
75static int __init msm_stub_init(void)
76{
77 return platform_driver_register(&msm_stub_driver);
78}
79module_init(msm_stub_init);
80
81static void __exit msm_stub_exit(void)
82{
83 platform_driver_unregister(&msm_stub_driver);
84}
85module_exit(msm_stub_exit);
86
87MODULE_DESCRIPTION("Generic MSM CODEC driver");
88MODULE_LICENSE("GPL v2");