Skip to contentSkip to conversation

Add es9356 focused SoundWire CODEC

PATCH Applied Zhang Yi 6 participants 16 messages May 14 – May 29

Subsystems (5)
lore
Share & tools
lore

Zhang Yi

author
#0 lore raw

v15 cover Add es9356 focused SoundWire CODEC

This patch chain adds support for the ES9356 PC focused SoundWire CODEC.

v15 -> v14:

	-Change `es9356_sdw_remove` from `int(*)` to `void(*)`

v14 -> v13:
-Rebase onto latest linux-next for-next branch

v13 -> v12:
-Fixed an issue where soc_sdw_es9356.c was missing

v12 -> v11:
-Fix a helper function to hw_params and hw_free -Move pm_runtime initializations to probe -Add es9356 to wake_capable_list

v11 -> v10:
-Add some comment for lock
-Add a helper function to hw_params and hw_free

v10 -> v9:
-Add some comment at codec driver
-Fixed the jack_lock issue during suspend

v9 -> v8:
-Fix some formatting issues in es9356.c
-Removed regmap_write(SDW_SCP_SYSTEMCTRL) from the codec driver

v8 -> v7:
-When the device status is UNATTACHED,
set regmap to cache-only and cancel any delay work already in the queue.

v7 -> v6:
-Provide comments for some parameters
-Rename jack_detect_work to interrupt_handle_work -Add a jack_lock when handling disable_irq in suspend -Adjust the handling procedure when a jack register
is incorrectly identified
-Replace the custom SOC_SINGLE_Q78_TLV with SDCA_SINGLE_Q78_TLV

v6 -> v5:
-Handling default values in button_detect and jack_detect -Add the member disable_irq so that interrupts are
no longer processed after suspend.
-Move the PDE processing to hw_params and hw_free -Separate JACK_OUT and JACK_IN in hw_params
-Simplify reading and writing to SDW_SCP_SDCA_INT1 in the callback -Adjust the scope of regcache_sync in the resume

v5 -> v4:
-Merge patch1 and patch3
-Add vendor_id in codec_info
-Use q78_get and q78_set to create Kcontrol -Set mbq_size and use regmap_mbq
-An additional helper function to implement DAPM

v4 -> v3:
-Updated some KControl names
-add copyright in soc_sdw_es9356

v3 -> v2:
-Removed unnecessary section in soc_sdw_es9356.c -Add pm_runtime_put_noidle to es9356.c to
reduce device incremented count
-Updated some KControl names
-Fix the error related to jack_report in the codec driver

v2 -> v1:
-Adjusted mutexes in the ES9356 driver -Use macros to replace certain values -Adjusted some ordering issues in Kconfig.

v1 -> v0:
-Modified snd_soc_dapm_add_routes in soc_sdw_es9356

Zhang Yi (6):
ASoC: sdw_utils: add soc_sdw_es9356
ASoC: sdw_utils: add ES9356 in codec_info_list
ASoC: es9356-sdca: Add ES9356 SDCA driver
ASoC: Intel: soc-acpi: arl: Add es9356 support
ASoC: Intel: sof_sdw: add es9356 support
soundwire: intel_auxdevice: Add es9356 to wake_capable_list

 drivers/soundwire/intel_auxdevice.c           |    1 +
 include/sound/soc_sdw_utils.h                 |   14 +
 sound/soc/codecs/Kconfig                      |    7 +
 sound/soc/codecs/Makefile                     |    2 +
 sound/soc/codecs/es9356.c                     | 1151 +++++++++++++++++
 sound/soc/codecs/es9356.h                     |  208 +++
 sound/soc/intel/boards/Kconfig                |    1 +
 .../intel/common/soc-acpi-intel-arl-match.c   |   52 +
 sound/soc/sdw_utils/Makefile                  |    1 +
 sound/soc/sdw_utils/soc_sdw_es9356.c          |  230 ++++
 sound/soc/sdw_utils/soc_sdw_utils.c           |   50 +
 11 files changed, 1717 insertions(+)
 create mode 100644 sound/soc/codecs/es9356.c
 create mode 100644 sound/soc/codecs/es9356.h
 create mode 100644 sound/soc/sdw_utils/soc_sdw_es9356.c
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v15 1/6 ASoC: sdw_utils: add soc_sdw_es9356

Add a utility program for handling ES9356 in the universal machine driver

