@@ -140,6 +140,10 @@
#define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1
#define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2
+/* DAI mclk_direction */
+#define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */
+#define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */
+
/* DAI physical PCM data formats.
* Add new formats to the end of the list.
*/
@@ -330,7 +334,7 @@ struct snd_soc_tplg_hw_config {
__u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */
__u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */
__u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */
- __u8 mclk_direction; /* 0 for input, 1 for output */
+ __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */
__le16 reserved; /* for 32bit alignment */
__le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */
__le32 bclk_rate; /* BCLK freqency in Hz */
@@ -1002,7 +1002,7 @@ struct snd_tplg_hw_config_template {
unsigned char invert_fsync; /* 1 for inverted frame clock, 0 for normal */
unsigned char bclk_master; /* SND_SOC_TPLG_BCLK_ value */
unsigned char fsync_master; /* SND_SOC_TPLG_FSYNC_ value */
- unsigned char mclk_direction; /* 0 for input, 1 for output */
+ unsigned char mclk_direction; /* SND_SOC_TPLG_MCLK_ value */
unsigned short reserved; /* for 32bit alignment */
unsigned int mclk_rate; /* MCLK or SYSCLK freqency in Hz */
unsigned int bclk_rate; /* BCLK freqency in Hz */
@@ -1223,8 +1223,19 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
if (snd_config_get_string(n, &val) < 0)
return -EINVAL;
- if (!strcmp(val, "master"))
- hw_cfg->mclk_direction = true;
+ if (!strcmp(val, "master")) {
+ /* For backwards capability,
+ * "master" == "for codec, mclk is input"
+ */
+ SNDERR("warning: deprecated mclk value '%s'\n",
+ val);
+
+ hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CI;
+ } else if (!strcmp(val, "codec_mclk_in")) {
+ hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CI;
+ } else if (!strcmp(val, "codec_mclk_out")) {
+ hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CO;
+ }
continue;
}