From patchwork Fri May 20 10:01:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9129105 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 6CB6F6048B for ; Fri, 20 May 2016 10:01:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B4EF279C4 for ; Fri, 20 May 2016 10:01:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4FC6C27BFE; Fri, 20 May 2016 10:01:33 +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 BCA32279C4 for ; Fri, 20 May 2016 10:01:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753973AbcETKBc (ORCPT ); Fri, 20 May 2016 06:01:32 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:36508 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753910AbcETKBb (ORCPT ); Fri, 20 May 2016 06:01:31 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 20 May 2016 19:01:29 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 621C14E7A1; Fri, 20 May 2016 19:01:29 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id 26801480A4; Fri, 20 May 2016 19:01:18 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id 9D090480E1; Fri, 20 May 2016 19:01:18 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac4.idc.renesas.com with ESMTP id VBL08639; Fri, 20 May 2016 19:01:18 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="211274803" Received: from mail-sg2apc01lp0248.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.248]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 20 May 2016 19:01:17 +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=kF0dyXdNv3rDSTq461lF+JheA9WtKGahseI6it7W2MU=; b=ZGQjBBbnq8QOX4WNxuAx0En/9h1WFahxyvCb4aIlMimUBSyPTkaEsjvjYUh8A7U5Tbab4COiYHz92SSGWRXXCiSpBoi8sbMespav13eYoTW22sBRA4ii1QxR2Fu//92HB80Hi3VAzZI7PHrq16BkwnoYH7TgryRYcdb3uqkCQrE= 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 SG2PR06MB1709.apcprd06.prod.outlook.com (10.167.82.139) with Microsoft SMTP Server (TLS) id 15.1.497.12; Fri, 20 May 2016 10:01:15 +0000 Message-ID: <874m9tqcjr.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 36/49] 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: <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 10:01:15 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TYXPR0101CA0015.jpnprd01.prod.outlook.com (10.168.40.153) To SG2PR06MB1709.apcprd06.prod.outlook.com (10.167.82.139) X-MS-Office365-Filtering-Correlation-Id: 88bc96cf-5155-42d3-7c3b-08d38095aee0 X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1709; 2:pLhR2PK3SEEp5oSJ1kFLdjisMVhC4eUAP4Pb6eOJdYFNUDINwZ8AoajDXKQTz4fmfhbL8+ljPIyG0n1xL0bNCsH+/UPa9SZKIfJlQ7LyJcvAVj0g9FabDus6a2mNfVjYK0F5hWJcM6SF7GdY6luNGgRIBAo9jGRwvbZPBFEgouJNkfckK3cWR5EAB24L8x78; 3:BHrbOppoaNxO6/IeJxPOBshOwbmeGhUQyY+iQSOxG4KpgA/FINGT5BFdW4T3ovHs4WawxBiVcI0w/pCf9a0JzFFMEX0od+CsnpgtGEvQZDx4pXFHt7o2H8DWeX62gxeL X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SG2PR06MB1709; X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1709; 25:1aynxPcB+nGwnmaA2dhWBQE+GkCowzoAu4/teRTE39FZ8ybk2zpOJy7xXT/VK4lmBWJA6PqyK8uoOHU1EdIyQQIOQFuJSNlLyXcRRXtULpZ5rtwMUXr2M17KJrVwsXEzeY1Kl8I/HcSl3Szcg5xiATk8/KsIyfKkZlpcm5/xoHSz97sdRgZXI2HFOTlBCSMLh/YHpyVeG7y04QyL41X1LVjVVco7tuItAzw9I/8gQmrIJiMXafqBuDmdEYNHndJkdivndm6EBwU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KJgFpYOSFkWJHZiBC8hsh50WobLCbS9eVH2X/whEoWqFx96mZE8jhj2pvHLXNr5bBFR894CIGsbGtvEEh/j5TmZg/AE1sIiEgAVSW4nGOM0ePwCK6M8bz21IBprzO4U+QVsY3j8+E2quiLZPCFSlZGwxWibolB1jNA7KAOWhzTXIeXbijPv3QGfdx2MxtmCmaLA2xDFX2R0TX52b6EOEIFyfWKAxCWrIMTPpO1aiLwSYiGhN3rWA/+RP7eEHFVmTUmw2TBxCtWnbp2Lar5wv8G1xoT5G5A4CGQpun+mh9ZhlmM5ZNn27BocomLZIU2G3g0Jm20mesz0fl+FENgjMHdohaDSl3p5r1LA== 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:SG2PR06MB1709; BCL:0; PCL:0; RULEID:; SRVR:SG2PR06MB1709; X-Forefront-PRVS: 09480768F8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(2906002)(229853001)(33646002)(4326007)(53416004)(8676002)(77096005)(76176999)(54356999)(81166006)(42186005)(2950100001)(86362001)(5004730100002)(47776003)(5008740100001)(36756003)(92566002)(83506001)(50466002)(66066001)(3846002)(23726003)(6116002)(189998001)(19580395003)(110136002)(50986999)(586003)(46406003)(19580405001)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR06MB1709; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1709; 23:KJFdqrOyiP0xEEbu3bIE9fWsWBb+NJuqSh+BpkBV06b58ayBWpvT7b+LLnqufspS5oYn+Tpo4fjUzwmC0OLK6p4BpYg4m9tLgwSQzADrkEh9ROghF9rxkB7KKN/JmbnvOoiM/gchCGXNlFjqAyblu+KLUcOsTChN/ccTWHZd8cb6+kacIuO0kvBS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8dj/RfRi/y8IsQ0+HwHaUMbVNM4wXi1kBajdiLaW4/t6BiVIYcnX9ZCk1wPW/bbCI1fbLZPKEtw8Fo4PbJDxcjreC1RFxs52U8iFMffiSV0wl2dVqmcw1UlqdeqWPrFPDaI6ORqWNC7NDmaKOGrfX28m5tbZ; 20:vEqlO69IKux+TZV7oBiV5JpS+rxFmjGh48e7gNZPauPsPvlG4yVwXLecCnQoC2mSaQE1ivqgLAsY649Ss9H6vr07+4ycEG+Uf7y1O+4e/jvgA8H0ow6IByUJmUZVSM8qxfw3IuA8C69/+GC49DZeHAOJySafxg1N7ZwkPTU92A8= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2016 10:01:15.6176 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB1709 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 fa3f02b..f61eff9 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -187,6 +187,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; + /* * In soc_bind_dai_link() will check cpu name after * of_node matching if dai_link has cpu_dai_name. @@ -216,6 +220,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; + /* additional name prefix */ if (of_data) { priv->codec_conf.of_node = dai_link->codec_of_node; @@ -239,68 +247,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, @@ -337,7 +289,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++;