From patchwork Fri May 20 09:51:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9129067 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E83B96048B for ; Fri, 20 May 2016 09:51:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAFBE1FF6C for ; Fri, 20 May 2016 09:51:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF31B2618C; Fri, 20 May 2016 09:51:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F2641FF6C for ; Fri, 20 May 2016 09:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754665AbcETJva (ORCPT ); Fri, 20 May 2016 05:51:30 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:6852 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754539AbcETJv3 (ORCPT ); Fri, 20 May 2016 05:51:29 -0400 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie1.idc.renesas.com with ESMTP; 20 May 2016 18:51:28 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 4C7D852C89; Fri, 20 May 2016 18:51:28 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 304E52806E; Fri, 20 May 2016 18:51:28 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 2A4BB2806D; Fri, 20 May 2016 18:51:28 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac2.idc.renesas.com with ESMTP id UAL18871; Fri, 20 May 2016 18:51:28 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="211272988" Received: from mail-hk2apc01lp0215.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.215]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 20 May 2016 18:51:27 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=yu9OPuctNM51iLSjXX863HN6BjdVg8/B/y1l5IhGfXg=; b=FK4mDn969MddscrniDstDo6e5lw0kT1RCM41BjDVON5FJDFi/LwUouHelIR3ST0QzKvlBG3QSosLYurVgafwJrFyAzkuQE4S9TW8PDreQBMCXAOokLYkJVvenslQceJpyQ02EMD55lEnG4AkWnrBSYCf10Zr12IF+tK4TK3zQGY= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by HK2PR06MB1697.apcprd06.prod.outlook.com (10.167.73.11) with Microsoft SMTP Server (TLS) id 15.1.497.12; Fri, 20 May 2016 09:51:26 +0000 Message-ID: <87r3cxqd03.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 21/49] ASoC: simple-card: use asoc_simple_card_parse_clk() User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown CC: Linux-ALSA , Liam Girdwood , Simon , In-Reply-To: <87lh35rs8w.wl%kuninori.morimoto.gx@renesas.com> References: <87lh35rs8w.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Fri, 20 May 2016 09:51:26 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS1PR01CA0044.jpnprd01.prod.outlook.com (10.164.162.26) To HK2PR06MB1697.apcprd06.prod.outlook.com (10.167.73.11) X-MS-Office365-Filtering-Correlation-Id: 1e9ca56d-a80e-46a5-e89f-08d380944f6e X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1697; 2:e9+1X+/KNalEs8gfWAcXeMpX0jxuzdbZCWz7dVoVM9OW8Qq1/xkQ5KJtnVWrzEI0Ri1t0Tw1TdZ3Ags69/6TCe3NtsM0/YPlSwHPHgKmgNHYLOr4AxPlHafBoNnJ6F+ZHtS4d+GWfVrftdaIEnfM8jHZqyPozK23XnzmQ1RpDat2QtpTdruDh/kYCyIJpEWS; 3:B7y482eu2AXpzHwwiWz1vK3iJa32t9ZtUWF97N1IAbZdZu2RYyhkyYLNIOYCXxIV/1Mho+V0rMGbqfvxUjS7hBZ/SxZSt/XkqOyCxJ3r5SGaXuV4Wq4QvPKK/77r9DB/; 25:sEbponsxx8vgAO/iysGFW4I5splUZPWi1IDAUz7b1dt772porxuYM2RXkkLPHVVOd9MD1X52uO2RezdS0y+tmEb7ya00H5ZKfr8puTxxXkt4zJyi+hGHu4FIUPhdDjA9JjRcCGi7QbTR8V1aVACVng1zJGlgv12aaSGNRkhtNAIkhzx7BKNnPW74aysci4zHiN7QtxKDDu8x7QeHXI3np8GsGrAkU9CsWE1ypqaVU2MqaoJlLvJVjal+QiUNFeXRWcdMZtT/3T2GAXqGphuxKZW+/04BbtKS6prPY199FwcMDPriHdKettsvkxQ4reJVx55x8gzSJJz6/UNChE//GRzEnfFeIrr3JWh9s1GWOP4ZCWcX/ls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X//qKQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:HK2PR06MB1697; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB1697; X-Forefront-PRVS: 09480768F8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(3846002)(23726003)(92566002)(6116002)(110136002)(42186005)(586003)(47776003)(19580405001)(19580395003)(2906002)(33646002)(5008740100001)(8676002)(36756003)(86362001)(81166006)(50466002)(229853001)(83506001)(4326007)(53416004)(189998001)(66066001)(5004730100002)(46406003)(2950100001)(76176999)(54356999)(50986999)(77096005)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB1697; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1697; 23:i5oXVFUq2/E1H9GDRKB9mPDmrQJD2BHEzqjKApI7zC+Hfa48bJHwfUNdAQlKzJHj7oSXLDjAjRdmW0EZJ2MPN8H4gTdcUrbKLg2zr36sQqpxroSvd01NAYuepV1NDHUWlbnGOjGVOmDGkUbQu0NpUC9n76UGIf0yRgzeszNOIemG3iA5c0Cu1QNTYyUQSjRsxDqnhaE9IN6PMtFFN8DCExyNmAJOUg9nbaWMx5S7r/zDUm0vZ4JGdZXCDDRhAJmYbq+EL37Vz+YoaESw11gDB12DqgmfYW9RhiVMptKbu72uNZUm4rNXVp8m/WCfSvC+puNlh7BTVfY+x3brs/s6YJIuLscf2l9TFhBuHgNwzCwt9CIJIE/IBCbQUBSl38tsXol2GM+DTKfP7EVuPRzOsf21TXtWb5t5E4jM9kNS99Co3OhG5UucoVUwEtDZxExvV3B/vEQfAOVnHf4EUqMyCWP9NxPd8XsT9Z/biMcj4g9vfLmCz7xI7mRZ4Q6DtiP5UOnoGDTZBoND+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ksAGv9lduohIQZPAzAPpDn4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2016 09:51:26.0086 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB1697 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-card.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index c67d94f..9b7f525 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -217,8 +217,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np, int *args_count) { struct of_phandle_args args; - struct clk *clk; - u32 val; int ret; if (!np) @@ -255,29 +253,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np, if (ret) return ret; - /* - * Parse dai->sysclk come from "clocks = <&xxx>" - * (if system has common clock) - * or "system-clock-frequency = " - * or device's module clock. - */ - if (of_property_read_bool(np, "clocks")) { - clk = of_clk_get(np, 0); - if (IS_ERR(clk)) { - ret = PTR_ERR(clk); - return ret; - } - - dai->sysclk = clk_get_rate(clk); - dai->clk = clk; - } else if (!of_property_read_u32(np, "system-clock-frequency", &val)) { - dai->sysclk = val; - } else { - clk = of_clk_get(args.np, 0); - if (!IS_ERR(clk)) - dai->sysclk = clk_get_rate(clk); - } - return 0; } @@ -289,6 +264,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, struct device *dev = simple_priv_to_dev(priv); struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx); struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx); + struct asoc_simple_dai *cpu_dai = &dai_props->cpu_dai; + struct asoc_simple_dai *codec_dai = &dai_props->codec_dai; struct device_node *cpu = NULL; struct device_node *plat = NULL; struct device_node *codec = NULL; @@ -344,6 +321,14 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, if (ret < 0) goto dai_link_of_err; + ret = asoc_simple_card_parse_clk_cpu(cpu, dai_link, cpu_dai); + if (ret < 0) + goto dai_link_of_err; + + ret = asoc_simple_card_parse_clk_codec(codec, dai_link, codec_dai); + if (ret < 0) + goto dai_link_of_err; + if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) { ret = -EINVAL; goto dai_link_of_err;