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

Commit d12f192d authored by Kuogee Hsieh's avatar Kuogee Hsieh Committed by Matt Wagantall
Browse files

msm: mdss: dsi: add support for DSC command mode panel



Add required register programming in the DSI host driver to support
command mode panels that use Display Stream Compression (DSC) modes.

Change-Id: I316086e929f2424d56097e2f9d63a01de2d3fe8d
Signed-off-by: default avatarKuogee Hsieh <khsieh@codeaurora.org>
parent 3b6ed7a2
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -1818,9 +1818,10 @@ static int mdss_dsi_ctl_partial_roi(struct mdss_panel_data *pdata)

static int mdss_dsi_set_stream_size(struct mdss_panel_data *pdata)
{
	u32 data, idle;
	u32 stream_ctrl, stream_total, idle;
	struct mdss_dsi_ctrl_pdata *ctrl_pdata = NULL;
	struct mdss_panel_info *pinfo;
	struct dsc_desc *dsc = NULL;
	struct mdss_rect *roi;
	struct panel_horizontal_idle *pidle;
	int i;
@@ -1838,18 +1839,28 @@ static int mdss_dsi_set_stream_size(struct mdss_panel_data *pdata)
	if (!pinfo->partial_update_supported)
		return -EINVAL;

	if (pinfo->compression_mode == COMPRESSION_DSC)
		dsc = &pinfo->dsc;

	roi = &pinfo->roi;

	/* DSI_COMMAND_MODE_MDP_STREAM_CTRL */
	data = (((roi->w * 3) + 1) << 16) |
	if (dsc) {
		stream_ctrl = ((dsc->bytes_in_slice + 1) << 16) |
			(pdata->panel_info.mipi.vc << 8) | DTYPE_DCS_LWRITE;
	MIPI_OUTP((ctrl_pdata->ctrl_base) + 0x60, data);
	MIPI_OUTP((ctrl_pdata->ctrl_base) + 0x58, data);
		stream_total = roi->h << 16 | dsc->pclk_per_line;
	} else  {

		stream_ctrl = (((roi->w * 3) + 1) << 16) |
			(pdata->panel_info.mipi.vc << 8) | DTYPE_DCS_LWRITE;
		stream_total = roi->h << 16 | roi->w;
	}
	MIPI_OUTP((ctrl_pdata->ctrl_base) + 0x60, stream_ctrl);
	MIPI_OUTP((ctrl_pdata->ctrl_base) + 0x58, stream_ctrl);

	/* DSI_COMMAND_MODE_MDP_STREAM_TOTAL */
	data = roi->h << 16 | roi->w;
	MIPI_OUTP((ctrl_pdata->ctrl_base) + 0x64, data);
	MIPI_OUTP((ctrl_pdata->ctrl_base) + 0x5C, data);
	MIPI_OUTP((ctrl_pdata->ctrl_base) + 0x64, stream_total);
	MIPI_OUTP((ctrl_pdata->ctrl_base) + 0x5C, stream_total);

	/* set idle control -- dsi clk cycle */
	idle = 0;
+8 −3
Original line number Diff line number Diff line
@@ -1043,9 +1043,9 @@ static void mdss_dsi_dsc_config(struct mdss_dsi_ctrl_pdata *ctrl,

		MIPI_OUTP((ctrl->ctrl_base) +
			MDSS_DSI_COMMAND_COMPRESSION_MODE_CTRL2,
						dsc->bytes_per_pkt);
						dsc->bytes_in_slice);

		data = 0x0b << 8;
		data = DTYPE_DCS_LWRITE << 8;
		data |= (dsc->pkt_per_line - 1) << 6;
		data |= dsc->eol_byte_num << 4;
		data |= 1;	/* enable */
@@ -1135,7 +1135,12 @@ static void mdss_dsi_mode_setup(struct mdss_panel_data *pdata)

		ystride = width * bpp + 1;

		if (pinfo->partial_update_enabled &&
		if (dsc) {
			stream_ctrl = ((dsc->bytes_in_slice + 1) << 16) |
					(mipi->vc << 8) | DTYPE_DCS_LWRITE;
			stream_total = dsc->pic_height << 16 |
							dsc->pclk_per_line;
		} else if (pinfo->partial_update_enabled &&
			mdss_dsi_is_panel_on(pdata) && pinfo->roi.w &&
			pinfo->roi.h) {
			stream_ctrl = (((pinfo->roi.w * bpp) + 1) << 16) |
+4 −12
Original line number Diff line number Diff line
@@ -1036,8 +1036,6 @@ void mdss_dsc_parameters_calc(struct mdss_panel_info *pinfo)
	dsc->max_qp_flatness = 12;
	dsc->min_qp_flatness = 3;

	dsc->pkt_per_line = 1;

	dsc->edge_factor = 6;
	dsc->quant_incr_limit0 = 11;
	dsc->quant_incr_limit1 = 11;
@@ -1071,20 +1069,14 @@ void mdss_dsc_parameters_calc(struct mdss_panel_info *pinfo)
	slice_per_line  = dsc->pic_width / dsc->slice_width;
	bytes_in_slice = CEIL(dsc->pic_width, slice_per_line);

	data = 0;
	bytes_in_slice *= dsc->bpp;	/* compressed */
	if (bytes_in_slice % 8)
		data++;
	bytes_in_slice *= dsc->bpp;	/* bites per compressed pixel */
	bytes_in_slice = CEIL(bytes_in_slice, 8);

	bytes_in_slice /= 8;
	if (data)
		bytes_in_slice++;
	dsc->bytes_in_slice = bytes_in_slice;

	total_bytes = bytes_in_slice * slice_per_line;
	dsc->eol_byte_num = total_bytes % 3;
	dsc->pclk_per_line =  total_bytes / 3;
	if (dsc->eol_byte_num)
		dsc->pclk_per_line++;
	dsc->pclk_per_line =  CEIL(total_bytes, 3);

	dsc->slice_last_group_size = 3 - dsc->eol_byte_num;

+1 −0
Original line number Diff line number Diff line
@@ -401,6 +401,7 @@ struct dsc_desc {
	int chunk_size;

	int pkt_per_line;
	int bytes_in_slice;
	int bytes_per_pkt;
	int eol_byte_num;
	int pclk_per_line;	/* width */