Skip to content

Commit 862f3de

Browse files
tbaldenDhineshCool
authored andcommitted
kcal: sde_hw: color proc v4: add RGB bias
Implement the RGB control part of kcal in new sde driver. Color mask bias can be applied at the points identified. Add internal values to be hooked for sysfs or other means of control. original concept: @savoca kernel 4.9 / sde_hw: @tbalden
1 parent 2c2083a commit 862f3de

1 file changed

Lines changed: 38 additions & 2 deletions

File tree

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

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
2+
* Copyright (c) 2018, Pal Zoltan Illes (tbalden) - kcal rgb
23
*
34
* This program is free software; you can redistribute it and/or modify
45
* it under the terms of the GNU General Public License version 2 and
@@ -173,12 +174,20 @@ void sde_setup_dspp_pccv4(struct sde_hw_dspp *ctx, void *cfg)
173174
struct drm_msm_pcc_coeff *coeffs = NULL;
174175
int i = 0;
175176
u32 base = 0;
177+
#if 1
178+
int enable = 0, r=255,g=255,b=255, min = 20;
179+
#endif
176180

177181
if (!ctx || !cfg) {
178182
DRM_ERROR("invalid param ctx %pK cfg %pK\n", ctx, cfg);
179183
return;
180184
}
181-
185+
#if 1
186+
pr_info("%s [CLEANSLATE] kcal setup... \n",__func__);
187+
if (r<min) r= min;
188+
if (g<min) g= min;
189+
if (b<min) b= min;
190+
#endif
182191
if (!hw_cfg->payload) {
183192
DRM_DEBUG_DRIVER("disable pcc feature\n");
184193
SDE_REG_WRITE(&ctx->hw, ctx->cap->sblk->pcc.base, 0);
@@ -192,7 +201,6 @@ void sde_setup_dspp_pccv4(struct sde_hw_dspp *ctx, void *cfg)
192201
}
193202

194203
pcc_cfg = hw_cfg->payload;
195-
196204
for (i = 0; i < PCC_NUM_PLANES; i++) {
197205
base = ctx->cap->sblk->pcc.base + (i * sizeof(u32));
198206
switch (i) {
@@ -229,13 +237,41 @@ void sde_setup_dspp_pccv4(struct sde_hw_dspp *ctx, void *cfg)
229237
}
230238

231239
SDE_REG_WRITE(&ctx->hw, base + PCC_C_OFF, coeffs->c);
240+
// ====
241+
// RED
242+
#if 1
243+
if (enable && i==0) {
244+
SDE_REG_WRITE(&ctx->hw, base + PCC_R_OFF, (coeffs->r * r)/256);
245+
pr_info("%s [CLEANSLATE] kcal r = %d\n",__func__,(coeffs->r * r)/256);
246+
} else
247+
#endif
232248
SDE_REG_WRITE(&ctx->hw, base + PCC_R_OFF, coeffs->r);
249+
// GREEN
250+
#if 1
251+
if (enable && i==1) {
252+
SDE_REG_WRITE(&ctx->hw, base + PCC_G_OFF, (coeffs->g * g)/256);
253+
pr_info("%s [CLEANSLATE] kcal g = %d\n",__func__,(coeffs->g * g)/256);
254+
} else
255+
#endif
233256
SDE_REG_WRITE(&ctx->hw, base + PCC_G_OFF, coeffs->g);
257+
// BLUE
258+
#if 1
259+
if (enable && i==2) {
260+
SDE_REG_WRITE(&ctx->hw, base + PCC_B_OFF, (coeffs->b * b)/256);
261+
pr_info("%s [CLEANSLATE] kcal b = %d\n",__func__,(coeffs->b * b)/256);
262+
} else
263+
#endif
234264
SDE_REG_WRITE(&ctx->hw, base + PCC_B_OFF, coeffs->b);
265+
// =====
235266
SDE_REG_WRITE(&ctx->hw, base + PCC_RG_OFF, coeffs->rg);
236267
SDE_REG_WRITE(&ctx->hw, base + PCC_RB_OFF, coeffs->rb);
237268
SDE_REG_WRITE(&ctx->hw, base + PCC_GB_OFF, coeffs->gb);
238269
SDE_REG_WRITE(&ctx->hw, base + PCC_RGB_OFF, coeffs->rgb);
270+
#if 0
271+
pr_info("%s [CLEANSLATE] kcal setup... drm_msm_pcc i %d r %d (rg %d) r_rr %d r_gg %d r_bb %d \n",__func__, i, coeffs->r, coeffs->rg, pcc_cfg->r_rr, pcc_cfg->r_gg, pcc_cfg->r_bb);
272+
pr_info("%s [CLEANSLATE] kcal setup... drm_msm_pcc i %d g %d (rb %d) g_rr %d g_gg %d g_bb %d \n",__func__, i, coeffs->g, coeffs->rb, pcc_cfg->g_rr, pcc_cfg->g_gg, pcc_cfg->g_bb);
273+
pr_info("%s [CLEANSLATE] kcal setup... drm_msm_pcc i %d b %d (gb %d rgb %d) b_rr %d b_gg %d b_bb %d \n",__func__, i, coeffs->b, coeffs->gb, coeffs->rgb, pcc_cfg->b_rr, pcc_cfg->b_gg, pcc_cfg->b_bb);
274+
#endif
239275
}
240276

241277
SDE_REG_WRITE(&ctx->hw, ctx->cap->sblk->pcc.base, PCC_EN);

0 commit comments

Comments
 (0)