Lines Matching refs:dev
48 static struct drm_framebuffer *tilcdc_fb_create(struct drm_device *dev, in tilcdc_fb_create() argument
51 return drm_fb_cma_create(dev, file_priv, mode_cmd); in tilcdc_fb_create()
54 static void tilcdc_fb_output_poll_changed(struct drm_device *dev) in tilcdc_fb_output_poll_changed() argument
56 struct tilcdc_drm_private *priv = dev->dev_private; in tilcdc_fb_output_poll_changed()
65 static int modeset_init(struct drm_device *dev) in modeset_init() argument
67 struct tilcdc_drm_private *priv = dev->dev_private; in modeset_init()
70 drm_mode_config_init(dev); in modeset_init()
72 priv->crtc = tilcdc_crtc_create(dev); in modeset_init()
76 mod->funcs->modeset_init(mod, dev); in modeset_init()
79 dev->mode_config.min_width = 0; in modeset_init()
80 dev->mode_config.min_height = 0; in modeset_init()
81 dev->mode_config.max_width = tilcdc_crtc_max_width(priv->crtc); in modeset_init()
82 dev->mode_config.max_height = 2048; in modeset_init()
83 dev->mode_config.funcs = &mode_config_funcs; in modeset_init()
109 static int tilcdc_unload(struct drm_device *dev) in tilcdc_unload() argument
111 struct tilcdc_drm_private *priv = dev->dev_private; in tilcdc_unload()
113 tilcdc_remove_external_encoders(dev); in tilcdc_unload()
116 drm_kms_helper_poll_fini(dev); in tilcdc_unload()
117 drm_mode_config_cleanup(dev); in tilcdc_unload()
118 drm_vblank_cleanup(dev); in tilcdc_unload()
120 pm_runtime_get_sync(dev->dev); in tilcdc_unload()
121 drm_irq_uninstall(dev); in tilcdc_unload()
122 pm_runtime_put_sync(dev->dev); in tilcdc_unload()
138 dev->dev_private = NULL; in tilcdc_unload()
140 pm_runtime_disable(dev->dev); in tilcdc_unload()
147 static int tilcdc_load(struct drm_device *dev, unsigned long flags) in tilcdc_load() argument
149 struct platform_device *pdev = dev->platformdev; in tilcdc_load()
150 struct device_node *node = pdev->dev.of_node; in tilcdc_load()
159 dev_err(dev->dev, "failed to allocate private data\n"); in tilcdc_load()
163 dev->dev_private = priv; in tilcdc_load()
166 tilcdc_get_external_components(dev->dev, NULL) > 0; in tilcdc_load()
176 dev_err(dev->dev, "failed to get memory resource\n"); in tilcdc_load()
183 dev_err(dev->dev, "failed to ioremap\n"); in tilcdc_load()
188 priv->clk = clk_get(dev->dev, "fck"); in tilcdc_load()
190 dev_err(dev->dev, "failed to get functional clock\n"); in tilcdc_load()
195 priv->disp_clk = clk_get(dev->dev, "dpll_disp_ck"); in tilcdc_load()
197 dev_err(dev->dev, "failed to get display clock\n"); in tilcdc_load()
208 dev_err(dev->dev, "failed to register cpufreq notifier\n"); in tilcdc_load()
229 pm_runtime_enable(dev->dev); in tilcdc_load()
230 pm_runtime_irq_safe(dev->dev); in tilcdc_load()
233 pm_runtime_get_sync(dev->dev); in tilcdc_load()
234 switch (tilcdc_read(dev, LCDC_PID_REG)) { in tilcdc_load()
243 dev_warn(dev->dev, "Unknown PID Reg value 0x%08x, " in tilcdc_load()
245 tilcdc_read(dev, LCDC_PID_REG)); in tilcdc_load()
250 pm_runtime_put_sync(dev->dev); in tilcdc_load()
252 ret = modeset_init(dev); in tilcdc_load()
254 dev_err(dev->dev, "failed to initialize mode setting\n"); in tilcdc_load()
258 platform_set_drvdata(pdev, dev); in tilcdc_load()
261 ret = component_bind_all(dev->dev, dev); in tilcdc_load()
265 ret = tilcdc_add_external_encoders(dev, &bpp); in tilcdc_load()
271 dev_err(dev->dev, "no encoders/connectors found\n"); in tilcdc_load()
276 ret = drm_vblank_init(dev, 1); in tilcdc_load()
278 dev_err(dev->dev, "failed to initialize vblank\n"); in tilcdc_load()
282 pm_runtime_get_sync(dev->dev); in tilcdc_load()
283 ret = drm_irq_install(dev, platform_get_irq(dev->platformdev, 0)); in tilcdc_load()
284 pm_runtime_put_sync(dev->dev); in tilcdc_load()
286 dev_err(dev->dev, "failed to install IRQ handler\n"); in tilcdc_load()
297 priv->fbdev = drm_fbdev_cma_init(dev, bpp, in tilcdc_load()
298 dev->mode_config.num_crtc, in tilcdc_load()
299 dev->mode_config.num_connector); in tilcdc_load()
305 drm_kms_helper_poll_init(dev); in tilcdc_load()
310 pm_runtime_get_sync(dev->dev); in tilcdc_load()
311 drm_irq_uninstall(dev); in tilcdc_load()
312 pm_runtime_put_sync(dev->dev); in tilcdc_load()
315 drm_vblank_cleanup(dev); in tilcdc_load()
318 drm_mode_config_cleanup(dev); in tilcdc_load()
322 component_unbind_all(dev->dev, dev); in tilcdc_load()
325 tilcdc_remove_external_encoders(dev); in tilcdc_load()
328 pm_runtime_disable(dev->dev); in tilcdc_load()
347 dev->dev_private = NULL; in tilcdc_load()
352 static void tilcdc_preclose(struct drm_device *dev, struct drm_file *file) in tilcdc_preclose() argument
354 struct tilcdc_drm_private *priv = dev->dev_private; in tilcdc_preclose()
359 static void tilcdc_lastclose(struct drm_device *dev) in tilcdc_lastclose() argument
361 struct tilcdc_drm_private *priv = dev->dev_private; in tilcdc_lastclose()
367 struct drm_device *dev = arg; in tilcdc_irq() local
368 struct tilcdc_drm_private *priv = dev->dev_private; in tilcdc_irq()
372 static void tilcdc_irq_preinstall(struct drm_device *dev) in tilcdc_irq_preinstall() argument
374 tilcdc_clear_irqstatus(dev, 0xffffffff); in tilcdc_irq_preinstall()
377 static int tilcdc_irq_postinstall(struct drm_device *dev) in tilcdc_irq_postinstall() argument
379 struct tilcdc_drm_private *priv = dev->dev_private; in tilcdc_irq_postinstall()
383 tilcdc_set(dev, LCDC_RASTER_CTRL_REG, LCDC_V1_UNDERFLOW_INT_ENA); in tilcdc_irq_postinstall()
385 tilcdc_set(dev, LCDC_INT_ENABLE_SET_REG, LCDC_V2_UNDERFLOW_INT_ENA); in tilcdc_irq_postinstall()
390 static void tilcdc_irq_uninstall(struct drm_device *dev) in tilcdc_irq_uninstall() argument
392 struct tilcdc_drm_private *priv = dev->dev_private; in tilcdc_irq_uninstall()
396 tilcdc_clear(dev, LCDC_RASTER_CTRL_REG, in tilcdc_irq_uninstall()
398 tilcdc_clear(dev, LCDC_DMA_CTRL_REG, LCDC_V1_END_OF_FRAME_INT_ENA); in tilcdc_irq_uninstall()
400 tilcdc_clear(dev, LCDC_INT_ENABLE_SET_REG, in tilcdc_irq_uninstall()
408 static void enable_vblank(struct drm_device *dev, bool enable) in enable_vblank() argument
410 struct tilcdc_drm_private *priv = dev->dev_private; in enable_vblank()
423 tilcdc_set(dev, reg, mask); in enable_vblank()
425 tilcdc_clear(dev, reg, mask); in enable_vblank()
428 static int tilcdc_enable_vblank(struct drm_device *dev, unsigned int pipe) in tilcdc_enable_vblank() argument
430 enable_vblank(dev, true); in tilcdc_enable_vblank()
434 static void tilcdc_disable_vblank(struct drm_device *dev, unsigned int pipe) in tilcdc_disable_vblank() argument
436 enable_vblank(dev, false); in tilcdc_disable_vblank()
476 struct drm_device *dev = node->minor->dev; in tilcdc_regs_show() local
477 struct tilcdc_drm_private *priv = dev->dev_private; in tilcdc_regs_show()
480 pm_runtime_get_sync(dev->dev); in tilcdc_regs_show()
487 tilcdc_read(dev, registers[i].reg)); in tilcdc_regs_show()
489 pm_runtime_put_sync(dev->dev); in tilcdc_regs_show()
497 struct drm_device *dev = node->minor->dev; in tilcdc_mm_show() local
498 return drm_mm_dump_table(m, &dev->vma_offset_manager->vm_addr_space_mm); in tilcdc_mm_show()
509 struct drm_device *dev = minor->dev; in tilcdc_debugfs_init() local
522 dev_err(dev->dev, "could not install tilcdc_debugfs_list\n"); in tilcdc_debugfs_init()
591 static int tilcdc_pm_suspend(struct device *dev) in tilcdc_pm_suspend() argument
593 struct drm_device *ddev = dev_get_drvdata(dev); in tilcdc_pm_suspend()
607 static int tilcdc_pm_resume(struct device *dev) in tilcdc_pm_resume() argument
609 struct drm_device *ddev = dev_get_drvdata(dev); in tilcdc_pm_resume()
632 static int tilcdc_bind(struct device *dev) in tilcdc_bind() argument
634 return drm_platform_init(&tilcdc_driver, to_platform_device(dev)); in tilcdc_bind()
637 static void tilcdc_unbind(struct device *dev) in tilcdc_unbind() argument
639 drm_put_dev(dev_get_drvdata(dev)); in tilcdc_unbind()
653 if (!pdev->dev.of_node) { in tilcdc_pdev_probe()
654 dev_err(&pdev->dev, "device-tree data is missing\n"); in tilcdc_pdev_probe()
658 ret = tilcdc_get_external_components(&pdev->dev, &match); in tilcdc_pdev_probe()
664 return component_master_add_with_match(&pdev->dev, in tilcdc_pdev_probe()
671 struct drm_device *ddev = dev_get_drvdata(&pdev->dev); in tilcdc_pdev_remove()
679 component_master_del(&pdev->dev, &tilcdc_comp_ops); in tilcdc_pdev_remove()