From patchwork Fri Jun 24 01:17:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9196299 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 5E1156075A for ; Fri, 24 Jun 2016 01:21:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BC0D2847D for ; Fri, 24 Jun 2016 01:21:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F39228483; Fri, 24 Jun 2016 01:21:38 +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 1F10A2847D for ; Fri, 24 Jun 2016 01:21:37 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2D19B266181; Fri, 24 Jun 2016 03:21:36 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 145772660F6; Fri, 24 Jun 2016 03:19:16 +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 9500D2660F6; Fri, 24 Jun 2016 03:19:14 +0200 (CEST) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id 2FFE9265DD3 for ; Fri, 24 Jun 2016 03:17:48 +0200 (CEST) Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 24 Jun 2016 10:17:46 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id C8B264BE76; Fri, 24 Jun 2016 10:17:46 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id C4ADB2806E; Fri, 24 Jun 2016 10:17:46 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id BF2052806D; Fri, 24 Jun 2016 10:17:46 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac2.idc.renesas.com with ESMTP id LAH09454; Fri, 24 Jun 2016 10:17:46 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="214136671" Received: from mail-pu1apc01lp0020.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.20]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 24 Jun 2016 10:17:46 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wEC2ieL/g6IWsMTYYxS7mCWC91QtfwsfYAUp1aSCqHQ=; b=HTVU08iqW+1rFznNkksvc7w18c0nHzEfYG1XzY3RIFrhXoNyfW/V35zlImPe/T6v0NOdl6Po8do0arsNAzSwTlEC4m6F5Uy9GoKr10p/8D9g4N5T6cSEFCMJ5qs+u5Dw5i+7Ep2DEsJtGWtDkTvj6IsSEkufrLg5pC5tmFqVf8Q= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by PS1PR06MB1705.apcprd06.prod.outlook.com (10.167.53.15) with Microsoft SMTP Server (TLS) id 15.1.523.12; Fri, 24 Jun 2016 01:17:44 +0000 Message-ID: <87mvmbxug3.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: <87wplfxumi.wl%kuninori.morimoto.gx@renesas.com> References: <87wplfxumi.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Fri, 24 Jun 2016 01:17:44 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR01CA0028.jpnprd01.prod.outlook.com (10.164.162.138) To PS1PR06MB1705.apcprd06.prod.outlook.com (10.167.53.15) X-MS-Office365-Filtering-Correlation-Id: 409f076a-3d21-48ab-3cd4-08d39bcd58a7 X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1705; 2:Cg/q28X6N7zORcQ1Z8gV753aLBubNe+7MsKxKjlOdnr2HhahWUi4k9eO9Kup3qU4TtCcDG0sez6R9o4SFGWuWjjhHyFrVdNYW6SXCajNL/9m9Keyc+1JJcXmi5C/o4qH+q5byUG4cZPC6va+gfPvmZx//4L73ZYS5UxzTvLQaVpHrnXao+mGPQ+cegxIhouz; 3:kFlllA0e3FiLwjcUJul6GNreFFMW+BCIs7KyloU0btaaydlF5zaEyfJirBWUX4DvIvyjE6g+aWFmit3mAeyIUFFrtRasKqgGUDxZ5JFjMf5chs5wia9iyFxIdUv9WgWl X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:PS1PR06MB1705; X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1705; 25:TpaqoA0DPsaHMiI2WG9QTi6349v1oCk8zjb0vcq06sD+K51isJVrbYX5Z6g3l4QZ+NM5T4npvsYDqYfioev6wxlAvXOuVvwvxMTU3j8nE9ay8BC2e/fKa+qdKMVhSysBoKgaauPgRti8k7inTy9jPD/S/Px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msePBdDYmULj23vAEN1pMW4f1KXhvyDO8uFQ4V1; 4:znZAbI0ZHWj53f/ykgJdfjzKQquQFhKWStXDdTTQjpvkRbx2zQxwgCgwS0lSFKQsPJJQOjZkMLt9widTySIURZqz5Er7W5PS1K86/tRY1s+5SjNt8Nd786tq8nxLCg5W5hk/UlabVVmcPCJOfZ8TmBNXpE0pdZjZ/YUqcPEflnnRMtQuRgpPauQpte0Gv8hGXrIpUd6w0IjXcozJk6DW5IwbTogsExxQgm5koO5fwKy7zWz2K3SjLbslIYCE3Jh4BX3RylJ5XgTyOmMpCxXSkk1qhAJKs5Z6N4rbI6PS7NEogikn5/QhnsmgzsshbyV7u3xmtGzRMJdK1ytv4yAXdeKBZZS1KUfqmJ+vo/u1McADBPet8sG1Qj79qQp/Mdoqlgn+DsiFtTTldImoLxhvwg== 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:PS1PR06MB1705; BCL:0; PCL:0; RULEID:; SRVR:PS1PR06MB1705; X-Forefront-PRVS: 0983EAD6B2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(66066001)(46406003)(189998001)(110136002)(19580405001)(230783001)(47776003)(92566002)(86362001)(4326007)(69596002)(2906002)(19580395003)(7846002)(3846002)(586003)(83506001)(23726003)(50466002)(6116002)(81156014)(8676002)(2950100001)(54356999)(53416004)(50986999)(76176999)(105586002)(97736004)(229853001)(305945005)(36756003)(7736002)(106356001)(77096005)(33646002)(4001350100001)(101416001)(42186005)(68736007)(81166006)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR06MB1705; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; PS1PR06MB1705; 23:1xbivyFrd+DCsLr3gTFrDbggvl0zmUnNEUmWpfHKi?= =?us-ascii?Q?qVrQ83QFd/x2h1olgT+KVVWUv/Cm/mk7++9tnvEPe2quEpMvOeHXXt2CVP99?= =?us-ascii?Q?2fbh1dKu0V8tXjjttTzMPtl5/5IU2MdyYuHzUNo3/a8AQbo9etcsqVP6qZJz?= =?us-ascii?Q?zeBeobok4HhKsSXGYYpF8y36rsiczGwEi65rylsysGgnCAlod/rHwLQQ2ltd?= =?us-ascii?Q?sspQwswNu8ZlsxzVUcJEpgIMLRn8gkOEBf7UQQZcxGdMh+tGY4Ca60VfWk3M?= =?us-ascii?Q?B39feyMAuSbv/LxtJ2RETGau9g5a7rlyyPZ/0MXWwWST4TSPkH647oxWgV5k?= =?us-ascii?Q?UxDYOV0DANrrsAujG+Env308/kwajCBPaeADe3lkJW8P4qqArB37kofA3wHu?= =?us-ascii?Q?f++qqMtMQYhMwCxWnlJiq5k8WdUIiTxqIkl5X/GfFSCGts7qxjpieh3HeEoD?= =?us-ascii?Q?MGwCZA67ik2z8E1geQzLK1wkIK9EbLpTYXRU8IhmLcZKAlqkBb/Q+QVkFOcB?= =?us-ascii?Q?jGaopUPFramqQSjmdMGYcJ5eVak/8xrhWNJt+3ZMYYaQY8bWr44ridPv/ZEX?= =?us-ascii?Q?7KSYe0chDfbvC+SByb6p+IGtzeT5NVxDdGZUJGwh01OoUqzr7Clhj7a/nuIr?= =?us-ascii?Q?fIHATfoV1TB92oQpEO/2YFboWqSFpboeoyz2IVFqONogG94ivZD09g/WCFHZ?= =?us-ascii?Q?T2XX+uAfMiD3Dtl20NnziVb/oyrYg5b7mgAzUrNJ85iFAzFlcQORzGppnN08?= =?us-ascii?Q?T7eXcla/RZj85Vjs23cTAU3MuTUmm3Su0wHl3VgEpEM0w9bsqvLcc+Bvlicu?= =?us-ascii?Q?wmNn8twHFVetRdp8iD2H71FbN2SLNlbHi36tueticgknH4GDeBvTyTHFMQOp?= =?us-ascii?Q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Y=; 7:BPDygVymN195nABsy3mBW5Z7e+4CAt5XjjWu9laAUSFnIHL0P1bYVdqaEL4Kf7LlGPkJGngYwRTPEr6f0ciK/PcWGxVA5iNGdor/HZCowNtQI6I4Xo7zj5ItUrJXNF+iyG24fhvkvHjXJta7YOExN+PgtWV/DTIFCsn6PKoVqtGvoY8rwYhV53EOuCF9YbCwD4NKu96PrGW8Wt0Dn7M+Pw31xM4LcgAOMTZbSPpOeUz4pb3g3I32JykmIxCOAWMg1JF1ySbeYKMByQ4X7LscCA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1705; 20:33rnnPLYbquo096GHcTkJoB+HwTaZ2pL/bbls9kfqL3aYs7ZsxzT8x+bAofsAeCFxFrR4xUO/Hl1WwkqbDZI8TjQA+I9FrgRIV1hE6pVR0RKIl6ikUJdWBT1cJ+5f3Q5PmAm1ETpnGr0403UbFrh4NTL8r+Uu6EmmvOg3Xx1q8g= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2016 01:17:44.3304 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR06MB1705 Cc: linux-renesas-soc@vger.kernel.org, Linux-ALSA , Simon , Liam Girdwood Subject: [alsa-devel] [PATCH 07/11] ASoC: simple-card-utils: add asoc_simple_card_parse_endpoint() 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 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_utils.h | 19 ++++++++++++++++++ sound/soc/generic/simple-card-utils.c | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index b8a8649..1a77d72 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -46,4 +46,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-utils.c b/sound/soc/generic/simple-card-utils.c index dbf4b00..a3d917d 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -172,3 +172,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);