From 122b2e5fd2553a15e6433556206823c9013a5121 Mon Sep 17 00:00:00 2001 From: Andrzej Hajda Date: Thu, 8 Sep 2016 15:39:04 +0200 Subject: [PATCH] drm/panel/s6e3ha2: handle max brightness specially The last nit should be treated specially and should be selected iff max brightness is set. Change-Id: Ifa58b0f6ced9859485ee727eb296415fa50e4cd0 Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/panel/panel-s6e3ha2.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-s6e3ha2.c b/drivers/gpu/drm/panel/panel-s6e3ha2.c index 4b75a4c..aae9a82 100644 --- a/drivers/gpu/drm/panel/panel-s6e3ha2.c +++ b/drivers/gpu/drm/panel/panel-s6e3ha2.c @@ -868,7 +868,12 @@ static void s6e3ha2_update_nit_index(struct s6e3ha2 *ctx) int bri = ctx->bl_dev->props.brightness; const int *nits = ctx->hmt_mode ? hmt_nits : s6e3ha2_nits[ctx->model]; const int count = ctx->hmt_mode ? HMT_NITS_COUNT : S6E3HA2_NITS_COUNT; - int nit, b = 0, e = count, m; + int nit, b = 0, e = count - 1, m; + + if (bri == MAX_BRIGHTNESS) { + ctx->nit_index = e; + return; + } nit = bri * nits[count - 1] / MAX_BRIGHTNESS; -- 2.7.4