aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-07-04 01:48:57 -0400
committerTakashi Iwai <tiwai@suse.de>2014-07-04 01:48:57 -0400
commit1a0e3f9639ebe7f0f17b40eb96d03c05ec067979 (patch)
tree55a007e8903e097cc1fee52dd17887b92d60c257 /sound
parentd5471e67229adb31a1e5f026955d006f06315f3d (diff)
parente4d9e513dedb5ac4e166c1053314fa935ddecc8c (diff)
Merge branch 'for-linus' into for-next
Conflicts: sound/pci/hda/hda_intel.c
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_i915.c55
-rw-r--r--sound/pci/hda/hda_i915.h2
-rw-r--r--sound/pci/hda/hda_intel.c50
-rw-r--r--sound/pci/hda/patch_realtek.c13
4 files changed, 79 insertions, 41 deletions
diff --git a/sound/pci/hda/hda_i915.c b/sound/pci/hda/hda_i915.c
index e9e8a4a4a9a1..d4d0375ac181 100644
--- a/sound/pci/hda/hda_i915.c
+++ b/sound/pci/hda/hda_i915.c
@@ -20,10 +20,20 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <sound/core.h> 21#include <sound/core.h>
22#include <drm/i915_powerwell.h> 22#include <drm/i915_powerwell.h>
23#include "hda_priv.h"
23#include "hda_i915.h" 24#include "hda_i915.h"
24 25
26/* Intel HSW/BDW display HDA controller Extended Mode registers.
27 * EM4 (M value) and EM5 (N Value) are used to convert CDClk (Core Display
28 * Clock) to 24MHz BCLK: BCLK = CDCLK * M / N
29 * The values will be lost when the display power well is disabled.
30 */
31#define AZX_REG_EM4 0x100c
32#define AZX_REG_EM5 0x1010
33
25static int (*get_power)(void); 34static int (*get_power)(void);
26static int (*put_power)(void); 35static int (*put_power)(void);
36static int (*get_cdclk)(void);
27 37
28int hda_display_power(bool enable) 38int hda_display_power(bool enable)
29{ 39{
@@ -38,6 +48,43 @@ int hda_display_power(bool enable)
38 return put_power(); 48 return put_power();
39} 49}
40 50
51void haswell_set_bclk(struct azx *chip)
52{
53 int cdclk_freq;
54 unsigned int bclk_m, bclk_n;
55
56 if (!get_cdclk)
57 return;
58
59 cdclk_freq = get_cdclk();
60 switch (cdclk_freq) {
61 case 337500:
62 bclk_m = 16;
63 bclk_n = 225;
64 break;
65
66 case 450000:
67 default: /* default CDCLK 450MHz */
68 bclk_m = 4;
69 bclk_n = 75;
70 break;
71
72 case 540000:
73 bclk_m = 4;
74 bclk_n = 90;
75 break;
76
77 case 675000:
78 bclk_m = 8;
79 bclk_n = 225;
80 break;
81 }
82
83 azx_writew(chip, EM4, bclk_m);
84 azx_writew(chip, EM5, bclk_n);
85}
86
87
41int hda_i915_init(void) 88int hda_i915_init(void)
42{ 89{
43 int err = 0; 90 int err = 0;
@@ -55,6 +102,10 @@ int hda_i915_init(void)
55 return -ENODEV; 102 return -ENODEV;
56 } 103 }
57 104
105 get_cdclk = symbol_request(i915_get_cdclk_freq);
106 if (!get_cdclk) /* may have abnormal BCLK and audio playback rate */
107 pr_warn("hda-i915: get_cdclk symbol get fail\n");
108
58 pr_debug("HDA driver get symbol successfully from i915 module\n"); 109 pr_debug("HDA driver get symbol successfully from i915 module\n");
59 110
60 return err; 111 return err;
@@ -70,6 +121,10 @@ int hda_i915_exit(void)
70 symbol_put(i915_release_power_well); 121 symbol_put(i915_release_power_well);
71 put_power = NULL; 122 put_power = NULL;
72 } 123 }
124 if (get_cdclk) {
125 symbol_put(i915_get_cdclk_freq);
126 get_cdclk = NULL;
127 }
73 128
74 return 0; 129 return 0;
75} 130}
diff --git a/sound/pci/hda/hda_i915.h b/sound/pci/hda/hda_i915.h
index bfd835f8f1aa..e6072c627583 100644
--- a/sound/pci/hda/hda_i915.h
+++ b/sound/pci/hda/hda_i915.h
@@ -18,10 +18,12 @@
18 18
19#ifdef CONFIG_SND_HDA_I915 19#ifdef CONFIG_SND_HDA_I915
20int hda_display_power(bool enable); 20int hda_display_power(bool enable);
21void haswell_set_bclk(struct azx *chip);
21int hda_i915_init(void); 22int hda_i915_init(void);
22int hda_i915_exit(void); 23int hda_i915_exit(void);
23#else 24#else
24static inline int hda_display_power(bool enable) { return 0; } 25static inline int hda_display_power(bool enable) { return 0; }
26static inline void haswell_set_bclk(struct azx *chip) { return; }
25static inline int hda_i915_init(void) 27static inline int hda_i915_init(void)
26{ 28{
27 return -ENODEV; 29 return -ENODEV;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index dc0c8dac1900..75b52c4cd70d 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -61,9 +61,9 @@
61#include <linux/vga_switcheroo.h> 61#include <linux/vga_switcheroo.h>
62#include <linux/firmware.h> 62#include <linux/firmware.h>
63#include "hda_codec.h" 63#include "hda_codec.h"
64#include "hda_i915.h"
65#include "hda_controller.h" 64#include "hda_controller.h"
66#include "hda_priv.h" 65#include "hda_priv.h"
66#include "hda_i915.h"
67 67
68/* position fix mode */ 68/* position fix mode */
69enum { 69enum {
@@ -333,22 +333,9 @@ static char *driver_short_names[] = {
333 [AZX_DRIVER_GENERIC] = "HD-Audio Generic", 333 [AZX_DRIVER_GENERIC] = "HD-Audio Generic",
334}; 334};
335 335
336
337/* Intel HSW/BDW display HDA controller Extended Mode registers.
338 * EM4 (M value) and EM5 (N Value) are used to convert CDClk (Core Display
339 * Clock) to 24MHz BCLK: BCLK = CDCLK * M / N
340 * The values will be lost when the display power well is disabled.
341 */
342#define AZX_REG_EM4 0x100c
343#define AZX_REG_EM5 0x1010
344
345struct hda_intel { 336struct hda_intel {
346 struct azx chip; 337 struct azx chip;
347 338
348 /* HSW/BDW display HDA controller to restore BCLK from CDCLK */
349 unsigned int bclk_m;
350 unsigned int bclk_n;
351
352 /* for pending irqs */ 339 /* for pending irqs */
353 struct work_struct irq_pending_work; 340 struct work_struct irq_pending_work;
354 341
@@ -777,22 +764,6 @@ static int param_set_xint(const char *val, const struct kernel_param *kp)
777#define azx_del_card_list(chip) /* NOP */ 764#define azx_del_card_list(chip) /* NOP */
778#endif /* CONFIG_PM */ 765#endif /* CONFIG_PM */
779 766
780static void haswell_save_bclk(struct azx *chip)
781{
782 struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
783
784 hda->bclk_m = azx_readw(chip, EM4);
785 hda->bclk_n = azx_readw(chip, EM5);
786}
787
788static void haswell_restore_bclk(struct azx *chip)
789{
790 struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
791
792 azx_writew(chip, EM4, hda->bclk_m);
793 azx_writew(chip, EM5, hda->bclk_n);
794}
795
796#if defined(CONFIG_PM_SLEEP) || defined(SUPPORT_VGA_SWITCHEROO) 767#if defined(CONFIG_PM_SLEEP) || defined(SUPPORT_VGA_SWITCHEROO)
797/* 768/*
798 * power management 769 * power management
@@ -820,12 +791,6 @@ static int azx_suspend(struct device *dev)
820 chip->irq = -1; 791 chip->irq = -1;
821 } 792 }
822 793
823 /* Save BCLK M/N values before they become invalid in D3.
824 * Will test if display power well can be released now.
825 */
826 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
827 haswell_save_bclk(chip);
828
829 if (chip->msi) 794 if (chip->msi)
830 pci_disable_msi(chip->pci); 795 pci_disable_msi(chip->pci);
831 pci_disable_device(pci); 796 pci_disable_device(pci);
@@ -847,7 +812,7 @@ static int azx_resume(struct device *dev)
847 812
848 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { 813 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
849 hda_display_power(true); 814 hda_display_power(true);
850 haswell_restore_bclk(chip); 815 haswell_set_bclk(chip);
851 } 816 }
852 pci_set_power_state(pci, PCI_D0); 817 pci_set_power_state(pci, PCI_D0);
853 pci_restore_state(pci); 818 pci_restore_state(pci);
@@ -892,10 +857,9 @@ static int azx_runtime_suspend(struct device *dev)
892 azx_stop_chip(chip); 857 azx_stop_chip(chip);
893 azx_enter_link_reset(chip); 858 azx_enter_link_reset(chip);
894 azx_clear_irq_pending(chip); 859 azx_clear_irq_pending(chip);
895 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { 860 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
896 haswell_save_bclk(chip);
897 hda_display_power(false); 861 hda_display_power(false);
898 } 862
899 return 0; 863 return 0;
900} 864}
901 865
@@ -915,7 +879,7 @@ static int azx_runtime_resume(struct device *dev)
915 879
916 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) { 880 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {
917 hda_display_power(true); 881 hda_display_power(true);
918 haswell_restore_bclk(chip); 882 haswell_set_bclk(chip);
919 } 883 }
920 884
921 /* Read STATESTS before controller reset */ 885 /* Read STATESTS before controller reset */
@@ -1604,6 +1568,10 @@ static int azx_first_init(struct azx *chip)
1604 1568
1605 /* initialize chip */ 1569 /* initialize chip */
1606 azx_init_pci(chip); 1570 azx_init_pci(chip);
1571
1572 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL)
1573 haswell_set_bclk(chip);
1574
1607 azx_init_chip(chip, (probe_only[dev] & 2) == 0); 1575 azx_init_chip(chip, (probe_only[dev] & 2) == 0);
1608 1576
1609 /* codec detection */ 1577 /* codec detection */
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 60bf5ee1178a..832c2255a620 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4994,6 +4994,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4994 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), 4994 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
4995 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK), 4995 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK),
4996 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), 4996 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
4997 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
4997 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4998 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4998 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4999 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4999 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 5000 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
@@ -5199,6 +5200,18 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
5199 {0x1b, 0x411111f0}, 5200 {0x1b, 0x411111f0},
5200 {0x1d, 0x40700001}, 5201 {0x1d, 0x40700001},
5201 {0x1e, 0x411111f0}), 5202 {0x1e, 0x411111f0}),
5203 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
5204 {0x12, 0x40000000},
5205 {0x13, 0x90a60140},
5206 {0x14, 0x90170110},
5207 {0x15, 0x0221401f},
5208 {0x16, 0x411111f0},
5209 {0x18, 0x411111f0},
5210 {0x19, 0x411111f0},
5211 {0x1a, 0x411111f0},
5212 {0x1b, 0x411111f0},
5213 {0x1d, 0x40700001},
5214 {0x1e, 0x411111f0}),
5202 {} 5215 {}
5203}; 5216};
5204 5217