Commit 10674ca9 authored by Mark Brown's avatar Mark Brown

ASoC/SoundWire: improve suspend flows and use set_stream() instead of set_tdm_slots() for HDAudio

Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>:

This series contains three topics.
1. SoundWire: Intel: remove pdm support
2. ASoC/SoundWire: dai: expand 'stream' concept beyond SoundWire
3. ASoC/SOF/SoundWire: fix suspend-resume on pause with dynamic pipelines

The topics are independent but the changes are dependent. So please
allow me to send them in one series.
parents 5c5f08f7 63a6aa96
...@@ -1178,9 +1178,6 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, ...@@ -1178,9 +1178,6 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
cdns->pcm.num_bd = config.pcm_bd; cdns->pcm.num_bd = config.pcm_bd;
cdns->pcm.num_in = config.pcm_in; cdns->pcm.num_in = config.pcm_in;
cdns->pcm.num_out = config.pcm_out; cdns->pcm.num_out = config.pcm_out;
cdns->pdm.num_bd = config.pdm_bd;
cdns->pdm.num_in = config.pdm_in;
cdns->pdm.num_out = config.pdm_out;
/* Allocate PDIs for PCMs */ /* Allocate PDIs for PCMs */
stream = &cdns->pcm; stream = &cdns->pcm;
...@@ -1211,32 +1208,6 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, ...@@ -1211,32 +1208,6 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
stream->num_pdi = stream->num_bd + stream->num_in + stream->num_out; stream->num_pdi = stream->num_bd + stream->num_in + stream->num_out;
cdns->num_ports = stream->num_pdi; cdns->num_ports = stream->num_pdi;
/* Allocate PDIs for PDMs */
stream = &cdns->pdm;
ret = cdns_allocate_pdi(cdns, &stream->bd,
stream->num_bd, offset);
if (ret)
return ret;
offset += stream->num_bd;
ret = cdns_allocate_pdi(cdns, &stream->in,
stream->num_in, offset);
if (ret)
return ret;
offset += stream->num_in;
ret = cdns_allocate_pdi(cdns, &stream->out,
stream->num_out, offset);
if (ret)
return ret;
/* Update total number of PDM PDIs */
stream->num_pdi = stream->num_bd + stream->num_in + stream->num_out;
cdns->num_ports += stream->num_pdi;
return 0; return 0;
} }
EXPORT_SYMBOL(sdw_cdns_pdi_init); EXPORT_SYMBOL(sdw_cdns_pdi_init);
...@@ -1681,7 +1652,7 @@ int sdw_cdns_probe(struct sdw_cdns *cdns) ...@@ -1681,7 +1652,7 @@ int sdw_cdns_probe(struct sdw_cdns *cdns)
EXPORT_SYMBOL(sdw_cdns_probe); EXPORT_SYMBOL(sdw_cdns_probe);
int cdns_set_sdw_stream(struct snd_soc_dai *dai, int cdns_set_sdw_stream(struct snd_soc_dai *dai,
void *stream, bool pcm, int direction) void *stream, int direction)
{ {
struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai); struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
struct sdw_cdns_dma_data *dma; struct sdw_cdns_dma_data *dma;
...@@ -1705,10 +1676,7 @@ int cdns_set_sdw_stream(struct snd_soc_dai *dai, ...@@ -1705,10 +1676,7 @@ int cdns_set_sdw_stream(struct snd_soc_dai *dai,
if (!dma) if (!dma)
return -ENOMEM; return -ENOMEM;
if (pcm) dma->stream_type = SDW_STREAM_PCM;
dma->stream_type = SDW_STREAM_PCM;
else
dma->stream_type = SDW_STREAM_PDM;
dma->bus = &cdns->bus; dma->bus = &cdns->bus;
dma->link_id = cdns->instance; dma->link_id = cdns->instance;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* @h_ch_num: high channel for PDI * @h_ch_num: high channel for PDI
* @ch_count: total channel count for PDI * @ch_count: total channel count for PDI
* @dir: data direction * @dir: data direction
* @type: stream type, PDM or PCM * @type: stream type, (only PCM supported)
*/ */
struct sdw_cdns_pdi { struct sdw_cdns_pdi {
int num; int num;
...@@ -62,17 +62,11 @@ struct sdw_cdns_streams { ...@@ -62,17 +62,11 @@ struct sdw_cdns_streams {
* @pcm_bd: number of bidirectional PCM streams supported * @pcm_bd: number of bidirectional PCM streams supported
* @pcm_in: number of input PCM streams supported * @pcm_in: number of input PCM streams supported
* @pcm_out: number of output PCM streams supported * @pcm_out: number of output PCM streams supported
* @pdm_bd: number of bidirectional PDM streams supported
* @pdm_in: number of input PDM streams supported
* @pdm_out: number of output PDM streams supported
*/ */
struct sdw_cdns_stream_config { struct sdw_cdns_stream_config {
unsigned int pcm_bd; unsigned int pcm_bd;
unsigned int pcm_in; unsigned int pcm_in;
unsigned int pcm_out; unsigned int pcm_out;
unsigned int pdm_bd;
unsigned int pdm_in;
unsigned int pdm_out;
}; };
/** /**
...@@ -86,6 +80,7 @@ struct sdw_cdns_stream_config { ...@@ -86,6 +80,7 @@ struct sdw_cdns_stream_config {
* @link_id: Master link id * @link_id: Master link id
* @hw_params: hw_params to be applied in .prepare step * @hw_params: hw_params to be applied in .prepare step
* @suspended: status set when suspended, to be used in .prepare * @suspended: status set when suspended, to be used in .prepare
* @paused: status set in .trigger, to be used in suspend
*/ */
struct sdw_cdns_dma_data { struct sdw_cdns_dma_data {
char *name; char *name;
...@@ -96,6 +91,7 @@ struct sdw_cdns_dma_data { ...@@ -96,6 +91,7 @@ struct sdw_cdns_dma_data {
int link_id; int link_id;
struct snd_pcm_hw_params *hw_params; struct snd_pcm_hw_params *hw_params;
bool suspended; bool suspended;
bool paused;
}; };
/** /**
...@@ -109,7 +105,6 @@ struct sdw_cdns_dma_data { ...@@ -109,7 +105,6 @@ struct sdw_cdns_dma_data {
* @ports: Data ports * @ports: Data ports
* @num_ports: Total number of data ports * @num_ports: Total number of data ports
* @pcm: PCM streams * @pcm: PCM streams
* @pdm: PDM streams
* @registers: Cadence registers * @registers: Cadence registers
* @link_up: Link status * @link_up: Link status
* @msg_count: Messages sent on bus * @msg_count: Messages sent on bus
...@@ -127,7 +122,6 @@ struct sdw_cdns { ...@@ -127,7 +122,6 @@ struct sdw_cdns {
int num_ports; int num_ports;
struct sdw_cdns_streams pcm; struct sdw_cdns_streams pcm;
struct sdw_cdns_streams pdm;
int pdi_loopback_source; int pdi_loopback_source;
int pdi_loopback_target; int pdi_loopback_target;
...@@ -186,7 +180,7 @@ cdns_xfer_msg_defer(struct sdw_bus *bus, ...@@ -186,7 +180,7 @@ cdns_xfer_msg_defer(struct sdw_bus *bus,
int cdns_bus_conf(struct sdw_bus *bus, struct sdw_bus_params *params); int cdns_bus_conf(struct sdw_bus *bus, struct sdw_bus_params *params);
int cdns_set_sdw_stream(struct snd_soc_dai *dai, int cdns_set_sdw_stream(struct snd_soc_dai *dai,
void *stream, bool pcm, int direction); void *stream, int direction);
void sdw_cdns_check_self_clearing_bits(struct sdw_cdns *cdns, const char *string, void sdw_cdns_check_self_clearing_bits(struct sdw_cdns *cdns, const char *string,
bool initial_delay, int reset_iterations); bool initial_delay, int reset_iterations);
......
This diff is collapsed.
...@@ -1024,8 +1024,8 @@ static int qcom_swrm_startup(struct snd_pcm_substream *substream, ...@@ -1024,8 +1024,8 @@ static int qcom_swrm_startup(struct snd_pcm_substream *substream,
ctrl->sruntime[dai->id] = sruntime; ctrl->sruntime[dai->id] = sruntime;
for_each_rtd_codec_dais(rtd, i, codec_dai) { for_each_rtd_codec_dais(rtd, i, codec_dai) {
ret = snd_soc_dai_set_sdw_stream(codec_dai, sruntime, ret = snd_soc_dai_set_stream(codec_dai, sruntime,
substream->stream); substream->stream);
if (ret < 0 && ret != -ENOTSUPP) { if (ret < 0 && ret != -ENOTSUPP) {
dev_err(dai->dev, "Failed to set sdw stream on %s\n", dev_err(dai->dev, "Failed to set sdw stream on %s\n",
codec_dai->name); codec_dai->name);
...@@ -1051,8 +1051,8 @@ static const struct snd_soc_dai_ops qcom_swrm_pdm_dai_ops = { ...@@ -1051,8 +1051,8 @@ static const struct snd_soc_dai_ops qcom_swrm_pdm_dai_ops = {
.hw_free = qcom_swrm_hw_free, .hw_free = qcom_swrm_hw_free,
.startup = qcom_swrm_startup, .startup = qcom_swrm_startup,
.shutdown = qcom_swrm_shutdown, .shutdown = qcom_swrm_shutdown,
.set_sdw_stream = qcom_swrm_set_sdw_stream, .set_stream = qcom_swrm_set_sdw_stream,
.get_sdw_stream = qcom_swrm_get_sdw_stream, .get_stream = qcom_swrm_get_sdw_stream,
}; };
static const struct snd_soc_component_driver qcom_swrm_dai_component = { static const struct snd_soc_component_driver qcom_swrm_dai_component = {
......
...@@ -1863,7 +1863,7 @@ static int set_stream(struct snd_pcm_substream *substream, ...@@ -1863,7 +1863,7 @@ static int set_stream(struct snd_pcm_substream *substream,
/* Set stream pointer on all DAIs */ /* Set stream pointer on all DAIs */
for_each_rtd_dais(rtd, i, dai) { for_each_rtd_dais(rtd, i, dai) {
ret = snd_soc_dai_set_sdw_stream(dai, sdw_stream, substream->stream); ret = snd_soc_dai_set_stream(dai, sdw_stream, substream->stream);
if (ret < 0) { if (ret < 0) {
dev_err(rtd->dev, "failed to set stream pointer on dai %s\n", dai->name); dev_err(rtd->dev, "failed to set stream pointer on dai %s\n", dai->name);
break; break;
...@@ -1934,7 +1934,7 @@ void sdw_shutdown_stream(void *sdw_substream) ...@@ -1934,7 +1934,7 @@ void sdw_shutdown_stream(void *sdw_substream)
/* Find stream from first CPU DAI */ /* Find stream from first CPU DAI */
dai = asoc_rtd_to_cpu(rtd, 0); dai = asoc_rtd_to_cpu(rtd, 0);
sdw_stream = snd_soc_dai_get_sdw_stream(dai, substream->stream); sdw_stream = snd_soc_dai_get_stream(dai, substream->stream);
if (IS_ERR(sdw_stream)) { if (IS_ERR(sdw_stream)) {
dev_err(rtd->dev, "no stream found for DAI %s\n", dai->name); dev_err(rtd->dev, "no stream found for DAI %s\n", dai->name);
......
...@@ -92,7 +92,7 @@ ...@@ -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 { ...@@ -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;
}; };
......
...@@ -295,9 +295,9 @@ struct snd_soc_dai_ops { ...@@ -295,9 +295,9 @@ struct snd_soc_dai_ops {
unsigned int *rx_num, unsigned int *rx_slot); unsigned int *rx_num, unsigned int *rx_slot);
int (*set_tristate)(struct snd_soc_dai *dai, int tristate); int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
int (*set_sdw_stream)(struct snd_soc_dai *dai, int (*set_stream)(struct snd_soc_dai *dai,
void *stream, int direction); void *stream, int direction);
void *(*get_sdw_stream)(struct snd_soc_dai *dai, int direction); void *(*get_stream)(struct snd_soc_dai *dai, int direction);
/* /*
* DAI digital mute - optional. * DAI digital mute - optional.
...@@ -515,42 +515,42 @@ static inline void *snd_soc_dai_get_drvdata(struct snd_soc_dai *dai) ...@@ -515,42 +515,42 @@ static inline void *snd_soc_dai_get_drvdata(struct snd_soc_dai *dai)
} }
/** /**
* snd_soc_dai_set_sdw_stream() - Configures a DAI for SDW stream operation * snd_soc_dai_set_stream() - Configures a DAI for stream operation
* @dai: DAI * @dai: DAI
* @stream: STREAM * @stream: STREAM (opaque structure depending on DAI type)
* @direction: Stream direction(Playback/Capture) * @direction: Stream direction(Playback/Capture)
* SoundWire subsystem doesn't have a notion of direction and we reuse * Some subsystems, such as SoundWire, don't have a notion of direction and we reuse
* the ASoC stream direction to configure sink/source ports. * the ASoC stream direction to configure sink/source ports.
* Playback maps to source ports and Capture for sink ports. * Playback maps to source ports and Capture for sink ports.
* *
* This should be invoked with NULL to clear the stream set previously. * This should be invoked with NULL to clear the stream set previously.
* Returns 0 on success, a negative error code otherwise. * Returns 0 on success, a negative error code otherwise.
*/ */
static inline int snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai, static inline int snd_soc_dai_set_stream(struct snd_soc_dai *dai,
void *stream, int direction) void *stream, int direction)
{ {
if (dai->driver->ops->set_sdw_stream) if (dai->driver->ops->set_stream)
return dai->driver->ops->set_sdw_stream(dai, stream, direction); return dai->driver->ops->set_stream(dai, stream, direction);
else else
return -ENOTSUPP; return -ENOTSUPP;
} }
/** /**
* snd_soc_dai_get_sdw_stream() - Retrieves SDW stream from DAI * snd_soc_dai_get_stream() - Retrieves stream from DAI
* @dai: DAI * @dai: DAI
* @direction: Stream direction(Playback/Capture) * @direction: Stream direction(Playback/Capture)
* *
* This routine only retrieves that was previously configured * This routine only retrieves that was previously configured
* with snd_soc_dai_get_sdw_stream() * with snd_soc_dai_get_stream()
* *
* Returns pointer to stream or an ERR_PTR value, e.g. * Returns pointer to stream or an ERR_PTR value, e.g.
* ERR_PTR(-ENOTSUPP) if callback is not supported; * ERR_PTR(-ENOTSUPP) if callback is not supported;
*/ */
static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai *dai, static inline void *snd_soc_dai_get_stream(struct snd_soc_dai *dai,
int direction) int direction)
{ {
if (dai->driver->ops->get_sdw_stream) if (dai->driver->ops->get_stream)
return dai->driver->ops->get_sdw_stream(dai, direction); return dai->driver->ops->get_stream(dai, direction);
else else
return ERR_PTR(-ENOTSUPP); return ERR_PTR(-ENOTSUPP);
} }
......
...@@ -46,9 +46,8 @@ static int hdac_hda_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -46,9 +46,8 @@ static int hdac_hda_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai); struct snd_soc_dai *dai);
static int hdac_hda_dai_hw_free(struct snd_pcm_substream *substream, static int hdac_hda_dai_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai); struct snd_soc_dai *dai);
static int hdac_hda_dai_set_tdm_slot(struct snd_soc_dai *dai, static int hdac_hda_dai_set_stream(struct snd_soc_dai *dai, void *stream,
unsigned int tx_mask, unsigned int rx_mask, int direction);
int slots, int slot_width);
static struct hda_pcm *snd_soc_find_pcm_from_dai(struct hdac_hda_priv *hda_pvt, static struct hda_pcm *snd_soc_find_pcm_from_dai(struct hdac_hda_priv *hda_pvt,
struct snd_soc_dai *dai); struct snd_soc_dai *dai);
...@@ -58,7 +57,7 @@ static const struct snd_soc_dai_ops hdac_hda_dai_ops = { ...@@ -58,7 +57,7 @@ static const struct snd_soc_dai_ops hdac_hda_dai_ops = {
.prepare = hdac_hda_dai_prepare, .prepare = hdac_hda_dai_prepare,
.hw_params = hdac_hda_dai_hw_params, .hw_params = hdac_hda_dai_hw_params,
.hw_free = hdac_hda_dai_hw_free, .hw_free = hdac_hda_dai_hw_free,
.set_tdm_slot = hdac_hda_dai_set_tdm_slot, .set_stream = hdac_hda_dai_set_stream,
}; };
static struct snd_soc_dai_driver hdac_hda_dais[] = { static struct snd_soc_dai_driver hdac_hda_dais[] = {
...@@ -180,21 +179,22 @@ static struct snd_soc_dai_driver hdac_hda_dais[] = { ...@@ -180,21 +179,22 @@ static struct snd_soc_dai_driver hdac_hda_dais[] = {
}; };
static int hdac_hda_dai_set_tdm_slot(struct snd_soc_dai *dai, static int hdac_hda_dai_set_stream(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask, void *stream, int direction)
int slots, int slot_width)
{ {
struct snd_soc_component *component = dai->component; struct snd_soc_component *component = dai->component;
struct hdac_hda_priv *hda_pvt; struct hdac_hda_priv *hda_pvt;
struct hdac_hda_pcm *pcm; struct hdac_hda_pcm *pcm;
struct hdac_stream *hstream;
if (!stream)
return -EINVAL;
hda_pvt = snd_soc_component_get_drvdata(component); hda_pvt = snd_soc_component_get_drvdata(component);
pcm = &hda_pvt->pcm[dai->id]; pcm = &hda_pvt->pcm[dai->id];
hstream = (struct hdac_stream *)stream;
if (tx_mask) pcm->stream_tag[direction] = hstream->stream_tag;
pcm->stream_tag[SNDRV_PCM_STREAM_PLAYBACK] = tx_mask;
else
pcm->stream_tag[SNDRV_PCM_STREAM_CAPTURE] = rx_mask;
return 0; return 0;
} }
......
...@@ -741,7 +741,7 @@ static int max98373_sdw_set_tdm_slot(struct snd_soc_dai *dai, ...@@ -741,7 +741,7 @@ static int max98373_sdw_set_tdm_slot(struct snd_soc_dai *dai,
static const struct snd_soc_dai_ops max98373_dai_sdw_ops = { static const struct snd_soc_dai_ops max98373_dai_sdw_ops = {
.hw_params = max98373_sdw_dai_hw_params, .hw_params = max98373_sdw_dai_hw_params,
.hw_free = max98373_pcm_hw_free, .hw_free = max98373_pcm_hw_free,
.set_sdw_stream = max98373_set_sdw_stream, .set_stream = max98373_set_sdw_stream,
.shutdown = max98373_shutdown, .shutdown = max98373_shutdown,
.set_tdm_slot = max98373_sdw_set_tdm_slot, .set_tdm_slot = max98373_sdw_set_tdm_slot,
}; };
......
...@@ -613,7 +613,7 @@ static const struct snd_soc_component_driver soc_component_sdw_rt1308 = { ...@@ -613,7 +613,7 @@ static const struct snd_soc_component_driver soc_component_sdw_rt1308 = {
static const struct snd_soc_dai_ops rt1308_aif_dai_ops = { static const struct snd_soc_dai_ops rt1308_aif_dai_ops = {
.hw_params = rt1308_sdw_hw_params, .hw_params = rt1308_sdw_hw_params,
.hw_free = rt1308_sdw_pcm_hw_free, .hw_free = rt1308_sdw_pcm_hw_free,
.set_sdw_stream = rt1308_set_sdw_stream, .set_stream = rt1308_set_sdw_stream,
.shutdown = rt1308_sdw_shutdown, .shutdown = rt1308_sdw_shutdown,
.set_tdm_slot = rt1308_sdw_set_tdm_slot, .set_tdm_slot = rt1308_sdw_set_tdm_slot,
}; };
......
...@@ -602,7 +602,7 @@ static const struct snd_soc_component_driver soc_component_sdw_rt1316 = { ...@@ -602,7 +602,7 @@ static const struct snd_soc_component_driver soc_component_sdw_rt1316 = {
static const struct snd_soc_dai_ops rt1316_aif_dai_ops = { static const struct snd_soc_dai_ops rt1316_aif_dai_ops = {
.hw_params = rt1316_sdw_hw_params, .hw_params = rt1316_sdw_hw_params,
.hw_free = rt1316_sdw_pcm_hw_free, .hw_free = rt1316_sdw_pcm_hw_free,
.set_sdw_stream = rt1316_set_sdw_stream, .set_stream = rt1316_set_sdw_stream,
.shutdown = rt1316_sdw_shutdown, .shutdown = rt1316_sdw_shutdown,
}; };
......
...@@ -272,7 +272,7 @@ static int rt5682_sdw_hw_free(struct snd_pcm_substream *substream, ...@@ -272,7 +272,7 @@ static int rt5682_sdw_hw_free(struct snd_pcm_substream *substream,
static const struct snd_soc_dai_ops rt5682_sdw_ops = { static const struct snd_soc_dai_ops rt5682_sdw_ops = {
.hw_params = rt5682_sdw_hw_params, .hw_params = rt5682_sdw_hw_params,
.hw_free = rt5682_sdw_hw_free, .hw_free = rt5682_sdw_hw_free,
.set_sdw_stream = rt5682_set_sdw_stream, .set_stream = rt5682_set_sdw_stream,
.shutdown = rt5682_sdw_shutdown, .shutdown = rt5682_sdw_shutdown,
}; };
......
...@@ -1005,7 +1005,7 @@ static int rt700_pcm_hw_free(struct snd_pcm_substream *substream, ...@@ -1005,7 +1005,7 @@ static int rt700_pcm_hw_free(struct snd_pcm_substream *substream,
static const struct snd_soc_dai_ops rt700_ops = { static const struct snd_soc_dai_ops rt700_ops = {
.hw_params = rt700_pcm_hw_params, .hw_params = rt700_pcm_hw_params,
.hw_free = rt700_pcm_hw_free, .hw_free = rt700_pcm_hw_free,
.set_sdw_stream = rt700_set_sdw_stream, .set_stream = rt700_set_sdw_stream,
.shutdown = rt700_shutdown, .shutdown = rt700_shutdown,
}; };
......
...@@ -1358,7 +1358,7 @@ static int rt711_sdca_pcm_hw_free(struct snd_pcm_substream *substream, ...@@ -1358,7 +1358,7 @@ static int rt711_sdca_pcm_hw_free(struct snd_pcm_substream *substream,
static const struct snd_soc_dai_ops rt711_sdca_ops = { static const struct snd_soc_dai_ops rt711_sdca_ops = {
.hw_params = rt711_sdca_pcm_hw_params, .hw_params = rt711_sdca_pcm_hw_params,
.hw_free = rt711_sdca_pcm_hw_free, .hw_free = rt711_sdca_pcm_hw_free,
.set_sdw_stream = rt711_sdca_set_sdw_stream, .set_stream = rt711_sdca_set_sdw_stream,
.shutdown = rt711_sdca_shutdown, .shutdown = rt711_sdca_shutdown,
}; };
......
...@@ -1089,7 +1089,7 @@ static int rt711_pcm_hw_free(struct snd_pcm_substream *substream, ...@@ -1089,7 +1089,7 @@ static int rt711_pcm_hw_free(struct snd_pcm_substream *substream,
static const struct snd_soc_dai_ops rt711_ops = { static const struct snd_soc_dai_ops rt711_ops = {
.hw_params = rt711_pcm_hw_params, .hw_params = rt711_pcm_hw_params,
.hw_free = rt711_pcm_hw_free, .hw_free = rt711_pcm_hw_free,
.set_sdw_stream = rt711_set_sdw_stream, .set_stream = rt711_set_sdw_stream,
.shutdown = rt711_shutdown, .shutdown = rt711_shutdown,
}; };
......
...@@ -938,7 +938,7 @@ static int rt715_sdca_pcm_hw_free(struct snd_pcm_substream *substream, ...@@ -938,7 +938,7 @@ static int rt715_sdca_pcm_hw_free(struct snd_pcm_substream *substream,
static const struct snd_soc_dai_ops rt715_sdca_ops = { static const struct snd_soc_dai_ops rt715_sdca_ops = {
.hw_params = rt715_sdca_pcm_hw_params, .hw_params = rt715_sdca_pcm_hw_params,
.hw_free = rt715_sdca_pcm_hw_free, .hw_free = rt715_sdca_pcm_hw_free,
.set_sdw_stream = rt715_sdca_set_sdw_stream, .set_stream = rt715_sdca_set_sdw_stream,
.shutdown = rt715_sdca_shutdown, .shutdown = rt715_sdca_shutdown,
}; };
......
...@@ -909,7 +909,7 @@ static int rt715_pcm_hw_free(struct snd_pcm_substream *substream, ...@@ -909,7 +909,7 @@ static int rt715_pcm_hw_free(struct snd_pcm_substream *substream,
static const struct snd_soc_dai_ops rt715_ops = { static const struct snd_soc_dai_ops rt715_ops = {
.hw_params = rt715_pcm_hw_params, .hw_params = rt715_pcm_hw_params,
.hw_free = rt715_pcm_hw_free, .hw_free = rt715_pcm_hw_free,
.set_sdw_stream = rt715_set_sdw_stream, .set_stream = rt715_set_sdw_stream,
.shutdown = rt715_shutdown, .shutdown = rt715_shutdown,
}; };
......
...@@ -138,7 +138,7 @@ static int sdw_mockup_pcm_hw_free(struct snd_pcm_substream *substream, ...@@ -138,7 +138,7 @@ static int sdw_mockup_pcm_hw_free(struct snd_pcm_substream *substream,
static const struct snd_soc_dai_ops sdw_mockup_ops = { static const struct snd_soc_dai_ops sdw_mockup_ops = {
.hw_params = sdw_mockup_pcm_hw_params, .hw_params = sdw_mockup_pcm_hw_params,
.hw_free = sdw_mockup_pcm_hw_free, .hw_free = sdw_mockup_pcm_hw_free,
.set_sdw_stream = sdw_mockup_set_sdw_stream, .set_stream = sdw_mockup_set_sdw_stream,
.shutdown = sdw_mockup_shutdown, .shutdown = sdw_mockup_shutdown,
}; };
......
...@@ -4285,7 +4285,7 @@ static int wcd938x_codec_set_sdw_stream(struct snd_soc_dai *dai, ...@@ -4285,7 +4285,7 @@ static int wcd938x_codec_set_sdw_stream(struct snd_soc_dai *dai,
static const struct snd_soc_dai_ops wcd938x_sdw_dai_ops = { static const struct snd_soc_dai_ops wcd938x_sdw_dai_ops = {
.hw_params = wcd938x_codec_hw_params, .hw_params = wcd938x_codec_hw_params,
.hw_free = wcd938x_codec_free, .hw_free = wcd938x_codec_free,
.set_sdw_stream = wcd938x_codec_set_sdw_stream, .set_stream = wcd938x_codec_set_sdw_stream,
}; };
static struct snd_soc_dai_driver wcd938x_dais[] = { static struct snd_soc_dai_driver wcd938x_dais[] = {
......
...@@ -1018,7 +1018,7 @@ static const struct snd_soc_dai_ops wsa881x_dai_ops = { ...@@ -1018,7 +1018,7 @@ static const struct snd_soc_dai_ops wsa881x_dai_ops = {
.hw_params = wsa881x_hw_params, .hw_params = wsa881x_hw_params,
.hw_free = wsa881x_hw_free, .hw_free = wsa881x_hw_free,
.mute_stream = wsa881x_digital_mute, .mute_stream = wsa881x_digital_mute,
.set_sdw_stream = wsa881x_set_sdw_stream, .set_stream = wsa881x_set_sdw_stream,
}; };
static struct snd_soc_dai_driver wsa881x_dais[] = { static struct snd_soc_dai_driver wsa881x_dais[] = {
......
...@@ -347,7 +347,7 @@ int sdw_prepare(struct snd_pcm_substream *substream) ...@@ -347,7 +347,7 @@ int sdw_prepare(struct snd_pcm_substream *substream)
/* Find stream from first CPU DAI */ /* Find stream from first CPU DAI */
dai = asoc_rtd_to_cpu(rtd, 0); dai = asoc_rtd_to_cpu(rtd, 0);
sdw_stream = snd_soc_dai_get_sdw_stream(dai, substream->stream); sdw_stream = snd_soc_dai_get_stream(dai, substream->stream);
if (IS_ERR(sdw_stream)) { if (IS_ERR(sdw_stream)) {
dev_err(rtd->dev, "no stream found for DAI %s", dai->name); dev_err(rtd->dev, "no stream found for DAI %s", dai->name);
...@@ -367,7 +367,7 @@ int sdw_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -367,7 +367,7 @@ int sdw_trigger(struct snd_pcm_substream *substream, int cmd)
/* Find stream from first CPU DAI */ /* Find stream from first CPU DAI */
dai = asoc_rtd_to_cpu(rtd, 0); dai = asoc_rtd_to_cpu(rtd, 0);
sdw_stream = snd_soc_dai_get_sdw_stream(dai, substream->stream); sdw_stream = snd_soc_dai_get_stream(dai, substream->stream);
if (IS_ERR(sdw_stream)) { if (IS_ERR(sdw_stream)) {
dev_err(rtd->dev, "no stream found for DAI %s", dai->name); dev_err(rtd->dev, "no stream found for DAI %s", dai->name);
...@@ -406,7 +406,7 @@ int sdw_hw_free(struct snd_pcm_substream *substream) ...@@ -406,7 +406,7 @@ int sdw_hw_free(struct snd_pcm_substream *substream)
/* Find stream from first CPU DAI */ /* Find stream from first CPU DAI */
dai = asoc_rtd_to_cpu(rtd, 0); dai = asoc_rtd_to_cpu(rtd, 0);
sdw_stream = snd_soc_dai_get_sdw_stream(dai, substream->stream); sdw_stream = snd_soc_dai_get_stream(dai, substream->stream);
if (IS_ERR(sdw_stream)) { if (IS_ERR(sdw_stream)) {
dev_err(rtd->dev, "no stream found for DAI %s", dai->name); dev_err(rtd->dev, "no stream found for DAI %s", dai->name);
......
...@@ -562,11 +562,8 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream, ...@@ -562,11 +562,8 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,
stream_tag = hdac_stream(link_dev)->stream_tag; stream_tag = hdac_stream(link_dev)->stream_tag;
/* set the stream tag in the codec dai dma params */ /* set the hdac_stream in the codec dai */
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) snd_soc_dai_set_stream(codec_dai, hdac_stream(link_dev), substream->stream);
snd_soc_dai_set_tdm_slot(codec_dai, stream_tag, 0, 0, 0);
else
snd_soc_dai_set_tdm_slot(codec_dai, 0, stream_tag, 0, 0);
p_params.s_fmt = snd_pcm_format_width(params_format(params)); p_params.s_fmt = snd_pcm_format_width(params_format(params));
p_params.ch = params_channels(params); p_params.ch = params_channels(params);
......
...@@ -57,8 +57,8 @@ static int sdm845_slim_snd_hw_params(struct snd_pcm_substream *substream, ...@@ -57,8 +57,8 @@ static int sdm845_slim_snd_hw_params(struct snd_pcm_substream *substream,
int ret = 0, i; int ret = 0, i;
for_each_rtd_codec_dais(rtd, i, codec_dai) { for_each_rtd_codec_dais(rtd, i, codec_dai) {
sruntime = snd_soc_dai_get_sdw_stream(codec_dai, sruntime = snd_soc_dai_get_stream(codec_dai,
substream->stream); substream->stream);
if (sruntime != ERR_PTR(-ENOTSUPP)) if (sruntime != ERR_PTR(-ENOTSUPP))
pdata->sruntime[cpu_dai->id] = sruntime; pdata->sruntime[cpu_dai->id] = sruntime;
......
...@@ -136,8 +136,8 @@ static int sm8250_snd_hw_params(struct snd_pcm_substream *substream, ...@@ -136,8 +136,8 @@ static int sm8250_snd_hw_params(struct snd_pcm_substream *substream,
case TX_CODEC_DMA_TX_2: case TX_CODEC_DMA_TX_2:
case TX_CODEC_DMA_TX_3: case TX_CODEC_DMA_TX_3:
for_each_rtd_codec_dais(rtd, i, codec_dai) { for_each_rtd_codec_dais(rtd, i, codec_dai) {
sruntime = snd_soc_dai_get_sdw_stream(codec_dai, sruntime = snd_soc_dai_get_stream(codec_dai,
substream->stream); substream->stream);
if (sruntime != ERR_PTR(-ENOTSUPP)) if (sruntime != ERR_PTR(-ENOTSUPP))
pdata->sruntime[cpu_dai->id] = sruntime; pdata->sruntime[cpu_dai->id] = sruntime;
} }
......
...@@ -243,11 +243,8 @@ static int hda_link_hw_params(struct snd_pcm_substream *substream, ...@@ -243,11 +243,8 @@ static int hda_link_hw_params(struct snd_pcm_substream *substream,
if (!link) if (!link)
return -EINVAL; return -EINVAL;
/* set the stream tag in the codec dai dma params */ /* set the hdac_stream in the codec dai */
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) snd_soc_dai_set_stream(codec_dai, hdac_stream(link_dev), substream->stream);
snd_soc_dai_set_tdm_slot(codec_dai, stream_tag, 0, 0, 0);
else
snd_soc_dai_set_tdm_slot(codec_dai, 0, stream_tag, 0, 0);
p_params.s_fmt = snd_pcm_format_width(params_format(params)); p_params.s_fmt = snd_pcm_format_width(params_format(params));
p_params.ch = params_channels(params); p_params.ch = params_channels(params);
......
...@@ -184,15 +184,11 @@ static int sdw_dai_config_ipc(struct snd_sof_dev *sdev, ...@@ -184,15 +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;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) w = snd_soc_dai_get_widget(d, params_data->stream);
w = d->playback_widget;
else
w = d->capture_widget;
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);
...@@ -201,15 +197,11 @@ static int sdw_params_stream(struct device *dev, ...@@ -201,15 +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;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) w = snd_soc_dai_get_widget(d, free_data->stream);
w = d->playback_widget;
else
w = d->capture_widget;
/* 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);
......
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