Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3329532ybg; Mon, 28 Oct 2019 11:06:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxOKqq9/+x8GvXqJoO977eNXCokXJxPtfhbL/6OTCnRqNxEKlyTjVwM3+/jjIBYIJj/0ae X-Received: by 2002:a17:906:80c1:: with SMTP id a1mr18146660ejx.37.1572285995248; Mon, 28 Oct 2019 11:06:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1572285995; cv=pass; d=google.com; s=arc-20160816; b=hCOyGxdy4w4CkpVV1uD8peMgLETs4Rs7nubGlVwv/Aqk+HznJQpLwuOFYCIsxV3f3j ZjF3rgPkB0v9YHTaV1Gh15t9SLniUaMA3Z4Hg+pcUPAY81dIblAFXCVNv0Ay6Rt6AFWF pcnxpj8iUXFW2Ynf/fGXvjeybPXEzcihQDlrMFbhjkMV9yUQOojq6aQ1iwah8h59B0u4 khEr2oAy5K5752CUrf7ylW5AsUj7156reIJjPGql3SKhNgrckTtUB2+3rCmhEllgUog2 46eWld9DGMq+DDl27rM4SH6Pzn70vSuK+XGK7kA+lY2Uez9V6RH0NbApB2k9qf4ubP15 Se8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=hh+MnHDOR6FKVUKWefs3YTRv+AL+3LYegFZgSqg3dmI=; b=AufQpsF60m+9kunyWgroGoSpbSdxmOwl9IqirPauOc9mX60CK6g5WuJ2dsATHThstk uQRtxBU2kmhpdfzQ0TLcPUXOR/lkw5qFk+AGUrggxYlK1RxO48Ge2tyRvveQm5Q+08lI EUTDo9sO6L1y1pFr8aF6/b3/bTaEzFvPkxzIPcMYDYqY47VYxvt3SnnCgJCvP3GapzXv j420ArjAcv/GILaCZWQlxiJWILWd0sD1pH/mhZVu05Ot0DGL0x8Ai6mk58cuPmlI7JPX Yl37nK770uP64cNA/wRaxXb3sjh1m2eNyRYe6/RZNOiD4fz9zr6hnXGhtFApejmoG3Hr UVCg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=UiyCZN+G; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23si8884784edc.46.2019.10.28.11.06.11; Mon, 28 Oct 2019 11:06:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=UiyCZN+G; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733042AbfJ1Hr4 (ORCPT + 99 others); Mon, 28 Oct 2019 03:47:56 -0400 Received: from mail-eopbgr130079.outbound.protection.outlook.com ([40.107.13.79]:41185 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729695AbfJ1Hrz (ORCPT ); Mon, 28 Oct 2019 03:47:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A5s6FYE6vH5liyocQfY+b8dKkKH7lG/7jjCNRcgvDUSYQNLveMrk/0KBQWQRGmC/bFVkmsnchcp3VU00Wzl4Lsi9KYRt4ERLmLoaF/tgtmbHdHXjh1W52D6ME/9UD/W0jCeORQ8TECEa9MTKnEeryf9Br0SA2rQ5BXuvTzoj0vfN7JwXJkuXXgxLaGffC4IehCRoEjudp5WqmOrBstgEcFV7qHxetpuUBnKPx9Lz8rZklo/XIEA/POMiKoWZD7H0RI/mDbEBCUrIAgT0IiD87HH82P7EIKTPx3AEQKI5ZBVDUo1pnCFIC1qQX86SqrrUCiEt6CM2UdxzT5Zy20eO+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hh+MnHDOR6FKVUKWefs3YTRv+AL+3LYegFZgSqg3dmI=; b=FKIlYdBcDVbnlqPCDLaBFS6seYCDGkZGGWHbWI7sVENtDMD1gJ1iksA0Jb2+MLPr/91Om5j0eG7UVWsedn+SKkO+eVPkZZ5ODRWNliIPaPKQPc/uyAxpgVcIOlQ2JI6sCr7iB5fFJsoqaVg9wdSy06zAiDalolU14Ev6JnkPuZwNt73O2rTuQLSXPZDhvh00Fyi/R8h4/pqBbIymrDNuem3NIYBf5TpC+h2w7QwD3iyfzm1S4H6iEclOABqdZ4DXNYeQwW8dbPPKl2N2hBw+ty4+71T1dNgynnvwRhvHt1OMzd1w44D7lek8HIknnyovjLWlcowc4GjHOPYIwjBiSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hh+MnHDOR6FKVUKWefs3YTRv+AL+3LYegFZgSqg3dmI=; b=UiyCZN+G11opAVJJ/W3Ss2rvoGBUomgXr2qplSmZuFrhoAWMKRpTdxQr7QgPEmSQXpcMneOOKfnmB++Lf9YgtllescFzi6J2fUG8dYCcPxvh1x8m3RAQMdxXSGnu9BVbwrwdL3/QMEjG+sD5QYf6eay3VKljuAmgM4vp3D7Xivs= Received: from VE1PR04MB6479.eurprd04.prod.outlook.com (20.179.232.225) by VE1PR04MB6430.eurprd04.prod.outlook.com (20.179.232.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.25; Mon, 28 Oct 2019 07:47:51 +0000 Received: from VE1PR04MB6479.eurprd04.prod.outlook.com ([fe80::e052:9278:76a3:27c]) by VE1PR04MB6479.eurprd04.prod.outlook.com ([fe80::e052:9278:76a3:27c%6]) with mapi id 15.20.2387.025; Mon, 28 Oct 2019 07:47:51 +0000 From: "S.j. Wang" To: Nicolin Chen CC: "timur@kernel.org" , "Xiubo.Lee@gmail.com" , "festevam@gmail.com" , "broonie@kernel.org" , "alsa-devel@alsa-project.org" , "lgirdwood@gmail.com" , "perex@perex.cz" , "tiwai@suse.com" , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH V2] ASoC: fsl_esai: Add spin lock to protect reset, stop and start Thread-Topic: [PATCH V2] ASoC: fsl_esai: Add spin lock to protect reset, stop and start Thread-Index: AdWNY/owwLufHxxAQSqOpSi0OV5oBg== Date: Mon, 28 Oct 2019 07:47:51 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shengjiu.wang@nxp.com; x-originating-ip: [92.121.36.197] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: f447758a-d31a-49a2-47bc-08d75b7b22b4 x-ms-traffictypediagnostic: VE1PR04MB6430: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 0204F0BDE2 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(39860400002)(346002)(136003)(396003)(376002)(189003)(199004)(2906002)(305945005)(25786009)(7736002)(74316002)(7416002)(66066001)(229853002)(52536014)(6436002)(4326008)(76116006)(64756008)(66556008)(5660300002)(66476007)(66446008)(66946007)(8936002)(55016002)(6916009)(9686003)(54906003)(316002)(6246003)(99286004)(81166006)(81156014)(8676002)(1411001)(71190400001)(71200400001)(33656002)(14444005)(256004)(102836004)(7696005)(486006)(6506007)(186003)(26005)(478600001)(86362001)(14454004)(6116002)(3846002)(476003);DIR:OUT;SFP:1101;SCL:1;SRVR:VE1PR04MB6430;H:VE1PR04MB6479.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: d96KwWFhzAkrV7UqcWZisV0YSdWxS1LCA38z4vHivyAm7dZazowLYJ3mI4QQ+vDRbojkr0zCDq4GV7EWsG119Cnr/BxmnX5Gb26HHUwsZx1C/3To0ajQjmiSenkNvGDiMU5ihwe66PyyKtuUN3sDdtGydR5/VB+ZuhVA4SXWJp/PpH4YBb0+MQWcUdUSCAmH5sGklj1CLx8mbYAsRPqNnDFBqVCucGt3KDD8S9gpcLruM3QPriC21tYLeCuq5X9YqUNR6mcLxnLTCLmiXyw7uizQqP7n++FMoXaMQ1xnm8dSMNT7+0nBMx8HhjCxvBQwNTUS73UpuTna1Hp8eVuImSYgx8EWkAZn/02Xx/mVI0FtoC8gCjzLlpse60z3bXj40CSAoOEcg3dKcIrMTcYNZa/nHGyTrmjv9sdgva1mE0fQXbu47No1cnL1Lb1MH1BT x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f447758a-d31a-49a2-47bc-08d75b7b22b4 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Oct 2019 07:47:51.6530 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: F3lf0gtxnJQQ/k7s415xoPKpweRgrhcqH/dNZW6jDajznrKoLOJgx2ll04mHJMmKmvtFOhZ+a1VDFL4SH+iQ7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB6430 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi >=20 > On Fri, Oct 25, 2019 at 03:13:53PM +0800, Shengjiu Wang wrote: > > xrun may happen at the end of stream, the > > trigger->fsl_esai_trigger_stop maybe called in the middle of > > fsl_esai_hw_reset, this may cause esai in wrong state after stop, and > > there may be endless xrun interrupt. > > > > This issue may also happen with trigger->fsl_esai_trigger_start. > > > > So Add spin lock to lock those functions. > > > > Fixes: 7ccafa2b3879 ("ASoC: fsl_esai: recover the channel swap after > > xrun") > > Signed-off-by: Shengjiu Wang >=20 > Some small comments inline. Once they are addressed, please add: >=20 > Acked-by: Nicolin Chen >=20 > Thanks >=20 > > --- > > Change in v2 > > -add lock for fsl_esai_trigger_start. > > > > sound/soc/fsl/fsl_esai.c | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > > > diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index > > 37b14c48b537..9b28e2af26e4 100644 > > --- a/sound/soc/fsl/fsl_esai.c > > +++ b/sound/soc/fsl/fsl_esai.c > > @@ -33,6 +33,7 @@ > > * @fsysclk: system clock source to derive HCK, SCK and FS > > * @spbaclk: SPBA clock (optional, depending on SoC design) > > * @task: tasklet to handle the reset operation > > + * @lock: spin lock to handle reset and stop behavior >=20 > Should be "between hw_reset() and trigger()" now. >=20 > > * @fifo_depth: depth of tx/rx FIFO > > * @slot_width: width of each DAI slot > > * @slots: number of slots > > @@ -56,6 +57,7 @@ struct fsl_esai { > > struct clk *fsysclk; > > struct clk *spbaclk; > > struct tasklet_struct task; > > + spinlock_t lock; /* Protect reset and stop */ >=20 > We can drop the comments here since you add it to the top. Here is required by the checkpatch.pl, so still is needed. Best regards Wang shengjiu