2022-06-10 02:58:22

by Bard Liao

[permalink] [raw]
Subject: [PATCH 0/2] soundwire: Intel: add trigger callback

The .trigger callback will be used in ASoC.
Hi Vinod, Could you provied a tag so that Mark can take the tag to
his tree?

Bard Liao (1):
soundwire: Intel: add trigger callback

Pierre-Louis Bossart (1):
soundwire: intel: uniquify debug message

drivers/soundwire/intel.c | 36 ++++++++++++++++++-----------
include/linux/soundwire/sdw_intel.h | 1 +
2 files changed, 23 insertions(+), 14 deletions(-)

--
2.17.1


2022-06-10 03:26:39

by Bard Liao

[permalink] [raw]
Subject: [PATCH 2/2] soundwire: Intel: add trigger callback

When a pipeline is split into FE and BE parts, the BE pipeline may need to
be triggered separately in the BE trigger op. So add the trigger callback
in the link_res ops that will be invoked during BE DAI trigger.

Signed-off-by: Bard Liao <[email protected]>
Reviewed-by: Rander Wang <[email protected]>
Reviewed-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
---
drivers/soundwire/intel.c | 8 ++++++++
include/linux/soundwire/sdw_intel.h | 1 +
2 files changed, 9 insertions(+)

diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index 808e2f320052..3f3c2c99cb8e 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -1004,9 +1004,17 @@ static int intel_trigger(struct snd_pcm_substream *substream, int cmd, struct sn
{
struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
struct sdw_intel *sdw = cdns_to_intel(cdns);
+ struct sdw_intel_link_res *res = sdw->link_res;
struct sdw_cdns_dma_data *dma;
int ret = 0;

+ /* The .trigger callback is used to send required IPC to audio
+ * firmware. The .free_stream callback will still be called
+ * by intel_free_stream() in the TRIGGER_SUSPEND case.
+ */
+ if (res->ops && res->ops->trigger)
+ res->ops->trigger(dai, cmd, substream->stream);
+
dma = snd_soc_dai_get_dma_data(dai, substream);
if (!dma) {
dev_err(dai->dev, "failed to get dma data in %s\n",
diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h
index 67e0d3e750b5..f638707fd712 100644
--- a/include/linux/soundwire/sdw_intel.h
+++ b/include/linux/soundwire/sdw_intel.h
@@ -119,6 +119,7 @@ struct sdw_intel_ops {
struct sdw_intel_stream_params_data *params_data);
int (*free_stream)(struct device *dev,
struct sdw_intel_stream_free_data *free_data);
+ int (*trigger)(struct snd_soc_dai *dai, int cmd, int stream);
};

/**
--
2.17.1

2022-06-10 05:49:22

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 2/2] soundwire: Intel: add trigger callback

On Fri, Jun 10, 2022 at 10:35:37AM +0800, Bard Liao wrote:
> When a pipeline is split into FE and BE parts, the BE pipeline may need to
> be triggered separately in the BE trigger op. So add the trigger callback
> in the link_res ops that will be invoked during BE DAI trigger.
>
> Signed-off-by: Bard Liao <[email protected]>
> Reviewed-by: Rander Wang <[email protected]>
> Reviewed-by: Pierre-Louis Bossart <[email protected]>
> Reviewed-by: Ranjani Sridharan <[email protected]>
> ---
> drivers/soundwire/intel.c | 8 ++++++++
> include/linux/soundwire/sdw_intel.h | 1 +
> 2 files changed, 9 insertions(+)
>
> diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
> index 808e2f320052..3f3c2c99cb8e 100644
> --- a/drivers/soundwire/intel.c
> +++ b/drivers/soundwire/intel.c
> @@ -1004,9 +1004,17 @@ static int intel_trigger(struct snd_pcm_substream *substream, int cmd, struct sn
> {
> struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
> struct sdw_intel *sdw = cdns_to_intel(cdns);
> + struct sdw_intel_link_res *res = sdw->link_res;
> struct sdw_cdns_dma_data *dma;
> int ret = 0;
>
> + /* The .trigger callback is used to send required IPC to audio
> + * firmware. The .free_stream callback will still be called
> + * by intel_free_stream() in the TRIGGER_SUSPEND case.
> + */
> + if (res->ops && res->ops->trigger)
> + res->ops->trigger(dai, cmd, substream->stream);
> +
> dma = snd_soc_dai_get_dma_data(dai, substream);
> if (!dma) {
> dev_err(dai->dev, "failed to get dma data in %s\n",
> diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h
> index 67e0d3e750b5..f638707fd712 100644
> --- a/include/linux/soundwire/sdw_intel.h
> +++ b/include/linux/soundwire/sdw_intel.h
> @@ -119,6 +119,7 @@ struct sdw_intel_ops {
> struct sdw_intel_stream_params_data *params_data);
> int (*free_stream)(struct device *dev,
> struct sdw_intel_stream_free_data *free_data);
> + int (*trigger)(struct snd_soc_dai *dai, int cmd, int stream);
> };
>
> /**
> --
> 2.17.1
>

Where is the in-kernel user of this new callback? Without that, there
is no need for this, NOR is there a way to properly review this commit.

sorry,

greg k-h

2022-06-10 17:04:16

by Pierre-Louis Bossart

[permalink] [raw]
Subject: Re: [PATCH 2/2] soundwire: Intel: add trigger callback


> Where is the in-kernel user of this new callback? Without that, there
> is no need for this, NOR is there a way to properly review this commit.
>
> sorry,

ASoC/SOF will be the user, this is a dependency before Mark Brown can
take additional code in his tree. It was spelled out in the cover letter.

To be clearer, the ONLY user of all the soundwire:intel code is
precisely the ASoC/SOF driver.

2022-06-14 08:08:57

by Liao, Bard

[permalink] [raw]
Subject: RE: [PATCH 2/2] soundwire: Intel: add trigger callback

> -----Original Message-----
> From: Pierre-Louis Bossart <[email protected]>
> Sent: Friday, June 10, 2022 10:54 PM
> To: Greg KH <[email protected]>; Bard Liao <yung-
> [email protected]>
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; Kale, Sanyog R <[email protected]>;
> Liao, Bard <[email protected]>
> Subject: Re: [PATCH 2/2] soundwire: Intel: add trigger callback
>
>
> > Where is the in-kernel user of this new callback? Without that, there
> > is no need for this, NOR is there a way to properly review this commit.
> >
> > sorry,
>
> ASoC/SOF will be the user, this is a dependency before Mark Brown can
> take additional code in his tree. It was spelled out in the cover letter.
>
> To be clearer, the ONLY user of all the soundwire:intel code is
> precisely the ASoC/SOF driver.

I resent the patch with the patch that uses the callback. ????