From c86f3dba238a44a8fcf7b1452c46f1cab68f525a Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Mon, 2 Nov 2015 18:01:18 -0600 Subject: [PATCH] intel_extreme: LVDS cleanup and fixes for later gens --- .../graphics/intel_extreme/intel_extreme.h | 12 ++++++------ .../accelerants/intel_extreme/Ports.cpp | 18 +++++++++++++++++- src/add-ons/accelerants/intel_extreme/dpms.cpp | 4 ---- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index ffaf34586e..76706efa67 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -613,16 +613,16 @@ struct intel_free_graphics_memory { #define VGA_DISPLAY_DISABLED (1UL << 31) // LVDS panel -#define INTEL_PANEL_STATUS 0x61200 +#define INTEL_PANEL_STATUS (0x1200 | REGS_NORTH_PIPE_AND_PORT) #define PANEL_STATUS_POWER_ON (1UL << 31) -#define INTEL_PANEL_CONTROL 0x61204 +#define INTEL_PANEL_CONTROL (0x1204 | REGS_NORTH_PIPE_AND_PORT) #define PANEL_CONTROL_POWER_TARGET_ON (1UL << 0) -#define INTEL_PANEL_FIT_CONTROL 0x61230 -#define INTEL_PANEL_FIT_RATIOS 0x61234 +#define INTEL_PANEL_FIT_CONTROL (0x1230 | REGS_NORTH_PIPE_AND_PORT) +#define INTEL_PANEL_FIT_RATIOS (0x1234 | REGS_NORTH_PIPE_AND_PORT) // LVDS on IronLake and up -#define PCH_PANEL_CONTROL 0xc7200 -#define PCH_PANEL_STATUS 0xc7204 +#define PCH_PANEL_CONTROL (0x7200 | REGS_SOUTH_SHARED) +#define PCH_PANEL_STATUS (0x7204 | REGS_SOUTH_SHARED) #define PANEL_REGISTER_UNLOCK (0xabcd << 16) #define PCH_LVDS_DETECTED (1 << 1) diff --git a/src/add-ons/accelerants/intel_extreme/Ports.cpp b/src/add-ons/accelerants/intel_extreme/Ports.cpp index 4bfd7a54fb..f2a60a5088 100644 --- a/src/add-ons/accelerants/intel_extreme/Ports.cpp +++ b/src/add-ons/accelerants/intel_extreme/Ports.cpp @@ -330,17 +330,33 @@ LVDSPort::LVDSPort() : Port(INTEL_PORT_C, "LVDS") { + // Always unlock LVDS port as soon as we start messing with it. + if (gInfo->shared_info->device_type.HasPlatformControlHub()) { + write32(PCH_PANEL_CONTROL, + read32(PCH_PANEL_CONTROL) | PANEL_REGISTER_UNLOCK); + } } bool LVDSPort::IsConnected() { + // Older generations don't have LVDS detection. If not mobile skip. + if (gInfo->shared_info->device_type.Generation() <= 4) { + if (!gInfo->shared_info->device_type.IsMobile()) { + TRACE("LVDS: Skipping LVDS detection due to gen and not mobile\n"); + return false; + } + } + uint32 registerValue = read32(INTEL_DIGITAL_LVDS_PORT); if (gInfo->shared_info->device_type.HasPlatformControlHub()) { // there's a detection bit we can use - if ((registerValue & PCH_LVDS_DETECTED) == 0) + if ((registerValue & PCH_LVDS_DETECTED) == 0) { + TRACE("LVDS: Not detected\n"); return false; + } + // TODO: Skip if eDP support } // Try getting EDID, as the LVDS port doesn't overlap with anything else, diff --git a/src/add-ons/accelerants/intel_extreme/dpms.cpp b/src/add-ons/accelerants/intel_extreme/dpms.cpp index a6d1c6957c..8761f26422 100644 --- a/src/add-ons/accelerants/intel_extreme/dpms.cpp +++ b/src/add-ons/accelerants/intel_extreme/dpms.cpp @@ -99,10 +99,6 @@ static void enable_lvds_panel(bool enable) { bool hasPCH = gInfo->shared_info->device_type.HasPlatformControlHub(); - if (hasPCH) { - // TODO: fix for PCH - return; - } int controlRegister = hasPCH ? PCH_PANEL_CONTROL : INTEL_PANEL_CONTROL; int statusRegister = hasPCH ? PCH_PANEL_STATUS : INTEL_PANEL_STATUS;