2 * Copyright (C) 2013 Red Hat
3 * Author: Rob Clark <robdclark@gmail.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <http://www.gnu.org/licenses/>.
19 #include "msm_debugfs.h"
20 #include "msm_fence.h"
24 static void msm_fb_output_poll_changed(struct drm_device
*dev
)
26 struct msm_drm_private
*priv
= dev
->dev_private
;
28 drm_fb_helper_hotplug_event(priv
->fbdev
);
31 static const struct drm_mode_config_funcs mode_config_funcs
= {
32 .fb_create
= msm_framebuffer_create
,
33 .output_poll_changed
= msm_fb_output_poll_changed
,
34 .atomic_check
= msm_atomic_check
,
35 .atomic_commit
= msm_atomic_commit
,
38 int msm_register_mmu(struct drm_device
*dev
, struct msm_mmu
*mmu
)
40 struct msm_drm_private
*priv
= dev
->dev_private
;
41 int idx
= priv
->num_mmus
++;
43 if (WARN_ON(idx
>= ARRAY_SIZE(priv
->mmus
)))
46 priv
->mmus
[idx
] = mmu
;
51 #ifdef CONFIG_DRM_MSM_REGISTER_LOGGING
52 static bool reglog
= false;
53 MODULE_PARM_DESC(reglog
, "Enable register read/write logging");
54 module_param(reglog
, bool, 0600);
59 #ifdef CONFIG_DRM_FBDEV_EMULATION
60 static bool fbdev
= true;
61 MODULE_PARM_DESC(fbdev
, "Enable fbdev compat layer");
62 module_param(fbdev
, bool, 0600);
65 static char *vram
= "16m";
66 MODULE_PARM_DESC(vram
, "Configure VRAM size (for devices without IOMMU/GPUMMU)");
67 module_param(vram
, charp
, 0);
73 void __iomem
*msm_ioremap(struct platform_device
*pdev
, const char *name
,
81 res
= platform_get_resource_byname(pdev
, IORESOURCE_MEM
, name
);
83 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
86 dev_err(&pdev
->dev
, "failed to get memory resource: %s\n", name
);
87 return ERR_PTR(-EINVAL
);
90 size
= resource_size(res
);
92 ptr
= devm_ioremap_nocache(&pdev
->dev
, res
->start
, size
);
94 dev_err(&pdev
->dev
, "failed to ioremap: %s\n", name
);
95 return ERR_PTR(-ENOMEM
);
99 printk(KERN_DEBUG
"IO:region %s %p %08lx\n", dbgname
, ptr
, size
);
104 void msm_writel(u32 data
, void __iomem
*addr
)
107 printk(KERN_DEBUG
"IO:W %p %08x\n", addr
, data
);
111 u32
msm_readl(const void __iomem
*addr
)
113 u32 val
= readl(addr
);
115 printk(KERN_ERR
"IO:R %p %08x\n", addr
, val
);
119 struct vblank_event
{
120 struct list_head node
;
125 static void vblank_ctrl_worker(struct work_struct
*work
)
127 struct msm_vblank_ctrl
*vbl_ctrl
= container_of(work
,
128 struct msm_vblank_ctrl
, work
);
129 struct msm_drm_private
*priv
= container_of(vbl_ctrl
,
130 struct msm_drm_private
, vblank_ctrl
);
131 struct msm_kms
*kms
= priv
->kms
;
132 struct vblank_event
*vbl_ev
, *tmp
;
135 spin_lock_irqsave(&vbl_ctrl
->lock
, flags
);
136 list_for_each_entry_safe(vbl_ev
, tmp
, &vbl_ctrl
->event_list
, node
) {
137 list_del(&vbl_ev
->node
);
138 spin_unlock_irqrestore(&vbl_ctrl
->lock
, flags
);
141 kms
->funcs
->enable_vblank(kms
,
142 priv
->crtcs
[vbl_ev
->crtc_id
]);
144 kms
->funcs
->disable_vblank(kms
,
145 priv
->crtcs
[vbl_ev
->crtc_id
]);
149 spin_lock_irqsave(&vbl_ctrl
->lock
, flags
);
152 spin_unlock_irqrestore(&vbl_ctrl
->lock
, flags
);
155 static int vblank_ctrl_queue_work(struct msm_drm_private
*priv
,
156 int crtc_id
, bool enable
)
158 struct msm_vblank_ctrl
*vbl_ctrl
= &priv
->vblank_ctrl
;
159 struct vblank_event
*vbl_ev
;
162 vbl_ev
= kzalloc(sizeof(*vbl_ev
), GFP_ATOMIC
);
166 vbl_ev
->crtc_id
= crtc_id
;
167 vbl_ev
->enable
= enable
;
169 spin_lock_irqsave(&vbl_ctrl
->lock
, flags
);
170 list_add_tail(&vbl_ev
->node
, &vbl_ctrl
->event_list
);
171 spin_unlock_irqrestore(&vbl_ctrl
->lock
, flags
);
173 queue_work(priv
->wq
, &vbl_ctrl
->work
);
178 static int msm_drm_uninit(struct device
*dev
)
180 struct platform_device
*pdev
= to_platform_device(dev
);
181 struct drm_device
*ddev
= platform_get_drvdata(pdev
);
182 struct msm_drm_private
*priv
= ddev
->dev_private
;
183 struct msm_kms
*kms
= priv
->kms
;
184 struct msm_gpu
*gpu
= priv
->gpu
;
185 struct msm_vblank_ctrl
*vbl_ctrl
= &priv
->vblank_ctrl
;
186 struct vblank_event
*vbl_ev
, *tmp
;
188 /* We must cancel and cleanup any pending vblank enable/disable
189 * work before drm_irq_uninstall() to avoid work re-enabling an
190 * irq after uninstall has disabled it.
192 cancel_work_sync(&vbl_ctrl
->work
);
193 list_for_each_entry_safe(vbl_ev
, tmp
, &vbl_ctrl
->event_list
, node
) {
194 list_del(&vbl_ev
->node
);
198 drm_kms_helper_poll_fini(ddev
);
200 drm_dev_unregister(ddev
);
202 #ifdef CONFIG_DRM_FBDEV_EMULATION
203 if (fbdev
&& priv
->fbdev
)
204 msm_fbdev_free(ddev
);
206 drm_mode_config_cleanup(ddev
);
208 pm_runtime_get_sync(dev
);
209 drm_irq_uninstall(ddev
);
210 pm_runtime_put_sync(dev
);
212 flush_workqueue(priv
->wq
);
213 destroy_workqueue(priv
->wq
);
215 flush_workqueue(priv
->atomic_wq
);
216 destroy_workqueue(priv
->atomic_wq
);
219 pm_runtime_disable(dev
);
220 kms
->funcs
->destroy(kms
);
224 mutex_lock(&ddev
->struct_mutex
);
225 gpu
->funcs
->pm_suspend(gpu
);
226 mutex_unlock(&ddev
->struct_mutex
);
227 gpu
->funcs
->destroy(gpu
);
230 if (priv
->vram
.paddr
) {
231 DEFINE_DMA_ATTRS(attrs
);
232 dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING
, &attrs
);
233 drm_mm_takedown(&priv
->vram
.mm
);
234 dma_free_attrs(dev
, priv
->vram
.size
, NULL
,
235 priv
->vram
.paddr
, &attrs
);
238 component_unbind_all(dev
, ddev
);
240 ddev
->dev_private
= NULL
;
248 static int get_mdp_ver(struct platform_device
*pdev
)
250 struct device
*dev
= &pdev
->dev
;
252 return (int) (unsigned long) of_device_get_match_data(dev
);
255 #include <linux/of_address.h>
257 static int msm_init_vram(struct drm_device
*dev
)
259 struct msm_drm_private
*priv
= dev
->dev_private
;
260 struct device_node
*node
;
261 unsigned long size
= 0;
264 /* In the device-tree world, we could have a 'memory-region'
265 * phandle, which gives us a link to our "vram". Allocating
266 * is all nicely abstracted behind the dma api, but we need
267 * to know the entire size to allocate it all in one go. There
269 * 1) device with no IOMMU, in which case we need exclusive
270 * access to a VRAM carveout big enough for all gpu
272 * 2) device with IOMMU, but where the bootloader puts up
273 * a splash screen. In this case, the VRAM carveout
274 * need only be large enough for fbdev fb. But we need
275 * exclusive access to the buffer to avoid the kernel
276 * using those pages for other purposes (which appears
277 * as corruption on screen before we have a chance to
278 * load and do initial modeset)
281 node
= of_parse_phandle(dev
->dev
->of_node
, "memory-region", 0);
284 ret
= of_address_to_resource(node
, 0, &r
);
287 size
= r
.end
- r
.start
;
288 DRM_INFO("using VRAM carveout: %lx@%pa\n", size
, &r
.start
);
290 /* if we have no IOMMU, then we need to use carveout allocator.
291 * Grab the entire CMA chunk carved out in early startup in
294 } else if (!iommu_present(&platform_bus_type
)) {
295 DRM_INFO("using %s VRAM carveout\n", vram
);
296 size
= memparse(vram
, NULL
);
300 DEFINE_DMA_ATTRS(attrs
);
303 priv
->vram
.size
= size
;
305 drm_mm_init(&priv
->vram
.mm
, 0, (size
>> PAGE_SHIFT
) - 1);
307 dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING
, &attrs
);
308 dma_set_attr(DMA_ATTR_WRITE_COMBINE
, &attrs
);
310 /* note that for no-kernel-mapping, the vaddr returned
311 * is bogus, but non-null if allocation succeeded:
313 p
= dma_alloc_attrs(dev
->dev
, size
,
314 &priv
->vram
.paddr
, GFP_KERNEL
, &attrs
);
316 dev_err(dev
->dev
, "failed to allocate VRAM\n");
317 priv
->vram
.paddr
= 0;
321 dev_info(dev
->dev
, "VRAM: %08x->%08x\n",
322 (uint32_t)priv
->vram
.paddr
,
323 (uint32_t)(priv
->vram
.paddr
+ size
));
329 static int msm_drm_init(struct device
*dev
, struct drm_driver
*drv
)
331 struct platform_device
*pdev
= to_platform_device(dev
);
332 struct drm_device
*ddev
;
333 struct msm_drm_private
*priv
;
337 ddev
= drm_dev_alloc(drv
, dev
);
339 dev_err(dev
, "failed to allocate drm_device\n");
343 platform_set_drvdata(pdev
, ddev
);
344 ddev
->platformdev
= pdev
;
346 priv
= kzalloc(sizeof(*priv
), GFP_KERNEL
);
352 ddev
->dev_private
= priv
;
354 priv
->wq
= alloc_ordered_workqueue("msm", 0);
355 priv
->atomic_wq
= alloc_ordered_workqueue("msm:atomic", 0);
356 init_waitqueue_head(&priv
->pending_crtcs_event
);
358 INIT_LIST_HEAD(&priv
->inactive_list
);
359 INIT_LIST_HEAD(&priv
->vblank_ctrl
.event_list
);
360 INIT_WORK(&priv
->vblank_ctrl
.work
, vblank_ctrl_worker
);
361 spin_lock_init(&priv
->vblank_ctrl
.lock
);
363 drm_mode_config_init(ddev
);
365 /* Bind all our sub-components: */
366 ret
= component_bind_all(dev
, ddev
);
373 ret
= msm_init_vram(ddev
);
377 switch (get_mdp_ver(pdev
)) {
379 kms
= mdp4_kms_init(ddev
);
382 kms
= mdp5_kms_init(ddev
);
385 kms
= ERR_PTR(-ENODEV
);
391 * NOTE: once we have GPU support, having no kms should not
392 * be considered fatal.. ideally we would still support gpu
393 * and (for example) use dmabuf/prime to share buffers with
394 * imx drm driver on iMX5
396 dev_err(dev
, "failed to load kms\n");
404 pm_runtime_enable(dev
);
405 ret
= kms
->funcs
->hw_init(kms
);
407 dev_err(dev
, "kms hw init failed: %d\n", ret
);
412 ddev
->mode_config
.funcs
= &mode_config_funcs
;
414 ret
= drm_vblank_init(ddev
, priv
->num_crtcs
);
416 dev_err(dev
, "failed to initialize vblank\n");
420 pm_runtime_get_sync(dev
);
421 ret
= drm_irq_install(ddev
, platform_get_irq(pdev
, 0));
422 pm_runtime_put_sync(dev
);
424 dev_err(dev
, "failed to install IRQ handler\n");
428 ret
= drm_dev_register(ddev
, 0);
432 drm_mode_config_reset(ddev
);
434 #ifdef CONFIG_DRM_FBDEV_EMULATION
436 priv
->fbdev
= msm_fbdev_init(ddev
);
439 ret
= msm_debugfs_late_init(ddev
);
443 drm_kms_helper_poll_init(ddev
);
456 static void load_gpu(struct drm_device
*dev
)
458 static DEFINE_MUTEX(init_lock
);
459 struct msm_drm_private
*priv
= dev
->dev_private
;
461 mutex_lock(&init_lock
);
464 priv
->gpu
= adreno_load_gpu(dev
);
466 mutex_unlock(&init_lock
);
469 static int msm_open(struct drm_device
*dev
, struct drm_file
*file
)
471 struct msm_file_private
*ctx
;
473 /* For now, load gpu on open.. to avoid the requirement of having
474 * firmware in the initrd.
478 ctx
= kzalloc(sizeof(*ctx
), GFP_KERNEL
);
482 file
->driver_priv
= ctx
;
487 static void msm_preclose(struct drm_device
*dev
, struct drm_file
*file
)
489 struct msm_drm_private
*priv
= dev
->dev_private
;
490 struct msm_file_private
*ctx
= file
->driver_priv
;
492 mutex_lock(&dev
->struct_mutex
);
493 if (ctx
== priv
->lastctx
)
494 priv
->lastctx
= NULL
;
495 mutex_unlock(&dev
->struct_mutex
);
500 static void msm_lastclose(struct drm_device
*dev
)
502 struct msm_drm_private
*priv
= dev
->dev_private
;
504 drm_fb_helper_restore_fbdev_mode_unlocked(priv
->fbdev
);
507 static irqreturn_t
msm_irq(int irq
, void *arg
)
509 struct drm_device
*dev
= arg
;
510 struct msm_drm_private
*priv
= dev
->dev_private
;
511 struct msm_kms
*kms
= priv
->kms
;
513 return kms
->funcs
->irq(kms
);
516 static void msm_irq_preinstall(struct drm_device
*dev
)
518 struct msm_drm_private
*priv
= dev
->dev_private
;
519 struct msm_kms
*kms
= priv
->kms
;
521 kms
->funcs
->irq_preinstall(kms
);
524 static int msm_irq_postinstall(struct drm_device
*dev
)
526 struct msm_drm_private
*priv
= dev
->dev_private
;
527 struct msm_kms
*kms
= priv
->kms
;
529 return kms
->funcs
->irq_postinstall(kms
);
532 static void msm_irq_uninstall(struct drm_device
*dev
)
534 struct msm_drm_private
*priv
= dev
->dev_private
;
535 struct msm_kms
*kms
= priv
->kms
;
537 kms
->funcs
->irq_uninstall(kms
);
540 static int msm_enable_vblank(struct drm_device
*dev
, unsigned int pipe
)
542 struct msm_drm_private
*priv
= dev
->dev_private
;
543 struct msm_kms
*kms
= priv
->kms
;
546 DBG("dev=%p, crtc=%u", dev
, pipe
);
547 return vblank_ctrl_queue_work(priv
, pipe
, true);
550 static void msm_disable_vblank(struct drm_device
*dev
, unsigned int pipe
)
552 struct msm_drm_private
*priv
= dev
->dev_private
;
553 struct msm_kms
*kms
= priv
->kms
;
556 DBG("dev=%p, crtc=%u", dev
, pipe
);
557 vblank_ctrl_queue_work(priv
, pipe
, false);
564 static int msm_ioctl_get_param(struct drm_device
*dev
, void *data
,
565 struct drm_file
*file
)
567 struct msm_drm_private
*priv
= dev
->dev_private
;
568 struct drm_msm_param
*args
= data
;
571 /* for now, we just have 3d pipe.. eventually this would need to
572 * be more clever to dispatch to appropriate gpu module:
574 if (args
->pipe
!= MSM_PIPE_3D0
)
582 return gpu
->funcs
->get_param(gpu
, args
->param
, &args
->value
);
585 static int msm_ioctl_gem_new(struct drm_device
*dev
, void *data
,
586 struct drm_file
*file
)
588 struct drm_msm_gem_new
*args
= data
;
590 if (args
->flags
& ~MSM_BO_FLAGS
) {
591 DRM_ERROR("invalid flags: %08x\n", args
->flags
);
595 return msm_gem_new_handle(dev
, file
, args
->size
,
596 args
->flags
, &args
->handle
);
599 static inline ktime_t
to_ktime(struct drm_msm_timespec timeout
)
601 return ktime_set(timeout
.tv_sec
, timeout
.tv_nsec
);
604 static int msm_ioctl_gem_cpu_prep(struct drm_device
*dev
, void *data
,
605 struct drm_file
*file
)
607 struct drm_msm_gem_cpu_prep
*args
= data
;
608 struct drm_gem_object
*obj
;
609 ktime_t timeout
= to_ktime(args
->timeout
);
612 if (args
->op
& ~MSM_PREP_FLAGS
) {
613 DRM_ERROR("invalid op: %08x\n", args
->op
);
617 obj
= drm_gem_object_lookup(file
, args
->handle
);
621 ret
= msm_gem_cpu_prep(obj
, args
->op
, &timeout
);
623 drm_gem_object_unreference_unlocked(obj
);
628 static int msm_ioctl_gem_cpu_fini(struct drm_device
*dev
, void *data
,
629 struct drm_file
*file
)
631 struct drm_msm_gem_cpu_fini
*args
= data
;
632 struct drm_gem_object
*obj
;
635 obj
= drm_gem_object_lookup(file
, args
->handle
);
639 ret
= msm_gem_cpu_fini(obj
);
641 drm_gem_object_unreference_unlocked(obj
);
646 static int msm_ioctl_gem_info(struct drm_device
*dev
, void *data
,
647 struct drm_file
*file
)
649 struct drm_msm_gem_info
*args
= data
;
650 struct drm_gem_object
*obj
;
656 obj
= drm_gem_object_lookup(file
, args
->handle
);
660 args
->offset
= msm_gem_mmap_offset(obj
);
662 drm_gem_object_unreference_unlocked(obj
);
667 static int msm_ioctl_wait_fence(struct drm_device
*dev
, void *data
,
668 struct drm_file
*file
)
670 struct msm_drm_private
*priv
= dev
->dev_private
;
671 struct drm_msm_wait_fence
*args
= data
;
672 ktime_t timeout
= to_ktime(args
->timeout
);
675 DRM_ERROR("invalid pad: %08x\n", args
->pad
);
682 return msm_wait_fence(priv
->gpu
->fctx
, args
->fence
, &timeout
, true);
685 static const struct drm_ioctl_desc msm_ioctls
[] = {
686 DRM_IOCTL_DEF_DRV(MSM_GET_PARAM
, msm_ioctl_get_param
, DRM_AUTH
|DRM_RENDER_ALLOW
),
687 DRM_IOCTL_DEF_DRV(MSM_GEM_NEW
, msm_ioctl_gem_new
, DRM_AUTH
|DRM_RENDER_ALLOW
),
688 DRM_IOCTL_DEF_DRV(MSM_GEM_INFO
, msm_ioctl_gem_info
, DRM_AUTH
|DRM_RENDER_ALLOW
),
689 DRM_IOCTL_DEF_DRV(MSM_GEM_CPU_PREP
, msm_ioctl_gem_cpu_prep
, DRM_AUTH
|DRM_RENDER_ALLOW
),
690 DRM_IOCTL_DEF_DRV(MSM_GEM_CPU_FINI
, msm_ioctl_gem_cpu_fini
, DRM_AUTH
|DRM_RENDER_ALLOW
),
691 DRM_IOCTL_DEF_DRV(MSM_GEM_SUBMIT
, msm_ioctl_gem_submit
, DRM_AUTH
|DRM_RENDER_ALLOW
),
692 DRM_IOCTL_DEF_DRV(MSM_WAIT_FENCE
, msm_ioctl_wait_fence
, DRM_AUTH
|DRM_RENDER_ALLOW
),
695 static const struct vm_operations_struct vm_ops
= {
696 .fault
= msm_gem_fault
,
697 .open
= drm_gem_vm_open
,
698 .close
= drm_gem_vm_close
,
701 static const struct file_operations fops
= {
702 .owner
= THIS_MODULE
,
704 .release
= drm_release
,
705 .unlocked_ioctl
= drm_ioctl
,
707 .compat_ioctl
= drm_compat_ioctl
,
712 .mmap
= msm_gem_mmap
,
715 static struct drm_driver msm_driver
= {
716 .driver_features
= DRIVER_HAVE_IRQ
|
723 .preclose
= msm_preclose
,
724 .lastclose
= msm_lastclose
,
725 .irq_handler
= msm_irq
,
726 .irq_preinstall
= msm_irq_preinstall
,
727 .irq_postinstall
= msm_irq_postinstall
,
728 .irq_uninstall
= msm_irq_uninstall
,
729 .get_vblank_counter
= drm_vblank_no_hw_counter
,
730 .enable_vblank
= msm_enable_vblank
,
731 .disable_vblank
= msm_disable_vblank
,
732 .gem_free_object
= msm_gem_free_object
,
733 .gem_vm_ops
= &vm_ops
,
734 .dumb_create
= msm_gem_dumb_create
,
735 .dumb_map_offset
= msm_gem_dumb_map_offset
,
736 .dumb_destroy
= drm_gem_dumb_destroy
,
737 .prime_handle_to_fd
= drm_gem_prime_handle_to_fd
,
738 .prime_fd_to_handle
= drm_gem_prime_fd_to_handle
,
739 .gem_prime_export
= drm_gem_prime_export
,
740 .gem_prime_import
= drm_gem_prime_import
,
741 .gem_prime_pin
= msm_gem_prime_pin
,
742 .gem_prime_unpin
= msm_gem_prime_unpin
,
743 .gem_prime_get_sg_table
= msm_gem_prime_get_sg_table
,
744 .gem_prime_import_sg_table
= msm_gem_prime_import_sg_table
,
745 .gem_prime_vmap
= msm_gem_prime_vmap
,
746 .gem_prime_vunmap
= msm_gem_prime_vunmap
,
747 .gem_prime_mmap
= msm_gem_prime_mmap
,
748 #ifdef CONFIG_DEBUG_FS
749 .debugfs_init
= msm_debugfs_init
,
750 .debugfs_cleanup
= msm_debugfs_cleanup
,
752 .ioctls
= msm_ioctls
,
753 .num_ioctls
= DRM_MSM_NUM_IOCTLS
,
756 .desc
= "MSM Snapdragon DRM",
762 #ifdef CONFIG_PM_SLEEP
763 static int msm_pm_suspend(struct device
*dev
)
765 struct drm_device
*ddev
= dev_get_drvdata(dev
);
767 drm_kms_helper_poll_disable(ddev
);
772 static int msm_pm_resume(struct device
*dev
)
774 struct drm_device
*ddev
= dev_get_drvdata(dev
);
776 drm_kms_helper_poll_enable(ddev
);
782 static const struct dev_pm_ops msm_pm_ops
= {
783 SET_SYSTEM_SLEEP_PM_OPS(msm_pm_suspend
, msm_pm_resume
)
787 * Componentized driver support:
791 * NOTE: duplication of the same code as exynos or imx (or probably any other).
792 * so probably some room for some helpers
794 static int compare_of(struct device
*dev
, void *data
)
796 return dev
->of_node
== data
;
799 static int add_components(struct device
*dev
, struct component_match
**matchptr
,
802 struct device_node
*np
= dev
->of_node
;
806 struct device_node
*node
;
808 node
= of_parse_phandle(np
, name
, i
);
812 component_match_add(dev
, matchptr
, compare_of
, node
);
818 static int msm_drm_bind(struct device
*dev
)
820 return msm_drm_init(dev
, &msm_driver
);
823 static void msm_drm_unbind(struct device
*dev
)
828 static const struct component_master_ops msm_drm_ops
= {
829 .bind
= msm_drm_bind
,
830 .unbind
= msm_drm_unbind
,
837 static int msm_pdev_probe(struct platform_device
*pdev
)
839 struct component_match
*match
= NULL
;
841 add_components(&pdev
->dev
, &match
, "connectors");
842 add_components(&pdev
->dev
, &match
, "gpus");
844 pdev
->dev
.coherent_dma_mask
= DMA_BIT_MASK(32);
845 return component_master_add_with_match(&pdev
->dev
, &msm_drm_ops
, match
);
848 static int msm_pdev_remove(struct platform_device
*pdev
)
850 component_master_del(&pdev
->dev
, &msm_drm_ops
);
855 static const struct platform_device_id msm_id
[] = {
860 static const struct of_device_id dt_match
[] = {
861 { .compatible
= "qcom,mdp4", .data
= (void *) 4 }, /* mdp4 */
862 { .compatible
= "qcom,mdp5", .data
= (void *) 5 }, /* mdp5 */
863 /* to support downstream DT files */
864 { .compatible
= "qcom,mdss_mdp", .data
= (void *) 5 }, /* mdp5 */
867 MODULE_DEVICE_TABLE(of
, dt_match
);
869 static struct platform_driver msm_platform_driver
= {
870 .probe
= msm_pdev_probe
,
871 .remove
= msm_pdev_remove
,
874 .of_match_table
= dt_match
,
880 static int __init
msm_drm_register(void)
887 return platform_driver_register(&msm_platform_driver
);
890 static void __exit
msm_drm_unregister(void)
893 platform_driver_unregister(&msm_platform_driver
);
894 msm_hdmi_unregister();
896 msm_edp_unregister();
897 msm_dsi_unregister();
900 module_init(msm_drm_register
);
901 module_exit(msm_drm_unregister
);
903 MODULE_AUTHOR("Rob Clark <robdclark@gmail.com");
904 MODULE_DESCRIPTION("MSM DRM Driver");
905 MODULE_LICENSE("GPL");