Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11444116ybi; Thu, 25 Jul 2019 16:42:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0yka3ANYVMokhWnh2KqBMG3qCWPfpPac8DiQzbn1xOjk0gMpjHRQWWbFdKzH1+Xf3gnlw X-Received: by 2002:a62:e515:: with SMTP id n21mr19388273pff.186.1564098165720; Thu, 25 Jul 2019 16:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564098165; cv=none; d=google.com; s=arc-20160816; b=WB/rsMCkVa0k+kD+tauBq30qlEBU6qrBk/gTLFsG48G063jb9km4Jd2LvpQG2fiayD M+XpJa5nh6uOVHH6meUUMZAXZzVL0lTukU28FxKx3yyjAlIDZXkMrAYNb+uYJuFPUSFp sjVE8jIYbqwMe53NlpBsaZDyeXPHcTN/JymiTFZnYkaWOoU1wohBMEna7H0pjec+jF+v 5wxwKvxPDDtFMA9svSA78B3GMA5FSJp4up10m69MpcI0MsCbSAlY3B4tO7C8Yl129L67 TOUKk0FhxDT4Bo0gc3sJex8LrwjZGcGkdhL5Z8Dg2E5SrrPeytSILGamG70EXAyMjqEt HhFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=h3XiiZiCOa0GiapHki2ND73sftRSjaeoELIamBUwDgs=; b=VAIbPOfRtJzFFkI47Q/Vn5Qcme6+4fAoK8M83H1UF8xoLEWuDqpB21fmBF2G8zOwk9 785FYmPdEA1h/b8PInD/7Y6H5rAPi7KaAVJmf+vYfbma8UKuC9wjBDmNT+wSnuS9fPat Kt5kjIkVlpDErhaab+A3KWRHqa6883JH4cLAHLRh9my/Lu5Zsbto73ex4Yudqu8liq1Y 5I8s3QWjrxdl48P5n0vTUZ5hEFDC+jPricathot8AV4LC4x9DxKZBjsKOVQ9D7ylRoD5 Z9MI10b6gggmHeHCkY9xgHTleGtp9/k7LU6Iv3cjC9ORFqLLKEJKCLsxEdFT8X0I1tAK 9RhA== 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 s24si21446821pgm.327.2019.07.25.16.42.30; Thu, 25 Jul 2019 16:42:45 -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 S1727353AbfGYXl0 (ORCPT + 99 others); Thu, 25 Jul 2019 19:41:26 -0400 Received: from mga06.intel.com ([134.134.136.31]:51808 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727300AbfGYXlW (ORCPT ); Thu, 25 Jul 2019 19:41:22 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2019 16:41:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,308,1559545200"; d="scan'208";a="369874711" Received: from amrutaku-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.255.230.75]) by fmsmga006.fm.intel.com with ESMTP; 25 Jul 2019 16:41:21 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, vkoul@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, slawomir.blauciak@intel.com, Pierre-Louis Bossart , Sanyog Kale Subject: [RFC PATCH 15/40] soundwire: cadence_master: handle multiple status reports per Slave Date: Thu, 25 Jul 2019 18:40:07 -0500 Message-Id: <20190725234032.21152-16-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: + 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; + } + + dev_warn_ratelimited(cdns->dev, + "Slave %d status updated to %d\n", + i, status[i]); + } } -- 2.20.1