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: 4348121 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D9BB5BEEAA for ; Fri, 13 Jun 2014 10:04:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ECE832022A for ; Fri, 13 Jun 2014 10:04:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F40E820254 for ; Fri, 13 Jun 2014 10:04:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751458AbaFMKEx (ORCPT ); Fri, 13 Jun 2014 06:04:53 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:38038 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752497AbaFMKEu (ORCPT ); Fri, 13 Jun 2014 06:04:50 -0400 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: , , CC: , , , , , Jyri Sarha Subject: [PATCH 2/3] ASoC: simple-card: Add system-clock-direction DT parameter to dai nodes 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 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.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)