mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
ALSA: ymfpci: Store saved legacy registers in an array
In preparation for storing more than two legacy PCI registers, the existing ones are moved into a new array. Signed-off-by: Tasos Sahanidis <tasos@tasossah.com> Link: https://lore.kernel.org/r/20230329041440.177363-4-tasos@tasossah.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
69a6c1ba42
commit
39fef76ce5
@ -297,6 +297,12 @@ static const int saved_regs_index[] = {
|
||||
};
|
||||
#define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index)
|
||||
|
||||
static const int pci_saved_regs_index[] = {
|
||||
PCIR_DSXG_LEGACY,
|
||||
PCIR_DSXG_ELEGACY,
|
||||
};
|
||||
#define DSXG_PCI_NUM_SAVED_REGS ARRAY_SIZE(pci_saved_regs_index)
|
||||
|
||||
struct snd_ymfpci {
|
||||
int irq;
|
||||
|
||||
@ -376,8 +382,7 @@ struct snd_ymfpci {
|
||||
|
||||
u32 saved_regs[YDSXGR_NUM_SAVED_REGS];
|
||||
u32 saved_ydsxgr_mode;
|
||||
u16 saved_dsxg_legacy;
|
||||
u16 saved_dsxg_elegacy;
|
||||
u16 saved_dsxg_pci_regs[DSXG_PCI_NUM_SAVED_REGS];
|
||||
};
|
||||
|
||||
int snd_ymfpci_create(struct snd_card *card,
|
||||
|
@ -2228,13 +2228,16 @@ static int snd_ymfpci_suspend(struct device *dev)
|
||||
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
||||
snd_ac97_suspend(chip->ac97);
|
||||
|
||||
for (i = 0; i < YDSXGR_NUM_SAVED_REGS; i++)
|
||||
chip->saved_regs[i] = snd_ymfpci_readl(chip, saved_regs_index[i]);
|
||||
|
||||
chip->saved_ydsxgr_mode = snd_ymfpci_readl(chip, YDSXGR_MODE);
|
||||
pci_read_config_word(chip->pci, PCIR_DSXG_LEGACY,
|
||||
&chip->saved_dsxg_legacy);
|
||||
pci_read_config_word(chip->pci, PCIR_DSXG_ELEGACY,
|
||||
&chip->saved_dsxg_elegacy);
|
||||
|
||||
for (i = 0; i < DSXG_PCI_NUM_SAVED_REGS; i++)
|
||||
pci_read_config_word(chip->pci, pci_saved_regs_index[i],
|
||||
chip->saved_dsxg_pci_regs + i);
|
||||
|
||||
snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0);
|
||||
snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0);
|
||||
snd_ymfpci_disable_dsp(chip);
|
||||
@ -2258,10 +2261,9 @@ static int snd_ymfpci_resume(struct device *dev)
|
||||
|
||||
snd_ac97_resume(chip->ac97);
|
||||
|
||||
pci_write_config_word(chip->pci, PCIR_DSXG_LEGACY,
|
||||
chip->saved_dsxg_legacy);
|
||||
pci_write_config_word(chip->pci, PCIR_DSXG_ELEGACY,
|
||||
chip->saved_dsxg_elegacy);
|
||||
for (i = 0; i < DSXG_PCI_NUM_SAVED_REGS; i++)
|
||||
pci_write_config_word(chip->pci, pci_saved_regs_index[i],
|
||||
chip->saved_dsxg_pci_regs[i]);
|
||||
|
||||
/* start hw again */
|
||||
if (chip->start_count > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user