Lines Matching full:drm

16 #include <drm/drm_atomic_helper.h>
17 #include <drm/drm_drv.h>
18 #include <drm/drm_fbdev_dma.h>
19 #include <drm/drm_gem_dma_helper.h>
20 #include <drm/drm_gem_framebuffer_helper.h>
21 #include <drm/drm_module.h>
22 #include <drm/drm_probe_helper.h>
23 #include <drm/drm_vblank.h>
35 drm_err(&kmb->drm, "Failed to enable LCD clock: %d\n", ret); in kmb_display_clk_enable()
49 drm_err(&kmb->drm, "clk_get() failed clk_lcd\n"); in kmb_initialize_clocks()
55 drm_err(&kmb->drm, "clk_get() failed clk_pll0 "); in kmb_initialize_clocks()
59 drm_info(&kmb->drm, "system clk = %d Mhz", kmb->sys_clk_mhz); in kmb_initialize_clocks()
66 drm_err(&kmb->drm, "failed to set to clk_lcd to %d\n", in kmb_initialize_clocks()
70 drm_dbg(&kmb->drm, "clk_lcd = %ld\n", clk_get_rate(kmb->kmb_clk.clk_lcd)); in kmb_initialize_clocks()
78 drm_err(&kmb->drm, "failed to get msscam syscon"); in kmb_initialize_clocks()
93 static void __iomem *kmb_map_mmio(struct drm_device *drm, in kmb_map_mmio() argument
102 drm_err(drm, "failed to get resource for %s", name); in kmb_map_mmio()
105 mem = devm_ioremap_resource(drm->dev, res); in kmb_map_mmio()
107 drm_err(drm, "failed to ioremap %s registers", name); in kmb_map_mmio()
111 static int kmb_hw_init(struct drm_device *drm, unsigned long flags) in kmb_hw_init() argument
113 struct kmb_drm_private *kmb = to_kmb(drm); in kmb_hw_init()
114 struct platform_device *pdev = to_platform_device(drm->dev); in kmb_hw_init()
119 kmb->lcd_mmio = kmb_map_mmio(drm, pdev, "lcd"); in kmb_hw_init()
121 drm_err(&kmb->drm, "failed to map LCD registers\n"); in kmb_hw_init()
142 drm_err(&kmb->drm, "irq_lcd not found"); in kmb_hw_init()
147 ret = of_reserved_mem_device_init(drm->dev); in kmb_hw_init()
158 of_reserved_mem_device_release(drm->dev); in kmb_hw_init()
169 static int kmb_setup_mode_config(struct drm_device *drm) in kmb_setup_mode_config() argument
172 struct kmb_drm_private *kmb = to_kmb(drm); in kmb_setup_mode_config()
174 ret = drmm_mode_config_init(drm); in kmb_setup_mode_config()
177 drm->mode_config.min_width = KMB_FB_MIN_WIDTH; in kmb_setup_mode_config()
178 drm->mode_config.min_height = KMB_FB_MIN_HEIGHT; in kmb_setup_mode_config()
179 drm->mode_config.max_width = KMB_FB_MAX_WIDTH; in kmb_setup_mode_config()
180 drm->mode_config.max_height = KMB_FB_MAX_HEIGHT; in kmb_setup_mode_config()
181 drm->mode_config.preferred_depth = 24; in kmb_setup_mode_config()
182 drm->mode_config.funcs = &kmb_mode_config_funcs; in kmb_setup_mode_config()
184 ret = kmb_setup_crtc(drm); in kmb_setup_mode_config()
186 drm_err(drm, "failed to create crtc\n"); in kmb_setup_mode_config()
189 ret = kmb_dsi_encoder_init(drm, kmb->kmb_dsi); in kmb_setup_mode_config()
191 kmb->crtc.port = of_graph_get_port_by_id(drm->dev->of_node, 0); in kmb_setup_mode_config()
192 ret = drm_vblank_init(drm, drm->mode_config.num_crtc); in kmb_setup_mode_config()
194 drm_err(drm, "failed to initialize vblank\n"); in kmb_setup_mode_config()
195 pm_runtime_disable(drm->dev); in kmb_setup_mode_config()
199 drm_mode_config_reset(drm); in kmb_setup_mode_config()
311 drm_info(&kmb->drm, in handle_lcd_irq()
331 drm_dbg(&kmb->drm, in handle_lcd_irq()
334 drm_dbg(&kmb->drm, in handle_lcd_irq()
337 drm_dbg(&kmb->drm, in handle_lcd_irq()
345 drm_info(&kmb->drm, in handle_lcd_irq()
365 drm_dbg(&kmb->drm, in handle_lcd_irq()
368 drm_dbg(&kmb->drm, in handle_lcd_irq()
371 drm_dbg(&kmb->drm, in handle_lcd_irq()
376 drm_dbg(&kmb->drm, in handle_lcd_irq()
379 drm_dbg(&kmb->drm, in handle_lcd_irq()
384 drm_dbg(&kmb->drm, in handle_lcd_irq()
387 drm_dbg(&kmb->drm, in handle_lcd_irq()
412 static void kmb_irq_reset(struct drm_device *drm) in kmb_irq_reset() argument
414 kmb_write_lcd(to_kmb(drm), LCD_INT_CLEAR, 0xFFFF); in kmb_irq_reset()
415 kmb_write_lcd(to_kmb(drm), LCD_INT_ENABLE, 0); in kmb_irq_reset()
418 static int kmb_irq_install(struct drm_device *drm, unsigned int irq) in kmb_irq_install() argument
423 kmb_irq_reset(drm); in kmb_irq_install()
425 return request_irq(irq, kmb_isr, 0, drm->driver->name, drm); in kmb_irq_install()
428 static void kmb_irq_uninstall(struct drm_device *drm) in kmb_irq_uninstall() argument
430 struct kmb_drm_private *kmb = to_kmb(drm); in kmb_irq_uninstall()
432 kmb_irq_reset(drm); in kmb_irq_uninstall()
433 free_irq(kmb->irq_lcd, drm); in kmb_irq_uninstall()
444 .name = "kmb-drm",
454 struct drm_device *drm = dev_get_drvdata(dev); in kmb_remove() local
455 struct kmb_drm_private *kmb = to_kmb(drm); in kmb_remove()
457 drm_dev_unregister(drm); in kmb_remove()
458 drm_kms_helper_poll_fini(drm); in kmb_remove()
461 pm_runtime_get_sync(drm->dev); in kmb_remove()
462 kmb_irq_uninstall(drm); in kmb_remove()
463 pm_runtime_put_sync(drm->dev); in kmb_remove()
464 pm_runtime_disable(drm->dev); in kmb_remove()
466 of_reserved_mem_device_release(drm->dev); in kmb_remove()
475 drm_atomic_helper_shutdown(drm); in kmb_remove()
525 /* Create DRM device */ in kmb_probe()
527 struct kmb_drm_private, drm); in kmb_probe()
531 dev_set_drvdata(dev, &kmb->drm); in kmb_probe()
536 drm_err(&kmb->drm, "failed to initialize DSI\n"); in kmb_probe()
543 ret = kmb_hw_init(&kmb->drm, 0); in kmb_probe()
547 ret = kmb_setup_mode_config(&kmb->drm); in kmb_probe()
551 ret = kmb_irq_install(&kmb->drm, kmb->irq_lcd); in kmb_probe()
553 drm_err(&kmb->drm, "failed to install IRQ handler\n"); in kmb_probe()
557 drm_kms_helper_poll_init(&kmb->drm); in kmb_probe()
560 ret = drm_dev_register(&kmb->drm, 0); in kmb_probe()
564 drm_fbdev_dma_setup(&kmb->drm, 0); in kmb_probe()
569 drm_kms_helper_poll_fini(&kmb->drm); in kmb_probe()
571 pm_runtime_disable(kmb->drm.dev); in kmb_probe()
574 drm_mode_config_cleanup(&kmb->drm); in kmb_probe()
591 struct drm_device *drm = dev_get_drvdata(dev); in kmb_pm_suspend() local
592 struct kmb_drm_private *kmb = to_kmb(drm); in kmb_pm_suspend()
594 drm_kms_helper_poll_disable(drm); in kmb_pm_suspend()
596 kmb->state = drm_atomic_helper_suspend(drm); in kmb_pm_suspend()
598 drm_kms_helper_poll_enable(drm); in kmb_pm_suspend()
607 struct drm_device *drm = dev_get_drvdata(dev); in kmb_pm_resume() local
608 struct kmb_drm_private *kmb = drm ? to_kmb(drm) : NULL; in kmb_pm_resume()
613 drm_atomic_helper_resume(drm, kmb->state); in kmb_pm_resume()
614 drm_kms_helper_poll_enable(drm); in kmb_pm_resume()
625 .name = "kmb-drm",