From patchwork Tue Jul 19 02:53:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9235837 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 06A8C600CB for ; Tue, 19 Jul 2016 02:53:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F063A26490 for ; Tue, 19 Jul 2016 02:53:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E53D626B41; Tue, 19 Jul 2016 02:53:38 +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 4358B26490 for ; Tue, 19 Jul 2016 02:53:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752309AbcGSCxi (ORCPT ); Mon, 18 Jul 2016 22:53:38 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:13623 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752305AbcGSCxh (ORCPT ); Mon, 18 Jul 2016 22:53:37 -0400 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie1.idc.renesas.com with ESMTP; 19 Jul 2016 11:53:34 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id F308C4C912; Tue, 19 Jul 2016 11:53:34 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id D6D678002E; Tue, 19 Jul 2016 11:53:34 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id D0F288002D; Tue, 19 Jul 2016 11:53:34 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac1.idc.renesas.com with ESMTP id MAC31091; Tue, 19 Jul 2016 11:53:34 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="215372673" Received: from mail-pu1apc01lp0016.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.16]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 19 Jul 2016 11:53:34 +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=MbFdho/lMOl/CEalQWaSQ3/s9AtrLnIFY9yukpeFxJOGpR4KvW0wSKJicMbDreATJ2wJ2HHtaoTSavummN+UldBYtFRaLBVap/rnS9Dz2Z4iVyXsO5OaJsk1Q/RLpyIJ3MT8BH8b6jJh7duFIo6hfOMSoq9rK2VN4Tw6I4XzKCo= 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 PS1PR0601MB1450.apcprd06.prod.outlook.com (10.165.210.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.544.10; Tue, 19 Jul 2016 02:53:32 +0000 Message-ID: <87k2gimjki.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:32 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR01CA0010.jpnprd01.prod.outlook.com (10.161.131.148) To PS1PR0601MB1450.apcprd06.prod.outlook.com (10.165.210.154) X-MS-Office365-Filtering-Correlation-Id: 8865620e-b493-4ceb-4502-08d3af7fdf2e X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1450; 2:W3+fvrR7bDjjPWh5MdFmduRfG2TPKHD+i8exSmlNqD2j7ZGygW57g0WcE6A414OX2wvhJXT3gTM1c4m2sTUbTcRlgnGAQOrwqv5oQb1SuOUO8BJ4VXiiFWRD6cxXAo/5m3qoT+mTS7MxfxCsCDBn28d5JkiIK+cOQZ0MlvKEaimvQf5mAiCFyyVVI0EDjQYc; 3:juhegPuoFXvUFeFF0Zg8WXpIW9bj19FVhQ41HMEUMPTVJIEAL9+FcLSSZbGqOSZViveMeuuHYAf1S6kuvvFi/HH8u7jLwy2xdBiA8ZLGIeBS3HBbILlrP28VQLdnd4NE X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:PS1PR0601MB1450; X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1450; 25:tIzqeThJeHG+y9AWS1L7tjnZZHwF1La6Yxhg8xjz6frZFTGP+JZPFpxdfSU+8c1Pte6kLxuRQGgqSEGtL8tZs1AQQz8pufnAtIdlAet7RNOhSMp9RDY4DfMH9LE9e7oDyxPCSZUFGikMalpiZ2+531kMgaEYUmGMFprwu0imf5UosOrlspDorhWueiDKT+S+TilhF7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o5UF3KNSVJv/HsBzv8lbpX53Qpl4fqiZPrWgDplWNjXuzgVLNlRRYVzDa0esRYkDe3eGdszcXBMwcHnJnARoUetzANmxmhxVZCrd6T+a5dxtXe9JDelefR29p/y7Ae9y8IhnZ4ANxDofYxSrZp39lubasyWGjdVhblj2Dd/0O7/gwBX9FvA1lXR6dBznElxqrQ90/l/95Wuy/AZeP6t9Zt7d3RCuk2MudWg8CFyn9kMb; 4:JGkh1wwYpJlysYzL5aC7BAp4wSr536llK1nCbMt8yWvsa5JV1xbJqlFTijJYevO16BfRB4rgaHr3h036YRuKL7dtqFk2igZtXjpzu1gnuaABU6nMv7P0etDsj/dIEzoqqCDtslnSz1rlKmDnK7XcFYJ49uF0UE2cQdZ704T7Ah7pgnScrA+K3uJBXgr76zLnJOBzjAhVFhs9mKhAu/qykCnoVauDkhT544ZutVDkvtN38Kp3np/lZD4kmoWDjnpxvrzAApVZGIiioA9KghrmSjmeh06Dp8H6cpTRRTF2kB2M0UHKiSNZO8QnSLgN96rHb1GTK8VpGPUBu56xt6Dm+aZyW9UIZNgUGbrIKX2g2s6DmXzYPmpsP9GmQCl+BmPfwnDycSAJFYiENi6Yu+kU0w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:PS1PR0601MB1450; BCL:0; PCL:0; RULEID:; SRVR:PS1PR0601MB1450; X-Forefront-PRVS: 000800954F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(305945005)(33646002)(105586002)(7736002)(106356001)(69596002)(7846002)(101416001)(86362001)(68736007)(46406003)(83506001)(23726003)(2906002)(66066001)(81156014)(81166006)(4326007)(42186005)(8676002)(2950100001)(50466002)(53416004)(6116002)(3846002)(19580395003)(586003)(19580405001)(189998001)(47776003)(77096005)(110136002)(97736004)(229853001)(92566002)(36756003)(4001350100001)(76176999)(54356999)(50986999)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR0601MB1450; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; PS1PR0601MB1450; 23:MLq77zM6MHPs6w+1V0QZ7jl3KEO1daQEVU9KGbR?= =?us-ascii?Q?9HwQHMb8OcQ92ktxZ/xYD4OxztyvK/uJGJTX6hz8ZGksmxtVJtZCTNGJppGe?= =?us-ascii?Q?5Vq7rD0uV6CTgvM4N5bXIBWeQg+3lgDjYkdlFM+AYnsV2+pzJUOO63zfRM16?= =?us-ascii?Q?qdN7dNxa1qRiU3DzcShdaNvi7om4TALrr6mrrg2MH99lWFqVtMDbjQr5HQN1?= =?us-ascii?Q?3yTBPnLjdxrVahjd1WvFJx6zw18gvDPaDNynDWgtqyvtz1iqb7aUfIAC7j0R?= =?us-ascii?Q?B/UhKPoXNte651Lgqc3+Xj3rGUZuL3nPen4O55B3VkJfLjerclGjwYavs9Xn?= =?us-ascii?Q?Z0toGsBc1t29/UhfJVg/Bj0Ej3X7aK+fLCg2Kk/BmfffjGeaEQUaw4cPlF4A?= =?us-ascii?Q?0hIthlNCncnA4K9fuu3tbc3+pNoNZWwRsINv+BysyOnJipz9YOFoyPYv+Y0Z?= =?us-ascii?Q?wh2KA4HblgxyPP41V/hLi3xatpcg4mHfJW0oUBIHhoLTHOLYcPqimOAa9fWk?= =?us-ascii?Q?8ExvhGcuAH4V2Ggqn5qXj2gKI8NeWW4R+UG6hrxzLMNYKxoh+8RsQirk7Doo?= =?us-ascii?Q?fg7t9dj0VKW0bwrk/B+nxLy+NxZ8QUn2L8tzJZR8iPHp9qHttwyEUVFwFt3t?= =?us-ascii?Q?NJh/7h25IEzXJulOxMTb3/Vr90RRZUyNOSKFaJktJwRqaeCM+TXFzIOrVLm+?= =?us-ascii?Q?YDrCa8UPV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RpKXeoMgqJqkUhNnnIspO4QUbdjiTuTWq8NsAUa0PI3u3whFES8zWSscdhDJ+g==; 24:gi+CDsw5ofGmEZF+gYejPr6TCUsMLwiNmb8RFIhYqeZugKKqD916hsZfoWf07NcRkp0H07Bcc8AmNL6Q9tK90agSMuCdOU32MKdoijvuwnI=; 7:rIKHpACEVkyfm0kvqf+mHQNwIaT4d88084cbK9EuKc7rrFhgWm7mzNWSipDBIfEn0BVVIbaHTBVbXuibF4NNuIJv8r5p3LSPobA4j5zm+poQ2AQ1yHgYkBoIz7MC64QHaf7wwK9SPWJZiChcYHRMfDUgh73lw7lZbOQxylqRl+SuDPBpTJahD/a3E6bES7bqpFLs1v5QOlkaBK0YPke48CqUrzRug9KnamEPttos5UKEzQESpAn6VRc3mYKztd+I SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1450; 20:zAJCcFxYJbXJkZgqqmUcb4AZ3wRM8bfrmnT2LgOy3arMM6l693n7xjpsNniGCsInbjFGCysRf9T7LQbQRO6gDmULS0q1DVDZ80mzJXAaqytB1HuHfkrQ4isAUmz7svS+YN32e7QMpbixxN4oFUpd7GlGI6rp8bqdTZ7WHkyXtug= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2016 02:53:32.5497 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR0601MB1450 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++;