Lines Matching +full:mt8183 +full:- +full:dsi
1 // SPDX-License-Identifier: GPL-2.0-only
13 #include <linux/dma-mapping.h>
49 if (info->num_planes != 1) in mtk_drm_mode_fb_create()
50 return ERR_PTR(-EINVAL); in mtk_drm_mode_fb_create()
325 .min_width = 2, /* 2-pixel align when ethdr is bypassed */
330 { .compatible = "mediatek,mt2701-mmsys",
332 { .compatible = "mediatek,mt7623-mmsys",
334 { .compatible = "mediatek,mt2712-mmsys",
336 { .compatible = "mediatek,mt8167-mmsys",
338 { .compatible = "mediatek,mt8173-mmsys",
340 { .compatible = "mediatek,mt8183-mmsys",
342 { .compatible = "mediatek,mt8186-mmsys",
344 { .compatible = "mediatek,mt8188-vdosys0",
346 { .compatible = "mediatek,mt8188-vdosys1",
348 { .compatible = "mediatek,mt8192-mmsys",
350 { .compatible = "mediatek,mt8195-mmsys",
352 { .compatible = "mediatek,mt8195-vdosys0",
354 { .compatible = "mediatek,mt8195-vdosys1",
362 if (!strncmp(dev_name(dev), "mediatek-drm", sizeof("mediatek-drm") - 1)) in mtk_drm_match()
372 struct device_node *phandle = dev->parent->of_node; in mtk_drm_get_all_drm_priv()
379 for_each_child_of_node(phandle->parent, node) { in mtk_drm_get_all_drm_priv()
390 drm_dev = device_find_child(&pdev->dev, NULL, mtk_drm_match); in mtk_drm_get_all_drm_priv()
398 if (temp_drm_priv->data->main_len) in mtk_drm_get_all_drm_priv()
400 else if (temp_drm_priv->data->ext_len) in mtk_drm_get_all_drm_priv()
402 else if (temp_drm_priv->data->third_len) in mtk_drm_get_all_drm_priv()
405 if (temp_drm_priv->mtk_drm_bound) in mtk_drm_get_all_drm_priv()
412 if (drm_priv->data->mmsys_dev_num == cnt) { in mtk_drm_get_all_drm_priv()
415 all_drm_priv[j]->all_drm_private[i] = all_drm_priv[i]; in mtk_drm_get_all_drm_priv()
425 const struct mtk_mmsys_driver_data *drv_data = private->data; in mtk_drm_find_mmsys_comp()
428 if (drv_data->main_path) in mtk_drm_find_mmsys_comp()
429 for (i = 0; i < drv_data->main_len; i++) in mtk_drm_find_mmsys_comp()
430 if (drv_data->main_path[i] == comp_id) in mtk_drm_find_mmsys_comp()
433 if (drv_data->ext_path) in mtk_drm_find_mmsys_comp()
434 for (i = 0; i < drv_data->ext_len; i++) in mtk_drm_find_mmsys_comp()
435 if (drv_data->ext_path[i] == comp_id) in mtk_drm_find_mmsys_comp()
438 if (drv_data->third_path) in mtk_drm_find_mmsys_comp()
439 for (i = 0; i < drv_data->third_len; i++) in mtk_drm_find_mmsys_comp()
440 if (drv_data->third_path[i] == comp_id) in mtk_drm_find_mmsys_comp()
443 if (drv_data->num_conn_routes) in mtk_drm_find_mmsys_comp()
444 for (i = 0; i < drv_data->num_conn_routes; i++) in mtk_drm_find_mmsys_comp()
445 if (drv_data->conn_routes[i].route_ddp == comp_id) in mtk_drm_find_mmsys_comp()
453 struct mtk_drm_private *private = drm->dev_private; in mtk_drm_kms_init()
460 return -ENODEV; in mtk_drm_kms_init()
466 drm->mode_config.min_width = 64; in mtk_drm_kms_init()
467 drm->mode_config.min_height = 64; in mtk_drm_kms_init()
474 drm->mode_config.max_width = 4096; in mtk_drm_kms_init()
475 drm->mode_config.max_height = 4096; in mtk_drm_kms_init()
476 drm->mode_config.funcs = &mtk_drm_mode_config_funcs; in mtk_drm_kms_init()
477 drm->mode_config.helper_private = &mtk_drm_mode_config_helpers; in mtk_drm_kms_init()
479 for (i = 0; i < private->data->mmsys_dev_num; i++) { in mtk_drm_kms_init()
480 drm->dev_private = private->all_drm_private[i]; in mtk_drm_kms_init()
481 ret = component_bind_all(private->all_drm_private[i]->dev, drm); in mtk_drm_kms_init()
495 * OVL0 -> COLOR0 -> AAL -> OD -> RDMA0 -> UFOE -> DSI0 ... in mtk_drm_kms_init()
502 for (j = 0; j < private->data->mmsys_dev_num; j++) { in mtk_drm_kms_init()
503 priv_n = private->all_drm_private[j]; in mtk_drm_kms_init()
505 if (priv_n->data->max_width) in mtk_drm_kms_init()
506 drm->mode_config.max_width = priv_n->data->max_width; in mtk_drm_kms_init()
508 if (priv_n->data->min_width) in mtk_drm_kms_init()
509 drm->mode_config.min_width = priv_n->data->min_width; in mtk_drm_kms_init()
511 if (priv_n->data->min_height) in mtk_drm_kms_init()
512 drm->mode_config.min_height = priv_n->data->min_height; in mtk_drm_kms_init()
514 if (i == CRTC_MAIN && priv_n->data->main_len) { in mtk_drm_kms_init()
515 ret = mtk_crtc_create(drm, priv_n->data->main_path, in mtk_drm_kms_init()
516 priv_n->data->main_len, j, in mtk_drm_kms_init()
517 priv_n->data->conn_routes, in mtk_drm_kms_init()
518 priv_n->data->num_conn_routes); in mtk_drm_kms_init()
523 } else if (i == CRTC_EXT && priv_n->data->ext_len) { in mtk_drm_kms_init()
524 ret = mtk_crtc_create(drm, priv_n->data->ext_path, in mtk_drm_kms_init()
525 priv_n->data->ext_len, j, NULL, 0); in mtk_drm_kms_init()
530 } else if (i == CRTC_THIRD && priv_n->data->third_len) { in mtk_drm_kms_init()
531 ret = mtk_crtc_create(drm, priv_n->data->third_path, in mtk_drm_kms_init()
532 priv_n->data->third_len, j, NULL, 0); in mtk_drm_kms_init()
542 drm->mode_config.cursor_width = 512; in mtk_drm_kms_init()
543 drm->mode_config.cursor_height = 512; in mtk_drm_kms_init()
550 ret = -ENODEV; in mtk_drm_kms_init()
551 dev_err(drm->dev, "Need at least one OVL device\n"); in mtk_drm_kms_init()
555 for (i = 0; i < private->data->mmsys_dev_num; i++) in mtk_drm_kms_init()
556 private->all_drm_private[i]->dma_dev = dma_dev; in mtk_drm_kms_init()
574 for (i = 0; i < private->data->mmsys_dev_num; i++) in mtk_drm_kms_init()
575 component_unbind_all(private->all_drm_private[i]->dev, drm); in mtk_drm_kms_init()
577 for (i = 0; i < private->data->mmsys_dev_num; i++) in mtk_drm_kms_init()
578 put_device(private->all_drm_private[i]->mutex_dev); in mtk_drm_kms_init()
588 component_unbind_all(drm->dev, drm); in mtk_drm_kms_deinit()
595 * not dev->dev, as drm_gem_prime_import() expects.
600 struct mtk_drm_private *private = dev->dev_private; in mtk_gem_prime_import()
602 return drm_gem_prime_import_dev(dev, dma_buf, private->dma_dev); in mtk_gem_prime_import()
633 pdev = of_find_device_by_node(private->mutex_node); in mtk_drm_bind()
635 dev_err(dev, "Waiting for disp-mutex device %pOF\n", in mtk_drm_bind()
636 private->mutex_node); in mtk_drm_bind()
637 of_node_put(private->mutex_node); in mtk_drm_bind()
638 return -EPROBE_DEFER; in mtk_drm_bind()
641 private->mutex_dev = &pdev->dev; in mtk_drm_bind()
642 private->mtk_drm_bound = true; in mtk_drm_bind()
643 private->dev = dev; in mtk_drm_bind()
652 private->drm_master = true; in mtk_drm_bind()
653 drm->dev_private = private; in mtk_drm_bind()
654 for (i = 0; i < private->data->mmsys_dev_num; i++) in mtk_drm_bind()
655 private->all_drm_private[i]->drm = drm; in mtk_drm_bind()
672 private->drm = NULL; in mtk_drm_bind()
682 if (private->drm_master) { in mtk_drm_unbind()
683 drm_dev_unregister(private->drm); in mtk_drm_unbind()
684 mtk_drm_kms_deinit(private->drm); in mtk_drm_unbind()
685 drm_dev_put(private->drm); in mtk_drm_unbind()
687 private->mtk_drm_bound = false; in mtk_drm_unbind()
688 private->drm_master = false; in mtk_drm_unbind()
689 private->drm = NULL; in mtk_drm_unbind()
698 { .compatible = "mediatek,mt8167-disp-aal",
700 { .compatible = "mediatek,mt8173-disp-aal",
702 { .compatible = "mediatek,mt8183-disp-aal",
704 { .compatible = "mediatek,mt8192-disp-aal",
706 { .compatible = "mediatek,mt8167-disp-ccorr",
708 { .compatible = "mediatek,mt8183-disp-ccorr",
710 { .compatible = "mediatek,mt8192-disp-ccorr",
712 { .compatible = "mediatek,mt2701-disp-color",
714 { .compatible = "mediatek,mt8167-disp-color",
716 { .compatible = "mediatek,mt8173-disp-color",
718 { .compatible = "mediatek,mt8167-disp-dither",
720 { .compatible = "mediatek,mt8183-disp-dither",
722 { .compatible = "mediatek,mt8195-disp-dsc",
724 { .compatible = "mediatek,mt8167-disp-gamma",
726 { .compatible = "mediatek,mt8173-disp-gamma",
728 { .compatible = "mediatek,mt8183-disp-gamma",
730 { .compatible = "mediatek,mt8195-disp-gamma",
732 { .compatible = "mediatek,mt8195-disp-merge",
734 { .compatible = "mediatek,mt2701-disp-mutex",
736 { .compatible = "mediatek,mt2712-disp-mutex",
738 { .compatible = "mediatek,mt8167-disp-mutex",
740 { .compatible = "mediatek,mt8173-disp-mutex",
742 { .compatible = "mediatek,mt8183-disp-mutex",
744 { .compatible = "mediatek,mt8186-disp-mutex",
746 { .compatible = "mediatek,mt8188-disp-mutex",
748 { .compatible = "mediatek,mt8192-disp-mutex",
750 { .compatible = "mediatek,mt8195-disp-mutex",
752 { .compatible = "mediatek,mt8173-disp-od",
754 { .compatible = "mediatek,mt2701-disp-ovl",
756 { .compatible = "mediatek,mt8167-disp-ovl",
758 { .compatible = "mediatek,mt8173-disp-ovl",
760 { .compatible = "mediatek,mt8183-disp-ovl",
762 { .compatible = "mediatek,mt8192-disp-ovl",
764 { .compatible = "mediatek,mt8195-disp-ovl",
766 { .compatible = "mediatek,mt8183-disp-ovl-2l",
768 { .compatible = "mediatek,mt8192-disp-ovl-2l",
770 { .compatible = "mediatek,mt8192-disp-postmask",
772 { .compatible = "mediatek,mt2701-disp-pwm",
774 { .compatible = "mediatek,mt8167-disp-pwm",
776 { .compatible = "mediatek,mt8173-disp-pwm",
778 { .compatible = "mediatek,mt2701-disp-rdma",
780 { .compatible = "mediatek,mt8167-disp-rdma",
782 { .compatible = "mediatek,mt8173-disp-rdma",
784 { .compatible = "mediatek,mt8183-disp-rdma",
786 { .compatible = "mediatek,mt8195-disp-rdma",
788 { .compatible = "mediatek,mt8173-disp-ufoe",
790 { .compatible = "mediatek,mt8173-disp-wdma",
792 { .compatible = "mediatek,mt2701-dpi",
794 { .compatible = "mediatek,mt8167-dsi",
796 { .compatible = "mediatek,mt8173-dpi",
798 { .compatible = "mediatek,mt8183-dpi",
800 { .compatible = "mediatek,mt8186-dpi",
802 { .compatible = "mediatek,mt8188-dp-intf",
804 { .compatible = "mediatek,mt8192-dpi",
806 { .compatible = "mediatek,mt8195-dp-intf",
808 { .compatible = "mediatek,mt2701-dsi",
810 { .compatible = "mediatek,mt8173-dsi",
812 { .compatible = "mediatek,mt8183-dsi",
814 { .compatible = "mediatek,mt8186-dsi",
816 { .compatible = "mediatek,mt8188-dsi",
823 struct device *dev = &pdev->dev; in mtk_drm_probe()
824 struct device_node *phandle = dev->parent->of_node; in mtk_drm_probe()
835 return -ENOMEM; in mtk_drm_probe()
837 private->mmsys_dev = dev->parent; in mtk_drm_probe()
838 if (!private->mmsys_dev) { in mtk_drm_probe()
840 return -ENODEV; in mtk_drm_probe()
845 return -ENODEV; in mtk_drm_probe()
847 private->data = of_id->data; in mtk_drm_probe()
849 private->all_drm_private = devm_kmalloc_array(dev, private->data->mmsys_dev_num, in mtk_drm_probe()
850 sizeof(*private->all_drm_private), in mtk_drm_probe()
852 if (!private->all_drm_private) in mtk_drm_probe()
853 return -ENOMEM; in mtk_drm_probe()
857 ovl_adaptor = platform_device_register_data(dev, "mediatek-disp-ovl-adaptor", in mtk_drm_probe()
859 (void *)private->mmsys_dev, in mtk_drm_probe()
860 sizeof(*private->mmsys_dev)); in mtk_drm_probe()
861 private->ddp_comp[DDP_COMPONENT_DRM_OVL_ADAPTOR].dev = &ovl_adaptor->dev; in mtk_drm_probe()
862 mtk_ddp_comp_init(NULL, &private->ddp_comp[DDP_COMPONENT_DRM_OVL_ADAPTOR], in mtk_drm_probe()
864 component_match_add(dev, &match, compare_dev, &ovl_adaptor->dev); in mtk_drm_probe()
868 for_each_child_of_node(phandle->parent, node) { in mtk_drm_probe()
883 comp_type = (enum mtk_ddp_comp_type)(uintptr_t)of_id->data; in mtk_drm_probe()
889 if (id < 0 || id == private->data->mmsys_id) { in mtk_drm_probe()
890 private->mutex_node = of_node_get(node); in mtk_drm_probe()
891 dev_dbg(dev, "get mutex for mmsys %d", private->data->mmsys_id); in mtk_drm_probe()
906 private->comp_node[comp_id] = of_node_get(node); in mtk_drm_probe()
909 * Currently only the AAL, CCORR, COLOR, GAMMA, MERGE, OVL, RDMA, DSI, and DPI in mtk_drm_probe()
931 ret = mtk_ddp_comp_init(node, &private->ddp_comp[comp_id], comp_id); in mtk_drm_probe()
938 if (!private->mutex_node) { in mtk_drm_probe()
939 dev_err(dev, "Failed to find disp-mutex node\n"); in mtk_drm_probe()
940 ret = -ENODEV; in mtk_drm_probe()
957 of_node_put(private->mutex_node); in mtk_drm_probe()
959 of_node_put(private->comp_node[i]); in mtk_drm_probe()
968 component_master_del(&pdev->dev, &mtk_drm_ops); in mtk_drm_remove()
969 pm_runtime_disable(&pdev->dev); in mtk_drm_remove()
970 of_node_put(private->mutex_node); in mtk_drm_remove()
972 of_node_put(private->comp_node[i]); in mtk_drm_remove()
979 drm_atomic_helper_shutdown(private->drm); in mtk_drm_shutdown()
985 struct drm_device *drm = private->drm; in mtk_drm_sys_prepare()
987 if (private->drm_master) in mtk_drm_sys_prepare()
996 struct drm_device *drm = private->drm; in mtk_drm_sys_complete()
999 if (private->drm_master) in mtk_drm_sys_complete()
1015 .name = "mediatek-drm",