Lines Matching refs:chip
280 #define azx_get_snoop_type(chip) \ argument
281 (((chip)->driver_caps & AZX_DCAPS_SNOOP_MASK) >> 10)
350 #define use_vga_switcheroo(chip) ((chip)->use_vga_switcheroo) argument
352 #define use_vga_switcheroo(chip) 0 argument
388 static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) in __mark_pages_wc() argument
392 if (azx_snoop(chip)) in __mark_pages_wc()
400 if (chip->driver_type == AZX_DRIVER_CMEDIA) in __mark_pages_wc()
417 static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf, in mark_pages_wc() argument
420 __mark_pages_wc(chip, buf, on); in mark_pages_wc()
422 static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, in mark_runtime_wc() argument
426 __mark_pages_wc(chip, snd_pcm_get_dma_buf(substream), on); in mark_runtime_wc()
432 static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf, in mark_pages_wc() argument
436 static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, in mark_runtime_wc() argument
442 static int azx_acquire_irq(struct azx *chip, int do_disconnect);
459 static void azx_init_pci(struct azx *chip) in azx_init_pci() argument
461 int snoop_type = azx_get_snoop_type(chip); in azx_init_pci()
469 if (!(chip->driver_caps & AZX_DCAPS_NO_TCSEL)) { in azx_init_pci()
470 dev_dbg(chip->card->dev, "Clearing TCSEL\n"); in azx_init_pci()
471 update_pci_byte(chip->pci, AZX_PCIREG_TCSEL, 0x07, 0); in azx_init_pci()
478 dev_dbg(chip->card->dev, "Setting ATI snoop: %d\n", in azx_init_pci()
479 azx_snoop(chip)); in azx_init_pci()
480 update_pci_byte(chip->pci, in azx_init_pci()
482 azx_snoop(chip) ? ATI_SB450_HDAUDIO_ENABLE_SNOOP : 0); in azx_init_pci()
487 dev_dbg(chip->card->dev, "Setting Nvidia snoop: %d\n", in azx_init_pci()
488 azx_snoop(chip)); in azx_init_pci()
489 update_pci_byte(chip->pci, in azx_init_pci()
492 update_pci_byte(chip->pci, in azx_init_pci()
495 update_pci_byte(chip->pci, in azx_init_pci()
503 pci_read_config_word(chip->pci, INTEL_SCH_HDA_DEVC, &snoop); in azx_init_pci()
504 if ((!azx_snoop(chip) && !(snoop & INTEL_SCH_HDA_DEVC_NOSNOOP)) || in azx_init_pci()
505 (azx_snoop(chip) && (snoop & INTEL_SCH_HDA_DEVC_NOSNOOP))) { in azx_init_pci()
507 if (!azx_snoop(chip)) in azx_init_pci()
509 pci_write_config_word(chip->pci, INTEL_SCH_HDA_DEVC, snoop); in azx_init_pci()
510 pci_read_config_word(chip->pci, in azx_init_pci()
513 dev_dbg(chip->card->dev, "SCH snoop: %s\n", in azx_init_pci()
526 static void bxt_reduce_dma_latency(struct azx *chip) in bxt_reduce_dma_latency() argument
530 val = azx_readl(chip, SKL_EM4L); in bxt_reduce_dma_latency()
532 azx_writel(chip, SKL_EM4L, val); in bxt_reduce_dma_latency()
535 static void hda_intel_init_chip(struct azx *chip, bool full_reset) in hda_intel_init_chip() argument
537 struct hdac_bus *bus = azx_bus(chip); in hda_intel_init_chip()
538 struct pci_dev *pci = chip->pci; in hda_intel_init_chip()
541 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) in hda_intel_init_chip()
548 azx_init_chip(chip, full_reset); in hda_intel_init_chip()
554 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) in hda_intel_init_chip()
559 bxt_reduce_dma_latency(chip); in hda_intel_init_chip()
563 static int azx_get_delay_from_lpib(struct azx *chip, struct azx_dev *azx_dev, in azx_get_delay_from_lpib() argument
568 unsigned int lpib_pos = azx_get_pos_lpib(chip, azx_dev); in azx_get_delay_from_lpib()
583 dev_info(chip->card->dev, in azx_get_delay_from_lpib()
587 chip->driver_caps &= ~AZX_DCAPS_COUNT_LPIB_DELAY; in azx_get_delay_from_lpib()
588 chip->get_delay[stream] = NULL; in azx_get_delay_from_lpib()
594 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev);
597 static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev) in azx_position_check() argument
599 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_position_check()
602 ok = azx_position_ok(chip, azx_dev); in azx_position_check()
615 static int azx_intel_link_power(struct azx *chip, bool enable) in azx_intel_link_power() argument
617 struct hdac_bus *bus = azx_bus(chip); in azx_intel_link_power()
631 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) in azx_position_ok() argument
638 wallclk = azx_readl(chip, WALLCLK) - azx_dev->core.start_wallclk; in azx_position_ok()
642 if (chip->get_position[stream]) in azx_position_ok()
643 pos = chip->get_position[stream](chip, azx_dev); in azx_position_ok()
645 pos = azx_get_pos_posbuf(chip, azx_dev); in azx_position_ok()
647 dev_info(chip->card->dev, in azx_position_ok()
649 chip->get_position[stream] = azx_get_pos_lpib; in azx_position_ok()
650 if (chip->get_position[0] == azx_get_pos_lpib && in azx_position_ok()
651 chip->get_position[1] == azx_get_pos_lpib) in azx_position_ok()
652 azx_bus(chip)->use_posbuf = false; in azx_position_ok()
653 pos = azx_get_pos_lpib(chip, azx_dev); in azx_position_ok()
654 chip->get_delay[stream] = NULL; in azx_position_ok()
656 chip->get_position[stream] = azx_get_pos_posbuf; in azx_position_ok()
657 if (chip->driver_caps & AZX_DCAPS_COUNT_LPIB_DELAY) in azx_position_ok()
658 chip->get_delay[stream] = azx_get_delay_from_lpib; in azx_position_ok()
671 return chip->bdl_pos_adj[chip->dev_index] ? 0 : -1; in azx_position_ok()
682 struct azx *chip = &hda->chip; in azx_irq_pending_work() local
683 struct hdac_bus *bus = azx_bus(chip); in azx_irq_pending_work()
688 dev_info(chip->card->dev, in azx_irq_pending_work()
690 chip->card->number); in azx_irq_pending_work()
703 ok = azx_position_ok(chip, azx_dev); in azx_irq_pending_work()
722 static void azx_clear_irq_pending(struct azx *chip) in azx_clear_irq_pending() argument
724 struct hdac_bus *bus = azx_bus(chip); in azx_clear_irq_pending()
735 static int azx_acquire_irq(struct azx *chip, int do_disconnect) in azx_acquire_irq() argument
737 struct hdac_bus *bus = azx_bus(chip); in azx_acquire_irq()
739 if (request_irq(chip->pci->irq, azx_interrupt, in azx_acquire_irq()
740 chip->msi ? 0 : IRQF_SHARED, in azx_acquire_irq()
741 KBUILD_MODNAME, chip)) { in azx_acquire_irq()
742 dev_err(chip->card->dev, in azx_acquire_irq()
744 chip->pci->irq); in azx_acquire_irq()
746 snd_card_disconnect(chip->card); in azx_acquire_irq()
749 bus->irq = chip->pci->irq; in azx_acquire_irq()
750 pci_intx(chip->pci, !chip->msi); in azx_acquire_irq()
755 static unsigned int azx_via_get_position(struct azx *chip, in azx_via_get_position() argument
778 fifo_size = readw(azx_bus(chip)->remap_addr + in azx_via_get_position()
815 static void azx_add_card_list(struct azx *chip) in azx_add_card_list() argument
817 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_add_card_list()
823 static void azx_del_card_list(struct azx *chip) in azx_del_card_list() argument
825 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_del_card_list()
835 struct azx *chip; in param_set_xint() local
844 chip = &hda->chip; in param_set_xint()
845 if (!hda->probe_continued || chip->disabled) in param_set_xint()
847 snd_hda_set_power_save(&chip->bus, power_save * 1000); in param_set_xint()
853 #define azx_add_card_list(chip) /* NOP */ argument
854 #define azx_del_card_list(chip) /* NOP */ argument
866 struct azx *chip = &hda->chip; in haswell_set_bclk() local
873 cdclk_freq = snd_hdac_get_display_clk(azx_bus(chip)); in haswell_set_bclk()
897 azx_writew(chip, HSW_EM4, bclk_m); in haswell_set_bclk()
898 azx_writew(chip, HSW_EM5, bclk_n); in haswell_set_bclk()
908 struct azx *chip; in azx_suspend() local
915 chip = card->private_data; in azx_suspend()
916 hda = container_of(chip, struct hda_intel, chip); in azx_suspend()
917 if (chip->disabled || hda->init_failed || !chip->running) in azx_suspend()
920 bus = azx_bus(chip); in azx_suspend()
922 azx_clear_irq_pending(chip); in azx_suspend()
923 azx_stop_chip(chip); in azx_suspend()
924 azx_enter_link_reset(chip); in azx_suspend()
926 free_irq(bus->irq, chip); in azx_suspend()
930 if (chip->msi) in azx_suspend()
931 pci_disable_msi(chip->pci); in azx_suspend()
932 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL in azx_suspend()
936 trace_azx_suspend(chip); in azx_suspend()
944 struct azx *chip; in azx_resume() local
950 chip = card->private_data; in azx_resume()
951 hda = container_of(chip, struct hda_intel, chip); in azx_resume()
952 if (chip->disabled || hda->init_failed || !chip->running) in azx_resume()
955 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL in azx_resume()
957 snd_hdac_display_power(azx_bus(chip), true); in azx_resume()
960 if (chip->msi) in azx_resume()
962 chip->msi = 0; in azx_resume()
963 if (azx_acquire_irq(chip, 1) < 0) in azx_resume()
965 azx_init_pci(chip); in azx_resume()
967 hda_intel_init_chip(chip, true); in azx_resume()
971 trace_azx_resume(chip); in azx_resume()
1005 struct azx *chip; in azx_runtime_suspend() local
1011 chip = card->private_data; in azx_runtime_suspend()
1012 hda = container_of(chip, struct hda_intel, chip); in azx_runtime_suspend()
1013 if (chip->disabled || hda->init_failed) in azx_runtime_suspend()
1016 if (!azx_has_pm_runtime(chip)) in azx_runtime_suspend()
1020 azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | in azx_runtime_suspend()
1023 azx_stop_chip(chip); in azx_runtime_suspend()
1024 azx_enter_link_reset(chip); in azx_runtime_suspend()
1025 azx_clear_irq_pending(chip); in azx_runtime_suspend()
1026 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL in azx_runtime_suspend()
1028 snd_hdac_display_power(azx_bus(chip), false); in azx_runtime_suspend()
1030 trace_azx_runtime_suspend(chip); in azx_runtime_suspend()
1037 struct azx *chip; in azx_runtime_resume() local
1046 chip = card->private_data; in azx_runtime_resume()
1047 hda = container_of(chip, struct hda_intel, chip); in azx_runtime_resume()
1048 if (chip->disabled || hda->init_failed) in azx_runtime_resume()
1051 if (!azx_has_pm_runtime(chip)) in azx_runtime_resume()
1054 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { in azx_runtime_resume()
1055 bus = azx_bus(chip); in azx_runtime_resume()
1067 status = azx_readw(chip, STATESTS); in azx_runtime_resume()
1069 azx_init_pci(chip); in azx_runtime_resume()
1070 hda_intel_init_chip(chip, true); in azx_runtime_resume()
1073 list_for_each_codec(codec, &chip->bus) in azx_runtime_resume()
1080 azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & in azx_runtime_resume()
1083 trace_azx_runtime_resume(chip); in azx_runtime_resume()
1090 struct azx *chip; in azx_runtime_idle() local
1096 chip = card->private_data; in azx_runtime_idle()
1097 hda = container_of(chip, struct hda_intel, chip); in azx_runtime_idle()
1098 if (chip->disabled || hda->init_failed) in azx_runtime_idle()
1101 if (!power_save_controller || !azx_has_pm_runtime(chip) || in azx_runtime_idle()
1102 azx_bus(chip)->codec_powered || !chip->running) in azx_runtime_idle()
1123 static int azx_probe_continue(struct azx *chip);
1132 struct azx *chip = card->private_data; in azx_vs_set_state() local
1133 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_vs_set_state()
1141 if (chip->disabled == disabled) in azx_vs_set_state()
1145 chip->disabled = disabled; in azx_vs_set_state()
1147 dev_info(chip->card->dev, in azx_vs_set_state()
1149 if (azx_probe_continue(chip) < 0) { in azx_vs_set_state()
1150 dev_err(chip->card->dev, "initialization error\n"); in azx_vs_set_state()
1155 dev_info(chip->card->dev, "%s via vga_switcheroo\n", in azx_vs_set_state()
1164 chip->disabled = true; in azx_vs_set_state()
1165 if (snd_hda_lock_devices(&chip->bus)) in azx_vs_set_state()
1166 dev_warn(chip->card->dev, in azx_vs_set_state()
1169 snd_hda_unlock_devices(&chip->bus); in azx_vs_set_state()
1171 chip->disabled = false; in azx_vs_set_state()
1180 struct azx *chip = card->private_data; in azx_vs_can_switch() local
1181 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_vs_can_switch()
1186 if (chip->disabled || !hda->probe_continued) in azx_vs_can_switch()
1188 if (snd_hda_lock_devices(&chip->bus)) in azx_vs_can_switch()
1190 snd_hda_unlock_devices(&chip->bus); in azx_vs_can_switch()
1194 static void init_vga_switcheroo(struct azx *chip) in init_vga_switcheroo() argument
1196 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in init_vga_switcheroo()
1197 struct pci_dev *p = get_bound_vga(chip->pci); in init_vga_switcheroo()
1199 dev_info(chip->card->dev, in init_vga_switcheroo()
1211 static int register_vga_switcheroo(struct azx *chip) in register_vga_switcheroo() argument
1213 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in register_vga_switcheroo()
1221 err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, in register_vga_switcheroo()
1228 vga_switcheroo_init_domain_pm_optimus_hdmi_audio(chip->card->dev, in register_vga_switcheroo()
1233 #define init_vga_switcheroo(chip) /* NOP */ argument
1234 #define register_vga_switcheroo(chip) 0 argument
1241 static int azx_free(struct azx *chip) in azx_free() argument
1243 struct pci_dev *pci = chip->pci; in azx_free()
1244 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_free()
1245 struct hdac_bus *bus = azx_bus(chip); in azx_free()
1247 if (azx_has_pm_runtime(chip) && chip->running) in azx_free()
1250 azx_del_card_list(chip); in azx_free()
1256 if (chip->disabled && hda->probe_continued) in azx_free()
1257 snd_hda_unlock_devices(&chip->bus); in azx_free()
1259 vga_switcheroo_unregister_client(chip->pci); in azx_free()
1263 azx_clear_irq_pending(chip); in azx_free()
1264 azx_stop_all_streams(chip); in azx_free()
1265 azx_stop_chip(chip); in azx_free()
1269 free_irq(bus->irq, (void*)chip); in azx_free()
1270 if (chip->msi) in azx_free()
1271 pci_disable_msi(chip->pci); in azx_free()
1274 azx_free_stream_pages(chip); in azx_free()
1275 azx_free_streams(chip); in azx_free()
1278 if (chip->region_requested) in azx_free()
1279 pci_release_regions(chip->pci); in azx_free()
1281 pci_disable_device(chip->pci); in azx_free()
1283 release_firmware(chip->fw); in azx_free()
1286 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { in azx_free()
1298 struct azx *chip = device->device_data; in azx_dev_disconnect() local
1300 chip->bus.shutdown = 1; in azx_dev_disconnect()
1371 static int check_position_fix(struct azx *chip, int fix) in check_position_fix() argument
1384 q = snd_pci_quirk_lookup(chip->pci, position_fix_list); in check_position_fix()
1386 dev_info(chip->card->dev, in check_position_fix()
1393 if (chip->driver_caps & AZX_DCAPS_POSFIX_VIA) { in check_position_fix()
1394 dev_dbg(chip->card->dev, "Using VIACOMBO position fix\n"); in check_position_fix()
1397 if (chip->driver_caps & AZX_DCAPS_POSFIX_LPIB) { in check_position_fix()
1398 dev_dbg(chip->card->dev, "Using LPIB position fix\n"); in check_position_fix()
1404 static void assign_position_fix(struct azx *chip, int fix) in assign_position_fix() argument
1414 chip->get_position[0] = chip->get_position[1] = callbacks[fix]; in assign_position_fix()
1418 chip->get_position[1] = NULL; in assign_position_fix()
1421 (chip->driver_caps & AZX_DCAPS_COUNT_LPIB_DELAY)) { in assign_position_fix()
1422 chip->get_delay[0] = chip->get_delay[1] = in assign_position_fix()
1452 static void check_probe_mask(struct azx *chip, int dev) in check_probe_mask() argument
1456 chip->codec_probe_mask = probe_mask[dev]; in check_probe_mask()
1457 if (chip->codec_probe_mask == -1) { in check_probe_mask()
1458 q = snd_pci_quirk_lookup(chip->pci, probe_mask_list); in check_probe_mask()
1460 dev_info(chip->card->dev, in check_probe_mask()
1463 chip->codec_probe_mask = q->value; in check_probe_mask()
1468 if (chip->codec_probe_mask != -1 && in check_probe_mask()
1469 (chip->codec_probe_mask & AZX_FORCE_CODEC_MASK)) { in check_probe_mask()
1470 azx_bus(chip)->codec_mask = chip->codec_probe_mask & 0xff; in check_probe_mask()
1471 dev_info(chip->card->dev, "codec_mask forced to 0x%x\n", in check_probe_mask()
1472 (int)azx_bus(chip)->codec_mask); in check_probe_mask()
1493 static void check_msi(struct azx *chip) in check_msi() argument
1498 chip->msi = !!enable_msi; in check_msi()
1501 chip->msi = 1; /* enable MSI as default */ in check_msi()
1502 q = snd_pci_quirk_lookup(chip->pci, msi_black_list); in check_msi()
1504 dev_info(chip->card->dev, in check_msi()
1507 chip->msi = q->value; in check_msi()
1512 if (chip->driver_caps & AZX_DCAPS_NO_MSI) { in check_msi()
1513 dev_info(chip->card->dev, "Disabling MSI\n"); in check_msi()
1514 chip->msi = 0; in check_msi()
1519 static void azx_check_snoop_available(struct azx *chip) in azx_check_snoop_available() argument
1524 dev_info(chip->card->dev, "Force to %s mode by module option\n", in azx_check_snoop_available()
1526 chip->snoop = snoop; in azx_check_snoop_available()
1531 if (azx_get_snoop_type(chip) == AZX_SNOOP_TYPE_NONE && in azx_check_snoop_available()
1532 chip->driver_type == AZX_DRIVER_VIA) { in azx_check_snoop_available()
1537 pci_read_config_byte(chip->pci, 0x42, &val); in azx_check_snoop_available()
1538 if (!(val & 0x80) && chip->pci->revision == 0x30) in azx_check_snoop_available()
1542 if (chip->driver_caps & AZX_DCAPS_SNOOP_OFF) in azx_check_snoop_available()
1545 chip->snoop = snoop; in azx_check_snoop_available()
1547 dev_info(chip->card->dev, "Force to non-snoop mode\n"); in azx_check_snoop_available()
1553 azx_probe_continue(&hda->chip); in azx_probe_work()
1571 struct azx *chip; in azx_create() local
1586 chip = &hda->chip; in azx_create()
1587 mutex_init(&chip->open_mutex); in azx_create()
1588 chip->card = card; in azx_create()
1589 chip->pci = pci; in azx_create()
1590 chip->ops = &pci_hda_ops; in azx_create()
1591 chip->driver_caps = driver_caps; in azx_create()
1592 chip->driver_type = driver_caps & 0xff; in azx_create()
1593 check_msi(chip); in azx_create()
1594 chip->dev_index = dev; in azx_create()
1595 chip->jackpoll_ms = jackpoll_ms; in azx_create()
1596 INIT_LIST_HEAD(&chip->pcm_list); in azx_create()
1599 init_vga_switcheroo(chip); in azx_create()
1602 assign_position_fix(chip, check_position_fix(chip, position_fix[dev])); in azx_create()
1604 check_probe_mask(chip, dev); in azx_create()
1606 chip->single_cmd = single_cmd; in azx_create()
1607 azx_check_snoop_available(chip); in azx_create()
1610 switch (chip->driver_type) { in azx_create()
1620 chip->bdl_pos_adj = bdl_pos_adj; in azx_create()
1622 err = azx_bus_init(chip, model[dev], &pci_hda_io_ops); in azx_create()
1629 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); in azx_create()
1632 azx_free(chip); in azx_create()
1639 *rchip = chip; in azx_create()
1644 static int azx_first_init(struct azx *chip) in azx_first_init() argument
1646 int dev = chip->dev_index; in azx_first_init()
1647 struct pci_dev *pci = chip->pci; in azx_first_init()
1648 struct snd_card *card = chip->card; in azx_first_init()
1649 struct hdac_bus *bus = azx_bus(chip); in azx_first_init()
1656 if (chip->driver_type == AZX_DRIVER_ULI) { in azx_first_init()
1667 chip->region_requested = 1; in azx_first_init()
1676 if (chip->msi) { in azx_first_init()
1677 if (chip->driver_caps & AZX_DCAPS_NO_MSI64) { in azx_first_init()
1682 chip->msi = 0; in azx_first_init()
1685 if (azx_acquire_irq(chip, 0) < 0) in azx_first_init()
1691 gcap = azx_readw(chip, GCAP); in azx_first_init()
1695 if (chip->pci->vendor == PCI_VENDOR_ID_AMD) in azx_first_init()
1699 if (chip->pci->vendor == PCI_VENDOR_ID_ATI) { in azx_first_init()
1713 if (chip->driver_caps & AZX_DCAPS_NO_64BIT) { in azx_first_init()
1720 chip->align_buffer_size = !!align_buffer_size; in azx_first_init()
1722 if (chip->driver_caps & AZX_DCAPS_NO_ALIGN_BUFSIZE) in azx_first_init()
1723 chip->align_buffer_size = 0; in azx_first_init()
1725 chip->align_buffer_size = 1; in azx_first_init()
1741 chip->capture_streams = (gcap >> 8) & 0x0f; in azx_first_init()
1742 chip->playback_streams = (gcap >> 12) & 0x0f; in azx_first_init()
1743 if (!chip->playback_streams && !chip->capture_streams) { in azx_first_init()
1746 switch (chip->driver_type) { in azx_first_init()
1748 chip->playback_streams = ULI_NUM_PLAYBACK; in azx_first_init()
1749 chip->capture_streams = ULI_NUM_CAPTURE; in azx_first_init()
1753 chip->playback_streams = ATIHDMI_NUM_PLAYBACK; in azx_first_init()
1754 chip->capture_streams = ATIHDMI_NUM_CAPTURE; in azx_first_init()
1758 chip->playback_streams = ICH6_NUM_PLAYBACK; in azx_first_init()
1759 chip->capture_streams = ICH6_NUM_CAPTURE; in azx_first_init()
1763 chip->capture_index_offset = 0; in azx_first_init()
1764 chip->playback_index_offset = chip->capture_streams; in azx_first_init()
1765 chip->num_streams = chip->playback_streams + chip->capture_streams; in azx_first_init()
1768 err = azx_init_streams(chip); in azx_first_init()
1772 err = azx_alloc_stream_pages(chip); in azx_first_init()
1777 azx_init_pci(chip); in azx_first_init()
1779 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { in azx_first_init()
1782 hda = container_of(chip, struct hda_intel, chip); in azx_first_init()
1786 hda_intel_init_chip(chip, (probe_only[dev] & 2) == 0); in azx_first_init()
1789 if (!azx_bus(chip)->codec_mask) { in azx_first_init()
1795 strlcpy(card->shortname, driver_short_names[chip->driver_type], in azx_first_init()
1809 struct azx *chip = card->private_data; in azx_firmware_cb() local
1810 struct pci_dev *pci = chip->pci; in azx_firmware_cb()
1817 chip->fw = fw; in azx_firmware_cb()
1818 if (!chip->disabled) { in azx_firmware_cb()
1820 if (azx_probe_continue(chip)) in azx_firmware_cb()
1866 static int disable_msi_reset_irq(struct azx *chip) in disable_msi_reset_irq() argument
1868 struct hdac_bus *bus = azx_bus(chip); in disable_msi_reset_irq()
1871 free_irq(bus->irq, chip); in disable_msi_reset_irq()
1873 pci_disable_msi(chip->pci); in disable_msi_reset_irq()
1874 chip->msi = 0; in disable_msi_reset_irq()
1875 err = azx_acquire_irq(chip, 1); in disable_msi_reset_irq()
1888 struct azx *chip = bus_to_azx(bus); in dma_alloc_pages() local
1896 mark_pages_wc(chip, buf, true); in dma_alloc_pages()
1902 struct azx *chip = bus_to_azx(bus); in dma_free_pages() local
1904 mark_pages_wc(chip, buf, false); in dma_free_pages()
1908 static int substream_alloc_pages(struct azx *chip, in substream_alloc_pages() argument
1915 mark_runtime_wc(chip, azx_dev, substream, false); in substream_alloc_pages()
1919 mark_runtime_wc(chip, azx_dev, substream, true); in substream_alloc_pages()
1923 static int substream_free_pages(struct azx *chip, in substream_free_pages() argument
1927 mark_runtime_wc(chip, azx_dev, substream, false); in substream_free_pages()
1936 struct azx *chip = apcm->chip; in pcm_mmap_prepare() local
1937 if (!azx_snoop(chip) && chip->driver_type != AZX_DRIVER_CMEDIA) in pcm_mmap_prepare()
1968 struct azx *chip; in azx_probe() local
1986 err = azx_create(card, pci, dev, pci_id->driver_data, &chip); in azx_probe()
1989 card->private_data = chip; in azx_probe()
1990 hda = container_of(chip, struct hda_intel, chip); in azx_probe()
1994 err = register_vga_switcheroo(chip); in azx_probe()
2003 chip->disabled = true; in azx_probe()
2006 schedule_probe = !chip->disabled; in azx_probe()
2022 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) in azx_probe()
2030 if (chip->disabled) in azx_probe()
2045 static int azx_probe_continue(struct azx *chip) in azx_probe_continue() argument
2047 struct hda_intel *hda = container_of(chip, struct hda_intel, chip); in azx_probe_continue()
2048 struct hdac_bus *bus = azx_bus(chip); in azx_probe_continue()
2049 struct pci_dev *pci = chip->pci; in azx_probe_continue()
2050 int dev = chip->dev_index; in azx_probe_continue()
2060 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { in azx_probe_continue()
2080 dev_err(chip->card->dev, in azx_probe_continue()
2087 err = azx_first_init(chip); in azx_probe_continue()
2092 chip->beep_mode = beep_mode[dev]; in azx_probe_continue()
2096 err = azx_probe_codecs(chip, azx_max_codecs[chip->driver_type]); in azx_probe_continue()
2101 if (chip->fw) { in azx_probe_continue()
2102 err = snd_hda_load_patch(&chip->bus, chip->fw->size, in azx_probe_continue()
2103 chip->fw->data); in azx_probe_continue()
2107 release_firmware(chip->fw); /* no longer needed */ in azx_probe_continue()
2108 chip->fw = NULL; in azx_probe_continue()
2113 err = azx_codec_configure(chip); in azx_probe_continue()
2118 err = snd_card_register(chip->card); in azx_probe_continue()
2122 chip->running = 1; in azx_probe_continue()
2123 azx_add_card_list(chip); in azx_probe_continue()
2124 snd_hda_set_power_save(&chip->bus, power_save * 1000); in azx_probe_continue()
2125 if (azx_has_pm_runtime(chip) || hda->use_vga_switcheroo) in azx_probe_continue()
2129 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL in azx_probe_continue()
2143 struct azx *chip; in azx_remove() local
2148 chip = card->private_data; in azx_remove()
2149 hda = container_of(chip, struct hda_intel, chip); in azx_remove()
2159 struct azx *chip; in azx_shutdown() local
2163 chip = card->private_data; in azx_shutdown()
2164 if (chip && chip->running) in azx_shutdown()
2165 azx_stop_chip(chip); in azx_shutdown()