Commit 16252a8f authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Mark Brown

ASoC: codecs: wsa881x: remove soundwire stream handling

There could be multiple instances of this codec on any platform,
so handling stream directly in this codec driver can lead to
multiple calls to prepare/enable/disable on the same SoundWire stream.
Move this stream handling to machine driver to fix this issue.
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200317151233.8763-3-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent eff4d9ec
......@@ -676,7 +676,6 @@ struct wsa881x_priv {
int active_ports;
bool port_prepared[WSA881X_MAX_SWR_PORTS];
bool port_enable[WSA881X_MAX_SWR_PORTS];
bool stream_prepared;
};
static void wsa881x_init(struct wsa881x_priv *wsa881x)
......@@ -954,41 +953,6 @@ static const struct snd_soc_dapm_widget wsa881x_dapm_widgets[] = {
SND_SOC_DAPM_OUTPUT("SPKR"),
};
static int wsa881x_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct wsa881x_priv *wsa881x = dev_get_drvdata(dai->dev);
int ret;
if (wsa881x->stream_prepared) {
sdw_disable_stream(wsa881x->sruntime);
sdw_deprepare_stream(wsa881x->sruntime);
wsa881x->stream_prepared = false;
}
ret = sdw_prepare_stream(wsa881x->sruntime);
if (ret)
return ret;
/**
* NOTE: there is a strict hw requirement about the ordering of port
* enables and actual PA enable. PA enable should only happen after
* soundwire ports are enabled if not DC on the line is accumulated
* resulting in Click/Pop Noise
* PA enable/mute are handled as part of DAPM and digital mute.
*/
ret = sdw_enable_stream(wsa881x->sruntime);
if (ret) {
sdw_deprepare_stream(wsa881x->sruntime);
return ret;
}
wsa881x->stream_prepared = true;
return ret;
}
static int wsa881x_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
......@@ -1016,12 +980,7 @@ static int wsa881x_hw_free(struct snd_pcm_substream *substream,
{
struct wsa881x_priv *wsa881x = dev_get_drvdata(dai->dev);
if (wsa881x->stream_prepared) {
sdw_disable_stream(wsa881x->sruntime);
sdw_deprepare_stream(wsa881x->sruntime);
sdw_stream_remove_slave(wsa881x->slave, wsa881x->sruntime);
wsa881x->stream_prepared = false;
}
return 0;
}
......@@ -1052,7 +1011,6 @@ static int wsa881x_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
static struct snd_soc_dai_ops wsa881x_dai_ops = {
.hw_params = wsa881x_hw_params,
.prepare = wsa881x_prepare,
.hw_free = wsa881x_hw_free,
.mute_stream = wsa881x_digital_mute,
.set_sdw_stream = wsa881x_set_sdw_stream,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment