]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ASoC: SOF: topology: read back control data from DSP
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Wed, 15 Dec 2021 18:04:04 +0000 (10:04 -0800)
committerMark Brown <broonie@kernel.org>
Wed, 15 Dec 2021 22:16:48 +0000 (22:16 +0000)
Read back the control data from the DSP to initialize the control data
size to match that of the data in the DSP. This is particularly useful
for volatile read-only kcontrols in static pipelines.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-9-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/sof-audio.c

index 735fbc5fe1bd34ac48a3fffc599a715bae277b33..91e3fa5a73501ba02e335089ecb21acae75577cf 100644 (file)
@@ -59,12 +59,26 @@ static int sof_widget_kcontrol_setup(struct snd_sof_dev *sdev, struct snd_sof_wi
        /* set up all controls for the widget */
        list_for_each_entry(scontrol, &sdev->kcontrol_list, list)
                if (scontrol->comp_id == swidget->comp_id) {
+                       /* set kcontrol data in DSP */
                        ret = sof_kcontrol_setup(sdev, scontrol);
                        if (ret < 0) {
                                dev_err(sdev->dev, "error: fail to set up kcontrols for widget %s\n",
                                        swidget->widget->name);
                                return ret;
                        }
+
+                       /*
+                        * Read back the data from the DSP for static widgets. This is particularly
+                        * useful for binary kcontrols associated with static pipeline widgets to
+                        * initialize the data size to match that in the DSP.
+                        */
+                       if (swidget->dynamic_pipeline_widget)
+                               continue;
+
+                       ret = snd_sof_ipc_set_get_comp_data(scontrol, false);
+                       if (ret < 0)
+                               dev_warn(sdev->dev, "Failed kcontrol get for control in widget %s\n",
+                                        swidget->widget->name);
                }
 
        return 0;