---
 include/sound/soc_sdw_utils.h        |  14 ++
 sound/soc/sdw_utils/Makefile         |   1 +
 sound/soc/sdw_utils/soc_sdw_es9356.c | 230 +++++++++++++++++++++++++++
 3 files changed, 245 insertions(+)
 create mode 100644 sound/soc/sdw_utils/soc_sdw_es9356.c
include/sound/soc_sdw_utils.h +14 -0
index d713ab2f6..79c219662 100644
@@ -223,6 +223,17 @@ int asoc_sdw_cs42l43_spk_init(struct snd_soc_card *card,
 			      struct asoc_sdw_codec_info *info,
 			      bool playback);
 
+/* es9356 codec support */
+int asoc_sdw_es9356_init(struct snd_soc_card *card,
+			       struct snd_soc_dai_link *dai_links,
+			       struct asoc_sdw_codec_info *info,
+			       bool playback);
+int asoc_sdw_es9356_amp_init(struct snd_soc_card *card,
+			       struct snd_soc_dai_link *dai_links,
+			       struct asoc_sdw_codec_info *info,
+			       bool playback);
+int asoc_sdw_es9356_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
+
 /* CS AMP support */
 int asoc_sdw_bridge_cs35l56_count_sidecar(struct snd_soc_card *card,
 					  int *num_dais, int *num_devs);
@@ -278,5 +289,8 @@ int asoc_sdw_ti_amp_initial_settings(struct snd_soc_card *card,
 				     const char *name_prefix);
 int asoc_sdw_ti_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
 int asoc_sdw_ti_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
+int asoc_sdw_es9356_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
+int asoc_sdw_es9356_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
+int asoc_sdw_es9356_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai);
 
 #endif
sound/soc/sdw_utils/Makefile +1 -0
index a8d091fd3..5ae8c69b8 100644
@@ -8,6 +8,7 @@ snd-soc-sdw-utils-y := soc_sdw_utils.o soc_sdw_dmic.o soc_sdw_rt_dmic.o \
 		       soc_sdw_cs42l45.o				\
 		       soc_sdw_cs47l47.o				\
 		       soc_sdw_cs_amp.o					\
+		       soc_sdw_es9356.o					\
 		       soc_sdw_maxim.o \
 		       soc_sdw_ti_amp.o
 obj-$(CONFIG_SND_SOC_SDW_UTILS) += snd-soc-sdw-utils.o
sound/soc/sdw_utils/soc_sdw_es9356.c new file +230 -0

230 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#2 lore raw

PATCH v15 2/6 ASoC: sdw_utils: add ES9356 in codec_info_list

In reply to Zhang Yi

Add ES9356 in codec_info_list

---
 sound/soc/sdw_utils/soc_sdw_utils.c | 50 +++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
sound/soc/sdw_utils/soc_sdw_utils.c +50 -0
index 85291bfb5..5bb9b6972 100644
@@ -1090,6 +1090,56 @@ struct asoc_sdw_codec_info codec_info_list[] = {
 		},
 		.aux_num = 1,
 	},
