Merge "msm: mdss: update panel info node with dynamic fps parameters"

This commit is contained in:
Linux Build Service Account 2015-06-09 06:14:07 -07:00 committed by Gerrit - the friendly Code Review server
commit cdd249909d
6 changed files with 104 additions and 53 deletions

View file

@ -129,6 +129,10 @@ Optional properties:
"dfps_immediate_porch_mode" = FPS change request is
implemented immediately by changing panel porch
values.
- qcom,min-refresh-rate: Minimum refresh rate supported by the panel.
- qcom,max-refresh-rate: Maximum refresh rate supported by the panel. If max refresh
rate is not specified, then the frame rate of the panel in
qcom,mdss-dsi-panel-framerate is used.
- qcom,mdss-dsi-bl-pmic-control-type: A string that specifies the implementation of backlight
control for this panel.
"bl_ctrl_pwm" = Backlight controlled by PWM gpio.
@ -409,6 +413,8 @@ Example:
qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_wled";
qcom,mdss-dsi-pan-enable-dynamic-fps;
qcom,mdss-dsi-pan-fps-update = "dfps_suspend_resume_mode";
qcom,min-refresh-rate = <30>;
qcom,max-refresh-rate = <60>;
qcom,mdss-dsi-bl-pmic-bank-select = <0>;
qcom,mdss-dsi-bl-pmic-pwm-frequency = <0>;
qcom,mdss-dsi-pwm-gpio = <&pm8941_mpps 5 0>;

View file

