1 /* 2 * Copyright (c) 2015, The Linux Foundation. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 and 6 * only version 2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 */ 13 14 #include "dsi_cfg.h" 15 16 static const char * const dsi_v2_bus_clk_names[] = { 17 "core_mmss_clk", "iface_clk", "bus_clk", 18 }; 19 20 static const struct msm_dsi_config apq8064_dsi_cfg = { 21 .io_offset = 0, 22 .reg_cfg = { 23 .num = 3, 24 .regs = { 25 {"vdda", 1200000, 1200000, 100000, 100}, 26 {"avdd", 3000000, 3000000, 110000, 100}, 27 {"vddio", 1800000, 1800000, 100000, 100}, 28 }, 29 }, 30 .bus_clk_names = dsi_v2_bus_clk_names, 31 .num_bus_clks = ARRAY_SIZE(dsi_v2_bus_clk_names), 32 }; 33 34 static const char * const dsi_6g_bus_clk_names[] = { 35 "mdp_core_clk", "iface_clk", "bus_clk", "core_mmss_clk", 36 }; 37 38 static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = { 39 .io_offset = DSI_6G_REG_SHIFT, 40 .reg_cfg = { 41 .num = 4, 42 .regs = { 43 {"gdsc", -1, -1, -1, -1}, 44 {"vdd", 3000000, 3000000, 150000, 100}, 45 {"vdda", 1200000, 1200000, 100000, 100}, 46 {"vddio", 1800000, 1800000, 100000, 100}, 47 }, 48 }, 49 .bus_clk_names = dsi_6g_bus_clk_names, 50 .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names), 51 }; 52 53 static const char * const dsi_8916_bus_clk_names[] = { 54 "mdp_core_clk", "iface_clk", "bus_clk", 55 }; 56 57 static const struct msm_dsi_config msm8916_dsi_cfg = { 58 .io_offset = DSI_6G_REG_SHIFT, 59 .reg_cfg = { 60 .num = 4, 61 .regs = { 62 {"gdsc", -1, -1, -1, -1}, 63 {"vdd", 2850000, 2850000, 100000, 100}, 64 {"vdda", 1200000, 1200000, 100000, 100}, 65 {"vddio", 1800000, 1800000, 100000, 100}, 66 }, 67 }, 68 .bus_clk_names = dsi_8916_bus_clk_names, 69 .num_bus_clks = ARRAY_SIZE(dsi_8916_bus_clk_names), 70 }; 71 72 static const struct msm_dsi_config msm8994_dsi_cfg = { 73 .io_offset = DSI_6G_REG_SHIFT, 74 .reg_cfg = { 75 .num = 7, 76 .regs = { 77 {"gdsc", -1, -1, -1, -1}, 78 {"vdda", 1250000, 1250000, 100000, 100}, 79 {"vddio", 1800000, 1800000, 100000, 100}, 80 {"vcca", 1000000, 1000000, 10000, 100}, 81 {"vdd", 1800000, 1800000, 100000, 100}, 82 {"lab_reg", -1, -1, -1, -1}, 83 {"ibb_reg", -1, -1, -1, -1}, 84 }, 85 }, 86 .bus_clk_names = dsi_6g_bus_clk_names, 87 .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names), 88 }; 89 90 static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] = { 91 {MSM_DSI_VER_MAJOR_V2, MSM_DSI_V2_VER_MINOR_8064, &apq8064_dsi_cfg}, 92 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_0, 93 &msm8974_apq8084_dsi_cfg}, 94 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1, 95 &msm8974_apq8084_dsi_cfg}, 96 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_1_1, 97 &msm8974_apq8084_dsi_cfg}, 98 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_2, 99 &msm8974_apq8084_dsi_cfg}, 100 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3, &msm8994_dsi_cfg}, 101 {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V1_3_1, &msm8916_dsi_cfg}, 102 }; 103 104 const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor) 105 { 106 const struct msm_dsi_cfg_handler *cfg_hnd = NULL; 107 int i; 108 109 for (i = ARRAY_SIZE(dsi_cfg_handlers) - 1; i >= 0; i--) { 110 if ((dsi_cfg_handlers[i].major == major) && 111 (dsi_cfg_handlers[i].minor == minor)) { 112 cfg_hnd = &dsi_cfg_handlers[i]; 113 break; 114 } 115 } 116 117 return cfg_hnd; 118 } 119 120