Skip to contentSkip to conversation

Add support for different DMIC configurations

PATCH Superseded Mateusz Gorski 3 participants 9 messages Apr 22, 2020 – Apr 23, 2020

Subsystems (3)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add support for different DMIC configurations

Set of patches to enable DMIC capture on different hardware configurations.
Information about supported DMIC configuration is read from NHLT and correct pipeline configuration is selected automatically. Also, adding additional option for topology binary name which is based on used machine driver.

Mateusz Gorski (3):
ASoC: Intel: Skylake: Add alternative topology binary name
ASoC: Intel: Multiple I/O PCM format support for pipe
ASoC: Intel: Skylake: Automatic DMIC format configuration according to
information from NHLT

Changes in v2:
- removed patch 1/4 swapping machine device and platform device registration order
- alt_tplg_name creation now uses different field to read machine driver name
- including of <sound/soc-acpi.h> moved to different patch

 include/uapi/sound/skl-tplg-interface.h |   2 +
 sound/soc/intel/skylake/skl-topology.c  | 189 +++++++++++++++++++++++-
 sound/soc/intel/skylake/skl-topology.h  |   1 +
 3 files changed, 187 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/3 ASoC: Intel: Skylake: Add alternative topology binary name

Add alternative topology binary file name based on used machine driver and fallback to use this name after failed attempt to load topology file with name based on NHLT.
This change addresses multiple issues with current mechanism, for example - there are devices without NHLT table, and that currently results in tplg_name being empty.

---

Changes in v2:
- added <sound/soc-acpi.h> include
- machine driver name is now read from different field

 sound/soc/intel/skylake/skl-topology.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/skl-topology.c +18 -2
index 69cd7a81bf2a..58f77b6c5cda 100644
@@ -14,6 +14,7 @@
 #include <linux/uuid.h>
 #include <sound/intel-nhlt.h>
 #include <sound/soc.h>
+#include <sound/soc-acpi.h>
 #include <sound/soc-topology.h>
 #include <uapi/sound/snd_sst_tokens.h>
 #include <uapi/sound/skl-tplg-interface.h>
@@ -3565,8 +3566,20 @@ int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus)
 
 	ret = request_firmware(&fw, skl->tplg_name, bus->dev);
 	if (ret < 0) {
-		dev_info(bus->dev, "tplg fw %s load failed with %d, falling back to dfw_sst.bin",
-				skl->tplg_name, ret);
+		char alt_tplg_name[64];
+
+		snprintf(alt_tplg_name, sizeof(alt_tplg_name), "%s-tplg.bin",
+				skl->mach->drv_name);
+		dev_info(bus->dev, "tplg fw %s load failed with %d, trying alternative tplg name %s",
+				skl->tplg_name, ret, alt_tplg_name);
+
+		ret = request_firmware(&fw, alt_tplg_name, bus->dev);
+		if (!ret)
+			goto component_load;
+
+		dev_info(bus->dev, "tplg %s failed with %d, falling back to dfw_sst.bin",
+				alt_tplg_name, ret);
+
 		ret = request_firmware(&fw, "dfw_sst.bin", bus->dev);
 		if (ret < 0) {
 			dev_err(bus->dev, "Fallback tplg fw %s load failed with %d\n",
@@ -3575,6 +3588,9 @@ int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus)
 		}
 	}
 
