From patchwork Fri May 20 09:51:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9129069 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 AC6326048B for ; Fri, 20 May 2016 09:51:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EB2B1FF6C for ; Fri, 20 May 2016 09:51:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91A1D2618C; Fri, 20 May 2016 09:51: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=-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 D933C1FF6C for ; Fri, 20 May 2016 09:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754747AbcETJv6 (ORCPT ); Fri, 20 May 2016 05:51:58 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:59896 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754539AbcETJv5 (ORCPT ); Fri, 20 May 2016 05:51:57 -0400 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie3.idc.renesas.com with ESMTP; 20 May 2016 18:51:56 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 51AAA52D51; Fri, 20 May 2016 18:51:56 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 356BD1806F; Fri, 20 May 2016 18:51:56 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 298091800A; Fri, 20 May 2016 18:51:56 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id UAK02630; Fri, 20 May 2016 18:51:55 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="211714081" Received: from mail-sg2apc01lp0246.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.246]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 20 May 2016 18:51:54 +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=vMSW/04+Q1MbBzKNpFwG4piWuE5UaaVOu5N/DaYKJME=; b=PH4gOY8XPamOj50qTDpf5IZCjcM5jF05es/N0gmo0kpFhIvOgYN07+73xVjQPNBIWEtUpJ8YGxoXLHaZy2i06XBViprgfJbxvcgpjN9aZ2CXoYE2lf/w04nSlmKGPPP9nculxkgqim3O5cug8u+kPlb07r8iqALHn71WPd16KAw= 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 HK2PR06MB1699.apcprd06.prod.outlook.com (10.167.73.13) with Microsoft SMTP Server (TLS) id 15.1.497.12; Fri, 20 May 2016 09:51:53 +0000 Message-ID: <87poshqcze.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 22/49] ASoC: simple-card: use asoc_simple_card_parse_endpoint() 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:53 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS1PR01CA0026.jpnprd01.prod.outlook.com (10.164.162.8) To HK2PR06MB1699.apcprd06.prod.outlook.com (10.167.73.13) X-MS-Office365-Filtering-Correlation-Id: 2ed6f5f1-2e42-4b45-9ab8-08d380945f85 X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1699; 2:okywjwtaocIKHcFLAC62DzsVA/SSeIglcyDpeu41uDHOhE3NMW76cmJtEpaE4srOad1VXQfLRmJ9QEPCvxZjNCV3/6Bupx2NMBaEnIju+a92o5w3heKtIJ8JHjvHactO0vJbwkitISLjKaFGq4Cau6KXvNGOzrE3Ps+nPw/HZLBhHIqOQRvX6z4sQi3eoKiT; 3:3K1i7ZkU1d5QgdScr2O5WVZUlJM0KueZHWamUmmkQKLyIGNeDrpfZ914uT+M/XLa4L3b22Y96YC9jVA+52WvoAThPNo9j6r0x4B6uvpgO0SttJAWpSBDUgXCQv9rBEp2; 25:y2OSRGMiRke1gHb3be3h0i/KDK7XUrYCQUx4YsfitgIDSv6TlltPN3UaVg2jPoHgq2QTApxamOcMdS6AjDnMGRXhLZz4vtsB2saMgqCepcKVhqhW19hB4m/EVfbf0LPFn8BWXADO97+L5ZJKKIB+C7APcremPT3hNNjH+04YGKiZMgpFHkOPaT2L0nOEGXpcBvXrWsa1VqM6648qZMlSedE8czWGmhp8dGrTNVoTKqdiC+L7uruwiX3SBxXeyAY2aqML+bYsEXTl/4kzPckt056bunnXR1rF/NO8cL5GAZqVW6thNicMOmf1JTi5mpn/1Z4DxIqKvh8/q4CZta8SE0l59Qznvpi5knFvFVFqlhX4DiA/ZH0wbwywv5Af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MW6A== 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:HK2PR06MB1699; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB1699; X-Forefront-PRVS: 09480768F8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(77096005)(23726003)(50986999)(54356999)(3846002)(76176999)(50466002)(2950100001)(189998001)(586003)(33646002)(5008740100001)(6116002)(110136002)(229853001)(5004730100002)(47776003)(66066001)(53416004)(4326007)(8676002)(86362001)(19580405001)(92566002)(83506001)(46406003)(19580395003)(2906002)(36756003)(42186005)(81166006)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB1699; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1699; 23:cXdxuZxse4haCSOFkjN167aOkaRsMy2bgeJDHZjP4rX5t6QXUKDL5TRM5+wY4HMqXrf2YUJMoOeykjSONIHi+QMc3SNSViCgWSLy/kkt123IOFxhD+gfUTPagAx5yLuR+7iUxLFBoZJBwL1ig9MFTSJdLbPdgcrk8H3LRgc8TzSHTlF5GzDP9y3WgBa2b71kKNh9RvJ1JsqMmUil/uyeTn0TNjId0eWUH7d6nSZBeyli3ikRuEQwvbiTpt+jlFFbWqPx6reWBYB1VaRXov4Ze0eFMIQEBxLd3ddEjm/clix0aGUbhr6pe26A6K35V5nimmRSWNWrpevCNfGdOyxEhyUw7VASdofNAxQWJHy1zNNgZylNWi7DJUZoMTN236K3CqeRaphs7+HstK2dPhlW64vMNZLtx9LpNNHJu3R018Y3BuC3gMK4WGulOPD1u9T4a8g6/r5/RGyd/bbwgnBLYTr/SGeTMsMb91l+kt9J3pZanupsZrYt+pZLm6xZtsO/N0usA+TShs75mdEvMK8warrY0jtDRjVG4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amDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2016 09:51:53.0009 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB1699 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 | 44 ++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 9b7f525..aa7c7ef 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -38,6 +38,9 @@ struct simple_card_data { #define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + i) #define simple_priv_to_props(priv, i) ((priv)->dai_props + i) +#define DAI "sound-dai" +#define CELL "#sound-dai-cells" + static int asoc_simple_card_startup(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; @@ -216,33 +219,11 @@ asoc_simple_card_sub_parse_of(struct device_node *np, const char **name, int *args_count) { - struct of_phandle_args args; int ret; if (!np) return 0; - /* - * Get node via "sound-dai = <&phandle port>" - * it will be used as xxx_of_node on soc_bind_dai_link() - */ - ret = of_parse_phandle_with_args(np, "sound-dai", - "#sound-dai-cells", 0, &args); - if (ret) - return ret; - - *p_node = args.np; - - if (args_count) - *args_count = args.args_count; - - /* Get dai->name */ - if (name) { - ret = snd_soc_of_get_dai_name(np, name); - if (ret < 0) - return ret; - } - if (!dai) return 0; @@ -272,7 +253,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, char *name; char prop[128]; char *prefix = ""; - int ret, cpu_args; + int ret, single_cpu; u32 val; /* For single DAI link & old style of DT node */ @@ -302,10 +283,23 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, if (!of_property_read_u32(node, "mclk-fs", &val)) dai_props->mclk_fs = val; + ret = asoc_simple_card_parse_cpu(cpu, dai_link, + DAI, CELL, &single_cpu); + if (ret < 0) + goto dai_link_of_err; + + ret = asoc_simple_card_parse_codec(codec, dai_link, DAI, CELL); + if (ret < 0) + goto dai_link_of_err; + + ret = asoc_simple_card_parse_platform(plat, dai_link, DAI, CELL); + if (ret < 0) + goto dai_link_of_err; + ret = asoc_simple_card_sub_parse_of(cpu, &dai_props->cpu_dai, &dai_link->cpu_of_node, &dai_link->cpu_dai_name, - &cpu_args); + &single_cpu); if (ret < 0) goto dai_link_of_err; @@ -372,7 +366,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, * fmt_single_name() * fmt_multiple_name() */ - if (!cpu_args) + if (single_cpu) dai_link->cpu_dai_name = NULL; dai_link_of_err: