Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2395097lqp; Sun, 24 Mar 2024 17:35:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSzaxwatdhNzjmY8tMr2LJ2f1LLE1/L0CoChLQYoWLUrI6nQQnXJUU6pzA4XDnv31/qCvleIq9vRkW2cdNCF8AAuQKOHTXd3OAdw7Skg== X-Google-Smtp-Source: AGHT+IGHiuFkeUHWMnzB2nRLmHM2Bdc+I2d018IrV7hfYnXfxQwCYUWOKhDjVf0He7KhZHVlTNe1 X-Received: by 2002:ad4:4ee6:0:b0:696:2134:95e5 with SMTP id dv6-20020ad44ee6000000b00696213495e5mr9873934qvb.3.1711326949501; Sun, 24 Mar 2024 17:35:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711326949; cv=pass; d=google.com; s=arc-20160816; b=ciFY2WcXOC8FNJqB5YtQvZ4BI/VWQjp//Xg8xStv4Niw3uvKxQMFIHz3c5/wVExuOK WbPg7pa4KELxE0mvM43d3lk0sTK7fAJ0PGnVevBUBkuQ6VrtP+cFOStK/rIh7oLl8U+w Lhw+nnZsOKg8Kz1ZDwxVpgjSYuNJbUOmqkorGLKr0a5ukuIA2yXkYHXBnmMINtDZW3Dp lD9Iy55O6Q+7JDHSlJx55LfOjJjvZAWnCtGREkEnrag84jWWuBDx4PpXDusw/WdRugH7 SbqkobCM0i59nh6uGjAGboQF6XcSi6MTxBlBVV4FkMJrtqgDzr3yLTS85dCakwLuu8z7 0FjQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=KdMlMuGEn0ofehqoBqG2KtdevFMilvMsv4QsTVcTFFI=; fh=k0YGrrLibE4Ez6fKBTWZNvBxelP2UNQexSeTLOSofmw=; b=A+KYMwFUiewYgK+348fQekriPIjrEUPMImIOacx9m7uWqwsroi1ch8Vz3q+kRrtjuB iduaTZezFrkxfQ8cwG539cZ6Y4Nj/xM+TRmOAseHhWpZ1qjSVjYFpFub9ZVJ1VcD5Zha YN+nEpJ/fyHG2/jQAwa/YBz09sMYC0/NiiMh3BYN3ltbKhCGjwAVny1yoA6ch/QcyRZi P2kSZvsmOo9pegQ+6kK17JOn9gvmAanHg67GfCKpvOnC++12FCVoJsY0C4lMEX2IHf1o XAKIvh7GBBxE54Xb0TvpIY6BEEtvM9TBXYc7l4tgGSTzI3ciJhERc7FdLTAvfzn6Ysp6 HWgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hOlHLEXl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113434-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id i4-20020ad45c64000000b006914fe64c42si6726699qvh.327.2024.03.24.17.35.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:35:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hOlHLEXl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113434-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113434-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3F8181C23CAF for ; Mon, 25 Mar 2024 00:35:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 885F21A9F5D; Sun, 24 Mar 2024 22:43:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hOlHLEXl" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9FD4C1AB17C; Sun, 24 Mar 2024 22:43:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320236; cv=none; b=RvNKWp5YTwbcVisIV3Y5yZdQIVsOTCvBvI3vMrut+VFBvoxJjCfEWSNp3skHaydLaDV20PpoVouQlQGNAu5kO6yV/UmanDeb9utA6gEKAV8KWqy0cGZ6lbk4IXmcWa12w4kQSlHjtVFCOtWPewzY6dhk4+eQIHhn3HpuPSFWwKk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320236; c=relaxed/simple; bh=lppP1siZJgQmbkQMvaFEoIwmC5tUGtg3YwEGgKlGD9o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZBcCfKKCYh5Rh133jPGjfVyWpfFaWlX0+qHL487Mvqivm3WMlcqC9XCBoEmcL3lcbMCjQg/JLoznyMvSAJefUWVhXoB+OW+PYdtn4d+CFStIoYEwdxCqDgVaXjUWcMUBDzkMpYRYkGBC+poG+vQCMHFsCVzqEt6fegNdBDhkXOc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hOlHLEXl; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC6E0C433B1; Sun, 24 Mar 2024 22:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320236; bh=lppP1siZJgQmbkQMvaFEoIwmC5tUGtg3YwEGgKlGD9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hOlHLEXlfxnI4u26GDflKk8epihASbnHsUog2iiG8OHXUWAB7d3wOSa9TvZJr3HX0 QblWRSO5jXuuXVNLXxb8pXRAmzCgcsLFtNXKHYBvK8aPizdhFCvTIIouU1ZOfUM+NK LpLF3Yylw9EoksIGkbYrNweqHTKdoApNrxxvXc+NpNyog3IhLrukdP1UV8k2nh7ZxL vSJibViPoe+rocSpiJLRgjdgUZhY5VYW3nGzrCXTgoYGyGg3WrbXaYHQq3ide43Jli qxeyu7BsoqtlcXgSkQe0HFYEZMY7eXrNtVbgQq3mq1euFiLwq8lhcr2p4o+fbB4lOV NudLfuN48rLAQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Gergo Koteles , Takashi Iwai , Sasha Levin Subject: [PATCH 6.8 543/715] ALSA: hda/tas2781: restore power state after system_resume Date: Sun, 24 Mar 2024 18:32:02 -0400 Message-ID: <20240324223455.1342824-544-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Gergo Koteles [ Upstream commit 9fc91a6fe37c78ef301aed4251f7e50b8524e72d ] After system_resume the amplifers will remain off, even if they were on before system_suspend. Use playback_started bool to save the playback state, and restore power state based on it. Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver") Signed-off-by: Gergo Koteles Signed-off-by: Takashi Iwai Message-ID: <1742b61901781826f6e6212ffe1d21af542d134a.1709918447.git.soyer@irl.hu> Signed-off-by: Sasha Levin --- sound/pci/hda/tas2781_hda_i2c.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c index a99f490c6a234..7aef93126ed0c 100644 --- a/sound/pci/hda/tas2781_hda_i2c.c +++ b/sound/pci/hda/tas2781_hda_i2c.c @@ -160,11 +160,13 @@ static void tas2781_hda_playback_hook(struct device *dev, int action) pm_runtime_get_sync(dev); mutex_lock(&tas_hda->priv->codec_lock); tasdevice_tuning_switch(tas_hda->priv, 0); + tas_hda->priv->playback_started = true; mutex_unlock(&tas_hda->priv->codec_lock); break; case HDA_GEN_PCM_ACT_CLOSE: mutex_lock(&tas_hda->priv->codec_lock); tasdevice_tuning_switch(tas_hda->priv, 1); + tas_hda->priv->playback_started = false; mutex_unlock(&tas_hda->priv->codec_lock); pm_runtime_mark_last_busy(dev); @@ -666,6 +668,7 @@ static void tasdev_fw_ready(const struct firmware *fmw, void *context) tasdevice_save_calibration(tas_priv); tasdevice_tuning_switch(tas_hda->priv, 0); + tas_hda->priv->playback_started = true; out: mutex_unlock(&tas_hda->priv->codec_lock); @@ -837,6 +840,9 @@ static int tas2781_runtime_suspend(struct device *dev) mutex_lock(&tas_hda->priv->codec_lock); + /* The driver powers up the amplifiers at module load time. + * Stop the playback if it's unused. + */ if (tas_hda->priv->playback_started) { tasdevice_tuning_switch(tas_hda->priv, 1); tas_hda->priv->playback_started = false; @@ -876,7 +882,8 @@ static int tas2781_system_suspend(struct device *dev) mutex_lock(&tas_hda->priv->codec_lock); /* Shutdown chip before system suspend */ - tasdevice_tuning_switch(tas_hda->priv, 1); + if (tas_hda->priv->playback_started) + tasdevice_tuning_switch(tas_hda->priv, 1); mutex_unlock(&tas_hda->priv->codec_lock); @@ -908,6 +915,10 @@ static int tas2781_system_resume(struct device *dev) * calibrated data inside algo. */ tasdevice_apply_calibration(tas_hda->priv); + + if (tas_hda->priv->playback_started) + tasdevice_tuning_switch(tas_hda->priv, 0); + mutex_unlock(&tas_hda->priv->codec_lock); return 0; -- 2.43.0