On 17/09/2021 17:36, Daniel Baluta wrote: > From: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx> > > With the implementation of the dynamic pipeline feature, widgets > will only be setup when a PCM is opened during the > hw_params ioctl. The BE hw_params callback is responsible for > sending the DAI_CONFIG for the DAI widgets in the DSP. > With dynamic pipelines, the DAI widgets will need to set up > first before sending the DAI_CONFIG IPC in the BE hw_params. > > Update the BE hw_params/hw_free callbacks for all ALH, HDA and SSP > DAIs to set up/free the DAI widget before/after DAI_CONFIG IPC. > > Signed-off-by: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx> > Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@xxxxxxxxxxxxxxx> > Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx> > Reviewed-by: Kai Vehmanen <kai.vehmanen@xxxxxxxxxxxxxxx> > Signed-off-by: Daniel Baluta <daniel.baluta@xxxxxxx> > --- > sound/soc/sof/intel/hda-dai.c | 176 ++++++++++++++++++++------------- > sound/soc/sof/intel/hda.c | 177 +++++++++++++++++++++++++--------- > sound/soc/sof/intel/hda.h | 5 + > sound/soc/sof/sof-audio.c | 1 + > sound/soc/sof/sof-audio.h | 2 +- > sound/soc/sof/topology.c | 3 - > 6 files changed, 245 insertions(+), 119 deletions(-) > > diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c > index 2f54a659b78a..d1ec8bfb6002 100644 > --- a/sound/soc/sof/intel/hda-dai.c > +++ b/sound/soc/sof/intel/hda-dai.c > @@ -155,49 +155,70 @@ static int hda_link_dma_params(struct hdac_ext_stream *stream, > return 0; > } > > -/* Send DAI_CONFIG IPC to the DAI that matches the dai_name and direction */ > -static int hda_link_config_ipc(struct sof_intel_hda_stream *hda_stream, > - const char *dai_name, int channel, int dir) > +/* Update config for the DAI widget */ > +static struct sof_ipc_dai_config *hda_dai_update_config(struct snd_soc_dapm_widget *w, > + int channel) > { > + struct snd_sof_widget *swidget = w->dobj.private; > struct sof_ipc_dai_config *config; > struct snd_sof_dai *sof_dai; > - struct sof_ipc_reply reply; > - int ret = 0; > > - list_for_each_entry(sof_dai, &hda_stream->sdev->dai_list, list) { > - if (!sof_dai->cpu_dai_name) > - continue; > + if (!swidget) { > + dev_err(swidget->scomp->dev, "error: No private data for widget %s\n", w->name); NULL pointer dereference, just return NULL without the print. The caller is printing anyways. > + return NULL; > + } > -- Péter