Lines Matching +full:rockchip +full:- +full:vop

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
4 * Author:Mark Yao <mark.yao@rock-chips.com>
10 #include <linux/dma-mapping.h>
29 #include <asm/dma-iommu.h>
40 #define DRIVER_NAME "rockchip"
41 #define DRIVER_DESC "RockChip Soc DRM"
56 struct rockchip_drm_private *private = drm_dev->dev_private; in rockchip_drm_dma_attach_device()
59 if (!private->domain) in rockchip_drm_dma_attach_device()
71 ret = iommu_attach_device(private->domain, dev); in rockchip_drm_dma_attach_device()
83 struct rockchip_drm_private *private = drm_dev->dev_private; in rockchip_drm_dma_detach_device()
85 if (!private->domain) in rockchip_drm_dma_detach_device()
88 iommu_detach_device(private->domain, dev); in rockchip_drm_dma_detach_device()
94 struct rockchip_drm_private *private = drm_dev->dev_private; in rockchip_drm_dma_init_device()
97 private->iommu_dev = ERR_PTR(-ENODEV); in rockchip_drm_dma_init_device()
98 else if (!private->iommu_dev) in rockchip_drm_dma_init_device()
99 private->iommu_dev = dev; in rockchip_drm_dma_init_device()
104 struct rockchip_drm_private *private = drm_dev->dev_private; in rockchip_drm_init_iommu()
109 if (IS_ERR_OR_NULL(private->iommu_dev)) in rockchip_drm_init_iommu()
112 private->domain = iommu_paging_domain_alloc(private->iommu_dev); in rockchip_drm_init_iommu()
113 if (IS_ERR(private->domain)) { in rockchip_drm_init_iommu()
114 ret = PTR_ERR(private->domain); in rockchip_drm_init_iommu()
115 private->domain = NULL; in rockchip_drm_init_iommu()
119 geometry = &private->domain->geometry; in rockchip_drm_init_iommu()
120 start = geometry->aperture_start; in rockchip_drm_init_iommu()
121 end = geometry->aperture_end; in rockchip_drm_init_iommu()
123 DRM_DEBUG("IOMMU context initialized (aperture: %#llx-%#llx)\n", in rockchip_drm_init_iommu()
125 drm_mm_init(&private->mm, start, end - start + 1); in rockchip_drm_init_iommu()
126 mutex_init(&private->mm_lock); in rockchip_drm_init_iommu()
133 struct rockchip_drm_private *private = drm_dev->dev_private; in rockchip_iommu_cleanup()
135 if (!private->domain) in rockchip_iommu_cleanup()
138 drm_mm_takedown(&private->mm); in rockchip_iommu_cleanup()
139 iommu_domain_free(private->domain); in rockchip_iommu_cleanup()
152 "Failed to remove existing framebuffers - %d.\n", in rockchip_drm_bind()
163 private = devm_kzalloc(drm_dev->dev, sizeof(*private), GFP_KERNEL); in rockchip_drm_bind()
165 ret = -ENOMEM; in rockchip_drm_bind()
169 drm_dev->dev_private = private; in rockchip_drm_bind()
186 ret = drm_vblank_init(drm_dev, drm_dev->mode_config.num_crtc); in rockchip_drm_bind()
286 return -ENOENT; in rockchip_drm_encoder_set_crtc_endpoint_id()
290 return -ENOENT; in rockchip_drm_encoder_set_crtc_endpoint_id()
296 rkencoder->crtc_endpoint_id = ep.id; in rockchip_drm_encoder_set_crtc_endpoint_id()
302 * Check if a vop endpoint is leading to a rockchip subdriver or bridge.
306 * @ep: endpoint of a rockchip vop
308 * returns true if subdriver, false if external bridge and -ENODEV
319 return -ENODEV; in rockchip_drm_endpoint_is_subdriver()
321 /* status disabled will prevent creation of platform-devices */ in rockchip_drm_endpoint_is_subdriver()
324 return -ENODEV; in rockchip_drm_endpoint_is_subdriver()
330 /* enabled non-platform-devices can immediately return here */ in rockchip_drm_endpoint_is_subdriver()
335 * All rockchip subdrivers have probed at this point, so in rockchip_drm_endpoint_is_subdriver()
338 drv = pdev->dev.driver; in rockchip_drm_endpoint_is_subdriver()
359 list_for_each_entry(link, &dev->links.consumers, s_node) in rockchip_drm_match_remove()
363 /* list of preferred vop devices */
365 "rockchip,rk3399-vop-big",
375 /* add preferred vop device match before adding driver device matches */ in rockchip_drm_match_add()
377 port = of_parse_phandle(dev->of_node, "ports", i); in rockchip_drm_match_add()
381 if (of_device_is_available(port->parent) && in rockchip_drm_match_add()
382 of_device_compatible_match(port->parent, in rockchip_drm_match_add()
386 port->parent); in rockchip_drm_match_add()
396 d = platform_find_device_by_driver(p, &drv->driver); in rockchip_drm_match_add()
411 return match ?: ERR_PTR(-ENODEV); in rockchip_drm_match_add()
421 struct device_node *np = dev->of_node; in rockchip_drm_platform_of_probe()
427 return -ENODEV; in rockchip_drm_platform_of_probe()
434 if (!of_device_is_available(port->parent)) { in rockchip_drm_platform_of_probe()
445 return -ENODEV; in rockchip_drm_platform_of_probe()
450 "No available vop found for display-subsystem.\n"); in rockchip_drm_platform_of_probe()
451 return -ENODEV; in rockchip_drm_platform_of_probe()
459 struct device *dev = &pdev->dev; in rockchip_drm_platform_probe()
482 component_master_del(&pdev->dev, &rockchip_drm_ops); in rockchip_drm_platform_remove()
484 rockchip_drm_match_remove(&pdev->dev); in rockchip_drm_platform_remove()
496 { .compatible = "rockchip,display-subsystem", },
506 .name = "rockchip-drm",
523 return -ENODEV; in rockchip_drm_init()
571 MODULE_AUTHOR("Mark Yao <mark.yao@rock-chips.com>");
572 MODULE_DESCRIPTION("ROCKCHIP DRM Driver");