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

1 // SPDX-License-Identifier: GPL-2.0-or-later
7 * Copyright (C) 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
12 #include <linux/dma-mapping.h>
82 clk_prepare_enable(mxsfb->clk_axi); in mxsfb_enable_axi_clk()
87 clk_disable_unprepare(mxsfb->clk_axi); in mxsfb_disable_axi_clk()
98 return ERR_PTR(-EINVAL); in mxsfb_fb_create()
100 if (mode_cmd->width * info->cpp[0] != mode_cmd->pitches[0]) { in mxsfb_fb_create()
101 dev_dbg(dev->dev, "Invalid pitch: fb width must match pitch\n"); in mxsfb_fb_create()
102 return ERR_PTR(-EINVAL); in mxsfb_fb_create()
120 struct drm_device *drm = mxsfb->drm; in mxsfb_attach_bridge()
126 ret = drm_of_find_panel_or_bridge(drm->dev->of_node, 0, 0, &panel, in mxsfb_attach_bridge()
132 bridge = devm_drm_panel_bridge_add_typed(drm->dev, panel, in mxsfb_attach_bridge()
139 return -ENODEV; in mxsfb_attach_bridge()
141 ret = drm_bridge_attach(&mxsfb->encoder, bridge, NULL, 0); in mxsfb_attach_bridge()
143 return dev_err_probe(drm->dev, ret, "Failed to attach bridge\n"); in mxsfb_attach_bridge()
145 mxsfb->bridge = bridge; in mxsfb_attach_bridge()
152 mxsfb->connector = drm_connector_list_iter_next(&iter); in mxsfb_attach_bridge()
161 struct mxsfb_drm_private *mxsfb = drm->dev_private; in mxsfb_irq_handler()
165 reg = readl(mxsfb->base + LCDC_CTRL1); in mxsfb_irq_handler()
168 drm_crtc_handle_vblank(&mxsfb->crtc); in mxsfb_irq_handler()
169 if (mxsfb->crc_active) { in mxsfb_irq_handler()
170 crc = readl(mxsfb->base + LCDC_V4_CRC_STAT); in mxsfb_irq_handler()
171 vbc = drm_crtc_accurate_vblank_count(&mxsfb->crtc); in mxsfb_irq_handler()
172 drm_crtc_add_crc_entry(&mxsfb->crtc, true, vbc, &crc); in mxsfb_irq_handler()
176 writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR); in mxsfb_irq_handler()
183 struct mxsfb_drm_private *mxsfb = drm->dev_private; in mxsfb_irq_disable()
188 writel(CTRL1_CUR_FRAME_DONE_IRQ_EN, mxsfb->base + LCDC_CTRL1 + REG_CLR); in mxsfb_irq_disable()
189 writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR); in mxsfb_irq_disable()
197 return -ENOTCONN; in mxsfb_irq_install()
201 return request_irq(irq, mxsfb_irq_handler, 0, dev->driver->name, dev); in mxsfb_irq_install()
206 struct mxsfb_drm_private *mxsfb = dev->dev_private; in mxsfb_irq_uninstall()
209 free_irq(mxsfb->irq, dev); in mxsfb_irq_uninstall()
215 struct platform_device *pdev = to_platform_device(drm->dev); in mxsfb_load()
220 mxsfb = devm_kzalloc(&pdev->dev, sizeof(*mxsfb), GFP_KERNEL); in mxsfb_load()
222 return -ENOMEM; in mxsfb_load()
224 mxsfb->drm = drm; in mxsfb_load()
225 drm->dev_private = mxsfb; in mxsfb_load()
226 mxsfb->devdata = devdata; in mxsfb_load()
229 mxsfb->base = devm_ioremap_resource(drm->dev, res); in mxsfb_load()
230 if (IS_ERR(mxsfb->base)) in mxsfb_load()
231 return PTR_ERR(mxsfb->base); in mxsfb_load()
233 mxsfb->clk = devm_clk_get(drm->dev, NULL); in mxsfb_load()
234 if (IS_ERR(mxsfb->clk)) in mxsfb_load()
235 return PTR_ERR(mxsfb->clk); in mxsfb_load()
237 mxsfb->clk_axi = devm_clk_get_optional(drm->dev, "axi"); in mxsfb_load()
238 if (IS_ERR(mxsfb->clk_axi)) in mxsfb_load()
239 return PTR_ERR(mxsfb->clk_axi); in mxsfb_load()
241 mxsfb->clk_disp_axi = devm_clk_get(drm->dev, "disp_axi"); in mxsfb_load()
242 if (IS_ERR(mxsfb->clk_disp_axi)) in mxsfb_load()
243 mxsfb->clk_disp_axi = NULL; in mxsfb_load()
245 ret = dma_set_mask_and_coherent(drm->dev, DMA_BIT_MASK(32)); in mxsfb_load()
249 pm_runtime_enable(drm->dev); in mxsfb_load()
254 dev_err(drm->dev, "Failed to initialize mode config\n"); in mxsfb_load()
260 dev_err(drm->dev, "Failed to initialize KMS pipeline\n"); in mxsfb_load()
264 ret = drm_vblank_init(drm, drm->mode_config.num_crtc); in mxsfb_load()
266 dev_err(drm->dev, "Failed to initialise vblank\n"); in mxsfb_load()
271 drm_crtc_vblank_off(&mxsfb->crtc); in mxsfb_load()
275 dev_err_probe(drm->dev, ret, "Cannot connect bridge\n"); in mxsfb_load()
279 drm->mode_config.min_width = MXSFB_MIN_XRES; in mxsfb_load()
280 drm->mode_config.min_height = MXSFB_MIN_YRES; in mxsfb_load()
281 drm->mode_config.max_width = MXSFB_MAX_XRES; in mxsfb_load()
282 drm->mode_config.max_height = MXSFB_MAX_YRES; in mxsfb_load()
283 drm->mode_config.funcs = &mxsfb_mode_config_funcs; in mxsfb_load()
284 drm->mode_config.helper_private = &mxsfb_mode_config_helpers; in mxsfb_load()
291 mxsfb->irq = ret; in mxsfb_load()
293 pm_runtime_get_sync(drm->dev); in mxsfb_load()
294 ret = mxsfb_irq_install(drm, mxsfb->irq); in mxsfb_load()
295 pm_runtime_put_sync(drm->dev); in mxsfb_load()
298 dev_err(drm->dev, "Failed to install IRQ handler\n"); in mxsfb_load()
311 pm_runtime_disable(drm->dev); in mxsfb_load()
320 pm_runtime_get_sync(drm->dev); in mxsfb_unload()
322 pm_runtime_put_sync(drm->dev); in mxsfb_unload()
324 drm->dev_private = NULL; in mxsfb_unload()
326 pm_runtime_disable(drm->dev); in mxsfb_unload()
335 .name = "mxsfb-drm",
343 { .compatible = "fsl,imx23-lcdif", .data = &mxsfb_devdata[MXSFB_V3], },
344 { .compatible = "fsl,imx28-lcdif", .data = &mxsfb_devdata[MXSFB_V4], },
345 { .compatible = "fsl,imx6sx-lcdif", .data = &mxsfb_devdata[MXSFB_V6], },
355 drm = drm_dev_alloc(&mxsfb_driver, &pdev->dev); in mxsfb_probe()
359 ret = mxsfb_load(drm, device_get_match_data(&pdev->dev)); in mxsfb_probe()