Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 1 | /* |
Stephane Viau | 02dfd9d | 2015-03-24 15:06:02 -0400 | [diff] [blame] | 2 | * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved. |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 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 "mdp5_kms.h" |
| 15 | #include "mdp5_cfg.h" |
| 16 | |
| 17 | struct mdp5_cfg_handler { |
| 18 | int revision; |
| 19 | struct mdp5_cfg config; |
| 20 | }; |
| 21 | |
| 22 | /* mdp5_cfg must be exposed (used in mdp5.xml.h) */ |
| 23 | const struct mdp5_cfg_hw *mdp5_cfg = NULL; |
| 24 | |
jilai wang | 8a94b0a | 2015-07-08 18:25:40 -0400 | [diff] [blame] | 25 | const struct mdp5_cfg_hw msm8x74v1_config = { |
| 26 | .name = "msm8x74v1", |
| 27 | .mdp = { |
| 28 | .count = 1, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 29 | .caps = MDP_CAP_SMP | |
| 30 | 0, |
jilai wang | 8a94b0a | 2015-07-08 18:25:40 -0400 | [diff] [blame] | 31 | }, |
| 32 | .smp = { |
| 33 | .mmb_count = 22, |
| 34 | .mmb_size = 4096, |
| 35 | .clients = { |
| 36 | [SSPP_VIG0] = 1, [SSPP_VIG1] = 4, [SSPP_VIG2] = 7, |
| 37 | [SSPP_DMA0] = 10, [SSPP_DMA1] = 13, |
| 38 | [SSPP_RGB0] = 16, [SSPP_RGB1] = 17, [SSPP_RGB2] = 18, |
| 39 | }, |
| 40 | }, |
| 41 | .ctl = { |
| 42 | .count = 5, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 43 | .base = { 0x00500, 0x00600, 0x00700, 0x00800, 0x00900 }, |
jilai wang | 8a94b0a | 2015-07-08 18:25:40 -0400 | [diff] [blame] | 44 | .flush_hw_mask = 0x0003ffff, |
| 45 | }, |
| 46 | .pipe_vig = { |
| 47 | .count = 3, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 48 | .base = { 0x01100, 0x01500, 0x01900 }, |
jilai wang | 8a94b0a | 2015-07-08 18:25:40 -0400 | [diff] [blame] | 49 | .caps = MDP_PIPE_CAP_HFLIP | |
| 50 | MDP_PIPE_CAP_VFLIP | |
| 51 | MDP_PIPE_CAP_SCALE | |
| 52 | MDP_PIPE_CAP_CSC | |
| 53 | 0, |
| 54 | }, |
| 55 | .pipe_rgb = { |
| 56 | .count = 3, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 57 | .base = { 0x01d00, 0x02100, 0x02500 }, |
jilai wang | 8a94b0a | 2015-07-08 18:25:40 -0400 | [diff] [blame] | 58 | .caps = MDP_PIPE_CAP_HFLIP | |
| 59 | MDP_PIPE_CAP_VFLIP | |
| 60 | MDP_PIPE_CAP_SCALE | |
| 61 | 0, |
| 62 | }, |
| 63 | .pipe_dma = { |
| 64 | .count = 2, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 65 | .base = { 0x02900, 0x02d00 }, |
jilai wang | 8a94b0a | 2015-07-08 18:25:40 -0400 | [diff] [blame] | 66 | .caps = MDP_PIPE_CAP_HFLIP | |
| 67 | MDP_PIPE_CAP_VFLIP | |
| 68 | 0, |
| 69 | }, |
| 70 | .lm = { |
| 71 | .count = 5, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 72 | .base = { 0x03100, 0x03500, 0x03900, 0x03d00, 0x04100 }, |
jilai wang | 8a94b0a | 2015-07-08 18:25:40 -0400 | [diff] [blame] | 73 | .nb_stages = 5, |
| 74 | }, |
| 75 | .dspp = { |
| 76 | .count = 3, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 77 | .base = { 0x04500, 0x04900, 0x04d00 }, |
jilai wang | 8a94b0a | 2015-07-08 18:25:40 -0400 | [diff] [blame] | 78 | }, |
| 79 | .pp = { |
| 80 | .count = 3, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 81 | .base = { 0x21a00, 0x21b00, 0x21c00 }, |
jilai wang | 8a94b0a | 2015-07-08 18:25:40 -0400 | [diff] [blame] | 82 | }, |
| 83 | .intf = { |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 84 | .base = { 0x21000, 0x21200, 0x21400, 0x21600 }, |
jilai wang | 8a94b0a | 2015-07-08 18:25:40 -0400 | [diff] [blame] | 85 | .connect = { |
| 86 | [0] = INTF_eDP, |
| 87 | [1] = INTF_DSI, |
| 88 | [2] = INTF_DSI, |
| 89 | [3] = INTF_HDMI, |
| 90 | }, |
| 91 | }, |
| 92 | .max_clk = 200000000, |
| 93 | }; |
| 94 | |
| 95 | const struct mdp5_cfg_hw msm8x74v2_config = { |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 96 | .name = "msm8x74", |
Stephane Viau | f525381 | 2015-03-09 09:11:04 -0400 | [diff] [blame] | 97 | .mdp = { |
| 98 | .count = 1, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 99 | .caps = MDP_CAP_SMP | |
| 100 | 0, |
Stephane Viau | f525381 | 2015-03-09 09:11:04 -0400 | [diff] [blame] | 101 | }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 102 | .smp = { |
| 103 | .mmb_count = 22, |
| 104 | .mmb_size = 4096, |
Stephane Viau | 6fa6acd | 2015-03-09 09:11:06 -0400 | [diff] [blame] | 105 | .clients = { |
| 106 | [SSPP_VIG0] = 1, [SSPP_VIG1] = 4, [SSPP_VIG2] = 7, |
| 107 | [SSPP_DMA0] = 10, [SSPP_DMA1] = 13, |
| 108 | [SSPP_RGB0] = 16, [SSPP_RGB1] = 17, [SSPP_RGB2] = 18, |
| 109 | }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 110 | }, |
| 111 | .ctl = { |
| 112 | .count = 5, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 113 | .base = { 0x00500, 0x00600, 0x00700, 0x00800, 0x00900 }, |
Stephane Viau | 389b09a | 2015-03-13 15:49:33 -0400 | [diff] [blame] | 114 | .flush_hw_mask = 0x0003ffff, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 115 | }, |
| 116 | .pipe_vig = { |
| 117 | .count = 3, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 118 | .base = { 0x01100, 0x01500, 0x01900 }, |
jilai wang | 3498409 | 2015-07-08 18:12:40 -0400 | [diff] [blame] | 119 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP | |
| 120 | MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_CSC | |
| 121 | MDP_PIPE_CAP_DECIMATION, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 122 | }, |
| 123 | .pipe_rgb = { |
| 124 | .count = 3, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 125 | .base = { 0x01d00, 0x02100, 0x02500 }, |
jilai wang | 3498409 | 2015-07-08 18:12:40 -0400 | [diff] [blame] | 126 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP | |
| 127 | MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_DECIMATION, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 128 | }, |
| 129 | .pipe_dma = { |
| 130 | .count = 2, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 131 | .base = { 0x02900, 0x02d00 }, |
jilai wang | 3498409 | 2015-07-08 18:12:40 -0400 | [diff] [blame] | 132 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 133 | }, |
| 134 | .lm = { |
| 135 | .count = 5, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 136 | .base = { 0x03100, 0x03500, 0x03900, 0x03d00, 0x04100 }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 137 | .nb_stages = 5, |
Hai Li | 9b7a9fc | 2015-06-24 19:13:40 -0400 | [diff] [blame] | 138 | .max_width = 2048, |
| 139 | .max_height = 0xFFFF, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 140 | }, |
| 141 | .dspp = { |
| 142 | .count = 3, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 143 | .base = { 0x04500, 0x04900, 0x04d00 }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 144 | }, |
| 145 | .ad = { |
| 146 | .count = 2, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 147 | .base = { 0x13000, 0x13200 }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 148 | }, |
Hai Li | 3830590 | 2015-03-05 15:20:47 -0500 | [diff] [blame] | 149 | .pp = { |
| 150 | .count = 3, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 151 | .base = { 0x12c00, 0x12d00, 0x12e00 }, |
Hai Li | 3830590 | 2015-03-05 15:20:47 -0500 | [diff] [blame] | 152 | }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 153 | .intf = { |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 154 | .base = { 0x12400, 0x12600, 0x12800, 0x12a00 }, |
Stephane Viau | fe34464 | 2015-04-30 13:45:52 -0400 | [diff] [blame] | 155 | .connect = { |
| 156 | [0] = INTF_eDP, |
| 157 | [1] = INTF_DSI, |
| 158 | [2] = INTF_DSI, |
| 159 | [3] = INTF_HDMI, |
| 160 | }, |
Stephane Viau | 67ac0a2 | 2015-03-13 15:49:34 -0400 | [diff] [blame] | 161 | }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 162 | .max_clk = 200000000, |
| 163 | }; |
| 164 | |
| 165 | const struct mdp5_cfg_hw apq8084_config = { |
| 166 | .name = "apq8084", |
Stephane Viau | f525381 | 2015-03-09 09:11:04 -0400 | [diff] [blame] | 167 | .mdp = { |
| 168 | .count = 1, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 169 | .caps = MDP_CAP_SMP | |
| 170 | 0, |
Stephane Viau | f525381 | 2015-03-09 09:11:04 -0400 | [diff] [blame] | 171 | }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 172 | .smp = { |
| 173 | .mmb_count = 44, |
| 174 | .mmb_size = 8192, |
Stephane Viau | 6fa6acd | 2015-03-09 09:11:06 -0400 | [diff] [blame] | 175 | .clients = { |
| 176 | [SSPP_VIG0] = 1, [SSPP_VIG1] = 4, |
| 177 | [SSPP_VIG2] = 7, [SSPP_VIG3] = 19, |
| 178 | [SSPP_DMA0] = 10, [SSPP_DMA1] = 13, |
| 179 | [SSPP_RGB0] = 16, [SSPP_RGB1] = 17, |
| 180 | [SSPP_RGB2] = 18, [SSPP_RGB3] = 22, |
| 181 | }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 182 | .reserved_state[0] = GENMASK(7, 0), /* first 8 MMBs */ |
Stephane Viau | 6fa6acd | 2015-03-09 09:11:06 -0400 | [diff] [blame] | 183 | .reserved = { |
| 184 | /* Two SMP blocks are statically tied to RGB pipes: */ |
| 185 | [16] = 2, [17] = 2, [18] = 2, [22] = 2, |
| 186 | }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 187 | }, |
| 188 | .ctl = { |
| 189 | .count = 5, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 190 | .base = { 0x00500, 0x00600, 0x00700, 0x00800, 0x00900 }, |
Stephane Viau | 389b09a | 2015-03-13 15:49:33 -0400 | [diff] [blame] | 191 | .flush_hw_mask = 0x003fffff, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 192 | }, |
| 193 | .pipe_vig = { |
| 194 | .count = 4, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 195 | .base = { 0x01100, 0x01500, 0x01900, 0x01d00 }, |
jilai wang | 3498409 | 2015-07-08 18:12:40 -0400 | [diff] [blame] | 196 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP | |
| 197 | MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_CSC | |
| 198 | MDP_PIPE_CAP_DECIMATION, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 199 | }, |
| 200 | .pipe_rgb = { |
| 201 | .count = 4, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 202 | .base = { 0x02100, 0x02500, 0x02900, 0x02d00 }, |
jilai wang | 3498409 | 2015-07-08 18:12:40 -0400 | [diff] [blame] | 203 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP | |
| 204 | MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_DECIMATION, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 205 | }, |
| 206 | .pipe_dma = { |
| 207 | .count = 2, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 208 | .base = { 0x03100, 0x03500 }, |
jilai wang | 3498409 | 2015-07-08 18:12:40 -0400 | [diff] [blame] | 209 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 210 | }, |
| 211 | .lm = { |
| 212 | .count = 6, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 213 | .base = { 0x03900, 0x03d00, 0x04100, 0x04500, 0x04900, 0x04d00 }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 214 | .nb_stages = 5, |
Hai Li | 9b7a9fc | 2015-06-24 19:13:40 -0400 | [diff] [blame] | 215 | .max_width = 2048, |
| 216 | .max_height = 0xFFFF, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 217 | }, |
| 218 | .dspp = { |
| 219 | .count = 4, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 220 | .base = { 0x05100, 0x05500, 0x05900, 0x05d00 }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 221 | |
| 222 | }, |
| 223 | .ad = { |
| 224 | .count = 3, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 225 | .base = { 0x13400, 0x13600, 0x13800 }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 226 | }, |
Hai Li | 3830590 | 2015-03-05 15:20:47 -0500 | [diff] [blame] | 227 | .pp = { |
| 228 | .count = 4, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 229 | .base = { 0x12e00, 0x12f00, 0x13000, 0x13100 }, |
Hai Li | 3830590 | 2015-03-05 15:20:47 -0500 | [diff] [blame] | 230 | }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 231 | .intf = { |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 232 | .base = { 0x12400, 0x12600, 0x12800, 0x12a00, 0x12c00 }, |
Stephane Viau | fe34464 | 2015-04-30 13:45:52 -0400 | [diff] [blame] | 233 | .connect = { |
| 234 | [0] = INTF_eDP, |
| 235 | [1] = INTF_DSI, |
| 236 | [2] = INTF_DSI, |
| 237 | [3] = INTF_HDMI, |
| 238 | }, |
Stephane Viau | 67ac0a2 | 2015-03-13 15:49:34 -0400 | [diff] [blame] | 239 | }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 240 | .max_clk = 320000000, |
| 241 | }; |
| 242 | |
Stephane Viau | 02dfd9d | 2015-03-24 15:06:02 -0400 | [diff] [blame] | 243 | const struct mdp5_cfg_hw msm8x16_config = { |
| 244 | .name = "msm8x16", |
| 245 | .mdp = { |
| 246 | .count = 1, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 247 | .base = { 0x0 }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 248 | .caps = MDP_CAP_SMP | |
| 249 | 0, |
Stephane Viau | 02dfd9d | 2015-03-24 15:06:02 -0400 | [diff] [blame] | 250 | }, |
| 251 | .smp = { |
| 252 | .mmb_count = 8, |
| 253 | .mmb_size = 8192, |
| 254 | .clients = { |
| 255 | [SSPP_VIG0] = 1, [SSPP_DMA0] = 4, |
| 256 | [SSPP_RGB0] = 7, [SSPP_RGB1] = 8, |
| 257 | }, |
| 258 | }, |
| 259 | .ctl = { |
| 260 | .count = 5, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 261 | .base = { 0x01000, 0x01200, 0x01400, 0x01600, 0x01800 }, |
Stephane Viau | 02dfd9d | 2015-03-24 15:06:02 -0400 | [diff] [blame] | 262 | .flush_hw_mask = 0x4003ffff, |
| 263 | }, |
| 264 | .pipe_vig = { |
| 265 | .count = 1, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 266 | .base = { 0x04000 }, |
jilai wang | 3498409 | 2015-07-08 18:12:40 -0400 | [diff] [blame] | 267 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP | |
| 268 | MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_CSC | |
| 269 | MDP_PIPE_CAP_DECIMATION, |
Stephane Viau | 02dfd9d | 2015-03-24 15:06:02 -0400 | [diff] [blame] | 270 | }, |
| 271 | .pipe_rgb = { |
| 272 | .count = 2, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 273 | .base = { 0x14000, 0x16000 }, |
jilai wang | 3498409 | 2015-07-08 18:12:40 -0400 | [diff] [blame] | 274 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP | |
Rob Clark | 07cd2e3 | 2016-10-17 12:00:21 -0400 | [diff] [blame] | 275 | MDP_PIPE_CAP_DECIMATION, |
Stephane Viau | 02dfd9d | 2015-03-24 15:06:02 -0400 | [diff] [blame] | 276 | }, |
| 277 | .pipe_dma = { |
| 278 | .count = 1, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 279 | .base = { 0x24000 }, |
jilai wang | 3498409 | 2015-07-08 18:12:40 -0400 | [diff] [blame] | 280 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP, |
Stephane Viau | 02dfd9d | 2015-03-24 15:06:02 -0400 | [diff] [blame] | 281 | }, |
| 282 | .lm = { |
| 283 | .count = 2, /* LM0 and LM3 */ |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 284 | .base = { 0x44000, 0x47000 }, |
Rob Clark | 67cba0f | 2016-10-24 11:46:44 -0400 | [diff] [blame] | 285 | .nb_stages = 8, |
Hai Li | 9b7a9fc | 2015-06-24 19:13:40 -0400 | [diff] [blame] | 286 | .max_width = 2048, |
| 287 | .max_height = 0xFFFF, |
Stephane Viau | 02dfd9d | 2015-03-24 15:06:02 -0400 | [diff] [blame] | 288 | }, |
| 289 | .dspp = { |
| 290 | .count = 1, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 291 | .base = { 0x54000 }, |
Stephane Viau | 02dfd9d | 2015-03-24 15:06:02 -0400 | [diff] [blame] | 292 | |
| 293 | }, |
| 294 | .intf = { |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 295 | .base = { 0x00000, 0x6a800 }, |
Stephane Viau | fe34464 | 2015-04-30 13:45:52 -0400 | [diff] [blame] | 296 | .connect = { |
| 297 | [0] = INTF_DISABLED, |
| 298 | [1] = INTF_DSI, |
| 299 | }, |
Stephane Viau | 02dfd9d | 2015-03-24 15:06:02 -0400 | [diff] [blame] | 300 | }, |
Stephane Viau | 02dfd9d | 2015-03-24 15:06:02 -0400 | [diff] [blame] | 301 | .max_clk = 320000000, |
| 302 | }; |
| 303 | |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 304 | const struct mdp5_cfg_hw msm8x94_config = { |
| 305 | .name = "msm8x94", |
| 306 | .mdp = { |
| 307 | .count = 1, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 308 | .caps = MDP_CAP_SMP | |
| 309 | 0, |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 310 | }, |
| 311 | .smp = { |
| 312 | .mmb_count = 44, |
| 313 | .mmb_size = 8192, |
| 314 | .clients = { |
| 315 | [SSPP_VIG0] = 1, [SSPP_VIG1] = 4, |
| 316 | [SSPP_VIG2] = 7, [SSPP_VIG3] = 19, |
| 317 | [SSPP_DMA0] = 10, [SSPP_DMA1] = 13, |
| 318 | [SSPP_RGB0] = 16, [SSPP_RGB1] = 17, |
| 319 | [SSPP_RGB2] = 18, [SSPP_RGB3] = 22, |
| 320 | }, |
| 321 | .reserved_state[0] = GENMASK(23, 0), /* first 24 MMBs */ |
| 322 | .reserved = { |
| 323 | [1] = 1, [4] = 1, [7] = 1, [19] = 1, |
| 324 | [16] = 5, [17] = 5, [18] = 5, [22] = 5, |
| 325 | }, |
| 326 | }, |
| 327 | .ctl = { |
| 328 | .count = 5, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 329 | .base = { 0x01000, 0x01200, 0x01400, 0x01600, 0x01800 }, |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 330 | .flush_hw_mask = 0xf0ffffff, |
| 331 | }, |
| 332 | .pipe_vig = { |
| 333 | .count = 4, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 334 | .base = { 0x04000, 0x06000, 0x08000, 0x0a000 }, |
jilai wang | 3498409 | 2015-07-08 18:12:40 -0400 | [diff] [blame] | 335 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP | |
| 336 | MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_CSC | |
| 337 | MDP_PIPE_CAP_DECIMATION, |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 338 | }, |
| 339 | .pipe_rgb = { |
| 340 | .count = 4, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 341 | .base = { 0x14000, 0x16000, 0x18000, 0x1a000 }, |
jilai wang | 3498409 | 2015-07-08 18:12:40 -0400 | [diff] [blame] | 342 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP | |
| 343 | MDP_PIPE_CAP_SCALE | MDP_PIPE_CAP_DECIMATION, |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 344 | }, |
| 345 | .pipe_dma = { |
| 346 | .count = 2, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 347 | .base = { 0x24000, 0x26000 }, |
jilai wang | 3498409 | 2015-07-08 18:12:40 -0400 | [diff] [blame] | 348 | .caps = MDP_PIPE_CAP_HFLIP | MDP_PIPE_CAP_VFLIP, |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 349 | }, |
| 350 | .lm = { |
| 351 | .count = 6, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 352 | .base = { 0x44000, 0x45000, 0x46000, 0x47000, 0x48000, 0x49000 }, |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 353 | .nb_stages = 8, |
Hai Li | 9b7a9fc | 2015-06-24 19:13:40 -0400 | [diff] [blame] | 354 | .max_width = 2048, |
| 355 | .max_height = 0xFFFF, |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 356 | }, |
| 357 | .dspp = { |
| 358 | .count = 4, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 359 | .base = { 0x54000, 0x56000, 0x58000, 0x5a000 }, |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 360 | |
| 361 | }, |
| 362 | .ad = { |
| 363 | .count = 3, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 364 | .base = { 0x78000, 0x78800, 0x79000 }, |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 365 | }, |
| 366 | .pp = { |
| 367 | .count = 4, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 368 | .base = { 0x70000, 0x70800, 0x71000, 0x71800 }, |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 369 | }, |
| 370 | .intf = { |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 371 | .base = { 0x6a000, 0x6a800, 0x6b000, 0x6b800, 0x6c000 }, |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 372 | .connect = { |
| 373 | [0] = INTF_DISABLED, |
| 374 | [1] = INTF_DSI, |
| 375 | [2] = INTF_DSI, |
| 376 | [3] = INTF_HDMI, |
| 377 | }, |
| 378 | }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 379 | .max_clk = 400000000, |
| 380 | }; |
| 381 | |
| 382 | const struct mdp5_cfg_hw msm8x96_config = { |
| 383 | .name = "msm8x96", |
| 384 | .mdp = { |
| 385 | .count = 1, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 386 | .caps = MDP_CAP_DSC | |
| 387 | MDP_CAP_CDM | |
| 388 | 0, |
| 389 | }, |
| 390 | .ctl = { |
| 391 | .count = 5, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 392 | .base = { 0x01000, 0x01200, 0x01400, 0x01600, 0x01800 }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 393 | .flush_hw_mask = 0xf4ffffff, |
| 394 | }, |
| 395 | .pipe_vig = { |
| 396 | .count = 4, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 397 | .base = { 0x04000, 0x06000, 0x08000, 0x0a000 }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 398 | .caps = MDP_PIPE_CAP_HFLIP | |
| 399 | MDP_PIPE_CAP_VFLIP | |
| 400 | MDP_PIPE_CAP_SCALE | |
| 401 | MDP_PIPE_CAP_CSC | |
| 402 | MDP_PIPE_CAP_DECIMATION | |
| 403 | MDP_PIPE_CAP_SW_PIX_EXT | |
| 404 | 0, |
| 405 | }, |
| 406 | .pipe_rgb = { |
| 407 | .count = 4, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 408 | .base = { 0x14000, 0x16000, 0x18000, 0x1a000 }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 409 | .caps = MDP_PIPE_CAP_HFLIP | |
| 410 | MDP_PIPE_CAP_VFLIP | |
| 411 | MDP_PIPE_CAP_SCALE | |
| 412 | MDP_PIPE_CAP_DECIMATION | |
| 413 | MDP_PIPE_CAP_SW_PIX_EXT | |
| 414 | 0, |
| 415 | }, |
| 416 | .pipe_dma = { |
| 417 | .count = 2, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 418 | .base = { 0x24000, 0x26000 }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 419 | .caps = MDP_PIPE_CAP_HFLIP | |
| 420 | MDP_PIPE_CAP_VFLIP | |
| 421 | MDP_PIPE_CAP_SW_PIX_EXT | |
| 422 | 0, |
| 423 | }, |
| 424 | .lm = { |
| 425 | .count = 6, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 426 | .base = { 0x44000, 0x45000, 0x46000, 0x47000, 0x48000, 0x49000 }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 427 | .nb_stages = 8, |
| 428 | .max_width = 2560, |
| 429 | .max_height = 0xFFFF, |
| 430 | }, |
| 431 | .dspp = { |
| 432 | .count = 2, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 433 | .base = { 0x54000, 0x56000 }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 434 | }, |
| 435 | .ad = { |
| 436 | .count = 3, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 437 | .base = { 0x78000, 0x78800, 0x79000 }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 438 | }, |
| 439 | .pp = { |
| 440 | .count = 4, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 441 | .base = { 0x70000, 0x70800, 0x71000, 0x71800 }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 442 | }, |
| 443 | .cdm = { |
| 444 | .count = 1, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 445 | .base = { 0x79200 }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 446 | }, |
| 447 | .dsc = { |
| 448 | .count = 2, |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 449 | .base = { 0x80000, 0x80400 }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 450 | }, |
| 451 | .intf = { |
Archit Taneja | 031d63d | 2016-05-09 12:14:49 +0530 | [diff] [blame] | 452 | .base = { 0x6a000, 0x6a800, 0x6b000, 0x6b800, 0x6c000 }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 453 | .connect = { |
| 454 | [0] = INTF_DISABLED, |
| 455 | [1] = INTF_DSI, |
| 456 | [2] = INTF_DSI, |
| 457 | [3] = INTF_HDMI, |
| 458 | }, |
| 459 | }, |
| 460 | .max_clk = 412500000, |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 461 | }; |
| 462 | |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 463 | static const struct mdp5_cfg_handler cfg_handlers[] = { |
jilai wang | 8a94b0a | 2015-07-08 18:25:40 -0400 | [diff] [blame] | 464 | { .revision = 0, .config = { .hw = &msm8x74v1_config } }, |
| 465 | { .revision = 2, .config = { .hw = &msm8x74v2_config } }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 466 | { .revision = 3, .config = { .hw = &apq8084_config } }, |
Stephane Viau | 02dfd9d | 2015-03-24 15:06:02 -0400 | [diff] [blame] | 467 | { .revision = 6, .config = { .hw = &msm8x16_config } }, |
Stephane Viau | 3a84f84 | 2015-06-19 16:04:47 -0400 | [diff] [blame] | 468 | { .revision = 9, .config = { .hw = &msm8x94_config } }, |
Stephane Viau | d879eb5 | 2015-09-15 08:41:53 -0400 | [diff] [blame] | 469 | { .revision = 7, .config = { .hw = &msm8x96_config } }, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 470 | }; |
| 471 | |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 472 | static struct mdp5_cfg_platform *mdp5_get_config(struct platform_device *dev); |
| 473 | |
Rob Clark | 42238da | 2014-11-18 14:28:43 -0500 | [diff] [blame] | 474 | const struct mdp5_cfg_hw *mdp5_cfg_get_hw_config(struct mdp5_cfg_handler *cfg_handler) |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 475 | { |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 476 | return cfg_handler->config.hw; |
| 477 | } |
| 478 | |
Rob Clark | 42238da | 2014-11-18 14:28:43 -0500 | [diff] [blame] | 479 | struct mdp5_cfg *mdp5_cfg_get_config(struct mdp5_cfg_handler *cfg_handler) |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 480 | { |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 481 | return &cfg_handler->config; |
| 482 | } |
| 483 | |
Rob Clark | 42238da | 2014-11-18 14:28:43 -0500 | [diff] [blame] | 484 | int mdp5_cfg_get_hw_rev(struct mdp5_cfg_handler *cfg_handler) |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 485 | { |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 486 | return cfg_handler->revision; |
| 487 | } |
| 488 | |
Rob Clark | 42238da | 2014-11-18 14:28:43 -0500 | [diff] [blame] | 489 | void mdp5_cfg_destroy(struct mdp5_cfg_handler *cfg_handler) |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 490 | { |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 491 | kfree(cfg_handler); |
| 492 | } |
| 493 | |
Rob Clark | 42238da | 2014-11-18 14:28:43 -0500 | [diff] [blame] | 494 | struct mdp5_cfg_handler *mdp5_cfg_init(struct mdp5_kms *mdp5_kms, |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 495 | uint32_t major, uint32_t minor) |
| 496 | { |
| 497 | struct drm_device *dev = mdp5_kms->dev; |
| 498 | struct platform_device *pdev = dev->platformdev; |
| 499 | struct mdp5_cfg_handler *cfg_handler; |
| 500 | struct mdp5_cfg_platform *pconfig; |
| 501 | int i, ret = 0; |
| 502 | |
| 503 | cfg_handler = kzalloc(sizeof(*cfg_handler), GFP_KERNEL); |
| 504 | if (unlikely(!cfg_handler)) { |
| 505 | ret = -ENOMEM; |
| 506 | goto fail; |
| 507 | } |
| 508 | |
| 509 | if (major != 1) { |
| 510 | dev_err(dev->dev, "unexpected MDP major version: v%d.%d\n", |
| 511 | major, minor); |
| 512 | ret = -ENXIO; |
| 513 | goto fail; |
| 514 | } |
| 515 | |
| 516 | /* only after mdp5_cfg global pointer's init can we access the hw */ |
| 517 | for (i = 0; i < ARRAY_SIZE(cfg_handlers); i++) { |
| 518 | if (cfg_handlers[i].revision != minor) |
| 519 | continue; |
| 520 | mdp5_cfg = cfg_handlers[i].config.hw; |
| 521 | |
| 522 | break; |
| 523 | } |
| 524 | if (unlikely(!mdp5_cfg)) { |
| 525 | dev_err(dev->dev, "unexpected MDP minor revision: v%d.%d\n", |
| 526 | major, minor); |
| 527 | ret = -ENXIO; |
| 528 | goto fail; |
| 529 | } |
| 530 | |
| 531 | cfg_handler->revision = minor; |
| 532 | cfg_handler->config.hw = mdp5_cfg; |
| 533 | |
| 534 | pconfig = mdp5_get_config(pdev); |
| 535 | memcpy(&cfg_handler->config.platform, pconfig, sizeof(*pconfig)); |
| 536 | |
| 537 | DBG("MDP5: %s hw config selected", mdp5_cfg->name); |
| 538 | |
| 539 | return cfg_handler; |
| 540 | |
| 541 | fail: |
| 542 | if (cfg_handler) |
| 543 | mdp5_cfg_destroy(cfg_handler); |
| 544 | |
| 545 | return NULL; |
| 546 | } |
| 547 | |
| 548 | static struct mdp5_cfg_platform *mdp5_get_config(struct platform_device *dev) |
| 549 | { |
| 550 | static struct mdp5_cfg_platform config = {}; |
Archit Taneja | d50c192 | 2015-11-18 12:44:52 +0530 | [diff] [blame] | 551 | |
Stephane Viau | 2e362e1 | 2014-11-18 12:49:48 -0500 | [diff] [blame] | 552 | config.iommu = iommu_domain_alloc(&platform_bus_type); |
| 553 | |
| 554 | return &config; |
| 555 | } |