Repository navigation
Conversation
|
The first commit is also on #3251. Added it here is just to avoid build error. |
|
|
||
| static const struct sof_topology_token ipc4_sched_tokens[] = { | ||
| {SOF_TKN_SCHED_LP_MODE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, | ||
| offsetof(struct sof_ipc4_pipeline, lp_mode), 0} |
There was a problem hiding this comment.
why does this need to be a seaprate array? It doesnt clash with any existing scheduler tokens for IPC3. So why not just include it in there?
| }; | ||
|
|
||
| /** | ||
| * sof_ipc4_comp_alloc - allocate and initialize buffer for a new component |
There was a problem hiding this comment.
can we hange to init memory for new component. Its confusing with there being a buffer component in topology
|
|
||
| snd-sof-objs := core.o ops.o loader.o ipc.o pcm.o pm.o debug.o topology.o\ | ||
| control.o trace.o utils.o sof-audio.o stream-ipc.o ipc4.o \ | ||
| topology-common.o |
There was a problem hiding this comment.
same with this commit. Topology2.0 has nothign to do with this change. You will need to do the same thing irrespective of whether you use topolpogy1.0 or 2.0
| * | ||
| * Return: The pointer to the new allocated component, NULL if failed. | ||
| */ | ||
| static struct sof_ipc_comp *sof_ipc4_comp_alloc(struct snd_sof_widget *swidget, |
There was a problem hiding this comment.
why cant we reuse cof_comp_alloc() here?
There was a problem hiding this comment.
IPC4 doesn't need to set hdr.cmd. Since IPC4 doesn't use hdr we can reuse it
| return comp; | ||
| } | ||
|
|
||
| static int sof_ipc4_widget_load_dai(struct snd_soc_component *scomp, int index, |
There was a problem hiding this comment.
why not pass ipc4_dai->dai and reuse sof_load_dai from IP3?
| * PCM Topology | ||
| */ | ||
|
|
||
| static int sof_ipc4_widget_load_pcm(struct snd_soc_component *scomp, int index, |
There was a problem hiding this comment.
I feel there's a lot of duplicaed code we can avoid here. Can you please address the duplication and why it is unavaoidable @RanderWang @bardliao
There was a problem hiding this comment.
@ranj063 yes, we can reuse more code.
There was a problem hiding this comment.
@ranj063 @RanderWang After revisiting the code, I think only few code should be split. I will restructure the code. Thanks.
73f0cfe to
9fbc666
Compare
| } | ||
| scontrol->volume_table[size - 1] = IPC4_VOL_MAX; | ||
|
|
||
| return 0; |
There was a problem hiding this comment.
seems like both this function and the get_tlv_data can be shared too no?
There was a problem hiding this comment.
seems like both this function and the get_tlv_data can be shared too no?
Volume control is firmware dependency, right? Each firmware defines their own maxima volume/step etc. set_up_volume_table doesn't look similar. get_tlv_data looks similar but /* min value in topology tlv data is multiplied by 100 */ is on the IPC3 version.
| return 0; | ||
| } | ||
|
|
||
| int sof_ipc4_control_load_volume(struct snd_soc_component *scomp, |
There was a problem hiding this comment.
what is IPCv4 sepcific in this load_volume() compared to the IPC3 version?
There was a problem hiding this comment.
what is IPCv4 sepcific in this load_volume() compared to the IPC3 version?
It is not about IPC, but about firmware. Different firmware can have their own volume definition. max, min, step, how to calculate, etc.
| cdata = scontrol->control_data; | ||
| for (i = 0; i < scontrol->num_channels; i++) { | ||
| cdata->chanv[i].channel = i; | ||
| cdata->chanv[i].value = IPC4_VOL_MAX; |
There was a problem hiding this comment.
Ahh just this?
This is to set the default volume.
| return 0; | ||
| } | ||
|
|
||
| int sof_ipc4_widget_load_pipeline(struct snd_soc_component *scomp, int index, |
There was a problem hiding this comment.
@bardliao this looks mostly good but I wonder if we can take this one step further. Basically every load function performs 4 steps:
- Alloc memory
- parse tokens
- set IPC message bits (optionally)
- additional processig (optionally)
Now, before we add support for IPC4, if we can demarcate these steps in all the load functions for IPC3, then we can use some kind of ops to abstract this for IPC3 and IPC4. This will make the transition easier if there were ever an IPC5. Just a thought.
There was a problem hiding this comment.
@bardliao this looks mostly good but I wonder if we can take this one step further. Basically every load function performs 4 steps:
- Alloc memory
- parse tokens
- set IPC message bits (optionally)
- additional processig (optionally)
Now, before we add support for IPC4, if we can demarcate these steps in all the load functions for IPC3, then we can use some kind of ops to abstract this for IPC3 and IPC4. This will make the transition easier if there were ever an IPC5. Just a thought.
Agree, but in step 2 (parse tokens) is tied to data struct. We will parse tokens and store the data into the struct we need. And the struct is different from IPCs. So the ops may include step 2.
Move the token definitions along with the code for parsing them to a common file so they can be shared with IPCv4 topology parser. Signed-off-by: Rander Wang <rander.wang@intel.com>
This patch adds topology support for IPC4. We reuse the common part of the existing topology and create new files for the IPC4 part. Signed-off-by: Rander Wang <rander.wang@intel.com>
Creating topology2 support for IPC4.