diff options
author | Ranjani Sridharan <ranjani.sridharan@linux.intel.com> | 2022-04-26 10:17:33 -0700 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-04-29 13:05:54 +0100 |
commit | 48d2a1ceae03610a431535aca9106eab4201b191 (patch) | |
tree | 74747565969950f1e0668a4b68d1e9a09236fc48 /sound/soc/sof/ipc3-control.c | |
parent | ce216cfa84a4e1c23b105e652c550bdeaac9e922 (diff) |
ASoC: SOF: Add a new op to set up volume table
Add a new op set_up_volume_table for control IPC ops. Define and set
the op for IPC3.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220426171743.171061-2-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/ipc3-control.c')
-rw-r--r-- | sound/soc/sof/ipc3-control.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sound/soc/sof/ipc3-control.c b/sound/soc/sof/ipc3-control.c index cde9e481f7f2..bea26e73a741 100644 --- a/sound/soc/sof/ipc3-control.c +++ b/sound/soc/sof/ipc3-control.c @@ -694,6 +694,23 @@ static int sof_ipc3_widget_kcontrol_setup(struct snd_sof_dev *sdev, return 0; } +static int +sof_ipc3_set_up_volume_table(struct snd_sof_control *scontrol, int tlv[SOF_TLV_ITEMS], int size) +{ + int i; + + /* init the volume table */ + scontrol->volume_table = kcalloc(size, sizeof(u32), GFP_KERNEL); + if (!scontrol->volume_table) + return -ENOMEM; + + /* populate the volume table */ + for (i = 0; i < size ; i++) + scontrol->volume_table[i] = vol_compute_gain(i, tlv); + + return 0; +} + const struct sof_ipc_tplg_control_ops tplg_ipc3_control_ops = { .volume_put = sof_ipc3_volume_put, .volume_get = sof_ipc3_volume_get, @@ -708,4 +725,5 @@ const struct sof_ipc_tplg_control_ops tplg_ipc3_control_ops = { .bytes_ext_volatile_get = sof_ipc3_bytes_ext_volatile_get, .update = sof_ipc3_control_update, .widget_kcontrol_setup = sof_ipc3_widget_kcontrol_setup, + .set_up_volume_table = sof_ipc3_set_up_volume_table, }; |