From patchwork Fri May 20 09:47:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9129049 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 D2F1760762 for ; Fri, 20 May 2016 09:47:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C58961FF6C for ; Fri, 20 May 2016 09:47:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA66B25D91; Fri, 20 May 2016 09:47:49 +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 5602F1FF6C for ; Fri, 20 May 2016 09:47:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932514AbcETJrt (ORCPT ); Fri, 20 May 2016 05:47:49 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:63234 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932274AbcETJrs (ORCPT ); Fri, 20 May 2016 05:47:48 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie1.idc.renesas.com with ESMTP; 20 May 2016 18:47:45 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id EE24143FF3; Fri, 20 May 2016 18:47:45 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id D5EA48002E; Fri, 20 May 2016 18:47:45 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id D0A238002D; Fri, 20 May 2016 18:47:45 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac1.idc.renesas.com with ESMTP id UBK10034; Fri, 20 May 2016 18:47:45 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="211713760" Received: from mail-sg2apc01lp0247.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.247]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 20 May 2016 18:47:44 +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=egbIrwTrCLaAmecCKa9coQTqTU78FDsDBX47s02tXvY=; b=An5MR733KKStfXwRB7REjN4bgcrClFOEJfQGl1JuSo8f9SrcAj5o8n6BSVsF+0CzC+gOLvPC+gYjKQ59aunxQncXxg2sqMJkjoUCXuMvyHUS/QjHGTAgoiqSIgykOAimg+8cQoFOTTTSnA7cmOHn4sUnrO0T1HZM+Tl9ID2LtkU= 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 PS1PR06MB1708.apcprd06.prod.outlook.com (10.167.53.18) with Microsoft SMTP Server (TLS) id 15.1.501.7; Fri, 20 May 2016 09:47:40 +0000 Message-ID: <8737pdrrqx.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 13/49] ASoC: simple-card-core: add 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:47:40 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS2PR01CA0027.jpnprd01.prod.outlook.com (10.164.161.137) To PS1PR06MB1708.apcprd06.prod.outlook.com (10.167.53.18) X-MS-Office365-Filtering-Correlation-Id: 3d573169-c05f-4566-5c4c-08d38093c937 X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1708; 2:YDcnkVwaBZ84Irdl9ZM0kJzwUF8KXB62+PXKOmktDF+IY6Y27/AG2EhZRmXZY4depfKjH3N3h3ZVSU6u8ykg4MU6uFYd1Gk2lboDrnmPsyqTHtoATf3eXyvgCsIlZN1OFdgauhOaQPFApUhR4tisO0CkKgCyHgzuMBiePx0Sc9ZBLf1fSw6kaT+PKA8dFS6f; 3:CISXIJ/hzEBRFO/67Z5QaKkm48XZkMMlzjMF4tXXDUMifHMaXU2bZ4rVJ+/0KlT/fF04E5cmyWnp1lOKa+bhPirwZWhDQRI2XYwD3YMUnbUikxN427t3Drj6bCVNl1xf; 25:J9kvzeCv/qqIo2mct0FlJUAnKZ7A9WJ84HQdJ52ONcvA3coLlm0qqrPA32bNEmkKTt6ZJzmazcJMSpJ2NN0jAMCeJdzKO6QEnFIjK76z9ZXYi7G6REWwGB6IWBD7e4jApHquZO9qQehv6QKNC25aXhJPwA4NWiCh5DqBnIxBEKnpNSdU+KChW96hhCRTkrEb+MM6n9Ul3iu5JT792vSKmvoSSWFM0z0MkpDul1PPov49CTP5sRqtMaFJ9+gNPGH9zlNAkjl6JLxZCTEWXjoDsc84FvJJgwoVnFrkKkQ0kCBeyef3aBCA6E76w+0oW/D2yMKHFAAJ+oO+b4eVpuUXP8WWFu6uDo0BBOTo7oo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6i04rzA== 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:PS1PR06MB1708; BCL:0; PCL:0; RULEID:; SRVR:PS1PR06MB1708; X-Forefront-PRVS: 09480768F8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(230783001)(86362001)(53416004)(83506001)(5008740100001)(50986999)(76176999)(8676002)(4326007)(229853001)(81166006)(54356999)(6116002)(23726003)(42186005)(19580405001)(36756003)(19580395003)(47776003)(66066001)(33646002)(3846002)(92566002)(2906002)(586003)(189998001)(110136002)(50466002)(5004730100002)(2950100001)(77096005)(46406003)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR06MB1708; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1708; 23:oP9tKTuJjvEppOyTN/bQGFg2Ky1SAP+gEGoqptBY7s00ciYshpBL3Iu+xLB7qq0J/se5S+buYOmq8q0Pp1J6TfAEkycUD8/qbkOC5G0gkqeGVVlBpjpPKBSiwo4P7SRmvCvbgUKgtKVbB99INh0LSliFsIlee7n1zj7ISfPFPcjDDjC6G4xl+CXh7BfB3DXoyreTAsLzdBxYsTP9PjLMCM2clarNTWSXNSo8iltrs5ZSe1SoWwXZLPeGMK6+ac0rA4z8aZHCZugFb3pu7q+prYC+YB5RtGkTbLTF1hY9aNSOgnF6JD9UFGP8WkljdML+gwWyD3Aq8AszyV983IM4IBX6DsyYrQEnousU+1Di57Ysa3SCLkvn1NTYuIF2LiDb18YwkxBNMpCxfwoUYW3JnRroHvm6DJkZkCWQveHl7rpulJ+ZbnJ1tXCwlwRdpqq5M7ZvvKCfzxdQSlrPaemIr7RlCafA7feLr+sMprS/Ysh11Oxf+MmpNj/EUk9k+2rW5NwWdzf44hNj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SCoNh6wsYurwE29QROhBTGKMSHcoQL7yZz+6cQDYlq1CM= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2016 09:47:40.9080 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR06MB1708 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 simple-card needs to get its dai name and endpoint node. This patch makes it simple style standard Signed-off-by: Kuninori Morimoto --- include/sound/simple_card_core.h | 19 ++++++++++++++++++ sound/soc/generic/simple-card-core.c | 38 ++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h index 5105b24..8155001 100644 --- a/include/sound/simple_card_core.h +++ b/include/sound/simple_card_core.h @@ -50,4 +50,23 @@ int asoc_simple_card_parse_clk(struct device_node *port_np, struct device_node *endpoint_np, struct asoc_simple_dai *simple_dai); +#define asoc_simple_card_parse_cpu(port_np, dai_link, \ + list_name, cells_name, is_single_link) \ + asoc_simple_card_parse_endpoint(port_np, &dai_link->cpu_of_node, \ + &dai_link->cpu_dai_name, list_name, cells_name, is_single_link) +#define asoc_simple_card_parse_codec(port_np, dai_link, \ + list_name, cells_name) \ + asoc_simple_card_parse_endpoint(port_np, &dai_link->codec_of_node, \ + &dai_link->codec_dai_name, list_name, cells_name, NULL) +#define asoc_simple_card_parse_platform(port_np, dai_link, \ + list_name, cells_name) \ + asoc_simple_card_parse_endpoint(port_np, &dai_link->platform_of_node, \ + NULL, list_name, cells_name, NULL) +int asoc_simple_card_parse_endpoint(struct device_node *port_np, + struct device_node **endpoint_np, + const char **dai_name, + const char *list_name, + const char *cells_name, + int *is_single_links); + #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c index 1b01c07..d9285df 100644 --- a/sound/soc/generic/simple-card-core.c +++ b/sound/soc/generic/simple-card-core.c @@ -204,3 +204,41 @@ int asoc_simple_card_parse_clk(struct device_node *port_np, return 0; } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_clk); + +int asoc_simple_card_parse_endpoint(struct device_node *port_np, + struct device_node **endpoint_np, + const char **dai_name, + const char *list_name, + const char *cells_name, + int *is_single_link) +{ + struct of_phandle_args args; + int ret; + + if (!port_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(port_np, + list_name, cells_name, 0, &args); + if (ret) + return ret; + + /* Get dai->name */ + if (dai_name) { + ret = snd_soc_of_get_dai_name(port_np, dai_name); + if (ret < 0) + return ret; + } + + *endpoint_np = args.np; + + if (is_single_link) + *is_single_link = !args.args_count; + + return 0; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_endpoint);