Commit 760ef473 authored by Sung Lee's avatar Sung Lee Committed by Alex Deucher

drm/amd/display: Formula refactor for calculating DPP CLK DTO

[Why]
Previous formula for calculating DPP CLK DTO was
hard to understand.

[How]
Replace with easier to understand formula that produces
same results.
Signed-off-by: default avatarSung Lee <sung.lee@amd.com>
Reviewed-by: default avatarDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 54790345
...@@ -50,20 +50,20 @@ void dccg2_update_dpp_dto(struct dccg *dccg, int dpp_inst, int req_dppclk) ...@@ -50,20 +50,20 @@ void dccg2_update_dpp_dto(struct dccg *dccg, int dpp_inst, int req_dppclk)
if (dccg->ref_dppclk && req_dppclk) { if (dccg->ref_dppclk && req_dppclk) {
int ref_dppclk = dccg->ref_dppclk; int ref_dppclk = dccg->ref_dppclk;
int modulo, phase;
ASSERT(req_dppclk <= ref_dppclk); // phase / modulo = dpp pipe clk / dpp global clk
/* need to clamp to 8 bits */ modulo = 0xff; // use FF at the end
if (ref_dppclk > 0xff) { phase = ((modulo * req_dppclk) + ref_dppclk - 1) / ref_dppclk;
int divider = (ref_dppclk + 0xfe) / 0xff;
ref_dppclk /= divider; if (phase > 0xff) {
req_dppclk = (req_dppclk + divider - 1) / divider; ASSERT(false);
if (req_dppclk > ref_dppclk) phase = 0xff;
req_dppclk = ref_dppclk;
} }
REG_SET_2(DPPCLK_DTO_PARAM[dpp_inst], 0, REG_SET_2(DPPCLK_DTO_PARAM[dpp_inst], 0,
DPPCLK0_DTO_PHASE, req_dppclk, DPPCLK0_DTO_PHASE, phase,
DPPCLK0_DTO_MODULO, ref_dppclk); DPPCLK0_DTO_MODULO, modulo);
REG_UPDATE(DPPCLK_DTO_CTRL, REG_UPDATE(DPPCLK_DTO_CTRL,
DPPCLK_DTO_ENABLE[dpp_inst], 1); DPPCLK_DTO_ENABLE[dpp_inst], 1);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment