mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 21:44:23 -04:00
ASoC: SOF: Intel: hda-dai: Remove BE DAI DRV ops for SSP DAI's
Now that the DAI_CONFIG IPC is sent after widget setup and before widget free, there is no need for the BE DAI DRV ops that do the same thing. So remove them. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230307140435.2808-2-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
ed3b4b8772
commit
274f8a3b4e
@@ -605,115 +605,6 @@ static const struct snd_soc_dai_ops ipc4_hda_dai_ops = {
|
||||
|
||||
#endif
|
||||
|
||||
/* only one flag used so far to harden hw_params/hw_free/trigger/prepare */
|
||||
struct ssp_dai_dma_data {
|
||||
bool setup;
|
||||
};
|
||||
|
||||
static int ssp_dai_setup_or_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai,
|
||||
bool setup)
|
||||
{
|
||||
struct snd_soc_dapm_widget *w;
|
||||
|
||||
w = snd_soc_dai_get_widget(dai, substream->stream);
|
||||
|
||||
if (setup)
|
||||
return hda_ctrl_dai_widget_setup(w, SOF_DAI_CONFIG_FLAGS_NONE, NULL);
|
||||
|
||||
return hda_ctrl_dai_widget_free(w, SOF_DAI_CONFIG_FLAGS_NONE, NULL);
|
||||
}
|
||||
|
||||
static int ssp_dai_startup(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct ssp_dai_dma_data *dma_data;
|
||||
|
||||
dma_data = kzalloc(sizeof(*dma_data), GFP_KERNEL);
|
||||
if (!dma_data)
|
||||
return -ENOMEM;
|
||||
|
||||
snd_soc_dai_set_dma_data(dai, substream, dma_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ssp_dai_setup(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai,
|
||||
bool setup)
|
||||
{
|
||||
struct ssp_dai_dma_data *dma_data;
|
||||
int ret = 0;
|
||||
|
||||
dma_data = snd_soc_dai_get_dma_data(dai, substream);
|
||||
if (!dma_data) {
|
||||
dev_err(dai->dev, "%s: failed to get dma_data\n", __func__);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (dma_data->setup != setup) {
|
||||
ret = ssp_dai_setup_or_free(substream, dai, setup);
|
||||
if (!ret)
|
||||
dma_data->setup = setup;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ssp_dai_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
/* params are ignored for now */
|
||||
return ssp_dai_setup(substream, dai, true);
|
||||
}
|
||||
|
||||
static int ssp_dai_prepare(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
/*
|
||||
* the SSP will only be reconfigured during resume operations and
|
||||
* not in case of xruns
|
||||
*/
|
||||
return ssp_dai_setup(substream, dai, true);
|
||||
}
|
||||
|
||||
static int ipc3_ssp_dai_trigger(struct snd_pcm_substream *substream,
|
||||
int cmd, struct snd_soc_dai *dai)
|
||||
{
|
||||
if (cmd != SNDRV_PCM_TRIGGER_SUSPEND)
|
||||
return 0;
|
||||
|
||||
return ssp_dai_setup(substream, dai, false);
|
||||
}
|
||||
|
||||
static int ssp_dai_hw_free(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
return ssp_dai_setup(substream, dai, false);
|
||||
}
|
||||
|
||||
static void ssp_dai_shutdown(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct ssp_dai_dma_data *dma_data;
|
||||
|
||||
dma_data = snd_soc_dai_get_dma_data(dai, substream);
|
||||
if (!dma_data) {
|
||||
dev_err(dai->dev, "%s: failed to get dma_data\n", __func__);
|
||||
return;
|
||||
}
|
||||
snd_soc_dai_set_dma_data(dai, substream, NULL);
|
||||
kfree(dma_data);
|
||||
}
|
||||
|
||||
static const struct snd_soc_dai_ops ipc3_ssp_dai_ops = {
|
||||
.startup = ssp_dai_startup,
|
||||
.hw_params = ssp_dai_hw_params,
|
||||
.prepare = ssp_dai_prepare,
|
||||
.trigger = ipc3_ssp_dai_trigger,
|
||||
.hw_free = ssp_dai_hw_free,
|
||||
.shutdown = ssp_dai_shutdown,
|
||||
};
|
||||
|
||||
void hda_set_dai_drv_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *ops)
|
||||
{
|
||||
int i;
|
||||
@@ -721,10 +612,6 @@ void hda_set_dai_drv_ops(struct snd_sof_dev *sdev, struct snd_sof_dsp_ops *ops)
|
||||
switch (sdev->pdata->ipc_type) {
|
||||
case SOF_IPC:
|
||||
for (i = 0; i < ops->num_drv; i++) {
|
||||
if (strstr(ops->drv[i].name, "SSP")) {
|
||||
ops->drv[i].ops = &ipc3_ssp_dai_ops;
|
||||
continue;
|
||||
}
|
||||
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC)
|
||||
if (strstr(ops->drv[i].name, "iDisp") ||
|
||||
strstr(ops->drv[i].name, "Analog") ||
|
||||
|
||||
Reference in New Issue
Block a user