From patchwork Thu Dec 10 03:21:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zidan Wang X-Patchwork-Id: 7814461 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 F1C709F349 for ; Thu, 10 Dec 2015 03:19:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0DBE820396 for ; Thu, 10 Dec 2015 03:19:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D767C202F0 for ; Thu, 10 Dec 2015 03:19:33 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5514026170F; Thu, 10 Dec 2015 04:19:32 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, NO_DNS_FOR_FROM,RCVD_IN_DNSWL_LOW,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 738B7261527; Thu, 10 Dec 2015 04:19:24 +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 574832614F4; Thu, 10 Dec 2015 04:19:23 +0100 (CET) Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0123.outbound.protection.outlook.com [65.55.169.123]) by alsa0.perex.cz (Postfix) with ESMTP id A365C2614F4 for ; Thu, 10 Dec 2015 04:19:15 +0100 (CET) Received: from CH1PR03CA011.namprd03.prod.outlook.com (10.255.156.156) by BY1PR0301MB1256.namprd03.prod.outlook.com (10.161.203.28) with Microsoft SMTP Server (TLS) id 15.1.337.19; Thu, 10 Dec 2015 03:19:13 +0000 Received: from BN1BFFO11FD054.protection.gbl (10.255.156.132) by CH1PR03CA011.outlook.office365.com (10.255.156.156) with Microsoft SMTP Server (TLS) id 15.1.337.19 via Frontend Transport; Thu, 10 Dec 2015 03:19:12 +0000 Authentication-Results: spf=permerror (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; freescale.mail.onmicrosoft.com; dmarc=none action=none header.from=freescale.com; Received-SPF: PermError (protection.outlook.com: domain of freescale.com used an invalid SPF mechanism) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD054.mail.protection.outlook.com (10.58.145.9) with Microsoft SMTP Server (TLS) id 15.1.337.8 via Frontend Transport; Thu, 10 Dec 2015 03:19:12 +0000 Received: from b50113.ap.freescale.net (b50113.ap.freescale.net [10.192.241.29]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id tBA3J6u5023946; Wed, 9 Dec 2015 20:19:07 -0700 From: Zidan Wang To: Date: Thu, 10 Dec 2015 11:21:25 +0800 Message-ID: X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD054; 1:Ak9wCeygE8pQ22FvsHqSzPpMI5Ow6UcVc86FxhM08usG1NBSc/YS6VZIXiMmjj5Vg94A0RUbodEcJ7kCZH+lN/nx3+dwDm//djLH8gz/g+0vP3jKTZMFuo+P6xBerEjVvmTIGEJYi/QWYQx61R+Th4uFdvO04gKkdQ5aWAP/SV2fz/9X3hgFFBU4uCnWIuSn0KlFX1qDehQoC9lEQlny6JUh41cju7SM2F0rVlt6zrBuSA2NaZlGSBR/tUA005yka1hE8Siqt8+Hf7f9THA6eGNypIDQcMGrYsyjAtJTYVyoldHa2n6905bLXmWkc0Pz+bXqiJs3tmvFXqjhN+00kPu23yHExu/z3k8Rxn/c6Hv5WWcLG98wadJBcVb8CB8qvGYLVO7tzZTLSLhON88oKHX5dmuQSraB/QAKqr/70O0= X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(448002)(199003)(189002)(48376002)(47776003)(50226001)(104016004)(6806005)(189998001)(36756003)(4001430100002)(5003940100001)(5008740100001)(1096002)(92566002)(33646002)(97736004)(106466001)(50466002)(19580395003)(50986999)(229853001)(2351001)(5001960100002)(110136002)(107886002)(11100500001)(19580405001)(81156007)(1220700001)(586003)(118296001)(77096005)(86362001)(85326001)(87936001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR0301MB1256; H:tx30smr01.am.freescale.net; FPR:; SPF:PermError; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1256; 2:17X1WfgXNo1H9JXxLiE+c+8ZPrEs1NiDQFZYtwBKN5SxyHrEH7BVM3Zw3E+tTOoy1quPsrFCxXmIG/i0pEAubk9C9nL5CPNIyJhYxlR8rioiiHJG65MEtM07ns1/e99BiLxDhhrI27SiSyXQPpbgow==; 3:YTtHsuKwfnRTJ5Q+HTkBVWNes+xyLWqsd2CWyUdtVhL8wUyQ+wjOZ7KTGPGI41Sijux6u4r4W+DOyX4opwbF8NjE5xBIR/cODpFZzdpcM9iPghLFuEj6Icb0kyCZhUG7NoIWUisuU6SYpJtLczjzqjx5yh1p9ZgT4WyuCkgwxS4Yq1kOioBc7R4OcHJ3Y63Mluct3llI+ZN8zJXiEQc/yhCAraehgx8/rm2r1XVBCTU=; 25:Bz/5HJgQAfqMp/ZuJGOXmufR8kSZcl07vkqcnxcJpLE5YVJb2+IINwmdNalafxPvmQn7D+r8WZXhM23daHfcqqU9C8QX2QoPtwWcV1FR+GLGGVk+WwzoNnRz4wQNz3eSDMxIMkDne0zunOBQWrtldHS9W4UgKbluDCi0HhtGvElHCRtM71+B0f0suQHfrd5HE6X3d4NU3K8wk9ntjasvtF6ks7mscV2WIQuMBnExG24u8IL3exoKXY6sG2Qtvn2ySP+QjIsss4ScxCADkq0F9g== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1256; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1256; 20:Amy8QUp9dAPsb8dwGuczKYgHab3lcwryxmJzrIqdxn86cY+yztfJTe01h/VNwVlTvwpUwmvlto6AO2QYUfJcKerzi6qQCC0TXnWtcxUtzYES/HpFy5b+f6QGW0onaH7DerO9eJT5rBp8BTxtmZfyjfYIP0Vi6FhS3ltyiDLrBTgyKktskg09qklU9Sm331qrotSfQwwwbc243/wccwqcMM6imNicOx2FfCY/ydHwKJEP5K72V62AJ61ErboYwuWxOSpLctxW/Cya7BXVojpnsjeeZTaPKA+kKp/7qkT+S+cgRYio2fFjE6WYHGB6+GRnEcaoEyaqXel4Uo7EZEUReEmgfZ1Bh09l/rQAoJ2kvfk=; 4:pHQsuWFa07lZz5b0aTb1EKCeYkpmOXQpMl89avf9LpbKXxmV9g1eaaRaWfTtD1wutW/VbSmOSMdDZG+TAWdYLgfA88xoi3tG59DlLLenQSjHpxs8wWmfXEkFL074hHAtttslNi4em1oMjPYu+MzvzsMBAIefu2isRe7aDc7XU+S4wjsCPoF3lmqicbm/2cr0/CeLG32h5K353d5y8uFjf17BRXCHvvAry0a1XgWhTuf+PpDSpF7cFBDfCq6HuJT9Z1SVzN+x7Zi/3XH41n5s/xYQSk61Iz7IUCYBJLpR7w33iWt+PruBhTV/guJWXv275uKk07YNRP0+ihzKYLe7jBTXw023mq+5mrjWomYHCQ9376o/35VZrBw3an7bCFnj2BZtU8GgnxubdKq7bwdsrKXBy8oBBGYjOufW9fdYLtDFq9oTy3WFa1/Djloz02my X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(10201501046); SRVR:BY1PR0301MB1256; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0301MB1256; X-Forefront-PRVS: 078693968A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0301MB1256; 23:R8L9eNvGT/vSTl7Kxd+6QDd4t23uyyHojoUiBb9?= =?us-ascii?Q?DYlCos9O0Z4kI2Ompgw6QBcZL3acbuKYKPohYoyaTzKSKXGIwuYqey38+tyD?= =?us-ascii?Q?Me8EUXSo8E7UwD4d+WM2FI51nTBhcssAARptmvNF63w1a5be/eeQ8/iywwh0?= =?us-ascii?Q?EfIoYau0GqFHO4HJYz9OPoq2iamvOCtAdMicsKY+AO0kATxdg1o7FTpYUQ9z?= =?us-ascii?Q?nvpY9NaM2Xm5yp0yBYgQYC1pdne2NEviHBObRgj4am9zOxLF4WY0A53hEljf?= =?us-ascii?Q?WPh0rZ0qtLJvB2dVDJEub+jQOrpE1AGi4prqYdsxFm4QGv5gvBR5Twjoa4bX?= =?us-ascii?Q?bOrwxxymTvxBE8/OAZahHxPSd7gdX1b95Y/VH8VEd20BnlNqW9ijfpQrQyId?= =?us-ascii?Q?dJHK+2JwpfrDJi4w2wR0LiFyRZRUHswRTNpzCHRiqM7un0PUlLUxTZQHY0xD?= =?us-ascii?Q?DqgkU3jMhn5R8BHmb9Qv9HUnslDxllv1YDFmbiFrI5O08dsjT060QKIQPzHN?= =?us-ascii?Q?qV5xQohuIhJFf/IJmKGFK64Vn6WdfZBF+Z+Hh56/Mf8pM4w9Lfc5HRGaZPBE?= =?us-ascii?Q?IIWAGuxsmYhI82OSSc2nRSyGzE5gsmYoxvnsbp3SQrpEft+e1+t5PqmO2f27?= =?us-ascii?Q?+IvngcxBRtUKfkGxV6oA7tUMCWZkbDKmxhEleFMXKXbq5NYcUgOnDv72jgDI?= =?us-ascii?Q?kbD2QLnozKz4+J+bnNRaqWlW7CZqVAEZopGw1It3Dg56AW6meb3LJ09St2bx?= =?us-ascii?Q?LwxAeBrHALrXFbdXeHcRDgIkdHKILJrXFZm1CDOlfX/8P8dXhJMNDOmmpaIa?= =?us-ascii?Q?cTjCUM0Rou03ejSGvcXrct2P3axJilczl3FzxVfqxQz57S3MbIHTm+aRS1k+?= =?us-ascii?Q?/pXPbGMI3esbUD/meZ09xo+nCgaTBn788lr/Y6bEWXye3ftYTGRrzvn4mDzb?= =?us-ascii?Q?FrZD0zAegGGU+obq4iYo65/kdShd6R7ei4ZMWhR6WUHkuPIYVhaC1eWULlp9?= =?us-ascii?Q?C11kWxCbRfj/CHmYTDo6SY7GgVdwKjG51BRnKwmPQmnQgjg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1256; 5:bLfh0FiwXNF8ayk7iCEQP8Wz6K688iC5F0JQM7jSigRYpVJ3dRzSZ8pWy0gtznLznV9anC/6VcRU1r9h/pWsXcvXKImlmN+q/ZRt57P8xwE5VlY142PR9+jRDKEd46+E0+q7tYV73OjyEM9+rHKUtQ==; 24:CqeO20CKbw3E+G/R/ix/+fmoNVOjwtV0L3aP7b+8k94xMAePNeEQkoYFyu8yo67uyg3LV1JLYKLJVGlCFthhElypsDWEqXqd/a0VREDuxIA= X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2015 03:19:12.7987 (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]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1256 Cc: alsa-devel@alsa-project.org, timur@tabi.org, Zidan Wang , lgirdwood@gmail.com, tiwai@suse.com, nicoleotsuka@gmail.com Subject: [alsa-devel] [PATCH v2] ASoC: fsl_sai: fix no frame clk in master 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 After several open/close sai test with ctrl+c, there will be I/O error. The SAI can't work anymore, can't recover. There will be no frame clock. With adding the software reset in trigger stop, the issue can be fixed. This is a hardware bug/errata and reset is the only option. According to the reference manual, the software reset doesn't reset any control register but only internal hardware logics such as bit clock generator, status flags, and FIFO pointers. (Our purpose is just to reset the clock generator while the software reset is the only way to do that.) Since slave mode doesn't use the clock generator, only apply the reset procedure to the master mode. For asynchronous mode, TX will not be reset when RX is still running. In this case, i can't reproduce this issue. Signed-off-by: Zidan Wang Acked-by: Nicolin Chen --- v1->v2: 1) refine the commit log and comments 2) Since slave mode doesn't use the clock generator, only apply the reset procedure to the master mode. sound/soc/fsl/fsl_sai.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 8832901..a55a7de 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -564,6 +564,17 @@ static int fsl_sai_trigger(struct snd_pcm_substream *substream, int cmd, FSL_SAI_CSR_FR, FSL_SAI_CSR_FR); regmap_update_bits(sai->regmap, FSL_SAI_RCSR, FSL_SAI_CSR_FR, FSL_SAI_CSR_FR); + + if (!sai->is_slave_mode) { + /* Software Reset for both Tx and Rx */ + regmap_write(sai->regmap, + FSL_SAI_TCSR, FSL_SAI_CSR_SR); + regmap_write(sai->regmap, + FSL_SAI_RCSR, FSL_SAI_CSR_SR); + /* Clear SR bit to finish the reset */ + regmap_write(sai->regmap, FSL_SAI_TCSR, 0); + regmap_write(sai->regmap, FSL_SAI_RCSR, 0); + } } break; default: