drm/panel/s6e3ha2: handle max brightness specially
authorAndrzej Hajda <a.hajda@samsung.com>
Thu, 8 Sep 2016 13:39:04 +0000 (15:39 +0200)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 14 Dec 2016 04:52:53 +0000 (13:52 +0900)
The last nit should be treated specially and should be selected
iff max brightness is set.

Change-Id: Ifa58b0f6ced9859485ee727eb296415fa50e4cd0
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
drivers/gpu/drm/panel/panel-s6e3ha2.c

index 4b75a4c..aae9a82 100644 (file)
@@ -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;