hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/sound/pci/intel8x0.c
....@@ -1,29 +1,14 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * ALSA driver for Intel ICH (i8x0) chipsets
34 *
45 * Copyright (c) 2000 Jaroslav Kysela <perex@perex.cz>
56 *
6
- *
77 * This code also contains alpha support for SiS 735 chipsets provided
88 * by Mike Pieper <mptei@users.sourceforge.net>. We have no datasheet
99 * for SiS735, so the code is not fully functional.
1010 *
11
- *
12
- * This program is free software; you can redistribute it and/or modify
13
- * it under the terms of the GNU General Public License as published by
14
- * the Free Software Foundation; either version 2 of the License, or
15
- * (at your option) any later version.
16
- *
17
- * This program is distributed in the hope that it will be useful,
18
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- * GNU General Public License for more details.
21
- *
22
- * You should have received a copy of the GNU General Public License
23
- * along with this program; if not, write to the Free Software
24
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2511
26
- *
2712 */
2813
2914 #include <linux/io.h>
....@@ -38,11 +23,6 @@
3823 #include <sound/ac97_codec.h>
3924 #include <sound/info.h>
4025 #include <sound/initval.h>
41
-/* for 440MX workaround */
42
-#include <asm/pgtable.h>
43
-#ifdef CONFIG_X86
44
-#include <asm/set_memory.h>
45
-#endif
4626
4727 MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
4828 MODULE_DESCRIPTION("Intel 82801AA,82901AB,i810,i820,i830,i840,i845,MX440; SiS 7012; Ali 5455");
....@@ -86,7 +66,7 @@
8666 module_param(id, charp, 0444);
8767 MODULE_PARM_DESC(id, "ID string for Intel i8x0 soundcard.");
8868 module_param(ac97_clock, int, 0444);
89
-MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = whitelist + auto-detect, 1 = force autodetect).");
69
+MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = allowlist + auto-detect, 1 = force autodetect).");
9070 module_param(ac97_quirk, charp, 0444);
9171 MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
9272 module_param(buggy_semaphore, bool, 0444);
....@@ -374,7 +354,7 @@
374354 unsigned int ali_slot; /* ALI DMA slot */
375355 struct ac97_pcm *pcm;
376356 int pcm_open_flag;
377
- unsigned int page_attr_changed: 1;
357
+ unsigned int prepared:1;
378358 unsigned int suspended: 1;
379359 };
380360
....@@ -414,7 +394,7 @@
414394 struct snd_ac97 *ac97[3];
415395 unsigned int ac97_sdin[3];
416396 unsigned int max_codecs, ncodecs;
417
- unsigned int *codec_bit;
397
+ const unsigned int *codec_bit;
418398 unsigned int codec_isr_bits;
419399 unsigned int codec_ready_bits;
420400
....@@ -724,25 +704,6 @@
724704 iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI);
725705 }
726706
727
-#ifdef __i386__
728
-/*
729
- * Intel 82443MX running a 100MHz processor system bus has a hardware bug,
730
- * which aborts PCI busmaster for audio transfer. A workaround is to set
731
- * the pages as non-cached. For details, see the errata in
732
- * http://download.intel.com/design/chipsets/specupdt/24505108.pdf
733
- */
734
-static void fill_nocache(void *buf, int size, int nocache)
735
-{
736
- size = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
737
- if (nocache)
738
- set_pages_uc(virt_to_page(buf), size);
739
- else
740
- set_pages_wb(virt_to_page(buf), size);
741
-}
742
-#else
743
-#define fill_nocache(buf, size, nocache) do { ; } while (0)
744
-#endif
745
-
746707 /*
747708 * Interrupt handler
748709 */
....@@ -753,6 +714,9 @@
753714 unsigned long flags;
754715 int status, civ, i, step;
755716 int ack = 0;
717
+
718
+ if (!(ichdev->prepared || chip->in_measurement) || ichdev->suspended)
719
+ return;
756720
757721 spin_lock_irqsave(&chip->reg_lock, flags);
758722 status = igetbyte(chip, port + ichdev->roff_sr);
....@@ -850,7 +814,7 @@
850814 switch (cmd) {
851815 case SNDRV_PCM_TRIGGER_RESUME:
852816 ichdev->suspended = 0;
853
- /* fallthru */
817
+ fallthrough;
854818 case SNDRV_PCM_TRIGGER_START:
855819 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
856820 val = ICH_IOCE | ICH_STARTBM;
....@@ -858,7 +822,7 @@
858822 break;
859823 case SNDRV_PCM_TRIGGER_SUSPEND:
860824 ichdev->suspended = 1;
861
- /* fallthru */
825
+ fallthrough;
862826 case SNDRV_PCM_TRIGGER_STOP:
863827 val = 0;
864828 break;
....@@ -883,7 +847,7 @@
883847 struct intel8x0 *chip = snd_pcm_substream_chip(substream);
884848 struct ichdev *ichdev = get_ichdev(substream);
885849 unsigned long port = ichdev->reg_offset;
886
- static int fiforeg[] = {
850
+ static const int fiforeg[] = {
887851 ICHREG(ALI_FIFOCR1), ICHREG(ALI_FIFOCR2), ICHREG(ALI_FIFOCR3)
888852 };
889853 unsigned int val, fifo;
....@@ -892,7 +856,7 @@
892856 switch (cmd) {
893857 case SNDRV_PCM_TRIGGER_RESUME:
894858 ichdev->suspended = 0;
895
- /* fallthru */
859
+ fallthrough;
896860 case SNDRV_PCM_TRIGGER_START:
897861 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
898862 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
....@@ -909,7 +873,7 @@
909873 break;
910874 case SNDRV_PCM_TRIGGER_SUSPEND:
911875 ichdev->suspended = 1;
912
- /* fallthru */
876
+ fallthrough;
913877 case SNDRV_PCM_TRIGGER_STOP:
914878 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
915879 /* pause */
....@@ -938,26 +902,13 @@
938902 {
939903 struct intel8x0 *chip = snd_pcm_substream_chip(substream);
940904 struct ichdev *ichdev = get_ichdev(substream);
941
- struct snd_pcm_runtime *runtime = substream->runtime;
942905 int dbl = params_rate(hw_params) > 48000;
943906 int err;
944907
945
- if (chip->fix_nocache && ichdev->page_attr_changed) {
946
- fill_nocache(runtime->dma_area, runtime->dma_bytes, 0); /* clear */
947
- ichdev->page_attr_changed = 0;
948
- }
949
- err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
950
- if (err < 0)
951
- return err;
952
- if (chip->fix_nocache) {
953
- if (runtime->dma_area && ! ichdev->page_attr_changed) {
954
- fill_nocache(runtime->dma_area, runtime->dma_bytes, 1);
955
- ichdev->page_attr_changed = 1;
956
- }
957
- }
958908 if (ichdev->pcm_open_flag) {
959909 snd_ac97_pcm_close(ichdev->pcm);
960910 ichdev->pcm_open_flag = 0;
911
+ ichdev->prepared = 0;
961912 }
962913 err = snd_ac97_pcm_open(ichdev->pcm, params_rate(hw_params),
963914 params_channels(hw_params),
....@@ -974,18 +925,14 @@
974925
975926 static int snd_intel8x0_hw_free(struct snd_pcm_substream *substream)
976927 {
977
- struct intel8x0 *chip = snd_pcm_substream_chip(substream);
978928 struct ichdev *ichdev = get_ichdev(substream);
979929
980930 if (ichdev->pcm_open_flag) {
981931 snd_ac97_pcm_close(ichdev->pcm);
982932 ichdev->pcm_open_flag = 0;
933
+ ichdev->prepared = 0;
983934 }
984
- if (chip->fix_nocache && ichdev->page_attr_changed) {
985
- fill_nocache(substream->runtime->dma_area, substream->runtime->dma_bytes, 0);
986
- ichdev->page_attr_changed = 0;
987
- }
988
- return snd_pcm_lib_free_pages(substream);
935
+ return 0;
989936 }
990937
991938 static void snd_intel8x0_setup_pcm_out(struct intel8x0 *chip,
....@@ -1058,6 +1005,7 @@
10581005 ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1;
10591006 }
10601007 snd_intel8x0_setup_periods(chip, ichdev);
1008
+ ichdev->prepared = 1;
10611009 return 0;
10621010 }
10631011
....@@ -1370,7 +1318,6 @@
13701318 static const struct snd_pcm_ops snd_intel8x0_playback_ops = {
13711319 .open = snd_intel8x0_playback_open,
13721320 .close = snd_intel8x0_playback_close,
1373
- .ioctl = snd_pcm_lib_ioctl,
13741321 .hw_params = snd_intel8x0_hw_params,
13751322 .hw_free = snd_intel8x0_hw_free,
13761323 .prepare = snd_intel8x0_pcm_prepare,
....@@ -1381,7 +1328,6 @@
13811328 static const struct snd_pcm_ops snd_intel8x0_capture_ops = {
13821329 .open = snd_intel8x0_capture_open,
13831330 .close = snd_intel8x0_capture_close,
1384
- .ioctl = snd_pcm_lib_ioctl,
13851331 .hw_params = snd_intel8x0_hw_params,
13861332 .hw_free = snd_intel8x0_hw_free,
13871333 .prepare = snd_intel8x0_pcm_prepare,
....@@ -1392,7 +1338,6 @@
13921338 static const struct snd_pcm_ops snd_intel8x0_capture_mic_ops = {
13931339 .open = snd_intel8x0_mic_open,
13941340 .close = snd_intel8x0_mic_close,
1395
- .ioctl = snd_pcm_lib_ioctl,
13961341 .hw_params = snd_intel8x0_hw_params,
13971342 .hw_free = snd_intel8x0_hw_free,
13981343 .prepare = snd_intel8x0_pcm_prepare,
....@@ -1403,7 +1348,6 @@
14031348 static const struct snd_pcm_ops snd_intel8x0_capture_mic2_ops = {
14041349 .open = snd_intel8x0_mic2_open,
14051350 .close = snd_intel8x0_mic2_close,
1406
- .ioctl = snd_pcm_lib_ioctl,
14071351 .hw_params = snd_intel8x0_hw_params,
14081352 .hw_free = snd_intel8x0_hw_free,
14091353 .prepare = snd_intel8x0_pcm_prepare,
....@@ -1414,7 +1358,6 @@
14141358 static const struct snd_pcm_ops snd_intel8x0_capture2_ops = {
14151359 .open = snd_intel8x0_capture2_open,
14161360 .close = snd_intel8x0_capture2_close,
1417
- .ioctl = snd_pcm_lib_ioctl,
14181361 .hw_params = snd_intel8x0_hw_params,
14191362 .hw_free = snd_intel8x0_hw_free,
14201363 .prepare = snd_intel8x0_pcm_prepare,
....@@ -1425,7 +1368,6 @@
14251368 static const struct snd_pcm_ops snd_intel8x0_spdif_ops = {
14261369 .open = snd_intel8x0_spdif_open,
14271370 .close = snd_intel8x0_spdif_close,
1428
- .ioctl = snd_pcm_lib_ioctl,
14291371 .hw_params = snd_intel8x0_hw_params,
14301372 .hw_free = snd_intel8x0_hw_free,
14311373 .prepare = snd_intel8x0_pcm_prepare,
....@@ -1436,7 +1378,6 @@
14361378 static const struct snd_pcm_ops snd_intel8x0_ali_playback_ops = {
14371379 .open = snd_intel8x0_playback_open,
14381380 .close = snd_intel8x0_playback_close,
1439
- .ioctl = snd_pcm_lib_ioctl,
14401381 .hw_params = snd_intel8x0_hw_params,
14411382 .hw_free = snd_intel8x0_hw_free,
14421383 .prepare = snd_intel8x0_pcm_prepare,
....@@ -1447,7 +1388,6 @@
14471388 static const struct snd_pcm_ops snd_intel8x0_ali_capture_ops = {
14481389 .open = snd_intel8x0_capture_open,
14491390 .close = snd_intel8x0_capture_close,
1450
- .ioctl = snd_pcm_lib_ioctl,
14511391 .hw_params = snd_intel8x0_hw_params,
14521392 .hw_free = snd_intel8x0_hw_free,
14531393 .prepare = snd_intel8x0_pcm_prepare,
....@@ -1458,7 +1398,6 @@
14581398 static const struct snd_pcm_ops snd_intel8x0_ali_capture_mic_ops = {
14591399 .open = snd_intel8x0_mic_open,
14601400 .close = snd_intel8x0_mic_close,
1461
- .ioctl = snd_pcm_lib_ioctl,
14621401 .hw_params = snd_intel8x0_hw_params,
14631402 .hw_free = snd_intel8x0_hw_free,
14641403 .prepare = snd_intel8x0_pcm_prepare,
....@@ -1469,7 +1408,6 @@
14691408 static const struct snd_pcm_ops snd_intel8x0_ali_ac97spdifout_ops = {
14701409 .open = snd_intel8x0_ali_ac97spdifout_open,
14711410 .close = snd_intel8x0_ali_ac97spdifout_close,
1472
- .ioctl = snd_pcm_lib_ioctl,
14731411 .hw_params = snd_intel8x0_hw_params,
14741412 .hw_free = snd_intel8x0_hw_free,
14751413 .prepare = snd_intel8x0_pcm_prepare,
....@@ -1481,7 +1419,6 @@
14811419 static struct snd_pcm_ops snd_intel8x0_ali_spdifin_ops = {
14821420 .open = snd_intel8x0_ali_spdifin_open,
14831421 .close = snd_intel8x0_ali_spdifin_close,
1484
- .ioctl = snd_pcm_lib_ioctl,
14851422 .hw_params = snd_intel8x0_hw_params,
14861423 .hw_free = snd_intel8x0_hw_free,
14871424 .prepare = snd_intel8x0_pcm_prepare,
....@@ -1492,7 +1429,6 @@
14921429 static struct snd_pcm_ops snd_intel8x0_ali_spdifout_ops = {
14931430 .open = snd_intel8x0_ali_spdifout_open,
14941431 .close = snd_intel8x0_ali_spdifout_close,
1495
- .ioctl = snd_pcm_lib_ioctl,
14961432 .hw_params = snd_intel8x0_hw_params,
14971433 .hw_free = snd_intel8x0_hw_free,
14981434 .prepare = snd_intel8x0_pcm_prepare,
....@@ -1510,8 +1446,11 @@
15101446 int ac97_idx;
15111447 };
15121448
1449
+#define intel8x0_dma_type(chip) \
1450
+ ((chip)->fix_nocache ? SNDRV_DMA_TYPE_DEV_UC : SNDRV_DMA_TYPE_DEV)
1451
+
15131452 static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device,
1514
- struct ich_pcm_table *rec)
1453
+ const struct ich_pcm_table *rec)
15151454 {
15161455 struct snd_pcm *pcm;
15171456 int err;
....@@ -1540,9 +1479,9 @@
15401479 strcpy(pcm->name, chip->card->shortname);
15411480 chip->pcm[device] = pcm;
15421481
1543
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1544
- snd_dma_pci_data(chip->pci),
1545
- rec->prealloc_size, rec->prealloc_max_size);
1482
+ snd_pcm_set_managed_buffer_all(pcm, intel8x0_dma_type(chip),
1483
+ &chip->pci->dev,
1484
+ rec->prealloc_size, rec->prealloc_max_size);
15461485
15471486 if (rec->playback_ops &&
15481487 rec->playback_ops->open == snd_intel8x0_playback_open) {
....@@ -1566,7 +1505,7 @@
15661505 return 0;
15671506 }
15681507
1569
-static struct ich_pcm_table intel_pcms[] = {
1508
+static const struct ich_pcm_table intel_pcms[] = {
15701509 {
15711510 .playback_ops = &snd_intel8x0_playback_ops,
15721511 .capture_ops = &snd_intel8x0_capture_ops,
....@@ -1603,7 +1542,7 @@
16031542 },
16041543 };
16051544
1606
-static struct ich_pcm_table nforce_pcms[] = {
1545
+static const struct ich_pcm_table nforce_pcms[] = {
16071546 {
16081547 .playback_ops = &snd_intel8x0_playback_ops,
16091548 .capture_ops = &snd_intel8x0_capture_ops,
....@@ -1626,7 +1565,7 @@
16261565 },
16271566 };
16281567
1629
-static struct ich_pcm_table ali_pcms[] = {
1568
+static const struct ich_pcm_table ali_pcms[] = {
16301569 {
16311570 .playback_ops = &snd_intel8x0_ali_playback_ops,
16321571 .capture_ops = &snd_intel8x0_ali_capture_ops,
....@@ -1661,7 +1600,7 @@
16611600 static int snd_intel8x0_pcm(struct intel8x0 *chip)
16621601 {
16631602 int i, tblsize, device, err;
1664
- struct ich_pcm_table *tbl, *rec;
1603
+ const struct ich_pcm_table *tbl, *rec;
16651604
16661605 switch (chip->device_type) {
16671606 case DEVICE_INTEL_ICH4:
....@@ -2206,12 +2145,12 @@
22062145 int err;
22072146 unsigned int i, codecs;
22082147 unsigned int glob_sta = 0;
2209
- struct snd_ac97_bus_ops *ops;
2210
- static struct snd_ac97_bus_ops standard_bus_ops = {
2148
+ const struct snd_ac97_bus_ops *ops;
2149
+ static const struct snd_ac97_bus_ops standard_bus_ops = {
22112150 .write = snd_intel8x0_codec_write,
22122151 .read = snd_intel8x0_codec_read,
22132152 };
2214
- static struct snd_ac97_bus_ops ali_bus_ops = {
2153
+ static const struct snd_ac97_bus_ops ali_bus_ops = {
22152154 .write = snd_intel8x0_ali_codec_write,
22162155 .read = snd_intel8x0_ali_codec_read,
22172156 };
....@@ -2396,7 +2335,7 @@
23962335 }
23972336
23982337 #ifdef CONFIG_SND_AC97_POWER_SAVE
2399
-static struct snd_pci_quirk ich_chip_reset_mode[] = {
2338
+static const struct snd_pci_quirk ich_chip_reset_mode[] = {
24002339 SND_PCI_QUIRK(0x1014, 0x051f, "Thinkpad R32", 1),
24012340 { } /* end */
24022341 };
....@@ -2629,11 +2568,8 @@
26292568 __hw_end:
26302569 if (chip->irq >= 0)
26312570 free_irq(chip->irq, chip);
2632
- if (chip->bdbars.area) {
2633
- if (chip->fix_nocache)
2634
- fill_nocache(chip->bdbars.area, chip->bdbars.bytes, 0);
2571
+ if (chip->bdbars.area)
26352572 snd_dma_free_pages(&chip->bdbars);
2636
- }
26372573 if (chip->addr)
26382574 pci_iounmap(chip->pci, chip->addr);
26392575 if (chip->bmaddr)
....@@ -2655,19 +2591,6 @@
26552591 int i;
26562592
26572593 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
2658
- for (i = 0; i < chip->pcm_devs; i++)
2659
- snd_pcm_suspend_all(chip->pcm[i]);
2660
- /* clear nocache */
2661
- if (chip->fix_nocache) {
2662
- for (i = 0; i < chip->bdbars_count; i++) {
2663
- struct ichdev *ichdev = &chip->ichd[i];
2664
- if (ichdev->substream && ichdev->page_attr_changed) {
2665
- struct snd_pcm_runtime *runtime = ichdev->substream->runtime;
2666
- if (runtime->dma_area)
2667
- fill_nocache(runtime->dma_area, runtime->dma_bytes, 0);
2668
- }
2669
- }
2670
- }
26712594 for (i = 0; i < chip->ncodecs; i++)
26722595 snd_ac97_suspend(chip->ac97[i]);
26732596 if (chip->device_type == DEVICE_INTEL_ICH4)
....@@ -2676,6 +2599,7 @@
26762599 if (chip->irq >= 0) {
26772600 free_irq(chip->irq, chip);
26782601 chip->irq = -1;
2602
+ card->sync_irq = -1;
26792603 }
26802604 return 0;
26812605 }
....@@ -2696,7 +2620,7 @@
26962620 return -EIO;
26972621 }
26982622 chip->irq = pci->irq;
2699
- synchronize_irq(chip->irq);
2623
+ card->sync_irq = chip->irq;
27002624
27012625 /* re-initialize mixer stuff */
27022626 if (chip->device_type == DEVICE_INTEL_ICH4 && !spdif_aclink) {
....@@ -2708,24 +2632,8 @@
27082632 ICH_PCM_SPDIF_1011);
27092633 }
27102634
2711
- /* refill nocache */
2712
- if (chip->fix_nocache)
2713
- fill_nocache(chip->bdbars.area, chip->bdbars.bytes, 1);
2714
-
27152635 for (i = 0; i < chip->ncodecs; i++)
27162636 snd_ac97_resume(chip->ac97[i]);
2717
-
2718
- /* refill nocache */
2719
- if (chip->fix_nocache) {
2720
- for (i = 0; i < chip->bdbars_count; i++) {
2721
- struct ichdev *ichdev = &chip->ichd[i];
2722
- if (ichdev->substream && ichdev->page_attr_changed) {
2723
- struct snd_pcm_runtime *runtime = ichdev->substream->runtime;
2724
- if (runtime->dma_area)
2725
- fill_nocache(runtime->dma_area, runtime->dma_bytes, 1);
2726
- }
2727
- }
2728
- }
27292637
27302638 /* resume status */
27312639 for (i = 0; i < chip->bdbars_count; i++) {
....@@ -2873,7 +2781,7 @@
28732781 snd_ac97_update_power(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 0);
28742782 }
28752783
2876
-static struct snd_pci_quirk intel8x0_clock_list[] = {
2784
+static const struct snd_pci_quirk intel8x0_clock_list[] = {
28772785 SND_PCI_QUIRK(0x0e11, 0x008a, "AD1885", 41000),
28782786 SND_PCI_QUIRK(0x1014, 0x0581, "AD1981B", 48000),
28792787 SND_PCI_QUIRK(0x1028, 0x00be, "AD1885", 44100),
....@@ -2891,7 +2799,7 @@
28912799 wl = snd_pci_quirk_lookup(pci, intel8x0_clock_list);
28922800 if (!wl)
28932801 return 0;
2894
- dev_info(chip->card->dev, "white list rate for %04x:%04x is %i\n",
2802
+ dev_info(chip->card->dev, "allow list rate for %04x:%04x is %i\n",
28952803 pci->subsystem_vendor, pci->subsystem_device, wl->value);
28962804 chip->ac97_bus->clock = wl->value;
28972805 return 1;
....@@ -2933,10 +2841,8 @@
29332841
29342842 static void snd_intel8x0_proc_init(struct intel8x0 *chip)
29352843 {
2936
- struct snd_info_entry *entry;
2937
-
2938
- if (! snd_card_proc_new(chip->card, "intel8x0", &entry))
2939
- snd_info_set_text_ops(entry, chip, snd_intel8x0_proc_read);
2844
+ snd_card_ro_proc_new(chip->card, "intel8x0", chip,
2845
+ snd_intel8x0_proc_read);
29402846 }
29412847
29422848 static int snd_intel8x0_dev_free(struct snd_device *device)
....@@ -2950,10 +2856,10 @@
29502856 unsigned int offset;
29512857 };
29522858
2953
-static unsigned int ich_codec_bits[3] = {
2859
+static const unsigned int ich_codec_bits[3] = {
29542860 ICH_PCR, ICH_SCR, ICH_TCR
29552861 };
2956
-static unsigned int sis_codec_bits[3] = {
2862
+static const unsigned int sis_codec_bits[3] = {
29572863 ICH_PCR, ICH_SCR, ICH_SIS_TCR
29582864 };
29592865
....@@ -2998,18 +2904,18 @@
29982904 unsigned int i;
29992905 unsigned int int_sta_masks;
30002906 struct ichdev *ichdev;
3001
- static struct snd_device_ops ops = {
2907
+ static const struct snd_device_ops ops = {
30022908 .dev_free = snd_intel8x0_dev_free,
30032909 };
30042910
3005
- static unsigned int bdbars[] = {
2911
+ static const unsigned int bdbars[] = {
30062912 3, /* DEVICE_INTEL */
30072913 6, /* DEVICE_INTEL_ICH4 */
30082914 3, /* DEVICE_SIS */
30092915 6, /* DEVICE_ALI */
30102916 4, /* DEVICE_NFORCE */
30112917 };
3012
- static struct ich_reg_info intel_regs[6] = {
2918
+ static const struct ich_reg_info intel_regs[6] = {
30132919 { ICH_PIINT, 0 },
30142920 { ICH_POINT, 0x10 },
30152921 { ICH_MCINT, 0x20 },
....@@ -3017,13 +2923,13 @@
30172923 { ICH_P2INT, 0x50 },
30182924 { ICH_SPINT, 0x60 },
30192925 };
3020
- static struct ich_reg_info nforce_regs[4] = {
2926
+ static const struct ich_reg_info nforce_regs[4] = {
30212927 { ICH_PIINT, 0 },
30222928 { ICH_POINT, 0x10 },
30232929 { ICH_MCINT, 0x20 },
30242930 { ICH_NVSPINT, 0x70 },
30252931 };
3026
- static struct ich_reg_info ali_regs[6] = {
2932
+ static const struct ich_reg_info ali_regs[6] = {
30272933 { ALI_INT_PCMIN, 0x40 },
30282934 { ALI_INT_PCMOUT, 0x50 },
30292935 { ALI_INT_MICIN, 0x60 },
....@@ -3031,7 +2937,7 @@
30312937 { ALI_INT_SPDIFIN, 0xa0 },
30322938 { ALI_INT_SPDIFOUT, 0xb0 },
30332939 };
3034
- struct ich_reg_info *tbl;
2940
+ const struct ich_reg_info *tbl;
30352941
30362942 *r_intel8x0 = NULL;
30372943
....@@ -3057,6 +2963,12 @@
30572963
30582964 chip->inside_vm = snd_intel8x0_inside_vm(pci);
30592965
2966
+ /*
2967
+ * Intel 82443MX running a 100MHz processor system bus has a hardware
2968
+ * bug, which aborts PCI busmaster for audio transfer. A workaround
2969
+ * is to set the pages as non-cached. For details, see the errata in
2970
+ * http://download.intel.com/design/chipsets/specupdt/24505108.pdf
2971
+ */
30602972 if (pci->vendor == PCI_VENDOR_ID_INTEL &&
30612973 pci->device == PCI_DEVICE_ID_INTEL_440MX)
30622974 chip->fix_nocache = 1; /* enable workaround */
....@@ -3128,7 +3040,7 @@
31283040
31293041 /* allocate buffer descriptor lists */
31303042 /* the start of each lists must be aligned to 8 bytes */
3131
- if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
3043
+ if (snd_dma_alloc_pages(intel8x0_dma_type(chip), &pci->dev,
31323044 chip->bdbars_count * sizeof(u32) * ICH_MAX_FRAGS * 2,
31333045 &chip->bdbars) < 0) {
31343046 snd_intel8x0_free(chip);
....@@ -3137,9 +3049,6 @@
31373049 }
31383050 /* tables must be aligned to 8 bytes here, but the kernel pages
31393051 are much bigger, so we don't care (on i386) */
3140
- /* workaround for 440MX */
3141
- if (chip->fix_nocache)
3142
- fill_nocache(chip->bdbars.area, chip->bdbars.bytes, 1);
31433052 int_sta_masks = 0;
31443053 for (i = 0; i < chip->bdbars_count; i++) {
31453054 ichdev = &chip->ichd[i];
....@@ -3191,6 +3100,7 @@
31913100 return -EBUSY;
31923101 }
31933102 chip->irq = pci->irq;
3103
+ card->sync_irq = chip->irq;
31943104
31953105 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
31963106 snd_intel8x0_free(chip);
....@@ -3230,12 +3140,12 @@
32303140 { 0, NULL },
32313141 };
32323142
3233
-static struct snd_pci_quirk spdif_aclink_defaults[] = {
3143
+static const struct snd_pci_quirk spdif_aclink_defaults[] = {
32343144 SND_PCI_QUIRK(0x147b, 0x1c1a, "ASUS KN8", 1),
32353145 { } /* end */
32363146 };
32373147
3238
-/* look up white/black list for SPDIF over ac-link */
3148
+/* look up allow/deny list for SPDIF over ac-link */
32393149 static int check_default_spdif_aclink(struct pci_dev *pci)
32403150 {
32413151 const struct snd_pci_quirk *w;