Lines Matching +full:mt8173 +full:- +full:mmsys

1 // SPDX-License-Identifier: GPL-2.0-only
8 #include <linux/clk-provider.h>
15 #include <linux/dma-mapping.h>
51 if (info->num_planes != 1) in mtk_drm_mode_fb_create()
52 return ERR_PTR(-EINVAL); in mtk_drm_mode_fb_create()
347 struct mtk_drm_private *private = drm->dev_private; in mtk_drm_kms_init()
354 return -ENODEV; in mtk_drm_kms_init()
357 return -EPROBE_DEFER; in mtk_drm_kms_init()
359 pdev = of_find_device_by_node(private->mutex_node); in mtk_drm_kms_init()
361 dev_err(drm->dev, "Waiting for disp-mutex device %pOF\n", in mtk_drm_kms_init()
362 private->mutex_node); in mtk_drm_kms_init()
363 of_node_put(private->mutex_node); in mtk_drm_kms_init()
364 return -EPROBE_DEFER; in mtk_drm_kms_init()
366 private->mutex_dev = &pdev->dev; in mtk_drm_kms_init()
372 drm->mode_config.min_width = 64; in mtk_drm_kms_init()
373 drm->mode_config.min_height = 64; in mtk_drm_kms_init()
380 drm->mode_config.max_width = 4096; in mtk_drm_kms_init()
381 drm->mode_config.max_height = 4096; in mtk_drm_kms_init()
382 drm->mode_config.funcs = &mtk_drm_mode_config_funcs; in mtk_drm_kms_init()
383 drm->mode_config.helper_private = &mtk_drm_mode_config_helpers; in mtk_drm_kms_init()
385 ret = component_bind_all(drm->dev, drm); in mtk_drm_kms_init()
392 * OVL0 -> COLOR0 -> AAL -> OD -> RDMA0 -> UFOE -> DSI0 ... in mtk_drm_kms_init()
394 ret = mtk_drm_crtc_create(drm, private->data->main_path, in mtk_drm_kms_init()
395 private->data->main_len); in mtk_drm_kms_init()
398 /* ... and OVL1 -> COLOR1 -> GAMMA -> RDMA1 -> DPI0. */ in mtk_drm_kms_init()
399 ret = mtk_drm_crtc_create(drm, private->data->ext_path, in mtk_drm_kms_init()
400 private->data->ext_len); in mtk_drm_kms_init()
404 ret = mtk_drm_crtc_create(drm, private->data->third_path, in mtk_drm_kms_init()
405 private->data->third_len); in mtk_drm_kms_init()
410 np = private->comp_node[private->data->main_path[0]] ?: in mtk_drm_kms_init()
411 private->comp_node[private->data->ext_path[0]]; in mtk_drm_kms_init()
414 ret = -ENODEV; in mtk_drm_kms_init()
415 dev_err(drm->dev, "Need at least one OVL device\n"); in mtk_drm_kms_init()
419 dma_dev = &pdev->dev; in mtk_drm_kms_init()
420 private->dma_dev = dma_dev; in mtk_drm_kms_init()
442 component_unbind_all(drm->dev, drm); in mtk_drm_kms_init()
444 put_device(private->mutex_dev); in mtk_drm_kms_init()
453 component_unbind_all(drm->dev, drm); in mtk_drm_kms_deinit()
460 * not dev->dev, as drm_gem_prime_import() expects.
465 struct mtk_drm_private *private = dev->dev_private; in mtk_drm_gem_prime_import()
467 return drm_gem_prime_import_dev(dev, dma_buf, private->dma_dev); in mtk_drm_gem_prime_import()
499 drm->dev_private = private; in mtk_drm_bind()
500 private->drm = drm; in mtk_drm_bind()
525 drm_dev_unregister(private->drm); in mtk_drm_unbind()
526 mtk_drm_kms_deinit(private->drm); in mtk_drm_unbind()
527 drm_dev_put(private->drm); in mtk_drm_unbind()
528 private->num_pipes = 0; in mtk_drm_unbind()
529 private->drm = NULL; in mtk_drm_unbind()
538 { .compatible = "mediatek,mt8167-disp-aal",
540 { .compatible = "mediatek,mt8173-disp-aal",
542 { .compatible = "mediatek,mt8183-disp-aal",
544 { .compatible = "mediatek,mt8192-disp-aal",
546 { .compatible = "mediatek,mt8167-disp-ccorr",
548 { .compatible = "mediatek,mt8183-disp-ccorr",
550 { .compatible = "mediatek,mt8192-disp-ccorr",
552 { .compatible = "mediatek,mt2701-disp-color",
554 { .compatible = "mediatek,mt8167-disp-color",
556 { .compatible = "mediatek,mt8173-disp-color",
558 { .compatible = "mediatek,mt8167-disp-dither",
560 { .compatible = "mediatek,mt8183-disp-dither",
562 { .compatible = "mediatek,mt8195-disp-dsc",
564 { .compatible = "mediatek,mt8167-disp-gamma",
566 { .compatible = "mediatek,mt8173-disp-gamma",
568 { .compatible = "mediatek,mt8183-disp-gamma",
570 { .compatible = "mediatek,mt8195-disp-merge",
572 { .compatible = "mediatek,mt2701-disp-mutex",
574 { .compatible = "mediatek,mt2712-disp-mutex",
576 { .compatible = "mediatek,mt8167-disp-mutex",
578 { .compatible = "mediatek,mt8173-disp-mutex",
580 { .compatible = "mediatek,mt8183-disp-mutex",
582 { .compatible = "mediatek,mt8186-disp-mutex",
584 { .compatible = "mediatek,mt8192-disp-mutex",
586 { .compatible = "mediatek,mt8195-disp-mutex",
588 { .compatible = "mediatek,mt8173-disp-od",
590 { .compatible = "mediatek,mt2701-disp-ovl",
592 { .compatible = "mediatek,mt8167-disp-ovl",
594 { .compatible = "mediatek,mt8173-disp-ovl",
596 { .compatible = "mediatek,mt8183-disp-ovl",
598 { .compatible = "mediatek,mt8192-disp-ovl",
600 { .compatible = "mediatek,mt8183-disp-ovl-2l",
602 { .compatible = "mediatek,mt8192-disp-ovl-2l",
604 { .compatible = "mediatek,mt8192-disp-postmask",
606 { .compatible = "mediatek,mt2701-disp-pwm",
608 { .compatible = "mediatek,mt8167-disp-pwm",
610 { .compatible = "mediatek,mt8173-disp-pwm",
612 { .compatible = "mediatek,mt2701-disp-rdma",
614 { .compatible = "mediatek,mt8167-disp-rdma",
616 { .compatible = "mediatek,mt8173-disp-rdma",
618 { .compatible = "mediatek,mt8183-disp-rdma",
620 { .compatible = "mediatek,mt8195-disp-rdma",
622 { .compatible = "mediatek,mt8173-disp-ufoe",
624 { .compatible = "mediatek,mt8173-disp-wdma",
626 { .compatible = "mediatek,mt2701-dpi",
628 { .compatible = "mediatek,mt8167-dsi",
630 { .compatible = "mediatek,mt8173-dpi",
632 { .compatible = "mediatek,mt8183-dpi",
634 { .compatible = "mediatek,mt8192-dpi",
636 { .compatible = "mediatek,mt8195-dp-intf",
638 { .compatible = "mediatek,mt2701-dsi",
640 { .compatible = "mediatek,mt8173-dsi",
642 { .compatible = "mediatek,mt8183-dsi",
644 { .compatible = "mediatek,mt8186-dsi",
650 { .compatible = "mediatek,mt2701-mmsys",
652 { .compatible = "mediatek,mt7623-mmsys",
654 { .compatible = "mediatek,mt2712-mmsys",
656 { .compatible = "mediatek,mt8167-mmsys",
658 { .compatible = "mediatek,mt8173-mmsys",
660 { .compatible = "mediatek,mt8183-mmsys",
662 { .compatible = "mediatek,mt8186-mmsys",
664 { .compatible = "mediatek,mt8192-mmsys",
666 { .compatible = "mediatek,mt8195-mmsys",
676 struct platform_device *pdev = of_find_device_by_node(dev->parent->of_node); in mtk_drm_find_match_data()
682 return -EINVAL; in mtk_drm_find_match_data()
685 for (i = 0; i < match_data->num_drv_data; i++) in mtk_drm_find_match_data()
686 if (match_data->drv_data[i]->io_start == res->start) in mtk_drm_find_match_data()
689 return -EINVAL; in mtk_drm_find_match_data()
694 struct device *dev = &pdev->dev; in mtk_drm_probe()
695 struct device_node *phandle = dev->parent->of_node; in mtk_drm_probe()
706 return -ENOMEM; in mtk_drm_probe()
708 private->mmsys_dev = dev->parent; in mtk_drm_probe()
709 if (!private->mmsys_dev) { in mtk_drm_probe()
710 dev_err(dev, "Failed to get MMSYS device\n"); in mtk_drm_probe()
711 return -ENODEV; in mtk_drm_probe()
716 return -ENODEV; in mtk_drm_probe()
718 match_data = of_id->data; in mtk_drm_probe()
719 if (match_data->num_drv_data > 1) { in mtk_drm_probe()
720 /* This SoC has multiple mmsys channels */ in mtk_drm_probe()
726 private->data = match_data->drv_data[ret]; in mtk_drm_probe()
728 dev_dbg(dev, "Using single mmsys channel\n"); in mtk_drm_probe()
729 private->data = match_data->drv_data[0]; in mtk_drm_probe()
733 for_each_child_of_node(phandle->parent, node) { in mtk_drm_probe()
748 comp_type = (enum mtk_ddp_comp_type)of_id->data; in mtk_drm_probe()
751 private->mutex_node = of_node_get(node); in mtk_drm_probe()
762 private->comp_node[comp_id] = of_node_get(node); in mtk_drm_probe()
786 ret = mtk_ddp_comp_init(node, &private->ddp_comp[comp_id], comp_id); in mtk_drm_probe()
793 if (!private->mutex_node) { in mtk_drm_probe()
794 dev_err(dev, "Failed to find disp-mutex node\n"); in mtk_drm_probe()
795 ret = -ENODEV; in mtk_drm_probe()
812 of_node_put(private->mutex_node); in mtk_drm_probe()
814 of_node_put(private->comp_node[i]); in mtk_drm_probe()
823 component_master_del(&pdev->dev, &mtk_drm_ops); in mtk_drm_remove()
824 pm_runtime_disable(&pdev->dev); in mtk_drm_remove()
825 of_node_put(private->mutex_node); in mtk_drm_remove()
827 of_node_put(private->comp_node[i]); in mtk_drm_remove()
835 struct drm_device *drm = private->drm; in mtk_drm_sys_prepare()
843 struct drm_device *drm = private->drm; in mtk_drm_sys_complete()
860 .name = "mediatek-drm",