From patchwork Wed Jul 6 01:01:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9215297 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 EA76160752 for ; Wed, 6 Jul 2016 01:08:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D703128544 for ; Wed, 6 Jul 2016 01:08:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBBFC28549; Wed, 6 Jul 2016 01:08:43 +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 31D3128544 for ; Wed, 6 Jul 2016 01:08:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750840AbcGFBIm (ORCPT ); Tue, 5 Jul 2016 21:08:42 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:14819 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750828AbcGFBIl (ORCPT ); Tue, 5 Jul 2016 21:08:41 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 06 Jul 2016 10:08:39 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id C8CCA4410F; Wed, 6 Jul 2016 10:08:39 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id C9503480A4; Wed, 6 Jul 2016 10:08:39 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id C2664480A3; Wed, 6 Jul 2016 10:08:39 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac4.idc.renesas.com with ESMTP id LAA20687; Wed, 6 Jul 2016 10:08:39 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="214963370" Received: from mail-sg2apc01lp0245.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.245]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 06 Jul 2016 10:08:38 +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=wvlbE7cJD7I0tt0RJdFoav0wWylz9TcgFReAlAk7SBM=; b=aGJND95wKDIzRnE+rFfY4dmCexsGG+OeciybAIpCmhkmzfGUisIus/jiPuFsvgR7L5QH5r1/Nud1czu4WNTNc1/t2Khu/4Y/2zDeCag/PNPtttUbf4zGnfYDAq52QBMHdNDZmhwOP/wqA4bdgsDUg0rsloH0uAsNU/0EJN+woWE= 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.534.14; Wed, 6 Jul 2016 01:08:35 +0000 Date: Wed, 6 Jul 2016 10:01:27 +0900 Message-ID: <87y45flguw.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 1/7] ASoC: simple-card-utils: add asoc_simple_card_set_dailink_name() User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown , Liam Girdwood CC: Linux-ALSA , Simon , In-Reply-To: <87zipvlgyf.wl%kuninori.morimoto.gx@renesas.com> References: <87zipvlgyf.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR06CA0040.apcprd06.prod.outlook.com (10.164.91.50) To PS1PR06MB1705.apcprd06.prod.outlook.com (10.167.53.15) X-MS-Office365-Filtering-Correlation-Id: 7412d06f-b7ea-4545-7b7a-08d3a53a0e54 X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1705; 2:qQMo+bYIuZazkpDORd5Z6EByQ8H1ctAaguyxXN4K58og3CgZAXSjLERt9UsIRHPHWt3J1oCT0+TujCC2dm1YLXdDH1HQY1LDEClNIVp/jp3I4hjjexjcDm6/rYuKo+I3t4BvQr1ZmWQGj7jhBqt2oS6hdf2LxjCJQXMmD0Y23SFT4puxMiR/QLzn1MYka7Ir; 3:I/7wYeSUnJetSBNPpptfrq+ZVQC1KwymeKMV51oGCc4shU2XmiFaOxDo7pedbHn5toIo6QeZJ5tHnVtoV8NfQJBwioq14jmQn18Neft/Zvz+wFGGv3lKv0uGe9mTyAjQ; 25:ttCzfuAtB5NX7XUaXFQd0TE+oBjYTuL3t4WQ0qdfTGZ4TsEhWqZE64ULB9cf2oVNtmTD3lmkI22/C1gj4VsXv0WMwalGHpqL+wVFLZPndxGeKJm9Ax7yoD+y7xU27RJsMfa8ujw4CC4fuSx0pVqmVvu2wyQPEPLEOQnXOHecHPtHorFuGsMiKllHOBfqLCXZeioTIsJl3uYvYVoTLcKf06MbkBcJQfmg2xQ8izzCBsebw3YfkgGVWI73pob93akRDdCgETSnYEKSJKZjDyJgsWDBADX4HGLGUrBhfl/+Utu5XqtwfufjRKhuJo9Uop/3LUe9bJnMxqPDhZ9+zZkSzvT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plfR+v7qfsF/QjW2oLKEF4jPiupJ61Nz8UE7mjLEGTuqyAZRr7WQV/LvHaptIecXXlEnpfi6O16ptAHFc5i+hlsNzozo1Fb/93oIqhwVyQxgpF5drczrW19v6YWXXnDmP1SyKX5Vbjn/A1ksZnRDS9cwmuwJpI7SLqD2u1A/nI6hode+GjTBRERArLiajTQ/oQhxqjXzmwNgzkyf5KDDSKJJly0Nce6U2JDXshI259w== 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: 0995196AA2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(53416004)(4001350100001)(2950100001)(42186005)(81166006)(81156014)(66066001)(230783001)(106356001)(54356999)(47776003)(586003)(97736004)(101416001)(8676002)(5001770100001)(36756003)(189998001)(7846002)(33646002)(92566002)(68736007)(229853001)(4326007)(7736002)(2906002)(305945005)(105586002)(46406003)(83506001)(77096005)(69596002)(3846002)(6116002)(19580395003)(76176999)(50986999)(50466002)(23726003)(19580405001)(86362001)(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:10ECURgwIpz0Q+mSfRvmeYhiorzxIbeq4bnqBuPkY?= =?us-ascii?Q?qXZ970vXEWOL90TzkD4Vi46r+zdS1FoN7V+prOArce7b7ddmPwotZ7SDBBO8?= =?us-ascii?Q?Bk9Mq3sWIfxXYphW1M2A+8Am96MZI21Qw/PHbv9ZN3/Yhys8qS7+GmHqElLX?= =?us-ascii?Q?omTJB/tGh8I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f26lBQSMJxmMGDdEEdZymqEVYyGA3 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1705; 20:b9sEmeZQBpflfOwJOoUewZL81bTLFEyFMT9gO/ZkipJ8yBtWLXBzeQcDe5ydENBi7mKcGINQ0qlNw1ZVFfb1Lr20biqzgPP8RtuEmcovnxTfEfcLaPQJ60Qd//YbYUS0K3HayzuTBu3XLrTXeCMVuvV/7cclAUqxHztLZ4theG0= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2016 01:08:35.2352 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR06MB1705 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, or "fe.CPU" or "be.Codec" if it was DPCM. This patch adds asoc_simple_card_set_dailink_name() and set dailink name as common method. Signed-off-by: Kuninori Morimoto --- previous -> this - asoc_simple_card_set_dailink_name() doen't include DPCM specific naming include/sound/simple_card_utils.h | 3 +++ sound/soc/generic/simple-card-utils.c | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 50aa7b2..b88a8dc 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -27,5 +27,8 @@ int asoc_simple_card_parse_daifmt(struct device *dev, struct device_node *codec, char *prefix, unsigned int *retfmt); +int asoc_simple_card_set_dailink_name(struct device *dev, + struct snd_soc_dai_link *dai_link, + const char *fmt, ...); #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..7f9014e 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -52,3 +52,26 @@ int asoc_simple_card_parse_daifmt(struct device *dev, return 0; } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_daifmt); + +int asoc_simple_card_set_dailink_name(struct device *dev, + struct snd_soc_dai_link *dai_link, + const char *fmt, ...) +{ + va_list ap; + char *name = NULL; + int ret = -ENOMEM; + + va_start(ap, fmt); + name = devm_kvasprintf(dev, GFP_KERNEL, fmt, ap); + va_end(ap); + + if (name) { + ret = 0; + + dai_link->name = + dai_link->stream_name = name; + } + + return ret; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_set_dailink_name);