public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
From: Cole Leavitt <cole@unwrap.rs>
To: vkoul@kernel.org, yung-chuan.liao@linux.intel.com
Cc: pierre-louis.bossart@linux.dev, david.rhodes@cirrus.com,
	rf@opensource.cirrus.com, lgirdwood@gmail.com,
	broonie@kernel.org, perex@perex.cz, tiwai@suse.com,
	linux-sound@vger.kernel.org, patches@opensource.cirrus.com,
	linux-kernel@vger.kernel.org, cole@unwrap.rs
Subject: [PATCH 1/2] soundwire: bus: downgrade expected unattach warnings to dev_dbg
Date: Tue, 17 Feb 2026 16:35:32 -0700	[thread overview]
Message-ID: <20260217233533.4716-2-cole@unwrap.rs> (raw)
In-Reply-To: <20260217233533.4716-1-cole@unwrap.rs>

The sdw_handle_slave_status() function emits dev_warn() whenever a
peripheral transitions to UNATTACHED from a previously ATTACHED state.
While useful for debugging genuinely unexpected detachments, this
warning also fires during normal operation when a codec driver
intentionally triggers a system reset (e.g., after firmware download),
causing unnecessary noise in the kernel log on every boot.

Add an 'unattach_pending' flag to struct sdw_slave that codec drivers
can set before triggering an expected detach. When this flag is set,
the bus layer emits a dev_dbg() instead of dev_warn() and clears the
flag, preserving the warning for genuinely unexpected detachments.

Signed-off-by: Cole Leavitt <cole@unwrap.rs>
---
 drivers/soundwire/bus.c       | 9 +++++++--
 include/linux/soundwire/sdw.h | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index fb68738dfb9b..a5a71ab1feed 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -1899,8 +1899,13 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
 
 		if (status[i] == SDW_SLAVE_UNATTACHED &&
 		    slave->status != SDW_SLAVE_UNATTACHED) {
-			dev_warn(&slave->dev, "Slave %d state check1: UNATTACHED, status was %d\n",
-				 i, slave->status);
+			if (slave->unattach_pending)
+				dev_dbg(&slave->dev, "Slave %d state check1: UNATTACHED (expected), status was %d\n",
+					i, slave->status);
+			else
+				dev_warn(&slave->dev, "Slave %d state check1: UNATTACHED, status was %d\n",
+					 i, slave->status);
+			slave->unattach_pending = false;
 			sdw_modify_slave_status(slave, SDW_SLAVE_UNATTACHED);
 
 			/* Ensure driver knows that peripheral unattached */
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
index f462717acf20..4318f2b144e1 100644
--- a/include/linux/soundwire/sdw.h
+++ b/include/linux/soundwire/sdw.h
@@ -682,6 +682,7 @@ struct sdw_slave {
 	struct completion enumeration_complete;
 	struct completion initialization_complete;
 	u32 unattach_request;
+	bool unattach_pending;
 	bool first_interrupt_done;
 	bool is_mockup_device;
 	struct mutex sdw_dev_lock; /* protect callbacks/remove races */
-- 
2.52.0


  reply	other threads:[~2026-02-17 23:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-17 23:35 [PATCH 0/2] soundwire: suppress expected unattach warnings during codec reset Cole Leavitt
2026-02-17 23:35 ` Cole Leavitt [this message]
2026-02-17 23:35 ` [PATCH 2/2] ASoC: cs35l56: set unattach_pending before SoundWire system reset Cole Leavitt
2026-02-18 10:14 ` [PATCH 0/2] soundwire: suppress expected unattach warnings during codec reset Richard Fitzgerald
2026-02-18 10:50   ` Pierre-Louis Bossart
2026-02-18 11:01     ` Richard Fitzgerald
2026-02-18 12:49     ` Charles Keepax
2026-02-18 13:55 ` [PATCH v2] soundwire: bus: demote UNATTACHED slave warnings to dev_dbg Cole Leavitt
2026-02-18 14:00 ` [PATCH v3] " Cole Leavitt
2026-02-18 16:52   ` Pierre-Louis Bossart
2026-02-18 18:02 ` [PATCH v4] soundwire: bus: demote UNATTACHED state warnings to dev_dbg() Cole Leavitt
2026-02-23 15:20   ` Richard Fitzgerald
2026-03-09  7:05 ` [PATCH 0/2] soundwire: suppress expected unattach warnings during codec reset Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260217233533.4716-2-cole@unwrap.rs \
    --to=cole@unwrap.rs \
    --cc=broonie@kernel.org \
    --cc=david.rhodes@cirrus.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=rf@opensource.cirrus.com \
    --cc=tiwai@suse.com \
    --cc=vkoul@kernel.org \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox