From patchwork Tue Jan 20 12:21:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zidan Wang X-Patchwork-Id: 5668711 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D9B759F357 for ; Tue, 20 Jan 2015 12:23:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0642020114 for ; Tue, 20 Jan 2015 12:23:05 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id A385C20172 for ; Tue, 20 Jan 2015 12:23:03 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id DAE1B260569; Tue, 20 Jan 2015 13:23:02 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id DCD1B260523; Tue, 20 Jan 2015 13:22:02 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id F4029260545; Tue, 20 Jan 2015 13:22:00 +0100 (CET) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bbn0107.outbound.protection.outlook.com [157.56.111.107]) by alsa0.perex.cz (Postfix) with ESMTP id 25B1F26055C for ; Tue, 20 Jan 2015 13:21:13 +0100 (CET) Received: from CO2PR03CA0031.namprd03.prod.outlook.com (10.141.194.158) by DM2PR0301MB1263.namprd03.prod.outlook.com (25.160.219.28) with Microsoft SMTP Server (TLS) id 15.1.59.20; Tue, 20 Jan 2015 12:20:50 +0000 Received: from BN1AFFO11FD033.protection.gbl (2a01:111:f400:7c10::135) by CO2PR03CA0031.outlook.office365.com (2a01:111:e400:1414::30) with Microsoft SMTP Server (TLS) id 15.1.59.20 via Frontend Transport; Tue, 20 Jan 2015 12:20:50 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD033.mail.protection.outlook.com (10.58.52.246) with Microsoft SMTP Server (TLS) id 15.1.49.13 via Frontend Transport; Tue, 20 Jan 2015 12:20:49 +0000 Received: from b50113.ap.freescale.net (b50113.ap.freescale.net [10.192.241.89]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t0KCKSiC027870; Tue, 20 Jan 2015 05:20:46 -0700 From: Zidan Wang To: Date: Tue, 20 Jan 2015 20:21:20 +0800 Message-ID: <1421756480-7055-4-git-send-email-zidan.wang@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1421756480-7055-1-git-send-email-zidan.wang@freescale.com> References: <1421756480-7055-1-git-send-email-zidan.wang@freescale.com> X-EOPAttributedMessage: 0 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=zidan.wang@freescale.com; X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(199003)(189002)(6806004)(105606002)(106466001)(97736003)(110136001)(2351001)(229853001)(19580405001)(19580395003)(85426001)(86362001)(575784001)(50466002)(87936001)(48376002)(77096005)(68736005)(50986999)(76176999)(62966003)(77156002)(50226001)(2950100001)(46102003)(47776003)(92566002)(64706001)(36756003)(33646002)(104016003); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR0301MB1263; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-DmarcAction-Test: None X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(3005004);SRVR:DM2PR0301MB1263; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004); SRVR:DM2PR0301MB1263; X-Forefront-PRVS: 0462918D61 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:; SRVR:DM2PR0301MB1263; X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2015 12:20:49.3931 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB1263 Cc: alsa-devel@alsa-project.org, Zidan Wang , Xiubo.Lee@gmail.com, tiwai@suse.de, linux-kernel@vger.kernel.org, lgirdwood@gmail.com, nicoleotsuka@gmail.com, broonie@kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [alsa-devel] [PATCH 3/3] ASoC: fsl_sai: Add support for Right-J mode X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Add Right-J mode and set TCR5 FBT bit to let data right justify. Signed-off-by: Zidan Wang --- sound/soc/fsl/fsl_sai.c | 14 +++++++++++--- sound/soc/fsl/fsl_sai.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 4c5040d..19cd6f3 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -228,7 +228,11 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai, sai->is_dsp_mode = true; break; case SND_SOC_DAIFMT_RIGHT_J: - /* To be done */ + /* Frame high, one word length for frame sync */ + val_cr2 |= FSL_SAI_CR2_BCP; + sai->is_right_j_mode = true; + break; + default: return -EINVAL; } @@ -418,9 +422,13 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream, val_cr5 |= FSL_SAI_CR5_WNW(sai->slot_width); val_cr5 |= FSL_SAI_CR5_W0W(sai->slot_width); - if (sai->is_lsb_first) + if (sai->is_lsb_first && sai->is_right_j_mode) val_cr5 |= FSL_SAI_CR5_FBT(0); - else + else if (sai->is_lsb_first && !sai->is_right_j_mode) + val_cr5 |= FSL_SAI_CR5_FBT(sai->slot_width - word_width); + else if (!sai->is_lsb_first && sai->is_right_j_mode) + val_cr5 |= FSL_SAI_CR5_FBT(sai->slot_width - 1); + else if (!sai->is_lsb_first && !sai->is_right_j_mode) val_cr5 |= FSL_SAI_CR5_FBT(word_width - 1); val_cr4 |= FSL_SAI_CR4_FRSZ(sai->slots * channels); diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h index 111dfce..e220940 100644 --- a/sound/soc/fsl/fsl_sai.h +++ b/sound/soc/fsl/fsl_sai.h @@ -137,6 +137,7 @@ struct fsl_sai { bool is_lsb_first; bool is_slave_mode; bool is_dsp_mode; + bool is_right_j_mode; bool sai_on_imx; bool synchronous[2];