From patchwork Fri Jun 24 01:18: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: 9196285 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 16DB06075A for ; Fri, 24 Jun 2016 01:18:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06BC128480 for ; Fri, 24 Jun 2016 01:18:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF3B528484; Fri, 24 Jun 2016 01:18:21 +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 6C72828480 for ; Fri, 24 Jun 2016 01:18:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751348AbcFXBSL (ORCPT ); Thu, 23 Jun 2016 21:18:11 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:9250 "EHLO relmlie4.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751537AbcFXBSI (ORCPT ); Thu, 23 Jun 2016 21:18:08 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie4.idc.renesas.com with ESMTP; 24 Jun 2016 10:18:06 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 034184BEB1; Fri, 24 Jun 2016 10:18:07 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id F15A9480A4; Fri, 24 Jun 2016 10:18:06 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id B05F2480A3; Fri, 24 Jun 2016 10:18:06 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac4.idc.renesas.com with ESMTP id LAL17134; Fri, 24 Jun 2016 10:18:06 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="213663813" Received: from mail-hk2apc01lp0216.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.216]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 24 Jun 2016 10:18:05 +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=zjE7sTqaiaQvyXizb7JLE/XIxjTFfthyjJX2LhXLpnI=; b=AfWjS/KSd6ID/f4qQ7TOXtFhp0yjUElM54+IkYLel8t91f5d6H+B6/qDaa62Ay+cjHZKecwDCriDi+I3yl/1tM0epiDjVVjynnvlqPtLYbBlm71wX6ArAJ2J27Qochyh/rqlUEWIX6nfO27piBVORSbfTG4R9lEjn7062NW6Bz0= 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 PS1PR06MB1706.apcprd06.prod.outlook.com (10.167.53.16) with Microsoft SMTP Server (TLS) id 15.1.523.12; Fri, 24 Jun 2016 01:18:03 +0000 Message-ID: <87lh1vxufm.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 08/11] 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: <87wplfxumi.wl%kuninori.morimoto.gx@renesas.com> References: <87wplfxumi.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Fri, 24 Jun 2016 01:18:03 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR01CA0048.jpnprd01.prod.outlook.com (10.164.162.158) To PS1PR06MB1706.apcprd06.prod.outlook.com (10.167.53.16) X-MS-Office365-Filtering-Correlation-Id: e8572f60-38a2-4f3b-6f2c-08d39bcd6429 X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1706; 2:KRAijG0ZsDRBwMkJ1oMuMjOL/UZ/HdjsA6bD2RGCPGEsT1uEGEvOZT8AQCGTUBqMVJiK7akl/yqMDgwaGjB5ikPJlocv7yfBof04b0zR9xAX8Ub6fF71AR9/wniJiDzy9B3S8TH1Q7s+Y38MwfsXXF99GxcwfqWKsQ5G2Dc77G5We08zZyiv/+xKJwmJPYWG; 3:EO7FglBx6e6u70t+uJlX+c5v9lQZvmMjnjPPQ1R711Or3huzLeUBNWGFBPAF6qEZHfmNTQgbnrOsmXnfVwdCm3YL8lVylDceBIbNqINWZUC76K/ZD3bfJzvzVe+yyOj6 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:PS1PR06MB1706; X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1706; 25:xuVtevRxmBWs3azsw+fVKQsdr/ZS+0xTCNB4ldX/DKZWk7spfftafdslaxv7P8hW2P5BmGxmubC6xkCz4T1gSRFN2/d38y02RCfBJitxrWuN2FS3lYxcoO7lQuRHGymELmMODF6+hk+32GrVwgarR+TL2x0awQ19o3owFti0Js72QcP+lOLJDcMjWUKPJ53OwF+hSFQ2ItRi+v5cEmUIQiBhr8kAgIdYKYaFoTFRJHK6cZa7ByauFEXvX5cFa+Ck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7mnh4ezJOfZWLJ94NQhxoV8fXEprA3+ryLHlTQYcAexreJvYZXvqDvg8+zjMSWMv1zq5KfwfXmbmWCgjozKW7AaiL5tYehfwu5wxCqL2GKF7T7NDAkn8/RHYF65aXIn/S0hYUVIKIuwbG46pna0c6N+4bWMXDl7MNvBthP7ZIxuUO/2W84OVq9mUvlOIAco4hfn65fmiux/U3svyj3HaKUXYmY0+hHJnshdFKMqMYsWWMuHgSpbl4NlKFCjMDpntK7p57qaUoDuLriXRwB2Fb1bHfPdbyV9gb5PAJZbqMLPSgOOtNaYu8U+BolecYRkAaTmg== 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:PS1PR06MB1706; BCL:0; PCL:0; RULEID:; SRVR:PS1PR06MB1706; X-Forefront-PRVS: 0983EAD6B2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(23726003)(110136002)(101416001)(53416004)(47776003)(66066001)(7846002)(33646002)(81156014)(54356999)(50986999)(76176999)(86362001)(8676002)(189998001)(77096005)(230783001)(586003)(4001350100001)(7736002)(305945005)(81166006)(2950100001)(97736004)(6116002)(229853001)(3846002)(92566002)(68736007)(4326007)(46406003)(19580395003)(105586002)(19580405001)(106356001)(69596002)(83506001)(2906002)(42186005)(36756003)(50466002)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR06MB1706; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; PS1PR06MB1706; 23:wRiazFd/uPE46olAnwezB+u5GcRldmezFqyrNo5y3?= =?us-ascii?Q?mWpVB/7lJN6lzqnhLz9gAP8seLDQ4Q4ZypwALzkDKRKuuGwHguAlLeHcl+0o?= =?us-ascii?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2t5R54SmZTcFkvfAEid8mUJIdP7ZIRKeMRKaz2CQzjmiZB8pXMg+nFzC23RDDjbsDF7/yhEcR6fonOYDK63zzNWwxM6RW/7HvEeJOFtbPK9vO8vnSGR5nR+y0j07G4sDMOLi0h6ad6KqYyAgtsfGA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1706; 20:aRvrZMXC+8ObdCqtPcp0rU+ZQ7RTLaNZwJFIBflPPdXRkwFipf8Dl1DHyMbWkqSX0SH3gIVLdijR1y2rk43P745I1K1PYUcY2soXflH6yHYrwg0lWihQjl1KYE80zPYHS1MYE1t8CtXhzhtPHnBq5dxD7z3rEnSzYH7bITcsFxE= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2016 01:18:03.6546 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR06MB1706 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);