From 389458ab76b6501360d52adeb0bb39799007f94e Mon Sep 17 00:00:00 2001 From: Andrzej Hajda Date: Fri, 9 Sep 2016 15:12:42 +0200 Subject: [PATCH] drm/panel/s6e3ha2: refactor temperature setting function Function setting temperature was named incorrectly and split into two functions. The patch fixes it and makes the code more readable. Change-Id: If3588d56b4c5a9aaae833ff84b96ee47171f2bb4 Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/panel/panel-s6e3ha2.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-s6e3ha2.c b/drivers/gpu/drm/panel/panel-s6e3ha2.c index 63643f7..bfc87f8 100644 --- a/drivers/gpu/drm/panel/panel-s6e3ha2.c +++ b/drivers/gpu/drm/panel/panel-s6e3ha2.c @@ -786,14 +786,12 @@ static void s6e3ha2_acl_off_opr(struct s6e3ha2 *ctx) s6e3ha2_dcs_write_seq_static(ctx, LDI_OPRCTL, 0x40); } -static void s6e3ha2_test_global(struct s6e3ha2 *ctx) +static void s6e3ha2_set_temperature(struct s6e3ha2 *ctx, int temp) { - s6e3ha2_dcs_write_seq_static(ctx, LDI_G_PARA, 0x07); -} + s8 t = clamp(temp, -127, 127); -static void s6e3ha2_test(struct s6e3ha2 *ctx) -{ - s6e3ha2_dcs_write_seq_static(ctx, LDI_TSETCTL, 0x19); + s6e3ha2_dcs_write_seq_static(ctx, LDI_G_PARA, 0x07); + s6e3ha2_dcs_write_seq(ctx, LDI_TSETCTL, t); } static void s6e3ha2_touch_hsync_on1(struct s6e3ha2 *ctx) { @@ -1212,10 +1210,7 @@ static int s6e3ha2_enable(struct drm_panel *panel) s6e3ha2_acl_off(ctx); s6e3ha2_acl_off_opr(ctx); s6e3ha2_hbm_off(ctx); - - /* elvss temp compensation */ - s6e3ha2_test_global(ctx); - s6e3ha2_test(ctx); + s6e3ha2_set_temperature(ctx, 25); s6e3ha2_test_key_off_f0(ctx); s6e3ha2_dcs_write_seq_static(ctx, MIPI_DCS_SET_DISPLAY_ON); -- 2.7.4