intel_extreme: Program more LVDS regs. Set +/- @ lvds port

This commit is contained in:
Alexander von Gluck IV
2015-11-12 18:30:21 -06:00
parent 39f61d2190
commit f979e62e54
4 changed files with 33 additions and 7 deletions
@@ -442,10 +442,16 @@ struct intel_free_graphics_memory {
#define LVDS_POST2_RATE_FAST 7 #define LVDS_POST2_RATE_FAST 7
#define LVDS_CLKB_POWER_MASK (3 << 4) #define LVDS_CLKB_POWER_MASK (3 << 4)
#define LVDS_CLKB_POWER_UP (3 << 4) #define LVDS_CLKB_POWER_UP (3 << 4)
#define LVDS_PORT_EN (1 << 31) #define LVDS_A3_POWER_MASK (3 << 6)
#define LVDS_A3_POWER_UP (3 << 6)
#define LVDS_A0A2_CLKA_POWER_UP (3 << 8) #define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
#define LVDS_B0B3PAIRS_POWER_UP (3 << 2) #define LVDS_B0B3PAIRS_POWER_UP (3 << 2)
#define LVDS_BORDER_ENABLE (1 << 15)
#define LVDS_HSYNC_POLARITY (1 << 20)
#define LVDS_VSYNC_POLARITY (1 << 21)
#define LVDS_18BIT_DITHER (1 << 25) #define LVDS_18BIT_DITHER (1 << 25)
#define LVDS_PORT_EN (1 << 31)
// PLL flags // PLL flags
#define DISPLAY_PLL_ENABLED (1UL << 31) #define DISPLAY_PLL_ENABLED (1UL << 31)
@@ -202,6 +202,15 @@ DisplayPipe::ConfigureTimings(const pll_divisors& divisors, uint32 pixelClock,
// pll |= ((divisors.post1 - 1) << DISPLAY_PLL_POST1_DIVISOR_SHIFT) // pll |= ((divisors.post1 - 1) << DISPLAY_PLL_POST1_DIVISOR_SHIFT)
// & DISPLAY_PLL_9xx_POST1_DIVISOR_MASK; // & DISPLAY_PLL_9xx_POST1_DIVISOR_MASK;
} }
#if 0
// TODO: ??? LVDS?
switch (divisors.post2) {
case 5:
case 7:
pll |= DISPLAY_PLL_DIVIDE_HIGH;
break;
}
#endif
if (divisors.post2_high) if (divisors.post2_high)
pll |= DISPLAY_PLL_DIVIDE_HIGH; pll |= DISPLAY_PLL_DIVIDE_HIGH;
@@ -452,9 +452,12 @@ LVDSPort::SetDisplayMode(display_mode* target, uint32 colorMode)
uint32 lvds = read32(_PortRegister()) uint32 lvds = read32(_PortRegister())
| LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP; | LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP;
lvds |= LVDS_18BIT_DITHER; if (gInfo->shared_info->device_type.Generation() == 4) {
// TODO: do not do this if the connected panel is 24-bit // LVDS_A3_POWER_UP == 24bpp
// (I don't know how to detect that) // otherwise, 18bpp
if ((lvds & LVDS_A3_POWER_MASK) != LVDS_A3_POWER_UP)
lvds |= LVDS_18BIT_DITHER;
}
// Set the B0-B3 data pairs corresponding to whether we're going to // Set the B0-B3 data pairs corresponding to whether we're going to
// set the DPLLs for dual-channel mode or not. // set the DPLLs for dual-channel mode or not.
@@ -463,6 +466,13 @@ LVDSPort::SetDisplayMode(display_mode* target, uint32 colorMode)
else else
lvds &= ~(LVDS_B0B3PAIRS_POWER_UP | LVDS_CLKB_POWER_UP); lvds &= ~(LVDS_B0B3PAIRS_POWER_UP | LVDS_CLKB_POWER_UP);
// Set LVDS sync polarity
lvds &= ~(LVDS_HSYNC_POLARITY | LVDS_VSYNC_POLARITY);
if ((target->timing.flags & B_POSITIVE_HSYNC) != 0)
lvds |= LVDS_HSYNC_POLARITY;
if ((target->timing.flags & B_POSITIVE_VSYNC) != 0)
lvds |= LVDS_VSYNC_POLARITY;
write32(_PortRegister(), lvds); write32(_PortRegister(), lvds);
read32(_PortRegister()); read32(_PortRegister());
@@ -486,9 +496,9 @@ LVDSPort::SetDisplayMode(display_mode* target, uint32 colorMode)
write32(panelControl, read32(panelControl) | PANEL_CONTROL_POWER_TARGET_ON); write32(panelControl, read32(panelControl) | PANEL_CONTROL_POWER_TARGET_ON);
// TODO: A wait_for power on status to be set would be better here // TODO: A wait_for power on status to be set would be better here
spin(1000); spin(750);
if ((read32(panelStatus) & PANEL_STATUS_POWER_ON) == 0) if ((read32(panelStatus) & PANEL_STATUS_POWER_ON) == 0)
ERROR("%s: %s didn't power on in 250ms!\n", __func__, PortName()); ERROR("%s: %s didn't power on in 750ms!\n", __func__, PortName());
// Program target display mode // Program target display mode
fDisplayPipe->Enable(target, _PortRegister()); fDisplayPipe->Enable(target, _PortRegister());
@@ -138,7 +138,8 @@ compute_pll_divisors(display_mode* current, pll_divisors* divisors,
TRACE("%s: required MHz: %g\n", __func__, requestedPixelClock); TRACE("%s: required MHz: %g\n", __func__, requestedPixelClock);
if (isLVDS) { if (isLVDS) {
if ((read32(INTEL_DIGITAL_LVDS_PORT) & LVDS_CLKB_POWER_MASK) if (requestedPixelClock >= 112.199
|| (read32(INTEL_DIGITAL_LVDS_PORT) & LVDS_CLKB_POWER_MASK)
== LVDS_CLKB_POWER_UP) == LVDS_CLKB_POWER_UP)
divisors->post2 = LVDS_POST2_RATE_FAST; divisors->post2 = LVDS_POST2_RATE_FAST;
else else