Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b223dcf8 authored by Gopikrishnaiah Anandan's avatar Gopikrishnaiah Anandan Committed by Gerrit - the friendly Code Review server
Browse files

mdss: msm: Update dither driver interface



Post processing driver clients can program the dither table in mdp.
If length of the dither table is set to 0, driver will program the
default table. If driver client would like to program the table it needs
to update the length field as per mdp hardware version.

CRs-fixed: 983164
Change-Id: I5e6aaa3d9376884e5ea1fe153cdf2798e3a52d1e
Signed-off-by: default avatarGopikrishnaiah Anandan <agopik@codeaurora.org>
parent a8371783
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -341,6 +341,12 @@ int pp_dither_cache_params_v1_7(struct mdp_dither_cfg_data *config,
		}
		memcpy(v17_cache_data, &v17_usr_config, sizeof(v17_usr_config));
	}
	if (v17_cache_data->len &&
		v17_cache_data->len != MDP_DITHER_DATA_V1_7_SZ) {
		pr_err("invalid dither len %d expected %d\n",
			   v17_cache_data->len, MDP_DITHER_DATA_V1_7_SZ);
		ret = -EINVAL;
	}

dither_config_exit:
	return ret;
+14 −9
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -530,6 +530,7 @@ static int pp_dither_set_config(char __iomem *base_addr,
	u32 data;
	struct mdp_dither_cfg_data *dither_cfg_data = NULL;
	struct mdp_dither_data_v1_7 *dither_data = NULL;
	uint32_t *pdata = NULL;

	if (!base_addr || !cfg_data || !pp_sts) {
		pr_err("invalid params base_addr %p cfg_data %p pp_sts_type %p\n",
@@ -565,23 +566,27 @@ static int pp_dither_set_config(char __iomem *base_addr,

	if ((dither_data->g_y_depth >= DITHER_DEPTH_MAP_INDEX) ||
		(dither_data->b_cb_depth >= DITHER_DEPTH_MAP_INDEX) ||
		(dither_data->r_cr_depth >= DITHER_DEPTH_MAP_INDEX)) {
		pr_err("invalid data for dither, g_y_depth %d y_cb_depth %d r_cr_depth %d\n",
		(dither_data->r_cr_depth >= DITHER_DEPTH_MAP_INDEX) ||
		(dither_data->len > DITHER_MATRIX_INDEX)) {
		pr_err("invalid data for dither, g_y_depth %d y_cb_depth %d r_cr_depth %d\n len %d",
			dither_data->g_y_depth, dither_data->b_cb_depth,
			dither_data->r_cr_depth);
			dither_data->r_cr_depth, dither_data->len);
		return -EINVAL;
	}
	if (!dither_data->len)
		pdata = dither_matrix;
	else
		pdata = dither_data->data;

	data = dither_depth_map[dither_data->g_y_depth];
	data |= dither_depth_map[dither_data->b_cb_depth] << 2;
	data |= dither_depth_map[dither_data->r_cr_depth] << 4;
	data |= dither_cfg_data->mode << 8;
	data |= (dither_data->temporal_en) ? (1  << 8) : 0;
	writel_relaxed(data, base_addr);
	base_addr += DITHER_MATRIX_OFF;
	for (i = 0; i < DITHER_MATRIX_INDEX; i += 4) {
		data = dither_matrix[i] |
			(dither_matrix[i + 1] << 4) |
			(dither_matrix[i + 2] << 8) |
			(dither_matrix[i + 3] << 12);
		data = pdata[i] | (pdata[i + 1] << 4) |
		       (pdata[i + 2] << 8) | (pdata[i + 3] << 12);
		writel_relaxed(data, base_addr);
		base_addr += 4;
	}
+5 −0
Original line number Diff line number Diff line
@@ -969,10 +969,15 @@ struct mdp_pa_cfg_data {
	struct mdp_pa_cfg pa_data;
};

#define MDP_DITHER_DATA_V1_7_SZ 16

struct mdp_dither_data_v1_7 {
	uint32_t g_y_depth;
	uint32_t r_cr_depth;
	uint32_t b_cb_depth;
	uint32_t len;
	uint32_t data[MDP_DITHER_DATA_V1_7_SZ];
	uint32_t temporal_en;
};

struct mdp_dither_cfg_data {