ASoC: Intel: Fixes
Subsystems (3)
cover ASoC: Intel: Fixes
Series of fixes for issues found during development and testing, primarly for avs driver.
Amadeusz Sławiński (4):
ASoC: Intel: avs: Fix module lookup
ASoC: Intel: avs: Access path components under lock
ASoC: Intel: avs: Fix avs_path_module::instance_id size
ASoC: Intel: avs: Add missing checks on FE startup
Cezary Rojewski (3):
ASoC: Intel: Skylake: Fix declaration of enum skl_ch_cfg
ASoC: Intel: avs: Fix declaration of enum avs_channel_config
ASoC: Intel: avs: Account for UID of ACPI device
include/sound/soc-acpi.h | 1 + include/uapi/sound/skl-tplg-interface.h | 3 ++- sound/soc/intel/avs/apl.c | 6 +++++- sound/soc/intel/avs/avs.h | 4 ++-- sound/soc/intel/avs/board_selection.c | 2 +- sound/soc/intel/avs/control.c | 22 +++++++++++++++------- sound/soc/intel/avs/dsp.c | 4 ++-- sound/soc/intel/avs/messages.h | 2 +- sound/soc/intel/avs/path.h | 2 +- sound/soc/intel/avs/pcm.c | 23 ++++++++++++++++++----- sound/soc/intel/avs/probes.c | 2 +- 11 files changed, 49 insertions(+), 22 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/7 ASoC: Intel: avs: Fix module lookup
When changing value of kcontrol, FW module to which data should be send needs to be found. Currently it is done in improper way, fix it. Change function name to indicate that it looks only for volume module.
This allows to change volume during runtime, instead of only changing init value.
--- sound/soc/intel/avs/control.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
sound/soc/intel/avs/control.c +15 -7
@@ -21,17 +21,25 @@ static struct avs_dev *avs_get_kcontrol_adev(struct snd_kcontrol *kcontrol)return to_avs_dev (w->dapm->component->dev); } -static struct avs_path_module *avs_get_kcontrol_module (struct avs_dev *adev,u32 id) +static struct avs_path_module *avs_get_volume_module (struct avs_dev *adev,u32 id) {struct avs_path *path;struct avs_path_pipeline *ppl;struct avs_path_module *mod; -list_for_each_entry (path, &adev->path_list, node) -list_for_each_entry (ppl, &path->ppl_list, node) -list_for_each_entry (mod, &ppl->mod_list, node) -if (mod->template->ctl_id && mod->template->ctl_id == id) +spin_lock (&adev->path_list_lock); +list_for_each_entry (path, &adev->path_list, node) { +list_for_each_entry (ppl, &path->ppl_list, node) { +list_for_each_entry (mod, &ppl->mod_list, node) { +if (guid_equal (&mod->template->cfg_ext->type, &AVS_PEAKVOL_MOD_UUID ) + && mod->template->ctl_id == id) { +spin_unlock (&adev->path_list_lock);return mod; + } + } + } + } +spin_unlock (&adev->path_list_lock);return NULL ; }
@@ -49,7 +57,7 @@ int avs_control_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va/* prevent access to modules while path is being constructed */ mutex_lock (&adev->path_mutex); - active_module =avs_get_kcontrol_module (adev, ctl_data->id); + active_module =avs_get_volume_module (adev, ctl_data->id);if (active_module) { ret = avs_ipc_peakvol_get_volume(adev, active_module->module_id, active_module->instance_id, &dspvols,
@@ -89,7 +97,7 @@ int avs_control_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va changed =1 ; } - active_module =avs_get_kcontrol_module (adev, ctl_data->id); + active_module =avs_get_volume_module (adev, ctl_data->id);if (active_module) { dspvol.channel_id =AVS_ALL_CHANNELS_MASK ; dspvol.target_volume = *volume;
Signature · 1 line
2.34.1
PATCH 2/7 ASoC: Intel: avs: Access path components under lock
In reply to Amadeusz SławińskiPath and its components should be accessed under lock to prevent problems with one thread modifying them while other tries to read.
--- sound/soc/intel/avs/apl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/intel/avs/apl.c +5 -1
@@ -169,6 +169,7 @@ static bool apl_lp_streaming(struct avs_dev *adev) {struct avs_path *path; +spin_lock (&adev->path_list_lock);/* Any gateway without buffer allocated in LP area disqualifies D0IX. */ list_for_each_entry (path, &adev->path_list, node) {struct avs_path_pipeline *ppl;
@@ -188,11 +189,14 @@ static bool apl_lp_streaming(struct avs_dev *adev)if (cfg->copier.dma_type ==INVALID_OBJECT_ID )continue ; -if (!mod->gtw_attrs.lp_buffer_alloc) +if (!mod->gtw_attrs.lp_buffer_alloc) { +spin_unlock (&adev->path_list_lock);return false; + } } } } +spin_unlock (&adev->path_list_lock);return true; }
Signature · 1 line
2.34.1
PATCH 3/7 ASoC: Intel: Skylake: Fix declaration of enum skl_ch_cfg
In reply to Amadeusz SławińskiFrom: Cezary Rojewski <[email protected]>
Constant 'C4_CHANNEL' does not exist on the firmware side. Value 0xC is reserved for 'C7_1' instead.
--- include/uapi/sound/skl-tplg-interface.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/uapi/sound/skl-tplg-interface.h +2 -1
@@ -66,7 +66,8 @@ enum skl_ch_cfg {SKL_CH_CFG_DUAL_MONO =9 ,SKL_CH_CFG_I2S_DUAL_STEREO_0 =10 ,SKL_CH_CFG_I2S_DUAL_STEREO_1 =11 , -SKL_CH_CFG_4_CHANNEL =12 , +SKL_CH_CFG_7_1 =12 , +SKL_CH_CFG_4_CHANNEL =SKL_CH_CFG_7_1 , SKL_CH_CFG_INVALID };
Signature · 1 line
2.34.1
PATCH 4/7 ASoC: Intel: avs: Fix declaration of enum avs_channel_config
In reply to Amadeusz SławińskiFrom: Cezary Rojewski <[email protected]>
Constant 'C4_CHANNEL' does not exist on the firmware side. Value 0xC is reserved for 'C7_1' instead.
--- sound/soc/intel/avs/messages.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/avs/messages.h +1 -1
@@ -619,7 +619,7 @@ enum avs_channel_config {AVS_CHANNEL_CONFIG_DUAL_MONO =9 ,AVS_CHANNEL_CONFIG_I2S_DUAL_STEREO_0 =10 ,AVS_CHANNEL_CONFIG_I2S_DUAL_STEREO_1 =11 , -AVS_CHANNEL_CONFIG_4_CHANNEL =12 , +AVS_CHANNEL_CONFIG_7_1 =12 , AVS_CHANNEL_CONFIG_INVALID };
Signature · 1 line
2.34.1
PATCH 5/7 ASoC: Intel: avs: Account for UID of ACPI device
In reply to Amadeusz SławińskiFrom: Cezary Rojewski <[email protected]>
Configurations with multiple codecs attached to the platform are supported but only if each from the set is different. Add new field representing the 'Unique ID' so that codecs that share Vendor and Part IDs can be differentiated and thus enabling support for such configurations.
--- include/sound/soc-acpi.h | 1 + sound/soc/intel/avs/board_selection.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
include/sound/soc-acpi.h +1 -0
@@ -170,6 +170,7 @@ struct snd_soc_acpi_link_adr {/* Descriptor for SST ASoC machine driver */ struct snd_soc_acpi_mach {u8 id[ACPI_ID_LEN ]; +const char *uid;const struct snd_soc_acpi_codecs *comp_ids;const u32 link_mask;const struct snd_soc_acpi_link_adr *links;
sound/soc/intel/avs/board_selection.c +1 -1
@@ -443,7 +443,7 @@ static int avs_register_i2s_boards(struct avs_dev *adev) }for (mach = boards->machs; mach->id[0 ]; mach++) { -if (!acpi_dev_present (mach->id,NULL ,-1 )) +if (!acpi_dev_present (mach->id, mach->uid,-1 ))continue ;if (mach->machine_quirk)
Signature · 1 line
2.34.1
PATCH 6/7 ASoC: Intel: avs: Fix avs_path_module::instance_id size
In reply to Amadeusz SławińskiAll IPCs using instance_id use 8 bit value. Original commit used 16 bit value because FW reports possible max value in 16 bit field, but in practice FW limits the value to 8 bits.
--- sound/soc/intel/avs/avs.h | 4 ++-- sound/soc/intel/avs/dsp.c | 4 ++-- sound/soc/intel/avs/path.h | 2 +- sound/soc/intel/avs/probes.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
sound/soc/intel/avs/avs.h +2 -2
@@ -283,8 +283,8 @@ void avs_release_firmwares(struct avs_dev *adev);int avs_dsp_init_module (struct avs_dev *adev,u16 module_id,u8 ppl_instance_id,u8 core_id,u8 domain,void *param,u32 param_size, -u16 *instance_id); -void avs_dsp_delete_module (struct avs_dev *adev,u16 module_id,u16 instance_id, +u8 *instance_id); +void avs_dsp_delete_module (struct avs_dev *adev,u16 module_id,u8 instance_id,u8 ppl_instance_id,u8 core_id);int avs_dsp_create_pipeline (struct avs_dev *adev,u16 req_size,u8 priority,bool lp,u16 attributes,u8 *instance_id);
sound/soc/intel/avs/dsp.c +2 -2
@@ -225,7 +225,7 @@ static int avs_dsp_put_core(struct avs_dev *adev, u32 core_id)int avs_dsp_init_module (struct avs_dev *adev,u16 module_id,u8 ppl_instance_id,u8 core_id,u8 domain,void *param,u32 param_size, -u16 *instance_id) +u8 *instance_id) {struct avs_module_entry mentry;bool was_loaded = false;
@@ -272,7 +272,7 @@ int avs_dsp_init_module(struct avs_dev *adev, u16 module_id, u8 ppl_instance_id,return ret; } -void avs_dsp_delete_module (struct avs_dev *adev,u16 module_id,u16 instance_id, +void avs_dsp_delete_module (struct avs_dev *adev,u16 module_id,u8 instance_id,u8 ppl_instance_id,u8 core_id) {struct avs_module_entry mentry;
sound/soc/intel/avs/path.h +1 -1
@@ -37,7 +37,7 @@ struct avs_path_pipeline {struct avs_path_module {u16 module_id; -u16 instance_id; +u8 instance_id;union avs_gtw_attributes gtw_attrs;struct avs_tplg_module *template;
sound/soc/intel/avs/probes.c +1 -1
@@ -18,7 +18,7 @@ static int avs_dsp_init_probe(struct avs_dev *adev, union avs_connector_node_id {struct avs_probe_cfg cfg = {{0 }};struct avs_module_entry mentry; -u16 dummy; +u8 dummy;avs_get_module_entry (adev, &AVS_PROBE_MOD_UUID , &mentry);
Signature · 1 line
2.34.1
PATCH 7/7 ASoC: Intel: avs: Add missing checks on FE startup
In reply to Amadeusz SławińskiConstraint functions have return values, they should be checked for potential errors.
--- sound/soc/intel/avs/pcm.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
sound/soc/intel/avs/pcm.c +18 -5
@@ -468,21 +468,34 @@ static int avs_dai_fe_startup(struct snd_pcm_substream *substream, struct snd_so host_stream =snd_hdac_ext_stream_assign (bus, substream,HDAC_EXT_STREAM_TYPE_HOST );if (!host_stream) { -kfree (data); -return -EBUSY ; + ret = -EBUSY ; + goto err; } data->host_stream = host_stream; -snd_pcm_hw_constraint_integer (runtime,SNDRV_PCM_HW_PARAM_PERIODS ); + ret =snd_pcm_hw_constraint_integer (runtime,SNDRV_PCM_HW_PARAM_PERIODS ); +if (ret <0 ) + goto err; +/* avoid wrap-around with wall-clock */ -snd_pcm_hw_constraint_minmax (runtime,SNDRV_PCM_HW_PARAM_BUFFER_TIME ,20 ,178000000 ); -snd_pcm_hw_constraint_list (runtime,0 ,SNDRV_PCM_HW_PARAM_RATE , &hw_rates); + ret =snd_pcm_hw_constraint_minmax (runtime,SNDRV_PCM_HW_PARAM_BUFFER_TIME ,20 ,178000000 ); +if (ret <0 ) + goto err; + + ret =snd_pcm_hw_constraint_list (runtime,0 ,SNDRV_PCM_HW_PARAM_RATE , &hw_rates); +if (ret <0 ) + goto err; +snd_pcm_set_sync (substream);dev_dbg (dai->dev,"%s fe STARTUP tag %d str %p" , __func__,hdac_stream (host_stream)->stream_tag, substream);return 0 ; + +err: +kfree (data); +return ret; }static void avs_dai_fe_shutdown (struct snd_pcm_substream *substream,struct snd_soc_dai *dai)
Signature · 1 line
2.34.1
Mark Brown
maintainerQuoted 10 lines · Amadeusz Sławiński
Series of fixes for issues found during development and testing, primarly for avs driver.
Amadeusz Sławiński (4):
ASoC: Intel: avs: Fix module lookup
ASoC: Intel: avs: Access path components under lock
ASoC: Intel: avs: Fixavs_path_module::instance_idsize
ASoC: Intel: avs: Add missing checks on FE startup[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/7] ASoC: Intel: avs: Fix module lookup
commit: ff04437f6dcd138b50483afc7b313f016020ce8f
[2/7] ASoC: Intel: avs: Access path components under lock
commit: d849996f7458042af803b7d15a181922834c5249
[3/7] ASoC: Intel: Skylake: Fix declaration of enum skl_ch_cfg
commit: 95109657471311601b98e71f03d0244f48dc61bb
[4/7] ASoC: Intel: avs: Fix declaration of enum avs_channel_config
commit: 1cf036deebcdec46d6348842bd2f8931202fd4cd
[5/7] ASoC: Intel: avs: Account for UID of ACPI device
commit: 836855100b87b4dd7a82546131779dc255c18b67
[6/7] ASoC: Intel: avs: Fix avs_path_module::instance_id size
commit: 320f4d868b83a804e3a4bd61a5b7d0f1db66380e
[7/7] ASoC: Intel: avs: Add missing checks on FE startup
commit: 25148f57a2a6d157779bae494852e172952ba980All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark