summaryrefslogtreecommitdiff
path: root/sound/pci/ymfpci
diff options
context:
space:
mode:
authorTasos Sahanidis <tasos@tasossah.com>2023-03-29 07:14:39 +0300
committerTakashi Iwai <tiwai@suse.de>2023-03-29 09:28:27 +0300
commit39fef76ce533dd1fe3b55e929cdceb3269a91c99 (patch)
tree535c78078fbe965151fb1dcaff91f07f2e17d868 /sound/pci/ymfpci
parent69a6c1ba4238ef5ce01afb6f9e1b9be79b765d5f (diff)
downloadlinux-39fef76ce533dd1fe3b55e929cdceb3269a91c99.tar.xz
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>
Diffstat (limited to 'sound/pci/ymfpci')
-rw-r--r--sound/pci/ymfpci/ymfpci.h9
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c18
2 files changed, 17 insertions, 10 deletions
diff --git a/sound/pci/ymfpci/ymfpci.h b/sound/pci/ymfpci/ymfpci.h
index 04e2800049cd..192f6ce9b9fa 100644
--- a/sound/pci/ymfpci/ymfpci.h
+++ b/sound/pci/ymfpci/ymfpci.h
@@ -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,
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 8bf647824db2..02c9e454c2e6 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -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) {