Lines Matching refs:dev
69 cedrus_write(ctx->dev, VE_MODE, reg); in cedrus_engine_enable()
74 void cedrus_engine_disable(struct cedrus_dev *dev) in cedrus_engine_disable() argument
76 cedrus_write(dev, VE_MODE, VE_MODE_DISABLED); in cedrus_engine_disable()
79 void cedrus_dst_format_set(struct cedrus_dev *dev, in cedrus_dst_format_set() argument
92 cedrus_write(dev, VE_PRIMARY_OUT_FMT, reg); in cedrus_dst_format_set()
95 cedrus_write(dev, VE_PRIMARY_CHROMA_BUF_LEN, reg); in cedrus_dst_format_set()
99 cedrus_write(dev, VE_PRIMARY_FB_LINE_STRIDE, reg); in cedrus_dst_format_set()
105 cedrus_write(dev, VE_PRIMARY_OUT_FMT, reg); in cedrus_dst_format_set()
108 cedrus_write(dev, VE_CHROMA_BUF_LEN, reg); in cedrus_dst_format_set()
116 struct cedrus_dev *dev = data; in cedrus_irq() local
125 if (!cancel_delayed_work(&dev->watchdog_work)) in cedrus_irq()
128 ctx = v4l2_m2m_get_curr_priv(dev->m2m_dev); in cedrus_irq()
130 v4l2_err(&dev->v4l2_dev, in cedrus_irq()
147 v4l2_m2m_buf_done_and_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx, in cedrus_irq()
155 struct cedrus_dev *dev; in cedrus_watchdog() local
158 dev = container_of(to_delayed_work(work), in cedrus_watchdog()
161 ctx = v4l2_m2m_get_curr_priv(dev->m2m_dev); in cedrus_watchdog()
165 v4l2_err(&dev->v4l2_dev, "frame processing timed out!\n"); in cedrus_watchdog()
166 reset_control_reset(dev->rstc); in cedrus_watchdog()
167 v4l2_m2m_buf_done_and_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx, in cedrus_watchdog()
173 struct cedrus_dev *dev = dev_get_drvdata(device); in cedrus_hw_suspend() local
175 clk_disable_unprepare(dev->ram_clk); in cedrus_hw_suspend()
176 clk_disable_unprepare(dev->mod_clk); in cedrus_hw_suspend()
177 clk_disable_unprepare(dev->ahb_clk); in cedrus_hw_suspend()
179 reset_control_assert(dev->rstc); in cedrus_hw_suspend()
186 struct cedrus_dev *dev = dev_get_drvdata(device); in cedrus_hw_resume() local
189 ret = reset_control_reset(dev->rstc); in cedrus_hw_resume()
191 dev_err(dev->dev, "Failed to apply reset\n"); in cedrus_hw_resume()
196 ret = clk_prepare_enable(dev->ahb_clk); in cedrus_hw_resume()
198 dev_err(dev->dev, "Failed to enable AHB clock\n"); in cedrus_hw_resume()
203 ret = clk_prepare_enable(dev->mod_clk); in cedrus_hw_resume()
205 dev_err(dev->dev, "Failed to enable MOD clock\n"); in cedrus_hw_resume()
210 ret = clk_prepare_enable(dev->ram_clk); in cedrus_hw_resume()
212 dev_err(dev->dev, "Failed to enable RAM clock\n"); in cedrus_hw_resume()
220 clk_disable_unprepare(dev->mod_clk); in cedrus_hw_resume()
222 clk_disable_unprepare(dev->ahb_clk); in cedrus_hw_resume()
224 reset_control_assert(dev->rstc); in cedrus_hw_resume()
229 int cedrus_hw_probe(struct cedrus_dev *dev) in cedrus_hw_probe() argument
235 variant = of_device_get_match_data(dev->dev); in cedrus_hw_probe()
239 dev->capabilities = variant->capabilities; in cedrus_hw_probe()
241 irq_dec = platform_get_irq(dev->pdev, 0); in cedrus_hw_probe()
244 ret = devm_request_irq(dev->dev, irq_dec, cedrus_irq, in cedrus_hw_probe()
245 0, dev_name(dev->dev), dev); in cedrus_hw_probe()
247 dev_err(dev->dev, "Failed to request IRQ\n"); in cedrus_hw_probe()
252 ret = of_reserved_mem_device_init(dev->dev); in cedrus_hw_probe()
254 dev_err(dev->dev, "Failed to reserve memory\n"); in cedrus_hw_probe()
259 ret = sunxi_sram_claim(dev->dev); in cedrus_hw_probe()
261 dev_err(dev->dev, "Failed to claim SRAM\n"); in cedrus_hw_probe()
266 dev->ahb_clk = devm_clk_get(dev->dev, "ahb"); in cedrus_hw_probe()
267 if (IS_ERR(dev->ahb_clk)) { in cedrus_hw_probe()
268 dev_err(dev->dev, "Failed to get AHB clock\n"); in cedrus_hw_probe()
270 ret = PTR_ERR(dev->ahb_clk); in cedrus_hw_probe()
274 dev->mod_clk = devm_clk_get(dev->dev, "mod"); in cedrus_hw_probe()
275 if (IS_ERR(dev->mod_clk)) { in cedrus_hw_probe()
276 dev_err(dev->dev, "Failed to get MOD clock\n"); in cedrus_hw_probe()
278 ret = PTR_ERR(dev->mod_clk); in cedrus_hw_probe()
282 dev->ram_clk = devm_clk_get(dev->dev, "ram"); in cedrus_hw_probe()
283 if (IS_ERR(dev->ram_clk)) { in cedrus_hw_probe()
284 dev_err(dev->dev, "Failed to get RAM clock\n"); in cedrus_hw_probe()
286 ret = PTR_ERR(dev->ram_clk); in cedrus_hw_probe()
290 dev->rstc = devm_reset_control_get(dev->dev, NULL); in cedrus_hw_probe()
291 if (IS_ERR(dev->rstc)) { in cedrus_hw_probe()
292 dev_err(dev->dev, "Failed to get reset control\n"); in cedrus_hw_probe()
294 ret = PTR_ERR(dev->rstc); in cedrus_hw_probe()
298 dev->base = devm_platform_ioremap_resource(dev->pdev, 0); in cedrus_hw_probe()
299 if (IS_ERR(dev->base)) { in cedrus_hw_probe()
300 dev_err(dev->dev, "Failed to map registers\n"); in cedrus_hw_probe()
302 ret = PTR_ERR(dev->base); in cedrus_hw_probe()
306 ret = clk_set_rate(dev->mod_clk, variant->mod_rate); in cedrus_hw_probe()
308 dev_err(dev->dev, "Failed to set clock rate\n"); in cedrus_hw_probe()
313 pm_runtime_enable(dev->dev); in cedrus_hw_probe()
314 if (!pm_runtime_enabled(dev->dev)) { in cedrus_hw_probe()
315 ret = cedrus_hw_resume(dev->dev); in cedrus_hw_probe()
323 pm_runtime_disable(dev->dev); in cedrus_hw_probe()
325 sunxi_sram_release(dev->dev); in cedrus_hw_probe()
327 of_reserved_mem_device_release(dev->dev); in cedrus_hw_probe()
332 void cedrus_hw_remove(struct cedrus_dev *dev) in cedrus_hw_remove() argument
334 pm_runtime_disable(dev->dev); in cedrus_hw_remove()
335 if (!pm_runtime_status_suspended(dev->dev)) in cedrus_hw_remove()
336 cedrus_hw_suspend(dev->dev); in cedrus_hw_remove()
338 sunxi_sram_release(dev->dev); in cedrus_hw_remove()
340 of_reserved_mem_device_release(dev->dev); in cedrus_hw_remove()