Add support for different DMIC configurations
Subsystems (3)
v4 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.
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
Changes in v3:
- cosmetic changes in skl-topology.c file
Changes in v4:
- refactored patch 2/3 to use one common helper function to deal with both set and get pipe configuration operations, as suggested by Pierre
- adjusted patch 3/3 to also use this helper function for DMIC pipes
- added comment in patch 3/3 explaining the change of access rights for DMIC enums
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
include/uapi/sound/skl-tplg-interface.h | 2 + sound/soc/intel/skylake/skl-topology.c | 177 +++++++++++++++++++++++- sound/soc/intel/skylake/skl-topology.h | 1 + 3 files changed, 175 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1
PATCH v4 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
Changes in v3:
- deleted additional newline after component_load:
Changes in v4:
--none--
sound/soc/intel/skylake/skl-topology.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/skl-topology.c +17 -2
@@ -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,8 @@ 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
PATCH v4 2/3 ASoC: Intel: Multiple I/O PCM format support for pipe
In reply to Mateusz GorskiFor 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.
---
Changes in v2:
--none--
Changes in v3:
- reordered declarations in skl_tplg_is_multi_fmt
Changes in v4:
- added helper function to set and get pipe config
include/uapi/sound/skl-tplg-interface.h | 1 + sound/soc/intel/skylake/skl-topology.c | 94 +++++++++++++++++++++++++ sound/soc/intel/skylake/skl-topology.h | 1 + 3 files changed, 96 insertions(+)
include/uapi/sound/skl-tplg-interface.h +1 -0
@@ -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 +94 -0
118 lines not on this page · raw message
sound/soc/intel/skylake/skl-topology.h +1 -0
@@ -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
PATCH v4 3/3 ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHLT
In reply to Mateusz GorskiAutomatically 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 to patch 1/3)
Changes in v3:
--none--
Changes in v4:
- added comment about access rights for DMIC pipe configuration enums
- adjusted set and get functions for DMIC enums to use helper function introduced in patch 2/3
include/uapi/sound/skl-tplg-interface.h | 1 + sound/soc/intel/skylake/skl-topology.c | 64 +++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 3 deletions(-)
include/uapi/sound/skl-tplg-interface.h +1 -0
@@ -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 +61 -3
97 lines not on this page · raw message
Signature · 1 line
2.17.1
Mark Brown
maintainerQuoted 2 lines · Mateusz Gorski
Set of patches to enable DMIC capture on different hardware configurations.
Neither this posting nor the last posting seem to have managed to send me a copy of patch 2.
Re: [PATCH v4 2/3] ASoC: Intel: Multiple I/O PCM format support for pipe
In reply to Mateusz GorskiQuoted 17 lines
sound/soc/intel/skylake/skl-topology.c +16
-0+static int skl_tplg_multi_config_set_get (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol,bool is_set) +{ +struct snd_soc_component *component = +snd_soc_kcontrol_component (kcontrol); +struct hdac_bus *bus =snd_soc_component_get_drvdata (component); +struct skl_dev *skl =bus_to_skl (bus); +struct skl_pipeline *ppl; +struct skl_pipe *pipe =NULL ; +struct soc_enum *ec = (struct soc_enum *)kcontrol->private_value; +u32 *pipe_id; + +if (!ec) +return -EINVAL ; + +if (is_set && (ucontrol->value.enumerated.item[0 ] > ec->items))
sound/soc/intel/skylake/skl-topology.c static int skl_tplg_pga_event(struct snd_soc_dapm_widget *w, · line 1383
Quoted 10 lines
sound/soc/intel/skylake/skl-topology.c +10
-0+return -EINVAL ; + + pipe_id = ec->dobj.private; + +list_for_each_entry (ppl, &skl->ppl_list, node) { +if (ppl->pipe->ppl_id == *pipe_id) { + pipe = ppl->pipe; +break ; + } + }
is there an alignment issue here or just a diff illusion?
sound/soc/intel/skylake/skl-topology.c static int skl_tplg_pga_event(struct snd_soc_dapm_widget *w, · line 1394
Quoted 11 lines
sound/soc/intel/skylake/skl-topology.c +11
-0+if (!pipe) +return -EIO ; + +if (is_set) + pipe->pipe_config_idx = ucontrol->value.enumerated.item[0 ]; +else + ucontrol->value.enumerated.item[0 ] = pipe->pipe_config_idx; + +return 0 ; +} +
You also have a number of other alignment/style issues reported by checkpatch.pl
---------------------------------------------------------------
0001-ASoC-Intel-Skylake-Add-alternative-topology-binary-n.patch
---------------------------------------------------------------
CHECK: Alignment should match open parenthesis
#41: FILE: sound/soc/intel/skylake/skl-topology.c:3572:
+ snprintf(alt_tplg_name, sizeof(alt_tplg_name), "%s-tplg.bin",
+ skl->mach->drv_name);
CHECK: Alignment should match open parenthesis #43: FILE: sound/soc/intel/skylake/skl-topology.c:3574:
+ dev_info(bus->dev, "tplg fw %s load failed with %d, trying alternative tplg name %s",
+ skl->tplg_name, ret, alt_tplg_name);
CHECK: Alignment should match open parenthesis #50: FILE: sound/soc/intel/skylake/skl-topology.c:3581:
+ dev_info(bus->dev, "tplg %s failed with %d, falling back to dfw_sst.bin",
+ alt_tplg_name, ret);
--------------------------------------------------------------
0002-ASoC-Intel-Multiple-I-O-PCM-format-support-for-pipe.patch
--------------------------------------------------------------
CHECK: spaces preferred around that '+' (ctx:VxV) #58: FILE: sound/soc/intel/skylake/skl-topology.c:597:
+ next_fmt = &pipe->configs[i+1].out_fmt;
^
CHECK: spaces preferred around that '+' (ctx:VxV) #61: FILE: sound/soc/intel/skylake/skl-topology.c:600:
+ next_fmt = &pipe->configs[i+1].in_fmt;
^
CHECK: Alignment should match open parenthesis #86: FILE: sound/soc/intel/skylake/skl-topology.c:640:
+ dev_dbg(skl->dev, "found pipe config idx:%d\n",
+ pipe->cur_config_idx);
CHECK: Alignment should match open parenthesis
#98: FILE: sound/soc/intel/skylake/skl-topology.c:1359:
+static int skl_tplg_multi_config_set_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol, bool is_set)
CHECK: Unnecessary parentheses around 'ucontrol->value.enumerated.item[0] > ec->items' #112: FILE: sound/soc/intel/skylake/skl-topology.c:1373:
+ if (is_set && (ucontrol->value.enumerated.item[0] > ec->items))
CHECK: Alignment should match open parenthesis
#135: FILE: sound/soc/intel/skylake/skl-topology.c:1396:
+static int skl_tplg_multi_config_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
CHECK: Alignment should match open parenthesis
#141: FILE: sound/soc/intel/skylake/skl-topology.c:1402:
+static int skl_tplg_multi_config_set(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
---------------------------------------------------------------
0003-ASoC-Intel-Skylake-Automatic-DMIC-format-configurati.patch
---------------------------------------------------------------
CHECK: Alignment should match open parenthesis
#40: FILE: sound/soc/intel/skylake/skl-topology.c:1408:
+static int skl_tplg_multi_config_get_dmic(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
CHECK: Alignment should match open parenthesis
#46: FILE: sound/soc/intel/skylake/skl-topology.c:1414:
+static int skl_tplg_multi_config_set_dmic(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
CHECK: Alignment should match open parenthesis #110: FILE: sound/soc/intel/skylake/skl-topology.c:3627:
+ if (dobj->type != SND_SOC_DOBJ_ENUM ||
+ dobj->control.kcontrol->put !=
Quoted 5 lines
Quoted 3 lines
Set of patches to enable DMIC capture on different hardware configurations.
Neither this posting nor the last posting seem to have managed to send me a copy of patch 2.
The only reason I can think of is the fact, that one of Signed-by tags in patch 2/3 had a comma in it and git send-patch added one additional, invalid CC recipient.
I have adjusted that Signed-by tag in patchset v5.
Mateusz
Re: [PATCH v4 2/3] ASoC: Intel: Multiple I/O PCM format support for pipe
In reply to Pierre-Louis BossartQuoted 9 lines
Quoted 7 lines
+
list_for_each_entry(ppl, &skl->ppl_list, node){ + if (ppl->pipe->ppl_id==*pipe_id) { + pipe =ppl->pipe;
+ break;
+ }
+ }is there an alignment issue here or just a diff illusion?
There was, changed in v5.
Quoted 3 lines
You also have a number of other alignment/style issues reported by checkpatch.pl
I have only validated with standard chechpatch.pl settings, scanned with *--strict *and addressed all warnings in patchset v5.
Thanks,
Mateusz