Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ALSA: hda/tas2781: restore power state after system_resume

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 <soyer@irl.hu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <1742b61901781826f6e6212ffe1d21af542d134a.1709918447.git.soyer@irl.hu>

authored by

Gergo Koteles and committed by
Takashi Iwai
9fc91a6f 5f51de7e

+12 -1
+12 -1
sound/pci/hda/tas2781_hda_i2c.c
··· 160 160 pm_runtime_get_sync(dev); 161 161 mutex_lock(&tas_hda->priv->codec_lock); 162 162 tasdevice_tuning_switch(tas_hda->priv, 0); 163 + tas_hda->priv->playback_started = true; 163 164 mutex_unlock(&tas_hda->priv->codec_lock); 164 165 break; 165 166 case HDA_GEN_PCM_ACT_CLOSE: 166 167 mutex_lock(&tas_hda->priv->codec_lock); 167 168 tasdevice_tuning_switch(tas_hda->priv, 1); 169 + tas_hda->priv->playback_started = false; 168 170 mutex_unlock(&tas_hda->priv->codec_lock); 169 171 170 172 pm_runtime_mark_last_busy(dev); ··· 668 666 tasdevice_save_calibration(tas_priv); 669 667 670 668 tasdevice_tuning_switch(tas_hda->priv, 0); 669 + tas_hda->priv->playback_started = true; 671 670 672 671 out: 673 672 mutex_unlock(&tas_hda->priv->codec_lock); ··· 840 837 841 838 mutex_lock(&tas_hda->priv->codec_lock); 842 839 840 + /* The driver powers up the amplifiers at module load time. 841 + * Stop the playback if it's unused. 842 + */ 843 843 if (tas_hda->priv->playback_started) { 844 844 tasdevice_tuning_switch(tas_hda->priv, 1); 845 845 tas_hda->priv->playback_started = false; ··· 882 876 mutex_lock(&tas_hda->priv->codec_lock); 883 877 884 878 /* Shutdown chip before system suspend */ 885 - tasdevice_tuning_switch(tas_hda->priv, 1); 879 + if (tas_hda->priv->playback_started) 880 + tasdevice_tuning_switch(tas_hda->priv, 1); 886 881 887 882 mutex_unlock(&tas_hda->priv->codec_lock); 888 883 ··· 915 908 * calibrated data inside algo. 916 909 */ 917 910 tasdevice_apply_calibration(tas_hda->priv); 911 + 912 + if (tas_hda->priv->playback_started) 913 + tasdevice_tuning_switch(tas_hda->priv, 0); 914 + 918 915 mutex_unlock(&tas_hda->priv->codec_lock); 919 916 920 917 return 0;