From: Takashi Iwai Subject: Re: [PATCH] ALS300(+) Date: Fri, 27 Jan 2006 12:45:50 +0100 Message-ID: References: <20060127055809.4939E8402E@ws1-5.us4.outblaze.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Fri_Jan_27_12:45:50_2006-1" Return-path: In-Reply-To: <20060127055809.4939E8402E@ws1-5.us4.outblaze.com> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Ash Willis Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org --Multipart_Fri_Jan_27_12:45:50_2006-1 Content-Type: text/plain; charset=US-ASCII At Fri, 27 Jan 2006 00:58:09 -0500, Ash Willis wrote: > > Hi Takashi, > I believe i've made all the changes that you requested. > Please find attached my updated als300 patch. Thanks, it looks good. I applied the patch to CVS now (with minor space fixes in a couple of places). BTW, could you try the patch below whether the suspend/resume works? If your machine isn't a laptop, try the following: # echo 3 > /sys/device/pci*/$YOUR-ALS300/power/state (it's a pseudo suspend on the given device) # echo 0 > /sys/device/pci*/$YOUR-ALS300/power/state (it's a pseudo resume on the given device) Then play something again. If it works, do the above procedure during playing sounds, and confirm that the playback is resumed, too. At best, you can try aplay, which surely supports PM. Takashi --Multipart_Fri_Jan_27_12:45:50_2006-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="als300-pm.diff" Content-Transfer-Encoding: 7bit Index: alsa-driver/pci/als300.c =================================================================== RCS file: /home/iwai/cvs/alsa/alsa-driver/pci/als300.c,v retrieving revision 1.1 diff -u -r1.1 als300.c --- alsa-driver/pci/als300.c 27 Jan 2006 10:16:49 -0000 1.1 +++ alsa-driver/pci/als300.c 27 Jan 2006 11:39:52 -0000 @@ -533,12 +533,14 @@ spin_lock(&chip->reg_lock); switch (cmd) { case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: tmp = snd_als300_gcr_read(chip->port, reg); data->period_flipflop = 1; snd_als300_gcr_write(chip->port, reg, tmp | TRANSFER_START); snd_als300_dbgplay("TRIGGER START\n"); break; case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_SUSPEND: tmp = snd_als300_gcr_read(chip->port, reg); snd_als300_gcr_write(chip->port, reg, tmp & ~TRANSFER_START); snd_als300_dbgplay("TRIGGER STOP\n"); @@ -757,6 +759,40 @@ return 0; } +#ifdef CONFIG_PM +static int snd_als300_suspend(struct pci_dev *pci, pm_message_t state) +{ + struct snd_card *card = pci_get_drvdata(pci); + struct snd_als300 *chip = card->private_data; + + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + snd_pcm_suspend_all(chip->pcm); + snd_ac97_suspend(chip->ac97); + + pci_set_power_state(pci, PCI_D3hot); + pci_disable_device(pci); + pci_save_state(pci); + return 0; +} + +static int snd_als300_resume(struct pci_dev *pci) +{ + struct snd_card *card = pci_get_drvdata(pci); + struct snd_als300 *chip = card->private_data; + + pci_restore_state(pci); + pci_enable_device(pci); + pci_set_power_state(pci, PCI_D0); + pci_set_master(pci); + + snd_als300_init(chip); + snd_ac97_resume(chip->ac97); + + snd_power_change_state(card, SNDRV_CTL_POWER_D0); + return 0; +} +#endif + static int __devinit snd_als300_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { @@ -783,6 +819,7 @@ snd_card_free(card); return err; } + card->private_data = chip; strcpy(card->driver, "ALS300"); if (chip->chip_type == DEVICE_ALS300_PLUS) @@ -809,6 +846,10 @@ .id_table = snd_als300_ids, .probe = snd_als300_probe, .remove = __devexit_p(snd_als300_remove), +#ifdef CONFIG_PM + .suspend = snd_als300_suspend, + .resume = snd_als300_resume, +#endif }; static int __init alsa_card_als300_init(void) --Multipart_Fri_Jan_27_12:45:50_2006-1-- ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642