From patchwork Tue Jul 19 02:53:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9235839 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 69C71600CB for ; Tue, 19 Jul 2016 02:53:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60172205AD for ; Tue, 19 Jul 2016 02:53:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54C71265F9; Tue, 19 Jul 2016 02:53:58 +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 CDDB2205AD for ; Tue, 19 Jul 2016 02:53:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752309AbcGSCx5 (ORCPT ); Mon, 18 Jul 2016 22:53:57 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:21514 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752305AbcGSCx4 (ORCPT ); Mon, 18 Jul 2016 22:53:56 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 19 Jul 2016 11:53:55 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 1A9764A87D; Tue, 19 Jul 2016 11:53:55 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id E9C108002E; Tue, 19 Jul 2016 11:53:54 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id E2B738002D; Tue, 19 Jul 2016 11:53:54 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac1.idc.renesas.com with ESMTP id MBB31091; Tue, 19 Jul 2016 11:53:54 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="215372695" Received: from mail-pu1apc01lp0017.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.17]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 19 Jul 2016 11:53:54 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=WAoLlrU2F0U1OwKGCbLINkHCLF1xpVslkP9jv/nc0lY=; b=lElBUFu31J0IZFqt/FAsi6tmmlX7RHDpOXwhH6SlyaFO11cwnuCVLdaGMvNKPqTY9/s11Jun67Ios6IwpXHV2dddRgYckP2MZCFWqMmxVQ3x5ECw9yFzqJKDoEAQcTovtaP5EzH5Bq+C4sDg65i7REtXLE7+W+0mc8jtBTzrL5M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by PS1PR0601MB1452.apcprd06.prod.outlook.com (10.165.210.156) with Microsoft SMTP Server (TLS) id 15.1.539.14; Tue, 19 Jul 2016 02:53:52 +0000 Message-ID: <87inw2mjjz.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 3/7] ASoC: rsrc-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: <87oa5umjoe.wl%kuninori.morimoto.gx@renesas.com> References: <87oa5umjoe.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Tue, 19 Jul 2016 02:53:52 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: KAWPR01CA0033.jpnprd01.prod.outlook.com (10.165.48.143) To PS1PR0601MB1452.apcprd06.prod.outlook.com (10.165.210.156) X-MS-Office365-Filtering-Correlation-Id: b6495b84-5351-46fa-d895-08d3af7feb18 X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1452; 2:ws9EAnIoRFEF+8tBuEiP8YsP4unKKekEKYTy1oMBbrQpIp4H4EbrmD1OBmxbXueVD2gURZutWUIWSsnv6GkUjFLUt9cTYV54HSLkhkF+uq3KHcC/+sC05YnteUUP+DMe0JjMxRh0/xydlAgQh6fBpeXNTZMIIdT+GPCV7ZC/oK4hYpGjjAfjMqz2BXFMbEiZ; 3:BbPlqh10xbsiPaLJXM5jBmsBdv5Vru2k74XCUpnUl8bG+pqjns7dM4EW5xkf454ab90L0WEDivOGyIoIXYsfUyY8CNOQpng50/TUgEvrF9Yj/W1PPTv/sSCi4a/qHf5D X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:PS1PR0601MB1452; X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1452; 25:p5yHJA1Q6lPl8lcwZ0/s91MEgXzt8K50lb+1M7qMKaWLcjw+zgvD7sFSWXV0OM9lUBu4XOTulCpVUTZa4zDgHW2ID96fwJH16sKGrft9FnfcLQBIG+sR1bm/8k0BidpDsUPZk2Nqa7UTDMlTZRZ8p6EDApu/PbqwgZDuPuQhmXP0/1TUYdOMkqmATi3raisUFqTXgENA+oyc4xkR6nbMqMK1bTk5dxQB6frQO8xWz6TbRrELgmoh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nljHRwrUTMVDehHRwXI0HIkoPxKbbyfrZOHABajswRxgyeBQAG4wrPRwIkDI/rBBoIqgarkD7z06ZIFhQVyUj3QWeIhuykM61H3HNejs4pRw5uZ3svFDUfUlTlIx500OUqJM0csYE6P2sKLziCLNa6GgL8mJwteHwdx3+8NLHL2uj/yEdSLhPQa5a9F1+8Zk; 4:sRZP265lw478/lJdSorb2U6ZtlSUYqrc7JUCbwJ3qSM25atHVn/uHdEJ2W+bfPhYU4bevFFOoqwmnuiPzOLpk2DyxUv45FeugkwdxDEgSO23kVO5yOUhVEDQ+edug17+zhU283HY0NcjMEU8nRZJf6cysadM41GzYilqbrxoW+d9FzqKHLiQo/QMzDXaA75Y7Gckf4AZgR2Tfvo2LkLgCaIJnvdXfzbMKogo3EQJJEvGRl1TjU4GAp13c3qjbpM40t26aWw6i5LAMn1PUY52AsGdbM1RzZy5zbIq5Ga7J14ywKkuI6YoY/Gk6+ryUsw0okUScP9CwsjGHunPQ33+GqSitk3eeWkEQpbn56XREj42ap2fe+6ty6uQATuBF2K4ujBuXIM96qdhKadZO/45+A== 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)(10201501046)(3002001)(6055026); SRVR:PS1PR0601MB1452; BCL:0; PCL:0; RULEID:; SRVR:PS1PR0601MB1452; X-Forefront-PRVS: 000800954F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(101416001)(54356999)(76176999)(42186005)(23726003)(33646002)(2906002)(229853001)(81156014)(68736007)(7846002)(2950100001)(53416004)(586003)(305945005)(106356001)(4001350100001)(66066001)(47776003)(69596002)(8676002)(83506001)(7736002)(3846002)(19580395003)(4326007)(46406003)(6116002)(19580405001)(92566002)(50466002)(110136002)(36756003)(77096005)(189998001)(81166006)(105586002)(50986999)(86362001)(97736004)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR0601MB1452; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; PS1PR0601MB1452; 23:MBlflW9BbBA7xk7ggQqqypS9IHbXLo8/PJ6Ew7Z?= =?us-ascii?Q?R0jFIz1geHQ1jxVibvI06QuPiadPUo1AfYTPEN22ap10fQsWT36LnNvioqKh?= =?us-ascii?Q?TCiGuBAtnkRgXlT0O8L0P8V6BV637Ohx9AyDslKqdVwiDpr7ke5GNYOEH4Yi?= =?us-ascii?Q?NIWXjeDm/dGIavOT420g8t0rn48S1mZD+1d7Xl5D04t2IjSCEfyX3IZcvx4f?= =?us-ascii?Q?mHSCXDA8Egqoczwn+N6sInrXNBPm6luQLaCETRPiMg23P625Yf+gSrUlZkGP?= =?us-ascii?Q?P8DMNiLtl5NROhKRb8kIWB+li0o+pD79huEfxxNuxDIRThjk8LMEmaW2pDEz?= =?us-ascii?Q?/gleT+KidJKsjEEHNt1GWaliiJPRhff4HhTHiisuwKSsyRpyvrLEZ0/7ZWmg?= =?us-ascii?Q?EiZBs8RNcU3U4otCzSPK+u3PtYKIRbW9XCL9wK/IyP9DJCbNYHEMB4DxQm+9?= =?us-ascii?Q?mp24yl9/W8U/X9i6zLD/rXG0LTwVlZEoah8k/2st0Cj5HetObsqIePuatjjb?= =?us-ascii?Q?noxzVd14984NoQoHgsfA8nUYo/2Ku/KJnmPVNCg5QXZgncFcNkwja4Av885j?= =?us-ascii?Q?WpORfXWVUHM8ysJv2/QC5xk0+BYhavAdcDHgTFHNGd+3rxSNuXlxLgtLRRdF?= =?us-ascii?Q?4/S4xQyhAslUqEct95Zp+CtkWbyFdh3XvSQLUc+wAFLNQHR/4Tlm0sjWuETI?= =?us-ascii?Q?/RKa0UoGUtewJwrsRmDe3xHZGexcmq04hWlWNMHbLzhbgSEJAZvjxg9I/Dgi?= =?us-ascii?Q?hs7hXm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8oo4jvGmJ3kcQs1fRql5/CFDQM3Z/bsqz+dxiAWA4wlMn125lUWMxFZO0kEcKkQpDA//FDyvlRxtOA7WZaoziT1Ixhig=; 7:Z57IaAnd0KDCkowlWHwCDjvOXx/fEkxJ1iX4cfkuSWS/VFyWCKpDX+tnOWMY0oDl9iG5wPrVh/fzc20mZatXPsufgAgydtD88syLmGZDrTjPNMDjURwwrsFgCsOrz743Y0GslVC5bAv3P35Bzcx11jZ0itJJuixMMaehld2HPUGZhkqmLw8+sY/x7iCsdk43AlBxaIZeIAXPUnfCXFnIUf11gD/51Tz7dlCZ/qqnmrp1JnTiCtPSddBGLtDcYWLl SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1452; 20:kMVt/7pMwtF2qtmcOJIBg+cBrO3Ds7IGpitSPdfwaDYmFBjSTqFSnYzjMOZp3wIQXRClUPu0WUgZDGKcVo/gJQfLelr0mzNDIEK1+7YU9qM9cqBO207i9NxaiGdzTUjafKt4I8Y/GIw7Ft3X/8/NE4TeHBk7M5eBzaV+WoTePk0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2016 02:53:52.5439 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR0601MB1452 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/sh/rcar/rsrc-card.c | 68 +++++++------------------------------------ 1 file changed, 10 insertions(+), 58 deletions(-) diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index fa37f84..ed5391f 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -190,6 +190,10 @@ static int rsrc_card_parse_links(struct device_node *np, if (ret < 0) return ret; + ret = asoc_simple_card_parse_clk_cpu(np, dai_link, dai_props); + if (ret < 0) + return ret; + ret = asoc_simple_card_set_dailink_name(dev, dai_link, "fe.%s", dai_link->cpu_dai_name); @@ -225,6 +229,10 @@ static int rsrc_card_parse_links(struct device_node *np, if (ret < 0) return ret; + ret = asoc_simple_card_parse_clk_codec(np, dai_link, dai_props); + if (ret < 0) + return ret; + ret = asoc_simple_card_set_dailink_name(dev, dai_link, "be.%s", dai_link->codec_dai_name); @@ -250,68 +258,12 @@ static int rsrc_card_parse_links(struct device_node *np, dai_link->ops = &rsrc_card_ops; dai_link->init = rsrc_card_dai_init; - return 0; -} - -static int rsrc_card_parse_clk(struct device_node *np, - struct rsrc_card_priv *priv, - int idx, bool is_fe) -{ - struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx); - struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx); - struct clk *clk; - struct device_node *of_np = is_fe ? dai_link->cpu_of_node : - dai_link->codec_of_node; - u32 val; - - /* - * 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)) - return PTR_ERR(clk); - - dai_props->sysclk = clk_get_rate(clk); - dai_props->clk = clk; - } else if (!of_property_read_u32(np, "system-clock-frequency", &val)) { - dai_props->sysclk = val; - } else { - clk = of_clk_get(of_np, 0); - if (!IS_ERR(clk)) - dai_props->sysclk = clk_get_rate(clk); - } - - return 0; -} - -static int rsrc_card_dai_sub_link_of(struct device_node *node, - struct device_node *np, - struct rsrc_card_priv *priv, - int idx, bool is_fe) -{ - struct device *dev = rsrc_priv_to_dev(priv); - struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx); - struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx); - int ret; - - ret = rsrc_card_parse_links(np, priv, idx, is_fe); - if (ret < 0) - return ret; - - ret = rsrc_card_parse_clk(np, priv, idx, is_fe); - if (ret < 0) - return ret; - dev_dbg(dev, "\t%s / %04x / %d\n", dai_link->name, dai_link->dai_fmt, dai_props->sysclk); - return ret; + return 0; } static int rsrc_card_dai_link_of(struct device_node *node, @@ -348,7 +300,7 @@ static int rsrc_card_dai_link_of(struct device_node *node, if (strcmp(np->name, "cpu") == 0) is_fe = true; - ret = rsrc_card_dai_sub_link_of(node, np, priv, i, is_fe); + ret = rsrc_card_parse_links(np, priv, i, is_fe); if (ret < 0) return ret; i++;