diff options
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r-- | sound/pci/hda/hda_intel.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index bb65a124e006..b6b4e71a0b0b 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -62,9 +62,9 @@ | |||
62 | #include <linux/vga_switcheroo.h> | 62 | #include <linux/vga_switcheroo.h> |
63 | #include <linux/firmware.h> | 63 | #include <linux/firmware.h> |
64 | #include "hda_codec.h" | 64 | #include "hda_codec.h" |
65 | #include "hda_i915.h" | ||
66 | #include "hda_controller.h" | 65 | #include "hda_controller.h" |
67 | #include "hda_priv.h" | 66 | #include "hda_priv.h" |
67 | #include "hda_i915.h" | ||
68 | 68 | ||
69 | 69 | ||
70 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 70 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
@@ -288,6 +288,11 @@ static char *driver_short_names[] = { | |||
288 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", | 288 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", |
289 | }; | 289 | }; |
290 | 290 | ||
291 | struct hda_intel { | ||
292 | struct azx chip; | ||
293 | }; | ||
294 | |||
295 | |||
291 | #ifdef CONFIG_X86 | 296 | #ifdef CONFIG_X86 |
292 | static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) | 297 | static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on) |
293 | { | 298 | { |
@@ -606,6 +611,7 @@ static int azx_suspend(struct device *dev) | |||
606 | free_irq(chip->irq, chip); | 611 | free_irq(chip->irq, chip); |
607 | chip->irq = -1; | 612 | chip->irq = -1; |
608 | } | 613 | } |
614 | |||
609 | if (chip->msi) | 615 | if (chip->msi) |
610 | pci_disable_msi(chip->pci); | 616 | pci_disable_msi(chip->pci); |
611 | pci_disable_device(pci); | 617 | pci_disable_device(pci); |
@@ -625,8 +631,10 @@ static int azx_resume(struct device *dev) | |||
625 | if (chip->disabled) | 631 | if (chip->disabled) |
626 | return 0; | 632 | return 0; |
627 | 633 | ||
628 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 634 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
629 | hda_display_power(true); | 635 | hda_display_power(true); |
636 | haswell_set_bclk(chip); | ||
637 | } | ||
630 | pci_set_power_state(pci, PCI_D0); | 638 | pci_set_power_state(pci, PCI_D0); |
631 | pci_restore_state(pci); | 639 | pci_restore_state(pci); |
632 | if (pci_enable_device(pci) < 0) { | 640 | if (pci_enable_device(pci) < 0) { |
@@ -672,6 +680,7 @@ static int azx_runtime_suspend(struct device *dev) | |||
672 | azx_clear_irq_pending(chip); | 680 | azx_clear_irq_pending(chip); |
673 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 681 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
674 | hda_display_power(false); | 682 | hda_display_power(false); |
683 | |||
675 | return 0; | 684 | return 0; |
676 | } | 685 | } |
677 | 686 | ||
@@ -689,8 +698,10 @@ static int azx_runtime_resume(struct device *dev) | |||
689 | if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) | 698 | if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) |
690 | return 0; | 699 | return 0; |
691 | 700 | ||
692 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 701 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { |
693 | hda_display_power(true); | 702 | hda_display_power(true); |
703 | haswell_set_bclk(chip); | ||
704 | } | ||
694 | 705 | ||
695 | /* Read STATESTS before controller reset */ | 706 | /* Read STATESTS before controller reset */ |
696 | status = azx_readw(chip, STATESTS); | 707 | status = azx_readw(chip, STATESTS); |
@@ -883,6 +894,8 @@ static int register_vga_switcheroo(struct azx *chip) | |||
883 | static int azx_free(struct azx *chip) | 894 | static int azx_free(struct azx *chip) |
884 | { | 895 | { |
885 | struct pci_dev *pci = chip->pci; | 896 | struct pci_dev *pci = chip->pci; |
897 | struct hda_intel *hda = container_of(chip, struct hda_intel, chip); | ||
898 | |||
886 | int i; | 899 | int i; |
887 | 900 | ||
888 | if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) | 901 | if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) |
@@ -930,7 +943,7 @@ static int azx_free(struct azx *chip) | |||
930 | hda_display_power(false); | 943 | hda_display_power(false); |
931 | hda_i915_exit(); | 944 | hda_i915_exit(); |
932 | } | 945 | } |
933 | kfree(chip); | 946 | kfree(hda); |
934 | 947 | ||
935 | return 0; | 948 | return 0; |
936 | } | 949 | } |
@@ -1174,6 +1187,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, | |||
1174 | static struct snd_device_ops ops = { | 1187 | static struct snd_device_ops ops = { |
1175 | .dev_free = azx_dev_free, | 1188 | .dev_free = azx_dev_free, |
1176 | }; | 1189 | }; |
1190 | struct hda_intel *hda; | ||
1177 | struct azx *chip; | 1191 | struct azx *chip; |
1178 | int err; | 1192 | int err; |
1179 | 1193 | ||
@@ -1183,13 +1197,14 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, | |||
1183 | if (err < 0) | 1197 | if (err < 0) |
1184 | return err; | 1198 | return err; |
1185 | 1199 | ||
1186 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 1200 | hda = kzalloc(sizeof(*hda), GFP_KERNEL); |
1187 | if (!chip) { | 1201 | if (!hda) { |
1188 | dev_err(card->dev, "Cannot allocate chip\n"); | 1202 | dev_err(card->dev, "Cannot allocate hda\n"); |
1189 | pci_disable_device(pci); | 1203 | pci_disable_device(pci); |
1190 | return -ENOMEM; | 1204 | return -ENOMEM; |
1191 | } | 1205 | } |
1192 | 1206 | ||
1207 | chip = &hda->chip; | ||
1193 | spin_lock_init(&chip->reg_lock); | 1208 | spin_lock_init(&chip->reg_lock); |
1194 | mutex_init(&chip->open_mutex); | 1209 | mutex_init(&chip->open_mutex); |
1195 | chip->card = card; | 1210 | chip->card = card; |
@@ -1375,6 +1390,10 @@ static int azx_first_init(struct azx *chip) | |||
1375 | 1390 | ||
1376 | /* initialize chip */ | 1391 | /* initialize chip */ |
1377 | azx_init_pci(chip); | 1392 | azx_init_pci(chip); |
1393 | |||
1394 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | ||
1395 | haswell_set_bclk(chip); | ||
1396 | |||
1378 | azx_init_chip(chip, (probe_only[dev] & 2) == 0); | 1397 | azx_init_chip(chip, (probe_only[dev] & 2) == 0); |
1379 | 1398 | ||
1380 | /* codec detection */ | 1399 | /* codec detection */ |
@@ -1656,8 +1675,13 @@ static int azx_probe_continue(struct azx *chip) | |||
1656 | "Error request power-well from i915\n"); | 1675 | "Error request power-well from i915\n"); |
1657 | goto out_free; | 1676 | goto out_free; |
1658 | } | 1677 | } |
1678 | err = hda_display_power(true); | ||
1679 | if (err < 0) { | ||
1680 | dev_err(chip->card->dev, | ||
1681 | "Cannot turn on display power on i915\n"); | ||
1682 | goto out_free; | ||
1683 | } | ||
1659 | #endif | 1684 | #endif |
1660 | hda_display_power(true); | ||
1661 | } | 1685 | } |
1662 | 1686 | ||
1663 | err = azx_first_init(chip); | 1687 | err = azx_first_init(chip); |