Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1455834ybi; Fri, 2 Aug 2019 16:19:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9TTVxy7EC0EOF7ltnVll5HJ8ry+qy0pwoEEe6N7JyHUr6cukDuhuMpH1uAD385kEI3LQV X-Received: by 2002:a17:902:2889:: with SMTP id f9mr126480956plb.230.1564787990607; Fri, 02 Aug 2019 16:19:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564787990; cv=none; d=google.com; s=arc-20160816; b=iU8fq20sEOEu2Lo8KnQm54+Z+79KLhOe4Kz03C2x6e1OJYlIW7CWhuhpFBmEnc2TPS 4yxp/VJmIK2H1rmqR1F+xamif+smsIzA5fuyv5iYZXI0TmHmRzkysdwKAH9zRzaMgI2j zN/4Fqr3Z3HeLKaaruSA0PA9sNTvl/VKlu39mcAN9H2VqIX5fwkCHWVPJnX8VYdaaIzA 4zw8NQscxDDzvEGRQpXY18WBaswEl2R8omvMqjbAOJB5yvYOJ3g/+ObS2l9cJdJ/NM6m WabaDSobFOGg22R1X2biZBtkqF92FdHbitMoPO03sHtLWSfuSgYnG7W0kkvDcr6mBaYe dxsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YAWP/q1+8eb1ybl+Im3Rf/zZDPg/Rwc70X7ZNUoczG8=; b=am9mBibUOFS5cxommoErzlzV0imArd0QiAm3B20EwojBBCu5OrFXsn0aLMl0r0ROOy Ki5jGOOSfwLBmhUCeI/m5qWkMJSGYJHehufYyMe5cc2YXtX/Mhjh0Q+Vc4OV5t9eEZSr xHkW/BQH+/1HaUDGguvsIAYk5hmTIltP6CzQLyrOh4oIgOP0uUnQD2aUkB9+TI2DTcQk ChPHJJXgQ7akUgT8TzhDueA4kU152oB+7/ZJ8wMmDMvYEjLnd+wmWoxRE+oii92BRQXn oEpAh8xpmoGIu0mCu5VFg7gHNX98hWPP4gTRByZxOWB2LegK9c0cvZ/FBJ/MkkkrrqLa QrAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BekoZ6qt; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 185si72437993pfa.40.2019.08.02.16.19.14; Fri, 02 Aug 2019 16:19:50 -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=@kernel.org header.s=default header.b=BekoZ6qt; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388110AbfHBMVS (ORCPT + 99 others); Fri, 2 Aug 2019 08:21:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:34782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729422AbfHBMVR (ORCPT ); Fri, 2 Aug 2019 08:21:17 -0400 Received: from localhost (unknown [122.167.106.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C8BC32184B; Fri, 2 Aug 2019 12:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564748476; bh=SQAMv/GjRtBugvtxOJvDkEzBbx5en47q4GkvzPSXWfA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BekoZ6qtwpJXcE8GkxJd8wDRfQ56P5nTr4BJmBMzke7A8zAcU5VhQjNje/C4YtZ6c Fkcd3MFuAxUnTC0pfqp6TjQ3WD8OA8jNLs1JIOu33/eY4KnoJhxejAPG0HgtNXJ0v4 +/l2hUDYGTOsVbLu6Tkc2xyL43SxP8dbIT6kKs6k= Date: Fri, 2 Aug 2019 17:50:03 +0530 From: Vinod Koul To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, slawomir.blauciak@intel.com, Sanyog Kale Subject: Re: [RFC PATCH 15/40] soundwire: cadence_master: handle multiple status reports per Slave Message-ID: <20190802122003.GQ12733@vkoul-mobl.Dlink> References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> <20190725234032.21152-16-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190725234032.21152-16-pierre-louis.bossart@linux.intel.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25-07-19, 18:40, Pierre-Louis Bossart wrote: > When a Slave reports multiple status in the sticky bits, find the > latest configuration from the mirror of the PING frame status and > update the status directly. > > Signed-off-by: Pierre-Louis Bossart > --- > drivers/soundwire/cadence_master.c | 34 ++++++++++++++++++++++++------ > 1 file changed, 28 insertions(+), 6 deletions(-) > > diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c > index 889fa2cd49ae..25d5c7267c15 100644 > --- a/drivers/soundwire/cadence_master.c > +++ b/drivers/soundwire/cadence_master.c > @@ -643,13 +643,35 @@ static int cdns_update_slave_status(struct sdw_cdns *cdns, > > /* first check if Slave reported multiple status */ > if (set_status > 1) { > + u32 val; > + > dev_warn_ratelimited(cdns->dev, > - "Slave reported multiple Status: %d\n", > - mask); > - /* > - * TODO: we need to reread the status here by > - * issuing a PING cmd > - */ > + "Slave %d reported multiple Status: %d\n", > + i, mask); > + > + /* re-check latest status extracted from PING commands */ > + val = cdns_readl(cdns, CDNS_MCP_SLAVE_STAT); > + val >>= (i * 2); > + > + switch (val & 0x3) { > + case 0: why not case CDNS_MCP_SLAVE_INTSTAT_NPRESENT: > + status[i] = SDW_SLAVE_UNATTACHED; > + break; > + case 1: > + status[i] = SDW_SLAVE_ATTACHED; > + break; > + case 2: > + status[i] = SDW_SLAVE_ALERT; > + break; > + default: > + status[i] = SDW_SLAVE_RESERVED; > + break; > + } we have same logic in the code block preceding this, maybe good idea to write a helper and use for both Also IIRC we can have multiple status set right? -- ~Vinod