Skip to contentSkip to conversation

ASoC: Intel: avs: Machine boards and HDA codec support

PATCH Superseded Cezary Rojewski 4 participants 25 messages Apr 27, 2022 – May 10, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Cezary Rojewski

author maintainer
#0 lore raw

cover ASoC: Intel: avs: Machine boards and HDA codec support

This series focuses on populating boards/ subdirectory with supported configurations by the avs-driver. Note: it is independent of recently provided "Driver code and PCM operations" series [1], that is, code found here should not collide with it.

Series starts with a small change that adds a helper to sound pcm header, allowing for retrieving string naming a direction without the need of substream pointer. Said helper is used by codec driver code that follows it but I believe it's generic and helpful enough that it can be called an independent addition to the sound core.

Code for generic HD-Audio codec driver follows. It is a ASoC wrapper for existing HD-Audio codec code found in sound/pci/hda/. There is basically no custom logic involved up to the point that driver follows HDA_DEV_LEGACY convention, rather than the HDA_DEV_ASOC one. Commit message for the given patch iterates on this and explains crucial parts of the implementation.

From there on is a range of boards appended. All of them follow the same scheme:

- define avs_create_dai_link() so DAI-LINKs can be created dynamically, based on the link_mask (I2S) or the number of entries in the ->pcm_list_head list (HDA)
- define avs_create_dapm_routes() so DAPM routes can be created dynamically, same rules as above apply
- define probe() function that creates new ASoC card, assign all required operations and resources along with calling the two above

[1]: https://lore.kernel.org/all/[email protected]/

Amadeusz Sławiński (1):
ASoC: Intel: avs: Add max98373 machine board

Cezary Rojewski (13):
ALSA: Add snd_pcm_direction_name() helper
ASoC: codecs: Add HD-Audio codec driver
ASoC: Intel: avs: Add HDAudio machine board
ASoC: Intel: avs: Add DMIC machine board
ASoC: Intel: avs: Add ssp-test machine board
ASoC: Intel: avs: Add rt274 machine board
ASoC: Intel: avs: Add rt286 machine board
ASoC: Intel: avs: Add rt298 machine board
ASoC: Intel: avs: Add rt5682 machine board
ASoC: Intel: avs: Add nau8825 machine board
ASoC: Intel: avs: Add ssm4567 machine board
ASoC: Intel: avs: Add max98357a machine board
ASoC: Intel: avs: Add da7219 machine board

 include/sound/pcm.h                    |  19 +-
 sound/soc/codecs/Kconfig               |   5 +
 sound/soc/codecs/Makefile              |   2 +
 sound/soc/codecs/hda-dai.c             | 102 +++++++
 sound/soc/codecs/hda.c                 | 395 +++++++++++++++++++++++++
 sound/soc/codecs/hda.h                 |  19 ++
 sound/soc/intel/Kconfig                |   3 +
 sound/soc/intel/avs/Makefile           |   3 +
 sound/soc/intel/avs/boards/Kconfig     | 121 ++++++++
 sound/soc/intel/avs/boards/Makefile    |  27 ++
 sound/soc/intel/avs/boards/da7219.c    | 281 ++++++++++++++++++
 sound/soc/intel/avs/boards/dmic.c      |  93 ++++++
 sound/soc/intel/avs/boards/hdaudio.c   | 294 ++++++++++++++++++
 sound/soc/intel/avs/boards/max98357a.c | 153 ++++++++++
 sound/soc/intel/avs/boards/max98373.c  | 238 +++++++++++++++
 sound/soc/intel/avs/boards/nau8825.c   | 352 ++++++++++++++++++++++
 sound/soc/intel/avs/boards/rt274.c     | 309 +++++++++++++++++++
 sound/soc/intel/avs/boards/rt286.c     | 280 ++++++++++++++++++
 sound/soc/intel/avs/boards/rt298.c     | 280 ++++++++++++++++++
 sound/soc/intel/avs/boards/rt5682.c    | 339 +++++++++++++++++++++
 sound/soc/intel/avs/boards/ssm4567.c   | 270 +++++++++++++++++
 sound/soc/intel/avs/boards/ssp_test.c  | 178 +++++++++++
 22 files changed, 3759 insertions(+), 4 deletions(-)
 create mode 100644 sound/soc/codecs/hda-dai.c
 create mode 100644 sound/soc/codecs/hda.c
 create mode 100644 sound/soc/codecs/hda.h
 create mode 100644 sound/soc/intel/avs/boards/Kconfig
 create mode 100644 sound/soc/intel/avs/boards/Makefile
 create mode 100644 sound/soc/intel/avs/boards/da7219.c
 create mode 100644 sound/soc/intel/avs/boards/dmic.c
 create mode 100644 sound/soc/intel/avs/boards/hdaudio.c
 create mode 100644 sound/soc/intel/avs/boards/max98357a.c
 create mode 100644 sound/soc/intel/avs/boards/max98373.c
 create mode 100644 sound/soc/intel/avs/boards/nau8825.c
 create mode 100644 sound/soc/intel/avs/boards/rt274.c
 create mode 100644 sound/soc/intel/avs/boards/rt286.c
 create mode 100644 sound/soc/intel/avs/boards/rt298.c
 create mode 100644 sound/soc/intel/avs/boards/rt5682.c
 create mode 100644 sound/soc/intel/avs/boards/ssm4567.c
 create mode 100644 sound/soc/intel/avs/boards/ssp_test.c

base-commit: fa96ec9fa9f8f0c80e8a0129a819f592a39b1044

Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH 1/14 ALSA: Add snd_pcm_direction_name() helper

Allow for retrieving string naming a direction of a stream without the need of substream pointer.

---
 include/sound/pcm.h | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
include/sound/pcm.h +15 -4
index 6b99310b5b88..26523cfe428d 100644
@@ -1392,6 +1392,20 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
 
 const char *snd_pcm_format_name(snd_pcm_format_t format);
 
+/**
+ * snd_pcm_direction_name - Get a string naming the direction of a stream
+ * @direction: Stream's direction, one of SNDRV_PCM_STREAM_XXX
+ *
+ * Returns a string naming the direction of the stream.
+ */
+static inline const char *snd_pcm_direction_name(int direction)
+{
+	if (direction == SNDRV_PCM_STREAM_PLAYBACK)
+		return "Playback";
+	else
+		return "Capture";
+}
+
 /**
  * snd_pcm_stream_str - Get a string naming the direction of a stream
  * @substream: the pcm substream instance
@@ -1400,10 +1414,7 @@ const char *snd_pcm_format_name(snd_pcm_format_t format);
  */
 static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream)
 {
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		return "Playback";
-	else
-		return "Capture";
+	return snd_pcm_direction_name(substream->stream);
 }
 
 /*
Signature · 1 line
2.25.1
author maintainer
#2 lore raw

PATCH 2/14 ASoC: codecs: Add HD-Audio codec driver

In reply to Cezary Rojewski

Add generic ASoC equivalent of ALSA HD-Audio codec. This codec is designed to follow HDA_DEV_LEGACY convention. Driver wrapps existing hda_codec.c handlers to prevent code duplication within the newly added code. Number of DAIs created is dependent on capabilities exposed by the codec itself. Because of this, single solution can be applied to support every single HD-Audio codec type.

At the same, through the ASoC topology, platform drivers may limit the number of endpoints available to the userspace as codec driver exposes BE DAIs only.

Both hda_codec_probe() and hda_codec_remove() declare their expectations on device's usage_count and suspended-status. This is to catch any unexpected behavior as PM-related code for HD-Audio has been changing quite a bit throughout the years.

In order for codec DAI list to reflect its actual PCM capabilities, PCMs need to be built and that can only happen once codec device is constructed. To do that, a valid component->card->snd_card pointer is needed. Said pointer will be provided by the framework once all card components are accounted for and their probing can begin. Usage of "binder" BE DAI solves the problem - codec can be listed as one of HD-Audio card components without declaring any actual BE DAIs statically.

---
 sound/soc/codecs/Kconfig   |   5 +
 sound/soc/codecs/Makefile  |   2 +
 sound/soc/codecs/hda-dai.c | 102 ++++++++++
 sound/soc/codecs/hda.c     | 395 +++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/hda.h     |  19 ++
 5 files changed, 523 insertions(+)
 create mode 100644 sound/soc/codecs/hda-dai.c
 create mode 100644 sound/soc/codecs/hda.c
 create mode 100644 sound/soc/codecs/hda.h
sound/soc/codecs/Kconfig +5 -0
index b106e5517090..23fdbf97e453 100644
@@ -937,6 +937,11 @@ config SND_SOC_HDAC_HDA
 	tristate
 	select SND_HDA
 
+config SND_SOC_HDA
+	tristate "HD-Audio codec driver"
+	select SND_HDA_EXT_CORE
+	select SND_HDA
+
 config SND_SOC_ICS43432
 	tristate "ICS43423 and compatible i2s microphones"
 
sound/soc/codecs/Makefile +2 -0
index 28dc4edfd01f..d32026ae326f 100644
@@ -106,6 +106,7 @@ snd-soc-es8328-spi-objs := es8328-spi.o
 snd-soc-gtm601-objs := gtm601.o
 snd-soc-hdac-hdmi-objs := hdac_hdmi.o
 snd-soc-hdac-hda-objs := hdac_hda.o
+snd-soc-hda-codec-objs := hda.o hda-dai.o
 snd-soc-ics43432-objs := ics43432.o
 snd-soc-inno-rk3036-objs := inno_rk3036.o
 snd-soc-isabelle-objs := isabelle.o
@@ -458,6 +459,7 @@ obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.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_HDAC_HDA) += snd-soc-hdac-hda.o
+obj-$(CONFIG_SND_SOC_HDA) += snd-soc-hda-codec.o
 obj-$(CONFIG_SND_SOC_ICS43432)	+= snd-soc-ics43432.o
 obj-$(CONFIG_SND_SOC_INNO_RK3036)	+= snd-soc-inno-rk3036.o
 obj-$(CONFIG_SND_SOC_ISABELLE)	+= snd-soc-isabelle.o
sound/soc/codecs/hda-dai.c new file +102 -0

102 lines not on this page · raw message

sound/soc/codecs/hda.c new file +395 -0

395 lines not on this page · raw message

sound/soc/codecs/hda.h new file +19 -0
new file mode 100644
index 000000000000..78a2be4945b1
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright(c) 2021-2022 Intel Corporation. All rights reserved.
+ *
+ * Author: Cezary Rojewski <[email protected]>
+ */
+
+#ifndef SND_SOC_CODECS_HDA_H
+#define SND_SOC_CODECS_HDA_H
+
+#define hda_codec_is_display(codec) \
+	((((codec)->core.vendor_id >> 16) & 0xFFFF) == 0x8086)
+
+extern const struct snd_soc_dai_ops snd_soc_hda_codec_dai_ops;
+
+extern const struct hdac_ext_bus_ops soc_hda_ext_bus_ops;
+int hda_codec_probe_complete(struct hda_codec *codec);
+
+#endif
Signature · 1 line
2.25.1
#3 lore raw

