From 5a2e3355e8b4a0eaf265cfa714da4e07593098c3 Mon Sep 17 00:00:00 2001 From: Clarence Ip Date: Tue, 23 Feb 2016 17:40:48 -0500 Subject: ARM: dts: msm: add the LAB/IBB regulator nodes to panel dtsi Currently, the LAB/IBB regulators to supply power to the panel are controlled in MDSS DSI drivers and the property to enable it is part of MDSS DSI node. This needs to be ideally enabled/controlled through the panel dtsi. Add support to control these regulators similar to the other PMIC LDO regulators via the panel dtsi node for 8994, 8992, 8996 and 8952. Cleanup the existing code in DSI drivers related to LAB/IBB control. Change-Id: Ie504da64f7752625060717dbeb08f8da1c87c98e Signed-off-by: Padmanabhan Komanduru Signed-off-by: Siddhartha Agrawal [cip@codeaurora.org: Removed .dtsi files, replace regulator_set_optimum_mode with regulator_set_load] Signed-off-by: Clarence Ip --- .../devicetree/bindings/fb/mdss-dsi-ctrl.txt | 2 - drivers/video/fbdev/msm/mdss_dsi.c | 109 --------------------- drivers/video/fbdev/msm/mdss_dsi.h | 1 - drivers/video/fbdev/msm/mdss_io_util.c | 21 ++-- 4 files changed, 10 insertions(+), 123 deletions(-) diff --git a/Documentation/devicetree/bindings/fb/mdss-dsi-ctrl.txt b/Documentation/devicetree/bindings/fb/mdss-dsi-ctrl.txt index 38a07a8d1d4b..5d04ee748ac8 100644 --- a/Documentation/devicetree/bindings/fb/mdss-dsi-ctrl.txt +++ b/Documentation/devicetree/bindings/fb/mdss-dsi-ctrl.txt @@ -63,7 +63,6 @@ Optional properties: controller. These pin configurations are installed in the pinctrl device node. Refer to pinctrl-bindings.txt - qcom,regulator-ldo-mode: Boolean to enable ldo mode for the dsi phy regulator -- qcom,dsi-panel-bias-vreg: Boolean to enable control of panel bias regulator - qcom,mmss-ulp-clamp-ctrl-offset: Specifies the offset for dsi ulps clamp control register. - qcom,mmss-phyreset-ctrl-offset: Specifies the offset for dsi phy reset control register. - qcom,dsi-irq-line: Boolean specifies if DSI has a different irq line than mdp. @@ -106,7 +105,6 @@ Example: qcom,platform-enable-gpio = <&msmgpio 58 1>; qcom,platform-bklight-en-gpio = <&msmgpio 86 0>; qcom,platform-mode-gpio = <&msmgpio 7 0>; - qcom,dsi-panel-bias-vreg; qcom,dsi-irq-line; qcom,timing-db-mode; qcom,dsi-clk-ln-recovery; diff --git a/drivers/video/fbdev/msm/mdss_dsi.c b/drivers/video/fbdev/msm/mdss_dsi.c index b2d7843e5a44..ba7c76d6bf33 100644 --- a/drivers/video/fbdev/msm/mdss_dsi.c +++ b/drivers/video/fbdev/msm/mdss_dsi.c @@ -37,87 +37,6 @@ static struct dsi_drv_cm_data shared_ctrl_data; static int mdss_dsi_pinctrl_set_state(struct mdss_dsi_ctrl_pdata *ctrl_pdata, bool active); -static int mdss_dsi_labibb_vreg_init(struct platform_device *pdev) -{ - struct mdss_dsi_ctrl_pdata *ctrl = NULL; - int rc; - - ctrl = platform_get_drvdata(pdev); - if (!ctrl) { - pr_err("%s: invalid driver data\n", __func__); - return -EINVAL; - } - - if (!ctrl->panel_bias_vreg) - return -EINVAL; - - ctrl->lab = regulator_get(&pdev->dev, "lab_reg"); - rc = PTR_RET(ctrl->lab); - if (rc) { - ctrl->lab = NULL; - pr_err("%s: lab_regi get failed.\n", __func__); - return rc; - } - ctrl->ibb = regulator_get(&pdev->dev, "ibb_reg"); - rc = PTR_RET(ctrl->ibb); - if (rc) { - ctrl->lab = NULL; - ctrl->ibb = NULL; - pr_err("%s: ibb_regi get failed.\n", __func__); - regulator_put(ctrl->lab); - return rc; - } - - pr_debug("%s: lab=%p ibb=%p\n", __func__, - ctrl->lab, ctrl->ibb); - - return 0; -} - -static int mdss_dsi_labibb_vreg_ctrl(struct mdss_dsi_ctrl_pdata *ctrl, - int enable) -{ - int rc; - - if (!ctrl->panel_bias_vreg || !ctrl->lab || !ctrl->ibb) - return -EINVAL; - - pr_debug("%s: ndx=%d enable=%d\n", __func__, ctrl->ndx, enable); - - if (enable) { - rc = regulator_enable(ctrl->lab); - if (rc) { - pr_err("%s: enable failed for lab regulator\n", - __func__); - return rc; - } - rc = regulator_enable(ctrl->ibb); - if (rc) { - pr_err("%s: enable failed for ibb regulator\n", - __func__); - regulator_disable(ctrl->lab); - return rc; - } - - } else { - rc = regulator_disable(ctrl->lab); - if (rc) { - pr_err("%s: disable failed for lab regulator\n", - __func__); - return rc; - } - - rc = regulator_disable(ctrl->ibb); - if (rc) { - pr_err("%s: disable failed for ibb regulator\n", - __func__); - return rc; - } - } - - return 0; -} - static int mdss_dsi_regulator_init(struct platform_device *pdev) { int rc = 0; @@ -145,8 +64,6 @@ static int mdss_dsi_regulator_init(struct platform_device *pdev) __func__, __mdss_dsi_pm_name(i)); } - mdss_dsi_labibb_vreg_init(pdev); - return rc; } @@ -173,15 +90,6 @@ static int mdss_dsi_panel_power_off(struct mdss_panel_data *pdata) if (mdss_dsi_pinctrl_set_state(ctrl_pdata, false)) pr_debug("reset disable: pinctrl not enabled\n"); - if (ctrl_pdata->panel_bias_vreg) { - pr_debug("%s: Disabling panel bias vreg. ndx = %d\n", - __func__, ctrl_pdata->ndx); - if (mdss_dsi_labibb_vreg_ctrl(ctrl_pdata, false)) - pr_err("Unable to disable bias vreg\n"); - /* Add delay recommended by panel specs */ - udelay(2000); - } - ret = msm_dss_enable_vreg( ctrl_pdata->power_data[DSI_PANEL_PM].vreg_config, ctrl_pdata->power_data[DSI_PANEL_PM].num_vreg, 0); @@ -215,15 +123,6 @@ static int mdss_dsi_panel_power_on(struct mdss_panel_data *pdata) return ret; } - if (ctrl_pdata->panel_bias_vreg) { - pr_debug("%s: Enable panel bias vreg. ndx = %d\n", - __func__, ctrl_pdata->ndx); - if (mdss_dsi_labibb_vreg_ctrl(ctrl_pdata, true)) - pr_err("Unable to configure bias vreg\n"); - /* Add delay recommended by panel specs */ - udelay(2000); - } - /* * If continuous splash screen feature is enabled, then we need to * request all the GPIOs that have already been configured in the @@ -2208,14 +2107,6 @@ static int mdss_dsi_ctrl_probe(struct platform_device *pdev) } } - /* - * Currently, the Bias vreg is controlled by wled driver. - * Once we have support from pmic driver, implement the - * bias vreg control using the existing vreg apis. - */ - ctrl_pdata->panel_bias_vreg = of_property_read_bool( - pdev->dev.of_node, "qcom,dsi-panel-bias-vreg"); - /* DSI panels can be different between controllers */ rc = mdss_dsi_get_panel_cfg(panel_cfg, ctrl_pdata); if (!rc) diff --git a/drivers/video/fbdev/msm/mdss_dsi.h b/drivers/video/fbdev/msm/mdss_dsi.h index 21ad2e5c115a..8bdf547966d8 100644 --- a/drivers/video/fbdev/msm/mdss_dsi.h +++ b/drivers/video/fbdev/msm/mdss_dsi.h @@ -358,7 +358,6 @@ struct mdss_dsi_ctrl_pdata { int pwm_enabled; int clk_lane_cnt; bool dmap_iommu_map; - bool panel_bias_vreg; bool dsi_irq_line; bool dcs_cmd_insert; atomic_t te_irq_ready; diff --git a/drivers/video/fbdev/msm/mdss_io_util.c b/drivers/video/fbdev/msm/mdss_io_util.c index 63bac3e6b11c..ac39f15f6ff5 100644 --- a/drivers/video/fbdev/msm/mdss_io_util.c +++ b/drivers/video/fbdev/msm/mdss_io_util.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -242,16 +242,15 @@ int msm_dss_enable_vreg(struct dss_vreg *in_vreg, int num_vreg, int enable) } } } else { - for (i = num_vreg-1; i >= 0; i--) - if (regulator_is_enabled(in_vreg[i].vreg)) { - if (in_vreg[i].pre_off_sleep) - msleep(in_vreg[i].pre_off_sleep); - regulator_set_load(in_vreg[i].vreg, - in_vreg[i].disable_load); - regulator_disable(in_vreg[i].vreg); - if (in_vreg[i].post_off_sleep) - msleep(in_vreg[i].post_off_sleep); - } + for (i = num_vreg-1; i >= 0; i--) { + if (in_vreg[i].pre_off_sleep) + msleep(in_vreg[i].pre_off_sleep); + regulator_set_load(in_vreg[i].vreg, + in_vreg[i].disable_load); + regulator_disable(in_vreg[i].vreg); + if (in_vreg[i].post_off_sleep) + msleep(in_vreg[i].post_off_sleep); + } } return rc; -- cgit v1.2.3