aboutsummaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0071-ASoC-add-dummy-device-for-WL18xx-PCM-audio.patch
blob: 30aebe049822b8d421c6316bd32a0453cf0b0a26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
From 81ddd8a5dbf200938ef70efaa9254742f49d3034 Mon Sep 17 00:00:00 2001
From: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Date: Thu, 10 Aug 2017 16:29:01 +0300
Subject: [PATCH] ASoC: add dummy device for WL18xx PCM audio

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
---
 sound/soc/codecs/Kconfig  |  3 ++
 sound/soc/codecs/Makefile |  2 ++
 sound/soc/codecs/wl18xx.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+)
 create mode 100644 sound/soc/codecs/wl18xx.c

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 140f1597966a..6658d05f1648 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -625,6 +625,9 @@ config SND_SOC_PCM3168A_SPI
 config SND_SOC_SI468X
 	tristate "Dummy sound driver for Si468x radio"
 
+config SND_SOC_WL18XX
+	tristate "Dummy sound driver for WL18xx BT"
+
 config SND_SOC_PCM5102A
 	tristate
 
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 8e02341428d8..17fd313489de 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -126,6 +126,7 @@ snd-soc-sigmadsp-i2c-objs := sigmadsp-i2c.o
 snd-soc-sigmadsp-regmap-objs := sigmadsp-regmap.o
 snd-soc-si476x-objs := si476x.o
 snd-soc-si468x-objs := si468x.o
+snd-soc-wl18xx-objs := wl18xx.o
 snd-soc-sirf-audio-codec-objs := sirf-audio-codec.o
 snd-soc-sn95031-objs := sn95031.o
 snd-soc-spdif-tx-objs := spdif_transmitter.o
@@ -349,6 +350,7 @@ obj-$(CONFIG_SND_SOC_SIGMADSP_I2C)	+= snd-soc-sigmadsp-i2c.o
 obj-$(CONFIG_SND_SOC_SIGMADSP_REGMAP)	+= snd-soc-sigmadsp-regmap.o
 obj-$(CONFIG_SND_SOC_SI476X)	+= snd-soc-si476x.o
 obj-$(CONFIG_SND_SOC_SI468X)	+= snd-soc-si468x.o
+obj-$(CONFIG_SND_SOC_WL18XX)	+= snd-soc-wl18xx.o
 obj-$(CONFIG_SND_SOC_SN95031)	+=snd-soc-sn95031.o
 obj-$(CONFIG_SND_SOC_SPDIF)	+= snd-soc-spdif-rx.o snd-soc-spdif-tx.o
 obj-$(CONFIG_SND_SOC_SSM2518)	+= snd-soc-ssm2518.o
diff --git a/sound/soc/codecs/wl18xx.c b/sound/soc/codecs/wl18xx.c
new file mode 100644
index 000000000000..50ebbd4c0013
--- /dev/null
+++ b/sound/soc/codecs/wl18xx.c
@@ -0,0 +1,72 @@
+/*
+ * Dummy sound driver for wl18xx BT modules
+ * Copyright 2016 Andrey Gusakov <andrey.gusakov@cogentembedded.com>
+ *
+ * Based on: Driver for the DFBM-CS320 bluetooth module
+ * Copyright 2011 Lars-Peter Clausen <lars@metafoo.de>
+ *
+ *  This program is free software; you can redistribute  it and/or modify it
+ *  under  the terms of  the GNU General  Public License as published by the
+ *  Free Software Foundation;  either version 2 of the  License, or (at your
+ *  option) any later version.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+#include <sound/soc.h>
+
+static struct snd_soc_dai_driver wl18xx_dai = {
+	.name = "wl18xx-pcm",
+	.capture = {
+		.channels_min = 2,
+		.channels_max = 2,
+		.rates = SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+	.playback = {
+		.channels_min = 2,
+		.channels_max = 2,
+		.rates = SNDRV_PCM_RATE_48000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+};
+
+static struct snd_soc_codec_driver soc_codec_dev_wl18xx;
+
+static int wl18xx_probe(struct platform_device *pdev)
+{
+	return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wl18xx,
+			&wl18xx_dai, 1);
+}
+
+static int wl18xx_remove(struct platform_device *pdev)
+{
+	snd_soc_unregister_codec(&pdev->dev);
+
+	return 0;
+}
+
+static const struct of_device_id wl18xx_of_match[] = {
+	{ .compatible = "ti,wl18xx-pcm", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, wl18xx_of_match);
+
+static struct platform_driver wl18xx_driver = {
+	.driver = {
+		.name = "wl18xx-codec",
+		.of_match_table = wl18xx_of_match,
+		.owner = THIS_MODULE,
+	},
+	.probe = wl18xx_probe,
+	.remove = wl18xx_remove,
+};
+
+module_platform_driver(wl18xx_driver);
+
+MODULE_AUTHOR("Andrey Gusakov <andrey.gusakov@cogentembedded.com>");
+MODULE_DESCRIPTION("ASoC wl18xx driver");
+MODULE_LICENSE("GPL");
-- 
2.13.0