Skip to contentSkip to conversation

ALS300(+)

PATCH Ash Willis 2 participants 2 messages Jan 27, 2006

lore
Share & tools
lore

Ash Willis

author
#0 lore raw

Hi Takashi,
I believe i've made all the changes that you requested. Please find attached my updated als300 patch.

Ash Willis

Signature · 2 lines
___________________________________________________
Play 100s of games for FREE! http://games.mail.com/
pci/Kconfig +12 -0
diff -Naur alsa-driver-orig/pci/Kconfig alsa-driver/pci/Kconfig
@@ -170,5 +170,17 @@
 	  To compile this driver as a module, choose M here: the module
 	  will be called snd-riptide
 
+config SND_ALS300
+        tristate "Avance Logic ALS300/ALS300+"
+        depends on SND
+        select SND_PCM
+        select SND_AC97_CODEC
+        select SND_OPL3_LIB
+        help
+          Say 'Y' or 'M' to include support for Avance Logic ALS300/ALS300+
+
+          To compile this driver as a module, choose M here: the module
+          will be called snd-als300
+
 endmenu
 
pci/Makefile +3 -0
diff -Naur alsa-driver-orig/pci/Makefile alsa-driver/pci/Makefile
@@ -9,6 +9,9 @@
 # ALSA extra code
 #
 
+snd-als300-objs := als300.o
+obj-$(CONFIG_SND_ALS300) += snd-als300.o
+
 clean-files := ad1889.c bt87x.c intel8x0.c maestro3.c
 
 obj-$(CONFIG_SND) += pdplus/ echoaudio/ riptide/ asihpi/
pci/als300.c +825 -0

825 lines not on this page · raw message

#1 lore raw

At Fri, 27 Jan 2006 00:58:09 -0500,

Quoted 4 lines · Ash Willis

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

Index: alsa-driver/pci/als300.c
===================================================================
RCS file: /home/iwai/cvs/alsa/alsa-driver/pci/als300.c,v retrieving revision 1.1

pci/als300.c +41 -0
diff -u -r1.1 als300.c
@@ -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)