blob: cf91f2a6de1bfc3bafb451ac8b7b6c059d3574f3 [file] [log] [blame]
Meng Wang43bbb872018-12-10 12:32:05 +08001// SPDX-License-Identifier: GPL-2.0-only
Xiaojun Sang53cd13a2018-06-29 15:14:37 +08002/* Copyright (c) 2011-2014, 2017-2019 The Linux Foundation. All rights reserved.
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303 */
4#include <linux/platform_device.h>
5#include <linux/slab.h>
6#include <linux/module.h>
7#include <linux/of_device.h>
8#include <sound/core.h>
9#include <sound/pcm.h>
10#include <sound/soc.h>
11
Meng Wang15c825d2018-09-06 10:49:18 +080012#define DRV_NAME "msm-stub-codec"
13
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053014/* A dummy driver useful only to advertise hardware parameters */
15static struct snd_soc_dai_driver msm_stub_dais[] = {
16 {
17 .name = "msm-stub-rx",
18 .playback = { /* Support maximum range */
19 .stream_name = "Playback",
20 .channels_min = 1,
21 .channels_max = 8,
22 .rates = SNDRV_PCM_RATE_8000_48000,
23 .formats = SNDRV_PCM_FMTBIT_S16_LE,
24 },
25 },
26 {
27 .name = "msm-stub-tx",
28 .capture = { /* Support maximum range */
29 .stream_name = "Record",
30 .channels_min = 1,
31 .channels_max = 8,
32 .rates = SNDRV_PCM_RATE_8000_48000,
33 .formats = (SNDRV_PCM_FMTBIT_S16_LE |
34 SNDRV_PCM_FMTBIT_S24_LE),
35 },
36 },
37};
38
Meng Wang15c825d2018-09-06 10:49:18 +080039static const struct snd_soc_component_driver soc_msm_stub = {
40 .name = DRV_NAME,
41};
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053042
43static int msm_stub_dev_probe(struct platform_device *pdev)
44{
45 dev_dbg(&pdev->dev, "dev name %s\n", dev_name(&pdev->dev));
46
Meng Wang15c825d2018-09-06 10:49:18 +080047 return snd_soc_register_component(&pdev->dev,
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053048 &soc_msm_stub, msm_stub_dais, ARRAY_SIZE(msm_stub_dais));
49}
50
51static int msm_stub_dev_remove(struct platform_device *pdev)
52{
Meng Wang15c825d2018-09-06 10:49:18 +080053 snd_soc_unregister_component(&pdev->dev);
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053054 return 0;
55}
56static const struct of_device_id msm_stub_codec_dt_match[] = {
57 { .compatible = "qcom,msm-stub-codec", },
58 {}
59};
60
61static struct platform_driver msm_stub_driver = {
62 .driver = {
63 .name = "msm-stub-codec",
64 .owner = THIS_MODULE,
65 .of_match_table = msm_stub_codec_dt_match,
Xiaojun Sang53cd13a2018-06-29 15:14:37 +080066 .suppress_bind_attrs = true,
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053067 },
68 .probe = msm_stub_dev_probe,
69 .remove = msm_stub_dev_remove,
70};
71
72static int __init msm_stub_init(void)
73{
74 return platform_driver_register(&msm_stub_driver);
75}
76module_init(msm_stub_init);
77
78static void __exit msm_stub_exit(void)
79{
80 platform_driver_unregister(&msm_stub_driver);
81}
82module_exit(msm_stub_exit);
83
84MODULE_DESCRIPTION("Generic MSM CODEC driver");
85MODULE_LICENSE("GPL v2");