Re: [PATCH 02/14] ASoC: codecs: Add HD-Audio codec driver

Quoted 16 lines · Cezary Rojewski

Add generic ASoC equivalent of ALSA HD-Audio codec. This codec is designed to follow HDA_DEV_LEGACY convention. Driver wrapps existing hda_codec.c handlers to prevent code duplication within the newly added code. Number of DAIs created is dependent on capabilities exposed by the codec itself. Because of this, single solution can be applied to support every single HD-Audio codec type.

At the same, through the ASoC topology, platform drivers may limit the number of endpoints available to the userspace as codec driver exposes BE DAIs only.

Both hda_codec_probe() and hda_codec_remove() declare their expectations on device's usage_count and suspended-status. This is to catch any unexpected behavior as PM-related code for HD-Audio has been changing quite a bit throughout the years.

Quoted 8 lines

In order for codec DAI list to reflect its actual PCM capabilities, PCMs need to be built and that can only happen once codec device is constructed. To do that, a valid component->card->snd_card pointer is needed. Said pointer will be provided by the framework once all card components are accounted for and their probing can begin. Usage of "binder" BE DAI solves the problem - codec can be listed as one of HD-Audio card components without declaring any actual BE DAIs statically.

I am surprised the explanations don't even mention the existence of hdac_hda.c

/*

* hdac_hda.c - ASoC extensions to reuse the legacy HDA codec drivers

* with ASoC platform drivers. These APIs are called by the legacy HDA

* codec drivers using hdac_ext_bus_ops ops.

*/

I thought the series was about adding machine drivers, but this also adds code on the sound/soc/codecs/ side which I didn't see coming.

I am not qualified to review this part of the code, I just wonder about duplication of functionality.

At the very least an explanation on why you decided to NOT use hdac_hda.c would be useful to reviewers and maintainers.

Thanks.

Quoted 583 lines
---
 sound/soc/codecs/Kconfig   |   5 +
 sound/soc/codecs/Makefile  |   2 +
 sound/soc/codecs/hda-dai.c | 102 ++++++++++
 sound/soc/codecs/hda.c     | 395 +++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/hda.h     |  19 ++
 5 files changed, 523 insertions(+)
 create mode 100644 sound/soc/codecs/hda-dai.c
 create mode 100644 sound/soc/codecs/hda.c
 create mode 100644 sound/soc/codecs/hda.h
sound/soc/codecs/Kconfig +5 -0
index b106e5517090..23fdbf97e453 100644
@@ -937,6 +937,11 @@ config SND_SOC_HDAC_HDA
 	tristate
 	select SND_HDA
 
+config SND_SOC_HDA
+	tristate "HD-Audio codec driver"
+	select SND_HDA_EXT_CORE
+	select SND_HDA
+
 config SND_SOC_ICS43432
 	tristate "ICS43423 and compatible i2s microphones"
 
sound/soc/codecs/Makefile +2 -0
index 28dc4edfd01f..d32026ae326f 100644
@@ -106,6 +106,7 @@ snd-soc-es8328-spi-objs := es8328-spi.o
 snd-soc-gtm601-objs := gtm601.o
 snd-soc-hdac-hdmi-objs := hdac_hdmi.o
 snd-soc-hdac-hda-objs := hdac_hda.o
+snd-soc-hda-codec-objs := hda.o hda-dai.o
 snd-soc-ics43432-objs := ics43432.o
 snd-soc-inno-rk3036-objs := inno_rk3036.o
 snd-soc-isabelle-objs := isabelle.o
@@ -458,6 +459,7 @@ obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.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_HDAC_HDA) += snd-soc-hdac-hda.o
+obj-$(CONFIG_SND_SOC_HDA) += snd-soc-hda-codec.o
 obj-$(CONFIG_SND_SOC_ICS43432)	+= snd-soc-ics43432.o
 obj-$(CONFIG_SND_SOC_INNO_RK3036)	+= snd-soc-inno-rk3036.o
 obj-$(CONFIG_SND_SOC_ISABELLE)	+= snd-soc-isabelle.o