+	{
+		.vendor_id = 0x04b3,
+		.part_id = 0x9356,
+		.name_prefix = "es9356",
+		.version_id = 3,
+		.dais = {
+			{
+				.direction = {true, false},
+				.dai_name = "es9356-sdp-aif1",
+				.dai_type = SOC_SDW_DAI_TYPE_JACK,
+				.dailink = {SOC_SDW_JACK_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
+				.init = asoc_sdw_es9356_init,
+				.exit = asoc_sdw_es9356_exit,
+				.rtd_init = asoc_sdw_es9356_rtd_init,
+				.controls = generic_jack_controls,
+				.num_controls = ARRAY_SIZE(generic_jack_controls),
+				.widgets = generic_jack_widgets,
+				.num_widgets = ARRAY_SIZE(generic_jack_widgets),
+			},
+			{
+				.direction = {false, true},
+				.dai_name = "es9356-sdp-aif4",
+				.dai_type = SOC_SDW_DAI_TYPE_MIC,
+				.dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_DMIC_DAI_ID},
+				.rtd_init = asoc_sdw_es9356_dmic_rtd_init,
+				.widgets = generic_dmic_widgets,
+				.num_widgets = ARRAY_SIZE(generic_dmic_widgets),
+			},
+			{
+				.direction = {false, true},
+				.dai_name = "es9356-sdp-aif2",
+				.dai_type = SOC_SDW_DAI_TYPE_JACK,
+				.dailink = {SOC_SDW_UNUSED_DAI_ID, SOC_SDW_JACK_IN_DAI_ID},
+			},
+			{
+				.direction = {true, false},
+				.dai_name = "es9356-sdp-aif3",
+				.component_name = "es9356",
+				.dai_type = SOC_SDW_DAI_TYPE_AMP,
+				.dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
+				.init = asoc_sdw_es9356_amp_init,
+				.rtd_init = asoc_sdw_es9356_spk_rtd_init,
+				.controls = generic_spk_controls,
+				.num_controls = ARRAY_SIZE(generic_spk_controls),
+				.widgets = generic_spk_widgets,
+				.num_widgets = ARRAY_SIZE(generic_spk_widgets),
+			},
+		},
+		.dai_num = 4,
+	},
 	{
 		.vendor_id = 0x0105,
 		.part_id = 0xaaaa, /* generic codec mockup */
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH v15 3/6 ASoC: es9356-sdca: Add ES9356 SDCA driver

In reply to Zhang Yi

This is the codec driver for es9356-sdca.

---
 sound/soc/codecs/Kconfig  |    7 +
 sound/soc/codecs/Makefile |    2 +
 sound/soc/codecs/es9356.c | 1151 +++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/es9356.h |  208 +++++++
 4 files changed, 1368 insertions(+)
 create mode 100644 sound/soc/codecs/es9356.c
 create mode 100644 sound/soc/codecs/es9356.h
sound/soc/codecs/Kconfig +7 -0
index 069ec05e4..f2e62c2b7 100644
@@ -122,6 +122,7 @@ config SND_SOC_ALL_CODECS
 	imply SND_SOC_ES8328_I2C
 	imply SND_SOC_ES8375
 	imply SND_SOC_ES8389
+	imply SND_SOC_ES9356
 	imply SND_SOC_ES7134
 	imply SND_SOC_ES7241
 	imply SND_SOC_FRAMER
@@ -1302,6 +1303,12 @@ config SND_SOC_ES8389
 	tristate "Everest Semi ES8389 CODEC"
 	depends on I2C
 
+config SND_SOC_ES9356
+        tristate "Everest Semi ES9356 CODEC SDW"
+        depends on SOUNDWIRE
+        select REGMAP_SOUNDWIRE
+        select REGMAP_SOUNDWIRE_MBQ
+
 config SND_SOC_FRAMER
 	tristate "Framer codec"
 	depends on GENERIC_FRAMER
sound/soc/codecs/Makefile +2 -0
index 2c2d0553f..73315d017 100644
@@ -138,6 +138,7 @@ snd-soc-es8328-i2c-y := es8328-i2c.o
 snd-soc-es8328-spi-y := es8328-spi.o
 snd-soc-es8375-y := es8375.o
 snd-soc-es8389-y := es8389.o
+snd-soc-es9356-y := es9356.o
 snd-soc-framer-y := framer-codec.o
 snd-soc-fs-amp-lib-y := fs-amp-lib.o
 snd-soc-fs210x-y := fs210x.o
@@ -577,6 +578,7 @@ 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_ES8375)    += snd-soc-es8375.o
 obj-$(CONFIG_SND_SOC_ES8389)    += snd-soc-es8389.o
+obj-$(CONFIG_SND_SOC_ES9356)    += snd-soc-es9356.o
 obj-$(CONFIG_SND_SOC_FRAMER)	+= snd-soc-framer.o
 obj-$(CONFIG_SND_SOC_FS_AMP_LIB)+= snd-soc-fs-amp-lib.o
 obj-$(CONFIG_SND_SOC_FS210X)	+= snd-soc-fs210x.o
sound/soc/codecs/es9356.c new file +1151 -0

1,151 lines not on this page · raw message

sound/soc/codecs/es9356.h new file +208 -0

208 lines not on this page · raw message

Signature · 1 line
2.17.1
maintainer
#4 lore raw

Re: [PATCH v15 3/6] ASoC: es9356-sdca: Add ES9356 SDCA driver

Quoted 20 lines · Zhang Yi

This is the codec driver for es9356-sdca.

---

