drm/panel_param: optimize the code
1.Different projects have different features. For example: there are not "ACL" feature for lcd panel. So some feature cmd parse is failed. We only release the struct dsi_panel_cmd_set when parse failed. 2.Must get "panel_hbm_fod" first, then parse param property. Change-Id: If7f4395af70fcc5a775a1178f742773b32ffeaaa Signed-off-by: houdz1 <houdz1@motorola.com> Reviewed-on: https://gerrit.mot.com/1485550 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Shanshan Dai <daiss1@motorola.com> Reviewed-by: Guobin Zhang <zhanggb@motorola.com> Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1509832 Reviewed-by: Hua Tan <tanhua1@motorola.com>
This commit is contained in:
1 parent
2f1e274764
commit
56f1586746
1 file changed
+19
-24
+19
-24
@@ -3672,7 +3672,7 @@ end:
|
||||
}
|
||||
|
||||
static int dsi_panel_parse_param_prop(struct dsi_panel *panel,
|
||||
struct device_node *of_node, u32 param_idx)
|
||||
struct device_node *of_node, u32 panel_idx)
|
||||
{
|
||||
int i, j, rc =0;
|
||||
struct panel_param *param;
|
||||
@@ -3682,8 +3682,11 @@ static int dsi_panel_parse_param_prop(struct dsi_panel *panel,
|
||||
const char *prop;
|
||||
struct dsi_parser_utils *utils = &panel->utils;
|
||||
|
||||
panel->panel_hbm_fod = of_property_read_bool(of_node,
|
||||
"qcom,mdss-dsi-hbm-fod");
|
||||
|
||||
for (i = 0; i < PARAM_ID_NUM; i++) {
|
||||
param = &dsi_panel_param[param_idx][i];
|
||||
param = &dsi_panel_param[panel_idx][i];
|
||||
|
||||
if (!param) {
|
||||
pr_err("Invalid param\n");
|
||||
@@ -3716,16 +3719,24 @@ static int dsi_panel_parse_param_prop(struct dsi_panel *panel,
|
||||
rc = dsi_panel_parse_cmd_sets_sub(param_map->cmds,
|
||||
type, utils);
|
||||
if (rc) {
|
||||
DSI_ERR("panel param cmd %s parsing failed\n",
|
||||
DSI_WARN("panel param cmd %s parsing failed\n",
|
||||
param->param_name);
|
||||
rc = -EINVAL;
|
||||
goto parse_err;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!rc) {
|
||||
param->is_supported = true;
|
||||
DSI_INFO("%s: feature enabled.\n", param->param_name);
|
||||
} else {
|
||||
param->is_supported = false;
|
||||
pr_info("%s: feature disabled.\n", param->param_name);
|
||||
for (j = 0; j < param->val_max; j++) {
|
||||
if (param->val_map[j].cmds) {
|
||||
kfree(param->val_map[j].cmds);
|
||||
param->val_map[j].cmds= NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3734,22 +3745,6 @@ static int dsi_panel_parse_param_prop(struct dsi_panel *panel,
|
||||
if (panel->is_hbm_using_51_cmd)
|
||||
DSI_INFO("HBM command is using 0x51 command\n");
|
||||
|
||||
panel->panel_hbm_fod = of_property_read_bool(of_node,
|
||||
"qcom,mdss-dsi-hbm-fod");
|
||||
|
||||
return rc;
|
||||
|
||||
parse_err:
|
||||
for (i = 0; i < ARRAY_SIZE(dsi_panel_param); i++) {
|
||||
param = &dsi_panel_param[param_idx][i];
|
||||
for (j = 0; j < param->val_max; j++) {
|
||||
if (param->val_map[j].cmds) {
|
||||
kfree(param->val_map[j].cmds);
|
||||
param->val_map[j].cmds= NULL;
|
||||
}
|
||||
}
|
||||
param->is_supported = false;
|
||||
}
|
||||
err:
|
||||
return rc;
|
||||
|
||||
@@ -3851,7 +3846,7 @@ struct dsi_panel *dsi_panel_get(struct device *parent,
|
||||
struct dsi_parser_utils *utils;
|
||||
const char *panel_physical_type;
|
||||
int rc = 0;
|
||||
u32 param_idx = 0; /* Since only panel support for now */
|
||||
u32 panel_idx = 0; /* Since only panel support for now */
|
||||
|
||||
panel = kzalloc(sizeof(*panel), GFP_KERNEL);
|
||||
if (!panel)
|
||||
@@ -3882,8 +3877,8 @@ struct dsi_panel *dsi_panel_get(struct device *parent,
|
||||
if (rc)
|
||||
DSI_DEBUG("failed to parse mot_panel_config, rc = %d\n", rc);
|
||||
|
||||
panel->param_cmds = dsi_panel_param[param_idx];
|
||||
rc = dsi_panel_parse_param_prop(panel, of_node, param_idx );
|
||||
panel->param_cmds = dsi_panel_param[panel_idx];
|
||||
rc = dsi_panel_parse_param_prop(panel, of_node, panel_idx );
|
||||
if (rc)
|
||||
pr_debug("failed to parse panel param prop, rc =%d\n", rc);
|
||||
|
||||
|
||||
Reference in new issue
Block a user