Skip to content

Commit 240ca95

Browse files
committed
ASoC: Intel: Fixes
Merge series from Amadeusz Sławiński <[email protected]>: Series of fixes for issues found during development and testing, primarly for avs driver.
2 parents 3a2e3fa + 25148f5 commit 240ca95

File tree

11 files changed

+49
-22
lines changed

11 files changed

+49
-22
lines changed

include/sound/soc-acpi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ struct snd_soc_acpi_link_adr {
170170
/* Descriptor for SST ASoC machine driver */
171171
struct snd_soc_acpi_mach {
172172
u8 id[ACPI_ID_LEN];
173+
const char *uid;
173174
const struct snd_soc_acpi_codecs *comp_ids;
174175
const u32 link_mask;
175176
const struct snd_soc_acpi_link_adr *links;

include/uapi/sound/skl-tplg-interface.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ enum skl_ch_cfg {
6666
SKL_CH_CFG_DUAL_MONO = 9,
6767
SKL_CH_CFG_I2S_DUAL_STEREO_0 = 10,
6868
SKL_CH_CFG_I2S_DUAL_STEREO_1 = 11,
69-
SKL_CH_CFG_4_CHANNEL = 12,
69+
SKL_CH_CFG_7_1 = 12,
70+
SKL_CH_CFG_4_CHANNEL = SKL_CH_CFG_7_1,
7071
SKL_CH_CFG_INVALID
7172
};
7273

sound/soc/intel/avs/apl.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ static bool apl_lp_streaming(struct avs_dev *adev)
169169
{
170170
struct avs_path *path;
171171

172+
spin_lock(&adev->path_list_lock);
172173
/* Any gateway without buffer allocated in LP area disqualifies D0IX. */
173174
list_for_each_entry(path, &adev->path_list, node) {
174175
struct avs_path_pipeline *ppl;
@@ -188,11 +189,14 @@ static bool apl_lp_streaming(struct avs_dev *adev)
188189
if (cfg->copier.dma_type == INVALID_OBJECT_ID)
189190
continue;
190191

191-
if (!mod->gtw_attrs.lp_buffer_alloc)
192+
if (!mod->gtw_attrs.lp_buffer_alloc) {
193+
spin_unlock(&adev->path_list_lock);
192194
return false;
195+
}
193196
}
194197
}
195198
}
199+
spin_unlock(&adev->path_list_lock);
196200

197201
return true;
198202
}

sound/soc/intel/avs/avs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ void avs_release_firmwares(struct avs_dev *adev);
283283

284284
int avs_dsp_init_module(struct avs_dev *adev, u16 module_id, u8 ppl_instance_id,
285285
u8 core_id, u8 domain, void *param, u32 param_size,
286-
u16 *instance_id);
287-
void avs_dsp_delete_module(struct avs_dev *adev, u16 module_id, u16 instance_id,
286+
u8 *instance_id);
287+
void avs_dsp_delete_module(struct avs_dev *adev, u16 module_id, u8 instance_id,
288288
u8 ppl_instance_id, u8 core_id);
289289
int avs_dsp_create_pipeline(struct avs_dev *adev, u16 req_size, u8 priority,
290290
bool lp, u16 attributes, u8 *instance_id);

sound/soc/intel/avs/board_selection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ static int avs_register_i2s_boards(struct avs_dev *adev)
443443
}
444444

445445
for (mach = boards->machs; mach->id[0]; mach++) {
446-
if (!acpi_dev_present(mach->id, NULL, -1))
446+
if (!acpi_dev_present(mach->id, mach->uid, -1))
447447
continue;
448448

449449
if (mach->machine_quirk)

sound/soc/intel/avs/control.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,25 @@ static struct avs_dev *avs_get_kcontrol_adev(struct snd_kcontrol *kcontrol)
2121
return to_avs_dev(w->dapm->component->dev);
2222
}
2323

24-
static struct avs_path_module *avs_get_kcontrol_module(struct avs_dev *adev, u32 id)
24+
static struct avs_path_module *avs_get_volume_module(struct avs_dev *adev, u32 id)
2525
{
2626
struct avs_path *path;
2727
struct avs_path_pipeline *ppl;
2828
struct avs_path_module *mod;
2929

30-
list_for_each_entry(path, &adev->path_list, node)
31-
list_for_each_entry(ppl, &path->ppl_list, node)
32-
list_for_each_entry(mod, &ppl->mod_list, node)
33-
if (mod->template->ctl_id && mod->template->ctl_id == id)
30+
spin_lock(&adev->path_list_lock);
31+
list_for_each_entry(path, &adev->path_list, node) {
32+
list_for_each_entry(ppl, &path->ppl_list, node) {
33+
list_for_each_entry(mod, &ppl->mod_list, node) {
34+
if (guid_equal(&mod->template->cfg_ext->type, &AVS_PEAKVOL_MOD_UUID)
35+
&& mod->template->ctl_id == id) {
36+
spin_unlock(&adev->path_list_lock);
3437
return mod;
38+
}
39+
}
40+
}
41+
}
42+
spin_unlock(&adev->path_list_lock);
3543

3644
return NULL;
3745
}
@@ -49,7 +57,7 @@ int avs_control_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
4957
/* prevent access to modules while path is being constructed */
5058
mutex_lock(&adev->path_mutex);
5159

