]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
drm/amd/display: resume from S3 bypass power down HW block.
authorCharlene Liu <charlene.liu@amd.com>
Wed, 24 Jan 2018 18:18:57 +0000 (13:18 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 19 Feb 2018 19:19:35 +0000 (14:19 -0500)
Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@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/bios/bios_parser.c
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.c
drivers/gpu/drm/amd/display/dc/bios/bios_parser_helper.h
drivers/gpu/drm/amd/display/dc/dc_bios_types.h
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c

index c00e405b63e89e8ef93bd23f90fa9596184edc9d..fb3cceec1a7fbb408baeac5304baaa9c194da832 100644 (file)
@@ -3803,6 +3803,7 @@ static const struct dc_vbios_funcs vbios_funcs = {
 
        /* bios scratch register communication */
        .is_accelerated_mode = bios_is_accelerated_mode,
+       .get_vga_enabled_displays = bios_get_vga_enabled_displays,
 
        .set_scratch_critical_state = bios_parser_set_scratch_critical_state,
 
index 1ee1717f2e6f006c5bcd09e649e2d8f612c158f2..1689c670ca6f9bfce3684d39ed2ce6e883fa0f3a 100644 (file)
@@ -1280,6 +1280,12 @@ static bool bios_parser_is_accelerated_mode(
        return bios_is_accelerated_mode(dcb);
 }
 
+static uint32_t bios_parser_get_vga_enabled_displays(
+       struct dc_bios *bios)
+{
+       return bios_get_vga_enabled_displays(bios);
+}
+
 
 /**
  * bios_parser_set_scratch_critical_state
@@ -1800,6 +1806,7 @@ static const struct dc_vbios_funcs vbios_funcs = {
 
 
        .is_accelerated_mode = bios_parser_is_accelerated_mode,
+       .get_vga_enabled_displays = bios_parser_get_vga_enabled_displays,
 
        .set_scratch_critical_state = bios_parser_set_scratch_critical_state,
 
index 5c9e5108c32cd30a89328010bc349acc6e45a687..d4589470985c72cc5d649ad9e615c815ee0ceda7 100644 (file)
@@ -78,5 +78,13 @@ void bios_set_scratch_critical_state(
        REG_UPDATE(BIOS_SCRATCH_6, S6_CRITICAL_STATE, critial_state);
 }
 
+uint32_t bios_get_vga_enabled_displays(
+       struct dc_bios *bios)
+{
+       uint32_t active_disp = 1;
 
+       if (bios->regs->BIOS_SCRATCH_3) /*follow up with other asic, todo*/
+               active_disp = REG_READ(BIOS_SCRATCH_3) & 0XFFFF;
+       return active_disp;
+}
 
index c0047efeb0065e0cbea4f73b95088f1689d8524a..75a29e68fb2782ad667f858b4f235aeccdcc8ace 100644 (file)
@@ -34,6 +34,7 @@ uint8_t *bios_get_image(struct dc_bios *bp, uint32_t offset,
 bool bios_is_accelerated_mode(struct dc_bios *bios);
 void bios_set_scratch_acc_mode_change(struct dc_bios *bios);
 void bios_set_scratch_critical_state(struct dc_bios *bios, bool state);
+uint32_t bios_get_vga_enabled_displays(struct dc_bios *bios);
 
 #define GET_IMAGE(type, offset) ((type *) bios_get_image(&bp->base, offset, sizeof(type)))
 
index 273d80a4ebcebe3b245a5cc8a4e9f3099b7a3d99..d9b84ec7954c511d599683772cf28e1be02e974b 100644 (file)
@@ -111,6 +111,8 @@ struct dc_vbios_funcs {
                struct dc_bios *bios);
        bool (*is_accelerated_mode)(
                struct dc_bios *bios);
+       uint32_t (*get_vga_enabled_displays)(
+               struct dc_bios *bios);
        void (*get_bios_event_info)(
                struct dc_bios *bios,
                struct bios_event_info *info);
@@ -199,6 +201,7 @@ struct dc_vbios_funcs {
 };
 
 struct bios_registers {
+       uint32_t BIOS_SCRATCH_3;
        uint32_t BIOS_SCRATCH_6;
 };
 
index bc1c4546ef69a7aac6f3482f378bb7bc8e6a4941..b87974e2a41bca6784bc2526924955862697d19c 100644 (file)
@@ -1484,20 +1484,21 @@ static struct dc_link *get_link_for_edp_not_in_use(
  */
 void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)
 {
+       struct dc_bios *dcb = dc->ctx->dc_bios;
        struct dc_link *edp_link_to_turnoff = get_link_for_edp_not_in_use(dc, context);
 
        struct dc_link *edp_link = get_link_for_edp(dc);
-
-       if (edp_link)
-               /*we need turn off backlight before DP_blank and encoder powered down*/
-               dc->hwss.edp_backlight_control(edp_link, 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);
-
+       if (dcb->funcs->get_vga_enabled_displays(dc->ctx->dc_bios) != 0) {
+               if (edp_link_to_turnoff) {
+                       /*we need turn off backlight before DP_blank and encoder powered down, todo add optimization*/
+                       dc->hwss.edp_backlight_control(edp_link, false);
+               }
+               /*resume from S3, no vbios posting, no need to power down again*/
+               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 17dd222f82feefdcbfb5af14fdd03eea09fe74e1..c4a564cb56b9bd8e42300801540ad5801a81d744 100644 (file)
@@ -366,6 +366,7 @@ static const struct dcn_optc_mask tg_mask = {
 
 
 static const struct bios_registers bios_regs = {
+               NBIO_SR(BIOS_SCRATCH_3),
                NBIO_SR(BIOS_SCRATCH_6)
 };