Skip to content

Commit dcb7359

Browse files
flar2DhineshCool
authored andcommitted
drm: msm: kcal: hue, saturation, value and contrast adjustments
1 parent 978c7d9 commit dcb7359

1 file changed

Lines changed: 39 additions & 5 deletions

File tree

drivers/gpu/drm/msm/sde/sde_hw_color_proc_v4.c

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,18 @@
1818
unsigned int kcal_red = 256;
1919
unsigned int kcal_green = 256;
2020
unsigned int kcal_blue = 256;
21+
unsigned int kcal_hue = 0;
22+
unsigned int kcal_sat = 255;
23+
unsigned int kcal_val = 255;
24+
unsigned int kcal_cont = 255;
2125

2226
module_param(kcal_red, uint, 0644);
2327
module_param(kcal_green, uint, 0644);
2428
module_param(kcal_blue, uint, 0644);
29+
module_param(kcal_hue, uint, 0644);
30+
module_param(kcal_sat, uint, 0644);
31+
module_param(kcal_val, uint, 0644);
32+
module_param(kcal_cont, uint, 0644);
2533

2634
static int sde_write_3d_gamut(struct sde_hw_blk_reg_map *hw,
2735
struct drm_msm_3d_gamut *payload, u32 base,
@@ -184,6 +192,7 @@ void sde_setup_dspp_pccv4(struct sde_hw_dspp *ctx, void *cfg)
184192
int i = 0;
185193
int kcal_min = 20;
186194
u32 base = 0;
195+
u32 opcode = 0, local_opcode = 0;
187196

188197
if (!ctx || !cfg) {
189198
DRM_ERROR("invalid param ctx %pK cfg %pK\n", ctx, cfg);
@@ -246,22 +255,47 @@ void sde_setup_dspp_pccv4(struct sde_hw_dspp *ctx, void *cfg)
246255
}
247256

248257
SDE_REG_WRITE(&ctx->hw, base + PCC_C_OFF, coeffs->c);
249-
// ====
250-
// RED
258+
259+
// RED
251260
SDE_REG_WRITE(&ctx->hw, base + PCC_R_OFF,
252261
i == 0 ? (coeffs->r * kcal_red) / 256 : coeffs->r);
253-
// GREEN
262+
// GREEN
254263
SDE_REG_WRITE(&ctx->hw, base + PCC_G_OFF,
255264
i == 1 ? (coeffs->g * kcal_green) / 256 : coeffs->g);
256-
// BLUE
265+
// BLUE
257266
SDE_REG_WRITE(&ctx->hw, base + PCC_B_OFF,
258267
i == 2 ? (coeffs->b * kcal_blue) / 256 : coeffs->b);
259-
// =====
268+
260269
SDE_REG_WRITE(&ctx->hw, base + PCC_RG_OFF, coeffs->rg);
261270
SDE_REG_WRITE(&ctx->hw, base + PCC_RB_OFF, coeffs->rb);
262271
SDE_REG_WRITE(&ctx->hw, base + PCC_GB_OFF, coeffs->gb);
263272
SDE_REG_WRITE(&ctx->hw, base + PCC_RGB_OFF, coeffs->rgb);
264273
}
265274

275+
opcode = SDE_REG_READ(&ctx->hw, ctx->cap->sblk->hsic.base);
276+
277+
// HUE
278+
SDE_REG_WRITE(&ctx->hw, ctx->cap->sblk->hsic.base + PA_HUE_OFF,
279+
kcal_hue & PA_HUE_MASK);
280+
local_opcode |= PA_HUE_EN;
281+
282+
// SATURATION
283+
SDE_REG_WRITE(&ctx->hw, ctx->cap->sblk->hsic.base + PA_SAT_OFF,
284+
kcal_sat & PA_SAT_MASK);
285+
local_opcode |= PA_SAT_EN;
286+
287+
// VALUE
288+
SDE_REG_WRITE(&ctx->hw, ctx->cap->sblk->hsic.base + PA_VAL_OFF,
289+
kcal_val & PA_VAL_MASK);
290+
local_opcode |= PA_VAL_EN;
291+
292+
// CONTRAST
293+
SDE_REG_WRITE(&ctx->hw, ctx->cap->sblk->hsic.base + PA_CONT_OFF,
294+
kcal_cont & PA_CONT_MASK);
295+
local_opcode |= PA_CONT_EN;
296+
297+
opcode |= (local_opcode | PA_EN);
298+
SDE_REG_WRITE(&ctx->hw, ctx->cap->sblk->hsic.base, opcode);
299+
266300
SDE_REG_WRITE(&ctx->hw, ctx->cap->sblk->pcc.base, PCC_EN);
267301
}

0 commit comments

Comments
 (0)