old mode 100644new mode 100755.. | .. |
---|
16 | 16 | |
---|
17 | 17 | DECLARE_GLOBAL_DATA_PTR; |
---|
18 | 18 | |
---|
| 19 | + |
---|
| 20 | +#if 1 |
---|
| 21 | +struct display_fixup_data { |
---|
| 22 | + int type; |
---|
| 23 | + |
---|
| 24 | + int delay_prepare; |
---|
| 25 | + int delay_enable; |
---|
| 26 | + int delay_disable; |
---|
| 27 | + int delay_unprepare; |
---|
| 28 | + int delay_reset; |
---|
| 29 | + int delay_init; |
---|
| 30 | + int size_width; |
---|
| 31 | + int size_height; |
---|
| 32 | + |
---|
| 33 | + int clock_frequency; |
---|
| 34 | + int hactive; |
---|
| 35 | + int hfront_porch; |
---|
| 36 | + int hsync_len; |
---|
| 37 | + int hback_porch; |
---|
| 38 | + int vactive; |
---|
| 39 | + int vfront_porch; |
---|
| 40 | + int vsync_len; |
---|
| 41 | + int vback_porch; |
---|
| 42 | + int hsync_active; |
---|
| 43 | + int vsync_active; |
---|
| 44 | + int de_active; |
---|
| 45 | + int pixelclk_active; |
---|
| 46 | + |
---|
| 47 | + /* for DSI Panel */ |
---|
| 48 | + int flags; |
---|
| 49 | + int format; |
---|
| 50 | + int lanes; |
---|
| 51 | + int init_cmd_length; |
---|
| 52 | + u8 *init_cmd; |
---|
| 53 | + |
---|
| 54 | + int nodka_lvds; |
---|
| 55 | +}; |
---|
| 56 | +enum { |
---|
| 57 | + PANEL_TYPE_DSI, |
---|
| 58 | + PANEL_TYPE_EDP, |
---|
| 59 | + PANEL_TYPE_LVDS, |
---|
| 60 | +}; |
---|
| 61 | + |
---|
| 62 | +#define CUSTOM_PARTITION_NAME "baseparameter" |
---|
| 63 | +#define LCD_PARAM_MAX_COUNT 27 |
---|
| 64 | + |
---|
| 65 | +int lcdParam[LCD_PARAM_MAX_COUNT]; |
---|
| 66 | +char param_buf_temp[4*1024] = {0}; |
---|
| 67 | + |
---|
| 68 | +void set_lcdparam_test_edp(struct display_fixup_data *data) |
---|
| 69 | +{ |
---|
| 70 | + |
---|
| 71 | + data->type = PANEL_TYPE_DSI; |
---|
| 72 | + data->delay_prepare = 100; |
---|
| 73 | + data->delay_enable = 100; |
---|
| 74 | + data->delay_disable = 100; |
---|
| 75 | + data->delay_unprepare = 100; |
---|
| 76 | + data->delay_reset = 100; |
---|
| 77 | + data->delay_init = 100; |
---|
| 78 | + data->size_width = 240; |
---|
| 79 | + data->size_height = 300; |
---|
| 80 | + data->clock_frequency = 60000000; |
---|
| 81 | + data->hactive = 1024; |
---|
| 82 | + data->hfront_porch = 12; |
---|
| 83 | + data->hsync_len = 16; |
---|
| 84 | + data->hback_porch = 48; |
---|
| 85 | + data->vactive = 600; |
---|
| 86 | + data->vfront_porch = 8; |
---|
| 87 | + data->vsync_len = 4; |
---|
| 88 | + data->vback_porch = 8; |
---|
| 89 | + data->hsync_active = 0; |
---|
| 90 | + data->vsync_active = 0; |
---|
| 91 | + data->de_active = 0; |
---|
| 92 | + data->pixelclk_active = 0; |
---|
| 93 | + data->flags = 0; |
---|
| 94 | + data->format = 0; |
---|
| 95 | + data->lanes = 4; |
---|
| 96 | + *(data->init_cmd + 0) = 0x05; |
---|
| 97 | + *(data->init_cmd + 1) = 0x00; |
---|
| 98 | + *(data->init_cmd + 2) = 0x01; |
---|
| 99 | + *(data->init_cmd + 3) = 0x01; |
---|
| 100 | + |
---|
| 101 | + *(data->init_cmd + 4) = 0x05; |
---|
| 102 | + *(data->init_cmd + 5) = 0x00; |
---|
| 103 | + *(data->init_cmd + 6) = 0x01; |
---|
| 104 | + *(data->init_cmd + 7) = 0x02; |
---|
| 105 | + |
---|
| 106 | + *(data->init_cmd + 8) = 0x05; |
---|
| 107 | + *(data->init_cmd + 9) = 0x00; |
---|
| 108 | + *(data->init_cmd + 10) = 0x01; |
---|
| 109 | + *(data->init_cmd + 11) = 0x03; |
---|
| 110 | + |
---|
| 111 | + *(data->init_cmd + 12) = 0x05; |
---|
| 112 | + *(data->init_cmd + 13) = 0x00; |
---|
| 113 | + *(data->init_cmd + 14) = 0x01; |
---|
| 114 | + *(data->init_cmd + 15) = 0x05; |
---|
| 115 | + |
---|
| 116 | +} |
---|
| 117 | + |
---|
| 118 | +int get_lcdparam_info_from_custom_partition(struct display_fixup_data *data) |
---|
| 119 | +{ |
---|
| 120 | + |
---|
| 121 | + struct blk_desc *dev_desc; |
---|
| 122 | + disk_partition_t part_info; |
---|
| 123 | + char *boot_partname = CUSTOM_PARTITION_NAME; |
---|
| 124 | + int ret,i; |
---|
| 125 | + |
---|
| 126 | + dev_desc = rockchip_get_bootdev(); |
---|
| 127 | + if (!dev_desc) { |
---|
| 128 | + printf("%s: dev_desc is NULL!\n", __func__); |
---|
| 129 | + return -ENODEV; |
---|
| 130 | + } |
---|
| 131 | + |
---|
| 132 | + ret = part_get_info_by_name(dev_desc, boot_partname, &part_info); |
---|
| 133 | + if (ret < 0) { |
---|
| 134 | + printf("%s: failed to get %s part, ret=%d\n", |
---|
| 135 | + __func__, boot_partname, ret); |
---|
| 136 | + /* RKIMG can support part table without 'boot' */ |
---|
| 137 | + return -1; |
---|
| 138 | + } |
---|
| 139 | + |
---|
| 140 | + printf("block num: %lu, name %s ,type %s,block size :%lu\n",part_info.size,part_info.name,part_info.type,part_info.blksz); |
---|
| 141 | + |
---|
| 142 | + ret = blk_dread(dev_desc, part_info.start + 512, 1, param_buf_temp); |
---|
| 143 | + if (ret != 1) { |
---|
| 144 | + printf("%s: failed to read screen parameter, ret=%d\n", |
---|
| 145 | + __func__, ret); |
---|
| 146 | + return -1; |
---|
| 147 | + } |
---|
| 148 | + |
---|
| 149 | + for (i = 0; i < LCD_PARAM_MAX_COUNT; i++) { |
---|
| 150 | + lcdParam[i] = param_buf_temp[i * 4]; |
---|
| 151 | + lcdParam[i] = (lcdParam[i] << 8) + param_buf_temp[i * 4 + 1]; |
---|
| 152 | + lcdParam[i] = (lcdParam[i] << 8) + param_buf_temp[i * 4 + 2]; |
---|
| 153 | + lcdParam[i] = (lcdParam[i] << 8) + param_buf_temp[i * 4 + 3]; |
---|
| 154 | + if(lcdParam[i] < 0){ |
---|
| 155 | + lcdParam[i] = -lcdParam[i]; |
---|
| 156 | + } |
---|
| 157 | + if(lcdParam[i] > 100000 && i != 9){ |
---|
| 158 | + lcdParam[i] = 0; |
---|
| 159 | + } |
---|
| 160 | + printf("--get-- lcd_param %d\n",lcdParam[i]); |
---|
| 161 | + } |
---|
| 162 | + |
---|
| 163 | + if(lcdParam[14] == 0 || lcdParam[10] == 0){ |
---|
| 164 | + return -1; |
---|
| 165 | + } |
---|
| 166 | + printf("-get- crc32 = 0X%02X%02X%02X%02X\n", |
---|
| 167 | + param_buf_temp[LCD_PARAM_MAX_COUNT * 4], param_buf_temp[LCD_PARAM_MAX_COUNT * 4 + 1], |
---|
| 168 | + param_buf_temp[LCD_PARAM_MAX_COUNT * 4 + 2], param_buf_temp[LCD_PARAM_MAX_COUNT * 4 + 3]); |
---|
| 169 | + |
---|
| 170 | + data->type = lcdParam[0]; |
---|
| 171 | + data->delay_prepare = lcdParam[4]; |
---|
| 172 | + data->delay_enable = lcdParam[2]; |
---|
| 173 | + data->delay_disable = lcdParam[3]; |
---|
| 174 | + data->delay_unprepare = lcdParam[1]; |
---|
| 175 | + data->delay_reset = lcdParam[5]; |
---|
| 176 | + data->delay_init = lcdParam[6]; |
---|
| 177 | + data->size_width = lcdParam[7]; |
---|
| 178 | + data->size_height = lcdParam[8]; |
---|
| 179 | + data->clock_frequency = lcdParam[9]; |
---|
| 180 | + data->hactive = lcdParam[10]; |
---|
| 181 | + data->hfront_porch = lcdParam[11]; |
---|
| 182 | + data->hsync_len = lcdParam[12]; |
---|
| 183 | + data->hback_porch = lcdParam[13]; |
---|
| 184 | + data->vactive = lcdParam[14]; |
---|
| 185 | + data->vfront_porch = lcdParam[15]; |
---|
| 186 | + data->vsync_len = lcdParam[16]; |
---|
| 187 | + data->vback_porch = lcdParam[17]; |
---|
| 188 | + data->hsync_active = lcdParam[18]; |
---|
| 189 | + data->vsync_active = lcdParam[19]; |
---|
| 190 | + data->de_active = lcdParam[20]; |
---|
| 191 | + data->pixelclk_active = lcdParam[21]; |
---|
| 192 | + data->flags = lcdParam[22]; |
---|
| 193 | + data->format = lcdParam[23]; |
---|
| 194 | + data->lanes = lcdParam[24]; |
---|
| 195 | + data->init_cmd_length = lcdParam[25] = 16; |
---|
| 196 | + data->nodka_lvds = lcdParam[26]; |
---|
| 197 | + data->init_cmd = malloc(sizeof(*(data->init_cmd)) * data->init_cmd_length); |
---|
| 198 | + for(i = 0; i < data->init_cmd_length; i++){ |
---|
| 199 | + *(data->init_cmd + i) = param_buf_temp[100 + i]; |
---|
| 200 | + // printf("init cmd = %x\n",param_buf_temp[100 + i]); |
---|
| 201 | + |
---|
| 202 | + } |
---|
| 203 | + |
---|
| 204 | +// set_lcdparam_test_edp(data); |
---|
| 205 | + |
---|
| 206 | + return 0; |
---|
| 207 | +} |
---|
| 208 | + |
---|
| 209 | +#endif |
---|
| 210 | + |
---|
| 211 | + |
---|
| 212 | +static int find_connector_node(const void *blob, int node) |
---|
| 213 | +{ |
---|
| 214 | + int phandle, remote; |
---|
| 215 | + int nodedepth; |
---|
| 216 | + |
---|
| 217 | + phandle = fdt_getprop_u32_default_node(blob, node, 0, |
---|
| 218 | + "remote-endpoint", -1); |
---|
| 219 | + remote = fdt_node_offset_by_phandle(blob, phandle); |
---|
| 220 | + nodedepth = fdt_node_depth(blob, remote); |
---|
| 221 | + |
---|
| 222 | + return fdt_supernode_atdepth_offset(blob, remote, |
---|
| 223 | + nodedepth - 3, NULL); |
---|
| 224 | +} |
---|
| 225 | + |
---|
| 226 | +static int get_panel_node(const void *blob, int conn_node) |
---|
| 227 | +{ |
---|
| 228 | + int panel, ports, port, ep, remote, ph, nodedepth; |
---|
| 229 | + |
---|
| 230 | + panel = fdt_subnode_offset(blob, conn_node, "panel"); |
---|
| 231 | + printf("panel_1=%d\n",panel); |
---|
| 232 | + if (panel > 0) { |
---|
| 233 | + return panel; |
---|
| 234 | + } |
---|
| 235 | + |
---|
| 236 | + ports = fdt_subnode_offset(blob, conn_node, "ports"); |
---|
| 237 | + if (ports < 0) |
---|
| 238 | + { |
---|
| 239 | + return -ENODEV; |
---|
| 240 | + } |
---|
| 241 | + |
---|
| 242 | + fdt_for_each_subnode(port, blob, ports) { |
---|
| 243 | + fdt_for_each_subnode(ep, blob, port) { |
---|
| 244 | + ph = fdt_getprop_u32_default_node(blob, ep, 0, |
---|
| 245 | + "remote-endpoint", 0); |
---|
| 246 | + if (!ph) |
---|
| 247 | + continue; |
---|
| 248 | + |
---|
| 249 | + remote = fdt_node_offset_by_phandle(blob, ph); |
---|
| 250 | + |
---|
| 251 | + nodedepth = fdt_node_depth(blob, remote); |
---|
| 252 | + if (nodedepth < 2) |
---|
| 253 | + continue; |
---|
| 254 | + |
---|
| 255 | + panel = fdt_supernode_atdepth_offset(blob, remote, |
---|
| 256 | + nodedepth - 2, |
---|
| 257 | + NULL); |
---|
| 258 | + break; |
---|
| 259 | + } |
---|
| 260 | + } |
---|
| 261 | + printf("panel_2=%d\n",panel); |
---|
| 262 | + return panel; |
---|
| 263 | +} |
---|
| 264 | + |
---|
| 265 | +static int fdt_fixup_node_status(void *blob, int node, enum fdt_status status) |
---|
| 266 | +{ |
---|
| 267 | + int ret; |
---|
| 268 | + |
---|
| 269 | +// printf("My fixup %s %d\n", fdt_get_name(blob, node, NULL), status); |
---|
| 270 | + |
---|
| 271 | +set_status: |
---|
| 272 | + ret = fdt_set_node_status(blob, node, status, 0); |
---|
| 273 | + if (ret == -FDT_ERR_NOSPACE) { |
---|
| 274 | + ret = fdt_increase_size(blob, 512); |
---|
| 275 | + if (!ret) |
---|
| 276 | + goto set_status; |
---|
| 277 | + else |
---|
| 278 | + goto err_size; |
---|
| 279 | + } else if (ret < 0) { |
---|
| 280 | + printf("Can't set node status: %s\n", fdt_strerror(ret)); |
---|
| 281 | + return ret; |
---|
| 282 | + } |
---|
| 283 | + |
---|
| 284 | + return 0; |
---|
| 285 | + |
---|
| 286 | +err_size: |
---|
| 287 | + printf("Can't increase blob size: %s\n", fdt_strerror(ret)); |
---|
| 288 | + return ret; |
---|
| 289 | +} |
---|
| 290 | + |
---|
| 291 | +static int fdt_fixup_panel_init_sequence(void *fdt, int node,const struct display_fixup_data *data) |
---|
| 292 | +{ |
---|
| 293 | + #if 0 |
---|
| 294 | + u8 init_buf[] = {0x05, 0x00, 0x01, 0x78, 0x15, 0x01, 0x02, 0x03, 0x04, 0x05, 0x05, 0x01, 0x14,0x39, 0x01, 0x03, 0x02, 0x29, 0x11}; |
---|
| 295 | + u8 exit_buf[] = {0x05, 0x64, 0x01, 0x29, 0x05, 0x64, 0x01, 0x11}; |
---|
| 296 | + #endif |
---|
| 297 | + int ret; |
---|
| 298 | + |
---|
| 299 | +add_seq: |
---|
| 300 | + ret = fdt_setprop(fdt, node, "panel-init-sequence", data->init_cmd, data->init_cmd_length); |
---|
| 301 | + if (ret == -FDT_ERR_NOSPACE) { |
---|
| 302 | + printf(" init sequence FDT_ERR_NOSPACE\n"); |
---|
| 303 | + ret = fdt_increase_size(fdt, data->init_cmd_length * 4);//gln the length needs precision |
---|
| 304 | + if (!ret) |
---|
| 305 | + goto add_seq; |
---|
| 306 | + else |
---|
| 307 | + goto err_size; |
---|
| 308 | + } else if (ret < 0) { |
---|
| 309 | + printf("Can't add property: %s\n", fdt_strerror(ret)); |
---|
| 310 | + return ret; |
---|
| 311 | + } |
---|
| 312 | + |
---|
| 313 | +#if 0 |
---|
| 314 | +add_init_seq: |
---|
| 315 | + ret = fdt_setprop(fdt, node, "panel-init-sequence", init_buf, sizeof(init_buf)); |
---|
| 316 | + if (ret == -FDT_ERR_NOSPACE) { |
---|
| 317 | + printf(" init sequence FDT_ERR_NOSPACE\n"); |
---|
| 318 | + ret = fdt_increase_size(fdt, 512);//gln the length needs precision |
---|
| 319 | + if (!ret) |
---|
| 320 | + goto add_init_seq; |
---|
| 321 | + else |
---|
| 322 | + goto err_size; |
---|
| 323 | + } else if (ret < 0) { |
---|
| 324 | + printf("Can't add property: %s\n", fdt_strerror(ret)); |
---|
| 325 | + return ret; |
---|
| 326 | + } |
---|
| 327 | +add_exit_seq: |
---|
| 328 | + ret = fdt_setprop(fdt, node, "panel-exit-sequence", exit_buf, sizeof(exit_buf)); |
---|
| 329 | + if (ret == -FDT_ERR_NOSPACE) { |
---|
| 330 | + printf(" init sequence FDT_ERR_NOSPACE\n"); |
---|
| 331 | + ret = fdt_increase_size(fdt, 512);//gln the length needs precision |
---|
| 332 | + if (!ret) |
---|
| 333 | + goto add_exit_seq; |
---|
| 334 | + else |
---|
| 335 | + goto err_size; |
---|
| 336 | + } else if (ret < 0) { |
---|
| 337 | + printf("Can't add property: %s\n", fdt_strerror(ret)); |
---|
| 338 | + return ret; |
---|
| 339 | + } |
---|
| 340 | +#endif |
---|
| 341 | + |
---|
| 342 | + return 0; |
---|
| 343 | + |
---|
| 344 | +err_size: |
---|
| 345 | + printf("Can't increase blob size: %s\n", fdt_strerror(ret)); |
---|
| 346 | + return ret; |
---|
| 347 | +} |
---|
| 348 | + |
---|
| 349 | +static int fdt_fixup_setprop_u32(void *fdt, int node, const char *name, u32 data) |
---|
| 350 | +{ |
---|
| 351 | + int ret; |
---|
| 352 | + |
---|
| 353 | +set_prop: |
---|
| 354 | + ret = fdt_setprop_u32(fdt, node, name, data); |
---|
| 355 | + if (ret == -FDT_ERR_NOSPACE) { |
---|
| 356 | + ret = fdt_increase_size(fdt, 512); |
---|
| 357 | + if (!ret) |
---|
| 358 | + goto set_prop; |
---|
| 359 | + else |
---|
| 360 | + goto err_size; |
---|
| 361 | + } else if (ret < 0) { |
---|
| 362 | + printf("Can't add property: %s\n", fdt_strerror(ret)); |
---|
| 363 | + return ret; |
---|
| 364 | + } |
---|
| 365 | + |
---|
| 366 | + return 0; |
---|
| 367 | + |
---|
| 368 | +err_size: |
---|
| 369 | + printf("Can't increase blob size: %s\n", fdt_strerror(ret)); |
---|
| 370 | + return ret; |
---|
| 371 | +} |
---|
| 372 | + |
---|
| 373 | +static void fdt_fixup_display_timing(void *blob, int node, |
---|
| 374 | + const struct display_fixup_data *data) |
---|
| 375 | +{ |
---|
| 376 | + fdt_fixup_setprop_u32(blob, node, "clock-frequency", data->clock_frequency); |
---|
| 377 | + fdt_fixup_setprop_u32(blob, node, "hactive", data->hactive); |
---|
| 378 | + fdt_fixup_setprop_u32(blob, node, "hfront-porch", data->hfront_porch); |
---|
| 379 | + fdt_fixup_setprop_u32(blob, node, "hsync-len", data->hsync_len); |
---|
| 380 | + fdt_fixup_setprop_u32(blob, node, "hback-porch", data->hback_porch); |
---|
| 381 | + fdt_fixup_setprop_u32(blob, node, "vactive", data->vactive); |
---|
| 382 | + fdt_fixup_setprop_u32(blob, node, "vfront-porch", data->vfront_porch); |
---|
| 383 | + fdt_fixup_setprop_u32(blob, node, "vsync-len", data->vsync_len); |
---|
| 384 | + fdt_fixup_setprop_u32(blob, node, "vback-porch", data->vback_porch); |
---|
| 385 | + fdt_fixup_setprop_u32(blob, node, "hsync-active", data->hsync_active); |
---|
| 386 | + fdt_fixup_setprop_u32(blob, node, "vsync-active", data->vsync_active); |
---|
| 387 | + fdt_fixup_setprop_u32(blob, node, "de-active", data->de_active); |
---|
| 388 | + fdt_fixup_setprop_u32(blob, node, "pixelclk-active", data->pixelclk_active); |
---|
| 389 | +} |
---|
| 390 | + |
---|
| 391 | +static void fdt_fixup_panel_node(void *blob, int node, const char *name, |
---|
| 392 | + const struct display_fixup_data *data) |
---|
| 393 | +{ |
---|
| 394 | + if (!strcmp(name, "dsi")) { |
---|
| 395 | + fdt_setprop_u32(blob, node, "dsi,flags", data->flags); |
---|
| 396 | + fdt_setprop_u32(blob, node, "dsi,format", data->format); |
---|
| 397 | + fdt_setprop_u32(blob, node, "dsi,lanes", data->lanes); |
---|
| 398 | + fdt_fixup_panel_init_sequence(blob, node,data); |
---|
| 399 | + } |
---|
| 400 | + fdt_fixup_setprop_u32(blob, node, "prepare-delay-ms", data->delay_prepare); |
---|
| 401 | + fdt_fixup_setprop_u32(blob, node, "enable-delay-ms", data->delay_enable); |
---|
| 402 | + fdt_fixup_setprop_u32(blob, node, "disable-delay-ms", data->delay_disable); |
---|
| 403 | + fdt_fixup_setprop_u32(blob, node, "unprepare-delay-ms", data->delay_unprepare); |
---|
| 404 | + fdt_fixup_setprop_u32(blob, node, "reset-delay-ms", data->delay_reset); |
---|
| 405 | + fdt_fixup_setprop_u32(blob, node, "init-delay-ms", data->delay_init); |
---|
| 406 | + fdt_fixup_setprop_u32(blob, node, "width-mm", data->size_width); |
---|
| 407 | + fdt_fixup_setprop_u32(blob, node, "height-mm", data->size_height); |
---|
| 408 | + |
---|
| 409 | +} |
---|
| 410 | +static void fdt_fixup_nodka_lvds(void *blob, int node, |
---|
| 411 | + const struct display_fixup_data *data) |
---|
| 412 | +{ |
---|
| 413 | + if ( data->nodka_lvds != 0 ) |
---|
| 414 | + fdt_fixup_setprop_u32(blob, node, "nodka-lvds", data->nodka_lvds); |
---|
| 415 | +} |
---|
| 416 | + |
---|
| 417 | + |
---|
| 418 | +static int fdt_fixup_display_sub_route(void *blob, const char *name, |
---|
| 419 | + enum fdt_status status, |
---|
| 420 | + const struct display_fixup_data *data) |
---|
| 421 | +{ |
---|
| 422 | + int route, phandle, connect, connector, panel, dt, timing, route_lvds; |
---|
| 423 | + char path[64]; |
---|
| 424 | + char path_lvds[16] = "/panel"; |
---|
| 425 | + int ret; |
---|
| 426 | + sprintf(path, "/display-subsystem/route/route-%s", name); |
---|
| 427 | + |
---|
| 428 | + |
---|
| 429 | + route = fdt_path_offset(blob, path); |
---|
| 430 | + printf("route : %d \n",route); |
---|
| 431 | + if (route < 0) |
---|
| 432 | + return route; |
---|
| 433 | + |
---|
| 434 | + route_lvds = fdt_path_offset(blob, path_lvds); |
---|
| 435 | + if (route_lvds < 0) |
---|
| 436 | + { |
---|
| 437 | + printf("can not get route_lvds = %d\n",route_lvds); |
---|
| 438 | + return route_lvds; |
---|
| 439 | + } |
---|
| 440 | + /* fixup lvds gpio channel*/ |
---|
| 441 | + fdt_fixup_nodka_lvds(blob, route_lvds, data); |
---|
| 442 | + |
---|
| 443 | + /* fixup route status */ |
---|
| 444 | + ret = fdt_fixup_node_status(blob, route, status); |
---|
| 445 | + if (ret < 0) |
---|
| 446 | + return ret; |
---|
| 447 | + phandle = fdt_getprop_u32_default_node(blob, route, 0, "connect", -1); |
---|
| 448 | + if (phandle < 0) |
---|
| 449 | + return phandle; |
---|
| 450 | + connect = fdt_node_offset_by_phandle(blob, phandle); |
---|
| 451 | + if (connect < 0) |
---|
| 452 | + return connect; |
---|
| 453 | + connector = find_connector_node(blob, connect); |
---|
| 454 | + if (connector < 0) |
---|
| 455 | + return connector; |
---|
| 456 | + /* fixup connector status */ |
---|
| 457 | + ret = fdt_fixup_node_status(blob, connector, status); |
---|
| 458 | + if (ret < 0) |
---|
| 459 | + return ret; |
---|
| 460 | + if (status != FDT_STATUS_OKAY) { |
---|
| 461 | + return 0; |
---|
| 462 | + } |
---|
| 463 | + panel = get_panel_node(blob, connector); |
---|
| 464 | + if (panel < 0) |
---|
| 465 | + return panel; |
---|
| 466 | + /* fixup panel info */ |
---|
| 467 | + fdt_fixup_panel_node(blob, panel, name, data); |
---|
| 468 | + dt = fdt_subnode_offset(blob, panel, "display-timings"); |
---|
| 469 | + if (dt < 0) { |
---|
| 470 | + return dt; |
---|
| 471 | + } |
---|
| 472 | + timing = fdt_subnode_offset(blob, dt, "timing"); |
---|
| 473 | + if (timing < 0) { |
---|
| 474 | + phandle = fdt_getprop_u32_default_node(blob, dt, 0, "native-mode", -1); |
---|
| 475 | + if (phandle < 0) |
---|
| 476 | + return phandle; |
---|
| 477 | + |
---|
| 478 | + timing = fdt_node_offset_by_phandle(blob, phandle); |
---|
| 479 | + if (timing < 0) |
---|
| 480 | + return timing; |
---|
| 481 | + } |
---|
| 482 | + |
---|
| 483 | + /* fixup panel display timing */ |
---|
| 484 | + fdt_fixup_display_timing(blob, timing, data); |
---|
| 485 | + return 0; |
---|
| 486 | +} |
---|
| 487 | + |
---|
| 488 | +static void fdt_fixup_display_route(void *blob, const struct display_fixup_data *data) |
---|
| 489 | +{ |
---|
| 490 | + if (data->type == PANEL_TYPE_DSI) { |
---|
| 491 | + fdt_fixup_display_sub_route(blob, "dsi", FDT_STATUS_OKAY, data); |
---|
| 492 | + fdt_fixup_display_sub_route(blob, "edp", FDT_STATUS_DISABLED, data); |
---|
| 493 | + fdt_fixup_display_sub_route(blob, "lvds", FDT_STATUS_DISABLED, data); |
---|
| 494 | + } else if (data->type == PANEL_TYPE_EDP) { |
---|
| 495 | + fdt_fixup_display_sub_route(blob, "dsi", FDT_STATUS_DISABLED, data); |
---|
| 496 | + fdt_fixup_display_sub_route(blob, "edp", FDT_STATUS_OKAY, data); |
---|
| 497 | + fdt_fixup_display_sub_route(blob, "lvds", FDT_STATUS_DISABLED, data); |
---|
| 498 | + } else if (data->type == PANEL_TYPE_LVDS) { |
---|
| 499 | + fdt_fixup_display_sub_route(blob, "lvds", FDT_STATUS_OKAY, data); |
---|
| 500 | + fdt_fixup_display_sub_route(blob, "dsi", FDT_STATUS_DISABLED, data); |
---|
| 501 | + fdt_fixup_display_sub_route(blob, "edp", FDT_STATUS_DISABLED, data); |
---|
| 502 | + } |
---|
| 503 | +} |
---|
| 504 | + |
---|
| 505 | + |
---|
| 506 | + |
---|
| 507 | + |
---|
| 508 | + |
---|
| 509 | + |
---|
| 510 | + |
---|
| 511 | + |
---|
| 512 | + |
---|
19 | 513 | #ifdef CONFIG_USING_KERNEL_DTB_V2 |
---|
20 | 514 | static int dm_rm_kernel_dev(void) |
---|
21 | 515 | { |
---|
.. | .. |
---|
301 | 795 | #endif |
---|
302 | 796 | ulong fdt_addr = 0; |
---|
303 | 797 | int ret = -ENODEV; |
---|
| 798 | + struct display_fixup_data fix_data; |
---|
304 | 799 | |
---|
305 | 800 | printf("DM: v%d\n", IS_ENABLED(CONFIG_USING_KERNEL_DTB_V2) ? 2 : 1); |
---|
306 | 801 | |
---|
.. | .. |
---|
372 | 867 | phandles_fixup_cru((void *)gd->fdt_blob); |
---|
373 | 868 | phandles_fixup_gpio((void *)gd->fdt_blob, (void *)ufdt_blob); |
---|
374 | 869 | #endif |
---|
| 870 | + if (!get_lcdparam_info_from_custom_partition(&fix_data)) |
---|
| 871 | + fdt_fixup_display_route((void *)fdt_addr, &fix_data); |
---|
375 | 872 | |
---|
376 | 873 | gd->flags |= GD_FLG_KDTB_READY; |
---|
377 | 874 | gd->of_root_f = gd->of_root; |
---|