From patchwork Fri May 20 09:49:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9129055 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 7985160762 for ; Fri, 20 May 2016 09:49:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C6381FF6C for ; Fri, 20 May 2016 09:49:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 614C925D91; Fri, 20 May 2016 09:49:11 +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 3AF531FF6C for ; Fri, 20 May 2016 09:49:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932755AbcETJtJ (ORCPT ); Fri, 20 May 2016 05:49:09 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:48544 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932604AbcETJtI (ORCPT ); Fri, 20 May 2016 05:49:08 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 20 May 2016 18:49:07 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 4A4174E092; Fri, 20 May 2016 18:49:07 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 2D08A2806E; Fri, 20 May 2016 18:49:07 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 232F02806D; Fri, 20 May 2016 18:49:07 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac2.idc.renesas.com with ESMTP id UAD18279; Fri, 20 May 2016 18:49:07 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="211713856" Received: from mail-hk2apc01lp0213.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.213]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 20 May 2016 18:49:06 +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=SHetvmyMSH5OqkYiUfUbjBu2nTUNdGjofkHAw2UayEA=; b=XVv4deWPkqJQwAE+dkYh7gHndpw8cIx7dgy4d7SApHzWHbfkHnEeE0XPYXJ4XO4B2ZuBa+MGJfKm5CT3/RMOfBQZdtcHcc7MPnsGJFEM9hj2tF8ZNU6vmh2UX3hUml7CCuv2WgBJK7E2QEcyAOv+S4SBd2tBiivB2DOPZ15FGPM= 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.497.12; Fri, 20 May 2016 09:49:04 +0000 Message-ID: <87y475qd42.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 16/49] ASoC: simple-card-core: 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: <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:49:04 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: KAWPR01CA0037.jpnprd01.prod.outlook.com (10.165.48.147) To SG2PR06MB1712.apcprd06.prod.outlook.com (10.167.82.142) X-MS-Office365-Filtering-Correlation-Id: f1869e41-c922-4eca-dd9f-08d38093fb1a X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1712; 2:+i4CpiKNl3QqV0rn1BbvRAnWZyyfRAm6soyfwcBxC1h8NDuUBMMyGB/wNaYI7nA8+45S9E6iBNjLcEvtX+3dkkq+6V4HggNO2+OWqbt4d6EBS11dp9DqdmLtJ8pcG234ECflDPT9jcefucqJImWmHw4SXekp5a2gL3X8u77+Mco5PG+xEKFalTesF+8NQIzh; 3:QtCI9bySHn7M9yXz+7lwBnWun14YZhaS0MBL+7gJFe0oH+GJ2w1uVnvbbWS3sH6MiA3Ovq4CnQcSwQ8tGS9TtqJBL2BubOKPVwIVFVcXBeVI1CAGGcd/cC1sQ8bqUmCZ X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SG2PR06MB1712; X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1712; 25:1s2VhxRBCykJQaMHCB3dYgkeDTrMYrag3ctRlxtrgd7hSaAezd7neslYzMwwpa5KWLD0qqqQTIas4Z0ssgj8nfXte6bR3gNUSH6drEmseL/7G9RXndxiREJdsJ9UQzVGEuaa6/Mf1hwyU/rqrB2cGBMEsq/HED5qAKqbfSNVEG85GsvOs5gJ3McW7UypyRiqA4HlFx8tYH0y0AxP0CsP+xh/mpkngnnJFzHLm227Z+BsIwY7mDAqw5JtBujp666KFOxrJFZT0FT+/2N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Xlt1mQdYqtgX6uhmgwXGnYSxXRm1SH1sMXL5ACItAU3cYCp7DeZcQgzv/A1P9xFVMeRQ97vaCDBjHVg3WW3mKowosuGvcJasPN+xodhVG04gAY3yVpoIRhcnNdUBeXW0eFXskP26EojxL6L1qZCm6HoXfKedQnaXbdX8UK2BXgnFgclAPYty46/g+i2DJ9Ifl/QKxVe6V9dTzEpXfi3X5rPXDGuD0frVsjw/pAhqdZqFGlaI42lBaepTxseooy15Mjelbc8ai1e8/VOeQRlFiUru6+6uvHVqHxmFbe3OwlFSyl/4IMNsg6tDkECnwbK4pQ== 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)(10201501046)(3002001)(6055026); SRVR:SG2PR06MB1712; BCL:0; PCL:0; RULEID:; SRVR:SG2PR06MB1712; X-Forefront-PRVS: 09480768F8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(92566002)(189998001)(5004730100002)(5008740100001)(47776003)(83506001)(81166006)(50986999)(586003)(46406003)(110136002)(36756003)(8676002)(2950100001)(77096005)(2906002)(4326007)(86362001)(229853001)(76176999)(54356999)(42186005)(50466002)(33646002)(53416004)(3846002)(6116002)(19580405001)(23726003)(19580395003)(66066001)(230783001)(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: 1; SG2PR06MB1712; 23:WAiXwr+mAMZ5Pz93jtYUYbp9d67wIXuZcvqCExcXJXxOwtpuHO+CfnvPJdPL4764RgyQVji+VlFDjbAmRKdnrG/fZKWTcNDvsYiEHpdeL+B9ns87vzEK2b6m18E2yQ1Y4yy1kw57SB4jwBms/l0irSwEGMc5ul3SVWzZ5nQkguk23XjjDOgSuwgW80rn1XiEjo2+hl8qo967R/Ku1bxvLUku0E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mvQvDmc1pLqqTqI9kJLgGEbr8MrU8PSUsl5dV5uS9rRrcoUxV5lAIRqMWGgQig1NsWEH47+npvXEtOmo3tcAd9+VcRDQpefM2qPqSuf9s4rW9hG0vOD4wycHjIAj0; 20:pA2MwrwFKvJCCR54tZcNC92P38T/04EGBj3kKtBygjSK1zymUs2WhE88ihYixaHyTdeyi2HZ3AxwqjcU1InEcaw2IsRXN9DxpiocVds7iB+OBfqi+9gEDjtLOKYLFg6FXbc9h4RYh3cHeX+zecCFHNxOgdo98Y7OfKM+aHpZIUQ= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2016 09:49:04.5292 (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_core.h | 3 +++ sound/soc/generic/simple-card-core.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h index d37acee..9146825 100644 --- a/include/sound/simple_card_core.h +++ b/include/sound/simple_card_core.h @@ -94,4 +94,7 @@ int asoc_simple_card_init_jack(struct snd_soc_card *card, void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack); +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-core.c b/sound/soc/generic/simple-card-core.c index 86f64da..cc638e9 100644 --- a/sound/soc/generic/simple-card-core.c +++ b/sound/soc/generic/simple-card-core.c @@ -331,3 +331,32 @@ void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack) snd_soc_jack_free_gpios(&sjack->jack, 1, &sjack->gpio); } EXPORT_SYMBOL_GPL(asoc_simple_card_remove_jack); + +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);