From patchwork Wed Jan 26 01:15:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 12724425 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DC776C5AC75 for ; Wed, 26 Jan 2022 01:16:45 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1F2331F6B; Wed, 26 Jan 2022 02:15:54 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1F2331F6B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1643159804; bh=4ie7NmQiHe1ezeLtR9C2w+62rfFvkBb3pIYs6EglC0g=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=GAojtb+7vSguGd5YB+gB+X3F+cJcrwH4W1vOFxFw82v2zE17sfZJbf3us4Qqvz4PV Yzh/AkVpEK2nC9gL60AeIqqDvcM7je9mdzpyKL22CG0f/7en0uvIYlv2UW3lyom/Vn 1KIwVJuCFKDaF2lLkvu530NVKAQznmMbHYk5j4Ok= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3DC66F804D1; Wed, 26 Jan 2022 02:15:51 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CDA5FF804D2; Wed, 26 Jan 2022 02:15:49 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id EDAFBF80118 for ; Wed, 26 Jan 2022 02:15:40 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EDAFBF80118 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="k1R8vndN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643159744; x=1674695744; h=from:to:cc:subject:date:message-id; bh=4ie7NmQiHe1ezeLtR9C2w+62rfFvkBb3pIYs6EglC0g=; b=k1R8vndNNZL0xL7CPyHM2UmCgb6fbfS6z7rANRXohSmlN5CXdYdlfpZx Yo/poATUdo4GmdRGxsTBQX1PXt203+wih8EC2/KEo6KO27yxBp+yJ+Y4L 7JLgQjgyss74eVH3rR6VC78HGvABqihEycx7MfK/DR3HkDa1cAlb68O8z mrDnLZbqvK+VXUjVwAqq/fiWk6CYc6pa0MuGBe0R9SzLqx0Lee8UdZYld cFP/9/BeuEZVqtrCfer3ee08WsHKcgawBkBpu3rByqzQYsEtP6nCwfyPN ACT0mvW/l8aNO8sXV4AeSYlLPzMQJN/+V0F8RL1nPXEjHMr1YeAvK7N3X g==; X-IronPort-AV: E=McAfee;i="6200,9189,10238"; a="246235779" X-IronPort-AV: E=Sophos;i="5.88,316,1635231600"; d="scan'208";a="246235779" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 17:15:38 -0800 X-IronPort-AV: E=Sophos;i="5.88,316,1635231600"; d="scan'208";a="520616673" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 17:15:35 -0800 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org Subject: [PATCH] soundwire: bus: add dev_warn() messages to track UNATTACHED devices Date: Wed, 26 Jan 2022 09:15:27 +0800 Message-Id: <20220126011527.27930-1-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.17.1 Cc: vinod.koul@linaro.org, gregkh@linuxfoundation.org, pierre-louis.bossart@linux.intel.com, linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, sanyog.r.kale@intel.com, bard.liao@intel.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" From: Pierre-Louis Bossart In rare cases, some devices seem to lose sync and never re-attach on the bus. This seems to happen only when there are more than one device per link, which suggests either an electrical issue, a race condition or a state machine issue. Add two dev_warn() messages to identify the sequence by which the devices become UNATTACHED. BugLink: https://github.com/thesofproject/linux/issues/3063 BugLink: https://github.com/thesofproject/linux/issues/3325 Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Bard Liao --- drivers/soundwire/bus.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index 67369e941d0d..354d3f89366f 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -1749,8 +1749,11 @@ int sdw_handle_slave_status(struct sdw_bus *bus, continue; if (status[i] == SDW_SLAVE_UNATTACHED && - slave->status != SDW_SLAVE_UNATTACHED) + slave->status != SDW_SLAVE_UNATTACHED) { + dev_warn(&slave->dev, "Slave %d state check1: UNATTACHED, status was %d\n", + i, slave->status); sdw_modify_slave_status(slave, SDW_SLAVE_UNATTACHED); + } } if (status[0] == SDW_SLAVE_ATTACHED) { @@ -1785,6 +1788,9 @@ int sdw_handle_slave_status(struct sdw_bus *bus, if (slave->status == SDW_SLAVE_UNATTACHED) break; + dev_warn(&slave->dev, "Slave %d state check2: UNATTACHED, status was %d\n", + i, slave->status); + sdw_modify_slave_status(slave, SDW_SLAVE_UNATTACHED); break;