diff mbox

[v2,08/13] ASoC: Add SoundWire stream programming interface

Message ID 1522946904-2089-9-git-send-email-vinod.koul@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vinod Koul April 5, 2018, 4:48 p.m. UTC
From: Shreyas NC <shreyas.nc@intel.com>

SoundWire stream needs to be propagated to all the DAIs(cpu, codec).
So, add a snd_soc_dai_set_sdw_stream() API for the same.

Signed-off-by: Shreyas NC <shreyas.nc@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 include/sound/soc-dai.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Pierre-Louis Bossart April 5, 2018, 11:42 p.m. UTC | #1
On 4/5/18 11:48 AM, Vinod Koul wrote:
> From: Shreyas NC <shreyas.nc@intel.com>
> 
> SoundWire stream needs to be propagated to all the DAIs(cpu, codec).
> So, add a snd_soc_dai_set_sdw_stream() API for the same.
> 
> Signed-off-by: Shreyas NC <shreyas.nc@intel.com>
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> ---
>   include/sound/soc-dai.h | 21 +++++++++++++++++++++
>   1 file changed, 21 insertions(+)
> 
> diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
> index 58acd00cae19..405c4c304f87 100644
> --- a/include/sound/soc-dai.h
> +++ b/include/sound/soc-dai.h
> @@ -168,6 +168,8 @@ struct snd_soc_dai_ops {
>   		unsigned int rx_num, unsigned int *rx_slot);
>   	int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
>   
> +	int (*set_sdw_stream)(struct snd_soc_dai *dai,
> +			void *stream, int direction);
>   	/*
>   	 * DAI digital mute - optional.
>   	 * Called by soc-core to minimise any pops.
> @@ -359,4 +361,23 @@ static inline void *snd_soc_dai_get_drvdata(struct snd_soc_dai *dai)
>   	return dev_get_drvdata(dai->dev);
>   }
>   
> +/**
> + * snd_soc_dai_set_sdw_stream() - Configures a DAI for SDW stream operation
> + * @dai: DAI
> + * @stream: STREAM
> + * @direction: Stream direction(Playback/Capture)
> + * SoundWire subsystem doesn't have a notion of direction and we reuse
> + * the ASoC stream direction to configure sink/source ports.

Playback == source, Capture == sink?
what is the mapping convention?

> + *
> + * Returns 0 on success, a negative error code otherwise.
> + */
> +static inline int snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai,
> +				void *stream, int direction)
> +{
> +	if (dai->driver->ops->set_sdw_stream)
> +		return dai->driver->ops->set_sdw_stream(dai, stream, direction);
> +	else
> +		return -ENOTSUPP;
> +}
> +
>   #endif
>
Vinod Koul April 6, 2018, 8:49 a.m. UTC | #2
On Thu, Apr 05, 2018 at 06:42:53PM -0500, Pierre-Louis Bossart wrote:
> >+/**
> >+ * snd_soc_dai_set_sdw_stream() - Configures a DAI for SDW stream operation
> >+ * @dai: DAI
> >+ * @stream: STREAM
> >+ * @direction: Stream direction(Playback/Capture)
> >+ * SoundWire subsystem doesn't have a notion of direction and we reuse
> >+ * the ASoC stream direction to configure sink/source ports.
> 
> Playback == source, Capture == sink?
> what is the mapping convention?

oops, will fix
diff mbox

Patch

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 58acd00cae19..405c4c304f87 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -168,6 +168,8 @@  struct snd_soc_dai_ops {
 		unsigned int rx_num, unsigned int *rx_slot);
 	int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
 
+	int (*set_sdw_stream)(struct snd_soc_dai *dai,
+			void *stream, int direction);
 	/*
 	 * DAI digital mute - optional.
 	 * Called by soc-core to minimise any pops.
@@ -359,4 +361,23 @@  static inline void *snd_soc_dai_get_drvdata(struct snd_soc_dai *dai)
 	return dev_get_drvdata(dai->dev);
 }
 
+/**
+ * snd_soc_dai_set_sdw_stream() - Configures a DAI for SDW stream operation
+ * @dai: DAI
+ * @stream: STREAM
+ * @direction: Stream direction(Playback/Capture)
+ * SoundWire subsystem doesn't have a notion of direction and we reuse
+ * the ASoC stream direction to configure sink/source ports.
+ *
+ * Returns 0 on success, a negative error code otherwise.
+ */
+static inline int snd_soc_dai_set_sdw_stream(struct snd_soc_dai *dai,
+				void *stream, int direction)
+{
+	if (dai->driver->ops->set_sdw_stream)
+		return dai->driver->ops->set_sdw_stream(dai, stream, direction);
+	else
+		return -ENOTSUPP;
+}
+
 #endif