diff mbox series

[2/2] ALSA: hda: tas2781: Simplify system PM with runtime PM

Message ID 20241008122658.9549-2-tiwai@suse.de (mailing list archive)
State New, archived
Headers show
Series [1/2] ALSA: hda: tas2781: Fix missing setup at runtime PM | expand

Commit Message

Takashi Iwai Oct. 8, 2024, 12:26 p.m. UTC
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 mbox series

Patch

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 = {