]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/display: Add panel cntl id for set backlight level.
authorYongqiang Sun <yongqiang.sun@amd.com>
Wed, 22 Apr 2020 22:07:59 +0000 (18:07 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 28 Apr 2020 20:19:24 +0000 (16:19 -0400)
[Why & How]
Add panel cntl instance when calling set backlight.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Acked-by: Tony Cheng <Tony.Cheng@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/core/dc_link.c
drivers/gpu/drm/amd/display/dc/dce/dce_abm.c
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
drivers/gpu/drm/amd/display/dc/inc/hw/abm.h
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h

index 0f7810571be3ce45d50e1831db6325d518702687..ad817bd7458665cecfe5aabeaf589f9290278db0 100644 (file)
@@ -2210,7 +2210,9 @@ static void commit_planes_do_stream_update(struct dc *dc,
 
                                if (should_program_abm) {
                                        if (*stream_update->abm_level == ABM_LEVEL_IMMEDIATE_DISABLE) {
-                                               pipe_ctx->stream_res.abm->funcs->set_abm_immediate_disable(pipe_ctx->stream_res.abm);
+                                               pipe_ctx->stream_res.abm->funcs->set_abm_immediate_disable(
+                                                               pipe_ctx->stream_res.abm,
+                                                               pipe_ctx->stream->link->panel_cntl->inst);
                                        } else {
                                                pipe_ctx->stream_res.abm->funcs->set_abm_level(
                                                        pipe_ctx->stream_res.abm, stream->abm_level);
index 9c4686edcf3e2107c11ef3b9075af632833fe858..a54b3e05f66bb0cfac45fc810ffaa5c265c268cf 100644 (file)
@@ -2552,6 +2552,7 @@ bool dc_link_set_backlight_level(const struct dc_link *link,
                                backlight_pwm_u16_16,
                                frame_ramp,
                                controller_id,
+                               link->panel_cntl->inst,
                                fw_set_brightness);
        }
 
@@ -2564,7 +2565,7 @@ bool dc_link_set_abm_disable(const struct dc_link *link)
        bool success = false;
 
        if (abm)
-               success = abm->funcs->set_abm_immediate_disable(abm);
+               success = abm->funcs->set_abm_immediate_disable(abm, link->panel_cntl->inst);
 
        return success;
 }
index 4dae9efebb6f5c38c40e5e056e0682523ca05c81..c15e60fb5ebcdbc0e47efbe157fb6e4c353cf88d 100644 (file)
@@ -55,7 +55,7 @@
 
 #define MCP_DISABLE_ABM_IMMEDIATELY 255
 
-static bool dce_abm_set_pipe(struct abm *abm, uint32_t controller_id)
+static bool dce_abm_set_pipe(struct abm *abm, uint32_t controller_id, uint32_t panel_inst)
 {
        struct dce_abm *abm_dce = TO_DCE_ABM(abm);
        uint32_t rampingBoundary = 0xFFFF;
@@ -201,7 +201,8 @@ static void dmcu_set_backlight_level(
        struct dce_abm *abm_dce,
        uint32_t backlight_pwm_u16_16,
        uint32_t frame_ramp,
-       uint32_t controller_id)
+       uint32_t controller_id,
+       uint32_t panel_id)
 {
        unsigned int backlight_8_bit = 0;
        uint32_t s2;
@@ -213,7 +214,7 @@ static void dmcu_set_backlight_level(
                // Take MSB of fractional part since backlight is not max
                backlight_8_bit = (backlight_pwm_u16_16 >> 8) & 0xFF;
 
-       dce_abm_set_pipe(&abm_dce->base, controller_id);
+       dce_abm_set_pipe(&abm_dce->base, controller_id, panel_id);
 
        /* waitDMCUReadyForCmd */
        REG_WAIT(MASTER_COMM_CNTL_REG, MASTER_COMM_INTERRUPT,
@@ -331,14 +332,14 @@ static bool dce_abm_set_level(struct abm *abm, uint32_t level)
        return true;
 }
 
-static bool dce_abm_immediate_disable(struct abm *abm)
+static bool dce_abm_immediate_disable(struct abm *abm, uint32_t panel_inst)
 {
        struct dce_abm *abm_dce = TO_DCE_ABM(abm);
 
        if (abm->dmcu_is_running == false)
                return true;
 
-       dce_abm_set_pipe(abm, MCP_DISABLE_ABM_IMMEDIATELY);
+       dce_abm_set_pipe(abm, MCP_DISABLE_ABM_IMMEDIATELY, panel_inst);
 
        abm->stored_backlight_registers.BL_PWM_CNTL =
                REG_READ(BL_PWM_CNTL);
@@ -420,6 +421,7 @@ static bool dce_abm_set_backlight_level_pwm(
                unsigned int backlight_pwm_u16_16,
                unsigned int frame_ramp,
                unsigned int controller_id,
+               unsigned int panel_inst,
                bool fw_set_brightness)
 {
        struct dce_abm *abm_dce = TO_DCE_ABM(abm);
@@ -432,7 +434,8 @@ static bool dce_abm_set_backlight_level_pwm(
                dmcu_set_backlight_level(abm_dce,
                                backlight_pwm_u16_16,
                                frame_ramp,
-                               controller_id);
+                               controller_id,
+                               panel_inst);
        else
                driver_set_backlight_level(abm_dce, backlight_pwm_u16_16);
 
index 09e19e3332e20579efc9422905b8ca6cf2c08415..06d39d529c0962c88cb5aba8906dfb0d2f7833ea 100644 (file)
@@ -50,7 +50,7 @@
 
 #define DISABLE_ABM_IMMEDIATELY 255
 
-static bool dmub_abm_set_pipe(struct abm *abm, uint32_t otg_inst)
+static bool dmub_abm_set_pipe(struct abm *abm, uint32_t otg_inst, uint32_t panel_inst)
 {
        union dmub_rb_cmd cmd;
        struct dc_context *dc = abm->ctx;
@@ -59,6 +59,7 @@ static bool dmub_abm_set_pipe(struct abm *abm, uint32_t otg_inst)
        cmd.abm_set_pipe.header.type = DMUB_CMD__ABM;
        cmd.abm_set_pipe.header.sub_type = DMUB_CMD__ABM_SET_PIPE;
        cmd.abm_set_pipe.abm_set_pipe_data.otg_inst = otg_inst;
+       cmd.abm_set_pipe.abm_set_pipe_data.panel_inst = panel_inst;
        cmd.abm_set_pipe.abm_set_pipe_data.ramping_boundary = ramping_boundary;
        cmd.abm_set_pipe.header.payload_bytes = sizeof(struct dmub_cmd_abm_set_pipe_data);
 
@@ -120,7 +121,8 @@ static void dmcub_set_backlight_level(
        struct dce_abm *dce_abm,
        uint32_t backlight_pwm_u16_16,
        uint32_t frame_ramp,
-       uint32_t otg_inst)
+       uint32_t otg_inst,
+       uint32_t panel_inst)
 {
        union dmub_rb_cmd cmd;
        struct dc_context *dc = dce_abm->base.ctx;
@@ -134,7 +136,7 @@ static void dmcub_set_backlight_level(
                // Take MSB of fractional part since backlight is not max
                backlight_8_bit = (backlight_pwm_u16_16 >> 8) & 0xFF;
 
-       dmub_abm_set_pipe(&dce_abm->base, otg_inst);
+       dmub_abm_set_pipe(&dce_abm->base, otg_inst, panel_inst);
 
        REG_UPDATE(BL1_PWM_USER_LEVEL, BL1_PWM_USER_LEVEL, backlight_pwm_u16_16);
 
@@ -257,11 +259,11 @@ static bool dmub_abm_set_level(struct abm *abm, uint32_t level)
        return true;
 }
 
-static bool dmub_abm_immediate_disable(struct abm *abm)
+static bool dmub_abm_immediate_disable(struct abm *abm, uint32_t panel_inst)
 {
        struct dce_abm *dce_abm = TO_DMUB_ABM(abm);
 
-       dmub_abm_set_pipe(abm, DISABLE_ABM_IMMEDIATELY);
+       dmub_abm_set_pipe(abm, DISABLE_ABM_IMMEDIATELY, panel_inst);
 
        abm->stored_backlight_registers.BL_PWM_CNTL =
                REG_READ(BL_PWM_CNTL);
@@ -338,6 +340,7 @@ static bool dmub_abm_set_backlight_level_pwm(
                unsigned int backlight_pwm_u16_16,
                unsigned int frame_ramp,
                unsigned int otg_inst,
+               uint32_t panel_inst,
                bool fw_set_brightness)
 {
        struct dce_abm *dce_abm = TO_DMUB_ABM(abm);
@@ -345,7 +348,8 @@ static bool dmub_abm_set_backlight_level_pwm(
        dmcub_set_backlight_level(dce_abm,
                        backlight_pwm_u16_16,
                        frame_ramp,
-                       otg_inst);
+                       otg_inst,
+                       panel_inst);
 
        return true;
 }
index 0d53e1d6d6b766eb1c7b41ee67d56a8895dd5959..bfc8578eda156a07e017c7d3ed667588a3a85b38 100644 (file)
@@ -903,7 +903,8 @@ static void dcn10_reset_back_end_for_pipe(
        if (pipe_ctx->top_pipe == NULL) {
 
                if (pipe_ctx->stream_res.abm)
-                       pipe_ctx->stream_res.abm->funcs->set_abm_immediate_disable(pipe_ctx->stream_res.abm);
+                       pipe_ctx->stream_res.abm->funcs->set_abm_immediate_disable(pipe_ctx->stream_res.abm,
+                                       pipe_ctx->stream->link->panel_cntl->inst);
 
                pipe_ctx->stream_res.tg->funcs->disable_crtc(pipe_ctx->stream_res.tg);
 
@@ -2474,12 +2475,14 @@ void dcn10_blank_pixel_data(
                if (stream_res->tg->funcs->set_blank)
                        stream_res->tg->funcs->set_blank(stream_res->tg, blank);
                if (stream_res->abm) {
-                       stream_res->abm->funcs->set_pipe(stream_res->abm, stream_res->tg->inst + 1);
+                       stream_res->abm->funcs->set_pipe(stream_res->abm, stream_res->tg->inst + 1,
+                                       stream->link->panel_cntl->inst);
                        stream_res->abm->funcs->set_abm_level(stream_res->abm, stream->abm_level);
                }
        } else if (blank) {
                if (stream_res->abm)
-                       stream_res->abm->funcs->set_abm_immediate_disable(stream_res->abm);
+                       stream_res->abm->funcs->set_abm_immediate_disable(stream_res->abm,
+                                       stream->link->panel_cntl->inst);
                if (stream_res->tg->funcs->set_blank)
                        stream_res->tg->funcs->set_blank(stream_res->tg, blank);
        }
index bd2ccf8eb9cfea89c5140a39329dfc4a633cbaf7..3a290ccaeb82ccb6b1cf9e344f6e31b6e661c04a 100644 (file)
@@ -962,7 +962,8 @@ void dcn20_blank_pixel_data(
 
        if (blank) {
                if (stream_res->abm)
-                       stream_res->abm->funcs->set_abm_immediate_disable(stream_res->abm);
+                       stream_res->abm->funcs->set_abm_immediate_disable(stream_res->abm,
+                                       stream->link->panel_cntl->inst);
 
                if (dc->debug.visual_confirm != VISUAL_CONFIRM_DISABLE) {
                        test_pattern = CONTROLLER_DP_TEST_PATTERN_COLORSQUARES;
@@ -997,7 +998,8 @@ void dcn20_blank_pixel_data(
 
        if (!blank)
                if (stream_res->abm) {
-                       stream_res->abm->funcs->set_pipe(stream_res->abm, stream_res->tg->inst + 1);
+                       stream_res->abm->funcs->set_pipe(stream_res->abm, stream_res->tg->inst + 1,
+                                       stream->link->panel_cntl->inst);
                        stream_res->abm->funcs->set_abm_level(stream_res->abm, stream->abm_level);
                }
 }
@@ -2041,7 +2043,8 @@ static void dcn20_reset_back_end_for_pipe(
        if (pipe_ctx->top_pipe == NULL) {
 
                if (pipe_ctx->stream_res.abm)
-                       pipe_ctx->stream_res.abm->funcs->set_abm_immediate_disable(pipe_ctx->stream_res.abm);
+                       pipe_ctx->stream_res.abm->funcs->set_abm_immediate_disable(pipe_ctx->stream_res.abm,
+                                       pipe_ctx->stream->link->panel_cntl->inst);
 
                pipe_ctx->stream_res.tg->funcs->disable_crtc(pipe_ctx->stream_res.tg);
 
index 0dd12c4fc23c3e6df3c2e833dee5bdfa400a7fa9..91a42f0f1fc45b1994dd08222540581c3e905ab5 100644 (file)
@@ -45,8 +45,8 @@ struct abm {
 struct abm_funcs {
        void (*abm_init)(struct abm *abm);
        bool (*set_abm_level)(struct abm *abm, unsigned int abm_level);
-       bool (*set_abm_immediate_disable)(struct abm *abm);
-       bool (*set_pipe)(struct abm *abm, unsigned int controller_id);
+       bool (*set_abm_immediate_disable)(struct abm *abm, unsigned int panel_inst);
+       bool (*set_pipe)(struct abm *abm, unsigned int controller_id, unsigned int panel_inst);
        bool (*init_backlight)(struct abm *abm);
 
        /* backlight_pwm_u16_16 is unsigned 32 bit,
@@ -56,6 +56,7 @@ struct abm_funcs {
                        unsigned int backlight_pwm_u16_16,
                        unsigned int frame_ramp,
                        unsigned int controller_id,
+                       unsigned int panel_inst,
                        bool fw_set_brightness);
 
        unsigned int (*get_current_backlight)(struct abm *abm);
index 6b48285446c3515d337e2bb18b53266e0ed7527a..eb10518dc058a75117113cc17f15989f76e5e253 100644 (file)
@@ -261,6 +261,7 @@ struct dmub_rb_cmd_psr_set_version {
 struct dmub_cmd_abm_set_pipe_data {
        uint32_t ramping_boundary;
        uint32_t otg_inst;
+       uint32_t panel_inst;
 };
 
 struct dmub_rb_cmd_abm_set_pipe {