From patchwork Fri May 20 09:52:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9129075 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 559206048B for ; Fri, 20 May 2016 09:52:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 487D81FF6C for ; Fri, 20 May 2016 09:52:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D3B62618C; Fri, 20 May 2016 09:52:51 +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 859011FF6C for ; Fri, 20 May 2016 09:52:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933232AbcETJwu (ORCPT ); Fri, 20 May 2016 05:52:50 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:50259 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932340AbcETJwt (ORCPT ); Fri, 20 May 2016 05:52:49 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 20 May 2016 18:52:47 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id AC9BB50941; Fri, 20 May 2016 18:52:47 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 783B02806D; Fri, 20 May 2016 18:52:47 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 49E4E2806E; Fri, 20 May 2016 18:52:47 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac2.idc.renesas.com with ESMTP id UAT19132; Fri, 20 May 2016 18:52:47 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="211273054" Received: from mail-hk2apc01lp0208.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.208]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 20 May 2016 18:52:46 +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=i+N8Q1ISFfcc8Mu9MEq8inDT4I8uDCL4j7+01zsFjID3Q3Zf2zarUgxQvgJt6OUhILMavfQqAOwhJK9ATODR4YKJViNXYyz8/9trSxQdrx/Tlnaq+akpacI+9Qv+vxClcNpmAokNsxH/KzOqsK5dvfyKW5iHqekkzrgTxWAzJeU= 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 KL1PR06MB1704.apcprd06.prod.outlook.com (10.167.63.18) with Microsoft SMTP Server (TLS) id 15.1.497.12; Fri, 20 May 2016 09:52:43 +0000 Message-ID: <87oa81qcy1.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:52:43 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS2PR01CA0071.jpnprd01.prod.outlook.com (10.165.51.159) To KL1PR06MB1704.apcprd06.prod.outlook.com (10.167.63.18) X-MS-Office365-Filtering-Correlation-Id: e17d41fe-a796-43a2-a529-08d380947de5 X-Microsoft-Exchange-Diagnostics: 1; KL1PR06MB1704; 2:9QmoGinn/fbGqb5JrzHl6SQbyv/8FPbCz9VUe94p2nn2p4+DNJnZ4NPCibmBK0Wd17ZkWratJmBVjeHIgbOyGI+3EzjF43vrpGFiZxcd2g6r4ug3X/g1PqMGq476TURYmYkKoDeVAhtdEBRSEy9onhGg0xlg6FeiLSHEXfN9CfeTD4NjX8yqdYsQUFQrl440; 3:TFHhYdTw4h1VBJl1vUhKY9cROlWCY7YjeVXE1KKoC3n3dclvjzs/kOoNK26i2pnR2y5dCXc9dfUgkm/eb+MADRsFNTV1bQWYeqeU3eiR6EdIYcWpZCAkD1f5eUUq6D2H; 25:wdLYcqA2gZJa12pWxrVtvTGwXDnf9XBtRAVpQN0QZKqWXTioD9ZjfXwldFhzVseNDztKmmwkQYFKTxrn84nlkSFkIs2V10eEIx1pjqNlc9FKufEDgS5LRCq2IexLRLlxcw1nvjIEbSsXziEBX9Qisd/covqwMQ3radnAqrKXUCk1HaOdF8OEDUngZrth7uMFvuc64XNy1NDQHImbHZ+B8STEjaAmYy2zOLFfE55UowruCJBB+cDPdBZbCX/dBo3r0qu/vM/thV3mDAuqJ35Rl+ujB2Lb1kptDMD+WBa5f1n01ohzEO7mMUic2DdlzfXC6S4o813vrlhLZciRyEtzsT8P9sH+7okcTQBeyzsuXh6b35KFEDB2mbAP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-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:KL1PR06MB1704; BCL:0; PCL:0; RULEID:; SRVR:KL1PR06MB1704; X-Forefront-PRVS: 09480768F8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(2906002)(42186005)(33646002)(50466002)(4326007)(189998001)(46406003)(3846002)(83506001)(19580395003)(53416004)(19580405001)(81166006)(92566002)(54356999)(76176999)(586003)(6116002)(110136002)(50986999)(23726003)(229853001)(5008740100001)(8676002)(36756003)(66066001)(2950100001)(47776003)(86362001)(77096005)(5004730100002)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:KL1PR06MB1704; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; KL1PR06MB1704; 23:Kgg2ovixpKv10PI8cIzq2Wc2gWiX5bSNC61z3mnyriUfCMOcrH20dIXV1ry14m6VCeelRcVGMZdi06lIrPShuMAhBOnzhXdvZysl9r2+m3s33uHIFin+yCxqLgAhIL3VNROfeAwCAgG15CyNQD2iHqwksE0XQT9LAF8XnJNxMcfROxaM52dRHIXDuKU90i0ITrMrlt+Y4VNSPDUkX7L1fR5HOyuzwKehFjhNSiJA+rqA/tM/Vld/VnNbYB2O1/wSKJr2PhSJ6uVI1Db8YReIQltVfL5/YILuFeh2/jV2eZfLmnuQmKZ+Qu7gWMR8qeaPbFGsWS+j1ZBPTex0PT95aCG50IWMZdAOrNAJghvJhiD7R8h7b+NgKmFPgrlvAuuTjxdpVcJeEWoCPx6kjQY8KwYf7vvtYpVHtLbfOfEltVwIBY/fNPihEQOd6Dl2C5lp+z8ujDlzEJVWFs2h0YkZrwL0A8l4SSYOcoP8NBqeUDQqMh9VAyuhYHCCjwXPUEqlh0GyNBvCvfw8vIcn6UWJFOCYKtNP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DiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2016 09:52:43.5869 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB1704 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: