From patchwork Tue May 31 09:03:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9143869 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 C9A2060757 for ; Tue, 31 May 2016 09:03:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDE0428185 for ; Tue, 31 May 2016 09:03:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2A4727BF1; Tue, 31 May 2016 09:03:34 +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 8BEBA27BF1 for ; Tue, 31 May 2016 09:03:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756751AbcEaJDd (ORCPT ); Tue, 31 May 2016 05:03:33 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:15814 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756452AbcEaJDb (ORCPT ); Tue, 31 May 2016 05:03:31 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie3.idc.renesas.com with ESMTP; 31 May 2016 18:03:29 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id C5C283BFA5; Tue, 31 May 2016 18:03:29 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id C3D248002E; Tue, 31 May 2016 18:03:29 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id BEA0B8002D; Tue, 31 May 2016 18:03:29 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac1.idc.renesas.com with ESMTP id UAS01714; Tue, 31 May 2016 18:03:29 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="212431825" Received: from mail-pu1apc01lp0023.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.23]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 31 May 2016 18:03:28 +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=zjE7sTqaiaQvyXizb7JLE/XIxjTFfthyjJX2LhXLpnI=; b=AOL6hTJHaRQDkwio9qKZvouw5Irt6OoiUySe5jkTpIlXiSWtaJtnsSLtNjhyxVLNl16dz5Y8LFntW+o1g830Vo1W3ofEqw0G35zwlEwYXzJkkdaqIeheeUDBHPt+vOIrkuou8alRbA0+zgXclJdMu3+paN6u4iY4J8pmUq4+lqk= 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 SG2PR06MB1712.apcprd06.prod.outlook.com (10.167.82.142) with Microsoft SMTP Server (TLS) id 15.1.506.9; Tue, 31 May 2016 09:03:26 +0000 Message-ID: <87zir6r4f6.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 11/39 v2] ASoC: simple-card-utils: add asoc_simple_card_init_dai() User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown CC: Linux-ALSA , Liam Girdwood , Simon , In-Reply-To: <87fusysjam.wl%kuninori.morimoto.gx@renesas.com> References: <87fusysjam.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Tue, 31 May 2016 09:03:26 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: KAWPR01CA0040.jpnprd01.prod.outlook.com (10.165.48.150) To SG2PR06MB1712.apcprd06.prod.outlook.com (10.167.82.142) X-MS-Office365-Filtering-Correlation-Id: c1114065-84de-495b-bc55-08d389326dce X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1712; 2:yB4iljHydCmth8TKTLu1ZQudqrLL+Oi60Idc78lUBCHH0X8gx7KVZ5F+h23tdJjbdUya5wydyh/MceGMvngYiowRugm7L5743KVP412NXcd16WVCqMywnBugW985mqhSjsyAOEhS7tgPJ5kLsxzEFfWvabu8t8P3C5ClD8CKMuXLT2jLA/HqPBQv+eBDbxW2; 3:W4hWnTlYNB0veY6WNqhn1B2pSbwlo768yVXhtC3/4AILMrE9q+96MnFfjpO6PmyvcR5dcEhs6XKXxBI7wi71bJb0Wk9jCGsDxbcm87Zz8QROGRmhFvDj5TXOgUK6XOb+ X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SG2PR06MB1712; X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1712; 25:IyVH1+MDwzz2uSrG3Y6RzX6PVc3f4C2xfKIhiy0+pkvVHBCNKk882ly7er6mIBa6gouShGCo1uxulk8f6b+2oAYUWP9mQ04qdsn42uoCgy5FUVgG0IdkjBsa0Cqpp2aNC3qRb0nFziaCkq9UeRXgpBc3LKyUizLL092gnP3Elozh7JJUR2LYjr6UHS2ZIb4oOKvGvctxpXHLwqqgsdCioHuhDEwSkKkSwdQSo2zQtbsjUwiIirKGV4oZsPCDaUbQxvD3pUdeeJW1bSjGXKtQlDGJWTG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UJi+MzY8liMA4MFPAmVzB0Gt0R+UG76kwi2o+86gbsMf0QLk1GO+Vn02eUm1xj7kfT/qVliEWP6pQtig4yfPwVsxzRuFw5ro4PjDn0ArBeM0RsxRd/fZ8uS3BmE6HjCicxA2qxiH67/Jn0SUS93H25VsW/0S8MR7LgFy+eQHWkrun0lOvQjDsLTunZkt1IcBh3Gl3FeGTY5PnSk+eJjSMWRskXSVsWqWTpHhan0WZT1cftxglkIXDaUH8Okp2wLHIoltglD1pbpFO37b7bblsuqCb0MZdRFHY2IJj+vZnwOaA== 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:SG2PR06MB1712; BCL:0; PCL:0; RULEID:; SRVR:SG2PR06MB1712; X-Forefront-PRVS: 095972DF2F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(66066001)(47776003)(50466002)(3846002)(4001350100001)(76176999)(6116002)(50986999)(586003)(2906002)(92566002)(54356999)(4326007)(23726003)(110136002)(36756003)(46406003)(189998001)(77096005)(8676002)(229853001)(53416004)(19580405001)(86362001)(19580395003)(230783001)(81166006)(2950100001)(5004730100002)(83506001)(33646002)(5008740100001)(42186005)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR06MB1712; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SG2PR06MB1712; 23:SbhWL2prADijx8R3YFc1Vulcl9p66XH0EdU4nma+k?= =?us-ascii?Q?eM8uvr4MoNVuyP6ECi4oiIKoFTfanKjFazDxlnP8xFTDxYbF51LaZ+3GNS3w?= =?us-ascii?Q?bR7FnhWMUL2shXAa+Lgs0tH16VWxXsak5zUEccerJX3wqUvPxEWNSWqzWS5k?= =?us-ascii?Q?QVjBDRxskgLFzST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PbN3NdX6LWI/E6k3kj8V+QFagy5PtKBkGyJsi49/bV+HF6UUOXMlEWj36u6HUqXAgPhh8HFPeGTDdNsrg2Sd+zIWwI+AdIBZ20LZEfXE872g0c9UaD/ExU2JclQ3YdDl4919CQJgWdd0A==; 24:/kOFAfxusZWN6bmHGsYlYwod2buJGsuBPD05AKLGVI0rcuTE9LuaUKye6yQiCK7NqcoSHdnF/oO36isNeUoFVIZJ1uEOPDTUpBXaEnz66X4=; 7:v/JUuV+XSAuqPiNagKUhdNvyXmlv+xGzaUdzGKAdmqj5OFGimXdAeJmpZnesjtA+17meaat4bIOoqiqrdhqt0/DFw9WCrBnO74/xQQnPF0kwdPilLgW/MT6d/CR+U9g1aCAynSTdvTHn7cjJSSwd1E0UldSVQzjGKQ6CdNKV1V4R53pCXt9MPPhZEVvNr4dP; 20:y4v9IDsJ4ZMZCz2ZInEEf7oeXTk+2whqp0lJqk6cEWK7FS/reF8YYg4BD9xTKKQNBE/zTXM5Ezx+OotEJ1bOPFyiSJ9DqOr/Zoeirb2qH9RGbr7jmM3WlBFZ0dlY9/zc7XX+6TgBdZlsNb3H2MhfojVTu4pwt88gNSXbMgrVq88= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2016 09:03:26.7382 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB1712 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 simple-card is supporting clock/tdm slot initialization. This patch makes this method simple style standard. Signed-off-by: Kuninori Morimoto --- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 1a77d72..289e61d 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -65,4 +65,6 @@ int asoc_simple_card_parse_endpoint(struct device_node *port_np, const char *cells_name, int *is_single_links); +int asoc_simple_card_init_dai(struct snd_soc_dai *dai, + struct asoc_simple_dai *simple_dai); #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index a3d917d..4f434c4 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -210,3 +210,32 @@ int asoc_simple_card_parse_endpoint(struct device_node *port_np, return 0; } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_endpoint); + +int asoc_simple_card_init_dai(struct snd_soc_dai *dai, + struct asoc_simple_dai *simple_dai) +{ + int ret; + + if (simple_dai->sysclk) { + ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk, 0); + if (ret && ret != -ENOTSUPP) { + dev_err(dai->dev, "simple-card: set_sysclk error\n"); + return ret; + } + } + + if (simple_dai->slots) { + ret = snd_soc_dai_set_tdm_slot(dai, + simple_dai->tx_slot_mask, + simple_dai->rx_slot_mask, + simple_dai->slots, + simple_dai->slot_width); + if (ret && ret != -ENOTSUPP) { + dev_err(dai->dev, "simple-card: set_tdm_slot error\n"); + return ret; + } + } + + return 0; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai);