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, DMA_RESV_USAGE_READ, 320 true, timeout); 321 if (!ret) 322 ret = timeout ? -ETIMEDOUT : -EBUSY; 323 324 drm_gem_object_put(gem_obj); 325 326 return ret; 327 } 328 329 static int panfrost_ioctl_mmap_bo(struct drm_device *dev, void *data, 330 struct drm_file *file_priv) 331 { 332 struct drm_panfrost_mmap_bo *args = data; 333 struct drm_gem_object *gem_obj; 334 int ret; 335 336 if (args->flags != 0) { 337 DRM_INFO("unknown mmap_bo flags: %d\n", args->flags); 338 return -EINVAL; 339 } 340 341 gem_obj = drm_gem_object_lookup(file_priv, args->handle); 342 if (!gem_obj) { 343 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); 344 return -ENOENT; 345 } 346 347 /* Don't allow mmapping of heap objects as pages are not pinned. */ 348 if (to_panfrost_bo(gem_obj)->is_heap) { 349 ret = -EINVAL; 350 goto out; 351 } 352 353 ret = drm_gem_create_mmap_offset(gem_obj); 354 if (ret == 0) 355 args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node); 356 357 out: 358 drm_gem_object_put(gem_obj); 359 return ret; 360 } 361 362 static int panfrost_ioctl_get_bo_offset(struct drm_device *dev, void *data, 363 struct drm_file *file_priv) 364 { 365 struct panfrost_file_priv *priv = file_priv->driver_priv; 366 struct drm_panfrost_get_bo_offset *args = data; 367 struct panfrost_gem_mapping *mapping; 368 struct drm_gem_object *gem_obj; 369 struct panfrost_gem_object *bo; 370 371 gem_obj = drm_gem_object_lookup(file_priv, args->handle); 372 if (!gem_obj) { 373 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); 374 return -ENOENT; 375 } 376 bo = to_panfrost_bo(gem_obj); 377 378 mapping = panfrost_gem_mapping_get(bo, priv); 379 drm_gem_object_put(gem_obj); 380 381 if (!mapping) 382 return -EINVAL; 383 384 args->offset = mapping->mmnode.start << PAGE_SHIFT; 385 panfrost_gem_mapping_put(mapping); 386 return 0; 387 } 388 389 static int panfrost_ioctl_madvise(struct drm_device *dev, void *data, 390 struct drm_file *file_priv) 391 { 392 struct panfrost_file_priv *priv = file_priv->driver_priv; 393 struct drm_panfrost_madvise *args = data; 394 struct panfrost_device *pfdev = dev->dev_private; 395 struct drm_gem_object *gem_obj; 396 struct panfrost_gem_object *bo; 397 int ret = 0; 398 399 gem_obj = drm_gem_object_lookup(file_priv, args->handle); 400 if (!gem_obj) { 401 DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); 402 return -ENOENT; 403 } 404 405 bo = to_panfrost_bo(gem_obj); 406 407 mutex_lock(&pfdev->shrinker_lock); 408 mutex_lock(&bo->mappings.lock); 409 if (args->madv == PANFROST_MADV_DONTNEED) { 410 struct panfrost_gem_mapping *first; 411 412 first = list_first_entry(&bo->mappings.list, 413 struct panfrost_gem_mapping, 414 node); 415 416 /* 417 * If we want to mark the BO purgeable, there must be only one 418 * user: the caller FD. 419 * We could do something smarter and mark the BO purgeable only 420 * when all its users have marked it purgeable, but globally 421 * visible/shared BOs are likely to never be marked purgeable 422 * anyway, so let's not bother. 423 */ 424 if (!list_is_singular(&bo->mappings.list) || 425 WARN_ON_ONCE(first->mmu != priv->mmu)) { 426 ret = -EINVAL; 427 goto out_unlock_mappings; 428 } 429 } 430 431 args->retained = drm_gem_shmem_madvise(&bo->base, args->madv); 432 433 if (args->retained) { 434 if (args->madv == PANFROST_MADV_DONTNEED) 435 list_add_tail(&bo->base.madv_list, 436 &pfdev->shrinker_list); 437 else if (args->madv == PANFROST_MADV_WILLNEED) 438 list_del_init(&bo->base.madv_list); 439 } 440 441 out_unlock_mappings: 442 mutex_unlock(&bo->mappings.lock); 443 mutex_unlock(&pfdev->shrinker_lock); 444 445 drm_gem_object_put(gem_obj); 446 return ret; 447 } 448 449 int panfrost_unstable_ioctl_check(void) 450 { 451 if (!unstable_ioctls) 452 return -ENOSYS; 453 454 return 0; 455 } 456 457 static int 458 panfrost_open(struct drm_device *dev, struct drm_file *file) 459 { 460 int ret; 461 struct panfrost_device *pfdev = dev->dev_private; 462 struct panfrost_file_priv *panfrost_priv; 463 464 panfrost_priv = kzalloc(sizeof(*panfrost_priv), GFP_KERNEL); 465 if (!panfrost_priv) 466 return -ENOMEM; 467 468 panfrost_priv->pfdev = pfdev; 469 file->driver_priv = panfrost_priv; 470 471 panfrost_priv->mmu = panfrost_mmu_ctx_create(pfdev); 472 if (IS_ERR(panfrost_priv->mmu)) { 473 ret = PTR_ERR(panfrost_priv->mmu); 474 goto err_free; 475 } 476 477 ret = panfrost_job_open(panfrost_priv); 478 if (ret) 479 goto err_job; 480 481 return 0; 482 483 err_job: 484 panfrost_mmu_ctx_put(panfrost_priv->mmu); 485 err_free: 486 kfree(panfrost_priv); 487 return ret; 488 } 489 490 static void 491 panfrost_postclose(struct drm_device *dev, struct drm_file *file) 492 { 493 struct panfrost_file_priv *panfrost_priv = file->driver_priv; 494 495 panfrost_perfcnt_close(file); 496 panfrost_job_close(panfrost_priv); 497 498 panfrost_mmu_ctx_put(panfrost_priv->mmu); 499 kfree(panfrost_priv); 500 } 501 502 static const struct drm_ioctl_desc panfrost_drm_driver_ioctls[] = { 503 #define PANFROST_IOCTL(n, func, flags) \ 504 DRM_IOCTL_DEF_DRV(PANFROST_##n, panfrost_ioctl_##func, flags) 505 506 PANFROST_IOCTL(SUBMIT, submit, DRM_RENDER_ALLOW), 507 PANFROST_IOCTL(WAIT_BO, wait_bo, DRM_RENDER_ALLOW), 508 PANFROST_IOCTL(CREATE_BO, create_bo, DRM_RENDER_ALLOW), 509 PANFROST_IOCTL(MMAP_BO, mmap_bo, DRM_RENDER_ALLOW), 510 PANFROST_IOCTL(GET_PARAM, get_param, DRM_RENDER_ALLOW), 511 PANFROST_IOCTL(GET_BO_OFFSET, get_bo_offset, DRM_RENDER_ALLOW), 512 PANFROST_IOCTL(PERFCNT_ENABLE, perfcnt_enable, DRM_RENDER_ALLOW), 513 PANFROST_IOCTL(PERFCNT_DUMP, perfcnt_dump, DRM_RENDER_ALLOW), 514 PANFROST_IOCTL(MADVISE, madvise, DRM_RENDER_ALLOW), 515 }; 516 517 DEFINE_DRM_GEM_FOPS(panfrost_drm_driver_fops); 518 519 /* 520 * Panfrost driver version: 521 * - 1.0 - initial interface 522 * - 1.1 - adds HEAP and NOEXEC flags for CREATE_BO 523 * - 1.2 - adds AFBC_FEATURES query 524 */ 525 static const struct drm_driver panfrost_drm_driver = { 526 .driver_features = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ, 527 .open = panfrost_open, 528 .postclose = panfrost_postclose, 529 .ioctls = panfrost_drm_driver_ioctls, 530 .num_ioctls = ARRAY_SIZE(panfrost_drm_driver_ioctls), 531 .fops = &panfrost_drm_driver_fops, 532 .name = "panfrost", 533 .desc = "panfrost DRM", 534 .date = "20180908", 535 .major = 1, 536 .minor = 2, 537 538 .gem_create_object = panfrost_gem_create_object, 539 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 540 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 541 .gem_prime_import_sg_table = panfrost_gem_prime_import_sg_table, 542 .gem_prime_mmap = drm_gem_prime_mmap, 543 }; 544 545 static int panfrost_probe(struct platform_device *pdev) 546 { 547 struct panfrost_device *pfdev; 548 struct drm_device *ddev; 549 int err; 550 551 pfdev = devm_kzalloc(&pdev->dev, sizeof(*pfdev), GFP_KERNEL); 552 if (!pfdev) 553 return -ENOMEM; 554 555 pfdev->pdev = pdev; 556 pfdev->dev = &pdev->dev; 557 558 platform_set_drvdata(pdev, pfdev); 559 560 pfdev->comp = of_device_get_match_data(&pdev->dev); 561 if (!pfdev->comp) 562 return -ENODEV; 563 564 pfdev->coherent = device_get_dma_attr(&pdev->dev) == DEV_DMA_COHERENT; 565 566 /* Allocate and initialize the DRM device. */ 567 ddev = drm_dev_alloc(&panfrost_drm_driver, &pdev->dev); 568 if (IS_ERR(ddev)) 569 return PTR_ERR(ddev); 570 571 ddev->dev_private = pfdev; 572 pfdev->ddev = ddev; 573 574 mutex_init(&pfdev->shrinker_lock); 575 INIT_LIST_HEAD(&pfdev->shrinker_list); 576 577 err = panfrost_device_init(pfdev); 578 if (err) { 579 if (err != -EPROBE_DEFER) 580 dev_err(&pdev->dev, "Fatal error during GPU init\n"); 581 goto err_out0; 582 } 583 584 pm_runtime_set_active(pfdev->dev); 585 pm_runtime_mark_last_busy(pfdev->dev); 586 pm_runtime_enable(pfdev->dev); 587 pm_runtime_set_autosuspend_delay(pfdev->dev, 50); /* ~3 frames */ 588 pm_runtime_use_autosuspend(pfdev->dev); 589 590 /* 591 * Register the DRM device with the core and the connectors with 592 * sysfs 593 */ 594 err = drm_dev_register(ddev, 0); 595 if (err < 0) 596 goto err_out1; 597 598 panfrost_gem_shrinker_init(ddev); 599 600 return 0; 601 602 err_out1: 603 pm_runtime_disable(pfdev->dev); 604 panfrost_device_fini(pfdev); 605 pm_runtime_set_suspended(pfdev->dev); 606 err_out0: 607 drm_dev_put(ddev); 608 return err; 609 } 610 611 static int panfrost_remove(struct platform_device *pdev) 612 { 613 struct panfrost_device *pfdev = platform_get_drvdata(pdev); 614 struct drm_device *ddev = pfdev->ddev; 615 616 drm_dev_unregister(ddev); 617 panfrost_gem_shrinker_cleanup(ddev); 618 619 pm_runtime_get_sync(pfdev->dev); 620 pm_runtime_disable(pfdev->dev); 621 panfrost_device_fini(pfdev); 622 pm_runtime_set_suspended(pfdev->dev); 623 624 drm_dev_put(ddev); 625 return 0; 626 } 627 628 static const char * const default_supplies[] = { "mali" }; 629 static const struct panfrost_compatible default_data = { 630 .num_supplies = ARRAY_SIZE(default_supplies), 631 .supply_names = default_supplies, 632 .num_pm_domains = 1, /* optional */ 633 .pm_domain_names = NULL, 634 }; 635 636 static const struct panfrost_compatible amlogic_data = { 637 .num_supplies = ARRAY_SIZE(default_supplies), 638 .supply_names = default_supplies, 639 .vendor_quirk = panfrost_gpu_amlogic_quirk, 640 }; 641 642 static const char * const mediatek_mt8183_supplies[] = { "mali", "sram" }; 643 static const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" }; 644 static const struct panfrost_compatible mediatek_mt8183_data = { 645 .num_supplies = ARRAY_SIZE(mediatek_mt8183_supplies), 646 .supply_names = mediatek_mt8183_supplies, 647 .num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains), 648 .pm_domain_names = mediatek_mt8183_pm_domains, 649 }; 650 651 static const struct of_device_id dt_match[] = { 652 /* Set first to probe before the generic compatibles */ 653 { .compatible = "amlogic,meson-gxm-mali", 654 .data = &amlogic_data, }, 655 { .compatible = "amlogic,meson-g12a-mali", 656 .data = &amlogic_data, }, 657 { .compatible = "arm,mali-t604", .data = &default_data, }, 658 { .compatible = "arm,mali-t624", .data = &default_data, }, 659 { .compatible = "arm,mali-t628", .data = &default_data, }, 660 { .compatible = "arm,mali-t720", .data = &default_data, }, 661 { .compatible = "arm,mali-t760", .data = &default_data, }, 662 { .compatible = "arm,mali-t820", .data = &default_data, }, 663 { .compatible = "arm,mali-t830", .data = &default_data, }, 664 { .compatible = "arm,mali-t860", .data = &default_data, }, 665 { .compatible = "arm,mali-t880", .data = &default_data, }, 666 { .compatible = "arm,mali-bifrost", .data = &default_data, }, 667 { .compatible = "mediatek,mt8183-mali", .data = &mediatek_mt8183_data }, 668 {} 669 }; 670 MODULE_DEVICE_TABLE(of, dt_match); 671 672 static const struct dev_pm_ops panfrost_pm_ops = { 673 SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) 674 SET_RUNTIME_PM_OPS(panfrost_device_suspend, panfrost_device_resume, NULL) 675 }; 676 677 static struct platform_driver panfrost_driver = { 678 .probe = panfrost_probe, 679 .remove = panfrost_remove, 680 .driver = { 681 .name = "panfrost", 682 .pm = &panfrost_pm_ops, 683 .of_match_table = dt_match, 684 }, 685 }; 686 module_platform_driver(panfrost_driver); 687 688 MODULE_AUTHOR("Panfrost Project Developers"); 689 MODULE_DESCRIPTION("Panfrost DRM Driver"); 690 MODULE_LICENSE("GPL v2"); 691