~hui.wang/alsa-driver/dkms-packaging.audiosdw-ppa

« back to all changes in this revision

Viewing changes to buildroot/src/oem-audiosdw-lp1836324-1ubuntu1.3/soc/codecs/bt-sco.c

  • Committer: Hui Wang
  • Date: 2019-12-13 02:41:40 UTC
  • Revision ID: hui.wang@canonical.com-20191213024140-1cprdcbl3122fn85
insert pc-oem-dkms

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// SPDX-License-Identifier: GPL-2.0-or-later
 
2
/*
 
3
 * Driver for generic Bluetooth SCO link
 
4
 * Copyright 2011 Lars-Peter Clausen <lars@metafoo.de>
 
5
 */
 
6
 
 
7
#include <linux/init.h>
 
8
#include <linux/module.h>
 
9
#include <linux/platform_device.h>
 
10
 
 
11
#include <sound/soc.h>
 
12
 
 
13
static const struct snd_soc_dapm_widget bt_sco_widgets[] = {
 
14
        SND_SOC_DAPM_INPUT("RX"),
 
15
        SND_SOC_DAPM_OUTPUT("TX"),
 
16
};
 
17
 
 
18
static const struct snd_soc_dapm_route bt_sco_routes[] = {
 
19
        { "Capture", NULL, "RX" },
 
20
        { "TX", NULL, "Playback" },
 
21
};
 
22
 
 
23
static struct snd_soc_dai_driver bt_sco_dai[] = {
 
24
        {
 
25
                .name = "bt-sco-pcm",
 
26
                .playback = {
 
27
                        .stream_name = "Playback",
 
28
                        .channels_min = 1,
 
29
                        .channels_max = 1,
 
30
                        .rates = SNDRV_PCM_RATE_8000,
 
31
                        .formats = SNDRV_PCM_FMTBIT_S16_LE,
 
32
                },
 
33
                .capture = {
 
34
                         .stream_name = "Capture",
 
35
                        .channels_min = 1,
 
36
                        .channels_max = 1,
 
37
                        .rates = SNDRV_PCM_RATE_8000,
 
38
                        .formats = SNDRV_PCM_FMTBIT_S16_LE,
 
39
                },
 
40
        },
 
41
        {
 
42
                .name = "bt-sco-pcm-wb",
 
43
                .playback = {
 
44
                        .stream_name = "Playback",
 
45
                        .channels_min = 1,
 
46
                        .channels_max = 1,
 
47
                        .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
 
48
                        .formats = SNDRV_PCM_FMTBIT_S16_LE,
 
49
                },
 
50
                .capture = {
 
51
                         .stream_name = "Capture",
 
52
                        .channels_min = 1,
 
53
                        .channels_max = 1,
 
54
                        .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000,
 
55
                        .formats = SNDRV_PCM_FMTBIT_S16_LE,
 
56
                },
 
57
        }
 
58
};
 
59
 
 
60
static const struct snd_soc_component_driver soc_component_dev_bt_sco = {
 
61
        .dapm_widgets           = bt_sco_widgets,
 
62
        .num_dapm_widgets       = ARRAY_SIZE(bt_sco_widgets),
 
63
        .dapm_routes            = bt_sco_routes,
 
64
        .num_dapm_routes        = ARRAY_SIZE(bt_sco_routes),
 
65
        .idle_bias_on           = 1,
 
66
        .use_pmdown_time        = 1,
 
67
        .endianness             = 1,
 
68
        .non_legacy_dai_naming  = 1,
 
69
};
 
70
 
 
71
static int bt_sco_probe(struct platform_device *pdev)
 
72
{
 
73
        return devm_snd_soc_register_component(&pdev->dev,
 
74
                                      &soc_component_dev_bt_sco,
 
75
                                      bt_sco_dai, ARRAY_SIZE(bt_sco_dai));
 
76
}
 
77
 
 
78
static int bt_sco_remove(struct platform_device *pdev)
 
79
{
 
80
        return 0;
 
81
}
 
82
 
 
83
static const struct platform_device_id bt_sco_driver_ids[] = {
 
84
        {
 
85
                .name           = "dfbmcs320",
 
86
        },
 
87
        {
 
88
                .name           = "bt-sco",
 
89
        },
 
90
        {},
 
91
};
 
92
MODULE_DEVICE_TABLE(platform, bt_sco_driver_ids);
 
93
 
 
94
#if defined(CONFIG_OF)
 
95
static const struct of_device_id bt_sco_codec_of_match[] = {
 
96
        { .compatible = "delta,dfbmcs320", },
 
97
        { .compatible = "linux,bt-sco", },
 
98
        {},
 
99
};
 
100
MODULE_DEVICE_TABLE(of, bt_sco_codec_of_match);
 
101
#endif
 
102
 
 
103
static struct platform_driver bt_sco_driver = {
 
104
        .driver = {
 
105
                .name = "bt-sco",
 
106
                .of_match_table = of_match_ptr(bt_sco_codec_of_match),
 
107
        },
 
108
        .probe = bt_sco_probe,
 
109
        .remove = bt_sco_remove,
 
110
        .id_table = bt_sco_driver_ids,
 
111
};
 
112
 
 
113
module_platform_driver(bt_sco_driver);
 
114
 
 
115
MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
 
116
MODULE_DESCRIPTION("ASoC generic bluetooth sco link driver");
 
117
MODULE_LICENSE("GPL");