sound/soc/codecs/es9356.c new file +16 -0
+static int es9356_sdca_dev_resume(struct device *dev)
+{
+	struct sdw_slave *slave = dev_to_sdw_dev(dev);
+	struct es9356_sdw_priv *es9356 = dev_get_drvdata(dev);
+	unsigned long time;
+
+	if (!slave->unattach_request) {
+		es9356->disable_irq = false;
+		goto regmap_sync;
+	}
+
+	time = wait_for_completion_timeout(&slave->initialization_complete,
+				msecs_to_jiffies(es9356_PROBE_TIMEOUT));
+	if (!time) {
+		dev_err(&slave->dev, "Initialization not complete, timed out\n");
+		sdw_show_ping_status(slave->bus, true);

sound/soc/codecs/es9356.c line 1129

Quoted 10 lines
sound/soc/codecs/es9356.c new file +10 -0
+
+		return -ETIMEDOUT;
+	}
+
+regmap_sync:
+	slave->unattach_request = 0;
+	regcache_cache_only(es9356->regmap, false);
+	regcache_sync(es9356->regmap);
+	return 0;
+}

This should be updated to use sdw_slave_wait_for_init(), as per:

https://lore.kernel.org/linux-sound/177858284069.1043532.13233320271274458583.b4-ty@b4/T/#m58ed8c01e7e96c991c8f05b636e36bc65cde8add

Thanks,
Charles

#5 lore raw

Re: [PATCH v15 3/6] ASoC: es9356-sdca: Add ES9356 SDCA driver

In reply to Zhang Yi

Hi,

Quoted 3 lines · Zhang Yi

This is the codec driver for es9356-sdca.

...

Quoted 5 lines
sound/soc/codecs/es9356.c new file +0 -0
new file mode 100644
index 000000000..78fddd9d0

...

Quoted 22 lines
sound/soc/codecs/es9356.c new file +22 -0
+static const struct snd_kcontrol_new es9356_sdca_controls[] = {
+	SDCA_SINGLE_Q78_TLV("FU41 Left Playback Volume",
+		SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU41, ES9356_SDCA_CTL_FU_VOLUME, CH_L),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU41 Right Playback Volume",
+		SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU41, ES9356_SDCA_CTL_FU_VOLUME, CH_R),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU36 Left Capture Volume",
+		SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU36, ES9356_SDCA_CTL_FU_VOLUME, CH_L),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU36 Right Capture Volume",
+		SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU36, ES9356_SDCA_CTL_FU_VOLUME, CH_R),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU33 Capture Volume",
+		SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU33, ES9356_SDCA_CTL_FU_CH_GAIN, 0),
+		ES9356_GAIN_MIN, ES9356_AMIC_GAIN_MAX, ES9356_AMIC_GAIN_STEP, amic_gain_tlv),
+	SDCA_SINGLE_Q78_TLV("FU21 Left Playback Volume",
+		SDW_SDCA_CTL(FUNC_NUM_AMP, ES9356_SDCA_ENT_FU21, ES9356_SDCA_CTL_FU_VOLUME, CH_L),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU21 Right Playback Volume",
+		SDW_SDCA_CTL(FUNC_NUM_AMP, ES9356_SDCA_ENT_FU21, ES9356_SDCA_CTL_FU_VOLUME, CH_R),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),

sound/soc/codecs/es9356.c

Quoted 10 lines
sound/soc/codecs/es9356.c new file +10 -0
+	SDCA_SINGLE_Q78_TLV("FU113 Left Capture Volume",
+		SDW_SDCA_CTL(FUNC_NUM_MIC, ES9356_SDCA_ENT_FU113, ES9356_SDCA_CTL_FU_VOLUME, CH_L),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU113 Right Capture Volume",
+		SDW_SDCA_CTL(FUNC_NUM_MIC, ES9356_SDCA_ENT_FU113, ES9356_SDCA_CTL_FU_VOLUME, CH_R),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU11 Capture Volume",
+		SDW_SDCA_CTL(FUNC_NUM_MIC, ES9356_SDCA_ENT_FU11, ES9356_SDCA_CTL_FU_CH_GAIN, 0),
+		ES9356_GAIN_MIN, ES9356_DMIC_GAIN_MAX, ES9356_DMIC_GAIN_STEP, dmic_gain_tlv),
+};

The use of SDCA_SINGLE_Q78_TLV() can break the build for architectures that do not support ACPI, as CONFIG_SND_SOC_SDCA depends on ACPI and the driver does not actually select it, so it might not be enabled if another driver that does select it is not enabled:

  $ printf "CONFIG_%s=m\n" SOUNDWIRE SND_SOC_ES9356 >arch/arm/configs/repro.config
  $ make -skj"$(nproc)" ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- mrproper defconfig repro.config all
  ERROR: modpost: "sdca_asoc_q78_get_volsw" [sound/soc/codecs/snd-soc-es9356.ko] undefined!
  ERROR: modpost: "sdca_asoc_q78_put_volsw" [sound/soc/codecs/snd-soc-es9356.ko] undefined!
  ...