sound/soc/codecs/hda-dai.c new file +102 -0
new file mode 100644
index 000000000000..5371ff086261
@@ -0,0 +1,102 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright(c) 2021-2022 Intel Corporation. All rights reserved.
+//
+// Author: Cezary Rojewski <[email protected]>
+//
+
+#include <sound/soc.h>
+#include <sound/hda_codec.h>
+#include "hda.h"
+
+static int hda_codec_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
+{
+	struct hda_pcm_stream *stream_info;
+	struct hda_codec *codec;
+	struct hda_pcm *pcm;
+	int ret;
+
+	codec = dev_to_hda_codec(dai->dev);
+	stream_info = snd_soc_dai_get_dma_data(dai, substream);
+	pcm = container_of(stream_info, struct hda_pcm, stream[substream->stream]);
+
+	dev_dbg(dai->dev, "open stream codec: %08x, info: %p, pcm: %p %s substream: %p\n",
+		codec->core.vendor_id, stream_info, pcm, pcm->name, substream);
+
+	snd_hda_codec_pcm_get(pcm);
+
+	ret = stream_info->ops.open(stream_info, codec, substream);
+	if (ret < 0) {
+		dev_err(dai->dev, "codec open failed: %d\n", ret);
+		snd_hda_codec_pcm_put(pcm);
+		return ret;
+	}
+
+	return 0;
+}
+
+static void hda_codec_dai_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
+{
+	struct hda_pcm_stream *stream_info;
+	struct hda_codec *codec;
+	struct hda_pcm *pcm;
+	int ret;
+
+	codec = dev_to_hda_codec(dai->dev);
+	stream_info = snd_soc_dai_get_dma_data(dai, substream);
+	pcm = container_of(stream_info, struct hda_pcm, stream[substream->stream]);
+
+	dev_dbg(dai->dev, "close stream codec: %08x, info: %p, pcm: %p %s substream: %p\n",
+		codec->core.vendor_id, stream_info, pcm, pcm->name, substream);
+
+	ret = stream_info->ops.close(stream_info, codec, substream);
+	if (ret < 0)
+		dev_err(dai->dev, "codec close failed: %d\n", ret);
+
+	snd_hda_codec_pcm_put(pcm);
+}
+
+static int hda_codec_dai_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
+{
+	struct hda_pcm_stream *stream_info;
+	struct hda_codec *codec;
+
+	codec = dev_to_hda_codec(dai->dev);
+	stream_info = snd_soc_dai_get_dma_data(dai, substream);
+
+	snd_hda_codec_cleanup(codec, stream_info, substream);
+
+	return 0;
+}
+
+static int hda_codec_dai_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct hda_pcm_stream *stream_info;
+	struct hdac_stream *stream;
+	struct hda_codec *codec;
+	unsigned int format;
+	int ret;
+
+	codec = dev_to_hda_codec(dai->dev);
+	stream = substream->runtime->private_data;
+	stream_info = snd_soc_dai_get_dma_data(dai, substream);
+	format = snd_hdac_calc_stream_format(runtime->rate, runtime->channels, runtime->format,
+					     runtime->sample_bits, 0);
+
+	ret = snd_hda_codec_prepare(codec, stream_info, stream->stream_tag, format, substream);
+	if (ret < 0) {
+		dev_err(dai->dev, "codec prepare failed: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+const struct snd_soc_dai_ops snd_soc_hda_codec_dai_ops = {
+	.startup = hda_codec_dai_startup,
+	.shutdown = hda_codec_dai_shutdown,
+	.hw_free = hda_codec_dai_hw_free,
+	.prepare = hda_codec_dai_prepare,
+};
+EXPORT_SYMBOL_GPL(snd_soc_hda_codec_dai_ops);
sound/soc/codecs/hda.c new file +395 -0
new file mode 100644
index 000000000000..edcb8bc6806b
@@ -0,0 +1,395 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright(c) 2021-2022 Intel Corporation. All rights reserved.
+//
+// Author: Cezary Rojewski <[email protected]>
+//
+
+#include <linux/module.h>
+#include <linux/pm_runtime.h>
+#include <sound/soc.h>
+#include <sound/hdaudio_ext.h>
+#include <sound/hda_i915.h>
+#include <sound/hda_codec.h>
+#include "hda.h"
+
+static int hda_codec_create_dais(struct hda_codec *codec, int pcm_count,
+				 struct snd_soc_dai_driver **drivers)
+{
+	struct device *dev = &codec->core.dev;
+	struct snd_soc_dai_driver *drvs;
+	struct hda_pcm *pcm;
+	int i;
+
+	drvs = devm_kcalloc(dev, pcm_count, sizeof(*drvs), GFP_KERNEL);
+	if (!drvs)
+		return -ENOMEM;
+
+	pcm = list_first_entry(&codec->pcm_list_head, struct hda_pcm, list);
+
+	for (i = 0; i < pcm_count; i++, pcm = list_next_entry(pcm, list)) {
+		struct snd_soc_pcm_stream *stream;
+		int dir;
+
+		dev_info(dev, "creating for %s %d\n", pcm->name, i);
+		drvs[i].id = i;
+		drvs[i].name = pcm->name;
+		drvs[i].ops = &snd_soc_hda_codec_dai_ops;
+
+		dir = SNDRV_PCM_STREAM_PLAYBACK;
+		stream = &drvs[i].playback;
+		if (!pcm->stream[dir].substreams) {
+			dev_info(dev, "skipping playback dai for %s\n", pcm->name);
+			goto capture_dais;
+		}
+
+		stream->stream_name =
+			devm_kasprintf(dev, GFP_KERNEL, "%s %s", pcm->name,
+				       snd_pcm_direction_name(dir));
+		if (!stream->stream_name)
+			return -ENOMEM;
+		stream->channels_min = pcm->stream[dir].channels_min;
+		stream->channels_max = pcm->stream[dir].channels_max;
+		stream->rates = pcm->stream[dir].rates;
+		stream->formats = pcm->stream[dir].formats;
+		stream->sig_bits = pcm->stream[dir].maxbps;
+
+capture_dais:
+		dir = SNDRV_PCM_STREAM_CAPTURE;
+		stream = &drvs[i].capture;
+		if (!pcm->stream[dir].substreams) {
+			dev_info(dev, "skipping capture dai for %s\n", pcm->name);
+			continue;
+		}
+
+		stream->stream_name =
+			devm_kasprintf(dev, GFP_KERNEL, "%s %s", pcm->name,
+				       snd_pcm_direction_name(dir));
+		if (!stream->stream_name)
+			return -ENOMEM;
+		stream->channels_min = pcm->stream[dir].channels_min;
+		stream->channels_max = pcm->stream[dir].channels_max;
+		stream->rates = pcm->stream[dir].rates;
+		stream->formats = pcm->stream[dir].formats;
+		stream->sig_bits = pcm->stream[dir].maxbps;
+	}
+
+	*drivers = drvs;
+	return 0;
+}
+
+static int hda_codec_register_dais(struct hda_codec *codec, struct snd_soc_component *component)
+{
+	struct snd_soc_dai_driver *drvs = NULL;
+	struct snd_soc_dapm_context *dapm;
+	struct hda_pcm *pcm;
+	int ret, pcm_count = 0;
+
+	if (list_empty(&codec->pcm_list_head))
+		return -EINVAL;
+	list_for_each_entry(pcm, &codec->pcm_list_head, list)
+		pcm_count++;
+
+	ret = hda_codec_create_dais(codec, pcm_count, &drvs);
+	if (ret < 0)
+		return ret;
+
+	dapm = snd_soc_component_get_dapm(component);
+
+	list_for_each_entry(pcm, &codec->pcm_list_head, list) {
+		struct snd_soc_dai *dai;
+
+		dai = snd_soc_register_dai(component, drvs, false);
+		if (!dai) {
+			dev_err(component->dev, "register dai for %s failed\n", pcm->name);
+			return -EINVAL;
+		}
+
+		ret = snd_soc_dapm_new_dai_widgets(dapm, dai);
+		if (ret < 0) {
+			dev_err(component->dev, "create widgets failed: %d\n", ret);
+			snd_soc_unregister_dai(dai);
+			return ret;
+		}
+
+		snd_soc_dai_init_dma_data(dai, &pcm->stream[0], &pcm->stream[1]);
+		drvs++;
+	}
+
+	return 0;
+}
+
+static void hda_codec_unregister_dais(struct hda_codec *codec,
+				      struct snd_soc_component *component)
+{
+	struct snd_soc_dai *dai, *save;
+	struct hda_pcm *pcm;
+
+	for_each_component_dais_safe(component, dai, save) {
+		list_for_each_entry(pcm, &codec->pcm_list_head, list) {
+			if (strcmp(dai->driver->name, pcm->name))
+				continue;
+
+			if (dai->playback_widget)
+				snd_soc_dapm_free_widget(dai->playback_widget);
+			if (dai->capture_widget)
+				snd_soc_dapm_free_widget(dai->capture_widget);
+			snd_soc_unregister_dai(dai);
+			break;
+		}
+	}
+}
+
+int hda_codec_probe_complete(struct hda_codec *codec)
+{
+	struct hdac_device *hdev = &codec->core;
+	struct hdac_bus *bus = hdev->bus;
+	int ret;
+
+	ret = snd_hda_codec_build_controls(codec);
+	if (ret < 0) {
+		dev_err(&hdev->dev, "unable to create controls %d\n", ret);
+		goto out;
+	}
+
+	/* Bus suspended codecs as it does not manage their pm */
+	pm_runtime_set_active(&hdev->dev);
+	/* rpm was forbidden in snd_hda_codec_device_new() */
+	snd_hda_codec_set_power_save(codec, 2000);
+	snd_hda_codec_register(codec);
+out:
+	/* Complement pm_runtime_get_sync(bus) in probe */
+	pm_runtime_mark_last_busy(bus->dev);
+	pm_runtime_put_autosuspend(bus->dev);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(hda_codec_probe_complete);
+
+/* Expects codec with usage_count=1 and status=suspended */
+static int hda_codec_probe(struct snd_soc_component *component)
+{
+	struct hda_codec *codec = dev_to_hda_codec(component->dev);
+	struct hdac_device *hdev = &codec->core;
+	struct hdac_bus *bus = hdev->bus;
+	struct hdac_ext_link *hlink;
+	hda_codec_patch_t patch;
+	int ret;
+
+#ifdef CONFIG_PM
+	WARN_ON(atomic_read(&hdev->dev.power.usage_count) != 1 ||
+		!pm_runtime_status_suspended(&hdev->dev));
+#endif
+
+	hlink = snd_hdac_ext_bus_link_at(bus, hdev->addr);
+	if (!hlink) {
+		dev_err(&hdev->dev, "hdac link not found\n");
+		return -EIO;
+	}
+
+	pm_runtime_get_sync(bus->dev);
+	if (hda_codec_is_display(codec))
+		snd_hdac_display_power(bus, hdev->addr, true);
+	snd_hdac_ext_bus_link_get(bus, hlink);
+
+	ret = snd_hda_codec_device_new(codec->bus, component->card->snd_card, hdev->addr, codec,
+				       false);
+	if (ret < 0) {
+		dev_err(&hdev->dev, "create hda codec failed: %d\n", ret);
+		goto device_new_err;
+	}
+
+	ret = snd_hda_codec_set_name(codec, codec->preset->name);
+	if (ret < 0) {
+		dev_err(&hdev->dev, "name failed %s\n", codec->preset->name);
+		goto err;
+	}
+
+	ret = snd_hdac_regmap_init(&codec->core);
+	if (ret < 0) {
+		dev_err(&hdev->dev, "regmap init failed\n");
+		goto err;
+	}
+
+	patch = (hda_codec_patch_t)codec->preset->driver_data;
+	if (!patch) {
+		dev_err(&hdev->dev, "no patch specified?\n");
+		ret = -EINVAL;
+		goto err;
+	}
+
+	ret = patch(codec);
+	if (ret < 0) {
+		dev_err(&hdev->dev, "patch failed %d\n", ret);
+		goto err;
+	}
+
+	/* configure codec for 1:1 PCM:DAI mapping */
+	codec->mst_no_extra_pcms = 1;
+
+	ret = snd_hda_codec_parse_pcms(codec);
+	if (ret < 0) {
+		dev_err(&hdev->dev, "unable to map pcms to dai %d\n", ret);
+		goto parse_pcms_err;
+	}
+
+	ret = hda_codec_register_dais(codec, component);
+	if (ret < 0) {
+		dev_err(&hdev->dev, "update dais failed: %d\n", ret);
+		goto parse_pcms_err;
+	}
+
+	if (!hda_codec_is_display(codec)) {
+		ret = hda_codec_probe_complete(codec);
+		if (ret < 0)
+			goto complete_err;
+	}
+
+	codec->core.lazy_cache = true;
+
+	return 0;
+
+complete_err:
+	hda_codec_unregister_dais(codec, component);
+parse_pcms_err:
+	if (codec->patch_ops.free)
+		codec->patch_ops.free(codec);
+err:
+	snd_hda_codec_cleanup_for_unbind(codec);
+device_new_err:
+	if (hda_codec_is_display(codec))
+		snd_hdac_display_power(bus, hdev->addr, false);
+
+	snd_hdac_ext_bus_link_put(bus, hlink);
+
+	pm_runtime_mark_last_busy(bus->dev);
+	pm_runtime_put_autosuspend(bus->dev);
+	return ret;
+}
+
+/* Leaves codec with usage_count=1 and status=suspended */
+static void hda_codec_remove(struct snd_soc_component *component)
+{
+	struct hda_codec *codec = dev_to_hda_codec(component->dev);
+	struct hdac_device *hdev = &codec->core;
+	struct hdac_bus *bus = hdev->bus;
+	struct hdac_ext_link *hlink;
+	bool was_registered = codec->registered;
+
+	/* Don't allow any more runtime suspends */
+	pm_runtime_forbid(&hdev->dev);
+
+	hda_codec_unregister_dais(codec, component);
+
+	if (codec->patch_ops.free)
+		codec->patch_ops.free(codec);
+
+	snd_hda_codec_cleanup_for_unbind(codec);
+	pm_runtime_put_noidle(&hdev->dev);
+	/* snd_hdac_device_exit() is only called on bus remove */
+	pm_runtime_set_suspended(&hdev->dev);
+
+	if (hda_codec_is_display(codec))
+		snd_hdac_display_power(bus, hdev->addr, false);
+
+	hlink = snd_hdac_ext_bus_link_at(bus, hdev->addr);
+	if (hlink)
+		snd_hdac_ext_bus_link_put(bus, hlink);
+	/*
+	 * HDMI card's hda_codec_probe_complete() (see late_probe()) may
+	 * not be called due to early error, leaving bus uc unbalanced
+	 */
+	if (!was_registered) {
+		pm_runtime_mark_last_busy(bus->dev);
+		pm_runtime_put_autosuspend(bus->dev);
+	}
+
+#ifdef CONFIG_PM
+	WARN_ON(atomic_read(&hdev->dev.power.usage_count) != 1 ||
+		!pm_runtime_status_suspended(&hdev->dev));
+#endif
+}
+
+static const struct snd_soc_dapm_route hda_dapm_routes[] = {
+	{"AIF1TX", NULL, "Codec Input Pin1"},
+	{"AIF2TX", NULL, "Codec Input Pin2"},
+	{"AIF3TX", NULL, "Codec Input Pin3"},
+
+	{"Codec Output Pin1", NULL, "AIF1RX"},
+	{"Codec Output Pin2", NULL, "AIF2RX"},
+	{"Codec Output Pin3", NULL, "AIF3RX"},
+};
+
+static const struct snd_soc_dapm_widget hda_dapm_widgets[] = {
+	/* Audio Interface */
+	SND_SOC_DAPM_AIF_IN("AIF1RX", "Analog Codec Playback", 0, SND_SOC_NOPM, 0, 0),
+	SND_SOC_DAPM_AIF_IN("AIF2RX", "Digital Codec Playback", 0, SND_SOC_NOPM, 0, 0),
+	SND_SOC_DAPM_AIF_IN("AIF3RX", "Alt Analog Codec Playback", 0, SND_SOC_NOPM, 0, 0),
+	SND_SOC_DAPM_AIF_OUT("AIF1TX", "Analog Codec Capture", 0, SND_SOC_NOPM, 0, 0),
+	SND_SOC_DAPM_AIF_OUT("AIF2TX", "Digital Codec Capture", 0, SND_SOC_NOPM, 0, 0),
+	SND_SOC_DAPM_AIF_OUT("AIF3TX", "Alt Analog Codec Capture", 0, SND_SOC_NOPM, 0, 0),
+
+	/* Input Pins */
+	SND_SOC_DAPM_INPUT("Codec Input Pin1"),
+	SND_SOC_DAPM_INPUT("Codec Input Pin2"),
+	SND_SOC_DAPM_INPUT("Codec Input Pin3"),
+
+	/* Output Pins */
+	SND_SOC_DAPM_OUTPUT("Codec Output Pin1"),
+	SND_SOC_DAPM_OUTPUT("Codec Output Pin2"),
+	SND_SOC_DAPM_OUTPUT("Codec Output Pin3"),
+};
+
+static struct snd_soc_dai_driver card_binder_dai = {
+	.id = -1,
+	.name = "codec-probing-DAI",
+};
+
+static int hda_hdev_attach(struct hdac_device *hdev)
+{
+	struct hda_codec *codec = dev_to_hda_codec(&hdev->dev);
+	struct snd_soc_component_driver *comp_drv;
+
+	comp_drv = devm_kzalloc(&hdev->dev, sizeof(*comp_drv), GFP_KERNEL);
+	if (!comp_drv)
+		return -ENOMEM;
+
+	/*
+	 * It's save to rely on dev_name() rather than a copy as component
+	 * driver's lifetime is directly tied to hda codec one
+	 */
+	comp_drv->name = dev_name(&hdev->dev);
+	comp_drv->probe = hda_codec_probe;
+	comp_drv->remove = hda_codec_remove;
+	comp_drv->idle_bias_on = false;
+	if (!hda_codec_is_display(codec)) {
+		comp_drv->dapm_widgets = hda_dapm_widgets;
+		comp_drv->num_dapm_widgets = ARRAY_SIZE(hda_dapm_widgets);
+		comp_drv->dapm_routes = hda_dapm_routes;
+		comp_drv->num_dapm_routes = ARRAY_SIZE(hda_dapm_routes);
+	}
+
+	return snd_soc_register_component(&hdev->dev, comp_drv, &card_binder_dai, 1);
+}
+
+static int hda_hdev_detach(struct hdac_device *hdev)
+{
+	struct hda_codec *codec = dev_to_hda_codec(&hdev->dev);
+
+	if (codec->registered)
+		cancel_delayed_work_sync(&codec->jackpoll_work);
+
+	snd_soc_unregister_component(&hdev->dev);
+
+	return 0;
+}
+
+const struct hdac_ext_bus_ops soc_hda_ext_bus_ops = {
+	.hdev_attach = hda_hdev_attach,
+	.hdev_detach = hda_hdev_detach,
+};
+EXPORT_SYMBOL_GPL(soc_hda_ext_bus_ops);
+
+MODULE_DESCRIPTION("HD-Audio codec driver");
+MODULE_AUTHOR("Cezary Rojewski <[email protected]>");
+MODULE_LICENSE("GPL");
sound/soc/codecs/hda.h new file +19 -0
new file mode 100644
index 000000000000..78a2be4945b1
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright(c) 2021-2022 Intel Corporation. All rights reserved.
+ *
+ * Author: Cezary Rojewski <[email protected]>
+ */
+
+#ifndef SND_SOC_CODECS_HDA_H
+#define SND_SOC_CODECS_HDA_H
+
+#define hda_codec_is_display(codec) \
+	((((codec)->core.vendor_id >> 16) & 0xFFFF) == 0x8086)
+
+extern const struct snd_soc_dai_ops snd_soc_hda_codec_dai_ops;
+
+extern const struct hdac_ext_bus_ops soc_hda_ext_bus_ops;
+int hda_codec_probe_complete(struct hda_codec *codec);
+
+#endif
maintainer
#4 lore raw

Re: [PATCH 02/14] ASoC: codecs: Add HD-Audio codec driver

Quoted 12 lines · Pierre-Louis Bossart
Quoted 3 lines · Cezary Rojewski

Add generic ASoC equivalent of ALSA HD-Audio codec. This codec is designed to follow HDA_DEV_LEGACY convention. Driver wrapps existing hda_codec.c handlers to prevent code duplication within the newly added

I am surprised the explanations don't even mention the existence of hdac_hda.c

I thought the series was about adding machine drivers, but this also adds code on the sound/soc/codecs/ side which I didn't see coming.

Quoted 5 lines

I am not qualified to review this part of the code, I just wonder about duplication of functionality.

At the very least an explanation on why you decided to NOT use hdac_hda.c would be useful to reviewers and maintainers.

Right, why the duplication here? Can't we fix or extend the existing code to do whatever it's not currently doing which compels reimplementation?

author maintainer
#5 lore raw

Re: [PATCH 02/14] ASoC: codecs: Add HD-Audio codec driver

Quoted 16 lines · Mark Brown
Quoted 14 lines · Pierre-Louis Bossart
Quoted 3 lines · Cezary Rojewski

Add generic ASoC equivalent of ALSA HD-Audio codec. This codec is designed to follow HDA_DEV_LEGACY convention. Driver wrapps existing hda_codec.c handlers to prevent code duplication within the newly added

I am surprised the explanations don't even mention the existence of hdac_hda.c

I thought the series was about adding machine drivers, but this also adds code on the sound/soc/codecs/ side which I didn't see coming.

I am not qualified to review this part of the code, I just wonder about duplication of functionality.

Quoted 6 lines
Quoted 2 lines

At the very least an explanation on why you decided to NOT use hdac_hda.c would be useful to reviewers and maintainers.

Right, why the duplication here? Can't we fix or extend the existing code to do whatever it's not currently doing which compels reimplementation?

Sorry for the late response, did not realize there is an unanswered comment here.

So, the rough list goes as:
- hdac_hda.c hardcodes codec capabilities rather than aligning with what sound/pci/hda/ code does
- merges HDMI (i.e. Intel i915 audio component) and HDA DAIs together whereas these are two separate devices
- because of above, implements custom search/matching mechanism for PCM/DAI
- cont. because of above, its header hosts private data struct, unnecessary complication
- follows HDA_DEV_ASOC convention rather than HDA_DEV_LEGACY causing misalignments between sound/pci/hda and sound/soc/ behaviour
- has basic PM runtime support and does not survive scenarios where resume/suspend + denylist + rmmod/modprobe are mixed together or invoked in unordered fashion between this module and several others in the audio stack

My suggestion is different: have all HD-Audio ASoC users switch to this implementation when possible and remove the existing code along with skylake-driver.

Regards,
Czarek

#6 lore raw

Re: [PATCH 02/14] ASoC: codecs: Add HD-Audio codec driver

Quoted 43 lines · Cezary Rojewski
Quoted 17 lines · Mark Brown
Quoted 15 lines · Pierre-Louis Bossart
Quoted 3 lines · Cezary Rojewski

Add generic ASoC equivalent of ALSA HD-Audio codec. This codec is designed to follow HDA_DEV_LEGACY convention. Driver wrapps existing hda_codec.c handlers to prevent code duplication within the newly added

I am surprised the explanations don't even mention the existence of hdac_hda.c

I thought the series was about adding machine drivers, but this also adds code on the sound/soc/codecs/ side which I didn't see coming.

I am not qualified to review this part of the code, I just wonder about duplication of functionality.

Quoted 6 lines
Quoted 2 lines

At the very least an explanation on why you decided to NOT use hdac_hda.c would be useful to reviewers and maintainers.

Right, why the duplication here?  Can't we fix or extend the existing code to do whatever it's not currently doing which compels reimplementation?

Sorry for the late response, did not realize there is an unanswered comment here.

So, the rough list goes as:
- hdac_hda.c hardcodes codec capabilities rather than aligning with what sound/pci/hda/ code does
- merges HDMI (i.e. Intel i915 audio component) and HDA DAIs together whereas these are two separate devices
- because of above, implements custom search/matching mechanism for PCM/DAI
- cont. because of above, its header hosts private data struct, unnecessary complication
- follows HDA_DEV_ASOC convention rather than HDA_DEV_LEGACY causing misalignments between sound/pci/hda and sound/soc/ behaviour
- has basic PM runtime support and does not survive scenarios where resume/suspend + denylist + rmmod/modprobe are mixed together or invoked in unordered fashion between this module and several others in the audio stack

Quoted 3 lines

My suggestion is different: have all HD-Audio ASoC users switch to this implementation when possible and remove the existing code along with skylake-driver.

I am not against change and will agree that HDaudio support is far from perfect, but it's been released for multiple generations from dozens of OEMs and mostly works. All the issues reported to us are related to codec configurations that also don't work with the legacy HDaudio driver, DMIC configurations, CSME authentication or system hangs that have not been root-caused [1]. HDaudio/ASoC interfaces are not on our radar as problematic.

Disrupting basic HDaudio support to do things better has to be handled with extreme caution and a ton of testing involving distro maintainers and community members, so we are talking about an opt-in transition, not an immediate switch. We've done a similar transition in the past to stop using a dedicated hdac_hdmi.c codec, see all references to the 'use_common_hdmi' parameter in the SOF code. That transition seems to go exactly against your second point above on HDMI and HDA being different devices, so this could be an interesting debate.

Changes to the HDAudio/ASoC support would need to be handled with a separate patchset anyways, and the SOF side changes done after we are finished with the IPC4 and MeteorLake upstreaming. No one in our team has any bandwidth to help with reviews or tests on this topic at the moment.

I will also re-state that the removal of the skylake driver can only happen after a long period of deprecation, when firmware and topologies have been picked by distributions and all users are known to have switched, so it's very likely that any alignment between "all HD-Audio ASoC users" mentioned above does include the Skylake driver, doesn't it?

So to circle back: is there anything preventing the use of the existing hdac_hda.c codec in this "ASoC: Intel: avs: Machine boards and HDA codec support" series and can the HDaudio codec change be done "later" in a more organized way?

Thanks!
-Pierre

[1]
https://github.com/thesofproject/linux/issues?q=is%3Aissue+is%3Aopen+label%3ACommunity+-label%3A%22codec+ES8336%22

author maintainer
#7 lore raw

Re: [PATCH 02/14] ASoC: codecs: Add HD-Audio codec driver

Quoted 1 line · Pierre-Louis Bossart

On 5/6/22 08:39, Cezary Rojewski wrote:

...

Quoted 22 lines
Quoted 18 lines

Sorry for the late response, did not realize there is an unanswered comment here.

So, the rough list goes as:
- hdac_hda.c hardcodes codec capabilities rather than aligning with what sound/pci/hda/ code does
- merges HDMI (i.e. Intel i915 audio component) and HDA DAIs together whereas these are two separate devices
- because of above, implements custom search/matching mechanism for PCM/DAI
- cont. because of above, its header hosts private data struct, unnecessary complication
- follows HDA_DEV_ASOC convention rather than HDA_DEV_LEGACY causing misalignments between sound/pci/hda and sound/soc/ behaviour
- has basic PM runtime support and does not survive scenarios where resume/suspend + denylist + rmmod/modprobe are mixed together or invoked in unordered fashion between this module and several others in the audio stack

Quoted 3 lines

My suggestion is different: have all HD-Audio ASoC users switch to this implementation when possible and remove the existing code along with skylake-driver.

Quoted 7 lines

I am not against change and will agree that HDaudio support is far from perfect, but it's been released for multiple generations from dozens of OEMs and mostly works. All the issues reported to us are related to codec configurations that also don't work with the legacy HDaudio driver, DMIC configurations, CSME authentication or system hangs that have not been root-caused [1]. HDaudio/ASoC interfaces are not on our radar as problematic.

That's why aligning with sound/pci/hda behavior is better for both, ALSA and ASoC users -> one place to fix the problems, both clients happy.

Quoted 9 lines

Disrupting basic HDaudio support to do things better has to be handled with extreme caution and a ton of testing involving distro maintainers and community members, so we are talking about an opt-in transition, not an immediate switch. We've done a similar transition in the past to stop using a dedicated hdac_hdmi.c codec, see all references to the 'use_common_hdmi' parameter in the SOF code. That transition seems to go exactly against your second point above on HDMI and HDA being different devices, so this could be an interesting debate.

Quoted 4 lines

Changes to the HDAudio/ASoC support would need to be handled with a separate patchset anyways, and the SOF side changes done after we are finished with the IPC4 and MeteorLake upstreaming. No one in our team has any bandwidth to help with reviews or tests on this topic at the moment.

Agree. This won't be forced on anyone and that's why separate implementation needed to be provided. There is too much to cover if we were to refactor hdac_hda.c

Quoted 5 lines

I will also re-state that the removal of the skylake driver can only happen after a long period of deprecation, when firmware and topologies have been picked by distributions and all users are known to have switched, so it's very likely that any alignment between "all HD-Audio ASoC users" mentioned above does include the Skylake driver, doesn't it?

Nah, I don't believe we need to be saving skylake-driver here. By "all HD-Audio ASoC users" I meant sof-driver as it isn't going anywhere - what cannot be said about the skylake-driver :)

Quoted 4 lines

So to circle back: is there anything preventing the use of the existing hdac_hda.c codec in this "ASoC: Intel: avs: Machine boards and HDA codec support" series and can the HDaudio codec change be done "later" in a more organized way?

Yeah, all the pm scenarios will fail when paired with the avs-driver. The expectations are different. We'd have to fix probe() and remove() (and related) sequences for the hdac_hda.c, and given that its users did not notice prompts further problems with the refactor. This is very similar to the skylake-driver vs avs-driver case. We could have applied ~300 patches we had internally that prepare skylake-driver to be re-modeled and then apply patchsets which look more or less like the avs-driver series instead of providing a parallel driver.

But the reality shows that such approach applies too much pressure on the reviewers and leaves no fallback option for the end users if anything fails along the way.

Regards,
Czarek

#8 lore raw

Re: [PATCH 02/14] ASoC: codecs: Add HD-Audio codec driver

Quoted 86 lines · Cezary Rojewski
Quoted 1 line · Pierre-Louis Bossart

On 5/6/22 08:39, Cezary Rojewski wrote:

...

Quoted 23 lines
Quoted 19 lines

Sorry for the late response, did not realize there is an unanswered comment here.

So, the rough list goes as:
- hdac_hda.c hardcodes codec capabilities rather than aligning with what sound/pci/hda/ code does
- merges HDMI (i.e. Intel i915 audio component) and HDA DAIs together whereas these are two separate devices
- because of above, implements custom search/matching mechanism for PCM/DAI
- cont. because of above, its header hosts private data struct, unnecessary complication
- follows HDA_DEV_ASOC convention rather than HDA_DEV_LEGACY causing misalignments between sound/pci/hda and sound/soc/ behaviour
- has basic PM runtime support and does not survive scenarios where resume/suspend + denylist + rmmod/modprobe are mixed together or invoked in unordered fashion between this module and several others in the audio stack

Quoted 3 lines

My suggestion is different: have all HD-Audio ASoC users switch to this implementation when possible and remove the existing code along with skylake-driver.

Quoted 7 lines

I am not against change and will agree that HDaudio support is far from perfect, but it's been released for multiple generations from dozens of OEMs and mostly works. All the issues reported to us are related to codec configurations that also don't work with the legacy HDaudio driver, DMIC configurations, CSME authentication or system hangs that have not been root-caused [1]. HDaudio/ASoC interfaces are not on our radar as problematic.

That's why aligning with sound/pci/hda behavior is better for both, ALSA and ASoC users -> one place to fix the problems, both clients happy.

Quoted 9 lines

Disrupting basic HDaudio support to do things better has to be handled with extreme caution and a ton of testing involving distro maintainers and community members, so we are talking about an opt-in transition, not an immediate switch. We've done a similar transition in the past to stop using a dedicated hdac_hdmi.c codec, see all references to the 'use_common_hdmi' parameter in the SOF code. That transition seems to go exactly against your second point above on HDMI and HDA being different devices, so this could be an interesting debate.

Quoted 5 lines

Changes to the HDAudio/ASoC support would need to be handled with a separate patchset anyways, and the SOF side changes done after we are finished with the IPC4 and MeteorLake upstreaming. No one in our team has any bandwidth to help with reviews or tests on this topic at the moment.

Agree. This won't be forced on anyone and that's why separate implementation needed to be provided. There is too much to cover if we were to refactor hdac_hda.c

Quoted 5 lines

I will also re-state that the removal of the skylake driver can only happen after a long period of deprecation, when firmware and topologies have been picked by distributions and all users are known to have switched, so it's very likely that any alignment between "all HD-Audio ASoC users" mentioned above does include the Skylake driver, doesn't it?

Nah, I don't believe we need to be saving skylake-driver here. By "all HD-Audio ASoC users" I meant sof-driver as it isn't going anywhere - what cannot be said about the skylake-driver :)