52-
active_module = avs_get_kcontrol_module(adev, ctl_data->id);
60+
active_module = avs_get_volume_module(adev, ctl_data->id);
5361
if (active_module) {
5462
ret = avs_ipc_peakvol_get_volume(adev, active_module->module_id,
5563
active_module->instance_id, &dspvols,
@@ -89,7 +97,7 @@ int avs_control_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
8997
changed = 1;
9098
}
9199

92-
active_module = avs_get_kcontrol_module(adev, ctl_data->id);
100+
active_module = avs_get_volume_module(adev, ctl_data->id);
93101
if (active_module) {
94102
dspvol.channel_id = AVS_ALL_CHANNELS_MASK;
95103
dspvol.target_volume = *volume;

sound/soc/intel/avs/dsp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static int avs_dsp_put_core(struct avs_dev *adev, u32 core_id)
225225

226226
int avs_dsp_init_module(struct avs_dev *adev, u16 module_id, u8 ppl_instance_id,
227227
u8 core_id, u8 domain, void *param, u32 param_size,
228-
u16 *instance_id)
228+
u8 *instance_id)
229229
{
230230
struct avs_module_entry mentry;
231231
bool was_loaded = false;
@@ -272,7 +272,7 @@ int avs_dsp_init_module(struct avs_dev *adev, u16 module_id, u8 ppl_instance_id,
272272
return ret;
273273
}
274274

275-
void avs_dsp_delete_module(struct avs_dev *adev, u16 module_id, u16 instance_id,
275+
void avs_dsp_delete_module(struct avs_dev *adev, u16 module_id, u8 instance_id,
276276
u8 ppl_instance_id, u8 core_id)
277277
{
278278
struct avs_module_entry mentry;

sound/soc/intel/avs/messages.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ enum avs_channel_config {
619619
AVS_CHANNEL_CONFIG_DUAL_MONO = 9,
620620
AVS_CHANNEL_CONFIG_I2S_DUAL_STEREO_0 = 10,
621621
AVS_CHANNEL_CONFIG_I2S_DUAL_STEREO_1 = 11,
622-
AVS_CHANNEL_CONFIG_4_CHANNEL = 12,
622+
AVS_CHANNEL_CONFIG_7_1 = 12,
623623
AVS_CHANNEL_CONFIG_INVALID
624624
};
625625

sound/soc/intel/avs/path.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct avs_path_pipeline {
3737

3838
struct avs_path_module {
3939
u16 module_id;
40-
u16 instance_id;
40+
u8 instance_id;
4141
union avs_gtw_attributes gtw_attrs;
4242

4343
struct avs_tplg_module *template;

sound/soc/intel/avs/pcm.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -468,21 +468,34 @@ static int avs_dai_fe_startup(struct snd_pcm_substream *substream, struct snd_so
468468

469469
host_stream = snd_hdac_ext_stream_assign(bus, substream, HDAC_EXT_STREAM_TYPE_HOST);
470470
if (!host_stream) {
471-
kfree(data);
472-
return -EBUSY;
471+
ret = -EBUSY;
472+
goto err;
473473
}
474474

475475
data->host_stream = host_stream;
476-
snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
476+
ret = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
477+
if (ret < 0)
478+
goto err;
479+
477480
/* avoid wrap-around with wall-clock */
478-
snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_TIME, 20, 178000000);
479-
snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_rates);
481+
ret = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_TIME, 20, 178000000);
482+
if (ret < 0)
483+
goto err;
484+
485+
ret = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_rates);
486+
if (ret < 0)
487+
goto err;
488+
480489
snd_pcm_set_sync(substream);
481490

482491
dev_dbg(dai->dev, "%s fe STARTUP tag %d str %p",
483492
__func__, hdac_stream(host_stream)->stream_tag, substream);
484493

485494
return 0;
495+
496+
err:
497+
kfree(data);
498+
return ret;
486499
}
487500

488501
static void avs_dai_fe_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)

0 commit comments

Comments
 (0)