drm/amd/display: Fix manual trigger source for DCN2
[linux-block.git] / drivers / gpu / drm / amd / display / dc / dc_types.h
CommitLineData
4562236b
HW
1/*
2 * Copyright 2012-15 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 DC_TYPES_H_
26#define DC_TYPES_H_
27
0417df16
BZ
28/* AND EdidUtility only needs a portion
29 * of this file, including the rest only
30 * causes additional issues.
31 */
eb0e5154 32#include "os_types.h"
4562236b
HW
33#include "fixed31_32.h"
34#include "irq_types.h"
35#include "dc_dp_types.h"
36#include "dc_hw_types.h"
37#include "dal_types.h"
9f72f51d 38#include "grph_object_defs.h"
4562236b 39
d462fcf5
BL
40#ifdef CONFIG_DRM_AMD_DC_HDCP
41#include "dm_cp_psp.h"
42#endif
43
4562236b 44/* forward declarations */
c9614aeb 45struct dc_plane_state;
0971c40e 46struct dc_stream_state;
4562236b
HW
47struct dc_link;
48struct dc_sink;
49struct dal;
3a1627b0 50struct dc_dmub_srv;
4562236b
HW
51
52/********************************
53 * Environment definitions
54 ********************************/
55enum dce_environment {
56 DCE_ENV_PRODUCTION_DRV = 0,
57 /* Emulation on FPGA, in "Maximus" System.
58 * This environment enforces that *only* DC registers accessed.
59 * (access to non-DC registers will hang FPGA) */
60 DCE_ENV_FPGA_MAXIMUS,
61 /* Emulation on real HW or on FPGA. Used by Diagnostics, enforces
62 * requirements of Diagnostics team. */
63 DCE_ENV_DIAG
64};
65
66/* Note: use these macro definitions instead of direct comparison! */
67#define IS_FPGA_MAXIMUS_DC(dce_environment) \
68 (dce_environment == DCE_ENV_FPGA_MAXIMUS)
69
70#define IS_DIAG_DC(dce_environment) \
71 (IS_FPGA_MAXIMUS_DC(dce_environment) || (dce_environment == DCE_ENV_DIAG))
72
73struct hw_asic_id {
74 uint32_t chip_id;
75 uint32_t chip_family;
76 uint32_t pci_revision_id;
77 uint32_t hw_internal_rev;
78 uint32_t vram_type;
79 uint32_t vram_width;
80 uint32_t feature_flags;
81 uint32_t fake_paths_num;
82 void *atombios_base_address;
83};
84
0cf5eb76
DF
85struct dc_perf_trace {
86 unsigned long read_count;
87 unsigned long write_count;
88 unsigned long last_entry_read;
89 unsigned long last_entry_write;
90};
91
4562236b
HW
92struct dc_context {
93 struct dc *dc;
94
95 void *driver_context; /* e.g. amdgpu_device */
0cf5eb76 96 struct dc_perf_trace *perf_trace;
4562236b
HW
97 void *cgs_device;
98
99 enum dce_environment dce_environment;
100 struct hw_asic_id asic_id;
101
102 /* todo: below should probably move to dc. to facilitate removal
103 * of AS we will store these here
104 */
105 enum dce_version dce_version;
106 struct dc_bios *dc_bios;
107 bool created_bios;
108 struct gpio_service *gpio_service;
ce3f6e82 109 uint32_t dc_sink_id_count;
04a789be 110 uint32_t dc_stream_id_count;
690b5e39 111 uint64_t fbc_gpu_addr;
3a1627b0 112 struct dc_dmub_srv *dmub_srv;
2200eb9e 113
d462fcf5
BL
114#ifdef CONFIG_DRM_AMD_DC_HDCP
115 struct cp_psp cp_psp;
116#endif
4562236b
HW
117};
118
119
f38e720a 120#define DC_MAX_EDID_BUFFER_SIZE 1024
a634913e 121#define DC_EDID_BLOCK_SIZE 128
ba326a91 122#define MAX_SURFACE_NUM 4
4562236b 123#define NUM_PIXEL_FORMATS 10
8e5100a5 124#define MAX_REPEATER_CNT 8
4562236b
HW
125
126#include "dc_ddc_types.h"
127
128enum tiling_mode {
129 TILING_MODE_INVALID,
130 TILING_MODE_LINEAR,
131 TILING_MODE_TILED,
132 TILING_MODE_COUNT
133};
134
135enum view_3d_format {
136 VIEW_3D_FORMAT_NONE = 0,
137 VIEW_3D_FORMAT_FRAME_SEQUENTIAL,
138 VIEW_3D_FORMAT_SIDE_BY_SIDE,
139 VIEW_3D_FORMAT_TOP_AND_BOTTOM,
140 VIEW_3D_FORMAT_COUNT,
141 VIEW_3D_FORMAT_FIRST = VIEW_3D_FORMAT_FRAME_SEQUENTIAL
142};
143
144enum plane_stereo_format {
145 PLANE_STEREO_FORMAT_NONE = 0,
146 PLANE_STEREO_FORMAT_SIDE_BY_SIDE = 1,
147 PLANE_STEREO_FORMAT_TOP_AND_BOTTOM = 2,
148 PLANE_STEREO_FORMAT_FRAME_ALTERNATE = 3,
149 PLANE_STEREO_FORMAT_ROW_INTERLEAVED = 5,
150 PLANE_STEREO_FORMAT_COLUMN_INTERLEAVED = 6,
151 PLANE_STEREO_FORMAT_CHECKER_BOARD = 7
152};
153
154/* TODO: Find way to calculate number of bits
155 * Please increase if pixel_format enum increases
156 * num from PIXEL_FORMAT_INDEX8 to PIXEL_FORMAT_444BPP32
157 */
158
159enum dc_edid_connector_type {
8de94233
RA
160 DC_EDID_CONNECTOR_UNKNOWN = 0,
161 DC_EDID_CONNECTOR_ANALOG = 1,
162 DC_EDID_CONNECTOR_DIGITAL = 10,
163 DC_EDID_CONNECTOR_DVI = 11,
164 DC_EDID_CONNECTOR_HDMIA = 12,
165 DC_EDID_CONNECTOR_MDDI = 14,
166 DC_EDID_CONNECTOR_DISPLAYPORT = 15
4562236b
HW
167};
168
169enum dc_edid_status {
170 EDID_OK,
171 EDID_BAD_INPUT,
172 EDID_NO_RESPONSE,
173 EDID_BAD_CHECKSUM,
7d58e721 174 EDID_THE_SAME,
4562236b
HW
175};
176
48af9b91
AL
177enum act_return_status {
178 ACT_SUCCESS,
179 ACT_LINK_LOST,
180 ACT_FAILED
181};
182
4562236b
HW
183/* audio capability from EDID*/
184struct dc_cea_audio_mode {
185 uint8_t format_code; /* ucData[0] [6:3]*/
186 uint8_t channel_count; /* ucData[0] [2:0]*/
187 uint8_t sample_rate; /* ucData[1]*/
188 union {
189 uint8_t sample_size; /* for LPCM*/
190 /* for Audio Formats 2-8 (Max bit rate divided by 8 kHz)*/
191 uint8_t max_bit_rate;
192 uint8_t audio_codec_vendor_specific; /* for Audio Formats 9-15*/
193 };
194};
195
196struct dc_edid {
197 uint32_t length;
8de94233 198 uint8_t raw_edid[DC_MAX_EDID_BUFFER_SIZE];
4562236b
HW
199};
200
201/* When speaker location data block is not available, DEFAULT_SPEAKER_LOCATION
202 * is used. In this case we assume speaker location are: front left, front
203 * right and front center. */
204#define DEFAULT_SPEAKER_LOCATION 5
205
206#define DC_MAX_AUDIO_DESC_COUNT 16
207
208#define AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS 20
209
50e27654
ZF
210union display_content_support {
211 unsigned int raw;
212 struct {
213 unsigned int valid_content_type :1;
214 unsigned int game_content :1;
215 unsigned int cinema_content :1;
216 unsigned int photo_content :1;
217 unsigned int graphics_content :1;
218 unsigned int reserved :27;
219 } bits;
220};
221
243c46c5 222struct dc_panel_patch {
b686ee20 223 unsigned int dppowerup_delay;
ff587987 224 unsigned int extra_t12_ms;
a4f1d2b8 225 unsigned int extra_delay_backlight_off;
88eac241 226 unsigned int extra_t7_ms;
243c46c5
JB
227};
228
4562236b
HW
229struct dc_edid_caps {
230 /* sink identification */
231 uint16_t manufacturer_id;
232 uint16_t product_id;
233 uint32_t serial_number;
234 uint8_t manufacture_week;
235 uint8_t manufacture_year;
236 uint8_t display_name[AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS];
237
238 /* audio caps */
239 uint8_t speaker_flags;
240 uint32_t audio_mode_count;
241 struct dc_cea_audio_mode audio_modes[DC_MAX_AUDIO_DESC_COUNT];
242 uint32_t audio_latency;
243 uint32_t video_latency;
244
50e27654
ZF
245 union display_content_support content_support;
246
247 uint8_t qs_bit;
248 uint8_t qy_bit;
249
4562236b
HW
250 /*HDMI 2.0 caps*/
251 bool lte_340mcsc_scramble;
252
253 bool edid_hdmi;
506ab334 254 bool hdr_supported;
243c46c5
JB
255
256 struct dc_panel_patch panel_patch;
4562236b
HW
257};
258
259struct view {
260 uint32_t width;
261 uint32_t height;
262};
263
264struct dc_mode_flags {
265 /* note: part of refresh rate flag*/
266 uint32_t INTERLACE :1;
267 /* native display timing*/
268 uint32_t NATIVE :1;
269 /* preferred is the recommended mode, one per display */
270 uint32_t PREFERRED :1;
271 /* true if this mode should use reduced blanking timings
272 *_not_ related to the Reduced Blanking adjustment*/
273 uint32_t REDUCED_BLANKING :1;
274 /* note: part of refreshrate flag*/
275 uint32_t VIDEO_OPTIMIZED_RATE :1;
276 /* should be reported to upper layers as mode_flags*/
277 uint32_t PACKED_PIXEL_FORMAT :1;
278 /*< preferred view*/
279 uint32_t PREFERRED_VIEW :1;
280 /* this timing should be used only in tiled mode*/
281 uint32_t TILED_MODE :1;
282 uint32_t DSE_MODE :1;
283 /* Refresh rate divider when Miracast sink is using a
284 different rate than the output display device
285 Must be zero for wired displays and non-zero for
286 Miracast displays*/
287 uint32_t MIRACAST_REFRESH_DIVIDER;
288};
289
290
291enum dc_timing_source {
292 TIMING_SOURCE_UNDEFINED,
293
294 /* explicitly specifed by user, most important*/
295 TIMING_SOURCE_USER_FORCED,
296 TIMING_SOURCE_USER_OVERRIDE,
297 TIMING_SOURCE_CUSTOM,
298 TIMING_SOURCE_EXPLICIT,
299
300 /* explicitly specified by the display device, more important*/
301 TIMING_SOURCE_EDID_CEA_SVD_3D,
302 TIMING_SOURCE_EDID_CEA_SVD_PREFERRED,
303 TIMING_SOURCE_EDID_CEA_SVD_420,
304 TIMING_SOURCE_EDID_DETAILED,
305 TIMING_SOURCE_EDID_ESTABLISHED,
306 TIMING_SOURCE_EDID_STANDARD,
307 TIMING_SOURCE_EDID_CEA_SVD,
308 TIMING_SOURCE_EDID_CVT_3BYTE,
309 TIMING_SOURCE_EDID_4BYTE,
310 TIMING_SOURCE_VBIOS,
311 TIMING_SOURCE_CV,
312 TIMING_SOURCE_TV,
313 TIMING_SOURCE_HDMI_VIC,
314
315 /* implicitly specified by display device, still safe but less important*/
316 TIMING_SOURCE_DEFAULT,
317
318 /* only used for custom base modes */
319 TIMING_SOURCE_CUSTOM_BASE,
320
321 /* these timing might not work, least important*/
322 TIMING_SOURCE_RANGELIMIT,
323 TIMING_SOURCE_OS_FORCED,
324 TIMING_SOURCE_IMPLICIT,
325
326 /* only used by default mode list*/
327 TIMING_SOURCE_BASICMODE,
328
329 TIMING_SOURCE_COUNT
330};
331
b6d6103b
VP
332
333struct stereo_3d_features {
334 bool supported ;
335 bool allTimings ;
336 bool cloneMode ;
337 bool scaling ;
338 bool singleFrameSWPacked;
339};
340
4562236b
HW
341enum dc_timing_support_method {
342 TIMING_SUPPORT_METHOD_UNDEFINED,
343 TIMING_SUPPORT_METHOD_EXPLICIT,
344 TIMING_SUPPORT_METHOD_IMPLICIT,
345 TIMING_SUPPORT_METHOD_NATIVE
346};
347
348struct dc_mode_info {
349 uint32_t pixel_width;
350 uint32_t pixel_height;
351 uint32_t field_rate;
352 /* Vertical refresh rate for progressive modes.
353 * Field rate for interlaced modes.*/
354
355 enum dc_timing_standard timing_standard;
356 enum dc_timing_source timing_source;
357 struct dc_mode_flags flags;
358};
359
360enum dc_power_state {
361 DC_POWER_STATE_ON = 1,
362 DC_POWER_STATE_STANDBY,
363 DC_POWER_STATE_SUSPEND,
364 DC_POWER_STATE_OFF
365};
366
367/* DC PowerStates */
368enum dc_video_power_state {
369 DC_VIDEO_POWER_UNSPECIFIED = 0,
370 DC_VIDEO_POWER_ON = 1,
371 DC_VIDEO_POWER_STANDBY,
372 DC_VIDEO_POWER_SUSPEND,
373 DC_VIDEO_POWER_OFF,
374 DC_VIDEO_POWER_HIBERNATE,
375 DC_VIDEO_POWER_SHUTDOWN,
376 DC_VIDEO_POWER_ULPS, /* BACO or Ultra-Light-Power-State */
377 DC_VIDEO_POWER_AFTER_RESET,
378 DC_VIDEO_POWER_MAXIMUM
379};
380
381enum dc_acpi_cm_power_state {
382 DC_ACPI_CM_POWER_STATE_D0 = 1,
383 DC_ACPI_CM_POWER_STATE_D1 = 2,
384 DC_ACPI_CM_POWER_STATE_D2 = 4,
385 DC_ACPI_CM_POWER_STATE_D3 = 8
386};
387
388enum dc_connection_type {
389 dc_connection_none,
390 dc_connection_single,
391 dc_connection_mst_branch,
392 dc_connection_active_dongle
393};
394
395struct dc_csc_adjustments {
396 struct fixed31_32 contrast;
397 struct fixed31_32 saturation;
398 struct fixed31_32 brightness;
399 struct fixed31_32 hue;
400};
401
03f5c686
CL
402enum dpcd_downstream_port_max_bpc {
403 DOWN_STREAM_MAX_8BPC = 0,
404 DOWN_STREAM_MAX_10BPC,
405 DOWN_STREAM_MAX_12BPC,
406 DOWN_STREAM_MAX_16BPC
407};
8e5100a5 408
409
410enum link_training_offset {
411 DPRX = 0,
412 LTTPR_PHY_REPEATER1 = 1,
413 LTTPR_PHY_REPEATER2 = 2,
414 LTTPR_PHY_REPEATER3 = 3,
415 LTTPR_PHY_REPEATER4 = 4,
416 LTTPR_PHY_REPEATER5 = 5,
417 LTTPR_PHY_REPEATER6 = 6,
418 LTTPR_PHY_REPEATER7 = 7,
419 LTTPR_PHY_REPEATER8 = 8
420};
421
8e5100a5 422struct dc_lttpr_caps {
61aa7a6f 423 union dpcd_rev revision;
424 uint8_t mode;
8e5100a5 425 uint8_t max_lane_count;
426 uint8_t max_link_rate;
427 uint8_t phy_repeater_cnt;
428 uint8_t max_ext_timeout;
429 uint8_t aux_rd_interval[MAX_REPEATER_CNT - 1];
430};
431
03f5c686
CL
432struct dc_dongle_caps {
433 /* dongle type (DP converter, CV smart dongle) */
434 enum display_dongle_type dongle_type;
435 bool extendedCapValid;
436 /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
437 indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
438 bool is_dp_hdmi_s3d_converter;
439 bool is_dp_hdmi_ycbcr422_pass_through;
440 bool is_dp_hdmi_ycbcr420_pass_through;
441 bool is_dp_hdmi_ycbcr422_converter;
442 bool is_dp_hdmi_ycbcr420_converter;
443 uint32_t dp_hdmi_max_bpc;
e5490464 444 uint32_t dp_hdmi_max_pixel_clk_in_khz;
03f5c686 445};
4562236b
HW
446/* Scaling format */
447enum scaling_transformation {
448 SCALING_TRANSFORMATION_UNINITIALIZED,
449 SCALING_TRANSFORMATION_IDENTITY = 0x0001,
450 SCALING_TRANSFORMATION_CENTER_TIMING = 0x0002,
451 SCALING_TRANSFORMATION_FULL_SCREEN_SCALE = 0x0004,
452 SCALING_TRANSFORMATION_PRESERVE_ASPECT_RATIO_SCALE = 0x0008,
453 SCALING_TRANSFORMATION_DAL_DECIDE = 0x0010,
454 SCALING_TRANSFORMATION_INVALID = 0x80000000,
455
456 /* Flag the first and last */
457 SCALING_TRANSFORMATION_BEGING = SCALING_TRANSFORMATION_IDENTITY,
458 SCALING_TRANSFORMATION_END =
459 SCALING_TRANSFORMATION_PRESERVE_ASPECT_RATIO_SCALE
460};
461
50e27654
ZF
462enum display_content_type {
463 DISPLAY_CONTENT_TYPE_NO_DATA = 0,
464 DISPLAY_CONTENT_TYPE_GRAPHICS = 1,
465 DISPLAY_CONTENT_TYPE_PHOTO = 2,
466 DISPLAY_CONTENT_TYPE_CINEMA = 4,
467 DISPLAY_CONTENT_TYPE_GAME = 8
468};
469
345429a6 470/* writeback */
9796b713
TD
471struct dwb_stereo_params {
472 bool stereo_enabled; /* false: normal mode, true: 3D stereo */
473 enum dwb_stereo_type stereo_type; /* indicates stereo format */
474 bool stereo_polarity; /* indicates left eye or right eye comes first in stereo mode */
475 enum dwb_stereo_eye_select stereo_eye_select; /* indicate which eye should be captured */
476};
477
345429a6
HW
478struct dc_dwb_cnv_params {
479 unsigned int src_width; /* input active width */
480 unsigned int src_height; /* input active height (half-active height in interlaced mode) */
481 unsigned int crop_width; /* cropped window width at cnv output */
482 bool crop_en; /* window cropping enable in cnv */
483 unsigned int crop_height; /* cropped window height at cnv output */
484 unsigned int crop_x; /* cropped window start x value at cnv output */
485 unsigned int crop_y; /* cropped window start y value at cnv output */
486 enum dwb_cnv_out_bpc cnv_out_bpc; /* cnv output pixel depth - 8bpc or 10bpc */
487};
488
489struct dc_dwb_params {
490 struct dc_dwb_cnv_params cnv_params; /* CNV source size and cropping window parameters */
491 unsigned int dest_width; /* Destination width */
492 unsigned int dest_height; /* Destination height */
493 enum dwb_scaler_mode out_format; /* default = YUV420 - TODO: limit this to 0 and 1 on dcn3 */
494 enum dwb_output_depth output_depth; /* output pixel depth - 8bpc or 10bpc */
495 enum dwb_capture_rate capture_rate; /* controls the frame capture rate */
496 struct scaling_taps scaler_taps; /* Scaling taps */
497 enum dwb_subsample_position subsample_position;
498 struct dc_transfer_func *out_transfer_func;
499};
345429a6 500
4562236b
HW
501/* audio*/
502
503union audio_sample_rates {
504 struct sample_rates {
505 uint8_t RATE_32:1;
506 uint8_t RATE_44_1:1;
507 uint8_t RATE_48:1;
508 uint8_t RATE_88_2:1;
509 uint8_t RATE_96:1;
510 uint8_t RATE_176_4:1;
511 uint8_t RATE_192:1;
512 } rate;
513
514 uint8_t all;
515};
516
517struct audio_speaker_flags {
5667ff5c
DA
518 uint32_t FL_FR:1;
519 uint32_t LFE:1;
520 uint32_t FC:1;
521 uint32_t RL_RR:1;
522 uint32_t RC:1;
523 uint32_t FLC_FRC:1;
524 uint32_t RLC_RRC:1;
525 uint32_t SUPPORT_AI:1;
4562236b
HW
526};
527
528struct audio_speaker_info {
529 uint32_t ALLSPEAKERS:7;
530 uint32_t SUPPORT_AI:1;
531};
532
533
534struct audio_info_flags {
535
536 union {
537
538 struct audio_speaker_flags speaker_flags;
539 struct audio_speaker_info info;
540
541 uint8_t all;
542 };
543};
544
545enum audio_format_code {
546 AUDIO_FORMAT_CODE_FIRST = 1,
547 AUDIO_FORMAT_CODE_LINEARPCM = AUDIO_FORMAT_CODE_FIRST,
548
549 AUDIO_FORMAT_CODE_AC3,
550 /*Layers 1 & 2 */
551 AUDIO_FORMAT_CODE_MPEG1,
552 /*MPEG1 Layer 3 */
553 AUDIO_FORMAT_CODE_MP3,
554 /*multichannel */
555 AUDIO_FORMAT_CODE_MPEG2,
556 AUDIO_FORMAT_CODE_AAC,
557 AUDIO_FORMAT_CODE_DTS,
558 AUDIO_FORMAT_CODE_ATRAC,
559 AUDIO_FORMAT_CODE_1BITAUDIO,
560 AUDIO_FORMAT_CODE_DOLBYDIGITALPLUS,
561 AUDIO_FORMAT_CODE_DTS_HD,
562 AUDIO_FORMAT_CODE_MAT_MLP,
563 AUDIO_FORMAT_CODE_DST,
564 AUDIO_FORMAT_CODE_WMAPRO,
565 AUDIO_FORMAT_CODE_LAST,
566 AUDIO_FORMAT_CODE_COUNT =
567 AUDIO_FORMAT_CODE_LAST - AUDIO_FORMAT_CODE_FIRST
568};
569
570struct audio_mode {
571 /* ucData[0] [6:3] */
572 enum audio_format_code format_code;
573 /* ucData[0] [2:0] */
574 uint8_t channel_count;
575 /* ucData[1] */
576 union audio_sample_rates sample_rates;
577 union {
578 /* for LPCM */
579 uint8_t sample_size;
580 /* for Audio Formats 2-8 (Max bit rate divided by 8 kHz) */
581 uint8_t max_bit_rate;
582 /* for Audio Formats 9-15 */
583 uint8_t vendor_specific;
584 };
585};
586
587struct audio_info {
588 struct audio_info_flags flags;
589 uint32_t video_latency;
590 uint32_t audio_latency;
591 uint32_t display_index;
592 uint8_t display_name[AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS];
593 uint32_t manufacture_id;
594 uint32_t product_id;
595 /* PortID used for ContainerID when defined */
596 uint32_t port_id[2];
597 uint32_t mode_count;
598 /* this field must be last in this struct */
599 struct audio_mode modes[DC_MAX_AUDIO_DESC_COUNT];
600};
3ab4cc65
CL
601struct audio_check {
602 unsigned int audio_packet_type;
603 unsigned int max_audiosample_rate;
604 unsigned int acat;
605};
98e6436d
AK
606enum dc_infoframe_type {
607 DC_HDMI_INFOFRAME_TYPE_VENDOR = 0x81,
608 DC_HDMI_INFOFRAME_TYPE_AVI = 0x82,
609 DC_HDMI_INFOFRAME_TYPE_SPD = 0x83,
610 DC_HDMI_INFOFRAME_TYPE_AUDIO = 0x84,
97bda032 611 DC_DP_INFOFRAME_TYPE_PPS = 0x10,
64ed6a2e
AK
612};
613
e09b6473
AK
614struct dc_info_packet {
615 bool valid;
616 uint8_t hb0;
617 uint8_t hb1;
618 uint8_t hb2;
619 uint8_t hb3;
620 uint8_t sb[32];
621};
622
f82c916c
CL
623struct dc_info_packet_128 {
624 bool valid;
625 uint8_t hb0;
626 uint8_t hb1;
627 uint8_t hb2;
628 uint8_t hb3;
629 uint8_t sb[128];
630};
a6132cb1 631
64ed6a2e
AK
632#define DC_PLANE_UPDATE_TIMES_MAX 10
633
634struct dc_plane_flip_time {
635 unsigned int time_elapsed_in_us[DC_PLANE_UPDATE_TIMES_MAX];
636 unsigned int index;
637 unsigned int prev_update_time_in_us;
638};
639
94267b3d
ST
640struct psr_config {
641 unsigned char psr_version;
642 unsigned int psr_rfb_setup_time;
643 bool psr_exit_link_training_required;
94267b3d
ST
644 bool psr_frame_capture_indication_req;
645 unsigned int psr_sdp_transmit_line_num_deadline;
5d87a3fd 646 bool allow_smu_optimizations;
94267b3d
ST
647};
648
9f72f51d
AZ
649union dmcu_psr_level {
650 struct {
651 unsigned int SKIP_CRC:1;
652 unsigned int SKIP_DP_VID_STREAM_DISABLE:1;
653 unsigned int SKIP_PHY_POWER_DOWN:1;
654 unsigned int SKIP_AUX_ACK_CHECK:1;
655 unsigned int SKIP_CRTC_DISABLE:1;
656 unsigned int SKIP_AUX_RFB_CAPTURE_CHECK:1;
657 unsigned int SKIP_SMU_NOTIFICATION:1;
658 unsigned int SKIP_AUTO_STATE_ADVANCE:1;
659 unsigned int DISABLE_PSR_ENTRY_ABORT:1;
ee356d8f
CL
660 unsigned int SKIP_SINGLE_OTG_DISABLE:1;
661 unsigned int RESERVED:22;
9f72f51d
AZ
662 } bits;
663 unsigned int u32all;
664};
665
666enum physical_phy_id {
667 PHYLD_0,
668 PHYLD_1,
669 PHYLD_2,
670 PHYLD_3,
671 PHYLD_4,
672 PHYLD_5,
673 PHYLD_6,
674 PHYLD_7,
675 PHYLD_8,
676 PHYLD_9,
677 PHYLD_COUNT,
678 PHYLD_UNKNOWN = (-1L)
679};
680
681enum phy_type {
682 PHY_TYPE_UNKNOWN = 1,
683 PHY_TYPE_PCIE_PHY = 2,
684 PHY_TYPE_UNIPHY = 3,
685};
686
687struct psr_context {
688 /* ddc line */
689 enum channel_id channel;
690 /* Transmitter id */
691 enum transmitter transmitterId;
692 /* Engine Id is used for Dig Be source select */
693 enum engine_id engineId;
694 /* Controller Id used for Dig Fe source select */
695 enum controller_id controllerId;
696 /* Pcie or Uniphy */
697 enum phy_type phyType;
698 /* Physical PHY Id used by SMU interpretation */
699 enum physical_phy_id smuPhyId;
700 /* Vertical total pixels from crtc timing.
701 * This is used for static screen detection.
702 * ie. If we want to detect half a frame,
703 * we use this to determine the hyst lines.
704 */
705 unsigned int crtcTimingVerticalTotal;
706 /* PSR supported from panel capabilities and
707 * current display configuration
708 */
709 bool psrSupportedDisplayConfig;
710 /* Whether fast link training is supported by the panel */
711 bool psrExitLinkTrainingRequired;
712 /* If RFB setup time is greater than the total VBLANK time,
713 * it is not possible for the sink to capture the video frame
714 * in the same frame the SDP is sent. In this case,
715 * the frame capture indication bit should be set and an extra
716 * static frame should be transmitted to the sink.
717 */
718 bool psrFrameCaptureIndicationReq;
719 /* Set the last possible line SDP may be transmitted without violating
720 * the RFB setup time or entering the active video frame.
721 */
722 unsigned int sdpTransmitLineNumDeadline;
723 /* The VSync rate in Hz used to calculate the
724 * step size for smooth brightness feature
725 */
726 unsigned int vsyncRateHz;
727 unsigned int skipPsrWaitForPllLock;
728 unsigned int numberOfControllers;
729 /* Unused, for future use. To indicate that first changed frame from
730 * state3 shouldn't result in psr_inactive, but rather to perform
731 * an automatic single frame rfb_update.
732 */
733 bool rfb_update_auto_en;
734 /* Number of frame before entering static screen */
735 unsigned int timehyst_frames;
736 /* Partial frames before entering static screen */
737 unsigned int hyst_lines;
738 /* # of repeated AUX transaction attempts to make before
739 * indicating failure to the driver
740 */
741 unsigned int aux_repeats;
742 /* Controls hw blocks to power down during PSR active state */
743 union dmcu_psr_level psr_level;
744 /* Controls additional delay after remote frame capture before
745 * continuing powerd own
746 */
747 unsigned int frame_delay;
5d87a3fd 748 bool allow_smu_optimizations;
9f72f51d
AZ
749};
750
4562236b
HW
751struct colorspace_transform {
752 struct fixed31_32 matrix[12];
753 bool enable_remap;
754};
755
7c7f5b15
AG
756enum i2c_mot_mode {
757 I2C_MOT_UNDEF,
758 I2C_MOT_TRUE,
759 I2C_MOT_FALSE
760};
761
8ab2180f
EB
762struct AsicStateEx {
763 unsigned int memoryClock;
764 unsigned int displayClock;
765 unsigned int engineClock;
766 unsigned int maxSupportedDppClock;
767 unsigned int dppClock;
768 unsigned int socClock;
769 unsigned int dcfClockDeepSleep;
770 unsigned int fClock;
771 unsigned int phyClock;
772};
773
925f566c
CL
774
775enum dc_clock_type {
776 DC_CLOCK_TYPE_DISPCLK = 0,
777 DC_CLOCK_TYPE_DPPCLK = 1,
778};
779
780struct dc_clock_config {
781 uint32_t max_clock_khz;
782 uint32_t min_clock_khz;
783 uint32_t bw_requirequired_clock_khz;
784 uint32_t current_clock_khz;/*current clock in use*/
785};
786
97bda032
HW
787/* DSC DPCD capabilities */
788union dsc_slice_caps1 {
789 struct {
790 uint8_t NUM_SLICES_1 : 1;
791 uint8_t NUM_SLICES_2 : 1;
792 uint8_t RESERVED : 1;
793 uint8_t NUM_SLICES_4 : 1;
794 uint8_t NUM_SLICES_6 : 1;
795 uint8_t NUM_SLICES_8 : 1;
796 uint8_t NUM_SLICES_10 : 1;
797 uint8_t NUM_SLICES_12 : 1;
798 } bits;
799 uint8_t raw;
800};
801
802union dsc_slice_caps2 {
803 struct {
804 uint8_t NUM_SLICES_16 : 1;
805 uint8_t NUM_SLICES_20 : 1;
806 uint8_t NUM_SLICES_24 : 1;
807 uint8_t RESERVED : 5;
808 } bits;
809 uint8_t raw;
810};
811
812union dsc_color_formats {
813 struct {
814 uint8_t RGB : 1;
815 uint8_t YCBCR_444 : 1;
816 uint8_t YCBCR_SIMPLE_422 : 1;
817 uint8_t YCBCR_NATIVE_422 : 1;
818 uint8_t YCBCR_NATIVE_420 : 1;
819 uint8_t RESERVED : 3;
820 } bits;
821 uint8_t raw;
822};
823
824union dsc_color_depth {
825 struct {
826 uint8_t RESERVED1 : 1;
827 uint8_t COLOR_DEPTH_8_BPC : 1;
828 uint8_t COLOR_DEPTH_10_BPC : 1;
829 uint8_t COLOR_DEPTH_12_BPC : 1;
830 uint8_t RESERVED2 : 3;
831 } bits;
832 uint8_t raw;
833};
834
835struct dsc_dec_dpcd_caps {
836 bool is_dsc_supported;
837 uint8_t dsc_version;
838 int32_t rc_buffer_size; /* DSC RC buffer block size in bytes */
839 union dsc_slice_caps1 slice_caps1;
840 union dsc_slice_caps2 slice_caps2;
841 int32_t lb_bit_depth;
842 bool is_block_pred_supported;
843 int32_t edp_max_bits_per_pixel; /* Valid only in eDP */
844 union dsc_color_formats color_formats;
845 union dsc_color_depth color_depth;
846 int32_t throughput_mode_0_mps; /* In MPs */
847 int32_t throughput_mode_1_mps; /* In MPs */
848 int32_t max_slice_width;
849 uint32_t bpp_increment_div; /* bpp increment divisor, e.g. if 16, it's 1/16th of a bit */
f446489a
NC
850
851 /* Extended DSC caps */
852 uint32_t branch_overall_throughput_0_mps; /* In MPs */
853 uint32_t branch_overall_throughput_1_mps; /* In MPs */
854 uint32_t branch_max_line_width;
97bda032 855};
0417df16 856
4562236b 857#endif /* DC_TYPES_H_ */