Lines Matching refs:chip
273 #define azx_get_snoop_type(chip) \ argument
274 (((chip)->driver_caps & AZX_DCAPS_SNOOP_MASK) >> 10)
343 #define use_vga_switcheroo(chip) ((chip)->use_vga_switcheroo) argument
345 #define use_vga_switcheroo(chip) 0 argument
373 static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) in __mark_pages_wc() argument
377 if (azx_snoop(chip)) in __mark_pages_wc()
385 if (chip->driver_type == AZX_DRIVER_CMEDIA) in __mark_pages_wc()
402 static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf, in mark_pages_wc() argument
405 __mark_pages_wc(chip, buf, on); in mark_pages_wc()
407 static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, in mark_runtime_wc() argument
411 __mark_pages_wc(chip, snd_pcm_get_dma_buf(substream), on); in mark_runtime_wc()
417 static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf, in mark_pages_wc() argument
421 static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, in mark_runtime_wc() argument
427 static int azx_acquire_irq(struct azx *chip, int do_disconnect);
444 static void azx_init_pci(struct azx *chip) in azx_init_pci() argument
446 int snoop_type = azx_get_snoop_type(chip); in azx_init_pci()
454 if (!(chip->driver_caps & AZX_DCAPS_NO_TCSEL)) { in azx_init_pci()
455 dev_dbg(chip->card->dev, "Clearing TCSEL\n"); in azx_init_pci()
456 update_pci_byte(chip->pci, AZX_PCIREG_TCSEL, 0x07, 0); in azx_init_pci()
463 dev_dbg(chip->card->dev, "Setting ATI snoop: %d\n", in azx_init_pci()
464 azx_snoop(chip)); in azx_init_pci()
465 update_pci_byte(chip->pci, in azx_init_pci()
467 azx_snoop(chip) ? ATI_SB450_HDAUDIO_ENABLE_SNOOP : 0); in azx_init_pci()
472 dev_dbg(chip->card->dev, "Setting Nvidia snoop: %d\n", in azx_init_pci()
473 azx_snoop(chip)); in azx_init_pci()
474 update_pci_byte(chip->pci, in azx_init_pci()
477 update_pci_byte(chip->pci, in azx_init_pci()
480 update_pci_byte(chip->pci, in azx_init_pci()
488 pci_read_config_word(chip->pci, INTEL_SCH_HDA_DEVC, &snoop); in azx_init_pci()
489 if ((!azx_snoop(chip) && !(snoop & INTEL_SCH_HDA_DEVC_NOSNOOP)) || in azx_init_pci()
490 (azx_snoop(chip) && (snoop & INTEL_SCH_HDA_DEVC_NOSNOOP))) { in azx_init_pci()
492 if (!azx_snoop(chip)) in azx_init_pci()
494 pci_write_config_word(chip->pci, INTEL_SCH_HDA_DEVC, snoop); in azx_init_pci()
495 pci_read_config_word(chip->pci, in azx_init_pci()
498 dev_dbg(chip->card->dev, "SCH snoop: %s\n", in azx_init_pci()
505 static int azx_get_delay_from_lpib(struct azx *chip, struct azx_dev *azx_dev, in azx_get_delay_from_lpib() argument
510 unsigned int lpib_pos = azx_get_pos_lpib(chip, azx_dev); in azx_get_delay_from_lpib()
525 dev_info(chip->card->dev, in azx_get_delay_from_lpib()
529 chip->driver_caps &= ~AZX_DCAPS_COUNT_LPIB_DELAY; in azx_get_delay_from_lpib()
530 chip->get_delay[stream] = NULL; in azx_get_delay_from_lpib()
536 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev);
539 static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev) in azx_position_check() argument
541 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_position_check()
544 ok = azx_position_ok(chip, azx_dev); in azx_position_check()
565 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) in azx_position_ok() argument
572 wallclk = azx_readl(chip, WALLCLK) - azx_dev->start_wallclk; in azx_position_ok()
576 if (chip->get_position[stream]) in azx_position_ok()
577 pos = chip->get_position[stream](chip, azx_dev); in azx_position_ok()
579 pos = azx_get_pos_posbuf(chip, azx_dev); in azx_position_ok()
581 dev_info(chip->card->dev, in azx_position_ok()
583 chip->get_position[stream] = azx_get_pos_lpib; in azx_position_ok()
584 pos = azx_get_pos_lpib(chip, azx_dev); in azx_position_ok()
585 chip->get_delay[stream] = NULL; in azx_position_ok()
587 chip->get_position[stream] = azx_get_pos_posbuf; in azx_position_ok()
588 if (chip->driver_caps & AZX_DCAPS_COUNT_LPIB_DELAY) in azx_position_ok()
589 chip->get_delay[stream] = azx_get_delay_from_lpib; in azx_position_ok()
602 return chip->bdl_pos_adj[chip->dev_index] ? 0 : -1; in azx_position_ok()
613 struct azx *chip = &hda->chip; in azx_irq_pending_work() local
617 dev_info(chip->card->dev, in azx_irq_pending_work()
619 chip->card->number); in azx_irq_pending_work()
625 spin_lock_irq(&chip->reg_lock); in azx_irq_pending_work()
626 for (i = 0; i < chip->num_streams; i++) { in azx_irq_pending_work()
627 struct azx_dev *azx_dev = &chip->azx_dev[i]; in azx_irq_pending_work()
632 ok = azx_position_ok(chip, azx_dev); in azx_irq_pending_work()
635 spin_unlock(&chip->reg_lock); in azx_irq_pending_work()
637 spin_lock(&chip->reg_lock); in azx_irq_pending_work()
643 spin_unlock_irq(&chip->reg_lock); in azx_irq_pending_work()
651 static void azx_clear_irq_pending(struct azx *chip) in azx_clear_irq_pending() argument
655 spin_lock_irq(&chip->reg_lock); in azx_clear_irq_pending()
656 for (i = 0; i < chip->num_streams; i++) in azx_clear_irq_pending()
657 chip->azx_dev[i].irq_pending = 0; in azx_clear_irq_pending()
658 spin_unlock_irq(&chip->reg_lock); in azx_clear_irq_pending()
661 static int azx_acquire_irq(struct azx *chip, int do_disconnect) in azx_acquire_irq() argument
663 if (request_irq(chip->pci->irq, azx_interrupt, in azx_acquire_irq()
664 chip->msi ? 0 : IRQF_SHARED, in azx_acquire_irq()
665 KBUILD_MODNAME, chip)) { in azx_acquire_irq()
666 dev_err(chip->card->dev, in azx_acquire_irq()
668 chip->pci->irq); in azx_acquire_irq()
670 snd_card_disconnect(chip->card); in azx_acquire_irq()
673 chip->irq = chip->pci->irq; in azx_acquire_irq()
674 pci_intx(chip->pci, !chip->msi); in azx_acquire_irq()
679 static unsigned int azx_via_get_position(struct azx *chip, in azx_via_get_position() argument
686 link_pos = azx_sd_readl(chip, azx_dev, SD_LPIB); in azx_via_get_position()
702 fifo_size = readw(chip->remap_addr + VIA_IN_STREAM0_FIFO_SIZE_OFFSET); in azx_via_get_position()
738 static void azx_add_card_list(struct azx *chip) in azx_add_card_list() argument
740 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_add_card_list()
746 static void azx_del_card_list(struct azx *chip) in azx_del_card_list() argument
748 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_del_card_list()
758 struct azx *chip; in param_set_xint() local
767 chip = &hda->chip; in param_set_xint()
768 if (!chip->bus || chip->disabled) in param_set_xint()
770 snd_hda_set_power_save(chip->bus, power_save * 1000); in param_set_xint()
776 #define azx_add_card_list(chip) /* NOP */ argument
777 #define azx_del_card_list(chip) /* NOP */ argument
787 struct azx *chip; in azx_suspend() local
793 chip = card->private_data; in azx_suspend()
794 hda = container_of(chip, struct hda_intel, chip); in azx_suspend()
795 if (chip->disabled || hda->init_failed) in azx_suspend()
799 azx_clear_irq_pending(chip); in azx_suspend()
800 azx_stop_chip(chip); in azx_suspend()
801 azx_enter_link_reset(chip); in azx_suspend()
802 if (chip->irq >= 0) { in azx_suspend()
803 free_irq(chip->irq, chip); in azx_suspend()
804 chip->irq = -1; in azx_suspend()
807 if (chip->msi) in azx_suspend()
808 pci_disable_msi(chip->pci); in azx_suspend()
809 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) in azx_suspend()
818 struct azx *chip; in azx_resume() local
824 chip = card->private_data; in azx_resume()
825 hda = container_of(chip, struct hda_intel, chip); in azx_resume()
826 if (chip->disabled || hda->init_failed) in azx_resume()
829 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { in azx_resume()
833 if (chip->msi) in azx_resume()
835 chip->msi = 0; in azx_resume()
836 if (azx_acquire_irq(chip, 1) < 0) in azx_resume()
838 azx_init_pci(chip); in azx_resume()
840 azx_init_chip(chip, true); in azx_resume()
881 struct azx *chip; in azx_runtime_suspend() local
887 chip = card->private_data; in azx_runtime_suspend()
888 hda = container_of(chip, struct hda_intel, chip); in azx_runtime_suspend()
889 if (chip->disabled || hda->init_failed) in azx_runtime_suspend()
892 if (!azx_has_pm_runtime(chip)) in azx_runtime_suspend()
896 azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | in azx_runtime_suspend()
899 azx_stop_chip(chip); in azx_runtime_suspend()
900 azx_enter_link_reset(chip); in azx_runtime_suspend()
901 azx_clear_irq_pending(chip); in azx_runtime_suspend()
902 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) in azx_runtime_suspend()
911 struct azx *chip; in azx_runtime_resume() local
920 chip = card->private_data; in azx_runtime_resume()
921 hda = container_of(chip, struct hda_intel, chip); in azx_runtime_resume()
922 if (chip->disabled || hda->init_failed) in azx_runtime_resume()
925 if (!azx_has_pm_runtime(chip)) in azx_runtime_resume()
928 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { in azx_runtime_resume()
934 status = azx_readw(chip, STATESTS); in azx_runtime_resume()
936 azx_init_pci(chip); in azx_runtime_resume()
937 azx_init_chip(chip, true); in azx_runtime_resume()
939 bus = chip->bus; in azx_runtime_resume()
948 azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & in azx_runtime_resume()
957 struct azx *chip; in azx_runtime_idle() local
963 chip = card->private_data; in azx_runtime_idle()
964 hda = container_of(chip, struct hda_intel, chip); in azx_runtime_idle()
965 if (chip->disabled || hda->init_failed) in azx_runtime_idle()
968 if (!power_save_controller || !azx_has_pm_runtime(chip) || in azx_runtime_idle()
969 chip->bus->core.codec_powered) in azx_runtime_idle()
990 static int azx_probe_continue(struct azx *chip);
999 struct azx *chip = card->private_data; in azx_vs_set_state() local
1000 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_vs_set_state()
1008 if (chip->disabled == disabled) in azx_vs_set_state()
1011 if (!chip->bus) { in azx_vs_set_state()
1012 chip->disabled = disabled; in azx_vs_set_state()
1014 dev_info(chip->card->dev, in azx_vs_set_state()
1016 if (azx_probe_continue(chip) < 0) { in azx_vs_set_state()
1017 dev_err(chip->card->dev, "initialization error\n"); in azx_vs_set_state()
1022 dev_info(chip->card->dev, "%s via VGA-switcheroo\n", in azx_vs_set_state()
1031 chip->disabled = true; in azx_vs_set_state()
1032 if (snd_hda_lock_devices(chip->bus)) in azx_vs_set_state()
1033 dev_warn(chip->card->dev, in azx_vs_set_state()
1036 snd_hda_unlock_devices(chip->bus); in azx_vs_set_state()
1038 chip->disabled = false; in azx_vs_set_state()
1047 struct azx *chip = card->private_data; in azx_vs_can_switch() local
1048 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_vs_can_switch()
1053 if (chip->disabled || !chip->bus) in azx_vs_can_switch()
1055 if (snd_hda_lock_devices(chip->bus)) in azx_vs_can_switch()
1057 snd_hda_unlock_devices(chip->bus); in azx_vs_can_switch()
1061 static void init_vga_switcheroo(struct azx *chip) in init_vga_switcheroo() argument
1063 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in init_vga_switcheroo()
1064 struct pci_dev *p = get_bound_vga(chip->pci); in init_vga_switcheroo()
1066 dev_info(chip->card->dev, in init_vga_switcheroo()
1078 static int register_vga_switcheroo(struct azx *chip) in register_vga_switcheroo() argument
1080 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in register_vga_switcheroo()
1088 err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, in register_vga_switcheroo()
1090 chip->bus != NULL); in register_vga_switcheroo()
1096 vga_switcheroo_init_domain_pm_optimus_hdmi_audio(chip->card->dev, in register_vga_switcheroo()
1101 #define init_vga_switcheroo(chip) /* NOP */ argument
1102 #define register_vga_switcheroo(chip) 0 argument
1109 static int azx_free(struct azx *chip) in azx_free() argument
1111 struct pci_dev *pci = chip->pci; in azx_free()
1112 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_free()
1115 if (azx_has_pm_runtime(chip) && chip->running) in azx_free()
1118 azx_del_card_list(chip); in azx_free()
1124 if (chip->disabled && chip->bus) in azx_free()
1125 snd_hda_unlock_devices(chip->bus); in azx_free()
1127 vga_switcheroo_unregister_client(chip->pci); in azx_free()
1130 if (chip->initialized) { in azx_free()
1131 azx_clear_irq_pending(chip); in azx_free()
1132 for (i = 0; i < chip->num_streams; i++) in azx_free()
1133 azx_stream_stop(chip, &chip->azx_dev[i]); in azx_free()
1134 azx_stop_chip(chip); in azx_free()
1137 if (chip->irq >= 0) in azx_free()
1138 free_irq(chip->irq, (void*)chip); in azx_free()
1139 if (chip->msi) in azx_free()
1140 pci_disable_msi(chip->pci); in azx_free()
1141 iounmap(chip->remap_addr); in azx_free()
1143 azx_free_stream_pages(chip); in azx_free()
1144 if (chip->region_requested) in azx_free()
1145 pci_release_regions(chip->pci); in azx_free()
1146 pci_disable_device(chip->pci); in azx_free()
1147 kfree(chip->azx_dev); in azx_free()
1149 release_firmware(chip->fw); in azx_free()
1151 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { in azx_free()
1227 static int check_position_fix(struct azx *chip, int fix) in check_position_fix() argument
1240 q = snd_pci_quirk_lookup(chip->pci, position_fix_list); in check_position_fix()
1242 dev_info(chip->card->dev, in check_position_fix()
1249 if (chip->driver_caps & AZX_DCAPS_POSFIX_VIA) { in check_position_fix()
1250 dev_dbg(chip->card->dev, "Using VIACOMBO position fix\n"); in check_position_fix()
1253 if (chip->driver_caps & AZX_DCAPS_POSFIX_LPIB) { in check_position_fix()
1254 dev_dbg(chip->card->dev, "Using LPIB position fix\n"); in check_position_fix()
1260 static void assign_position_fix(struct azx *chip, int fix) in assign_position_fix() argument
1270 chip->get_position[0] = chip->get_position[1] = callbacks[fix]; in assign_position_fix()
1274 chip->get_position[1] = NULL; in assign_position_fix()
1277 (chip->driver_caps & AZX_DCAPS_COUNT_LPIB_DELAY)) { in assign_position_fix()
1278 chip->get_delay[0] = chip->get_delay[1] = in assign_position_fix()
1308 static void check_probe_mask(struct azx *chip, int dev) in check_probe_mask() argument
1312 chip->codec_probe_mask = probe_mask[dev]; in check_probe_mask()
1313 if (chip->codec_probe_mask == -1) { in check_probe_mask()
1314 q = snd_pci_quirk_lookup(chip->pci, probe_mask_list); in check_probe_mask()
1316 dev_info(chip->card->dev, in check_probe_mask()
1319 chip->codec_probe_mask = q->value; in check_probe_mask()
1324 if (chip->codec_probe_mask != -1 && in check_probe_mask()
1325 (chip->codec_probe_mask & AZX_FORCE_CODEC_MASK)) { in check_probe_mask()
1326 chip->codec_mask = chip->codec_probe_mask & 0xff; in check_probe_mask()
1327 dev_info(chip->card->dev, "codec_mask forced to 0x%x\n", in check_probe_mask()
1328 chip->codec_mask); in check_probe_mask()
1349 static void check_msi(struct azx *chip) in check_msi() argument
1354 chip->msi = !!enable_msi; in check_msi()
1357 chip->msi = 1; /* enable MSI as default */ in check_msi()
1358 q = snd_pci_quirk_lookup(chip->pci, msi_black_list); in check_msi()
1360 dev_info(chip->card->dev, in check_msi()
1363 chip->msi = q->value; in check_msi()
1368 if (chip->driver_caps & AZX_DCAPS_NO_MSI) { in check_msi()
1369 dev_info(chip->card->dev, "Disabling MSI\n"); in check_msi()
1370 chip->msi = 0; in check_msi()
1375 static void azx_check_snoop_available(struct azx *chip) in azx_check_snoop_available() argument
1380 dev_info(chip->card->dev, "Force to %s mode by module option\n", in azx_check_snoop_available()
1382 chip->snoop = snoop; in azx_check_snoop_available()
1387 if (azx_get_snoop_type(chip) == AZX_SNOOP_TYPE_NONE && in azx_check_snoop_available()
1388 chip->driver_type == AZX_DRIVER_VIA) { in azx_check_snoop_available()
1393 pci_read_config_byte(chip->pci, 0x42, &val); in azx_check_snoop_available()
1394 if (!(val & 0x80) && chip->pci->revision == 0x30) in azx_check_snoop_available()
1398 if (chip->driver_caps & AZX_DCAPS_SNOOP_OFF) in azx_check_snoop_available()
1401 chip->snoop = snoop; in azx_check_snoop_available()
1403 dev_info(chip->card->dev, "Force to non-snoop mode\n"); in azx_check_snoop_available()
1409 azx_probe_continue(&hda->chip); in azx_probe_work()
1424 struct azx *chip; in azx_create() local
1439 chip = &hda->chip; in azx_create()
1440 spin_lock_init(&chip->reg_lock); in azx_create()
1441 mutex_init(&chip->open_mutex); in azx_create()
1442 chip->card = card; in azx_create()
1443 chip->pci = pci; in azx_create()
1444 chip->ops = hda_ops; in azx_create()
1445 chip->irq = -1; in azx_create()
1446 chip->driver_caps = driver_caps; in azx_create()
1447 chip->driver_type = driver_caps & 0xff; in azx_create()
1448 check_msi(chip); in azx_create()
1449 chip->dev_index = dev; in azx_create()
1450 chip->jackpoll_ms = jackpoll_ms; in azx_create()
1451 INIT_LIST_HEAD(&chip->pcm_list); in azx_create()
1454 init_vga_switcheroo(chip); in azx_create()
1457 assign_position_fix(chip, check_position_fix(chip, position_fix[dev])); in azx_create()
1459 check_probe_mask(chip, dev); in azx_create()
1461 chip->single_cmd = single_cmd; in azx_create()
1462 azx_check_snoop_available(chip); in azx_create()
1465 switch (chip->driver_type) { in azx_create()
1475 chip->bdl_pos_adj = bdl_pos_adj; in azx_create()
1477 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); in azx_create()
1480 azx_free(chip); in azx_create()
1487 *rchip = chip; in azx_create()
1492 static int azx_first_init(struct azx *chip) in azx_first_init() argument
1494 int dev = chip->dev_index; in azx_first_init()
1495 struct pci_dev *pci = chip->pci; in azx_first_init()
1496 struct snd_card *card = chip->card; in azx_first_init()
1503 if (chip->driver_type == AZX_DRIVER_ULI) { in azx_first_init()
1514 chip->region_requested = 1; in azx_first_init()
1516 chip->addr = pci_resource_start(pci, 0); in azx_first_init()
1517 chip->remap_addr = pci_ioremap_bar(pci, 0); in azx_first_init()
1518 if (chip->remap_addr == NULL) { in azx_first_init()
1523 if (chip->msi) { in azx_first_init()
1524 if (chip->driver_caps & AZX_DCAPS_NO_MSI64) { in azx_first_init()
1529 chip->msi = 0; in azx_first_init()
1532 if (azx_acquire_irq(chip, 0) < 0) in azx_first_init()
1536 synchronize_irq(chip->irq); in azx_first_init()
1538 gcap = azx_readw(chip, GCAP); in azx_first_init()
1542 if (chip->pci->vendor == PCI_VENDOR_ID_AMD) in azx_first_init()
1546 if (chip->pci->vendor == PCI_VENDOR_ID_ATI) { in azx_first_init()
1560 if (chip->driver_caps & AZX_DCAPS_NO_64BIT) { in azx_first_init()
1567 chip->align_buffer_size = !!align_buffer_size; in azx_first_init()
1569 if (chip->driver_caps & AZX_DCAPS_NO_ALIGN_BUFSIZE) in azx_first_init()
1570 chip->align_buffer_size = 0; in azx_first_init()
1572 chip->align_buffer_size = 1; in azx_first_init()
1588 chip->capture_streams = (gcap >> 8) & 0x0f; in azx_first_init()
1589 chip->playback_streams = (gcap >> 12) & 0x0f; in azx_first_init()
1590 if (!chip->playback_streams && !chip->capture_streams) { in azx_first_init()
1593 switch (chip->driver_type) { in azx_first_init()
1595 chip->playback_streams = ULI_NUM_PLAYBACK; in azx_first_init()
1596 chip->capture_streams = ULI_NUM_CAPTURE; in azx_first_init()
1600 chip->playback_streams = ATIHDMI_NUM_PLAYBACK; in azx_first_init()
1601 chip->capture_streams = ATIHDMI_NUM_CAPTURE; in azx_first_init()
1605 chip->playback_streams = ICH6_NUM_PLAYBACK; in azx_first_init()
1606 chip->capture_streams = ICH6_NUM_CAPTURE; in azx_first_init()
1610 chip->capture_index_offset = 0; in azx_first_init()
1611 chip->playback_index_offset = chip->capture_streams; in azx_first_init()
1612 chip->num_streams = chip->playback_streams + chip->capture_streams; in azx_first_init()
1613 chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev), in azx_first_init()
1615 if (!chip->azx_dev) in azx_first_init()
1618 err = azx_alloc_stream_pages(chip); in azx_first_init()
1623 azx_init_stream(chip); in azx_first_init()
1626 azx_init_pci(chip); in azx_first_init()
1628 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { in azx_first_init()
1631 hda = container_of(chip, struct hda_intel, chip); in azx_first_init()
1635 azx_init_chip(chip, (probe_only[dev] & 2) == 0); in azx_first_init()
1638 if (!chip->codec_mask) { in azx_first_init()
1644 strlcpy(card->shortname, driver_short_names[chip->driver_type], in azx_first_init()
1648 card->shortname, chip->addr, chip->irq); in azx_first_init()
1658 struct azx *chip = card->private_data; in azx_firmware_cb() local
1659 struct pci_dev *pci = chip->pci; in azx_firmware_cb()
1666 chip->fw = fw; in azx_firmware_cb()
1667 if (!chip->disabled) { in azx_firmware_cb()
1669 if (azx_probe_continue(chip)) in azx_firmware_cb()
1715 static int disable_msi_reset_irq(struct azx *chip) in disable_msi_reset_irq() argument
1719 free_irq(chip->irq, chip); in disable_msi_reset_irq()
1720 chip->irq = -1; in disable_msi_reset_irq()
1721 pci_disable_msi(chip->pci); in disable_msi_reset_irq()
1722 chip->msi = 0; in disable_msi_reset_irq()
1723 err = azx_acquire_irq(chip, 1); in disable_msi_reset_irq()
1731 static int dma_alloc_pages(struct azx *chip, in dma_alloc_pages() argument
1739 chip->card->dev, in dma_alloc_pages()
1743 mark_pages_wc(chip, buf, true); in dma_alloc_pages()
1747 static void dma_free_pages(struct azx *chip, struct snd_dma_buffer *buf) in dma_free_pages() argument
1749 mark_pages_wc(chip, buf, false); in dma_free_pages()
1753 static int substream_alloc_pages(struct azx *chip, in substream_alloc_pages() argument
1760 mark_runtime_wc(chip, azx_dev, substream, false); in substream_alloc_pages()
1767 mark_runtime_wc(chip, azx_dev, substream, true); in substream_alloc_pages()
1771 static int substream_free_pages(struct azx *chip, in substream_free_pages() argument
1775 mark_runtime_wc(chip, azx_dev, substream, false); in substream_free_pages()
1784 struct azx *chip = apcm->chip; in pcm_mmap_prepare() local
1785 if (!azx_snoop(chip) && chip->driver_type != AZX_DRIVER_CMEDIA) in pcm_mmap_prepare()
1812 struct azx *chip; in azx_probe() local
1831 &pci_hda_ops, &chip); in azx_probe()
1834 card->private_data = chip; in azx_probe()
1835 hda = container_of(chip, struct hda_intel, chip); in azx_probe()
1839 err = register_vga_switcheroo(chip); in azx_probe()
1848 chip->disabled = true; in azx_probe()
1851 schedule_probe = !chip->disabled; in azx_probe()
1867 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) in azx_probe()
1875 if (chip->disabled) in azx_probe()
1890 static int azx_probe_continue(struct azx *chip) in azx_probe_continue() argument
1892 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_probe_continue()
1893 struct pci_dev *pci = chip->pci; in azx_probe_continue()
1894 int dev = chip->dev_index; in azx_probe_continue()
1898 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { in azx_probe_continue()
1914 dev_err(chip->card->dev, in azx_probe_continue()
1924 err = azx_first_init(chip); in azx_probe_continue()
1929 chip->beep_mode = beep_mode[dev]; in azx_probe_continue()
1933 err = azx_bus_create(chip, model[dev]); in azx_probe_continue()
1937 err = azx_probe_codecs(chip, azx_max_codecs[chip->driver_type]); in azx_probe_continue()
1942 if (chip->fw) { in azx_probe_continue()
1943 err = snd_hda_load_patch(chip->bus, chip->fw->size, in azx_probe_continue()
1944 chip->fw->data); in azx_probe_continue()
1948 release_firmware(chip->fw); /* no longer needed */ in azx_probe_continue()
1949 chip->fw = NULL; in azx_probe_continue()
1954 err = azx_codec_configure(chip); in azx_probe_continue()
1959 err = snd_card_register(chip->card); in azx_probe_continue()
1963 chip->running = 1; in azx_probe_continue()
1964 azx_add_card_list(chip); in azx_probe_continue()
1965 snd_hda_set_power_save(chip->bus, power_save * 1000); in azx_probe_continue()
1966 if (azx_has_pm_runtime(chip) || hda->use_vga_switcheroo) in azx_probe_continue()
1979 struct azx *chip; in azx_remove() local
1984 chip = card->private_data; in azx_remove()
1985 hda = container_of(chip, struct hda_intel, chip); in azx_remove()
1995 struct azx *chip; in azx_shutdown() local
1999 chip = card->private_data; in azx_shutdown()
2000 if (chip && chip->running) in azx_shutdown()
2001 azx_stop_chip(chip); in azx_shutdown()