msm: mdss: add scr rev support for dsc

Panels can support different dsc revisions based on the scr.
Add scr revision support for dsc based on updated spec.

Change-Id: Icbd93ed592a7d79dcd7f72b52d73572ced384759
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
This commit is contained in:
Dhaval Patel 2016-03-30 00:22:57 -07:00 committed by Kyle Yan
parent 2e95db147d
commit 76d65e6339
4 changed files with 80 additions and 13 deletions

View file

@ -441,6 +441,12 @@ Optional properites:
- qcom,split-mode: String property indicating which split mode MDP should use. Valid
entries are "pingpong-split" and "dualctl-split".
This property is mutually exclusive with qcom,lm-split.
- qcom,mdss-dsc-version: An 8 bit value indicates the DSC version supported by panel. Bits[0.3]
provides information about minor version while Bits[4.7] provides
major version information. It supports only DSC rev 1(Major).1(Minor)
right now.
- qcom,mdss-dsc-scr-version: Each DSC version can have multiple SCR. This 8 bit value indicates
current SCR revision information supported by panel.
- qcom,mdss-dsc-encoders: An integer value indicating how many DSC encoders should be used
to drive data stream to DSI.
Default value is 1 and max value is 2.
@ -680,6 +686,8 @@ Example:
qcom,config-select = <&dsi_sim_vid_config0>;
qcom,dba-panel;
qcom,bridge-name = "adv7533";
qcom,mdss-dsc-version = <0x11>;
qcom,mdss-dsc-scr-version = <0x1>;
dsi_sim_vid_config0: config0 {
qcom,lm-split = <360 360>;

View file

@ -1089,7 +1089,7 @@ void mdss_dsi_panel_dsc_pps_send(struct mdss_dsi_ctrl_pdata *ctrl,
memset(&cmd, 0, sizeof(cmd));
cmd.dchdr.dlen = mdss_panel_dsc_prepare_pps_buf(&pinfo->dsc,
ctrl->pps_buf, 0 , 1, 0);
ctrl->pps_buf, 0);
cmd.dchdr.dtype = DTYPE_PPS;
cmd.dchdr.last = 1;
cmd.dchdr.wait = 10;
@ -1104,6 +1104,47 @@ void mdss_dsi_panel_dsc_pps_send(struct mdss_dsi_ctrl_pdata *ctrl,
mdss_dsi_panel_cmds_send(ctrl, &pcmds, CMD_REQ_COMMIT);
}
static int mdss_dsi_parse_dsc_version(struct device_node *np,
struct mdss_panel_timing *timing)
{
u32 data;
int rc = 0;
struct dsc_desc *dsc = &timing->dsc;
rc = of_property_read_u32(np, "qcom,mdss-dsc-version", &data);
if (rc) {
dsc->version = 0x11;
rc = 0;
} else {
dsc->version = data & 0xff;
/* only support DSC 1.1 rev */
if (dsc->version != 0x11) {
pr_err("%s: DSC version:%d not supported\n", __func__,
dsc->version);
rc = -EINVAL;
goto end;
}
}
rc = of_property_read_u32(np, "qcom,mdss-dsc-scr-version", &data);
if (rc) {
dsc->scr_rev = 0x0;
rc = 0;
} else {
dsc->scr_rev = data & 0xff;
/* only one scr rev supported */
if (dsc->scr_rev > 0x1) {
pr_err("%s: DSC scr version:%d not supported\n",
__func__, dsc->scr_rev);
rc = -EINVAL;
goto end;
}
}
end:
return rc;
}
static int mdss_dsi_parse_dsc_params(struct device_node *np,
struct mdss_panel_timing *timing, bool is_split_display)
{
@ -1277,11 +1318,16 @@ static int mdss_dsi_parse_topology_config(struct device_node *np,
data = of_get_property(np, "qcom,compression-mode", NULL);
if (data) {
if (cfg_np && !strcmp(data, "dsc"))
if (cfg_np && !strcmp(data, "dsc")) {
rc = mdss_dsi_parse_dsc_version(np, &pt->timing);
if (rc)
goto end;
rc = mdss_dsi_parse_dsc_params(cfg_np, &pt->timing,
is_split_display);
else if (!strcmp(data, "fbc"))
} else if (!strcmp(data, "fbc")) {
rc = mdss_dsi_parse_fbc_params(np, &pt->timing);
}
}
end:

View file

@ -30,10 +30,14 @@
*/
static u32 dsc_rc_buf_thresh[] = {0x0e, 0x1c, 0x2a, 0x38, 0x46, 0x54,
0x62, 0x69, 0x70, 0x77, 0x79, 0x7b, 0x7d, 0x7e};
static char dsc_rc_range_min_qp[] = {0, 0, 1, 1, 3, 3, 3, 3, 3, 3, 5,
static char dsc_rc_range_min_qp_1_1[] = {0, 0, 1, 1, 3, 3, 3, 3, 3, 3, 5,
5, 5, 7, 13};
static char dsc_rc_range_max_qp[] = {4, 4, 5, 6, 7, 7, 7, 8, 9, 10, 11,
static char dsc_rc_range_min_qp_1_1_scr1[] = {0, 0, 1, 1, 3, 3, 3, 3, 3, 3, 5,
5, 5, 9, 12};
static char dsc_rc_range_max_qp_1_1[] = {4, 4, 5, 6, 7, 7, 7, 8, 9, 10, 11,
12, 13, 13, 15};
static char dsc_rc_range_max_qp_1_1_scr1[] = {4, 4, 5, 6, 7, 7, 7, 8, 9, 10, 10,
11, 11, 12, 13};
static char dsc_rc_range_bpg_offset[] = {2, 0, 0, -2, -4, -6, -8, -8,
-8, -10, -10, -12, -12, -12, -12};
@ -668,7 +672,10 @@ void mdss_panel_dsc_parameters_calc(struct dsc_desc *dsc)
int final_value, final_scale;
dsc->rc_model_size = 8192; /* rate_buffer_size */
dsc->first_line_bpg_offset = 12;
if (dsc->version == 0x11 && dsc->scr_rev == 0x1)
dsc->first_line_bpg_offset = 15;
else
dsc->first_line_bpg_offset = 12;
dsc->min_qp_flatness = 3;
dsc->max_qp_flatness = 12;
dsc->line_buf_depth = 9;
@ -680,8 +687,13 @@ void mdss_panel_dsc_parameters_calc(struct dsc_desc *dsc)
dsc->tgt_offset_lo = 3;
dsc->buf_thresh = dsc_rc_buf_thresh;
dsc->range_min_qp = dsc_rc_range_min_qp;
dsc->range_max_qp = dsc_rc_range_max_qp;
if (dsc->version == 0x11 && dsc->scr_rev == 0x1) {
dsc->range_min_qp = dsc_rc_range_min_qp_1_1_scr1;
dsc->range_max_qp = dsc_rc_range_max_qp_1_1_scr1;
} else {
dsc->range_min_qp = dsc_rc_range_min_qp_1_1;
dsc->range_max_qp = dsc_rc_range_max_qp_1_1;
}
dsc->range_bpg_offset = dsc_rc_range_bpg_offset;
bpp = dsc->bpp;
@ -858,14 +870,14 @@ void mdss_panel_dsc_pclk_param_calc(struct dsc_desc *dsc, int intf_width)
}
int mdss_panel_dsc_prepare_pps_buf(struct dsc_desc *dsc, char *buf,
int pps_id, int major, int minor)
int pps_id)
{
char *bp;
char data;
int i, bpp;
bp = buf;
*bp++ = (((major & 0xf) << 4) | (minor & 0xf)); /* pps0 */
*bp++ = (dsc->version & 0xff); /* pps0 */
*bp++ = (pps_id & 0xff); /* pps1 */
bp++; /* pps2, reserved */

View file

@ -441,6 +441,9 @@ enum {
};
struct dsc_desc {
u8 version; /* top 4 bits major and lower 4 bits minor version */
u8 scr_rev; /* 8 bit value for dsc scr revision */
/*
* Following parameters can change per frame if partial update is on
*/
@ -1014,13 +1017,11 @@ void mdss_panel_dsc_pclk_param_calc(struct dsc_desc *dsc, int intf_width);
* @dsc: pointer to DSC structure associated with panel_info
* @buf: buffer that holds PPS
* @pps_id: pps_identifier
* @major: major version of the DSC encoder
* @minot: minor version of the DSC encoder
*
* returns length of the PPS buffer.
*/
int mdss_panel_dsc_prepare_pps_buf(struct dsc_desc *dsc, char *buf,
int pps_id, int major, int minor);
int pps_id);
#ifdef CONFIG_FB_MSM_MDSS
int mdss_panel_debugfs_init(struct mdss_panel_info *panel_info,
char const *panel_name);