drm/panel/s6e3ha2: handle max brightness specially 65/87565/4
authorAndrzej Hajda <a.hajda@samsung.com>
Thu, 8 Sep 2016 13:39:04 +0000 (15:39 +0200)
committerInki Dae <inki.dae@samsung.com>
Thu, 22 Sep 2016 10:28:13 +0000 (03:28 -0700)
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 4b75a4cb99bf79bdc688c47dcc7b3002d091eb1f..aae9a82eb5d3ab2065fb8e97d316a4f6cc774492 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;