Commit 39fef76c authored by Tasos Sahanidis's avatar Tasos Sahanidis Committed by Takashi Iwai

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: default avatarTasos Sahanidis <tasos@tasossah.com>
Link: https://lore.kernel.org/r/20230329041440.177363-4-tasos@tasossah.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 69a6c1ba
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment