msm: mdss: check lab/ibb regulator before enable
Make sure the LAB/IBB regulators are available before start using them. In addition, fix the regulator_disable error return path. CRs-Fixed: 778471 Change-Id: I0a8c3b1f7f13c2699ad58b9c8302c992d076b89d Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
This commit is contained in:
parent
ec30c547ec
commit
e43e3b4bca
1 changed files with 19 additions and 7 deletions
|
@ -53,12 +53,15 @@ static int mdss_dsi_labibb_vreg_init(struct platform_device *pdev)
|
||||||
ctrl->lab = regulator_get(&pdev->dev, "lab_reg");
|
ctrl->lab = regulator_get(&pdev->dev, "lab_reg");
|
||||||
rc = PTR_RET(ctrl->lab);
|
rc = PTR_RET(ctrl->lab);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
ctrl->lab = NULL;
|
||||||
pr_err("%s: lab_regi get failed.\n", __func__);
|
pr_err("%s: lab_regi get failed.\n", __func__);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
ctrl->ibb = regulator_get(&pdev->dev, "ibb_reg");
|
ctrl->ibb = regulator_get(&pdev->dev, "ibb_reg");
|
||||||
rc = PTR_RET(ctrl->ibb);
|
rc = PTR_RET(ctrl->ibb);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
ctrl->lab = NULL;
|
||||||
|
ctrl->ibb = NULL;
|
||||||
pr_err("%s: ibb_regi get failed.\n", __func__);
|
pr_err("%s: ibb_regi get failed.\n", __func__);
|
||||||
regulator_put(ctrl->lab);
|
regulator_put(ctrl->lab);
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -75,7 +78,7 @@ static int mdss_dsi_labibb_vreg_ctrl(struct mdss_dsi_ctrl_pdata *ctrl,
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (!ctrl->panel_bias_vreg)
|
if (!ctrl->panel_bias_vreg || !ctrl->lab || !ctrl->ibb)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
pr_debug("%s: ndx=%d enable=%d\n", __func__, ctrl->ndx, enable);
|
pr_debug("%s: ndx=%d enable=%d\n", __func__, ctrl->ndx, enable);
|
||||||
|
@ -83,23 +86,32 @@ static int mdss_dsi_labibb_vreg_ctrl(struct mdss_dsi_ctrl_pdata *ctrl,
|
||||||
if (enable) {
|
if (enable) {
|
||||||
rc = regulator_enable(ctrl->lab);
|
rc = regulator_enable(ctrl->lab);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
pr_err("%s: falied at lab\n", __func__);
|
pr_err("%s: enable failed for lab regulator\n",
|
||||||
|
__func__);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
rc = regulator_enable(ctrl->ibb);
|
rc = regulator_enable(ctrl->ibb);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
pr_err("%s: falied at ibb\n", __func__);
|
pr_err("%s: enable failed for ibb regulator\n",
|
||||||
|
__func__);
|
||||||
regulator_disable(ctrl->lab);
|
regulator_disable(ctrl->lab);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
rc = regulator_disable(ctrl->lab);
|
rc = regulator_disable(ctrl->lab);
|
||||||
if (rc)
|
if (rc) {
|
||||||
pr_err("%s: falied at lab\n", __func__);
|
pr_err("%s: disable failed for lab regulator\n",
|
||||||
|
__func__);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
rc = regulator_disable(ctrl->ibb);
|
rc = regulator_disable(ctrl->ibb);
|
||||||
if (rc)
|
if (rc) {
|
||||||
pr_err("%s: falied at ibb\n", __func__);
|
pr_err("%s: disable failed for ibb regulator\n",
|
||||||
|
__func__);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue