| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * hda_intel.c - Implementation of primary alsa driver code base |
|---|
| .. | .. |
|---|
| 8 | 9 | * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de> |
|---|
| 9 | 10 | * PeiSen Hou <pshou@realtek.com.tw> |
|---|
| 10 | 11 | * |
|---|
| 11 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 12 | | - * under the terms of the GNU General Public License as published by the Free |
|---|
| 13 | | - * Software Foundation; either version 2 of the License, or (at your option) |
|---|
| 14 | | - * any later version. |
|---|
| 15 | | - * |
|---|
| 16 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 17 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 18 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 19 | | - * more details. |
|---|
| 20 | | - * |
|---|
| 21 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 22 | | - * this program; if not, write to the Free Software Foundation, Inc., 59 |
|---|
| 23 | | - * Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 24 | | - * |
|---|
| 25 | 12 | * CONTACTS: |
|---|
| 26 | 13 | * |
|---|
| 27 | 14 | * Matt Jared matt.jared@intel.com |
|---|
| .. | .. |
|---|
| 31 | 18 | * CHANGES: |
|---|
| 32 | 19 | * |
|---|
| 33 | 20 | * 2004.12.01 Major rewrite by tiwai, merged the work of pshou |
|---|
| 34 | | - * |
|---|
| 35 | 21 | */ |
|---|
| 36 | 22 | |
|---|
| 37 | 23 | #include <linux/delay.h> |
|---|
| .. | .. |
|---|
| 49 | 35 | #include <linux/clocksource.h> |
|---|
| 50 | 36 | #include <linux/time.h> |
|---|
| 51 | 37 | #include <linux/completion.h> |
|---|
| 38 | +#include <linux/acpi.h> |
|---|
| 39 | +#include <linux/pgtable.h> |
|---|
| 52 | 40 | |
|---|
| 53 | 41 | #ifdef CONFIG_X86 |
|---|
| 54 | 42 | /* for snoop control */ |
|---|
| 55 | | -#include <asm/pgtable.h> |
|---|
| 56 | 43 | #include <asm/set_memory.h> |
|---|
| 57 | 44 | #include <asm/cpufeature.h> |
|---|
| 58 | 45 | #endif |
|---|
| .. | .. |
|---|
| 60 | 47 | #include <sound/initval.h> |
|---|
| 61 | 48 | #include <sound/hdaudio.h> |
|---|
| 62 | 49 | #include <sound/hda_i915.h> |
|---|
| 50 | +#include <sound/intel-dsp-config.h> |
|---|
| 63 | 51 | #include <linux/vgaarb.h> |
|---|
| 64 | 52 | #include <linux/vga_switcheroo.h> |
|---|
| 65 | 53 | #include <linux/firmware.h> |
|---|
| 66 | | -#include "hda_codec.h" |
|---|
| 54 | +#include <sound/hda_codec.h> |
|---|
| 67 | 55 | #include "hda_controller.h" |
|---|
| 68 | 56 | #include "hda_intel.h" |
|---|
| 69 | 57 | |
|---|
| .. | .. |
|---|
| 98 | 86 | #define INTEL_SCH_HDA_DEVC 0x78 |
|---|
| 99 | 87 | #define INTEL_SCH_HDA_DEVC_NOSNOOP (0x1<<11) |
|---|
| 100 | 88 | |
|---|
| 101 | | -/* Define IN stream 0 FIFO size offset in VIA controller */ |
|---|
| 102 | | -#define VIA_IN_STREAM0_FIFO_SIZE_OFFSET 0x90 |
|---|
| 103 | 89 | /* Define VIA HD Audio Device ID*/ |
|---|
| 104 | 90 | #define VIA_HDAC_DEVICE_ID 0x3288 |
|---|
| 105 | 91 | |
|---|
| .. | .. |
|---|
| 139 | 125 | static bool beep_mode[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = |
|---|
| 140 | 126 | CONFIG_SND_HDA_INPUT_BEEP_MODE}; |
|---|
| 141 | 127 | #endif |
|---|
| 128 | +static bool dmic_detect = 1; |
|---|
| 142 | 129 | |
|---|
| 143 | 130 | module_param_array(index, int, NULL, 0444); |
|---|
| 144 | 131 | MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); |
|---|
| .. | .. |
|---|
| 173 | 160 | MODULE_PARM_DESC(beep_mode, "Select HDA Beep registration mode " |
|---|
| 174 | 161 | "(0=off, 1=on) (default=1)."); |
|---|
| 175 | 162 | #endif |
|---|
| 163 | +module_param(dmic_detect, bool, 0444); |
|---|
| 164 | +MODULE_PARM_DESC(dmic_detect, "Allow DSP driver selection (bypass this driver) " |
|---|
| 165 | + "(0=off, 1=on) (default=1); " |
|---|
| 166 | + "deprecated, use snd-intel-dspcfg.dsp_driver option instead"); |
|---|
| 176 | 167 | |
|---|
| 177 | 168 | #ifdef CONFIG_PM |
|---|
| 178 | 169 | static int param_set_xint(const char *val, const struct kernel_param *kp); |
|---|
| .. | .. |
|---|
| 189 | 180 | |
|---|
| 190 | 181 | static bool pm_blacklist = true; |
|---|
| 191 | 182 | module_param(pm_blacklist, bool, 0644); |
|---|
| 192 | | -MODULE_PARM_DESC(pm_blacklist, "Enable power-management blacklist"); |
|---|
| 183 | +MODULE_PARM_DESC(pm_blacklist, "Enable power-management denylist"); |
|---|
| 193 | 184 | |
|---|
| 194 | 185 | /* reset the HD-audio controller in power save mode. |
|---|
| 195 | 186 | * this may give more power-saving, but will take longer time to |
|---|
| .. | .. |
|---|
| 273 | 264 | AZX_DRIVER_ATI, |
|---|
| 274 | 265 | AZX_DRIVER_ATIHDMI, |
|---|
| 275 | 266 | AZX_DRIVER_ATIHDMI_NS, |
|---|
| 267 | + AZX_DRIVER_GFHDMI, |
|---|
| 276 | 268 | AZX_DRIVER_VIA, |
|---|
| 277 | 269 | AZX_DRIVER_SIS, |
|---|
| 278 | 270 | AZX_DRIVER_ULI, |
|---|
| .. | .. |
|---|
| 281 | 273 | AZX_DRIVER_CTX, |
|---|
| 282 | 274 | AZX_DRIVER_CTHDA, |
|---|
| 283 | 275 | AZX_DRIVER_CMEDIA, |
|---|
| 276 | + AZX_DRIVER_ZHAOXIN, |
|---|
| 284 | 277 | AZX_DRIVER_GENERIC, |
|---|
| 285 | 278 | AZX_NUM_DRIVERS, /* keep this as last entry */ |
|---|
| 286 | 279 | }; |
|---|
| .. | .. |
|---|
| 311 | 304 | #define AZX_DCAPS_INTEL_HASWELL \ |
|---|
| 312 | 305 | (/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_COUNT_LPIB_DELAY |\ |
|---|
| 313 | 306 | AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_COMPONENT |\ |
|---|
| 314 | | - AZX_DCAPS_I915_POWERWELL | AZX_DCAPS_SNOOP_TYPE(SCH)) |
|---|
| 307 | + AZX_DCAPS_SNOOP_TYPE(SCH)) |
|---|
| 315 | 308 | |
|---|
| 316 | 309 | /* Broadwell HDMI can't use position buffer reliably, force to use LPIB */ |
|---|
| 317 | 310 | #define AZX_DCAPS_INTEL_BROADWELL \ |
|---|
| 318 | 311 | (/*AZX_DCAPS_ALIGN_BUFSIZE |*/ AZX_DCAPS_POSFIX_LPIB |\ |
|---|
| 319 | 312 | AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_COMPONENT |\ |
|---|
| 320 | | - AZX_DCAPS_I915_POWERWELL | AZX_DCAPS_SNOOP_TYPE(SCH)) |
|---|
| 313 | + AZX_DCAPS_SNOOP_TYPE(SCH)) |
|---|
| 321 | 314 | |
|---|
| 322 | 315 | #define AZX_DCAPS_INTEL_BAYTRAIL \ |
|---|
| 323 | | - (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_I915_COMPONENT |\ |
|---|
| 324 | | - AZX_DCAPS_I915_POWERWELL) |
|---|
| 316 | + (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_I915_COMPONENT) |
|---|
| 325 | 317 | |
|---|
| 326 | 318 | #define AZX_DCAPS_INTEL_BRASWELL \ |
|---|
| 327 | 319 | (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME |\ |
|---|
| 328 | | - AZX_DCAPS_I915_COMPONENT | AZX_DCAPS_I915_POWERWELL) |
|---|
| 320 | + AZX_DCAPS_I915_COMPONENT) |
|---|
| 329 | 321 | |
|---|
| 330 | 322 | #define AZX_DCAPS_INTEL_SKYLAKE \ |
|---|
| 331 | 323 | (AZX_DCAPS_INTEL_PCH_BASE | AZX_DCAPS_PM_RUNTIME |\ |
|---|
| 332 | | - AZX_DCAPS_SYNC_WRITE |\ |
|---|
| 333 | | - AZX_DCAPS_SEPARATE_STREAM_TAG | AZX_DCAPS_I915_COMPONENT |\ |
|---|
| 334 | | - AZX_DCAPS_I915_POWERWELL) |
|---|
| 324 | + AZX_DCAPS_SEPARATE_STREAM_TAG | AZX_DCAPS_I915_COMPONENT) |
|---|
| 335 | 325 | |
|---|
| 336 | | -#define AZX_DCAPS_INTEL_BROXTON AZX_DCAPS_INTEL_SKYLAKE |
|---|
| 326 | +#define AZX_DCAPS_INTEL_BROXTON AZX_DCAPS_INTEL_SKYLAKE |
|---|
| 337 | 327 | |
|---|
| 338 | 328 | /* quirks for ATI SB / AMD Hudson */ |
|---|
| 339 | 329 | #define AZX_DCAPS_PRESET_ATI_SB \ |
|---|
| 340 | | - (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB |\ |
|---|
| 330 | + (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_POSFIX_LPIB |\ |
|---|
| 341 | 331 | AZX_DCAPS_SNOOP_TYPE(ATI)) |
|---|
| 342 | 332 | |
|---|
| 343 | 333 | /* quirks for ATI/AMD HDMI */ |
|---|
| 344 | 334 | #define AZX_DCAPS_PRESET_ATI_HDMI \ |
|---|
| 345 | | - (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB|\ |
|---|
| 335 | + (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_POSFIX_LPIB|\ |
|---|
| 346 | 336 | AZX_DCAPS_NO_MSI64) |
|---|
| 347 | 337 | |
|---|
| 348 | 338 | /* quirks for ATI HDMI with snoop off */ |
|---|
| .. | .. |
|---|
| 351 | 341 | |
|---|
| 352 | 342 | /* quirks for AMD SB */ |
|---|
| 353 | 343 | #define AZX_DCAPS_PRESET_AMD_SB \ |
|---|
| 354 | | - (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_AMD_WORKAROUND |\ |
|---|
| 355 | | - AZX_DCAPS_SNOOP_TYPE(ATI) | AZX_DCAPS_PM_RUNTIME) |
|---|
| 344 | + (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_AMD_WORKAROUND |\ |
|---|
| 345 | + AZX_DCAPS_SNOOP_TYPE(ATI) | AZX_DCAPS_PM_RUNTIME |\ |
|---|
| 346 | + AZX_DCAPS_RETRY_PROBE) |
|---|
| 356 | 347 | |
|---|
| 357 | 348 | /* quirks for Nvidia */ |
|---|
| 358 | 349 | #define AZX_DCAPS_PRESET_NVIDIA \ |
|---|
| .. | .. |
|---|
| 369 | 360 | */ |
|---|
| 370 | 361 | #ifdef SUPPORT_VGA_SWITCHEROO |
|---|
| 371 | 362 | #define use_vga_switcheroo(chip) ((chip)->use_vga_switcheroo) |
|---|
| 372 | | -#define needs_eld_notify_link(chip) ((chip)->need_eld_notify_link) |
|---|
| 363 | +#define needs_eld_notify_link(chip) ((chip)->bus.keep_power) |
|---|
| 373 | 364 | #else |
|---|
| 374 | 365 | #define use_vga_switcheroo(chip) 0 |
|---|
| 375 | 366 | #define needs_eld_notify_link(chip) false |
|---|
| 376 | 367 | #endif |
|---|
| 377 | 368 | |
|---|
| 378 | | -#define CONTROLLER_IN_GPU(pci) (((pci)->device == 0x0a0c) || \ |
|---|
| 369 | +#define CONTROLLER_IN_GPU(pci) (((pci)->vendor == 0x8086) && \ |
|---|
| 370 | + (((pci)->device == 0x0a0c) || \ |
|---|
| 379 | 371 | ((pci)->device == 0x0c0c) || \ |
|---|
| 380 | 372 | ((pci)->device == 0x0d0c) || \ |
|---|
| 381 | | - ((pci)->device == 0x160c)) |
|---|
| 373 | + ((pci)->device == 0x160c) || \ |
|---|
| 374 | + ((pci)->device == 0x490d) || \ |
|---|
| 375 | + ((pci)->device == 0x4f90) || \ |
|---|
| 376 | + ((pci)->device == 0x4f91) || \ |
|---|
| 377 | + ((pci)->device == 0x4f92))) |
|---|
| 382 | 378 | |
|---|
| 383 | 379 | #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98) |
|---|
| 384 | | -#define IS_CFL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa348) |
|---|
| 385 | | -#define IS_CNL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9dc8) |
|---|
| 386 | 380 | |
|---|
| 387 | | -static char *driver_short_names[] = { |
|---|
| 381 | +static const char * const driver_short_names[] = { |
|---|
| 388 | 382 | [AZX_DRIVER_ICH] = "HDA Intel", |
|---|
| 389 | 383 | [AZX_DRIVER_PCH] = "HDA Intel PCH", |
|---|
| 390 | 384 | [AZX_DRIVER_SCH] = "HDA Intel MID", |
|---|
| .. | .. |
|---|
| 393 | 387 | [AZX_DRIVER_ATI] = "HDA ATI SB", |
|---|
| 394 | 388 | [AZX_DRIVER_ATIHDMI] = "HDA ATI HDMI", |
|---|
| 395 | 389 | [AZX_DRIVER_ATIHDMI_NS] = "HDA ATI HDMI", |
|---|
| 390 | + [AZX_DRIVER_GFHDMI] = "HDA GF HDMI", |
|---|
| 396 | 391 | [AZX_DRIVER_VIA] = "HDA VIA VT82xx", |
|---|
| 397 | 392 | [AZX_DRIVER_SIS] = "HDA SIS966", |
|---|
| 398 | 393 | [AZX_DRIVER_ULI] = "HDA ULI M5461", |
|---|
| .. | .. |
|---|
| 401 | 396 | [AZX_DRIVER_CTX] = "HDA Creative", |
|---|
| 402 | 397 | [AZX_DRIVER_CTHDA] = "HDA Creative", |
|---|
| 403 | 398 | [AZX_DRIVER_CMEDIA] = "HDA C-Media", |
|---|
| 399 | + [AZX_DRIVER_ZHAOXIN] = "HDA Zhaoxin", |
|---|
| 404 | 400 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", |
|---|
| 405 | 401 | }; |
|---|
| 406 | | - |
|---|
| 407 | | -#ifdef CONFIG_X86 |
|---|
| 408 | | -static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) |
|---|
| 409 | | -{ |
|---|
| 410 | | - int pages; |
|---|
| 411 | | - |
|---|
| 412 | | - if (azx_snoop(chip)) |
|---|
| 413 | | - return; |
|---|
| 414 | | - if (!dmab || !dmab->area || !dmab->bytes) |
|---|
| 415 | | - return; |
|---|
| 416 | | - |
|---|
| 417 | | -#ifdef CONFIG_SND_DMA_SGBUF |
|---|
| 418 | | - if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_SG) { |
|---|
| 419 | | - struct snd_sg_buf *sgbuf = dmab->private_data; |
|---|
| 420 | | - if (!chip->uc_buffer) |
|---|
| 421 | | - return; /* deal with only CORB/RIRB buffers */ |
|---|
| 422 | | - if (on) |
|---|
| 423 | | - set_pages_array_wc(sgbuf->page_table, sgbuf->pages); |
|---|
| 424 | | - else |
|---|
| 425 | | - set_pages_array_wb(sgbuf->page_table, sgbuf->pages); |
|---|
| 426 | | - return; |
|---|
| 427 | | - } |
|---|
| 428 | | -#endif |
|---|
| 429 | | - |
|---|
| 430 | | - pages = (dmab->bytes + PAGE_SIZE - 1) >> PAGE_SHIFT; |
|---|
| 431 | | - if (on) |
|---|
| 432 | | - set_memory_wc((unsigned long)dmab->area, pages); |
|---|
| 433 | | - else |
|---|
| 434 | | - set_memory_wb((unsigned long)dmab->area, pages); |
|---|
| 435 | | -} |
|---|
| 436 | | - |
|---|
| 437 | | -static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf, |
|---|
| 438 | | - bool on) |
|---|
| 439 | | -{ |
|---|
| 440 | | - __mark_pages_wc(chip, buf, on); |
|---|
| 441 | | -} |
|---|
| 442 | | -static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, |
|---|
| 443 | | - struct snd_pcm_substream *substream, bool on) |
|---|
| 444 | | -{ |
|---|
| 445 | | - if (azx_dev->wc_marked != on) { |
|---|
| 446 | | - __mark_pages_wc(chip, snd_pcm_get_dma_buf(substream), on); |
|---|
| 447 | | - azx_dev->wc_marked = on; |
|---|
| 448 | | - } |
|---|
| 449 | | -} |
|---|
| 450 | | -#else |
|---|
| 451 | | -/* NOP for other archs */ |
|---|
| 452 | | -static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf, |
|---|
| 453 | | - bool on) |
|---|
| 454 | | -{ |
|---|
| 455 | | -} |
|---|
| 456 | | -static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, |
|---|
| 457 | | - struct snd_pcm_substream *substream, bool on) |
|---|
| 458 | | -{ |
|---|
| 459 | | -} |
|---|
| 460 | | -#endif |
|---|
| 461 | 402 | |
|---|
| 462 | 403 | static int azx_acquire_irq(struct azx *chip, int do_disconnect); |
|---|
| 463 | 404 | static void set_default_power_save(struct azx *chip); |
|---|
| .. | .. |
|---|
| 565 | 506 | static int intel_get_lctl_scf(struct azx *chip) |
|---|
| 566 | 507 | { |
|---|
| 567 | 508 | struct hdac_bus *bus = azx_bus(chip); |
|---|
| 568 | | - static int preferred_bits[] = { 2, 3, 1, 4, 5 }; |
|---|
| 509 | + static const int preferred_bits[] = { 2, 3, 1, 4, 5 }; |
|---|
| 569 | 510 | u32 val, t; |
|---|
| 570 | 511 | int i; |
|---|
| 571 | 512 | |
|---|
| .. | .. |
|---|
| 651 | 592 | struct pci_dev *pci = chip->pci; |
|---|
| 652 | 593 | u32 val; |
|---|
| 653 | 594 | |
|---|
| 654 | | - if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
|---|
| 655 | | - snd_hdac_set_codec_wakeup(bus, true); |
|---|
| 595 | + snd_hdac_set_codec_wakeup(bus, true); |
|---|
| 656 | 596 | if (chip->driver_type == AZX_DRIVER_SKL) { |
|---|
| 657 | 597 | pci_read_config_dword(pci, INTEL_HDA_CGCTL, &val); |
|---|
| 658 | 598 | val = val & ~INTEL_HDA_CGCTL_MISCBDCGE; |
|---|
| .. | .. |
|---|
| 664 | 604 | val = val | INTEL_HDA_CGCTL_MISCBDCGE; |
|---|
| 665 | 605 | pci_write_config_dword(pci, INTEL_HDA_CGCTL, val); |
|---|
| 666 | 606 | } |
|---|
| 667 | | - if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
|---|
| 668 | | - snd_hdac_set_codec_wakeup(bus, false); |
|---|
| 607 | + |
|---|
| 608 | + snd_hdac_set_codec_wakeup(bus, false); |
|---|
| 669 | 609 | |
|---|
| 670 | 610 | /* reduce dma latency to avoid noise */ |
|---|
| 671 | 611 | if (IS_BXT(pci)) |
|---|
| .. | .. |
|---|
| 727 | 667 | return 0; |
|---|
| 728 | 668 | } |
|---|
| 729 | 669 | |
|---|
| 730 | | -/* Enable/disable i915 display power for the link */ |
|---|
| 731 | | -static int azx_intel_link_power(struct azx *chip, bool enable) |
|---|
| 732 | | -{ |
|---|
| 733 | | - struct hdac_bus *bus = azx_bus(chip); |
|---|
| 734 | | - |
|---|
| 735 | | - return snd_hdac_display_power(bus, enable); |
|---|
| 736 | | -} |
|---|
| 670 | +#define display_power(chip, enable) \ |
|---|
| 671 | + snd_hdac_display_power(azx_bus(chip), HDA_CODEC_IDX_CONTROLLER, enable) |
|---|
| 737 | 672 | |
|---|
| 738 | 673 | /* |
|---|
| 739 | 674 | * Check whether the current DMA position is acceptable for updating |
|---|
| .. | .. |
|---|
| 885 | 820 | return -1; |
|---|
| 886 | 821 | } |
|---|
| 887 | 822 | bus->irq = chip->pci->irq; |
|---|
| 823 | + chip->card->sync_irq = bus->irq; |
|---|
| 888 | 824 | pci_intx(chip->pci, !chip->msi); |
|---|
| 889 | 825 | return 0; |
|---|
| 890 | 826 | } |
|---|
| .. | .. |
|---|
| 910 | 846 | mod_dma_pos = le32_to_cpu(*azx_dev->core.posbuf); |
|---|
| 911 | 847 | mod_dma_pos %= azx_dev->core.period_bytes; |
|---|
| 912 | 848 | |
|---|
| 913 | | - /* azx_dev->fifo_size can't get FIFO size of in stream. |
|---|
| 914 | | - * Get from base address + offset. |
|---|
| 915 | | - */ |
|---|
| 916 | | - fifo_size = readw(azx_bus(chip)->remap_addr + |
|---|
| 917 | | - VIA_IN_STREAM0_FIFO_SIZE_OFFSET); |
|---|
| 849 | + fifo_size = azx_stream(azx_dev)->fifo_size - 1; |
|---|
| 918 | 850 | |
|---|
| 919 | 851 | if (azx_dev->insufficient) { |
|---|
| 920 | 852 | /* Link position never gather than FIFO size */ |
|---|
| .. | .. |
|---|
| 989 | 921 | return substream->runtime->delay; |
|---|
| 990 | 922 | } |
|---|
| 991 | 923 | |
|---|
| 992 | | -static unsigned int azx_skl_get_dpib_pos(struct azx *chip, |
|---|
| 993 | | - struct azx_dev *azx_dev) |
|---|
| 924 | +static void __azx_shutdown_chip(struct azx *chip, bool skip_link_reset) |
|---|
| 994 | 925 | { |
|---|
| 995 | | - return _snd_hdac_chip_readl(azx_bus(chip), |
|---|
| 996 | | - AZX_REG_VS_SDXDPIB_XBASE + |
|---|
| 997 | | - (AZX_REG_VS_SDXDPIB_XINTERVAL * |
|---|
| 998 | | - azx_dev->core.index)); |
|---|
| 999 | | -} |
|---|
| 1000 | | - |
|---|
| 1001 | | -/* get the current DMA position with correction on SKL+ chips */ |
|---|
| 1002 | | -static unsigned int azx_get_pos_skl(struct azx *chip, struct azx_dev *azx_dev) |
|---|
| 1003 | | -{ |
|---|
| 1004 | | - /* DPIB register gives a more accurate position for playback */ |
|---|
| 1005 | | - if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
|---|
| 1006 | | - return azx_skl_get_dpib_pos(chip, azx_dev); |
|---|
| 1007 | | - |
|---|
| 1008 | | - /* read of DPIB fetches the actual posbuf */ |
|---|
| 1009 | | - azx_skl_get_dpib_pos(chip, azx_dev); |
|---|
| 1010 | | - return azx_get_pos_posbuf(chip, azx_dev); |
|---|
| 926 | + azx_stop_chip(chip); |
|---|
| 927 | + if (!skip_link_reset) |
|---|
| 928 | + azx_enter_link_reset(chip); |
|---|
| 929 | + azx_clear_irq_pending(chip); |
|---|
| 930 | + display_power(chip, false); |
|---|
| 1011 | 931 | } |
|---|
| 1012 | 932 | |
|---|
| 1013 | 933 | #ifdef CONFIG_PM |
|---|
| 1014 | 934 | static DEFINE_MUTEX(card_list_lock); |
|---|
| 1015 | 935 | static LIST_HEAD(card_list); |
|---|
| 936 | + |
|---|
| 937 | +static void azx_shutdown_chip(struct azx *chip) |
|---|
| 938 | +{ |
|---|
| 939 | + __azx_shutdown_chip(chip, false); |
|---|
| 940 | +} |
|---|
| 1016 | 941 | |
|---|
| 1017 | 942 | static void azx_add_card_list(struct azx *chip) |
|---|
| 1018 | 943 | { |
|---|
| .. | .. |
|---|
| 1051 | 976 | mutex_unlock(&card_list_lock); |
|---|
| 1052 | 977 | return 0; |
|---|
| 1053 | 978 | } |
|---|
| 1054 | | -#else |
|---|
| 1055 | | -#define azx_add_card_list(chip) /* NOP */ |
|---|
| 1056 | | -#define azx_del_card_list(chip) /* NOP */ |
|---|
| 1057 | | -#endif /* CONFIG_PM */ |
|---|
| 1058 | 979 | |
|---|
| 1059 | | -#ifdef CONFIG_PM_SLEEP |
|---|
| 1060 | 980 | /* |
|---|
| 1061 | 981 | * power management |
|---|
| 1062 | 982 | */ |
|---|
| 983 | +static bool azx_is_pm_ready(struct snd_card *card) |
|---|
| 984 | +{ |
|---|
| 985 | + struct azx *chip; |
|---|
| 986 | + struct hda_intel *hda; |
|---|
| 987 | + |
|---|
| 988 | + if (!card) |
|---|
| 989 | + return false; |
|---|
| 990 | + chip = card->private_data; |
|---|
| 991 | + hda = container_of(chip, struct hda_intel, chip); |
|---|
| 992 | + if (chip->disabled || hda->init_failed || !chip->running) |
|---|
| 993 | + return false; |
|---|
| 994 | + return true; |
|---|
| 995 | +} |
|---|
| 996 | + |
|---|
| 997 | +static void __azx_runtime_resume(struct azx *chip) |
|---|
| 998 | +{ |
|---|
| 999 | + struct hda_intel *hda = container_of(chip, struct hda_intel, chip); |
|---|
| 1000 | + struct hdac_bus *bus = azx_bus(chip); |
|---|
| 1001 | + struct hda_codec *codec; |
|---|
| 1002 | + int status; |
|---|
| 1003 | + |
|---|
| 1004 | + display_power(chip, true); |
|---|
| 1005 | + if (hda->need_i915_power) |
|---|
| 1006 | + snd_hdac_i915_set_bclk(bus); |
|---|
| 1007 | + |
|---|
| 1008 | + /* Read STATESTS before controller reset */ |
|---|
| 1009 | + status = azx_readw(chip, STATESTS); |
|---|
| 1010 | + |
|---|
| 1011 | + azx_init_pci(chip); |
|---|
| 1012 | + hda_intel_init_chip(chip, true); |
|---|
| 1013 | + |
|---|
| 1014 | + /* Avoid codec resume if runtime resume is for system suspend */ |
|---|
| 1015 | + if (!chip->pm_prepared) { |
|---|
| 1016 | + list_for_each_codec(codec, &chip->bus) { |
|---|
| 1017 | + if (codec->relaxed_resume) |
|---|
| 1018 | + continue; |
|---|
| 1019 | + |
|---|
| 1020 | + if (codec->forced_resume || (status & (1 << codec->addr))) |
|---|
| 1021 | + pm_request_resume(hda_codec_dev(codec)); |
|---|
| 1022 | + } |
|---|
| 1023 | + } |
|---|
| 1024 | + |
|---|
| 1025 | + /* power down again for link-controlled chips */ |
|---|
| 1026 | + if (!hda->need_i915_power) |
|---|
| 1027 | + display_power(chip, false); |
|---|
| 1028 | +} |
|---|
| 1029 | + |
|---|
| 1030 | +#ifdef CONFIG_PM_SLEEP |
|---|
| 1031 | +static int azx_prepare(struct device *dev) |
|---|
| 1032 | +{ |
|---|
| 1033 | + struct snd_card *card = dev_get_drvdata(dev); |
|---|
| 1034 | + struct azx *chip; |
|---|
| 1035 | + |
|---|
| 1036 | + if (!azx_is_pm_ready(card)) |
|---|
| 1037 | + return 0; |
|---|
| 1038 | + |
|---|
| 1039 | + chip = card->private_data; |
|---|
| 1040 | + chip->pm_prepared = 1; |
|---|
| 1041 | + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
|---|
| 1042 | + |
|---|
| 1043 | + flush_work(&azx_bus(chip)->unsol_work); |
|---|
| 1044 | + |
|---|
| 1045 | + /* HDA controller always requires different WAKEEN for runtime suspend |
|---|
| 1046 | + * and system suspend, so don't use direct-complete here. |
|---|
| 1047 | + */ |
|---|
| 1048 | + return 0; |
|---|
| 1049 | +} |
|---|
| 1050 | + |
|---|
| 1051 | +static void azx_complete(struct device *dev) |
|---|
| 1052 | +{ |
|---|
| 1053 | + struct snd_card *card = dev_get_drvdata(dev); |
|---|
| 1054 | + struct azx *chip; |
|---|
| 1055 | + |
|---|
| 1056 | + if (!azx_is_pm_ready(card)) |
|---|
| 1057 | + return; |
|---|
| 1058 | + |
|---|
| 1059 | + chip = card->private_data; |
|---|
| 1060 | + snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
|---|
| 1061 | + chip->pm_prepared = 0; |
|---|
| 1062 | +} |
|---|
| 1063 | + |
|---|
| 1063 | 1064 | static int azx_suspend(struct device *dev) |
|---|
| 1064 | 1065 | { |
|---|
| 1065 | 1066 | struct snd_card *card = dev_get_drvdata(dev); |
|---|
| 1066 | 1067 | struct azx *chip; |
|---|
| 1067 | | - struct hda_intel *hda; |
|---|
| 1068 | 1068 | struct hdac_bus *bus; |
|---|
| 1069 | 1069 | |
|---|
| 1070 | | - if (!card) |
|---|
| 1070 | + if (!azx_is_pm_ready(card)) |
|---|
| 1071 | 1071 | return 0; |
|---|
| 1072 | 1072 | |
|---|
| 1073 | 1073 | chip = card->private_data; |
|---|
| 1074 | | - hda = container_of(chip, struct hda_intel, chip); |
|---|
| 1075 | | - if (chip->disabled || hda->init_failed || !chip->running) |
|---|
| 1076 | | - return 0; |
|---|
| 1077 | | - |
|---|
| 1078 | 1074 | bus = azx_bus(chip); |
|---|
| 1079 | | - snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
|---|
| 1080 | | - azx_clear_irq_pending(chip); |
|---|
| 1081 | | - azx_stop_chip(chip); |
|---|
| 1082 | | - azx_enter_link_reset(chip); |
|---|
| 1075 | + azx_shutdown_chip(chip); |
|---|
| 1083 | 1076 | if (bus->irq >= 0) { |
|---|
| 1084 | 1077 | free_irq(bus->irq, chip); |
|---|
| 1085 | 1078 | bus->irq = -1; |
|---|
| 1079 | + chip->card->sync_irq = -1; |
|---|
| 1086 | 1080 | } |
|---|
| 1087 | 1081 | |
|---|
| 1088 | 1082 | if (chip->msi) |
|---|
| 1089 | 1083 | pci_disable_msi(chip->pci); |
|---|
| 1090 | | - if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
|---|
| 1091 | | - && hda->need_i915_power) |
|---|
| 1092 | | - snd_hdac_display_power(bus, false); |
|---|
| 1093 | 1084 | |
|---|
| 1094 | 1085 | trace_azx_suspend(chip); |
|---|
| 1095 | 1086 | return 0; |
|---|
| .. | .. |
|---|
| 1097 | 1088 | |
|---|
| 1098 | 1089 | static int azx_resume(struct device *dev) |
|---|
| 1099 | 1090 | { |
|---|
| 1100 | | - struct pci_dev *pci = to_pci_dev(dev); |
|---|
| 1101 | 1091 | struct snd_card *card = dev_get_drvdata(dev); |
|---|
| 1102 | 1092 | struct azx *chip; |
|---|
| 1103 | | - struct hda_intel *hda; |
|---|
| 1104 | | - struct hdac_bus *bus; |
|---|
| 1105 | 1093 | |
|---|
| 1106 | | - if (!card) |
|---|
| 1094 | + if (!azx_is_pm_ready(card)) |
|---|
| 1107 | 1095 | return 0; |
|---|
| 1108 | 1096 | |
|---|
| 1109 | 1097 | chip = card->private_data; |
|---|
| 1110 | | - hda = container_of(chip, struct hda_intel, chip); |
|---|
| 1111 | | - bus = azx_bus(chip); |
|---|
| 1112 | | - if (chip->disabled || hda->init_failed || !chip->running) |
|---|
| 1113 | | - return 0; |
|---|
| 1114 | | - |
|---|
| 1115 | | - if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
|---|
| 1116 | | - snd_hdac_display_power(bus, true); |
|---|
| 1117 | | - if (hda->need_i915_power) |
|---|
| 1118 | | - snd_hdac_i915_set_bclk(bus); |
|---|
| 1119 | | - } |
|---|
| 1120 | | - |
|---|
| 1121 | 1098 | if (chip->msi) |
|---|
| 1122 | | - if (pci_enable_msi(pci) < 0) |
|---|
| 1099 | + if (pci_enable_msi(chip->pci) < 0) |
|---|
| 1123 | 1100 | chip->msi = 0; |
|---|
| 1124 | 1101 | if (azx_acquire_irq(chip, 1) < 0) |
|---|
| 1125 | 1102 | return -EIO; |
|---|
| 1126 | | - azx_init_pci(chip); |
|---|
| 1127 | 1103 | |
|---|
| 1128 | | - hda_intel_init_chip(chip, true); |
|---|
| 1129 | | - |
|---|
| 1130 | | - /* power down again for link-controlled chips */ |
|---|
| 1131 | | - if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL) && |
|---|
| 1132 | | - !hda->need_i915_power) |
|---|
| 1133 | | - snd_hdac_display_power(bus, false); |
|---|
| 1134 | | - |
|---|
| 1135 | | - snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
|---|
| 1104 | + __azx_runtime_resume(chip); |
|---|
| 1136 | 1105 | |
|---|
| 1137 | 1106 | trace_azx_resume(chip); |
|---|
| 1138 | 1107 | return 0; |
|---|
| .. | .. |
|---|
| 1147 | 1116 | struct azx *chip = card->private_data; |
|---|
| 1148 | 1117 | struct pci_dev *pci = to_pci_dev(dev); |
|---|
| 1149 | 1118 | |
|---|
| 1119 | + if (!azx_is_pm_ready(card)) |
|---|
| 1120 | + return 0; |
|---|
| 1150 | 1121 | if (chip->driver_type == AZX_DRIVER_SKL) |
|---|
| 1151 | 1122 | pci_set_power_state(pci, PCI_D3hot); |
|---|
| 1152 | 1123 | |
|---|
| .. | .. |
|---|
| 1159 | 1130 | struct azx *chip = card->private_data; |
|---|
| 1160 | 1131 | struct pci_dev *pci = to_pci_dev(dev); |
|---|
| 1161 | 1132 | |
|---|
| 1133 | + if (!azx_is_pm_ready(card)) |
|---|
| 1134 | + return 0; |
|---|
| 1162 | 1135 | if (chip->driver_type == AZX_DRIVER_SKL) |
|---|
| 1163 | 1136 | pci_set_power_state(pci, PCI_D0); |
|---|
| 1164 | 1137 | |
|---|
| .. | .. |
|---|
| 1166 | 1139 | } |
|---|
| 1167 | 1140 | #endif /* CONFIG_PM_SLEEP */ |
|---|
| 1168 | 1141 | |
|---|
| 1169 | | -#ifdef CONFIG_PM |
|---|
| 1170 | 1142 | static int azx_runtime_suspend(struct device *dev) |
|---|
| 1171 | 1143 | { |
|---|
| 1172 | 1144 | struct snd_card *card = dev_get_drvdata(dev); |
|---|
| 1173 | 1145 | struct azx *chip; |
|---|
| 1174 | | - struct hda_intel *hda; |
|---|
| 1175 | 1146 | |
|---|
| 1176 | | - if (!card) |
|---|
| 1147 | + if (!azx_is_pm_ready(card)) |
|---|
| 1177 | 1148 | return 0; |
|---|
| 1178 | | - |
|---|
| 1179 | 1149 | chip = card->private_data; |
|---|
| 1180 | | - hda = container_of(chip, struct hda_intel, chip); |
|---|
| 1181 | | - if (chip->disabled || hda->init_failed) |
|---|
| 1182 | | - return 0; |
|---|
| 1183 | | - |
|---|
| 1184 | | - if (!azx_has_pm_runtime(chip)) |
|---|
| 1185 | | - return 0; |
|---|
| 1186 | 1150 | |
|---|
| 1187 | 1151 | /* enable controller wake up event */ |
|---|
| 1188 | | - azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | |
|---|
| 1189 | | - STATESTS_INT_MASK); |
|---|
| 1152 | + azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | STATESTS_INT_MASK); |
|---|
| 1190 | 1153 | |
|---|
| 1191 | | - azx_stop_chip(chip); |
|---|
| 1192 | | - azx_enter_link_reset(chip); |
|---|
| 1193 | | - azx_clear_irq_pending(chip); |
|---|
| 1194 | | - if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
|---|
| 1195 | | - && hda->need_i915_power) |
|---|
| 1196 | | - snd_hdac_display_power(azx_bus(chip), false); |
|---|
| 1197 | | - |
|---|
| 1154 | + azx_shutdown_chip(chip); |
|---|
| 1198 | 1155 | trace_azx_runtime_suspend(chip); |
|---|
| 1199 | 1156 | return 0; |
|---|
| 1200 | 1157 | } |
|---|
| .. | .. |
|---|
| 1203 | 1160 | { |
|---|
| 1204 | 1161 | struct snd_card *card = dev_get_drvdata(dev); |
|---|
| 1205 | 1162 | struct azx *chip; |
|---|
| 1206 | | - struct hda_intel *hda; |
|---|
| 1207 | | - struct hdac_bus *bus; |
|---|
| 1208 | | - struct hda_codec *codec; |
|---|
| 1209 | | - int status; |
|---|
| 1210 | 1163 | |
|---|
| 1211 | | - if (!card) |
|---|
| 1164 | + if (!azx_is_pm_ready(card)) |
|---|
| 1212 | 1165 | return 0; |
|---|
| 1213 | | - |
|---|
| 1214 | 1166 | chip = card->private_data; |
|---|
| 1215 | | - hda = container_of(chip, struct hda_intel, chip); |
|---|
| 1216 | | - bus = azx_bus(chip); |
|---|
| 1217 | | - if (chip->disabled || hda->init_failed) |
|---|
| 1218 | | - return 0; |
|---|
| 1219 | | - |
|---|
| 1220 | | - if (!azx_has_pm_runtime(chip)) |
|---|
| 1221 | | - return 0; |
|---|
| 1222 | | - |
|---|
| 1223 | | - if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
|---|
| 1224 | | - snd_hdac_display_power(bus, true); |
|---|
| 1225 | | - if (hda->need_i915_power) |
|---|
| 1226 | | - snd_hdac_i915_set_bclk(bus); |
|---|
| 1227 | | - } |
|---|
| 1228 | | - |
|---|
| 1229 | | - /* Read STATESTS before controller reset */ |
|---|
| 1230 | | - status = azx_readw(chip, STATESTS); |
|---|
| 1231 | | - |
|---|
| 1232 | | - azx_init_pci(chip); |
|---|
| 1233 | | - hda_intel_init_chip(chip, true); |
|---|
| 1234 | | - |
|---|
| 1235 | | - if (status) { |
|---|
| 1236 | | - list_for_each_codec(codec, &chip->bus) |
|---|
| 1237 | | - if (status & (1 << codec->addr)) |
|---|
| 1238 | | - schedule_delayed_work(&codec->jackpoll_work, |
|---|
| 1239 | | - codec->jackpoll_interval); |
|---|
| 1240 | | - } |
|---|
| 1167 | + __azx_runtime_resume(chip); |
|---|
| 1241 | 1168 | |
|---|
| 1242 | 1169 | /* disable controller Wake Up event*/ |
|---|
| 1243 | | - azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & |
|---|
| 1244 | | - ~STATESTS_INT_MASK); |
|---|
| 1245 | | - |
|---|
| 1246 | | - /* power down again for link-controlled chips */ |
|---|
| 1247 | | - if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL) && |
|---|
| 1248 | | - !hda->need_i915_power) |
|---|
| 1249 | | - snd_hdac_display_power(bus, false); |
|---|
| 1170 | + azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & ~STATESTS_INT_MASK); |
|---|
| 1250 | 1171 | |
|---|
| 1251 | 1172 | trace_azx_runtime_resume(chip); |
|---|
| 1252 | 1173 | return 0; |
|---|
| .. | .. |
|---|
| 1271 | 1192 | return -EBUSY; |
|---|
| 1272 | 1193 | |
|---|
| 1273 | 1194 | /* ELD notification gets broken when HD-audio bus is off */ |
|---|
| 1274 | | - if (needs_eld_notify_link(hda)) |
|---|
| 1195 | + if (needs_eld_notify_link(chip)) |
|---|
| 1275 | 1196 | return -EBUSY; |
|---|
| 1276 | 1197 | |
|---|
| 1277 | 1198 | return 0; |
|---|
| .. | .. |
|---|
| 1280 | 1201 | static const struct dev_pm_ops azx_pm = { |
|---|
| 1281 | 1202 | SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume) |
|---|
| 1282 | 1203 | #ifdef CONFIG_PM_SLEEP |
|---|
| 1204 | + .prepare = azx_prepare, |
|---|
| 1205 | + .complete = azx_complete, |
|---|
| 1283 | 1206 | .freeze_noirq = azx_freeze_noirq, |
|---|
| 1284 | 1207 | .thaw_noirq = azx_thaw_noirq, |
|---|
| 1285 | 1208 | #endif |
|---|
| .. | .. |
|---|
| 1288 | 1211 | |
|---|
| 1289 | 1212 | #define AZX_PM_OPS &azx_pm |
|---|
| 1290 | 1213 | #else |
|---|
| 1214 | +#define azx_add_card_list(chip) /* NOP */ |
|---|
| 1215 | +#define azx_del_card_list(chip) /* NOP */ |
|---|
| 1291 | 1216 | #define AZX_PM_OPS NULL |
|---|
| 1292 | 1217 | #endif /* CONFIG_PM */ |
|---|
| 1293 | 1218 | |
|---|
| .. | .. |
|---|
| 1319 | 1244 | if (!disabled) { |
|---|
| 1320 | 1245 | dev_info(chip->card->dev, |
|---|
| 1321 | 1246 | "Start delayed initialization\n"); |
|---|
| 1322 | | - if (azx_probe_continue(chip) < 0) { |
|---|
| 1247 | + if (azx_probe_continue(chip) < 0) |
|---|
| 1323 | 1248 | dev_err(chip->card->dev, "initialization error\n"); |
|---|
| 1324 | | - hda->init_failed = true; |
|---|
| 1325 | | - } |
|---|
| 1326 | 1249 | } |
|---|
| 1327 | 1250 | } else { |
|---|
| 1328 | 1251 | dev_info(chip->card->dev, "%s via vga_switcheroo\n", |
|---|
| .. | .. |
|---|
| 1380 | 1303 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); |
|---|
| 1381 | 1304 | struct hda_codec *codec; |
|---|
| 1382 | 1305 | |
|---|
| 1383 | | - if (hda->use_vga_switcheroo && !hda->need_eld_notify_link) { |
|---|
| 1306 | + if (hda->use_vga_switcheroo && !needs_eld_notify_link(chip)) { |
|---|
| 1384 | 1307 | list_for_each_codec(codec, &chip->bus) |
|---|
| 1385 | 1308 | codec->auto_runtime_pm = 1; |
|---|
| 1386 | 1309 | /* reset the power save setup */ |
|---|
| .. | .. |
|---|
| 1394 | 1317 | { |
|---|
| 1395 | 1318 | struct snd_card *card = pci_get_drvdata(pci); |
|---|
| 1396 | 1319 | struct azx *chip = card->private_data; |
|---|
| 1397 | | - struct hda_intel *hda = container_of(chip, struct hda_intel, chip); |
|---|
| 1398 | 1320 | |
|---|
| 1399 | 1321 | if (client_id == VGA_SWITCHEROO_DIS) |
|---|
| 1400 | | - hda->need_eld_notify_link = 0; |
|---|
| 1322 | + chip->bus.keep_power = 0; |
|---|
| 1401 | 1323 | setup_vga_switcheroo_runtime_pm(chip); |
|---|
| 1402 | 1324 | } |
|---|
| 1403 | 1325 | |
|---|
| .. | .. |
|---|
| 1405 | 1327 | { |
|---|
| 1406 | 1328 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); |
|---|
| 1407 | 1329 | struct pci_dev *p = get_bound_vga(chip->pci); |
|---|
| 1330 | + struct pci_dev *parent; |
|---|
| 1408 | 1331 | if (p) { |
|---|
| 1409 | 1332 | dev_info(chip->card->dev, |
|---|
| 1410 | 1333 | "Handle vga_switcheroo audio client\n"); |
|---|
| 1411 | 1334 | hda->use_vga_switcheroo = 1; |
|---|
| 1412 | | - hda->need_eld_notify_link = 1; /* cleared in gpu_bound op */ |
|---|
| 1335 | + |
|---|
| 1336 | + /* cleared in either gpu_bound op or codec probe, or when its |
|---|
| 1337 | + * upstream port has _PR3 (i.e. dGPU). |
|---|
| 1338 | + */ |
|---|
| 1339 | + parent = pci_upstream_bridge(p); |
|---|
| 1340 | + chip->bus.keep_power = parent ? !pci_pr3_present(parent) : 1; |
|---|
| 1413 | 1341 | chip->driver_caps |= AZX_DCAPS_PM_RUNTIME; |
|---|
| 1414 | 1342 | pci_dev_put(p); |
|---|
| 1415 | 1343 | } |
|---|
| .. | .. |
|---|
| 1450 | 1378 | /* |
|---|
| 1451 | 1379 | * destructor |
|---|
| 1452 | 1380 | */ |
|---|
| 1453 | | -static int azx_free(struct azx *chip) |
|---|
| 1381 | +static void azx_free(struct azx *chip) |
|---|
| 1454 | 1382 | { |
|---|
| 1455 | 1383 | struct pci_dev *pci = chip->pci; |
|---|
| 1456 | 1384 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); |
|---|
| 1457 | 1385 | struct hdac_bus *bus = azx_bus(chip); |
|---|
| 1386 | + |
|---|
| 1387 | + if (hda->freed) |
|---|
| 1388 | + return; |
|---|
| 1458 | 1389 | |
|---|
| 1459 | 1390 | if (azx_has_pm_runtime(chip) && chip->running) |
|---|
| 1460 | 1391 | pm_runtime_get_noresume(&pci->dev); |
|---|
| .. | .. |
|---|
| 1495 | 1426 | #ifdef CONFIG_SND_HDA_PATCH_LOADER |
|---|
| 1496 | 1427 | release_firmware(chip->fw); |
|---|
| 1497 | 1428 | #endif |
|---|
| 1429 | + display_power(chip, false); |
|---|
| 1498 | 1430 | |
|---|
| 1499 | | - if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
|---|
| 1500 | | - if (hda->need_i915_power) |
|---|
| 1501 | | - snd_hdac_display_power(bus, false); |
|---|
| 1502 | | - } |
|---|
| 1503 | 1431 | if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT) |
|---|
| 1504 | 1432 | snd_hdac_i915_exit(bus); |
|---|
| 1505 | | - kfree(hda); |
|---|
| 1506 | 1433 | |
|---|
| 1507 | | - return 0; |
|---|
| 1434 | + hda->freed = 1; |
|---|
| 1508 | 1435 | } |
|---|
| 1509 | 1436 | |
|---|
| 1510 | 1437 | static int azx_dev_disconnect(struct snd_device *device) |
|---|
| .. | .. |
|---|
| 1520 | 1447 | |
|---|
| 1521 | 1448 | static int azx_dev_free(struct snd_device *device) |
|---|
| 1522 | 1449 | { |
|---|
| 1523 | | - return azx_free(device->device_data); |
|---|
| 1450 | + azx_free(device->device_data); |
|---|
| 1451 | + return 0; |
|---|
| 1524 | 1452 | } |
|---|
| 1525 | 1453 | |
|---|
| 1526 | 1454 | #ifdef SUPPORT_VGA_SWITCHEROO |
|---|
| 1455 | +#ifdef CONFIG_ACPI |
|---|
| 1456 | +/* ATPX is in the integrated GPU's namespace */ |
|---|
| 1457 | +static bool atpx_present(void) |
|---|
| 1458 | +{ |
|---|
| 1459 | + struct pci_dev *pdev = NULL; |
|---|
| 1460 | + acpi_handle dhandle, atpx_handle; |
|---|
| 1461 | + acpi_status status; |
|---|
| 1462 | + |
|---|
| 1463 | + while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { |
|---|
| 1464 | + dhandle = ACPI_HANDLE(&pdev->dev); |
|---|
| 1465 | + if (dhandle) { |
|---|
| 1466 | + status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); |
|---|
| 1467 | + if (!ACPI_FAILURE(status)) { |
|---|
| 1468 | + pci_dev_put(pdev); |
|---|
| 1469 | + return true; |
|---|
| 1470 | + } |
|---|
| 1471 | + } |
|---|
| 1472 | + } |
|---|
| 1473 | + while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) { |
|---|
| 1474 | + dhandle = ACPI_HANDLE(&pdev->dev); |
|---|
| 1475 | + if (dhandle) { |
|---|
| 1476 | + status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); |
|---|
| 1477 | + if (!ACPI_FAILURE(status)) { |
|---|
| 1478 | + pci_dev_put(pdev); |
|---|
| 1479 | + return true; |
|---|
| 1480 | + } |
|---|
| 1481 | + } |
|---|
| 1482 | + } |
|---|
| 1483 | + return false; |
|---|
| 1484 | +} |
|---|
| 1485 | +#else |
|---|
| 1486 | +static bool atpx_present(void) |
|---|
| 1487 | +{ |
|---|
| 1488 | + return false; |
|---|
| 1489 | +} |
|---|
| 1490 | +#endif |
|---|
| 1491 | + |
|---|
| 1527 | 1492 | /* |
|---|
| 1528 | 1493 | * Check of disabled HDMI controller by vga_switcheroo |
|---|
| 1529 | 1494 | */ |
|---|
| .. | .. |
|---|
| 1535 | 1500 | switch (pci->vendor) { |
|---|
| 1536 | 1501 | case PCI_VENDOR_ID_ATI: |
|---|
| 1537 | 1502 | case PCI_VENDOR_ID_AMD: |
|---|
| 1503 | + if (pci->devfn == 1) { |
|---|
| 1504 | + p = pci_get_domain_bus_and_slot(pci_domain_nr(pci->bus), |
|---|
| 1505 | + pci->bus->number, 0); |
|---|
| 1506 | + if (p) { |
|---|
| 1507 | + /* ATPX is in the integrated GPU's ACPI namespace |
|---|
| 1508 | + * rather than the dGPU's namespace. However, |
|---|
| 1509 | + * the dGPU is the one who is involved in |
|---|
| 1510 | + * vgaswitcheroo. |
|---|
| 1511 | + */ |
|---|
| 1512 | + if (((p->class >> 16) == PCI_BASE_CLASS_DISPLAY) && |
|---|
| 1513 | + atpx_present()) |
|---|
| 1514 | + return p; |
|---|
| 1515 | + pci_dev_put(p); |
|---|
| 1516 | + } |
|---|
| 1517 | + } |
|---|
| 1518 | + break; |
|---|
| 1538 | 1519 | case PCI_VENDOR_ID_NVIDIA: |
|---|
| 1539 | 1520 | if (pci->devfn == 1) { |
|---|
| 1540 | 1521 | p = pci_get_domain_bus_and_slot(pci_domain_nr(pci->bus), |
|---|
| .. | .. |
|---|
| 1565 | 1546 | #endif /* SUPPORT_VGA_SWITCHEROO */ |
|---|
| 1566 | 1547 | |
|---|
| 1567 | 1548 | /* |
|---|
| 1568 | | - * white/black-listing for position_fix |
|---|
| 1549 | + * allow/deny-listing for position_fix |
|---|
| 1569 | 1550 | */ |
|---|
| 1570 | | -static struct snd_pci_quirk position_fix_list[] = { |
|---|
| 1551 | +static const struct snd_pci_quirk position_fix_list[] = { |
|---|
| 1571 | 1552 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), |
|---|
| 1572 | 1553 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), |
|---|
| 1573 | 1554 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), |
|---|
| .. | .. |
|---|
| 1630 | 1611 | |
|---|
| 1631 | 1612 | static void assign_position_fix(struct azx *chip, int fix) |
|---|
| 1632 | 1613 | { |
|---|
| 1633 | | - static azx_get_pos_callback_t callbacks[] = { |
|---|
| 1614 | + static const azx_get_pos_callback_t callbacks[] = { |
|---|
| 1634 | 1615 | [POS_FIX_AUTO] = NULL, |
|---|
| 1635 | 1616 | [POS_FIX_LPIB] = azx_get_pos_lpib, |
|---|
| 1636 | 1617 | [POS_FIX_POSBUF] = azx_get_pos_posbuf, |
|---|
| 1637 | 1618 | [POS_FIX_VIACOMBO] = azx_via_get_position, |
|---|
| 1638 | 1619 | [POS_FIX_COMBO] = azx_get_pos_lpib, |
|---|
| 1639 | | - [POS_FIX_SKL] = azx_get_pos_skl, |
|---|
| 1620 | + [POS_FIX_SKL] = azx_get_pos_posbuf, |
|---|
| 1640 | 1621 | [POS_FIX_FIFO] = azx_get_pos_fifo, |
|---|
| 1641 | 1622 | }; |
|---|
| 1642 | 1623 | |
|---|
| .. | .. |
|---|
| 1658 | 1639 | } |
|---|
| 1659 | 1640 | |
|---|
| 1660 | 1641 | /* |
|---|
| 1661 | | - * black-lists for probe_mask |
|---|
| 1642 | + * deny-lists for probe_mask |
|---|
| 1662 | 1643 | */ |
|---|
| 1663 | | -static struct snd_pci_quirk probe_mask_list[] = { |
|---|
| 1644 | +static const struct snd_pci_quirk probe_mask_list[] = { |
|---|
| 1664 | 1645 | /* Thinkpad often breaks the controller communication when accessing |
|---|
| 1665 | 1646 | * to the non-working (or non-existing) modem codec slot. |
|---|
| 1666 | 1647 | */ |
|---|
| .. | .. |
|---|
| 1707 | 1688 | } |
|---|
| 1708 | 1689 | |
|---|
| 1709 | 1690 | /* |
|---|
| 1710 | | - * white/black-list for enable_msi |
|---|
| 1691 | + * allow/deny-list for enable_msi |
|---|
| 1711 | 1692 | */ |
|---|
| 1712 | | -static struct snd_pci_quirk msi_black_list[] = { |
|---|
| 1693 | +static const struct snd_pci_quirk msi_deny_list[] = { |
|---|
| 1713 | 1694 | SND_PCI_QUIRK(0x103c, 0x2191, "HP", 0), /* AMD Hudson */ |
|---|
| 1714 | 1695 | SND_PCI_QUIRK(0x103c, 0x2192, "HP", 0), /* AMD Hudson */ |
|---|
| 1715 | 1696 | SND_PCI_QUIRK(0x103c, 0x21f7, "HP", 0), /* AMD Hudson */ |
|---|
| .. | .. |
|---|
| 1732 | 1713 | return; |
|---|
| 1733 | 1714 | } |
|---|
| 1734 | 1715 | chip->msi = 1; /* enable MSI as default */ |
|---|
| 1735 | | - q = snd_pci_quirk_lookup(chip->pci, msi_black_list); |
|---|
| 1716 | + q = snd_pci_quirk_lookup(chip->pci, msi_deny_list); |
|---|
| 1736 | 1717 | if (q) { |
|---|
| 1737 | 1718 | dev_info(chip->card->dev, |
|---|
| 1738 | 1719 | "msi for device %04x:%04x set to %d\n", |
|---|
| .. | .. |
|---|
| 1788 | 1769 | |
|---|
| 1789 | 1770 | static void azx_probe_work(struct work_struct *work) |
|---|
| 1790 | 1771 | { |
|---|
| 1791 | | - struct hda_intel *hda = container_of(work, struct hda_intel, probe_work); |
|---|
| 1772 | + struct hda_intel *hda = container_of(work, struct hda_intel, probe_work.work); |
|---|
| 1792 | 1773 | azx_probe_continue(&hda->chip); |
|---|
| 1793 | 1774 | } |
|---|
| 1794 | 1775 | |
|---|
| .. | .. |
|---|
| 1804 | 1785 | } |
|---|
| 1805 | 1786 | |
|---|
| 1806 | 1787 | switch (chip->driver_type) { |
|---|
| 1788 | + /* |
|---|
| 1789 | + * increase the bdl size for Glenfly Gpus for hardware |
|---|
| 1790 | + * limitation on hdac interrupt interval |
|---|
| 1791 | + */ |
|---|
| 1792 | + case AZX_DRIVER_GFHDMI: |
|---|
| 1793 | + return 128; |
|---|
| 1807 | 1794 | case AZX_DRIVER_ICH: |
|---|
| 1808 | 1795 | case AZX_DRIVER_PCH: |
|---|
| 1809 | 1796 | return 1; |
|---|
| .. | .. |
|---|
| 1815 | 1802 | /* |
|---|
| 1816 | 1803 | * constructor |
|---|
| 1817 | 1804 | */ |
|---|
| 1818 | | -static const struct hdac_io_ops pci_hda_io_ops; |
|---|
| 1819 | 1805 | static const struct hda_controller_ops pci_hda_ops; |
|---|
| 1820 | 1806 | |
|---|
| 1821 | 1807 | static int azx_create(struct snd_card *card, struct pci_dev *pci, |
|---|
| 1822 | 1808 | int dev, unsigned int driver_caps, |
|---|
| 1823 | 1809 | struct azx **rchip) |
|---|
| 1824 | 1810 | { |
|---|
| 1825 | | - static struct snd_device_ops ops = { |
|---|
| 1811 | + static const struct snd_device_ops ops = { |
|---|
| 1826 | 1812 | .dev_disconnect = azx_dev_disconnect, |
|---|
| 1827 | 1813 | .dev_free = azx_dev_free, |
|---|
| 1828 | 1814 | }; |
|---|
| .. | .. |
|---|
| 1836 | 1822 | if (err < 0) |
|---|
| 1837 | 1823 | return err; |
|---|
| 1838 | 1824 | |
|---|
| 1839 | | - hda = kzalloc(sizeof(*hda), GFP_KERNEL); |
|---|
| 1825 | + hda = devm_kzalloc(&pci->dev, sizeof(*hda), GFP_KERNEL); |
|---|
| 1840 | 1826 | if (!hda) { |
|---|
| 1841 | 1827 | pci_disable_device(pci); |
|---|
| 1842 | 1828 | return -ENOMEM; |
|---|
| .. | .. |
|---|
| 1851 | 1837 | chip->driver_type = driver_caps & 0xff; |
|---|
| 1852 | 1838 | check_msi(chip); |
|---|
| 1853 | 1839 | chip->dev_index = dev; |
|---|
| 1854 | | - chip->jackpoll_ms = jackpoll_ms; |
|---|
| 1840 | + if (jackpoll_ms[dev] >= 50 && jackpoll_ms[dev] <= 60000) |
|---|
| 1841 | + chip->jackpoll_interval = msecs_to_jiffies(jackpoll_ms[dev]); |
|---|
| 1855 | 1842 | INIT_LIST_HEAD(&chip->pcm_list); |
|---|
| 1856 | 1843 | INIT_WORK(&hda->irq_pending_work, azx_irq_pending_work); |
|---|
| 1857 | 1844 | INIT_LIST_HEAD(&hda->list); |
|---|
| .. | .. |
|---|
| 1872 | 1859 | else |
|---|
| 1873 | 1860 | chip->bdl_pos_adj = bdl_pos_adj[dev]; |
|---|
| 1874 | 1861 | |
|---|
| 1875 | | - /* Workaround for a communication error on CFL (bko#199007) and CNL */ |
|---|
| 1876 | | - if (IS_CFL(pci) || IS_CNL(pci)) |
|---|
| 1877 | | - chip->polling_mode = 1; |
|---|
| 1878 | | - |
|---|
| 1879 | | - err = azx_bus_init(chip, model[dev], &pci_hda_io_ops); |
|---|
| 1862 | + err = azx_bus_init(chip, model[dev]); |
|---|
| 1880 | 1863 | if (err < 0) { |
|---|
| 1881 | | - kfree(hda); |
|---|
| 1882 | 1864 | pci_disable_device(pci); |
|---|
| 1883 | 1865 | return err; |
|---|
| 1884 | 1866 | } |
|---|
| 1885 | 1867 | |
|---|
| 1868 | + /* use the non-cached pages in non-snoop mode */ |
|---|
| 1869 | + if (!azx_snoop(chip)) |
|---|
| 1870 | + azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_UC; |
|---|
| 1871 | + |
|---|
| 1886 | 1872 | if (chip->driver_type == AZX_DRIVER_NVIDIA) { |
|---|
| 1887 | 1873 | dev_dbg(chip->card->dev, "Enable delay in RIRB handling\n"); |
|---|
| 1888 | | - chip->bus.needs_damn_long_delay = 1; |
|---|
| 1874 | + chip->bus.core.needs_damn_long_delay = 1; |
|---|
| 1889 | 1875 | } |
|---|
| 1890 | 1876 | |
|---|
| 1891 | 1877 | check_probe_mask(chip, dev); |
|---|
| .. | .. |
|---|
| 1898 | 1884 | } |
|---|
| 1899 | 1885 | |
|---|
| 1900 | 1886 | /* continue probing in work context as may trigger request module */ |
|---|
| 1901 | | - INIT_WORK(&hda->probe_work, azx_probe_work); |
|---|
| 1887 | + INIT_DELAYED_WORK(&hda->probe_work, azx_probe_work); |
|---|
| 1902 | 1888 | |
|---|
| 1903 | 1889 | *rchip = chip; |
|---|
| 1904 | 1890 | |
|---|
| .. | .. |
|---|
| 1924 | 1910 | pci_write_config_dword(pci, PCI_BASE_ADDRESS_1, 0); |
|---|
| 1925 | 1911 | } |
|---|
| 1926 | 1912 | #endif |
|---|
| 1913 | + /* |
|---|
| 1914 | + * Fix response write request not synced to memory when handle |
|---|
| 1915 | + * hdac interrupt on Glenfly Gpus |
|---|
| 1916 | + */ |
|---|
| 1917 | + if (chip->driver_type == AZX_DRIVER_GFHDMI) |
|---|
| 1918 | + bus->polling_mode = 1; |
|---|
| 1927 | 1919 | |
|---|
| 1928 | 1920 | err = pci_request_regions(pci, "ICH HD audio"); |
|---|
| 1929 | 1921 | if (err < 0) |
|---|
| .. | .. |
|---|
| 1963 | 1955 | } |
|---|
| 1964 | 1956 | |
|---|
| 1965 | 1957 | pci_set_master(pci); |
|---|
| 1966 | | - synchronize_irq(bus->irq); |
|---|
| 1967 | 1958 | |
|---|
| 1968 | 1959 | gcap = azx_readw(chip, GCAP); |
|---|
| 1969 | 1960 | dev_dbg(card->dev, "chipset global capabilities = 0x%x\n", gcap); |
|---|
| .. | .. |
|---|
| 2034 | 2025 | chip->playback_streams = ATIHDMI_NUM_PLAYBACK; |
|---|
| 2035 | 2026 | chip->capture_streams = ATIHDMI_NUM_CAPTURE; |
|---|
| 2036 | 2027 | break; |
|---|
| 2028 | + case AZX_DRIVER_GFHDMI: |
|---|
| 2037 | 2029 | case AZX_DRIVER_GENERIC: |
|---|
| 2038 | 2030 | default: |
|---|
| 2039 | 2031 | chip->playback_streams = ICH6_NUM_PLAYBACK; |
|---|
| .. | .. |
|---|
| 2065 | 2057 | /* initialize chip */ |
|---|
| 2066 | 2058 | azx_init_pci(chip); |
|---|
| 2067 | 2059 | |
|---|
| 2068 | | - if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
|---|
| 2069 | | - snd_hdac_i915_set_bclk(bus); |
|---|
| 2060 | + snd_hdac_i915_set_bclk(bus); |
|---|
| 2070 | 2061 | |
|---|
| 2071 | 2062 | hda_intel_init_chip(chip, (probe_only[dev] & 2) == 0); |
|---|
| 2072 | 2063 | |
|---|
| .. | .. |
|---|
| 2107 | 2098 | } |
|---|
| 2108 | 2099 | #endif |
|---|
| 2109 | 2100 | |
|---|
| 2110 | | -/* |
|---|
| 2111 | | - * HDA controller ops. |
|---|
| 2112 | | - */ |
|---|
| 2113 | | - |
|---|
| 2114 | | -/* PCI register access. */ |
|---|
| 2115 | | -static void pci_azx_writel(u32 value, u32 __iomem *addr) |
|---|
| 2116 | | -{ |
|---|
| 2117 | | - writel(value, addr); |
|---|
| 2118 | | -} |
|---|
| 2119 | | - |
|---|
| 2120 | | -static u32 pci_azx_readl(u32 __iomem *addr) |
|---|
| 2121 | | -{ |
|---|
| 2122 | | - return readl(addr); |
|---|
| 2123 | | -} |
|---|
| 2124 | | - |
|---|
| 2125 | | -static void pci_azx_writew(u16 value, u16 __iomem *addr) |
|---|
| 2126 | | -{ |
|---|
| 2127 | | - writew(value, addr); |
|---|
| 2128 | | -} |
|---|
| 2129 | | - |
|---|
| 2130 | | -static u16 pci_azx_readw(u16 __iomem *addr) |
|---|
| 2131 | | -{ |
|---|
| 2132 | | - return readw(addr); |
|---|
| 2133 | | -} |
|---|
| 2134 | | - |
|---|
| 2135 | | -static void pci_azx_writeb(u8 value, u8 __iomem *addr) |
|---|
| 2136 | | -{ |
|---|
| 2137 | | - writeb(value, addr); |
|---|
| 2138 | | -} |
|---|
| 2139 | | - |
|---|
| 2140 | | -static u8 pci_azx_readb(u8 __iomem *addr) |
|---|
| 2141 | | -{ |
|---|
| 2142 | | - return readb(addr); |
|---|
| 2143 | | -} |
|---|
| 2144 | | - |
|---|
| 2145 | 2101 | static int disable_msi_reset_irq(struct azx *chip) |
|---|
| 2146 | 2102 | { |
|---|
| 2147 | 2103 | struct hdac_bus *bus = azx_bus(chip); |
|---|
| .. | .. |
|---|
| 2149 | 2105 | |
|---|
| 2150 | 2106 | free_irq(bus->irq, chip); |
|---|
| 2151 | 2107 | bus->irq = -1; |
|---|
| 2108 | + chip->card->sync_irq = -1; |
|---|
| 2152 | 2109 | pci_disable_msi(chip->pci); |
|---|
| 2153 | 2110 | chip->msi = 0; |
|---|
| 2154 | 2111 | err = azx_acquire_irq(chip, 1); |
|---|
| .. | .. |
|---|
| 2156 | 2113 | return err; |
|---|
| 2157 | 2114 | |
|---|
| 2158 | 2115 | return 0; |
|---|
| 2159 | | -} |
|---|
| 2160 | | - |
|---|
| 2161 | | -/* DMA page allocation helpers. */ |
|---|
| 2162 | | -static int dma_alloc_pages(struct hdac_bus *bus, |
|---|
| 2163 | | - int type, |
|---|
| 2164 | | - size_t size, |
|---|
| 2165 | | - struct snd_dma_buffer *buf) |
|---|
| 2166 | | -{ |
|---|
| 2167 | | - struct azx *chip = bus_to_azx(bus); |
|---|
| 2168 | | - int err; |
|---|
| 2169 | | - |
|---|
| 2170 | | - err = snd_dma_alloc_pages(type, |
|---|
| 2171 | | - bus->dev, |
|---|
| 2172 | | - size, buf); |
|---|
| 2173 | | - if (err < 0) |
|---|
| 2174 | | - return err; |
|---|
| 2175 | | - mark_pages_wc(chip, buf, true); |
|---|
| 2176 | | - return 0; |
|---|
| 2177 | | -} |
|---|
| 2178 | | - |
|---|
| 2179 | | -static void dma_free_pages(struct hdac_bus *bus, struct snd_dma_buffer *buf) |
|---|
| 2180 | | -{ |
|---|
| 2181 | | - struct azx *chip = bus_to_azx(bus); |
|---|
| 2182 | | - |
|---|
| 2183 | | - mark_pages_wc(chip, buf, false); |
|---|
| 2184 | | - snd_dma_free_pages(buf); |
|---|
| 2185 | | -} |
|---|
| 2186 | | - |
|---|
| 2187 | | -static int substream_alloc_pages(struct azx *chip, |
|---|
| 2188 | | - struct snd_pcm_substream *substream, |
|---|
| 2189 | | - size_t size) |
|---|
| 2190 | | -{ |
|---|
| 2191 | | - struct azx_dev *azx_dev = get_azx_dev(substream); |
|---|
| 2192 | | - int ret; |
|---|
| 2193 | | - |
|---|
| 2194 | | - mark_runtime_wc(chip, azx_dev, substream, false); |
|---|
| 2195 | | - ret = snd_pcm_lib_malloc_pages(substream, size); |
|---|
| 2196 | | - if (ret < 0) |
|---|
| 2197 | | - return ret; |
|---|
| 2198 | | - mark_runtime_wc(chip, azx_dev, substream, true); |
|---|
| 2199 | | - return 0; |
|---|
| 2200 | | -} |
|---|
| 2201 | | - |
|---|
| 2202 | | -static int substream_free_pages(struct azx *chip, |
|---|
| 2203 | | - struct snd_pcm_substream *substream) |
|---|
| 2204 | | -{ |
|---|
| 2205 | | - struct azx_dev *azx_dev = get_azx_dev(substream); |
|---|
| 2206 | | - mark_runtime_wc(chip, azx_dev, substream, false); |
|---|
| 2207 | | - return snd_pcm_lib_free_pages(substream); |
|---|
| 2208 | 2116 | } |
|---|
| 2209 | 2117 | |
|---|
| 2210 | 2118 | static void pcm_mmap_prepare(struct snd_pcm_substream *substream, |
|---|
| .. | .. |
|---|
| 2218 | 2126 | #endif |
|---|
| 2219 | 2127 | } |
|---|
| 2220 | 2128 | |
|---|
| 2221 | | -static const struct hdac_io_ops pci_hda_io_ops = { |
|---|
| 2222 | | - .reg_writel = pci_azx_writel, |
|---|
| 2223 | | - .reg_readl = pci_azx_readl, |
|---|
| 2224 | | - .reg_writew = pci_azx_writew, |
|---|
| 2225 | | - .reg_readw = pci_azx_readw, |
|---|
| 2226 | | - .reg_writeb = pci_azx_writeb, |
|---|
| 2227 | | - .reg_readb = pci_azx_readb, |
|---|
| 2228 | | - .dma_alloc_pages = dma_alloc_pages, |
|---|
| 2229 | | - .dma_free_pages = dma_free_pages, |
|---|
| 2230 | | -}; |
|---|
| 2231 | | - |
|---|
| 2232 | | -/* Blacklist for skipping the whole probe: |
|---|
| 2129 | +/* Denylist for skipping the whole probe: |
|---|
| 2233 | 2130 | * some HD-audio PCI entries are exposed without any codecs, and such devices |
|---|
| 2234 | 2131 | * should be ignored from the beginning. |
|---|
| 2235 | 2132 | */ |
|---|
| 2236 | | -static const struct pci_device_id driver_blacklist[] = { |
|---|
| 2133 | +static const struct pci_device_id driver_denylist[] = { |
|---|
| 2237 | 2134 | { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1043, 0x874f) }, /* ASUS ROG Zenith II / Strix */ |
|---|
| 2238 | 2135 | { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1462, 0xcb59) }, /* MSI TRX40 Creator */ |
|---|
| 2239 | 2136 | { PCI_DEVICE_SUB(0x1022, 0x1487, 0x1462, 0xcb60) }, /* MSI TRX40 */ |
|---|
| .. | .. |
|---|
| 2242 | 2139 | |
|---|
| 2243 | 2140 | static const struct hda_controller_ops pci_hda_ops = { |
|---|
| 2244 | 2141 | .disable_msi_reset_irq = disable_msi_reset_irq, |
|---|
| 2245 | | - .substream_alloc_pages = substream_alloc_pages, |
|---|
| 2246 | | - .substream_free_pages = substream_free_pages, |
|---|
| 2247 | 2142 | .pcm_mmap_prepare = pcm_mmap_prepare, |
|---|
| 2248 | 2143 | .position_check = azx_position_check, |
|---|
| 2249 | | - .link_power = azx_intel_link_power, |
|---|
| 2250 | 2144 | }; |
|---|
| 2251 | 2145 | |
|---|
| 2252 | 2146 | static int azx_probe(struct pci_dev *pci, |
|---|
| .. | .. |
|---|
| 2259 | 2153 | bool schedule_probe; |
|---|
| 2260 | 2154 | int err; |
|---|
| 2261 | 2155 | |
|---|
| 2262 | | - if (pci_match_id(driver_blacklist, pci)) { |
|---|
| 2263 | | - dev_info(&pci->dev, "Skipping the blacklisted device\n"); |
|---|
| 2156 | + if (pci_match_id(driver_denylist, pci)) { |
|---|
| 2157 | + dev_info(&pci->dev, "Skipping the device on the denylist\n"); |
|---|
| 2264 | 2158 | return -ENODEV; |
|---|
| 2265 | 2159 | } |
|---|
| 2266 | 2160 | |
|---|
| .. | .. |
|---|
| 2269 | 2163 | if (!enable[dev]) { |
|---|
| 2270 | 2164 | dev++; |
|---|
| 2271 | 2165 | return -ENOENT; |
|---|
| 2166 | + } |
|---|
| 2167 | + |
|---|
| 2168 | + /* |
|---|
| 2169 | + * stop probe if another Intel's DSP driver should be activated |
|---|
| 2170 | + */ |
|---|
| 2171 | + if (dmic_detect) { |
|---|
| 2172 | + err = snd_intel_dsp_driver_probe(pci); |
|---|
| 2173 | + if (err != SND_INTEL_DSP_DRIVER_ANY && err != SND_INTEL_DSP_DRIVER_LEGACY) { |
|---|
| 2174 | + dev_dbg(&pci->dev, "HDAudio driver not selected, aborting probe\n"); |
|---|
| 2175 | + return -ENODEV; |
|---|
| 2176 | + } |
|---|
| 2177 | + } else { |
|---|
| 2178 | + dev_warn(&pci->dev, "dmic_detect option is deprecated, pass snd-intel-dspcfg.dsp_driver=1 option instead\n"); |
|---|
| 2272 | 2179 | } |
|---|
| 2273 | 2180 | |
|---|
| 2274 | 2181 | err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, |
|---|
| .. | .. |
|---|
| 2319 | 2226 | #endif |
|---|
| 2320 | 2227 | |
|---|
| 2321 | 2228 | if (schedule_probe) |
|---|
| 2322 | | - schedule_work(&hda->probe_work); |
|---|
| 2229 | + schedule_delayed_work(&hda->probe_work, 0); |
|---|
| 2323 | 2230 | |
|---|
| 2324 | 2231 | dev++; |
|---|
| 2325 | 2232 | if (chip->disabled) |
|---|
| .. | .. |
|---|
| 2338 | 2245 | * So we keep a list of devices where we disable powersaving as its known |
|---|
| 2339 | 2246 | * to causes problems on these devices. |
|---|
| 2340 | 2247 | */ |
|---|
| 2341 | | -static struct snd_pci_quirk power_save_blacklist[] = { |
|---|
| 2248 | +static const struct snd_pci_quirk power_save_denylist[] = { |
|---|
| 2342 | 2249 | /* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */ |
|---|
| 2343 | 2250 | SND_PCI_QUIRK(0x1849, 0xc892, "Asrock B85M-ITX", 0), |
|---|
| 2344 | 2251 | /* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */ |
|---|
| .. | .. |
|---|
| 2364 | 2271 | SND_PCI_QUIRK(0x8086, 0x2068, "Intel NUC7i3BNB", 0), |
|---|
| 2365 | 2272 | /* https://bugzilla.kernel.org/show_bug.cgi?id=198611 */ |
|---|
| 2366 | 2273 | SND_PCI_QUIRK(0x17aa, 0x2227, "Lenovo X1 Carbon 3rd Gen", 0), |
|---|
| 2274 | + SND_PCI_QUIRK(0x17aa, 0x316e, "Lenovo ThinkCentre M70q", 0), |
|---|
| 2367 | 2275 | /* https://bugzilla.redhat.com/show_bug.cgi?id=1689623 */ |
|---|
| 2368 | 2276 | SND_PCI_QUIRK(0x17aa, 0x367b, "Lenovo IdeaCentre B550", 0), |
|---|
| 2369 | 2277 | /* https://bugzilla.redhat.com/show_bug.cgi?id=1572975 */ |
|---|
| .. | .. |
|---|
| 2382 | 2290 | if (pm_blacklist) { |
|---|
| 2383 | 2291 | const struct snd_pci_quirk *q; |
|---|
| 2384 | 2292 | |
|---|
| 2385 | | - q = snd_pci_quirk_lookup(chip->pci, power_save_blacklist); |
|---|
| 2293 | + q = snd_pci_quirk_lookup(chip->pci, power_save_denylist); |
|---|
| 2386 | 2294 | if (q && val) { |
|---|
| 2387 | | - dev_info(chip->card->dev, "device %04x:%04x is on the power_save blacklist, forcing power_save to 0\n", |
|---|
| 2295 | + dev_info(chip->card->dev, "device %04x:%04x is on the power_save denylist, forcing power_save to 0\n", |
|---|
| 2388 | 2296 | q->subvendor, q->subdevice); |
|---|
| 2389 | 2297 | val = 0; |
|---|
| 2390 | 2298 | } |
|---|
| .. | .. |
|---|
| 2394 | 2302 | } |
|---|
| 2395 | 2303 | |
|---|
| 2396 | 2304 | /* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ |
|---|
| 2397 | | -static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = { |
|---|
| 2305 | +static const unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = { |
|---|
| 2398 | 2306 | [AZX_DRIVER_NVIDIA] = 8, |
|---|
| 2399 | 2307 | [AZX_DRIVER_TERA] = 1, |
|---|
| 2400 | 2308 | }; |
|---|
| .. | .. |
|---|
| 2406 | 2314 | struct pci_dev *pci = chip->pci; |
|---|
| 2407 | 2315 | int dev = chip->dev_index; |
|---|
| 2408 | 2316 | int err; |
|---|
| 2317 | + |
|---|
| 2318 | + if (chip->disabled || hda->init_failed) |
|---|
| 2319 | + return -EIO; |
|---|
| 2320 | + if (hda->probe_retry) |
|---|
| 2321 | + goto probe_retry; |
|---|
| 2409 | 2322 | |
|---|
| 2410 | 2323 | to_hda_bus(bus)->bus_probing = 1; |
|---|
| 2411 | 2324 | hda->probe_continued = 1; |
|---|
| .. | .. |
|---|
| 2425 | 2338 | goto out_free; |
|---|
| 2426 | 2339 | } else { |
|---|
| 2427 | 2340 | /* don't bother any longer */ |
|---|
| 2428 | | - chip->driver_caps &= |
|---|
| 2429 | | - ~(AZX_DCAPS_I915_COMPONENT | AZX_DCAPS_I915_POWERWELL); |
|---|
| 2341 | + chip->driver_caps &= ~AZX_DCAPS_I915_COMPONENT; |
|---|
| 2430 | 2342 | } |
|---|
| 2431 | 2343 | } |
|---|
| 2344 | + |
|---|
| 2345 | + /* HSW/BDW controllers need this power */ |
|---|
| 2346 | + if (CONTROLLER_IN_GPU(pci)) |
|---|
| 2347 | + hda->need_i915_power = 1; |
|---|
| 2432 | 2348 | } |
|---|
| 2433 | 2349 | |
|---|
| 2434 | 2350 | /* Request display power well for the HDA controller or codec. For |
|---|
| .. | .. |
|---|
| 2436 | 2352 | * this power. For other platforms, like Baytrail/Braswell, only the |
|---|
| 2437 | 2353 | * display codec needs the power and it can be released after probe. |
|---|
| 2438 | 2354 | */ |
|---|
| 2439 | | - if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
|---|
| 2440 | | - /* HSW/BDW controllers need this power */ |
|---|
| 2441 | | - if (CONTROLLER_IN_GPU(pci)) |
|---|
| 2442 | | - hda->need_i915_power = 1; |
|---|
| 2443 | | - |
|---|
| 2444 | | - err = snd_hdac_display_power(bus, true); |
|---|
| 2445 | | - if (err < 0) { |
|---|
| 2446 | | - dev_err(chip->card->dev, |
|---|
| 2447 | | - "Cannot turn on display power on i915\n"); |
|---|
| 2448 | | - goto i915_power_fail; |
|---|
| 2449 | | - } |
|---|
| 2450 | | - } |
|---|
| 2355 | + display_power(chip, true); |
|---|
| 2451 | 2356 | |
|---|
| 2452 | 2357 | err = azx_first_init(chip); |
|---|
| 2453 | 2358 | if (err < 0) |
|---|
| .. | .. |
|---|
| 2476 | 2381 | #endif |
|---|
| 2477 | 2382 | } |
|---|
| 2478 | 2383 | #endif |
|---|
| 2384 | + |
|---|
| 2385 | + probe_retry: |
|---|
| 2479 | 2386 | if (bus->codec_mask && !(probe_only[dev] & 1)) { |
|---|
| 2480 | 2387 | err = azx_codec_configure(chip); |
|---|
| 2481 | | - if (err < 0) |
|---|
| 2388 | + if (err) { |
|---|
| 2389 | + if ((chip->driver_caps & AZX_DCAPS_RETRY_PROBE) && |
|---|
| 2390 | + ++hda->probe_retry < 60) { |
|---|
| 2391 | + schedule_delayed_work(&hda->probe_work, |
|---|
| 2392 | + msecs_to_jiffies(1000)); |
|---|
| 2393 | + return 0; /* keep things up */ |
|---|
| 2394 | + } |
|---|
| 2395 | + dev_err(chip->card->dev, "Cannot probe codecs, giving up\n"); |
|---|
| 2482 | 2396 | goto out_free; |
|---|
| 2397 | + } |
|---|
| 2483 | 2398 | } |
|---|
| 2484 | 2399 | |
|---|
| 2485 | 2400 | err = snd_card_register(chip->card); |
|---|
| .. | .. |
|---|
| 2495 | 2410 | |
|---|
| 2496 | 2411 | if (azx_has_pm_runtime(chip)) { |
|---|
| 2497 | 2412 | pm_runtime_use_autosuspend(&pci->dev); |
|---|
| 2413 | + pm_runtime_allow(&pci->dev); |
|---|
| 2498 | 2414 | pm_runtime_put_autosuspend(&pci->dev); |
|---|
| 2499 | 2415 | } |
|---|
| 2500 | 2416 | |
|---|
| 2501 | 2417 | out_free: |
|---|
| 2502 | | - if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
|---|
| 2503 | | - && !hda->need_i915_power) |
|---|
| 2504 | | - snd_hdac_display_power(bus, false); |
|---|
| 2418 | + if (err < 0) { |
|---|
| 2419 | + pci_set_drvdata(pci, NULL); |
|---|
| 2420 | + snd_card_free(chip->card); |
|---|
| 2421 | + return err; |
|---|
| 2422 | + } |
|---|
| 2505 | 2423 | |
|---|
| 2506 | | -i915_power_fail: |
|---|
| 2507 | | - if (err < 0) |
|---|
| 2508 | | - hda->init_failed = 1; |
|---|
| 2424 | + if (!hda->need_i915_power) |
|---|
| 2425 | + display_power(chip, false); |
|---|
| 2509 | 2426 | complete_all(&hda->probe_wait); |
|---|
| 2510 | 2427 | to_hda_bus(bus)->bus_probing = 0; |
|---|
| 2511 | | - return err; |
|---|
| 2428 | + hda->probe_retry = 0; |
|---|
| 2429 | + return 0; |
|---|
| 2512 | 2430 | } |
|---|
| 2513 | 2431 | |
|---|
| 2514 | 2432 | static void azx_remove(struct pci_dev *pci) |
|---|
| .. | .. |
|---|
| 2533 | 2451 | * device during cancel_work_sync() call. |
|---|
| 2534 | 2452 | */ |
|---|
| 2535 | 2453 | device_unlock(&pci->dev); |
|---|
| 2536 | | - cancel_work_sync(&hda->probe_work); |
|---|
| 2454 | + cancel_delayed_work_sync(&hda->probe_work); |
|---|
| 2537 | 2455 | device_lock(&pci->dev); |
|---|
| 2538 | 2456 | |
|---|
| 2539 | 2457 | snd_card_free(card); |
|---|
| .. | .. |
|---|
| 2549 | 2467 | return; |
|---|
| 2550 | 2468 | chip = card->private_data; |
|---|
| 2551 | 2469 | if (chip && chip->running) |
|---|
| 2552 | | - azx_stop_chip(chip); |
|---|
| 2470 | + __azx_shutdown_chip(chip, true); |
|---|
| 2553 | 2471 | } |
|---|
| 2554 | 2472 | |
|---|
| 2555 | 2473 | /* PCI IDs */ |
|---|
| .. | .. |
|---|
| 2609 | 2527 | /* Cannonlake */ |
|---|
| 2610 | 2528 | { PCI_DEVICE(0x8086, 0x9dc8), |
|---|
| 2611 | 2529 | .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2530 | + /* CometLake-LP */ |
|---|
| 2531 | + { PCI_DEVICE(0x8086, 0x02C8), |
|---|
| 2532 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2533 | + /* CometLake-H */ |
|---|
| 2534 | + { PCI_DEVICE(0x8086, 0x06C8), |
|---|
| 2535 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2536 | + { PCI_DEVICE(0x8086, 0xf1c8), |
|---|
| 2537 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2538 | + /* CometLake-S */ |
|---|
| 2539 | + { PCI_DEVICE(0x8086, 0xa3f0), |
|---|
| 2540 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2541 | + /* CometLake-R */ |
|---|
| 2542 | + { PCI_DEVICE(0x8086, 0xf0c8), |
|---|
| 2543 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2612 | 2544 | /* Icelake */ |
|---|
| 2613 | 2545 | { PCI_DEVICE(0x8086, 0x34c8), |
|---|
| 2546 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2547 | + /* Icelake-H */ |
|---|
| 2548 | + { PCI_DEVICE(0x8086, 0x3dc8), |
|---|
| 2549 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2550 | + /* Jasperlake */ |
|---|
| 2551 | + { PCI_DEVICE(0x8086, 0x38c8), |
|---|
| 2552 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2553 | + { PCI_DEVICE(0x8086, 0x4dc8), |
|---|
| 2554 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2555 | + /* Tigerlake */ |
|---|
| 2556 | + { PCI_DEVICE(0x8086, 0xa0c8), |
|---|
| 2557 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2558 | + /* Tigerlake-H */ |
|---|
| 2559 | + { PCI_DEVICE(0x8086, 0x43c8), |
|---|
| 2560 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2561 | + /* DG1 */ |
|---|
| 2562 | + { PCI_DEVICE(0x8086, 0x490d), |
|---|
| 2563 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2564 | + /* DG2 */ |
|---|
| 2565 | + { PCI_DEVICE(0x8086, 0x4f90), |
|---|
| 2566 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2567 | + { PCI_DEVICE(0x8086, 0x4f91), |
|---|
| 2568 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2569 | + { PCI_DEVICE(0x8086, 0x4f92), |
|---|
| 2570 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2571 | + /* Alderlake-S */ |
|---|
| 2572 | + { PCI_DEVICE(0x8086, 0x7ad0), |
|---|
| 2573 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2574 | + /* Alderlake-P */ |
|---|
| 2575 | + { PCI_DEVICE(0x8086, 0x51c8), |
|---|
| 2576 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2577 | + /* Elkhart Lake */ |
|---|
| 2578 | + { PCI_DEVICE(0x8086, 0x4b55), |
|---|
| 2579 | + .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2580 | + { PCI_DEVICE(0x8086, 0x4b58), |
|---|
| 2614 | 2581 | .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, |
|---|
| 2615 | 2582 | /* Broxton-P(Apollolake) */ |
|---|
| 2616 | 2583 | { PCI_DEVICE(0x8086, 0x5a98), |
|---|
| .. | .. |
|---|
| 2634 | 2601 | /* 5 Series/3400 */ |
|---|
| 2635 | 2602 | { PCI_DEVICE(0x8086, 0x3b56), |
|---|
| 2636 | 2603 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, |
|---|
| 2604 | + { PCI_DEVICE(0x8086, 0x3b57), |
|---|
| 2605 | + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, |
|---|
| 2637 | 2606 | /* Poulsbo */ |
|---|
| 2638 | 2607 | { PCI_DEVICE(0x8086, 0x811b), |
|---|
| 2639 | | - .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE }, |
|---|
| 2608 | + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE | |
|---|
| 2609 | + AZX_DCAPS_POSFIX_LPIB }, |
|---|
| 2640 | 2610 | /* Oaktrail */ |
|---|
| 2641 | 2611 | { PCI_DEVICE(0x8086, 0x080a), |
|---|
| 2642 | 2612 | .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE }, |
|---|
| .. | .. |
|---|
| 2764 | 2734 | { PCI_DEVICE(0x1002, 0xaac8), |
|---|
| 2765 | 2735 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
|---|
| 2766 | 2736 | { PCI_DEVICE(0x1002, 0xaad8), |
|---|
| 2767 | | - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
|---|
| 2768 | | - { PCI_DEVICE(0x1002, 0xaae8), |
|---|
| 2769 | | - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
|---|
| 2737 | + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | |
|---|
| 2738 | + AZX_DCAPS_PM_RUNTIME }, |
|---|
| 2770 | 2739 | { PCI_DEVICE(0x1002, 0xaae0), |
|---|
| 2771 | | - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
|---|
| 2740 | + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | |
|---|
| 2741 | + AZX_DCAPS_PM_RUNTIME }, |
|---|
| 2742 | + { PCI_DEVICE(0x1002, 0xaae8), |
|---|
| 2743 | + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | |
|---|
| 2744 | + AZX_DCAPS_PM_RUNTIME }, |
|---|
| 2772 | 2745 | { PCI_DEVICE(0x1002, 0xaaf0), |
|---|
| 2773 | | - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
|---|
| 2746 | + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | |
|---|
| 2747 | + AZX_DCAPS_PM_RUNTIME }, |
|---|
| 2748 | + { PCI_DEVICE(0x1002, 0xaaf8), |
|---|
| 2749 | + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | |
|---|
| 2750 | + AZX_DCAPS_PM_RUNTIME }, |
|---|
| 2751 | + { PCI_DEVICE(0x1002, 0xab00), |
|---|
| 2752 | + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | |
|---|
| 2753 | + AZX_DCAPS_PM_RUNTIME }, |
|---|
| 2754 | + { PCI_DEVICE(0x1002, 0xab08), |
|---|
| 2755 | + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | |
|---|
| 2756 | + AZX_DCAPS_PM_RUNTIME }, |
|---|
| 2757 | + { PCI_DEVICE(0x1002, 0xab10), |
|---|
| 2758 | + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | |
|---|
| 2759 | + AZX_DCAPS_PM_RUNTIME }, |
|---|
| 2760 | + { PCI_DEVICE(0x1002, 0xab18), |
|---|
| 2761 | + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | |
|---|
| 2762 | + AZX_DCAPS_PM_RUNTIME }, |
|---|
| 2763 | + { PCI_DEVICE(0x1002, 0xab20), |
|---|
| 2764 | + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | |
|---|
| 2765 | + AZX_DCAPS_PM_RUNTIME }, |
|---|
| 2766 | + { PCI_DEVICE(0x1002, 0xab28), |
|---|
| 2767 | + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | |
|---|
| 2768 | + AZX_DCAPS_PM_RUNTIME }, |
|---|
| 2769 | + { PCI_DEVICE(0x1002, 0xab30), |
|---|
| 2770 | + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | |
|---|
| 2771 | + AZX_DCAPS_PM_RUNTIME }, |
|---|
| 2772 | + { PCI_DEVICE(0x1002, 0xab38), |
|---|
| 2773 | + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | |
|---|
| 2774 | + AZX_DCAPS_PM_RUNTIME }, |
|---|
| 2775 | + /* GLENFLY */ |
|---|
| 2776 | + { PCI_DEVICE(0x6766, PCI_ANY_ID), |
|---|
| 2777 | + .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, |
|---|
| 2778 | + .class_mask = 0xffffff, |
|---|
| 2779 | + .driver_data = AZX_DRIVER_GFHDMI | AZX_DCAPS_POSFIX_LPIB | |
|---|
| 2780 | + AZX_DCAPS_NO_MSI | AZX_DCAPS_NO_64BIT }, |
|---|
| 2774 | 2781 | /* VIA VT8251/VT8237A */ |
|---|
| 2775 | 2782 | { PCI_DEVICE(0x1106, 0x3288), .driver_data = AZX_DRIVER_VIA }, |
|---|
| 2776 | 2783 | /* VIA GFX VT7122/VX900 */ |
|---|
| .. | .. |
|---|
| 2830 | 2837 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, |
|---|
| 2831 | 2838 | .class_mask = 0xffffff, |
|---|
| 2832 | 2839 | .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_HDMI }, |
|---|
| 2840 | + /* Zhaoxin */ |
|---|
| 2841 | + { PCI_DEVICE(0x1d17, 0x3288), .driver_data = AZX_DRIVER_ZHAOXIN }, |
|---|
| 2833 | 2842 | { 0, } |
|---|
| 2834 | 2843 | }; |
|---|
| 2835 | 2844 | MODULE_DEVICE_TABLE(pci, azx_ids); |
|---|