From patchwork Tue May 31 09:10:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9144049 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 2A02760761 for ; Tue, 31 May 2016 09:26:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BC422793B for ; Tue, 31 May 2016 09:26:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1092627BF0; Tue, 31 May 2016 09:26:59 +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=-1.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C9542793B for ; Tue, 31 May 2016 09:26:58 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 217BF26682F; Tue, 31 May 2016 11:26:57 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 55A1326682D; Tue, 31 May 2016 11:15:57 +0200 (CEST) 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 5F32F266820; Tue, 31 May 2016 11:15:55 +0200 (CEST) Received: from relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id 5685826682D for ; Tue, 31 May 2016 11:10:23 +0200 (CEST) Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie1.idc.renesas.com with ESMTP; 31 May 2016 18:10:21 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 16CC6506B4; Tue, 31 May 2016 18:10:22 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 16F898002E; Tue, 31 May 2016 18:10:22 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 10E738002D; Tue, 31 May 2016 18:10:22 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac1.idc.renesas.com with ESMTP id UAA04553; Tue, 31 May 2016 18:10:22 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="211981039" Received: from mail-sg2apc01lp0239.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.239]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 31 May 2016 18:10:21 +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=bsHJe5YgNrT0gpJKjneqVsmhhHGi8mVuBwqV28FzlpQ=; b=TiWRPxOgBPPOWew4pIeVlMbXV48InftRh892UUtzsxnNu3GC5u51+6wuamiuTQ+mdqVx5MJSsU/Eoa6UpYcRZaOzzHpkxSeXPoRAkZSLObyILmF6/HG4twrITGncCwpBbtyPQVuhrO3VB4VKl2yc/oHtC6WKYPWKsRKPE15WF/o= 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 SG2PR06MB1711.apcprd06.prod.outlook.com (10.167.82.141) with Microsoft SMTP Server (TLS) id 15.1.506.9; Tue, 31 May 2016 09:10:17 +0000 Message-ID: <87bn3mr43q.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown In-Reply-To: <87fusysjam.wl%kuninori.morimoto.gx@renesas.com> References: <87fusysjam.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Tue, 31 May 2016 09:10:17 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TYXPR0101CA0025.jpnprd01.prod.outlook.com (10.168.40.163) To SG2PR06MB1711.apcprd06.prod.outlook.com (10.167.82.141) X-MS-Office365-Filtering-Correlation-Id: 195259c4-1acb-4504-6547-08d3893362db X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1711; 2:k/xKQ0/aRP6M0+CG4+vFT6KbjC8Qr8tJLzDoQOcwcBu9YU/OecyAKIjinR+itlGAJZEFG5gd83jf63+8RiK8wDDFPEMdNXzrLGC5XE+GxiR2mcFbqu+0vIaLu9XiJDGaubsIxsh26VhPXwKuksQOB0vk3IZnpOsdYpxWJLbBINiRoFcnJqzAPJJznBYyk5v7; 3:IYWTIT116LvGcFtkPjRA2ATRThVYIu5z+fN+zlVO5N7WTglHjd3ekFc4Z3PoWS8s6LOVICXEqhSrsMqFeVwbzUDZ+Qxy3ckewyYHggIGZv+k9RwxEbrC+QKY4KIy0tSV X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SG2PR06MB1711; X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1711; 25:wT1F03Ly90Jl/Wyw6L1Hk+4K14ioKXXYJGStQdP+RVANVxx8bUq3ig4ZRz4Ia/ZvtPIuZf7F7dLTi+O+JgKnmw8Jll/uTS6ifhrX4HiDb6Iu7tZ95hn0jVOMP3SojPPcUAFjBX4P7I77YZ5I1Jeqd4oEEORjowkCv28qscc/E/mafEM9jQcwOpaEANcCM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ik3c9aLRQz5mEzc9V1PJMKeEfd; 4:ExSM252+eVnbkj4bBSIyc2lgV/dR8/XZMx/h/CIhHZMXZc3t8RWhRH3c7fmFzNGNZErt3zBkixhSOIYm9AxKjbzCcdpq2n0cvuFspe5K5bEMaT/xZaeJetX3y8CinF6E/G52gF/yu1KDOSQfiPzFrehFfteNdh1fNny9pHK8RBD/0DiaYZbXJToZIhIMgy4dFzJ6UXR1yaw1LsuGnhQOumjJlTY/bHo6s4tEvWJ0TdeUOI1DN//Bf73lJdX+VsEXwnd58I+mVY8lJXtRrnl3PysU5t3EOdAV2AhVgW07FNTE+rdtMcabMIvYZ8fH8g/IQkhJYlJiRhidDMBhByViUuMWdN3hofMqn4oPCAf9hWcDc0YeyoIC5YsIs5V5h1x5kIOlPk1kEDMyZsKcCIk03w== 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)(3002001)(10201501046)(6055026); SRVR:SG2PR06MB1711; BCL:0; PCL:0; RULEID:; SRVR:SG2PR06MB1711; X-Forefront-PRVS: 095972DF2F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(586003)(5004730100002)(86362001)(4001350100001)(77096005)(23726003)(92566002)(81166006)(2950100001)(36756003)(46406003)(50986999)(66066001)(33646002)(6116002)(8676002)(5008740100001)(76176999)(3846002)(229853001)(189998001)(19580405001)(54356999)(50466002)(19580395003)(42186005)(4326007)(110136002)(53416004)(2906002)(83506001)(47776003)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR06MB1711; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SG2PR06MB1711; 23:TEO4b9djjUE/aq6+6wNee9dNN+epog/0KvOw+/Pra?= =?us-ascii?Q?wPGy1aOSK3mHwIY/GaD5p62iY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lwHwXNW3wW7aLInQLFLsOyR/xtUNjwWi4WLS8bBpF2DWLF+LXUjzQSFN?= =?us-ascii?Q?bM=3D?= X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1711; 5:o+mLFKwSoBmIB9LoRbzXSSIVf42nnz5UfT26SoIPCgJjBT5CrKP39vMc6epYfEZVrouK6KoWuvlJmZnihN5Umv2Cbr95kZTBG9YkYkrBnEbghMT28qRfI36FxZ9N8nbeblVsTksl1XsKn5ekypU7yQ==; 24:Bm54Y66PH66ufcmJg0cvE8ZwR09YDU5banTZo2txPoYThZ3+FIL5yAd9nnxmpYgra761NxB9A8Lf1LKR9u0TsjskNCnqD60Dp+I4g2DnRD4=; 7:VTHDGGVTyHm5mrCsFPoexI0DHEuophvYaQqRY9rDYyNAPxvJ+1bEYQiLziyI8G1c/9KKm8/fniRn7rpaiO92SGmkg4hiuEPWwFU8Rfxsk6k6fXgytUVI8+YRCi3eMCCUb+YTRuX/6J3jnyE+AQsjEmQuQLpim6iszKu+NdmVkWutZ1r+meCxYDrRp3/UFY+E; 20:BhMr3O6/NjBXUd4fLdxxp+ERleLvNIEr9i/tF0R/iGvwMaIoSI8nCHdYsQr+3+pynLhB4SRJR/Kia/ShX8w8WLr0jhx1yJ7BcemsNWId7cPeDzmQHWxfPPvDNUIcoWU61zBsNwD8yh4UEleoRGjxeiOlgEfyeTfXlKfZYU6JPm0= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2016 09:10:17.8629 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB1711 Cc: linux-renesas-soc@vger.kernel.org, Linux-ALSA , Simon , Liam Girdwood Subject: [alsa-devel] [PATCH 28/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_clk() 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: 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 e28c9c0..c326562 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; + /* * In soc_bind_dai_link() will check cpu name after * of_node matching if dai_link has cpu_dai_name. @@ -219,6 +223,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; @@ -242,68 +250,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, @@ -340,7 +292,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++;