Lines Matching +full:ctrl +full:- +full:module
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
6 #define pr_fmt(fmt) "[drm-dp] %s: " fmt, __func__
9 #include <linux/clk-provider.h>
27 struct regulator_bulk_data *s = power->supplies; in dp_power_regulator_disable()
28 const struct dp_reg_entry *regs = power->parser->regulator_cfg->regs; in dp_power_regulator_disable()
29 int num = power->parser->regulator_cfg->num; in dp_power_regulator_disable()
33 for (i = num - 1; i >= 0; i--) in dp_power_regulator_disable()
43 struct regulator_bulk_data *s = power->supplies; in dp_power_regulator_enable()
44 const struct dp_reg_entry *regs = power->parser->regulator_cfg->regs; in dp_power_regulator_enable()
45 int num = power->parser->regulator_cfg->num; in dp_power_regulator_enable()
70 for (i--; i >= 0; i--) in dp_power_regulator_enable()
77 struct regulator_bulk_data *s = power->supplies; in dp_power_regulator_init()
78 const struct dp_reg_entry *regs = power->parser->regulator_cfg->regs; in dp_power_regulator_init()
79 struct platform_device *pdev = power->pdev; in dp_power_regulator_init()
80 int num = power->parser->regulator_cfg->num; in dp_power_regulator_init()
86 ret = devm_regulator_bulk_get(&pdev->dev, num, s); in dp_power_regulator_init()
99 struct dss_module_power *core, *ctrl, *stream; in dp_power_clk_init() local
100 struct device *dev = &power->pdev->dev; in dp_power_clk_init()
102 core = &power->parser->mp[DP_CORE_PM]; in dp_power_clk_init()
103 ctrl = &power->parser->mp[DP_CTRL_PM]; in dp_power_clk_init()
104 stream = &power->parser->mp[DP_STREAM_PM]; in dp_power_clk_init()
106 rc = msm_dss_get_clk(dev, core->clk_config, core->num_clk); in dp_power_clk_init()
113 rc = msm_dss_get_clk(dev, ctrl->clk_config, ctrl->num_clk); in dp_power_clk_init()
117 msm_dss_put_clk(core->clk_config, core->num_clk); in dp_power_clk_init()
118 return -ENODEV; in dp_power_clk_init()
121 rc = msm_dss_get_clk(dev, stream->clk_config, stream->num_clk); in dp_power_clk_init()
125 msm_dss_put_clk(core->clk_config, core->num_clk); in dp_power_clk_init()
126 return -ENODEV; in dp_power_clk_init()
134 struct dss_module_power *core, *ctrl, *stream; in dp_power_clk_deinit() local
136 core = &power->parser->mp[DP_CORE_PM]; in dp_power_clk_deinit()
137 ctrl = &power->parser->mp[DP_CTRL_PM]; in dp_power_clk_deinit()
138 stream = &power->parser->mp[DP_STREAM_PM]; in dp_power_clk_deinit()
140 if (!core || !ctrl || !stream) { in dp_power_clk_deinit()
142 return -EINVAL; in dp_power_clk_deinit()
145 msm_dss_put_clk(ctrl->clk_config, ctrl->num_clk); in dp_power_clk_deinit()
146 msm_dss_put_clk(core->clk_config, core->num_clk); in dp_power_clk_deinit()
147 msm_dss_put_clk(stream->clk_config, stream->num_clk); in dp_power_clk_deinit()
152 enum dp_pm_type module, bool enable) in dp_power_clk_set_rate() argument
155 struct dss_module_power *mp = &power->parser->mp[module]; in dp_power_clk_set_rate()
158 rc = msm_dss_clk_set_rate(mp->clk_config, mp->num_clk); in dp_power_clk_set_rate()
165 rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, enable); in dp_power_clk_set_rate()
177 return dp_power->core_clks_on; in dp_power_clk_status()
180 return dp_power->link_clks_on; in dp_power_clk_status()
183 return dp_power->stream_clks_on; in dp_power_clk_status()
198 DRM_ERROR("unsupported power module: %s\n", in dp_power_clk_enable()
200 return -EINVAL; in dp_power_clk_enable()
204 if (pm_type == DP_CORE_PM && dp_power->core_clks_on) { in dp_power_clk_enable()
209 if (pm_type == DP_CTRL_PM && dp_power->link_clks_on) { in dp_power_clk_enable()
214 if (pm_type == DP_STREAM_PM && dp_power->stream_clks_on) { in dp_power_clk_enable()
219 if ((pm_type == DP_CTRL_PM) && (!dp_power->core_clks_on)) { in dp_power_clk_enable()
228 dp_power->core_clks_on = true; in dp_power_clk_enable()
241 dp_power->core_clks_on = enable; in dp_power_clk_enable()
243 dp_power->stream_clks_on = enable; in dp_power_clk_enable()
245 dp_power->link_clks_on = enable; in dp_power_clk_enable()
251 dp_power->stream_clks_on ? "on" : "off", in dp_power_clk_enable()
252 dp_power->link_clks_on ? "on" : "off", in dp_power_clk_enable()
253 dp_power->core_clks_on ? "on" : "off"); in dp_power_clk_enable()
265 return -EINVAL; in dp_power_client_init()
270 pm_runtime_enable(&power->pdev->dev); in dp_power_client_init()
286 pm_runtime_disable(&power->pdev->dev); in dp_power_client_init()
302 pm_runtime_disable(&power->pdev->dev); in dp_power_client_deinit()
313 return -EINVAL; in dp_power_init()
318 pm_runtime_get_sync(&power->pdev->dev); in dp_power_init()
336 pm_runtime_put_sync(&power->pdev->dev); in dp_power_init()
348 pm_runtime_put_sync(&power->pdev->dev); in dp_power_deinit()
359 return ERR_PTR(-EINVAL); in dp_power_get()
362 power = devm_kzalloc(&parser->pdev->dev, sizeof(*power), GFP_KERNEL); in dp_power_get()
364 return ERR_PTR(-ENOMEM); in dp_power_get()
366 power->parser = parser; in dp_power_get()
367 power->pdev = parser->pdev; in dp_power_get()
369 dp_power = &power->dp_power; in dp_power_get()