1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Copyright (c) 2021 MediaTek Inc. 4 * Copyright (c) 2024 Collabora Ltd. 5 * AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> 6 */ 7 8 #include <linux/device.h> 9 #include <linux/interconnect.h> 10 #include <linux/interconnect-provider.h> 11 #include <linux/mod_devicetable.h> 12 #include <linux/module.h> 13 #include <linux/platform_device.h> 14 #include <dt-bindings/interconnect/mediatek,mt8183.h> 15 16 #include "icc-emi.h" 17 18 static struct mtk_icc_node ddr_emi = { 19 .name = "ddr-emi", 20 .id = SLAVE_DDR_EMI, 21 .ep = 1, 22 }; 23 24 static struct mtk_icc_node mcusys = { 25 .name = "mcusys", 26 .id = MASTER_MCUSYS, 27 .ep = 0, 28 .num_links = 1, 29 .links = { SLAVE_DDR_EMI } 30 }; 31 32 static struct mtk_icc_node gpu = { 33 .name = "gpu", 34 .id = MASTER_MFG, 35 .ep = 0, 36 .num_links = 1, 37 .links = { SLAVE_DDR_EMI } 38 }; 39 40 static struct mtk_icc_node mmsys = { 41 .name = "mmsys", 42 .id = MASTER_MMSYS, 43 .ep = 0, 44 .num_links = 1, 45 .links = { SLAVE_DDR_EMI } 46 }; 47 48 static struct mtk_icc_node mm_vpu = { 49 .name = "mm-vpu", 50 .id = MASTER_MM_VPU, 51 .ep = 0, 52 .num_links = 1, 53 .links = { MASTER_MMSYS } 54 }; 55 56 static struct mtk_icc_node mm_disp = { 57 .name = "mm-disp", 58 .id = MASTER_MM_DISP, 59 .ep = 0, 60 .num_links = 1, 61 .links = { MASTER_MMSYS } 62 }; 63 64 static struct mtk_icc_node mm_vdec = { 65 .name = "mm-vdec", 66 .id = MASTER_MM_VDEC, 67 .ep = 0, 68 .num_links = 1, 69 .links = { MASTER_MMSYS } 70 }; 71 72 static struct mtk_icc_node mm_venc = { 73 .name = "mm-venc", 74 .id = MASTER_MM_VENC, 75 .ep = 0, 76 .num_links = 1, 77 .links = { MASTER_MMSYS } 78 }; 79 80 static struct mtk_icc_node mm_cam = { 81 .name = "mm-cam", 82 .id = MASTER_MM_CAM, 83 .ep = 0, 84 .num_links = 1, 85 .links = { MASTER_MMSYS } 86 }; 87 88 static struct mtk_icc_node mm_img = { 89 .name = "mm-img", 90 .id = MASTER_MM_IMG, 91 .ep = 0, 92 .num_links = 1, 93 .links = { MASTER_MMSYS } 94 }; 95 96 static struct mtk_icc_node mm_mdp = { 97 .name = "mm-mdp", 98 .id = MASTER_MM_MDP, 99 .ep = 0, 100 .num_links = 1, 101 .links = { MASTER_MMSYS } 102 }; 103 104 static struct mtk_icc_node *mt8183_emi_icc_nodes[] = { 105 [SLAVE_DDR_EMI] = &ddr_emi, 106 [MASTER_MCUSYS] = &mcusys, 107 [MASTER_MFG] = &gpu, 108 [MASTER_MMSYS] = &mmsys, 109 [MASTER_MM_VPU] = &mm_vpu, 110 [MASTER_MM_DISP] = &mm_disp, 111 [MASTER_MM_VDEC] = &mm_vdec, 112 [MASTER_MM_VENC] = &mm_venc, 113 [MASTER_MM_CAM] = &mm_cam, 114 [MASTER_MM_IMG] = &mm_img, 115 [MASTER_MM_MDP] = &mm_mdp 116 }; 117 118 static const struct mtk_icc_desc mt8183_emi_icc = { 119 .nodes = mt8183_emi_icc_nodes, 120 .num_nodes = ARRAY_SIZE(mt8183_emi_icc_nodes), 121 }; 122 123 static const struct of_device_id mtk_mt8183_emi_icc_of_match[] = { 124 { .compatible = "mediatek,mt8183-emi", .data = &mt8183_emi_icc }, 125 { /* sentinel */ }, 126 }; 127 MODULE_DEVICE_TABLE(of, mtk_mt8183_emi_icc_of_match); 128 129 static struct platform_driver mtk_emi_icc_mt8183_driver = { 130 .driver = { 131 .name = "emi-icc-mt8183", 132 .of_match_table = mtk_mt8183_emi_icc_of_match, 133 .sync_state = icc_sync_state, 134 }, 135 .probe = mtk_emi_icc_probe, 136 .remove_new = mtk_emi_icc_remove, 137 138 }; 139 module_platform_driver(mtk_emi_icc_mt8183_driver); 140 141 MODULE_AUTHOR("AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>"); 142 MODULE_DESCRIPTION("MediaTek MT8183 EMI ICC driver"); 143 MODULE_LICENSE("GPL"); 144