From patchwork Fri Dec 18 08:53:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zidan Wang X-Patchwork-Id: 7880691 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BB4C9BEEE5 for ; Fri, 18 Dec 2015 08:52:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 36D46204AE for ; Fri, 18 Dec 2015 08:52:17 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id DC874204A9 for ; Fri, 18 Dec 2015 08:52:15 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id ECC462651EF; Fri, 18 Dec 2015 09:52:14 +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, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 85DDA265680; Fri, 18 Dec 2015 09:52:03 +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 6052A265680; Fri, 18 Dec 2015 09:52:01 +0100 (CET) Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0132.outbound.protection.outlook.com [207.46.100.132]) by alsa0.perex.cz (Postfix) with ESMTP id 8683C265857 for ; Fri, 18 Dec 2015 09:51:33 +0100 (CET) Received: from BLUPR0301CA0022.namprd03.prod.outlook.com (10.162.113.160) by CY1PR0301MB1258.namprd03.prod.outlook.com (10.161.212.156) with Microsoft SMTP Server (TLS) id 15.1.361.13; Fri, 18 Dec 2015 08:51:29 +0000 Received: from BN1AFFO11FD046.protection.gbl (2a01:111:f400:7c10::117) by BLUPR0301CA0022.outlook.office365.com (2a01:111:e400:5259::32) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Fri, 18 Dec 2015 08:51:29 +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 BN1AFFO11FD046.mail.protection.outlook.com (10.58.53.61) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Fri, 18 Dec 2015 08:51:28 +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 tBI8pNUl029542; Fri, 18 Dec 2015 01:51:24 -0700 From: Zidan Wang To: Date: Fri, 18 Dec 2015 16:53:41 +0800 Message-ID: <4e56cafc5497654b0413418d41187e5b8f0023e3.1450428585.git.zidan.wang@freescale.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD046; 1:/Re3GTM2ydVeIkzoNOysUtcN1bt/IeVdj2vCBrDxDHLqEQBdqUOwMqjpoQNeOouwY73Q0j1hqfHwYOMdVYJ5rQjrSGV6oEmZSwajMF2FPS2IHJ27Pcs7/buPvfQSpFqlKp8C/Cbc+a3BLmcA+a7yGizw40WdHyeO5RChOXKy86+p8RsrnAcqapfAuioyuweNoaBSdM+GIj4BPJ3bFfHwVUR2+0d+usufdhGlVhCSTfJgVYMzGwWcPyhqEiveH6f2/oiymMEnTMzIA4KHk6LaroGbLV8bVoQb1K80eTH3JswT4L8Xhlg6sqblSPJNwj0FQXXp/9RPzXOFv2XqbxyV3NBcJhytWJXSLDLQl+bMEVQwMJ3z13bapSSnYTipK4kyqIibjrAp7PTgNU0J3iVhZLd2rJn5pASPw40rJ1wohajIyh5CFyNxYMztWLaciZ1f X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(448002)(3190300001)(189002)(199003)(48376002)(77096005)(19580405001)(2351001)(1220700001)(229853001)(1096002)(50466002)(106466001)(19580395003)(118296001)(586003)(6806005)(87936001)(47776003)(104016004)(50226001)(5008740100001)(81156007)(86362001)(50986999)(189998001)(4001430100002)(11100500001)(92566002)(5003940100001)(110136002)(107886002)(5001960100002)(33646002)(97736004)(36756003)(85326001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB1258; H:tx30smr01.am.freescale.net; FPR:; SPF:PermError; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1258; 2:1BfDf2X0kQCwQyngQSW/7XI26GFy2ItjiAU/sPoVy2xpjFFQXUzOoeH/xywLPzTDD3E/VJZejbviW20qGjO/pdC1um6LWGfjM/ffvQcHDgQcBNZPYSYGJOR6X47rHhOpsUDRFjYSWKxZGzV46LWHnQ==; 3:+JrlYllup7WSzeqlemgzRW+nxYS8zTzLtg4x7cWQ4/MLipeTB76M18M9Yh6wEgVITuEUxamgxDAxuYbdV3o34gcDUxVvKSodDAf1TAxQnZuprpxBnXO5nyYF7PSG+dhEFJdhiaUt8AHYSKPwKHytnRe1/VZyaB+lAnmZkAb9J2i1RBQ71DSfn9zacoCsIXVRs9A12vuEv96Zm1ExOomEYj2kKVRdM/Fuaj/RxJEJORM=; 25:vpVbEKe27ejABfegILpy1CbOrM8HgGdEgWvU8WWglvPjF3TBeRFZbuxpXm1dWRv/4FxNqH5/wXib+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dNtZUV09gWEWA9YT43Yb1u7XBGlI/dlLsx6u0j X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046); SRVR:CY1PR0301MB1258; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1258; X-Forefront-PRVS: 07943272E1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1258; 23:FfC8OdB9FgKEn6d2J57645hLID5hT4iuVHhjDko?= =?us-ascii?Q?HhbYuV0a52tu9DNgLeOQEPMCew02XcdAQH7ketf3xyHqlE1oh7EKdFDdATrM?= =?us-ascii?Q?XK7bzEcnKz+rW/igbe9n2YFZWujCE+Q1ZsgEk4J39e7If0CWgrqe321yE/ya?= =?us-ascii?Q?iy7US14ktELNubtc/z3xjYTgI6asOXEiAHS0yIEplZ/puP3krcZSfao9uxJy?= =?us-ascii?Q?/YBLgP4CEqo4bxWja27B+qJLDqNUfu9h/ChBEUSw+kQCXQYo8OFFfMqiPBPG?= =?us-ascii?Q?VRi+fTa4fgb6uHFUjsJarZ1Gw7f5avYA3yGJJqWUeyp3gS4OIXwU/8mYlLqz?= =?us-ascii?Q?rcAwbczxHFGYeKeaKjyWfdXjATOTPadLVySXn0HKi4ibMMbnsM8lsJw9E2+r?= =?us-ascii?Q?AHh2JJGF+yt3OU55MFl2CPVA8Td4vRSUmCQoCxfJsfEwYXVFbbWmsL/l2FIE?= =?us-ascii?Q?zHgQuNY8WjdwSo/Lwg/G/91LcBAf124EyWer7rVCKGXC1jX9eA7H9kAoMauz?= =?us-ascii?Q?erWUlDoF3PqmPbrNvdip1vL7WcgsqMmP2HAuEm5XLHq7eRiVK7OAR0G1CB+5?= =?us-ascii?Q?pn9GJ9IQUoFMkWVUq8FAU33KkN65KzYAe5y/Rlc4HEecKkL+PDMNJXwNXabz?= =?us-ascii?Q?GFIeLy2e8lquG2YqAcC7aYqUnHKV5TH7gw3IlBEBSSABJ7mdbeItJKV3JN6Z?= =?us-ascii?Q?+jUglsRt7Xoyb2fuYc2dvliKRHtqYsOnICfRoBUGHfHe/syT+J+Gff2uVDmF?= =?us-ascii?Q?QsvWuW2yWYFnrrVK4xV3GiuiXu/NNc4Jnvdj/Evsj4u9ypgnxPziY6PB6ubC?= =?us-ascii?Q?cISxHX8Tz3HN5D6JO4rVtOSBsQRpJtpkLiSGQUKZLiH4INrOQRNEzwm0s83j?= =?us-ascii?Q?GhWOVh7gMVopDaLzRf5iENAlnsA8KpNeaWpuZFZkZMYE/xqKrHNk45n3rBRy?= =?us-ascii?Q?62Hjl/tu9eX/hCozTQN1NK3piTgHr3eD7P3Xz1Eh8gkFqIZhQDFgYLizWR/a?= =?us-ascii?Q?85LiW8X305ICM478DaScrwjlqNgz98xy1ET0QA3BjugODCiiuhJbc5qDOE3+?= =?us-ascii?Q?cwAJT4LU=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1258; 5:XWYT9k3LT0LWhI+fDJ2ra+FNo53UgbrggLt6qrXOc1wza73OO+9bQHyw7CuONgGsLO4E6tu6LT1jtIg3MJA918Z8sWAtyO1iaqv991bAXqDuMtA5D1/Mw5WZMXGhBs/wa93M4liZFeVDgftRhtAxgg==; 24:F/d05I/4qoOlSGQvzaHxgCK4DkXroJnkZ+rVWoDAZNAonB39vMq9OdfAHppJic2wiT46hZWWkcJX+WQRT3psMTyG3crKdAUbMbplcnKjWJM= X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2015 08:51:28.6231 (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: CY1PR0301MB1258 Cc: alsa-devel@alsa-project.org, Zidan Wang , Xiubo.Lee@gmail.com, tiwai@suse.com, nicoleotsuka@gmail.com Subject: [alsa-devel] [PATCH v3] 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. v2->v3: add a simple comment in code to describe the hardware bug. sound/soc/fsl/fsl_sai.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 8832901..fef264d 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -564,6 +564,24 @@ 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); + + /* + * For sai master mode, after several open/close sai, + * there will be no frame clock, and can't recover + * anymore. Add software reset to fix this issue. + * This is a hardware bug, and will be fix in the + * next sai version. + */ + 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: