Lines Matching +full:lcdif +full:- +full:axi
1 // SPDX-License-Identifier: GPL-2.0-or-later
9 #include <linux/dma-mapping.h>
47 static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif) in lcdif_attach_bridge() argument
49 struct device *dev = lcdif->drm->dev; in lcdif_attach_bridge()
54 for_each_endpoint_of_node(dev->of_node, ep) { in lcdif_attach_bridge()
73 bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, of_ep.id); in lcdif_attach_bridge()
86 return -ENOMEM; in lcdif_attach_bridge()
89 encoder->possible_crtcs = drm_crtc_mask(&lcdif->crtc); in lcdif_attach_bridge()
90 ret = drm_encoder_init(lcdif->drm, encoder, &lcdif_encoder_funcs, in lcdif_attach_bridge()
114 struct lcdif_drm_private *lcdif = drm->dev_private; in lcdif_irq_handler() local
117 stat = readl(lcdif->base + LCDC_V8_INT_STATUS_D0); in lcdif_irq_handler()
122 reg = readl(lcdif->base + LCDC_V8_CTRLDESCL0_5); in lcdif_irq_handler()
124 drm_crtc_handle_vblank(&lcdif->crtc); in lcdif_irq_handler()
127 writel(stat, lcdif->base + LCDC_V8_INT_STATUS_D0); in lcdif_irq_handler()
134 struct platform_device *pdev = to_platform_device(drm->dev); in lcdif_load()
135 struct lcdif_drm_private *lcdif; in lcdif_load() local
139 lcdif = devm_kzalloc(&pdev->dev, sizeof(*lcdif), GFP_KERNEL); in lcdif_load()
140 if (!lcdif) in lcdif_load()
141 return -ENOMEM; in lcdif_load()
143 lcdif->drm = drm; in lcdif_load()
144 drm->dev_private = lcdif; in lcdif_load()
147 lcdif->base = devm_ioremap_resource(drm->dev, res); in lcdif_load()
148 if (IS_ERR(lcdif->base)) in lcdif_load()
149 return PTR_ERR(lcdif->base); in lcdif_load()
151 lcdif->clk = devm_clk_get(drm->dev, "pix"); in lcdif_load()
152 if (IS_ERR(lcdif->clk)) in lcdif_load()
153 return PTR_ERR(lcdif->clk); in lcdif_load()
155 lcdif->clk_axi = devm_clk_get(drm->dev, "axi"); in lcdif_load()
156 if (IS_ERR(lcdif->clk_axi)) in lcdif_load()
157 return PTR_ERR(lcdif->clk_axi); in lcdif_load()
159 lcdif->clk_disp_axi = devm_clk_get(drm->dev, "disp_axi"); in lcdif_load()
160 if (IS_ERR(lcdif->clk_disp_axi)) in lcdif_load()
161 return PTR_ERR(lcdif->clk_disp_axi); in lcdif_load()
165 ret = dma_set_mask_and_coherent(drm->dev, DMA_BIT_MASK(36)); in lcdif_load()
172 dev_err(drm->dev, "Failed to initialize mode config\n"); in lcdif_load()
176 ret = lcdif_kms_init(lcdif); in lcdif_load()
178 dev_err(drm->dev, "Failed to initialize KMS pipeline\n"); in lcdif_load()
182 ret = drm_vblank_init(drm, drm->mode_config.num_crtc); in lcdif_load()
184 dev_err(drm->dev, "Failed to initialise vblank\n"); in lcdif_load()
189 drm_crtc_vblank_off(&lcdif->crtc); in lcdif_load()
191 ret = lcdif_attach_bridge(lcdif); in lcdif_load()
193 return dev_err_probe(drm->dev, ret, "Cannot connect bridge\n"); in lcdif_load()
195 drm->mode_config.min_width = LCDIF_MIN_XRES; in lcdif_load()
196 drm->mode_config.min_height = LCDIF_MIN_YRES; in lcdif_load()
197 drm->mode_config.max_width = LCDIF_MAX_XRES; in lcdif_load()
198 drm->mode_config.max_height = LCDIF_MAX_YRES; in lcdif_load()
199 drm->mode_config.funcs = &lcdif_mode_config_funcs; in lcdif_load()
200 drm->mode_config.helper_private = &lcdif_mode_config_helpers; in lcdif_load()
207 lcdif->irq = ret; in lcdif_load()
209 ret = devm_request_irq(drm->dev, lcdif->irq, lcdif_irq_handler, 0, in lcdif_load()
210 drm->driver->name, drm); in lcdif_load()
212 dev_err(drm->dev, "Failed to install IRQ handler\n"); in lcdif_load()
220 pm_runtime_enable(drm->dev); in lcdif_load()
227 struct lcdif_drm_private *lcdif = drm->dev_private; in lcdif_unload() local
229 pm_runtime_get_sync(drm->dev); in lcdif_unload()
231 drm_crtc_vblank_off(&lcdif->crtc); in lcdif_unload()
235 pm_runtime_put_sync(drm->dev); in lcdif_unload()
236 pm_runtime_disable(drm->dev); in lcdif_unload()
238 drm->dev_private = NULL; in lcdif_unload()
247 .name = "imx-lcdif",
248 .desc = "i.MX LCDIF Controller DRM",
255 { .compatible = "fsl,imx8mp-lcdif" },
256 { .compatible = "fsl,imx93-lcdif" },
266 drm = drm_dev_alloc(&lcdif_driver, &pdev->dev); in lcdif_probe()
310 struct lcdif_drm_private *lcdif = drm->dev_private; in lcdif_rpm_suspend() local
313 clk_disable_unprepare(lcdif->clk); in lcdif_rpm_suspend()
314 /* These clock supply the System Bus, AXI, Write Path, LFIFO */ in lcdif_rpm_suspend()
315 clk_disable_unprepare(lcdif->clk_disp_axi); in lcdif_rpm_suspend()
317 clk_disable_unprepare(lcdif->clk_axi); in lcdif_rpm_suspend()
325 struct lcdif_drm_private *lcdif = drm->dev_private; in lcdif_rpm_resume() local
328 clk_prepare_enable(lcdif->clk_axi); in lcdif_rpm_resume()
329 /* These clock supply the System Bus, AXI, Write Path, LFIFO */ in lcdif_rpm_resume()
330 clk_prepare_enable(lcdif->clk_disp_axi); in lcdif_rpm_resume()
332 clk_prepare_enable(lcdif->clk); in lcdif_rpm_resume()
372 .name = "imx-lcdif",
381 MODULE_DESCRIPTION("Freescale LCDIF DRM/KMS driver");