From nobody Tue Sep 29 02:02:42 2026 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CC5647986F for ; Thu, 13 Aug 2026 16:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786638750; cv=none; b=fyFudKH3xFGDGxTrig+ux42WixITeXSeU+U/x4uMIIhNl9KuAKjgk1ho9wmUgS7+hPsbmX1tMv9lhS/7lHrQvmoVgbvxTrtFb6/S+LpYkl8g4/hZqNy3SM6I6paEnDbIF4VRda3lApXasASPYEPbNE41ytuJKtMU8FbWUTOSc+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786638750; c=relaxed/simple; bh=3T8Gpk4hBZ6/7bKZ34LAXa+oW+i0l/pUwjNPfBxsavw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uVhZO4Hvk1YGmQHRCoG2+NgUoclwrO04RLN3lLC321xg2k1KfaU3mMYU/uFONI9yG8EUi4gJEsLFp3GZ+WwdhDDXhltbPXdYywPKVtfUSA04LhFwht4ncK+Vsb/Kca8/IhoTS6odD5iuKsZEku5Mw6TZTU767KBeNt6qfeuspeg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SztbtNFH; arc=none smtp.client-ip=209.85.167.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SztbtNFH" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5b2aab18795so977805e87.2 for ; Thu, 13 Aug 2026 09:32:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786638746; x=1787243546; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=WOaWqaE8RFMDGe7l+nIA7VCXjiyeSRAiT9jJHXAYkP0=; b=SztbtNFHOrHFdGGJ4dr3rCgzBURQ/GWwIEBsij6N3kxS6bPmpBd+uVR4CsdmX9gKGk G8TfJWhCfKiLuUGX7m/9WvEYb8nyxuCJ6VT8bsi8xzvGcSF79LepZiiUEL2RiGhEpnGf KGCLkUDHV+Yq1/6wgxNc8LZfcj9b7aefH1frz2uAv3tkoS9RuDThIcmGKLLOG0zVaAjp jbRNk2LacHKIWHWkW0iTd6KQwiLk1Yk6RSY/yK9JMS1wRrodpuU4/Yd68LDYlvJLAjjd gR9cb6Vu8Stn2xl0Ug0rmhWgYWzvF304nZlz+hvyVHoTeLTms9cLya02OkGD1JxBAw6s Bmfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786638746; x=1787243546; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=WOaWqaE8RFMDGe7l+nIA7VCXjiyeSRAiT9jJHXAYkP0=; b=F8rLXaAC/LlPZT5lxF7ZsVvvO+K64IuFlUCV4GQSPIXeFloW/DlZTXQBjGyL01X00M 7SFKEG+aZXuHbj9geKEYYRvHmh26c0jyaILPhknn2cQ0d4KVQBFg7F/RxDOVcORj0ExM gYwFjDfOrc4UYdCc4VD2f8DMsbe3onyYOL/jJxPFSKnysTaw8IFsJ9z2PP2Bim/PWP3r +43khtpx2rn5x3t0Cgxs3SibZcCFbds4AHUXa3+PeZgLTeuVZeLHZ1yn4IaIJQx81EpM NJEaO/tniadC2FO3FbxFODYJhyq36Ds12ZoU3RpToQ3zX+/TAh4crjUdE3kuX1uqbDUh MSyw== X-Forwarded-Encrypted: i=1; AHgh+RoZqgOT9/eNMxCf7iu+0QjVEmGsN5Qz7o2Kb/I+bh7C7NtDwzzywY9MaEwVgqqZZIFWU1si8LEiAB8WewQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzL40H2ufN3KwlO/fxNJyBauGGbii24nudzitAUlCYQlUiV/VIA Zvub3GXEp1uTXsCM1rrAvU4V6Cnro4aQgepdSKPkqDyqyYM/GvaPpI0a X-Gm-Gg: AR+sD12fRNcdYh6/u8UeQ+xILCag8x5PMTHagkxizv1LQvIOTClMJz3YHjrqyZch6by tFB7Maznk4MJHtpoQpcogdR50jVIe/sO0Jh5h6XoTTKZc7J/uN1mKCJb8GDNh9FLg7WlEBEVgmT hOYWogweiP9csceCvtlk8fG4DOG4z4CTtFV2gzVcnso48+s4+rqWpdA0IElO9MogOqKLqOR4J39 Q6TwED7etxnz2meklp/2Tmuucex+3WqBf5zeaaV2U88VcsT5ZTZFhpFxMPnQ+dPDzPNWH3ElQBI 4iUYeYVD99fz0qwotv12AI7ilvD1X0evGBFLX+D30kzcggHoF0xT2EmdIftxjAEjeBuv0T+2mgS ffOK2OnUQEF8tqT/EEFEt2A7QhzyI2eONEDAqWgfsKD8ISJMQTJAJ3jIITuH1bWJvWMUY41h9Mw lbxqtK0oQnqLl8BALjh222G7dehknh1WYBJ7nyC5kEhUztkzi3nKOw0EZfXWk1oTFUjqtxx33wp wXGaRvvqVJ16GdeKPqtpV0= X-Received: by 2002:a05:6512:3b24:b0:5b2:e890:e6b4 with SMTP id 2adb3069b0e04-5b453f82eb4mr1037445e87.36.1786638746233; Thu, 13 Aug 2026 09:32:26 -0700 (PDT) Received: from localhost (host-80-73-162-2.rev.as20985.net. [80.73.162.2]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5b453a54adasm586005e87.38.2026.08.13.09.32.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Aug 2026 09:32:25 -0700 (PDT) From: Andrey Golovko To: Shenghao Ding , Kevin Lu , Baojun Xu , Sen Wang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: "Holalu Yogendra, Niranjan" , Pierre-Louis Bossart , Vijendar Mukunda , "Dommati, Sunil-kumar" , Bard Liao , Antoine Monnet , Robin Everaars , Ville Saarinen , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] ASoC: sdw_utils: prepare the stream again when resuming Date: Thu, 13 Aug 2026 19:40:00 +0300 Message-ID: <20260813194000.10412-2-andrey.golovko@gmail.com> In-Reply-To: <20260813194000.10412-1-andrey.golovko@gmail.com> References: <20260813194000.10412-1-andrey.golovko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A peripheral loses its Data Port configuration when the controller is power-gated during system suspend, so the ports have to be prepared again before the stream can be enabled. That happens on its own when userspace calls snd_pcm_prepare() after SNDRV_PCM_STATE_SUSPENDED, but an application is also allowed to restart the stream with SNDRV_PCM_IOCTL_RESUME on a card that advertises SNDRV_PCM_INFO_RESUME, as the AMD ACP platforms do. That path only reaches the trigger callback, sdw_enable_stream() writes the channels of ports that were never prepared, and playback silently produces nothing: the PCM keeps running, no error is reported anywhere, and the speakers stay quiet until the stream is torn down and set up again. Prepare the stream on SNDRV_PCM_TRIGGER_RESUME, before enabling it. The SoundWire core expects exactly this: sdw_prepare_stream() accepts a disabled stream and then reapplies the bus parameters without recomputing them, which it documents as the resume case. Signed-off-by: Andrey Golovko --- New in v2, after Mark Brown and Vijendar Mukunda pointed out that a stream restarted with SNDRV_PCM_IOCTL_RESUME never prepares its ports again. Measured on an ASUS ProArt PX13 HN7306EAC: without this patch a tone that is resumed with snd_pcm_resume() alone comes back inaudible with DP1 PrepareCtrl at 0x0 and PDE23 at PS3, with it the ports are prepared again and the tone returns at its pre-suspend level. Numbers are in the cover letter. sound/soc/sdw_utils/soc_sdw_utils.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_= sdw_utils.c index 8a07ba2a29e5..3e091e78d8c2 100644 --- a/sound/soc/sdw_utils/soc_sdw_utils.c +++ b/sound/soc/sdw_utils/soc_sdw_utils.c @@ -1510,9 +1510,24 @@ int asoc_sdw_trigger(struct snd_pcm_substream *subst= ream, int cmd) } =20 switch (cmd) { + case SNDRV_PCM_TRIGGER_RESUME: + /* + * The peripherals lose their port configuration when the + * controller is power-gated during system suspend, and an + * application that restarts the stream with + * SNDRV_PCM_IOCTL_RESUME - which platforms advertising + * SNDRV_PCM_INFO_RESUME allow - never goes through + * .prepare() again. Prepare the stream here so that the + * ports are reprogrammed before they are enabled; + * sdw_prepare_stream() reapplies the parameters without + * recomputing them when the stream is disabled. + */ + ret =3D sdw_prepare_stream(sdw_stream); + if (ret) + break; + fallthrough; case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - case SNDRV_PCM_TRIGGER_RESUME: ret =3D sdw_enable_stream(sdw_stream); break; =20 --=20 2.53.0 From nobody Tue Sep 29 02:02:42 2026 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88D344963CD for ; Thu, 13 Aug 2026 16:32:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786638752; cv=none; b=ClB9A6w3+Ax9W25E3RSn5JTM/qvsgQQnTN8DCeyiEctXnxhJyCsU6goL8wOerLo5yuqB70rD2u9757hfpjAqyzHg9Lls7HYt08P1Mg4e/j5sV4FRIZaDF7liaghMdBsj0wN8hiUhGpREX+C8TUgP++dxhRUeN2nl5iG0hZucDtE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786638752; c=relaxed/simple; bh=/YhplFr3wX+cQu+n5OeAbAsCzhnZxT1J8kXTe5t6tkc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MwU/Oo5gOlEv/WNNwv8Yr7R8gI8/D1qbsPlGg04+co9krMIWXX+epwVff5bFNANkSRMjYljNqdVqQ5hA2iH1npfp7GjkAM5CEUZe0gW1S6UYTsEj6chidZI1Z2him/0sYQaK/6l6NVOJLFhDUiy84OvxUN/FOe94zmGcr71uwrU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fbCLYW5T; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fbCLYW5T" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-5b0f19bea2fso2855320e87.1 for ; Thu, 13 Aug 2026 09:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786638748; x=1787243548; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=twv+XV+1+yrG3KOORHIQ174JWU1gzEjtWwKvqruL4XM=; b=fbCLYW5TBOvMPl6u6bZjJDoV+KLNdanRaTYzcg/oHsE9cv/s89MpeQaYhQEeuOGT3P k6JG/+p3SjwAc8cFj3UFdHqOGdoyaR4fRMgbGvyJqe0ZZ1dwQuEQiNlsQghuMMrLKkaW CFiyW5ayhO5kmcXj5lgktAZ8YtBVtsumpS877SFIgTV+pCJiZhzbzMYwYXlhYti8KioP XITYMjbbdK7BgpQImcnlQ4yc3qiGU50nsO76FLgoutIT0rynExSw060wWVaafMQnC3ek Fajw7MiVMddYvbZLlDXhIBYL6Awuh5fW672o4v/whhWBceC1d9bBuChT92g+mueCk3cM 6wng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786638748; x=1787243548; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=twv+XV+1+yrG3KOORHIQ174JWU1gzEjtWwKvqruL4XM=; b=qfY1ZnlwpBVTClocYJtNpNHaMUdpViiBgwrgAK7vSdEVA1fOGa0IKZOIzGo6o8tBIB 8bsoqqjoxL65tdZLD5/pW7Wv1zyjqh9AQREo5HmUBKfwMNrV2dXsEAm7tyMPOokNJovL fUlUeAjgMSP32HIlwKVz8okqxLyJoUdcRzbx7wE+Rkwo8s6MsCaJoLtBEpqOibxNZMXI jm34jHRQaXexQzQAm02roKbbEwJdXN/SmTNZt0Rvk9UierqInCHLJO8aPS7UzhUK9LrW zkLpFcOEvIeh7kjqWjiyt8Qf2/5WaciNju1SlSwewoL3g+elVMRS0PIgwfcwqRdr61ka xUIQ== X-Forwarded-Encrypted: i=1; AHgh+RpXOOm+2CMDJ5yDjkpzqjQIOqsrG20I4PTUyjswhfmnh/R2Wu8eeRSWDZ9ib/p1zbpu8AIfdXBh0Plih+w=@vger.kernel.org X-Gm-Message-State: AOJu0YxgtDU307R1RKKTS2lycI5FUOyQy9b5mom2OAYC9Cn+Zouyox1p gu3c2Zt0eRtU0ZEfo7MTrVX46/Q98DYpPI+E8Zhl4G1UgIrs9jhE3tst X-Gm-Gg: AR+sD10cYRk5tJygAX2Sb+Dmi4mzoWxHTsX3MHzhjtArsJaLIG2D8iFiESTp+6WX2G1 4B5mNlzVYCU6e5oknbVMlXt5khK8cfcZmHSR5LBjrkBRJxPnNs/EgoDihC+y+LPK1aRD89baU97 ukB4wrWdIbyQyX7sM50QEBAklTYX/HWxYB3K2Y/6W3bE5TOeXZd5v6nc7lojuRUziXg277E48HM eGX2o/y8YhKGceLcEF2/rvES8zaHBskLfVVvehfQE497kKegkLRiwftDWd+D0BPDgJzK6eLtQx/ fj0F+YTMsmV0G25xvKV8kd/QPCAKoM3jFpZG3jF8ctwzeM6t7H3v5gNN1AWrDPxDhoFHdOvOo6B xDHPbrlFbRvMjZtvF07vXnkNNJwhUa5qNEw2+yXxRUQHoZA7/k2X/jYZ/ekcu+MQ7RRHIZ9zvnP NtjsH4q8mX2MqXzu7UINRrTKfOREtCoL2lPqhXE8qvYelgjcjhavYt70Ck+P8yHCCwwxIwh80K8 pnSfFSloBaBL7p7jUe4dt0= X-Received: by 2002:a05:6512:4205:b0:5ae:bd66:553b with SMTP id 2adb3069b0e04-5b453f830bdmr1118109e87.38.1786638748404; Thu, 13 Aug 2026 09:32:28 -0700 (PDT) Received: from localhost (host-80-73-162-2.rev.as20985.net. [80.73.162.2]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5b458b9a8a5sm1778e87.7.2026.08.13.09.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Aug 2026 09:32:27 -0700 (PDT) From: Andrey Golovko To: Shenghao Ding , Kevin Lu , Baojun Xu , Sen Wang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: "Holalu Yogendra, Niranjan" , Pierre-Louis Bossart , Vijendar Mukunda , "Dommati, Sunil-kumar" , Bard Liao , Antoine Monnet , Robin Everaars , Ville Saarinen , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] ASoC: tas2783-sdw: power the Function up before preparing the port Date: Thu, 13 Aug 2026 19:40:00 +0300 Message-ID: <20260813194000.10412-3-andrey.golovko@gmail.com> In-Reply-To: <20260813194000.10412-1-andrey.golovko@gmail.com> References: <20260813194000.10412-1-andrey.golovko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A Data Port cannot complete channel preparation while the SDCA Function is powered down: the peripheral raises the channel's bit in DPn_PrepareStatus and never clears it. tas_sdw_hw_params() takes care of that for a stream that is being set up, and the retry loop there says so - "ensure power on so that port prepare succeeds". Port preparation, however, also happens on a stream that is merely re-prepared, without hw_params() running again. That is what userspace does after a suspend in which the peripheral lost power: snd_pcm_prepare() reaches .prepare and sdw_prepare_stream(), the port is prepared afresh, but PDE23 is still at the PS3 reset default because nothing wrote it since the device came back. The result is silence with no error anywhere. The codec sets simple_ch_prep_sm, so sdw_prep_deprep_slave_port() skips the NOT_PREPARED poll, and a port that never prepares is indistinguishable from a healthy one. Power the Function up in the PRE_PREP callback, immediately before the PrepareCtrl write it already performs, so that preparation has what it needs on every path that prepares a port. Measured on an ASUS ProArt PX13 (AMD ACP7.0, two TAS2783): after s2idle with ~100 s of S0i3 residency, DPn_PrepareStatus stays at the channel mask and there is no audio; writing PDE23 PS0 and re-issuing the prepare clears it within 1 ms and audio returns. Signed-off-by: Andrey Golovko --- v2: no functional change. The comment no longer implies that a userspace snd_pcm_prepare() is the only way into port preparation, since patch 1 now also reaches it from the resume trigger. sound/soc/codecs/tas2783-sdw.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c index c217da5fccdf..d32d8f441651 100644 --- a/sound/soc/codecs/tas2783-sdw.c +++ b/sound/soc/codecs/tas2783-sdw.c @@ -1259,6 +1259,7 @@ static int tas_port_prep(struct sdw_slave *slave, str= uct sdw_prepare_ch *prep_ch enum sdw_port_prep_ops pre_ops) { struct device *dev =3D &slave->dev; + struct tas2783_prv *tas_dev =3D dev_get_drvdata(dev); struct sdw_dpn_prop *dpn_prop; u32 addr; int ret; @@ -1270,6 +1271,25 @@ static int tas_port_prep(struct sdw_slave *slave, st= ruct sdw_prepare_ch *prep_ch addr =3D SDW_DPN_PREPARECTRL(prep_ch->num); switch (pre_ops) { case SDW_OPS_PORT_PRE_PREP: + /* + * The Function has to be powered before the port can complete + * channel preparation. hw_params() does that when a stream is + * set up, but a stream that is only re-prepared - as it is + * after the peripheral lost power in S0i3 - does not go + * through hw_params() again, and the peripheral is back at its + * PS3 reset default. Power it up here, where it is needed. + */ + scoped_guard(mutex, &tas_dev->pde_lock) + ret =3D regmap_write(tas_dev->regmap, + SDW_SDCA_CTL(1, TAS2783_SDCA_ENT_PDE23, + TAS2783_SDCA_CTL_REQ_POW_STATE, 0), + TAS2783_SDCA_POW_STATE_ON); + if (ret) { + dev_err(dev, "power up failed for port %d, err=3D%d\n", + prep_ch->num, ret); + return ret; + } + ret =3D sdw_write_no_pm(slave, addr, prep_ch->ch_mask); if (ret) dev_err(dev, "prep failed for port %d, err=3D%d\n", --=20 2.53.0