1 // SPDX-License-Identifier: GPL-2.0 2 /* Copyright 2018 Marty E. Plummer <hanetzer@startmail.com> */ 3 /* Copyright 2019 Linaro, Ltd., Rob Herring <robh@kernel.org> */ 4 /* Copyright 2019 Collabora ltd. */ 5 6 #include <linux/module.h> 7 #include <linux/of_platform.h> 8 #include <linux/pagemap.h> 9 #include <linux/pm_runtime.h> 10 #include <drm/panfrost_drm.h> 11 #include <drm/drm_drv.h> 12 #include <drm/drm_ioctl.h> 13 #include <drm/drm_syncobj.h> 14 #include <drm/drm_utils.h> 15 16 #include "panfrost_device.h" 17 #include "panfrost_gem.h" 18 #include "panfrost_mmu.h" 19 #include "panfrost_job.h" 20 #include "panfrost_gpu.h" 21 #include "panfrost_perfcnt.h" 22 23 static bool unstable_ioctls; 24 module_param_unsafe(unstable_ioctls, bool, 0600); 25 26 static int panfrost_ioctl_get_param(struct drm_device *ddev, void *data, struct drm_file *file) 27 { 28 struct drm_panfrost_get_param *param = data; 29 struct panfrost_device *pfdev = ddev->dev_private; 30 31 if (param->pad != 0) 32 return -EINVAL; 33 34 #define PANFROST_FEATURE(name, member) \ 35 case DRM_PANFROST_PARAM_ ## name: \ 36 param->value = pfdev->features.member; \ 37 break 38 #define PANFROST_FEATURE_ARRAY(name, member, max) \ 39 case DRM_PANFROST_PARAM_ ## name ## 0 ... \ 40 DRM_PANFROST_PARAM_ ## name ## max: \ 41 param->value = pfdev->features.member[param->param - \ 42 DRM_PANFROST_PARAM_ ## name ## 0]; \ 43 break 44 45 switch (param->param) { 46 PANFROST_FEATURE(GPU_PROD_ID, id); 47 PANFROST_FEATURE(GPU_REVISION, revision); 48 PANFROST_FEATURE(SHADER_PRESENT, shader_present); 49 PANFROST_FEATURE(TILER_PRESENT, tiler_present); 50 PANFROST_FEATURE(L2_PRESENT, l2_present); 51 PANFROST_FEATURE(STACK_PRESENT, stack_present); 52 PANFROST_FEATURE(AS_PRESENT, as_present); 53 PANFROST_FEATURE(JS_PRESENT, js_present); 54 PANFROST_FEATURE(L2_FEATURES, l2_features); 55 PANFROST_FEATURE(CORE_FEATURES, core_features); 56 PANFROST_FEATURE(TILER_FEATURES, tiler_features); 57 PANFROST_FEATURE(MEM_FEATURES, mem_features); 58 PANFROST_FEATURE(MMU_FEATURES, mmu_features); 59 PANFROST_FEATURE(THREAD_FEATURES, thread_features); 60 PANFROST_FEATURE(MAX_THREADS, max_threads); 61 PANFROST_FEATURE(THREAD_MAX_WORKGROUP_SZ, 62 thread_max_workgroup_sz); 63 PANFROST_FEATURE(THREAD_MAX_BARRIER_SZ, 64 thread_max_barrier_sz); 65 PANFROST_FEATURE(COHERENCY_FEATURES, coherency_features); 66 PANFROST_FEATURE(AFBC_FEATURES, afbc_features); 67 PANFROST_FEATURE_ARRAY(TEXTURE_FEATURES, texture_features, 3); 68 PANFROST_FEATURE_ARRAY(JS_FEATURES, js_features, 15); 69 PANFROST_FEATURE(NR_CORE_GROUPS, nr_core_groups); 70 PANFROST_FEATURE(THREAD_TLS_ALLOC, thread_tls_alloc); 71 default: 72 return -EINVAL; 73 } 74 75 return 0; 76 } 77 78 static int panfrost_ioctl_create_bo(struct drm_device *dev, void *data, 79 struct drm_file *file) 80 { 81 struct panfrost_file_priv *priv = file->driver_priv; 82 struct panfrost_gem_object *bo; 83 struct drm_panfrost_create_bo *args = data; 84 struct panfrost_gem_mapping *mapping; 85 86 if (!args->size || args->pad || 87 (args->flags & ~(PANFROST_BO_NOEXEC | PANFROST_BO_HEAP))) 88 return -EINVAL; 89 90 /* Heaps should never be executable */ 91 if ((args->flags & PANFROST_BO_HEAP) && 92 !(args->flags & PANFROST_BO_NOEXEC)) 93 return -EINVAL; 94 95 bo = panfrost_gem_create_with_handle(file, dev, args->size, args->flags, 96 &args->handle); 97 if (IS_ERR(bo)) 98 return PTR_ERR(bo); 99 100 mapping = panfrost_gem_mapping_get(bo, priv); 101 if (!mapping) { 102 drm_gem_object_put(&bo->base.base); 103 return -EINVAL; 104 } 105 106 args->offset = mapping->mmnode.start << PAGE_SHIFT; 107 panfrost_gem_mapping_put(mapping); 108 109 return 0; 110 } 111 112 /** 113 * panfrost_lookup_bos() - Sets up job->bo[] with the GEM objects 114 * referenced by the job. 115 * @dev: DRM device 116 * @file_priv: DRM file for this fd 117 * @args: IOCTL args 118 * @job: job being set up 119 * 120 * Resolve handles from userspace to BOs and attach them to job. 121 * 122 * Note that this function doesn't need to unreference the BOs on 123 * failure, because that will happen at panfrost_job_cleanup() time. 124 */ 125 static int 126 panfrost_lookup_bos(struct drm_device *dev, 127 struct drm_file *file_priv, 128 struct drm_panfrost_submit *args, 129 struct panfrost_job *job) 130 { 131 struct panfrost_file_priv *priv = file_priv->driver_priv; 132 struct panfrost_gem_object *bo; 133 unsigned int i; 134 int ret; 135 136 job->bo_count = args->bo_handle_count; 137 138 if (!job->bo_count) 139 return 0; 140 141 ret = drm_gem_objects_lookup(file_priv, 142 (void __user *)(uintptr_t)args->bo_handles, 143 job->bo_count, &job->bos); 144 if (ret) 145 return ret; 146 147 job->mappings = kvmalloc_array(job->bo_count, 148 sizeof(struct panfrost_gem_mapping *), 149 GFP_KERNEL | __GFP_ZERO); 150 if (!job->mappings) 151 return -ENOMEM; 152 153 for (i = 0; i < job->bo_count; i++) { 154 struct panfrost_gem_mapping *mapping; 155 156 bo = to_panfrost_bo(job->bos[i]); 157 mapping = panfrost_gem_mapping_get(bo, priv); 158 if (!mapping) { 159 ret = -EINVAL; 160 break; 161 } 162 163 atomic_inc(&bo->gpu_usecount); 164 job->mappings[i] = mapping; 165 } 166 167 return ret; 168 } 169 170 /** 171 * panfrost_copy_in_sync() - Sets up job->deps with the sync objects 172 * referenced by the job. 173 * @dev: DRM device 174 * @file_priv: DRM file for this fd 175 * @args: IOCTL args 176 * @job: job being set up 177 * 178 * Resolve syncobjs from userspace to fences and attach them to job. 179 * 180 * Note that this function doesn't need to unreference the fences on 181 * failure, because that will happen at panfrost_job_cleanup() time. 182 */ 183 static int 184 panfrost_copy_in_sync(struct drm_device *dev, 185 struct drm_file *file_priv, 186 struct drm_panfrost_submit *args, 187 struct panfrost_job *job) 188 { 189 u32 *handles; 190 int ret = 0; 191 int i, in_fence_count; 192 193 in_fence_count = args->in_sync_count; 194 195 if (!in_fence_count) 196 return 0; 197 198 handles = kvmalloc_array(in_fence_count, sizeof(u32), GFP_KERNEL); 199 if (!handles) { 200 ret = -ENOMEM; 201 DRM_DEBUG("Failed to allocate incoming syncobj handles\n"); 202 goto fail; 203 } 204 205 if (copy_from_user(handles, 206 (void __user *)(uintptr_t)args->in_syncs, 207 in_fence_count * sizeof(u32))) { 208 ret = -EFAULT; 209 DRM_DEBUG("Failed to copy in syncobj handles\n"); 210 goto fail; 211 } 212 213 for (i = 0; i < in_fence_count; i++) { 214 struct dma_fence *fence; 215 216 ret = drm_syncobj_find_fence(file_priv, handles[i], 0, 0, 217 &fence); 218 if (ret) 219 goto fail; 220 221 ret = drm_sched_job_add_dependency(&job->base, fence); 222 223 if (ret) 224 goto fail; 225 } 226 227 fail: 228 kvfree(handles); 229 return ret; 230 } 231 232 static int panfrost_ioctl_submit(struct drm_device *dev, void *data, 233 struct drm_file *file) 234 { 235 struct panfrost_device *pfdev = dev->dev_private; 236 struct drm_panfrost_submit *args = data; 237 struct drm_syncobj *sync_out = NULL; 238 struct panfrost_job *job; 239 int ret = 0, slot; 240 241 if (!args->jc) 242 return -EINVAL; 243 244 if (args->requirements && args->requirements != PANFROST_JD_REQ_FS) 245 return -EINVAL; 246 247 if (args->out_sync > 0) { 248 sync_out = drm_syncobj_find(file, args->out_sync); 249 if (!sync_out) 250 return -ENODEV; 251 } 252 253 job = kzalloc(sizeof(*job), GFP_KERNEL); 254 if (!job) { 255 ret = -ENOMEM; 256 goto out_put_syncout; 257 } 258 259 kref_init(&job->refcount); 260 261 job->pfdev = pfdev; 262 job->jc = args->jc; 263 job->requirements = args->requirements; 264 job->flush_id = panfrost_gpu_get_latest_flush_id(pfdev); 265 job->file_priv = file->driver_priv; 266 267 slot = panfrost_job_get_slot(job); 268 269 ret = drm_sched_job_init(&job->base, 270 &job->file_priv->sched_entity[slot], 271 NULL); 272 if (ret) 273 goto out_put_job; 274 275 ret = panfrost_copy_in_sync(dev, file, args, job); 276 if (ret) 277 goto out_cleanup_job; 278 279 ret = panfrost_lookup_bos(dev, file, args, job); 280 if (ret) 281 goto out_cleanup_job; 282 283 ret = panfrost_job_push(job); 284 if (ret) 285 goto out_cleanup_job; 286 287 /* Update the return sync object for the job */ 288 if (sync_out) 289 drm_syncobj_replace_fence(sync_out, job->render_done_fence); 290 291 out_cleanup_job: 292 if (ret) 293 drm_sched_job_cleanup(&job->base); 294 out_put_job: 295 panfrost_job_put(job); 296 out_put_syncout: 297 if (sync_out) 298 drm_syncobj_put(sync_out); 299 300 return ret; 301 } 302 303 static int 304 panfrost_ioctl_wait_bo(struct drm_device *dev, void *data, 305 struct drm_file *file_priv) 306 { 307 long ret; 308 struct drm_panfrost_wait_bo *args = data; 309 struct drm_gem_object *gem_obj; 310 unsigned long timeout = drm_timeout_abs_to_jiffies(args->timeout_ns); 311 312 if (args->pad) 313 return -EINVAL; 314 315 gem_obj = drm_gem_object_lookup(file_priv, args->handle); 316 if (!gem_obj) 317 return -ENOENT; 318 319 ret = dma_resv_wait_timeout(gem_obj->resv, true, true, timeout); 320 if (!ret) 321 ret = timeout ? -ETIMEDOUT : -EBUSY; 322 323 drm_gem_object_put(gem_obj); 324 325 return ret; 326 } 327 328 static int panfrost_ioctl_mmap_bo(struct drm_device *dev, void *data, 329 struct drm_file *file_priv) 330 { 331 struct drm_panfrost_mmap_bo *args = data; 332 struct drm_gem_object *gem_obj; 333 int ret; 334 335 if (args->flags != 0) { 336 DRM_INFO("unknown mmap_bo flags: %d\n", args->flags); 337 return -EINVAL; 338 } 339 340 gem_obj = drm_gem_object_lookup(file_priv, args->handle); 341 if (!gem_obj) { 342 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); 343 return -ENOENT; 344 } 345 346 /* Don't allow mmapping of heap objects as pages are not pinned. */ 347 if (to_panfrost_bo(gem_obj)->is_heap) { 348 ret = -EINVAL; 349 goto out; 350 } 351 352 ret = drm_gem_create_mmap_offset(gem_obj); 353 if (ret == 0) 354 args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node); 355 356 out: 357 drm_gem_object_put(gem_obj); 358 return ret; 359 } 360 361 static int panfrost_ioctl_get_bo_offset(struct drm_device *dev, void *data, 362 struct drm_file *file_priv) 363 { 364 struct panfrost_file_priv *priv = file_priv->driver_priv; 365 struct drm_panfrost_get_bo_offset *args = data; 366 struct panfrost_gem_mapping *mapping; 367 struct drm_gem_object *gem_obj; 368 struct panfrost_gem_object *bo; 369 370 gem_obj = drm_gem_object_lookup(file_priv, args->handle); 371 if (!gem_obj) { 372 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); 373 return -ENOENT; 374 } 375 bo = to_panfrost_bo(gem_obj); 376 377 mapping = panfrost_gem_mapping_get(bo, priv); 378 drm_gem_object_put(gem_obj); 379 380 if (!mapping) 381 return -EINVAL; 382 383 args->offset = mapping->mmnode.start << PAGE_SHIFT; 384 panfrost_gem_mapping_put(mapping); 385 return 0; 386 } 387 388 static int panfrost_ioctl_madvise(struct drm_device *dev, void *data, 389 struct drm_file *file_priv) 390 { 391 struct panfrost_file_priv *priv = file_priv->driver_priv; 392 struct drm_panfrost_madvise *args = data; 393 struct panfrost_device *pfdev = dev->dev_private; 394 struct drm_gem_object *gem_obj; 395 struct panfrost_gem_object *bo; 396 int ret = 0; 397 398 gem_obj = drm_gem_object_lookup(file_priv, args->handle); 399 if (!gem_obj) { 400 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); 401 return -ENOENT; 402 } 403 404 bo = to_panfrost_bo(gem_obj); 405 406 mutex_lock(&pfdev->shrinker_lock); 407 mutex_lock(&bo->mappings.lock); 408 if (args->madv == PANFROST_MADV_DONTNEED) { 409 struct panfrost_gem_mapping *first; 410 411 first = list_first_entry(&bo->mappings.list, 412 struct panfrost_gem_mapping, 413 node); 414 415 /* 416 * If we want to mark the BO purgeable, there must be only one 417 * user: the caller FD. 418 * We could do something smarter and mark the BO purgeable only 419 * when all its users have marked it purgeable, but globally 420 * visible/shared BOs are likely to never be marked purgeable 421 * anyway, so let's not bother. 422 */ 423 if (!list_is_singular(&bo->mappings.list) || 424 WARN_ON_ONCE(first->mmu != priv->mmu)) { 425 ret = -EINVAL; 426 goto out_unlock_mappings; 427 } 428 } 429 430 args->retained = drm_gem_shmem_madvise(gem_obj, args->madv); 431 432 if (args->retained) { 433 if (args->madv == PANFROST_MADV_DONTNEED) 434 list_add_tail(&bo->base.madv_list, 435 &pfdev->shrinker_list); 436 else if (args->madv == PANFROST_MADV_WILLNEED) 437 list_del_init(&bo->base.madv_list); 438 } 439 440 out_unlock_mappings: 441 mutex_unlock(&bo->mappings.lock); 442 mutex_unlock(&pfdev->shrinker_lock); 443 444 drm_gem_object_put(gem_obj); 445 return ret; 446 } 447 448 int panfrost_unstable_ioctl_check(void) 449 { 450 if (!unstable_ioctls) 451 return -ENOSYS; 452 453 return 0; 454 } 455 456 static int 457 panfrost_open(struct drm_device *dev, struct drm_file *file) 458 { 459 int ret; 460 struct panfrost_device *pfdev = dev->dev_private; 461 struct panfrost_file_priv *panfrost_priv; 462 463 panfrost_priv = kzalloc(sizeof(*panfrost_priv), GFP_KERNEL); 464 if (!panfrost_priv) 465 return -ENOMEM; 466 467 panfrost_priv->pfdev = pfdev; 468 file->driver_priv = panfrost_priv; 469 470 panfrost_priv->mmu = panfrost_mmu_ctx_create(pfdev); 471 if (IS_ERR(panfrost_priv->mmu)) { 472 ret = PTR_ERR(panfrost_priv->mmu); 473 goto err_free; 474 } 475 476 ret = panfrost_job_open(panfrost_priv); 477 if (ret) 478 goto err_job; 479 480 return 0; 481 482 err_job: 483 panfrost_mmu_ctx_put(panfrost_priv->mmu); 484 err_free: 485 kfree(panfrost_priv); 486 return ret; 487 } 488 489 static void 490 panfrost_postclose(struct drm_device *dev, struct drm_file *file) 491 { 492 struct panfrost_file_priv *panfrost_priv = file->driver_priv; 493 494 panfrost_perfcnt_close(file); 495 panfrost_job_close(panfrost_priv); 496 497 panfrost_mmu_ctx_put(panfrost_priv->mmu); 498 kfree(panfrost_priv); 499 } 500 501 static const struct drm_ioctl_desc panfrost_drm_driver_ioctls[] = { 502 #define PANFROST_IOCTL(n, func, flags) \ 503 DRM_IOCTL_DEF_DRV(PANFROST_##n, panfrost_ioctl_##func, flags) 504 505 PANFROST_IOCTL(SUBMIT, submit, DRM_RENDER_ALLOW), 506 PANFROST_IOCTL(WAIT_BO, wait_bo, DRM_RENDER_ALLOW), 507 PANFROST_IOCTL(CREATE_BO, create_bo, DRM_RENDER_ALLOW), 508 PANFROST_IOCTL(MMAP_BO, mmap_bo, DRM_RENDER_ALLOW), 509 PANFROST_IOCTL(GET_PARAM, get_param, DRM_RENDER_ALLOW), 510 PANFROST_IOCTL(GET_BO_OFFSET, get_bo_offset, DRM_RENDER_ALLOW), 511 PANFROST_IOCTL(PERFCNT_ENABLE, perfcnt_enable, DRM_RENDER_ALLOW), 512 PANFROST_IOCTL(PERFCNT_DUMP, perfcnt_dump, DRM_RENDER_ALLOW), 513 PANFROST_IOCTL(MADVISE, madvise, DRM_RENDER_ALLOW), 514 }; 515 516 DEFINE_DRM_GEM_FOPS(panfrost_drm_driver_fops); 517 518 /* 519 * Panfrost driver version: 520 * - 1.0 - initial interface 521 * - 1.1 - adds HEAP and NOEXEC flags for CREATE_BO 522 * - 1.2 - adds AFBC_FEATURES query 523 */ 524 static const struct drm_driver panfrost_drm_driver = { 525 .driver_features = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ, 526 .open = panfrost_open, 527 .postclose = panfrost_postclose, 528 .ioctls = panfrost_drm_driver_ioctls, 529 .num_ioctls = ARRAY_SIZE(panfrost_drm_driver_ioctls), 530 .fops = &panfrost_drm_driver_fops, 531 .name = "panfrost", 532 .desc = "panfrost DRM", 533 .date = "20180908", 534 .major = 1, 535 .minor = 2, 536 537 .gem_create_object = panfrost_gem_create_object, 538 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 539 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 540 .gem_prime_import_sg_table = panfrost_gem_prime_import_sg_table, 541 .gem_prime_mmap = drm_gem_prime_mmap, 542 }; 543 544 static int panfrost_probe(struct platform_device *pdev) 545 { 546 struct panfrost_device *pfdev; 547 struct drm_device *ddev; 548 int err; 549 550 pfdev = devm_kzalloc(&pdev->dev, sizeof(*pfdev), GFP_KERNEL); 551 if (!pfdev) 552 return -ENOMEM; 553 554 pfdev->pdev = pdev; 555 pfdev->dev = &pdev->dev; 556 557 platform_set_drvdata(pdev, pfdev); 558 559 pfdev->comp = of_device_get_match_data(&pdev->dev); 560 if (!pfdev->comp) 561 return -ENODEV; 562 563 pfdev->coherent = device_get_dma_attr(&pdev->dev) == DEV_DMA_COHERENT; 564 565 /* Allocate and initialze the DRM device. */ 566 ddev = drm_dev_alloc(&panfrost_drm_driver, &pdev->dev); 567 if (IS_ERR(ddev)) 568 return PTR_ERR(ddev); 569 570 ddev->dev_private = pfdev; 571 pfdev->ddev = ddev; 572 573 mutex_init(&pfdev->shrinker_lock); 574 INIT_LIST_HEAD(&pfdev->shrinker_list); 575 576 err = panfrost_device_init(pfdev); 577 if (err) { 578 if (err != -EPROBE_DEFER) 579 dev_err(&pdev->dev, "Fatal error during GPU init\n"); 580 goto err_out0; 581 } 582 583 pm_runtime_set_active(pfdev->dev); 584 pm_runtime_mark_last_busy(pfdev->dev); 585 pm_runtime_enable(pfdev->dev); 586 pm_runtime_set_autosuspend_delay(pfdev->dev, 50); /* ~3 frames */ 587 pm_runtime_use_autosuspend(pfdev->dev); 588 589 /* 590 * Register the DRM device with the core and the connectors with 591 * sysfs 592 */ 593 err = drm_dev_register(ddev, 0); 594 if (err < 0) 595 goto err_out1; 596 597 panfrost_gem_shrinker_init(ddev); 598 599 return 0; 600 601 err_out1: 602 pm_runtime_disable(pfdev->dev); 603 panfrost_device_fini(pfdev); 604 pm_runtime_set_suspended(pfdev->dev); 605 err_out0: 606 drm_dev_put(ddev); 607 return err; 608 } 609 610 static int panfrost_remove(struct platform_device *pdev) 611 { 612 struct panfrost_device *pfdev = platform_get_drvdata(pdev); 613 struct drm_device *ddev = pfdev->ddev; 614 615 drm_dev_unregister(ddev); 616 panfrost_gem_shrinker_cleanup(ddev); 617 618 pm_runtime_get_sync(pfdev->dev); 619 pm_runtime_disable(pfdev->dev); 620 panfrost_device_fini(pfdev); 621 pm_runtime_set_suspended(pfdev->dev); 622 623 drm_dev_put(ddev); 624 return 0; 625 } 626 627 static const char * const default_supplies[] = { "mali" }; 628 static const struct panfrost_compatible default_data = { 629 .num_supplies = ARRAY_SIZE(default_supplies), 630 .supply_names = default_supplies, 631 .num_pm_domains = 1, /* optional */ 632 .pm_domain_names = NULL, 633 }; 634 635 static const struct panfrost_compatible amlogic_data = { 636 .num_supplies = ARRAY_SIZE(default_supplies), 637 .supply_names = default_supplies, 638 .vendor_quirk = panfrost_gpu_amlogic_quirk, 639 }; 640 641 static const char * const mediatek_mt8183_supplies[] = { "mali", "sram" }; 642 static const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" }; 643 static const struct panfrost_compatible mediatek_mt8183_data = { 644 .num_supplies = ARRAY_SIZE(mediatek_mt8183_supplies), 645 .supply_names = mediatek_mt8183_supplies, 646 .num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains), 647 .pm_domain_names = mediatek_mt8183_pm_domains, 648 }; 649 650 static const struct of_device_id dt_match[] = { 651 /* Set first to probe before the generic compatibles */ 652 { .compatible = "amlogic,meson-gxm-mali", 653 .data = &amlogic_data, }, 654 { .compatible = "amlogic,meson-g12a-mali", 655 .data = &amlogic_data, }, 656 { .compatible = "arm,mali-t604", .data = &default_data, }, 657 { .compatible = "arm,mali-t624", .data = &default_data, }, 658 { .compatible = "arm,mali-t628", .data = &default_data, }, 659 { .compatible = "arm,mali-t720", .data = &default_data, }, 660 { .compatible = "arm,mali-t760", .data = &default_data, }, 661 { .compatible = "arm,mali-t820", .data = &default_data, }, 662 { .compatible = "arm,mali-t830", .data = &default_data, }, 663 { .compatible = "arm,mali-t860", .data = &default_data, }, 664 { .compatible = "arm,mali-t880", .data = &default_data, }, 665 { .compatible = "arm,mali-bifrost", .data = &default_data, }, 666 { .compatible = "mediatek,mt8183-mali", .data = &mediatek_mt8183_data }, 667 {} 668 }; 669 MODULE_DEVICE_TABLE(of, dt_match); 670 671 static const struct dev_pm_ops panfrost_pm_ops = { 672 SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) 673 SET_RUNTIME_PM_OPS(panfrost_device_suspend, panfrost_device_resume, NULL) 674 }; 675 676 static struct platform_driver panfrost_driver = { 677 .probe = panfrost_probe, 678 .remove = panfrost_remove, 679 .driver = { 680 .name = "panfrost", 681 .pm = &panfrost_pm_ops, 682 .of_match_table = dt_match, 683 }, 684 }; 685 module_platform_driver(panfrost_driver); 686 687 MODULE_AUTHOR("Panfrost Project Developers"); 688 MODULE_DESCRIPTION("Panfrost DRM Driver"); 689 MODULE_LICENSE("GPL v2"); 690