From patchwork Mon Feb 15 14:11:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 8315711 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8C229C02AA for ; Mon, 15 Feb 2016 14:14:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B7346203A5 for ; Mon, 15 Feb 2016 14:14:25 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 7620F2039E for ; Mon, 15 Feb 2016 14:14:24 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 98F6D2651FD; Mon, 15 Feb 2016 15:14:23 +0100 (CET) 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, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E63A7265326; Mon, 15 Feb 2016 15:12:29 +0100 (CET) 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 4C736265326; Mon, 15 Feb 2016 15:12:28 +0100 (CET) Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by alsa0.perex.cz (Postfix) with ESMTP id 48203265091 for ; Mon, 15 Feb 2016 15:11:51 +0100 (CET) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id u1FEBogK006691; Mon, 15 Feb 2016 08:11:50 -0600 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 u1FEBo6R003697; Mon, 15 Feb 2016 08:11:50 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Mon, 15 Feb 2016 08:11:49 -0600 Received: from dflp33.itg.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u1FEBcma032690; Mon, 15 Feb 2016 08:11:48 -0600 From: Peter Ujfalusi To: Mark Brown , Liam Girdwood Date: Mon, 15 Feb 2016 16:11:35 +0200 Message-ID: <1455545495-20292-5-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1455545495-20292-1-git-send-email-peter.ujfalusi@ti.com> References: <1455545495-20292-1-git-send-email-peter.ujfalusi@ti.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Jyri Sarha Subject: [alsa-devel] [PATCH 4/4] ASoC: simple-card: Support for selecting system clocks by ID 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 From: Jyri Sarha Most CPU and codec drivers can select their system clock from different sources. They rely on snd_soc_dai_set_sysclk(x, sysclk_id, x, x) to do so. Add support for selecting which clock need to be selected along with the rate. Signed-off-by: Jyri Sarha Signed-off-by: Peter Ujfalusi --- Documentation/devicetree/bindings/sound/simple-card.txt | 2 ++ include/sound/simple_card.h | 1 + sound/soc/generic/simple-card.c | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index 1f2cf76d701a..bc8f9e4a17cc 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt @@ -85,6 +85,8 @@ Optional CPU/CODEC subnodes properties: clk_disable_unprepare() in dai shutdown(). - system-clock-direction : "in" or "out", default "in" +- system-clock-id : Numberic ID of the system clock to + select within the dai, default is 0. Example 1 - single DAI link: diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h index 783bc5499794..f930ad3763ff 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 sysclk; int sysclk_dir; + int sysclk_id; int slots; int slot_width; unsigned int tx_slot_mask; diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index f0d89e6f28a6..c6111e7a6d93 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -142,7 +142,7 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, int ret; if (set->sysclk) { - ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, + ret = snd_soc_dai_set_sysclk(dai, set->sysclk_id, set->sysclk, set->sysclk_dir); if (ret && ret != -ENOTSUPP) { dev_err(dai->dev, "simple-card: set_sysclk error\n"); @@ -284,6 +284,9 @@ asoc_simple_card_sub_parse_of(struct device_node *np, dai->sysclk = clk_get_rate(clk); } + if (!of_property_read_u32(np, "system-clock-id", &val)) + dai->sysclk_id = val; + return 0; }