ASoC: SOF: topology: pass volume min/max linear value to FW

The driver currently passes the volume ramp type and length
topology tokens to firmware, but the min and max volume are
not set. This patch provides a correction to convert the
information from the topology file and pass the linear volume
min/max value to the firmware to improve transitions.

Signed-off-by: Zhu Yingjiang <yingjiang.zhu@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Zhu Yingjiang 2019-06-12 12:01:46 -05:00 committed by Mark Brown
parent aa66fd80e0
commit 65a18a46b2
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 14 additions and 0 deletions

View File

@ -1552,6 +1552,9 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index,
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
struct snd_soc_tplg_private *private = &tw->priv; struct snd_soc_tplg_private *private = &tw->priv;
struct sof_ipc_comp_volume *volume; struct sof_ipc_comp_volume *volume;
struct snd_sof_control *scontrol;
int min_step;
int max_step;
int ret; int ret;
volume = kzalloc(sizeof(*volume), GFP_KERNEL); volume = kzalloc(sizeof(*volume), GFP_KERNEL);
@ -1594,6 +1597,17 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index,
swidget->private = volume; swidget->private = volume;
list_for_each_entry(scontrol, &sdev->kcontrol_list, list) {
if (scontrol->comp_id == swidget->comp_id) {
min_step = scontrol->min_volume_step;
max_step = scontrol->max_volume_step;
volume->min_value = scontrol->volume_table[min_step];
volume->max_value = scontrol->volume_table[max_step];
volume->channels = scontrol->num_channels;
break;
}
}
ret = sof_ipc_tx_message(sdev->ipc, volume->comp.hdr.cmd, volume, ret = sof_ipc_tx_message(sdev->ipc, volume->comp.hdr.cmd, volume,
sizeof(*volume), r, sizeof(*r)); sizeof(*volume), r, sizeof(*r));
if (ret >= 0) if (ret >= 0)