aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-07-29 19:24:10 -0400
committerKeith Packard <keithp@keithp.com>2011-07-29 19:24:10 -0400
commit9b546e571b94cacccf1091cc9cc0bd8a6a207a66 (patch)
treefd50ef5eae6b8283e26926fa5d664f7e1cd88920 /drivers/gpu
parent2c1756b12edc19fdd75c833699cb752e1bbb641e (diff)
parentcda2bb78c24de7674eafa3210314dc75bed344a6 (diff)
Merge branch 'drm-intel-fixes' into drm-intel-next
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c90
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h1
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h19
-rw-r--r--drivers/gpu/drm/i915/i915_suspend.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c36
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c39
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c8
7 files changed, 193 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e2662497d50f..5bf7bf57c641 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1338,6 +1338,76 @@ static const struct file_operations i915_wedged_fops = {
1338 .llseek = default_llseek, 1338 .llseek = default_llseek,
1339}; 1339};
1340 1340
1341static int
1342i915_max_freq_open(struct inode *inode,
1343 struct file *filp)
1344{
1345 filp->private_data = inode->i_private;
1346 return 0;
1347}
1348
1349static ssize_t
1350i915_max_freq_read(struct file *filp,
1351 char __user *ubuf,
1352 size_t max,
1353 loff_t *ppos)
1354{
1355 struct drm_device *dev = filp->private_data;
1356 drm_i915_private_t *dev_priv = dev->dev_private;
1357 char buf[80];
1358 int len;
1359
1360 len = snprintf(buf, sizeof (buf),
1361 "max freq: %d\n", dev_priv->max_delay * 50);
1362
1363 if (len > sizeof (buf))
1364 len = sizeof (buf);
1365
1366 return simple_read_from_buffer(ubuf, max, ppos, buf, len);
1367}
1368
1369static ssize_t
1370i915_max_freq_write(struct file *filp,
1371 const char __user *ubuf,
1372 size_t cnt,
1373 loff_t *ppos)
1374{
1375 struct drm_device *dev = filp->private_data;
1376 struct drm_i915_private *dev_priv = dev->dev_private;
1377 char buf[20];
1378 int val = 1;
1379
1380 if (cnt > 0) {
1381 if (cnt > sizeof (buf) - 1)
1382 return -EINVAL;
1383
1384 if (copy_from_user(buf, ubuf, cnt))
1385 return -EFAULT;
1386 buf[cnt] = 0;
1387
1388 val = simple_strtoul(buf, NULL, 0);
1389 }
1390
1391 DRM_DEBUG_DRIVER("Manually setting max freq to %d\n", val);
1392
1393 /*
1394 * Turbo will still be enabled, but won't go above the set value.
1395 */
1396 dev_priv->max_delay = val / 50;
1397
1398 gen6_set_rps(dev, val / 50);
1399
1400 return cnt;
1401}
1402
1403static const struct file_operations i915_max_freq_fops = {
1404 .owner = THIS_MODULE,
1405 .open = i915_max_freq_open,
1406 .read = i915_max_freq_read,
1407 .write = i915_max_freq_write,
1408 .llseek = default_llseek,
1409};
1410
1341/* As the drm_debugfs_init() routines are called before dev->dev_private is 1411/* As the drm_debugfs_init() routines are called before dev->dev_private is
1342 * allocated we need to hook into the minor for release. */ 1412 * allocated we need to hook into the minor for release. */
1343static int 1413static int
@@ -1437,6 +1507,21 @@ static int i915_forcewake_create(struct dentry *root, struct drm_minor *minor)
1437 return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops); 1507 return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops);
1438} 1508}
1439 1509
1510static int i915_max_freq_create(struct dentry *root, struct drm_minor *minor)
1511{
1512 struct drm_device *dev = minor->dev;
1513 struct dentry *ent;
1514
1515 ent = debugfs_create_file("i915_max_freq",
1516 S_IRUGO | S_IWUSR,
1517 root, dev,
1518 &i915_max_freq_fops);
1519 if (IS_ERR(ent))
1520 return PTR_ERR(ent);
1521
1522 return drm_add_fake_info_node(minor, ent, &i915_max_freq_fops);
1523}
1524
1440static struct drm_info_list i915_debugfs_list[] = { 1525static struct drm_info_list i915_debugfs_list[] = {
1441 {"i915_capabilities", i915_capabilities, 0}, 1526 {"i915_capabilities", i915_capabilities, 0},
1442 {"i915_gem_objects", i915_gem_object_info, 0}, 1527 {"i915_gem_objects", i915_gem_object_info, 0},
@@ -1490,6 +1575,9 @@ int i915_debugfs_init(struct drm_minor *minor)
1490 ret = i915_forcewake_create(minor->debugfs_root, minor); 1575 ret = i915_forcewake_create(minor->debugfs_root, minor);
1491 if (ret) 1576 if (ret)
1492 return ret; 1577 return ret;
1578 ret = i915_max_freq_create(minor->debugfs_root, minor);
1579 if (ret)
1580 return ret;
1493 1581
1494 return drm_debugfs_create_files(i915_debugfs_list, 1582 return drm_debugfs_create_files(i915_debugfs_list,
1495 I915_DEBUGFS_ENTRIES, 1583 I915_DEBUGFS_ENTRIES,
@@ -1504,6 +1592,8 @@ void i915_debugfs_cleanup(struct drm_minor *minor)
1504 1, minor); 1592 1, minor);
1505 drm_debugfs_remove_files((struct drm_info_list *) &i915_wedged_fops, 1593 drm_debugfs_remove_files((struct drm_info_list *) &i915_wedged_fops,
1506 1, minor); 1594 1, minor);
1595 drm_debugfs_remove_files((struct drm_info_list *) &i915_max_freq_fops,
1596 1, minor);
1507} 1597}
1508 1598
1509#endif /* CONFIG_DEBUG_FS */ 1599#endif /* CONFIG_DEBUG_FS */
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 6867e193d85e..feb4f164fd1b 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -544,6 +544,7 @@ typedef struct drm_i915_private {
544 u32 savePIPEB_LINK_M1; 544 u32 savePIPEB_LINK_M1;
545 u32 savePIPEB_LINK_N1; 545 u32 savePIPEB_LINK_N1;
546 u32 saveMCHBAR_RENDER_STANDBY; 546 u32 saveMCHBAR_RENDER_STANDBY;
547 u32 savePCH_PORT_HOTPLUG;
547 548
548 struct { 549 struct {
549 /** Bridge to intel-gtt-ko */ 550 /** Bridge to intel-gtt-ko */
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index a900809baf2a..be67a596eee5 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3021,6 +3021,20 @@
3021#define _TRANSA_DP_LINK_M2 0xe0048 3021#define _TRANSA_DP_LINK_M2 0xe0048
3022#define _TRANSA_DP_LINK_N2 0xe004c 3022#define _TRANSA_DP_LINK_N2 0xe004c
3023 3023
3024/* Per-transcoder DIP controls */
3025
3026#define _VIDEO_DIP_CTL_A 0xe0200
3027#define _VIDEO_DIP_DATA_A 0xe0208
3028#define _VIDEO_DIP_GCP_A 0xe0210
3029
3030#define _VIDEO_DIP_CTL_B 0xe1200
3031#define _VIDEO_DIP_DATA_B 0xe1208
3032#define _VIDEO_DIP_GCP_B 0xe1210
3033
3034#define TVIDEO_DIP_CTL(pipe) _PIPE(pipe, _VIDEO_DIP_CTL_A, _VIDEO_DIP_CTL_B)
3035#define TVIDEO_DIP_DATA(pipe) _PIPE(pipe, _VIDEO_DIP_DATA_A, _VIDEO_DIP_DATA_B)
3036#define TVIDEO_DIP_GCP(pipe) _PIPE(pipe, _VIDEO_DIP_GCP_A, _VIDEO_DIP_GCP_B)
3037
3024#define _TRANS_HTOTAL_B 0xe1000 3038#define _TRANS_HTOTAL_B 0xe1000
3025#define _TRANS_HBLANK_B 0xe1004 3039#define _TRANS_HBLANK_B 0xe1004
3026#define _TRANS_HSYNC_B 0xe1008 3040#define _TRANS_HSYNC_B 0xe1008
@@ -3078,6 +3092,11 @@
3078#define TRANS_CHICKEN2(pipe) _PIPE(pipe, _TRANSA_CHICKEN2, _TRANSB_CHICKEN2) 3092#define TRANS_CHICKEN2(pipe) _PIPE(pipe, _TRANSA_CHICKEN2, _TRANSB_CHICKEN2)
3079#define TRANS_AUTOTRAIN_GEN_STALL_DIS (1<<31) 3093#define TRANS_AUTOTRAIN_GEN_STALL_DIS (1<<31)
3080 3094
3095#define SOUTH_CHICKEN1 0xc2000
3096#define FDIA_PHASE_SYNC_SHIFT_OVR 19
3097#define FDIA_PHASE_SYNC_SHIFT_EN 18
3098#define FDI_PHASE_SYNC_OVR(pipe) (1<<(FDIA_PHASE_SYNC_SHIFT_OVR - ((pipe) * 2)))
3099#define FDI_PHASE_SYNC_EN(pipe) (1<<(FDIA_PHASE_SYNC_SHIFT_EN - ((pipe) * 2)))
3081#define SOUTH_CHICKEN2 0xc2004 3100#define SOUTH_CHICKEN2 0xc2004
3082#define DPLS_EDP_PPS_FIX_DIS (1<<0) 3101#define DPLS_EDP_PPS_FIX_DIS (1<<0)
3083 3102
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index 285758603ac8..87677d60d0df 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -812,6 +812,7 @@ int i915_save_state(struct drm_device *dev)
812 dev_priv->saveFDI_RXB_IMR = I915_READ(_FDI_RXB_IMR); 812 dev_priv->saveFDI_RXB_IMR = I915_READ(_FDI_RXB_IMR);
813 dev_priv->saveMCHBAR_RENDER_STANDBY = 813 dev_priv->saveMCHBAR_RENDER_STANDBY =
814 I915_READ(RSTDBYCTL); 814 I915_READ(RSTDBYCTL);
815 dev_priv->savePCH_PORT_HOTPLUG = I915_READ(PCH_PORT_HOTPLUG);
815 } else { 816 } else {
816 dev_priv->saveIER = I915_READ(IER); 817 dev_priv->saveIER = I915_READ(IER);
817 dev_priv->saveIMR = I915_READ(IMR); 818 dev_priv->saveIMR = I915_READ(IMR);
@@ -863,6 +864,7 @@ int i915_restore_state(struct drm_device *dev)
863 I915_WRITE(GTIMR, dev_priv->saveGTIMR); 864 I915_WRITE(GTIMR, dev_priv->saveGTIMR);
864 I915_WRITE(_FDI_RXA_IMR, dev_priv->saveFDI_RXA_IMR); 865 I915_WRITE(_FDI_RXA_IMR, dev_priv->saveFDI_RXA_IMR);
865 I915_WRITE(_FDI_RXB_IMR, dev_priv->saveFDI_RXB_IMR); 866 I915_WRITE(_FDI_RXB_IMR, dev_priv->saveFDI_RXB_IMR);
867 I915_WRITE(PCH_PORT_HOTPLUG, dev_priv->savePCH_PORT_HOTPLUG);
866 } else { 868 } else {
867 I915_WRITE(IER, dev_priv->saveIER); 869 I915_WRITE(IER, dev_priv->saveIER);
868 I915_WRITE(IMR, dev_priv->saveIMR); 870 I915_WRITE(IMR, dev_priv->saveIMR);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ce908ec02900..2bf5bb63fe41 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2275,6 +2275,18 @@ static void intel_fdi_normal_train(struct drm_crtc *crtc)
2275 FDI_FE_ERRC_ENABLE); 2275 FDI_FE_ERRC_ENABLE);
2276} 2276}
2277 2277
2278static void cpt_phase_pointer_enable(struct drm_device *dev, int pipe)
2279{
2280 struct drm_i915_private *dev_priv = dev->dev_private;
2281 u32 flags = I915_READ(SOUTH_CHICKEN1);
2282
2283 flags |= FDI_PHASE_SYNC_OVR(pipe);
2284 I915_WRITE(SOUTH_CHICKEN1, flags); /* once to unlock... */
2285 flags |= FDI_PHASE_SYNC_EN(pipe);
2286 I915_WRITE(SOUTH_CHICKEN1, flags); /* then again to enable */
2287 POSTING_READ(SOUTH_CHICKEN1);
2288}
2289
2278/* The FDI link training functions for ILK/Ibexpeak. */ 2290/* The FDI link training functions for ILK/Ibexpeak. */
2279static void ironlake_fdi_link_train(struct drm_crtc *crtc) 2291static void ironlake_fdi_link_train(struct drm_crtc *crtc)
2280{ 2292{
@@ -2425,6 +2437,9 @@ static void gen6_fdi_link_train(struct drm_crtc *crtc)
2425 POSTING_READ(reg); 2437 POSTING_READ(reg);
2426 udelay(150); 2438 udelay(150);
2427 2439
2440 if (HAS_PCH_CPT(dev))
2441 cpt_phase_pointer_enable(dev, pipe);
2442
2428 for (i = 0; i < 4; i++ ) { 2443 for (i = 0; i < 4; i++ ) {
2429 reg = FDI_TX_CTL(pipe); 2444 reg = FDI_TX_CTL(pipe);
2430 temp = I915_READ(reg); 2445 temp = I915_READ(reg);
@@ -2541,6 +2556,9 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
2541 POSTING_READ(reg); 2556 POSTING_READ(reg);
2542 udelay(150); 2557 udelay(150);
2543 2558
2559 if (HAS_PCH_CPT(dev))
2560 cpt_phase_pointer_enable(dev, pipe);
2561
2544 for (i = 0; i < 4; i++ ) { 2562 for (i = 0; i < 4; i++ ) {
2545 reg = FDI_TX_CTL(pipe); 2563 reg = FDI_TX_CTL(pipe);
2546 temp = I915_READ(reg); 2564 temp = I915_READ(reg);
@@ -2650,6 +2668,17 @@ static void ironlake_fdi_pll_enable(struct drm_crtc *crtc)
2650 } 2668 }
2651} 2669}
2652 2670
2671static void cpt_phase_pointer_disable(struct drm_device *dev, int pipe)
2672{
2673 struct drm_i915_private *dev_priv = dev->dev_private;
2674 u32 flags = I915_READ(SOUTH_CHICKEN1);
2675
2676 flags &= ~(FDI_PHASE_SYNC_EN(pipe));
2677 I915_WRITE(SOUTH_CHICKEN1, flags); /* once to disable... */
2678 flags &= ~(FDI_PHASE_SYNC_OVR(pipe));
2679 I915_WRITE(SOUTH_CHICKEN1, flags); /* then again to lock */
2680 POSTING_READ(SOUTH_CHICKEN1);
2681}
2653static void ironlake_fdi_disable(struct drm_crtc *crtc) 2682static void ironlake_fdi_disable(struct drm_crtc *crtc)
2654{ 2683{
2655 struct drm_device *dev = crtc->dev; 2684 struct drm_device *dev = crtc->dev;
@@ -2679,6 +2708,8 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc)
2679 I915_WRITE(FDI_RX_CHICKEN(pipe), 2708 I915_WRITE(FDI_RX_CHICKEN(pipe),
2680 I915_READ(FDI_RX_CHICKEN(pipe) & 2709 I915_READ(FDI_RX_CHICKEN(pipe) &
2681 ~FDI_RX_PHASE_SYNC_POINTER_EN)); 2710 ~FDI_RX_PHASE_SYNC_POINTER_EN));
2711 } else if (HAS_PCH_CPT(dev)) {
2712 cpt_phase_pointer_disable(dev, pipe);
2682 } 2713 }
2683 2714
2684 /* still set train pattern 1 */ 2715 /* still set train pattern 1 */
@@ -5269,7 +5300,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
5269 } else if (is_sdvo && is_tv) 5300 } else if (is_sdvo && is_tv)
5270 factor = 20; 5301 factor = 20;
5271 5302
5272 if (clock.m1 < factor * clock.n) 5303 if (clock.m < factor * clock.n)
5273 fp |= FP_CB_TUNE; 5304 fp |= FP_CB_TUNE;
5274 5305
5275 dpll = 0; 5306 dpll = 0;
@@ -8219,6 +8250,9 @@ struct intel_quirk intel_quirks[] = {
8219 8250
8220 /* Lenovo U160 cannot use SSC on LVDS */ 8251 /* Lenovo U160 cannot use SSC on LVDS */
8221 { 0x0046, 0x17aa, 0x3920, quirk_ssc_force_disable }, 8252 { 0x0046, 0x17aa, 0x3920, quirk_ssc_force_disable },
8253
8254 /* Sony Vaio Y cannot use SSC on LVDS */
8255 { 0x0046, 0x104d, 0x9076, quirk_ssc_force_disable },
8222}; 8256};
8223 8257
8224static void intel_init_quirks(struct drm_device *dev) 8258static void intel_init_quirks(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 1ed8e6903915..105e2b892f3a 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -112,6 +112,40 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
112 VIDEO_DIP_ENABLE_AVI); 112 VIDEO_DIP_ENABLE_AVI);
113} 113}
114 114
115static void intel_ironlake_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
116{
117 struct dip_infoframe avi_if = {
118 .type = DIP_TYPE_AVI,
119 .ver = DIP_VERSION_AVI,
120 .len = DIP_LEN_AVI,
121 };
122 uint32_t *data = (uint32_t *)&avi_if;
123 struct drm_device *dev = encoder->dev;
124 struct drm_i915_private *dev_priv = dev->dev_private;
125 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
126 struct drm_crtc *crtc = encoder->crtc;
127 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
128 int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
129 unsigned i;
130
131 if (!intel_hdmi->has_hdmi_sink)
132 return;
133
134 intel_wait_for_vblank(dev, intel_crtc->pipe);
135
136 I915_WRITE(reg, VIDEO_DIP_SELECT_AVI);
137
138 intel_dip_infoframe_csum(&avi_if);
139 for (i = 0; i < sizeof(avi_if); i += 4) {
140 I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
141 data++;
142 }
143
144 I915_WRITE(reg, VIDEO_DIP_ENABLE | VIDEO_DIP_SELECT_AVI |
145 VIDEO_DIP_FREQ_VSYNC | (DIP_LEN_AVI << 8) |
146 VIDEO_DIP_ENABLE_AVI);
147}
148
115static void intel_hdmi_mode_set(struct drm_encoder *encoder, 149static void intel_hdmi_mode_set(struct drm_encoder *encoder,
116 struct drm_display_mode *mode, 150 struct drm_display_mode *mode,
117 struct drm_display_mode *adjusted_mode) 151 struct drm_display_mode *adjusted_mode)
@@ -155,7 +189,10 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
155 I915_WRITE(intel_hdmi->sdvox_reg, sdvox); 189 I915_WRITE(intel_hdmi->sdvox_reg, sdvox);
156 POSTING_READ(intel_hdmi->sdvox_reg); 190 POSTING_READ(intel_hdmi->sdvox_reg);
157 191
158 intel_hdmi_set_avi_infoframe(encoder); 192 if (HAS_PCH_SPLIT(dev))
193 intel_ironlake_hdmi_set_avi_infoframe(encoder);
194 else
195 intel_hdmi_set_avi_infoframe(encoder);
159} 196}
160 197
161static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode) 198static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode)
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index b28f7bd9f88a..2e8ddfcba40c 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -690,6 +690,14 @@ static const struct dmi_system_id intel_no_lvds[] = {
690 }, 690 },
691 { 691 {
692 .callback = intel_no_lvds_dmi_callback, 692 .callback = intel_no_lvds_dmi_callback,
693 .ident = "Dell OptiPlex FX170",
694 .matches = {
695 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
696 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex FX170"),
697 },
698 },
699 {
700 .callback = intel_no_lvds_dmi_callback,
693 .ident = "AOpen Mini PC", 701 .ident = "AOpen Mini PC",
694 .matches = { 702 .matches = {
695 DMI_MATCH(DMI_SYS_VENDOR, "AOpen"), 703 DMI_MATCH(DMI_SYS_VENDOR, "AOpen"),