Skip to content

Commit 782cee6

Browse files
ranj063macchian
authored andcommitted
module_adapter: Add support for SET_VALUE/GET_VALUE control commands
In preparation for modifying the volume component to use the new module API, add support for SET_VALUE/GET_VALUE control commands. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
1 parent 575f556 commit 782cee6

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

src/audio/module_adapter/module_adapter.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,10 @@ static int module_adapter_ctrl_set_data(struct comp_dev *dev, struct sof_ipc_ctr
639639
/* Used to pass standard and bespoke commands (with data) to component */
640640
int module_adapter_cmd(struct comp_dev *dev, int cmd, void *data, int max_data_size)
641641
{
642-
int ret;
643642
struct sof_ipc_ctrl_data *cdata = ASSUME_ALIGNED(data, 4);
643+
struct processing_module *mod = comp_get_drvdata(dev);
644+
struct module_data *md = &mod->priv;
645+
int ret = 0;
644646

645647
comp_dbg(dev, "module_adapter_cmd() %d start", cmd);
646648

@@ -652,6 +654,25 @@ int module_adapter_cmd(struct comp_dev *dev, int cmd, void *data, int max_data_s
652654
comp_err(dev, "module_adapter_cmd() get_data not implemented yet.");
653655
ret = -ENODATA;
654656
break;
657+
case COMP_CMD_SET_VALUE:
658+
/*
659+
* IPC3 does not use config_id, so pass 0 for config ID as it will be ignored
660+
* anyway. Also, pass the 0 as the fragment size as it is not relevant for the
661+
* SET_VALUE command.
662+
*/
663+
if (md->ops->set_configuration)
664+
ret = md->ops->set_configuration(mod, 0, MODULE_CFG_FRAGMENT_SINGLE, 0,
665+
(const uint8_t *)cdata, 0, NULL, 0);
666+
break;
667+
case COMP_CMD_GET_VALUE:
668+
/*
669+
* IPC3 does not use config_id, so pass 0 for config ID as it will be ignored
670+
* anyway. Also, pass the 0 as the fragment size and data offset as they are not
671+
* relevant for the GET_VALUE command.
672+
*/
673+
if (md->ops->get_configuration)
674+
ret = md->ops->get_configuration(mod, 0, 0, (uint8_t *)cdata, 0);
675+
break;
655676
default:
656677
comp_err(dev, "module_adapter_cmd() error: unknown command");
657678
ret = -EINVAL;

0 commit comments

Comments
 (0)