Re: [PATCH v2] ASoC: rt712-sdca: Add RT712 SDCA driver for Mic topology

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/28/2023 11:28 AM, shumingf@xxxxxxxxxxx wrote:
From: Shuming Fan <shumingf@xxxxxxxxxxx>

This is the initial codec driver for rt712 SDCA (Mic topology).
The host should connect with rt712 SdW2 interface.

Signed-off-by: Shuming Fan <shumingf@xxxxxxxxxxx>
---
  sound/soc/codecs/Kconfig           |   7 +
  sound/soc/codecs/Makefile          |   2 +
  sound/soc/codecs/rt712-sdca-dmic.c | 991 +++++++++++++++++++++++++++++
  sound/soc/codecs/rt712-sdca-dmic.h | 106 +++
  4 files changed, 1106 insertions(+)
  create mode 100644 sound/soc/codecs/rt712-sdca-dmic.c
  create mode 100644 sound/soc/codecs/rt712-sdca-dmic.h

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 03630d13d35f..8d41fc509637 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -203,6 +203,7 @@ config SND_SOC_ALL_CODECS
  	imply SND_SOC_RT711_SDW
  	imply SND_SOC_RT711_SDCA_SDW
  	imply SND_SOC_RT712_SDCA_SDW
+	imply SND_SOC_RT712_SDCA_DMIC_SDW
  	imply SND_SOC_RT715_SDW
  	imply SND_SOC_RT715_SDCA_SDW
  	imply SND_SOC_RT1308_SDW
@@ -1521,6 +1522,12 @@ config SND_SOC_RT712_SDCA_SDW
  	select REGMAP_SOUNDWIRE
  	select REGMAP_SOUNDWIRE_MBQ
+config SND_SOC_RT712_SDCA_DMIC_SDW
+	tristate "Realtek RT712 SDCA DMIC Codec - SDW"
+	depends on SOUNDWIRE
+	select REGMAP_SOUNDWIRE
+	select REGMAP_SOUNDWIRE_MBQ
+
  config SND_SOC_RT715
  	tristate
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 25ebce58a0ba..dac48236db02 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -233,6 +233,7 @@ snd-soc-rt700-objs := rt700.o rt700-sdw.o
  snd-soc-rt711-objs := rt711.o rt711-sdw.o
  snd-soc-rt711-sdca-objs := rt711-sdca.o rt711-sdca-sdw.o
  snd-soc-rt712-sdca-objs := rt712-sdca.o rt712-sdca-sdw.o
+snd-soc-rt712-sdca-dmic-objs := rt712-sdca-dmic.o
  snd-soc-rt715-objs := rt715.o rt715-sdw.o
  snd-soc-rt715-sdca-objs := rt715-sdca.o rt715-sdca-sdw.o
  snd-soc-rt9120-objs := rt9120.o
@@ -601,6 +602,7 @@ obj-$(CONFIG_SND_SOC_RT700)     += snd-soc-rt700.o
  obj-$(CONFIG_SND_SOC_RT711)     += snd-soc-rt711.o
  obj-$(CONFIG_SND_SOC_RT711_SDCA_SDW)     += snd-soc-rt711-sdca.o
  obj-$(CONFIG_SND_SOC_RT712_SDCA_SDW)     += snd-soc-rt712-sdca.o
+obj-$(CONFIG_SND_SOC_RT712_SDCA_DMIC_SDW)     += snd-soc-rt712-sdca-dmic.o
  obj-$(CONFIG_SND_SOC_RT715)     += snd-soc-rt715.o
  obj-$(CONFIG_SND_SOC_RT715_SDCA_SDW)     += snd-soc-rt715-sdca.o
  obj-$(CONFIG_SND_SOC_RT9120)	+= snd-soc-rt9120.o
diff --git a/sound/soc/codecs/rt712-sdca-dmic.c b/sound/soc/codecs/rt712-sdca-dmic.c
new file mode 100644
index 000000000000..e5d765d84369
--- /dev/null
+++ b/sound/soc/codecs/rt712-sdca-dmic.c
@@ -0,0 +1,991 @@
+// SPDX-License-Identifier: GPL-2.0-only
+//
+// rt712-sdca-dmic.c -- rt712 SDCA DMIC ALSA SoC audio driver
+//
+// Copyright(c) 2023 Realtek Semiconductor Corp.
+//
+//
+
+#include <linux/bitops.h>
+#include <sound/core.h>
+#include <linux/device.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <sound/initval.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/mod_devicetable.h>
+#include <linux/pm_runtime.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <linux/soundwire/sdw_registers.h>
+#include <linux/slab.h>
+#include <sound/soc-dapm.h>
+#include <sound/tlv.h>

Ordering of those includes seems bit weird to me, can't you include sound/ ones after linux/ ones?

And a bit of nitpicking linux/moduleparam.h seems redundant if you include linux/module.h

And I'm not sure why do you need linux/delay.h, I don't see any *sleep or *delay functions in the patch?

+#include "rt712-sdca.h"
+#include "rt712-sdca-dmic.h"
+

...



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux