@@ -135,6 +135,11 @@ int asoc_simple_parse_daifmt(struct device *dev,
struct device_node *codec,
char *prefix,
unsigned int *retfmt);
+int asoc_simple_parse_link_direction(struct device *dev,
+ struct device_node *node,
+ char *prefix,
+ bool *is_playback_only,
+ bool *is_capture_only);
int asoc_simple_parse_tdm_width_map(struct device *dev, struct device_node *np,
struct asoc_simple_dai *dai);
@@ -115,6 +115,33 @@ int asoc_simple_parse_daifmt(struct device *dev,
}
EXPORT_SYMBOL_GPL(asoc_simple_parse_daifmt);
+int asoc_simple_parse_link_direction(struct device *dev, struct device_node *node, char *prefix,
+ bool *playback_only, bool *capture_only)
+{
+ bool is_playback_only = false;
+ bool is_capture_only = false;
+
+ if (!prefix)
+ prefix = "";
+
+ if (of_property_read_bool(node, "playback-only"))
+ is_playback_only = true;
+
+ if (of_property_read_bool(node, "capture-only"))
+ is_capture_only = true;
+
+ if (is_playback_only && is_capture_only) {
+ dev_err(dev, "Invalid configuration, both playback-only / capture-only are set\n");
+ return -EINVAL;
+ }
+
+ *playback_only = is_playback_only;
+ *capture_only = is_capture_only;
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_parse_link_direction);
+
int asoc_simple_parse_tdm_width_map(struct device *dev, struct device_node *np,
struct asoc_simple_dai *dai)
{
@@ -195,6 +195,7 @@ static int simple_link_init(struct asoc_simple_priv *priv,
{
struct device *dev = simple_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link);
+ bool is_playback_only, is_capture_only;
int ret;
ret = asoc_simple_parse_daifmt(dev, node, codec,
@@ -202,6 +203,15 @@ static int simple_link_init(struct asoc_simple_priv *priv,
if (ret < 0)
return 0;
+ ret = asoc_simple_parse_link_direction(dev, node, prefix,
+ &is_playback_only,
+ &is_capture_only);
+ if (ret < 0)
+ return 0;
+
+ dai_link->playback_only = is_playback_only;
+ dai_link->capture_only = is_capture_only;
+
dai_link->init = asoc_simple_dai_init;
dai_link->ops = &simple_ops;