From patchwork Thu Jun 30 06:03: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: 9206655 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 7411D607D6 for ; Thu, 30 Jun 2016 06:03:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65B51285B7 for ; Thu, 30 Jun 2016 06:03:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A02C2865A; Thu, 30 Jun 2016 06:03: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 E8657285B7 for ; Thu, 30 Jun 2016 06:03:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751441AbcF3GDs (ORCPT ); Thu, 30 Jun 2016 02:03:48 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:41424 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751383AbcF3GDr (ORCPT ); Thu, 30 Jun 2016 02:03:47 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie1.idc.renesas.com with ESMTP; 30 Jun 2016 15:03:46 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 300464B637; Thu, 30 Jun 2016 15:03:46 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 34C8E2806E; Thu, 30 Jun 2016 15:03:46 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 2F1042806D; Thu, 30 Jun 2016 15:03:46 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac2.idc.renesas.com with ESMTP id RAD03165; Thu, 30 Jun 2016 15:03:46 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="214096219" Received: from mail-hk2apc01lp0214.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.214]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 30 Jun 2016 15:03:45 +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=1VJfxZvmk8bn72KhH+1vdQQ7+tt/fz8+PhEVnn5dBC8=; b=IjD+zlAgROOu7cOSidXwRn1622G1pOzMKu2AJ8c0TxX6ITMus1Pfc1xbmVaAk+8u96uSpzbAYj7oS84WTAxDQY86RPZUG2lX4QACTuAXDngYUHZB1h1nsd0KTqz8vvfZY9Ep6RJM0I7tTcmqUDJCZLKI6V9Hp1oqh2aBLaR++aw= 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 PS1PR06MB1708.apcprd06.prod.outlook.com (10.167.53.18) with Microsoft SMTP Server (TLS) id 15.1.528.16; Thu, 30 Jun 2016 06:03:43 +0000 Message-ID: <87shvv9q3q.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 3/6] ASoC: simple-card-utils: add asoc_simple_card_parse_dailink_name() User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown CC: Linux-ALSA , Liam Girdwood , Simon , In-Reply-To: <87wpl79q79.wl%kuninori.morimoto.gx@renesas.com> References: <87wpl79q79.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Thu, 30 Jun 2016 06:03:43 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS2PR01CA0018.jpnprd01.prod.outlook.com (10.161.74.156) To PS1PR06MB1708.apcprd06.prod.outlook.com (10.167.53.18) X-MS-Office365-Filtering-Correlation-Id: 5e05620f-93af-4e97-1260-08d3a0ac4ab0 X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1708; 2:8gLby6ixcg5c9s6JDG2RCkPr/boJ6lNQXQ5lXPTci+tUkalojBNoZYYSxo1BXnACmrQv0IoZtU3cQrQMF+9HKGtQL5B/Df/MTKW6H3+Vm+vlWRPso9rPrh4CafU9JiCftjzBTSYyhE6lGxIMyD81JQb5wxj+3z6KGfgwWo+biZmNMXY3lndYT6AX1Qn58SYX; 3:ygZRkolMacq86CswrAj6A1EIaSP0clylMcC60DD5TrDLiJ17jJ39pNz4U2qK8szGPiy0nmGDsE8kyB3oJFEQXKar/6Jfn7iN65TXUATedGyAdTC+HPjU/43qYUujkkR6 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:PS1PR06MB1708; X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1708; 25:6c8w0ed6bcnHIf/eAsoD/pA4L39b3sLvVo2Ww2GnKpzxBmUt4mhtURbYEXYaj/YnzfbdE640LmsUEDbpbrS45tbHX3cJ7L/8trMtJXUFxmmAmqJLBKpobhLSlZf8/AZ2nk+wQx4wabSNDU6Rht1CrMbPL3XcA9ejmUZ23205kzRo4PMuc8ZJvAvEvAUDTjy0tR6FnYR/wvI3ZWeZ22xXtmVmUz/BNBDIgbkjq+CkB/Bs0D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ynq/plVEgXi6JyVeus8OVMJlBsEMYyvG1xb1SWNqKcPlDQZzvEbjAcqS+Elr4axcBMDrxmENmx4YFCs51gASo9mecVzVYBcuGGZW0w2LX7n3S5nfTH0wxH5n9G/ryeHLGXmTgqv5Ihsj2AjGBrlk4xZjVcggF4We9Hic/3kZichoJjlkVtbTBY; 4:7Wgk2nuo+e8D/Uju/ixmHxvfFUbnNwnoyFK3ch+dZ3RnX5xJcV+ktUmBVfZfB+VPzTh6/TvmH2uGRK2avqM/neXHHF4U0lj7UUDQeL1ckYpLMGWfDqJlmkNUWEEFo84B9J6/LvnEpmGf2hJkS00I3709zp3tTf7/0DmjV1a6/LUuWocMGV0lln4EF/5HPAAXHJ+/cJ8PuXTy9GNTidbmsJIu5jWmxb7zmI0XdbNFahzPI5GAN6ehfjaF3p/T51lBZM/7ieZJFxdVVbbeKbBCtt8zAKXMa6OLdWX5EpLa8Wt7HtWx5lg1juXi+AZlgLbyHiAN/YvtQl+7+FZ0waTMEiHEGCV3LdB8Q1lCOVouj6rD7m6Y5y0eHQOs4+5ztYePO6fbEYaOg+iRjoIrBA4kLA== 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)(10201501046)(3002001)(6055026); SRVR:PS1PR06MB1708; BCL:0; PCL:0; RULEID:; SRVR:PS1PR06MB1708; X-Forefront-PRVS: 0989A7979C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(36756003)(305945005)(189998001)(7846002)(110136002)(4001350100001)(97736004)(101416001)(7736002)(2906002)(106356001)(92566002)(83506001)(105586002)(4326007)(81156014)(81166006)(76176999)(69596002)(229853001)(54356999)(50986999)(23726003)(8676002)(46406003)(230783001)(6116002)(77096005)(3846002)(586003)(53416004)(19580405001)(19580395003)(33646002)(50466002)(42186005)(47776003)(68736007)(2950100001)(66066001)(86362001)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR06MB1708; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; PS1PR06MB1708; 23:ulr1QN12FNI6FlxdeHJlM1Zb2zJDaY1ZzhsNx2gKS?= =?us-ascii?Q?Rcm0haSEP3ErqFtWXcbgOUksOuMttHXNInVu+dbXU/WhqeyWFXdEBtO4yfZp?= =?us-ascii?Q?EN9gqUuc+9JkCMLArYm5c2y24uczBKPxmA2GYh2pFNLmZqiiAFx7rYy68Fkn?= =?us-ascii?Q?E0Iw5hk8jMd+JBJmBwLxXHQ5NuOh+HepABVVwC17v9XxvqTaYvSXhFa+UGIV?= =?us-ascii?Q?TDn53n/dmqjT9g+rVgVK0mfWbYTWtjSDTwSCflAlXywxeN0l01y4kVqBbGPe?= =?us-ascii?Q?dxWLTrvdsYVOYdIFea2KG212LUepcW8zmT2+9KL2dhfsRPGFhj9HS5MjfX23?= =?us-ascii?Q?Ofhb5cag8tlLmsFYW862GQofBjFYwMt2gjowuQVrGwYMuQwcDFk9Hk9OCUn5?= =?us-ascii?Q?7vZf7e+WtEa8McM5s6UU5Sc62dNF5IA1WhUm9A2w1zsRmE6VEzOItVHIJiuT?= =?us-ascii?Q?WIW4e/3tJoduAl82OaMqF5u21cXB5/BVQXW17LVIm7ihQOtcmrWbKU0+7fWN?= =?us-ascii?Q?btDxtTJPKxkW1XI7u6kuAuDdEVyTJszUfTdfwOn3HtWLEEZpkWltSY9FNEjR?= =?us-ascii?Q?dMx/RiVefoF2+Z/bWcZE/iex9cNIt/jGb0gycaOVghv7QEMbhWpVbl7Df+/Q?= =?us-ascii?Q?qN0zF5yDPw6LT+qsH8rrI8zqvGYEkimOxq8wrb5TrlCyJ3/I95PuDw4+lst0?= =?us-ascii?Q?/ThFCbP9B63aD/aODtdxCGjtZ/eM+09xliB9CcQbJMu7X8qgJG05poG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IKLNw==; 24:Oeb2ecMRYe96US20sd6f2YYl31hILipgWUglFr0Re7fYyFf57JQ/kyMRgbiQSf/UPW04lkUTn1uI2ZnUf9dq1uwqM0hqMek2iCAQeKLf5NI=; 7:QGRApJ27Ersra20IvhYhoYJpKh0LAMlAtsyht1Vfs4rsgF3mEW5trNXe3rPSreKP1eNSCxa6i0pVYCd1Qs7BuczGvTfJop2l9CM4ZLVXI/5KQ5pfVaaiBRZVkROj9Rt5gKA0WMq/p/0930enXhEL8gj7aomVCJugK5znteY2ZiFe7aG0XYoeMrxuZUwbmQ3iJWs+EklJZRY2k+e/qLpLrhF9pSyuiDXiheOwQdlMAZMKRTiAjuj/cIfnPStCpyGe SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1708; 20:W3YZ1tyJZxG2Nxamg6I2RUwtWILytQ/WHki56UApeROriDUe0fVZ005Wco0rK1rZWRSSTJWYZKgiJkhbks2ySC0sqjyAJAAgmDm3srB8xmVqPmoSPFdgQhflu7A3Ls+xD7cREboU3XAYjgK1JobAREnMkDt5MRuUS1cqwkmP32c= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2016 06:03:43.2449 (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 Current simple-card is creating dai_link->name / dai_link->stream_name. These are based on CPU + Codec name. It can be "fe.CPU" or "be.Codec" if it was DPCM. This patch adds simple card common function for it. Signed-off-by: Kuninori Morimoto --- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 50aa7b2..3abe224 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -27,5 +27,7 @@ int asoc_simple_card_parse_daifmt(struct device *dev, struct device_node *codec, char *prefix, unsigned int *retfmt); +int asoc_simple_card_parse_dailink_name(struct device *dev, + struct snd_soc_dai_link *dai_link); #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 3f6b725..14d3a75 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -52,3 +52,33 @@ int asoc_simple_card_parse_daifmt(struct device *dev, return 0; } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_daifmt); + +int asoc_simple_card_parse_dailink_name(struct device *dev, + struct snd_soc_dai_link *dai_link) +{ + char *name = NULL; + int ret = -ENOMEM; + + if (dai_link->dynamic && dai_link->cpu_dai_name) + name = devm_kasprintf(dev, GFP_KERNEL, + "fe.%s", dai_link->cpu_dai_name); + + else if (dai_link->no_pcm && dai_link->codec_dai_name) + name = devm_kasprintf(dev, GFP_KERNEL, + "be.%s", dai_link->codec_dai_name); + else if (dai_link->cpu_dai_name && dai_link->codec_dai_name) + name = devm_kasprintf(dev, GFP_KERNEL, + "%s-%s", + dai_link->cpu_dai_name, + dai_link->codec_dai_name); + + if (name) { + ret = 0; + + dai_link->name = + dai_link->stream_name = name; + } + + return ret; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dailink_name);