+component_load:
+
+
 	/*
 	 * The complete tplg for SKL is loaded as index 0, we don't use
 	 * any other index
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH v2 1/3] ASoC: Intel: Skylake: Add alternative topology binary name

Quoted 17 lines · Mateusz Gorski

Add alternative topology binary file name based on used machine driver and fallback to use this name after failed attempt to load topology file with name based on NHLT.
This change addresses multiple issues with current mechanism, for example - there are devices without NHLT table, and that currently results in tplg_name being empty.

---

Changes in v2:
- added <sound/soc-acpi.h> include
- machine driver name is now read from different field

sound/soc/intel/skylake/skl-topology.c int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus) · line 3596

Quoted 9 lines
sound/soc/intel/skylake/skl-topology.c +3 -0
@@ -3575,6 +3588,9 @@ int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus)
  		}
  	}
 
+component_load:
+
+
  	/*
  	 * The complete tplg for SKL is loaded as index 0, we don't use
  	 * any other index

Looks like double newline after 'component_load' slipped through my eyes. Please fix it.

#3 lore raw

PATCH v2 2/3 ASoC: Intel: Multiple I/O PCM format support for pipe

In reply to Mateusz Gorski

For pipes supporting multiple input/output formats, kcontrol is created and selection of pipe input and output configuration is done based on control set.

If more than one configuration is supported, then this patch allows user to select configuration of choice using amixer settings.

---
 include/uapi/sound/skl-tplg-interface.h |   1 +
 sound/soc/intel/skylake/skl-topology.c  | 110 ++++++++++++++++++++++++
 sound/soc/intel/skylake/skl-topology.h  |   1 +
 3 files changed, 112 insertions(+)
include/uapi/sound/skl-tplg-interface.h +1 -0
index 9eee32f5e407..f2711186c81f 100644
@@ -18,6 +18,7 @@
  */
 #define SKL_CONTROL_TYPE_BYTE_TLV	0x100
 #define SKL_CONTROL_TYPE_MIC_SELECT	0x102
+#define SKL_CONTROL_TYPE_MULTI_IO_SELECT	0x103
 
 #define HDA_SST_CFG_MAX	900 /* size of copier cfg*/
 #define MAX_IN_QUEUE 8
sound/soc/intel/skylake/skl-topology.c +110 -0

134 lines not on this page · raw message

