From: Takashi Iwai <tiwai@suse.de>
To: linux-sound@vger.kernel.org
Cc: Shenghao Ding <shenghao-ding@ti.com>, Kevin Lu <kevin-lu@ti.com>,
Baojun Xu <baojun.xu@ti.com>
Subject: [PATCH 2/2] ALSA: hda: tas2781: Simplify system PM with runtime PM
Date: Tue, 8 Oct 2024 14:26:56 +0200 [thread overview]
Message-ID: <20241008122658.9549-2-tiwai@suse.de> (raw)
In-Reply-To: <20241008122658.9549-1-tiwai@suse.de>
Now most of the calls in both system and runtime PMs are identical,
use pm_runtime_force_suspend() and *_resume() for simplifying the
code.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/hda/tas2781_hda_i2c.c | 27 ++-------------------------
1 file changed, 2 insertions(+), 25 deletions(-)
diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c
index 6d173b721fd0..c35c676202b7 100644
--- a/sound/pci/hda/tas2781_hda_i2c.c
+++ b/sound/pci/hda/tas2781_hda_i2c.c
@@ -901,19 +901,7 @@ static int tas2781_system_suspend(struct device *dev)
dev_dbg(tas_hda->priv->dev, "System Suspend\n");
- mutex_lock(&tas_hda->priv->codec_lock);
-
- /* Shutdown chip before system suspend */
- if (tas_hda->priv->playback_started)
- tasdevice_tuning_switch(tas_hda->priv, 1);
-
- mutex_unlock(&tas_hda->priv->codec_lock);
-
- /*
- * Reset GPIO may be shared, so cannot reset here.
- * However beyond this point, amps may be powered down.
- */
- return 0;
+ return pm_runtime_force_suspend(dev);
}
static int tas2781_system_resume(struct device *dev)
@@ -924,26 +912,15 @@ static int tas2781_system_resume(struct device *dev)
dev_dbg(tas_hda->priv->dev, "System Resume\n");
mutex_lock(&tas_hda->priv->codec_lock);
-
for (i = 0; i < tas_hda->priv->ndev; i++) {
tas_hda->priv->tasdevice[i].cur_book = -1;
tas_hda->priv->tasdevice[i].cur_prog = -1;
tas_hda->priv->tasdevice[i].cur_conf = -1;
}
tasdevice_reset(tas_hda->priv);
- tasdevice_prmg_load(tas_hda->priv, tas_hda->priv->cur_prog);
-
- /* If calibrated data occurs error, dsp will still work with default
- * 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;
+ return pm_runtime_force_resume(dev);
}
static const struct dev_pm_ops tas2781_hda_pm_ops = {
--
2.43.0
next prev parent reply other threads:[~2024-10-08 12:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 12:26 [PATCH 1/2] ALSA: hda: tas2781: Fix missing setup at runtime PM Takashi Iwai
2024-10-08 12:26 ` Takashi Iwai [this message]
2024-10-09 14:32 ` Gergo Koteles
2024-10-09 14:55 ` Takashi Iwai
2024-10-09 15:34 ` Gergo Koteles
2024-10-09 15:44 ` Takashi Iwai
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=20241008122658.9549-2-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=baojun.xu@ti.com \
--cc=kevin-lu@ti.com \
--cc=linux-sound@vger.kernel.org \
--cc=shenghao-ding@ti.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