]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ASoC: Add SoundWire stream programming interface
authorShreyas NC <shreyas.nc@intel.com>
Thu, 26 Apr 2018 13:08:38 +0000 (18:38 +0530)
committerVinod Koul <vkoul@kernel.org>
Fri, 11 May 2018 16:17:19 +0000 (21:47 +0530)
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>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
include/sound/soc-dai.h

index 8ad11669e4d8f346ae3e654587386af88d08281e..3ddb575eed54aa71e6f1ed3c4b19ce4b5e2ef1a1 100644 (file)
@@ -170,6 +170,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.
@@ -358,4 +360,25 @@ 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 maps to source ports and Capture for sink ports.
+ *
+ * This should be invoked with NULL to clear the stream set previously.
+ * 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