drm/amd/display: Initialize new backlight_level_params structure
authorKaitlyn Tse <Kaitlyn.Tse@amd.com>
Wed, 4 Sep 2024 15:54:15 +0000 (11:54 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 7 Oct 2024 18:17:16 +0000 (14:17 -0400)
[Why]
Initialize the new backlight_level_params structure as part of the ABC
framework, the information in this structure is needed to be passed down
to the DMCUB to identify the backlight control type, to adjust the
backlight of the panel and to perform any required conversions from PWM
to nits or vice versa.

[How]
Created initial framework of the backlight_level_params struct and
modified existing functions to include the new structure.

Reviewed-by: Harry Vanzylldejong <harry.vanzylldejong@amd.com>
Reviewed-by: Iswara Nagulendran <iswara.nagulendran@amd.com>
Reviewed-by: Anthony Koo <anthony.koo@amd.com>
Signed-off-by: Kaitlyn Tse <Kaitlyn.Tse@amd.com>
Signed-off-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.h
drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c
drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.h
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c

index 9d00d8dc5ae8775ce5c3eac8f42db505bec1c347..c31ec44ccd8c0466b88f2aabf97b04b427538012 100644 (file)
@@ -3142,9 +3142,10 @@ static void dce110_set_cursor_attribute(struct pipe_ctx *pipe_ctx)
 }
 
 bool dce110_set_backlight_level(struct pipe_ctx *pipe_ctx,
-               uint32_t backlight_pwm_u16_16,
-               uint32_t frame_ramp)
+       struct set_backlight_level_params *params)
 {
+       uint32_t backlight_pwm_u16_16 = params->backlight_pwm_u16_16;
+       uint32_t frame_ramp = params->frame_ramp;
        struct dc_link *link = pipe_ctx->stream->link;
        struct dc  *dc = link->ctx->dc;
        struct abm *abm = pipe_ctx->stream_res.abm;
index ed3cc3648e8e23f8d076b92e10a23791253f9662..06789ac3a2245da193b502e898e02b1c6882fa25 100644 (file)
@@ -88,8 +88,7 @@ void dce110_edp_wait_for_hpd_ready(
                bool power_up);
 
 bool dce110_set_backlight_level(struct pipe_ctx *pipe_ctx,
-               uint32_t backlight_pwm_u16_16,
-               uint32_t frame_ramp);
+       struct set_backlight_level_params *params);
 void dce110_set_abm_immediate_disable(struct pipe_ctx *pipe_ctx);
 void dce110_set_pipe(struct pipe_ctx *pipe_ctx);
 void dce110_disable_link_output(struct dc_link *link,
index 1ea95f8d4cbccbb4195a5ede6c9e69d2d290e376..630e05f32c806554a3c3f810e7199725b9cacdab 100644 (file)
@@ -242,14 +242,15 @@ void dcn21_set_pipe(struct pipe_ctx *pipe_ctx)
 }
 
 bool dcn21_set_backlight_level(struct pipe_ctx *pipe_ctx,
-               uint32_t backlight_pwm_u16_16,
-               uint32_t frame_ramp)
+       struct set_backlight_level_params *params)
 {
        struct dc_context *dc = pipe_ctx->stream->ctx;
        struct abm *abm = pipe_ctx->stream_res.abm;
        struct timing_generator *tg = pipe_ctx->stream_res.tg;
        struct panel_cntl *panel_cntl = pipe_ctx->stream->link->panel_cntl;
        uint32_t otg_inst;
+       uint32_t backlight_pwm_u16_16 = params->backlight_pwm_u16_16;
+       uint32_t frame_ramp = params->frame_ramp;
 
        if (!abm || !tg || !panel_cntl)
                return false;
@@ -257,7 +258,7 @@ bool dcn21_set_backlight_level(struct pipe_ctx *pipe_ctx,
        otg_inst = tg->inst;
 
        if (dc->dc->res_pool->dmcu) {
-               dce110_set_backlight_level(pipe_ctx, backlight_pwm_u16_16, frame_ramp);
+               dce110_set_backlight_level(pipe_ctx, params);
                return true;
        }
 
index 9cee9bdb8de95c1ab2566d4ac512a84c7469e573..a7eaaa4596be4619ae3cf20bed1df293494fc124 100644 (file)
@@ -50,8 +50,7 @@ void dcn21_PLAT_58856_wa(struct dc_state *context,
 void dcn21_set_pipe(struct pipe_ctx *pipe_ctx);
 void dcn21_set_abm_immediate_disable(struct pipe_ctx *pipe_ctx);
 bool dcn21_set_backlight_level(struct pipe_ctx *pipe_ctx,
-               uint32_t backlight_pwm_u16_16,
-               uint32_t frame_ramp);
+       struct set_backlight_level_params *params);
 bool dcn21_is_abm_supported(struct dc *dc,
                struct dc_state *context, struct dc_stream_state *stream);
 
index 2f56c36e425103626243342d14420ecc38f48ce9..1df17c54f3a9f0810be0261c46b5e3563da6c3ac 100644 (file)
@@ -174,6 +174,11 @@ union block_sequence_params {
        struct fams2_global_control_lock_fast_params fams2_global_control_lock_fast_params;
 };
 
+struct set_backlight_level_params {
+       uint32_t backlight_pwm_u16_16;
+       uint32_t frame_ramp;
+};
+
 enum block_sequence_func {
        DMUB_SUBVP_PIPE_CONTROL_LOCK_FAST = 0,
        OPTC_PIPE_CONTROL_LOCK,
@@ -365,8 +370,7 @@ struct hw_sequencer_funcs {
        void (*clear_status_bits)(struct dc *dc, unsigned int mask);
 
        bool (*set_backlight_level)(struct pipe_ctx *pipe_ctx,
-                       uint32_t backlight_pwm_u16_16,
-                       uint32_t frame_ramp);
+               struct set_backlight_level_params *params);
 
        void (*set_abm_immediate_disable)(struct pipe_ctx *pipe_ctx);
 
index cbea36916d35c909ae2a4b361b4c77824359c4ee..43a467f6ce7bd98e8f47e1da53b52d01f6554902 100644 (file)
@@ -521,13 +521,13 @@ bool edp_set_backlight_level(const struct dc_link *link,
                uint32_t frame_ramp)
 {
        struct dc  *dc = link->ctx->dc;
-
        DC_LOGGER_INIT(link->ctx->logger);
        DC_LOG_BACKLIGHT("New Backlight level: %d (0x%X)\n",
                        backlight_pwm_u16_16, backlight_pwm_u16_16);
 
        if (dc_is_embedded_signal(link->connector_signal)) {
                struct pipe_ctx *pipe_ctx = get_pipe_from_link(link);
+               struct set_backlight_level_params backlight_level_param = { 0 };
 
                if (link->panel_cntl)
                        link->panel_cntl->stored_backlight_registers.USER_LEVEL = backlight_pwm_u16_16;
@@ -542,10 +542,12 @@ bool edp_set_backlight_level(const struct dc_link *link,
                        return false;
                }
 
+               backlight_level_param.backlight_pwm_u16_16 = backlight_pwm_u16_16;
+               backlight_level_param.frame_ramp = frame_ramp;
+
                dc->hwss.set_backlight_level(
                                pipe_ctx,
-                               backlight_pwm_u16_16,
-                               frame_ramp);
+                               &backlight_level_param);
        }
        return true;
 }