Lines Matching full:dcss
16 #include "dcss-dev.h"
17 #include "dcss-kms.h"
19 static void dcss_clocks_enable(struct dcss_dev *dcss) in dcss_clocks_enable() argument
21 clk_prepare_enable(dcss->axi_clk); in dcss_clocks_enable()
22 clk_prepare_enable(dcss->apb_clk); in dcss_clocks_enable()
23 clk_prepare_enable(dcss->rtrm_clk); in dcss_clocks_enable()
24 clk_prepare_enable(dcss->dtrc_clk); in dcss_clocks_enable()
25 clk_prepare_enable(dcss->pix_clk); in dcss_clocks_enable()
28 static void dcss_clocks_disable(struct dcss_dev *dcss) in dcss_clocks_disable() argument
30 clk_disable_unprepare(dcss->pix_clk); in dcss_clocks_disable()
31 clk_disable_unprepare(dcss->dtrc_clk); in dcss_clocks_disable()
32 clk_disable_unprepare(dcss->rtrm_clk); in dcss_clocks_disable()
33 clk_disable_unprepare(dcss->apb_clk); in dcss_clocks_disable()
34 clk_disable_unprepare(dcss->axi_clk); in dcss_clocks_disable()
39 struct dcss_dev *dcss = data; in dcss_disable_dtg_and_ss_cb() local
41 dcss->disable_callback = NULL; in dcss_disable_dtg_and_ss_cb()
43 dcss_ss_shutoff(dcss->ss); in dcss_disable_dtg_and_ss_cb()
44 dcss_dtg_shutoff(dcss->dtg); in dcss_disable_dtg_and_ss_cb()
46 complete(&dcss->disable_completion); in dcss_disable_dtg_and_ss_cb()
49 void dcss_disable_dtg_and_ss(struct dcss_dev *dcss) in dcss_disable_dtg_and_ss() argument
51 dcss->disable_callback = dcss_disable_dtg_and_ss_cb; in dcss_disable_dtg_and_ss()
54 void dcss_enable_dtg_and_ss(struct dcss_dev *dcss) in dcss_enable_dtg_and_ss() argument
56 if (dcss->disable_callback) in dcss_enable_dtg_and_ss()
57 dcss->disable_callback = NULL; in dcss_enable_dtg_and_ss()
59 dcss_dtg_enable(dcss->dtg); in dcss_enable_dtg_and_ss()
60 dcss_ss_enable(dcss->ss); in dcss_enable_dtg_and_ss()
63 static int dcss_submodules_init(struct dcss_dev *dcss) in dcss_submodules_init() argument
66 u32 base_addr = dcss->start_addr; in dcss_submodules_init()
67 const struct dcss_type_data *devtype = dcss->devtype; in dcss_submodules_init()
69 dcss_clocks_enable(dcss); in dcss_submodules_init()
71 ret = dcss_blkctl_init(dcss, base_addr + devtype->blkctl_ofs); in dcss_submodules_init()
75 ret = dcss_ctxld_init(dcss, base_addr + devtype->ctxld_ofs); in dcss_submodules_init()
79 ret = dcss_dtg_init(dcss, base_addr + devtype->dtg_ofs); in dcss_submodules_init()
83 ret = dcss_ss_init(dcss, base_addr + devtype->ss_ofs); in dcss_submodules_init()
87 ret = dcss_dpr_init(dcss, base_addr + devtype->dpr_ofs); in dcss_submodules_init()
91 ret = dcss_scaler_init(dcss, base_addr + devtype->scaler_ofs); in dcss_submodules_init()
95 dcss_clocks_disable(dcss); in dcss_submodules_init()
100 dcss_dpr_exit(dcss->dpr); in dcss_submodules_init()
103 dcss_ss_exit(dcss->ss); in dcss_submodules_init()
106 dcss_dtg_exit(dcss->dtg); in dcss_submodules_init()
109 dcss_ctxld_exit(dcss->ctxld); in dcss_submodules_init()
112 dcss_clocks_disable(dcss); in dcss_submodules_init()
117 static void dcss_submodules_stop(struct dcss_dev *dcss) in dcss_submodules_stop() argument
119 dcss_clocks_enable(dcss); in dcss_submodules_stop()
120 dcss_scaler_exit(dcss->scaler); in dcss_submodules_stop()
121 dcss_dpr_exit(dcss->dpr); in dcss_submodules_stop()
122 dcss_ss_exit(dcss->ss); in dcss_submodules_stop()
123 dcss_dtg_exit(dcss->dtg); in dcss_submodules_stop()
124 dcss_ctxld_exit(dcss->ctxld); in dcss_submodules_stop()
125 dcss_clocks_disable(dcss); in dcss_submodules_stop()
128 static int dcss_clks_init(struct dcss_dev *dcss) in dcss_clks_init() argument
135 {"apb", &dcss->apb_clk}, in dcss_clks_init()
136 {"axi", &dcss->axi_clk}, in dcss_clks_init()
137 {"pix", &dcss->pix_clk}, in dcss_clks_init()
138 {"rtrm", &dcss->rtrm_clk}, in dcss_clks_init()
139 {"dtrc", &dcss->dtrc_clk}, in dcss_clks_init()
143 *clks[i].clk = devm_clk_get(dcss->dev, clks[i].id); in dcss_clks_init()
145 dev_err(dcss->dev, "failed to get %s clock\n", in dcss_clks_init()
154 static void dcss_clks_release(struct dcss_dev *dcss) in dcss_clks_release() argument
156 devm_clk_put(dcss->dev, dcss->dtrc_clk); in dcss_clks_release()
157 devm_clk_put(dcss->dev, dcss->rtrm_clk); in dcss_clks_release()
158 devm_clk_put(dcss->dev, dcss->pix_clk); in dcss_clks_release()
159 devm_clk_put(dcss->dev, dcss->axi_clk); in dcss_clks_release()
160 devm_clk_put(dcss->dev, dcss->apb_clk); in dcss_clks_release()
168 struct dcss_dev *dcss; in dcss_dev_create() local
183 if (!devm_request_mem_region(dev, res->start, resource_size(res), "dcss")) { in dcss_dev_create()
188 dcss = devm_kzalloc(dev, sizeof(*dcss), GFP_KERNEL); in dcss_dev_create()
189 if (!dcss) in dcss_dev_create()
192 dcss->dev = dev; in dcss_dev_create()
193 dcss->devtype = devtype; in dcss_dev_create()
194 dcss->hdmi_output = hdmi_output; in dcss_dev_create()
196 ret = dcss_clks_init(dcss); in dcss_dev_create()
202 dcss->of_port = of_graph_get_port_by_id(dev->of_node, 0); in dcss_dev_create()
203 if (!dcss->of_port) { in dcss_dev_create()
209 dcss->start_addr = res->start; in dcss_dev_create()
211 ret = dcss_submodules_init(dcss); in dcss_dev_create()
213 of_node_put(dcss->of_port); in dcss_dev_create()
218 init_completion(&dcss->disable_completion); in dcss_dev_create()
226 return dcss; in dcss_dev_create()
229 dcss_clks_release(dcss); in dcss_dev_create()
234 void dcss_dev_destroy(struct dcss_dev *dcss) in dcss_dev_destroy() argument
236 if (!pm_runtime_suspended(dcss->dev)) { in dcss_dev_destroy()
237 dcss_ctxld_suspend(dcss->ctxld); in dcss_dev_destroy()
238 dcss_clocks_disable(dcss); in dcss_dev_destroy()
241 of_node_put(dcss->of_port); in dcss_dev_destroy()
243 pm_runtime_disable(dcss->dev); in dcss_dev_destroy()
245 dcss_submodules_stop(dcss); in dcss_dev_destroy()
247 dcss_clks_release(dcss); in dcss_dev_destroy()
252 struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev); in dcss_dev_suspend() local
261 ret = dcss_ctxld_suspend(dcss->ctxld); in dcss_dev_suspend()
265 dcss_clocks_disable(dcss); in dcss_dev_suspend()
272 struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev); in dcss_dev_resume() local
280 dcss_clocks_enable(dcss); in dcss_dev_resume()
282 dcss_blkctl_cfg(dcss->blkctl); in dcss_dev_resume()
284 dcss_ctxld_resume(dcss->ctxld); in dcss_dev_resume()
293 struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev); in dcss_dev_runtime_suspend() local
296 ret = dcss_ctxld_suspend(dcss->ctxld); in dcss_dev_runtime_suspend()
300 dcss_clocks_disable(dcss); in dcss_dev_runtime_suspend()
307 struct dcss_dev *dcss = dcss_drv_dev_to_dcss(dev); in dcss_dev_runtime_resume() local
309 dcss_clocks_enable(dcss); in dcss_dev_runtime_resume()
311 dcss_blkctl_cfg(dcss->blkctl); in dcss_dev_runtime_resume()
313 dcss_ctxld_resume(dcss->ctxld); in dcss_dev_runtime_resume()