Lines Matching +full:port +full:- +full:mapping
1 // SPDX-License-Identifier: GPL-2.0-only
4 * Author:Mark Yao <mark.yao@rock-chips.com>
9 #include <linux/dma-mapping.h>
28 #include <asm/dma-iommu.h>
48 * Attach a (component) device to the shared drm dma mapping from master drm
50 * mapping.
55 struct rockchip_drm_private *private = drm_dev->dev_private; in rockchip_drm_dma_attach_device()
58 if (!private->domain) in rockchip_drm_dma_attach_device()
62 struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); in rockchip_drm_dma_attach_device() local
64 if (mapping) { in rockchip_drm_dma_attach_device()
66 arm_iommu_release_mapping(mapping); in rockchip_drm_dma_attach_device()
70 ret = iommu_attach_device(private->domain, dev); in rockchip_drm_dma_attach_device()
82 struct rockchip_drm_private *private = drm_dev->dev_private; in rockchip_drm_dma_detach_device()
84 if (!private->domain) in rockchip_drm_dma_detach_device()
87 iommu_detach_device(private->domain, dev); in rockchip_drm_dma_detach_device()
93 struct rockchip_drm_private *private = drm_dev->dev_private; in rockchip_drm_dma_init_device()
96 private->iommu_dev = ERR_PTR(-ENODEV); in rockchip_drm_dma_init_device()
97 else if (!private->iommu_dev) in rockchip_drm_dma_init_device()
98 private->iommu_dev = dev; in rockchip_drm_dma_init_device()
103 struct rockchip_drm_private *private = drm_dev->dev_private; in rockchip_drm_init_iommu()
108 if (IS_ERR_OR_NULL(private->iommu_dev)) in rockchip_drm_init_iommu()
111 private->domain = iommu_paging_domain_alloc(private->iommu_dev); in rockchip_drm_init_iommu()
112 if (IS_ERR(private->domain)) { in rockchip_drm_init_iommu()
113 ret = PTR_ERR(private->domain); in rockchip_drm_init_iommu()
114 private->domain = NULL; in rockchip_drm_init_iommu()
118 geometry = &private->domain->geometry; in rockchip_drm_init_iommu()
119 start = geometry->aperture_start; in rockchip_drm_init_iommu()
120 end = geometry->aperture_end; in rockchip_drm_init_iommu()
122 DRM_DEBUG("IOMMU context initialized (aperture: %#llx-%#llx)\n", in rockchip_drm_init_iommu()
124 drm_mm_init(&private->mm, start, end - start + 1); in rockchip_drm_init_iommu()
125 mutex_init(&private->mm_lock); in rockchip_drm_init_iommu()
132 struct rockchip_drm_private *private = drm_dev->dev_private; in rockchip_iommu_cleanup()
134 if (!private->domain) in rockchip_iommu_cleanup()
137 drm_mm_takedown(&private->mm); in rockchip_iommu_cleanup()
138 iommu_domain_free(private->domain); in rockchip_iommu_cleanup()
151 "Failed to remove existing framebuffers - %d.\n", in rockchip_drm_bind()
162 private = devm_kzalloc(drm_dev->dev, sizeof(*private), GFP_KERNEL); in rockchip_drm_bind()
164 ret = -ENOMEM; in rockchip_drm_bind()
168 drm_dev->dev_private = private; in rockchip_drm_bind()
185 ret = drm_vblank_init(drm_dev, drm_dev->mode_config.num_crtc); in rockchip_drm_bind()
272 * @port: The number of the port leading to the VOP2
276 struct device_node *np, int port, int reg) in rockchip_drm_encoder_set_crtc_endpoint_id() argument
282 en = of_graph_get_endpoint_by_regs(np, port, reg); in rockchip_drm_encoder_set_crtc_endpoint_id()
284 return -ENOENT; in rockchip_drm_encoder_set_crtc_endpoint_id()
288 return -ENOENT; in rockchip_drm_encoder_set_crtc_endpoint_id()
294 rkencoder->crtc_endpoint_id = ep.id; in rockchip_drm_encoder_set_crtc_endpoint_id()
306 * returns true if subdriver, false if external bridge and -ENODEV
307 * if remote port does not contain a device.
317 return -ENODEV; in rockchip_drm_endpoint_is_subdriver()
319 /* status disabled will prevent creation of platform-devices */ in rockchip_drm_endpoint_is_subdriver()
322 return -ENODEV; in rockchip_drm_endpoint_is_subdriver()
328 /* enabled non-platform-devices can immediately return here */ in rockchip_drm_endpoint_is_subdriver()
336 drv = pdev->dev.driver; in rockchip_drm_endpoint_is_subdriver()
357 list_for_each_entry(link, &dev->links.consumers, s_node) in rockchip_drm_match_remove()
371 d = platform_find_device_by_driver(p, &drv->driver); in rockchip_drm_match_add()
386 return match ?: ERR_PTR(-ENODEV); in rockchip_drm_match_add()
396 struct device_node *np = dev->of_node; in rockchip_drm_platform_of_probe()
397 struct device_node *port; in rockchip_drm_platform_of_probe() local
402 return -ENODEV; in rockchip_drm_platform_of_probe()
405 port = of_parse_phandle(np, "ports", i); in rockchip_drm_platform_of_probe()
406 if (!port) in rockchip_drm_platform_of_probe()
409 if (!of_device_is_available(port->parent)) { in rockchip_drm_platform_of_probe()
410 of_node_put(port); in rockchip_drm_platform_of_probe()
415 of_node_put(port); in rockchip_drm_platform_of_probe()
420 return -ENODEV; in rockchip_drm_platform_of_probe()
425 "No available vop found for display-subsystem.\n"); in rockchip_drm_platform_of_probe()
426 return -ENODEV; in rockchip_drm_platform_of_probe()
434 struct device *dev = &pdev->dev; in rockchip_drm_platform_probe()
457 component_master_del(&pdev->dev, &rockchip_drm_ops); in rockchip_drm_platform_remove()
459 rockchip_drm_match_remove(&pdev->dev); in rockchip_drm_platform_remove()
471 { .compatible = "rockchip,display-subsystem", },
481 .name = "rockchip-drm",
498 return -ENODEV; in rockchip_drm_init()
544 MODULE_AUTHOR("Mark Yao <mark.yao@rock-chips.com>");