* [PATCH v2 0/4] soundwire: Remove sdw stream operations from Intel
@ 2020-09-03 20:47 Bard Liao
2020-09-03 20:47 ` [PATCH v2 1/4] soundwire: stream: fix NULL/IS_ERR confusion Bard Liao
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Bard Liao @ 2020-09-03 20:47 UTC (permalink / raw)
To: alsa-devel, vkoul
Cc: vinod.koul, linux-kernel, tiwai, broonie, gregkh, jank,
srinivas.kandagatla, rander.wang, ranjani.sridharan, hui.wang,
pierre-louis.bossart, sanyog.r.kale, mengdong.lin, bard.liao
Sdw stream operation APIs can be called once per stream. Move these
operations to dailink ops. The linked series is "ASoC: Add sdw stream
operations to dailink ops".
Pierre-Louis Bossart (4):
soundwire: stream: fix NULL/IS_ERR confusion
soundwire: intel: fix NULL/ERR_PTR confusion
soundwire: intel: remove .trigger operation
soundwire: intel: remove stream handling from .prepare and .hw_free
drivers/soundwire/intel.c | 60 +++++---------------------------------
drivers/soundwire/stream.c | 2 +-
2 files changed, 9 insertions(+), 53 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/4] soundwire: stream: fix NULL/IS_ERR confusion
2020-09-03 20:47 [PATCH v2 0/4] soundwire: Remove sdw stream operations from Intel Bard Liao
@ 2020-09-03 20:47 ` Bard Liao
2020-09-03 20:47 ` [PATCH v2 2/4] soundwire: intel: fix NULL/ERR_PTR confusion Bard Liao
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Bard Liao @ 2020-09-03 20:47 UTC (permalink / raw)
To: alsa-devel, vkoul
Cc: vinod.koul, linux-kernel, tiwai, broonie, gregkh, jank,
srinivas.kandagatla, rander.wang, ranjani.sridharan, hui.wang,
pierre-louis.bossart, sanyog.r.kale, mengdong.lin, bard.liao
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
snd_soc_dai_get_sdw_stream() can only return -ENOTSUPP or the stream,
NULL is not a possible value.
Fixes: 4550569bd779f ('soundwire: stream: add helper to startup/shutdown streams')
Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
drivers/soundwire/stream.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index e4cf484f5905..12a4a4bba85a 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -1914,7 +1914,7 @@ void sdw_shutdown_stream(void *sdw_substream)
sdw_stream = snd_soc_dai_get_sdw_stream(dai, substream->stream);
- if (!sdw_stream) {
+ if (IS_ERR(sdw_stream)) {
dev_err(rtd->dev, "no stream found for DAI %s", dai->name);
return;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/4] soundwire: intel: fix NULL/ERR_PTR confusion
2020-09-03 20:47 [PATCH v2 0/4] soundwire: Remove sdw stream operations from Intel Bard Liao
2020-09-03 20:47 ` [PATCH v2 1/4] soundwire: stream: fix NULL/IS_ERR confusion Bard Liao
@ 2020-09-03 20:47 ` Bard Liao
2020-09-03 20:47 ` [PATCH v2 3/4] soundwire: intel: remove .trigger operation Bard Liao
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Bard Liao @ 2020-09-03 20:47 UTC (permalink / raw)
To: alsa-devel, vkoul
Cc: vinod.koul, linux-kernel, tiwai, broonie, gregkh, jank,
srinivas.kandagatla, rander.wang, ranjani.sridharan, hui.wang,
pierre-louis.bossart, sanyog.r.kale, mengdong.lin, bard.liao
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
snd_soc_dai_get_sdw_stream() can only return the pointer to stream or
an ERR_PTR value, NULL is not a possible value.
Fixes: 09553140c8d7b ('soundwire: intel: implement get_sdw_stream() operations')
Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
drivers/soundwire/intel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index 710f5eba936b..7c20b7daf1c8 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -1142,7 +1142,7 @@ static void *intel_get_sdw_stream(struct snd_soc_dai *dai,
dma = dai->capture_dma_data;
if (!dma)
- return NULL;
+ return ERR_PTR(-EINVAL);
return dma->stream;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/4] soundwire: intel: remove .trigger operation
2020-09-03 20:47 [PATCH v2 0/4] soundwire: Remove sdw stream operations from Intel Bard Liao
2020-09-03 20:47 ` [PATCH v2 1/4] soundwire: stream: fix NULL/IS_ERR confusion Bard Liao
2020-09-03 20:47 ` [PATCH v2 2/4] soundwire: intel: fix NULL/ERR_PTR confusion Bard Liao
@ 2020-09-03 20:47 ` Bard Liao
2020-09-03 20:47 ` [PATCH v2 4/4] soundwire: intel: remove stream handling from .prepare and .hw_free Bard Liao
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Bard Liao @ 2020-09-03 20:47 UTC (permalink / raw)
To: alsa-devel, vkoul
Cc: vinod.koul, linux-kernel, tiwai, broonie, gregkh, jank,
srinivas.kandagatla, rander.wang, ranjani.sridharan, hui.wang,
pierre-louis.bossart, sanyog.r.kale, mengdong.lin, bard.liao
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Now that the stream trigger is handled at the dai-link level, there is
no need for a dai-level trigger any longer.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
drivers/soundwire/intel.c | 39 ---------------------------------------
1 file changed, 39 deletions(-)
diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index 7c20b7daf1c8..d208c49b157a 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -1013,43 +1013,6 @@ static int intel_prepare(struct snd_pcm_substream *substream,
return ret;
}
-static int intel_trigger(struct snd_pcm_substream *substream, int cmd,
- struct snd_soc_dai *dai)
-{
- struct sdw_cdns_dma_data *dma;
- int ret;
-
- dma = snd_soc_dai_get_dma_data(dai, substream);
- if (!dma) {
- dev_err(dai->dev, "failed to get dma data in %s", __func__);
- return -EIO;
- }
-
- switch (cmd) {
- case SNDRV_PCM_TRIGGER_START:
- case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- case SNDRV_PCM_TRIGGER_RESUME:
- ret = sdw_enable_stream(dma->stream);
- break;
-
- case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- case SNDRV_PCM_TRIGGER_SUSPEND:
- case SNDRV_PCM_TRIGGER_STOP:
- ret = sdw_disable_stream(dma->stream);
- break;
-
- default:
- ret = -EINVAL;
- break;
- }
-
- if (ret)
- dev_err(dai->dev,
- "%s trigger %d failed: %d",
- __func__, cmd, ret);
- return ret;
-}
-
static int
intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
{
@@ -1151,7 +1114,6 @@ static const struct snd_soc_dai_ops intel_pcm_dai_ops = {
.startup = intel_startup,
.hw_params = intel_hw_params,
.prepare = intel_prepare,
- .trigger = intel_trigger,
.hw_free = intel_hw_free,
.shutdown = intel_shutdown,
.set_sdw_stream = intel_pcm_set_sdw_stream,
@@ -1162,7 +1124,6 @@ static const struct snd_soc_dai_ops intel_pdm_dai_ops = {
.startup = intel_startup,
.hw_params = intel_hw_params,
.prepare = intel_prepare,
- .trigger = intel_trigger,
.hw_free = intel_hw_free,
.shutdown = intel_shutdown,
.set_sdw_stream = intel_pdm_set_sdw_stream,
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 4/4] soundwire: intel: remove stream handling from .prepare and .hw_free
2020-09-03 20:47 [PATCH v2 0/4] soundwire: Remove sdw stream operations from Intel Bard Liao
` (2 preceding siblings ...)
2020-09-03 20:47 ` [PATCH v2 3/4] soundwire: intel: remove .trigger operation Bard Liao
@ 2020-09-03 20:47 ` Bard Liao
2020-09-04 9:21 ` [PATCH v2 0/4] soundwire: Remove sdw stream operations from Intel Vinod Koul
2020-09-08 12:44 ` Jaroslav Kysela
5 siblings, 0 replies; 7+ messages in thread
From: Bard Liao @ 2020-09-03 20:47 UTC (permalink / raw)
To: alsa-devel, vkoul
Cc: vinod.koul, linux-kernel, tiwai, broonie, gregkh, jank,
srinivas.kandagatla, rander.wang, ranjani.sridharan, hui.wang,
pierre-louis.bossart, sanyog.r.kale, mengdong.lin, bard.liao
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Now that the stream is handled at the dai-link level (in the machine
driver), we can remove the stream handling at the dai level. We still
need these callbacks to perform dai-level resource handling
(i.e. addition/removal of a master).
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
drivers/soundwire/intel.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index d208c49b157a..a254f271acf2 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -967,7 +967,7 @@ static int intel_prepare(struct snd_pcm_substream *substream,
struct sdw_intel *sdw = cdns_to_intel(cdns);
struct sdw_cdns_dma_data *dma;
int ch, dir;
- int ret;
+ int ret = 0;
dma = snd_soc_dai_get_dma_data(dai, substream);
if (!dma) {
@@ -1003,13 +1003,8 @@ static int intel_prepare(struct snd_pcm_substream *substream,
dma->hw_params,
sdw->instance,
dma->pdi->intel_alh_id);
- if (ret)
- goto err;
}
- ret = sdw_prepare_stream(dma->stream);
-
-err:
return ret;
}
@@ -1025,12 +1020,12 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
if (!dma)
return -EIO;
- ret = sdw_deprepare_stream(dma->stream);
- if (ret) {
- dev_err(dai->dev, "sdw_deprepare_stream: failed %d", ret);
- return ret;
- }
-
+ /*
+ * The sdw stream state will transition to RELEASED when stream->
+ * master_list is empty. So the stream state will transition to
+ * DEPREPARED for the first cpu-dai and to RELEASED for the last
+ * cpu-dai.
+ */
ret = sdw_stream_remove_master(&cdns->bus, dma->stream);
if (ret < 0) {
dev_err(dai->dev, "remove master from stream %s failed: %d\n",
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/4] soundwire: Remove sdw stream operations from Intel
2020-09-03 20:47 [PATCH v2 0/4] soundwire: Remove sdw stream operations from Intel Bard Liao
` (3 preceding siblings ...)
2020-09-03 20:47 ` [PATCH v2 4/4] soundwire: intel: remove stream handling from .prepare and .hw_free Bard Liao
@ 2020-09-04 9:21 ` Vinod Koul
2020-09-08 12:44 ` Jaroslav Kysela
5 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2020-09-04 9:21 UTC (permalink / raw)
To: Bard Liao
Cc: alsa-devel, linux-kernel, tiwai, broonie, gregkh, jank,
srinivas.kandagatla, rander.wang, ranjani.sridharan, hui.wang,
pierre-louis.bossart, sanyog.r.kale, mengdong.lin, bard.liao
On 04-09-20, 04:47, Bard Liao wrote:
> Sdw stream operation APIs can be called once per stream. Move these
> operations to dailink ops. The linked series is "ASoC: Add sdw stream
> operations to dailink ops".
Applied all, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/4] soundwire: Remove sdw stream operations from Intel
2020-09-03 20:47 [PATCH v2 0/4] soundwire: Remove sdw stream operations from Intel Bard Liao
` (4 preceding siblings ...)
2020-09-04 9:21 ` [PATCH v2 0/4] soundwire: Remove sdw stream operations from Intel Vinod Koul
@ 2020-09-08 12:44 ` Jaroslav Kysela
5 siblings, 0 replies; 7+ messages in thread
From: Jaroslav Kysela @ 2020-09-08 12:44 UTC (permalink / raw)
To: Bard Liao, alsa-devel, vkoul
Cc: pierre-louis.bossart, vinod.koul, tiwai, gregkh, linux-kernel,
ranjani.sridharan, hui.wang, broonie, srinivas.kandagatla, jank,
mengdong.lin, sanyog.r.kale, rander.wang, bard.liao
Dne 03. 09. 20 v 22:47 Bard Liao napsal(a):
> Sdw stream operation APIs can be called once per stream. Move these
> operations to dailink ops. The linked series is "ASoC: Add sdw stream
> operations to dailink ops".
>
> Pierre-Louis Bossart (4):
> soundwire: stream: fix NULL/IS_ERR confusion
> soundwire: intel: fix NULL/ERR_PTR confusion
> soundwire: intel: remove .trigger operation
> soundwire: intel: remove stream handling from .prepare and .hw_free
>
> drivers/soundwire/intel.c | 60 +++++---------------------------------
> drivers/soundwire/stream.c | 2 +-
> 2 files changed, 9 insertions(+), 53 deletions(-)
>
Straight patches. I tested them. For all:
Acked-by: Jaroslav Kysela <perex@perex.cz>
Note: The ASoC part must be merged in sync -
"[PATCH v3 0/3] ASoC: Add sdw stream operations to dailink ops."
Jaroslav
--
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-09-08 17:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-03 20:47 [PATCH v2 0/4] soundwire: Remove sdw stream operations from Intel Bard Liao
2020-09-03 20:47 ` [PATCH v2 1/4] soundwire: stream: fix NULL/IS_ERR confusion Bard Liao
2020-09-03 20:47 ` [PATCH v2 2/4] soundwire: intel: fix NULL/ERR_PTR confusion Bard Liao
2020-09-03 20:47 ` [PATCH v2 3/4] soundwire: intel: remove .trigger operation Bard Liao
2020-09-03 20:47 ` [PATCH v2 4/4] soundwire: intel: remove stream handling from .prepare and .hw_free Bard Liao
2020-09-04 9:21 ` [PATCH v2 0/4] soundwire: Remove sdw stream operations from Intel Vinod Koul
2020-09-08 12:44 ` Jaroslav Kysela
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).