Quoted 4 lines

So to circle back: is there anything preventing the use of the existing hdac_hda.c codec in this "ASoC: Intel: avs: Machine boards and HDA codec support" series and can the HDaudio codec change be done "later" in a more organized way?

Yeah, all the pm scenarios will fail when paired with the avs-driver. The expectations are different. We'd have to fix probe() and remove() (and related) sequences for the hdac_hda.c, and given that its users did not notice prompts further problems with the refactor. This is very similar to the skylake-driver vs avs-driver case. We could have applied ~300 patches we had internally that prepare skylake-driver to be re-modeled and then apply patchsets which look more or less like the avs-driver series instead of providing a parallel driver.

Quoted 3 lines

But the reality shows that such approach applies too much pressure on the reviewers and leaves no fallback option for the end users if anything fails along the way.

I will stop commenting here to let others chime in, I don't have the background to provide useful technical feedback on this complicated HDaudio/ASoC interface.

I am however concerned about the lack of long-term plans and confusion coming having 3 different ways of dealing with HDaudio codecs on the same hardware platform (legacy, ASoC/SOF-Skylake, ASoC-AVS). 2 was already bad, I don't see how 3 is better?

maintainer
#9 lore raw

Re: [PATCH 02/14] ASoC: codecs: Add HD-Audio codec driver

