From nobody Fri Apr 3 01:29:33 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABBC53D0909; Wed, 25 Mar 2026 11:42:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774438931; cv=none; b=pFwOmhjkDLlSA6IGXscjtrHhCd1sL3gkh7GDA9Kaf8FSjgTgPvm5qnQhFMiykLYiweMzVcUS9wO8Wo1OCYk62YAu1HHCSj+4wOhyqsuxU/QBKJ3G5DLW3tZXQ+06fw1bNOPKdZjxbYoQyZhpVdkp9r1AlBpYHUxdg7VeA7LQ4eA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774438931; c=relaxed/simple; bh=v/FtdyqYqM6XmYIAUEAXApbL23Nchrm1fV+xHfiiy1U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AuDkEijDKsEySpH59Hrf9uTI3U6q+AphKvUeVT37kOOSFF0Myk4EneOffCklZQMoCj8fgrJWk7IcOJ4LQGKQ+7peCAHVqKh6BG+PPOtc+D3xtVQY0q2Pbogs30cm0KUiLdPwDRAkiwgyCXq6Jb0kxz5yoCKong8/CsB0evViDnY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gJajka1C; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gJajka1C" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1774438930; x=1805974930; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v/FtdyqYqM6XmYIAUEAXApbL23Nchrm1fV+xHfiiy1U=; b=gJajka1CTfGZeaT5c8alCu1Y8LH2+03cclZraveBgQ+fIxD0S1ktc3rO +7ql+17uO9bpHQ4ErgGJ/qsYNKUau08BtPPJQ/YspwrAIuMm9D/35HL6M 5ItkpS6JuyuO6cy2YHk8VZfY2ZCgoBMsXhDlmSNsr844bElQPRmWZWcxS ThYA6CtgihJeIBZhjSCXOmlHkjZtAOxMt/HGGdnhSvfCczAOSXrEhLg98 kiETXriEoTEM4O8OqK7avAJZVgeWBU9NTUjx2O9+pJG1s57x9AMdr2Dzv tjFiurwrzSHv2toVa607yBiXQvgo3uci1CEWtlBRRoWKqoZYaf9Vk0INM g==; X-CSE-ConnectionGUID: LSI4m7G8SUy8UHrFIz6azg== X-CSE-MsgGUID: 3CXF1k88SSW6xlNFQaFavA== X-IronPort-AV: E=McAfee;i="6800,10657,11739"; a="63020048" X-IronPort-AV: E=Sophos;i="6.23,140,1770624000"; d="scan'208";a="63020048" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2026 04:42:09 -0700 X-CSE-ConnectionGUID: cDTgsJ18RVusKLJaccPeBA== X-CSE-MsgGUID: zXBypTLySJy31diCSYU1BA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,140,1770624000"; d="scan'208";a="220253777" Received: from yungchua-desk.itwn.intel.com ([10.227.8.136]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2026 04:42:07 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.dev, peter.ujfalusi@linux.intel.com, bard.liao@intel.com Subject: [PATCH 1/2] soundwire: don't program SDW_SCP_BUSCLOCK_SCALE on a unattached Peripheral Date: Wed, 25 Mar 2026 19:41:55 +0800 Message-ID: <20260325114156.1028118-2-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260325114156.1028118-1-yung-chuan.liao@linux.intel.com> References: <20260325114156.1028118-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The SDW_SCP_BUSCLOCK_SCALE register will be programmed when the Peripheral is attached. We can and should skip programming the SDW_SCP_BUSCLOCK_SCALE register when the Peripheral is unattached. Fixes: 645291cfe5e5 ("Soundwire: stream: program BUSCLOCK_SCALE") Signed-off-by: Bard Liao Reviewed-by: Simon Trimmer Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan --- drivers/soundwire/stream.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index 4ed8fb7663ad..0b9626838028 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -697,6 +697,13 @@ static int sdw_program_params(struct sdw_bus *bus, boo= l prepare) if (scale_index < 0) return scale_index; =20 + /* Skip the unattached Peripherals */ + if (!completion_done(&slave->enumeration_complete)) { + dev_warn(&slave->dev, + "Not enumerated, skip programming BUSCLOCK_SCALE\n"); + continue; + } + ret =3D sdw_write_no_pm(slave, addr1, scale_index); if (ret < 0) { dev_err(&slave->dev, "SDW_SCP_BUSCLOCK_SCALE register write failed\n"); --=20 2.43.0 From nobody Fri Apr 3 01:29:33 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF3123D1CA1; Wed, 25 Mar 2026 11:42:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774438933; cv=none; b=ZO+csnrrMDWXV2y05/85dlSk5aS41hGZC0fEopPyDiL/7+zOAWEHx8CTkf8uW4YC24YZBc8gVEvJYKn81+MZXN7zqezjy4lN90iMmLspGwUwbULiUVuEVchNRC1JuvP5dugicV1n1J8E0OUzci5EhkQLwLXAcKqI756M/3hTgkY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774438933; c=relaxed/simple; bh=EEzTDrRVElDZCxSW3TfsuQS88eL8+ot70SAwElORFx4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bRNHyKmdKlKMZ9d5p96m5MrHoqMnrilJttaKsGal0iB8AIC61Pg7CLeMha0lfkVlxWFYuyMNaBjVVfOksQeVFpTY1hae1y3h2nkNka+Kv/jgJe3eiEWoLLtVZzCBId/moqmsWXx+VwrtlSU7fzzrxSczkWTlYMXTxPHuMx2yC0o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fddbZGxL; arc=none smtp.client-ip=192.198.163.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fddbZGxL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1774438932; x=1805974932; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EEzTDrRVElDZCxSW3TfsuQS88eL8+ot70SAwElORFx4=; b=fddbZGxLqRDDn947eWigLh9XJH0U2x9gacZkfM/LwCp8Imne64LgLmCx MWTk2+6zgd3yNFqM5DBmBRs6w1SZNrV/TwIuo09l03pQk4P4UPtDKJdA+ IGhJ3OTZIcijZWeASDQ46UtA/hrKqFs5Zqb/Gah5Vh6vAnJRh7NZkfvA4 Ob51dF/W+JujSdFpZzAHmSpQPLozrHFF/ECjWv58P/K6pX2EU2CGguc3w deknXbBpr/E9fYTunyA4l76q9UGw/HktjGL+iEDYF6kWP1cihOvK2A7s2 1v7bZwoFTAnVrQ6zrYLAW+K+FlFLy/CPC9Ge2iDdq5SCR1m0r53r5UMkZ w==; X-CSE-ConnectionGUID: Cn0ws1XvQU+yrjlQg4k1dw== X-CSE-MsgGUID: LIFH19d/SiC9dzmapWRAbQ== X-IronPort-AV: E=McAfee;i="6800,10657,11739"; a="63020052" X-IronPort-AV: E=Sophos;i="6.23,140,1770624000"; d="scan'208";a="63020052" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2026 04:42:11 -0700 X-CSE-ConnectionGUID: OOgGV11NT6mKag0HdxGccQ== X-CSE-MsgGUID: b8WYPSJeTJaVHstfuFtO/g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,140,1770624000"; d="scan'208";a="220253793" Received: from yungchua-desk.itwn.intel.com ([10.227.8.136]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2026 04:42:09 -0700 From: Bard Liao To: linux-sound@vger.kernel.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.dev, peter.ujfalusi@linux.intel.com, bard.liao@intel.com Subject: [PATCH 2/2] soundwire: record Peripheral scale_index Date: Wed, 25 Mar 2026 19:41:56 +0800 Message-ID: <20260325114156.1028118-3-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260325114156.1028118-1-yung-chuan.liao@linux.intel.com> References: <20260325114156.1028118-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Currently, we program bus clock scale index unconditionally. It is not necessary if the new index is the same as the current one. Signed-off-by: Bard Liao Reviewed-by: Simon Trimmer Reviewed-by: P=C3=A9ter Ujfalusi Reviewed-by: Ranjani Sridharan --- drivers/soundwire/bus.c | 1 + drivers/soundwire/stream.c | 4 ++++ include/linux/soundwire/sdw.h | 2 ++ 3 files changed, 7 insertions(+) diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index fe5316d93fef..acecbdcf52ec 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -1411,6 +1411,7 @@ static int sdw_slave_set_frequency(struct sdw_slave *= slave) dev_err(&slave->dev, "SDW_SCP_BUSCLOCK_SCALE_B1 write failed:%d\n", ret); =20 + slave->scale_index =3D scale_index; return ret; } =20 diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index 0b9626838028..a6f0255c1c25 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -697,6 +697,9 @@ static int sdw_program_params(struct sdw_bus *bus, bool= prepare) if (scale_index < 0) return scale_index; =20 + if (scale_index =3D=3D slave->scale_index) + continue; + /* Skip the unattached Peripherals */ if (!completion_done(&slave->enumeration_complete)) { dev_warn(&slave->dev, @@ -709,6 +712,7 @@ static int sdw_program_params(struct sdw_bus *bus, bool= prepare) dev_err(&slave->dev, "SDW_SCP_BUSCLOCK_SCALE register write failed\n"); return ret; } + slave->scale_index =3D scale_index; } =20 manager_runtime: diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 6147eb1fb210..0845182f75f9 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -661,6 +661,7 @@ struct sdw_slave_ops { * protocol for SoundWire mockup devices * @sdw_dev_lock: mutex used to protect callbacks/remove races * @sdca_data: structure containing all device data for SDCA helpers + * @scale_index: current bus clock scaling index */ struct sdw_slave { struct sdw_slave_id id; @@ -686,6 +687,7 @@ struct sdw_slave { bool is_mockup_device; struct mutex sdw_dev_lock; /* protect callbacks/remove races */ struct sdca_device_data sdca_data; + unsigned int scale_index; }; =20 #define dev_to_sdw_dev(_dev) container_of(_dev, struct sdw_slave, dev) --=20 2.43.0