From patchwork Tue Aug 25 02:47:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2291498 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hTXK10dJwz1xyZ for ; Tue, 25 Aug 2026 12:48:20 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wyhCq-0002JL-J8; Tue, 25 Aug 2026 02:48:08 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wyhCk-0002IH-PP for kernel-team@lists.ubuntu.com; Tue, 25 Aug 2026 02:48:02 +0000 Received: from mail-yw1-f198.google.com (mail-yw1-f198.google.com [209.85.128.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id A3C6F3F5E4 for ; Tue, 25 Aug 2026 02:48:02 +0000 (UTC) Received: by mail-yw1-f198.google.com with SMTP id 00721157ae682-81e71be771cso11692907b3.0 for ; Mon, 24 Aug 2026 19:48:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787626081; x=1788230881; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=3kv71xNg5OK/nydB2GCDCV0F0RseAhzH1EIzMm1R7QU=; b=XepTD/TM6wRInVZY5M2EOAmpPVoM93v5uomvXU1ScBM/fd65tgslOLc/LixZBQgS1G kGZXUMyCQ2ubuz74CrG0wSYqrun05+GTJQVJBn0Z3h3q2Q/mJyQpSy+bcQ7NieoDiXX7 +eBof29RbjCgmh9FKquZvj/JKQFMfZ+nPw2YL/ao6NZHLBXp5qof9KS23VZC9VobWfdB A2akjOJiHKxr7QCwBX0SdpNkLkq4wCZuyB7QJ2JCrxjItIe5AJmJP1Qn7B0bpsw8usUp uwHe21iagCecUeE/IaYFAsdPWnhEEiBtMS5Xxfo5eacYgeFqdQO0C3t2KSXH0DwwM8ph fMYw== X-Gm-Message-State: AFuF++n04MQbPee7nu+1Dd0nLuX3I+wqkH5orKhUiMZ00CRNXUXbdsN0 +p/JqcQoETrIdDipdrh5MIaZaNkXjQ5pvwLspb8UcDoTPLxsGJV0LT3V0GBy2Y81gu1o8wpN2Eg XiW489nT1aa3+N4taqfB/MS23NvKgbb7trbm6T6ZsZFjEWJ61E208BskAWfGd3+RzaqV1b2MDcE TlqZaaHrjjR5upKe5x X-Gm-Gg: AR+sD11toj4vR64oF57M32h7qRKNZWSmpIYcUd63Ud3ZiL1UReK8W0F6r+bRGphLjoe gvIrBssIYJ2kXrhLRVs6lwg8luS4NtX/VW25KXG2+53K0/7UnTQCKOE27LESMlgeoK0oec739GB P33l7bxEq/9QmlDNsfDpuHbOl1OOjgJNzV1aWjmGwkgCkXGg2XOGladRIyfwh3cUxRTsnVNncC+ 1wsEz5+0+DbYu5WPNcDKdXQy4EtyTunW6RWMNhJluZDsSlgxUwsOe883yY+dxWIOh6LxQlqhZmr djwRpelqu0MKL/o/WoelmICtsUyEHKoZhaZkHvj2zgtewoz8hVbPENmShli9rChGpj1kzOl8WSL R6uEMpPZ6Tw== X-Received: by 2002:a53:b0d2:0:b0:66c:d7fa:57f1 with SMTP id 956f58d0204a3-66d146f2c11mr1137236d50.17.1787626081587; Mon, 24 Aug 2026 19:48:01 -0700 (PDT) X-Received: by 2002:a53:b0d2:0:b0:66c:d7fa:57f1 with SMTP id 956f58d0204a3-66d146f2c11mr1137232d50.17.1787626081152; Mon, 24 Aug 2026 19:48:01 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-66cf46460aesm4589565d50.6.2026.08.24.19.47.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 19:48:00 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH 1/3] ASoC: codecs: tas2783-sdw: Propagate regcache_sync() errors Date: Tue, 25 Aug 2026 10:47:30 +0800 Message-ID: <20260825024732.3420898-2-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260825024732.3420898-1-chris.chiu@canonical.com> References: <20260825024732.3420898-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Pengpeng Hou BugLink: https://bugs.launchpad.net/bugs/2164967 regcache_sync() can fail while replaying cached register state after SoundWire resume or attach handling. tas2783 currently ignores that failure. Propagate the error and restore cache-only/dirty state on failure. Signed-off-by: Pengpeng Hou Link: https://patch.msgid.link/20260704035746.82560-1-pengpeng@iscas.ac.cn Signed-off-by: Mark Brown (cherry picked from commit 0d6b2d6f93a6715827a9b3c027cd8448d76e0e47) Signed-off-by: Chris Chiu --- sound/soc/codecs/tas2783-sdw.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c index 90008d2d06e2..506fc7f99517 100644 --- a/sound/soc/codecs/tas2783-sdw.c +++ b/sound/soc/codecs/tas2783-sdw.c @@ -1099,7 +1099,13 @@ static s32 tas2783_sdca_dev_resume(struct device *dev) regmap_sync: regcache_cache_only(tas_dev->regmap, false); - regcache_sync(tas_dev->regmap); + ret = regcache_sync(tas_dev->regmap); + if (ret) { + regcache_cache_only(tas_dev->regmap, true); + regcache_mark_dirty(tas_dev->regmap); + return ret; + } + return 0; } @@ -1193,6 +1199,7 @@ static s32 tas_update_status(struct sdw_slave *slave, { struct tas2783_prv *tas_dev = dev_get_drvdata(&slave->dev); struct device *dev = &slave->dev; + int ret; dev_dbg(dev, "Peripheral status = %s", status == SDW_SLAVE_UNATTACHED ? "unattached" : @@ -1210,7 +1217,12 @@ static s32 tas_update_status(struct sdw_slave *slave, /* updated the cache data to device */ regcache_cache_only(tas_dev->regmap, false); - regcache_sync(tas_dev->regmap); + ret = regcache_sync(tas_dev->regmap); + if (ret) { + regcache_cache_only(tas_dev->regmap, true); + regcache_mark_dirty(tas_dev->regmap); + return ret; + } /* perform I/O transfers required for Slave initialization */ return tas_io_init(&slave->dev, slave); From patchwork Tue Aug 25 02:47:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2291497 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hTXK107SFz1xpj for ; Tue, 25 Aug 2026 12:48:20 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wyhCq-0002JY-Rk; Tue, 25 Aug 2026 02:48:08 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wyhCn-0002Iy-EP for kernel-team@lists.ubuntu.com; Tue, 25 Aug 2026 02:48:05 +0000 Received: from mail-yx1-f69.google.com (mail-yx1-f69.google.com [74.125.224.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 2279C3F584 for ; Tue, 25 Aug 2026 02:48:05 +0000 (UTC) Received: by mail-yx1-f69.google.com with SMTP id 956f58d0204a3-66c77a52575so15843754d50.2 for ; Mon, 24 Aug 2026 19:48:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787626084; x=1788230884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=/eB8UY8SqKjh3mvR4RWMFneMG3ZKlQZ4nATSOmATs6I=; b=cbxh+IZRtJB8e0jXreMITuY0CkjcHj1+YAGjv50WnizFUdNTe8yxIsd/4OUJlxh57I 9yhFKbmy+eLVabYlBq9GhXUaBw3YmvF+xyr2LvdKwWVsk6rHdYQHEFDHdu0WP+RrZEgL DJYi6VYG4NQ9lSlUHhS89eHKe1qgJAtBf86y5X7rAjj0bQ8IXHzfuLg5OciQdFbnScng tKAijiUzHKPbeO8GZm2jRvzk/1pbbjQiqkdEU3/WCzYxW7dzdLFf0ZUKuQDTC6niC49J aTAuELbkxxptxg7mfTGl3VmwPqwnM6SxPPrmrxyVxs4eyXjwzrxF4P96tEA2EhRZZN0w P3ew== X-Gm-Message-State: AFuF++nnbMGPuGsiI4AjZnW4if2df71yaST+BqAw7ArfQnxq/RT2tzmF ON/PKYifGM3i4z3CTkc6piFoXXIGXVPIlJ49prozwyOnjpFs1Y4YpVbtJL9cqkXCcHK4/QniFmc 7Xf+a/iC2rTvyCdEmSRMmxZG84XpyaqRyCaSGWVcAeIJUKnySbpdLuvF+CRq6tnDS/1xymsafeu AABXYiBUh0EFWe+rtW X-Gm-Gg: AR+sD13ZsZ73hD2IkgU/qXBog0Sagv4MuQRnBUD7b/MjNg1L6tlTilBfOW21KCkIUen MJivwDi2WMhqkr+IVTOed+JA+7+Nrk1CuTVYaebnd/liWrOlQ7R0rCkMJuk6TE79UL27Wxh6TKu 5JID8dn84Hvesn9RP1bSJffgxWpkPJUIf/1xuI4Z93g6tBvucd32OIN4EtYnRrYyYKik/Fm5Zax 62rOTSdqyxr3s2aXTddZE7kR2IktThqJg5e/vVb5kd8LsIDg4TUgIWiRt+SWZW69QOMsSB+yV3s 7Vm2GbpzuIdyt08b/+009+VrmEBGEBFH2oHBDBkaoqZQ05eJVzA9eqiUg0FZnTa2rJMfdnmyHYX ac13CGp/Ihw== X-Received: by 2002:a53:c243:0:b0:66c:abb8:9ca9 with SMTP id 956f58d0204a3-66ce4b3f64bmr8530629d50.43.1787626083780; Mon, 24 Aug 2026 19:48:03 -0700 (PDT) X-Received: by 2002:a53:c243:0:b0:66c:abb8:9ca9 with SMTP id 956f58d0204a3-66ce4b3f64bmr8530624d50.43.1787626083411; Mon, 24 Aug 2026 19:48:03 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-66cf46460aesm4589565d50.6.2026.08.24.19.48.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 19:48:03 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH 2/3] ASoC: tas2783: Use new SoundWire enumeration helper Date: Tue, 25 Aug 2026 10:47:31 +0800 Message-ID: <20260825024732.3420898-3-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260825024732.3420898-1-chris.chiu@canonical.com> References: <20260825024732.3420898-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Charles Keepax BugLink: https://bugs.launchpad.net/bugs/2164967 Update the driver to use the new core helper that waits for the device to enumerate on SoundWire and be initialised by the SoundWire core. Signed-off-by: Charles Keepax Link: https://patch.msgid.link/20260512103022.1154645-19-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown (cherry picked from commit ac6d4f298160bebf6979e63c2758414af5266f28) Signed-off-by: Chris Chiu --- sound/soc/codecs/tas2783-sdw.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c index 506fc7f99517..5c6866f3d3b5 100644 --- a/sound/soc/codecs/tas2783-sdw.c +++ b/sound/soc/codecs/tas2783-sdw.c @@ -1082,22 +1082,12 @@ static s32 tas2783_sdca_dev_resume(struct device *dev) { struct sdw_slave *slave = dev_to_sdw_dev(dev); struct tas2783_prv *tas_dev = dev_get_drvdata(dev); - unsigned long t; - - if (!slave->unattach_request) - goto regmap_sync; - - t = wait_for_completion_timeout(&slave->initialization_complete, - msecs_to_jiffies(TAS2783_PROBE_TIMEOUT)); - if (!t) { - dev_err(&slave->dev, "resume: initialization timed out\n"); - sdw_show_ping_status(slave->bus, true); - return -ETIMEDOUT; - } + int ret; - slave->unattach_request = 0; + ret = sdw_slave_wait_for_init(slave, TAS2783_PROBE_TIMEOUT); + if (ret) + return ret; -regmap_sync: regcache_cache_only(tas_dev->regmap, false); ret = regcache_sync(tas_dev->regmap); if (ret) { From patchwork Tue Aug 25 02:47:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 2291496 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hTXK10XXrz1xyJ for ; Tue, 25 Aug 2026 12:48:20 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1wyhCr-0002Jz-5l; Tue, 25 Aug 2026 02:48:09 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1wyhCp-0002JD-PK for kernel-team@lists.ubuntu.com; Tue, 25 Aug 2026 02:48:07 +0000 Received: from mail-yx1-f71.google.com (mail-yx1-f71.google.com [74.125.224.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 9F45B3F5E4 for ; Tue, 25 Aug 2026 02:48:07 +0000 (UTC) Received: by mail-yx1-f71.google.com with SMTP id 956f58d0204a3-66d03205d0eso8518580d50.2 for ; Mon, 24 Aug 2026 19:48:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787626086; x=1788230886; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=FN/uqs2xoEzfJHSj1G1XfJmP7xAvluF/gYs0O5NVIeg=; b=OXHJUNqnSGPdk4Mj20RetHF4NOiWiB126XueiO0dOBCacjjrp+OcHnW02R6QQ4H83k dhLL9KjV61tXQQhK9Hp+xihxeR9rfhQfydNyWNPl7rC0F0Kr9+fjqN05d/XFSylCjIeW +er0PdQfSYQOwWesQEvfEEAAGe8ULS5hf70lWRskGxWfa+TjhVZJ/76SQusoJIEOvvdR C5cEcg5Kd+bk0lT/GxkuOjDvzOCPNHM78pa2nEjswoBuPIrWGhgmhbjT3E2N24wRKxJq 5IxH9WBksXOwdN1WD5z3VQOZ/qzS0b7agC7lz2ClSiYqUN5lIVE+jEenWB1IxF9yx6SB ggJQ== X-Gm-Message-State: AFuF++lauP9mz/NhnkJxW1Xxxs9u9XL+pQiJEh0aKfv6MQUmi99hU/zC /tIlwgctKhmJehVwmaJLdz7hHQVRsVFmYMWYRqFPMElnZU9eUI9dIExCDIeAfVVc1d+44QSUI8e kdpEO8ehqWdVC/LY9R3lwFOaRwq7RE4Dc4w0NIjdhHsVN84kLa5I3qkTK3mhy7sNT/GvwlZPf05 LuZoQDuk6lHXxc0O95 X-Gm-Gg: AR+sD12DZYlZV2bdChPHqXzYJU4F1p7JrgkVQ6NcOMw3PENmK+P+gaonNS8FYWmZpng nu5+KBz8M4FRyS4Z2zTcHrsGex3ORo418ahg7v3GqVyodLFwn2+aMS2HQdvgW+1wGaWC9hB8XwM IuX8KINdZxkDWXX8e/AU0m+HB8hCu9pfdst3J6PyubzZk0VCWZYmL+YVB5MvMEWivNN8x0VaQ2j 8QQbbjd/KIgAiZOsI1xJ+eoCjP2rVZ/t2MnFUKPGWVnNpiPXr5QlUD3FJPY7EJ56jvYcd2NqcL8 IQ3hLRHjYNzE0Dt6gYSz1Lrn2apBJkB4a3ng2KE7jbSz1iKY3whwEAnE45pW3vitCE912cIkdvU rAwNhera7MQ== X-Received: by 2002:a05:690e:e86:b0:66d:163b:c100 with SMTP id 956f58d0204a3-66d163bc39amr1041465d50.28.1787626086375; Mon, 24 Aug 2026 19:48:06 -0700 (PDT) X-Received: by 2002:a05:690e:e86:b0:66d:163b:c100 with SMTP id 956f58d0204a3-66d163bc39amr1041454d50.28.1787626085869; Mon, 24 Aug 2026 19:48:05 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c1a2]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-66cf46460aesm4589565d50.6.2026.08.24.19.48.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 19:48:05 -0700 (PDT) To: kernel-team@lists.ubuntu.com Subject: [SRU][R][PATCH 3/3] ASoC: tas2783-sdw: drop stale regcache on uninitialized re-attach Date: Tue, 25 Aug 2026 10:47:32 +0800 Message-ID: <20260825024732.3420898-4-chris.chiu@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260825024732.3420898-1-chris.chiu@canonical.com> References: <20260825024732.3420898-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chris Chiu via kernel-team From: Chris Chiu Reply-To: Chris Chiu Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Andrey Golovko BugLink: https://bugs.launchpad.net/bugs/2164967 When the peripheral re-attaches after the SoundWire controller was power-gated during system suspend (s2idle reaching S0i3 on AMD ACP), the amplifier has lost all of its register and DSP state. tas_update_status() handles that by re-running tas_io_init(), which writes the device's TAS2783_SW_RESET register - a vendor register write that clears the device's register file and DSP state, not a SoundWire reset, so no re-enumeration is involved - and re-downloads the firmware. Before doing any of that, it syncs back a register cache that still holds the pre-suspend values. That sync is useless, since the reset immediately wipes whatever it wrote, and it leaves the cache claiming that the amplifier is already powered up and unmuted. Subsequent read-modify-write updates - DAPM amplifier power-up, SDCA PDE transitions at stream start - then see "no change" and skip the hardware write. Playback runs without a single error while the speakers stay silent. Unbinding and rebinding the driver restores audio, since probe starts from a fresh cache. Drop the cache instead of syncing it when an uninitialized device attaches, so that later accesses see the real hardware state. Reordering the sync after tas_io_init() and marking the cache dirty is not a workable alternative here: tas_regmap has no .writeable_reg, so the cache accepts every register up to .max_register, including ones for which tas2783_sdca_mbq_size() returns 0. regmap_sdw_mbq_size() rejects those with -EINVAL, so the replay fails on the first such register and takes initialization down with it. Cached user settings fall back to hardware defaults across such a power loss, which seems clearly preferable to a silent amplifier - the device is being reset and its firmware reloaded at this point anyway. Tested on an ASUS ProArt PX13 HN7306EAC (AMD Strix Halo, ACP7.0, two TAS2783 amplifiers plus RT721 on SoundWire link 1): the speakers work after an s2idle resume with ~51 s of S0i3 residency, where previously they stayed silent despite a complete firmware re-download. Fixes: 4cc9bd8d7b32 ("ASoc: tas2783A: Add soundwire based codec driver") Reported-by: Antoine Monnet Closes: https://lore.kernel.org/all/c66ae00a-e878-4af0-a05a-272e9574eaa5@montane.tech/ Signed-off-by: Andrey Golovko Link: https://patch.msgid.link/3e2751d1fb027bed0f09c88e5e56da8f@gmail.com Signed-off-by: Mark Brown (cherry picked from commit b627da43035744ca4d691fbf56eef60268319873 linux-next) Signed-off-by: Chris Chiu --- sound/soc/codecs/tas2783-sdw.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c index 5c6866f3d3b5..adeb01ac805e 100644 --- a/sound/soc/codecs/tas2783-sdw.c +++ b/sound/soc/codecs/tas2783-sdw.c @@ -1189,7 +1189,6 @@ static s32 tas_update_status(struct sdw_slave *slave, { struct tas2783_prv *tas_dev = dev_get_drvdata(&slave->dev); struct device *dev = &slave->dev; - int ret; dev_dbg(dev, "Peripheral status = %s", status == SDW_SLAVE_UNATTACHED ? "unattached" : @@ -1205,14 +1204,23 @@ static s32 tas_update_status(struct sdw_slave *slave, if (tas_dev->hw_init || tas_dev->status != SDW_SLAVE_ATTACHED) return 0; - /* updated the cache data to device */ regcache_cache_only(tas_dev->regmap, false); - ret = regcache_sync(tas_dev->regmap); - if (ret) { - regcache_cache_only(tas_dev->regmap, true); - regcache_mark_dirty(tas_dev->regmap); - return ret; - } + + /* + * The device is attaching uninitialized: either this is the first + * attach, or it lost power (and with it all register and DSP state) + * while the controller was power-gated during system suspend. The + * cache still holds the pre-suspend values, and tas_io_init() below + * resets the device via TAS2783_SW_RESET anyway, so syncing it back + * is both useless and harmful: later read-modify-write updates would + * compare against stale data and skip the hardware write. + * + * Drop the cache instead, so that subsequent accesses see the real + * hardware state. Syncing after the reset is not an option either: + * the cache accepts registers for which tas2783_sdca_mbq_size() + * returns 0, and writing those back fails with -EINVAL. + */ + regcache_drop_region(tas_dev->regmap, 0, UINT_MAX); /* perform I/O transfers required for Slave initialization */ return tas_io_init(&slave->dev, slave);