Maybe something like this is needed?

sound/soc/codecs/Kconfig +2 -0
index 5fdd0334c355..b9e8df5ddfd5 100644
@@ -1302,7 +1302,9 @@ config SND_SOC_ES8389
 
 config SND_SOC_ES9356
         tristate "Everest Semi ES9356 CODEC SDW"
+	depends on ACPI
         depends on SOUNDWIRE
+	select SND_SOC_SDCA
         select REGMAP_SOUNDWIRE
         select REGMAP_SOUNDWIRE_MBQ
 
Signature · 2 lines
Cheers,
Nathan
#6 lore raw

Re: [PATCH v15 3/6] ASoC: es9356-sdca: Add ES9356 SDCA driver

Quoted 65 lines · Nathan Chancellor

Hi,

Quoted 3 lines · Zhang Yi

This is the codec driver for es9356-sdca.

...

Quoted 5 lines
sound/soc/codecs/es9356.c new file +0 -0
new file mode 100644
index 000000000..78fddd9d0

...

Quoted 22 lines
sound/soc/codecs/es9356.c new file +22 -0
+static const struct snd_kcontrol_new es9356_sdca_controls[] = {
+	SDCA_SINGLE_Q78_TLV("FU41 Left Playback Volume",
+		SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU41, ES9356_SDCA_CTL_FU_VOLUME, CH_L),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU41 Right Playback Volume",
+		SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU41, ES9356_SDCA_CTL_FU_VOLUME, CH_R),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU36 Left Capture Volume",
+		SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU36, ES9356_SDCA_CTL_FU_VOLUME, CH_L),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU36 Right Capture Volume",
+		SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU36, ES9356_SDCA_CTL_FU_VOLUME, CH_R),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU33 Capture Volume",
+		SDW_SDCA_CTL(FUNC_NUM_UAJ, ES9356_SDCA_ENT_FU33, ES9356_SDCA_CTL_FU_CH_GAIN, 0),
+		ES9356_GAIN_MIN, ES9356_AMIC_GAIN_MAX, ES9356_AMIC_GAIN_STEP, amic_gain_tlv),
+	SDCA_SINGLE_Q78_TLV("FU21 Left Playback Volume",
+		SDW_SDCA_CTL(FUNC_NUM_AMP, ES9356_SDCA_ENT_FU21, ES9356_SDCA_CTL_FU_VOLUME, CH_L),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU21 Right Playback Volume",
+		SDW_SDCA_CTL(FUNC_NUM_AMP, ES9356_SDCA_ENT_FU21, ES9356_SDCA_CTL_FU_VOLUME, CH_R),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),

sound/soc/codecs/es9356.c

Quoted 10 lines
sound/soc/codecs/es9356.c new file +10 -0
+	SDCA_SINGLE_Q78_TLV("FU113 Left Capture Volume",
+		SDW_SDCA_CTL(FUNC_NUM_MIC, ES9356_SDCA_ENT_FU113, ES9356_SDCA_CTL_FU_VOLUME, CH_L),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU113 Right Capture Volume",
+		SDW_SDCA_CTL(FUNC_NUM_MIC, ES9356_SDCA_ENT_FU113, ES9356_SDCA_CTL_FU_VOLUME, CH_R),
+		ES9356_VOLUME_MIN, ES9356_VOLUME_MAX, ES9356_VOLUME_STEP, out_vol_tlv),
+	SDCA_SINGLE_Q78_TLV("FU11 Capture Volume",
+		SDW_SDCA_CTL(FUNC_NUM_MIC, ES9356_SDCA_ENT_FU11, ES9356_SDCA_CTL_FU_CH_GAIN, 0),
+		ES9356_GAIN_MIN, ES9356_DMIC_GAIN_MAX, ES9356_DMIC_GAIN_STEP, dmic_gain_tlv),
+};

The use of SDCA_SINGLE_Q78_TLV() can break the build for architectures that do not support ACPI, as CONFIG_SND_SOC_SDCA depends on ACPI and the driver does not actually select it, so it might not be enabled if another driver that does select it is not enabled:

  $ printf "CONFIG_%s=m\n" SOUNDWIRE SND_SOC_ES9356 >arch/arm/configs/repro.config
  $ make -skj"$(nproc)" ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- mrproper defconfig repro.config all
  ERROR: modpost: "sdca_asoc_q78_get_volsw" [sound/soc/codecs/snd-soc-es9356.ko] undefined!
  ERROR: modpost: "sdca_asoc_q78_put_volsw" [sound/soc/codecs/snd-soc-es9356.ko] undefined!
  ...

