Skip to contentSkip to conversation

PM patch to sb driver

RFT Aki M Laukkanen 1 participant 1 message Jun 21, 2000 Sound

lore
Share & tools
lore
#0 lore raw

Hello, this is an experimental patch to add pm support to the soundblaster driver. Contrary to what I earlier said I couldn't test it myself because sound worked with the sb driver just fine after suspend (On a Toshiba 220CS). I happened to test it only after making this patch so now I need testers who have troubles with suspend and the sb driver.

drivers/sound/sb.h +15 -5
diff -urN --exclude=*.flc linux-2.4.0-test1-ac22/drivers/sound/sb.h linux-2.4.0-test1-ac22.sb/drivers/sound/sb.h
@@ -1,3 +1,5 @@
+#include <linux/pm.h>
+
 #define DSP_RESET	(devc->base + 0x6)
 #define DSP_READ	(devc->base + 0xA)
 #define DSP_WRITE	(devc->base + 0xC)
@@ -138,7 +140,9 @@
            void *midi_irq_cookie;		/* IRQ cookie for the midi */
 
            struct sb_module_options sbmo;	/* Module options */
-
+       
+	/* Power management */
+	   struct pm_dev *pmdev;
         } sb_devc;
         
 /*
@@ -160,18 +164,16 @@
 int sb_dsp_detect (struct address_info *hw_config, int pci, int pciio, struct sb_module_options *sbmo);
 int sb_dsp_init (struct address_info *hw_config);
 void sb_dsp_unload(struct address_info *hw_config, int sbmpu);
-int sb_mixer_init(sb_devc *devc);
-void sb_mixer_unload(sb_devc *devc);
-void sb_mixer_set_stereo (sb_devc *devc, int mode);
-void smw_mixer_init(sb_devc *devc);
 void sb_dsp_midi_init (sb_devc *devc);
 void sb_audio_init (sb_devc *devc, char *name);
 void sb_midi_interrupt (sb_devc *devc);
 void sb_chgmixer (sb_devc * devc, unsigned int reg, unsigned int mask, unsigned int val);
 int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right);
 
+
 int sb_audio_open(int dev, int mode);
 void sb_audio_close(int dev);
+int sb_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data);
 
 extern sb_devc *last_sb;
 
@@ -184,3 +186,11 @@
 
 void unload_sb16(struct address_info *hw_info);
 void unload_sb16midi(struct address_info *hw_info);
+
+/*	From sb_mixer.c */
+int sb_mixer_set(sb_devc *devc, int dev, int value);
+int sb_set_recmask(sb_devc *devc, int mask);
+int sb_mixer_init(sb_devc *devc);
+void sb_mixer_unload(sb_devc *devc);
+void sb_mixer_set_stereo (sb_devc *devc, int mode);
+void smw_mixer_init(sb_devc *devc);
drivers/sound/sb_audio.c +6 -0
diff -urN --exclude=*.flc linux-2.4.0-test1-ac22/drivers/sound/sb_audio.c linux-2.4.0-test1-ac22.sb/drivers/sound/sb_audio.c
@@ -1122,4 +1122,10 @@
         }
         audio_devs[devc->dev]->mixer_dev = devc->my_mixerdev;
         audio_devs[devc->dev]->min_fragment = 5;
+
+	/* FIXME: PM_PCI_ID() needed but no access to pcidev */
+	devc->pmdev = pm_register(devc->caps&SB_PCI_IRQ?PM_PCI_DEV:PM_ISA_DEV, 
+				  devc->dev, sb_pm_callback);
+	if (devc->pmdev)
+		devc->pmdev->data = devc;
 }
drivers/sound/sb_card.c +3 -0
diff -urN --exclude=*.flc linux-2.4.0-test1-ac22/drivers/sound/sb_card.c linux-2.4.0-test1-ac22.sb/drivers/sound/sb_card.c
@@ -45,6 +45,8 @@
  * 25-05-2000 Added Creative SB AWE64 Gold (CTL00B2). 
  * 	Pål-Kristian Engstad <[email protected]>
  * 
+ * 21-06-2000 Power Management support. 
+ *	Aki Laukkanen <[email protected]>
  */
 
 #include <linux/config.h>
@@ -489,6 +491,7 @@
         }
         return(dev);
 }
+
 
 static struct pci_dev *sb_init(struct pci_bus *bus, struct address_info *hw_config, struct address_info *mpu_config, int slot, int card)
 {
drivers/sound/sb_common.c +63 -0

81 lines not on this page · raw message

drivers/sound/sb_mixer.c +4 -4
diff -urN --exclude=*.flc linux-2.4.0-test1-ac22/drivers/sound/sb_mixer.c linux-2.4.0-test1-ac22.sb/drivers/sound/sb_mixer.c
@@ -344,7 +344,7 @@
         return left | (right << 8);
 }
 
-static int sb_mixer_set(sb_devc * devc, int dev, int value)
+int sb_mixer_set(sb_devc * devc, int dev, int value)
 {
         int left = value & 0x000000ff;
         int right = (value & 0x0000ff00) >> 8;
@@ -387,7 +387,7 @@
         sb_setmixer(devc, RECORD_SRC, (sb_getmixer(devc, RECORD_SRC) & ~7) | (src & 0x7));
 }
 
-static int set_recmask(sb_devc * devc, int mask)
+int sb_set_recmask(sb_devc * devc, int mask)
 {
         int devmask, i;
         unsigned char  regimageL, regimageR;
@@ -569,7 +569,7 @@
                         switch (cmd & 0xff) 
                         {
                                 case SOUND_MIXER_RECSRC:
-					ret = set_recmask(devc, val);
+					ret = sb_set_recmask(devc, val);
                                         break;
 
                                 case SOUND_MIXER_OUTSRC:
@@ -654,7 +654,7 @@
                 sb_mixer_set(devc, i, devc->levels[i]);
 
         if (devc->model != MDL_ESS || !ess_mixer_reset (devc)) {
-		set_recmask(devc, SOUND_MASK_MIC);
+		sb_set_recmask(devc, SOUND_MASK_MIC);
         };
 }
 
Signature · 1 line
D.