Lines Matching +full:lcdif +full:- +full:axi

1 // SPDX-License-Identifier: GPL-2.0-or-later
9 #include <linux/dma-mapping.h>
41 static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif) in lcdif_attach_bridge() argument
43 struct drm_device *drm = lcdif->drm; in lcdif_attach_bridge()
47 bridge = devm_drm_of_get_bridge(drm->dev, drm->dev->of_node, 0, 0); in lcdif_attach_bridge()
51 ret = drm_bridge_attach(&lcdif->encoder, bridge, NULL, 0); in lcdif_attach_bridge()
53 return dev_err_probe(drm->dev, ret, "Failed to attach bridge\n"); in lcdif_attach_bridge()
55 lcdif->bridge = bridge; in lcdif_attach_bridge()
63 struct lcdif_drm_private *lcdif = drm->dev_private; in lcdif_irq_handler() local
66 stat = readl(lcdif->base + LCDC_V8_INT_STATUS_D0); in lcdif_irq_handler()
71 reg = readl(lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_irq_handler()
73 drm_crtc_handle_vblank(&lcdif->crtc); in lcdif_irq_handler()
76 writel(stat, lcdif->base + LCDC_V8_INT_STATUS_D0); in lcdif_irq_handler()
83 struct platform_device *pdev = to_platform_device(drm->dev); in lcdif_load()
84 struct lcdif_drm_private *lcdif; in lcdif_load() local
88 lcdif = devm_kzalloc(&pdev->dev, sizeof(*lcdif), GFP_KERNEL); in lcdif_load()
89 if (!lcdif) in lcdif_load()
90 return -ENOMEM; in lcdif_load()
92 lcdif->drm = drm; in lcdif_load()
93 drm->dev_private = lcdif; in lcdif_load()
96 lcdif->base = devm_ioremap_resource(drm->dev, res); in lcdif_load()
97 if (IS_ERR(lcdif->base)) in lcdif_load()
98 return PTR_ERR(lcdif->base); in lcdif_load()
100 lcdif->clk = devm_clk_get(drm->dev, "pix"); in lcdif_load()
101 if (IS_ERR(lcdif->clk)) in lcdif_load()
102 return PTR_ERR(lcdif->clk); in lcdif_load()
104 lcdif->clk_axi = devm_clk_get(drm->dev, "axi"); in lcdif_load()
105 if (IS_ERR(lcdif->clk_axi)) in lcdif_load()
106 return PTR_ERR(lcdif->clk_axi); in lcdif_load()
108 lcdif->clk_disp_axi = devm_clk_get(drm->dev, "disp_axi"); in lcdif_load()
109 if (IS_ERR(lcdif->clk_disp_axi)) in lcdif_load()
110 return PTR_ERR(lcdif->clk_disp_axi); in lcdif_load()
114 ret = dma_set_mask_and_coherent(drm->dev, DMA_BIT_MASK(36)); in lcdif_load()
121 ret = lcdif_kms_init(lcdif); in lcdif_load()
123 dev_err(drm->dev, "Failed to initialize KMS pipeline\n"); in lcdif_load()
127 ret = drm_vblank_init(drm, drm->mode_config.num_crtc); in lcdif_load()
129 dev_err(drm->dev, "Failed to initialise vblank\n"); in lcdif_load()
134 drm_crtc_vblank_off(&lcdif->crtc); in lcdif_load()
136 ret = lcdif_attach_bridge(lcdif); in lcdif_load()
138 return dev_err_probe(drm->dev, ret, "Cannot connect bridge\n"); in lcdif_load()
140 drm->mode_config.min_width = LCDIF_MIN_XRES; in lcdif_load()
141 drm->mode_config.min_height = LCDIF_MIN_YRES; in lcdif_load()
142 drm->mode_config.max_width = LCDIF_MAX_XRES; in lcdif_load()
143 drm->mode_config.max_height = LCDIF_MAX_YRES; in lcdif_load()
144 drm->mode_config.funcs = &lcdif_mode_config_funcs; in lcdif_load()
145 drm->mode_config.helper_private = &lcdif_mode_config_helpers; in lcdif_load()
152 lcdif->irq = ret; in lcdif_load()
154 ret = devm_request_irq(drm->dev, lcdif->irq, lcdif_irq_handler, 0, in lcdif_load()
155 drm->driver->name, drm); in lcdif_load()
157 dev_err(drm->dev, "Failed to install IRQ handler\n"); in lcdif_load()
165 pm_runtime_enable(drm->dev); in lcdif_load()
172 struct lcdif_drm_private *lcdif = drm->dev_private; in lcdif_unload() local
174 pm_runtime_get_sync(drm->dev); in lcdif_unload()
176 drm_crtc_vblank_off(&lcdif->crtc); in lcdif_unload()
181 pm_runtime_put_sync(drm->dev); in lcdif_unload()
182 pm_runtime_disable(drm->dev); in lcdif_unload()
184 drm->dev_private = NULL; in lcdif_unload()
193 .name = "imx-lcdif",
194 .desc = "i.MX LCDIF Controller DRM",
201 { .compatible = "fsl,imx8mp-lcdif" },
211 drm = drm_dev_alloc(&lcdif_driver, &pdev->dev); in lcdif_probe()
257 struct lcdif_drm_private *lcdif = drm->dev_private; in lcdif_rpm_suspend() local
260 clk_disable_unprepare(lcdif->clk); in lcdif_rpm_suspend()
261 /* These clock supply the System Bus, AXI, Write Path, LFIFO */ in lcdif_rpm_suspend()
262 clk_disable_unprepare(lcdif->clk_disp_axi); in lcdif_rpm_suspend()
264 clk_disable_unprepare(lcdif->clk_axi); in lcdif_rpm_suspend()
272 struct lcdif_drm_private *lcdif = drm->dev_private; in lcdif_rpm_resume() local
275 clk_prepare_enable(lcdif->clk_axi); in lcdif_rpm_resume()
276 /* These clock supply the System Bus, AXI, Write Path, LFIFO */ in lcdif_rpm_resume()
277 clk_prepare_enable(lcdif->clk_disp_axi); in lcdif_rpm_resume()
279 clk_prepare_enable(lcdif->clk); in lcdif_rpm_resume()
315 .name = "imx-lcdif",
324 MODULE_DESCRIPTION("Freescale LCDIF DRM/KMS driver");