@ -1393,7 +1393,6 @@ int dsi_panel_device_register(struct device_node *pan_node,
int rc, i, len;
struct device_node *dsi_ctrl_np = NULL;
struct platform_device *ctrl_pdev = NULL;
bool dynamic_fps;
const char *data;
struct mdss_panel_info *pinfo = &(ctrl_pdata->panel_data.panel_info);
@ -1474,49 +1473,6 @@ int dsi_panel_device_register(struct device_node *pan_node,
ctrl_pdata->shared_pdata.broadcast_enable = of_property_read_bool(
pan_node, "qcom,mdss-dsi-panel-broadcast-mode");
dynamic_fps = of_property_read_bool(pan_node,
"qcom,mdss-dsi-pan-enable-dynamic-fps");
if (dynamic_fps) {
pinfo->dynamic_fps = true;
data = of_get_property(pan_node,
"qcom,mdss-dsi-pan-fps-update", NULL);
if (data) {
if (!strcmp(data, "dfps_suspend_resume_mode")) {
pinfo->dfps_update =
DFPS_SUSPEND_RESUME_MODE;
pr_debug("%s: dfps mode: suspend/resume\n",
__func__);
} else if (!strcmp(data,
"dfps_immediate_clk_mode")) {
pinfo->dfps_update =
DFPS_IMMEDIATE_CLK_UPDATE_MODE;
pr_debug("%s: dfps mode: Immediate clk\n",
__func__);
} else if (!strcmp(data,
"dfps_immediate_porch_mode")) {
pinfo->dfps_update =
DFPS_IMMEDIATE_PORCH_UPDATE_MODE;
pr_debug("%s: dfps mode: Immediate porch\n",
__func__);
} else {
pr_debug("%s: dfps to default mode\n",
__func__);
pinfo->dfps_update =
DFPS_SUSPEND_RESUME_MODE;
pr_debug("%s: dfps mode: suspend/resume\n",
__func__);
}
} else {
pr_debug("%s: dfps update mode not configured\n",
__func__);
pinfo->dynamic_fps =
false;
pr_debug("%s: dynamic FPS disabled\n",
__func__);
}
pinfo->new_fps = pinfo->mipi.frame_rate;
}
pinfo->panel_max_fps = mdss_panel_get_framerate(pinfo);
pinfo->panel_max_vtotal = mdss_panel_get_vtotal(pinfo);
ctrl_pdata->disp_en_gpio = of_get_named_gpio(ctrl_pdev->dev.of_node,

View file

@ -26,6 +26,8 @@
#define DT_CMD_HDR 6
#define MIN_REFRESH_RATE 30
DEFINE_LED_TRIGGER(bl_led_trigger);
void mdss_dsi_panel_pwm_cfg(struct mdss_dsi_ctrl_pdata *ctrl)
@ -861,6 +863,85 @@ static int mdss_dsi_parse_panel_features(struct device_node *np,
return 0;
}
static int mdss_dsi_set_refresh_rate_range(struct device_node *pan_node,
struct mdss_panel_info *pinfo)
{
int rc = 0;
rc = of_property_read_u32(pan_node,
"qcom,mdss-dsi-min-refresh-rate",
&pinfo->min_fps);
if (rc) {
pr_warn("%s:%d, Unable to read min refresh rate\n",
__func__, __LINE__);
/*
* Since min refresh rate is not specified when dynamic
* fps is enabled, using minimum as 30
*/
pinfo->min_fps = MIN_REFRESH_RATE;
rc = 0;
}
rc = of_property_read_u32(pan_node,
"qcom,mdss-dsi-max-refresh-rate",
&pinfo->max_fps);
if (rc) {
pr_warn("%s:%d, Unable to read max refresh rate\n",
__func__, __LINE__);
/*
* Since max refresh rate was not specified when dynamic
* fps is enabled, using the default panel refresh rate
* as max refresh rate supported.
*/
pinfo->max_fps = pinfo->mipi.frame_rate;
rc = 0;
}
pr_info("dyn_fps: min = %d, max = %d\n",
pinfo->min_fps, pinfo->max_fps);
return rc;
}
static void mdss_dsi_parse_dfps_config(struct device_node *pan_node,
struct mdss_dsi_ctrl_pdata *ctrl_pdata)
{
const char *data;
bool dynamic_fps;
struct mdss_panel_info *pinfo = &(ctrl_pdata->panel_data.panel_info);
dynamic_fps = of_property_read_bool(pan_node,
"qcom,mdss-dsi-pan-enable-dynamic-fps");
if (!dynamic_fps)
return;
pinfo->dynamic_fps = true;
data = of_get_property(pan_node, "qcom,mdss-dsi-pan-fps-update", NULL);
if (data) {
if (!strcmp(data, "dfps_suspend_resume_mode")) {
pinfo->dfps_update = DFPS_SUSPEND_RESUME_MODE;
pr_debug("dfps mode: suspend/resume\n");
} else if (!strcmp(data, "dfps_immediate_clk_mode")) {
pinfo->dfps_update = DFPS_IMMEDIATE_CLK_UPDATE_MODE;
pr_debug("dfps mode: Immediate clk\n");
} else if (!strcmp(data, "dfps_immediate_porch_mode")) {
pinfo->dfps_update = DFPS_IMMEDIATE_PORCH_UPDATE_MODE;
pr_debug("dfps mode: Immediate porch\n");
} else {
pinfo->dfps_update = DFPS_SUSPEND_RESUME_MODE;
pr_debug("default dfps mode: suspend/resume\n");
}
mdss_dsi_set_refresh_rate_range(pan_node, pinfo);
} else {
pinfo->dynamic_fps = false;
pr_debug("dfps update mode not configured: disable\n");
}
pinfo->new_fps = pinfo->mipi.frame_rate;
return;
}
static int mdss_panel_parse_dt(struct device_node *np,
struct mdss_dsi_ctrl_pdata *ctrl_pdata)
{
@ -1169,6 +1250,8 @@ static int mdss_panel_parse_dt(struct device_node *np,
goto error;
}
mdss_dsi_parse_dfps_config(np, ctrl_pdata);
return 0;
error:

View file

@ -415,11 +415,13 @@ static ssize_t mdss_fb_get_panel_info(struct device *dev,
ret = scnprintf(buf, PAGE_SIZE,
"pu_en=%d\nxstart=%d\nwalign=%d\nystart=%d\nhalign=%d\n"
"min_w=%d\nmin_h=%d",
"min_w=%d\nmin_h=%d\ndyn_fps_en=%d\nmin_fps=%d\n"
"max_fps=%d\n",
pinfo->partial_update_enabled, pinfo->xstart_pix_align,
pinfo->width_pix_align, pinfo->ystart_pix_align,
pinfo->height_pix_align, pinfo->min_width,
pinfo->min_height);
pinfo->min_height, pinfo->dynamic_fps,
pinfo->min_fps, pinfo->max_fps);
return ret;
}

View file

@ -1982,13 +1982,15 @@ static ssize_t dynamic_fps_sysfs_wta_dfps(struct device *dev,
}
mutex_lock(&mdp5_data->dfps_lock);
if (dfps < 30) {
pr_err("Unsupported FPS. Configuring to min_fps = 30\n");
dfps = 30;
rc = mdss_mdp_ctl_update_fps(mdp5_data->ctl, dfps);
} else if (dfps > 60) {
pr_err("Unsupported FPS. Configuring to max_fps = 60\n");
dfps = 60;
if (dfps < pdata->panel_info.min_fps) {
pr_err("Unsupported FPS. min_fps = %d\n",
pdata->panel_info.min_fps);
mutex_unlock(&mdp5_data->dfps_lock);
return -EINVAL;
} else if (dfps > pdata->panel_info.max_fps) {
pr_warn("Unsupported FPS. Configuring to max_fps = %d\n",
pdata->panel_info.max_fps);
dfps = pdata->panel_info.max_fps;
rc = mdss_mdp_ctl_update_fps(mdp5_data->ctl, dfps);
} else {
rc = mdss_mdp_ctl_update_fps(mdp5_data->ctl, dfps);

View file

@ -339,6 +339,8 @@ struct mdss_panel_info {
u32 height_pix_align;
u32 min_width;
u32 min_height;
u32 min_fps;
u32 max_fps;
u32 cont_splash_enabled;
u32 partial_update_enabled;