Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11816300ybi; Fri, 26 Jul 2019 00:02:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFY9KcDdDtXWo9tcI85zArEcOy1VAyyiCIfTDKSIN0b4ys/ok2exhAZKhDVB1tFfI+IqYt X-Received: by 2002:a63:2f44:: with SMTP id v65mr88167741pgv.185.1564124576943; Fri, 26 Jul 2019 00:02:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564124576; cv=none; d=google.com; s=arc-20160816; b=NpIQcEpQhptwSRk2oyJeIvh87B+zwtIepszepyxWt5xy1uY5fmBvdGln6RAQXmm99o SvIoGKPTWPbTOtcbZXwUgjpBLasMtzHdCLg2baGmjFcTbAijLUE2g0oPFRJJI5xsQhfH p0afT7AYsbc56TdHDgWyb/VzLtjOUDfL9g1rcB9NEwnnNzUrDIbQWrBAOJxEh85nsTAI kZUDyKYosWdyRtcyVHc8/YGuC6+6mtyrjUytwfksZW+4LUptzHEife5PIcX4vSA49qSb 2R1dMkeqvIuxb3bDtaB2Zl5GF5g10n0mwxUlwhW1ggwr9hIlSifd60ZBXLqEXD31FvAU ErAw== 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; bh=Z6D1IPWiRmm2bGUc7qV9lUeyeAcy8cqADWqfIr0HU2w=; b=Z5aFu1aM4xnwtWV6/FZax+at3vMbNA4ekH+YSN9lz0KqTZn21Ktot2EwWR6udfU0rl Guq69MfFKCc4X2J9PWCJ2GwJ/vAGeMv6nAA2SwVpbO4HtLNWP+Q7NN8k6bZdjKb5X3ML d2KYsig7rNsbn3tOh0Z+PUfi0a27X/5Fc/O3G+Aa5mKQvjx41ZJIoV7cxLuHLPqwK1vU soSTcouEMQzXd1REe+Fcq3jAIvs5p+aKXKA3KwsdynHSh6n2RNMlB2D0ONvwsO/Q3pwt pCiIrkjOl+VwtejYKqnCEvkigfoCG2PBG3c6HQoporF6jShNvip3E0Rly0EaeUWQKBPv LdIQ== ARC-Authentication-Results: i=1; mx.google.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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f32si16700559pje.70.2019.07.26.00.02.40; Fri, 26 Jul 2019 00:02:56 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725981AbfGZHB7 (ORCPT + 99 others); Fri, 26 Jul 2019 03:01:59 -0400 Received: from mga11.intel.com ([192.55.52.93]:4051 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725836AbfGZHB6 (ORCPT ); Fri, 26 Jul 2019 03:01:58 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jul 2019 00:01:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,309,1559545200"; d="scan'208";a="170537755" Received: from gliakhov-mobl2.ger.corp.intel.com (HELO ubuntu) ([10.249.35.244]) by fmsmga008.fm.intel.com with ESMTP; 26 Jul 2019 00:01:55 -0700 Date: Fri, 26 Jul 2019 00:31:01 +0200 From: Guennadi Liakhovetski To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, tiwai@suse.de, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, jank@cadence.com, slawomir.blauciak@intel.com, Sanyog Kale Subject: Re: [alsa-devel] [RFC PATCH 15/40] soundwire: cadence_master: handle multiple status reports per Slave Message-ID: <20190725223100.GC16003@ubuntu> 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.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 25, 2019 at 06:40:07PM -0500, 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); Superfluous parentheses. > + > + switch (val & 0x3) { > + case 0: > + status[i] = SDW_SLAVE_UNATTACHED; > + break; > + case 1: > + status[i] = SDW_SLAVE_ATTACHED; > + break; > + case 2: > + status[i] = SDW_SLAVE_ALERT; > + break; > + default: There aren't many values left for the "default" case :-) But I'm not sure whether any of + case 3: or + case 3: + default: would improve readability. Thanks Guennadi > + status[i] = SDW_SLAVE_RESERVED; > + break; > + } > + > + dev_warn_ratelimited(cdns->dev, > + "Slave %d status updated to %d\n", > + i, status[i]); > + > } > } > > -- > 2.20.1 > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > https://mailman.alsa-project.org/mailman/listinfo/alsa-devel