From patchwork Mon Apr 18 09:39:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 8869181 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 986C49F36E for ; Mon, 18 Apr 2016 09:41:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 84A3A2022D for ; Mon, 18 Apr 2016 09:41:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 81FCE201B4 for ; Mon, 18 Apr 2016 09:41:02 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3BB4D2654CD; Mon, 18 Apr 2016 11:41:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 539B02650B0; Mon, 18 Apr 2016 11:40:31 +0200 (CEST) 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 121D3265141; Mon, 18 Apr 2016 11:40:30 +0200 (CEST) Received: from emea01-am1-obe.outbound.protection.outlook.com (mail-am1on0121.outbound.protection.outlook.com [157.56.112.121]) by alsa0.perex.cz (Postfix) with ESMTP id DA5942650B0 for ; Mon, 18 Apr 2016 11:40:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentiatech.onmicrosoft.com; s=selector1-axentia-se; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EozWQUFqnK1tekJgDjuDYdthiuCkTYUHu1hLpQh7yr0=; b=HtFfSO66xKXljfjWtGM/dihbwWX0gV/y/+uDXdfMVMriTyQvUbY9Sy1yKuaLFmn1ObIXMieHU9AEUxP91CjIX6M/HkIQOYFYpZOPetoA38f9ehT3y9Y/l4VyRLLyqJxOPzHNEr0kg/DxuNmBji+M0WifGPJtJtlC/jVOd0lO1d8= Authentication-Results: alsa-project.org; dkim=none (message not signed) header.d=none;alsa-project.org; dmarc=none action=none header.from=axentia.se; Received: from localhost.localdomain (217.210.101.82) by HE1PR02MB1307.eurprd02.prod.outlook.com (10.169.115.153) with Microsoft SMTP Server (TLS) id 15.1.466.19; Mon, 18 Apr 2016 09:40:15 +0000 From: Peter Rosin To: Date: Mon, 18 Apr 2016 11:39:50 +0200 Message-ID: <1460972390-30149-1-git-send-email-peda@axentia.se> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-Originating-IP: [217.210.101.82] X-ClientProxiedBy: DB4PR06CA0004.eurprd06.prod.outlook.com (10.162.49.14) To HE1PR02MB1307.eurprd02.prod.outlook.com (10.169.115.153) X-MS-Office365-Filtering-Correlation-Id: 3e90f02f-14a9-4d63-33c7-08d3676d735c X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1307; 2:7XJothwrmflfLEfglFntaBs6LJxSOrN6ZOoRQhEC5NPLe/w1JjmHR0h1wNtxADOlnUZKk2WKzouQ+iZ1juwqYZ/lZngxKVOx1W37L9iVoTuWDHvT/AFTSdiqr/FzxRp/T26ZMTTDsNU48CxQHTmkHwU0PcHnhNgzOgKiZ5ZwzgxlEtJoPXEfcoD2ZH37d7to; 3:RWt+DP42+hUpE2k9PoyNkl8L9fE7hX851AA9ftGyYL1t+JBcZXhRI+OLabgVYIZZEQ90na9ZdMFte9CyenOC1Z004WgjJutcF1aH2BNvxRTpD4eoQkt9MOgkClUXbP/3; 25:TZxd/VZq1qX5Dy5XzSFClQZzld+TnqxPRMuHDZ6V8yJLlzxhVDpPP9+qeWyH/uJIVptW+Dqwj95fqobukwu7roYkm3m/c1sspXpnJ4PKeAy1je048pAw5rpv2dIS2NJrNdVFGsXaShfdIw/iFw95aHqTgz0DEP84imHvXWvxcfzkhubMRyJhOavN6oExZFuRQLFlqKo0N3gbMMtj90SwEuWaQPVHsB9WmxxPzs9H+mfXn06V4Ny2VI9wWZYsNNQz+f7WieOu5F5nfLGb2igyJk5wZv4P0yM+2lSps/KOpLPQExm5q6dK09i22GVp5dBGquQHQZtVSPzHSr2RSvNK/A== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB1307; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(9101521026)(6040130)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6041046)(6043046); SRVR:HE1PR02MB1307; BCL:0; PCL:0; RULEID:; SRVR:HE1PR02MB1307; X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1307; 4:sggLaRr16NrTtWjXERMaLs2MlNG7MoIPEXia246LWvdFF3RpELhys0+qkNZLKG18X+Kereh02BdQudYfcgRBwDszuQmDJ0md0Il75XrNyaEqCkzxYPEKLmisYmwSMzqfXCGepOjG8HAbVuc04jPqYTmLCdt8hmSuhnM9J/7Qo704E+gPkuOmJwBlLqVgbSxwaGVDbBXyxHu8iFdNO2JXG/lc24KGik6Yd6UjgeznZDMAZG5X75op5JoosILXhtAbrKyz1T44WO5l/ZQfgcLJst6QPwS5ty3DKdUTGNUsPvgUztdHqee2ZJA0rLVIq009ByCxwkKk5I/s5+PfKc6ZqBxsS4VV04ddgBAvZV1WP9X0JzhKOEoCnh2944qziNwpx6/kcU+3r2ZHalWqNnYiAS0tym06wvYCXRiFR/uCBRJpnikfZm7dxnuFzYoLCousR3VJBQURueDEE9/Y7suuKQ== X-Forefront-PRVS: 0916FC3A18 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(6069001)(36756003)(5008740100001)(33646002)(74482002)(50226001)(5004730100002)(47776003)(4326007)(66066001)(92566002)(19580395003)(19580405001)(229853001)(586003)(42186005)(1096002)(81166005)(50986999)(86362001)(48376002)(5003940100001)(50466002)(77096005)(6116002)(2906002)(110136002)(2351001)(3846002)(189998001)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR02MB1307; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1307; 23:kd1GTEZ6BL9ZxcxEr+hqZL5I3OFCi21MoNhZgz59AopsLUKNuhFf6owTNZbZdMkYMBjbtfPZScxFn+zj0RMbg88nTjXIZjCNxpP5HlNO8v20QIjTC04DY4m83PYyi/IvQyCOhR3UcZczBEyccjnjgC8iOQ363SwLje+fJX6eO4pmkhUKGwn8Za/MVhgzvh+6YPP7kV42jontzKm3ROlhpY6w1PJfA2iqzAcWUhIvj08tdUquaH+a2JphPLE6nY16/Egg6wpO3r0waVXFLJ4AeEnfwxyvb1kvT3HIWyKy4OfdKXx89Vyayi11koo2J826GNU0FjnA6gZoc9lEsdcop39Hb/MXOMAtm3CCKvlXU2EoNZ8uRBknNTrpWqqAtCWDrTkxveGnGWfeaS7lyAuJWFs9A9m7GKkudHITRtlswgpATBCnewdc3s22k/y7Oe/uz7HcY2knPctAli/ZQTp7QXFMubo+pLMpGwsimD5nuy4oYpWwIVr+4IydupwdIyb5VeqY4UZUeRojUeFy/Kd9bsEVs+fhc87DuMvuTKVvNlnE0EmMLj8WhhZ/PR8MUc/fTU4EjSWK+UwYZIzMRyJrBaHlaeSXboXia/Bp5gWvJWdLuOsKSzDKIkfH/NOYlBcoUBpwwFsQkcM4j37nYPXKeYEcXLARZSIvw9rQzwB5d9l8l7JXyQEqPEHjoczf5adlnr8ge2Tel5X6FwLKpopSHeshwduyWB5UFAoYS0fSscyjq+6xRBYUNm+ISZpqNEb6hXMNzEykb8jMlCu0H7b4zUCvCF/DYJj4HGip3C68e/IM4a4W4TIRixzaMCNoEpEVTsuZ1CHxOfrKMxJvlqQC1dkVVLt74nojVD2HdtdZBbqUpyQuESQetRfJn+26nfJ/ X-Microsoft-Exchange-Diagnostics: 1; HE1PR02MB1307; 5:QxVr/WfUuJ47AK988SSGIoO1pKgZ9KQ7ZiPotXI4YOW3xyhDLh7KMhx+Z6fc1lpgwVsLbpn9k9hRMxxwbxUdw2wwm+r07IPjuoVxHLzLkalaUA02/dY+GmexNrSb1Qsk7uKXmEKGYGh0TxCDriOp3qBe+z/m+KGtZb3eexX7DJOZilI7oxDD3/UQDnyjIzhs; 24:Jboc+NvI0rsGgbKsnRGm5fCVZ/u7n96JoFL23td8c2o75+001q3URNo0Ua/1/s7/f3DRxK+HIPvFW7QbnaRohO1DFVDlNhqXoAooe2MtByk=; 7:JkSBBHxf/o3mqQNMXeUPtW2xr3M9Tn8EV43dk9pkrk8Lpyjk+N1A32HoS3PDMx7ucQXQiQTnZzoNKYa4MKVvo8zLQV/iOyUl3faxrnxjpkncX4YiBpgylj1XoLbCSVTXjQwBk/lQ+61UX9cnlnmLi7G7BGNO7QPtJqRXmh0GVg959HmNFHluWg+RmmEPUPcl3wrueWZ9Wsn2W3xWz+gudJgMyoHDC7aBAm2Gi7ZTvYk= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2016 09:40:15.7483 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR02MB1307 Cc: Jonathan Corbet , Takashi Iwai , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Liam Girdwood , Mark Brown , peda@lysator.liu.se, Peter Rosin Subject: [alsa-devel] [PATCH] ASoC: docs: add clocking examples for DAI formats 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 Provide *our* view of what the rules are for the different DAI formats, so that we do not have to trust external interpretations for this crucial bit of interoperability. Signed-off-by: Peter Rosin --- Documentation/sound/alsa/soc/clocking.txt | 110 +++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 2 deletions(-) Now, the reason for me writing this is that I once again had to go hunting the internet to find the rules for these things. And like last time, I found no definitive source and sometimes strange things as well. So, I don't know if the above is 100% good, but it is my understanding of the subject. Please enlighten me on any errors. Cheers, Peter diff --git a/Documentation/sound/alsa/soc/clocking.txt b/Documentation/sound/alsa/soc/clocking.txt index b1300162e01c..8b498d610e10 100644 --- a/Documentation/sound/alsa/soc/clocking.txt +++ b/Documentation/sound/alsa/soc/clocking.txt @@ -47,5 +47,111 @@ rate, number of channels and word size) to save on power. It is also desirable to use the codec (if possible) to drive (or master) the audio clocks as it usually gives more accurate sample rates than the CPU. - - +The below diagrams all have BCLK as the first signal, LRC as the second signal +and DATA as the third. Below that is an indication about which DATA bits belong +in what channel. + +A "..." marking as DATA indicates that there may be more bits that are not +shown. Also, all DATA bits marked X may or may not be present. DAI +transmitters must add them should LRC not match the word size exactly and DAI +receivers must be prepared to ignore them. DAI transmitters must insert +zeros for I2S, Left and Right Justified modes, and preferably not drive DATA +for the DSP modes for these extra X bits. + + +I2S + .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. +-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '- +---. .-------------------------------. + '-------------------------------' '----- +---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.- + | |MSB| |...| |LSB| X |...| X |MSB| |...| |LSB| X |...| X | +---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'- + | Left channel | Right channel | + + +Left Justified (aka MSB) + .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. +-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '- + .-------------------------------. .----- +---' '-------------------------------' +---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.- + |MSB| |...| |LSB| X |...| X |MSB| |...| |LSB| X |...| X | | +---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'- + | Left channel | Right channel | + + +Right Justified (aka LSB) + .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. +-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '- + .-------------------------------. .----- +---' '-------------------------------' +---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.- + | X |...| X |MSB| |...| |LSB| X |...| X |MSB| |...| |LSB| | +---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'- + | Left channel | Right channel | + + +DSP mode A + .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. +-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '- + -. -. + '- '- +---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.- + | |MSB| |...| |LSB|MSB| |...| |LSB| X | |...| | X | | +---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'- + | Left channel | Right channel | | + +LRC examples for DSP mode A + .---. .---. +---' '-------------------------------------------------------' '----- + .-. .-. +-----' '---------------------------------------------------------' '----- +-------. .---------------------------------------------------------. .--- + '-' '-' + + +DSP mode B + .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. +-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '- + .- .- + -' -' +---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.- + |MSB| |...| |LSB|MSB| |...| |LSB| X | |...| | X | | | +---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'- + | Left channel | Right channel | | + +LRC examples for DSP mode B + .---. .---. +---' '-------------------------------------------------------' '----- +-. .---------------------------------------------------------. .--------- + '-' '-' + + +The above diagrams show normal BCLK and LRC clocking where DAI transmitters +change DATA on the falling edge of BCLK and DAI receivers read DATA on the +rising edge. For inverted BCLK it is naturally the other way around. Inverted +LRC is just that. Note that DSP mode A is compatible with DSP mode B with +inverted LRC, and vice versa. + + +Left Justified, inverted BCLK +-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .- + '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' + .-------------------------------. .----- +---' '-------------------------------' +---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.- + |MSB| |...| |LSB| X |...| X |MSB| |...| |LSB| X |...| X | | +---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'- + | Left channel | Right channel | + + +Left Justified, inverted LRC + .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. .-. +-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '-' '- +---. .-------------------------------. + '-------------------------------' '----- +---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.- + |MSB| |...| |LSB| X |...| X |MSB| |...| |LSB| X |...| X | | +---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'- + | Left channel | Right channel |