Hi,

Quoted 4 lines · Pierre-Louis Bossart
Quoted 4 lines
Quoted 4 lines · Cezary Rojewski
Quoted 3 lines

My suggestion is different: have all HD-Audio ASoC users switch to this implementation when possible and remove the existing code along with skylake-driver.

[...]

Quoted 4 lines

I am however concerned about the lack of long-term plans and confusion coming having 3 different ways of dealing with HDaudio codecs on the same hardware platform (legacy, ASoC/SOF-Skylake, ASoC-AVS). 2 was already bad, I don't see how 3 is better?

fortunately most of the actual logic is in the codec drivers (in sound/pci/hda/), so redundancy in the asoc-to-hda wrappers is not that bad.

As a slight correction to the thread, hdac_hda.c does support HDMI and all SOF machine drivers transitioned to this a few years back (and dropped use of hdac_hdmi.c which is mostly duplicating code in patch_hdmi.c).

In last few years, most of the changes have been to the actual codec drivers and we've not really had many fixes to hdac_hda.c anymore (there has been a few, and indeed PM related). So in this sense this has worked well enough. Patches to fix bugs and add support for new hardware, have benefitted all users (DSP and no-DSP) and changes have been only needed at a single location. So this is all good.

The fixed DAI capabilities of hdac_hda.c are indeed not ideal (although in practise hasn't really been an issue so far) and the approach in the new hda.c seems indeed more robust. We do have a lot of existing machine drivers (and shipping DSP topologies that we need to keep working), so transitioning e.g. SOF machine drivers is not going to be straightforward. For new mach drivers, this could be considered.

So while not ideal, maybe it makes sense to have two wrappers, hdac_hda.c for mach drivers with fixed DAI configuration, and the new hda.c that supports dynamic configuration (but requires mach drivers that match this). If the old SST driver is deprecated, we can then proceed to remove hdac_hdmi.c from the tree, so there's some savings.

Please do add some description to the commit+code+kconfig on how this new codec driver relates to hdac_hda. Otherwise it's very confusing to have two asoc codec drivers for the same thing.

Br, Kai

#10 lore raw

Re: [PATCH 02/14] ASoC: codecs: Add HD-Audio codec driver

Quoted 29 lines · Kai Vehmanen

Hi,

Quoted 4 lines · Pierre-Louis Bossart
Quoted 4 lines
Quoted 4 lines · Cezary Rojewski
Quoted 3 lines

My suggestion is different: have all HD-Audio ASoC users switch to this implementation when possible and remove the existing code along with skylake-driver.

[...]

Quoted 4 lines

I am however concerned about the lack of long-term plans and confusion coming having 3 different ways of dealing with HDaudio codecs on the same hardware platform (legacy, ASoC/SOF-Skylake, ASoC-AVS). 2 was already bad, I don't see how 3 is better?

fortunately most of the actual logic is in the codec drivers (in sound/pci/hda/), so redundancy in the asoc-to-hda wrappers is not that bad.

As a slight correction to the thread, hdac_hda.c does support HDMI and all SOF machine drivers transitioned to this a few years back (and dropped use of hdac_hdmi.c which is mostly duplicating code in patch_hdmi.c).

In last few years, most of the changes have been to the actual codec drivers and we've not really had many fixes to hdac_hda.c anymore (there has been a few, and indeed PM related). So in this sense this has worked well enough. Patches to fix bugs and add support for new hardware, have benefitted all users (DSP and no-DSP) and changes have been only needed at a single location. So this is all good.

Quoted 6 lines

The fixed DAI capabilities of hdac_hda.c are indeed not ideal (although in practise hasn't really been an issue so far) and the approach in the new hda.c seems indeed more robust. We do have a lot of existing machine drivers (and shipping DSP topologies that we need to keep working), so transitioning e.g. SOF machine drivers is not going to be straightforward. For new mach drivers, this could be considered.

We've just simplified the HDAudio topologies to support the Analog playback and capture only, for both IPC3 and IPC4 cases, so there's really no plan to support such dynamic capabilities. I am not even aware of a single device available in our team where the digital inputs and outputs are exposed on a connector, so even if we wanted we couldn't test this dynamic part.

Quoted 5 lines

So while not ideal, maybe it makes sense to have two wrappers, hdac_hda.c for mach drivers with fixed DAI configuration, and the new hda.c that supports dynamic configuration (but requires mach drivers that match this). If the old SST driver is deprecated, we can then proceed to remove hdac_hdmi.c from the tree, so there's some savings.

Such removal isn't going to happen for at least 3+ years, the time it takes for the slowest distros and users to switch kernels.

that means we're going to have to maintain for the foreseeable future:

hdac_hdmi.c: used only by SST
hdac_hda.c: used by both SST and SOF
hda.c: used only by AVS.

author maintainer
#11 lore raw

Re: [PATCH 02/14] ASoC: codecs: Add HD-Audio codec driver

Quoted 7 lines · Kai Vehmanen
Quoted 6 lines

The fixed DAI capabilities of hdac_hda.c are indeed not ideal (although in practise hasn't really been an issue so far) and the approach in the new hda.c seems indeed more robust. We do have a lot of existing machine drivers (and shipping DSP topologies that we need to keep working), so transitioning e.g. SOF machine drivers is not going to be straightforward. For new mach drivers, this could be considered.

Quoted 6 lines

We've just simplified the HDAudio topologies to support the Analog playback and capture only, for both IPC3 and IPC4 cases, so there's really no plan to support such dynamic capabilities. I am not even aware of a single device available in our team where the digital inputs and outputs are exposed on a connector, so even if we wanted we couldn't test this dynamic part.

As I've explained in one of the previous posts, you can always use topology to limit the number of FE(s) available while still adhering to behavior found in sound/pci/hda. hda.c is a prime example of how ASoC HD-Audio can align with ALSA HD-Audio in 1:1 fashion. hdac_hda.c does not do that a) because of hardcodes b) following HDA_DEV_ASOC.

Having no behavioral differences is a major gain here, fix one place, enjoy both solutions. By 'one place' I mean sound/pci/hda of course as there should be no logic outside of that directory.

Quoted 6 lines
Quoted 5 lines

So while not ideal, maybe it makes sense to have two wrappers, hdac_hda.c for mach drivers with fixed DAI configuration, and the new hda.c that supports dynamic configuration (but requires mach drivers that match this). If the old SST driver is deprecated, we can then proceed to remove hdac_hdmi.c from the tree, so there's some savings.

Quoted 8 lines

Such removal isn't going to happen for at least 3+ years, the time it takes for the slowest distros and users to switch kernels.

that means we're going to have to maintain for the foreseeable future:

hdac_hdmi.c: used only by SST
hdac_hda.c: used by both SST and SOF
hda.c: used only by AVS.

I and the team maintained almost all the solutions found in sound/soc/intel for couple of years already, doing couple more with the old stuff is not a problem. Don't believe 'sit and do nothing' is the answer here, not sure if this is even an option - but I'm sure that the final effect is going to be worth the initial cost.

Regards,
Czarek

author maintainer
#12 lore raw

PATCH 3/14 ASoC: Intel: avs: Add HDAudio machine board

In reply to Cezary Rojewski

Connect AVS driver with ASoC HDAudio codec with help of this machine board. Similarly to its platform and codec components, DAI links and routes are being created dynamically so single board can be used across all HDAudio codec types.

Card makes use of "binder" BE DAI Link so HDAudio codec driver can be listed as one of its components. This allows for BE DAIs to be created dynamically, based on HDAudio codec capabilities.

---
 sound/soc/intel/Kconfig              |   3 +
 sound/soc/intel/avs/Makefile         |   3 +
 sound/soc/intel/avs/boards/Kconfig   |  15 ++
 sound/soc/intel/avs/boards/Makefile  |   5 +
 sound/soc/intel/avs/boards/hdaudio.c | 294 +++++++++++++++++++++++++++
 5 files changed, 320 insertions(+)
 create mode 100644 sound/soc/intel/avs/boards/Kconfig
 create mode 100644 sound/soc/intel/avs/boards/Makefile
 create mode 100644 sound/soc/intel/avs/boards/hdaudio.c
sound/soc/intel/Kconfig +3 -0
index be42c4eff165..851e8053e2fa 100644
@@ -224,5 +224,8 @@ config SND_SOC_INTEL_AVS
 	  capabilities. This includes Skylake, Kabylake, Amberlake and
 	  Apollolake.
 
+# Machine board drivers
+source "sound/soc/intel/avs/boards/Kconfig"
+
 # ASoC codec drivers
 source "sound/soc/intel/boards/Kconfig"
sound/soc/intel/avs/Makefile +3 -0
index 952f51977656..abd51fb6b55d 100644
@@ -5,3 +5,6 @@ snd-soc-avs-objs := dsp.o ipc.o messages.o utils.o core.o loader.o \
 snd-soc-avs-objs += cldma.o
 
 obj-$(CONFIG_SND_SOC_INTEL_AVS) += snd-soc-avs.o
+
+# Machine support
+obj-$(CONFIG_SND_SOC) += boards/
sound/soc/intel/avs/boards/Kconfig new file +15 -0
new file mode 100644
index 000000000000..de62c0437f6e
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: GPL-2.0-only
+menu "Intel AVS Machine drivers"
+	depends on SND_SOC_INTEL_AVS
+
+comment "Available DSP configurations"
+
+config SND_SOC_INTEL_AVS_MACH_HDAUDIO
+	tristate "HD-Audio generic board"
+	select SND_SOC_HDA
+	help
+	  This adds support for AVS with HDAudio codec configuration.
+	  Say Y or m if you have such a device. This is a recommended option.
+	  If unsure select "N".
+
+endmenu
sound/soc/intel/avs/boards/Makefile new file +5 -0
new file mode 100644
index 000000000000..e5281148e5d4
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+snd-soc-avs-hdaudio-objs := hdaudio.o
+
+obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_HDAUDIO) += snd-soc-avs-hdaudio.o
sound/soc/intel/avs/boards/hdaudio.c new file +294 -0

294 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#13 lore raw

PATCH 4/14 ASoC: Intel: avs: Add DMIC machine board

In reply to Cezary Rojewski

Support AVS-DMIC configuration by implementing board connecting AVS platform component with DMIC codec one.

---
 sound/soc/intel/avs/boards/Kconfig  |  8 +++
 sound/soc/intel/avs/boards/Makefile |  2 +
 sound/soc/intel/avs/boards/dmic.c   | 93 +++++++++++++++++++++++++++++
 3 files changed, 103 insertions(+)
 create mode 100644 sound/soc/intel/avs/boards/dmic.c
sound/soc/intel/avs/boards/Kconfig +8 -0
index de62c0437f6e..1d4597fa9814 100644
@@ -4,6 +4,14 @@ menu "Intel AVS Machine drivers"
 
 comment "Available DSP configurations"
 
+config SND_SOC_INTEL_AVS_MACH_DMIC
+	tristate "DMIC generic board"
+	select SND_SOC_DMIC
+	help
+	  This adds support for AVS with Digital Mic array configuration.
+	  Say Y or m if you have such a device. This is a recommended option.
+	  If unsure select "N".
+
 config SND_SOC_INTEL_AVS_MACH_HDAUDIO
 	tristate "HD-Audio generic board"
 	select SND_SOC_HDA
sound/soc/intel/avs/boards/Makefile +2 -0
index e5281148e5d4..2ff35d4d97d8 100644
@@ -1,5 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
+snd-soc-avs-dmic-objs := dmic.o
 snd-soc-avs-hdaudio-objs := hdaudio.o
 
+obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_DMIC) += snd-soc-avs-dmic.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_HDAUDIO) += snd-soc-avs-hdaudio.o
sound/soc/intel/avs/boards/dmic.c new file +93 -0

93 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#14 lore raw

PATCH 5/14 ASoC: Intel: avs: Add ssp-test machine board

In reply to Cezary Rojewski

Allow for testing audio streaming over I2S interface through SSP-test board. No actual codec is needed here as board is intended for SSP loopback scenarios only. One playback and one capture endpoint is exposed per SSP port.

---
 sound/soc/intel/avs/boards/Kconfig    |   6 +
 sound/soc/intel/avs/boards/Makefile   |   2 +
 sound/soc/intel/avs/boards/ssp_test.c | 178 ++++++++++++++++++++++++++
 3 files changed, 186 insertions(+)
 create mode 100644 sound/soc/intel/avs/boards/ssp_test.c
sound/soc/intel/avs/boards/Kconfig +6 -0
index 1d4597fa9814..ea2f094758f9 100644
@@ -20,4 +20,10 @@ config SND_SOC_INTEL_AVS_MACH_HDAUDIO
 	  Say Y or m if you have such a device. This is a recommended option.
 	  If unsure select "N".
 
+config SND_SOC_INTEL_AVS_MACH_SSP_TEST
+	tristate "SSP test board"
+	help
+	   This adds support for SSP test board which can be used to verify
+	   transfer over I2S interface with loopback scenarios.
+
 endmenu
sound/soc/intel/avs/boards/Makefile +2 -0
index 2ff35d4d97d8..1c860ca165de 100644
@@ -2,6 +2,8 @@
 
 snd-soc-avs-dmic-objs := dmic.o
 snd-soc-avs-hdaudio-objs := hdaudio.o
+snd-soc-avs-ssp-test-objs := ssp_test.o
 
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_DMIC) += snd-soc-avs-dmic.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_HDAUDIO) += snd-soc-avs-hdaudio.o
+obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_SSP_TEST) += snd-soc-avs-ssp-test.o
sound/soc/intel/avs/boards/ssp_test.c new file +178 -0

178 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#15 lore raw

Re: [PATCH 05/14] ASoC: Intel: avs: Add ssp-test machine board

Quoted 5 lines · Cezary Rojewski

Allow for testing audio streaming over I2S interface through SSP-test board. No actual codec is needed here as board is intended for SSP loopback scenarios only. One playback and one capture endpoint is exposed per SSP port.

Quoted 8 lines
---
  sound/soc/intel/avs/boards/Kconfig    |   6 +
  sound/soc/intel/avs/boards/Makefile   |   2 +
  sound/soc/intel/avs/boards/ssp_test.c | 178 ++++++++++++++++++++++++++
  3 files changed, 186 insertions(+)

create mode 100644 sound/soc/intel/avs/boards/ssp_test.c

I'll send v2 later today that renames this board from ssp_test to i2s_test - so it matches naming convention used for all other boards.

Regards,
Czarek

author maintainer
#16 lore raw

PATCH 6/14 ASoC: Intel: avs: Add rt274 machine board

In reply to Cezary Rojewski

To support AVS-rt274 configuration add machine board connecting AVS platform component driver with rt274 codec one.

