ASoC/soundwire: intel: simplify callbacks for params/hw_free

We don't really need to pass a substream to the callback, we only need
the direction. No functionality change, only simplification to enable
improve suspend with paused streams.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Acked-By: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20211224021034.26635-3-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Pierre-Louis Bossart 2021-12-24 10:10:29 +08:00 committed by Mark Brown
parent da893a93ea
commit b86947b52f
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
3 changed files with 11 additions and 13 deletions

View File

@ -711,7 +711,7 @@ intel_pdi_alh_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)
} }
static int intel_params_stream(struct sdw_intel *sdw, static int intel_params_stream(struct sdw_intel *sdw,
struct snd_pcm_substream *substream, int stream,
struct snd_soc_dai *dai, struct snd_soc_dai *dai,
struct snd_pcm_hw_params *hw_params, struct snd_pcm_hw_params *hw_params,
int link_id, int alh_stream_id) int link_id, int alh_stream_id)
@ -719,7 +719,7 @@ static int intel_params_stream(struct sdw_intel *sdw,
struct sdw_intel_link_res *res = sdw->link_res; struct sdw_intel_link_res *res = sdw->link_res;
struct sdw_intel_stream_params_data params_data; struct sdw_intel_stream_params_data params_data;
params_data.substream = substream; params_data.stream = stream; /* direction */
params_data.dai = dai; params_data.dai = dai;
params_data.hw_params = hw_params; params_data.hw_params = hw_params;
params_data.link_id = link_id; params_data.link_id = link_id;
@ -732,14 +732,14 @@ static int intel_params_stream(struct sdw_intel *sdw,
} }
static int intel_free_stream(struct sdw_intel *sdw, static int intel_free_stream(struct sdw_intel *sdw,
struct snd_pcm_substream *substream, int stream,
struct snd_soc_dai *dai, struct snd_soc_dai *dai,
int link_id) int link_id)
{ {
struct sdw_intel_link_res *res = sdw->link_res; struct sdw_intel_link_res *res = sdw->link_res;
struct sdw_intel_stream_free_data free_data; struct sdw_intel_stream_free_data free_data;
free_data.substream = substream; free_data.stream = stream; /* direction */
free_data.dai = dai; free_data.dai = dai;
free_data.link_id = link_id; free_data.link_id = link_id;
@ -876,7 +876,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
dma->hw_params = params; dma->hw_params = params;
/* Inform DSP about PDI stream number */ /* Inform DSP about PDI stream number */
ret = intel_params_stream(sdw, substream, dai, params, ret = intel_params_stream(sdw, substream->stream, dai, params,
sdw->instance, sdw->instance,
pdi->intel_alh_id); pdi->intel_alh_id);
if (ret) if (ret)
@ -953,7 +953,7 @@ static int intel_prepare(struct snd_pcm_substream *substream,
sdw_cdns_config_stream(cdns, ch, dir, dma->pdi); sdw_cdns_config_stream(cdns, ch, dir, dma->pdi);
/* Inform DSP about PDI stream number */ /* Inform DSP about PDI stream number */
ret = intel_params_stream(sdw, substream, dai, ret = intel_params_stream(sdw, substream->stream, dai,
dma->hw_params, dma->hw_params,
sdw->instance, sdw->instance,
dma->pdi->intel_alh_id); dma->pdi->intel_alh_id);
@ -987,7 +987,7 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
return ret; return ret;
} }
ret = intel_free_stream(sdw, substream, dai, sdw->instance); ret = intel_free_stream(sdw, substream->stream, dai, sdw->instance);
if (ret < 0) { if (ret < 0) {
dev_err(dai->dev, "intel_free_stream: failed %d\n", ret); dev_err(dai->dev, "intel_free_stream: failed %d\n", ret);
return ret; return ret;

View File

@ -92,7 +92,7 @@
* firmware. * firmware.
*/ */
struct sdw_intel_stream_params_data { struct sdw_intel_stream_params_data {
struct snd_pcm_substream *substream; int stream;
struct snd_soc_dai *dai; struct snd_soc_dai *dai;
struct snd_pcm_hw_params *hw_params; struct snd_pcm_hw_params *hw_params;
int link_id; int link_id;
@ -105,7 +105,7 @@ struct sdw_intel_stream_params_data {
* firmware. * firmware.
*/ */
struct sdw_intel_stream_free_data { struct sdw_intel_stream_free_data {
struct snd_pcm_substream *substream; int stream;
struct snd_soc_dai *dai; struct snd_soc_dai *dai;
int link_id; int link_id;
}; };

View File

@ -184,12 +184,11 @@ static int sdw_dai_config_ipc(struct snd_sof_dev *sdev,
static int sdw_params_stream(struct device *dev, static int sdw_params_stream(struct device *dev,
struct sdw_intel_stream_params_data *params_data) struct sdw_intel_stream_params_data *params_data)
{ {
struct snd_pcm_substream *substream = params_data->substream;
struct snd_sof_dev *sdev = dev_get_drvdata(dev); struct snd_sof_dev *sdev = dev_get_drvdata(dev);
struct snd_soc_dai *d = params_data->dai; struct snd_soc_dai *d = params_data->dai;
struct snd_soc_dapm_widget *w; struct snd_soc_dapm_widget *w;
w = snd_soc_dai_get_widget(d, substream->stream); w = snd_soc_dai_get_widget(d, params_data->stream);
return sdw_dai_config_ipc(sdev, w, params_data->link_id, params_data->alh_stream_id, return sdw_dai_config_ipc(sdev, w, params_data->link_id, params_data->alh_stream_id,
d->id, true); d->id, true);
@ -198,12 +197,11 @@ static int sdw_params_stream(struct device *dev,
static int sdw_free_stream(struct device *dev, static int sdw_free_stream(struct device *dev,
struct sdw_intel_stream_free_data *free_data) struct sdw_intel_stream_free_data *free_data)
{ {
struct snd_pcm_substream *substream = free_data->substream;
struct snd_sof_dev *sdev = dev_get_drvdata(dev); struct snd_sof_dev *sdev = dev_get_drvdata(dev);
struct snd_soc_dai *d = free_data->dai; struct snd_soc_dai *d = free_data->dai;
struct snd_soc_dapm_widget *w; struct snd_soc_dapm_widget *w;
w = snd_soc_dai_get_widget(d, substream->stream); w = snd_soc_dai_get_widget(d, free_data->stream);
/* send invalid stream_id */ /* send invalid stream_id */
return sdw_dai_config_ipc(sdev, w, free_data->link_id, 0xFFFF, d->id, false); return sdw_dai_config_ipc(sdev, w, free_data->link_id, 0xFFFF, d->id, false);