Maybe something like this is needed?

sound/soc/codecs/Kconfig +0 -0
index 5fdd0334c355..b9e8df5ddfd5 100644

sound/soc/codecs/Kconfig config SND_SOC_ES8389 · line 1309

Quoted 8 lines
sound/soc/codecs/Kconfig +2 -0
@@ -1302,7 +1302,9 @@ config SND_SOC_ES8389
 
 config SND_SOC_ES9356
         tristate "Everest Semi ES9356 CODEC SDW"
+	depends on ACPI
         depends on SOUNDWIRE
+	select SND_SOC_SDCA
         select REGMAP_SOUNDWIRE
         select REGMAP_SOUNDWIRE_MBQ

Maybe this instead?

depends on SOUNDWIRE
depends on SND_SOC_SDCA

#7 lore raw

Re: [PATCH v15 3/6] ASoC: es9356-sdca: Add ES9356 SDCA driver

Quoted 19 lines · Pierre-Louis Bossart
Quoted 7 lines · Nathan Chancellor

Maybe something like this is needed?

sound/soc/codecs/Kconfig +0 -0
index 5fdd0334c355..b9e8df5ddfd5 100644

sound/soc/codecs/Kconfig config SND_SOC_ES8389 · line 1309

Quoted 8 lines
sound/soc/codecs/Kconfig +2 -0
@@ -1302,7 +1302,9 @@ config SND_SOC_ES8389
 
 config SND_SOC_ES9356
         tristate "Everest Semi ES9356 CODEC SDW"
+	depends on ACPI
         depends on SOUNDWIRE
+	select SND_SOC_SDCA
         select REGMAP_SOUNDWIRE
         select REGMAP_SOUNDWIRE_MBQ

Maybe this instead?

Quoted 2 lines

depends on SOUNDWIRE
depends on SND_SOC_SDCA

Yeah, I realized shortly after sending that suggestion through testing that it would error during the Kconfig stage due to a recursive dependency issue. However, CONFIG_SND_SOC_SDCA is not a user selectable symbol and I only see it selected through

CONFIG_SND_SOC_ACPI_INTEL_MATCH -> CONFIG_SND_SOC_ACPI_INTEL_SDCA_QUIRKS

so is it expected that users have to enable a driver that selects CONFIG_SND_SOC_ACPI_INTEL_MATCH to get CONFIG_SND_SOC_SDCA?

Signature · 2 lines
Cheers,
Nathan
maintainer
#8 lore raw

Re: [PATCH v15 3/6] ASoC: es9356-sdca: Add ES9356 SDCA driver

Quoted 9 lines · Nathan Chancellor

Yeah, I realized shortly after sending that suggestion through testing that it would error during the Kconfig stage due to a recursive dependency issue. However, CONFIG_SND_SOC_SDCA is not a user selectable symbol and I only see it selected through

CONFIG_SND_SOC_ACPI_INTEL_MATCH -> CONFIG_SND_SOC_ACPI_INTEL_SDCA_QUIRKS

so is it expected that users have to enable a driver that selects CONFIG_SND_SOC_ACPI_INTEL_MATCH to get CONFIG_SND_SOC_SDCA?

That seems off, it's not like SoundWire is Intel or even x86 specific. I would expect either it should be user selectable or the drivers using it should select it. Given that it's a class driver that probably means user selectable I think, some devices might need no extra support?

#9 lore raw

Re: [PATCH v15 3/6] ASoC: es9356-sdca: Add ES9356 SDCA driver

Quoted 9 lines · Mark Brown
Quoted 6 lines · Nathan Chancellor

Yeah, I realized shortly after sending that suggestion through testing that it would error during the Kconfig stage due to a recursive dependency issue. However, CONFIG_SND_SOC_SDCA is not a user selectable symbol and I only see it selected through

CONFIG_SND_SOC_ACPI_INTEL_MATCH -> CONFIG_SND_SOC_ACPI_INTEL_SDCA_QUIRKS

Quoted 7 lines
Quoted 2 lines

so is it expected that users have to enable a driver that selects CONFIG_SND_SOC_ACPI_INTEL_MATCH to get CONFIG_SND_SOC_SDCA?

That seems off, it's not like SoundWire is Intel or even x86 specific. I would expect either it should be user selectable or the drivers using it should select it. Given that it's a class driver that probably means user selectable I think, some devices might need no extra support?

Yeah, just turning it into a user selectable symbol like

sound/soc/sdca/Kconfig +1 -1
index 87ab2895096c..4c0dcb9ff3b9 100644
@@ -2,7 +2,7 @@
 menu "SoundWire (SDCA)"
 
 config SND_SOC_SDCA
-	tristate
+	tristate "SDCA core support"
 	depends on ACPI
 	select AUXILIARY_BUS
 	help

--

appears to work for me, in combination with adding

depends on SND_SOC_SDCA

to the symbol for this driver.

Signature · 2 lines
Cheers,
Nathan
maintainer
#10 lore raw

Re: [PATCH v15 3/6] ASoC: es9356-sdca: Add ES9356 SDCA driver

Quoted 9 lines · Nathan Chancellor
Quoted 8 lines · Mark Brown
Quoted 6 lines · Nathan Chancellor

Yeah, I realized shortly after sending that suggestion through testing that it would error during the Kconfig stage due to a recursive dependency issue. However, CONFIG_SND_SOC_SDCA is not a user selectable symbol and I only see it selected through

CONFIG_SND_SOC_ACPI_INTEL_MATCH -> CONFIG_SND_SOC_ACPI_INTEL_SDCA_QUIRKS

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

so is it expected that users have to enable a driver that selects CONFIG_SND_SOC_ACPI_INTEL_MATCH to get CONFIG_SND_SOC_SDCA?

That seems off, it's not like SoundWire is Intel or even x86 specific. I would expect either it should be user selectable or the drivers using it should select it. Given that it's a class driver that probably means user selectable I think, some devices might need no extra support?

Yeah currently the class driver itself is user-selectable but doesn't make much sense to have SDCA selected through the host stuff.

Quoted 18 lines

Yeah, just turning it into a user selectable symbol like

sound/soc/sdca/Kconfig +1 -2
index 87ab2895096c..4c0dcb9ff3b9 100644
@@ -2,7 +2,7 @@
 menu "SoundWire (SDCA)"
 
 config SND_SOC_SDCA
-	tristate
+	tristate "SDCA core support"
 	depends on ACPI
 	select AUXILIARY_BUS
 	help
 
--
Quoted 5 lines

appears to work for me, in combination with adding

depends on SND_SOC_SDCA

to the symbol for this driver.

I certainly don't object to SDCA being user selectable, although yeah in my head drivers needing SDCA selecting it is probably the cleanest.

I think a lot of this stems for the slight weirdness around SDCA and SoundWire quirks, there is a weird interaction where SoundWire calls some SDCA functions really early to do some quirk stuff (see sdw_slave_add), but that makes it really easy to end up with weird dependencies, because obviously SDCA will call SoundWire.

Thanks,
Charles

author
#11 lore raw

PATCH v15 4/6 ASoC: Intel: soc-acpi: arl: Add es9356 support

In reply to Zhang Yi

Add support for the es9356 codec in the ARL board configuration.

---
 .../intel/common/soc-acpi-intel-arl-match.c   | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
sound/soc/intel/common/soc-acpi-intel-arl-match.c +52 -0
index c952f7d2b..9782825dd 100644
@@ -192,6 +192,42 @@ static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = {
 	},
 };
 
