From patchwork Fri Jun 13 10:04:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 4348141 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 60A809F314 for ; Fri, 13 Jun 2014 10:06:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A33B201D5 for ; Fri, 13 Jun 2014 10:06:09 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id EF89E20158 for ; Fri, 13 Jun 2014 10:06:07 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 16BE4265057; Fri, 13 Jun 2014 12:06:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id EE4C02625ED; Fri, 13 Jun 2014 12:04:59 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E5768261B2D; Fri, 13 Jun 2014 12:04:58 +0200 (CEST) Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by alsa0.perex.cz (Postfix) with ESMTP id 240E5261A50 for ; Fri, 13 Jun 2014 12:04:46 +0200 (CEST) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5DA4jtg013024; Fri, 13 Jun 2014 05:04:45 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5DA4jDs005988; Fri, 13 Jun 2014 05:04:45 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Fri, 13 Jun 2014 05:04:44 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5DA4ia9032295; Fri, 13 Jun 2014 05:04:44 -0500 From: Jyri Sarha To: , , Date: Fri, 13 Jun 2014 13:04:37 +0300 Message-ID: <0f714f64a67f9d52aaef8fdaeb279b9e499cf82a.1402653217.git.jsarha@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Cc: liam.r.girdwood@linux.intel.com, detheridge@ti.com, Jyri Sarha , peter.ujfalusi@ti.com, broonie@kernel.org, bcousson@baylibre.com Subject: [alsa-devel] [PATCH 2/3] ASoC: simple-card: Add system-clock-direction DT parameter to dai nodes X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Select dir parameters for set_sysclk calls in the card init phase. Signed-off-by: Jyri Sarha --- .../devicetree/bindings/sound/simple-card.txt | 1 + include/sound/simple_card.h | 1 + sound/soc/generic/simple-card.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index c2e9841..8460744 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt @@ -71,6 +71,7 @@ Optional CPU/CODEC subnodes properties: it can be specified via "clocks" if system has clock node (= common clock), or "system-clock-frequency" (if system doens't support common clock) +- system-clock-direction : "in" or "out", default "in" Example 1 - single DAI link: diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h index 9b0ac77..6d74fef 100644 --- a/include/sound/simple_card.h +++ b/include/sound/simple_card.h @@ -18,6 +18,7 @@ struct asoc_simple_dai { const char *name; unsigned int fmt; unsigned int sysclk; + int sysclk_dir; int slots; int slot_width; }; diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 159e517f..8dd7957 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -64,7 +64,8 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, } if (set->sysclk) { - ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0); + ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, + set->sysclk_dir); if (ret && ret != -ENOTSUPP) { dev_err(dai->dev, "simple-card: set_sysclk error\n"); goto err; @@ -116,6 +117,7 @@ asoc_simple_card_sub_parse_of(struct device_node *np, { struct device_node *node; struct clk *clk; + const char *str; u32 val; int ret; @@ -138,6 +140,16 @@ asoc_simple_card_sub_parse_of(struct device_node *np, if (ret) return ret; + ret = of_property_read_string(np, "system-clock-direction", &str); + if (ret == 0) { + if (!strcmp(str, "out")) + dai->sysclk_dir = SND_SOC_CLOCK_OUT; + else if (!strcmp(str, "in")) + dai->sysclk_dir = SND_SOC_CLOCK_IN; + else + return -EINVAL; + } + /* * dai->sysclk come from * "clocks = <&xxx>" (if system has common clock)