From be671e26815f4399c3856cdfd36ab046618e00d4 Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Tue, 11 Nov 2008 11:48:58 +0800 Subject: [PATCH] SDVO: set monitor DPMS state Use specific SDVO monitor power state setting command for monitor DPMS besides encoder power state. --- src/i830_sdvo.c | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-) diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c index 4a424de..dc50653 100644 --- a/src/i830_sdvo.c +++ b/src/i830_sdvo.c @@ -485,6 +485,34 @@ i830_sdvo_set_encoder_power_state(xf86OutputPtr output, int mode) return (status == SDVO_CMD_STATUS_SUCCESS); } +static Bool +i830_sdvo_set_monitor_power_state(xf86OutputPtr output, int mode) +{ + uint8_t status; + uint8_t state; + + switch (mode) { + case DPMSModeOn: + state = SDVO_DISPLAY_STATE_ON; + break; + case DPMSModeStandby: + state = SDVO_DISPLAY_STATE_STANDBY; + break; + case DPMSModeSuspend: + state = SDVO_DISPLAY_STATE_SUSPEND; + break; + case DPMSModeOff: + state = SDVO_DISPLAY_STATE_OFF; + break; + } + + i830_sdvo_write_cmd(output, SDVO_CMD_SET_DISPLAY_POWER_STATE, &state, + sizeof(state)); + status = i830_sdvo_read_response(output, NULL, 0); + + return (status == SDVO_CMD_STATUS_SUCCESS); +} + /** * Returns the pixel clock range limits of the current target input in kHz. */ @@ -1130,7 +1158,11 @@ i830_sdvo_dpms(xf86OutputPtr output, int mode) uint32_t temp; if (mode != DPMSModeOn) { + i830_sdvo_set_target_output(output, dev_priv->controlled_output); + i830_sdvo_set_monitor_power_state(output, mode); + i830_sdvo_set_active_outputs(output, 0); + if (0) i830_sdvo_set_encoder_power_state(output, mode); @@ -1163,6 +1195,9 @@ i830_sdvo_dpms(xf86OutputPtr output, int mode) if (0) i830_sdvo_set_encoder_power_state(output, mode); i830_sdvo_set_active_outputs(output, dev_priv->controlled_output); + + i830_sdvo_set_target_output(output, dev_priv->controlled_output); + i830_sdvo_set_monitor_power_state(output, mode); } } -- 1.5.6.5