---
 sound/soc/intel/avs/boards/Kconfig  |  10 +
 sound/soc/intel/avs/boards/Makefile |   2 +
 sound/soc/intel/avs/boards/rt274.c  | 309 ++++++++++++++++++++++++++++
 3 files changed, 321 insertions(+)
 create mode 100644 sound/soc/intel/avs/boards/rt274.c
sound/soc/intel/avs/boards/Kconfig +10 -0
index ea2f094758f9..a8f598247548 100644
@@ -20,6 +20,16 @@ config SND_SOC_INTEL_AVS_MACH_HDAUDIO
 	  Say Y or m if you have such a device. This is a recommended option.
 	  If unsure select "N".
 
+config SND_SOC_INTEL_AVS_MACH_RT274
+	tristate "rt274 in I2S mode"
+	depends on I2C
+	depends on MFD_INTEL_LPSS || COMPILE_TEST
+	select SND_SOC_RT274
+	help
+	   This adds support for ASoC machine driver with RT274 I2S audio codec.
+	   Say Y or m if you have such a device. This is a recommended option.
+	   If unsure select "N".
+
 config SND_SOC_INTEL_AVS_MACH_SSP_TEST
 	tristate "SSP test board"
 	help
sound/soc/intel/avs/boards/Makefile +2 -0
index 1c860ca165de..dbefc519e1e0 100644
@@ -2,8 +2,10 @@
 
 snd-soc-avs-dmic-objs := dmic.o
 snd-soc-avs-hdaudio-objs := hdaudio.o
+snd-soc-avs-rt274-objs := rt274.o
 snd-soc-avs-ssp-test-objs := ssp_test.o
 
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_DMIC) += snd-soc-avs-dmic.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_HDAUDIO) += snd-soc-avs-hdaudio.o
+obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT274) += snd-soc-avs-rt274.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_SSP_TEST) += snd-soc-avs-ssp-test.o
sound/soc/intel/avs/boards/rt274.c new file +309 -0

309 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#17 lore raw

PATCH 7/14 ASoC: Intel: avs: Add rt286 machine board

In reply to Cezary Rojewski

To support AVS-rt286 configuration add machine board connecting AVS platform component driver with rt286 codec one.

---
 sound/soc/intel/avs/boards/Kconfig  |  10 +
 sound/soc/intel/avs/boards/Makefile |   2 +
 sound/soc/intel/avs/boards/rt286.c  | 280 ++++++++++++++++++++++++++++
 3 files changed, 292 insertions(+)
 create mode 100644 sound/soc/intel/avs/boards/rt286.c
sound/soc/intel/avs/boards/Kconfig +10 -0
index a8f598247548..7c29eb8cee70 100644
@@ -30,6 +30,16 @@ config SND_SOC_INTEL_AVS_MACH_RT274
 	   Say Y or m if you have such a device. This is a recommended option.
 	   If unsure select "N".
 
+config SND_SOC_INTEL_AVS_MACH_RT286
+	tristate "rt286 in I2S mode"
+	depends on I2C
+	depends on MFD_INTEL_LPSS || COMPILE_TEST
+	select SND_SOC_RT286
+	help
+	   This adds support for ASoC machine driver with RT286 I2S audio codec.
+	   Say Y or m if you have such a device. This is a recommended option.
+	   If unsure select "N".
+
 config SND_SOC_INTEL_AVS_MACH_SSP_TEST
 	tristate "SSP test board"
 	help
sound/soc/intel/avs/boards/Makefile +2 -0
index dbefc519e1e0..25631c03ffec 100644
@@ -3,9 +3,11 @@
 snd-soc-avs-dmic-objs := dmic.o
 snd-soc-avs-hdaudio-objs := hdaudio.o
 snd-soc-avs-rt274-objs := rt274.o
+snd-soc-avs-rt286-objs := rt286.o
 snd-soc-avs-ssp-test-objs := ssp_test.o
 
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_DMIC) += snd-soc-avs-dmic.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_HDAUDIO) += snd-soc-avs-hdaudio.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT274) += snd-soc-avs-rt274.o
+obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT286) += snd-soc-avs-rt286.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_SSP_TEST) += snd-soc-avs-ssp-test.o
sound/soc/intel/avs/boards/rt286.c new file +280 -0

280 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#18 lore raw

PATCH 8/14 ASoC: Intel: avs: Add rt298 machine board

In reply to Cezary Rojewski

To support AVS-rt298 configuration add machine board connecting AVS platform component driver with rt298 codec one.

---
 sound/soc/intel/avs/boards/Kconfig  |  10 +
 sound/soc/intel/avs/boards/Makefile |   2 +
 sound/soc/intel/avs/boards/rt298.c  | 280 ++++++++++++++++++++++++++++
 3 files changed, 292 insertions(+)
 create mode 100644 sound/soc/intel/avs/boards/rt298.c
sound/soc/intel/avs/boards/Kconfig +10 -0
index 7c29eb8cee70..ae83e930aa35 100644
@@ -40,6 +40,16 @@ config SND_SOC_INTEL_AVS_MACH_RT286
 	   Say Y or m if you have such a device. This is a recommended option.
 	   If unsure select "N".
 
+config SND_SOC_INTEL_AVS_MACH_RT298
+	tristate "rt298 in I2S mode"
+	depends on I2C
+	depends on MFD_INTEL_LPSS || COMPILE_TEST
+	select SND_SOC_RT298
+	help
+	   This adds support for ASoC machine driver with RT298 I2S audio codec.
+	   Say Y or m if you have such a device. This is a recommended option.
+	   If unsure select "N".
+
 config SND_SOC_INTEL_AVS_MACH_SSP_TEST
 	tristate "SSP test board"
 	help
sound/soc/intel/avs/boards/Makefile +2 -0
index 25631c03ffec..d1d261192d96 100644
@@ -4,10 +4,12 @@ snd-soc-avs-dmic-objs := dmic.o
 snd-soc-avs-hdaudio-objs := hdaudio.o
 snd-soc-avs-rt274-objs := rt274.o
 snd-soc-avs-rt286-objs := rt286.o
+snd-soc-avs-rt298-objs := rt298.o
 snd-soc-avs-ssp-test-objs := ssp_test.o
 
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_DMIC) += snd-soc-avs-dmic.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_HDAUDIO) += snd-soc-avs-hdaudio.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT274) += snd-soc-avs-rt274.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT286) += snd-soc-avs-rt286.o
+obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT298) += snd-soc-avs-rt298.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_SSP_TEST) += snd-soc-avs-ssp-test.o
sound/soc/intel/avs/boards/rt298.c new file +280 -0

280 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#19 lore raw

PATCH 9/14 ASoC: Intel: avs: Add rt5682 machine board

In reply to Cezary Rojewski

To support AVS-rt5682 configuration add machine board connecting AVS platform component driver with rt5682 codec one.

---
 sound/soc/intel/avs/boards/Kconfig  |  10 +
 sound/soc/intel/avs/boards/Makefile |   2 +
 sound/soc/intel/avs/boards/rt5682.c | 339 ++++++++++++++++++++++++++++
 3 files changed, 351 insertions(+)
 create mode 100644 sound/soc/intel/avs/boards/rt5682.c
sound/soc/intel/avs/boards/Kconfig +10 -0
index ae83e930aa35..f735b8c0898f 100644
@@ -50,6 +50,16 @@ config SND_SOC_INTEL_AVS_MACH_RT298
 	   Say Y or m if you have such a device. This is a recommended option.
 	   If unsure select "N".
 
+config SND_SOC_INTEL_AVS_MACH_RT5682
+	tristate "rt5682 in I2S mode"
+	depends on I2C
+	depends on MFD_INTEL_LPSS || COMPILE_TEST
+	select SND_SOC_RT5682_I2C
+	help
+	   This adds support for ASoC machine driver with RT5682 I2S audio codec.
+	   Say Y or m if you have such a device. This is a recommended option.
+	   If unsure select "N".
+
 config SND_SOC_INTEL_AVS_MACH_SSP_TEST
 	tristate "SSP test board"
 	help
sound/soc/intel/avs/boards/Makefile +2 -0
index d1d261192d96..a36f38ef87de 100644
@@ -5,6 +5,7 @@ snd-soc-avs-hdaudio-objs := hdaudio.o
 snd-soc-avs-rt274-objs := rt274.o
 snd-soc-avs-rt286-objs := rt286.o
 snd-soc-avs-rt298-objs := rt298.o
+snd-soc-avs-rt5682-objs := rt5682.o
 snd-soc-avs-ssp-test-objs := ssp_test.o
 
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_DMIC) += snd-soc-avs-dmic.o
@@ -12,4 +13,5 @@ obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_HDAUDIO) += snd-soc-avs-hdaudio.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT274) += snd-soc-avs-rt274.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT286) += snd-soc-avs-rt286.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT298) += snd-soc-avs-rt298.o
+obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT5682) += snd-soc-avs-rt5682.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_SSP_TEST) += snd-soc-avs-ssp-test.o
sound/soc/intel/avs/boards/rt5682.c new file +339 -0

339 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#20 lore raw

PATCH 10/14 ASoC: Intel: avs: Add nau8825 machine board

In reply to Cezary Rojewski

To support AVS-nau8825 configuration add machine board connecting AVS platform component driver with nau8825 codec one.

---
 sound/soc/intel/avs/boards/Kconfig   |  11 +
 sound/soc/intel/avs/boards/Makefile  |   2 +
 sound/soc/intel/avs/boards/nau8825.c | 352 +++++++++++++++++++++++++++
 3 files changed, 365 insertions(+)
 create mode 100644 sound/soc/intel/avs/boards/nau8825.c
sound/soc/intel/avs/boards/Kconfig +11 -0
index f735b8c0898f..f9ecee648830 100644
@@ -20,6 +20,17 @@ config SND_SOC_INTEL_AVS_MACH_HDAUDIO
 	  Say Y or m if you have such a device. This is a recommended option.
 	  If unsure select "N".
 
+config SND_SOC_INTEL_AVS_MACH_NAU8825
+	tristate "nau8825 I2S board"
+	depends on I2C
+	depends on MFD_INTEL_LPSS || COMPILE_TEST
+	select SND_SOC_NAU8825
+	help
+	   This adds support for ASoC machine driver with NAU8825 I2S audio codec.
+	   It is meant to be used with AVS driver.
+	   Say Y or m if you have such a device. This is a recommended option.
+	   If unsure select "N".
+
 config SND_SOC_INTEL_AVS_MACH_RT274
 	tristate "rt274 in I2S mode"
 	depends on I2C
sound/soc/intel/avs/boards/Makefile +2 -0
index a36f38ef87de..ece733a96c1e 100644
@@ -2,6 +2,7 @@
 
 snd-soc-avs-dmic-objs := dmic.o
 snd-soc-avs-hdaudio-objs := hdaudio.o
