Changeset 35
- Timestamp:
- Dec 13, 2005, 9:08:20 PM (20 years ago)
- Location:
- GPL/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk/alsa-kernel/core/pcm_native.c
r34 r35 31 31 * Compatibility 32 32 */ 33 //#define RULES_DEBUG 33 34 //#define DEBUG_PK 34 35 //#define static … … 125 126 char *snd_pcm_hw_param_names[] = { 126 127 HW_PARAM(ACCESS), 128 HW_PARAM(FORMAT), 127 129 #ifdef TARGET_OS2 128 130 HW_PARAM(RATE_MASK), 129 131 #endif 130 HW_PARAM(FORMAT),131 132 HW_PARAM(SUBFORMAT), 132 133 HW_PARAM(SAMPLE_BITS), -
GPL/trunk/alsa-kernel/pci/intel8x0.c
r34 r35 389 389 enum { ALID_PCMIN, ALID_PCMOUT, ALID_MIC, ALID_AC97SPDIFOUT, ALID_SPDIFIN, ALID_SPDIFOUT, ALID_LAST = ALID_SPDIFOUT }; 390 390 391 #define get_ichdev(substream) ( ichdev_t*)(substream->runtime->private_data)392 393 typedef struct {391 #define get_ichdev(substream) (struct ichdev *)(substream->runtime->private_data) 392 393 typedef struct ichdev { 394 394 unsigned int ichd; /* ich device number */ 395 395 unsigned long reg_offset; /* offset to bmaddr */ … … 418 418 unsigned int page_attr_changed: 1; 419 419 unsigned int suspended: 1; 420 } ichdev_t; 421 422 typedef struct _snd_intel8x0 intel8x0_t; 423 #define chip_t intel8x0_t 424 425 struct _snd_intel8x0 { 420 }; 421 422 struct intel8x0 { 426 423 unsigned int device_type; 427 424 … … 440 437 int pcm_devs; 441 438 snd_pcm_t *pcm[6]; 442 ichdev_tichd[6];439 struct ichdev ichd[6]; 443 440 444 441 int multi4: 1, … … 504 501 */ 505 502 506 static u8 igetbyte( intel8x0_t*chip, u32 offset)503 static u8 igetbyte(struct intel8x0 *chip, u32 offset) 507 504 { 508 505 if (chip->bm_mmio) … … 512 509 } 513 510 514 static u16 igetword( intel8x0_t*chip, u32 offset)511 static u16 igetword(struct intel8x0 *chip, u32 offset) 515 512 { 516 513 if (chip->bm_mmio) … … 520 517 } 521 518 522 static u32 igetdword( intel8x0_t*chip, u32 offset)519 static u32 igetdword(struct intel8x0 *chip, u32 offset) 523 520 { 524 521 if (chip->bm_mmio) … … 528 525 } 529 526 530 static void iputbyte( intel8x0_t*chip, u32 offset, u8 val)527 static void iputbyte(struct intel8x0 *chip, u32 offset, u8 val) 531 528 { 532 529 if (chip->bm_mmio) … … 536 533 } 537 534 538 static void iputword( intel8x0_t*chip, u32 offset, u16 val)535 static void iputword(struct intel8x0 *chip, u32 offset, u16 val) 539 536 { 540 537 if (chip->bm_mmio) … … 544 541 } 545 542 546 static void iputdword( intel8x0_t*chip, u32 offset, u32 val)543 static void iputdword(struct intel8x0 *chip, u32 offset, u32 val) 547 544 { 548 545 if (chip->bm_mmio) … … 556 553 */ 557 554 558 static u16 iagetword( intel8x0_t*chip, u32 offset)555 static u16 iagetword(struct intel8x0 *chip, u32 offset) 559 556 { 560 557 if (chip->mmio) … … 564 561 } 565 562 566 static void iaputword( intel8x0_t*chip, u32 offset, u16 val)563 static void iaputword(struct intel8x0 *chip, u32 offset, u16 val) 567 564 { 568 565 if (chip->mmio) … … 581 578 582 579 /* return the GLOB_STA bit for the corresponding codec */ 583 static unsigned int get_ich_codec_bit( intel8x0_t*chip, unsigned int codec)580 static unsigned int get_ich_codec_bit(struct intel8x0 *chip, unsigned int codec) 584 581 { 585 582 static unsigned int codec_bit[3] = { … … 593 590 } 594 591 595 static int snd_intel8x0_codec_semaphore( intel8x0_t*chip, unsigned int codec)592 static int snd_intel8x0_codec_semaphore(struct intel8x0 *chip, unsigned int codec) 596 593 { 597 594 int time; … … 633 630 unsigned short val) 634 631 { 635 intel8x0_t*chip = ac97->private_data;632 struct intel8x0 *chip = ac97->private_data; 636 633 637 634 if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) { … … 645 642 unsigned short reg) 646 643 { 647 intel8x0_t*chip = ac97->private_data;644 struct intel8x0 *chip = ac97->private_data; 648 645 unsigned short res; 649 646 unsigned int tmp; … … 666 663 } 667 664 668 static void snd_intel8x0_codec_read_test( intel8x0_t*chip, unsigned int codec)665 static void snd_intel8x0_codec_read_test(struct intel8x0 *chip, unsigned int codec) 669 666 { 670 667 unsigned int tmp; … … 682 679 * access to AC97 for Ali5455 683 680 */ 684 static int snd_intel8x0_ali_codec_ready( intel8x0_t*chip, int mask)681 static int snd_intel8x0_ali_codec_ready(struct intel8x0 *chip, int mask) 685 682 { 686 683 int count = 0; … … 695 692 } 696 693 697 static int snd_intel8x0_ali_codec_semaphore( intel8x0_t*chip)694 static int snd_intel8x0_ali_codec_semaphore(struct intel8x0 *chip) 698 695 { 699 696 int time = 100; … … 709 706 static unsigned short snd_intel8x0_ali_codec_read(ac97_t *ac97, unsigned short reg) 710 707 { 711 intel8x0_t*chip = ac97->private_data;708 struct intel8x0 *chip = ac97->private_data; 712 709 unsigned short data = 0xffff; 713 710 … … 727 724 static void snd_intel8x0_ali_codec_write(ac97_t *ac97, unsigned short reg, unsigned short val) 728 725 { 729 intel8x0_t*chip = ac97->private_data;726 struct intel8x0 *chip = ac97->private_data; 730 727 731 728 if (snd_intel8x0_ali_codec_semaphore(chip)) … … 742 739 * DMA I/O 743 740 */ 744 static void snd_intel8x0_setup_periods( intel8x0_t *chip, ichdev_t*ichdev)741 static void snd_intel8x0_setup_periods(struct intel8x0 *chip, struct ichdev *ichdev) 745 742 { 746 743 int idx; … … 789 786 */ 790 787 791 static inline void snd_intel8x0_update( intel8x0_t *chip, ichdev_t*ichdev)788 static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ichdev) 792 789 { 793 790 unsigned long port = ichdev->reg_offset; … … 839 836 static irqreturn_t snd_intel8x0_interrupt(int irq, void *dev_id, struct pt_regs *regs) 840 837 { 841 intel8x0_t*chip = dev_id;842 ichdev_t*ichdev;838 struct intel8x0 *chip = dev_id; 839 struct ichdev *ichdev; 843 840 unsigned int status; 844 #ifdef TARGET_OS2845 int fOurIrq = FALSE;846 #endif847 841 unsigned int i; 848 842 … … 868 862 return IRQ_RETVAL(status); 869 863 } 870 #ifdef TARGET_OS2871 fOurIrq = TRUE;872 #endif873 864 874 865 for (i = 0; i < chip->bdbars_count; i++) { … … 881 872 iputdword(chip, chip->int_sta_reg, status & chip->int_sta_mask); 882 873 883 #ifdef TARGET_OS2884 if (fOurIrq) {885 eoi_irq(irq);886 }887 #endif //TARGET_OS2888 889 874 return IRQ_HANDLED; 890 875 } … … 896 881 static int snd_intel8x0_pcm_trigger(snd_pcm_substream_t *substream, int cmd) 897 882 { 898 intel8x0_t*chip = snd_pcm_substream_chip(substream);899 ichdev_t*ichdev = get_ichdev(substream);883 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 884 struct ichdev *ichdev = get_ichdev(substream); 900 885 unsigned char val = 0; 901 886 unsigned long port = ichdev->reg_offset; … … 935 920 static int snd_intel8x0_ali_trigger(snd_pcm_substream_t *substream, int cmd) 936 921 { 937 intel8x0_t*chip = snd_pcm_substream_chip(substream);938 ichdev_t*ichdev = get_ichdev(substream);922 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 923 struct ichdev *ichdev = get_ichdev(substream); 939 924 unsigned long port = ichdev->reg_offset; 940 925 static int fiforeg[] = { ICHREG(ALI_FIFOCR1), ICHREG(ALI_FIFOCR2), ICHREG(ALI_FIFOCR3) }; … … 986 971 snd_pcm_hw_params_t * hw_params) 987 972 { 988 intel8x0_t*chip = snd_pcm_substream_chip(substream);989 ichdev_t*ichdev = get_ichdev(substream);973 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 974 struct ichdev *ichdev = get_ichdev(substream); 990 975 int dbl = params_rate(hw_params) > 48000; 991 976 int err; … … 1012 997 static int snd_intel8x0_hw_free(snd_pcm_substream_t * substream) 1013 998 { 1014 ichdev_t*ichdev = get_ichdev(substream);999 struct ichdev *ichdev = get_ichdev(substream); 1015 1000 1016 1001 if (ichdev->pcm_open_flag) { … … 1021 1006 } 1022 1007 1023 static void snd_intel8x0_setup_pcm_out( intel8x0_t*chip,1008 static void snd_intel8x0_setup_pcm_out(struct intel8x0 *chip, 1024 1009 snd_pcm_runtime_t *runtime) 1025 1010 { … … 1077 1062 static int snd_intel8x0_pcm_prepare(snd_pcm_substream_t * substream) 1078 1063 { 1079 intel8x0_t*chip = snd_pcm_substream_chip(substream);1064 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1080 1065 snd_pcm_runtime_t *runtime = substream->runtime; 1081 ichdev_t*ichdev = get_ichdev(substream);1066 struct ichdev *ichdev = get_ichdev(substream); 1082 1067 1083 1068 ichdev->physbuf = runtime->dma_addr; … … 1096 1081 static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(snd_pcm_substream_t * substream) 1097 1082 { 1098 intel8x0_t*chip = snd_pcm_substream_chip(substream);1099 ichdev_t*ichdev = get_ichdev(substream);1083 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1084 struct ichdev *ichdev = get_ichdev(substream); 1100 1085 size_t ptr1, ptr; 1101 1086 int civ, timeout = 100; … … 1165 1150 }; 1166 1151 1167 static int snd_intel8x0_pcm_open(snd_pcm_substream_t * substream, ichdev_t*ichdev)1168 { 1169 intel8x0_t*chip = snd_pcm_substream_chip(substream);1152 static int snd_intel8x0_pcm_open(snd_pcm_substream_t * substream, struct ichdev *ichdev) 1153 { 1154 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1170 1155 snd_pcm_runtime_t *runtime = substream->runtime; 1171 1156 int err; … … 1190 1175 static int snd_intel8x0_playback_open(snd_pcm_substream_t * substream) 1191 1176 { 1192 intel8x0_t*chip = snd_pcm_substream_chip(substream);1177 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1193 1178 snd_pcm_runtime_t *runtime = substream->runtime; 1194 1179 int err; … … 1214 1199 static int snd_intel8x0_playback_close(snd_pcm_substream_t * substream) 1215 1200 { 1216 intel8x0_t*chip = snd_pcm_substream_chip(substream);1201 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1217 1202 1218 1203 chip->ichd[ICHD_PCMOUT].substream = NULL; … … 1222 1207 static int snd_intel8x0_capture_open(snd_pcm_substream_t * substream) 1223 1208 { 1224 intel8x0_t*chip = snd_pcm_substream_chip(substream);1209 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1225 1210 1226 1211 return snd_intel8x0_pcm_open(substream, &chip->ichd[ICHD_PCMIN]); … … 1229 1214 static int snd_intel8x0_capture_close(snd_pcm_substream_t * substream) 1230 1215 { 1231 intel8x0_t*chip = snd_pcm_substream_chip(substream);1216 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1232 1217 1233 1218 chip->ichd[ICHD_PCMIN].substream = NULL; … … 1237 1222 static int snd_intel8x0_mic_open(snd_pcm_substream_t * substream) 1238 1223 { 1239 intel8x0_t*chip = snd_pcm_substream_chip(substream);1224 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1240 1225 1241 1226 return snd_intel8x0_pcm_open(substream, &chip->ichd[ICHD_MIC]); … … 1244 1229 static int snd_intel8x0_mic_close(snd_pcm_substream_t * substream) 1245 1230 { 1246 intel8x0_t*chip = snd_pcm_substream_chip(substream);1231 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1247 1232 1248 1233 chip->ichd[ICHD_MIC].substream = NULL; … … 1252 1237 static int snd_intel8x0_mic2_open(snd_pcm_substream_t * substream) 1253 1238 { 1254 intel8x0_t*chip = snd_pcm_substream_chip(substream);1239 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1255 1240 1256 1241 return snd_intel8x0_pcm_open(substream, &chip->ichd[ICHD_MIC2]); … … 1259 1244 static int snd_intel8x0_mic2_close(snd_pcm_substream_t * substream) 1260 1245 { 1261 intel8x0_t*chip = snd_pcm_substream_chip(substream);1246 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1262 1247 1263 1248 chip->ichd[ICHD_MIC2].substream = NULL; … … 1267 1252 static int snd_intel8x0_capture2_open(snd_pcm_substream_t * substream) 1268 1253 { 1269 intel8x0_t*chip = snd_pcm_substream_chip(substream);1254 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1270 1255 1271 1256 return snd_intel8x0_pcm_open(substream, &chip->ichd[ICHD_PCM2IN]); … … 1274 1259 static int snd_intel8x0_capture2_close(snd_pcm_substream_t * substream) 1275 1260 { 1276 intel8x0_t*chip = snd_pcm_substream_chip(substream);1261 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1277 1262 1278 1263 chip->ichd[ICHD_PCM2IN].substream = NULL; … … 1282 1267 static int snd_intel8x0_spdif_open(snd_pcm_substream_t * substream) 1283 1268 { 1284 intel8x0_t*chip = snd_pcm_substream_chip(substream);1269 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1285 1270 int idx = chip->device_type == DEVICE_NFORCE ? NVD_SPBAR : ICHD_SPBAR; 1286 1271 … … 1290 1275 static int snd_intel8x0_spdif_close(snd_pcm_substream_t * substream) 1291 1276 { 1292 intel8x0_t*chip = snd_pcm_substream_chip(substream);1277 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1293 1278 int idx = chip->device_type == DEVICE_NFORCE ? NVD_SPBAR : ICHD_SPBAR; 1294 1279 … … 1299 1284 static int snd_intel8x0_ali_ac97spdifout_open(snd_pcm_substream_t * substream) 1300 1285 { 1301 intel8x0_t*chip = snd_pcm_substream_chip(substream);1286 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1302 1287 unsigned int val; 1303 1288 … … 1314 1299 static int snd_intel8x0_ali_ac97spdifout_close(snd_pcm_substream_t * substream) 1315 1300 { 1316 intel8x0_t*chip = snd_pcm_substream_chip(substream);1301 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1317 1302 unsigned int val; 1318 1303 … … 1329 1314 static int snd_intel8x0_ali_spdifin_open(snd_pcm_substream_t * substream) 1330 1315 { 1331 intel8x0_t*chip = snd_pcm_substream_chip(substream);1316 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1332 1317 1333 1318 return snd_intel8x0_pcm_open(substream, &chip->ichd[ALID_SPDIFIN]); … … 1336 1321 static int snd_intel8x0_ali_spdifin_close(snd_pcm_substream_t * substream) 1337 1322 { 1338 intel8x0_t*chip = snd_pcm_substream_chip(substream);1323 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1339 1324 1340 1325 chip->ichd[ALID_SPDIFIN].substream = NULL; … … 1345 1330 static int snd_intel8x0_ali_spdifout_open(snd_pcm_substream_t * substream) 1346 1331 { 1347 intel8x0_t*chip = snd_pcm_substream_chip(substream);1332 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1348 1333 1349 1334 return snd_intel8x0_pcm_open(substream, &chip->ichd[ALID_SPDIFOUT]); … … 1352 1337 static int snd_intel8x0_ali_spdifout_close(snd_pcm_substream_t * substream) 1353 1338 { 1354 intel8x0_t*chip = snd_pcm_substream_chip(substream);1339 struct intel8x0 *chip = snd_pcm_substream_chip(substream); 1355 1340 1356 1341 chip->ichd[ALID_SPDIFOUT].substream = NULL; … … 1503 1488 }; 1504 1489 1505 static int __devinit snd_intel8x0_pcm1( intel8x0_t*chip, int device, struct ich_pcm_table *rec)1490 static int __devinit snd_intel8x0_pcm1(struct intel8x0 *chip, int device, struct ich_pcm_table *rec) 1506 1491 { 1507 1492 snd_pcm_t *pcm; … … 1631 1616 1632 1617 1633 static int __devinit snd_intel8x0_pcm( intel8x0_t*chip)1618 static int __devinit snd_intel8x0_pcm(struct intel8x0 *chip) 1634 1619 { 1635 1620 int i, tblsize, device, err; … … 1681 1666 static void snd_intel8x0_mixer_free_ac97_bus(ac97_bus_t *bus) 1682 1667 { 1683 intel8x0_t*chip = bus->private_data;1668 struct intel8x0 *chip = bus->private_data; 1684 1669 chip->ac97_bus = NULL; 1685 1670 } … … 1687 1672 static void snd_intel8x0_mixer_free_ac97(ac97_t *ac97) 1688 1673 { 1689 intel8x0_t*chip = ac97->private_data;1674 struct intel8x0 *chip = ac97->private_data; 1690 1675 chip->ac97[ac97->num] = NULL; 1691 1676 } … … 1891 1876 }, 1892 1877 { 1893 .subvendor = 0x103c, 1878 .subvendor = 0x103c, 1879 .subdevice = 0x0938, 1880 .name = "HP nc4200", 1881 .type = AC97_TUNE_HP_MUTE_LED 1882 }, 1883 { 1884 .subvendor = 0x103c, 1885 .subdevice = 0x099c, 1886 .name = "HP nc6120", 1887 .type = AC97_TUNE_HP_MUTE_LED 1888 }, 1889 { 1890 .subvendor = 0x103c, 1891 .subdevice = 0x0944, 1892 .name = "HP nc6220", 1893 .type = AC97_TUNE_HP_MUTE_LED 1894 }, 1895 { 1896 .subvendor = 0x103c, 1897 .subdevice = 0x0934, 1898 .name = "HP nc8220", 1899 .type = AC97_TUNE_HP_MUTE_LED 1900 }, 1901 { 1902 .subvendor = 0x103c, 1894 1903 .subdevice = 0x12f1, 1895 1904 .name = "HP xw8200", /* AD1981B*/ … … 1945 1954 }, 1946 1955 { 1956 .subvendor = 0x10cf, 1957 .subdevice = 0x12f2, 1958 .name = "Fujitsu-Siemens Celsius H320", 1959 .type = AC97_TUNE_SWAP_HP 1960 }, 1961 { 1947 1962 .subvendor = 0x10f1, 1948 1963 .subdevice = 0x2665, … … 2038 2053 }; 2039 2054 2040 static int __devinit snd_intel8x0_mixer( intel8x0_t*chip, int ac97_clock, char *quirk_override)2055 static int __devinit snd_intel8x0_mixer(struct intel8x0 *chip, int ac97_clock, char *quirk_override) 2041 2056 { 2042 2057 ac97_bus_t *pbus; … … 2225 2240 */ 2226 2241 2227 static void do_ali_reset( intel8x0_t*chip)2242 static void do_ali_reset(struct intel8x0 *chip) 2228 2243 { 2229 2244 iputdword(chip, ICHREG(ALI_SCR), ICH_ALI_SC_RESET); … … 2242 2257 } while (0) 2243 2258 2244 static int snd_intel8x0_ich_chip_init( intel8x0_t*chip, int probing)2259 static int snd_intel8x0_ich_chip_init(struct intel8x0 *chip, int probing) 2245 2260 { 2246 2261 unsigned long end_time; … … 2371 2386 } 2372 2387 2373 static int snd_intel8x0_ali_chip_init( intel8x0_t*chip, int probing)2388 static int snd_intel8x0_ali_chip_init(struct intel8x0 *chip, int probing) 2374 2389 { 2375 2390 u32 reg; … … 2406 2421 } 2407 2422 2408 static int snd_intel8x0_chip_init( intel8x0_t*chip, int probing)2423 static int snd_intel8x0_chip_init(struct intel8x0 *chip, int probing) 2409 2424 { 2410 2425 unsigned int i; … … 2432 2447 } 2433 2448 2434 static int snd_intel8x0_free( intel8x0_t*chip)2449 static int snd_intel8x0_free(struct intel8x0 *chip) 2435 2450 { 2436 2451 unsigned int i; … … 2471 2486 * power management 2472 2487 */ 2473 static int intel8x0_suspend(s nd_card_t *card, unsigned int state)2474 { 2475 intel8x0_t *chip = card->pm_private_data;2476 #ifdef TARGET_OS2 2488 static int intel8x0_suspend(struct pci_dev *pci, pm_message_t state) 2489 { 2490 struct snd_card *card = pci_get_drvdata(pci); 2491 struct intel8x0 *chip = card->private_data; 2477 2492 int i; 2478 #endif 2479 2480 #ifdef TARGET_OS2 2481 for (i = 0; i < 3; i++) 2482 if (chip->ac97[i]) 2483 snd_ac97_suspend(chip->ac97[i]); 2484 #endif 2493 2494 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 2495 2485 2496 for (i = 0; i < chip->pcm_devs; i++) 2486 2497 snd_pcm_suspend_all(chip->pcm[i]); 2498 2487 2499 for (i = 0; i < 3; i++) 2488 if (chip->ac97[i]) 2489 snd_ac97_suspend(chip->ac97[i]); 2500 snd_ac97_suspend(chip->ac97[i]); 2490 2501 if (chip->device_type == DEVICE_INTEL_ICH4 || 2491 2502 chip->device_type == DEVICE_INTEL_ICH5) … … 2494 2505 if (chip->irq >= 0) 2495 2506 free_irq(chip->irq, (void *)chip); 2496 pci_disable_device(chip->pci); 2507 pci_disable_device(pci); 2508 pci_save_state(pci); 2497 2509 return 0; 2498 2510 } 2499 2511 2500 static int intel8x0_resume(snd_card_t *card, unsigned int state) 2501 { 2502 intel8x0_t *chip = card->pm_private_data; 2512 static int intel8x0_resume(struct pci_dev *pci) 2513 { 2514 struct snd_card *card = pci_get_drvdata(pci); 2515 struct intel8x0 *chip = card->private_data; 2503 2516 int i; 2504 2517 2505 pci_enable_device(chip->pci); 2506 pci_set_master(chip->pci); 2507 request_irq(chip->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, card->shortname, (void *)chip); 2518 pci_restore_state(pci); 2519 pci_enable_device(pci); 2520 pci_set_master(pci); 2521 request_irq(pci->irq, snd_intel8x0_interrupt, SA_INTERRUPT|SA_SHIRQ, 2522 card->shortname, (void *)chip); 2523 chip->irq = pci->irq; 2508 2524 synchronize_irq(chip->irq); 2509 2525 snd_intel8x0_chip_init(chip, 1); … … 2520 2536 2521 2537 for (i = 0; i < 3; i++) 2522 if (chip->ac97[i]) 2523 snd_ac97_resume(chip->ac97[i]); 2538 snd_ac97_resume(chip->ac97[i]); 2524 2539 /* resume status */ 2525 2540 for (i = 0; i < chip->bdbars_count; i++) { 2526 ichdev_t*ichdev = &chip->ichd[i];2541 struct ichdev *ichdev = &chip->ichd[i]; 2527 2542 unsigned long port = ichdev->reg_offset; 2528 2543 if (! ichdev->substream || ! ichdev->suspended) … … 2535 2550 iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); 2536 2551 } 2552 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 2537 2553 return 0; 2538 2554 } … … 2542 2558 #define INTEL8X0_TESTBUF_SIZE 32768 /* enough large for one shot */ 2543 2559 2544 static void __devinit intel8x0_measure_ac97_clock( intel8x0_t*chip)2560 static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) 2545 2561 { 2546 2562 snd_pcm_substream_t *subs; 2547 ichdev_t*ichdev;2563 struct ichdev *ichdev; 2548 2564 unsigned long port; 2549 2565 unsigned long pos, t; … … 2621 2637 } 2622 2638 2639 #ifdef CONFIG_PROC_FS 2623 2640 static void snd_intel8x0_proc_read(snd_info_entry_t * entry, 2624 2641 snd_info_buffer_t * buffer) 2625 2642 { 2626 intel8x0_t*chip = entry->private_data;2643 struct intel8x0 *chip = entry->private_data; 2627 2644 unsigned int tmp; 2628 2645 … … 2649 2666 } 2650 2667 2651 static void __devinit snd_intel8x0_proc_init( intel8x0_t* chip)2668 static void __devinit snd_intel8x0_proc_init(struct intel8x0 * chip) 2652 2669 { 2653 2670 snd_info_entry_t *entry; … … 2656 2673 snd_info_set_text_ops(entry, chip, 1024, snd_intel8x0_proc_read); 2657 2674 } 2658 2675 #else 2676 #define snd_intel8x0_proc_init(x) 2677 #endif 2659 2678 2660 2679 static int snd_intel8x0_dev_free(snd_device_t *device) 2661 2680 { 2662 intel8x0_t*chip = device->device_data;2681 struct intel8x0 *chip = device->device_data; 2663 2682 return snd_intel8x0_free(chip); 2664 2683 } … … 2673 2692 struct pci_dev *pci, 2674 2693 unsigned long device_type, 2675 intel8x0_t** r_intel8x0)2676 { 2677 intel8x0_t*chip;2694 struct intel8x0 ** r_intel8x0) 2695 { 2696 struct intel8x0 *chip; 2678 2697 int err; 2679 2698 unsigned int i,pci_dword; … … 2682 2701 unsigned char pci_byte; 2683 2702 2684 ichdev_t*ichdev;2703 struct ichdev *ichdev; 2685 2704 #ifdef TARGET_OS2 2686 2705 static snd_device_ops_t ops = { … … 2913 2932 } 2914 2933 2915 snd_card_set_pm_callback(card, intel8x0_suspend, intel8x0_resume, chip);2916 2917 2934 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { 2918 2935 snd_intel8x0_free(chip); … … 2958 2975 static int dev; 2959 2976 snd_card_t *card; 2960 intel8x0_t*chip;2977 struct intel8x0 *chip; 2961 2978 int err; 2962 2979 struct shortname_table *name; … … 3010 3027 return err; 3011 3028 } 3029 3030 card->private_data = chip; 3031 3012 3032 if ((err = snd_intel8x0_mixer(chip, ac97_clock[dev], ac97_quirk[dev])) < 0){ 3013 3033 snd_card_free(card); … … 3059 3079 .id_table = snd_intel8x0_ids, 3060 3080 .probe = snd_intel8x0_probe, 3061 .remove = snd_intel8x0_remove, 3062 SND_PCI_PM_CALLBACKS 3081 .remove = snd_intel8x0_remove, 3082 #ifdef CONFIG_PM 3083 .suspend = intel8x0_suspend, 3084 .resume = intel8x0_resume, 3085 #endif 3063 3086 }; 3064 3087 -
GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci.c
r34 r35 191 191 } 192 192 chip->fm_res = fm_res; 193 chip->mpu_res = mpu_res; 193 chip->mpu_res = mpu_res; 194 card->private_data = chip; 195 194 196 strcpy(card->driver, str); 195 197 sprintf(card->shortname, "Yamaha DS-XG (%s)", str); … … 270 272 271 273 static struct pci_driver driver = { 272 0,0,0,"Yamaha DS-XG PCI", 273 snd_ymfpci_ids, 274 snd_card_ymfpci_probe, 275 snd_card_ymfpci_remove, 276 SND_PCI_PM_CALLBACKS 274 .name = "Yamaha DS-1 PCI", 275 .id_table = snd_ymfpci_ids, 276 .probe = snd_card_ymfpci_probe, 277 .remove = snd_card_ymfpci_remove, 278 #ifdef CONFIG_PM 279 .suspend = snd_ymfpci_suspend, 280 .resume = snd_ymfpci_resume, 281 #endif 277 282 }; 283 278 284 279 285 static int __init alsa_card_ymfpci_init(void) -
GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci_main.c
r34 r35 728 728 u32 status, nvoice, mode; 729 729 ymfpci_voice_t *voice; 730 #ifdef TARGET_OS2731 int fOurIrq = FALSE;732 #endif733 730 734 731 status = snd_ymfpci_readl(chip, YDSXGR_STATUS); 735 732 if (status & 0x80000000) { 736 #ifdef TARGET_OS2737 fOurIrq = TRUE;738 #endif739 733 chip->active_bank = snd_ymfpci_readl(chip, YDSXGR_CTRLSELECT) & 1; 740 734 spin_lock(&chip->voice_lock); … … 775 769 if (chip->rawmidi) 776 770 snd_mpu401_uart_interrupt(irq, chip->rawmidi->private_data, regs); 777 #ifdef TARGET_OS2778 if (fOurIrq) {779 eoi_irq(irq);780 }781 #endif //TARGET_OS2782 771 return IRQ_HANDLED; 783 772 } … … 2226 2215 #define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index) 2227 2216 2228 static int snd_ymfpci_suspend(snd_card_t *card, unsigned int state) 2229 { 2230 ymfpci_t *chip = card->pm_private_data; 2217 int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state) 2218 { 2219 struct snd_card *card = pci_get_drvdata(pci); 2220 struct snd_ymfpci *chip = card->private_data; 2231 2221 unsigned int i; 2232 2222 2223 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 2233 2224 snd_pcm_suspend_all(chip->pcm); 2234 2225 snd_pcm_suspend_all(chip->pcm2); … … 2241 2232 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0); 2242 2233 snd_ymfpci_disable_dsp(chip); 2243 return 0; 2244 } 2245 2246 static int snd_ymfpci_resume(snd_card_t *card, unsigned int state) 2247 { 2248 ymfpci_t *chip = card->pm_private_data; 2234 pci_disable_device(pci); 2235 pci_save_state(pci); 2236 return 0; 2237 } 2238 2239 int snd_ymfpci_resume(struct pci_dev *pci) 2240 { 2241 struct snd_card *card = pci_get_drvdata(pci); 2242 struct snd_ymfpci *chip = card->private_data; 2249 2243 unsigned int i; 2250 2244 2251 pci_enable_device(chip->pci); 2252 pci_set_master(chip->pci); 2253 snd_ymfpci_aclink_reset(chip->pci); 2245 pci_restore_state(pci); 2246 pci_enable_device(pci); 2247 pci_set_master(pci); 2248 snd_ymfpci_aclink_reset(pci); 2254 2249 snd_ymfpci_codec_ready(chip, 0); 2255 2250 snd_ymfpci_download_image(chip); … … 2268 2263 spin_unlock_irq(&chip->reg_lock); 2269 2264 } 2270 return 0; 2271 } 2265 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 2266 return 0; 2267 } 2268 2272 2269 #endif /* CONFIG_PM */ 2273 2270 … … 2354 2351 return -ENOMEM; 2355 2352 } 2356 snd_card_set_pm_callback(card, snd_ymfpci_suspend, snd_ymfpci_resume, chip);2357 2353 #endif 2358 2359 snd_ymfpci_proc_init(card, chip);2360 2354 2361 2355 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { … … 2364 2358 } 2365 2359 2360 snd_ymfpci_proc_init(card, chip); 2361 2366 2362 snd_card_set_dev(card, &pci->dev); 2367 2363 -
GPL/trunk/lib32/pci.c
r34 r35 894 894 } 895 895 896 struct pci_driver_mapping { 897 struct pci_dev *dev; 898 struct pci_driver *drv; 899 unsigned long dma_mask; 900 void *driver_data; 901 u32 saved_config[16]; 902 }; 903 904 #define PCI_MAX_MAPPINGS 64 905 static struct pci_driver_mapping drvmap [PCI_MAX_MAPPINGS] = { { NULL, } , }; 906 907 908 static struct pci_driver_mapping *get_pci_driver_mapping(struct pci_dev *dev) 909 { 910 int i; 911 912 for (i = 0; i < PCI_MAX_MAPPINGS; i++) 913 if (drvmap[i].dev == dev) 914 return &drvmap[i]; 915 return NULL; 916 } 917 918 struct pci_driver *snd_pci_compat_get_pci_driver(struct pci_dev *dev) 919 { 920 struct pci_driver_mapping *map = get_pci_driver_mapping(dev); 921 if (map) 922 return map->drv; 923 return NULL; 924 } 925 #if 0 926 void * pci_get_drvdata (struct pci_dev *dev) 927 { 928 struct pci_driver_mapping *map = get_pci_driver_mapping(dev); 929 if (map) 930 return map->driver_data; 931 return NULL; 932 } 933 934 935 void pci_set_drvdata (struct pci_dev *dev, void *driver_data) 936 { 937 struct pci_driver_mapping *map = get_pci_driver_mapping(dev); 938 if (map) 939 map->driver_data = driver_data; 940 } 941 #endif
Note:
See TracChangeset
for help on using the changeset viewer.