From patchwork Mon Aug 8 06:01: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: 9266717 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 81B1C60839 for ; Mon, 8 Aug 2016 06:03:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71B9626E8A for ; Mon, 8 Aug 2016 06:03:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66726277D9; Mon, 8 Aug 2016 06:03:32 +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 6FC3526E8A for ; Mon, 8 Aug 2016 06:03:31 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id B5F2E266667; Mon, 8 Aug 2016 08:03:30 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 25E212665E4; Mon, 8 Aug 2016 08:02:28 +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 690232665E5; Mon, 8 Aug 2016 08:02:27 +0200 (CEST) Received: from relmlie4.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa0.perex.cz (Postfix) with ESMTP id CBA562612CC for ; Mon, 8 Aug 2016 08:01:48 +0200 (CEST) Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie4.idc.renesas.com with ESMTP; 08 Aug 2016 15:01:47 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 7799443789; Mon, 8 Aug 2016 15:01:47 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id 5B90C480A4; Mon, 8 Aug 2016 15:01:47 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id 543AC48014; Mon, 8 Aug 2016 15:01:47 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac4.idc.renesas.com with ESMTP id RAC09049; Mon, 8 Aug 2016 15:01:47 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'208";a="216920741" Received: from mail-hk2apc01lp0212.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.212]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 08 Aug 2016 15:01: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=X7J+YX5JYV0wsmEDz04Hun7cpJvJLhW21TJGtzadZR8=; b=AF2NWLeowTftsW2T9aM5EJPC7GKh9E5oznQ/3F3Weq3J6gImD87/5+PvvVQRhoUeeuvM7KGyn9SXin3gZypIdf3TuGAqpDkBushOpFs+gFXIQYE8RdeYivYbPXkA056wCp1ZnnwN3mFJ5nc7GAK+CrWf+IXcxwNG5xiNhvcr8fg= 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 HK2PR0601MB1442.apcprd06.prod.outlook.com (10.165.182.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.15; Mon, 8 Aug 2016 06:01:43 +0000 Message-ID: <8737mfajrk.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Mark Brown In-Reply-To: <878tw7ajwu.wl%kuninori.morimoto.gx@renesas.com> References: <878tw7ajwu.wl%kuninori.morimoto.gx@renesas.com> Date: Mon, 8 Aug 2016 06:01:43 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR01CA0082.jpnprd01.prod.outlook.com (10.167.153.170) To HK2PR0601MB1442.apcprd06.prod.outlook.com (10.165.182.148) X-MS-Office365-Filtering-Correlation-Id: 74e86537-2c97-4f06-be18-08d3bf51798b X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1442; 2:Qr2AWfIKRFOiFWnrm/y9bMBejOHu512MbamTEHnqd2W0mk6UJW36VZkYhuwZZyX4+5OvjJTQWIpo9iGW30N+QtqaDPnKERMRlbVNnSkZeNSS5KwUXRjY78MN+/Vc/flhtv1oF9Ii6i9T0fNBCHG8RvmLHD4W+ek8azUC/6qR8esdfyXCAndgzGLhnBr1/rJP; 3:vB6J9wA4nNrM83WFdujXctXDhacxsqDnHT6Z6CO2zi8nj3eTU0uIIQ7BtwDvf0r3syAwIrPn9qNTvJNEGGxY6au9vY7MkikEN51O7Mf2XQy5h5P/G3R8p2qtO3bi0PYt; 25:XHcnki9VxNrzCUL0sOIBXi58UKgSCuxcJxMqhVfAcJqPz6q1CQgPMuxzlUJyLM9gAP8TucHtm9tgpS9phIZ+Dnz90Hh/nGusoLCsJFyGGDbLUhVtHVTm1wu6rDQw+JE1RMJPbTKzLg9HoER20nxvgL+nVfQc5naOIUN0AWZry7SiIrCljgRCJB/DDD6Q9Z3WTUF4BbW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iLSQ 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:HK2PR0601MB1442; BCL:0; PCL:0; RULEID:; SRVR:HK2PR0601MB1442; X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1442; 4:l7TXxnGOLSXNmcsRZyyhHl7jrYX5VWXpyuYbKiJnTRCvf2tMEbzIexByxZvGMa0M4cbWjACVJl6mxfhVIXD+6Wc5oZTdllcOIsjPy+v+2JcFIBCt2unCvPYdR6VEaj6j+osT16X0AjifE8ycpc+W1ORhcZqcJD66QHY5nM7HfDOfeOsj/l2V1wAJ7PvkMI4D6UZsbA/DZZtP4jRso8WDMhtPua3/TMPeqesOCuDSfY907eSJ1LkDOuK+CGOnx1LQj5urbHW52t4FEoZYQUtdBSjKHc9Sx9J1pxExVQ3wF9YnANlSjRBHfB8AsBYtL0JdgnfCFM5322SOl7yAFIKZxz0QC5bkIaHlRiEom2TY/P7wYXaLFrJBoK965QxQBwe4Jfd89M5x9SKDA6+AokAKqQ== X-Forefront-PRVS: 00286C0CA6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(69596002)(7846002)(230783001)(92566002)(2906002)(83506001)(305945005)(54356999)(86362001)(46406003)(76176999)(19580395003)(97736004)(7736002)(42186005)(4001350100001)(19580405001)(53416004)(4326007)(50986999)(77096005)(2950100001)(8676002)(66066001)(229853001)(36756003)(23726003)(110136002)(47776003)(586003)(3846002)(50466002)(101416001)(6116002)(105586002)(106356001)(189998001)(33646002)(68736007)(81166006)(81156014)(21314002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR0601MB1442; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1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R44Tq+l7mVeavM3E65JbsY=; 7:U/bOUInlOn//mF3e6nYf0fIiZ5YpSxzj5aQLI+qXJ/1C4XXy32gj2yQ3G2uOko9EBRMs8v0CP1cXApqlFW4ItI5RB0LYrxrLIyK0ZUtwDJRh1U2dkJwPYFBJMjniueulyyS05l4jwUkaeXQ5RWrV4rmcAYLO1Y4dLs5hDdNg6Hr8oj0e31lwrFz8XwP2r8VaGHf4Fm5B/iwqIvbuidNjruSEpkYgJPX7X2U5b65oFLXoXcq8ARoSAyepZoe1nEUS SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HK2PR0601MB1442; 20:XqKVSGWuePtH1qbzx+FeDxc1u3QMr68w+EwC94c0cdRjutliikk2iFlfMGpYozZ0zxJhq9smeQs86cmHyd80LMP6PO3Bs8nAzpaoDkM3TBTKLjynHH8sR65ze9moSn8R0hPIz4ogLe4vZftF5bhYA3OcnHYBo4NVIZRZTdwta5k= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2016 06:01:43.7255 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR0601MB1442 Cc: linux-renesas-soc@vger.kernel.org, Linux-ALSA , Simon , Liam Girdwood Subject: [alsa-devel] [PATCH 4/7][REBASE] ASoC: simple-card-utils: add asoc_simple_card_parse_dai() 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 --- based on fix/simple branch include/sound/simple_card_utils.h | 17 ++++++++++++++++ sound/soc/generic/simple-card-utils.c | 37 +++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 1392eb5..62b3926 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -41,4 +41,21 @@ int asoc_simple_card_parse_clk(struct device_node *node, struct device_node *dai_of_node, struct asoc_simple_dai *simple_dai); +#define asoc_simple_card_parse_cpu(node, dai_link, \ + list_name, cells_name, is_single_link) \ + asoc_simple_card_parse_dai(node, &dai_link->cpu_of_node, \ + &dai_link->cpu_dai_name, list_name, cells_name, is_single_link) +#define asoc_simple_card_parse_codec(node, dai_link, list_name, cells_name) \ + asoc_simple_card_parse_dai(node, &dai_link->codec_of_node, \ + &dai_link->codec_dai_name, list_name, cells_name, NULL) +#define asoc_simple_card_parse_platform(node, dai_link, list_name, cells_name) \ + asoc_simple_card_parse_dai(node, &dai_link->platform_of_node, \ + NULL, list_name, cells_name, NULL) +int asoc_simple_card_parse_dai(struct device_node *node, + 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 16f65f9..27e6d03 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -127,6 +127,43 @@ int asoc_simple_card_parse_clk(struct device_node *node, } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_clk); +int asoc_simple_card_parse_dai(struct device_node *node, + struct device_node **dai_of_node, + const char **dai_name, + const char *list_name, + const char *cells_name, + int *is_single_link) +{ + struct of_phandle_args args; + int ret; + + if (!node) + 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(node, list_name, cells_name, 0, &args); + if (ret) + return ret; + + /* Get dai->name */ + if (dai_name) { + ret = snd_soc_of_get_dai_name(node, dai_name); + if (ret < 0) + return ret; + } + + *dai_of_node = args.np; + + if (is_single_link) + *is_single_link = !args.args_count; + + return 0; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dai); + /* Module information */ MODULE_AUTHOR("Kuninori Morimoto "); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");