On 3/25/22 23:07, zhuning@xxxxxxxxxxxxxxxx wrote:
From 18deaac165343c049bb5ac7a71d222576caec9fc Mon Sep 17 00:00:00 2001
From: yangxiaohua <yangxiaohua@xxxxxxxxxxxxxxxx>
Date: Thu, 10 Mar 2022 16:59:29 +0800
Subject: [PATCH 1/1] ASoC: codecs: add support for ES8326
The ES8326 codec is not compatible with ES8316 and requires a dedicated driver.
Signed-off-by: David Yang <yangxiaohua@xxxxxxxxxxxxxxxx>
You need to copy maintainers (added in CC:), and you're also missing a
Signed-off-by when sending patches developed by someone else.
Also please use git send-email, it looks like the indentations were
removed by your email client.
---
sound/soc/codecs/Kconfig | 5 +
sound/soc/codecs/Makefile | 2 +
sound/soc/codecs/es8326.c | 753 ++++++++++++++++++++++++++++++++++++++
sound/soc/codecs/es8326.h | 184 ++++++++++
4 files changed, 944 insertions(+)
create mode 100755 sound/soc/codecs/es8326.c
create mode 100755 sound/soc/codecs/es8326.h
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index c2627f7489a4..66bc2358e31e 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -95,6 +95,7 @@ config SND_SOC_ALL_CODECS
imply SND_SOC_DA9055
imply SND_SOC_DMIC
imply SND_SOC_ES8316
+ imply SND_SOC_ES8326
imply SND_SOC_ES8328_SPI
imply SND_SOC_ES8328_I2C
imply SND_SOC_ES7134
@@ -867,6 +868,10 @@ config SND_SOC_ES8316
tristate "Everest Semi ES8316 CODEC"
depends on I2C
+config SND_SOC_ES8326
+ tristate "Everest Semi ES8326 CODEC"
+ depends on I2C
+
config SND_SOC_ES8328
tristate
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index b4e11c3e4a08..73043d5bc1ea 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -95,6 +95,7 @@ snd-soc-dmic-objs := dmic.o
snd-soc-es7134-objs := es7134.o
snd-soc-es7241-objs := es7241.o
snd-soc-es8316-objs := es8316.o
+snd-soc-es8326-objs := es8326.o
snd-soc-es8328-objs := es8328.o
snd-soc-es8328-i2c-objs := es8328-i2c.o
snd-soc-es8328-spi-objs := es8328-spi.o
@@ -437,6 +438,7 @@ obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o
obj-$(CONFIG_SND_SOC_ES7134) += snd-soc-es7134.o
obj-$(CONFIG_SND_SOC_ES7241) += snd-soc-es7241.o
obj-$(CONFIG_SND_SOC_ES8316) += snd-soc-es8316.o
+obj-$(CONFIG_SND_SOC_ES8326) += snd-soc-es8326.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
diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
new file mode 100755
index 000000000000..a80649e04aa6
--- /dev/null
+++ b/sound/soc/codecs/es8326.c
@@ -0,0 +1,753 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * es8326.c -- es8326 ALSA SoC audio driver
+ * Copyright Everest Semiconductor Co., Ltd
+ *
+ * Authors: David Yang <yangxiaohua@xxxxxxxxxxxxxxxx>
+ */
+
+#include <linux/clk.h>
+#include <linux/gpio.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/module.h>
+#include <sound/jack.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/soc-dapm.h>
+#include <sound/tlv.h>
+#include "es8326.h"
+
+struct es8326_priv {
+ struct clk *mclk;
+ struct snd_pcm_hw_constraint_list *sysclk_constraints;
+ struct i2c_client *i2c;
+ struct regmap *regmap;
+ struct snd_soc_component *component;
+ struct delayed_work jack_detect_work;
+ bool amic;
+ bool start;
+ bool muted;
+ bool hp_inserted;
+ bool spk_gpio_level;
+ bool hp_det_level;
+ struct snd_soc_jack *jack;
+ int irq;
+ /* The lock protects the situation that an irq is generated
+ * while the previous irq is still being processed.
+ */
+ struct mutex lock;
+ u8 amic1_src;
+ u8 amic2_src;
+ u8 mic1_src;
+ u8 mic2_src;
+ u8 jack_pol;
+ bool jd_inverted;
+ unsigned int sysclk;
+};