Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: combine public interfaces into single header

[Why]
We want to better encapsulate all driver-fw dependencies into a single
file.

[How]
Combine all the headers under inc folder into a single header

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Anthony Koo and committed by
Alex Deucher
84034ad4 1f255112

+374 -525
-4
drivers/gpu/drm/amd/display/dmub/dmub_srv.h
··· 64 64 * other component within DAL. 65 65 */ 66 66 67 - #include "inc/dmub_types.h" 68 67 #include "inc/dmub_cmd.h" 69 - #include "inc/dmub_gpint_cmd.h" 70 - #include "inc/dmub_cmd_dal.h" 71 - #include "inc/dmub_rb.h" 72 68 73 69 #if defined(__cplusplus) 74 70 extern "C" {
+370 -13
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
··· 26 26 #ifndef _DMUB_CMD_H_ 27 27 #define _DMUB_CMD_H_ 28 28 29 - #include "dmub_types.h" 30 - #include "dmub_cmd_dal.h" 31 - #include "dmub_cmd_vbios.h" 29 + #include <asm/byteorder.h> 30 + #include <linux/types.h> 31 + #include <linux/string.h> 32 + #include <linux/delay.h> 33 + #include <stdarg.h> 34 + 32 35 #include "atomfirmware.h" 36 + 37 + 38 + //<DMUB_TYPES>================================================================== 39 + /* Basic type definitions. */ 40 + 41 + #define SET_ABM_PIPE_GRADUALLY_DISABLE 0 42 + #define SET_ABM_PIPE_IMMEDIATELY_DISABLE 255 43 + #define SET_ABM_PIPE_NORMAL 1 44 + 45 + /* Maximum number of streams on any ASIC. */ 46 + #define DMUB_MAX_STREAMS 6 47 + 48 + /* Maximum number of planes on any ASIC. */ 49 + #define DMUB_MAX_PLANES 6 50 + 51 + #ifndef PHYSICAL_ADDRESS_LOC 52 + #define PHYSICAL_ADDRESS_LOC union large_integer 53 + #endif 54 + 55 + #if defined(__cplusplus) 56 + extern "C" { 57 + #endif 58 + 59 + #ifndef dmub_memcpy 60 + #define dmub_memcpy(dest, source, bytes) memcpy((dest), (source), (bytes)) 61 + #endif 62 + 63 + #ifndef dmub_memset 64 + #define dmub_memset(dest, val, bytes) memset((dest), (val), (bytes)) 65 + #endif 66 + 67 + #ifndef dmub_udelay 68 + #define dmub_udelay(microseconds) udelay(microseconds) 69 + #endif 70 + 71 + union dmub_addr { 72 + struct { 73 + uint32_t low_part; 74 + uint32_t high_part; 75 + } u; 76 + uint64_t quad_part; 77 + }; 78 + 79 + union dmub_psr_debug_flags { 80 + struct { 81 + uint8_t visual_confirm : 1; 82 + } bitfields; 83 + 84 + unsigned int u32All; 85 + }; 86 + 87 + #if defined(__cplusplus) 88 + } 89 + #endif 90 + 91 + 92 + 93 + //============================================================================== 94 + //</DMUB_TYPES>================================================================= 95 + //============================================================================== 96 + //< DMUB_META>================================================================== 97 + //============================================================================== 98 + #pragma pack(push, 1) 99 + 100 + /* Magic value for identifying dmub_fw_meta_info */ 101 + #define DMUB_FW_META_MAGIC 0x444D5542 102 + 103 + /* Offset from the end of the file to the dmub_fw_meta_info */ 104 + #define DMUB_FW_META_OFFSET 0x24 105 + 106 + /** 107 + * struct dmub_fw_meta_info - metadata associated with fw binary 108 + * 109 + * NOTE: This should be considered a stable API. Fields should 110 + * not be repurposed or reordered. New fields should be 111 + * added instead to extend the structure. 112 + * 113 + * @magic_value: magic value identifying DMUB firmware meta info 114 + * @fw_region_size: size of the firmware state region 115 + * @trace_buffer_size: size of the tracebuffer region 116 + * @fw_version: the firmware version information 117 + */ 118 + struct dmub_fw_meta_info { 119 + uint32_t magic_value; 120 + uint32_t fw_region_size; 121 + uint32_t trace_buffer_size; 122 + uint32_t fw_version; 123 + }; 124 + 125 + /* Ensure that the structure remains 64 bytes. */ 126 + union dmub_fw_meta { 127 + struct dmub_fw_meta_info info; 128 + uint8_t reserved[64]; 129 + }; 130 + 131 + #pragma pack(pop) 132 + //============================================================================== 133 + //</DMUB_META>================================================================== 134 + //============================================================================== 135 + //< DMUB_VBIOS>================================================================= 136 + //============================================================================== 137 + 138 + /* 139 + * Command IDs should be treated as stable ABI. 140 + * Do not reuse or modify IDs. 141 + */ 142 + 143 + enum dmub_cmd_vbios_type { 144 + DMUB_CMD__VBIOS_DIGX_ENCODER_CONTROL = 0, 145 + DMUB_CMD__VBIOS_DIG1_TRANSMITTER_CONTROL = 1, 146 + DMUB_CMD__VBIOS_SET_PIXEL_CLOCK = 2, 147 + DMUB_CMD__VBIOS_ENABLE_DISP_POWER_GATING = 3, 148 + }; 149 + 150 + //============================================================================== 151 + //</DMUB_VBIOS>================================================================= 152 + //============================================================================== 153 + //< DMUB_GPINT>================================================================= 154 + //============================================================================== 155 + 156 + /** 157 + * The shifts and masks below may alternatively be used to format and read 158 + * the command register bits. 159 + */ 160 + 161 + #define DMUB_GPINT_DATA_PARAM_MASK 0xFFFF 162 + #define DMUB_GPINT_DATA_PARAM_SHIFT 0 163 + 164 + #define DMUB_GPINT_DATA_COMMAND_CODE_MASK 0xFFF 165 + #define DMUB_GPINT_DATA_COMMAND_CODE_SHIFT 16 166 + 167 + #define DMUB_GPINT_DATA_STATUS_MASK 0xF 168 + #define DMUB_GPINT_DATA_STATUS_SHIFT 28 169 + 170 + /** 171 + * Command responses. 172 + */ 173 + 174 + #define DMUB_GPINT__STOP_FW_RESPONSE 0xDEADDEAD 175 + 176 + /** 177 + * The register format for sending a command via the GPINT. 178 + */ 179 + union dmub_gpint_data_register { 180 + struct { 181 + uint32_t param : 16; 182 + uint32_t command_code : 12; 183 + uint32_t status : 4; 184 + } bits; 185 + uint32_t all; 186 + }; 187 + 188 + /* 189 + * Command IDs should be treated as stable ABI. 190 + * Do not reuse or modify IDs. 191 + */ 192 + 193 + enum dmub_gpint_command { 194 + DMUB_GPINT__INVALID_COMMAND = 0, 195 + DMUB_GPINT__GET_FW_VERSION = 1, 196 + DMUB_GPINT__STOP_FW = 2, 197 + DMUB_GPINT__GET_PSR_STATE = 7, 198 + }; 199 + 200 + //============================================================================== 201 + //</DMUB_GPINT>================================================================= 202 + //============================================================================== 203 + //< DMUB_CMD>=================================================================== 204 + //============================================================================== 33 205 34 206 #define DMUB_RB_CMD_SIZE 64 35 207 #define DMUB_RB_MAX_ENTRY 128 36 208 #define DMUB_RB_SIZE (DMUB_RB_CMD_SIZE * DMUB_RB_MAX_ENTRY) 37 209 #define REG_SET_MASK 0xFFFF 38 - 39 - #define SET_ABM_PIPE_GRADUALLY_DISABLE 0 40 - #define SET_ABM_PIPE_IMMEDIATELY_DISABLE 255 41 - #define SET_ABM_PIPE_NORMAL 1 42 210 43 211 /* 44 212 * Command IDs should be treated as stable ABI. ··· 277 109 }; 278 110 279 111 #define DMUB_REG_FIELD_UPDATE_SEQ__MAX 7 280 - 281 112 struct dmub_rb_cmd_reg_field_update_sequence { 282 113 struct dmub_cmd_header header; 283 114 uint32_t addr; 284 115 struct dmub_cmd_reg_field_update_sequence seq[DMUB_REG_FIELD_UPDATE_SEQ__MAX]; 285 116 }; 286 - 287 117 288 118 /* 289 119 * Burst write ··· 316 150 struct dmub_cmd_header header; 317 151 struct dmub_cmd_reg_wait_data reg_wait; 318 152 }; 319 - 320 - #ifndef PHYSICAL_ADDRESS_LOC 321 - #define PHYSICAL_ADDRESS_LOC union large_integer 322 - #endif 323 153 324 154 struct dmub_cmd_PLAT_54186_wa { 325 155 uint32_t DCSURF_SURFACE_CONTROL; ··· 380 218 uint8_t reserved[60]; 381 219 }; 382 220 221 + /* 222 + * Command IDs should be treated as stable ABI. 223 + * Do not reuse or modify IDs. 224 + */ 225 + 226 + enum dmub_cmd_psr_type { 227 + DMUB_CMD__PSR_SET_VERSION = 0, 228 + DMUB_CMD__PSR_COPY_SETTINGS = 1, 229 + DMUB_CMD__PSR_ENABLE = 2, 230 + DMUB_CMD__PSR_DISABLE = 3, 231 + DMUB_CMD__PSR_SET_LEVEL = 4, 232 + }; 233 + 234 + enum psr_version { 235 + PSR_VERSION_1 = 0, 236 + PSR_VERSION_UNSUPPORTED = 0xFFFFFFFF, 237 + }; 238 + 383 239 struct dmub_cmd_psr_copy_settings_data { 384 240 union dmub_psr_debug_flags debug; 385 241 uint16_t psr_level; ··· 441 261 struct dmub_rb_cmd_psr_set_version { 442 262 struct dmub_cmd_header header; 443 263 struct dmub_cmd_psr_set_version_data psr_set_version_data; 264 + }; 265 + 266 + enum dmub_cmd_abm_type { 267 + DMUB_CMD__ABM_INIT_CONFIG = 0, 268 + DMUB_CMD__ABM_SET_PIPE = 1, 269 + DMUB_CMD__ABM_SET_BACKLIGHT = 2, 270 + DMUB_CMD__ABM_SET_LEVEL = 3, 271 + DMUB_CMD__ABM_SET_AMBIENT_LEVEL = 4, 272 + DMUB_CMD__ABM_SET_PWM_FRAC = 5, 273 + }; 274 + 275 + #define NUM_AMBI_LEVEL 5 276 + #define NUM_AGGR_LEVEL 4 277 + #define NUM_POWER_FN_SEGS 8 278 + #define NUM_BL_CURVE_SEGS 16 279 + 280 + /* 281 + * Parameters for ABM2.4 algorithm. 282 + * Padded explicitly to 32-bit boundary. 283 + */ 284 + struct abm_config_table { 285 + /* Parameters for crgb conversion */ 286 + uint16_t crgb_thresh[NUM_POWER_FN_SEGS]; // 0B 287 + uint16_t crgb_offset[NUM_POWER_FN_SEGS]; // 15B 288 + uint16_t crgb_slope[NUM_POWER_FN_SEGS]; // 31B 289 + 290 + /* Parameters for custom curve */ 291 + uint16_t backlight_thresholds[NUM_BL_CURVE_SEGS]; // 47B 292 + uint16_t backlight_offsets[NUM_BL_CURVE_SEGS]; // 79B 293 + 294 + uint16_t ambient_thresholds_lux[NUM_AMBI_LEVEL]; // 111B 295 + uint16_t min_abm_backlight; // 121B 296 + 297 + uint8_t min_reduction[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; // 123B 298 + uint8_t max_reduction[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; // 143B 299 + uint8_t bright_pos_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; // 163B 300 + uint8_t dark_pos_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; // 183B 301 + uint8_t hybrid_factor[NUM_AGGR_LEVEL]; // 203B 302 + uint8_t contrast_factor[NUM_AGGR_LEVEL]; // 207B 303 + uint8_t deviation_gain[NUM_AGGR_LEVEL]; // 211B 304 + uint8_t min_knee[NUM_AGGR_LEVEL]; // 215B 305 + uint8_t max_knee[NUM_AGGR_LEVEL]; // 219B 306 + uint8_t iir_curve[NUM_AMBI_LEVEL]; // 223B 307 + uint8_t pad3[3]; // 228B 444 308 }; 445 309 446 310 struct dmub_cmd_abm_set_pipe_data { ··· 571 347 }; 572 348 573 349 #pragma pack(pop) 350 + 351 + 352 + //============================================================================== 353 + //</DMUB_CMD>=================================================================== 354 + //============================================================================== 355 + //< DMUB_RB>==================================================================== 356 + //============================================================================== 357 + 358 + #if defined(__cplusplus) 359 + extern "C" { 360 + #endif 361 + 362 + struct dmub_rb_init_params { 363 + void *ctx; 364 + void *base_address; 365 + uint32_t capacity; 366 + uint32_t read_ptr; 367 + uint32_t write_ptr; 368 + }; 369 + 370 + struct dmub_rb { 371 + void *base_address; 372 + uint32_t data_count; 373 + uint32_t rptr; 374 + uint32_t wrpt; 375 + uint32_t capacity; 376 + 377 + void *ctx; 378 + void *dmub; 379 + }; 380 + 381 + 382 + static inline bool dmub_rb_empty(struct dmub_rb *rb) 383 + { 384 + return (rb->wrpt == rb->rptr); 385 + } 386 + 387 + static inline bool dmub_rb_full(struct dmub_rb *rb) 388 + { 389 + uint32_t data_count; 390 + 391 + if (rb->wrpt >= rb->rptr) 392 + data_count = rb->wrpt - rb->rptr; 393 + else 394 + data_count = rb->capacity - (rb->rptr - rb->wrpt); 395 + 396 + return (data_count == (rb->capacity - DMUB_RB_CMD_SIZE)); 397 + } 398 + 399 + static inline bool dmub_rb_push_front(struct dmub_rb *rb, 400 + const union dmub_rb_cmd *cmd) 401 + { 402 + uint64_t volatile *dst = (uint64_t volatile *)(rb->base_address) + rb->wrpt / sizeof(uint64_t); 403 + const uint64_t *src = (const uint64_t *)cmd; 404 + int i; 405 + 406 + if (dmub_rb_full(rb)) 407 + return false; 408 + 409 + // copying data 410 + for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++) 411 + *dst++ = *src++; 412 + 413 + rb->wrpt += DMUB_RB_CMD_SIZE; 414 + 415 + if (rb->wrpt >= rb->capacity) 416 + rb->wrpt %= rb->capacity; 417 + 418 + return true; 419 + } 420 + 421 + static inline bool dmub_rb_front(struct dmub_rb *rb, 422 + union dmub_rb_cmd *cmd) 423 + { 424 + uint8_t *rd_ptr = (uint8_t *)rb->base_address + rb->rptr; 425 + 426 + if (dmub_rb_empty(rb)) 427 + return false; 428 + 429 + dmub_memcpy(cmd, rd_ptr, DMUB_RB_CMD_SIZE); 430 + 431 + return true; 432 + } 433 + 434 + static inline bool dmub_rb_pop_front(struct dmub_rb *rb) 435 + { 436 + if (dmub_rb_empty(rb)) 437 + return false; 438 + 439 + rb->rptr += DMUB_RB_CMD_SIZE; 440 + 441 + if (rb->rptr >= rb->capacity) 442 + rb->rptr %= rb->capacity; 443 + 444 + return true; 445 + } 446 + 447 + static inline void dmub_rb_flush_pending(const struct dmub_rb *rb) 448 + { 449 + uint32_t rptr = rb->rptr; 450 + uint32_t wptr = rb->wrpt; 451 + 452 + while (rptr != wptr) { 453 + uint64_t volatile *data = (uint64_t volatile *)rb->base_address + rptr / sizeof(uint64_t); 454 + //uint64_t volatile *p = (uint64_t volatile *)data; 455 + uint64_t temp; 456 + int i; 457 + 458 + for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++) 459 + temp = *data++; 460 + 461 + rptr += DMUB_RB_CMD_SIZE; 462 + if (rptr >= rb->capacity) 463 + rptr %= rb->capacity; 464 + } 465 + } 466 + 467 + static inline void dmub_rb_init(struct dmub_rb *rb, 468 + struct dmub_rb_init_params *init_params) 469 + { 470 + rb->base_address = init_params->base_address; 471 + rb->capacity = init_params->capacity; 472 + rb->rptr = init_params->read_ptr; 473 + rb->wrpt = init_params->write_ptr; 474 + } 475 + 476 + #if defined(__cplusplus) 477 + } 478 + #endif 479 + 480 + //============================================================================== 481 + //</DMUB_RB>==================================================================== 482 + //============================================================================== 574 483 575 484 #endif /* _DMUB_CMD_H_ */
-91
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd_dal.h
··· 1 - /* 2 - * Copyright 2019 Advanced Micro Devices, Inc. 3 - * 4 - * Permission is hereby granted, free of charge, to any person obtaining a 5 - * copy of this software and associated documentation files (the "Software"), 6 - * to deal in the Software without restriction, including without limitation 7 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 - * and/or sell copies of the Software, and to permit persons to whom the 9 - * Software is furnished to do so, subject to the following conditions: 10 - * 11 - * The above copyright notice and this permission notice shall be included in 12 - * all copies or substantial portions of the Software. 13 - * 14 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 - * OTHER DEALINGS IN THE SOFTWARE. 21 - * 22 - * Authors: AMD 23 - * 24 - */ 25 - 26 - #ifndef _DMUB_CMD_DAL_H_ 27 - #define _DMUB_CMD_DAL_H_ 28 - 29 - #define NUM_AMBI_LEVEL 5 30 - #define NUM_AGGR_LEVEL 4 31 - #define NUM_POWER_FN_SEGS 8 32 - #define NUM_BL_CURVE_SEGS 16 33 - 34 - /* 35 - * Command IDs should be treated as stable ABI. 36 - * Do not reuse or modify IDs. 37 - */ 38 - 39 - enum dmub_cmd_psr_type { 40 - DMUB_CMD__PSR_SET_VERSION = 0, 41 - DMUB_CMD__PSR_COPY_SETTINGS = 1, 42 - DMUB_CMD__PSR_ENABLE = 2, 43 - DMUB_CMD__PSR_DISABLE = 3, 44 - DMUB_CMD__PSR_SET_LEVEL = 4, 45 - }; 46 - 47 - enum psr_version { 48 - PSR_VERSION_1 = 0, 49 - PSR_VERSION_UNSUPPORTED = 0xFFFFFFFF, 50 - }; 51 - 52 - enum dmub_cmd_abm_type { 53 - DMUB_CMD__ABM_INIT_CONFIG = 0, 54 - DMUB_CMD__ABM_SET_PIPE = 1, 55 - DMUB_CMD__ABM_SET_BACKLIGHT = 2, 56 - DMUB_CMD__ABM_SET_LEVEL = 3, 57 - DMUB_CMD__ABM_SET_AMBIENT_LEVEL = 4, 58 - DMUB_CMD__ABM_SET_PWM_FRAC = 5, 59 - }; 60 - 61 - /* 62 - * Parameters for ABM2.4 algorithm. 63 - * Padded explicitly to 32-bit boundary. 64 - */ 65 - struct abm_config_table { 66 - /* Parameters for crgb conversion */ 67 - uint16_t crgb_thresh[NUM_POWER_FN_SEGS]; // 0B 68 - uint16_t crgb_offset[NUM_POWER_FN_SEGS]; // 15B 69 - uint16_t crgb_slope[NUM_POWER_FN_SEGS]; // 31B 70 - 71 - /* Parameters for custom curve */ 72 - uint16_t backlight_thresholds[NUM_BL_CURVE_SEGS]; // 47B 73 - uint16_t backlight_offsets[NUM_BL_CURVE_SEGS]; // 79B 74 - 75 - uint16_t ambient_thresholds_lux[NUM_AMBI_LEVEL]; // 111B 76 - uint16_t min_abm_backlight; // 121B 77 - 78 - uint8_t min_reduction[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; // 123B 79 - uint8_t max_reduction[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; // 143B 80 - uint8_t bright_pos_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; // 163B 81 - uint8_t dark_pos_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; // 183B 82 - uint8_t hybrid_factor[NUM_AGGR_LEVEL]; // 203B 83 - uint8_t contrast_factor[NUM_AGGR_LEVEL]; // 207B 84 - uint8_t deviation_gain[NUM_AGGR_LEVEL]; // 211B 85 - uint8_t min_knee[NUM_AGGR_LEVEL]; // 215B 86 - uint8_t max_knee[NUM_AGGR_LEVEL]; // 219B 87 - uint8_t iir_curve[NUM_AMBI_LEVEL]; // 223B 88 - uint8_t pad3[3]; // 228B 89 - }; 90 - 91 - #endif /* _DMUB_CMD_DAL_H_ */
-41
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd_vbios.h
··· 1 - /* 2 - * Copyright 2019 Advanced Micro Devices, Inc. 3 - * 4 - * Permission is hereby granted, free of charge, to any person obtaining a 5 - * copy of this software and associated documentation files (the "Software"), 6 - * to deal in the Software without restriction, including without limitation 7 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 - * and/or sell copies of the Software, and to permit persons to whom the 9 - * Software is furnished to do so, subject to the following conditions: 10 - * 11 - * The above copyright notice and this permission notice shall be included in 12 - * all copies or substantial portions of the Software. 13 - * 14 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 - * OTHER DEALINGS IN THE SOFTWARE. 21 - * 22 - * Authors: AMD 23 - * 24 - */ 25 - 26 - #ifndef _DMUB_CMD_VBIOS_H_ 27 - #define _DMUB_CMD_VBIOS_H_ 28 - 29 - /* 30 - * Command IDs should be treated as stable ABI. 31 - * Do not reuse or modify IDs. 32 - */ 33 - 34 - enum dmub_cmd_vbios_type { 35 - DMUB_CMD__VBIOS_DIGX_ENCODER_CONTROL = 0, 36 - DMUB_CMD__VBIOS_DIG1_TRANSMITTER_CONTROL = 1, 37 - DMUB_CMD__VBIOS_SET_PIXEL_CLOCK = 2, 38 - DMUB_CMD__VBIOS_ENABLE_DISP_POWER_GATING = 3, 39 - }; 40 - 41 - #endif /* _DMUB_CMD_VBIOS_H_ */
-65
drivers/gpu/drm/amd/display/dmub/inc/dmub_fw_meta.h
··· 1 - /* 2 - * Copyright 2019 Advanced Micro Devices, Inc. 3 - * 4 - * Permission is hereby granted, free of charge, to any person obtaining a 5 - * copy of this software and associated documentation files (the "Software"), 6 - * to deal in the Software without restriction, including without limitation 7 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 - * and/or sell copies of the Software, and to permit persons to whom the 9 - * Software is furnished to do so, subject to the following conditions: 10 - * 11 - * The above copyright notice and this permission notice shall be included in 12 - * all copies or substantial portions of the Software. 13 - * 14 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 - * OTHER DEALINGS IN THE SOFTWARE. 21 - * 22 - * Authors: AMD 23 - * 24 - */ 25 - #ifndef _DMUB_META_H_ 26 - #define _DMUB_META_H_ 27 - 28 - #include "dmub_types.h" 29 - 30 - #pragma pack(push, 1) 31 - 32 - /* Magic value for identifying dmub_fw_meta_info */ 33 - #define DMUB_FW_META_MAGIC 0x444D5542 34 - 35 - /* Offset from the end of the file to the dmub_fw_meta_info */ 36 - #define DMUB_FW_META_OFFSET 0x24 37 - 38 - /** 39 - * struct dmub_fw_meta_info - metadata associated with fw binary 40 - * 41 - * NOTE: This should be considered a stable API. Fields should 42 - * not be repurposed or reordered. New fields should be 43 - * added instead to extend the structure. 44 - * 45 - * @magic_value: magic value identifying DMUB firmware meta info 46 - * @fw_region_size: size of the firmware state region 47 - * @trace_buffer_size: size of the tracebuffer region 48 - * @fw_version: the firmware version information 49 - */ 50 - struct dmub_fw_meta_info { 51 - uint32_t magic_value; 52 - uint32_t fw_region_size; 53 - uint32_t trace_buffer_size; 54 - uint32_t fw_version; 55 - }; 56 - 57 - /* Ensure that the structure remains 64 bytes. */ 58 - union dmub_fw_meta { 59 - struct dmub_fw_meta_info info; 60 - uint8_t reserved[64]; 61 - }; 62 - 63 - #pragma pack(pop) 64 - 65 - #endif /* _DMUB_META_H_ */
-75
drivers/gpu/drm/amd/display/dmub/inc/dmub_gpint_cmd.h
··· 1 - /* 2 - * Copyright 2019 Advanced Micro Devices, Inc. 3 - * 4 - * Permission is hereby granted, free of charge, to any person obtaining a 5 - * copy of this software and associated documentation files (the "Software"), 6 - * to deal in the Software without restriction, including without limitation 7 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 - * and/or sell copies of the Software, and to permit persons to whom the 9 - * Software is furnished to do so, subject to the following conditions: 10 - * 11 - * The above copyright notice and this permission notice shall be included in 12 - * all copies or substantial portions of the Software. 13 - * 14 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 - * OTHER DEALINGS IN THE SOFTWARE. 21 - * 22 - * Authors: AMD 23 - * 24 - */ 25 - 26 - #ifndef _DMUB_GPINT_CMD_H_ 27 - #define _DMUB_GPINT_CMD_H_ 28 - 29 - #include "dmub_types.h" 30 - 31 - /** 32 - * The register format for sending a command via the GPINT. 33 - */ 34 - union dmub_gpint_data_register { 35 - struct { 36 - uint32_t param : 16; 37 - uint32_t command_code : 12; 38 - uint32_t status : 4; 39 - } bits; 40 - uint32_t all; 41 - }; 42 - 43 - /** 44 - * The shifts and masks below may alternatively be used to format and read 45 - * the command register bits. 46 - */ 47 - 48 - #define DMUB_GPINT_DATA_PARAM_MASK 0xFFFF 49 - #define DMUB_GPINT_DATA_PARAM_SHIFT 0 50 - 51 - #define DMUB_GPINT_DATA_COMMAND_CODE_MASK 0xFFF 52 - #define DMUB_GPINT_DATA_COMMAND_CODE_SHIFT 16 53 - 54 - #define DMUB_GPINT_DATA_STATUS_MASK 0xF 55 - #define DMUB_GPINT_DATA_STATUS_SHIFT 28 56 - 57 - /* 58 - * Command IDs should be treated as stable ABI. 59 - * Do not reuse or modify IDs. 60 - */ 61 - 62 - enum dmub_gpint_command { 63 - DMUB_GPINT__INVALID_COMMAND = 0, 64 - DMUB_GPINT__GET_FW_VERSION = 1, 65 - DMUB_GPINT__STOP_FW = 2, 66 - DMUB_GPINT__GET_PSR_STATE = 7, 67 - }; 68 - 69 - /** 70 - * Command responses. 71 - */ 72 - 73 - #define DMUB_GPINT__STOP_FW_RESPONSE 0xDEADDEAD 74 - 75 - #endif /* _DMUB_GPINT_CMD_H_ */
-154
drivers/gpu/drm/amd/display/dmub/inc/dmub_rb.h
··· 1 - /* 2 - * Copyright 2019 Advanced Micro Devices, Inc. 3 - * 4 - * Permission is hereby granted, free of charge, to any person obtaining a 5 - * copy of this software and associated documentation files (the "Software"), 6 - * to deal in the Software without restriction, including without limitation 7 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 - * and/or sell copies of the Software, and to permit persons to whom the 9 - * Software is furnished to do so, subject to the following conditions: 10 - * 11 - * The above copyright notice and this permission notice shall be included in 12 - * all copies or substantial portions of the Software. 13 - * 14 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 - * OTHER DEALINGS IN THE SOFTWARE. 21 - * 22 - * Authors: AMD 23 - * 24 - */ 25 - 26 - #ifndef _DMUB_RB_H_ 27 - #define _DMUB_RB_H_ 28 - 29 - #include "dmub_types.h" 30 - #include "dmub_cmd.h" 31 - 32 - #if defined(__cplusplus) 33 - extern "C" { 34 - #endif 35 - 36 - struct dmub_rb_init_params { 37 - void *ctx; 38 - void *base_address; 39 - uint32_t capacity; 40 - uint32_t read_ptr; 41 - uint32_t write_ptr; 42 - }; 43 - 44 - struct dmub_rb { 45 - void *base_address; 46 - uint32_t data_count; 47 - uint32_t rptr; 48 - uint32_t wrpt; 49 - uint32_t capacity; 50 - 51 - void *ctx; 52 - void *dmub; 53 - }; 54 - 55 - 56 - static inline bool dmub_rb_empty(struct dmub_rb *rb) 57 - { 58 - return (rb->wrpt == rb->rptr); 59 - } 60 - 61 - static inline bool dmub_rb_full(struct dmub_rb *rb) 62 - { 63 - uint32_t data_count; 64 - 65 - if (rb->wrpt >= rb->rptr) 66 - data_count = rb->wrpt - rb->rptr; 67 - else 68 - data_count = rb->capacity - (rb->rptr - rb->wrpt); 69 - 70 - return (data_count == (rb->capacity - DMUB_RB_CMD_SIZE)); 71 - } 72 - 73 - static inline bool dmub_rb_push_front(struct dmub_rb *rb, 74 - const union dmub_rb_cmd *cmd) 75 - { 76 - uint64_t volatile *dst = (uint64_t volatile *)(rb->base_address) + rb->wrpt / sizeof(uint64_t); 77 - const uint64_t *src = (const uint64_t *)cmd; 78 - int i; 79 - 80 - if (dmub_rb_full(rb)) 81 - return false; 82 - 83 - // copying data 84 - for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++) 85 - *dst++ = *src++; 86 - 87 - rb->wrpt += DMUB_RB_CMD_SIZE; 88 - 89 - if (rb->wrpt >= rb->capacity) 90 - rb->wrpt %= rb->capacity; 91 - 92 - return true; 93 - } 94 - 95 - static inline bool dmub_rb_front(struct dmub_rb *rb, 96 - union dmub_rb_cmd *cmd) 97 - { 98 - uint8_t *rd_ptr = (uint8_t *)rb->base_address + rb->rptr; 99 - 100 - if (dmub_rb_empty(rb)) 101 - return false; 102 - 103 - dmub_memcpy(cmd, rd_ptr, DMUB_RB_CMD_SIZE); 104 - 105 - return true; 106 - } 107 - 108 - static inline bool dmub_rb_pop_front(struct dmub_rb *rb) 109 - { 110 - if (dmub_rb_empty(rb)) 111 - return false; 112 - 113 - rb->rptr += DMUB_RB_CMD_SIZE; 114 - 115 - if (rb->rptr >= rb->capacity) 116 - rb->rptr %= rb->capacity; 117 - 118 - return true; 119 - } 120 - 121 - static inline void dmub_rb_flush_pending(const struct dmub_rb *rb) 122 - { 123 - uint32_t rptr = rb->rptr; 124 - uint32_t wptr = rb->wrpt; 125 - 126 - while (rptr != wptr) { 127 - uint64_t volatile *data = (uint64_t volatile *)rb->base_address + rptr / sizeof(uint64_t); 128 - //uint64_t volatile *p = (uint64_t volatile *)data; 129 - uint64_t temp; 130 - int i; 131 - 132 - for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++) 133 - temp = *data++; 134 - 135 - rptr += DMUB_RB_CMD_SIZE; 136 - if (rptr >= rb->capacity) 137 - rptr %= rb->capacity; 138 - } 139 - } 140 - 141 - static inline void dmub_rb_init(struct dmub_rb *rb, 142 - struct dmub_rb_init_params *init_params) 143 - { 144 - rb->base_address = init_params->base_address; 145 - rb->capacity = init_params->capacity; 146 - rb->rptr = init_params->read_ptr; 147 - rb->wrpt = init_params->write_ptr; 148 - } 149 - 150 - #if defined(__cplusplus) 151 - } 152 - #endif 153 - 154 - #endif /* _DMUB_RB_H_ */
-78
drivers/gpu/drm/amd/display/dmub/inc/dmub_types.h
··· 1 - /* 2 - * Copyright 2019 Advanced Micro Devices, Inc. 3 - * 4 - * Permission is hereby granted, free of charge, to any person obtaining a 5 - * copy of this software and associated documentation files (the "Software"), 6 - * to deal in the Software without restriction, including without limitation 7 - * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 - * and/or sell copies of the Software, and to permit persons to whom the 9 - * Software is furnished to do so, subject to the following conditions: 10 - * 11 - * The above copyright notice and this permission notice shall be included in 12 - * all copies or substantial portions of the Software. 13 - * 14 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 - * OTHER DEALINGS IN THE SOFTWARE. 21 - * 22 - * Authors: AMD 23 - * 24 - */ 25 - 26 - #ifndef _DMUB_TYPES_H_ 27 - #define _DMUB_TYPES_H_ 28 - 29 - /* Basic type definitions. */ 30 - #include <asm/byteorder.h> 31 - #include <linux/types.h> 32 - #include <linux/string.h> 33 - #include <linux/delay.h> 34 - #include <stdarg.h> 35 - 36 - #if defined(__cplusplus) 37 - extern "C" { 38 - #endif 39 - 40 - #ifndef dmub_memcpy 41 - #define dmub_memcpy(dest, source, bytes) memcpy((dest), (source), (bytes)) 42 - #endif 43 - 44 - #ifndef dmub_memset 45 - #define dmub_memset(dest, val, bytes) memset((dest), (val), (bytes)) 46 - #endif 47 - 48 - #ifndef dmub_udelay 49 - #define dmub_udelay(microseconds) udelay(microseconds) 50 - #endif 51 - 52 - /* Maximum number of streams on any ASIC. */ 53 - #define DMUB_MAX_STREAMS 6 54 - 55 - /* Maximum number of planes on any ASIC. */ 56 - #define DMUB_MAX_PLANES 6 57 - 58 - union dmub_addr { 59 - struct { 60 - uint32_t low_part; 61 - uint32_t high_part; 62 - } u; 63 - uint64_t quad_part; 64 - }; 65 - 66 - union dmub_psr_debug_flags { 67 - struct { 68 - uint8_t visual_confirm : 1; 69 - } bitfields; 70 - 71 - unsigned int u32All; 72 - }; 73 - 74 - #if defined(__cplusplus) 75 - } 76 - #endif 77 - 78 - #endif /* _DMUB_TYPES_H_ */
+1 -1
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn20.h
··· 26 26 #ifndef _DMUB_DCN20_H_ 27 27 #define _DMUB_DCN20_H_ 28 28 29 - #include "../inc/dmub_types.h" 29 + #include "../inc/dmub_cmd.h" 30 30 31 31 struct dmub_srv; 32 32
+1 -1
drivers/gpu/drm/amd/display/dmub/src/dmub_reg.h
··· 26 26 #ifndef _DMUB_REG_H_ 27 27 #define _DMUB_REG_H_ 28 28 29 - #include "../inc/dmub_types.h" 29 + #include "../inc/dmub_cmd.h" 30 30 31 31 struct dmub_srv; 32 32
+1 -1
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
··· 26 26 #include "../dmub_srv.h" 27 27 #include "dmub_dcn20.h" 28 28 #include "dmub_dcn21.h" 29 - #include "dmub_fw_meta.h" 29 + #include "dmub_cmd.h" 30 30 #include "os_types.h" 31 31 /* 32 32 * Note: the DMUB service is standalone. No additional headers should be
+1 -1
drivers/gpu/drm/amd/display/modules/power/power_helpers.c
··· 27 27 #include "dc/inc/hw/abm.h" 28 28 #include "dc.h" 29 29 #include "core_types.h" 30 - #include "dmub_cmd_dal.h" 30 + #include "dmub_cmd.h" 31 31 32 32 #define DIV_ROUNDUP(a, b) (((a)+((b)/2))/(b)) 33 33 #define bswap16_based_on_endian(big_endian, value) \