From 16cc59778b590eea0e0a39fe1838880169cdfdb6 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 15 Oct 2011 11:20:40 +0000 Subject: [PATCH] Attempt at panel control for SandyBridge, still disabled though as it doesn't work yet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42856 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/intel_extreme/intel_extreme.h | 4 ++++ src/add-ons/accelerants/intel_extreme/dpms.cpp | 18 +++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/headers/private/graphics/intel_extreme/intel_extreme.h b/headers/private/graphics/intel_extreme/intel_extreme.h index c5cb0169b6..e2ef215504 100644 --- a/headers/private/graphics/intel_extreme/intel_extreme.h +++ b/headers/private/graphics/intel_extreme/intel_extreme.h @@ -247,6 +247,10 @@ struct intel_free_graphics_memory { #define PCH_DISPLAY_A_PLL_DIVISOR_1 0xc6044 // INTEL_DISPLAY_A_PLL_DIVISOR_1 #define PCH_DISPLAY_B_PLL_DIVISOR_0 0xc6048 // INTEL_DISPLAY_B_PLL_DIVISOR_0 #define PCH_DISPLAY_B_PLL_DIVISOR_1 0xc604c // INTEL_DISPLAY_B_PLL_DIVISOR_1 +#define PCH_PANEL_CONTROL 0xc7200 // INTEL_PANEL_CONTROL +#define PCH_PANEL_STATUS 0xc7204 // INTEL_PANEL_STATUS + +#define PANEL_REGISTER_UNLOCK (0xabcd << 16) // South Display Engine (SDE) Transcoder and Port Controls #define PCH_DISPLAY_A_ANALOG_PORT 0xe1100 // INTEL_DISPLAY_A_ANALOG_PORT diff --git a/src/add-ons/accelerants/intel_extreme/dpms.cpp b/src/add-ons/accelerants/intel_extreme/dpms.cpp index b45242a6c3..37fee355f6 100644 --- a/src/add-ons/accelerants/intel_extreme/dpms.cpp +++ b/src/add-ons/accelerants/intel_extreme/dpms.cpp @@ -74,26 +74,30 @@ enable_display_pipe(bool enable) static void enable_lvds_panel(bool enable) { - uint32 control = read32(INTEL_PANEL_CONTROL); + bool isSNB = gInfo->shared_info->device_type.InGroup(INTEL_TYPE_SNB); + int controlRegister = isSNB ? PCH_PANEL_CONTROL : INTEL_PANEL_CONTROL; + int statusRegister = isSNB ? PCH_PANEL_STATUS : INTEL_PANEL_STATUS; + + uint32 control = read32(controlRegister); uint32 panelStatus; if (enable) { if ((control & PANEL_CONTROL_POWER_TARGET_ON) == 0) { - write32(INTEL_PANEL_CONTROL, control - | PANEL_CONTROL_POWER_TARGET_ON); + write32(controlRegister, control | PANEL_CONTROL_POWER_TARGET_ON + | (isSNB ? PANEL_REGISTER_UNLOCK : 0)); } do { - panelStatus = read32(INTEL_PANEL_STATUS); + panelStatus = read32(statusRegister); } while ((panelStatus & PANEL_STATUS_POWER_ON) == 0); } else { if ((control & PANEL_CONTROL_POWER_TARGET_ON) != 0) { - write32(INTEL_PANEL_CONTROL, control - & ~PANEL_CONTROL_POWER_TARGET_ON); + write32(controlRegister, (control & ~PANEL_CONTROL_POWER_TARGET_ON) + | (isSNB ? PANEL_REGISTER_UNLOCK : 0)); } do { - panelStatus = read32(INTEL_PANEL_STATUS); + panelStatus = read32(statusRegister); } while ((panelStatus & PANEL_STATUS_POWER_ON) != 0); } }