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

ALSA: ice1712: Save/restore routing and rate registers

Save/restore routing and rate registers during suspend/resume.
This fixes S/PDIF input being disabled after resume.
Tested with Audiophile 24/96.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

Ondrej Zary and committed by
Takashi Iwai
6ea0cae7 6e61246f

+32
+32
sound/pci/ice1712/ice1712.c
··· 1048 1048 old = inb(ICEMT(ice, RATE)); 1049 1049 if (!force && old == val) 1050 1050 goto __out; 1051 + 1052 + ice->cur_rate = rate; 1051 1053 outb(val, ICEMT(ice, RATE)); 1052 1054 spin_unlock_irqrestore(&ice->reg_lock, flags); 1053 1055 ··· 2834 2832 snd_pcm_suspend_all(ice->pcm_ds); 2835 2833 snd_ac97_suspend(ice->ac97); 2836 2834 2835 + spin_lock_irq(&ice->reg_lock); 2836 + ice->pm_saved_is_spdif_master = is_spdif_master(ice); 2837 + ice->pm_saved_spdif_ctrl = inw(ICEMT(ice, ROUTE_SPDOUT)); 2838 + ice->pm_saved_route = inw(ICEMT(ice, ROUTE_PSDOUT03)); 2839 + spin_unlock_irq(&ice->reg_lock); 2840 + 2837 2841 if (ice->pm_suspend) 2838 2842 ice->pm_suspend(ice); 2839 2843 ··· 2854 2846 struct pci_dev *pci = to_pci_dev(dev); 2855 2847 struct snd_card *card = dev_get_drvdata(dev); 2856 2848 struct snd_ice1712 *ice = card->private_data; 2849 + int rate; 2857 2850 2858 2851 if (!ice->pm_suspend_enabled) 2859 2852 return 0; ··· 2869 2860 2870 2861 pci_set_master(pci); 2871 2862 2863 + if (ice->cur_rate) 2864 + rate = ice->cur_rate; 2865 + else 2866 + rate = PRO_RATE_DEFAULT; 2867 + 2872 2868 if (snd_ice1712_chip_init(ice) < 0) { 2873 2869 snd_card_disconnect(card); 2874 2870 return -EIO; 2875 2871 } 2876 2872 2873 + ice->cur_rate = rate; 2874 + 2877 2875 if (ice->pm_resume) 2878 2876 ice->pm_resume(ice); 2877 + 2878 + if (ice->pm_saved_is_spdif_master) { 2879 + /* switching to external clock via SPDIF */ 2880 + spin_lock_irq(&ice->reg_lock); 2881 + outb(inb(ICEMT(ice, RATE)) | ICE1712_SPDIF_MASTER, 2882 + ICEMT(ice, RATE)); 2883 + spin_unlock_irq(&ice->reg_lock); 2884 + snd_ice1712_set_input_clock_source(ice, 1); 2885 + } else { 2886 + /* internal on-card clock */ 2887 + snd_ice1712_set_pro_rate(ice, rate, 1); 2888 + snd_ice1712_set_input_clock_source(ice, 0); 2889 + } 2890 + 2891 + outw(ice->pm_saved_spdif_ctrl, ICEMT(ice, ROUTE_SPDOUT)); 2892 + outw(ice->pm_saved_route, ICEMT(ice, ROUTE_PSDOUT03)); 2879 2893 2880 2894 if (ice->ac97) 2881 2895 snd_ac97_resume(ice->ac97);