62
62
#include <linux/vga_switcheroo.h>
63
63
#include <linux/firmware.h>
64
64
#include "hda_codec.h"
65
- #include "hda_i915.h"
66
65
#include "hda_controller.h"
67
66
#include "hda_priv.h"
67
+ #include "hda_i915.h"
68
68
69
69
70
70
static int index [SNDRV_CARDS ] = SNDRV_DEFAULT_IDX ;
@@ -288,21 +288,8 @@ static char *driver_short_names[] = {
288
288
[AZX_DRIVER_GENERIC ] = "HD-Audio Generic" ,
289
289
};
290
290
291
-
292
- /* Intel HSW/BDW display HDA controller Extended Mode registers.
293
- * EM4 (M value) and EM5 (N Value) are used to convert CDClk (Core Display
294
- * Clock) to 24MHz BCLK: BCLK = CDCLK * M / N
295
- * The values will be lost when the display power well is disabled.
296
- */
297
- #define ICH6_REG_EM4 0x100c
298
- #define ICH6_REG_EM5 0x1010
299
-
300
291
struct hda_intel {
301
292
struct azx chip ;
302
-
303
- /* HSW/BDW display HDA controller to restore BCLK from CDCLK */
304
- unsigned int bclk_m ;
305
- unsigned int bclk_n ;
306
293
};
307
294
308
295
@@ -598,22 +585,6 @@ static int param_set_xint(const char *val, const struct kernel_param *kp)
598
585
#define azx_del_card_list (chip ) /* NOP */
599
586
#endif /* CONFIG_PM */
600
587
601
- static void haswell_save_bclk (struct azx * chip )
602
- {
603
- struct hda_intel * hda = container_of (chip , struct hda_intel , chip );
604
-
605
- hda -> bclk_m = azx_readw (chip , EM4 );
606
- hda -> bclk_n = azx_readw (chip , EM5 );
607
- }
608
-
609
- static void haswell_restore_bclk (struct azx * chip )
610
- {
611
- struct hda_intel * hda = container_of (chip , struct hda_intel , chip );
612
-
613
- azx_writew (chip , EM4 , hda -> bclk_m );
614
- azx_writew (chip , EM5 , hda -> bclk_n );
615
- }
616
-
617
588
#if defined(CONFIG_PM_SLEEP ) || defined(SUPPORT_VGA_SWITCHEROO )
618
589
/*
619
590
* power management
@@ -641,12 +612,6 @@ static int azx_suspend(struct device *dev)
641
612
chip -> irq = -1 ;
642
613
}
643
614
644
- /* Save BCLK M/N values before they become invalid in D3.
645
- * Will test if display power well can be released now.
646
- */
647
- if (chip -> driver_caps & AZX_DCAPS_I915_POWERWELL )
648
- haswell_save_bclk (chip );
649
-
650
615
if (chip -> msi )
651
616
pci_disable_msi (chip -> pci );
652
617
pci_disable_device (pci );
@@ -668,7 +633,7 @@ static int azx_resume(struct device *dev)
668
633
669
634
if (chip -> driver_caps & AZX_DCAPS_I915_POWERWELL ) {
670
635
hda_display_power (true);
671
- haswell_restore_bclk (chip );
636
+ haswell_set_bclk (chip );
672
637
}
673
638
pci_set_power_state (pci , PCI_D0 );
674
639
pci_restore_state (pci );
@@ -713,10 +678,9 @@ static int azx_runtime_suspend(struct device *dev)
713
678
azx_stop_chip (chip );
714
679
azx_enter_link_reset (chip );
715
680
azx_clear_irq_pending (chip );
716
- if (chip -> driver_caps & AZX_DCAPS_I915_POWERWELL ) {
717
- haswell_save_bclk (chip );
681
+ if (chip -> driver_caps & AZX_DCAPS_I915_POWERWELL )
718
682
hda_display_power (false);
719
- }
683
+
720
684
return 0 ;
721
685
}
722
686
@@ -736,7 +700,7 @@ static int azx_runtime_resume(struct device *dev)
736
700
737
701
if (chip -> driver_caps & AZX_DCAPS_I915_POWERWELL ) {
738
702
hda_display_power (true);
739
- haswell_restore_bclk (chip );
703
+ haswell_set_bclk (chip );
740
704
}
741
705
742
706
/* Read STATESTS before controller reset */
@@ -1426,6 +1390,10 @@ static int azx_first_init(struct azx *chip)
1426
1390
1427
1391
/* initialize chip */
1428
1392
azx_init_pci (chip );
1393
+
1394
+ if (chip -> driver_caps & AZX_DCAPS_I915_POWERWELL )
1395
+ haswell_set_bclk (chip );
1396
+
1429
1397
azx_init_chip (chip , (probe_only [dev ] & 2 ) == 0 );
1430
1398
1431
1399
/* codec detection */
0 commit comments