summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorAndrzej Hajda <a.hajda@samsung.com>2016-09-12 12:18:25 +0200
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-12-14 13:52:58 +0900
commit0f88ae686672b2403d82086193e156bf8b2a9234 (patch)
treeec3e8eb92d403d1a92dced40bd640e93de2ec640 /drivers/gpu/drm
parentad12c158746ca46c2eb06947d707e442f2290bca (diff)
drm/panel/s6e3ha2: fix VINT settings
VINT should be set only for s6e3ha2 panel and should depend linearly on nit value. The patch merges also VINT setting for normal and HMT mode. Change-Id: I86383ea6fd1ac84812771c8923483e433698bc18 Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/panel/panel-s6e3ha2.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/gpu/drm/panel/panel-s6e3ha2.c b/drivers/gpu/drm/panel/panel-s6e3ha2.c
index 94fdb95f81b0..29d9471b3bbe 100644
--- a/drivers/gpu/drm/panel/panel-s6e3ha2.c
+++ b/drivers/gpu/drm/panel/panel-s6e3ha2.c
@@ -594,11 +594,6 @@ static const u32 hmt_aor_data[HMT_NITS_COUNT] = {
0x41303, 0x41303, 0x41303, 0x41303, 0x41303, 0x41303,
};
-unsigned char VINT_TABLE[] = {
- 0x18, 0x19, 0x1A, 0x1B, 0x1C,
- 0x1D, 0x1E, 0x1F, 0x20, 0x21
-};
-
enum s6e3ha2_model { MODEL_1440, MODEL_1600 };
struct s6e3ha2 {
@@ -922,10 +917,14 @@ static int s6e3ha2_get_brightness(struct backlight_device *bl_dev)
static void s6e3ha2_set_vint(struct s6e3ha2 *ctx)
{
- int vind = (ARRAY_SIZE(VINT_TABLE) - 1)
- * ctx->bl_dev->props.brightness / MAX_BRIGHTNESS;
+ int nit = ctx->hmt_mode ? hmt_nits[ctx->nit_index]
+ : s6e3ha2_nits[ctx->model][ctx->nit_index];
+ u8 v = clamp(nit, 5, 14) - 5 + 0x18;
+
+ if (ctx->model != MODEL_1440)
+ return;
- s6e3ha2_dcs_write_seq(ctx, LDI_PWRCTL, 0x8b, VINT_TABLE[vind]);
+ s6e3ha2_dcs_write_seq(ctx, LDI_PWRCTL, 0x8b, v);
}
static void s6e3ha2_update_nit_index(struct s6e3ha2 *ctx)
@@ -967,11 +966,6 @@ static void s6e3ha2_update_gamma(struct s6e3ha2 *ctx)
s6e3ha2_dcs_write(ctx, data, ARRAY_SIZE(data));
}
-static void s6e3ha2_set_hmt_vint(struct s6e3ha2 *ctx)
-{
- s6e3ha2_dcs_write_seq_static(ctx, LDI_PWRCTL, 0x8b, 0x21);
-}
-
static void s6e3ha2_set_hmt_brightness(struct s6e3ha2 *ctx)
{
s6e3ha2_test_key_on_f0(ctx);
@@ -980,8 +974,7 @@ static void s6e3ha2_set_hmt_brightness(struct s6e3ha2 *ctx)
s6e3ha2_update_gamma(ctx);
s6e3ha2_aid_control(ctx);
s6e3ha2_set_elvss(ctx);
- if (ctx->model == MODEL_1440)
- s6e3ha2_set_hmt_vint(ctx);
+ s6e3ha2_set_vint(ctx);
s6e3ha2_panel_update(ctx);
s6e3ha2_test_key_off_fc(ctx);