Lines Matching refs:dpu_kms

55 static void _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms);
62 struct dpu_kms *kms = s->private; in _dpu_danger_signal_status()
111 struct dpu_kms *kms = file->private_data; in _dpu_plane_danger_read()
120 static void _dpu_plane_set_danger_state(struct dpu_kms *kms, bool enable) in _dpu_plane_set_danger_state()
146 struct dpu_kms *kms = file->private_data; in _dpu_plane_danger_write()
175 static void dpu_debugfs_danger_init(struct dpu_kms *dpu_kms, in dpu_debugfs_danger_init() argument
181 dpu_kms, &dpu_debugfs_danger_stats_fops); in dpu_debugfs_danger_init()
183 dpu_kms, &dpu_debugfs_safe_stats_fops); in dpu_debugfs_danger_init()
185 dpu_kms, &dpu_plane_danger_enable); in dpu_debugfs_danger_init()
195 struct dpu_kms *dpu_kms; member
201 struct dpu_kms *dpu_kms = regset->dpu_kms; in dpu_regset32_show() local
205 if (!dpu_kms->mmio) in dpu_regset32_show()
208 base = dpu_kms->mmio + regset->offset; in dpu_regset32_show()
217 pm_runtime_get_sync(&dpu_kms->pdev->dev); in dpu_regset32_show()
227 pm_runtime_put_sync(&dpu_kms->pdev->dev); in dpu_regset32_show()
235 uint32_t offset, uint32_t length, struct dpu_kms *dpu_kms) in dpu_debugfs_create_regset32() argument
239 if (WARN_ON(!name || !dpu_kms || !length)) in dpu_debugfs_create_regset32()
242 regset = devm_kzalloc(&dpu_kms->pdev->dev, sizeof(*regset), GFP_KERNEL); in dpu_debugfs_create_regset32()
249 regset->dpu_kms = dpu_kms; in dpu_debugfs_create_regset32()
254 static void dpu_debugfs_sspp_init(struct dpu_kms *dpu_kms, struct dentry *debugfs_root) in dpu_debugfs_sspp_init() argument
263 struct dpu_hw_sspp *hw = dpu_rm_get_sspp(&dpu_kms->rm, i); in dpu_debugfs_sspp_init()
268 _dpu_hw_sspp_init_debugfs(hw, dpu_kms, entry); in dpu_debugfs_sspp_init()
274 struct dpu_kms *dpu_kms = to_dpu_kms(kms); in dpu_kms_debugfs_init() local
289 dpu_debugfs_danger_init(dpu_kms, entry); in dpu_kms_debugfs_init()
290 dpu_debugfs_vbif_init(dpu_kms, entry); in dpu_kms_debugfs_init()
291 dpu_debugfs_core_irq_init(dpu_kms, entry); in dpu_kms_debugfs_init()
292 dpu_debugfs_sspp_init(dpu_kms, entry); in dpu_kms_debugfs_init()
294 return dpu_core_perf_debugfs_init(dpu_kms, entry); in dpu_kms_debugfs_init()
306 dpu_kms_get_existing_global_state(struct dpu_kms *dpu_kms) in dpu_kms_get_existing_global_state() argument
308 return to_dpu_global_state(dpu_kms->global_state.state); in dpu_kms_get_existing_global_state()
318 struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms); in dpu_kms_get_global_state() local
322 &dpu_kms->global_state); in dpu_kms_get_global_state()
365 static int dpu_kms_global_obj_init(struct dpu_kms *dpu_kms) in dpu_kms_global_obj_init() argument
373 drm_atomic_private_obj_init(dpu_kms->dev, &dpu_kms->global_state, in dpu_kms_global_obj_init()
377 state->rm = &dpu_kms->rm; in dpu_kms_global_obj_init()
382 static void dpu_kms_global_obj_fini(struct dpu_kms *dpu_kms) in dpu_kms_global_obj_fini() argument
384 drm_atomic_private_obj_fini(&dpu_kms->global_state); in dpu_kms_global_obj_fini()
387 static int dpu_kms_parse_data_bus_icc_path(struct dpu_kms *dpu_kms) in dpu_kms_parse_data_bus_icc_path() argument
391 struct device *dpu_dev = &dpu_kms->pdev->dev; in dpu_kms_parse_data_bus_icc_path()
399 dpu_kms->path[0] = path0; in dpu_kms_parse_data_bus_icc_path()
400 dpu_kms->num_paths = 1; in dpu_kms_parse_data_bus_icc_path()
403 dpu_kms->path[1] = path1; in dpu_kms_parse_data_bus_icc_path()
404 dpu_kms->num_paths++; in dpu_kms_parse_data_bus_icc_path()
421 struct dpu_kms *dpu_kms = to_dpu_kms(kms); in dpu_kms_enable_commit() local
422 pm_runtime_get_sync(&dpu_kms->pdev->dev); in dpu_kms_enable_commit()
427 struct dpu_kms *dpu_kms = to_dpu_kms(kms); in dpu_kms_disable_commit() local
428 pm_runtime_put_sync(&dpu_kms->pdev->dev); in dpu_kms_disable_commit()
433 struct dpu_kms *dpu_kms = to_dpu_kms(kms); in dpu_kms_flush_commit() local
436 for_each_crtc_mask(dpu_kms->dev, crtc, crtc_mask) { in dpu_kms_flush_commit()
447 struct dpu_kms *dpu_kms = to_dpu_kms(kms); in dpu_kms_complete_commit() local
452 for_each_crtc_mask(dpu_kms->dev, crtc, crtc_mask) in dpu_kms_complete_commit()
501 struct dpu_kms *dpu_kms = to_dpu_kms(kms); in dpu_kms_wait_flush() local
504 for_each_crtc_mask(dpu_kms->dev, crtc, crtc_mask) in dpu_kms_wait_flush()
548 struct dpu_kms *dpu_kms) in _dpu_kms_initialize_dsi() argument
618 struct dpu_kms *dpu_kms) in _dpu_kms_initialize_displayport() argument
641 yuv_supported = !!dpu_kms->catalog->cdm; in _dpu_kms_initialize_displayport()
654 struct dpu_kms *dpu_kms) in _dpu_kms_initialize_hdmi() argument
684 struct msm_drm_private *priv, struct dpu_kms *dpu_kms, in _dpu_kms_initialize_writeback() argument
700 maxlinewidth = dpu_rm_get_wb(&dpu_kms->rm, info.h_tile_instance[0])->caps->maxlinewidth; in _dpu_kms_initialize_writeback()
727 struct dpu_kms *dpu_kms) in _dpu_kms_setup_displays() argument
732 rc = _dpu_kms_initialize_dsi(dev, priv, dpu_kms); in _dpu_kms_setup_displays()
738 rc = _dpu_kms_initialize_displayport(dev, priv, dpu_kms); in _dpu_kms_setup_displays()
744 rc = _dpu_kms_initialize_hdmi(dev, priv, dpu_kms); in _dpu_kms_setup_displays()
751 if (dpu_kms->catalog->wb_count) { in _dpu_kms_setup_displays()
752 for (i = 0; i < dpu_kms->catalog->wb_count; i++) { in _dpu_kms_setup_displays()
753 if (dpu_kms->catalog->wb[i].id == WB_2) { in _dpu_kms_setup_displays()
754 rc = _dpu_kms_initialize_writeback(dev, priv, dpu_kms, in _dpu_kms_setup_displays()
755 dpu_kms->catalog->wb[i].format_list, in _dpu_kms_setup_displays()
756 dpu_kms->catalog->wb[i].num_formats); in _dpu_kms_setup_displays()
769 static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) in _dpu_kms_drm_obj_init() argument
783 dev = dpu_kms->dev; in _dpu_kms_drm_obj_init()
785 catalog = dpu_kms->catalog; in _dpu_kms_drm_obj_init()
791 ret = _dpu_kms_setup_displays(dev, priv, dpu_kms); in _dpu_kms_drm_obj_init()
850 static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) in _dpu_kms_hw_destroy() argument
854 dpu_kms->hw_intr = NULL; in _dpu_kms_hw_destroy()
857 _dpu_kms_mmu_destroy(dpu_kms); in _dpu_kms_hw_destroy()
859 for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { in _dpu_kms_hw_destroy()
860 dpu_kms->hw_vbif[i] = NULL; in _dpu_kms_hw_destroy()
863 dpu_kms_global_obj_fini(dpu_kms); in _dpu_kms_hw_destroy()
865 dpu_kms->catalog = NULL; in _dpu_kms_hw_destroy()
867 dpu_kms->hw_mdp = NULL; in _dpu_kms_hw_destroy()
872 struct dpu_kms *dpu_kms; in dpu_kms_destroy() local
879 dpu_kms = to_dpu_kms(kms); in dpu_kms_destroy()
881 _dpu_kms_hw_destroy(dpu_kms); in dpu_kms_destroy()
883 msm_kms_destroy(&dpu_kms->base); in dpu_kms_destroy()
885 if (dpu_kms->rpm_enabled) in dpu_kms_destroy()
886 pm_runtime_disable(&dpu_kms->pdev->dev); in dpu_kms_destroy()
892 struct dpu_kms *dpu_kms = to_dpu_kms(kms); in dpu_irq_postinstall() local
894 if (!dpu_kms || !dpu_kms->dev) in dpu_irq_postinstall()
897 priv = dpu_kms->dev->dev_private; in dpu_irq_postinstall()
907 struct dpu_kms *dpu_kms; in dpu_kms_mdp_snapshot() local
911 dpu_kms = to_dpu_kms(kms); in dpu_kms_mdp_snapshot()
913 cat = dpu_kms->catalog; in dpu_kms_mdp_snapshot()
915 pm_runtime_get_sync(&dpu_kms->pdev->dev); in dpu_kms_mdp_snapshot()
920 dpu_kms->mmio + cat->ctl[i].base, cat->ctl[i].name); in dpu_kms_mdp_snapshot()
924 base = dpu_kms->mmio + cat->dspp[i].base; in dpu_kms_mdp_snapshot()
937 dpu_kms->mmio + cat->intf[i].base, cat->intf[i].name); in dpu_kms_mdp_snapshot()
941 base = dpu_kms->mmio + cat->pingpong[i].base; in dpu_kms_mdp_snapshot()
956 base = dpu_kms->mmio + cat->sspp[i].base; in dpu_kms_mdp_snapshot()
975 dpu_kms->mmio + cat->mixer[i].base, cat->mixer[i].name); in dpu_kms_mdp_snapshot()
980 dpu_kms->mmio + cat->wb[i].base, cat->wb[i].name); in dpu_kms_mdp_snapshot()
984 dpu_kms->mmio + cat->mdp[0].base, "top"); in dpu_kms_mdp_snapshot()
986 dpu_kms->mmio + cat->mdp[0].base + MDP_PERIPH_TOP0_END, "top_2"); in dpu_kms_mdp_snapshot()
989 dpu_kms->mmio + cat->mdp[0].base, "top"); in dpu_kms_mdp_snapshot()
994 base = dpu_kms->mmio + cat->dsc[i].base; in dpu_kms_mdp_snapshot()
1010 dpu_kms->mmio + cat->cdm->base, cat->cdm->name); in dpu_kms_mdp_snapshot()
1012 pm_runtime_put_sync(&dpu_kms->pdev->dev); in dpu_kms_mdp_snapshot()
1036 static void _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms) in _dpu_kms_mmu_destroy() argument
1040 if (!dpu_kms->base.aspace) in _dpu_kms_mmu_destroy()
1043 mmu = dpu_kms->base.aspace->mmu; in _dpu_kms_mmu_destroy()
1046 msm_gem_address_space_put(dpu_kms->base.aspace); in _dpu_kms_mmu_destroy()
1048 dpu_kms->base.aspace = NULL; in _dpu_kms_mmu_destroy()
1051 static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms) in _dpu_kms_mmu_init() argument
1055 aspace = msm_kms_init_aspace(dpu_kms->dev); in _dpu_kms_mmu_init()
1059 dpu_kms->base.aspace = aspace; in _dpu_kms_mmu_init()
1064 unsigned long dpu_kms_get_clk_rate(struct dpu_kms *dpu_kms, char *clock_name) in dpu_kms_get_clk_rate() argument
1068 clk = msm_clk_bulk_get_clock(dpu_kms->clocks, dpu_kms->num_clocks, clock_name); in dpu_kms_get_clk_rate()
1079 struct dpu_kms *dpu_kms; in dpu_kms_hw_init() local
1090 dpu_kms = to_dpu_kms(kms); in dpu_kms_hw_init()
1091 dev = dpu_kms->dev; in dpu_kms_hw_init()
1096 rc = dpu_kms_global_obj_init(dpu_kms); in dpu_kms_hw_init()
1100 atomic_set(&dpu_kms->bandwidth_ref, 0); in dpu_kms_hw_init()
1102 rc = pm_runtime_resume_and_get(&dpu_kms->pdev->dev); in dpu_kms_hw_init()
1106 core_rev = readl_relaxed(dpu_kms->mmio + 0x0); in dpu_kms_hw_init()
1110 dpu_kms->catalog = of_device_get_match_data(dev->dev); in dpu_kms_hw_init()
1111 if (!dpu_kms->catalog) { in dpu_kms_hw_init()
1121 rc = _dpu_kms_mmu_init(dpu_kms); in dpu_kms_hw_init()
1127 dpu_kms->mdss = msm_mdss_get_mdss_data(dpu_kms->pdev->dev.parent); in dpu_kms_hw_init()
1128 if (IS_ERR(dpu_kms->mdss)) { in dpu_kms_hw_init()
1129 rc = PTR_ERR(dpu_kms->mdss); in dpu_kms_hw_init()
1134 if (!dpu_kms->mdss) { in dpu_kms_hw_init()
1140 rc = dpu_rm_init(dev, &dpu_kms->rm, dpu_kms->catalog, dpu_kms->mdss, dpu_kms->mmio); in dpu_kms_hw_init()
1146 dpu_kms->hw_mdp = dpu_hw_mdptop_init(dev, in dpu_kms_hw_init()
1147 dpu_kms->catalog->mdp, in dpu_kms_hw_init()
1148 dpu_kms->mmio, in dpu_kms_hw_init()
1149 dpu_kms->catalog->mdss_ver); in dpu_kms_hw_init()
1150 if (IS_ERR(dpu_kms->hw_mdp)) { in dpu_kms_hw_init()
1151 rc = PTR_ERR(dpu_kms->hw_mdp); in dpu_kms_hw_init()
1153 dpu_kms->hw_mdp = NULL; in dpu_kms_hw_init()
1157 for (i = 0; i < dpu_kms->catalog->vbif_count; i++) { in dpu_kms_hw_init()
1159 const struct dpu_vbif_cfg *vbif = &dpu_kms->catalog->vbif[i]; in dpu_kms_hw_init()
1161 hw = dpu_hw_vbif_init(dev, vbif, dpu_kms->vbif[vbif->id]); in dpu_kms_hw_init()
1168 dpu_kms->hw_vbif[vbif->id] = hw; in dpu_kms_hw_init()
1172 max_core_clk_rate = dpu_kms_get_clk_rate(dpu_kms, "core"); in dpu_kms_hw_init()
1178 rc = dpu_core_perf_init(&dpu_kms->perf, dpu_kms->catalog->perf, max_core_clk_rate); in dpu_kms_hw_init()
1191 if (of_device_is_compatible(dpu_kms->pdev->dev.of_node, "qcom,sc8180x-dpu")) in dpu_kms_hw_init()
1192 dpu_kms->hw_mdp->ops.dp_phy_intf_sel(dpu_kms->hw_mdp, (unsigned int[]){ 1, 2, }); in dpu_kms_hw_init()
1194 dpu_kms->hw_intr = dpu_hw_intr_init(dev, dpu_kms->mmio, dpu_kms->catalog); in dpu_kms_hw_init()
1195 if (IS_ERR(dpu_kms->hw_intr)) { in dpu_kms_hw_init()
1196 rc = PTR_ERR(dpu_kms->hw_intr); in dpu_kms_hw_init()
1198 dpu_kms->hw_intr = NULL; in dpu_kms_hw_init()
1210 dpu_kms->catalog->caps->max_mixer_width * 2; in dpu_kms_hw_init()
1221 rc = _dpu_kms_drm_obj_init(dpu_kms); in dpu_kms_hw_init()
1227 dpu_vbif_init_memtypes(dpu_kms); in dpu_kms_hw_init()
1229 pm_runtime_put_sync(&dpu_kms->pdev->dev); in dpu_kms_hw_init()
1234 pm_runtime_put_sync(&dpu_kms->pdev->dev); in dpu_kms_hw_init()
1236 _dpu_kms_hw_destroy(dpu_kms); in dpu_kms_hw_init()
1246 struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms); in dpu_kms_init() local
1257 ret = msm_kms_init(&dpu_kms->base, &kms_funcs); in dpu_kms_init()
1262 dpu_kms->dev = ddev; in dpu_kms_init()
1265 dpu_kms->rpm_enabled = true; in dpu_kms_init()
1270 static int dpu_kms_mmap_mdp5(struct dpu_kms *dpu_kms) in dpu_kms_mmap_mdp5() argument
1272 struct platform_device *pdev = dpu_kms->pdev; in dpu_kms_mmap_mdp5()
1276 if (!dev_is_platform(dpu_kms->pdev->dev.parent)) in dpu_kms_mmap_mdp5()
1279 mdss_dev = to_platform_device(dpu_kms->pdev->dev.parent); in dpu_kms_mmap_mdp5()
1281 dpu_kms->mmio = msm_ioremap(pdev, "mdp_phys"); in dpu_kms_mmap_mdp5()
1282 if (IS_ERR(dpu_kms->mmio)) { in dpu_kms_mmap_mdp5()
1283 ret = PTR_ERR(dpu_kms->mmio); in dpu_kms_mmap_mdp5()
1285 dpu_kms->mmio = NULL; in dpu_kms_mmap_mdp5()
1288 DRM_DEBUG("mapped dpu address space @%pK\n", dpu_kms->mmio); in dpu_kms_mmap_mdp5()
1290 dpu_kms->vbif[VBIF_RT] = msm_ioremap_mdss(mdss_dev, in dpu_kms_mmap_mdp5()
1291 dpu_kms->pdev, in dpu_kms_mmap_mdp5()
1293 if (IS_ERR(dpu_kms->vbif[VBIF_RT])) { in dpu_kms_mmap_mdp5()
1294 ret = PTR_ERR(dpu_kms->vbif[VBIF_RT]); in dpu_kms_mmap_mdp5()
1296 dpu_kms->vbif[VBIF_RT] = NULL; in dpu_kms_mmap_mdp5()
1300 dpu_kms->vbif[VBIF_NRT] = msm_ioremap_mdss(mdss_dev, in dpu_kms_mmap_mdp5()
1301 dpu_kms->pdev, in dpu_kms_mmap_mdp5()
1303 if (IS_ERR(dpu_kms->vbif[VBIF_NRT])) { in dpu_kms_mmap_mdp5()
1304 dpu_kms->vbif[VBIF_NRT] = NULL; in dpu_kms_mmap_mdp5()
1311 static int dpu_kms_mmap_dpu(struct dpu_kms *dpu_kms) in dpu_kms_mmap_dpu() argument
1313 struct platform_device *pdev = dpu_kms->pdev; in dpu_kms_mmap_dpu()
1316 dpu_kms->mmio = msm_ioremap(pdev, "mdp"); in dpu_kms_mmap_dpu()
1317 if (IS_ERR(dpu_kms->mmio)) { in dpu_kms_mmap_dpu()
1318 ret = PTR_ERR(dpu_kms->mmio); in dpu_kms_mmap_dpu()
1320 dpu_kms->mmio = NULL; in dpu_kms_mmap_dpu()
1323 DRM_DEBUG("mapped dpu address space @%pK\n", dpu_kms->mmio); in dpu_kms_mmap_dpu()
1325 dpu_kms->vbif[VBIF_RT] = msm_ioremap(pdev, "vbif"); in dpu_kms_mmap_dpu()
1326 if (IS_ERR(dpu_kms->vbif[VBIF_RT])) { in dpu_kms_mmap_dpu()
1327 ret = PTR_ERR(dpu_kms->vbif[VBIF_RT]); in dpu_kms_mmap_dpu()
1329 dpu_kms->vbif[VBIF_RT] = NULL; in dpu_kms_mmap_dpu()
1333 dpu_kms->vbif[VBIF_NRT] = msm_ioremap_quiet(pdev, "vbif_nrt"); in dpu_kms_mmap_dpu()
1334 if (IS_ERR(dpu_kms->vbif[VBIF_NRT])) { in dpu_kms_mmap_dpu()
1335 dpu_kms->vbif[VBIF_NRT] = NULL; in dpu_kms_mmap_dpu()
1345 struct dpu_kms *dpu_kms; in dpu_dev_probe() local
1352 dpu_kms = devm_kzalloc(dev, sizeof(*dpu_kms), GFP_KERNEL); in dpu_dev_probe()
1353 if (!dpu_kms) in dpu_dev_probe()
1356 dpu_kms->pdev = pdev; in dpu_dev_probe()
1366 ret = devm_clk_bulk_get_all(&pdev->dev, &dpu_kms->clocks); in dpu_dev_probe()
1370 dpu_kms->num_clocks = ret; in dpu_dev_probe()
1376 dpu_kms->base.irq = irq; in dpu_dev_probe()
1378 if (of_device_is_compatible(dpu_kms->pdev->dev.of_node, "qcom,mdp5")) in dpu_dev_probe()
1379 ret = dpu_kms_mmap_mdp5(dpu_kms); in dpu_dev_probe()
1381 ret = dpu_kms_mmap_dpu(dpu_kms); in dpu_dev_probe()
1385 ret = dpu_kms_parse_data_bus_icc_path(dpu_kms); in dpu_dev_probe()
1389 return msm_drv_probe(&pdev->dev, dpu_kms_init, &dpu_kms->base); in dpu_dev_probe()
1402 struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms); in dpu_runtime_suspend() local
1406 clk_bulk_disable_unprepare(dpu_kms->num_clocks, dpu_kms->clocks); in dpu_runtime_suspend()
1408 for (i = 0; i < dpu_kms->num_paths; i++) in dpu_runtime_suspend()
1409 icc_set_bw(dpu_kms->path[i], 0, 0); in dpu_runtime_suspend()
1419 struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms); in dpu_runtime_resume() local
1423 ddev = dpu_kms->dev; in dpu_runtime_resume()
1425 rc = clk_bulk_prepare_enable(dpu_kms->num_clocks, dpu_kms->clocks); in dpu_runtime_resume()
1431 dpu_vbif_init_memtypes(dpu_kms); in dpu_runtime_resume()