[ALSA] caiaq - Fix indent in Kconfig
[linux-2.6.git] / sound / isa / azt2320.c
index bb41c6e..b615538 100644 (file)
@@ -93,6 +93,7 @@ struct snd_card_azt2320 {
        int dev_no;
        struct pnp_dev *dev;
        struct pnp_dev *devmpu;
+       struct snd_cs4231 *chip;
 };
 
 static struct pnp_card_device_id snd_azt2320_pnpids[] = {
@@ -227,10 +228,10 @@ static int __devinit snd_card_azt2320_probe(int dev,
                                            const struct pnp_card_device_id *pid)
 {
        int error;
-       snd_card_t *card;
+       struct snd_card *card;
        struct snd_card_azt2320 *acard;
-       cs4231_t *chip;
-       opl3_t *opl3;
+       struct snd_cs4231 *chip;
+       struct snd_opl3 *opl3;
 
        if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE,
                                 sizeof(struct snd_card_azt2320))) == NULL)
@@ -278,7 +279,7 @@ static int __devinit snd_card_azt2320_probe(int dev,
        if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) {
                if (snd_mpu401_uart_new(card, 0, MPU401_HW_AZT2320,
                                mpu_port[dev], 0,
-                               mpu_irq[dev], SA_INTERRUPT,
+                               mpu_irq[dev], IRQF_DISABLED,
                                NULL) < 0)
                        snd_printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", mpu_port[dev]);
        }
@@ -309,6 +310,8 @@ static int __devinit snd_card_azt2320_probe(int dev,
        return 0;
 }
 
+static unsigned int __devinitdata azt2320_devices;
+
 static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card,
                                            const struct pnp_card_device_id *id)
 {
@@ -322,6 +325,7 @@ static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card,
                if (res < 0)
                        return res;
                dev++;
+               azt2320_devices++;
                return 0;
        }
         return -ENODEV;
@@ -329,32 +333,62 @@ static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card,
 
 static void __devexit snd_azt2320_pnp_remove(struct pnp_card_link * pcard)
 {
-       snd_card_t *card = (snd_card_t *) pnp_get_card_drvdata(pcard);
+       snd_card_free(pnp_get_card_drvdata(pcard));
+       pnp_set_card_drvdata(pcard, NULL);
+}
+
+#ifdef CONFIG_PM
+static int snd_azt2320_pnp_suspend(struct pnp_card_link *pcard, pm_message_t state)
+{
+       struct snd_card *card = pnp_get_card_drvdata(pcard);
+       struct snd_card_azt2320 *acard = card->private_data;
+       struct snd_cs4231 *chip = acard->chip;
 
-       snd_card_disconnect(card);
-       snd_card_free_in_thread(card);
+       snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
+       chip->suspend(chip);
+       return 0;
 }
 
+static int snd_azt2320_pnp_resume(struct pnp_card_link *pcard)
+{
+       struct snd_card *card = pnp_get_card_drvdata(pcard);
+       struct snd_card_azt2320 *acard = card->private_data;
+       struct snd_cs4231 *chip = acard->chip;
+
+       chip->resume(chip);
+       snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+       return 0;
+}
+#endif
+
 static struct pnp_card_driver azt2320_pnpc_driver = {
        .flags          = PNP_DRIVER_RES_DISABLE,
        .name           = "azt2320",
        .id_table       = snd_azt2320_pnpids,
        .probe          = snd_azt2320_pnp_detect,
        .remove         = __devexit_p(snd_azt2320_pnp_remove),
+#ifdef CONFIG_PM
+       .suspend        = snd_azt2320_pnp_suspend,
+       .resume         = snd_azt2320_pnp_resume,
+#endif
 };
 
 static int __init alsa_card_azt2320_init(void)
 {
-       int cards = 0;
+       int err;
 
-       cards += pnp_register_card_driver(&azt2320_pnpc_driver);
-#ifdef MODULE
-       if (!cards) {
+       err = pnp_register_card_driver(&azt2320_pnpc_driver);
+       if (err)
+               return err;
+
+       if (!azt2320_devices) {
                pnp_unregister_card_driver(&azt2320_pnpc_driver);
+#ifdef MODULE
                snd_printk(KERN_ERR "no AZT2320 based soundcards found\n");
-       }
 #endif
-       return cards ? 0 : -ENODEV;
+               return -ENODEV;
+       }
+       return 0;
 }
 
 static void __exit alsa_card_azt2320_exit(void)