build/patch/kernel/odroidc2-next/0078-snd-soc-codec-add-es7134lv-dac-support.patch
2017-05-21 18:44:19 +02:00

161 lines
4.9 KiB
Diff

From 564a578e7c4b2bc120ad735058d22a0d1780fc01 Mon Sep 17 00:00:00 2001
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Sun, 12 Feb 2017 00:42:18 +0100
Subject: [PATCH 78/93] snd: soc: codec: add es7134lv dac support
TO BE COMPLETED ...
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
sound/soc/codecs/Kconfig | 4 ++
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/es7134lv.c | 95 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 101 insertions(+)
create mode 100644 sound/soc/codecs/es7134lv.c
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 9e1718a..dc933b4 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -72,6 +72,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_DMIC
select SND_SOC_ES8328_SPI if SPI_MASTER
select SND_SOC_ES8328_I2C if I2C
+ select SND_SOC_ES7134LV
select SND_SOC_GTM601
select SND_SOC_HDAC_HDMI
select SND_SOC_ICS43432
@@ -535,6 +536,9 @@ config SND_SOC_ES8328_SPI
tristate
select SND_SOC_ES8328
+config SND_SOC_ES7134LV
+ tristate "Everest ES7134LV CODEC"
+
config SND_SOC_GTM601
tristate 'GTM601 UMTS modem audio codec'
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 7e1dad7..a217310 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -66,6 +66,7 @@ snd-soc-dmic-objs := dmic.o
snd-soc-es8328-objs := es8328.o
snd-soc-es8328-i2c-objs := es8328-i2c.o
snd-soc-es8328-spi-objs := es8328-spi.o
+snd-soc-es7134lv-objs := es7134lv.o
snd-soc-gtm601-objs := gtm601.o
snd-soc-hdac-hdmi-objs := hdac_hdmi.o
snd-soc-ics43432-objs := ics43432.o
@@ -295,6 +296,7 @@ obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o
obj-$(CONFIG_SND_SOC_ES8328) += snd-soc-es8328.o
obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o
obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o
+obj-$(CONFIG_SND_SOC_ES7134LV) += snd-soc-es7134lv.o
obj-$(CONFIG_SND_SOC_GTM601) += snd-soc-gtm601.o
obj-$(CONFIG_SND_SOC_HDAC_HDMI) += snd-soc-hdac-hdmi.o
obj-$(CONFIG_SND_SOC_ICS43432) += snd-soc-ics43432.o
diff --git a/sound/soc/codecs/es7134lv.c b/sound/soc/codecs/es7134lv.c
new file mode 100644
index 0000000..a24d555
--- /dev/null
+++ b/sound/soc/codecs/es7134lv.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2017 BayLibre, SAS.
+ * Author: Jerome Brunet <jbrunet@baylibre.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * The full GNU General Public License is included in this distribution
+ * in the file called COPYING.
+ */
+
+#include <linux/module.h>
+#include <sound/soc.h>
+
+/*
+ * The everest 7134lv is a very simple DA converter with no register
+ */
+
+static const struct snd_soc_dapm_widget es7134lv_dapm_widgets[] = {
+ SND_SOC_DAPM_OUTPUT("AOUTL"),
+ SND_SOC_DAPM_OUTPUT("AOUTR"),
+};
+
+static const struct snd_soc_dapm_route es7134lv_dapm_routes[] = {
+ { "AOUTL", NULL, "Playback" },
+ { "AOUTR", NULL, "Playback" },
+};
+
+static struct snd_soc_dai_driver es7134lv_dai = {
+ .name = "es7134lv-hifi",
+ .playback = {
+ .stream_name = "Playback",
+ .channels_min = 2,
+ .channels_max = 2,
+ .rates = SNDRV_PCM_RATE_8000_192000,
+ .formats = (SNDRV_PCM_FMTBIT_S16_LE |
+ SNDRV_PCM_FMTBIT_S18_3LE |
+ SNDRV_PCM_FMTBIT_S20_3LE |
+ SNDRV_PCM_FMTBIT_S24_3LE |
+ SNDRV_PCM_FMTBIT_S24_LE),
+ },
+};
+
+static struct snd_soc_codec_driver es7134lv_codec_driver = {
+ .component_driver = {
+ .dapm_widgets = es7134lv_dapm_widgets,
+ .num_dapm_widgets = ARRAY_SIZE(es7134lv_dapm_widgets),
+ .dapm_routes = es7134lv_dapm_routes,
+ .num_dapm_routes = ARRAY_SIZE(es7134lv_dapm_routes),
+ },
+};
+
+static int es7134lv_probe(struct platform_device *pdev)
+{
+ return snd_soc_register_codec(&pdev->dev,
+ &es7134lv_codec_driver,
+ &es7134lv_dai, 1);
+}
+
+static int es7134lv_remove(struct platform_device *pdev)
+{
+ snd_soc_unregister_codec(&pdev->dev);
+ return 0;
+}
+
+#ifdef CONFIG_OF
+static const struct of_device_id es7134lv_ids[] = {
+ { .compatible = "everest,es7134lv", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, es7134lv_ids);
+#endif
+
+static struct platform_driver es7134lv_driver = {
+ .driver = {
+ .name = "es7134lv",
+ .of_match_table = of_match_ptr(es7134lv_ids),
+ },
+ .probe = es7134lv_probe,
+ .remove = es7134lv_remove,
+};
+
+module_platform_driver(es7134lv_driver);
+
+MODULE_DESCRIPTION("ASoC ES7134LV audio codec driver");
+MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
+MODULE_LICENSE("GPL");
--
1.9.1