]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - sound/pci/intel8x0.c
Merge tag 'mips_5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
[linux.git] / sound / pci / intel8x0.c
index 12374ba08ca2c76b64ac19b0f1f82f9b060fa8e3..1781a1c081c3d4f986facbc3063eedb2f680692a 100644 (file)
@@ -393,7 +393,7 @@ struct intel8x0 {
        struct snd_ac97 *ac97[3];
        unsigned int ac97_sdin[3];
        unsigned int max_codecs, ncodecs;
-       unsigned int *codec_bit;
+       const unsigned int *codec_bit;
        unsigned int codec_isr_bits;
        unsigned int codec_ready_bits;
 
@@ -843,7 +843,7 @@ static int snd_intel8x0_ali_trigger(struct snd_pcm_substream *substream, int cmd
        struct intel8x0 *chip = snd_pcm_substream_chip(substream);
        struct ichdev *ichdev = get_ichdev(substream);
        unsigned long port = ichdev->reg_offset;
-       static int fiforeg[] = {
+       static const int fiforeg[] = {
                ICHREG(ALI_FIFOCR1), ICHREG(ALI_FIFOCR2), ICHREG(ALI_FIFOCR3)
        };
        unsigned int val, fifo;
@@ -901,9 +901,6 @@ static int snd_intel8x0_hw_params(struct snd_pcm_substream *substream,
        int dbl = params_rate(hw_params) > 48000;
        int err;
 
-       err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
-       if (err < 0)
-               return err;
        if (ichdev->pcm_open_flag) {
                snd_ac97_pcm_close(ichdev->pcm);
                ichdev->pcm_open_flag = 0;
@@ -929,7 +926,7 @@ static int snd_intel8x0_hw_free(struct snd_pcm_substream *substream)
                snd_ac97_pcm_close(ichdev->pcm);
                ichdev->pcm_open_flag = 0;
        }
-       return snd_pcm_lib_free_pages(substream);
+       return 0;
 }
 
 static void snd_intel8x0_setup_pcm_out(struct intel8x0 *chip,
@@ -1314,7 +1311,6 @@ static int snd_intel8x0_ali_spdifout_close(struct snd_pcm_substream *substream)
 static const struct snd_pcm_ops snd_intel8x0_playback_ops = {
        .open =         snd_intel8x0_playback_open,
        .close =        snd_intel8x0_playback_close,
-       .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0_pcm_prepare,
@@ -1325,7 +1321,6 @@ static const struct snd_pcm_ops snd_intel8x0_playback_ops = {
 static const struct snd_pcm_ops snd_intel8x0_capture_ops = {
        .open =         snd_intel8x0_capture_open,
        .close =        snd_intel8x0_capture_close,
-       .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0_pcm_prepare,
@@ -1336,7 +1331,6 @@ static const struct snd_pcm_ops snd_intel8x0_capture_ops = {
 static const struct snd_pcm_ops snd_intel8x0_capture_mic_ops = {
        .open =         snd_intel8x0_mic_open,
        .close =        snd_intel8x0_mic_close,
-       .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0_pcm_prepare,
@@ -1347,7 +1341,6 @@ static const struct snd_pcm_ops snd_intel8x0_capture_mic_ops = {
 static const struct snd_pcm_ops snd_intel8x0_capture_mic2_ops = {
        .open =         snd_intel8x0_mic2_open,
        .close =        snd_intel8x0_mic2_close,
-       .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0_pcm_prepare,
@@ -1358,7 +1351,6 @@ static const struct snd_pcm_ops snd_intel8x0_capture_mic2_ops = {
 static const struct snd_pcm_ops snd_intel8x0_capture2_ops = {
        .open =         snd_intel8x0_capture2_open,
        .close =        snd_intel8x0_capture2_close,
-       .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0_pcm_prepare,
@@ -1369,7 +1361,6 @@ static const struct snd_pcm_ops snd_intel8x0_capture2_ops = {
 static const struct snd_pcm_ops snd_intel8x0_spdif_ops = {
        .open =         snd_intel8x0_spdif_open,
        .close =        snd_intel8x0_spdif_close,
-       .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0_pcm_prepare,
@@ -1380,7 +1371,6 @@ static const struct snd_pcm_ops snd_intel8x0_spdif_ops = {
 static const struct snd_pcm_ops snd_intel8x0_ali_playback_ops = {
        .open =         snd_intel8x0_playback_open,
        .close =        snd_intel8x0_playback_close,
-       .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0_pcm_prepare,
@@ -1391,7 +1381,6 @@ static const struct snd_pcm_ops snd_intel8x0_ali_playback_ops = {
 static const struct snd_pcm_ops snd_intel8x0_ali_capture_ops = {
        .open =         snd_intel8x0_capture_open,
        .close =        snd_intel8x0_capture_close,
-       .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0_pcm_prepare,
@@ -1402,7 +1391,6 @@ static const struct snd_pcm_ops snd_intel8x0_ali_capture_ops = {
 static const struct snd_pcm_ops snd_intel8x0_ali_capture_mic_ops = {
        .open =         snd_intel8x0_mic_open,
        .close =        snd_intel8x0_mic_close,
-       .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0_pcm_prepare,
@@ -1413,7 +1401,6 @@ static const struct snd_pcm_ops snd_intel8x0_ali_capture_mic_ops = {
 static const struct snd_pcm_ops snd_intel8x0_ali_ac97spdifout_ops = {
        .open =         snd_intel8x0_ali_ac97spdifout_open,
        .close =        snd_intel8x0_ali_ac97spdifout_close,
-       .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0_pcm_prepare,
@@ -1425,7 +1412,6 @@ static const struct snd_pcm_ops snd_intel8x0_ali_ac97spdifout_ops = {
 static struct snd_pcm_ops snd_intel8x0_ali_spdifin_ops = {
        .open =         snd_intel8x0_ali_spdifin_open,
        .close =        snd_intel8x0_ali_spdifin_close,
-       .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0_pcm_prepare,
@@ -1436,7 +1422,6 @@ static struct snd_pcm_ops snd_intel8x0_ali_spdifin_ops = {
 static struct snd_pcm_ops snd_intel8x0_ali_spdifout_ops = {
        .open =         snd_intel8x0_ali_spdifout_open,
        .close =        snd_intel8x0_ali_spdifout_close,
-       .ioctl =        snd_pcm_lib_ioctl,
        .hw_params =    snd_intel8x0_hw_params,
        .hw_free =      snd_intel8x0_hw_free,
        .prepare =      snd_intel8x0_pcm_prepare,
@@ -1458,7 +1443,7 @@ struct ich_pcm_table {
        ((chip)->fix_nocache ? SNDRV_DMA_TYPE_DEV_UC : SNDRV_DMA_TYPE_DEV)
 
 static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device,
-                            struct ich_pcm_table *rec)
+                            const struct ich_pcm_table *rec)
 {
        struct snd_pcm *pcm;
        int err;
@@ -1487,9 +1472,9 @@ static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device,
                strcpy(pcm->name, chip->card->shortname);
        chip->pcm[device] = pcm;
 
-       snd_pcm_lib_preallocate_pages_for_all(pcm, intel8x0_dma_type(chip),
-                                             &chip->pci->dev,
-                                             rec->prealloc_size, rec->prealloc_max_size);
+       snd_pcm_set_managed_buffer_all(pcm, intel8x0_dma_type(chip),
+                                      &chip->pci->dev,
+                                      rec->prealloc_size, rec->prealloc_max_size);
 
        if (rec->playback_ops &&
            rec->playback_ops->open == snd_intel8x0_playback_open) {
@@ -1513,7 +1498,7 @@ static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device,
        return 0;
 }
 
-static struct ich_pcm_table intel_pcms[] = {
+static const struct ich_pcm_table intel_pcms[] = {
        {
                .playback_ops = &snd_intel8x0_playback_ops,
                .capture_ops = &snd_intel8x0_capture_ops,
@@ -1550,7 +1535,7 @@ static struct ich_pcm_table intel_pcms[] = {
        },
 };
 
-static struct ich_pcm_table nforce_pcms[] = {
+static const struct ich_pcm_table nforce_pcms[] = {
        {
                .playback_ops = &snd_intel8x0_playback_ops,
                .capture_ops = &snd_intel8x0_capture_ops,
@@ -1573,7 +1558,7 @@ static struct ich_pcm_table nforce_pcms[] = {
        },
 };
 
-static struct ich_pcm_table ali_pcms[] = {
+static const struct ich_pcm_table ali_pcms[] = {
        {
                .playback_ops = &snd_intel8x0_ali_playback_ops,
                .capture_ops = &snd_intel8x0_ali_capture_ops,
@@ -1608,7 +1593,7 @@ static struct ich_pcm_table ali_pcms[] = {
 static int snd_intel8x0_pcm(struct intel8x0 *chip)
 {
        int i, tblsize, device, err;
-       struct ich_pcm_table *tbl, *rec;
+       const struct ich_pcm_table *tbl, *rec;
 
        switch (chip->device_type) {
        case DEVICE_INTEL_ICH4:
@@ -2153,12 +2138,12 @@ static int snd_intel8x0_mixer(struct intel8x0 *chip, int ac97_clock,
        int err;
        unsigned int i, codecs;
        unsigned int glob_sta = 0;
-       struct snd_ac97_bus_ops *ops;
-       static struct snd_ac97_bus_ops standard_bus_ops = {
+       const struct snd_ac97_bus_ops *ops;
+       static const struct snd_ac97_bus_ops standard_bus_ops = {
                .write = snd_intel8x0_codec_write,
                .read = snd_intel8x0_codec_read,
        };
-       static struct snd_ac97_bus_ops ali_bus_ops = {
+       static const struct snd_ac97_bus_ops ali_bus_ops = {
                .write = snd_intel8x0_ali_codec_write,
                .read = snd_intel8x0_ali_codec_read,
        };
@@ -2343,7 +2328,7 @@ static void do_ali_reset(struct intel8x0 *chip)
 }
 
 #ifdef CONFIG_SND_AC97_POWER_SAVE
-static struct snd_pci_quirk ich_chip_reset_mode[] = {
+static const struct snd_pci_quirk ich_chip_reset_mode[] = {
        SND_PCI_QUIRK(0x1014, 0x051f, "Thinkpad R32", 1),
        { } /* end */
 };
@@ -2607,6 +2592,7 @@ static int intel8x0_suspend(struct device *dev)
        if (chip->irq >= 0) {
                free_irq(chip->irq, chip);
                chip->irq = -1;
+               card->sync_irq = -1;
        }
        return 0;
 }
@@ -2627,7 +2613,7 @@ static int intel8x0_resume(struct device *dev)
                return -EIO;
        }
        chip->irq = pci->irq;
-       synchronize_irq(chip->irq);
+       card->sync_irq = chip->irq;
 
        /* re-initialize mixer stuff */
        if (chip->device_type == DEVICE_INTEL_ICH4 && !spdif_aclink) {
@@ -2788,7 +2774,7 @@ static void intel8x0_measure_ac97_clock(struct intel8x0 *chip)
        snd_ac97_update_power(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 0);
 }
 
-static struct snd_pci_quirk intel8x0_clock_list[] = {
+static const struct snd_pci_quirk intel8x0_clock_list[] = {
        SND_PCI_QUIRK(0x0e11, 0x008a, "AD1885", 41000),
        SND_PCI_QUIRK(0x1014, 0x0581, "AD1981B", 48000),
        SND_PCI_QUIRK(0x1028, 0x00be, "AD1885", 44100),
@@ -2863,10 +2849,10 @@ struct ich_reg_info {
        unsigned int offset;
 };
 
-static unsigned int ich_codec_bits[3] = {
+static const unsigned int ich_codec_bits[3] = {
        ICH_PCR, ICH_SCR, ICH_TCR
 };
-static unsigned int sis_codec_bits[3] = {
+static const unsigned int sis_codec_bits[3] = {
        ICH_PCR, ICH_SCR, ICH_SIS_TCR
 };
 
@@ -2911,18 +2897,18 @@ static int snd_intel8x0_create(struct snd_card *card,
        unsigned int i;
        unsigned int int_sta_masks;
        struct ichdev *ichdev;
-       static struct snd_device_ops ops = {
+       static const struct snd_device_ops ops = {
                .dev_free =     snd_intel8x0_dev_free,
        };
 
-       static unsigned int bdbars[] = {
+       static const unsigned int bdbars[] = {
                3, /* DEVICE_INTEL */
                6, /* DEVICE_INTEL_ICH4 */
                3, /* DEVICE_SIS */
                6, /* DEVICE_ALI */
                4, /* DEVICE_NFORCE */
        };
-       static struct ich_reg_info intel_regs[6] = {
+       static const struct ich_reg_info intel_regs[6] = {
                { ICH_PIINT, 0 },
                { ICH_POINT, 0x10 },
                { ICH_MCINT, 0x20 },
@@ -2930,13 +2916,13 @@ static int snd_intel8x0_create(struct snd_card *card,
                { ICH_P2INT, 0x50 },
                { ICH_SPINT, 0x60 },
        };
-       static struct ich_reg_info nforce_regs[4] = {
+       static const struct ich_reg_info nforce_regs[4] = {
                { ICH_PIINT, 0 },
                { ICH_POINT, 0x10 },
                { ICH_MCINT, 0x20 },
                { ICH_NVSPINT, 0x70 },
        };
-       static struct ich_reg_info ali_regs[6] = {
+       static const struct ich_reg_info ali_regs[6] = {
                { ALI_INT_PCMIN, 0x40 },
                { ALI_INT_PCMOUT, 0x50 },
                { ALI_INT_MICIN, 0x60 },
@@ -2944,7 +2930,7 @@ static int snd_intel8x0_create(struct snd_card *card,
                { ALI_INT_SPDIFIN, 0xa0 },
                { ALI_INT_SPDIFOUT, 0xb0 },
        };
-       struct ich_reg_info *tbl;
+       const struct ich_reg_info *tbl;
 
        *r_intel8x0 = NULL;
 
@@ -3107,6 +3093,7 @@ static int snd_intel8x0_create(struct snd_card *card,
                return -EBUSY;
        }
        chip->irq = pci->irq;
+       card->sync_irq = chip->irq;
 
        if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
                snd_intel8x0_free(chip);
@@ -3146,7 +3133,7 @@ static struct shortname_table {
        { 0, NULL },
 };
 
-static struct snd_pci_quirk spdif_aclink_defaults[] = {
+static const struct snd_pci_quirk spdif_aclink_defaults[] = {
        SND_PCI_QUIRK(0x147b, 0x1c1a, "ASUS KN8", 1),
        { } /* end */
 };