Merge remote-tracking branches 'asoc/topic/simple', 'asoc/topic/spear', 'asoc/topic...
[sfrench/cifs-2.6.git] / sound / soc / generic / simple-card-utils.c
index 0442099157e60a1f62a59305f94239b99207584a..3751a07de6aac1c6bab6e670abd9c91832fd7f51 100644 (file)
@@ -196,7 +196,11 @@ int asoc_simple_card_parse_clk(struct device *dev,
                        simple_dai->sysclk = clk_get_rate(clk);
        }
 
-       dev_dbg(dev, "%s : sysclk = %d\n", name, simple_dai->sysclk);
+       if (of_property_read_bool(node, "system-clock-direction-out"))
+               simple_dai->clk_direction = SND_SOC_CLOCK_OUT;
+
+       dev_dbg(dev, "%s : sysclk = %d, direction %d\n", name,
+               simple_dai->sysclk, simple_dai->clk_direction);
 
        return 0;
 }
@@ -263,6 +267,9 @@ static int asoc_simple_card_get_dai_id(struct device_node *ep)
                        id = i;
                i++;
        }
+
+       of_node_put(node);
+
        if (id < 0)
                return -ENODEV;
 
@@ -282,11 +289,6 @@ int asoc_simple_card_parse_graph_dai(struct device_node *ep,
        if (!dai_name)
                return 0;
 
-       /*
-        * of_graph_get_port_parent() will call
-        * of_node_put(). So, call of_node_get() here
-        */
-       of_node_get(ep);
        node = of_graph_get_port_parent(ep);
 
        /* Get dai->name */
@@ -310,7 +312,8 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
        int ret;
 
        if (simple_dai->sysclk) {
-               ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk, 0);
+               ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk,
+                                            simple_dai->clk_direction);
                if (ret && ret != -ENOTSUPP) {
                        dev_err(dai->dev, "simple-card: set_sysclk error\n");
                        return ret;