[alsa-devel] [RFC] ymfpci - re-enable legacy audio after suspend resume

Takashi Iwai tiwai at suse.de
Fri Mar 9 07:18:06 CET 2012


At Fri, 9 Mar 2012 07:28:26 +0800,
Raymond Yau wrote:
> 
> 2012/3/8, Takashi Iwai <tiwai at suse.de>:
> > At Thu, 8 Mar 2012 12:12:33 +0800,
> > Raymond Yau wrote:
> >>
> >> Since the Legacy Audio Control register is reset to default after
> >> suspend resume cycle
> >>
> >> need to enable the Legacy Audio Control Bit in order to use OPL3 FM Synth
> >>
> >> however it is still need to use sbiload  instrument loader to reload
> >> the instruments
> >
> > Isn't it better to save and restore these PCI registers like below?
> > It still doesn't solve the lost instrument problem, though.
> >
> 
> I only use std.o3 and drums.o3
> 
> It seem that the playback of midi using aplaymidi can resume playback
> after suspend with my ymf724f
> 
> so it seem that there is no need to reload the instrument with your patch
> 
> >
> > ---
> > diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
> > index 444cd6b..1e35b16 100644
> > --- a/include/sound/ymfpci.h
> > +++ b/include/sound/ymfpci.h
> > @@ -366,6 +366,8 @@ struct snd_ymfpci {
> >  #ifdef CONFIG_PM
> >  	u32 *saved_regs;
> >  	u32 saved_ydsxgr_mode;
> > +	u16 saved_saved_dsxg_legacy;
> > +	u16 saved_saved_dsxg_elegacy;
> 
> 
> Should be saved_dsxg_legacy and save_dsxg_elegacy.

Err, of course.

> How can this change back port to 2.6 kernel ?

I guess the patch can be applied as is.  There have been no big changes
in that driver since ages.


Takashi


> 
> 
> >  #endif
> >  };
> >
> > diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
> > index 12a9a2b..a8159b81 100644
> > --- a/sound/pci/ymfpci/ymfpci_main.c
> > +++ b/sound/pci/ymfpci/ymfpci_main.c
> > @@ -2317,6 +2317,10 @@ int snd_ymfpci_suspend(struct pci_dev *pci,
> > pm_message_t state)
> >  	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);
> >  	snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0);
> >  	snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0);
> >  	snd_ymfpci_disable_dsp(chip);
> > @@ -2351,6 +2355,11 @@ int snd_ymfpci_resume(struct pci_dev *pci)
> >
> >  	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);
> > +
> >  	/* start hw again */
> >  	if (chip->start_count > 0) {
> >  		spin_lock_irq(&chip->reg_lock);
> >
> >
> 


More information about the Alsa-devel mailing list