]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/amd/display: Disable eDP with a proper sequence.
authorYongqiang Sun <yongqiang.sun@amd.com>
Tue, 19 Dec 2017 16:51:40 +0000 (11:51 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 19 Feb 2018 19:17:25 +0000 (14:17 -0500)
Proper sequence should be:
disable backlight
dp blank
disable output
edp power off

In enable accelatate mode, all the encoder and controller
are disabled, so move disable eDP to the function is the
easiest way to implement.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.h
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h

index 36b761a3bfc6f605a2cef31346279cd602569d4c..d8a2079b360f0a43e91fd80dfd7fe1985d7c8857 100644 (file)
@@ -649,31 +649,6 @@ bool dc_enable_stereo(
        return ret;
 }
 
-static void disable_eDP_not_in_use(struct dc *dc, struct dc_state *context)
-{
-       int i;
-       struct dc_link *link = NULL;
-
-       /* check if eDP panel is suppose to be set mode, if yes, no need to disable */
-       for (i = 0; i < context->stream_count; i++) {
-               if (context->streams[i]->signal == SIGNAL_TYPE_EDP)
-                       return;
-       }
-
-       /* check if there is an eDP panel not in use */
-       for (i = 0; i < dc->link_count; i++) {
-               if (dc->links[i]->local_sink &&
-                       dc->links[i]->local_sink->sink_signal == SIGNAL_TYPE_EDP) {
-                       link = dc->links[i];
-                       break;
-               }
-       }
-
-       if (link) {
-               dc->hwss.edp_backlight_control(link, false);
-               dc->hwss.edp_power_control(link, false);
-       }
-}
 /*
  * Applies given context to HW and copy it into current context.
  * It's up to the user to release the src context afterwards.
@@ -691,10 +666,8 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c
        for (i = 0; i < context->stream_count; i++)
                dc_streams[i] =  context->streams[i];
 
-       if (!dcb->funcs->is_accelerated_mode(dcb)) {
-               dc->hwss.enable_accelerated_mode(dc);
-               disable_eDP_not_in_use(dc, context);
-       }
+       if (!dcb->funcs->is_accelerated_mode(dcb))
+               dc->hwss.enable_accelerated_mode(dc, context);
 
        /* re-program planes for existing stream, in case we need to
         * free up plane resource for later use
index d046212708b50cb5e8fa48d53b83ff12212a3135..57bc994c7a28fdcfb8e39acd66712b61e98a176e 100644 (file)
@@ -1407,6 +1407,31 @@ static void disable_vga_and_power_gate_all_controllers(
        }
 }
 
+static struct dc_link *get_link_for_eDP_not_in_use(
+               struct dc *dc,
+               struct dc_state *context)
+{
+       int i;
+       struct dc_link *link = NULL;
+
+       /* check if eDP panel is suppose to be set mode, if yes, no need to disable */
+       for (i = 0; i < context->stream_count; i++) {
+               if (context->streams[i]->signal == SIGNAL_TYPE_EDP)
+                       return NULL;
+       }
+
+       /* check if there is an eDP panel not in use */
+       for (i = 0; i < dc->link_count; i++) {
+               if (dc->links[i]->local_sink &&
+                       dc->links[i]->local_sink->sink_signal == SIGNAL_TYPE_EDP) {
+                       link = dc->links[i];
+                       break;
+               }
+       }
+
+       return link;
+}
+
 /**
  * When ASIC goes from VBIOS/VGA mode to driver/accelerated mode we need:
  *  1. Power down all DC HW blocks
@@ -1414,11 +1439,19 @@ static void disable_vga_and_power_gate_all_controllers(
  *  3. Enable power gating for controller
  *  4. Set acc_mode_change bit (VBIOS will clear this bit when going to FSDOS)
  */
-void dce110_enable_accelerated_mode(struct dc *dc)
+void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)
 {
-       power_down_all_hw_blocks(dc);
+       struct dc_link *eDP_link_to_turnoff = get_link_for_eDP_not_in_use(dc, context);
 
+       if (eDP_link_to_turnoff)
+               dc->hwss.edp_backlight_control(eDP_link_to_turnoff, false);
+
+       power_down_all_hw_blocks(dc);
        disable_vga_and_power_gate_all_controllers(dc);
+
+       if (eDP_link_to_turnoff)
+               dc->hwss.edp_power_control(eDP_link_to_turnoff, false);
+
        bios_set_scratch_acc_mode_change(dc->ctx->dc_bios);
 }
 
index fc637647f64331a568d3c62f1a3ed7e73d07afc2..7e1f95aa0dc4af3eff98930057994b963b68b19c 100644 (file)
@@ -55,7 +55,7 @@ void dce110_unblank_stream(struct pipe_ctx *pipe_ctx,
 void dce110_update_info_frame(struct pipe_ctx *pipe_ctx);
 
 void dce110_set_avmute(struct pipe_ctx *pipe_ctx, bool enable);
-void dce110_enable_accelerated_mode(struct dc *dc);
+void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context);
 
 void dce110_power_down(struct dc *dc);
 
index 4c0aa56f7bae255e42b18db495efba17b9868971..a904b5952023c9e9ca80c24d45402f6170dad2e7 100644 (file)
@@ -114,7 +114,7 @@ struct hw_sequencer_funcs {
 
        void (*power_down)(struct dc *dc);
 
-       void (*enable_accelerated_mode)(struct dc *dc);
+       void (*enable_accelerated_mode)(struct dc *dc, struct dc_state *context);
 
        void (*enable_timing_synchronization)(
                        struct dc *dc,