aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArchit Taneja <architt@codeaurora.org>2017-07-28 06:47:03 -0400
committerRob Clark <robdclark@gmail.com>2017-08-02 07:53:46 -0400
commitf6be1121ea8aa563f5a651cf5a96742c965a95f7 (patch)
tree9a941c42154d13780f31206467c95f124d8d8f95
parent6ed9ed484d04c2f6db0f68b0a31ef24db27d6454 (diff)
drm/msm/dsi: Set up runtime PM for DSI
Call the pm_runtime_get/put API where we need the clocks enabled. The main entry/exit points are 1) enabling/disabling the DSI bridge and 2) Sending commands from the DSI host to the device. Signed-off-by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r--drivers/gpu/drm/msm/dsi/dsi_host.c11
-rw-r--r--drivers/gpu/drm/msm/dsi/phy/dsi_phy.c2
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index c7b612c3d771..da0913a33ca0 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -221,6 +221,8 @@ static const struct msm_dsi_cfg_handler *dsi_get_config(
221 goto put_gdsc; 221 goto put_gdsc;
222 } 222 }
223 223
224 pm_runtime_get_sync(dev);
225
224 ret = regulator_enable(gdsc_reg); 226 ret = regulator_enable(gdsc_reg);
225 if (ret) { 227 if (ret) {
226 pr_err("%s: unable to enable gdsc\n", __func__); 228 pr_err("%s: unable to enable gdsc\n", __func__);
@@ -247,6 +249,7 @@ disable_clks:
247 clk_disable_unprepare(ahb_clk); 249 clk_disable_unprepare(ahb_clk);
248disable_gdsc: 250disable_gdsc:
249 regulator_disable(gdsc_reg); 251 regulator_disable(gdsc_reg);
252 pm_runtime_put_autosuspend(dev);
250put_clk: 253put_clk:
251 clk_put(ahb_clk); 254 clk_put(ahb_clk);
252put_gdsc: 255put_gdsc:
@@ -1713,6 +1716,8 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi)
1713 goto fail; 1716 goto fail;
1714 } 1717 }
1715 1718
1719 pm_runtime_enable(&pdev->dev);
1720
1716 msm_host->cfg_hnd = dsi_get_config(msm_host); 1721 msm_host->cfg_hnd = dsi_get_config(msm_host);
1717 if (!msm_host->cfg_hnd) { 1722 if (!msm_host->cfg_hnd) {
1718 ret = -EINVAL; 1723 ret = -EINVAL;
@@ -1786,6 +1791,8 @@ void msm_dsi_host_destroy(struct mipi_dsi_host *host)
1786 mutex_destroy(&msm_host->clk_mutex); 1791 mutex_destroy(&msm_host->clk_mutex);
1787 mutex_destroy(&msm_host->cmd_mutex); 1792 mutex_destroy(&msm_host->cmd_mutex);
1788 mutex_destroy(&msm_host->dev_mutex); 1793 mutex_destroy(&msm_host->dev_mutex);
1794
1795 pm_runtime_disable(&msm_host->pdev->dev);
1789} 1796}
1790 1797
1791int msm_dsi_host_modeset_init(struct mipi_dsi_host *host, 1798int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
@@ -1881,6 +1888,7 @@ int msm_dsi_host_xfer_prepare(struct mipi_dsi_host *host,
1881 * mdss interrupt is generated in mdp core clock domain 1888 * mdss interrupt is generated in mdp core clock domain
1882 * mdp clock need to be enabled to receive dsi interrupt 1889 * mdp clock need to be enabled to receive dsi interrupt
1883 */ 1890 */
1891 pm_runtime_get_sync(&msm_host->pdev->dev);
1884 dsi_clk_ctrl(msm_host, 1); 1892 dsi_clk_ctrl(msm_host, 1);
1885 1893
1886 /* TODO: vote for bus bandwidth */ 1894 /* TODO: vote for bus bandwidth */
@@ -1912,6 +1920,7 @@ void msm_dsi_host_xfer_restore(struct mipi_dsi_host *host,
1912 /* TODO: unvote for bus bandwidth */ 1920 /* TODO: unvote for bus bandwidth */
1913 1921
1914 dsi_clk_ctrl(msm_host, 0); 1922 dsi_clk_ctrl(msm_host, 0);
1923 pm_runtime_put_autosuspend(&msm_host->pdev->dev);
1915} 1924}
1916 1925
1917int msm_dsi_host_cmd_tx(struct mipi_dsi_host *host, 1926int msm_dsi_host_cmd_tx(struct mipi_dsi_host *host,
@@ -2217,6 +2226,7 @@ int msm_dsi_host_power_on(struct mipi_dsi_host *host,
2217 goto unlock_ret; 2226 goto unlock_ret;
2218 } 2227 }
2219 2228
2229 pm_runtime_get_sync(&msm_host->pdev->dev);
2220 ret = dsi_clk_ctrl(msm_host, 1); 2230 ret = dsi_clk_ctrl(msm_host, 1);
2221 if (ret) { 2231 if (ret) {
2222 pr_err("%s: failed to enable clocks. ret=%d\n", __func__, ret); 2232 pr_err("%s: failed to enable clocks. ret=%d\n", __func__, ret);
@@ -2269,6 +2279,7 @@ int msm_dsi_host_power_off(struct mipi_dsi_host *host)
2269 pinctrl_pm_select_sleep_state(&msm_host->pdev->dev); 2279 pinctrl_pm_select_sleep_state(&msm_host->pdev->dev);
2270 2280
2271 dsi_clk_ctrl(msm_host, 0); 2281 dsi_clk_ctrl(msm_host, 0);
2282 pm_runtime_put_autosuspend(&msm_host->pdev->dev);
2272 2283
2273 dsi_host_regulator_disable(msm_host); 2284 dsi_host_regulator_disable(msm_host);
2274 2285
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index 0c2eb9c9a1fc..7c9bf91bc22b 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -373,7 +373,7 @@ static int dsi_phy_enable_resource(struct msm_dsi_phy *phy)
373static void dsi_phy_disable_resource(struct msm_dsi_phy *phy) 373static void dsi_phy_disable_resource(struct msm_dsi_phy *phy)
374{ 374{
375 clk_disable_unprepare(phy->ahb_clk); 375 clk_disable_unprepare(phy->ahb_clk);
376 pm_runtime_put_sync(&phy->pdev->dev); 376 pm_runtime_put_autosuspend(&phy->pdev->dev);
377} 377}
378 378
379static const struct of_device_id dsi_phy_dt_match[] = { 379static const struct of_device_id dsi_phy_dt_match[] = {