+snd-soc-avs-nau8825-objs := nau8825.o
 snd-soc-avs-rt274-objs := rt274.o
 snd-soc-avs-rt286-objs := rt286.o
 snd-soc-avs-rt298-objs := rt298.o
@@ -10,6 +11,7 @@ snd-soc-avs-ssp-test-objs := ssp_test.o
 
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_DMIC) += snd-soc-avs-dmic.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_HDAUDIO) += snd-soc-avs-hdaudio.o
+obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_NAU8825) += snd-soc-avs-nau8825.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT274) += snd-soc-avs-rt274.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT286) += snd-soc-avs-rt286.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT298) += snd-soc-avs-rt298.o
sound/soc/intel/avs/boards/nau8825.c new file +352 -0

352 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#21 lore raw

PATCH 11/14 ASoC: Intel: avs: Add ssm4567 machine board

In reply to Cezary Rojewski

To support AVS-ssm4567 configuration add machine board connecting AVS platform component driver with ssm4567 codec one.

---
 sound/soc/intel/avs/boards/Kconfig   |  11 ++
 sound/soc/intel/avs/boards/Makefile  |   2 +
 sound/soc/intel/avs/boards/ssm4567.c | 270 +++++++++++++++++++++++++++
 3 files changed, 283 insertions(+)
 create mode 100644 sound/soc/intel/avs/boards/ssm4567.c
sound/soc/intel/avs/boards/Kconfig +11 -0
index f9ecee648830..8af85953adac 100644
@@ -71,6 +71,17 @@ config SND_SOC_INTEL_AVS_MACH_RT5682
 	   Say Y or m if you have such a device. This is a recommended option.
 	   If unsure select "N".
 
+config SND_SOC_INTEL_AVS_MACH_SSM4567
+	tristate "ssm4567 I2S board"
+	depends on I2C
+	depends on MFD_INTEL_LPSS || COMPILE_TEST
+	select SND_SOC_SSM4567
+	help
+	   This adds support for ASoC machine driver with SSM4567 I2S audio codec.
+	   It is meant to be used with AVS driver.
+	   Say Y or m if you have such a device. This is a recommended option.
+	   If unsure select "N".
+
 config SND_SOC_INTEL_AVS_MACH_SSP_TEST
 	tristate "SSP test board"
 	help
sound/soc/intel/avs/boards/Makefile +2 -0
index ece733a96c1e..30d0eac6c22a 100644
@@ -7,6 +7,7 @@ snd-soc-avs-rt274-objs := rt274.o
 snd-soc-avs-rt286-objs := rt286.o
 snd-soc-avs-rt298-objs := rt298.o
 snd-soc-avs-rt5682-objs := rt5682.o
+snd-soc-avs-ssm4567-objs := ssm4567.o
 snd-soc-avs-ssp-test-objs := ssp_test.o
 
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_DMIC) += snd-soc-avs-dmic.o
@@ -16,4 +17,5 @@ obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT274) += snd-soc-avs-rt274.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT286) += snd-soc-avs-rt286.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT298) += snd-soc-avs-rt298.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT5682) += snd-soc-avs-rt5682.o
+obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_SSM4567) += snd-soc-avs-ssm4567.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_SSP_TEST) += snd-soc-avs-ssp-test.o
sound/soc/intel/avs/boards/ssm4567.c new file +270 -0

270 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#22 lore raw

PATCH 12/14 ASoC: Intel: avs: Add max98357a machine board

In reply to Cezary Rojewski

To support AVS-max98357a configuration add machine board connecting AVS platform component driver with max98357a codec one.

---
 sound/soc/intel/avs/boards/Kconfig     |  10 ++
 sound/soc/intel/avs/boards/Makefile    |   2 +
 sound/soc/intel/avs/boards/max98357a.c | 153 +++++++++++++++++++++++++
 3 files changed, 165 insertions(+)
 create mode 100644 sound/soc/intel/avs/boards/max98357a.c
sound/soc/intel/avs/boards/Kconfig +10 -0
index 8af85953adac..6865dc904326 100644
@@ -20,6 +20,16 @@ config SND_SOC_INTEL_AVS_MACH_HDAUDIO
 	  Say Y or m if you have such a device. This is a recommended option.
 	  If unsure select "N".
 
+config SND_SOC_INTEL_AVS_MACH_MAX98357A
+	tristate "max98357A I2S board"
+	depends on I2C
+	depends on MFD_INTEL_LPSS || COMPILE_TEST
+	select SND_SOC_MAX98357A
+	help
+	  This adds support for AVS with MAX98357A I2S codec configuration.
+	  Say Y or m if you have such a device. This is a recommended option.
+	  If unsure select "N".
+
 config SND_SOC_INTEL_AVS_MACH_NAU8825
 	tristate "nau8825 I2S board"
 	depends on I2C
sound/soc/intel/avs/boards/Makefile +2 -0
index 30d0eac6c22a..ae890ad747ba 100644
@@ -2,6 +2,7 @@
 
 snd-soc-avs-dmic-objs := dmic.o
 snd-soc-avs-hdaudio-objs := hdaudio.o
+snd-soc-avs-max98357a-objs := max98357a.o
 snd-soc-avs-nau8825-objs := nau8825.o
 snd-soc-avs-rt274-objs := rt274.o
 snd-soc-avs-rt286-objs := rt286.o
@@ -12,6 +13,7 @@ snd-soc-avs-ssp-test-objs := ssp_test.o
 
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_DMIC) += snd-soc-avs-dmic.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_HDAUDIO) += snd-soc-avs-hdaudio.o
+obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98357A) += snd-soc-avs-max98357a.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_NAU8825) += snd-soc-avs-nau8825.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT274) += snd-soc-avs-rt274.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT286) += snd-soc-avs-rt286.o
sound/soc/intel/avs/boards/max98357a.c new file +153 -0

153 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#23 lore raw

PATCH 13/14 ASoC: Intel: avs: Add max98373 machine board

In reply to Cezary Rojewski

From: Amadeusz Sławiński <[email protected]>

To support AVS-max98373 configuration add machine board connecting AVS platform component driver with max98373 codec one.

---
 sound/soc/intel/avs/boards/Kconfig    |  10 ++
 sound/soc/intel/avs/boards/Makefile   |   2 +
 sound/soc/intel/avs/boards/max98373.c | 238 ++++++++++++++++++++++++++
 3 files changed, 250 insertions(+)
 create mode 100644 sound/soc/intel/avs/boards/max98373.c
sound/soc/intel/avs/boards/Kconfig +10 -0
index 6865dc904326..38a76f486d91 100644
@@ -30,6 +30,16 @@ config SND_SOC_INTEL_AVS_MACH_MAX98357A
 	  Say Y or m if you have such a device. This is a recommended option.
 	  If unsure select "N".
 
+config SND_SOC_INTEL_AVS_MACH_MAX98373
+	tristate "max98373 I2S board"
+	depends on I2C
+	depends on MFD_INTEL_LPSS || COMPILE_TEST
+	select SND_SOC_MAX98373
+	help
+	  This adds support for AVS with MAX98373 I2S codec configuration.
+	  Say Y or m if you have such a device. This is a recommended option.
+	  If unsure select "N".
+
 config SND_SOC_INTEL_AVS_MACH_NAU8825
 	tristate "nau8825 I2S board"
 	depends on I2C
sound/soc/intel/avs/boards/Makefile +2 -0
index ae890ad747ba..a9e27638d23c 100644
@@ -3,6 +3,7 @@
 snd-soc-avs-dmic-objs := dmic.o
 snd-soc-avs-hdaudio-objs := hdaudio.o
 snd-soc-avs-max98357a-objs := max98357a.o
+snd-soc-avs-max98373-objs := max98373.o
 snd-soc-avs-nau8825-objs := nau8825.o
 snd-soc-avs-rt274-objs := rt274.o
 snd-soc-avs-rt286-objs := rt286.o
@@ -14,6 +15,7 @@ snd-soc-avs-ssp-test-objs := ssp_test.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_DMIC) += snd-soc-avs-dmic.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_HDAUDIO) += snd-soc-avs-hdaudio.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98357A) += snd-soc-avs-max98357a.o
+obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98373) += snd-soc-avs-max98373.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_NAU8825) += snd-soc-avs-nau8825.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT274) += snd-soc-avs-rt274.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_RT286) += snd-soc-avs-rt286.o
sound/soc/intel/avs/boards/max98373.c new file +238 -0

238 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#24 lore raw

PATCH 14/14 ASoC: Intel: avs: Add da7219 machine board

In reply to Cezary Rojewski

To support AVS-da7219 configuration add machine board connecting AVS platform component driver with da7219 codec one.

---
 sound/soc/intel/avs/boards/Kconfig  |  10 +
 sound/soc/intel/avs/boards/Makefile |   2 +
 sound/soc/intel/avs/boards/da7219.c | 281 ++++++++++++++++++++++++++++
 3 files changed, 293 insertions(+)
 create mode 100644 sound/soc/intel/avs/boards/da7219.c
sound/soc/intel/avs/boards/Kconfig +10 -0
index 38a76f486d91..3a24cc9ec64d 100644
@@ -4,6 +4,16 @@ menu "Intel AVS Machine drivers"
 
 comment "Available DSP configurations"
 
+config SND_SOC_INTEL_AVS_MACH_DA7219
+	tristate "da7219 I2S board"
+	depends on I2C
+	depends on MFD_INTEL_LPSS || COMPILE_TEST
+	select SND_SOC_DA7219
+	help
+	  This adds support for AVS with DA7219 I2S codec configuration.
+	  Say Y or m if you have such a device. This is a recommended option.
+	  If unsure select "N".
+
 config SND_SOC_INTEL_AVS_MACH_DMIC
 	tristate "DMIC generic board"
 	select SND_SOC_DMIC
sound/soc/intel/avs/boards/Makefile +2 -0
index a9e27638d23c..5d8ddd1e08c5 100644
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
+snd-soc-avs-da7219-objs := da7219.o
 snd-soc-avs-dmic-objs := dmic.o
 snd-soc-avs-hdaudio-objs := hdaudio.o
 snd-soc-avs-max98357a-objs := max98357a.o
@@ -12,6 +13,7 @@ snd-soc-avs-rt5682-objs := rt5682.o
 snd-soc-avs-ssm4567-objs := ssm4567.o
 snd-soc-avs-ssp-test-objs := ssp_test.o
 
+obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_DA7219) += snd-soc-avs-da7219.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_DMIC) += snd-soc-avs-dmic.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_HDAUDIO) += snd-soc-avs-hdaudio.o
 obj-$(CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98357A) += snd-soc-avs-max98357a.o
sound/soc/intel/avs/boards/da7219.c new file +281 -0

281 lines not on this page · raw message

Signature · 1 line
2.25.1