summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hajda <a.hajda@samsung.com>2016-09-13 08:54:45 +0200
committerInki Dae <inki.dae@samsung.com>2016-09-22 03:31:07 -0700
commitaaafdc9f576798d1c03c5f3ef76d5a1a9f02a8b3 (patch)
treeebb273b0f04f028d7cba544a387dd9228c392080
parent88d1f12c3ead3e953ac9a0325188bdc7fea9a955 (diff)
downloadlinux-exynos-aaafdc9f576798d1c03c5f3ef76d5a1a9f02a8b3.tar.gz
linux-exynos-aaafdc9f576798d1c03c5f3ef76d5a1a9f02a8b3.tar.bz2
linux-exynos-aaafdc9f576798d1c03c5f3ef76d5a1a9f02a8b3.zip
drm/panel/s6e3ha2: store nit array pointers in context
Nit arrays are often used by the driver, storing their pointers in the context simplifies code. Change-Id: I88700800367112002b57dec2cc066b38a84a7511 Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
-rw-r--r--drivers/gpu/drm/panel/panel-s6e3ha2.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/gpu/drm/panel/panel-s6e3ha2.c b/drivers/gpu/drm/panel/panel-s6e3ha2.c
index 5aed94688721..a9ddbbea00e9 100644
--- a/drivers/gpu/drm/panel/panel-s6e3ha2.c
+++ b/drivers/gpu/drm/panel/panel-s6e3ha2.c
@@ -627,6 +627,8 @@ struct s6e3ha2 {
*/
struct mutex lock;
+ const int *nits[2];
+ int nits_count[2];
int nit_index;
u8 gammodes[S6E3HA2_NITS_COUNT][DAID_PARAM_COUNT];
u8 hmt_gammodes[HMT_NITS_COUNT][DAID_PARAM_COUNT];
@@ -764,8 +766,7 @@ static void s6e3ha2_aid_control(struct s6e3ha2 *ctx)
static void s6e3ha2_set_elvss(struct s6e3ha2 *ctx)
{
- int nit = ctx->hmt_mode ? hmt_nits[ctx->nit_index]
- : s6e3ha2_nits[ctx->model][ctx->nit_index], i;
+ int nit = ctx->nits[ctx->hmt_mode][ctx->nit_index], i;
u8 mps_con = nit < 20 ? 0x8c : 0x9c;
static const int nits[] = {
@@ -917,8 +918,7 @@ static int s6e3ha2_get_brightness(struct backlight_device *bl_dev)
static void s6e3ha2_set_vint(struct s6e3ha2 *ctx)
{
- int nit = ctx->hmt_mode ? hmt_nits[ctx->nit_index]
- : s6e3ha2_nits[ctx->model][ctx->nit_index];
+ int nit = ctx->nits[ctx->hmt_mode][ctx->nit_index];
u8 v = clamp(nit, 5, 14) - 5 + 0x18;
if (ctx->model != MODEL_1440)
@@ -930,8 +930,8 @@ static void s6e3ha2_set_vint(struct s6e3ha2 *ctx)
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;
+ const int *nits = ctx->nits[ctx->hmt_mode];
+ const int count = ctx->nits_count[ctx->hmt_mode];
int nit, b = 0, e = count - 1, m;
if (bri == MAX_BRIGHTNESS) {
@@ -1471,6 +1471,11 @@ static int s6e3ha2_probe(struct mipi_dsi_device *dsi)
if (ret < 0)
return ret;
+ ctx->nits[0] = s6e3ha2_nits[ctx->model];
+ ctx->nits[1] = hmt_nits;
+ ctx->nits_count[0] = S6E3HA2_NITS_COUNT;
+ ctx->nits_count[1] = HMT_NITS_COUNT;
+
ctx->supplies[0].supply = "vdd3";
ctx->supplies[1].supply = "vci";