xref: /linux/drivers/gpu/drm/msm/msm_drv.c (revision 247dbcdbf790c52fc76cf8e327cd0a5778e41e66)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (c) 2016-2018, 2020-2021 The Linux Foundation. All rights reserved.
4  * Copyright (C) 2013 Red Hat
5  * Author: Rob Clark <robdclark@gmail.com>
6  */
7 
8 #include <linux/dma-mapping.h>
9 #include <linux/fault-inject.h>
10 #include <linux/kthread.h>
11 #include <linux/of_address.h>
12 #include <linux/sched/mm.h>
13 #include <linux/uaccess.h>
14 #include <uapi/linux/sched/types.h>
15 
16 #include <drm/drm_aperture.h>
17 #include <drm/drm_bridge.h>
18 #include <drm/drm_drv.h>
19 #include <drm/drm_file.h>
20 #include <drm/drm_ioctl.h>
21 #include <drm/drm_prime.h>
22 #include <drm/drm_of.h>
23 #include <drm/drm_vblank.h>
24 
25 #include "disp/msm_disp_snapshot.h"
26 #include "msm_drv.h"
27 #include "msm_debugfs.h"
28 #include "msm_fence.h"
29 #include "msm_gem.h"
30 #include "msm_gpu.h"
31 #include "msm_kms.h"
32 #include "msm_mmu.h"
33 #include "adreno/adreno_gpu.h"
34 
35 /*
36  * MSM driver version:
37  * - 1.0.0 - initial interface
38  * - 1.1.0 - adds madvise, and support for submits with > 4 cmd buffers
39  * - 1.2.0 - adds explicit fence support for submit ioctl
40  * - 1.3.0 - adds GMEM_BASE + NR_RINGS params, SUBMITQUEUE_NEW +
41  *           SUBMITQUEUE_CLOSE ioctls, and MSM_INFO_IOVA flag for
42  *           MSM_GEM_INFO ioctl.
43  * - 1.4.0 - softpin, MSM_RELOC_BO_DUMP, and GEM_INFO support to set/get
44  *           GEM object's debug name
45  * - 1.5.0 - Add SUBMITQUERY_QUERY ioctl
46  * - 1.6.0 - Syncobj support
47  * - 1.7.0 - Add MSM_PARAM_SUSPENDS to access suspend count
48  * - 1.8.0 - Add MSM_BO_CACHED_COHERENT for supported GPUs (a6xx)
49  * - 1.9.0 - Add MSM_SUBMIT_FENCE_SN_IN
50  * - 1.10.0 - Add MSM_SUBMIT_BO_NO_IMPLICIT
51  * - 1.11.0 - Add wait boost (MSM_WAIT_FENCE_BOOST, MSM_PREP_BOOST)
52  */
53 #define MSM_VERSION_MAJOR	1
54 #define MSM_VERSION_MINOR	10
55 #define MSM_VERSION_PATCHLEVEL	0
56 
57 static void msm_deinit_vram(struct drm_device *ddev);
58 
59 static const struct drm_mode_config_funcs mode_config_funcs = {
60 	.fb_create = msm_framebuffer_create,
61 	.atomic_check = msm_atomic_check,
62 	.atomic_commit = drm_atomic_helper_commit,
63 };
64 
65 static const struct drm_mode_config_helper_funcs mode_config_helper_funcs = {
66 	.atomic_commit_tail = msm_atomic_commit_tail,
67 };
68 
69 static char *vram = "16m";
70 MODULE_PARM_DESC(vram, "Configure VRAM size (for devices without IOMMU/GPUMMU)");
71 module_param(vram, charp, 0);
72 
73 bool dumpstate;
74 MODULE_PARM_DESC(dumpstate, "Dump KMS state on errors");
75 module_param(dumpstate, bool, 0600);
76 
77 static bool modeset = true;
78 MODULE_PARM_DESC(modeset, "Use kernel modesetting [KMS] (1=on (default), 0=disable)");
79 module_param(modeset, bool, 0600);
80 
81 #ifdef CONFIG_FAULT_INJECTION
82 DECLARE_FAULT_ATTR(fail_gem_alloc);
83 DECLARE_FAULT_ATTR(fail_gem_iova);
84 #endif
85 
86 static irqreturn_t msm_irq(int irq, void *arg)
87 {
88 	struct drm_device *dev = arg;
89 	struct msm_drm_private *priv = dev->dev_private;
90 	struct msm_kms *kms = priv->kms;
91 
92 	BUG_ON(!kms);
93 
94 	return kms->funcs->irq(kms);
95 }
96 
97 static void msm_irq_preinstall(struct drm_device *dev)
98 {
99 	struct msm_drm_private *priv = dev->dev_private;
100 	struct msm_kms *kms = priv->kms;
101 
102 	BUG_ON(!kms);
103 
104 	kms->funcs->irq_preinstall(kms);
105 }
106 
107 static int msm_irq_postinstall(struct drm_device *dev)
108 {
109 	struct msm_drm_private *priv = dev->dev_private;
110 	struct msm_kms *kms = priv->kms;
111 
112 	BUG_ON(!kms);
113 
114 	if (kms->funcs->irq_postinstall)
115 		return kms->funcs->irq_postinstall(kms);
116 
117 	return 0;
118 }
119 
120 static int msm_irq_install(struct drm_device *dev, unsigned int irq)
121 {
122 	struct msm_drm_private *priv = dev->dev_private;
123 	struct msm_kms *kms = priv->kms;
124 	int ret;
125 
126 	if (irq == IRQ_NOTCONNECTED)
127 		return -ENOTCONN;
128 
129 	msm_irq_preinstall(dev);
130 
131 	ret = request_irq(irq, msm_irq, 0, dev->driver->name, dev);
132 	if (ret)
133 		return ret;
134 
135 	kms->irq_requested = true;
136 
137 	ret = msm_irq_postinstall(dev);
138 	if (ret) {
139 		free_irq(irq, dev);
140 		return ret;
141 	}
142 
143 	return 0;
144 }
145 
146 static void msm_irq_uninstall(struct drm_device *dev)
147 {
148 	struct msm_drm_private *priv = dev->dev_private;
149 	struct msm_kms *kms = priv->kms;
150 
151 	kms->funcs->irq_uninstall(kms);
152 	if (kms->irq_requested)
153 		free_irq(kms->irq, dev);
154 }
155 
156 struct msm_vblank_work {
157 	struct work_struct work;
158 	struct drm_crtc *crtc;
159 	bool enable;
160 	struct msm_drm_private *priv;
161 };
162 
163 static void vblank_ctrl_worker(struct work_struct *work)
164 {
165 	struct msm_vblank_work *vbl_work = container_of(work,
166 						struct msm_vblank_work, work);
167 	struct msm_drm_private *priv = vbl_work->priv;
168 	struct msm_kms *kms = priv->kms;
169 
170 	if (vbl_work->enable)
171 		kms->funcs->enable_vblank(kms, vbl_work->crtc);
172 	else
173 		kms->funcs->disable_vblank(kms,	vbl_work->crtc);
174 
175 	kfree(vbl_work);
176 }
177 
178 static int vblank_ctrl_queue_work(struct msm_drm_private *priv,
179 					struct drm_crtc *crtc, bool enable)
180 {
181 	struct msm_vblank_work *vbl_work;
182 
183 	vbl_work = kzalloc(sizeof(*vbl_work), GFP_ATOMIC);
184 	if (!vbl_work)
185 		return -ENOMEM;
186 
187 	INIT_WORK(&vbl_work->work, vblank_ctrl_worker);
188 
189 	vbl_work->crtc = crtc;
190 	vbl_work->enable = enable;
191 	vbl_work->priv = priv;
192 
193 	queue_work(priv->wq, &vbl_work->work);
194 
195 	return 0;
196 }
197 
198 static int msm_drm_uninit(struct device *dev)
199 {
200 	struct platform_device *pdev = to_platform_device(dev);
201 	struct msm_drm_private *priv = platform_get_drvdata(pdev);
202 	struct drm_device *ddev = priv->dev;
203 	struct msm_kms *kms = priv->kms;
204 	int i;
205 
206 	/*
207 	 * Shutdown the hw if we're far enough along where things might be on.
208 	 * If we run this too early, we'll end up panicking in any variety of
209 	 * places. Since we don't register the drm device until late in
210 	 * msm_drm_init, drm_dev->registered is used as an indicator that the
211 	 * shutdown will be successful.
212 	 */
213 	if (ddev->registered) {
214 		drm_dev_unregister(ddev);
215 		drm_atomic_helper_shutdown(ddev);
216 	}
217 
218 	/* We must cancel and cleanup any pending vblank enable/disable
219 	 * work before msm_irq_uninstall() to avoid work re-enabling an
220 	 * irq after uninstall has disabled it.
221 	 */
222 
223 	flush_workqueue(priv->wq);
224 
225 	/* clean up event worker threads */
226 	for (i = 0; i < priv->num_crtcs; i++) {
227 		if (priv->event_thread[i].worker)
228 			kthread_destroy_worker(priv->event_thread[i].worker);
229 	}
230 
231 	msm_gem_shrinker_cleanup(ddev);
232 
233 	drm_kms_helper_poll_fini(ddev);
234 
235 	msm_perf_debugfs_cleanup(priv);
236 	msm_rd_debugfs_cleanup(priv);
237 
238 	if (kms)
239 		msm_disp_snapshot_destroy(ddev);
240 
241 	drm_mode_config_cleanup(ddev);
242 
243 	for (i = 0; i < priv->num_bridges; i++)
244 		drm_bridge_remove(priv->bridges[i]);
245 	priv->num_bridges = 0;
246 
247 	if (kms) {
248 		pm_runtime_get_sync(dev);
249 		msm_irq_uninstall(ddev);
250 		pm_runtime_put_sync(dev);
251 	}
252 
253 	if (kms && kms->funcs)
254 		kms->funcs->destroy(kms);
255 
256 	msm_deinit_vram(ddev);
257 
258 	component_unbind_all(dev, ddev);
259 
260 	ddev->dev_private = NULL;
261 	drm_dev_put(ddev);
262 
263 	destroy_workqueue(priv->wq);
264 
265 	return 0;
266 }
267 
268 struct msm_gem_address_space *msm_kms_init_aspace(struct drm_device *dev)
269 {
270 	struct msm_gem_address_space *aspace;
271 	struct msm_mmu *mmu;
272 	struct device *mdp_dev = dev->dev;
273 	struct device *mdss_dev = mdp_dev->parent;
274 	struct device *iommu_dev;
275 
276 	/*
277 	 * IOMMUs can be a part of MDSS device tree binding, or the
278 	 * MDP/DPU device.
279 	 */
280 	if (device_iommu_mapped(mdp_dev))
281 		iommu_dev = mdp_dev;
282 	else
283 		iommu_dev = mdss_dev;
284 
285 	mmu = msm_iommu_new(iommu_dev, 0);
286 	if (IS_ERR(mmu))
287 		return ERR_CAST(mmu);
288 
289 	if (!mmu) {
290 		drm_info(dev, "no IOMMU, fallback to phys contig buffers for scanout\n");
291 		return NULL;
292 	}
293 
294 	aspace = msm_gem_address_space_create(mmu, "mdp_kms",
295 		0x1000, 0x100000000 - 0x1000);
296 	if (IS_ERR(aspace)) {
297 		dev_err(mdp_dev, "aspace create, error %pe\n", aspace);
298 		mmu->funcs->destroy(mmu);
299 	}
300 
301 	return aspace;
302 }
303 
304 bool msm_use_mmu(struct drm_device *dev)
305 {
306 	struct msm_drm_private *priv = dev->dev_private;
307 
308 	/*
309 	 * a2xx comes with its own MMU
310 	 * On other platforms IOMMU can be declared specified either for the
311 	 * MDP/DPU device or for its parent, MDSS device.
312 	 */
313 	return priv->is_a2xx ||
314 		device_iommu_mapped(dev->dev) ||
315 		device_iommu_mapped(dev->dev->parent);
316 }
317 
318 static int msm_init_vram(struct drm_device *dev)
319 {
320 	struct msm_drm_private *priv = dev->dev_private;
321 	struct device_node *node;
322 	unsigned long size = 0;
323 	int ret = 0;
324 
325 	/* In the device-tree world, we could have a 'memory-region'
326 	 * phandle, which gives us a link to our "vram".  Allocating
327 	 * is all nicely abstracted behind the dma api, but we need
328 	 * to know the entire size to allocate it all in one go. There
329 	 * are two cases:
330 	 *  1) device with no IOMMU, in which case we need exclusive
331 	 *     access to a VRAM carveout big enough for all gpu
332 	 *     buffers
333 	 *  2) device with IOMMU, but where the bootloader puts up
334 	 *     a splash screen.  In this case, the VRAM carveout
335 	 *     need only be large enough for fbdev fb.  But we need
336 	 *     exclusive access to the buffer to avoid the kernel
337 	 *     using those pages for other purposes (which appears
338 	 *     as corruption on screen before we have a chance to
339 	 *     load and do initial modeset)
340 	 */
341 
342 	node = of_parse_phandle(dev->dev->of_node, "memory-region", 0);
343 	if (node) {
344 		struct resource r;
345 		ret = of_address_to_resource(node, 0, &r);
346 		of_node_put(node);
347 		if (ret)
348 			return ret;
349 		size = r.end - r.start + 1;
350 		DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start);
351 
352 		/* if we have no IOMMU, then we need to use carveout allocator.
353 		 * Grab the entire DMA chunk carved out in early startup in
354 		 * mach-msm:
355 		 */
356 	} else if (!msm_use_mmu(dev)) {
357 		DRM_INFO("using %s VRAM carveout\n", vram);
358 		size = memparse(vram, NULL);
359 	}
360 
361 	if (size) {
362 		unsigned long attrs = 0;
363 		void *p;
364 
365 		priv->vram.size = size;
366 
367 		drm_mm_init(&priv->vram.mm, 0, (size >> PAGE_SHIFT) - 1);
368 		spin_lock_init(&priv->vram.lock);
369 
370 		attrs |= DMA_ATTR_NO_KERNEL_MAPPING;
371 		attrs |= DMA_ATTR_WRITE_COMBINE;
372 
373 		/* note that for no-kernel-mapping, the vaddr returned
374 		 * is bogus, but non-null if allocation succeeded:
375 		 */
376 		p = dma_alloc_attrs(dev->dev, size,
377 				&priv->vram.paddr, GFP_KERNEL, attrs);
378 		if (!p) {
379 			DRM_DEV_ERROR(dev->dev, "failed to allocate VRAM\n");
380 			priv->vram.paddr = 0;
381 			return -ENOMEM;
382 		}
383 
384 		DRM_DEV_INFO(dev->dev, "VRAM: %08x->%08x\n",
385 				(uint32_t)priv->vram.paddr,
386 				(uint32_t)(priv->vram.paddr + size));
387 	}
388 
389 	return ret;
390 }
391 
392 static void msm_deinit_vram(struct drm_device *ddev)
393 {
394 	struct msm_drm_private *priv = ddev->dev_private;
395 	unsigned long attrs = DMA_ATTR_NO_KERNEL_MAPPING;
396 
397 	if (!priv->vram.paddr)
398 		return;
399 
400 	drm_mm_takedown(&priv->vram.mm);
401 	dma_free_attrs(ddev->dev, priv->vram.size, NULL, priv->vram.paddr,
402 			attrs);
403 }
404 
405 static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
406 {
407 	struct msm_drm_private *priv = dev_get_drvdata(dev);
408 	struct drm_device *ddev;
409 	struct msm_kms *kms;
410 	struct drm_crtc *crtc;
411 	int ret;
412 
413 	if (drm_firmware_drivers_only())
414 		return -ENODEV;
415 
416 	ddev = drm_dev_alloc(drv, dev);
417 	if (IS_ERR(ddev)) {
418 		DRM_DEV_ERROR(dev, "failed to allocate drm_device\n");
419 		return PTR_ERR(ddev);
420 	}
421 	ddev->dev_private = priv;
422 	priv->dev = ddev;
423 
424 	priv->wq = alloc_ordered_workqueue("msm", 0);
425 	if (!priv->wq) {
426 		ret = -ENOMEM;
427 		goto err_put_dev;
428 	}
429 
430 	INIT_LIST_HEAD(&priv->objects);
431 	mutex_init(&priv->obj_lock);
432 
433 	/*
434 	 * Initialize the LRUs:
435 	 */
436 	mutex_init(&priv->lru.lock);
437 	drm_gem_lru_init(&priv->lru.unbacked, &priv->lru.lock);
438 	drm_gem_lru_init(&priv->lru.pinned,   &priv->lru.lock);
439 	drm_gem_lru_init(&priv->lru.willneed, &priv->lru.lock);
440 	drm_gem_lru_init(&priv->lru.dontneed, &priv->lru.lock);
441 
442 	/* Teach lockdep about lock ordering wrt. shrinker: */
443 	fs_reclaim_acquire(GFP_KERNEL);
444 	might_lock(&priv->lru.lock);
445 	fs_reclaim_release(GFP_KERNEL);
446 
447 	drm_mode_config_init(ddev);
448 
449 	ret = msm_init_vram(ddev);
450 	if (ret)
451 		goto err_cleanup_mode_config;
452 
453 	dma_set_max_seg_size(dev, UINT_MAX);
454 
455 	/* Bind all our sub-components: */
456 	ret = component_bind_all(dev, ddev);
457 	if (ret)
458 		goto err_deinit_vram;
459 
460 	/* the fw fb could be anywhere in memory */
461 	ret = drm_aperture_remove_framebuffers(drv);
462 	if (ret)
463 		goto err_msm_uninit;
464 
465 	ret = msm_gem_shrinker_init(ddev);
466 	if (ret)
467 		goto err_msm_uninit;
468 
469 	if (priv->kms_init) {
470 		ret = priv->kms_init(ddev);
471 		if (ret) {
472 			DRM_DEV_ERROR(dev, "failed to load kms\n");
473 			priv->kms = NULL;
474 			goto err_msm_uninit;
475 		}
476 		kms = priv->kms;
477 	} else {
478 		/* valid only for the dummy headless case, where of_node=NULL */
479 		WARN_ON(dev->of_node);
480 		kms = NULL;
481 	}
482 
483 	/* Enable normalization of plane zpos */
484 	ddev->mode_config.normalize_zpos = true;
485 
486 	if (kms) {
487 		kms->dev = ddev;
488 		ret = kms->funcs->hw_init(kms);
489 		if (ret) {
490 			DRM_DEV_ERROR(dev, "kms hw init failed: %d\n", ret);
491 			goto err_msm_uninit;
492 		}
493 	}
494 
495 	drm_helper_move_panel_connectors_to_head(ddev);
496 
497 	ddev->mode_config.funcs = &mode_config_funcs;
498 	ddev->mode_config.helper_private = &mode_config_helper_funcs;
499 
500 	drm_for_each_crtc(crtc, ddev) {
501 		struct msm_drm_thread *ev_thread;
502 
503 		/* initialize event thread */
504 		ev_thread = &priv->event_thread[drm_crtc_index(crtc)];
505 		ev_thread->dev = ddev;
506 		ev_thread->worker = kthread_create_worker(0, "crtc_event:%d", crtc->base.id);
507 		if (IS_ERR(ev_thread->worker)) {
508 			ret = PTR_ERR(ev_thread->worker);
509 			DRM_DEV_ERROR(dev, "failed to create crtc_event kthread\n");
510 			ev_thread->worker = NULL;
511 			goto err_msm_uninit;
512 		}
513 
514 		sched_set_fifo(ev_thread->worker->task);
515 	}
516 
517 	ret = drm_vblank_init(ddev, priv->num_crtcs);
518 	if (ret < 0) {
519 		DRM_DEV_ERROR(dev, "failed to initialize vblank\n");
520 		goto err_msm_uninit;
521 	}
522 
523 	if (kms) {
524 		pm_runtime_get_sync(dev);
525 		ret = msm_irq_install(ddev, kms->irq);
526 		pm_runtime_put_sync(dev);
527 		if (ret < 0) {
528 			DRM_DEV_ERROR(dev, "failed to install IRQ handler\n");
529 			goto err_msm_uninit;
530 		}
531 	}
532 
533 	ret = drm_dev_register(ddev, 0);
534 	if (ret)
535 		goto err_msm_uninit;
536 
537 	if (kms) {
538 		ret = msm_disp_snapshot_init(ddev);
539 		if (ret)
540 			DRM_DEV_ERROR(dev, "msm_disp_snapshot_init failed ret = %d\n", ret);
541 	}
542 	drm_mode_config_reset(ddev);
543 
544 	ret = msm_debugfs_late_init(ddev);
545 	if (ret)
546 		goto err_msm_uninit;
547 
548 	drm_kms_helper_poll_init(ddev);
549 
550 	if (kms)
551 		msm_fbdev_setup(ddev);
552 
553 	return 0;
554 
555 err_msm_uninit:
556 	msm_drm_uninit(dev);
557 
558 	return ret;
559 
560 err_deinit_vram:
561 	msm_deinit_vram(ddev);
562 err_cleanup_mode_config:
563 	drm_mode_config_cleanup(ddev);
564 	destroy_workqueue(priv->wq);
565 err_put_dev:
566 	drm_dev_put(ddev);
567 
568 	return ret;
569 }
570 
571 /*
572  * DRM operations:
573  */
574 
575 static void load_gpu(struct drm_device *dev)
576 {
577 	static DEFINE_MUTEX(init_lock);
578 	struct msm_drm_private *priv = dev->dev_private;
579 
580 	mutex_lock(&init_lock);
581 
582 	if (!priv->gpu)
583 		priv->gpu = adreno_load_gpu(dev);
584 
585 	mutex_unlock(&init_lock);
586 }
587 
588 static int context_init(struct drm_device *dev, struct drm_file *file)
589 {
590 	static atomic_t ident = ATOMIC_INIT(0);
591 	struct msm_drm_private *priv = dev->dev_private;
592 	struct msm_file_private *ctx;
593 
594 	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
595 	if (!ctx)
596 		return -ENOMEM;
597 
598 	INIT_LIST_HEAD(&ctx->submitqueues);
599 	rwlock_init(&ctx->queuelock);
600 
601 	kref_init(&ctx->ref);
602 	msm_submitqueue_init(dev, ctx);
603 
604 	ctx->aspace = msm_gpu_create_private_address_space(priv->gpu, current);
605 	file->driver_priv = ctx;
606 
607 	ctx->seqno = atomic_inc_return(&ident);
608 
609 	return 0;
610 }
611 
612 static int msm_open(struct drm_device *dev, struct drm_file *file)
613 {
614 	/* For now, load gpu on open.. to avoid the requirement of having
615 	 * firmware in the initrd.
616 	 */
617 	load_gpu(dev);
618 
619 	return context_init(dev, file);
620 }
621 
622 static void context_close(struct msm_file_private *ctx)
623 {
624 	msm_submitqueue_close(ctx);
625 	msm_file_private_put(ctx);
626 }
627 
628 static void msm_postclose(struct drm_device *dev, struct drm_file *file)
629 {
630 	struct msm_drm_private *priv = dev->dev_private;
631 	struct msm_file_private *ctx = file->driver_priv;
632 
633 	/*
634 	 * It is not possible to set sysprof param to non-zero if gpu
635 	 * is not initialized:
636 	 */
637 	if (priv->gpu)
638 		msm_file_private_set_sysprof(ctx, priv->gpu, 0);
639 
640 	context_close(ctx);
641 }
642 
643 int msm_crtc_enable_vblank(struct drm_crtc *crtc)
644 {
645 	struct drm_device *dev = crtc->dev;
646 	struct msm_drm_private *priv = dev->dev_private;
647 	struct msm_kms *kms = priv->kms;
648 	if (!kms)
649 		return -ENXIO;
650 	drm_dbg_vbl(dev, "crtc=%u", crtc->base.id);
651 	return vblank_ctrl_queue_work(priv, crtc, true);
652 }
653 
654 void msm_crtc_disable_vblank(struct drm_crtc *crtc)
655 {
656 	struct drm_device *dev = crtc->dev;
657 	struct msm_drm_private *priv = dev->dev_private;
658 	struct msm_kms *kms = priv->kms;
659 	if (!kms)
660 		return;
661 	drm_dbg_vbl(dev, "crtc=%u", crtc->base.id);
662 	vblank_ctrl_queue_work(priv, crtc, false);
663 }
664 
665 /*
666  * DRM ioctls:
667  */
668 
669 static int msm_ioctl_get_param(struct drm_device *dev, void *data,
670 		struct drm_file *file)
671 {
672 	struct msm_drm_private *priv = dev->dev_private;
673 	struct drm_msm_param *args = data;
674 	struct msm_gpu *gpu;
675 
676 	/* for now, we just have 3d pipe.. eventually this would need to
677 	 * be more clever to dispatch to appropriate gpu module:
678 	 */
679 	if ((args->pipe != MSM_PIPE_3D0) || (args->pad != 0))
680 		return -EINVAL;
681 
682 	gpu = priv->gpu;
683 
684 	if (!gpu)
685 		return -ENXIO;
686 
687 	return gpu->funcs->get_param(gpu, file->driver_priv,
688 				     args->param, &args->value, &args->len);
689 }
690 
691 static int msm_ioctl_set_param(struct drm_device *dev, void *data,
692 		struct drm_file *file)
693 {
694 	struct msm_drm_private *priv = dev->dev_private;
695 	struct drm_msm_param *args = data;
696 	struct msm_gpu *gpu;
697 
698 	if ((args->pipe != MSM_PIPE_3D0) || (args->pad != 0))
699 		return -EINVAL;
700 
701 	gpu = priv->gpu;
702 
703 	if (!gpu)
704 		return -ENXIO;
705 
706 	return gpu->funcs->set_param(gpu, file->driver_priv,
707 				     args->param, args->value, args->len);
708 }
709 
710 static int msm_ioctl_gem_new(struct drm_device *dev, void *data,
711 		struct drm_file *file)
712 {
713 	struct drm_msm_gem_new *args = data;
714 	uint32_t flags = args->flags;
715 
716 	if (args->flags & ~MSM_BO_FLAGS) {
717 		DRM_ERROR("invalid flags: %08x\n", args->flags);
718 		return -EINVAL;
719 	}
720 
721 	/*
722 	 * Uncached CPU mappings are deprecated, as of:
723 	 *
724 	 * 9ef364432db4 ("drm/msm: deprecate MSM_BO_UNCACHED (map as writecombine instead)")
725 	 *
726 	 * So promote them to WC.
727 	 */
728 	if (flags & MSM_BO_UNCACHED) {
729 		flags &= ~MSM_BO_CACHED;
730 		flags |= MSM_BO_WC;
731 	}
732 
733 	if (should_fail(&fail_gem_alloc, args->size))
734 		return -ENOMEM;
735 
736 	return msm_gem_new_handle(dev, file, args->size,
737 			args->flags, &args->handle, NULL);
738 }
739 
740 static inline ktime_t to_ktime(struct drm_msm_timespec timeout)
741 {
742 	return ktime_set(timeout.tv_sec, timeout.tv_nsec);
743 }
744 
745 static int msm_ioctl_gem_cpu_prep(struct drm_device *dev, void *data,
746 		struct drm_file *file)
747 {
748 	struct drm_msm_gem_cpu_prep *args = data;
749 	struct drm_gem_object *obj;
750 	ktime_t timeout = to_ktime(args->timeout);
751 	int ret;
752 
753 	if (args->op & ~MSM_PREP_FLAGS) {
754 		DRM_ERROR("invalid op: %08x\n", args->op);
755 		return -EINVAL;
756 	}
757 
758 	obj = drm_gem_object_lookup(file, args->handle);
759 	if (!obj)
760 		return -ENOENT;
761 
762 	ret = msm_gem_cpu_prep(obj, args->op, &timeout);
763 
764 	drm_gem_object_put(obj);
765 
766 	return ret;
767 }
768 
769 static int msm_ioctl_gem_cpu_fini(struct drm_device *dev, void *data,
770 		struct drm_file *file)
771 {
772 	struct drm_msm_gem_cpu_fini *args = data;
773 	struct drm_gem_object *obj;
774 	int ret;
775 
776 	obj = drm_gem_object_lookup(file, args->handle);
777 	if (!obj)
778 		return -ENOENT;
779 
780 	ret = msm_gem_cpu_fini(obj);
781 
782 	drm_gem_object_put(obj);
783 
784 	return ret;
785 }
786 
787 static int msm_ioctl_gem_info_iova(struct drm_device *dev,
788 		struct drm_file *file, struct drm_gem_object *obj,
789 		uint64_t *iova)
790 {
791 	struct msm_drm_private *priv = dev->dev_private;
792 	struct msm_file_private *ctx = file->driver_priv;
793 
794 	if (!priv->gpu)
795 		return -EINVAL;
796 
797 	if (should_fail(&fail_gem_iova, obj->size))
798 		return -ENOMEM;
799 
800 	/*
801 	 * Don't pin the memory here - just get an address so that userspace can
802 	 * be productive
803 	 */
804 	return msm_gem_get_iova(obj, ctx->aspace, iova);
805 }
806 
807 static int msm_ioctl_gem_info_set_iova(struct drm_device *dev,
808 		struct drm_file *file, struct drm_gem_object *obj,
809 		uint64_t iova)
810 {
811 	struct msm_drm_private *priv = dev->dev_private;
812 	struct msm_file_private *ctx = file->driver_priv;
813 
814 	if (!priv->gpu)
815 		return -EINVAL;
816 
817 	/* Only supported if per-process address space is supported: */
818 	if (priv->gpu->aspace == ctx->aspace)
819 		return -EOPNOTSUPP;
820 
821 	if (should_fail(&fail_gem_iova, obj->size))
822 		return -ENOMEM;
823 
824 	return msm_gem_set_iova(obj, ctx->aspace, iova);
825 }
826 
827 static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
828 		struct drm_file *file)
829 {
830 	struct drm_msm_gem_info *args = data;
831 	struct drm_gem_object *obj;
832 	struct msm_gem_object *msm_obj;
833 	int i, ret = 0;
834 
835 	if (args->pad)
836 		return -EINVAL;
837 
838 	switch (args->info) {
839 	case MSM_INFO_GET_OFFSET:
840 	case MSM_INFO_GET_IOVA:
841 	case MSM_INFO_SET_IOVA:
842 	case MSM_INFO_GET_FLAGS:
843 		/* value returned as immediate, not pointer, so len==0: */
844 		if (args->len)
845 			return -EINVAL;
846 		break;
847 	case MSM_INFO_SET_NAME:
848 	case MSM_INFO_GET_NAME:
849 		break;
850 	default:
851 		return -EINVAL;
852 	}
853 
854 	obj = drm_gem_object_lookup(file, args->handle);
855 	if (!obj)
856 		return -ENOENT;
857 
858 	msm_obj = to_msm_bo(obj);
859 
860 	switch (args->info) {
861 	case MSM_INFO_GET_OFFSET:
862 		args->value = msm_gem_mmap_offset(obj);
863 		break;
864 	case MSM_INFO_GET_IOVA:
865 		ret = msm_ioctl_gem_info_iova(dev, file, obj, &args->value);
866 		break;
867 	case MSM_INFO_SET_IOVA:
868 		ret = msm_ioctl_gem_info_set_iova(dev, file, obj, args->value);
869 		break;
870 	case MSM_INFO_GET_FLAGS:
871 		if (obj->import_attach) {
872 			ret = -EINVAL;
873 			break;
874 		}
875 		/* Hide internal kernel-only flags: */
876 		args->value = to_msm_bo(obj)->flags & MSM_BO_FLAGS;
877 		ret = 0;
878 		break;
879 	case MSM_INFO_SET_NAME:
880 		/* length check should leave room for terminating null: */
881 		if (args->len >= sizeof(msm_obj->name)) {
882 			ret = -EINVAL;
883 			break;
884 		}
885 		if (copy_from_user(msm_obj->name, u64_to_user_ptr(args->value),
886 				   args->len)) {
887 			msm_obj->name[0] = '\0';
888 			ret = -EFAULT;
889 			break;
890 		}
891 		msm_obj->name[args->len] = '\0';
892 		for (i = 0; i < args->len; i++) {
893 			if (!isprint(msm_obj->name[i])) {
894 				msm_obj->name[i] = '\0';
895 				break;
896 			}
897 		}
898 		break;
899 	case MSM_INFO_GET_NAME:
900 		if (args->value && (args->len < strlen(msm_obj->name))) {
901 			ret = -EINVAL;
902 			break;
903 		}
904 		args->len = strlen(msm_obj->name);
905 		if (args->value) {
906 			if (copy_to_user(u64_to_user_ptr(args->value),
907 					 msm_obj->name, args->len))
908 				ret = -EFAULT;
909 		}
910 		break;
911 	}
912 
913 	drm_gem_object_put(obj);
914 
915 	return ret;
916 }
917 
918 static int wait_fence(struct msm_gpu_submitqueue *queue, uint32_t fence_id,
919 		      ktime_t timeout, uint32_t flags)
920 {
921 	struct dma_fence *fence;
922 	int ret;
923 
924 	if (fence_after(fence_id, queue->last_fence)) {
925 		DRM_ERROR_RATELIMITED("waiting on invalid fence: %u (of %u)\n",
926 				      fence_id, queue->last_fence);
927 		return -EINVAL;
928 	}
929 
930 	/*
931 	 * Map submitqueue scoped "seqno" (which is actually an idr key)
932 	 * back to underlying dma-fence
933 	 *
934 	 * The fence is removed from the fence_idr when the submit is
935 	 * retired, so if the fence is not found it means there is nothing
936 	 * to wait for
937 	 */
938 	spin_lock(&queue->idr_lock);
939 	fence = idr_find(&queue->fence_idr, fence_id);
940 	if (fence)
941 		fence = dma_fence_get_rcu(fence);
942 	spin_unlock(&queue->idr_lock);
943 
944 	if (!fence)
945 		return 0;
946 
947 	if (flags & MSM_WAIT_FENCE_BOOST)
948 		dma_fence_set_deadline(fence, ktime_get());
949 
950 	ret = dma_fence_wait_timeout(fence, true, timeout_to_jiffies(&timeout));
951 	if (ret == 0) {
952 		ret = -ETIMEDOUT;
953 	} else if (ret != -ERESTARTSYS) {
954 		ret = 0;
955 	}
956 
957 	dma_fence_put(fence);
958 
959 	return ret;
960 }
961 
962 static int msm_ioctl_wait_fence(struct drm_device *dev, void *data,
963 		struct drm_file *file)
964 {
965 	struct msm_drm_private *priv = dev->dev_private;
966 	struct drm_msm_wait_fence *args = data;
967 	struct msm_gpu_submitqueue *queue;
968 	int ret;
969 
970 	if (args->flags & ~MSM_WAIT_FENCE_FLAGS) {
971 		DRM_ERROR("invalid flags: %08x\n", args->flags);
972 		return -EINVAL;
973 	}
974 
975 	if (!priv->gpu)
976 		return 0;
977 
978 	queue = msm_submitqueue_get(file->driver_priv, args->queueid);
979 	if (!queue)
980 		return -ENOENT;
981 
982 	ret = wait_fence(queue, args->fence, to_ktime(args->timeout), args->flags);
983 
984 	msm_submitqueue_put(queue);
985 
986 	return ret;
987 }
988 
989 static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data,
990 		struct drm_file *file)
991 {
992 	struct drm_msm_gem_madvise *args = data;
993 	struct drm_gem_object *obj;
994 	int ret;
995 
996 	switch (args->madv) {
997 	case MSM_MADV_DONTNEED:
998 	case MSM_MADV_WILLNEED:
999 		break;
1000 	default:
1001 		return -EINVAL;
1002 	}
1003 
1004 	obj = drm_gem_object_lookup(file, args->handle);
1005 	if (!obj) {
1006 		return -ENOENT;
1007 	}
1008 
1009 	ret = msm_gem_madvise(obj, args->madv);
1010 	if (ret >= 0) {
1011 		args->retained = ret;
1012 		ret = 0;
1013 	}
1014 
1015 	drm_gem_object_put(obj);
1016 
1017 	return ret;
1018 }
1019 
1020 
1021 static int msm_ioctl_submitqueue_new(struct drm_device *dev, void *data,
1022 		struct drm_file *file)
1023 {
1024 	struct drm_msm_submitqueue *args = data;
1025 
1026 	if (args->flags & ~MSM_SUBMITQUEUE_FLAGS)
1027 		return -EINVAL;
1028 
1029 	return msm_submitqueue_create(dev, file->driver_priv, args->prio,
1030 		args->flags, &args->id);
1031 }
1032 
1033 static int msm_ioctl_submitqueue_query(struct drm_device *dev, void *data,
1034 		struct drm_file *file)
1035 {
1036 	return msm_submitqueue_query(dev, file->driver_priv, data);
1037 }
1038 
1039 static int msm_ioctl_submitqueue_close(struct drm_device *dev, void *data,
1040 		struct drm_file *file)
1041 {
1042 	u32 id = *(u32 *) data;
1043 
1044 	return msm_submitqueue_remove(file->driver_priv, id);
1045 }
1046 
1047 static const struct drm_ioctl_desc msm_ioctls[] = {
1048 	DRM_IOCTL_DEF_DRV(MSM_GET_PARAM,    msm_ioctl_get_param,    DRM_RENDER_ALLOW),
1049 	DRM_IOCTL_DEF_DRV(MSM_SET_PARAM,    msm_ioctl_set_param,    DRM_RENDER_ALLOW),
1050 	DRM_IOCTL_DEF_DRV(MSM_GEM_NEW,      msm_ioctl_gem_new,      DRM_RENDER_ALLOW),
1051 	DRM_IOCTL_DEF_DRV(MSM_GEM_INFO,     msm_ioctl_gem_info,     DRM_RENDER_ALLOW),
1052 	DRM_IOCTL_DEF_DRV(MSM_GEM_CPU_PREP, msm_ioctl_gem_cpu_prep, DRM_RENDER_ALLOW),
1053 	DRM_IOCTL_DEF_DRV(MSM_GEM_CPU_FINI, msm_ioctl_gem_cpu_fini, DRM_RENDER_ALLOW),
1054 	DRM_IOCTL_DEF_DRV(MSM_GEM_SUBMIT,   msm_ioctl_gem_submit,   DRM_RENDER_ALLOW),
1055 	DRM_IOCTL_DEF_DRV(MSM_WAIT_FENCE,   msm_ioctl_wait_fence,   DRM_RENDER_ALLOW),
1056 	DRM_IOCTL_DEF_DRV(MSM_GEM_MADVISE,  msm_ioctl_gem_madvise,  DRM_RENDER_ALLOW),
1057 	DRM_IOCTL_DEF_DRV(MSM_SUBMITQUEUE_NEW,   msm_ioctl_submitqueue_new,   DRM_RENDER_ALLOW),
1058 	DRM_IOCTL_DEF_DRV(MSM_SUBMITQUEUE_CLOSE, msm_ioctl_submitqueue_close, DRM_RENDER_ALLOW),
1059 	DRM_IOCTL_DEF_DRV(MSM_SUBMITQUEUE_QUERY, msm_ioctl_submitqueue_query, DRM_RENDER_ALLOW),
1060 };
1061 
1062 static void msm_show_fdinfo(struct drm_printer *p, struct drm_file *file)
1063 {
1064 	struct drm_device *dev = file->minor->dev;
1065 	struct msm_drm_private *priv = dev->dev_private;
1066 
1067 	if (!priv->gpu)
1068 		return;
1069 
1070 	msm_gpu_show_fdinfo(priv->gpu, file->driver_priv, p);
1071 
1072 	drm_show_memory_stats(p, file);
1073 }
1074 
1075 static const struct file_operations fops = {
1076 	.owner = THIS_MODULE,
1077 	DRM_GEM_FOPS,
1078 	.show_fdinfo = drm_show_fdinfo,
1079 };
1080 
1081 static const struct drm_driver msm_driver = {
1082 	.driver_features    = DRIVER_GEM |
1083 				DRIVER_RENDER |
1084 				DRIVER_ATOMIC |
1085 				DRIVER_MODESET |
1086 				DRIVER_SYNCOBJ,
1087 	.open               = msm_open,
1088 	.postclose          = msm_postclose,
1089 	.dumb_create        = msm_gem_dumb_create,
1090 	.dumb_map_offset    = msm_gem_dumb_map_offset,
1091 	.gem_prime_import_sg_table = msm_gem_prime_import_sg_table,
1092 #ifdef CONFIG_DEBUG_FS
1093 	.debugfs_init       = msm_debugfs_init,
1094 #endif
1095 	.show_fdinfo        = msm_show_fdinfo,
1096 	.ioctls             = msm_ioctls,
1097 	.num_ioctls         = ARRAY_SIZE(msm_ioctls),
1098 	.fops               = &fops,
1099 	.name               = "msm",
1100 	.desc               = "MSM Snapdragon DRM",
1101 	.date               = "20130625",
1102 	.major              = MSM_VERSION_MAJOR,
1103 	.minor              = MSM_VERSION_MINOR,
1104 	.patchlevel         = MSM_VERSION_PATCHLEVEL,
1105 };
1106 
1107 int msm_pm_prepare(struct device *dev)
1108 {
1109 	struct msm_drm_private *priv = dev_get_drvdata(dev);
1110 	struct drm_device *ddev = priv ? priv->dev : NULL;
1111 
1112 	if (!priv || !priv->kms)
1113 		return 0;
1114 
1115 	return drm_mode_config_helper_suspend(ddev);
1116 }
1117 
1118 void msm_pm_complete(struct device *dev)
1119 {
1120 	struct msm_drm_private *priv = dev_get_drvdata(dev);
1121 	struct drm_device *ddev = priv ? priv->dev : NULL;
1122 
1123 	if (!priv || !priv->kms)
1124 		return;
1125 
1126 	drm_mode_config_helper_resume(ddev);
1127 }
1128 
1129 static const struct dev_pm_ops msm_pm_ops = {
1130 	.prepare = msm_pm_prepare,
1131 	.complete = msm_pm_complete,
1132 };
1133 
1134 /*
1135  * Componentized driver support:
1136  */
1137 
1138 /*
1139  * Identify what components need to be added by parsing what remote-endpoints
1140  * our MDP output ports are connected to. In the case of LVDS on MDP4, there
1141  * is no external component that we need to add since LVDS is within MDP4
1142  * itself.
1143  */
1144 static int add_components_mdp(struct device *master_dev,
1145 			      struct component_match **matchptr)
1146 {
1147 	struct device_node *np = master_dev->of_node;
1148 	struct device_node *ep_node;
1149 
1150 	for_each_endpoint_of_node(np, ep_node) {
1151 		struct device_node *intf;
1152 		struct of_endpoint ep;
1153 		int ret;
1154 
1155 		ret = of_graph_parse_endpoint(ep_node, &ep);
1156 		if (ret) {
1157 			DRM_DEV_ERROR(master_dev, "unable to parse port endpoint\n");
1158 			of_node_put(ep_node);
1159 			return ret;
1160 		}
1161 
1162 		/*
1163 		 * The LCDC/LVDS port on MDP4 is a speacial case where the
1164 		 * remote-endpoint isn't a component that we need to add
1165 		 */
1166 		if (of_device_is_compatible(np, "qcom,mdp4") &&
1167 		    ep.port == 0)
1168 			continue;
1169 
1170 		/*
1171 		 * It's okay if some of the ports don't have a remote endpoint
1172 		 * specified. It just means that the port isn't connected to
1173 		 * any external interface.
1174 		 */
1175 		intf = of_graph_get_remote_port_parent(ep_node);
1176 		if (!intf)
1177 			continue;
1178 
1179 		if (of_device_is_available(intf))
1180 			drm_of_component_match_add(master_dev, matchptr,
1181 						   component_compare_of, intf);
1182 
1183 		of_node_put(intf);
1184 	}
1185 
1186 	return 0;
1187 }
1188 
1189 /*
1190  * We don't know what's the best binding to link the gpu with the drm device.
1191  * Fow now, we just hunt for all the possible gpus that we support, and add them
1192  * as components.
1193  */
1194 static const struct of_device_id msm_gpu_match[] = {
1195 	{ .compatible = "qcom,adreno" },
1196 	{ .compatible = "qcom,adreno-3xx" },
1197 	{ .compatible = "amd,imageon" },
1198 	{ .compatible = "qcom,kgsl-3d0" },
1199 	{ },
1200 };
1201 
1202 static int add_gpu_components(struct device *dev,
1203 			      struct component_match **matchptr)
1204 {
1205 	struct device_node *np;
1206 
1207 	np = of_find_matching_node(NULL, msm_gpu_match);
1208 	if (!np)
1209 		return 0;
1210 
1211 	if (of_device_is_available(np))
1212 		drm_of_component_match_add(dev, matchptr, component_compare_of, np);
1213 
1214 	of_node_put(np);
1215 
1216 	return 0;
1217 }
1218 
1219 static int msm_drm_bind(struct device *dev)
1220 {
1221 	return msm_drm_init(dev, &msm_driver);
1222 }
1223 
1224 static void msm_drm_unbind(struct device *dev)
1225 {
1226 	msm_drm_uninit(dev);
1227 }
1228 
1229 const struct component_master_ops msm_drm_ops = {
1230 	.bind = msm_drm_bind,
1231 	.unbind = msm_drm_unbind,
1232 };
1233 
1234 int msm_drv_probe(struct device *master_dev,
1235 	int (*kms_init)(struct drm_device *dev))
1236 {
1237 	struct msm_drm_private *priv;
1238 	struct component_match *match = NULL;
1239 	int ret;
1240 
1241 	priv = devm_kzalloc(master_dev, sizeof(*priv), GFP_KERNEL);
1242 	if (!priv)
1243 		return -ENOMEM;
1244 
1245 	priv->kms_init = kms_init;
1246 	dev_set_drvdata(master_dev, priv);
1247 
1248 	/* Add mdp components if we have KMS. */
1249 	if (kms_init) {
1250 		ret = add_components_mdp(master_dev, &match);
1251 		if (ret)
1252 			return ret;
1253 	}
1254 
1255 	ret = add_gpu_components(master_dev, &match);
1256 	if (ret)
1257 		return ret;
1258 
1259 	/* on all devices that I am aware of, iommu's which can map
1260 	 * any address the cpu can see are used:
1261 	 */
1262 	ret = dma_set_mask_and_coherent(master_dev, ~0);
1263 	if (ret)
1264 		return ret;
1265 
1266 	ret = component_master_add_with_match(master_dev, &msm_drm_ops, match);
1267 	if (ret)
1268 		return ret;
1269 
1270 	return 0;
1271 }
1272 
1273 /*
1274  * Platform driver:
1275  * Used only for headlesss GPU instances
1276  */
1277 
1278 static int msm_pdev_probe(struct platform_device *pdev)
1279 {
1280 	return msm_drv_probe(&pdev->dev, NULL);
1281 }
1282 
1283 static int msm_pdev_remove(struct platform_device *pdev)
1284 {
1285 	component_master_del(&pdev->dev, &msm_drm_ops);
1286 
1287 	return 0;
1288 }
1289 
1290 void msm_drv_shutdown(struct platform_device *pdev)
1291 {
1292 	struct msm_drm_private *priv = platform_get_drvdata(pdev);
1293 	struct drm_device *drm = priv ? priv->dev : NULL;
1294 
1295 	/*
1296 	 * Shutdown the hw if we're far enough along where things might be on.
1297 	 * If we run this too early, we'll end up panicking in any variety of
1298 	 * places. Since we don't register the drm device until late in
1299 	 * msm_drm_init, drm_dev->registered is used as an indicator that the
1300 	 * shutdown will be successful.
1301 	 */
1302 	if (drm && drm->registered && priv->kms)
1303 		drm_atomic_helper_shutdown(drm);
1304 }
1305 
1306 static struct platform_driver msm_platform_driver = {
1307 	.probe      = msm_pdev_probe,
1308 	.remove     = msm_pdev_remove,
1309 	.shutdown   = msm_drv_shutdown,
1310 	.driver     = {
1311 		.name   = "msm",
1312 		.pm     = &msm_pm_ops,
1313 	},
1314 };
1315 
1316 static int __init msm_drm_register(void)
1317 {
1318 	if (!modeset)
1319 		return -EINVAL;
1320 
1321 	DBG("init");
1322 	msm_mdp_register();
1323 	msm_dpu_register();
1324 	msm_dsi_register();
1325 	msm_hdmi_register();
1326 	msm_dp_register();
1327 	adreno_register();
1328 	msm_mdp4_register();
1329 	msm_mdss_register();
1330 	return platform_driver_register(&msm_platform_driver);
1331 }
1332 
1333 static void __exit msm_drm_unregister(void)
1334 {
1335 	DBG("fini");
1336 	platform_driver_unregister(&msm_platform_driver);
1337 	msm_mdss_unregister();
1338 	msm_mdp4_unregister();
1339 	msm_dp_unregister();
1340 	msm_hdmi_unregister();
1341 	adreno_unregister();
1342 	msm_dsi_unregister();
1343 	msm_mdp_unregister();
1344 	msm_dpu_unregister();
1345 }
1346 
1347 module_init(msm_drm_register);
1348 module_exit(msm_drm_unregister);
1349 
1350 MODULE_AUTHOR("Rob Clark <robdclark@gmail.com");
1351 MODULE_DESCRIPTION("MSM DRM Driver");
1352 MODULE_LICENSE("GPL");
1353