OSDN Git Service

ASoC: core: add support to snd_soc_dai_get_channel_map()
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Mon, 23 Jul 2018 15:54:03 +0000 (16:54 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 24 Jul 2018 11:06:43 +0000 (12:06 +0100)
On Qualcomm platforms, specifically with SLIMbus interfaced codecs,
the codec slim channel numbers are passed to DSP while configuring
the slim audio path. Having get_channel_map() would allow dais to
share such information across multiple dais.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc-dai.h
sound/soc/soc-core.c

index a14bc06..f5d7004 100644 (file)
@@ -138,6 +138,11 @@ int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
 int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute,
                             int direction);
 
+
+int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai,
+               unsigned int *tx_num, unsigned int *tx_slot,
+               unsigned int *rx_num, unsigned int *rx_slot);
+
 int snd_soc_dai_is_dummy(struct snd_soc_dai *dai);
 
 struct snd_soc_dai_ops {
@@ -165,6 +170,9 @@ struct snd_soc_dai_ops {
        int (*set_channel_map)(struct snd_soc_dai *dai,
                unsigned int tx_num, unsigned int *tx_slot,
                unsigned int rx_num, unsigned int *rx_slot);
+       int (*get_channel_map)(struct snd_soc_dai *dai,
+                       unsigned int *tx_num, unsigned int *tx_slot,
+                       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,
index ad5b0ef..81b2792 100644 (file)
@@ -2680,6 +2680,28 @@ int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai,
 EXPORT_SYMBOL_GPL(snd_soc_dai_set_channel_map);
 
 /**
+ * snd_soc_dai_get_channel_map - Get DAI audio channel map
+ * @dai: DAI
+ * @tx_num: how many TX channels
+ * @tx_slot: pointer to an array which imply the TX slot number channel
+ *           0~num-1 uses
+ * @rx_num: how many RX channels
+ * @rx_slot: pointer to an array which imply the RX slot number channel
+ *           0~num-1 uses
+ */
+int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai,
+       unsigned int *tx_num, unsigned int *tx_slot,
+       unsigned int *rx_num, unsigned int *rx_slot)
+{
+       if (dai->driver->ops->get_channel_map)
+               return dai->driver->ops->get_channel_map(dai, tx_num, tx_slot,
+                       rx_num, rx_slot);
+       else
+               return -ENOTSUPP;
+}
+EXPORT_SYMBOL_GPL(snd_soc_dai_get_channel_map);
+
+/**
  * snd_soc_dai_set_tristate - configure DAI system or master clock.
  * @dai: DAI
  * @tristate: tristate enable