sound/soc/intel/skylake/skl-topology.h +1 -0
index e967800dbb62..06576147cc29 100644
@@ -306,6 +306,7 @@ struct skl_pipe {
 	struct skl_path_config configs[SKL_MAX_PATH_CONFIGS];
 	struct list_head w_list;
 	bool passthru;
+	u32 pipe_config_idx;
 };
 
 enum skl_module_state {
Signature · 1 line
2.17.1
maintainer
#4 lore raw

Re: [PATCH v2 2/3] ASoC: Intel: Multiple I/O PCM format support for pipe

Quoted 14 lines · Mateusz Gorski

For pipes supporting multiple input/output formats, kcontrol is created and selection of pipe input and output configuration is done based on control set.

If more than one configuration is supported, then this patch allows user to select configuration of choice using amixer settings.

sound/soc/intel/skylake/skl-topology.c +0 -0
index 58f77b6c5cda..2e6eca619c4e 100644

sound/soc/intel/skylake/skl-topology.c static int skl_tplg_unload_pipe_modules(struct skl_dev *skl, · line 587

Quoted 9 lines
sound/soc/intel/skylake/skl-topology.c +6 -0
@@ -579,6 +579,38 @@ static int skl_tplg_unload_pipe_modules(struct skl_dev *skl,
  	return ret;
  }
 
+static bool skl_tplg_is_multi_fmt(struct skl_dev *skl, struct skl_pipe *pipe)
+{
+	int i;
+	struct skl_pipe_fmt *cur_fmt;
+	struct skl_pipe_fmt *next_fmt;
+

Hmm, some code-cosmetics are left unattended too.
Please reorder 'i' declaration to the bottom.

#5 lore raw

PATCH v2 3/3 ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHLT

In reply to Mateusz Gorski

Automatically choose DMIC pipeline format configuration depending on information included in NHLT.
Change the access rights of appropriate kcontrols to read-only in order to prevent user interference.

---

Changes in v2:
- removed <sound/soc-acpi.h> include (moved po patch 1/3)

 include/uapi/sound/skl-tplg-interface.h |  1 +
 sound/soc/intel/skylake/skl-topology.c  | 59 +++++++++++++++++++++++--
 2 files changed, 57 insertions(+), 3 deletions(-)
include/uapi/sound/skl-tplg-interface.h +1 -0
index f2711186c81f..a93c0decfdd5 100644
@@ -19,6 +19,7 @@
 #define SKL_CONTROL_TYPE_BYTE_TLV	0x100
 #define SKL_CONTROL_TYPE_MIC_SELECT	0x102
 #define SKL_CONTROL_TYPE_MULTI_IO_SELECT	0x103
+#define SKL_CONTROL_TYPE_MULTI_IO_SELECT_DMIC	0x104
 
 #define HDA_SST_CFG_MAX	900 /* size of copier cfg*/
 #define MAX_IN_QUEUE 8
sound/soc/intel/skylake/skl-topology.c +56 -3

92 lines not on this page · raw message

Signature · 1 line
2.17.1
maintainer Acked-by on the v2 series
#6 lore raw
In reply to Mateusz Gorski
Quoted 6 lines · Mateusz Gorski

Set of patches to enable DMIC capture on different hardware configurations.
Information about supported DMIC configuration is read from NHLT and correct pipeline configuration is selected automatically. Also, adding additional option for topology binary name which is based on used machine driver.

*seems like this thread is missing few maintainers in CC*

Quoted 7 lines

Mateusz Gorski (3):
ASoC: Intel: Skylake: Add alternative topology binary name
ASoC: Intel: Multiple I/O PCM format support for pipe
ASoC: Intel: Skylake: Automatic DMIC format configuration according to
information from NHLT

Quoted 6 lines

Changes in v2:
- removed patch 1/4 swapping machine device and platform device registration order
- alt_tplg_name creation now uses different field to read machine driver name
- including of <sound/soc-acpi.h> moved to different patch

Ain't change-block supposed to be just below message body?

Quoted 6 lines
  include/uapi/sound/skl-tplg-interface.h |   2 +
  sound/soc/intel/skylake/skl-topology.c  | 189 +++++++++++++++++++++++-
  sound/soc/intel/skylake/skl-topology.h  |   1 +
  3 files changed, 187 insertions(+), 5 deletions(-)

You have forgotten to add my Reviewed-by tag as both, v1 and v2 were reviewed by me internally before upstreaming.

Thanks for addressing Pierre's review - indeed i2s_dev field usage could have been avoided. Good review, Pierre.

Don't believe series need to be resend just to fix cosmetics:

maintainer
#7 lore raw
Quoted 10 lines · Cezary Rojewski
Quoted 6 lines · Mateusz Gorski

Changes in v2:
- removed patch 1/4 swapping machine device and platform device registration order
- alt_tplg_name creation now uses different field to read machine driver name
- including of <sound/soc-acpi.h> moved to different patch

Ain't change-block supposed to be just below message body?

Only in patches to stop them getting included in the git changelog.

Quoted 2 lines

Don't believe series need to be resend just to fix cosmetics:

Well, I don't seem to have a copy of it so it'll need a resend for that unless it's just held up somewhere and arrives shortly.

maintainer
#8 lore raw
Quoted 10 lines · Mark Brown
Quoted 8 lines · Cezary Rojewski
Quoted 6 lines · Mateusz Gorski

Changes in v2:
- removed patch 1/4 swapping machine device and platform device registration order
- alt_tplg_name creation now uses different field to read machine driver name
- including of <sound/soc-acpi.h> moved to different patch

Quoted 4 lines
Quoted 1 line

Ain't change-block supposed to be just below message body?

Only in patches to stop them getting included in the git changelog.

Thanks for info, Mark.

Quoted 6 lines
Quoted 2 lines

Don't believe series need to be resend just to fix cosmetics:

Well, I don't seem to have a copy of it so it'll need a resend for that unless it's just held up somewhere and arrives shortly.

Doubt it will as Mateusz forgot to include you & Pierre in v2. Resend it is then!