Lines Matching +full:lvds +full:- +full:encoder
1 // SPDX-License-Identifier: GPL-2.0-only
19 struct drm_device *dev = mdp4_kms->dev; in mdp4_hw_init()
23 pm_runtime_get_sync(dev->dev); in mdp4_hw_init()
25 if (mdp4_kms->rev > 1) { in mdp4_hw_init()
35 clk = clk_get_rate(mdp4_kms->clk); in mdp4_hw_init()
37 if ((mdp4_kms->rev >= 1) || (clk >= 90000000)) { in mdp4_hw_init()
38 dmap_cfg = 0x47; /* 16 bytes-burst x 8 req */ in mdp4_hw_init()
39 vg_cfg = 0x47; /* 16 bytes-burs x 8 req */ in mdp4_hw_init()
41 dmap_cfg = 0x27; /* 8 bytes-burst x 8 req */ in mdp4_hw_init()
42 vg_cfg = 0x43; /* 16 bytes-burst x 4 req */ in mdp4_hw_init()
55 if (mdp4_kms->rev >= 2) in mdp4_hw_init()
67 if (mdp4_kms->rev > 1) in mdp4_hw_init()
70 pm_runtime_put_sync(dev->dev); in mdp4_hw_init()
97 for_each_crtc_mask(mdp4_kms->dev, crtc, crtc_mask) in mdp4_wait_flush()
106 struct drm_encoder *encoder) in mdp4_round_pixclk() argument
108 /* if we had >1 encoder, we'd need something more clever: */ in mdp4_round_pixclk()
109 switch (encoder->encoder_type) { in mdp4_round_pixclk()
111 return mdp4_dtv_round_pixclk(encoder, rate); in mdp4_round_pixclk()
122 struct device *dev = mdp4_kms->dev->dev; in mdp4_destroy()
123 struct msm_gem_address_space *aspace = kms->aspace; in mdp4_destroy()
125 if (mdp4_kms->blank_cursor_iova) in mdp4_destroy()
126 msm_gem_unpin_iova(mdp4_kms->blank_cursor_bo, kms->aspace); in mdp4_destroy()
127 drm_gem_object_put(mdp4_kms->blank_cursor_bo); in mdp4_destroy()
130 aspace->mmu->funcs->detach(aspace->mmu); in mdp4_destroy()
134 if (mdp4_kms->rpm_enabled) in mdp4_destroy()
137 mdp_kms_destroy(&mdp4_kms->base); in mdp4_destroy()
164 clk_disable_unprepare(mdp4_kms->clk); in mdp4_disable()
165 clk_disable_unprepare(mdp4_kms->pclk); in mdp4_disable()
166 clk_disable_unprepare(mdp4_kms->lut_clk); in mdp4_disable()
167 clk_disable_unprepare(mdp4_kms->axi_clk); in mdp4_disable()
176 clk_prepare_enable(mdp4_kms->clk); in mdp4_enable()
177 clk_prepare_enable(mdp4_kms->pclk); in mdp4_enable()
178 clk_prepare_enable(mdp4_kms->lut_clk); in mdp4_enable()
179 clk_prepare_enable(mdp4_kms->axi_clk); in mdp4_enable()
188 struct drm_device *dev = mdp4_kms->dev; in mdp4_modeset_init_intf()
189 struct msm_drm_private *priv = dev->dev_private; in mdp4_modeset_init_intf()
190 struct drm_encoder *encoder; in mdp4_modeset_init_intf() local
200 * initialize LCDC encoder and LVDS connector) in mdp4_modeset_init_intf()
202 panel_node = of_graph_get_remote_node(dev->dev->of_node, 0, 0); in mdp4_modeset_init_intf()
206 encoder = mdp4_lcdc_encoder_init(dev, panel_node); in mdp4_modeset_init_intf()
207 if (IS_ERR(encoder)) { in mdp4_modeset_init_intf()
208 DRM_DEV_ERROR(dev->dev, "failed to construct LCDC encoder\n"); in mdp4_modeset_init_intf()
210 return PTR_ERR(encoder); in mdp4_modeset_init_intf()
214 encoder->possible_crtcs = 1 << DMA_P; in mdp4_modeset_init_intf()
216 connector = mdp4_lvds_connector_init(dev, panel_node, encoder); in mdp4_modeset_init_intf()
218 DRM_DEV_ERROR(dev->dev, "failed to initialize LVDS connector\n"); in mdp4_modeset_init_intf()
225 encoder = mdp4_dtv_encoder_init(dev); in mdp4_modeset_init_intf()
226 if (IS_ERR(encoder)) { in mdp4_modeset_init_intf()
227 DRM_DEV_ERROR(dev->dev, "failed to construct DTV encoder\n"); in mdp4_modeset_init_intf()
228 return PTR_ERR(encoder); in mdp4_modeset_init_intf()
232 encoder->possible_crtcs = 1 << 1; in mdp4_modeset_init_intf()
234 if (priv->hdmi) { in mdp4_modeset_init_intf()
236 ret = msm_hdmi_modeset_init(priv->hdmi, dev, encoder); in mdp4_modeset_init_intf()
238 DRM_DEV_ERROR(dev->dev, "failed to initialize HDMI: %d\n", ret); in mdp4_modeset_init_intf()
248 if (!priv->dsi[dsi_id]) in mdp4_modeset_init_intf()
251 encoder = mdp4_dsi_encoder_init(dev); in mdp4_modeset_init_intf()
252 if (IS_ERR(encoder)) { in mdp4_modeset_init_intf()
253 ret = PTR_ERR(encoder); in mdp4_modeset_init_intf()
254 DRM_DEV_ERROR(dev->dev, in mdp4_modeset_init_intf()
255 "failed to construct DSI encoder: %d\n", ret); in mdp4_modeset_init_intf()
260 encoder->possible_crtcs = 1 << DMA_P; in mdp4_modeset_init_intf()
262 ret = msm_dsi_modeset_init(priv->dsi[dsi_id], dev, encoder); in mdp4_modeset_init_intf()
264 DRM_DEV_ERROR(dev->dev, "failed to initialize DSI: %d\n", in mdp4_modeset_init_intf()
271 DRM_DEV_ERROR(dev->dev, "Invalid or unsupported interface\n"); in mdp4_modeset_init_intf()
272 return -EINVAL; in mdp4_modeset_init_intf()
280 struct drm_device *dev = mdp4_kms->dev; in modeset_init()
281 struct msm_drm_private *priv = dev->dev_private; in modeset_init()
303 /* construct non-private planes: */ in modeset_init()
307 DRM_DEV_ERROR(dev->dev, in modeset_init()
317 DRM_DEV_ERROR(dev->dev, in modeset_init()
323 crtc = mdp4_crtc_init(dev, plane, priv->num_crtcs, i, in modeset_init()
326 DRM_DEV_ERROR(dev->dev, "failed to construct crtc for %s\n", in modeset_init()
332 priv->num_crtcs++; in modeset_init()
338 * LCDC/LVDS path: RGB1 -> DMA_P -> LCDC -> LVDS in modeset_init()
340 * DSI path: RGB1 -> DMA_P -> DSI1 -> DSI Panel in modeset_init()
342 * DTV/HDMI path: RGB2 -> DMA_E -> DTV -> HDMI in modeset_init()
348 DRM_DEV_ERROR(dev->dev, "failed to initialize intf: %d, %d\n", in modeset_init()
363 struct drm_device *dev = mdp4_kms->dev; in read_mdp_hw_revision()
373 DRM_DEV_INFO(dev->dev, "MDP4 version v%d.%d", *major, *minor); in read_mdp_hw_revision()
378 struct platform_device *pdev = to_platform_device(dev->dev); in mdp4_kms_init()
379 struct msm_drm_private *priv = dev->dev_private; in mdp4_kms_init()
380 struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(priv->kms)); in mdp4_kms_init()
391 ret = mdp_kms_init(&mdp4_kms->base, &kms_funcs); in mdp4_kms_init()
393 DRM_DEV_ERROR(dev->dev, "failed to init kms\n"); in mdp4_kms_init()
397 kms = priv->kms; in mdp4_kms_init()
399 mdp4_kms->dev = dev; in mdp4_kms_init()
401 if (mdp4_kms->vdd) { in mdp4_kms_init()
402 ret = regulator_enable(mdp4_kms->vdd); in mdp4_kms_init()
404 DRM_DEV_ERROR(dev->dev, "failed to enable regulator vdd: %d\n", ret); in mdp4_kms_init()
409 clk_set_rate(mdp4_kms->clk, max_clk); in mdp4_kms_init()
414 DRM_DEV_ERROR(dev->dev, "unexpected MDP version: v%d.%d\n", in mdp4_kms_init()
416 ret = -ENXIO; in mdp4_kms_init()
420 mdp4_kms->rev = minor; in mdp4_kms_init()
422 if (mdp4_kms->rev >= 2) { in mdp4_kms_init()
423 if (!mdp4_kms->lut_clk) { in mdp4_kms_init()
424 DRM_DEV_ERROR(dev->dev, "failed to get lut_clk\n"); in mdp4_kms_init()
425 ret = -ENODEV; in mdp4_kms_init()
428 clk_set_rate(mdp4_kms->lut_clk, max_clk); in mdp4_kms_init()
431 pm_runtime_enable(dev->dev); in mdp4_kms_init()
432 mdp4_kms->rpm_enabled = true; in mdp4_kms_init()
445 mmu = msm_iommu_new(&pdev->dev, 0); in mdp4_kms_init()
450 DRM_DEV_INFO(dev->dev, "no iommu, fallback to phys " in mdp4_kms_init()
455 "mdp4", 0x1000, 0x100000000 - 0x1000); in mdp4_kms_init()
459 mmu->funcs->destroy(mmu); in mdp4_kms_init()
464 kms->aspace = aspace; in mdp4_kms_init()
469 DRM_DEV_ERROR(dev->dev, "modeset_init failed: %d\n", ret); in mdp4_kms_init()
473 mdp4_kms->blank_cursor_bo = msm_gem_new(dev, SZ_16K, MSM_BO_WC | MSM_BO_SCANOUT); in mdp4_kms_init()
474 if (IS_ERR(mdp4_kms->blank_cursor_bo)) { in mdp4_kms_init()
475 ret = PTR_ERR(mdp4_kms->blank_cursor_bo); in mdp4_kms_init()
476 DRM_DEV_ERROR(dev->dev, "could not allocate blank-cursor bo: %d\n", ret); in mdp4_kms_init()
477 mdp4_kms->blank_cursor_bo = NULL; in mdp4_kms_init()
481 ret = msm_gem_get_and_pin_iova(mdp4_kms->blank_cursor_bo, kms->aspace, in mdp4_kms_init()
482 &mdp4_kms->blank_cursor_iova); in mdp4_kms_init()
484 DRM_DEV_ERROR(dev->dev, "could not pin blank-cursor bo: %d\n", ret); in mdp4_kms_init()
488 dev->mode_config.min_width = 0; in mdp4_kms_init()
489 dev->mode_config.min_height = 0; in mdp4_kms_init()
490 dev->mode_config.max_width = 2048; in mdp4_kms_init()
491 dev->mode_config.max_height = 2048; in mdp4_kms_init()
509 struct device *dev = &pdev->dev; in mdp4_probe()
515 return dev_err_probe(dev, -ENOMEM, "failed to allocate kms\n"); in mdp4_probe()
517 mdp4_kms->mmio = msm_ioremap(pdev, NULL); in mdp4_probe()
518 if (IS_ERR(mdp4_kms->mmio)) in mdp4_probe()
519 return PTR_ERR(mdp4_kms->mmio); in mdp4_probe()
525 mdp4_kms->base.base.irq = irq; in mdp4_probe()
531 mdp4_kms->vdd = devm_regulator_get_exclusive(&pdev->dev, "vdd"); in mdp4_probe()
532 if (IS_ERR(mdp4_kms->vdd)) in mdp4_probe()
533 mdp4_kms->vdd = NULL; in mdp4_probe()
535 mdp4_kms->clk = devm_clk_get(&pdev->dev, "core_clk"); in mdp4_probe()
536 if (IS_ERR(mdp4_kms->clk)) in mdp4_probe()
537 return dev_err_probe(dev, PTR_ERR(mdp4_kms->clk), "failed to get core_clk\n"); in mdp4_probe()
539 mdp4_kms->pclk = devm_clk_get(&pdev->dev, "iface_clk"); in mdp4_probe()
540 if (IS_ERR(mdp4_kms->pclk)) in mdp4_probe()
541 mdp4_kms->pclk = NULL; in mdp4_probe()
543 mdp4_kms->axi_clk = devm_clk_get(&pdev->dev, "bus_clk"); in mdp4_probe()
544 if (IS_ERR(mdp4_kms->axi_clk)) in mdp4_probe()
545 return dev_err_probe(dev, PTR_ERR(mdp4_kms->axi_clk), "failed to get axi_clk\n"); in mdp4_probe()
551 mdp4_kms->lut_clk = devm_clk_get_optional(&pdev->dev, "lut_clk"); in mdp4_probe()
552 if (IS_ERR(mdp4_kms->lut_clk)) in mdp4_probe()
553 return dev_err_probe(dev, PTR_ERR(mdp4_kms->lut_clk), "failed to get lut_clk\n"); in mdp4_probe()
555 return msm_drv_probe(&pdev->dev, mdp4_kms_init, &mdp4_kms->base.base); in mdp4_probe()
560 component_master_del(&pdev->dev, &msm_drm_ops); in mdp4_remove()