+static const struct snd_soc_acpi_endpoint es9356_endpoints[] = {
+	{ /* Jack Playback Endpoint */
+		.num = 0,
+		.aggregated = 0,
+		.group_position = 0,
+		.group_id = 0,
+	},
+	{ /* DMIC Capture Endpoint */
+		.num = 1,
+		.aggregated = 0,
+		.group_position = 0,
+		.group_id = 0,
+	},
+	{ /* Jack Capture Endpoint */
+		.num = 2,
+		.aggregated = 0,
+		.group_position = 0,
+		.group_id = 0,
+	},
+	{ /* Speaker Playback Endpoint */
+		.num = 3,
+		.aggregated = 0,
+		.group_position = 0,
+		.group_id = 0,
+	},
+};
+
+static const struct snd_soc_acpi_adr_device es9356_adr[] = {
+	{
+		.adr = 0x00013004b3935601ull,
+		.num_endpoints = ARRAY_SIZE(es9356_endpoints),
+		.endpoints = es9356_endpoints,
+		.name_prefix = "es9356"
+	}
+};
+
 static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = {
 	{
 		.adr = 0x00003001FA424301ull,
@@ -255,6 +291,15 @@ static const struct snd_soc_acpi_adr_device rt1320_2_single_adr[] = {
 	}
 };
 
+static const struct snd_soc_acpi_link_adr arl_n_mrd_es9356_link1[] = {
+	{
+		.mask = BIT(1),
+		.num_adr = ARRAY_SIZE(es9356_adr),
+		.adr_d = es9356_adr,
+	},
+	{}
+};
+
 static const struct snd_soc_acpi_link_adr arl_cs42l43_l0[] = {
 	{
 		.mask = BIT(0),
@@ -528,6 +573,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[] = {
 		.sof_tplg_filename = "sof-arl-rt722-l0_rt1320-l2.tplg",
 		.get_function_tplg_files = sof_sdw_get_tplg_files,
 	},
+	{
+		.link_mask = BIT(1),
+		.links = arl_n_mrd_es9356_link1,
+		.drv_name = "sof_sdw",
+		.sof_tplg_filename = "sof-arl-es9356.tplg",
+		.get_function_tplg_files = sof_sdw_get_tplg_files,
+	},
 	{},
 };
 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_arl_sdw_machines);
Signature · 1 line
2.17.1
author
#12 lore raw

PATCH v15 5/6 ASoC: Intel: sof_sdw: add es9356 support

In reply to Zhang Yi

add Everest-semi ES9356 support

---
 sound/soc/intel/boards/Kconfig | 1 +
 1 file changed, 1 insertion(+)
sound/soc/intel/boards/Kconfig +1 -0
index d53af8f7e..cddbd2aa4 100644
@@ -532,6 +532,7 @@ config SND_SOC_INTEL_SOUNDWIRE_SOF_MACH
 	select MFD_CS42L43_SDW
 	select SND_SOC_CS35L56_SPI
 	select SND_SOC_CS35L56_SDW
+	select SND_SOC_ES9356
 	select SND_SOC_DMIC
 	select SND_SOC_INTEL_HDA_DSP_COMMON
 	imply SND_SOC_SDW_MOCKUP
Signature · 1 line
2.17.1
author
#13 lore raw

PATCH v15 6/6 soundwire: intel_auxdevice: Add es9356 to wake_capable_list

In reply to Zhang Yi

Add es9356 to the wake_capable_list
because it can generate jack events whilst the bus is stopped

---
 drivers/soundwire/intel_auxdevice.c | 1 +
 1 file changed, 1 insertion(+)
drivers/soundwire/intel_auxdevice.c +1 -0
index ee951be15..0b8107bec 100644
@@ -72,6 +72,7 @@ static struct wake_capable_part wake_capable_list[] = {
 	{0x025d, 0x717},
 	{0x025d, 0x721},
 	{0x025d, 0x722},
+	{0x04b3, 0x9356},
 };
 
 static bool is_wake_capable(struct sdw_slave *slave)
Signature · 1 line
2.17.1
maintainer Applied
#14 lore raw

Re: (subset) [PATCH v15 0/6] Add es9356 focused SoundWire CODEC

In reply to Zhang Yi
Quoted 10 lines · Zhang Yi

This patch chain adds support for the ES9356 PC focused SoundWire CODEC.

v15 -> v14:

	-Change `es9356_sdw_remove` from `int(*)` to `void(*)`

v14 -> v13:
-Rebase onto latest linux-next for-next branch

[...]

Applied, thanks!

[6/6] soundwire: intel_auxdevice: Add es9356 to wake_capable_list

      commit: 4e90368e8680d9ddcb06f82f2e63cbbcf21cef2c

Best regards,

Signature · 1 line
~Vinod
maintainer
#15 lore raw

Re: (subset) [PATCH v15 0/6] Add es9356 focused SoundWire CODEC

In reply to Zhang Yi
Quoted 9 lines · Zhang Yi

Add es9356 focused SoundWire CODEC

This patch chain adds support for the ES9356 PC focused SoundWire CODEC.

v15 -> v14:

	-Change `es9356_sdw_remove` from `int(*)` to `void(*)`

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.2

Thanks!

[3/6] ASoC: es9356-sdca: Add ES9356 SDCA driver

      https://git.kernel.org/broonie/sound/c/5d9cb740cd38
[4/6] ASoC: Intel: soc-acpi: arl: Add es9356 support
      https://git.kernel.org/broonie/sound/c/25b905940832
[5/6] ASoC: Intel: sof_sdw: add es9356 support
      https://git.kernel.org/broonie/sound/c/f1e35606d618

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark