From patchwork Fri May 20 09:44:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9129037 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 9EC4060762 for ; Fri, 20 May 2016 09:44:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9094120265 for ; Fri, 20 May 2016 09:44:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 848E4279C4; Fri, 20 May 2016 09:44:23 +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 EC12120265 for ; Fri, 20 May 2016 09:44:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754524AbcETJoK (ORCPT ); Fri, 20 May 2016 05:44:10 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:21052 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751199AbcETJoH (ORCPT ); Fri, 20 May 2016 05:44:07 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 20 May 2016 18:44:05 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id A9AC643E5C; Fri, 20 May 2016 18:44:05 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 8C48B8002E; Fri, 20 May 2016 18:44:05 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 67E138002D; Fri, 20 May 2016 18:44:05 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac1.idc.renesas.com with ESMTP id UAK08871; Fri, 20 May 2016 18:44:05 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="211713524" Received: from mail-hk2apc01lp0216.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.216]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 20 May 2016 18:44:04 +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=FC/GEROjGPw9HUAWKfM2eij0uhPENAWtlrevpQJcXCw=; b=mY4ixNxasJTWQ/K6FzhJWC+O4bkwEvZ5Vhxku+H0tsjCt4CEo/dE1bXySvmx/8/f3af17R9AOMrlpbYpImNqbI9rMdDW0BjwfALxiwSoeNQlpq5MfnIiH1UwXT+CfjtwUnisYaT59RFSxmhVK/g6fQuXXNdbgjp4FRRf539HmbQ= 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 PS1PR06MB1705.apcprd06.prod.outlook.com (10.167.53.15) with Microsoft SMTP Server (TLS) id 15.1.501.7; Fri, 20 May 2016 09:44:03 +0000 Message-ID: <87bn41rrwx.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 07/49] ASoC: simple-card-core: 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: <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:44:03 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR01CA0048.jpnprd01.prod.outlook.com (10.164.162.158) To PS1PR06MB1705.apcprd06.prod.outlook.com (10.167.53.15) X-MS-Office365-Filtering-Correlation-Id: 74e1883e-d5d5-4372-385e-08d380934752 X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1705; 2:KRz/nGimDFUFGKgit2GmT4QIgvABv7Jx9DM++MO8AcUjQddFFpR07hv6lltbbFRpD+hd21Y7vW++XxBl/zXLf7L7QjyETwzUtRXx7fYqQ2W3gb2gf1hdXaXl915gUTMau44v28djAOvLr4dGYvSkubQm+huPKhbnGUVQyKPu8qIrW8qbhiXkf+JeeOpfDWiv; 3:JIYNKoicr1C35q/iApjzTeP6HP4t4Z3yV+y4JUbj5r1qdi9401rKo2gPvadXu+wJnCW2IPoc10pimhNbFY/GCPS04egbFJGYa5DKZMeUujbqHO+W7WIu48L0GPDtn2T+; 25:/DPwCOCcuwFQzzbBNWO43safbmq982LLr+X2I2FG19ifi81IX+4hHBff9nW3sUIBffr0/acIOROk//T1a6SFBPzKvCN9kcXfbW/s5H8A6T45EGSn6MQ4+hXC3VGCIrsaYV1i9XIO4MiZ6Kg/YQt6w+IgLYa9VX1WjsOvZadO0U/5DP1ZiDQDyqDTkwkhGTG8/TGNcYaKN5umaiyS3dLhfRMOnArHAi5sjzAaXZwvLKVVVRHabiCRDs+/1uCPl1M/qx7PWMF43Kz0azbPjyYk4P300PD6ZmqSHtoVy98o6kqp7LgmtPWKgJyfgTGsMJ54S0CSjCC+7I/ubbowNnvuqjsVpFMDsaTVZ836cpYxY+HGlD8ExqoOroUssi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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:PS1PR06MB1705; BCL:0; PCL:0; RULEID:; SRVR:PS1PR06MB1705; X-Forefront-PRVS: 09480768F8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(46406003)(4326007)(5004730100002)(5008740100001)(229853001)(83506001)(33646002)(23726003)(2906002)(3846002)(6116002)(50466002)(586003)(230783001)(66066001)(47776003)(36756003)(2950100001)(81166006)(53416004)(8676002)(77096005)(42186005)(110136002)(189998001)(92566002)(86362001)(19580405001)(19580395003)(54356999)(76176999)(50986999)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR06MB1705; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1705; 23:tzGDUkQ7l/Y/bqBKafv53u1SvRFE7PYkpqmp0koswvJZJ4A8JZh7DVUMQjnXD7HPqvtNqBUUYAcIAndWC/j5zQvpTsRs+KiGCC8lAQTyE7RjoTYvzg1g29FwFNoF4yqQAqjrLdxDnoLGirj+fH1CXNNWF1oXNYT5D5OYI/LI1194C0bRn/UBMs6794r2Wyt0SZ8Qvg65lFOTH7S6LXEZiAdaqhxqQkO0e3t8xP5cf5iKRlXISN4fDsAGbnRLOe1tJ7peulW11cZA8ZtxiSZDgXEElFnFIrKHNbBp8OXejpkIWWeCkn+RPtjb4aKRquPk1bUIjv/SeJRdh+ZqYORl69l1fVKQPUDZLEGQzKSxRg0CvkmiDD1S5fBj215oO7p7QSY/ASgRh8XF3r/xtXrKhfwhJBYiq27StoyBBf4hEVRS96pYEtYY3Qt67QiOFvv3ejBZk6L8GKGx20keLqI/QDQ9/2t8jF0eZZoY+NN9Hu4J+JMOFjiRq9+72OQ428JRjMO1hlBeHOKMsj2aTUKqkFV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= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2016 09:44:03.0896 (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. It can be "fe.CPU" or "be.Codec" if it was DPCM. This patch makes this method simple style standard. Signed-off-by: Kuninori Morimoto --- include/sound/simple_card_core.h | 2 ++ sound/soc/generic/simple-card-core.c | 42 ++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h index 6bb2c5f..41e567b 100644 --- a/include/sound/simple_card_core.h +++ b/include/sound/simple_card_core.h @@ -29,5 +29,7 @@ int asoc_simple_card_parse_daifmt(struct device *dev, unsigned int *retfmt); int asoc_simple_card_parse_tdm(struct device_node *port_np, struct asoc_simple_dai *simple_dai); +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-core.c b/sound/soc/generic/simple-card-core.c index e3536f4..51ed96e 100644 --- a/sound/soc/generic/simple-card-core.c +++ b/sound/soc/generic/simple-card-core.c @@ -63,3 +63,45 @@ int asoc_simple_card_parse_tdm(struct device_node *port_np, &simple_dai->slot_width); } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_tdm); + +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_kzalloc(dev, + strlen(dai_link->cpu_dai_name) + 4, + GFP_KERNEL); + if (name) + sprintf(name, "fe.%s", dai_link->cpu_dai_name); + + } else if (dai_link->no_pcm && dai_link->codec_dai_name) { + name = devm_kzalloc(dev, + strlen(dai_link->codec_dai_name) + 4, + GFP_KERNEL); + if (name) + sprintf(name, "be.%s", dai_link->codec_dai_name); + } else if (dai_link->cpu_dai_name && dai_link->codec_dai_name) { + name = devm_kzalloc(dev, + strlen(dai_link->cpu_dai_name) + + strlen(dai_link->codec_dai_name) + 2, + GFP_KERNEL); + if (name) { + sprintf(name, "%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);