1c349dbc7Sjsg /*
2c349dbc7Sjsg * Copyright 2019 Advanced Micro Devices, Inc.
3c349dbc7Sjsg *
4c349dbc7Sjsg * Permission is hereby granted, free of charge, to any person obtaining a
5c349dbc7Sjsg * copy of this software and associated documentation files (the "Software"),
6c349dbc7Sjsg * to deal in the Software without restriction, including without limitation
7c349dbc7Sjsg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8c349dbc7Sjsg * and/or sell copies of the Software, and to permit persons to whom the
9c349dbc7Sjsg * Software is furnished to do so, subject to the following conditions:
10c349dbc7Sjsg *
11c349dbc7Sjsg * The above copyright notice and this permission notice shall be included in
12c349dbc7Sjsg * all copies or substantial portions of the Software.
13c349dbc7Sjsg *
14c349dbc7Sjsg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15c349dbc7Sjsg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16c349dbc7Sjsg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17c349dbc7Sjsg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18c349dbc7Sjsg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19c349dbc7Sjsg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20c349dbc7Sjsg * OTHER DEALINGS IN THE SOFTWARE.
21c349dbc7Sjsg *
22c349dbc7Sjsg * Authors: AMD
23c349dbc7Sjsg *
24c349dbc7Sjsg */
25c349dbc7Sjsg
265ca02815Sjsg #ifndef DMUB_CMD_H
275ca02815Sjsg #define DMUB_CMD_H
285ca02815Sjsg
295ca02815Sjsg #if defined(_TEST_HARNESS) || defined(FPGA_USB4)
305ca02815Sjsg #include "dmub_fw_types.h"
315ca02815Sjsg #include "include_legacy/atomfirmware.h"
325ca02815Sjsg
335ca02815Sjsg #if defined(_TEST_HARNESS)
345ca02815Sjsg #include <string.h>
355ca02815Sjsg #endif
365ca02815Sjsg #else
37c349dbc7Sjsg
38ad8b1aafSjsg #include <asm/byteorder.h>
39ad8b1aafSjsg #include <linux/types.h>
40ad8b1aafSjsg #include <linux/string.h>
41ad8b1aafSjsg #include <linux/delay.h>
42ad8b1aafSjsg
43c349dbc7Sjsg #include "atomfirmware.h"
44c349dbc7Sjsg
455ca02815Sjsg #endif // defined(_TEST_HARNESS) || defined(FPGA_USB4)
465ca02815Sjsg
47ad8b1aafSjsg //<DMUB_TYPES>==================================================================
48ad8b1aafSjsg /* Basic type definitions. */
49ad8b1aafSjsg
505ca02815Sjsg #define __forceinline inline
515ca02815Sjsg
525ca02815Sjsg /**
535ca02815Sjsg * Flag from driver to indicate that ABM should be disabled gradually
545ca02815Sjsg * by slowly reversing all backlight programming and pixel compensation.
555ca02815Sjsg */
56ad8b1aafSjsg #define SET_ABM_PIPE_GRADUALLY_DISABLE 0
575ca02815Sjsg
585ca02815Sjsg /**
595ca02815Sjsg * Flag from driver to indicate that ABM should be disabled immediately
605ca02815Sjsg * and undo all backlight programming and pixel compensation.
615ca02815Sjsg */
62ad8b1aafSjsg #define SET_ABM_PIPE_IMMEDIATELY_DISABLE 255
635ca02815Sjsg
645ca02815Sjsg /**
655ca02815Sjsg * Flag from driver to indicate that ABM should be disabled immediately
665ca02815Sjsg * and keep the current backlight programming and pixel compensation.
675ca02815Sjsg */
68ad8b1aafSjsg #define SET_ABM_PIPE_IMMEDIATE_KEEP_GAIN_DISABLE 254
695ca02815Sjsg
705ca02815Sjsg /**
715ca02815Sjsg * Flag from driver to set the current ABM pipe index or ABM operating level.
725ca02815Sjsg */
73ad8b1aafSjsg #define SET_ABM_PIPE_NORMAL 1
74ad8b1aafSjsg
755ca02815Sjsg /**
765ca02815Sjsg * Number of ambient light levels in ABM algorithm.
775ca02815Sjsg */
785ca02815Sjsg #define NUM_AMBI_LEVEL 5
795ca02815Sjsg
805ca02815Sjsg /**
815ca02815Sjsg * Number of operating/aggression levels in ABM algorithm.
825ca02815Sjsg */
835ca02815Sjsg #define NUM_AGGR_LEVEL 4
845ca02815Sjsg
855ca02815Sjsg /**
865ca02815Sjsg * Number of segments in the gamma curve.
875ca02815Sjsg */
885ca02815Sjsg #define NUM_POWER_FN_SEGS 8
895ca02815Sjsg
905ca02815Sjsg /**
915ca02815Sjsg * Number of segments in the backlight curve.
925ca02815Sjsg */
935ca02815Sjsg #define NUM_BL_CURVE_SEGS 16
945ca02815Sjsg
951bb76ff1Sjsg /* Maximum number of SubVP streams */
961bb76ff1Sjsg #define DMUB_MAX_SUBVP_STREAMS 2
971bb76ff1Sjsg
98f005ef32Sjsg /* Define max FPO streams as 4 for now. Current implementation today
99f005ef32Sjsg * only supports 1, but could be more in the future. Reduce array
100f005ef32Sjsg * size to ensure the command size remains less than 64 bytes if
101f005ef32Sjsg * adding new fields.
102f005ef32Sjsg */
103f005ef32Sjsg #define DMUB_MAX_FPO_STREAMS 4
104f005ef32Sjsg
105ad8b1aafSjsg /* Maximum number of streams on any ASIC. */
106ad8b1aafSjsg #define DMUB_MAX_STREAMS 6
107ad8b1aafSjsg
108ad8b1aafSjsg /* Maximum number of planes on any ASIC. */
109ad8b1aafSjsg #define DMUB_MAX_PLANES 6
110ad8b1aafSjsg
1115ca02815Sjsg /* Trace buffer offset for entry */
1125ca02815Sjsg #define TRACE_BUFFER_ENTRY_OFFSET 16
1135ca02815Sjsg
1145ca02815Sjsg /**
1151bb76ff1Sjsg * Maximum number of dirty rects supported by FW.
1161bb76ff1Sjsg */
1171bb76ff1Sjsg #define DMUB_MAX_DIRTY_RECTS 3
1181bb76ff1Sjsg
1191bb76ff1Sjsg /**
1205ca02815Sjsg *
1215ca02815Sjsg * PSR control version legacy
1225ca02815Sjsg */
1235ca02815Sjsg #define DMUB_CMD_PSR_CONTROL_VERSION_UNKNOWN 0x0
1245ca02815Sjsg /**
1255ca02815Sjsg * PSR control version with multi edp support
1265ca02815Sjsg */
1275ca02815Sjsg #define DMUB_CMD_PSR_CONTROL_VERSION_1 0x1
1285ca02815Sjsg
1295ca02815Sjsg
1305ca02815Sjsg /**
1315ca02815Sjsg * ABM control version legacy
1325ca02815Sjsg */
1335ca02815Sjsg #define DMUB_CMD_ABM_CONTROL_VERSION_UNKNOWN 0x0
1345ca02815Sjsg
1355ca02815Sjsg /**
1365ca02815Sjsg * ABM control version with multi edp support
1375ca02815Sjsg */
1385ca02815Sjsg #define DMUB_CMD_ABM_CONTROL_VERSION_1 0x1
1395ca02815Sjsg
1405ca02815Sjsg /**
1415ca02815Sjsg * Physical framebuffer address location, 64-bit.
1425ca02815Sjsg */
143ad8b1aafSjsg #ifndef PHYSICAL_ADDRESS_LOC
144ad8b1aafSjsg #define PHYSICAL_ADDRESS_LOC union large_integer
145ad8b1aafSjsg #endif
146ad8b1aafSjsg
1475ca02815Sjsg /**
1485ca02815Sjsg * OS/FW agnostic memcpy
1495ca02815Sjsg */
150ad8b1aafSjsg #ifndef dmub_memcpy
151ad8b1aafSjsg #define dmub_memcpy(dest, source, bytes) memcpy((dest), (source), (bytes))
152ad8b1aafSjsg #endif
153ad8b1aafSjsg
1545ca02815Sjsg /**
1555ca02815Sjsg * OS/FW agnostic memset
1565ca02815Sjsg */
157ad8b1aafSjsg #ifndef dmub_memset
158ad8b1aafSjsg #define dmub_memset(dest, val, bytes) memset((dest), (val), (bytes))
159ad8b1aafSjsg #endif
160ad8b1aafSjsg
161ad8b1aafSjsg #if defined(__cplusplus)
162ad8b1aafSjsg extern "C" {
163ad8b1aafSjsg #endif
164ad8b1aafSjsg
165f005ef32Sjsg #pragma pack(push, 1)
1665ca02815Sjsg /**
1675ca02815Sjsg * OS/FW agnostic udelay
1685ca02815Sjsg */
169ad8b1aafSjsg #ifndef dmub_udelay
170ad8b1aafSjsg #define dmub_udelay(microseconds) udelay(microseconds)
171ad8b1aafSjsg #endif
172ad8b1aafSjsg
17312139144Sjsg #pragma pack(push, 1)
174f005ef32Sjsg #define ABM_NUM_OF_ACE_SEGMENTS 5
175f005ef32Sjsg
176f005ef32Sjsg union abm_flags {
177f005ef32Sjsg struct {
178f005ef32Sjsg /**
179f005ef32Sjsg * @abm_enabled: Indicates if ABM is enabled.
180f005ef32Sjsg */
181f005ef32Sjsg unsigned int abm_enabled : 1;
182f005ef32Sjsg
183f005ef32Sjsg /**
184f005ef32Sjsg * @disable_abm_requested: Indicates if driver has requested ABM to be disabled.
185f005ef32Sjsg */
186f005ef32Sjsg unsigned int disable_abm_requested : 1;
187f005ef32Sjsg
188f005ef32Sjsg /**
189f005ef32Sjsg * @disable_abm_immediately: Indicates if driver has requested ABM to be disabled
190f005ef32Sjsg * immediately.
191f005ef32Sjsg */
192f005ef32Sjsg unsigned int disable_abm_immediately : 1;
193f005ef32Sjsg
194f005ef32Sjsg /**
195f005ef32Sjsg * @disable_abm_immediate_keep_gain: Indicates if driver has requested ABM
196f005ef32Sjsg * to be disabled immediately and keep gain.
197f005ef32Sjsg */
198f005ef32Sjsg unsigned int disable_abm_immediate_keep_gain : 1;
199f005ef32Sjsg
200f005ef32Sjsg /**
201f005ef32Sjsg * @fractional_pwm: Indicates if fractional duty cycle for backlight PWM is enabled.
202f005ef32Sjsg */
203f005ef32Sjsg unsigned int fractional_pwm : 1;
204f005ef32Sjsg
205f005ef32Sjsg /**
206f005ef32Sjsg * @abm_gradual_bl_change: Indicates if algorithm has completed gradual adjustment
207f005ef32Sjsg * of user backlight level.
208f005ef32Sjsg */
209f005ef32Sjsg unsigned int abm_gradual_bl_change : 1;
210f005ef32Sjsg } bitfields;
211f005ef32Sjsg
212f005ef32Sjsg unsigned int u32All;
213f005ef32Sjsg };
214f005ef32Sjsg #pragma pack(pop)
215f005ef32Sjsg
216f005ef32Sjsg struct abm_save_restore {
217f005ef32Sjsg /**
218f005ef32Sjsg * @flags: Misc. ABM flags.
219f005ef32Sjsg */
220f005ef32Sjsg union abm_flags flags;
221f005ef32Sjsg
222f005ef32Sjsg /**
223f005ef32Sjsg * @pause: true: pause ABM and get state
224f005ef32Sjsg * false: unpause ABM after setting state
225f005ef32Sjsg */
226f005ef32Sjsg uint32_t pause;
227f005ef32Sjsg
228f005ef32Sjsg /**
229f005ef32Sjsg * @next_ace_slope: Next ACE slopes to be programmed in HW (u3.13)
230f005ef32Sjsg */
231f005ef32Sjsg uint32_t next_ace_slope[ABM_NUM_OF_ACE_SEGMENTS];
232f005ef32Sjsg
233f005ef32Sjsg /**
234f005ef32Sjsg * @next_ace_thresh: Next ACE thresholds to be programmed in HW (u10.6)
235f005ef32Sjsg */
236f005ef32Sjsg uint32_t next_ace_thresh[ABM_NUM_OF_ACE_SEGMENTS];
237f005ef32Sjsg
238f005ef32Sjsg /**
239f005ef32Sjsg * @next_ace_offset: Next ACE offsets to be programmed in HW (u10.6)
240f005ef32Sjsg */
241f005ef32Sjsg uint32_t next_ace_offset[ABM_NUM_OF_ACE_SEGMENTS];
242f005ef32Sjsg
243f005ef32Sjsg
244f005ef32Sjsg /**
245f005ef32Sjsg * @knee_threshold: Current x-position of ACE knee (u0.16).
246f005ef32Sjsg */
247f005ef32Sjsg uint32_t knee_threshold;
248f005ef32Sjsg /**
249f005ef32Sjsg * @current_gain: Current backlight reduction (u16.16).
250f005ef32Sjsg */
251f005ef32Sjsg uint32_t current_gain;
252f005ef32Sjsg /**
253f005ef32Sjsg * @curr_bl_level: Current actual backlight level converging to target backlight level.
254f005ef32Sjsg */
255f005ef32Sjsg uint16_t curr_bl_level;
256f005ef32Sjsg
257f005ef32Sjsg /**
258f005ef32Sjsg * @curr_user_bl_level: Current nominal backlight level converging to level requested by user.
259f005ef32Sjsg */
260f005ef32Sjsg uint16_t curr_user_bl_level;
261f005ef32Sjsg
262f005ef32Sjsg };
263f005ef32Sjsg
2645ca02815Sjsg /**
2655ca02815Sjsg * union dmub_addr - DMUB physical/virtual 64-bit address.
2665ca02815Sjsg */
267ad8b1aafSjsg union dmub_addr {
268ad8b1aafSjsg struct {
2695ca02815Sjsg uint32_t low_part; /**< Lower 32 bits */
2705ca02815Sjsg uint32_t high_part; /**< Upper 32 bits */
2715ca02815Sjsg } u; /*<< Low/high bit access */
2725ca02815Sjsg uint64_t quad_part; /*<< 64 bit address */
273ad8b1aafSjsg };
27412139144Sjsg #pragma pack(pop)
275ad8b1aafSjsg
2765ca02815Sjsg /**
2771bb76ff1Sjsg * Dirty rect definition.
2781bb76ff1Sjsg */
2791bb76ff1Sjsg struct dmub_rect {
2801bb76ff1Sjsg /**
2811bb76ff1Sjsg * Dirty rect x offset.
2821bb76ff1Sjsg */
2831bb76ff1Sjsg uint32_t x;
2841bb76ff1Sjsg
2851bb76ff1Sjsg /**
2861bb76ff1Sjsg * Dirty rect y offset.
2871bb76ff1Sjsg */
2881bb76ff1Sjsg uint32_t y;
2891bb76ff1Sjsg
2901bb76ff1Sjsg /**
2911bb76ff1Sjsg * Dirty rect width.
2921bb76ff1Sjsg */
2931bb76ff1Sjsg uint32_t width;
2941bb76ff1Sjsg
2951bb76ff1Sjsg /**
2961bb76ff1Sjsg * Dirty rect height.
2971bb76ff1Sjsg */
2981bb76ff1Sjsg uint32_t height;
2991bb76ff1Sjsg };
3001bb76ff1Sjsg
3011bb76ff1Sjsg /**
3025ca02815Sjsg * Flags that can be set by driver to change some PSR behaviour.
3035ca02815Sjsg */
304ad8b1aafSjsg union dmub_psr_debug_flags {
3055ca02815Sjsg /**
3065ca02815Sjsg * Debug flags.
3075ca02815Sjsg */
308ad8b1aafSjsg struct {
3095ca02815Sjsg /**
3105ca02815Sjsg * Enable visual confirm in FW.
3115ca02815Sjsg */
312ad8b1aafSjsg uint32_t visual_confirm : 1;
3131bb76ff1Sjsg
3141bb76ff1Sjsg /**
3151bb76ff1Sjsg * Force all selective updates to bw full frame updates.
3161bb76ff1Sjsg */
3171bb76ff1Sjsg uint32_t force_full_frame_update : 1;
3181bb76ff1Sjsg
3195ca02815Sjsg /**
3205ca02815Sjsg * Use HW Lock Mgr object to do HW locking in FW.
3215ca02815Sjsg */
322ad8b1aafSjsg uint32_t use_hw_lock_mgr : 1;
3235ca02815Sjsg
3245ca02815Sjsg /**
3251bb76ff1Sjsg * Use TPS3 signal when restore main link.
3265ca02815Sjsg */
3271bb76ff1Sjsg uint32_t force_wakeup_by_tps3 : 1;
328f005ef32Sjsg
329f005ef32Sjsg /**
330f005ef32Sjsg * Back to back flip, therefore cannot power down PHY
331f005ef32Sjsg */
332f005ef32Sjsg uint32_t back_to_back_flip : 1;
333f005ef32Sjsg
334ad8b1aafSjsg } bitfields;
335ad8b1aafSjsg
3365ca02815Sjsg /**
3375ca02815Sjsg * Union for debug flags.
3385ca02815Sjsg */
339ad8b1aafSjsg uint32_t u32All;
340ad8b1aafSjsg };
341ad8b1aafSjsg
3425ca02815Sjsg /**
343f005ef32Sjsg * Flags that can be set by driver to change some Replay behaviour.
344f005ef32Sjsg */
345f005ef32Sjsg union replay_debug_flags {
346f005ef32Sjsg struct {
347f005ef32Sjsg /**
348f005ef32Sjsg * Enable visual confirm in FW.
349f005ef32Sjsg */
350f005ef32Sjsg uint32_t visual_confirm : 1;
351f005ef32Sjsg
352f005ef32Sjsg /**
353f005ef32Sjsg * @skip_crc: Set if need to skip CRC.
354f005ef32Sjsg */
355f005ef32Sjsg uint32_t skip_crc : 1;
356f005ef32Sjsg
357f005ef32Sjsg /**
358f005ef32Sjsg * @force_link_power_on: Force disable ALPM control
359f005ef32Sjsg */
360f005ef32Sjsg uint32_t force_link_power_on : 1;
361f005ef32Sjsg
362f005ef32Sjsg /**
363f005ef32Sjsg * @force_phy_power_on: Force phy power on
364f005ef32Sjsg */
365f005ef32Sjsg uint32_t force_phy_power_on : 1;
366f005ef32Sjsg
367f005ef32Sjsg /**
368f005ef32Sjsg * @timing_resync_disabled: Disabled Replay normal sleep mode timing resync
369f005ef32Sjsg */
370f005ef32Sjsg uint32_t timing_resync_disabled : 1;
371f005ef32Sjsg
372f005ef32Sjsg /**
373f005ef32Sjsg * @skip_crtc_disabled: CRTC disable skipped
374f005ef32Sjsg */
375f005ef32Sjsg uint32_t skip_crtc_disabled : 1;
376f005ef32Sjsg
377f005ef32Sjsg /**
378f005ef32Sjsg * @force_defer_one_frame_update: Force defer one frame update in ultra sleep mode
379f005ef32Sjsg */
380f005ef32Sjsg uint32_t force_defer_one_frame_update : 1;
381f005ef32Sjsg /**
382f005ef32Sjsg * @disable_delay_alpm_on: Force disable delay alpm on
383f005ef32Sjsg */
384f005ef32Sjsg uint32_t disable_delay_alpm_on : 1;
385f005ef32Sjsg /**
386f005ef32Sjsg * @disable_desync_error_check: Force disable desync error check
387f005ef32Sjsg */
388f005ef32Sjsg uint32_t disable_desync_error_check : 1;
389f005ef32Sjsg /**
390f005ef32Sjsg * @disable_desync_error_check: Force disable desync error check
391f005ef32Sjsg */
392f005ef32Sjsg uint32_t disable_dmub_save_restore : 1;
393f005ef32Sjsg
394f005ef32Sjsg uint32_t reserved : 22;
395f005ef32Sjsg } bitfields;
396f005ef32Sjsg
397f005ef32Sjsg uint32_t u32All;
398f005ef32Sjsg };
399f005ef32Sjsg
400f005ef32Sjsg union replay_hw_flags {
401f005ef32Sjsg struct {
402f005ef32Sjsg /**
403f005ef32Sjsg * @allow_alpm_fw_standby_mode: To indicate whether the
404f005ef32Sjsg * ALPM FW standby mode is allowed
405f005ef32Sjsg */
406f005ef32Sjsg uint32_t allow_alpm_fw_standby_mode : 1;
407f005ef32Sjsg
408f005ef32Sjsg /*
409f005ef32Sjsg * @dsc_enable_status: DSC enable status in driver
410f005ef32Sjsg */
411f005ef32Sjsg uint32_t dsc_enable_status : 1;
412f005ef32Sjsg
413f005ef32Sjsg /**
414f005ef32Sjsg * @fec_enable_status: receive fec enable/disable status from driver
415f005ef32Sjsg */
416f005ef32Sjsg uint32_t fec_enable_status : 1;
417f005ef32Sjsg
418f005ef32Sjsg /*
419f005ef32Sjsg * @smu_optimizations_en: SMU power optimization.
420f005ef32Sjsg * Only when active display is Replay capable and display enters Replay.
421f005ef32Sjsg * Trigger interrupt to SMU to powerup/down.
422f005ef32Sjsg */
423f005ef32Sjsg uint32_t smu_optimizations_en : 1;
424f005ef32Sjsg
425f005ef32Sjsg /**
426f005ef32Sjsg * @otg_powered_down: Flag to keep track of OTG power state.
427f005ef32Sjsg */
428f005ef32Sjsg uint32_t otg_powered_down : 1;
429f005ef32Sjsg
430f005ef32Sjsg /**
431f005ef32Sjsg * @phy_power_state: Indicates current phy power state
432f005ef32Sjsg */
433f005ef32Sjsg uint32_t phy_power_state : 1;
434f005ef32Sjsg
435f005ef32Sjsg /**
436f005ef32Sjsg * @link_power_state: Indicates current link power state
437f005ef32Sjsg */
438f005ef32Sjsg uint32_t link_power_state : 1;
439f005ef32Sjsg /**
440f005ef32Sjsg * Use TPS3 signal when restore main link.
441f005ef32Sjsg */
442f005ef32Sjsg uint32_t force_wakeup_by_tps3 : 1;
443f005ef32Sjsg } bitfields;
444f005ef32Sjsg
445f005ef32Sjsg uint32_t u32All;
446f005ef32Sjsg };
447f005ef32Sjsg
448f005ef32Sjsg /**
4491bb76ff1Sjsg * DMUB visual confirm color
4505ca02815Sjsg */
4515ca02815Sjsg struct dmub_feature_caps {
4525ca02815Sjsg /**
4535ca02815Sjsg * Max PSR version supported by FW.
4545ca02815Sjsg */
4555ca02815Sjsg uint8_t psr;
4561bb76ff1Sjsg uint8_t fw_assisted_mclk_switch;
457f005ef32Sjsg uint8_t reserved[4];
458f005ef32Sjsg uint8_t subvp_psr_support;
459f005ef32Sjsg uint8_t gecc_enable;
4601bb76ff1Sjsg };
4611bb76ff1Sjsg
4621bb76ff1Sjsg struct dmub_visual_confirm_color {
4631bb76ff1Sjsg /**
4641bb76ff1Sjsg * Maximum 10 bits color value
4651bb76ff1Sjsg */
4661bb76ff1Sjsg uint16_t color_r_cr;
4671bb76ff1Sjsg uint16_t color_g_y;
4681bb76ff1Sjsg uint16_t color_b_cb;
4691bb76ff1Sjsg uint16_t panel_inst;
4705ca02815Sjsg };
4715ca02815Sjsg
472ad8b1aafSjsg #if defined(__cplusplus)
473ad8b1aafSjsg }
474ad8b1aafSjsg #endif
475ad8b1aafSjsg
476ad8b1aafSjsg //==============================================================================
477ad8b1aafSjsg //</DMUB_TYPES>=================================================================
478ad8b1aafSjsg //==============================================================================
479ad8b1aafSjsg //< DMUB_META>==================================================================
480ad8b1aafSjsg //==============================================================================
481ad8b1aafSjsg #pragma pack(push, 1)
482ad8b1aafSjsg
483ad8b1aafSjsg /* Magic value for identifying dmub_fw_meta_info */
484ad8b1aafSjsg #define DMUB_FW_META_MAGIC 0x444D5542
485ad8b1aafSjsg
486ad8b1aafSjsg /* Offset from the end of the file to the dmub_fw_meta_info */
487ad8b1aafSjsg #define DMUB_FW_META_OFFSET 0x24
488ad8b1aafSjsg
489ad8b1aafSjsg /**
490ad8b1aafSjsg * struct dmub_fw_meta_info - metadata associated with fw binary
491ad8b1aafSjsg *
492ad8b1aafSjsg * NOTE: This should be considered a stable API. Fields should
493ad8b1aafSjsg * not be repurposed or reordered. New fields should be
494ad8b1aafSjsg * added instead to extend the structure.
495ad8b1aafSjsg *
496ad8b1aafSjsg * @magic_value: magic value identifying DMUB firmware meta info
497ad8b1aafSjsg * @fw_region_size: size of the firmware state region
498ad8b1aafSjsg * @trace_buffer_size: size of the tracebuffer region
499ad8b1aafSjsg * @fw_version: the firmware version information
500ad8b1aafSjsg * @dal_fw: 1 if the firmware is DAL
501ad8b1aafSjsg */
502ad8b1aafSjsg struct dmub_fw_meta_info {
5035ca02815Sjsg uint32_t magic_value; /**< magic value identifying DMUB firmware meta info */
5045ca02815Sjsg uint32_t fw_region_size; /**< size of the firmware state region */
5055ca02815Sjsg uint32_t trace_buffer_size; /**< size of the tracebuffer region */
5065ca02815Sjsg uint32_t fw_version; /**< the firmware version information */
5075ca02815Sjsg uint8_t dal_fw; /**< 1 if the firmware is DAL */
5085ca02815Sjsg uint8_t reserved[3]; /**< padding bits */
509ad8b1aafSjsg };
510ad8b1aafSjsg
5115ca02815Sjsg /**
5125ca02815Sjsg * union dmub_fw_meta - ensures that dmub_fw_meta_info remains 64 bytes
5135ca02815Sjsg */
514ad8b1aafSjsg union dmub_fw_meta {
5155ca02815Sjsg struct dmub_fw_meta_info info; /**< metadata info */
5165ca02815Sjsg uint8_t reserved[64]; /**< padding bits */
517ad8b1aafSjsg };
518ad8b1aafSjsg
519ad8b1aafSjsg #pragma pack(pop)
520ad8b1aafSjsg
521ad8b1aafSjsg //==============================================================================
5225ca02815Sjsg //< DMUB Trace Buffer>================================================================
5235ca02815Sjsg //==============================================================================
5245ca02815Sjsg /**
5255ca02815Sjsg * dmub_trace_code_t - firmware trace code, 32-bits
5265ca02815Sjsg */
5275ca02815Sjsg typedef uint32_t dmub_trace_code_t;
5285ca02815Sjsg
5295ca02815Sjsg /**
5305ca02815Sjsg * struct dmcub_trace_buf_entry - Firmware trace entry
5315ca02815Sjsg */
5325ca02815Sjsg struct dmcub_trace_buf_entry {
5335ca02815Sjsg dmub_trace_code_t trace_code; /**< trace code for the event */
5345ca02815Sjsg uint32_t tick_count; /**< the tick count at time of trace */
5355ca02815Sjsg uint32_t param0; /**< trace defined parameter 0 */
5365ca02815Sjsg uint32_t param1; /**< trace defined parameter 1 */
5375ca02815Sjsg };
5385ca02815Sjsg
5395ca02815Sjsg //==============================================================================
540ad8b1aafSjsg //< DMUB_STATUS>================================================================
541ad8b1aafSjsg //==============================================================================
542ad8b1aafSjsg
543ad8b1aafSjsg /**
544ad8b1aafSjsg * DMCUB scratch registers can be used to determine firmware status.
545ad8b1aafSjsg * Current scratch register usage is as follows:
546ad8b1aafSjsg *
547ad8b1aafSjsg * SCRATCH0: FW Boot Status register
5485ca02815Sjsg * SCRATCH5: LVTMA Status Register
549ad8b1aafSjsg * SCRATCH15: FW Boot Options register
550ad8b1aafSjsg */
551ad8b1aafSjsg
5525ca02815Sjsg /**
5535ca02815Sjsg * union dmub_fw_boot_status - Status bit definitions for SCRATCH0.
5545ca02815Sjsg */
555ad8b1aafSjsg union dmub_fw_boot_status {
556ad8b1aafSjsg struct {
5575ca02815Sjsg uint32_t dal_fw : 1; /**< 1 if DAL FW */
5585ca02815Sjsg uint32_t mailbox_rdy : 1; /**< 1 if mailbox ready */
5595ca02815Sjsg uint32_t optimized_init_done : 1; /**< 1 if optimized init done */
5605ca02815Sjsg uint32_t restore_required : 1; /**< 1 if driver should call restore */
5615ca02815Sjsg uint32_t defer_load : 1; /**< 1 if VBIOS data is deferred programmed */
562a365a3ebSjsg uint32_t fams_enabled : 1; /**< 1 if VBIOS data is deferred programmed */
5635ca02815Sjsg uint32_t detection_required: 1; /**< if detection need to be triggered by driver */
564f005ef32Sjsg uint32_t hw_power_init_done: 1; /**< 1 if hw power init is completed */
5655ca02815Sjsg } bits; /**< status bits */
5665ca02815Sjsg uint32_t all; /**< 32-bit access to status bits */
5675ca02815Sjsg };
5685ca02815Sjsg
5695ca02815Sjsg /**
5705ca02815Sjsg * enum dmub_fw_boot_status_bit - Enum bit definitions for SCRATCH0.
5715ca02815Sjsg */
5725ca02815Sjsg enum dmub_fw_boot_status_bit {
5735ca02815Sjsg DMUB_FW_BOOT_STATUS_BIT_DAL_FIRMWARE = (1 << 0), /**< 1 if DAL FW */
5745ca02815Sjsg DMUB_FW_BOOT_STATUS_BIT_MAILBOX_READY = (1 << 1), /**< 1 if mailbox ready */
5755ca02815Sjsg DMUB_FW_BOOT_STATUS_BIT_OPTIMIZED_INIT_DONE = (1 << 2), /**< 1 if init done */
5765ca02815Sjsg DMUB_FW_BOOT_STATUS_BIT_RESTORE_REQUIRED = (1 << 3), /**< 1 if driver should call restore */
5775ca02815Sjsg DMUB_FW_BOOT_STATUS_BIT_DEFERRED_LOADED = (1 << 4), /**< 1 if VBIOS data is deferred programmed */
578f005ef32Sjsg DMUB_FW_BOOT_STATUS_BIT_FAMS_ENABLED = (1 << 5), /**< 1 if FAMS is enabled*/
5795ca02815Sjsg DMUB_FW_BOOT_STATUS_BIT_DETECTION_REQUIRED = (1 << 6), /**< 1 if detection need to be triggered by driver*/
580f005ef32Sjsg DMUB_FW_BOOT_STATUS_BIT_HW_POWER_INIT_DONE = (1 << 7), /**< 1 if hw power init is completed */
5815ca02815Sjsg };
5825ca02815Sjsg
5835ca02815Sjsg /* Register bit definition for SCRATCH5 */
5845ca02815Sjsg union dmub_lvtma_status {
5855ca02815Sjsg struct {
5865ca02815Sjsg uint32_t psp_ok : 1;
5875ca02815Sjsg uint32_t edp_on : 1;
5885ca02815Sjsg uint32_t reserved : 30;
589ad8b1aafSjsg } bits;
590ad8b1aafSjsg uint32_t all;
591ad8b1aafSjsg };
592ad8b1aafSjsg
5935ca02815Sjsg enum dmub_lvtma_status_bit {
5945ca02815Sjsg DMUB_LVTMA_STATUS_BIT_PSP_OK = (1 << 0),
5955ca02815Sjsg DMUB_LVTMA_STATUS_BIT_EDP_ON = (1 << 1),
596ad8b1aafSjsg };
597ad8b1aafSjsg
598f005ef32Sjsg enum dmub_ips_disable_type {
599f005ef32Sjsg DMUB_IPS_DISABLE_IPS1 = 1,
600f005ef32Sjsg DMUB_IPS_DISABLE_IPS2 = 2,
601f005ef32Sjsg DMUB_IPS_DISABLE_IPS2_Z10 = 3,
602f005ef32Sjsg };
603f005ef32Sjsg
6045ca02815Sjsg /**
6055ca02815Sjsg * union dmub_fw_boot_options - Boot option definitions for SCRATCH14
6065ca02815Sjsg */
607ad8b1aafSjsg union dmub_fw_boot_options {
608ad8b1aafSjsg struct {
6095ca02815Sjsg uint32_t pemu_env : 1; /**< 1 if PEMU */
6105ca02815Sjsg uint32_t fpga_env : 1; /**< 1 if FPGA */
6115ca02815Sjsg uint32_t optimized_init : 1; /**< 1 if optimized init */
6125ca02815Sjsg uint32_t skip_phy_access : 1; /**< 1 if PHY access should be skipped */
6135ca02815Sjsg uint32_t disable_clk_gate: 1; /**< 1 if clock gating should be disabled */
6145ca02815Sjsg uint32_t skip_phy_init_panel_sequence: 1; /**< 1 to skip panel init seq */
6155ca02815Sjsg uint32_t z10_disable: 1; /**< 1 to disable z10 */
6161bb76ff1Sjsg uint32_t enable_dpia: 1; /**< 1 if DPIA should be enabled */
6175ca02815Sjsg uint32_t invalid_vbios_data: 1; /**< 1 if VBIOS data table is invalid */
6181bb76ff1Sjsg uint32_t dpia_supported: 1; /**< 1 if DPIA is supported on this platform */
6191bb76ff1Sjsg uint32_t sel_mux_phy_c_d_phy_f_g: 1; /**< 1 if PHYF/PHYG should be enabled */
6201bb76ff1Sjsg /**< 1 if all root clock gating is enabled and low power memory is enabled*/
6211bb76ff1Sjsg uint32_t power_optimization: 1;
6221bb76ff1Sjsg uint32_t diag_env: 1; /* 1 if diagnostic environment */
6231bb76ff1Sjsg uint32_t gpint_scratch8: 1; /* 1 if GPINT is in scratch8*/
6241bb76ff1Sjsg uint32_t usb4_cm_version: 1; /**< 1 CM support */
6251bb76ff1Sjsg uint32_t dpia_hpd_int_enable_supported: 1; /* 1 if dpia hpd int enable supported */
626f005ef32Sjsg uint32_t usb4_dpia_bw_alloc_supported: 1; /* 1 if USB4 dpia BW allocation supported */
627f005ef32Sjsg uint32_t disable_clk_ds: 1; /* 1 if disallow dispclk_ds and dppclk_ds*/
628f005ef32Sjsg uint32_t disable_timeout_recovery : 1; /* 1 if timeout recovery should be disabled */
629f005ef32Sjsg uint32_t ips_pg_disable: 1; /* 1 to disable ONO domains power gating*/
630f005ef32Sjsg uint32_t ips_disable: 2; /* options to disable ips support*/
631f005ef32Sjsg uint32_t reserved : 10; /**< reserved */
6325ca02815Sjsg } bits; /**< boot bits */
6335ca02815Sjsg uint32_t all; /**< 32-bit access to bits */
634ad8b1aafSjsg };
635ad8b1aafSjsg
636ad8b1aafSjsg enum dmub_fw_boot_options_bit {
6375ca02815Sjsg DMUB_FW_BOOT_OPTION_BIT_PEMU_ENV = (1 << 0), /**< 1 if PEMU */
6385ca02815Sjsg DMUB_FW_BOOT_OPTION_BIT_FPGA_ENV = (1 << 1), /**< 1 if FPGA */
6395ca02815Sjsg DMUB_FW_BOOT_OPTION_BIT_OPTIMIZED_INIT_DONE = (1 << 2), /**< 1 if optimized init done */
640ad8b1aafSjsg };
641ad8b1aafSjsg
642ad8b1aafSjsg //==============================================================================
643ad8b1aafSjsg //</DMUB_STATUS>================================================================
644ad8b1aafSjsg //==============================================================================
645ad8b1aafSjsg //< DMUB_VBIOS>=================================================================
646ad8b1aafSjsg //==============================================================================
647ad8b1aafSjsg
648ad8b1aafSjsg /*
6495ca02815Sjsg * enum dmub_cmd_vbios_type - VBIOS commands.
6505ca02815Sjsg *
651ad8b1aafSjsg * Command IDs should be treated as stable ABI.
652ad8b1aafSjsg * Do not reuse or modify IDs.
653ad8b1aafSjsg */
654ad8b1aafSjsg enum dmub_cmd_vbios_type {
6555ca02815Sjsg /**
6565ca02815Sjsg * Configures the DIG encoder.
6575ca02815Sjsg */
658ad8b1aafSjsg DMUB_CMD__VBIOS_DIGX_ENCODER_CONTROL = 0,
6595ca02815Sjsg /**
6605ca02815Sjsg * Controls the PHY.
6615ca02815Sjsg */
662ad8b1aafSjsg DMUB_CMD__VBIOS_DIG1_TRANSMITTER_CONTROL = 1,
6635ca02815Sjsg /**
6645ca02815Sjsg * Sets the pixel clock/symbol clock.
6655ca02815Sjsg */
666ad8b1aafSjsg DMUB_CMD__VBIOS_SET_PIXEL_CLOCK = 2,
6675ca02815Sjsg /**
6685ca02815Sjsg * Enables or disables power gating.
6695ca02815Sjsg */
670ad8b1aafSjsg DMUB_CMD__VBIOS_ENABLE_DISP_POWER_GATING = 3,
6711bb76ff1Sjsg /**
6721bb76ff1Sjsg * Controls embedded panels.
6731bb76ff1Sjsg */
674ad8b1aafSjsg DMUB_CMD__VBIOS_LVTMA_CONTROL = 15,
6751bb76ff1Sjsg /**
6761bb76ff1Sjsg * Query DP alt status on a transmitter.
6771bb76ff1Sjsg */
6781bb76ff1Sjsg DMUB_CMD__VBIOS_TRANSMITTER_QUERY_DP_ALT = 26,
67918b3e4ddSjsg /**
68018b3e4ddSjsg * Controls domain power gating
68118b3e4ddSjsg */
68218b3e4ddSjsg DMUB_CMD__VBIOS_DOMAIN_CONTROL = 28,
683ad8b1aafSjsg };
684ad8b1aafSjsg
685ad8b1aafSjsg //==============================================================================
686ad8b1aafSjsg //</DMUB_VBIOS>=================================================================
687ad8b1aafSjsg //==============================================================================
688ad8b1aafSjsg //< DMUB_GPINT>=================================================================
689ad8b1aafSjsg //==============================================================================
690ad8b1aafSjsg
691ad8b1aafSjsg /**
692ad8b1aafSjsg * The shifts and masks below may alternatively be used to format and read
693ad8b1aafSjsg * the command register bits.
694ad8b1aafSjsg */
695ad8b1aafSjsg
696ad8b1aafSjsg #define DMUB_GPINT_DATA_PARAM_MASK 0xFFFF
697ad8b1aafSjsg #define DMUB_GPINT_DATA_PARAM_SHIFT 0
698ad8b1aafSjsg
699ad8b1aafSjsg #define DMUB_GPINT_DATA_COMMAND_CODE_MASK 0xFFF
700ad8b1aafSjsg #define DMUB_GPINT_DATA_COMMAND_CODE_SHIFT 16
701ad8b1aafSjsg
702ad8b1aafSjsg #define DMUB_GPINT_DATA_STATUS_MASK 0xF
703ad8b1aafSjsg #define DMUB_GPINT_DATA_STATUS_SHIFT 28
704ad8b1aafSjsg
705ad8b1aafSjsg /**
706ad8b1aafSjsg * Command responses.
707ad8b1aafSjsg */
708ad8b1aafSjsg
7095ca02815Sjsg /**
7105ca02815Sjsg * Return response for DMUB_GPINT__STOP_FW command.
7115ca02815Sjsg */
712ad8b1aafSjsg #define DMUB_GPINT__STOP_FW_RESPONSE 0xDEADDEAD
713ad8b1aafSjsg
714ad8b1aafSjsg /**
7155ca02815Sjsg * union dmub_gpint_data_register - Format for sending a command via the GPINT.
716ad8b1aafSjsg */
717ad8b1aafSjsg union dmub_gpint_data_register {
718ad8b1aafSjsg struct {
7195ca02815Sjsg uint32_t param : 16; /**< 16-bit parameter */
7205ca02815Sjsg uint32_t command_code : 12; /**< GPINT command */
7215ca02815Sjsg uint32_t status : 4; /**< Command status bit */
7225ca02815Sjsg } bits; /**< GPINT bit access */
7235ca02815Sjsg uint32_t all; /**< GPINT 32-bit access */
724ad8b1aafSjsg };
725ad8b1aafSjsg
726ad8b1aafSjsg /*
7275ca02815Sjsg * enum dmub_gpint_command - GPINT command to DMCUB FW
7285ca02815Sjsg *
729ad8b1aafSjsg * Command IDs should be treated as stable ABI.
730ad8b1aafSjsg * Do not reuse or modify IDs.
731ad8b1aafSjsg */
732ad8b1aafSjsg enum dmub_gpint_command {
7335ca02815Sjsg /**
7345ca02815Sjsg * Invalid command, ignored.
7355ca02815Sjsg */
736ad8b1aafSjsg DMUB_GPINT__INVALID_COMMAND = 0,
7375ca02815Sjsg /**
7385ca02815Sjsg * DESC: Queries the firmware version.
7395ca02815Sjsg * RETURN: Firmware version.
7405ca02815Sjsg */
741ad8b1aafSjsg DMUB_GPINT__GET_FW_VERSION = 1,
7425ca02815Sjsg /**
7435ca02815Sjsg * DESC: Halts the firmware.
7445ca02815Sjsg * RETURN: DMUB_GPINT__STOP_FW_RESPONSE (0xDEADDEAD) when halted
7455ca02815Sjsg */
746ad8b1aafSjsg DMUB_GPINT__STOP_FW = 2,
7475ca02815Sjsg /**
7485ca02815Sjsg * DESC: Get PSR state from FW.
7495ca02815Sjsg * RETURN: PSR state enum. This enum may need to be converted to the legacy PSR state value.
7505ca02815Sjsg */
751ad8b1aafSjsg DMUB_GPINT__GET_PSR_STATE = 7,
752ad8b1aafSjsg /**
753ad8b1aafSjsg * DESC: Notifies DMCUB of the currently active streams.
754ad8b1aafSjsg * ARGS: Stream mask, 1 bit per active stream index.
755ad8b1aafSjsg */
756ad8b1aafSjsg DMUB_GPINT__IDLE_OPT_NOTIFY_STREAM_MASK = 8,
7575ca02815Sjsg /**
7585ca02815Sjsg * DESC: Start PSR residency counter. Stop PSR resdiency counter and get value.
7595ca02815Sjsg * ARGS: We can measure residency from various points. The argument will specify the residency mode.
7605ca02815Sjsg * By default, it is measured from after we powerdown the PHY, to just before we powerup the PHY.
7615ca02815Sjsg * RETURN: PSR residency in milli-percent.
7625ca02815Sjsg */
7635ca02815Sjsg DMUB_GPINT__PSR_RESIDENCY = 9,
7645ca02815Sjsg
7655ca02815Sjsg /**
766f005ef32Sjsg * DESC: Get REPLAY state from FW.
767f005ef32Sjsg * RETURN: REPLAY state enum. This enum may need to be converted to the legacy REPLAY state value.
768f005ef32Sjsg */
769f005ef32Sjsg DMUB_GPINT__GET_REPLAY_STATE = 13,
770f005ef32Sjsg
771f005ef32Sjsg /**
772f005ef32Sjsg * DESC: Start REPLAY residency counter. Stop REPLAY resdiency counter and get value.
773f005ef32Sjsg * ARGS: We can measure residency from various points. The argument will specify the residency mode.
774f005ef32Sjsg * By default, it is measured from after we powerdown the PHY, to just before we powerup the PHY.
775f005ef32Sjsg * RETURN: REPLAY residency in milli-percent.
776f005ef32Sjsg */
777f005ef32Sjsg DMUB_GPINT__REPLAY_RESIDENCY = 14,
778f005ef32Sjsg
779f005ef32Sjsg
780f005ef32Sjsg /**
7815ca02815Sjsg * DESC: Notifies DMCUB detection is done so detection required can be cleared.
7825ca02815Sjsg */
7835ca02815Sjsg DMUB_GPINT__NOTIFY_DETECTION_DONE = 12,
784f005ef32Sjsg /**
785f005ef32Sjsg * DESC: Updates the trace buffer lower 32-bit mask.
786f005ef32Sjsg * ARGS: The new mask
787f005ef32Sjsg * RETURN: Lower 32-bit mask.
788f005ef32Sjsg */
789f005ef32Sjsg DMUB_GPINT__UPDATE_TRACE_BUFFER_MASK = 101,
790f005ef32Sjsg /**
791f005ef32Sjsg * DESC: Updates the trace buffer lower 32-bit mask.
792f005ef32Sjsg * ARGS: The new mask
793f005ef32Sjsg * RETURN: Lower 32-bit mask.
794f005ef32Sjsg */
795f005ef32Sjsg DMUB_GPINT__SET_TRACE_BUFFER_MASK_WORD0 = 102,
796f005ef32Sjsg /**
797f005ef32Sjsg * DESC: Updates the trace buffer mask bi0~bit15.
798f005ef32Sjsg * ARGS: The new mask
799f005ef32Sjsg * RETURN: Lower 32-bit mask.
800f005ef32Sjsg */
801f005ef32Sjsg DMUB_GPINT__SET_TRACE_BUFFER_MASK_WORD1 = 103,
802ad8b1aafSjsg };
803ad8b1aafSjsg
8045ca02815Sjsg /**
8055ca02815Sjsg * INBOX0 generic command definition
8065ca02815Sjsg */
8075ca02815Sjsg union dmub_inbox0_cmd_common {
8085ca02815Sjsg struct {
8095ca02815Sjsg uint32_t command_code: 8; /**< INBOX0 command code */
8105ca02815Sjsg uint32_t param: 24; /**< 24-bit parameter */
8115ca02815Sjsg } bits;
8125ca02815Sjsg uint32_t all;
8135ca02815Sjsg };
8145ca02815Sjsg
8155ca02815Sjsg /**
8165ca02815Sjsg * INBOX0 hw_lock command definition
8175ca02815Sjsg */
8185ca02815Sjsg union dmub_inbox0_cmd_lock_hw {
8195ca02815Sjsg struct {
8205ca02815Sjsg uint32_t command_code: 8;
8215ca02815Sjsg
8225ca02815Sjsg /* NOTE: Must be have enough bits to match: enum hw_lock_client */
8231bb76ff1Sjsg uint32_t hw_lock_client: 2;
8245ca02815Sjsg
8255ca02815Sjsg /* NOTE: Below fields must match with: struct dmub_hw_lock_inst_flags */
8265ca02815Sjsg uint32_t otg_inst: 3;
8275ca02815Sjsg uint32_t opp_inst: 3;
8285ca02815Sjsg uint32_t dig_inst: 3;
8295ca02815Sjsg
8305ca02815Sjsg /* NOTE: Below fields must match with: union dmub_hw_lock_flags */
8315ca02815Sjsg uint32_t lock_pipe: 1;
8325ca02815Sjsg uint32_t lock_cursor: 1;
8335ca02815Sjsg uint32_t lock_dig: 1;
8345ca02815Sjsg uint32_t triple_buffer_lock: 1;
8355ca02815Sjsg
8365ca02815Sjsg uint32_t lock: 1; /**< Lock */
8375ca02815Sjsg uint32_t should_release: 1; /**< Release */
8381bb76ff1Sjsg uint32_t reserved: 7; /**< Reserved for extending more clients, HW, etc. */
8395ca02815Sjsg } bits;
8405ca02815Sjsg uint32_t all;
8415ca02815Sjsg };
8425ca02815Sjsg
8435ca02815Sjsg union dmub_inbox0_data_register {
8445ca02815Sjsg union dmub_inbox0_cmd_common inbox0_cmd_common;
8455ca02815Sjsg union dmub_inbox0_cmd_lock_hw inbox0_cmd_lock_hw;
8465ca02815Sjsg };
8475ca02815Sjsg
8485ca02815Sjsg enum dmub_inbox0_command {
8495ca02815Sjsg /**
8505ca02815Sjsg * DESC: Invalid command, ignored.
8515ca02815Sjsg */
8525ca02815Sjsg DMUB_INBOX0_CMD__INVALID_COMMAND = 0,
8535ca02815Sjsg /**
8545ca02815Sjsg * DESC: Notification to acquire/release HW lock
8555ca02815Sjsg * ARGS:
8565ca02815Sjsg */
8575ca02815Sjsg DMUB_INBOX0_CMD__HW_LOCK = 1,
8585ca02815Sjsg };
859ad8b1aafSjsg //==============================================================================
860ad8b1aafSjsg //</DMUB_GPINT>=================================================================
861ad8b1aafSjsg //==============================================================================
862ad8b1aafSjsg //< DMUB_CMD>===================================================================
863ad8b1aafSjsg //==============================================================================
864ad8b1aafSjsg
8655ca02815Sjsg /**
8665ca02815Sjsg * Size in bytes of each DMUB command.
8675ca02815Sjsg */
868c349dbc7Sjsg #define DMUB_RB_CMD_SIZE 64
8695ca02815Sjsg
8705ca02815Sjsg /**
8715ca02815Sjsg * Maximum number of items in the DMUB ringbuffer.
8725ca02815Sjsg */
873c349dbc7Sjsg #define DMUB_RB_MAX_ENTRY 128
8745ca02815Sjsg
8755ca02815Sjsg /**
8765ca02815Sjsg * Ringbuffer size in bytes.
8775ca02815Sjsg */
878c349dbc7Sjsg #define DMUB_RB_SIZE (DMUB_RB_CMD_SIZE * DMUB_RB_MAX_ENTRY)
8795ca02815Sjsg
8805ca02815Sjsg /**
8815ca02815Sjsg * REG_SET mask for reg offload.
8825ca02815Sjsg */
883c349dbc7Sjsg #define REG_SET_MASK 0xFFFF
884c349dbc7Sjsg
885c349dbc7Sjsg /*
8865ca02815Sjsg * enum dmub_cmd_type - DMUB inbox command.
8875ca02815Sjsg *
888c349dbc7Sjsg * Command IDs should be treated as stable ABI.
889c349dbc7Sjsg * Do not reuse or modify IDs.
890c349dbc7Sjsg */
891c349dbc7Sjsg enum dmub_cmd_type {
8925ca02815Sjsg /**
8935ca02815Sjsg * Invalid command.
8945ca02815Sjsg */
895c349dbc7Sjsg DMUB_CMD__NULL = 0,
8965ca02815Sjsg /**
8975ca02815Sjsg * Read modify write register sequence offload.
8985ca02815Sjsg */
899c349dbc7Sjsg DMUB_CMD__REG_SEQ_READ_MODIFY_WRITE = 1,
9005ca02815Sjsg /**
9015ca02815Sjsg * Field update register sequence offload.
9025ca02815Sjsg */
903c349dbc7Sjsg DMUB_CMD__REG_SEQ_FIELD_UPDATE_SEQ = 2,
9045ca02815Sjsg /**
9055ca02815Sjsg * Burst write sequence offload.
9065ca02815Sjsg */
907c349dbc7Sjsg DMUB_CMD__REG_SEQ_BURST_WRITE = 3,
9085ca02815Sjsg /**
9095ca02815Sjsg * Reg wait sequence offload.
9105ca02815Sjsg */
911c349dbc7Sjsg DMUB_CMD__REG_REG_WAIT = 4,
9125ca02815Sjsg /**
9135ca02815Sjsg * Workaround to avoid HUBP underflow during NV12 playback.
9145ca02815Sjsg */
915c349dbc7Sjsg DMUB_CMD__PLAT_54186_WA = 5,
9165ca02815Sjsg /**
9175ca02815Sjsg * Command type used to query FW feature caps.
9185ca02815Sjsg */
9195ca02815Sjsg DMUB_CMD__QUERY_FEATURE_CAPS = 6,
9205ca02815Sjsg /**
9211bb76ff1Sjsg * Command type used to get visual confirm color.
9221bb76ff1Sjsg */
9231bb76ff1Sjsg DMUB_CMD__GET_VISUAL_CONFIRM_COLOR = 8,
9241bb76ff1Sjsg /**
9255ca02815Sjsg * Command type used for all PSR commands.
9265ca02815Sjsg */
927c349dbc7Sjsg DMUB_CMD__PSR = 64,
9285ca02815Sjsg /**
9295ca02815Sjsg * Command type used for all MALL commands.
9305ca02815Sjsg */
9315ca02815Sjsg DMUB_CMD__MALL = 65,
9325ca02815Sjsg /**
9335ca02815Sjsg * Command type used for all ABM commands.
9345ca02815Sjsg */
935c349dbc7Sjsg DMUB_CMD__ABM = 66,
9365ca02815Sjsg /**
9371bb76ff1Sjsg * Command type used to update dirty rects in FW.
9381bb76ff1Sjsg */
9391bb76ff1Sjsg DMUB_CMD__UPDATE_DIRTY_RECT = 67,
9401bb76ff1Sjsg /**
9411bb76ff1Sjsg * Command type used to update cursor info in FW.
9421bb76ff1Sjsg */
9431bb76ff1Sjsg DMUB_CMD__UPDATE_CURSOR_INFO = 68,
9441bb76ff1Sjsg /**
9455ca02815Sjsg * Command type used for HW locking in FW.
9465ca02815Sjsg */
947ad8b1aafSjsg DMUB_CMD__HW_LOCK = 69,
9485ca02815Sjsg /**
9495ca02815Sjsg * Command type used to access DP AUX.
9505ca02815Sjsg */
951ad8b1aafSjsg DMUB_CMD__DP_AUX_ACCESS = 70,
9525ca02815Sjsg /**
9535ca02815Sjsg * Command type used for OUTBOX1 notification enable
9545ca02815Sjsg */
955ad8b1aafSjsg DMUB_CMD__OUTBOX1_ENABLE = 71,
9561bb76ff1Sjsg
9575ca02815Sjsg /**
9585ca02815Sjsg * Command type used for all idle optimization commands.
9595ca02815Sjsg */
9605ca02815Sjsg DMUB_CMD__IDLE_OPT = 72,
9615ca02815Sjsg /**
9625ca02815Sjsg * Command type used for all clock manager commands.
9635ca02815Sjsg */
9645ca02815Sjsg DMUB_CMD__CLK_MGR = 73,
9655ca02815Sjsg /**
9665ca02815Sjsg * Command type used for all panel control commands.
9675ca02815Sjsg */
9685ca02815Sjsg DMUB_CMD__PANEL_CNTL = 74,
9695ca02815Sjsg /**
9701bb76ff1Sjsg * Command type used for <TODO:description>
9711bb76ff1Sjsg */
9721bb76ff1Sjsg DMUB_CMD__CAB_FOR_SS = 75,
9731bb76ff1Sjsg
9741bb76ff1Sjsg DMUB_CMD__FW_ASSISTED_MCLK_SWITCH = 76,
9751bb76ff1Sjsg
9761bb76ff1Sjsg /**
9771bb76ff1Sjsg * Command type used for interfacing with DPIA.
9781bb76ff1Sjsg */
9791bb76ff1Sjsg DMUB_CMD__DPIA = 77,
9801bb76ff1Sjsg /**
9815ca02815Sjsg * Command type used for EDID CEA parsing
9825ca02815Sjsg */
9835ca02815Sjsg DMUB_CMD__EDID_CEA = 79,
9845ca02815Sjsg /**
9851bb76ff1Sjsg * Command type used for getting usbc cable ID
9861bb76ff1Sjsg */
9871bb76ff1Sjsg DMUB_CMD_GET_USBC_CABLE_ID = 81,
9881bb76ff1Sjsg /**
9891bb76ff1Sjsg * Command type used to query HPD state.
9901bb76ff1Sjsg */
9911bb76ff1Sjsg DMUB_CMD__QUERY_HPD_STATE = 82,
9921bb76ff1Sjsg /**
9935ca02815Sjsg * Command type used for all VBIOS interface commands.
9945ca02815Sjsg */
9951bb76ff1Sjsg
9961bb76ff1Sjsg /**
997f005ef32Sjsg * Command type used for all REPLAY commands.
998f005ef32Sjsg */
999f005ef32Sjsg DMUB_CMD__REPLAY = 83,
1000f005ef32Sjsg
1001f005ef32Sjsg /**
1002f005ef32Sjsg * Command type used for all SECURE_DISPLAY commands.
1003f005ef32Sjsg */
1004f005ef32Sjsg DMUB_CMD__SECURE_DISPLAY = 85,
1005f005ef32Sjsg
1006f005ef32Sjsg /**
10071bb76ff1Sjsg * Command type used to set DPIA HPD interrupt state
10081bb76ff1Sjsg */
10091bb76ff1Sjsg DMUB_CMD__DPIA_HPD_INT_ENABLE = 86,
10101bb76ff1Sjsg
1011c349dbc7Sjsg DMUB_CMD__VBIOS = 128,
1012c349dbc7Sjsg };
1013c349dbc7Sjsg
10145ca02815Sjsg /**
10155ca02815Sjsg * enum dmub_out_cmd_type - DMUB outbox commands.
10165ca02815Sjsg */
1017ad8b1aafSjsg enum dmub_out_cmd_type {
10185ca02815Sjsg /**
10195ca02815Sjsg * Invalid outbox command, ignored.
10205ca02815Sjsg */
1021ad8b1aafSjsg DMUB_OUT_CMD__NULL = 0,
10225ca02815Sjsg /**
10235ca02815Sjsg * Command type used for DP AUX Reply data notification
10245ca02815Sjsg */
1025ad8b1aafSjsg DMUB_OUT_CMD__DP_AUX_REPLY = 1,
10261bb76ff1Sjsg /**
10271bb76ff1Sjsg * Command type used for DP HPD event notification
10281bb76ff1Sjsg */
10291bb76ff1Sjsg DMUB_OUT_CMD__DP_HPD_NOTIFY = 2,
10301bb76ff1Sjsg /**
10311bb76ff1Sjsg * Command type used for SET_CONFIG Reply notification
10321bb76ff1Sjsg */
10331bb76ff1Sjsg DMUB_OUT_CMD__SET_CONFIG_REPLY = 3,
1034f005ef32Sjsg /**
1035f005ef32Sjsg * Command type used for USB4 DPIA notification
1036f005ef32Sjsg */
1037f005ef32Sjsg DMUB_OUT_CMD__DPIA_NOTIFICATION = 5,
10381bb76ff1Sjsg };
10391bb76ff1Sjsg
10401bb76ff1Sjsg /* DMUB_CMD__DPIA command sub-types. */
10411bb76ff1Sjsg enum dmub_cmd_dpia_type {
10421bb76ff1Sjsg DMUB_CMD__DPIA_DIG1_DPIA_CONTROL = 0,
10431bb76ff1Sjsg DMUB_CMD__DPIA_SET_CONFIG_ACCESS = 1,
10441bb76ff1Sjsg DMUB_CMD__DPIA_MST_ALLOC_SLOTS = 2,
1045ad8b1aafSjsg };
1046ad8b1aafSjsg
1047f005ef32Sjsg /* DMUB_OUT_CMD__DPIA_NOTIFICATION command types. */
1048f005ef32Sjsg enum dmub_cmd_dpia_notification_type {
1049f005ef32Sjsg DPIA_NOTIFY__BW_ALLOCATION = 0,
1050f005ef32Sjsg };
1051f005ef32Sjsg
1052c349dbc7Sjsg #pragma pack(push, 1)
1053c349dbc7Sjsg
10545ca02815Sjsg /**
10555ca02815Sjsg * struct dmub_cmd_header - Common command header fields.
10565ca02815Sjsg */
1057c349dbc7Sjsg struct dmub_cmd_header {
10585ca02815Sjsg unsigned int type : 8; /**< command type */
10595ca02815Sjsg unsigned int sub_type : 8; /**< command sub type */
10605ca02815Sjsg unsigned int ret_status : 1; /**< 1 if returned data, 0 otherwise */
10615ca02815Sjsg unsigned int multi_cmd_pending : 1; /**< 1 if multiple commands chained together */
10625ca02815Sjsg unsigned int reserved0 : 6; /**< reserved bits */
10635ca02815Sjsg unsigned int payload_bytes : 6; /* payload excluding header - up to 60 bytes */
10645ca02815Sjsg unsigned int reserved1 : 2; /**< reserved bits */
1065c349dbc7Sjsg };
1066c349dbc7Sjsg
1067c349dbc7Sjsg /*
10685ca02815Sjsg * struct dmub_cmd_read_modify_write_sequence - Read modify write
1069c349dbc7Sjsg *
1070c349dbc7Sjsg * 60 payload bytes can hold up to 5 sets of read modify writes,
1071c349dbc7Sjsg * each take 3 dwords.
1072c349dbc7Sjsg *
1073c349dbc7Sjsg * number of sequences = header.payload_bytes / sizeof(struct dmub_cmd_read_modify_write_sequence)
1074c349dbc7Sjsg *
1075c349dbc7Sjsg * modify_mask = 0xffff'ffff means all fields are going to be updated. in this case
1076c349dbc7Sjsg * command parser will skip the read and we can use modify_mask = 0xffff'ffff as reg write
1077c349dbc7Sjsg */
1078c349dbc7Sjsg struct dmub_cmd_read_modify_write_sequence {
10795ca02815Sjsg uint32_t addr; /**< register address */
10805ca02815Sjsg uint32_t modify_mask; /**< modify mask */
10815ca02815Sjsg uint32_t modify_value; /**< modify value */
1082c349dbc7Sjsg };
1083c349dbc7Sjsg
10845ca02815Sjsg /**
10855ca02815Sjsg * Maximum number of ops in read modify write sequence.
10865ca02815Sjsg */
1087c349dbc7Sjsg #define DMUB_READ_MODIFY_WRITE_SEQ__MAX 5
10885ca02815Sjsg
10895ca02815Sjsg /**
10905ca02815Sjsg * struct dmub_cmd_read_modify_write_sequence - Read modify write command.
10915ca02815Sjsg */
1092c349dbc7Sjsg struct dmub_rb_cmd_read_modify_write {
10935ca02815Sjsg struct dmub_cmd_header header; /**< command header */
10945ca02815Sjsg /**
10955ca02815Sjsg * Read modify write sequence.
10965ca02815Sjsg */
1097c349dbc7Sjsg struct dmub_cmd_read_modify_write_sequence seq[DMUB_READ_MODIFY_WRITE_SEQ__MAX];
1098c349dbc7Sjsg };
1099c349dbc7Sjsg
1100c349dbc7Sjsg /*
1101c349dbc7Sjsg * Update a register with specified masks and values sequeunce
1102c349dbc7Sjsg *
1103c349dbc7Sjsg * 60 payload bytes can hold address + up to 7 sets of mask/value combo, each take 2 dword
1104c349dbc7Sjsg *
1105c349dbc7Sjsg * number of field update sequence = (header.payload_bytes - sizeof(addr)) / sizeof(struct read_modify_write_sequence)
1106c349dbc7Sjsg *
1107c349dbc7Sjsg *
1108c349dbc7Sjsg * USE CASE:
1109c349dbc7Sjsg * 1. auto-increment register where additional read would update pointer and produce wrong result
1110c349dbc7Sjsg * 2. toggle a bit without read in the middle
1111c349dbc7Sjsg */
1112c349dbc7Sjsg
1113c349dbc7Sjsg struct dmub_cmd_reg_field_update_sequence {
11145ca02815Sjsg uint32_t modify_mask; /**< 0xffff'ffff to skip initial read */
11155ca02815Sjsg uint32_t modify_value; /**< value to update with */
1116c349dbc7Sjsg };
1117c349dbc7Sjsg
11185ca02815Sjsg /**
11195ca02815Sjsg * Maximum number of ops in field update sequence.
11205ca02815Sjsg */
1121c349dbc7Sjsg #define DMUB_REG_FIELD_UPDATE_SEQ__MAX 7
11225ca02815Sjsg
11235ca02815Sjsg /**
11245ca02815Sjsg * struct dmub_rb_cmd_reg_field_update_sequence - Field update command.
11255ca02815Sjsg */
1126c349dbc7Sjsg struct dmub_rb_cmd_reg_field_update_sequence {
11275ca02815Sjsg struct dmub_cmd_header header; /**< command header */
11285ca02815Sjsg uint32_t addr; /**< register address */
11295ca02815Sjsg /**
11305ca02815Sjsg * Field update sequence.
11315ca02815Sjsg */
1132c349dbc7Sjsg struct dmub_cmd_reg_field_update_sequence seq[DMUB_REG_FIELD_UPDATE_SEQ__MAX];
1133c349dbc7Sjsg };
1134c349dbc7Sjsg
11355ca02815Sjsg
11365ca02815Sjsg /**
11375ca02815Sjsg * Maximum number of burst write values.
11385ca02815Sjsg */
11395ca02815Sjsg #define DMUB_BURST_WRITE_VALUES__MAX 14
11405ca02815Sjsg
1141c349dbc7Sjsg /*
11425ca02815Sjsg * struct dmub_rb_cmd_burst_write - Burst write
1143c349dbc7Sjsg *
1144c349dbc7Sjsg * support use case such as writing out LUTs.
1145c349dbc7Sjsg *
1146c349dbc7Sjsg * 60 payload bytes can hold up to 14 values to write to given address
1147c349dbc7Sjsg *
1148c349dbc7Sjsg * number of payload = header.payload_bytes / sizeof(struct read_modify_write_sequence)
1149c349dbc7Sjsg */
1150c349dbc7Sjsg struct dmub_rb_cmd_burst_write {
11515ca02815Sjsg struct dmub_cmd_header header; /**< command header */
11525ca02815Sjsg uint32_t addr; /**< register start address */
11535ca02815Sjsg /**
11545ca02815Sjsg * Burst write register values.
11555ca02815Sjsg */
1156c349dbc7Sjsg uint32_t write_values[DMUB_BURST_WRITE_VALUES__MAX];
1157c349dbc7Sjsg };
1158c349dbc7Sjsg
11595ca02815Sjsg /**
11605ca02815Sjsg * struct dmub_rb_cmd_common - Common command header
11615ca02815Sjsg */
1162c349dbc7Sjsg struct dmub_rb_cmd_common {
11635ca02815Sjsg struct dmub_cmd_header header; /**< command header */
11645ca02815Sjsg /**
11655ca02815Sjsg * Padding to RB_CMD_SIZE
11665ca02815Sjsg */
1167c349dbc7Sjsg uint8_t cmd_buffer[DMUB_RB_CMD_SIZE - sizeof(struct dmub_cmd_header)];
1168c349dbc7Sjsg };
1169c349dbc7Sjsg
11705ca02815Sjsg /**
11715ca02815Sjsg * struct dmub_cmd_reg_wait_data - Register wait data
11725ca02815Sjsg */
1173c349dbc7Sjsg struct dmub_cmd_reg_wait_data {
11745ca02815Sjsg uint32_t addr; /**< Register address */
11755ca02815Sjsg uint32_t mask; /**< Mask for register bits */
11765ca02815Sjsg uint32_t condition_field_value; /**< Value to wait for */
11775ca02815Sjsg uint32_t time_out_us; /**< Time out for reg wait in microseconds */
1178c349dbc7Sjsg };
1179c349dbc7Sjsg
11805ca02815Sjsg /**
11815ca02815Sjsg * struct dmub_rb_cmd_reg_wait - Register wait command
11825ca02815Sjsg */
1183c349dbc7Sjsg struct dmub_rb_cmd_reg_wait {
11845ca02815Sjsg struct dmub_cmd_header header; /**< Command header */
11855ca02815Sjsg struct dmub_cmd_reg_wait_data reg_wait; /**< Register wait data */
1186c349dbc7Sjsg };
1187c349dbc7Sjsg
11885ca02815Sjsg /**
11895ca02815Sjsg * struct dmub_cmd_PLAT_54186_wa - Underflow workaround
11905ca02815Sjsg *
11915ca02815Sjsg * Reprograms surface parameters to avoid underflow.
11925ca02815Sjsg */
1193c349dbc7Sjsg struct dmub_cmd_PLAT_54186_wa {
11945ca02815Sjsg uint32_t DCSURF_SURFACE_CONTROL; /**< reg value */
11955ca02815Sjsg uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH; /**< reg value */
11965ca02815Sjsg uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS; /**< reg value */
11975ca02815Sjsg uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_HIGH_C; /**< reg value */
11985ca02815Sjsg uint32_t DCSURF_PRIMARY_SURFACE_ADDRESS_C; /**< reg value */
1199c349dbc7Sjsg struct {
12005ca02815Sjsg uint8_t hubp_inst : 4; /**< HUBP instance */
12015ca02815Sjsg uint8_t tmz_surface : 1; /**< TMZ enable or disable */
12025ca02815Sjsg uint8_t immediate :1; /**< Immediate flip */
12035ca02815Sjsg uint8_t vmid : 4; /**< VMID */
12045ca02815Sjsg uint8_t grph_stereo : 1; /**< 1 if stereo */
12055ca02815Sjsg uint32_t reserved : 21; /**< Reserved */
12065ca02815Sjsg } flip_params; /**< Pageflip parameters */
12075ca02815Sjsg uint32_t reserved[9]; /**< Reserved bits */
1208c349dbc7Sjsg };
1209c349dbc7Sjsg
12105ca02815Sjsg /**
12115ca02815Sjsg * struct dmub_rb_cmd_PLAT_54186_wa - Underflow workaround command
12125ca02815Sjsg */
1213c349dbc7Sjsg struct dmub_rb_cmd_PLAT_54186_wa {
12145ca02815Sjsg struct dmub_cmd_header header; /**< Command header */
12155ca02815Sjsg struct dmub_cmd_PLAT_54186_wa flip; /**< Flip data */
1216c349dbc7Sjsg };
1217c349dbc7Sjsg
12185ca02815Sjsg /**
12195ca02815Sjsg * struct dmub_rb_cmd_mall - MALL command data.
12205ca02815Sjsg */
12215ca02815Sjsg struct dmub_rb_cmd_mall {
12225ca02815Sjsg struct dmub_cmd_header header; /**< Common command header */
12235ca02815Sjsg union dmub_addr cursor_copy_src; /**< Cursor copy address */
12245ca02815Sjsg union dmub_addr cursor_copy_dst; /**< Cursor copy destination */
12255ca02815Sjsg uint32_t tmr_delay; /**< Timer delay */
12265ca02815Sjsg uint32_t tmr_scale; /**< Timer scale */
12275ca02815Sjsg uint16_t cursor_width; /**< Cursor width in pixels */
12285ca02815Sjsg uint16_t cursor_pitch; /**< Cursor pitch in pixels */
12295ca02815Sjsg uint16_t cursor_height; /**< Cursor height in pixels */
12305ca02815Sjsg uint8_t cursor_bpp; /**< Cursor bits per pixel */
12315ca02815Sjsg uint8_t debug_bits; /**< Debug bits */
12325ca02815Sjsg
12335ca02815Sjsg uint8_t reserved1; /**< Reserved bits */
12345ca02815Sjsg uint8_t reserved2; /**< Reserved bits */
12355ca02815Sjsg };
12365ca02815Sjsg
12375ca02815Sjsg /**
1238f005ef32Sjsg * enum dmub_cmd_cab_type - CAB command data.
12391bb76ff1Sjsg */
12401bb76ff1Sjsg enum dmub_cmd_cab_type {
1241f005ef32Sjsg /**
1242f005ef32Sjsg * No idle optimizations (i.e. no CAB)
1243f005ef32Sjsg */
12441bb76ff1Sjsg DMUB_CMD__CAB_NO_IDLE_OPTIMIZATION = 0,
1245f005ef32Sjsg /**
1246f005ef32Sjsg * No DCN requests for memory
1247f005ef32Sjsg */
12481bb76ff1Sjsg DMUB_CMD__CAB_NO_DCN_REQ = 1,
1249f005ef32Sjsg /**
1250f005ef32Sjsg * Fit surfaces in CAB (i.e. CAB enable)
1251f005ef32Sjsg */
12521bb76ff1Sjsg DMUB_CMD__CAB_DCN_SS_FIT_IN_CAB = 2,
12531bb76ff1Sjsg };
12541bb76ff1Sjsg
12551bb76ff1Sjsg /**
1256f005ef32Sjsg * struct dmub_rb_cmd_cab - CAB command data.
12571bb76ff1Sjsg */
12581bb76ff1Sjsg struct dmub_rb_cmd_cab_for_ss {
12591bb76ff1Sjsg struct dmub_cmd_header header;
12601bb76ff1Sjsg uint8_t cab_alloc_ways; /* total number of ways */
12611bb76ff1Sjsg uint8_t debug_bits; /* debug bits */
12621bb76ff1Sjsg };
12631bb76ff1Sjsg
1264f005ef32Sjsg /**
1265f005ef32Sjsg * Enum for indicating which MCLK switch mode per pipe
1266f005ef32Sjsg */
12671bb76ff1Sjsg enum mclk_switch_mode {
12681bb76ff1Sjsg NONE = 0,
12691bb76ff1Sjsg FPO = 1,
12701bb76ff1Sjsg SUBVP = 2,
12711bb76ff1Sjsg VBLANK = 3,
12721bb76ff1Sjsg };
12731bb76ff1Sjsg
12741bb76ff1Sjsg /* Per pipe struct which stores the MCLK switch mode
12751bb76ff1Sjsg * data to be sent to DMUB.
12761bb76ff1Sjsg * Named "v2" for now -- once FPO and SUBVP are fully merged
12771bb76ff1Sjsg * the type name can be updated
12781bb76ff1Sjsg */
12791bb76ff1Sjsg struct dmub_cmd_fw_assisted_mclk_switch_pipe_data_v2 {
12801bb76ff1Sjsg union {
12811bb76ff1Sjsg struct {
12821bb76ff1Sjsg uint32_t pix_clk_100hz;
12831bb76ff1Sjsg uint16_t main_vblank_start;
12841bb76ff1Sjsg uint16_t main_vblank_end;
12851bb76ff1Sjsg uint16_t mall_region_lines;
12861bb76ff1Sjsg uint16_t prefetch_lines;
12871bb76ff1Sjsg uint16_t prefetch_to_mall_start_lines;
12881bb76ff1Sjsg uint16_t processing_delay_lines;
12891bb76ff1Sjsg uint16_t htotal; // required to calculate line time for multi-display cases
12901bb76ff1Sjsg uint16_t vtotal;
12911bb76ff1Sjsg uint8_t main_pipe_index;
12921bb76ff1Sjsg uint8_t phantom_pipe_index;
12931bb76ff1Sjsg /* Since the microschedule is calculated in terms of OTG lines,
12941bb76ff1Sjsg * include any scaling factors to make sure when we get accurate
12951bb76ff1Sjsg * conversion when programming MALL_START_LINE (which is in terms
12961bb76ff1Sjsg * of HUBP lines). If 4K is being downscaled to 1080p, scale factor
12971bb76ff1Sjsg * is 1/2 (numerator = 1, denominator = 2).
12981bb76ff1Sjsg */
12991bb76ff1Sjsg uint8_t scale_factor_numerator;
13001bb76ff1Sjsg uint8_t scale_factor_denominator;
13011bb76ff1Sjsg uint8_t is_drr;
13021bb76ff1Sjsg uint8_t main_split_pipe_index;
13031bb76ff1Sjsg uint8_t phantom_split_pipe_index;
13041bb76ff1Sjsg } subvp_data;
13051bb76ff1Sjsg
13061bb76ff1Sjsg struct {
13071bb76ff1Sjsg uint32_t pix_clk_100hz;
13081bb76ff1Sjsg uint16_t vblank_start;
13091bb76ff1Sjsg uint16_t vblank_end;
13101bb76ff1Sjsg uint16_t vstartup_start;
13111bb76ff1Sjsg uint16_t vtotal;
13121bb76ff1Sjsg uint16_t htotal;
13131bb76ff1Sjsg uint8_t vblank_pipe_index;
1314f005ef32Sjsg uint8_t padding[1];
13151bb76ff1Sjsg struct {
13161bb76ff1Sjsg uint8_t drr_in_use;
13171bb76ff1Sjsg uint8_t drr_window_size_ms; // Indicates largest VMIN/VMAX adjustment per frame
13181bb76ff1Sjsg uint16_t min_vtotal_supported; // Min VTOTAL that supports switching in VBLANK
13191bb76ff1Sjsg uint16_t max_vtotal_supported; // Max VTOTAL that can support SubVP static scheduling
13201bb76ff1Sjsg uint8_t use_ramping; // Use ramping or not
1321f005ef32Sjsg uint8_t drr_vblank_start_margin;
13221bb76ff1Sjsg } drr_info; // DRR considered as part of SubVP + VBLANK case
13231bb76ff1Sjsg } vblank_data;
13241bb76ff1Sjsg } pipe_config;
13251bb76ff1Sjsg
13261bb76ff1Sjsg /* - subvp_data in the union (pipe_config) takes up 27 bytes.
13271bb76ff1Sjsg * - Make the "mode" field a uint8_t instead of enum so we only use 1 byte (only
13281bb76ff1Sjsg * for the DMCUB command, cast to enum once we populate the DMCUB subvp state).
13291bb76ff1Sjsg */
13301bb76ff1Sjsg uint8_t mode; // enum mclk_switch_mode
13311bb76ff1Sjsg };
13321bb76ff1Sjsg
13331bb76ff1Sjsg /**
13341bb76ff1Sjsg * Config data for Sub-VP and FPO
13351bb76ff1Sjsg * Named "v2" for now -- once FPO and SUBVP are fully merged
13361bb76ff1Sjsg * the type name can be updated
13371bb76ff1Sjsg */
13381bb76ff1Sjsg struct dmub_cmd_fw_assisted_mclk_switch_config_v2 {
13391bb76ff1Sjsg uint16_t watermark_a_cache;
13401bb76ff1Sjsg uint8_t vertical_int_margin_us;
13411bb76ff1Sjsg uint8_t pstate_allow_width_us;
13421bb76ff1Sjsg struct dmub_cmd_fw_assisted_mclk_switch_pipe_data_v2 pipe_data[DMUB_MAX_SUBVP_STREAMS];
13431bb76ff1Sjsg };
13441bb76ff1Sjsg
13451bb76ff1Sjsg /**
13461bb76ff1Sjsg * DMUB rb command definition for Sub-VP and FPO
13471bb76ff1Sjsg * Named "v2" for now -- once FPO and SUBVP are fully merged
13481bb76ff1Sjsg * the type name can be updated
13491bb76ff1Sjsg */
13501bb76ff1Sjsg struct dmub_rb_cmd_fw_assisted_mclk_switch_v2 {
13511bb76ff1Sjsg struct dmub_cmd_header header;
13521bb76ff1Sjsg struct dmub_cmd_fw_assisted_mclk_switch_config_v2 config_data;
13531bb76ff1Sjsg };
13541bb76ff1Sjsg
13551bb76ff1Sjsg /**
13565ca02815Sjsg * enum dmub_cmd_idle_opt_type - Idle optimization command type.
13575ca02815Sjsg */
13585ca02815Sjsg enum dmub_cmd_idle_opt_type {
13595ca02815Sjsg /**
13605ca02815Sjsg * DCN hardware restore.
13615ca02815Sjsg */
13625ca02815Sjsg DMUB_CMD__IDLE_OPT_DCN_RESTORE = 0,
13635ca02815Sjsg
13645ca02815Sjsg /**
13655ca02815Sjsg * DCN hardware save.
13665ca02815Sjsg */
1367f005ef32Sjsg DMUB_CMD__IDLE_OPT_DCN_SAVE_INIT = 1,
1368f005ef32Sjsg
1369f005ef32Sjsg /**
1370f005ef32Sjsg * DCN hardware notify idle.
1371f005ef32Sjsg */
1372f005ef32Sjsg DMUB_CMD__IDLE_OPT_DCN_NOTIFY_IDLE = 2
13735ca02815Sjsg };
13745ca02815Sjsg
13755ca02815Sjsg /**
13765ca02815Sjsg * struct dmub_rb_cmd_idle_opt_dcn_restore - DCN restore command data.
13775ca02815Sjsg */
13785ca02815Sjsg struct dmub_rb_cmd_idle_opt_dcn_restore {
13795ca02815Sjsg struct dmub_cmd_header header; /**< header */
13805ca02815Sjsg };
13815ca02815Sjsg
13825ca02815Sjsg /**
1383f005ef32Sjsg * struct dmub_dcn_notify_idle_cntl_data - Data passed to FW in a DMUB_CMD__IDLE_OPT_DCN_NOTIFY_IDLE command.
1384f005ef32Sjsg */
1385f005ef32Sjsg struct dmub_dcn_notify_idle_cntl_data {
1386f005ef32Sjsg uint8_t driver_idle;
1387f005ef32Sjsg uint8_t pad[1];
1388f005ef32Sjsg };
1389f005ef32Sjsg
1390f005ef32Sjsg /**
1391f005ef32Sjsg * struct dmub_rb_cmd_idle_opt_dcn_notify_idle - Data passed to FW in a DMUB_CMD__IDLE_OPT_DCN_NOTIFY_IDLE command.
1392f005ef32Sjsg */
1393f005ef32Sjsg struct dmub_rb_cmd_idle_opt_dcn_notify_idle {
1394f005ef32Sjsg struct dmub_cmd_header header; /**< header */
1395f005ef32Sjsg struct dmub_dcn_notify_idle_cntl_data cntl_data;
1396f005ef32Sjsg };
1397f005ef32Sjsg
1398f005ef32Sjsg /**
13995ca02815Sjsg * struct dmub_clocks - Clock update notification.
14005ca02815Sjsg */
14015ca02815Sjsg struct dmub_clocks {
14025ca02815Sjsg uint32_t dispclk_khz; /**< dispclk kHz */
14035ca02815Sjsg uint32_t dppclk_khz; /**< dppclk kHz */
14045ca02815Sjsg uint32_t dcfclk_khz; /**< dcfclk kHz */
14055ca02815Sjsg uint32_t dcfclk_deep_sleep_khz; /**< dcfclk deep sleep kHz */
14065ca02815Sjsg };
14075ca02815Sjsg
14085ca02815Sjsg /**
14095ca02815Sjsg * enum dmub_cmd_clk_mgr_type - Clock manager commands.
14105ca02815Sjsg */
14115ca02815Sjsg enum dmub_cmd_clk_mgr_type {
14125ca02815Sjsg /**
14135ca02815Sjsg * Notify DMCUB of clock update.
14145ca02815Sjsg */
14155ca02815Sjsg DMUB_CMD__CLK_MGR_NOTIFY_CLOCKS = 0,
14165ca02815Sjsg };
14175ca02815Sjsg
14185ca02815Sjsg /**
14195ca02815Sjsg * struct dmub_rb_cmd_clk_mgr_notify_clocks - Clock update notification.
14205ca02815Sjsg */
14215ca02815Sjsg struct dmub_rb_cmd_clk_mgr_notify_clocks {
14225ca02815Sjsg struct dmub_cmd_header header; /**< header */
14235ca02815Sjsg struct dmub_clocks clocks; /**< clock data */
14245ca02815Sjsg };
14255ca02815Sjsg
14265ca02815Sjsg /**
14275ca02815Sjsg * struct dmub_cmd_digx_encoder_control_data - Encoder control data.
14285ca02815Sjsg */
1429c349dbc7Sjsg struct dmub_cmd_digx_encoder_control_data {
14305ca02815Sjsg union dig_encoder_control_parameters_v1_5 dig; /**< payload */
1431c349dbc7Sjsg };
1432c349dbc7Sjsg
14335ca02815Sjsg /**
14345ca02815Sjsg * struct dmub_rb_cmd_digx_encoder_control - Encoder control command.
14355ca02815Sjsg */
1436c349dbc7Sjsg struct dmub_rb_cmd_digx_encoder_control {
14375ca02815Sjsg struct dmub_cmd_header header; /**< header */
14385ca02815Sjsg struct dmub_cmd_digx_encoder_control_data encoder_control; /**< payload */
1439c349dbc7Sjsg };
1440c349dbc7Sjsg
14415ca02815Sjsg /**
14425ca02815Sjsg * struct dmub_cmd_set_pixel_clock_data - Set pixel clock data.
14435ca02815Sjsg */
1444c349dbc7Sjsg struct dmub_cmd_set_pixel_clock_data {
14455ca02815Sjsg struct set_pixel_clock_parameter_v1_7 clk; /**< payload */
1446c349dbc7Sjsg };
1447c349dbc7Sjsg
14485ca02815Sjsg /**
14495ca02815Sjsg * struct dmub_cmd_set_pixel_clock_data - Set pixel clock command.
14505ca02815Sjsg */
1451c349dbc7Sjsg struct dmub_rb_cmd_set_pixel_clock {
14525ca02815Sjsg struct dmub_cmd_header header; /**< header */
14535ca02815Sjsg struct dmub_cmd_set_pixel_clock_data pixel_clock; /**< payload */
1454c349dbc7Sjsg };
1455c349dbc7Sjsg
14565ca02815Sjsg /**
14575ca02815Sjsg * struct dmub_cmd_enable_disp_power_gating_data - Display power gating.
14585ca02815Sjsg */
1459c349dbc7Sjsg struct dmub_cmd_enable_disp_power_gating_data {
14605ca02815Sjsg struct enable_disp_power_gating_parameters_v2_1 pwr; /**< payload */
1461c349dbc7Sjsg };
1462c349dbc7Sjsg
14635ca02815Sjsg /**
14645ca02815Sjsg * struct dmub_rb_cmd_enable_disp_power_gating - Display power command.
14655ca02815Sjsg */
1466c349dbc7Sjsg struct dmub_rb_cmd_enable_disp_power_gating {
14675ca02815Sjsg struct dmub_cmd_header header; /**< header */
14685ca02815Sjsg struct dmub_cmd_enable_disp_power_gating_data power_gating; /**< payload */
1469c349dbc7Sjsg };
1470c349dbc7Sjsg
14715ca02815Sjsg /**
14725ca02815Sjsg * struct dmub_dig_transmitter_control_data_v1_7 - Transmitter control.
14735ca02815Sjsg */
14745ca02815Sjsg struct dmub_dig_transmitter_control_data_v1_7 {
14755ca02815Sjsg uint8_t phyid; /**< 0=UNIPHYA, 1=UNIPHYB, 2=UNIPHYC, 3=UNIPHYD, 4=UNIPHYE, 5=UNIPHYF */
14765ca02815Sjsg uint8_t action; /**< Defined as ATOM_TRANSMITER_ACTION_xxx */
14775ca02815Sjsg union {
14785ca02815Sjsg uint8_t digmode; /**< enum atom_encode_mode_def */
14795ca02815Sjsg uint8_t dplaneset; /**< DP voltage swing and pre-emphasis value, "DP_LANE_SET__xDB_y_zV" */
14805ca02815Sjsg } mode_laneset;
14815ca02815Sjsg uint8_t lanenum; /**< Number of lanes */
14825ca02815Sjsg union {
14835ca02815Sjsg uint32_t symclk_10khz; /**< Symbol Clock in 10Khz */
14845ca02815Sjsg } symclk_units;
14855ca02815Sjsg uint8_t hpdsel; /**< =1: HPD1, =2: HPD2, ..., =6: HPD6, =0: HPD is not assigned */
14865ca02815Sjsg uint8_t digfe_sel; /**< DIG front-end selection, bit0 means DIG0 FE is enabled */
14875ca02815Sjsg uint8_t connobj_id; /**< Connector Object Id defined in ObjectId.h */
14881bb76ff1Sjsg uint8_t HPO_instance; /**< HPO instance (0: inst0, 1: inst1) */
14895ca02815Sjsg uint8_t reserved1; /**< For future use */
14905ca02815Sjsg uint8_t reserved2[3]; /**< For future use */
14915ca02815Sjsg uint32_t reserved3[11]; /**< For future use */
1492c349dbc7Sjsg };
1493c349dbc7Sjsg
14945ca02815Sjsg /**
14955ca02815Sjsg * union dmub_cmd_dig1_transmitter_control_data - Transmitter control data.
14965ca02815Sjsg */
14975ca02815Sjsg union dmub_cmd_dig1_transmitter_control_data {
14985ca02815Sjsg struct dig_transmitter_control_parameters_v1_6 dig; /**< payload */
14995ca02815Sjsg struct dmub_dig_transmitter_control_data_v1_7 dig_v1_7; /**< payload 1.7 */
15005ca02815Sjsg };
15015ca02815Sjsg
15025ca02815Sjsg /**
15035ca02815Sjsg * struct dmub_rb_cmd_dig1_transmitter_control - Transmitter control command.
15045ca02815Sjsg */
1505c349dbc7Sjsg struct dmub_rb_cmd_dig1_transmitter_control {
15065ca02815Sjsg struct dmub_cmd_header header; /**< header */
15075ca02815Sjsg union dmub_cmd_dig1_transmitter_control_data transmitter_control; /**< payload */
1508c349dbc7Sjsg };
1509c349dbc7Sjsg
15105ca02815Sjsg /**
151118b3e4ddSjsg * struct dmub_rb_cmd_domain_control_data - Data for DOMAIN power control
151218b3e4ddSjsg */
151318b3e4ddSjsg struct dmub_rb_cmd_domain_control_data {
151418b3e4ddSjsg uint8_t inst : 6; /**< DOMAIN instance to control */
151518b3e4ddSjsg uint8_t power_gate : 1; /**< 1=power gate, 0=power up */
151618b3e4ddSjsg uint8_t reserved[3]; /**< Reserved for future use */
151718b3e4ddSjsg };
151818b3e4ddSjsg
151918b3e4ddSjsg /**
152018b3e4ddSjsg * struct dmub_rb_cmd_domain_control - Controls DOMAIN power gating
152118b3e4ddSjsg */
152218b3e4ddSjsg struct dmub_rb_cmd_domain_control {
152318b3e4ddSjsg struct dmub_cmd_header header; /**< header */
152418b3e4ddSjsg struct dmub_rb_cmd_domain_control_data data; /**< payload */
152518b3e4ddSjsg };
152618b3e4ddSjsg
152718b3e4ddSjsg /**
15281bb76ff1Sjsg * DPIA tunnel command parameters.
15291bb76ff1Sjsg */
15301bb76ff1Sjsg struct dmub_cmd_dig_dpia_control_data {
15311bb76ff1Sjsg uint8_t enc_id; /** 0 = ENGINE_ID_DIGA, ... */
15321bb76ff1Sjsg uint8_t action; /** ATOM_TRANSMITER_ACTION_DISABLE/ENABLE/SETUP_VSEMPH */
15331bb76ff1Sjsg union {
15341bb76ff1Sjsg uint8_t digmode; /** enum atom_encode_mode_def */
15351bb76ff1Sjsg uint8_t dplaneset; /** DP voltage swing and pre-emphasis value */
15361bb76ff1Sjsg } mode_laneset;
15371bb76ff1Sjsg uint8_t lanenum; /** Lane number 1, 2, 4, 8 */
15381bb76ff1Sjsg uint32_t symclk_10khz; /** Symbol Clock in 10Khz */
15391bb76ff1Sjsg uint8_t hpdsel; /** =0: HPD is not assigned */
15401bb76ff1Sjsg uint8_t digfe_sel; /** DIG stream( front-end ) selection, bit0 - DIG0 FE */
15411bb76ff1Sjsg uint8_t dpia_id; /** Index of DPIA */
15421bb76ff1Sjsg uint8_t fec_rdy : 1;
15431bb76ff1Sjsg uint8_t reserved : 7;
15441bb76ff1Sjsg uint32_t reserved1;
15451bb76ff1Sjsg };
15461bb76ff1Sjsg
15471bb76ff1Sjsg /**
15481bb76ff1Sjsg * DMUB command for DPIA tunnel control.
15491bb76ff1Sjsg */
15501bb76ff1Sjsg struct dmub_rb_cmd_dig1_dpia_control {
15511bb76ff1Sjsg struct dmub_cmd_header header;
15521bb76ff1Sjsg struct dmub_cmd_dig_dpia_control_data dpia_control;
15531bb76ff1Sjsg };
15541bb76ff1Sjsg
15551bb76ff1Sjsg /**
15561bb76ff1Sjsg * SET_CONFIG Command Payload
15571bb76ff1Sjsg */
15581bb76ff1Sjsg struct set_config_cmd_payload {
15591bb76ff1Sjsg uint8_t msg_type; /* set config message type */
15601bb76ff1Sjsg uint8_t msg_data; /* set config message data */
15611bb76ff1Sjsg };
15621bb76ff1Sjsg
15631bb76ff1Sjsg /**
15641bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__DPIA_SET_CONFIG_ACCESS command.
15651bb76ff1Sjsg */
15661bb76ff1Sjsg struct dmub_cmd_set_config_control_data {
15671bb76ff1Sjsg struct set_config_cmd_payload cmd_pkt;
15681bb76ff1Sjsg uint8_t instance; /* DPIA instance */
15691bb76ff1Sjsg uint8_t immed_status; /* Immediate status returned in case of error */
15701bb76ff1Sjsg };
15711bb76ff1Sjsg
15721bb76ff1Sjsg /**
15731bb76ff1Sjsg * DMUB command structure for SET_CONFIG command.
15741bb76ff1Sjsg */
15751bb76ff1Sjsg struct dmub_rb_cmd_set_config_access {
15761bb76ff1Sjsg struct dmub_cmd_header header; /* header */
15771bb76ff1Sjsg struct dmub_cmd_set_config_control_data set_config_control; /* set config data */
15781bb76ff1Sjsg };
15791bb76ff1Sjsg
15801bb76ff1Sjsg /**
15811bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__DPIA_MST_ALLOC_SLOTS command.
15821bb76ff1Sjsg */
15831bb76ff1Sjsg struct dmub_cmd_mst_alloc_slots_control_data {
15841bb76ff1Sjsg uint8_t mst_alloc_slots; /* mst slots to be allotted */
15851bb76ff1Sjsg uint8_t instance; /* DPIA instance */
15861bb76ff1Sjsg uint8_t immed_status; /* Immediate status returned as there is no outbox msg posted */
15871bb76ff1Sjsg uint8_t mst_slots_in_use; /* returns slots in use for error cases */
15881bb76ff1Sjsg };
15891bb76ff1Sjsg
15901bb76ff1Sjsg /**
15911bb76ff1Sjsg * DMUB command structure for SET_ command.
15921bb76ff1Sjsg */
15931bb76ff1Sjsg struct dmub_rb_cmd_set_mst_alloc_slots {
15941bb76ff1Sjsg struct dmub_cmd_header header; /* header */
15951bb76ff1Sjsg struct dmub_cmd_mst_alloc_slots_control_data mst_slots_control; /* mst slots control */
15961bb76ff1Sjsg };
15971bb76ff1Sjsg
15981bb76ff1Sjsg /**
15991bb76ff1Sjsg * DMUB command structure for DPIA HPD int enable control.
16001bb76ff1Sjsg */
16011bb76ff1Sjsg struct dmub_rb_cmd_dpia_hpd_int_enable {
16021bb76ff1Sjsg struct dmub_cmd_header header; /* header */
16031bb76ff1Sjsg uint32_t enable; /* dpia hpd interrupt enable */
16041bb76ff1Sjsg };
16051bb76ff1Sjsg
16061bb76ff1Sjsg /**
16075ca02815Sjsg * struct dmub_rb_cmd_dpphy_init - DPPHY init.
16085ca02815Sjsg */
1609c349dbc7Sjsg struct dmub_rb_cmd_dpphy_init {
16105ca02815Sjsg struct dmub_cmd_header header; /**< header */
16115ca02815Sjsg uint8_t reserved[60]; /**< reserved bits */
1612c349dbc7Sjsg };
1613c349dbc7Sjsg
16145ca02815Sjsg /**
16155ca02815Sjsg * enum dp_aux_request_action - DP AUX request command listing.
16165ca02815Sjsg *
16175ca02815Sjsg * 4 AUX request command bits are shifted to high nibble.
16185ca02815Sjsg */
1619ad8b1aafSjsg enum dp_aux_request_action {
16205ca02815Sjsg /** I2C-over-AUX write request */
1621ad8b1aafSjsg DP_AUX_REQ_ACTION_I2C_WRITE = 0x00,
16225ca02815Sjsg /** I2C-over-AUX read request */
1623ad8b1aafSjsg DP_AUX_REQ_ACTION_I2C_READ = 0x10,
16245ca02815Sjsg /** I2C-over-AUX write status request */
1625ad8b1aafSjsg DP_AUX_REQ_ACTION_I2C_STATUS_REQ = 0x20,
16265ca02815Sjsg /** I2C-over-AUX write request with MOT=1 */
1627ad8b1aafSjsg DP_AUX_REQ_ACTION_I2C_WRITE_MOT = 0x40,
16285ca02815Sjsg /** I2C-over-AUX read request with MOT=1 */
1629ad8b1aafSjsg DP_AUX_REQ_ACTION_I2C_READ_MOT = 0x50,
16305ca02815Sjsg /** I2C-over-AUX write status request with MOT=1 */
1631ad8b1aafSjsg DP_AUX_REQ_ACTION_I2C_STATUS_REQ_MOT = 0x60,
16325ca02815Sjsg /** Native AUX write request */
1633ad8b1aafSjsg DP_AUX_REQ_ACTION_DPCD_WRITE = 0x80,
16345ca02815Sjsg /** Native AUX read request */
1635ad8b1aafSjsg DP_AUX_REQ_ACTION_DPCD_READ = 0x90
1636ad8b1aafSjsg };
1637ad8b1aafSjsg
16385ca02815Sjsg /**
16395ca02815Sjsg * enum aux_return_code_type - DP AUX process return code listing.
16405ca02815Sjsg */
16415ca02815Sjsg enum aux_return_code_type {
16425ca02815Sjsg /** AUX process succeeded */
16435ca02815Sjsg AUX_RET_SUCCESS = 0,
16445ca02815Sjsg /** AUX process failed with unknown reason */
16455ca02815Sjsg AUX_RET_ERROR_UNKNOWN,
16465ca02815Sjsg /** AUX process completed with invalid reply */
16475ca02815Sjsg AUX_RET_ERROR_INVALID_REPLY,
16485ca02815Sjsg /** AUX process timed out */
16495ca02815Sjsg AUX_RET_ERROR_TIMEOUT,
16505ca02815Sjsg /** HPD was low during AUX process */
16515ca02815Sjsg AUX_RET_ERROR_HPD_DISCON,
16525ca02815Sjsg /** Failed to acquire AUX engine */
16535ca02815Sjsg AUX_RET_ERROR_ENGINE_ACQUIRE,
16545ca02815Sjsg /** AUX request not supported */
16555ca02815Sjsg AUX_RET_ERROR_INVALID_OPERATION,
16565ca02815Sjsg /** AUX process not available */
16575ca02815Sjsg AUX_RET_ERROR_PROTOCOL_ERROR,
16585ca02815Sjsg };
16595ca02815Sjsg
16605ca02815Sjsg /**
16615ca02815Sjsg * enum aux_channel_type - DP AUX channel type listing.
16625ca02815Sjsg */
16635ca02815Sjsg enum aux_channel_type {
16645ca02815Sjsg /** AUX thru Legacy DP AUX */
16655ca02815Sjsg AUX_CHANNEL_LEGACY_DDC,
16665ca02815Sjsg /** AUX thru DPIA DP tunneling */
16675ca02815Sjsg AUX_CHANNEL_DPIA
16685ca02815Sjsg };
16695ca02815Sjsg
16705ca02815Sjsg /**
16715ca02815Sjsg * struct aux_transaction_parameters - DP AUX request transaction data
16725ca02815Sjsg */
1673ad8b1aafSjsg struct aux_transaction_parameters {
16745ca02815Sjsg uint8_t is_i2c_over_aux; /**< 0=native AUX, 1=I2C-over-AUX */
16755ca02815Sjsg uint8_t action; /**< enum dp_aux_request_action */
16765ca02815Sjsg uint8_t length; /**< DP AUX request data length */
16775ca02815Sjsg uint8_t reserved; /**< For future use */
16785ca02815Sjsg uint32_t address; /**< DP AUX address */
16795ca02815Sjsg uint8_t data[16]; /**< DP AUX write data */
1680ad8b1aafSjsg };
1681ad8b1aafSjsg
16825ca02815Sjsg /**
16835ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__DP_AUX_ACCESS command.
16845ca02815Sjsg */
1685ad8b1aafSjsg struct dmub_cmd_dp_aux_control_data {
16865ca02815Sjsg uint8_t instance; /**< AUX instance or DPIA instance */
16875ca02815Sjsg uint8_t manual_acq_rel_enable; /**< manual control for acquiring or releasing AUX channel */
16885ca02815Sjsg uint8_t sw_crc_enabled; /**< Use software CRC for tunneling packet instead of hardware CRC */
16895ca02815Sjsg uint8_t reserved0; /**< For future use */
16905ca02815Sjsg uint16_t timeout; /**< timeout time in us */
16915ca02815Sjsg uint16_t reserved1; /**< For future use */
16925ca02815Sjsg enum aux_channel_type type; /**< enum aux_channel_type */
16935ca02815Sjsg struct aux_transaction_parameters dpaux; /**< struct aux_transaction_parameters */
1694ad8b1aafSjsg };
1695ad8b1aafSjsg
16965ca02815Sjsg /**
16975ca02815Sjsg * Definition of a DMUB_CMD__DP_AUX_ACCESS command.
16985ca02815Sjsg */
1699ad8b1aafSjsg struct dmub_rb_cmd_dp_aux_access {
17005ca02815Sjsg /**
17015ca02815Sjsg * Command header.
17025ca02815Sjsg */
1703ad8b1aafSjsg struct dmub_cmd_header header;
17045ca02815Sjsg /**
17055ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__DP_AUX_ACCESS command.
17065ca02815Sjsg */
1707ad8b1aafSjsg struct dmub_cmd_dp_aux_control_data aux_control;
1708ad8b1aafSjsg };
1709ad8b1aafSjsg
17105ca02815Sjsg /**
17115ca02815Sjsg * Definition of a DMUB_CMD__OUTBOX1_ENABLE command.
17125ca02815Sjsg */
1713ad8b1aafSjsg struct dmub_rb_cmd_outbox1_enable {
17145ca02815Sjsg /**
17155ca02815Sjsg * Command header.
17165ca02815Sjsg */
1717ad8b1aafSjsg struct dmub_cmd_header header;
17185ca02815Sjsg /**
17195ca02815Sjsg * enable: 0x0 -> disable outbox1 notification (default value)
17205ca02815Sjsg * 0x1 -> enable outbox1 notification
17215ca02815Sjsg */
1722ad8b1aafSjsg uint32_t enable;
1723ad8b1aafSjsg };
1724ad8b1aafSjsg
1725ad8b1aafSjsg /* DP AUX Reply command - OutBox Cmd */
17265ca02815Sjsg /**
17275ca02815Sjsg * Data passed to driver from FW in a DMUB_OUT_CMD__DP_AUX_REPLY command.
17285ca02815Sjsg */
1729ad8b1aafSjsg struct aux_reply_data {
17305ca02815Sjsg /**
17315ca02815Sjsg * Aux cmd
17325ca02815Sjsg */
1733ad8b1aafSjsg uint8_t command;
17345ca02815Sjsg /**
17355ca02815Sjsg * Aux reply data length (max: 16 bytes)
17365ca02815Sjsg */
1737ad8b1aafSjsg uint8_t length;
17385ca02815Sjsg /**
17395ca02815Sjsg * Alignment only
17405ca02815Sjsg */
1741ad8b1aafSjsg uint8_t pad[2];
17425ca02815Sjsg /**
17435ca02815Sjsg * Aux reply data
17445ca02815Sjsg */
1745ad8b1aafSjsg uint8_t data[16];
1746ad8b1aafSjsg };
1747ad8b1aafSjsg
17485ca02815Sjsg /**
17495ca02815Sjsg * Control Data passed to driver from FW in a DMUB_OUT_CMD__DP_AUX_REPLY command.
17505ca02815Sjsg */
1751ad8b1aafSjsg struct aux_reply_control_data {
17525ca02815Sjsg /**
17535ca02815Sjsg * Reserved for future use
17545ca02815Sjsg */
1755ad8b1aafSjsg uint32_t handle;
17565ca02815Sjsg /**
17575ca02815Sjsg * Aux Instance
17585ca02815Sjsg */
17595ca02815Sjsg uint8_t instance;
17605ca02815Sjsg /**
17615ca02815Sjsg * Aux transaction result: definition in enum aux_return_code_type
17625ca02815Sjsg */
1763ad8b1aafSjsg uint8_t result;
17645ca02815Sjsg /**
17655ca02815Sjsg * Alignment only
17665ca02815Sjsg */
1767ad8b1aafSjsg uint16_t pad;
1768ad8b1aafSjsg };
1769ad8b1aafSjsg
17705ca02815Sjsg /**
17715ca02815Sjsg * Definition of a DMUB_OUT_CMD__DP_AUX_REPLY command.
17725ca02815Sjsg */
1773ad8b1aafSjsg struct dmub_rb_cmd_dp_aux_reply {
17745ca02815Sjsg /**
17755ca02815Sjsg * Command header.
17765ca02815Sjsg */
1777ad8b1aafSjsg struct dmub_cmd_header header;
17785ca02815Sjsg /**
17795ca02815Sjsg * Control Data passed to driver from FW in a DMUB_OUT_CMD__DP_AUX_REPLY command.
17805ca02815Sjsg */
1781ad8b1aafSjsg struct aux_reply_control_data control;
17825ca02815Sjsg /**
17835ca02815Sjsg * Data passed to driver from FW in a DMUB_OUT_CMD__DP_AUX_REPLY command.
17845ca02815Sjsg */
1785ad8b1aafSjsg struct aux_reply_data reply_data;
1786ad8b1aafSjsg };
1787ad8b1aafSjsg
17885ca02815Sjsg /* DP HPD Notify command - OutBox Cmd */
17895ca02815Sjsg /**
17905ca02815Sjsg * DP HPD Type
17915ca02815Sjsg */
17925ca02815Sjsg enum dp_hpd_type {
17935ca02815Sjsg /**
17945ca02815Sjsg * Normal DP HPD
17955ca02815Sjsg */
17965ca02815Sjsg DP_HPD = 0,
17975ca02815Sjsg /**
17985ca02815Sjsg * DP HPD short pulse
17995ca02815Sjsg */
18005ca02815Sjsg DP_IRQ
18015ca02815Sjsg };
18025ca02815Sjsg
18035ca02815Sjsg /**
18045ca02815Sjsg * DP HPD Status
18055ca02815Sjsg */
18065ca02815Sjsg enum dp_hpd_status {
18075ca02815Sjsg /**
18085ca02815Sjsg * DP_HPD status low
18095ca02815Sjsg */
18105ca02815Sjsg DP_HPD_UNPLUG = 0,
18115ca02815Sjsg /**
18125ca02815Sjsg * DP_HPD status high
18135ca02815Sjsg */
18145ca02815Sjsg DP_HPD_PLUG
18155ca02815Sjsg };
18165ca02815Sjsg
18175ca02815Sjsg /**
18185ca02815Sjsg * Data passed to driver from FW in a DMUB_OUT_CMD__DP_HPD_NOTIFY command.
18195ca02815Sjsg */
1820ad8b1aafSjsg struct dp_hpd_data {
18215ca02815Sjsg /**
18225ca02815Sjsg * DP HPD instance
18235ca02815Sjsg */
18245ca02815Sjsg uint8_t instance;
18255ca02815Sjsg /**
18265ca02815Sjsg * HPD type
18275ca02815Sjsg */
1828ad8b1aafSjsg uint8_t hpd_type;
18295ca02815Sjsg /**
18305ca02815Sjsg * HPD status: only for type: DP_HPD to indicate status
18315ca02815Sjsg */
1832ad8b1aafSjsg uint8_t hpd_status;
18335ca02815Sjsg /**
18345ca02815Sjsg * Alignment only
18355ca02815Sjsg */
1836ad8b1aafSjsg uint8_t pad;
1837ad8b1aafSjsg };
1838ad8b1aafSjsg
18395ca02815Sjsg /**
18405ca02815Sjsg * Definition of a DMUB_OUT_CMD__DP_HPD_NOTIFY command.
18415ca02815Sjsg */
1842ad8b1aafSjsg struct dmub_rb_cmd_dp_hpd_notify {
18435ca02815Sjsg /**
18445ca02815Sjsg * Command header.
18455ca02815Sjsg */
1846ad8b1aafSjsg struct dmub_cmd_header header;
18475ca02815Sjsg /**
18485ca02815Sjsg * Data passed to driver from FW in a DMUB_OUT_CMD__DP_HPD_NOTIFY command.
18495ca02815Sjsg */
1850ad8b1aafSjsg struct dp_hpd_data hpd_data;
1851ad8b1aafSjsg };
1852ad8b1aafSjsg
18531bb76ff1Sjsg /**
18541bb76ff1Sjsg * Definition of a SET_CONFIG reply from DPOA.
18551bb76ff1Sjsg */
18561bb76ff1Sjsg enum set_config_status {
18571bb76ff1Sjsg SET_CONFIG_PENDING = 0,
18581bb76ff1Sjsg SET_CONFIG_ACK_RECEIVED,
18591bb76ff1Sjsg SET_CONFIG_RX_TIMEOUT,
18601bb76ff1Sjsg SET_CONFIG_UNKNOWN_ERROR,
18611bb76ff1Sjsg };
18621bb76ff1Sjsg
18631bb76ff1Sjsg /**
18641bb76ff1Sjsg * Definition of a set_config reply
18651bb76ff1Sjsg */
18661bb76ff1Sjsg struct set_config_reply_control_data {
18671bb76ff1Sjsg uint8_t instance; /* DPIA Instance */
18681bb76ff1Sjsg uint8_t status; /* Set Config reply */
18691bb76ff1Sjsg uint16_t pad; /* Alignment */
18701bb76ff1Sjsg };
18711bb76ff1Sjsg
18721bb76ff1Sjsg /**
18731bb76ff1Sjsg * Definition of a DMUB_OUT_CMD__SET_CONFIG_REPLY command.
18741bb76ff1Sjsg */
18751bb76ff1Sjsg struct dmub_rb_cmd_dp_set_config_reply {
18761bb76ff1Sjsg struct dmub_cmd_header header;
18771bb76ff1Sjsg struct set_config_reply_control_data set_config_reply_control;
18781bb76ff1Sjsg };
18791bb76ff1Sjsg
18801bb76ff1Sjsg /**
1881f005ef32Sjsg * Definition of a DPIA notification header
1882f005ef32Sjsg */
1883f005ef32Sjsg struct dpia_notification_header {
1884f005ef32Sjsg uint8_t instance; /**< DPIA Instance */
1885f005ef32Sjsg uint8_t reserved[3];
1886f005ef32Sjsg enum dmub_cmd_dpia_notification_type type; /**< DPIA notification type */
1887f005ef32Sjsg };
1888f005ef32Sjsg
1889f005ef32Sjsg /**
1890f005ef32Sjsg * Definition of the common data struct of DPIA notification
1891f005ef32Sjsg */
1892f005ef32Sjsg struct dpia_notification_common {
1893f005ef32Sjsg uint8_t cmd_buffer[DMUB_RB_CMD_SIZE - sizeof(struct dmub_cmd_header)
1894f005ef32Sjsg - sizeof(struct dpia_notification_header)];
1895f005ef32Sjsg };
1896f005ef32Sjsg
1897f005ef32Sjsg /**
1898f005ef32Sjsg * Definition of a DPIA notification data
1899f005ef32Sjsg */
1900f005ef32Sjsg struct dpia_bw_allocation_notify_data {
1901f005ef32Sjsg union {
1902f005ef32Sjsg struct {
1903f005ef32Sjsg uint16_t cm_bw_alloc_support: 1; /**< USB4 CM BW Allocation mode support */
1904f005ef32Sjsg uint16_t bw_request_failed: 1; /**< BW_Request_Failed */
1905f005ef32Sjsg uint16_t bw_request_succeeded: 1; /**< BW_Request_Succeeded */
1906f005ef32Sjsg uint16_t est_bw_changed: 1; /**< Estimated_BW changed */
1907f005ef32Sjsg uint16_t bw_alloc_cap_changed: 1; /**< BW_Allocation_Capabiity_Changed */
1908f005ef32Sjsg uint16_t reserved: 11; /**< Reserved */
1909f005ef32Sjsg } bits;
1910f005ef32Sjsg
1911f005ef32Sjsg uint16_t flags;
1912f005ef32Sjsg };
1913f005ef32Sjsg
1914f005ef32Sjsg uint8_t cm_id; /**< CM ID */
1915f005ef32Sjsg uint8_t group_id; /**< Group ID */
1916f005ef32Sjsg uint8_t granularity; /**< BW Allocation Granularity */
1917f005ef32Sjsg uint8_t estimated_bw; /**< Estimated_BW */
1918f005ef32Sjsg uint8_t allocated_bw; /**< Allocated_BW */
1919f005ef32Sjsg uint8_t reserved;
1920f005ef32Sjsg };
1921f005ef32Sjsg
1922f005ef32Sjsg /**
1923f005ef32Sjsg * union dpia_notify_data_type - DPIA Notification in Outbox command
1924f005ef32Sjsg */
1925f005ef32Sjsg union dpia_notification_data {
1926f005ef32Sjsg /**
1927f005ef32Sjsg * DPIA Notification for common data struct
1928f005ef32Sjsg */
1929f005ef32Sjsg struct dpia_notification_common common_data;
1930f005ef32Sjsg
1931f005ef32Sjsg /**
1932f005ef32Sjsg * DPIA Notification for DP BW Allocation support
1933f005ef32Sjsg */
1934f005ef32Sjsg struct dpia_bw_allocation_notify_data dpia_bw_alloc;
1935f005ef32Sjsg };
1936f005ef32Sjsg
1937f005ef32Sjsg /**
1938f005ef32Sjsg * Definition of a DPIA notification payload
1939f005ef32Sjsg */
1940f005ef32Sjsg struct dpia_notification_payload {
1941f005ef32Sjsg struct dpia_notification_header header;
1942f005ef32Sjsg union dpia_notification_data data; /**< DPIA notification payload data */
1943f005ef32Sjsg };
1944f005ef32Sjsg
1945f005ef32Sjsg /**
1946f005ef32Sjsg * Definition of a DMUB_OUT_CMD__DPIA_NOTIFICATION command.
1947f005ef32Sjsg */
1948f005ef32Sjsg struct dmub_rb_cmd_dpia_notification {
1949f005ef32Sjsg struct dmub_cmd_header header; /**< DPIA notification header */
1950f005ef32Sjsg struct dpia_notification_payload payload; /**< DPIA notification payload */
1951f005ef32Sjsg };
1952f005ef32Sjsg
1953f005ef32Sjsg /**
19541bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__QUERY_HPD_STATE command.
19551bb76ff1Sjsg */
19561bb76ff1Sjsg struct dmub_cmd_hpd_state_query_data {
19571bb76ff1Sjsg uint8_t instance; /**< HPD instance or DPIA instance */
19581bb76ff1Sjsg uint8_t result; /**< For returning HPD state */
19591bb76ff1Sjsg uint16_t pad; /** < Alignment */
19601bb76ff1Sjsg enum aux_channel_type ch_type; /**< enum aux_channel_type */
19611bb76ff1Sjsg enum aux_return_code_type status; /**< for returning the status of command */
19621bb76ff1Sjsg };
19631bb76ff1Sjsg
19641bb76ff1Sjsg /**
19651bb76ff1Sjsg * Definition of a DMUB_CMD__QUERY_HPD_STATE command.
19661bb76ff1Sjsg */
19671bb76ff1Sjsg struct dmub_rb_cmd_query_hpd_state {
19681bb76ff1Sjsg /**
19691bb76ff1Sjsg * Command header.
19701bb76ff1Sjsg */
19711bb76ff1Sjsg struct dmub_cmd_header header;
19721bb76ff1Sjsg /**
19731bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__QUERY_HPD_STATE command.
19741bb76ff1Sjsg */
19751bb76ff1Sjsg struct dmub_cmd_hpd_state_query_data data;
19761bb76ff1Sjsg };
19771bb76ff1Sjsg
1978ad8b1aafSjsg /*
1979ad8b1aafSjsg * Command IDs should be treated as stable ABI.
1980ad8b1aafSjsg * Do not reuse or modify IDs.
1981ad8b1aafSjsg */
1982ad8b1aafSjsg
19835ca02815Sjsg /**
19845ca02815Sjsg * PSR command sub-types.
19855ca02815Sjsg */
1986ad8b1aafSjsg enum dmub_cmd_psr_type {
19875ca02815Sjsg /**
19885ca02815Sjsg * Set PSR version support.
19895ca02815Sjsg */
1990ad8b1aafSjsg DMUB_CMD__PSR_SET_VERSION = 0,
19915ca02815Sjsg /**
19925ca02815Sjsg * Copy driver-calculated parameters to PSR state.
19935ca02815Sjsg */
1994ad8b1aafSjsg DMUB_CMD__PSR_COPY_SETTINGS = 1,
19955ca02815Sjsg /**
19965ca02815Sjsg * Enable PSR.
19975ca02815Sjsg */
1998ad8b1aafSjsg DMUB_CMD__PSR_ENABLE = 2,
19995ca02815Sjsg
20005ca02815Sjsg /**
20015ca02815Sjsg * Disable PSR.
20025ca02815Sjsg */
2003ad8b1aafSjsg DMUB_CMD__PSR_DISABLE = 3,
20045ca02815Sjsg
20055ca02815Sjsg /**
20065ca02815Sjsg * Set PSR level.
20075ca02815Sjsg * PSR level is a 16-bit value dicated by driver that
20085ca02815Sjsg * will enable/disable different functionality.
20095ca02815Sjsg */
2010ad8b1aafSjsg DMUB_CMD__PSR_SET_LEVEL = 4,
20115ca02815Sjsg
20125ca02815Sjsg /**
20135ca02815Sjsg * Forces PSR enabled until an explicit PSR disable call.
20145ca02815Sjsg */
20155ca02815Sjsg DMUB_CMD__PSR_FORCE_STATIC = 5,
20161bb76ff1Sjsg /**
20171bb76ff1Sjsg * Set vtotal in psr active for FreeSync PSR.
20181bb76ff1Sjsg */
20191bb76ff1Sjsg DMUB_CMD__SET_SINK_VTOTAL_IN_PSR_ACTIVE = 6,
20201bb76ff1Sjsg /**
20211bb76ff1Sjsg * Set PSR power option
20221bb76ff1Sjsg */
20231bb76ff1Sjsg DMUB_CMD__SET_PSR_POWER_OPT = 7,
20241bb76ff1Sjsg };
20251bb76ff1Sjsg
20261bb76ff1Sjsg enum dmub_cmd_fams_type {
20271bb76ff1Sjsg DMUB_CMD__FAMS_SETUP_FW_CTRL = 0,
20281bb76ff1Sjsg DMUB_CMD__FAMS_DRR_UPDATE = 1,
20291bb76ff1Sjsg DMUB_CMD__HANDLE_SUBVP_CMD = 2, // specifically for SubVP cmd
20301bb76ff1Sjsg /**
20311bb76ff1Sjsg * For SubVP set manual trigger in FW because it
20321bb76ff1Sjsg * triggers DRR_UPDATE_PENDING which SubVP relies
20331bb76ff1Sjsg * on (for any SubVP cases that use a DRR display)
20341bb76ff1Sjsg */
20351bb76ff1Sjsg DMUB_CMD__FAMS_SET_MANUAL_TRIGGER = 3,
2036ad8b1aafSjsg };
2037ad8b1aafSjsg
20385ca02815Sjsg /**
20395ca02815Sjsg * PSR versions.
20405ca02815Sjsg */
2041ad8b1aafSjsg enum psr_version {
20425ca02815Sjsg /**
20435ca02815Sjsg * PSR version 1.
20445ca02815Sjsg */
2045ad8b1aafSjsg PSR_VERSION_1 = 0,
20465ca02815Sjsg /**
20471bb76ff1Sjsg * Freesync PSR SU.
20481bb76ff1Sjsg */
20491bb76ff1Sjsg PSR_VERSION_SU_1 = 1,
20501bb76ff1Sjsg /**
20515ca02815Sjsg * PSR not supported.
20525ca02815Sjsg */
2053ad8b1aafSjsg PSR_VERSION_UNSUPPORTED = 0xFFFFFFFF,
2054ad8b1aafSjsg };
2055ad8b1aafSjsg
20565ca02815Sjsg /**
20575ca02815Sjsg * enum dmub_cmd_mall_type - MALL commands
20585ca02815Sjsg */
20595ca02815Sjsg enum dmub_cmd_mall_type {
20605ca02815Sjsg /**
20615ca02815Sjsg * Allows display refresh from MALL.
20625ca02815Sjsg */
20635ca02815Sjsg DMUB_CMD__MALL_ACTION_ALLOW = 0,
20645ca02815Sjsg /**
20655ca02815Sjsg * Disallows display refresh from MALL.
20665ca02815Sjsg */
20675ca02815Sjsg DMUB_CMD__MALL_ACTION_DISALLOW = 1,
20685ca02815Sjsg /**
20695ca02815Sjsg * Cursor copy for MALL.
20705ca02815Sjsg */
20715ca02815Sjsg DMUB_CMD__MALL_ACTION_COPY_CURSOR = 2,
20725ca02815Sjsg /**
20735ca02815Sjsg * Controls DF requests.
20745ca02815Sjsg */
20755ca02815Sjsg DMUB_CMD__MALL_ACTION_NO_DF_REQ = 3,
2076c349dbc7Sjsg };
2077c349dbc7Sjsg
20781bb76ff1Sjsg /**
20791bb76ff1Sjsg * PHY Link rate for DP.
20801bb76ff1Sjsg */
20811bb76ff1Sjsg enum phy_link_rate {
20821bb76ff1Sjsg /**
20831bb76ff1Sjsg * not supported.
20841bb76ff1Sjsg */
20851bb76ff1Sjsg PHY_RATE_UNKNOWN = 0,
20861bb76ff1Sjsg /**
20871bb76ff1Sjsg * Rate_1 (RBR) - 1.62 Gbps/Lane
20881bb76ff1Sjsg */
20891bb76ff1Sjsg PHY_RATE_162 = 1,
20901bb76ff1Sjsg /**
20911bb76ff1Sjsg * Rate_2 - 2.16 Gbps/Lane
20921bb76ff1Sjsg */
20931bb76ff1Sjsg PHY_RATE_216 = 2,
20941bb76ff1Sjsg /**
20951bb76ff1Sjsg * Rate_3 - 2.43 Gbps/Lane
20961bb76ff1Sjsg */
20971bb76ff1Sjsg PHY_RATE_243 = 3,
20981bb76ff1Sjsg /**
20991bb76ff1Sjsg * Rate_4 (HBR) - 2.70 Gbps/Lane
21001bb76ff1Sjsg */
21011bb76ff1Sjsg PHY_RATE_270 = 4,
21021bb76ff1Sjsg /**
21031bb76ff1Sjsg * Rate_5 (RBR2)- 3.24 Gbps/Lane
21041bb76ff1Sjsg */
21051bb76ff1Sjsg PHY_RATE_324 = 5,
21061bb76ff1Sjsg /**
21071bb76ff1Sjsg * Rate_6 - 4.32 Gbps/Lane
21081bb76ff1Sjsg */
21091bb76ff1Sjsg PHY_RATE_432 = 6,
21101bb76ff1Sjsg /**
21111bb76ff1Sjsg * Rate_7 (HBR2)- 5.40 Gbps/Lane
21121bb76ff1Sjsg */
21131bb76ff1Sjsg PHY_RATE_540 = 7,
21141bb76ff1Sjsg /**
21151bb76ff1Sjsg * Rate_8 (HBR3)- 8.10 Gbps/Lane
21161bb76ff1Sjsg */
21171bb76ff1Sjsg PHY_RATE_810 = 8,
21181bb76ff1Sjsg /**
21191bb76ff1Sjsg * UHBR10 - 10.0 Gbps/Lane
21201bb76ff1Sjsg */
21211bb76ff1Sjsg PHY_RATE_1000 = 9,
21221bb76ff1Sjsg /**
21231bb76ff1Sjsg * UHBR13.5 - 13.5 Gbps/Lane
21241bb76ff1Sjsg */
21251bb76ff1Sjsg PHY_RATE_1350 = 10,
21261bb76ff1Sjsg /**
21271bb76ff1Sjsg * UHBR10 - 20.0 Gbps/Lane
21281bb76ff1Sjsg */
21291bb76ff1Sjsg PHY_RATE_2000 = 11,
21301bb76ff1Sjsg };
21311bb76ff1Sjsg
21321bb76ff1Sjsg /**
21331bb76ff1Sjsg * enum dmub_phy_fsm_state - PHY FSM states.
21341bb76ff1Sjsg * PHY FSM state to transit to during PSR enable/disable.
21351bb76ff1Sjsg */
21361bb76ff1Sjsg enum dmub_phy_fsm_state {
21371bb76ff1Sjsg DMUB_PHY_FSM_POWER_UP_DEFAULT = 0,
21381bb76ff1Sjsg DMUB_PHY_FSM_RESET,
21391bb76ff1Sjsg DMUB_PHY_FSM_RESET_RELEASED,
21401bb76ff1Sjsg DMUB_PHY_FSM_SRAM_LOAD_DONE,
21411bb76ff1Sjsg DMUB_PHY_FSM_INITIALIZED,
21421bb76ff1Sjsg DMUB_PHY_FSM_CALIBRATED,
21431bb76ff1Sjsg DMUB_PHY_FSM_CALIBRATED_LP,
21441bb76ff1Sjsg DMUB_PHY_FSM_CALIBRATED_PG,
21451bb76ff1Sjsg DMUB_PHY_FSM_POWER_DOWN,
21461bb76ff1Sjsg DMUB_PHY_FSM_PLL_EN,
21471bb76ff1Sjsg DMUB_PHY_FSM_TX_EN,
21481bb76ff1Sjsg DMUB_PHY_FSM_FAST_LP,
2149f005ef32Sjsg DMUB_PHY_FSM_P2_PLL_OFF_CPM,
2150f005ef32Sjsg DMUB_PHY_FSM_P2_PLL_OFF_PG,
2151f005ef32Sjsg DMUB_PHY_FSM_P2_PLL_OFF,
2152f005ef32Sjsg DMUB_PHY_FSM_P2_PLL_ON,
21531bb76ff1Sjsg };
21545ca02815Sjsg
21555ca02815Sjsg /**
21565ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__PSR_COPY_SETTINGS command.
21575ca02815Sjsg */
21585ca02815Sjsg struct dmub_cmd_psr_copy_settings_data {
21595ca02815Sjsg /**
21605ca02815Sjsg * Flags that can be set by driver to change some PSR behaviour.
21615ca02815Sjsg */
21625ca02815Sjsg union dmub_psr_debug_flags debug;
21635ca02815Sjsg /**
21645ca02815Sjsg * 16-bit value dicated by driver that will enable/disable different functionality.
21655ca02815Sjsg */
21665ca02815Sjsg uint16_t psr_level;
21675ca02815Sjsg /**
21685ca02815Sjsg * DPP HW instance.
21695ca02815Sjsg */
21705ca02815Sjsg uint8_t dpp_inst;
21715ca02815Sjsg /**
21725ca02815Sjsg * MPCC HW instance.
21735ca02815Sjsg * Not used in dmub fw,
21745ca02815Sjsg * dmub fw will get active opp by reading odm registers.
21755ca02815Sjsg */
21765ca02815Sjsg uint8_t mpcc_inst;
21775ca02815Sjsg /**
21785ca02815Sjsg * OPP HW instance.
21795ca02815Sjsg * Not used in dmub fw,
21805ca02815Sjsg * dmub fw will get active opp by reading odm registers.
21815ca02815Sjsg */
21825ca02815Sjsg uint8_t opp_inst;
21835ca02815Sjsg /**
21845ca02815Sjsg * OTG HW instance.
21855ca02815Sjsg */
21865ca02815Sjsg uint8_t otg_inst;
21875ca02815Sjsg /**
21885ca02815Sjsg * DIG FE HW instance.
21895ca02815Sjsg */
21905ca02815Sjsg uint8_t digfe_inst;
21915ca02815Sjsg /**
21925ca02815Sjsg * DIG BE HW instance.
21935ca02815Sjsg */
21945ca02815Sjsg uint8_t digbe_inst;
21955ca02815Sjsg /**
21965ca02815Sjsg * DP PHY HW instance.
21975ca02815Sjsg */
21985ca02815Sjsg uint8_t dpphy_inst;
21995ca02815Sjsg /**
22005ca02815Sjsg * AUX HW instance.
22015ca02815Sjsg */
22025ca02815Sjsg uint8_t aux_inst;
22035ca02815Sjsg /**
22045ca02815Sjsg * Determines if SMU optimzations are enabled/disabled.
22055ca02815Sjsg */
22065ca02815Sjsg uint8_t smu_optimizations_en;
22075ca02815Sjsg /**
22085ca02815Sjsg * Unused.
22095ca02815Sjsg * TODO: Remove.
22105ca02815Sjsg */
22115ca02815Sjsg uint8_t frame_delay;
22125ca02815Sjsg /**
22135ca02815Sjsg * If RFB setup time is greater than the total VBLANK time,
22145ca02815Sjsg * it is not possible for the sink to capture the video frame
22155ca02815Sjsg * in the same frame the SDP is sent. In this case,
22165ca02815Sjsg * the frame capture indication bit should be set and an extra
22175ca02815Sjsg * static frame should be transmitted to the sink.
22185ca02815Sjsg */
22195ca02815Sjsg uint8_t frame_cap_ind;
22205ca02815Sjsg /**
22211bb76ff1Sjsg * Granularity of Y offset supported by sink.
22225ca02815Sjsg */
22231bb76ff1Sjsg uint8_t su_y_granularity;
22241bb76ff1Sjsg /**
22251bb76ff1Sjsg * Indicates whether sink should start capturing
22261bb76ff1Sjsg * immediately following active scan line,
22271bb76ff1Sjsg * or starting with the 2nd active scan line.
22281bb76ff1Sjsg */
22291bb76ff1Sjsg uint8_t line_capture_indication;
22305ca02815Sjsg /**
22315ca02815Sjsg * Multi-display optimizations are implemented on certain ASICs.
22325ca02815Sjsg */
22335ca02815Sjsg uint8_t multi_disp_optimizations_en;
22345ca02815Sjsg /**
22355ca02815Sjsg * The last possible line SDP may be transmitted without violating
22365ca02815Sjsg * the RFB setup time or entering the active video frame.
22375ca02815Sjsg */
22385ca02815Sjsg uint16_t init_sdp_deadline;
22395ca02815Sjsg /**
22401bb76ff1Sjsg * @ rate_control_caps : Indicate FreeSync PSR Sink Capabilities
22415ca02815Sjsg */
22421bb76ff1Sjsg uint8_t rate_control_caps ;
22431bb76ff1Sjsg /*
22441bb76ff1Sjsg * Force PSRSU always doing full frame update
22451bb76ff1Sjsg */
22461bb76ff1Sjsg uint8_t force_ffu_mode;
22475ca02815Sjsg /**
22485ca02815Sjsg * Length of each horizontal line in us.
22495ca02815Sjsg */
22505ca02815Sjsg uint32_t line_time_in_us;
22515ca02815Sjsg /**
22525ca02815Sjsg * FEC enable status in driver
22535ca02815Sjsg */
22545ca02815Sjsg uint8_t fec_enable_status;
22555ca02815Sjsg /**
22565ca02815Sjsg * FEC re-enable delay when PSR exit.
22575ca02815Sjsg * unit is 100us, range form 0~255(0xFF).
22585ca02815Sjsg */
22595ca02815Sjsg uint8_t fec_enable_delay_in100us;
22605ca02815Sjsg /**
22615ca02815Sjsg * PSR control version.
22625ca02815Sjsg */
22635ca02815Sjsg uint8_t cmd_version;
22645ca02815Sjsg /**
22655ca02815Sjsg * Panel Instance.
2266f005ef32Sjsg * Panel instance to identify which psr_state to use
22675ca02815Sjsg * Currently the support is only for 0 or 1
22685ca02815Sjsg */
22695ca02815Sjsg uint8_t panel_inst;
22701bb76ff1Sjsg /*
22711bb76ff1Sjsg * DSC enable status in driver
22725ca02815Sjsg */
22731bb76ff1Sjsg uint8_t dsc_enable_status;
22741bb76ff1Sjsg /*
22751bb76ff1Sjsg * Use FSM state for PSR power up/down
22761bb76ff1Sjsg */
22771bb76ff1Sjsg uint8_t use_phy_fsm;
22781bb76ff1Sjsg /**
2279f005ef32Sjsg * frame delay for frame re-lock
2280f005ef32Sjsg */
2281f005ef32Sjsg uint8_t relock_delay_frame_cnt;
2282f005ef32Sjsg /**
22831bb76ff1Sjsg * Explicit padding to 2 byte boundary.
22841bb76ff1Sjsg */
2285f005ef32Sjsg uint8_t pad3;
2286f005ef32Sjsg /**
2287f005ef32Sjsg * DSC Slice height.
2288f005ef32Sjsg */
2289f005ef32Sjsg uint16_t dsc_slice_height;
2290f005ef32Sjsg /**
2291f005ef32Sjsg * Explicit padding to 4 byte boundary.
2292f005ef32Sjsg */
2293f005ef32Sjsg uint16_t pad;
22945ca02815Sjsg };
22955ca02815Sjsg
22965ca02815Sjsg /**
22975ca02815Sjsg * Definition of a DMUB_CMD__PSR_COPY_SETTINGS command.
22985ca02815Sjsg */
2299c349dbc7Sjsg struct dmub_rb_cmd_psr_copy_settings {
23005ca02815Sjsg /**
23015ca02815Sjsg * Command header.
23025ca02815Sjsg */
2303c349dbc7Sjsg struct dmub_cmd_header header;
23045ca02815Sjsg /**
23055ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__PSR_COPY_SETTINGS command.
23065ca02815Sjsg */
2307c349dbc7Sjsg struct dmub_cmd_psr_copy_settings_data psr_copy_settings_data;
2308c349dbc7Sjsg };
2309c349dbc7Sjsg
23105ca02815Sjsg /**
23115ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__PSR_SET_LEVEL command.
23125ca02815Sjsg */
2313c349dbc7Sjsg struct dmub_cmd_psr_set_level_data {
23145ca02815Sjsg /**
23155ca02815Sjsg * 16-bit value dicated by driver that will enable/disable different functionality.
23165ca02815Sjsg */
2317c349dbc7Sjsg uint16_t psr_level;
23185ca02815Sjsg /**
23195ca02815Sjsg * PSR control version.
23205ca02815Sjsg */
23215ca02815Sjsg uint8_t cmd_version;
23225ca02815Sjsg /**
23235ca02815Sjsg * Panel Instance.
2324f005ef32Sjsg * Panel instance to identify which psr_state to use
23255ca02815Sjsg * Currently the support is only for 0 or 1
23265ca02815Sjsg */
23275ca02815Sjsg uint8_t panel_inst;
2328c349dbc7Sjsg };
2329c349dbc7Sjsg
23305ca02815Sjsg /**
23315ca02815Sjsg * Definition of a DMUB_CMD__PSR_SET_LEVEL command.
23325ca02815Sjsg */
2333c349dbc7Sjsg struct dmub_rb_cmd_psr_set_level {
23345ca02815Sjsg /**
23355ca02815Sjsg * Command header.
23365ca02815Sjsg */
2337c349dbc7Sjsg struct dmub_cmd_header header;
23385ca02815Sjsg /**
23395ca02815Sjsg * Definition of a DMUB_CMD__PSR_SET_LEVEL command.
23405ca02815Sjsg */
2341c349dbc7Sjsg struct dmub_cmd_psr_set_level_data psr_set_level_data;
2342c349dbc7Sjsg };
2343c349dbc7Sjsg
23445ca02815Sjsg struct dmub_rb_cmd_psr_enable_data {
23455ca02815Sjsg /**
23465ca02815Sjsg * PSR control version.
23475ca02815Sjsg */
23485ca02815Sjsg uint8_t cmd_version;
23495ca02815Sjsg /**
23505ca02815Sjsg * Panel Instance.
2351f005ef32Sjsg * Panel instance to identify which psr_state to use
23525ca02815Sjsg * Currently the support is only for 0 or 1
23535ca02815Sjsg */
23545ca02815Sjsg uint8_t panel_inst;
23555ca02815Sjsg /**
23561bb76ff1Sjsg * Phy state to enter.
23571bb76ff1Sjsg * Values to use are defined in dmub_phy_fsm_state
23585ca02815Sjsg */
23591bb76ff1Sjsg uint8_t phy_fsm_state;
23601bb76ff1Sjsg /**
23611bb76ff1Sjsg * Phy rate for DP - RBR/HBR/HBR2/HBR3.
23621bb76ff1Sjsg * Set this using enum phy_link_rate.
23631bb76ff1Sjsg * This does not support HDMI/DP2 for now.
23641bb76ff1Sjsg */
23651bb76ff1Sjsg uint8_t phy_rate;
23665ca02815Sjsg };
23675ca02815Sjsg
23685ca02815Sjsg /**
23695ca02815Sjsg * Definition of a DMUB_CMD__PSR_ENABLE command.
23705ca02815Sjsg * PSR enable/disable is controlled using the sub_type.
23715ca02815Sjsg */
2372c349dbc7Sjsg struct dmub_rb_cmd_psr_enable {
23735ca02815Sjsg /**
23745ca02815Sjsg * Command header.
23755ca02815Sjsg */
2376c349dbc7Sjsg struct dmub_cmd_header header;
23775ca02815Sjsg
23785ca02815Sjsg struct dmub_rb_cmd_psr_enable_data data;
2379c349dbc7Sjsg };
2380c349dbc7Sjsg
23815ca02815Sjsg /**
23825ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__PSR_SET_VERSION command.
23835ca02815Sjsg */
2384c349dbc7Sjsg struct dmub_cmd_psr_set_version_data {
23855ca02815Sjsg /**
23865ca02815Sjsg * PSR version that FW should implement.
23875ca02815Sjsg */
23885ca02815Sjsg enum psr_version version;
23895ca02815Sjsg /**
23905ca02815Sjsg * PSR control version.
23915ca02815Sjsg */
23925ca02815Sjsg uint8_t cmd_version;
23935ca02815Sjsg /**
23945ca02815Sjsg * Panel Instance.
2395f005ef32Sjsg * Panel instance to identify which psr_state to use
23965ca02815Sjsg * Currently the support is only for 0 or 1
23975ca02815Sjsg */
23985ca02815Sjsg uint8_t panel_inst;
23995ca02815Sjsg /**
24005ca02815Sjsg * Explicit padding to 4 byte boundary.
24015ca02815Sjsg */
24025ca02815Sjsg uint8_t pad[2];
2403c349dbc7Sjsg };
2404c349dbc7Sjsg
24055ca02815Sjsg /**
24065ca02815Sjsg * Definition of a DMUB_CMD__PSR_SET_VERSION command.
24075ca02815Sjsg */
2408c349dbc7Sjsg struct dmub_rb_cmd_psr_set_version {
24095ca02815Sjsg /**
24105ca02815Sjsg * Command header.
24115ca02815Sjsg */
2412c349dbc7Sjsg struct dmub_cmd_header header;
24135ca02815Sjsg /**
24145ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__PSR_SET_VERSION command.
24155ca02815Sjsg */
2416c349dbc7Sjsg struct dmub_cmd_psr_set_version_data psr_set_version_data;
2417c349dbc7Sjsg };
2418c349dbc7Sjsg
24195ca02815Sjsg struct dmub_cmd_psr_force_static_data {
24205ca02815Sjsg /**
24215ca02815Sjsg * PSR control version.
24225ca02815Sjsg */
24235ca02815Sjsg uint8_t cmd_version;
24245ca02815Sjsg /**
24255ca02815Sjsg * Panel Instance.
2426f005ef32Sjsg * Panel instance to identify which psr_state to use
24275ca02815Sjsg * Currently the support is only for 0 or 1
24285ca02815Sjsg */
24295ca02815Sjsg uint8_t panel_inst;
24305ca02815Sjsg /**
24315ca02815Sjsg * Explicit padding to 4 byte boundary.
24325ca02815Sjsg */
24335ca02815Sjsg uint8_t pad[2];
24345ca02815Sjsg };
24355ca02815Sjsg
24365ca02815Sjsg /**
24375ca02815Sjsg * Definition of a DMUB_CMD__PSR_FORCE_STATIC command.
24385ca02815Sjsg */
24395ca02815Sjsg struct dmub_rb_cmd_psr_force_static {
24405ca02815Sjsg /**
24415ca02815Sjsg * Command header.
24425ca02815Sjsg */
24435ca02815Sjsg struct dmub_cmd_header header;
24445ca02815Sjsg /**
24455ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__PSR_FORCE_STATIC command.
24465ca02815Sjsg */
24475ca02815Sjsg struct dmub_cmd_psr_force_static_data psr_force_static_data;
24485ca02815Sjsg };
24495ca02815Sjsg
24505ca02815Sjsg /**
24511bb76ff1Sjsg * PSR SU debug flags.
24521bb76ff1Sjsg */
24531bb76ff1Sjsg union dmub_psr_su_debug_flags {
24541bb76ff1Sjsg /**
24551bb76ff1Sjsg * PSR SU debug flags.
24561bb76ff1Sjsg */
24571bb76ff1Sjsg struct {
24581bb76ff1Sjsg /**
24591bb76ff1Sjsg * Update dirty rect in SW only.
24601bb76ff1Sjsg */
24611bb76ff1Sjsg uint8_t update_dirty_rect_only : 1;
24621bb76ff1Sjsg /**
24631bb76ff1Sjsg * Reset the cursor/plane state before processing the call.
24641bb76ff1Sjsg */
24651bb76ff1Sjsg uint8_t reset_state : 1;
24661bb76ff1Sjsg } bitfields;
24671bb76ff1Sjsg
24681bb76ff1Sjsg /**
24691bb76ff1Sjsg * Union for debug flags.
24701bb76ff1Sjsg */
24711bb76ff1Sjsg uint32_t u32All;
24721bb76ff1Sjsg };
24731bb76ff1Sjsg
24741bb76ff1Sjsg /**
24751bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__UPDATE_DIRTY_RECT command.
24761bb76ff1Sjsg * This triggers a selective update for PSR SU.
24771bb76ff1Sjsg */
24781bb76ff1Sjsg struct dmub_cmd_update_dirty_rect_data {
24791bb76ff1Sjsg /**
24801bb76ff1Sjsg * Dirty rects from OS.
24811bb76ff1Sjsg */
24821bb76ff1Sjsg struct dmub_rect src_dirty_rects[DMUB_MAX_DIRTY_RECTS];
24831bb76ff1Sjsg /**
24841bb76ff1Sjsg * PSR SU debug flags.
24851bb76ff1Sjsg */
24861bb76ff1Sjsg union dmub_psr_su_debug_flags debug_flags;
24871bb76ff1Sjsg /**
24881bb76ff1Sjsg * OTG HW instance.
24891bb76ff1Sjsg */
24901bb76ff1Sjsg uint8_t pipe_idx;
24911bb76ff1Sjsg /**
24921bb76ff1Sjsg * Number of dirty rects.
24931bb76ff1Sjsg */
24941bb76ff1Sjsg uint8_t dirty_rect_count;
24951bb76ff1Sjsg /**
24961bb76ff1Sjsg * PSR control version.
24971bb76ff1Sjsg */
24981bb76ff1Sjsg uint8_t cmd_version;
24991bb76ff1Sjsg /**
25001bb76ff1Sjsg * Panel Instance.
2501f005ef32Sjsg * Panel instance to identify which psr_state to use
25021bb76ff1Sjsg * Currently the support is only for 0 or 1
25031bb76ff1Sjsg */
25041bb76ff1Sjsg uint8_t panel_inst;
25051bb76ff1Sjsg };
25061bb76ff1Sjsg
25071bb76ff1Sjsg /**
25081bb76ff1Sjsg * Definition of a DMUB_CMD__UPDATE_DIRTY_RECT command.
25091bb76ff1Sjsg */
25101bb76ff1Sjsg struct dmub_rb_cmd_update_dirty_rect {
25111bb76ff1Sjsg /**
25121bb76ff1Sjsg * Command header.
25131bb76ff1Sjsg */
25141bb76ff1Sjsg struct dmub_cmd_header header;
25151bb76ff1Sjsg /**
25161bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__UPDATE_DIRTY_RECT command.
25171bb76ff1Sjsg */
25181bb76ff1Sjsg struct dmub_cmd_update_dirty_rect_data update_dirty_rect_data;
25191bb76ff1Sjsg };
25201bb76ff1Sjsg
25211bb76ff1Sjsg /**
25221bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__UPDATE_CURSOR_INFO command.
25231bb76ff1Sjsg */
25241bb76ff1Sjsg union dmub_reg_cursor_control_cfg {
25251bb76ff1Sjsg struct {
25261bb76ff1Sjsg uint32_t cur_enable: 1;
25271bb76ff1Sjsg uint32_t reser0: 3;
25281bb76ff1Sjsg uint32_t cur_2x_magnify: 1;
25291bb76ff1Sjsg uint32_t reser1: 3;
25301bb76ff1Sjsg uint32_t mode: 3;
25311bb76ff1Sjsg uint32_t reser2: 5;
25321bb76ff1Sjsg uint32_t pitch: 2;
25331bb76ff1Sjsg uint32_t reser3: 6;
25341bb76ff1Sjsg uint32_t line_per_chunk: 5;
25351bb76ff1Sjsg uint32_t reser4: 3;
25361bb76ff1Sjsg } bits;
25371bb76ff1Sjsg uint32_t raw;
25381bb76ff1Sjsg };
25391bb76ff1Sjsg struct dmub_cursor_position_cache_hubp {
25401bb76ff1Sjsg union dmub_reg_cursor_control_cfg cur_ctl;
25411bb76ff1Sjsg union dmub_reg_position_cfg {
25421bb76ff1Sjsg struct {
25431bb76ff1Sjsg uint32_t cur_x_pos: 16;
25441bb76ff1Sjsg uint32_t cur_y_pos: 16;
25451bb76ff1Sjsg } bits;
25461bb76ff1Sjsg uint32_t raw;
25471bb76ff1Sjsg } position;
25481bb76ff1Sjsg union dmub_reg_hot_spot_cfg {
25491bb76ff1Sjsg struct {
25501bb76ff1Sjsg uint32_t hot_x: 16;
25511bb76ff1Sjsg uint32_t hot_y: 16;
25521bb76ff1Sjsg } bits;
25531bb76ff1Sjsg uint32_t raw;
25541bb76ff1Sjsg } hot_spot;
25551bb76ff1Sjsg union dmub_reg_dst_offset_cfg {
25561bb76ff1Sjsg struct {
25571bb76ff1Sjsg uint32_t dst_x_offset: 13;
25581bb76ff1Sjsg uint32_t reserved: 19;
25591bb76ff1Sjsg } bits;
25601bb76ff1Sjsg uint32_t raw;
25611bb76ff1Sjsg } dst_offset;
25621bb76ff1Sjsg };
25631bb76ff1Sjsg
25641bb76ff1Sjsg union dmub_reg_cur0_control_cfg {
25651bb76ff1Sjsg struct {
25661bb76ff1Sjsg uint32_t cur0_enable: 1;
25671bb76ff1Sjsg uint32_t expansion_mode: 1;
25681bb76ff1Sjsg uint32_t reser0: 1;
25691bb76ff1Sjsg uint32_t cur0_rom_en: 1;
25701bb76ff1Sjsg uint32_t mode: 3;
25711bb76ff1Sjsg uint32_t reserved: 25;
25721bb76ff1Sjsg } bits;
25731bb76ff1Sjsg uint32_t raw;
25741bb76ff1Sjsg };
25751bb76ff1Sjsg struct dmub_cursor_position_cache_dpp {
25761bb76ff1Sjsg union dmub_reg_cur0_control_cfg cur0_ctl;
25771bb76ff1Sjsg };
25781bb76ff1Sjsg struct dmub_cursor_position_cfg {
25791bb76ff1Sjsg struct dmub_cursor_position_cache_hubp pHubp;
25801bb76ff1Sjsg struct dmub_cursor_position_cache_dpp pDpp;
25811bb76ff1Sjsg uint8_t pipe_idx;
25821bb76ff1Sjsg /*
25831bb76ff1Sjsg * Padding is required. To be 4 Bytes Aligned.
25841bb76ff1Sjsg */
25851bb76ff1Sjsg uint8_t padding[3];
25861bb76ff1Sjsg };
25871bb76ff1Sjsg
25881bb76ff1Sjsg struct dmub_cursor_attribute_cache_hubp {
25891bb76ff1Sjsg uint32_t SURFACE_ADDR_HIGH;
25901bb76ff1Sjsg uint32_t SURFACE_ADDR;
25911bb76ff1Sjsg union dmub_reg_cursor_control_cfg cur_ctl;
25921bb76ff1Sjsg union dmub_reg_cursor_size_cfg {
25931bb76ff1Sjsg struct {
25941bb76ff1Sjsg uint32_t width: 16;
25951bb76ff1Sjsg uint32_t height: 16;
25961bb76ff1Sjsg } bits;
25971bb76ff1Sjsg uint32_t raw;
25981bb76ff1Sjsg } size;
25991bb76ff1Sjsg union dmub_reg_cursor_settings_cfg {
26001bb76ff1Sjsg struct {
26011bb76ff1Sjsg uint32_t dst_y_offset: 8;
26021bb76ff1Sjsg uint32_t chunk_hdl_adjust: 2;
26031bb76ff1Sjsg uint32_t reserved: 22;
26041bb76ff1Sjsg } bits;
26051bb76ff1Sjsg uint32_t raw;
26061bb76ff1Sjsg } settings;
26071bb76ff1Sjsg };
26081bb76ff1Sjsg struct dmub_cursor_attribute_cache_dpp {
26091bb76ff1Sjsg union dmub_reg_cur0_control_cfg cur0_ctl;
26101bb76ff1Sjsg };
26111bb76ff1Sjsg struct dmub_cursor_attributes_cfg {
26121bb76ff1Sjsg struct dmub_cursor_attribute_cache_hubp aHubp;
26131bb76ff1Sjsg struct dmub_cursor_attribute_cache_dpp aDpp;
26141bb76ff1Sjsg };
26151bb76ff1Sjsg
26161bb76ff1Sjsg struct dmub_cmd_update_cursor_payload0 {
26171bb76ff1Sjsg /**
26181bb76ff1Sjsg * Cursor dirty rects.
26191bb76ff1Sjsg */
26201bb76ff1Sjsg struct dmub_rect cursor_rect;
26211bb76ff1Sjsg /**
26221bb76ff1Sjsg * PSR SU debug flags.
26231bb76ff1Sjsg */
26241bb76ff1Sjsg union dmub_psr_su_debug_flags debug_flags;
26251bb76ff1Sjsg /**
26261bb76ff1Sjsg * Cursor enable/disable.
26271bb76ff1Sjsg */
26281bb76ff1Sjsg uint8_t enable;
26291bb76ff1Sjsg /**
26301bb76ff1Sjsg * OTG HW instance.
26311bb76ff1Sjsg */
26321bb76ff1Sjsg uint8_t pipe_idx;
26331bb76ff1Sjsg /**
26341bb76ff1Sjsg * PSR control version.
26351bb76ff1Sjsg */
26361bb76ff1Sjsg uint8_t cmd_version;
26371bb76ff1Sjsg /**
26381bb76ff1Sjsg * Panel Instance.
2639f005ef32Sjsg * Panel instance to identify which psr_state to use
26401bb76ff1Sjsg * Currently the support is only for 0 or 1
26411bb76ff1Sjsg */
26421bb76ff1Sjsg uint8_t panel_inst;
26431bb76ff1Sjsg /**
26441bb76ff1Sjsg * Cursor Position Register.
26451bb76ff1Sjsg * Registers contains Hubp & Dpp modules
26461bb76ff1Sjsg */
26471bb76ff1Sjsg struct dmub_cursor_position_cfg position_cfg;
26481bb76ff1Sjsg };
26491bb76ff1Sjsg
26501bb76ff1Sjsg struct dmub_cmd_update_cursor_payload1 {
26511bb76ff1Sjsg struct dmub_cursor_attributes_cfg attribute_cfg;
26521bb76ff1Sjsg };
26531bb76ff1Sjsg
26541bb76ff1Sjsg union dmub_cmd_update_cursor_info_data {
26551bb76ff1Sjsg struct dmub_cmd_update_cursor_payload0 payload0;
26561bb76ff1Sjsg struct dmub_cmd_update_cursor_payload1 payload1;
26571bb76ff1Sjsg };
26581bb76ff1Sjsg /**
26591bb76ff1Sjsg * Definition of a DMUB_CMD__UPDATE_CURSOR_INFO command.
26601bb76ff1Sjsg */
26611bb76ff1Sjsg struct dmub_rb_cmd_update_cursor_info {
26621bb76ff1Sjsg /**
26631bb76ff1Sjsg * Command header.
26641bb76ff1Sjsg */
26651bb76ff1Sjsg struct dmub_cmd_header header;
26661bb76ff1Sjsg /**
26671bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__UPDATE_CURSOR_INFO command.
26681bb76ff1Sjsg */
26691bb76ff1Sjsg union dmub_cmd_update_cursor_info_data update_cursor_info_data;
26701bb76ff1Sjsg };
26711bb76ff1Sjsg
26721bb76ff1Sjsg /**
26731bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__SET_SINK_VTOTAL_IN_PSR_ACTIVE command.
26741bb76ff1Sjsg */
26751bb76ff1Sjsg struct dmub_cmd_psr_set_vtotal_data {
26761bb76ff1Sjsg /**
26771bb76ff1Sjsg * 16-bit value dicated by driver that indicates the vtotal in PSR active requirement when screen idle..
26781bb76ff1Sjsg */
26791bb76ff1Sjsg uint16_t psr_vtotal_idle;
26801bb76ff1Sjsg /**
26811bb76ff1Sjsg * PSR control version.
26821bb76ff1Sjsg */
26831bb76ff1Sjsg uint8_t cmd_version;
26841bb76ff1Sjsg /**
26851bb76ff1Sjsg * Panel Instance.
2686f005ef32Sjsg * Panel instance to identify which psr_state to use
26871bb76ff1Sjsg * Currently the support is only for 0 or 1
26881bb76ff1Sjsg */
26891bb76ff1Sjsg uint8_t panel_inst;
26901bb76ff1Sjsg /*
26911bb76ff1Sjsg * 16-bit value dicated by driver that indicates the vtotal in PSR active requirement when doing SU/FFU.
26921bb76ff1Sjsg */
26931bb76ff1Sjsg uint16_t psr_vtotal_su;
26941bb76ff1Sjsg /**
26951bb76ff1Sjsg * Explicit padding to 4 byte boundary.
26961bb76ff1Sjsg */
26971bb76ff1Sjsg uint8_t pad2[2];
26981bb76ff1Sjsg };
26991bb76ff1Sjsg
27001bb76ff1Sjsg /**
27011bb76ff1Sjsg * Definition of a DMUB_CMD__SET_SINK_VTOTAL_IN_PSR_ACTIVE command.
27021bb76ff1Sjsg */
27031bb76ff1Sjsg struct dmub_rb_cmd_psr_set_vtotal {
27041bb76ff1Sjsg /**
27051bb76ff1Sjsg * Command header.
27061bb76ff1Sjsg */
27071bb76ff1Sjsg struct dmub_cmd_header header;
27081bb76ff1Sjsg /**
27091bb76ff1Sjsg * Definition of a DMUB_CMD__SET_SINK_VTOTAL_IN_PSR_ACTIVE command.
27101bb76ff1Sjsg */
27111bb76ff1Sjsg struct dmub_cmd_psr_set_vtotal_data psr_set_vtotal_data;
27121bb76ff1Sjsg };
27131bb76ff1Sjsg
27141bb76ff1Sjsg /**
27151bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__SET_PSR_POWER_OPT command.
27161bb76ff1Sjsg */
27171bb76ff1Sjsg struct dmub_cmd_psr_set_power_opt_data {
27181bb76ff1Sjsg /**
27191bb76ff1Sjsg * PSR control version.
27201bb76ff1Sjsg */
27211bb76ff1Sjsg uint8_t cmd_version;
27221bb76ff1Sjsg /**
27231bb76ff1Sjsg * Panel Instance.
2724f005ef32Sjsg * Panel instance to identify which psr_state to use
27251bb76ff1Sjsg * Currently the support is only for 0 or 1
27261bb76ff1Sjsg */
27271bb76ff1Sjsg uint8_t panel_inst;
27281bb76ff1Sjsg /**
27291bb76ff1Sjsg * Explicit padding to 4 byte boundary.
27301bb76ff1Sjsg */
27311bb76ff1Sjsg uint8_t pad[2];
27321bb76ff1Sjsg /**
27331bb76ff1Sjsg * PSR power option
27341bb76ff1Sjsg */
27351bb76ff1Sjsg uint32_t power_opt;
27361bb76ff1Sjsg };
27371bb76ff1Sjsg
2738f005ef32Sjsg #define REPLAY_RESIDENCY_MODE_SHIFT (0)
2739f005ef32Sjsg #define REPLAY_RESIDENCY_ENABLE_SHIFT (1)
2740f005ef32Sjsg
2741f005ef32Sjsg #define REPLAY_RESIDENCY_MODE_MASK (0x1 << REPLAY_RESIDENCY_MODE_SHIFT)
2742f005ef32Sjsg # define REPLAY_RESIDENCY_MODE_PHY (0x0 << REPLAY_RESIDENCY_MODE_SHIFT)
2743f005ef32Sjsg # define REPLAY_RESIDENCY_MODE_ALPM (0x1 << REPLAY_RESIDENCY_MODE_SHIFT)
2744f005ef32Sjsg
2745f005ef32Sjsg #define REPLAY_RESIDENCY_ENABLE_MASK (0x1 << REPLAY_RESIDENCY_ENABLE_SHIFT)
2746f005ef32Sjsg # define REPLAY_RESIDENCY_DISABLE (0x0 << REPLAY_RESIDENCY_ENABLE_SHIFT)
2747f005ef32Sjsg # define REPLAY_RESIDENCY_ENABLE (0x1 << REPLAY_RESIDENCY_ENABLE_SHIFT)
2748f005ef32Sjsg
2749f005ef32Sjsg enum replay_state {
2750f005ef32Sjsg REPLAY_STATE_0 = 0x0,
2751f005ef32Sjsg REPLAY_STATE_1 = 0x10,
2752f005ef32Sjsg REPLAY_STATE_1A = 0x11,
2753f005ef32Sjsg REPLAY_STATE_2 = 0x20,
2754f005ef32Sjsg REPLAY_STATE_3 = 0x30,
2755f005ef32Sjsg REPLAY_STATE_3INIT = 0x31,
2756f005ef32Sjsg REPLAY_STATE_4 = 0x40,
2757f005ef32Sjsg REPLAY_STATE_4A = 0x41,
2758f005ef32Sjsg REPLAY_STATE_4B = 0x42,
2759f005ef32Sjsg REPLAY_STATE_4C = 0x43,
2760f005ef32Sjsg REPLAY_STATE_4D = 0x44,
2761f005ef32Sjsg REPLAY_STATE_4B_LOCKED = 0x4A,
2762f005ef32Sjsg REPLAY_STATE_4C_UNLOCKED = 0x4B,
2763f005ef32Sjsg REPLAY_STATE_5 = 0x50,
2764f005ef32Sjsg REPLAY_STATE_5A = 0x51,
2765f005ef32Sjsg REPLAY_STATE_5B = 0x52,
2766f005ef32Sjsg REPLAY_STATE_5A_LOCKED = 0x5A,
2767f005ef32Sjsg REPLAY_STATE_5B_UNLOCKED = 0x5B,
2768f005ef32Sjsg REPLAY_STATE_6 = 0x60,
2769f005ef32Sjsg REPLAY_STATE_6A = 0x61,
2770f005ef32Sjsg REPLAY_STATE_6B = 0x62,
2771f005ef32Sjsg REPLAY_STATE_INVALID = 0xFF,
2772f005ef32Sjsg };
2773f005ef32Sjsg
2774f005ef32Sjsg /**
2775f005ef32Sjsg * Replay command sub-types.
2776f005ef32Sjsg */
2777f005ef32Sjsg enum dmub_cmd_replay_type {
2778f005ef32Sjsg /**
2779f005ef32Sjsg * Copy driver-calculated parameters to REPLAY state.
2780f005ef32Sjsg */
2781f005ef32Sjsg DMUB_CMD__REPLAY_COPY_SETTINGS = 0,
2782f005ef32Sjsg /**
2783f005ef32Sjsg * Enable REPLAY.
2784f005ef32Sjsg */
2785f005ef32Sjsg DMUB_CMD__REPLAY_ENABLE = 1,
2786f005ef32Sjsg /**
2787f005ef32Sjsg * Set Replay power option.
2788f005ef32Sjsg */
2789f005ef32Sjsg DMUB_CMD__SET_REPLAY_POWER_OPT = 2,
2790f005ef32Sjsg /**
2791f005ef32Sjsg * Set coasting vtotal.
2792f005ef32Sjsg */
2793f005ef32Sjsg DMUB_CMD__REPLAY_SET_COASTING_VTOTAL = 3,
2794f005ef32Sjsg };
2795f005ef32Sjsg
2796f005ef32Sjsg /**
2797f005ef32Sjsg * Data passed from driver to FW in a DMUB_CMD__REPLAY_COPY_SETTINGS command.
2798f005ef32Sjsg */
2799f005ef32Sjsg struct dmub_cmd_replay_copy_settings_data {
2800f005ef32Sjsg /**
2801f005ef32Sjsg * Flags that can be set by driver to change some replay behaviour.
2802f005ef32Sjsg */
2803f005ef32Sjsg union replay_debug_flags debug;
2804f005ef32Sjsg
2805f005ef32Sjsg /**
2806f005ef32Sjsg * @flags: Flags used to determine feature functionality.
2807f005ef32Sjsg */
2808f005ef32Sjsg union replay_hw_flags flags;
2809f005ef32Sjsg
2810f005ef32Sjsg /**
2811f005ef32Sjsg * DPP HW instance.
2812f005ef32Sjsg */
2813f005ef32Sjsg uint8_t dpp_inst;
2814f005ef32Sjsg /**
2815f005ef32Sjsg * OTG HW instance.
2816f005ef32Sjsg */
2817f005ef32Sjsg uint8_t otg_inst;
2818f005ef32Sjsg /**
2819f005ef32Sjsg * DIG FE HW instance.
2820f005ef32Sjsg */
2821f005ef32Sjsg uint8_t digfe_inst;
2822f005ef32Sjsg /**
2823f005ef32Sjsg * DIG BE HW instance.
2824f005ef32Sjsg */
2825f005ef32Sjsg uint8_t digbe_inst;
2826f005ef32Sjsg /**
2827f005ef32Sjsg * AUX HW instance.
2828f005ef32Sjsg */
2829f005ef32Sjsg uint8_t aux_inst;
2830f005ef32Sjsg /**
2831f005ef32Sjsg * Panel Instance.
2832f005ef32Sjsg * Panel isntance to identify which psr_state to use
2833f005ef32Sjsg * Currently the support is only for 0 or 1
2834f005ef32Sjsg */
2835f005ef32Sjsg uint8_t panel_inst;
2836f005ef32Sjsg /**
2837f005ef32Sjsg * @pixel_deviation_per_line: Indicate the maximum pixel deviation per line compare
2838f005ef32Sjsg * to Source timing when Sink maintains coasting vtotal during the Replay normal sleep mode
2839f005ef32Sjsg */
2840f005ef32Sjsg uint8_t pixel_deviation_per_line;
2841f005ef32Sjsg /**
2842f005ef32Sjsg * @max_deviation_line: The max number of deviation line that can keep the timing
2843f005ef32Sjsg * synchronized between the Source and Sink during Replay normal sleep mode.
2844f005ef32Sjsg */
2845f005ef32Sjsg uint8_t max_deviation_line;
2846f005ef32Sjsg /**
2847f005ef32Sjsg * Length of each horizontal line in ns.
2848f005ef32Sjsg */
2849f005ef32Sjsg uint32_t line_time_in_ns;
2850f005ef32Sjsg /**
2851f005ef32Sjsg * PHY instance.
2852f005ef32Sjsg */
2853f005ef32Sjsg uint8_t dpphy_inst;
2854f005ef32Sjsg /**
2855f005ef32Sjsg * Determines if SMU optimzations are enabled/disabled.
2856f005ef32Sjsg */
2857f005ef32Sjsg uint8_t smu_optimizations_en;
2858f005ef32Sjsg /**
2859f005ef32Sjsg * Determines if timing sync are enabled/disabled.
2860f005ef32Sjsg */
2861f005ef32Sjsg uint8_t replay_timing_sync_supported;
2862f005ef32Sjsg /*
2863f005ef32Sjsg * Use FSM state for Replay power up/down
2864f005ef32Sjsg */
2865f005ef32Sjsg uint8_t use_phy_fsm;
2866f005ef32Sjsg };
2867f005ef32Sjsg
2868f005ef32Sjsg /**
2869f005ef32Sjsg * Definition of a DMUB_CMD__REPLAY_COPY_SETTINGS command.
2870f005ef32Sjsg */
2871f005ef32Sjsg struct dmub_rb_cmd_replay_copy_settings {
2872f005ef32Sjsg /**
2873f005ef32Sjsg * Command header.
2874f005ef32Sjsg */
2875f005ef32Sjsg struct dmub_cmd_header header;
2876f005ef32Sjsg /**
2877f005ef32Sjsg * Data passed from driver to FW in a DMUB_CMD__REPLAY_COPY_SETTINGS command.
2878f005ef32Sjsg */
2879f005ef32Sjsg struct dmub_cmd_replay_copy_settings_data replay_copy_settings_data;
2880f005ef32Sjsg };
2881f005ef32Sjsg
2882f005ef32Sjsg /**
2883f005ef32Sjsg * Replay disable / enable state for dmub_rb_cmd_replay_enable_data.enable
2884f005ef32Sjsg */
2885f005ef32Sjsg enum replay_enable {
2886f005ef32Sjsg /**
2887f005ef32Sjsg * Disable REPLAY.
2888f005ef32Sjsg */
2889f005ef32Sjsg REPLAY_DISABLE = 0,
2890f005ef32Sjsg /**
2891f005ef32Sjsg * Enable REPLAY.
2892f005ef32Sjsg */
2893f005ef32Sjsg REPLAY_ENABLE = 1,
2894f005ef32Sjsg };
2895f005ef32Sjsg
2896f005ef32Sjsg /**
2897f005ef32Sjsg * Data passed from driver to FW in a DMUB_CMD__REPLAY_ENABLE command.
2898f005ef32Sjsg */
2899f005ef32Sjsg struct dmub_rb_cmd_replay_enable_data {
2900f005ef32Sjsg /**
2901f005ef32Sjsg * Replay enable or disable.
2902f005ef32Sjsg */
2903f005ef32Sjsg uint8_t enable;
2904f005ef32Sjsg /**
2905f005ef32Sjsg * Panel Instance.
2906f005ef32Sjsg * Panel isntance to identify which replay_state to use
2907f005ef32Sjsg * Currently the support is only for 0 or 1
2908f005ef32Sjsg */
2909f005ef32Sjsg uint8_t panel_inst;
2910f005ef32Sjsg /**
2911f005ef32Sjsg * Phy state to enter.
2912f005ef32Sjsg * Values to use are defined in dmub_phy_fsm_state
2913f005ef32Sjsg */
2914f005ef32Sjsg uint8_t phy_fsm_state;
2915f005ef32Sjsg /**
2916f005ef32Sjsg * Phy rate for DP - RBR/HBR/HBR2/HBR3.
2917f005ef32Sjsg * Set this using enum phy_link_rate.
2918f005ef32Sjsg * This does not support HDMI/DP2 for now.
2919f005ef32Sjsg */
2920f005ef32Sjsg uint8_t phy_rate;
2921f005ef32Sjsg };
2922f005ef32Sjsg
2923f005ef32Sjsg /**
2924f005ef32Sjsg * Definition of a DMUB_CMD__REPLAY_ENABLE command.
2925f005ef32Sjsg * Replay enable/disable is controlled using action in data.
2926f005ef32Sjsg */
2927f005ef32Sjsg struct dmub_rb_cmd_replay_enable {
2928f005ef32Sjsg /**
2929f005ef32Sjsg * Command header.
2930f005ef32Sjsg */
2931f005ef32Sjsg struct dmub_cmd_header header;
2932f005ef32Sjsg
2933f005ef32Sjsg struct dmub_rb_cmd_replay_enable_data data;
2934f005ef32Sjsg };
2935f005ef32Sjsg
2936f005ef32Sjsg /**
2937f005ef32Sjsg * Data passed from driver to FW in a DMUB_CMD__SET_REPLAY_POWER_OPT command.
2938f005ef32Sjsg */
2939f005ef32Sjsg struct dmub_cmd_replay_set_power_opt_data {
2940f005ef32Sjsg /**
2941f005ef32Sjsg * Panel Instance.
2942f005ef32Sjsg * Panel isntance to identify which replay_state to use
2943f005ef32Sjsg * Currently the support is only for 0 or 1
2944f005ef32Sjsg */
2945f005ef32Sjsg uint8_t panel_inst;
2946f005ef32Sjsg /**
2947f005ef32Sjsg * Explicit padding to 4 byte boundary.
2948f005ef32Sjsg */
2949f005ef32Sjsg uint8_t pad[3];
2950f005ef32Sjsg /**
2951f005ef32Sjsg * REPLAY power option
2952f005ef32Sjsg */
2953f005ef32Sjsg uint32_t power_opt;
2954f005ef32Sjsg };
2955f005ef32Sjsg
2956f005ef32Sjsg /**
2957f005ef32Sjsg * Definition of a DMUB_CMD__SET_REPLAY_POWER_OPT command.
2958f005ef32Sjsg */
2959f005ef32Sjsg struct dmub_rb_cmd_replay_set_power_opt {
2960f005ef32Sjsg /**
2961f005ef32Sjsg * Command header.
2962f005ef32Sjsg */
2963f005ef32Sjsg struct dmub_cmd_header header;
2964f005ef32Sjsg /**
2965f005ef32Sjsg * Definition of a DMUB_CMD__SET_REPLAY_POWER_OPT command.
2966f005ef32Sjsg */
2967f005ef32Sjsg struct dmub_cmd_replay_set_power_opt_data replay_set_power_opt_data;
2968f005ef32Sjsg };
2969f005ef32Sjsg
2970f005ef32Sjsg /**
2971f005ef32Sjsg * Data passed from driver to FW in a DMUB_CMD__REPLAY_SET_COASTING_VTOTAL command.
2972f005ef32Sjsg */
2973f005ef32Sjsg struct dmub_cmd_replay_set_coasting_vtotal_data {
2974f005ef32Sjsg /**
2975f005ef32Sjsg * 16-bit value dicated by driver that indicates the coasting vtotal.
2976f005ef32Sjsg */
2977f005ef32Sjsg uint16_t coasting_vtotal;
2978f005ef32Sjsg /**
2979f005ef32Sjsg * REPLAY control version.
2980f005ef32Sjsg */
2981f005ef32Sjsg uint8_t cmd_version;
2982f005ef32Sjsg /**
2983f005ef32Sjsg * Panel Instance.
2984f005ef32Sjsg * Panel isntance to identify which replay_state to use
2985f005ef32Sjsg * Currently the support is only for 0 or 1
2986f005ef32Sjsg */
2987f005ef32Sjsg uint8_t panel_inst;
2988f005ef32Sjsg };
2989f005ef32Sjsg
2990f005ef32Sjsg /**
2991f005ef32Sjsg * Definition of a DMUB_CMD__REPLAY_SET_COASTING_VTOTAL command.
2992f005ef32Sjsg */
2993f005ef32Sjsg struct dmub_rb_cmd_replay_set_coasting_vtotal {
2994f005ef32Sjsg /**
2995f005ef32Sjsg * Command header.
2996f005ef32Sjsg */
2997f005ef32Sjsg struct dmub_cmd_header header;
2998f005ef32Sjsg /**
2999f005ef32Sjsg * Definition of a DMUB_CMD__REPLAY_SET_COASTING_VTOTAL command.
3000f005ef32Sjsg */
3001f005ef32Sjsg struct dmub_cmd_replay_set_coasting_vtotal_data replay_set_coasting_vtotal_data;
3002f005ef32Sjsg };
3003f005ef32Sjsg
30041bb76ff1Sjsg /**
30051bb76ff1Sjsg * Definition of a DMUB_CMD__SET_PSR_POWER_OPT command.
30061bb76ff1Sjsg */
30071bb76ff1Sjsg struct dmub_rb_cmd_psr_set_power_opt {
30081bb76ff1Sjsg /**
30091bb76ff1Sjsg * Command header.
30101bb76ff1Sjsg */
30111bb76ff1Sjsg struct dmub_cmd_header header;
30121bb76ff1Sjsg /**
30131bb76ff1Sjsg * Definition of a DMUB_CMD__SET_PSR_POWER_OPT command.
30141bb76ff1Sjsg */
30151bb76ff1Sjsg struct dmub_cmd_psr_set_power_opt_data psr_set_power_opt_data;
30161bb76ff1Sjsg };
30171bb76ff1Sjsg
30181bb76ff1Sjsg /**
30195ca02815Sjsg * Set of HW components that can be locked.
30205ca02815Sjsg *
30215ca02815Sjsg * Note: If updating with more HW components, fields
30225ca02815Sjsg * in dmub_inbox0_cmd_lock_hw must be updated to match.
30235ca02815Sjsg */
3024ad8b1aafSjsg union dmub_hw_lock_flags {
30255ca02815Sjsg /**
30265ca02815Sjsg * Set of HW components that can be locked.
30275ca02815Sjsg */
3028ad8b1aafSjsg struct {
30295ca02815Sjsg /**
30305ca02815Sjsg * Lock/unlock OTG master update lock.
30315ca02815Sjsg */
3032ad8b1aafSjsg uint8_t lock_pipe : 1;
30335ca02815Sjsg /**
30345ca02815Sjsg * Lock/unlock cursor.
30355ca02815Sjsg */
3036ad8b1aafSjsg uint8_t lock_cursor : 1;
30375ca02815Sjsg /**
30385ca02815Sjsg * Lock/unlock global update lock.
30395ca02815Sjsg */
3040ad8b1aafSjsg uint8_t lock_dig : 1;
30415ca02815Sjsg /**
30425ca02815Sjsg * Triple buffer lock requires additional hw programming to usual OTG master lock.
30435ca02815Sjsg */
3044ad8b1aafSjsg uint8_t triple_buffer_lock : 1;
3045ad8b1aafSjsg } bits;
3046ad8b1aafSjsg
30475ca02815Sjsg /**
30485ca02815Sjsg * Union for HW Lock flags.
30495ca02815Sjsg */
3050ad8b1aafSjsg uint8_t u8All;
3051ad8b1aafSjsg };
3052ad8b1aafSjsg
30535ca02815Sjsg /**
30545ca02815Sjsg * Instances of HW to be locked.
30555ca02815Sjsg *
30565ca02815Sjsg * Note: If updating with more HW components, fields
30575ca02815Sjsg * in dmub_inbox0_cmd_lock_hw must be updated to match.
30585ca02815Sjsg */
3059ad8b1aafSjsg struct dmub_hw_lock_inst_flags {
30605ca02815Sjsg /**
30615ca02815Sjsg * OTG HW instance for OTG master update lock.
30625ca02815Sjsg */
3063ad8b1aafSjsg uint8_t otg_inst;
30645ca02815Sjsg /**
30655ca02815Sjsg * OPP instance for cursor lock.
30665ca02815Sjsg */
3067ad8b1aafSjsg uint8_t opp_inst;
30685ca02815Sjsg /**
30695ca02815Sjsg * OTG HW instance for global update lock.
30705ca02815Sjsg * TODO: Remove, and re-use otg_inst.
30715ca02815Sjsg */
3072ad8b1aafSjsg uint8_t dig_inst;
30735ca02815Sjsg /**
30745ca02815Sjsg * Explicit pad to 4 byte boundary.
30755ca02815Sjsg */
3076ad8b1aafSjsg uint8_t pad;
3077ad8b1aafSjsg };
3078ad8b1aafSjsg
30795ca02815Sjsg /**
30805ca02815Sjsg * Clients that can acquire the HW Lock Manager.
30815ca02815Sjsg *
30825ca02815Sjsg * Note: If updating with more clients, fields in
30835ca02815Sjsg * dmub_inbox0_cmd_lock_hw must be updated to match.
30845ca02815Sjsg */
3085ad8b1aafSjsg enum hw_lock_client {
30865ca02815Sjsg /**
30875ca02815Sjsg * Driver is the client of HW Lock Manager.
30885ca02815Sjsg */
3089ad8b1aafSjsg HW_LOCK_CLIENT_DRIVER = 0,
30905ca02815Sjsg /**
30911bb76ff1Sjsg * PSR SU is the client of HW Lock Manager.
30921bb76ff1Sjsg */
30931bb76ff1Sjsg HW_LOCK_CLIENT_PSR_SU = 1,
30941bb76ff1Sjsg /**
3095f005ef32Sjsg * Replay is the client of HW Lock Manager.
3096f005ef32Sjsg */
3097f005ef32Sjsg HW_LOCK_CLIENT_REPLAY = 4,
3098f005ef32Sjsg /**
30995ca02815Sjsg * Invalid client.
31005ca02815Sjsg */
3101ad8b1aafSjsg HW_LOCK_CLIENT_INVALID = 0xFFFFFFFF,
3102ad8b1aafSjsg };
3103ad8b1aafSjsg
31045ca02815Sjsg /**
31055ca02815Sjsg * Data passed to HW Lock Mgr in a DMUB_CMD__HW_LOCK command.
31065ca02815Sjsg */
3107ad8b1aafSjsg struct dmub_cmd_lock_hw_data {
31085ca02815Sjsg /**
31095ca02815Sjsg * Specifies the client accessing HW Lock Manager.
31105ca02815Sjsg */
3111ad8b1aafSjsg enum hw_lock_client client;
31125ca02815Sjsg /**
31135ca02815Sjsg * HW instances to be locked.
31145ca02815Sjsg */
3115ad8b1aafSjsg struct dmub_hw_lock_inst_flags inst_flags;
31165ca02815Sjsg /**
31175ca02815Sjsg * Which components to be locked.
31185ca02815Sjsg */
3119ad8b1aafSjsg union dmub_hw_lock_flags hw_locks;
31205ca02815Sjsg /**
31215ca02815Sjsg * Specifies lock/unlock.
31225ca02815Sjsg */
3123ad8b1aafSjsg uint8_t lock;
31245ca02815Sjsg /**
31255ca02815Sjsg * HW can be unlocked separately from releasing the HW Lock Mgr.
31265ca02815Sjsg * This flag is set if the client wishes to release the object.
31275ca02815Sjsg */
3128ad8b1aafSjsg uint8_t should_release;
31295ca02815Sjsg /**
31305ca02815Sjsg * Explicit padding to 4 byte boundary.
31315ca02815Sjsg */
3132ad8b1aafSjsg uint8_t pad;
3133ad8b1aafSjsg };
3134ad8b1aafSjsg
31355ca02815Sjsg /**
31365ca02815Sjsg * Definition of a DMUB_CMD__HW_LOCK command.
31375ca02815Sjsg * Command is used by driver and FW.
31385ca02815Sjsg */
3139ad8b1aafSjsg struct dmub_rb_cmd_lock_hw {
31405ca02815Sjsg /**
31415ca02815Sjsg * Command header.
31425ca02815Sjsg */
3143ad8b1aafSjsg struct dmub_cmd_header header;
31445ca02815Sjsg /**
31455ca02815Sjsg * Data passed to HW Lock Mgr in a DMUB_CMD__HW_LOCK command.
31465ca02815Sjsg */
3147ad8b1aafSjsg struct dmub_cmd_lock_hw_data lock_hw_data;
3148ad8b1aafSjsg };
3149ad8b1aafSjsg
31505ca02815Sjsg /**
31515ca02815Sjsg * ABM command sub-types.
31525ca02815Sjsg */
3153ad8b1aafSjsg enum dmub_cmd_abm_type {
31545ca02815Sjsg /**
31555ca02815Sjsg * Initialize parameters for ABM algorithm.
31565ca02815Sjsg * Data is passed through an indirect buffer.
31575ca02815Sjsg */
3158ad8b1aafSjsg DMUB_CMD__ABM_INIT_CONFIG = 0,
31595ca02815Sjsg /**
31605ca02815Sjsg * Set OTG and panel HW instance.
31615ca02815Sjsg */
3162ad8b1aafSjsg DMUB_CMD__ABM_SET_PIPE = 1,
31635ca02815Sjsg /**
31645ca02815Sjsg * Set user requested backklight level.
31655ca02815Sjsg */
3166ad8b1aafSjsg DMUB_CMD__ABM_SET_BACKLIGHT = 2,
31675ca02815Sjsg /**
31685ca02815Sjsg * Set ABM operating/aggression level.
31695ca02815Sjsg */
3170ad8b1aafSjsg DMUB_CMD__ABM_SET_LEVEL = 3,
31715ca02815Sjsg /**
31725ca02815Sjsg * Set ambient light level.
31735ca02815Sjsg */
3174ad8b1aafSjsg DMUB_CMD__ABM_SET_AMBIENT_LEVEL = 4,
31755ca02815Sjsg /**
31765ca02815Sjsg * Enable/disable fractional duty cycle for backlight PWM.
31775ca02815Sjsg */
3178ad8b1aafSjsg DMUB_CMD__ABM_SET_PWM_FRAC = 5,
31791bb76ff1Sjsg
31801bb76ff1Sjsg /**
31811bb76ff1Sjsg * unregister vertical interrupt after steady state is reached
31821bb76ff1Sjsg */
31831bb76ff1Sjsg DMUB_CMD__ABM_PAUSE = 6,
3184f005ef32Sjsg
3185f005ef32Sjsg /**
3186f005ef32Sjsg * Save and Restore ABM state. On save we save parameters, and
3187f005ef32Sjsg * on restore we update state with passed in data.
3188f005ef32Sjsg */
3189f005ef32Sjsg DMUB_CMD__ABM_SAVE_RESTORE = 7,
3190ad8b1aafSjsg };
3191ad8b1aafSjsg
31925ca02815Sjsg /**
31935ca02815Sjsg * Parameters for ABM2.4 algorithm. Passed from driver to FW via an indirect buffer.
31945ca02815Sjsg * Requirements:
31955ca02815Sjsg * - Padded explicitly to 32-bit boundary.
31965ca02815Sjsg * - Must ensure this structure matches the one on driver-side,
31975ca02815Sjsg * otherwise it won't be aligned.
3198ad8b1aafSjsg */
3199ad8b1aafSjsg struct abm_config_table {
32005ca02815Sjsg /**
32015ca02815Sjsg * Gamma curve thresholds, used for crgb conversion.
32025ca02815Sjsg */
3203ad8b1aafSjsg uint16_t crgb_thresh[NUM_POWER_FN_SEGS]; // 0B
32045ca02815Sjsg /**
32055ca02815Sjsg * Gamma curve offsets, used for crgb conversion.
32065ca02815Sjsg */
32075ca02815Sjsg uint16_t crgb_offset[NUM_POWER_FN_SEGS]; // 16B
32085ca02815Sjsg /**
32095ca02815Sjsg * Gamma curve slopes, used for crgb conversion.
32105ca02815Sjsg */
32115ca02815Sjsg uint16_t crgb_slope[NUM_POWER_FN_SEGS]; // 32B
32125ca02815Sjsg /**
32135ca02815Sjsg * Custom backlight curve thresholds.
32145ca02815Sjsg */
32155ca02815Sjsg uint16_t backlight_thresholds[NUM_BL_CURVE_SEGS]; // 48B
32165ca02815Sjsg /**
32175ca02815Sjsg * Custom backlight curve offsets.
32185ca02815Sjsg */
32195ca02815Sjsg uint16_t backlight_offsets[NUM_BL_CURVE_SEGS]; // 78B
32205ca02815Sjsg /**
32215ca02815Sjsg * Ambient light thresholds.
32225ca02815Sjsg */
32235ca02815Sjsg uint16_t ambient_thresholds_lux[NUM_AMBI_LEVEL]; // 112B
32245ca02815Sjsg /**
32255ca02815Sjsg * Minimum programmable backlight.
32265ca02815Sjsg */
32275ca02815Sjsg uint16_t min_abm_backlight; // 122B
32285ca02815Sjsg /**
32295ca02815Sjsg * Minimum reduction values.
32305ca02815Sjsg */
32315ca02815Sjsg uint8_t min_reduction[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; // 124B
32325ca02815Sjsg /**
32335ca02815Sjsg * Maximum reduction values.
32345ca02815Sjsg */
32355ca02815Sjsg uint8_t max_reduction[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; // 144B
32365ca02815Sjsg /**
32375ca02815Sjsg * Bright positive gain.
32385ca02815Sjsg */
32395ca02815Sjsg uint8_t bright_pos_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; // 164B
32405ca02815Sjsg /**
32415ca02815Sjsg * Dark negative gain.
32425ca02815Sjsg */
32435ca02815Sjsg uint8_t dark_pos_gain[NUM_AMBI_LEVEL][NUM_AGGR_LEVEL]; // 184B
32445ca02815Sjsg /**
32455ca02815Sjsg * Hybrid factor.
32465ca02815Sjsg */
32475ca02815Sjsg uint8_t hybrid_factor[NUM_AGGR_LEVEL]; // 204B
32485ca02815Sjsg /**
32495ca02815Sjsg * Contrast factor.
32505ca02815Sjsg */
32515ca02815Sjsg uint8_t contrast_factor[NUM_AGGR_LEVEL]; // 208B
32525ca02815Sjsg /**
32535ca02815Sjsg * Deviation gain.
32545ca02815Sjsg */
32555ca02815Sjsg uint8_t deviation_gain[NUM_AGGR_LEVEL]; // 212B
32565ca02815Sjsg /**
32575ca02815Sjsg * Minimum knee.
32585ca02815Sjsg */
32595ca02815Sjsg uint8_t min_knee[NUM_AGGR_LEVEL]; // 216B
32605ca02815Sjsg /**
32615ca02815Sjsg * Maximum knee.
32625ca02815Sjsg */
32635ca02815Sjsg uint8_t max_knee[NUM_AGGR_LEVEL]; // 220B
32645ca02815Sjsg /**
32655ca02815Sjsg * Unused.
32665ca02815Sjsg */
32675ca02815Sjsg uint8_t iir_curve[NUM_AMBI_LEVEL]; // 224B
32685ca02815Sjsg /**
32695ca02815Sjsg * Explicit padding to 4 byte boundary.
32705ca02815Sjsg */
32715ca02815Sjsg uint8_t pad3[3]; // 229B
32725ca02815Sjsg /**
32735ca02815Sjsg * Backlight ramp reduction.
32745ca02815Sjsg */
32755ca02815Sjsg uint16_t blRampReduction[NUM_AGGR_LEVEL]; // 232B
32765ca02815Sjsg /**
32775ca02815Sjsg * Backlight ramp start.
32785ca02815Sjsg */
32795ca02815Sjsg uint16_t blRampStart[NUM_AGGR_LEVEL]; // 240B
3280ad8b1aafSjsg };
3281ad8b1aafSjsg
32825ca02815Sjsg /**
32835ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_SET_PIPE command.
32845ca02815Sjsg */
3285c349dbc7Sjsg struct dmub_cmd_abm_set_pipe_data {
32865ca02815Sjsg /**
32875ca02815Sjsg * OTG HW instance.
32885ca02815Sjsg */
3289ad8b1aafSjsg uint8_t otg_inst;
32905ca02815Sjsg
32915ca02815Sjsg /**
32925ca02815Sjsg * Panel Control HW instance.
32935ca02815Sjsg */
3294ad8b1aafSjsg uint8_t panel_inst;
32955ca02815Sjsg
32965ca02815Sjsg /**
32975ca02815Sjsg * Controls how ABM will interpret a set pipe or set level command.
32985ca02815Sjsg */
3299ad8b1aafSjsg uint8_t set_pipe_option;
33005ca02815Sjsg
33015ca02815Sjsg /**
33025ca02815Sjsg * Unused.
33035ca02815Sjsg * TODO: Remove.
33045ca02815Sjsg */
33055ca02815Sjsg uint8_t ramping_boundary;
3306*c1e59e83Sjsg
3307*c1e59e83Sjsg /**
3308*c1e59e83Sjsg * PwrSeq HW Instance.
3309*c1e59e83Sjsg */
3310*c1e59e83Sjsg uint8_t pwrseq_inst;
3311*c1e59e83Sjsg
3312*c1e59e83Sjsg /**
3313*c1e59e83Sjsg * Explicit padding to 4 byte boundary.
3314*c1e59e83Sjsg */
3315*c1e59e83Sjsg uint8_t pad[3];
3316c349dbc7Sjsg };
3317c349dbc7Sjsg
33185ca02815Sjsg /**
33195ca02815Sjsg * Definition of a DMUB_CMD__ABM_SET_PIPE command.
33205ca02815Sjsg */
3321c349dbc7Sjsg struct dmub_rb_cmd_abm_set_pipe {
33225ca02815Sjsg /**
33235ca02815Sjsg * Command header.
33245ca02815Sjsg */
3325c349dbc7Sjsg struct dmub_cmd_header header;
33265ca02815Sjsg
33275ca02815Sjsg /**
33285ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_SET_PIPE command.
33295ca02815Sjsg */
3330c349dbc7Sjsg struct dmub_cmd_abm_set_pipe_data abm_set_pipe_data;
3331c349dbc7Sjsg };
3332c349dbc7Sjsg
33335ca02815Sjsg /**
33345ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_SET_BACKLIGHT command.
33355ca02815Sjsg */
3336c349dbc7Sjsg struct dmub_cmd_abm_set_backlight_data {
33375ca02815Sjsg /**
33385ca02815Sjsg * Number of frames to ramp to backlight user level.
33395ca02815Sjsg */
3340c349dbc7Sjsg uint32_t frame_ramp;
33415ca02815Sjsg
33425ca02815Sjsg /**
33435ca02815Sjsg * Requested backlight level from user.
33445ca02815Sjsg */
3345ad8b1aafSjsg uint32_t backlight_user_level;
33465ca02815Sjsg
33475ca02815Sjsg /**
33485ca02815Sjsg * ABM control version.
33495ca02815Sjsg */
33505ca02815Sjsg uint8_t version;
33515ca02815Sjsg
33525ca02815Sjsg /**
33535ca02815Sjsg * Panel Control HW instance mask.
33545ca02815Sjsg * Bit 0 is Panel Control HW instance 0.
33555ca02815Sjsg * Bit 1 is Panel Control HW instance 1.
33565ca02815Sjsg */
33575ca02815Sjsg uint8_t panel_mask;
33585ca02815Sjsg
33595ca02815Sjsg /**
33605ca02815Sjsg * Explicit padding to 4 byte boundary.
33615ca02815Sjsg */
33625ca02815Sjsg uint8_t pad[2];
3363c349dbc7Sjsg };
3364c349dbc7Sjsg
33655ca02815Sjsg /**
33665ca02815Sjsg * Definition of a DMUB_CMD__ABM_SET_BACKLIGHT command.
33675ca02815Sjsg */
3368c349dbc7Sjsg struct dmub_rb_cmd_abm_set_backlight {
33695ca02815Sjsg /**
33705ca02815Sjsg * Command header.
33715ca02815Sjsg */
3372c349dbc7Sjsg struct dmub_cmd_header header;
33735ca02815Sjsg
33745ca02815Sjsg /**
33755ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_SET_BACKLIGHT command.
33765ca02815Sjsg */
3377c349dbc7Sjsg struct dmub_cmd_abm_set_backlight_data abm_set_backlight_data;
3378c349dbc7Sjsg };
3379c349dbc7Sjsg
33805ca02815Sjsg /**
33815ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_SET_LEVEL command.
33825ca02815Sjsg */
3383c349dbc7Sjsg struct dmub_cmd_abm_set_level_data {
33845ca02815Sjsg /**
33855ca02815Sjsg * Set current ABM operating/aggression level.
33865ca02815Sjsg */
3387c349dbc7Sjsg uint32_t level;
33885ca02815Sjsg
33895ca02815Sjsg /**
33905ca02815Sjsg * ABM control version.
33915ca02815Sjsg */
33925ca02815Sjsg uint8_t version;
33935ca02815Sjsg
33945ca02815Sjsg /**
33955ca02815Sjsg * Panel Control HW instance mask.
33965ca02815Sjsg * Bit 0 is Panel Control HW instance 0.
33975ca02815Sjsg * Bit 1 is Panel Control HW instance 1.
33985ca02815Sjsg */
33995ca02815Sjsg uint8_t panel_mask;
34005ca02815Sjsg
34015ca02815Sjsg /**
34025ca02815Sjsg * Explicit padding to 4 byte boundary.
34035ca02815Sjsg */
34045ca02815Sjsg uint8_t pad[2];
3405c349dbc7Sjsg };
3406c349dbc7Sjsg
34075ca02815Sjsg /**
34085ca02815Sjsg * Definition of a DMUB_CMD__ABM_SET_LEVEL command.
34095ca02815Sjsg */
3410c349dbc7Sjsg struct dmub_rb_cmd_abm_set_level {
34115ca02815Sjsg /**
34125ca02815Sjsg * Command header.
34135ca02815Sjsg */
3414c349dbc7Sjsg struct dmub_cmd_header header;
34155ca02815Sjsg
34165ca02815Sjsg /**
34175ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_SET_LEVEL command.
34185ca02815Sjsg */
3419c349dbc7Sjsg struct dmub_cmd_abm_set_level_data abm_set_level_data;
3420c349dbc7Sjsg };
3421c349dbc7Sjsg
34225ca02815Sjsg /**
34235ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_SET_AMBIENT_LEVEL command.
34245ca02815Sjsg */
3425c349dbc7Sjsg struct dmub_cmd_abm_set_ambient_level_data {
34265ca02815Sjsg /**
34275ca02815Sjsg * Ambient light sensor reading from OS.
34285ca02815Sjsg */
3429c349dbc7Sjsg uint32_t ambient_lux;
34305ca02815Sjsg
34315ca02815Sjsg /**
34325ca02815Sjsg * ABM control version.
34335ca02815Sjsg */
34345ca02815Sjsg uint8_t version;
34355ca02815Sjsg
34365ca02815Sjsg /**
34375ca02815Sjsg * Panel Control HW instance mask.
34385ca02815Sjsg * Bit 0 is Panel Control HW instance 0.
34395ca02815Sjsg * Bit 1 is Panel Control HW instance 1.
34405ca02815Sjsg */
34415ca02815Sjsg uint8_t panel_mask;
34425ca02815Sjsg
34435ca02815Sjsg /**
34445ca02815Sjsg * Explicit padding to 4 byte boundary.
34455ca02815Sjsg */
34465ca02815Sjsg uint8_t pad[2];
3447c349dbc7Sjsg };
3448c349dbc7Sjsg
34495ca02815Sjsg /**
34505ca02815Sjsg * Definition of a DMUB_CMD__ABM_SET_AMBIENT_LEVEL command.
34515ca02815Sjsg */
3452c349dbc7Sjsg struct dmub_rb_cmd_abm_set_ambient_level {
34535ca02815Sjsg /**
34545ca02815Sjsg * Command header.
34555ca02815Sjsg */
3456c349dbc7Sjsg struct dmub_cmd_header header;
34575ca02815Sjsg
34585ca02815Sjsg /**
34595ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_SET_AMBIENT_LEVEL command.
34605ca02815Sjsg */
3461c349dbc7Sjsg struct dmub_cmd_abm_set_ambient_level_data abm_set_ambient_level_data;
3462c349dbc7Sjsg };
3463c349dbc7Sjsg
34645ca02815Sjsg /**
34655ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_SET_PWM_FRAC command.
34665ca02815Sjsg */
3467c349dbc7Sjsg struct dmub_cmd_abm_set_pwm_frac_data {
34685ca02815Sjsg /**
34695ca02815Sjsg * Enable/disable fractional duty cycle for backlight PWM.
34705ca02815Sjsg * TODO: Convert to uint8_t.
34715ca02815Sjsg */
3472c349dbc7Sjsg uint32_t fractional_pwm;
34735ca02815Sjsg
34745ca02815Sjsg /**
34755ca02815Sjsg * ABM control version.
34765ca02815Sjsg */
34775ca02815Sjsg uint8_t version;
34785ca02815Sjsg
34795ca02815Sjsg /**
34805ca02815Sjsg * Panel Control HW instance mask.
34815ca02815Sjsg * Bit 0 is Panel Control HW instance 0.
34825ca02815Sjsg * Bit 1 is Panel Control HW instance 1.
34835ca02815Sjsg */
34845ca02815Sjsg uint8_t panel_mask;
34855ca02815Sjsg
34865ca02815Sjsg /**
34875ca02815Sjsg * Explicit padding to 4 byte boundary.
34885ca02815Sjsg */
34895ca02815Sjsg uint8_t pad[2];
3490c349dbc7Sjsg };
3491c349dbc7Sjsg
34925ca02815Sjsg /**
34935ca02815Sjsg * Definition of a DMUB_CMD__ABM_SET_PWM_FRAC command.
34945ca02815Sjsg */
3495c349dbc7Sjsg struct dmub_rb_cmd_abm_set_pwm_frac {
34965ca02815Sjsg /**
34975ca02815Sjsg * Command header.
34985ca02815Sjsg */
3499c349dbc7Sjsg struct dmub_cmd_header header;
35005ca02815Sjsg
35015ca02815Sjsg /**
35025ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_SET_PWM_FRAC command.
35035ca02815Sjsg */
3504c349dbc7Sjsg struct dmub_cmd_abm_set_pwm_frac_data abm_set_pwm_frac_data;
3505c349dbc7Sjsg };
3506c349dbc7Sjsg
35075ca02815Sjsg /**
35085ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_INIT_CONFIG command.
35095ca02815Sjsg */
3510ad8b1aafSjsg struct dmub_cmd_abm_init_config_data {
35115ca02815Sjsg /**
35125ca02815Sjsg * Location of indirect buffer used to pass init data to ABM.
35135ca02815Sjsg */
3514ad8b1aafSjsg union dmub_addr src;
35155ca02815Sjsg
35165ca02815Sjsg /**
35175ca02815Sjsg * Indirect buffer length.
35185ca02815Sjsg */
3519ad8b1aafSjsg uint16_t bytes;
35205ca02815Sjsg
35215ca02815Sjsg
35225ca02815Sjsg /**
35235ca02815Sjsg * ABM control version.
35245ca02815Sjsg */
35255ca02815Sjsg uint8_t version;
35265ca02815Sjsg
35275ca02815Sjsg /**
35285ca02815Sjsg * Panel Control HW instance mask.
35295ca02815Sjsg * Bit 0 is Panel Control HW instance 0.
35305ca02815Sjsg * Bit 1 is Panel Control HW instance 1.
35315ca02815Sjsg */
35325ca02815Sjsg uint8_t panel_mask;
35335ca02815Sjsg
35345ca02815Sjsg /**
35355ca02815Sjsg * Explicit padding to 4 byte boundary.
35365ca02815Sjsg */
35375ca02815Sjsg uint8_t pad[2];
3538ad8b1aafSjsg };
3539ad8b1aafSjsg
35405ca02815Sjsg /**
35415ca02815Sjsg * Definition of a DMUB_CMD__ABM_INIT_CONFIG command.
35425ca02815Sjsg */
3543ad8b1aafSjsg struct dmub_rb_cmd_abm_init_config {
35445ca02815Sjsg /**
35455ca02815Sjsg * Command header.
35465ca02815Sjsg */
3547ad8b1aafSjsg struct dmub_cmd_header header;
35485ca02815Sjsg
35495ca02815Sjsg /**
35505ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_INIT_CONFIG command.
35515ca02815Sjsg */
3552ad8b1aafSjsg struct dmub_cmd_abm_init_config_data abm_init_config_data;
3553ad8b1aafSjsg };
3554ad8b1aafSjsg
35555ca02815Sjsg /**
35561bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_PAUSE command.
35571bb76ff1Sjsg */
35581bb76ff1Sjsg
35591bb76ff1Sjsg struct dmub_cmd_abm_pause_data {
35601bb76ff1Sjsg
35611bb76ff1Sjsg /**
35621bb76ff1Sjsg * Panel Control HW instance mask.
35631bb76ff1Sjsg * Bit 0 is Panel Control HW instance 0.
35641bb76ff1Sjsg * Bit 1 is Panel Control HW instance 1.
35651bb76ff1Sjsg */
35661bb76ff1Sjsg uint8_t panel_mask;
35671bb76ff1Sjsg
35681bb76ff1Sjsg /**
35691bb76ff1Sjsg * OTG hw instance
35701bb76ff1Sjsg */
35711bb76ff1Sjsg uint8_t otg_inst;
35721bb76ff1Sjsg
35731bb76ff1Sjsg /**
35741bb76ff1Sjsg * Enable or disable ABM pause
35751bb76ff1Sjsg */
35761bb76ff1Sjsg uint8_t enable;
35771bb76ff1Sjsg
35781bb76ff1Sjsg /**
35791bb76ff1Sjsg * Explicit padding to 4 byte boundary.
35801bb76ff1Sjsg */
35811bb76ff1Sjsg uint8_t pad[1];
35821bb76ff1Sjsg };
35831bb76ff1Sjsg
3584f005ef32Sjsg
35851bb76ff1Sjsg /**
35861bb76ff1Sjsg * Definition of a DMUB_CMD__ABM_PAUSE command.
35871bb76ff1Sjsg */
35881bb76ff1Sjsg struct dmub_rb_cmd_abm_pause {
35891bb76ff1Sjsg /**
35901bb76ff1Sjsg * Command header.
35911bb76ff1Sjsg */
35921bb76ff1Sjsg struct dmub_cmd_header header;
35931bb76ff1Sjsg
35941bb76ff1Sjsg /**
35951bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_PAUSE command.
35961bb76ff1Sjsg */
35971bb76ff1Sjsg struct dmub_cmd_abm_pause_data abm_pause_data;
35981bb76ff1Sjsg };
35991bb76ff1Sjsg
36001bb76ff1Sjsg /**
3601f005ef32Sjsg * Definition of a DMUB_CMD__ABM_SAVE_RESTORE command.
3602f005ef32Sjsg */
3603f005ef32Sjsg struct dmub_rb_cmd_abm_save_restore {
3604f005ef32Sjsg /**
3605f005ef32Sjsg * Command header.
3606f005ef32Sjsg */
3607f005ef32Sjsg struct dmub_cmd_header header;
3608f005ef32Sjsg
3609f005ef32Sjsg /**
3610f005ef32Sjsg * OTG hw instance
3611f005ef32Sjsg */
3612f005ef32Sjsg uint8_t otg_inst;
3613f005ef32Sjsg
3614f005ef32Sjsg /**
3615f005ef32Sjsg * Enable or disable ABM pause
3616f005ef32Sjsg */
3617f005ef32Sjsg uint8_t freeze;
3618f005ef32Sjsg
3619f005ef32Sjsg /**
3620f005ef32Sjsg * Explicit padding to 4 byte boundary.
3621f005ef32Sjsg */
3622f005ef32Sjsg uint8_t debug;
3623f005ef32Sjsg
3624f005ef32Sjsg /**
3625f005ef32Sjsg * Data passed from driver to FW in a DMUB_CMD__ABM_INIT_CONFIG command.
3626f005ef32Sjsg */
3627f005ef32Sjsg struct dmub_cmd_abm_init_config_data abm_init_config_data;
3628f005ef32Sjsg };
3629f005ef32Sjsg
3630f005ef32Sjsg /**
36315ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__QUERY_FEATURE_CAPS command.
36325ca02815Sjsg */
36335ca02815Sjsg struct dmub_cmd_query_feature_caps_data {
36345ca02815Sjsg /**
36355ca02815Sjsg * DMUB feature capabilities.
36365ca02815Sjsg * After DMUB init, driver will query FW capabilities prior to enabling certain features.
36375ca02815Sjsg */
36385ca02815Sjsg struct dmub_feature_caps feature_caps;
3639c349dbc7Sjsg };
3640c349dbc7Sjsg
36415ca02815Sjsg /**
36425ca02815Sjsg * Definition of a DMUB_CMD__QUERY_FEATURE_CAPS command.
36435ca02815Sjsg */
36445ca02815Sjsg struct dmub_rb_cmd_query_feature_caps {
36455ca02815Sjsg /**
36465ca02815Sjsg * Command header.
36475ca02815Sjsg */
36485ca02815Sjsg struct dmub_cmd_header header;
36495ca02815Sjsg /**
36505ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__QUERY_FEATURE_CAPS command.
36515ca02815Sjsg */
36525ca02815Sjsg struct dmub_cmd_query_feature_caps_data query_feature_caps_data;
36535ca02815Sjsg };
36545ca02815Sjsg
36551bb76ff1Sjsg /**
36561bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__GET_VISUAL_CONFIRM_COLOR command.
36571bb76ff1Sjsg */
36581bb76ff1Sjsg struct dmub_cmd_visual_confirm_color_data {
36591bb76ff1Sjsg /**
36601bb76ff1Sjsg * DMUB feature capabilities.
36611bb76ff1Sjsg * After DMUB init, driver will query FW capabilities prior to enabling certain features.
36621bb76ff1Sjsg */
36631bb76ff1Sjsg struct dmub_visual_confirm_color visual_confirm_color;
36641bb76ff1Sjsg };
36651bb76ff1Sjsg
36661bb76ff1Sjsg /**
36671bb76ff1Sjsg * Definition of a DMUB_CMD__GET_VISUAL_CONFIRM_COLOR command.
36681bb76ff1Sjsg */
36691bb76ff1Sjsg struct dmub_rb_cmd_get_visual_confirm_color {
36701bb76ff1Sjsg /**
36711bb76ff1Sjsg * Command header.
36721bb76ff1Sjsg */
36731bb76ff1Sjsg struct dmub_cmd_header header;
36741bb76ff1Sjsg /**
36751bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD__GET_VISUAL_CONFIRM_COLOR command.
36761bb76ff1Sjsg */
36771bb76ff1Sjsg struct dmub_cmd_visual_confirm_color_data visual_confirm_color_data;
36781bb76ff1Sjsg };
36791bb76ff1Sjsg
36805ca02815Sjsg struct dmub_optc_state {
36815ca02815Sjsg uint32_t v_total_max;
36825ca02815Sjsg uint32_t v_total_min;
36835ca02815Sjsg uint32_t tg_inst;
36845ca02815Sjsg };
36855ca02815Sjsg
36865ca02815Sjsg struct dmub_rb_cmd_drr_update {
36875ca02815Sjsg struct dmub_cmd_header header;
36885ca02815Sjsg struct dmub_optc_state dmub_optc_state_req;
36895ca02815Sjsg };
36905ca02815Sjsg
36911bb76ff1Sjsg struct dmub_cmd_fw_assisted_mclk_switch_pipe_data {
36921bb76ff1Sjsg uint32_t pix_clk_100hz;
36931bb76ff1Sjsg uint8_t max_ramp_step;
36941bb76ff1Sjsg uint8_t pipes;
36951bb76ff1Sjsg uint8_t min_refresh_in_hz;
3696f005ef32Sjsg uint8_t pipe_count;
3697f005ef32Sjsg uint8_t pipe_index[4];
36981bb76ff1Sjsg };
36991bb76ff1Sjsg
37001bb76ff1Sjsg struct dmub_cmd_fw_assisted_mclk_switch_config {
37011bb76ff1Sjsg uint8_t fams_enabled;
37021bb76ff1Sjsg uint8_t visual_confirm_enabled;
3703f005ef32Sjsg uint16_t vactive_stretch_margin_us; // Extra vblank stretch required when doing FPO + Vactive
3704f005ef32Sjsg struct dmub_cmd_fw_assisted_mclk_switch_pipe_data pipe_data[DMUB_MAX_FPO_STREAMS];
37051bb76ff1Sjsg };
37061bb76ff1Sjsg
37071bb76ff1Sjsg struct dmub_rb_cmd_fw_assisted_mclk_switch {
37081bb76ff1Sjsg struct dmub_cmd_header header;
37091bb76ff1Sjsg struct dmub_cmd_fw_assisted_mclk_switch_config config_data;
37101bb76ff1Sjsg };
37111bb76ff1Sjsg
37125ca02815Sjsg /**
37135ca02815Sjsg * enum dmub_cmd_panel_cntl_type - Panel control command.
37145ca02815Sjsg */
37155ca02815Sjsg enum dmub_cmd_panel_cntl_type {
37165ca02815Sjsg /**
37175ca02815Sjsg * Initializes embedded panel hardware blocks.
37185ca02815Sjsg */
37195ca02815Sjsg DMUB_CMD__PANEL_CNTL_HW_INIT = 0,
37205ca02815Sjsg /**
37215ca02815Sjsg * Queries backlight info for the embedded panel.
37225ca02815Sjsg */
37235ca02815Sjsg DMUB_CMD__PANEL_CNTL_QUERY_BACKLIGHT_INFO = 1,
37245ca02815Sjsg };
37255ca02815Sjsg
37265ca02815Sjsg /**
37275ca02815Sjsg * struct dmub_cmd_panel_cntl_data - Panel control data.
37285ca02815Sjsg */
37295ca02815Sjsg struct dmub_cmd_panel_cntl_data {
3730*c1e59e83Sjsg uint32_t pwrseq_inst; /**< pwrseq instance */
37315ca02815Sjsg uint32_t current_backlight; /* in/out */
37325ca02815Sjsg uint32_t bl_pwm_cntl; /* in/out */
37335ca02815Sjsg uint32_t bl_pwm_period_cntl; /* in/out */
37345ca02815Sjsg uint32_t bl_pwm_ref_div1; /* in/out */
37355ca02815Sjsg uint8_t is_backlight_on : 1; /* in/out */
37365ca02815Sjsg uint8_t is_powered_on : 1; /* in/out */
37371bb76ff1Sjsg uint8_t padding[3];
37381bb76ff1Sjsg uint32_t bl_pwm_ref_div2; /* in/out */
37391bb76ff1Sjsg uint8_t reserved[4];
37405ca02815Sjsg };
37415ca02815Sjsg
37425ca02815Sjsg /**
37435ca02815Sjsg * struct dmub_rb_cmd_panel_cntl - Panel control command.
37445ca02815Sjsg */
37455ca02815Sjsg struct dmub_rb_cmd_panel_cntl {
37465ca02815Sjsg struct dmub_cmd_header header; /**< header */
37475ca02815Sjsg struct dmub_cmd_panel_cntl_data data; /**< payload */
37485ca02815Sjsg };
37495ca02815Sjsg
37505ca02815Sjsg /**
37515ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__VBIOS_LVTMA_CONTROL command.
37525ca02815Sjsg */
37535ca02815Sjsg struct dmub_cmd_lvtma_control_data {
37545ca02815Sjsg uint8_t uc_pwr_action; /**< LVTMA_ACTION */
3755f005ef32Sjsg uint8_t bypass_panel_control_wait;
3756f005ef32Sjsg uint8_t reserved_0[2]; /**< For future use */
3757*c1e59e83Sjsg uint8_t pwrseq_inst; /**< LVTMA control instance */
37585ca02815Sjsg uint8_t reserved_1[3]; /**< For future use */
37595ca02815Sjsg };
37605ca02815Sjsg
37615ca02815Sjsg /**
37625ca02815Sjsg * Definition of a DMUB_CMD__VBIOS_LVTMA_CONTROL command.
37635ca02815Sjsg */
37645ca02815Sjsg struct dmub_rb_cmd_lvtma_control {
37655ca02815Sjsg /**
37665ca02815Sjsg * Command header.
37675ca02815Sjsg */
37685ca02815Sjsg struct dmub_cmd_header header;
37695ca02815Sjsg /**
37705ca02815Sjsg * Data passed from driver to FW in a DMUB_CMD__VBIOS_LVTMA_CONTROL command.
37715ca02815Sjsg */
37725ca02815Sjsg struct dmub_cmd_lvtma_control_data data;
37735ca02815Sjsg };
37745ca02815Sjsg
37755ca02815Sjsg /**
37761bb76ff1Sjsg * Data passed in/out in a DMUB_CMD__VBIOS_TRANSMITTER_QUERY_DP_ALT command.
37771bb76ff1Sjsg */
37781bb76ff1Sjsg struct dmub_rb_cmd_transmitter_query_dp_alt_data {
37791bb76ff1Sjsg uint8_t phy_id; /**< 0=UNIPHYA, 1=UNIPHYB, 2=UNIPHYC, 3=UNIPHYD, 4=UNIPHYE, 5=UNIPHYF */
37801bb76ff1Sjsg uint8_t is_usb; /**< is phy is usb */
37811bb76ff1Sjsg uint8_t is_dp_alt_disable; /**< is dp alt disable */
37821bb76ff1Sjsg uint8_t is_dp4; /**< is dp in 4 lane */
37831bb76ff1Sjsg };
37841bb76ff1Sjsg
37851bb76ff1Sjsg /**
37861bb76ff1Sjsg * Definition of a DMUB_CMD__VBIOS_TRANSMITTER_QUERY_DP_ALT command.
37871bb76ff1Sjsg */
37881bb76ff1Sjsg struct dmub_rb_cmd_transmitter_query_dp_alt {
37891bb76ff1Sjsg struct dmub_cmd_header header; /**< header */
37901bb76ff1Sjsg struct dmub_rb_cmd_transmitter_query_dp_alt_data data; /**< payload */
37911bb76ff1Sjsg };
37921bb76ff1Sjsg
37931bb76ff1Sjsg /**
37945ca02815Sjsg * Maximum number of bytes a chunk sent to DMUB for parsing
37955ca02815Sjsg */
37965ca02815Sjsg #define DMUB_EDID_CEA_DATA_CHUNK_BYTES 8
37975ca02815Sjsg
37985ca02815Sjsg /**
37995ca02815Sjsg * Represent a chunk of CEA blocks sent to DMUB for parsing
38005ca02815Sjsg */
38015ca02815Sjsg struct dmub_cmd_send_edid_cea {
38025ca02815Sjsg uint16_t offset; /**< offset into the CEA block */
38035ca02815Sjsg uint8_t length; /**< number of bytes in payload to copy as part of CEA block */
38041bb76ff1Sjsg uint16_t cea_total_length; /**< total length of the CEA block */
38055ca02815Sjsg uint8_t payload[DMUB_EDID_CEA_DATA_CHUNK_BYTES]; /**< data chunk of the CEA block */
38065ca02815Sjsg uint8_t pad[3]; /**< padding and for future expansion */
38075ca02815Sjsg };
38085ca02815Sjsg
38095ca02815Sjsg /**
38105ca02815Sjsg * Result of VSDB parsing from CEA block
38115ca02815Sjsg */
38125ca02815Sjsg struct dmub_cmd_edid_cea_amd_vsdb {
38135ca02815Sjsg uint8_t vsdb_found; /**< 1 if parsing has found valid AMD VSDB */
38145ca02815Sjsg uint8_t freesync_supported; /**< 1 if Freesync is supported */
38155ca02815Sjsg uint16_t amd_vsdb_version; /**< AMD VSDB version */
38165ca02815Sjsg uint16_t min_frame_rate; /**< Maximum frame rate */
38175ca02815Sjsg uint16_t max_frame_rate; /**< Minimum frame rate */
38185ca02815Sjsg };
38195ca02815Sjsg
38205ca02815Sjsg /**
38215ca02815Sjsg * Result of sending a CEA chunk
38225ca02815Sjsg */
38235ca02815Sjsg struct dmub_cmd_edid_cea_ack {
38245ca02815Sjsg uint16_t offset; /**< offset of the chunk into the CEA block */
38255ca02815Sjsg uint8_t success; /**< 1 if this sending of chunk succeeded */
38265ca02815Sjsg uint8_t pad; /**< padding and for future expansion */
38275ca02815Sjsg };
38285ca02815Sjsg
38295ca02815Sjsg /**
38305ca02815Sjsg * Specify whether the result is an ACK/NACK or the parsing has finished
38315ca02815Sjsg */
38325ca02815Sjsg enum dmub_cmd_edid_cea_reply_type {
38335ca02815Sjsg DMUB_CMD__EDID_CEA_AMD_VSDB = 1, /**< VSDB parsing has finished */
38345ca02815Sjsg DMUB_CMD__EDID_CEA_ACK = 2, /**< acknowledges the CEA sending is OK or failing */
38355ca02815Sjsg };
38365ca02815Sjsg
38375ca02815Sjsg /**
38385ca02815Sjsg * Definition of a DMUB_CMD__EDID_CEA command.
38395ca02815Sjsg */
38405ca02815Sjsg struct dmub_rb_cmd_edid_cea {
38415ca02815Sjsg struct dmub_cmd_header header; /**< Command header */
38425ca02815Sjsg union dmub_cmd_edid_cea_data {
38435ca02815Sjsg struct dmub_cmd_send_edid_cea input; /**< input to send CEA chunks */
38445ca02815Sjsg struct dmub_cmd_edid_cea_output { /**< output with results */
38455ca02815Sjsg uint8_t type; /**< dmub_cmd_edid_cea_reply_type */
38465ca02815Sjsg union {
38475ca02815Sjsg struct dmub_cmd_edid_cea_amd_vsdb amd_vsdb;
38485ca02815Sjsg struct dmub_cmd_edid_cea_ack ack;
38495ca02815Sjsg };
38505ca02815Sjsg } output; /**< output to retrieve ACK/NACK or VSDB parsing results */
38515ca02815Sjsg } data; /**< Command data */
38525ca02815Sjsg
38535ca02815Sjsg };
38545ca02815Sjsg
38555ca02815Sjsg /**
38561bb76ff1Sjsg * struct dmub_cmd_cable_id_input - Defines the input of DMUB_CMD_GET_USBC_CABLE_ID command.
38571bb76ff1Sjsg */
38581bb76ff1Sjsg struct dmub_cmd_cable_id_input {
38591bb76ff1Sjsg uint8_t phy_inst; /**< phy inst for cable id data */
38601bb76ff1Sjsg };
38611bb76ff1Sjsg
38621bb76ff1Sjsg /**
38631bb76ff1Sjsg * struct dmub_cmd_cable_id_input - Defines the output of DMUB_CMD_GET_USBC_CABLE_ID command.
38641bb76ff1Sjsg */
38651bb76ff1Sjsg struct dmub_cmd_cable_id_output {
38661bb76ff1Sjsg uint8_t UHBR10_20_CAPABILITY :2; /**< b'01 for UHBR10 support, b'10 for both UHBR10 and UHBR20 support */
38671bb76ff1Sjsg uint8_t UHBR13_5_CAPABILITY :1; /**< b'1 for UHBR13.5 support */
38681bb76ff1Sjsg uint8_t CABLE_TYPE :3; /**< b'01 for passive cable, b'10 for active LRD cable, b'11 for active retimer cable */
38691bb76ff1Sjsg uint8_t RESERVED :2; /**< reserved means not defined */
38701bb76ff1Sjsg };
38711bb76ff1Sjsg
38721bb76ff1Sjsg /**
38731bb76ff1Sjsg * Definition of a DMUB_CMD_GET_USBC_CABLE_ID command
38741bb76ff1Sjsg */
38751bb76ff1Sjsg struct dmub_rb_cmd_get_usbc_cable_id {
38761bb76ff1Sjsg struct dmub_cmd_header header; /**< Command header */
38771bb76ff1Sjsg /**
38781bb76ff1Sjsg * Data passed from driver to FW in a DMUB_CMD_GET_USBC_CABLE_ID command.
38791bb76ff1Sjsg */
38801bb76ff1Sjsg union dmub_cmd_cable_id_data {
38811bb76ff1Sjsg struct dmub_cmd_cable_id_input input; /**< Input */
38821bb76ff1Sjsg struct dmub_cmd_cable_id_output output; /**< Output */
38831bb76ff1Sjsg uint8_t output_raw; /**< Raw data output */
38841bb76ff1Sjsg } data;
38851bb76ff1Sjsg };
38861bb76ff1Sjsg
38871bb76ff1Sjsg /**
3888f005ef32Sjsg * Command type of a DMUB_CMD__SECURE_DISPLAY command
3889f005ef32Sjsg */
3890f005ef32Sjsg enum dmub_cmd_secure_display_type {
3891f005ef32Sjsg DMUB_CMD__SECURE_DISPLAY_TEST_CMD = 0, /* test command to only check if inbox message works */
3892f005ef32Sjsg DMUB_CMD__SECURE_DISPLAY_CRC_STOP_UPDATE,
3893f005ef32Sjsg DMUB_CMD__SECURE_DISPLAY_CRC_WIN_NOTIFY
3894f005ef32Sjsg };
3895f005ef32Sjsg
3896f005ef32Sjsg /**
3897f005ef32Sjsg * Definition of a DMUB_CMD__SECURE_DISPLAY command
3898f005ef32Sjsg */
3899f005ef32Sjsg struct dmub_rb_cmd_secure_display {
3900f005ef32Sjsg struct dmub_cmd_header header;
3901f005ef32Sjsg /**
3902f005ef32Sjsg * Data passed from driver to dmub firmware.
3903f005ef32Sjsg */
3904f005ef32Sjsg struct dmub_cmd_roi_info {
3905f005ef32Sjsg uint16_t x_start;
3906f005ef32Sjsg uint16_t x_end;
3907f005ef32Sjsg uint16_t y_start;
3908f005ef32Sjsg uint16_t y_end;
3909f005ef32Sjsg uint8_t otg_id;
3910f005ef32Sjsg uint8_t phy_id;
3911f005ef32Sjsg } roi_info;
3912f005ef32Sjsg };
3913f005ef32Sjsg
3914f005ef32Sjsg /**
39155ca02815Sjsg * union dmub_rb_cmd - DMUB inbox command.
39165ca02815Sjsg */
39175ca02815Sjsg union dmub_rb_cmd {
39185ca02815Sjsg /**
39195ca02815Sjsg * Elements shared with all commands.
39205ca02815Sjsg */
3921ad8b1aafSjsg struct dmub_rb_cmd_common cmd_common;
39225ca02815Sjsg /**
39235ca02815Sjsg * Definition of a DMUB_CMD__REG_SEQ_READ_MODIFY_WRITE command.
39245ca02815Sjsg */
39255ca02815Sjsg struct dmub_rb_cmd_read_modify_write read_modify_write;
39265ca02815Sjsg /**
39275ca02815Sjsg * Definition of a DMUB_CMD__REG_SEQ_FIELD_UPDATE_SEQ command.
39285ca02815Sjsg */
39295ca02815Sjsg struct dmub_rb_cmd_reg_field_update_sequence reg_field_update_seq;
39305ca02815Sjsg /**
39315ca02815Sjsg * Definition of a DMUB_CMD__REG_SEQ_BURST_WRITE command.
39325ca02815Sjsg */
39335ca02815Sjsg struct dmub_rb_cmd_burst_write burst_write;
39345ca02815Sjsg /**
39355ca02815Sjsg * Definition of a DMUB_CMD__REG_REG_WAIT command.
39365ca02815Sjsg */
39375ca02815Sjsg struct dmub_rb_cmd_reg_wait reg_wait;
39385ca02815Sjsg /**
39395ca02815Sjsg * Definition of a DMUB_CMD__VBIOS_DIGX_ENCODER_CONTROL command.
39405ca02815Sjsg */
39415ca02815Sjsg struct dmub_rb_cmd_digx_encoder_control digx_encoder_control;
39425ca02815Sjsg /**
39435ca02815Sjsg * Definition of a DMUB_CMD__VBIOS_SET_PIXEL_CLOCK command.
39445ca02815Sjsg */
39455ca02815Sjsg struct dmub_rb_cmd_set_pixel_clock set_pixel_clock;
39465ca02815Sjsg /**
39475ca02815Sjsg * Definition of a DMUB_CMD__VBIOS_ENABLE_DISP_POWER_GATING command.
39485ca02815Sjsg */
39495ca02815Sjsg struct dmub_rb_cmd_enable_disp_power_gating enable_disp_power_gating;
39505ca02815Sjsg /**
39515ca02815Sjsg * Definition of a DMUB_CMD__VBIOS_DPPHY_INIT command.
39525ca02815Sjsg */
39535ca02815Sjsg struct dmub_rb_cmd_dpphy_init dpphy_init;
39545ca02815Sjsg /**
39555ca02815Sjsg * Definition of a DMUB_CMD__VBIOS_DIG1_TRANSMITTER_CONTROL command.
39565ca02815Sjsg */
39575ca02815Sjsg struct dmub_rb_cmd_dig1_transmitter_control dig1_transmitter_control;
39585ca02815Sjsg /**
395918b3e4ddSjsg * Definition of a DMUB_CMD__VBIOS_DOMAIN_CONTROL command.
396018b3e4ddSjsg */
396118b3e4ddSjsg struct dmub_rb_cmd_domain_control domain_control;
396218b3e4ddSjsg /**
39635ca02815Sjsg * Definition of a DMUB_CMD__PSR_SET_VERSION command.
39645ca02815Sjsg */
39655ca02815Sjsg struct dmub_rb_cmd_psr_set_version psr_set_version;
39665ca02815Sjsg /**
39675ca02815Sjsg * Definition of a DMUB_CMD__PSR_COPY_SETTINGS command.
39685ca02815Sjsg */
39695ca02815Sjsg struct dmub_rb_cmd_psr_copy_settings psr_copy_settings;
39705ca02815Sjsg /**
39715ca02815Sjsg * Definition of a DMUB_CMD__PSR_ENABLE command.
39725ca02815Sjsg */
39735ca02815Sjsg struct dmub_rb_cmd_psr_enable psr_enable;
39745ca02815Sjsg /**
39755ca02815Sjsg * Definition of a DMUB_CMD__PSR_SET_LEVEL command.
39765ca02815Sjsg */
39775ca02815Sjsg struct dmub_rb_cmd_psr_set_level psr_set_level;
39785ca02815Sjsg /**
39795ca02815Sjsg * Definition of a DMUB_CMD__PSR_FORCE_STATIC command.
39805ca02815Sjsg */
39815ca02815Sjsg struct dmub_rb_cmd_psr_force_static psr_force_static;
39825ca02815Sjsg /**
39831bb76ff1Sjsg * Definition of a DMUB_CMD__UPDATE_DIRTY_RECT command.
39841bb76ff1Sjsg */
39851bb76ff1Sjsg struct dmub_rb_cmd_update_dirty_rect update_dirty_rect;
39861bb76ff1Sjsg /**
39871bb76ff1Sjsg * Definition of a DMUB_CMD__UPDATE_CURSOR_INFO command.
39881bb76ff1Sjsg */
39891bb76ff1Sjsg struct dmub_rb_cmd_update_cursor_info update_cursor_info;
39901bb76ff1Sjsg /**
39911bb76ff1Sjsg * Definition of a DMUB_CMD__HW_LOCK command.
39921bb76ff1Sjsg * Command is used by driver and FW.
39931bb76ff1Sjsg */
39941bb76ff1Sjsg struct dmub_rb_cmd_lock_hw lock_hw;
39951bb76ff1Sjsg /**
39961bb76ff1Sjsg * Definition of a DMUB_CMD__SET_SINK_VTOTAL_IN_PSR_ACTIVE command.
39971bb76ff1Sjsg */
39981bb76ff1Sjsg struct dmub_rb_cmd_psr_set_vtotal psr_set_vtotal;
39991bb76ff1Sjsg /**
40001bb76ff1Sjsg * Definition of a DMUB_CMD__SET_PSR_POWER_OPT command.
40011bb76ff1Sjsg */
40021bb76ff1Sjsg struct dmub_rb_cmd_psr_set_power_opt psr_set_power_opt;
40031bb76ff1Sjsg /**
40045ca02815Sjsg * Definition of a DMUB_CMD__PLAT_54186_WA command.
40055ca02815Sjsg */
40065ca02815Sjsg struct dmub_rb_cmd_PLAT_54186_wa PLAT_54186_wa;
40075ca02815Sjsg /**
40085ca02815Sjsg * Definition of a DMUB_CMD__MALL command.
40095ca02815Sjsg */
40105ca02815Sjsg struct dmub_rb_cmd_mall mall;
40115ca02815Sjsg /**
40121bb76ff1Sjsg * Definition of a DMUB_CMD__CAB command.
40131bb76ff1Sjsg */
40141bb76ff1Sjsg struct dmub_rb_cmd_cab_for_ss cab;
40151bb76ff1Sjsg
40161bb76ff1Sjsg struct dmub_rb_cmd_fw_assisted_mclk_switch_v2 fw_assisted_mclk_switch_v2;
40171bb76ff1Sjsg
40181bb76ff1Sjsg /**
40195ca02815Sjsg * Definition of a DMUB_CMD__IDLE_OPT_DCN_RESTORE command.
40205ca02815Sjsg */
40215ca02815Sjsg struct dmub_rb_cmd_idle_opt_dcn_restore dcn_restore;
40225ca02815Sjsg
40235ca02815Sjsg /**
40245ca02815Sjsg * Definition of a DMUB_CMD__CLK_MGR_NOTIFY_CLOCKS command.
40255ca02815Sjsg */
40265ca02815Sjsg struct dmub_rb_cmd_clk_mgr_notify_clocks notify_clocks;
40275ca02815Sjsg
40285ca02815Sjsg /**
40295ca02815Sjsg * Definition of DMUB_CMD__PANEL_CNTL commands.
40305ca02815Sjsg */
40315ca02815Sjsg struct dmub_rb_cmd_panel_cntl panel_cntl;
40325ca02815Sjsg /**
40335ca02815Sjsg * Definition of a DMUB_CMD__ABM_SET_PIPE command.
40345ca02815Sjsg */
40355ca02815Sjsg struct dmub_rb_cmd_abm_set_pipe abm_set_pipe;
40365ca02815Sjsg
40375ca02815Sjsg /**
40385ca02815Sjsg * Definition of a DMUB_CMD__ABM_SET_BACKLIGHT command.
40395ca02815Sjsg */
40405ca02815Sjsg struct dmub_rb_cmd_abm_set_backlight abm_set_backlight;
40415ca02815Sjsg
40425ca02815Sjsg /**
40435ca02815Sjsg * Definition of a DMUB_CMD__ABM_SET_LEVEL command.
40445ca02815Sjsg */
40455ca02815Sjsg struct dmub_rb_cmd_abm_set_level abm_set_level;
40465ca02815Sjsg
40475ca02815Sjsg /**
40485ca02815Sjsg * Definition of a DMUB_CMD__ABM_SET_AMBIENT_LEVEL command.
40495ca02815Sjsg */
40505ca02815Sjsg struct dmub_rb_cmd_abm_set_ambient_level abm_set_ambient_level;
40515ca02815Sjsg
40525ca02815Sjsg /**
40535ca02815Sjsg * Definition of a DMUB_CMD__ABM_SET_PWM_FRAC command.
40545ca02815Sjsg */
40555ca02815Sjsg struct dmub_rb_cmd_abm_set_pwm_frac abm_set_pwm_frac;
40565ca02815Sjsg
40575ca02815Sjsg /**
40585ca02815Sjsg * Definition of a DMUB_CMD__ABM_INIT_CONFIG command.
40595ca02815Sjsg */
40605ca02815Sjsg struct dmub_rb_cmd_abm_init_config abm_init_config;
40615ca02815Sjsg
40625ca02815Sjsg /**
40631bb76ff1Sjsg * Definition of a DMUB_CMD__ABM_PAUSE command.
40641bb76ff1Sjsg */
40651bb76ff1Sjsg struct dmub_rb_cmd_abm_pause abm_pause;
40661bb76ff1Sjsg
40671bb76ff1Sjsg /**
4068f005ef32Sjsg * Definition of a DMUB_CMD__ABM_SAVE_RESTORE command.
4069f005ef32Sjsg */
4070f005ef32Sjsg struct dmub_rb_cmd_abm_save_restore abm_save_restore;
4071f005ef32Sjsg
4072f005ef32Sjsg /**
40735ca02815Sjsg * Definition of a DMUB_CMD__DP_AUX_ACCESS command.
40745ca02815Sjsg */
40755ca02815Sjsg struct dmub_rb_cmd_dp_aux_access dp_aux_access;
40765ca02815Sjsg
40775ca02815Sjsg /**
40785ca02815Sjsg * Definition of a DMUB_CMD__OUTBOX1_ENABLE command.
40795ca02815Sjsg */
40805ca02815Sjsg struct dmub_rb_cmd_outbox1_enable outbox1_enable;
40815ca02815Sjsg
40825ca02815Sjsg /**
40835ca02815Sjsg * Definition of a DMUB_CMD__QUERY_FEATURE_CAPS command.
40845ca02815Sjsg */
40855ca02815Sjsg struct dmub_rb_cmd_query_feature_caps query_feature_caps;
40861bb76ff1Sjsg
40871bb76ff1Sjsg /**
40881bb76ff1Sjsg * Definition of a DMUB_CMD__GET_VISUAL_CONFIRM_COLOR command.
40891bb76ff1Sjsg */
40901bb76ff1Sjsg struct dmub_rb_cmd_get_visual_confirm_color visual_confirm_color;
40915ca02815Sjsg struct dmub_rb_cmd_drr_update drr_update;
40921bb76ff1Sjsg struct dmub_rb_cmd_fw_assisted_mclk_switch fw_assisted_mclk_switch;
40931bb76ff1Sjsg
40945ca02815Sjsg /**
40955ca02815Sjsg * Definition of a DMUB_CMD__VBIOS_LVTMA_CONTROL command.
40965ca02815Sjsg */
40975ca02815Sjsg struct dmub_rb_cmd_lvtma_control lvtma_control;
40985ca02815Sjsg /**
40991bb76ff1Sjsg * Definition of a DMUB_CMD__VBIOS_TRANSMITTER_QUERY_DP_ALT command.
41001bb76ff1Sjsg */
41011bb76ff1Sjsg struct dmub_rb_cmd_transmitter_query_dp_alt query_dp_alt;
41021bb76ff1Sjsg /**
41031bb76ff1Sjsg * Definition of a DMUB_CMD__DPIA_DIG1_CONTROL command.
41041bb76ff1Sjsg */
41051bb76ff1Sjsg struct dmub_rb_cmd_dig1_dpia_control dig1_dpia_control;
41061bb76ff1Sjsg /**
41071bb76ff1Sjsg * Definition of a DMUB_CMD__DPIA_SET_CONFIG_ACCESS command.
41081bb76ff1Sjsg */
41091bb76ff1Sjsg struct dmub_rb_cmd_set_config_access set_config_access;
41101bb76ff1Sjsg /**
41111bb76ff1Sjsg * Definition of a DMUB_CMD__DPIA_MST_ALLOC_SLOTS command.
41121bb76ff1Sjsg */
41131bb76ff1Sjsg struct dmub_rb_cmd_set_mst_alloc_slots set_mst_alloc_slots;
41141bb76ff1Sjsg /**
41155ca02815Sjsg * Definition of a DMUB_CMD__EDID_CEA command.
41165ca02815Sjsg */
41175ca02815Sjsg struct dmub_rb_cmd_edid_cea edid_cea;
41181bb76ff1Sjsg /**
41191bb76ff1Sjsg * Definition of a DMUB_CMD_GET_USBC_CABLE_ID command.
41201bb76ff1Sjsg */
41211bb76ff1Sjsg struct dmub_rb_cmd_get_usbc_cable_id cable_id;
41221bb76ff1Sjsg
41231bb76ff1Sjsg /**
41241bb76ff1Sjsg * Definition of a DMUB_CMD__QUERY_HPD_STATE command.
41251bb76ff1Sjsg */
41261bb76ff1Sjsg struct dmub_rb_cmd_query_hpd_state query_hpd;
41271bb76ff1Sjsg /**
4128f005ef32Sjsg * Definition of a DMUB_CMD__SECURE_DISPLAY command.
4129f005ef32Sjsg */
4130f005ef32Sjsg struct dmub_rb_cmd_secure_display secure_display;
4131f005ef32Sjsg
4132f005ef32Sjsg /**
41331bb76ff1Sjsg * Definition of a DMUB_CMD__DPIA_HPD_INT_ENABLE command.
41341bb76ff1Sjsg */
41351bb76ff1Sjsg struct dmub_rb_cmd_dpia_hpd_int_enable dpia_hpd_int_enable;
4136f005ef32Sjsg /**
4137f005ef32Sjsg * Definition of a DMUB_CMD__IDLE_OPT_DCN_NOTIFY_IDLE command.
4138f005ef32Sjsg */
4139f005ef32Sjsg struct dmub_rb_cmd_idle_opt_dcn_notify_idle idle_opt_notify_idle;
4140f005ef32Sjsg /*
4141f005ef32Sjsg * Definition of a DMUB_CMD__REPLAY_COPY_SETTINGS command.
4142f005ef32Sjsg */
4143f005ef32Sjsg struct dmub_rb_cmd_replay_copy_settings replay_copy_settings;
4144f005ef32Sjsg /**
4145f005ef32Sjsg * Definition of a DMUB_CMD__REPLAY_ENABLE command.
4146f005ef32Sjsg */
4147f005ef32Sjsg struct dmub_rb_cmd_replay_enable replay_enable;
4148f005ef32Sjsg /**
4149f005ef32Sjsg * Definition of a DMUB_CMD__SET_REPLAY_POWER_OPT command.
4150f005ef32Sjsg */
4151f005ef32Sjsg struct dmub_rb_cmd_replay_set_power_opt replay_set_power_opt;
4152f005ef32Sjsg /**
4153f005ef32Sjsg * Definition of a DMUB_CMD__REPLAY_SET_COASTING_VTOTAL command.
4154f005ef32Sjsg */
4155f005ef32Sjsg struct dmub_rb_cmd_replay_set_coasting_vtotal replay_set_coasting_vtotal;
41565ca02815Sjsg };
41575ca02815Sjsg
41585ca02815Sjsg /**
41595ca02815Sjsg * union dmub_rb_out_cmd - Outbox command
41605ca02815Sjsg */
41615ca02815Sjsg union dmub_rb_out_cmd {
41625ca02815Sjsg /**
41635ca02815Sjsg * Parameters common to every command.
41645ca02815Sjsg */
41655ca02815Sjsg struct dmub_rb_cmd_common cmd_common;
41665ca02815Sjsg /**
41675ca02815Sjsg * AUX reply command.
41685ca02815Sjsg */
4169ad8b1aafSjsg struct dmub_rb_cmd_dp_aux_reply dp_aux_reply;
41705ca02815Sjsg /**
41715ca02815Sjsg * HPD notify command.
41725ca02815Sjsg */
4173ad8b1aafSjsg struct dmub_rb_cmd_dp_hpd_notify dp_hpd_notify;
41741bb76ff1Sjsg /**
41751bb76ff1Sjsg * SET_CONFIG reply command.
41761bb76ff1Sjsg */
41771bb76ff1Sjsg struct dmub_rb_cmd_dp_set_config_reply set_config_reply;
4178f005ef32Sjsg /**
4179f005ef32Sjsg * DPIA notification command.
4180f005ef32Sjsg */
4181f005ef32Sjsg struct dmub_rb_cmd_dpia_notification dpia_notification;
4182ad8b1aafSjsg };
4183c349dbc7Sjsg #pragma pack(pop)
4184c349dbc7Sjsg
4185ad8b1aafSjsg
4186ad8b1aafSjsg //==============================================================================
4187ad8b1aafSjsg //</DMUB_CMD>===================================================================
4188ad8b1aafSjsg //==============================================================================
4189ad8b1aafSjsg //< DMUB_RB>====================================================================
4190ad8b1aafSjsg //==============================================================================
4191ad8b1aafSjsg
4192ad8b1aafSjsg #if defined(__cplusplus)
4193ad8b1aafSjsg extern "C" {
4194ad8b1aafSjsg #endif
4195ad8b1aafSjsg
41965ca02815Sjsg /**
41975ca02815Sjsg * struct dmub_rb_init_params - Initialization params for DMUB ringbuffer
41985ca02815Sjsg */
4199ad8b1aafSjsg struct dmub_rb_init_params {
42005ca02815Sjsg void *ctx; /**< Caller provided context pointer */
42015ca02815Sjsg void *base_address; /**< CPU base address for ring's data */
42025ca02815Sjsg uint32_t capacity; /**< Ringbuffer capacity in bytes */
42035ca02815Sjsg uint32_t read_ptr; /**< Initial read pointer for consumer in bytes */
42045ca02815Sjsg uint32_t write_ptr; /**< Initial write pointer for producer in bytes */
4205ad8b1aafSjsg };
4206ad8b1aafSjsg
42075ca02815Sjsg /**
42085ca02815Sjsg * struct dmub_rb - Inbox or outbox DMUB ringbuffer
42095ca02815Sjsg */
4210ad8b1aafSjsg struct dmub_rb {
42115ca02815Sjsg void *base_address; /**< CPU address for the ring's data */
42125ca02815Sjsg uint32_t rptr; /**< Read pointer for consumer in bytes */
42135ca02815Sjsg uint32_t wrpt; /**< Write pointer for producer in bytes */
42145ca02815Sjsg uint32_t capacity; /**< Ringbuffer capacity in bytes */
4215ad8b1aafSjsg
42165ca02815Sjsg void *ctx; /**< Caller provided context pointer */
42175ca02815Sjsg void *dmub; /**< Pointer to the DMUB interface */
4218ad8b1aafSjsg };
4219ad8b1aafSjsg
42205ca02815Sjsg /**
42215ca02815Sjsg * @brief Checks if the ringbuffer is empty.
42225ca02815Sjsg *
42235ca02815Sjsg * @param rb DMUB Ringbuffer
42245ca02815Sjsg * @return true if empty
42255ca02815Sjsg * @return false otherwise
42265ca02815Sjsg */
dmub_rb_empty(struct dmub_rb * rb)4227ad8b1aafSjsg static inline bool dmub_rb_empty(struct dmub_rb *rb)
4228ad8b1aafSjsg {
4229ad8b1aafSjsg return (rb->wrpt == rb->rptr);
4230ad8b1aafSjsg }
4231ad8b1aafSjsg
42325ca02815Sjsg /**
42335ca02815Sjsg * @brief Checks if the ringbuffer is full
42345ca02815Sjsg *
42355ca02815Sjsg * @param rb DMUB Ringbuffer
42365ca02815Sjsg * @return true if full
42375ca02815Sjsg * @return false otherwise
42385ca02815Sjsg */
dmub_rb_full(struct dmub_rb * rb)4239ad8b1aafSjsg static inline bool dmub_rb_full(struct dmub_rb *rb)
4240ad8b1aafSjsg {
4241ad8b1aafSjsg uint32_t data_count;
4242ad8b1aafSjsg
4243ad8b1aafSjsg if (rb->wrpt >= rb->rptr)
4244ad8b1aafSjsg data_count = rb->wrpt - rb->rptr;
4245ad8b1aafSjsg else
4246ad8b1aafSjsg data_count = rb->capacity - (rb->rptr - rb->wrpt);
4247ad8b1aafSjsg
4248ad8b1aafSjsg return (data_count == (rb->capacity - DMUB_RB_CMD_SIZE));
4249ad8b1aafSjsg }
4250ad8b1aafSjsg
42515ca02815Sjsg /**
42525ca02815Sjsg * @brief Pushes a command into the ringbuffer
42535ca02815Sjsg *
42545ca02815Sjsg * @param rb DMUB ringbuffer
42555ca02815Sjsg * @param cmd The command to push
42565ca02815Sjsg * @return true if the ringbuffer was not full
42575ca02815Sjsg * @return false otherwise
42585ca02815Sjsg */
dmub_rb_push_front(struct dmub_rb * rb,const union dmub_rb_cmd * cmd)4259ad8b1aafSjsg static inline bool dmub_rb_push_front(struct dmub_rb *rb,
4260ad8b1aafSjsg const union dmub_rb_cmd *cmd)
4261ad8b1aafSjsg {
42621bb76ff1Sjsg uint64_t volatile *dst = (uint64_t volatile *)((uint8_t *)(rb->base_address) + rb->wrpt);
42631bb76ff1Sjsg const uint64_t *src = (const uint64_t *)cmd;
42641bb76ff1Sjsg uint8_t i;
4265ad8b1aafSjsg
4266ad8b1aafSjsg if (dmub_rb_full(rb))
4267ad8b1aafSjsg return false;
4268ad8b1aafSjsg
4269ad8b1aafSjsg // copying data
42701bb76ff1Sjsg for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++)
42711bb76ff1Sjsg *dst++ = *src++;
4272ad8b1aafSjsg
4273ad8b1aafSjsg rb->wrpt += DMUB_RB_CMD_SIZE;
4274ad8b1aafSjsg
4275ad8b1aafSjsg if (rb->wrpt >= rb->capacity)
4276ad8b1aafSjsg rb->wrpt %= rb->capacity;
4277ad8b1aafSjsg
4278ad8b1aafSjsg return true;
4279ad8b1aafSjsg }
4280ad8b1aafSjsg
42815ca02815Sjsg /**
42825ca02815Sjsg * @brief Pushes a command into the DMUB outbox ringbuffer
42835ca02815Sjsg *
42845ca02815Sjsg * @param rb DMUB outbox ringbuffer
42855ca02815Sjsg * @param cmd Outbox command
42865ca02815Sjsg * @return true if not full
42875ca02815Sjsg * @return false otherwise
42885ca02815Sjsg */
dmub_rb_out_push_front(struct dmub_rb * rb,const union dmub_rb_out_cmd * cmd)4289ad8b1aafSjsg static inline bool dmub_rb_out_push_front(struct dmub_rb *rb,
4290ad8b1aafSjsg const union dmub_rb_out_cmd *cmd)
4291ad8b1aafSjsg {
4292ad8b1aafSjsg uint8_t *dst = (uint8_t *)(rb->base_address) + rb->wrpt;
42935ca02815Sjsg const uint8_t *src = (const uint8_t *)cmd;
4294ad8b1aafSjsg
4295ad8b1aafSjsg if (dmub_rb_full(rb))
4296ad8b1aafSjsg return false;
4297ad8b1aafSjsg
4298ad8b1aafSjsg dmub_memcpy(dst, src, DMUB_RB_CMD_SIZE);
4299ad8b1aafSjsg
4300ad8b1aafSjsg rb->wrpt += DMUB_RB_CMD_SIZE;
4301ad8b1aafSjsg
4302ad8b1aafSjsg if (rb->wrpt >= rb->capacity)
4303ad8b1aafSjsg rb->wrpt %= rb->capacity;
4304ad8b1aafSjsg
4305ad8b1aafSjsg return true;
4306ad8b1aafSjsg }
4307ad8b1aafSjsg
43085ca02815Sjsg /**
43095ca02815Sjsg * @brief Returns the next unprocessed command in the ringbuffer.
43105ca02815Sjsg *
43115ca02815Sjsg * @param rb DMUB ringbuffer
43125ca02815Sjsg * @param cmd The command to return
43135ca02815Sjsg * @return true if not empty
43145ca02815Sjsg * @return false otherwise
43155ca02815Sjsg */
dmub_rb_front(struct dmub_rb * rb,union dmub_rb_cmd ** cmd)4316ad8b1aafSjsg static inline bool dmub_rb_front(struct dmub_rb *rb,
43175ca02815Sjsg union dmub_rb_cmd **cmd)
4318ad8b1aafSjsg {
43195ca02815Sjsg uint8_t *rb_cmd = (uint8_t *)(rb->base_address) + rb->rptr;
4320ad8b1aafSjsg
4321ad8b1aafSjsg if (dmub_rb_empty(rb))
4322ad8b1aafSjsg return false;
4323ad8b1aafSjsg
43245ca02815Sjsg *cmd = (union dmub_rb_cmd *)rb_cmd;
4325ad8b1aafSjsg
4326ad8b1aafSjsg return true;
4327ad8b1aafSjsg }
4328ad8b1aafSjsg
43295ca02815Sjsg /**
43305ca02815Sjsg * @brief Determines the next ringbuffer offset.
43315ca02815Sjsg *
43325ca02815Sjsg * @param rb DMUB inbox ringbuffer
43335ca02815Sjsg * @param num_cmds Number of commands
43345ca02815Sjsg * @param next_rptr The next offset in the ringbuffer
43355ca02815Sjsg */
dmub_rb_get_rptr_with_offset(struct dmub_rb * rb,uint32_t num_cmds,uint32_t * next_rptr)43365ca02815Sjsg static inline void dmub_rb_get_rptr_with_offset(struct dmub_rb *rb,
43375ca02815Sjsg uint32_t num_cmds,
43385ca02815Sjsg uint32_t *next_rptr)
43395ca02815Sjsg {
43405ca02815Sjsg *next_rptr = rb->rptr + DMUB_RB_CMD_SIZE * num_cmds;
43415ca02815Sjsg
43425ca02815Sjsg if (*next_rptr >= rb->capacity)
43435ca02815Sjsg *next_rptr %= rb->capacity;
43445ca02815Sjsg }
43455ca02815Sjsg
43465ca02815Sjsg /**
43475ca02815Sjsg * @brief Returns a pointer to a command in the inbox.
43485ca02815Sjsg *
43495ca02815Sjsg * @param rb DMUB inbox ringbuffer
43505ca02815Sjsg * @param cmd The inbox command to return
43515ca02815Sjsg * @param rptr The ringbuffer offset
43525ca02815Sjsg * @return true if not empty
43535ca02815Sjsg * @return false otherwise
43545ca02815Sjsg */
dmub_rb_peek_offset(struct dmub_rb * rb,union dmub_rb_cmd ** cmd,uint32_t rptr)43555ca02815Sjsg static inline bool dmub_rb_peek_offset(struct dmub_rb *rb,
43565ca02815Sjsg union dmub_rb_cmd **cmd,
43575ca02815Sjsg uint32_t rptr)
43585ca02815Sjsg {
43595ca02815Sjsg uint8_t *rb_cmd = (uint8_t *)(rb->base_address) + rptr;
43605ca02815Sjsg
43615ca02815Sjsg if (dmub_rb_empty(rb))
43625ca02815Sjsg return false;
43635ca02815Sjsg
43645ca02815Sjsg *cmd = (union dmub_rb_cmd *)rb_cmd;
43655ca02815Sjsg
43665ca02815Sjsg return true;
43675ca02815Sjsg }
43685ca02815Sjsg
43695ca02815Sjsg /**
43705ca02815Sjsg * @brief Returns the next unprocessed command in the outbox.
43715ca02815Sjsg *
43725ca02815Sjsg * @param rb DMUB outbox ringbuffer
43735ca02815Sjsg * @param cmd The outbox command to return
43745ca02815Sjsg * @return true if not empty
43755ca02815Sjsg * @return false otherwise
43765ca02815Sjsg */
dmub_rb_out_front(struct dmub_rb * rb,union dmub_rb_out_cmd * cmd)4377ad8b1aafSjsg static inline bool dmub_rb_out_front(struct dmub_rb *rb,
4378ad8b1aafSjsg union dmub_rb_out_cmd *cmd)
4379ad8b1aafSjsg {
43801bb76ff1Sjsg const uint64_t volatile *src = (const uint64_t volatile *)((uint8_t *)(rb->base_address) + rb->rptr);
43811bb76ff1Sjsg uint64_t *dst = (uint64_t *)cmd;
43821bb76ff1Sjsg uint8_t i;
4383ad8b1aafSjsg
4384ad8b1aafSjsg if (dmub_rb_empty(rb))
4385ad8b1aafSjsg return false;
4386ad8b1aafSjsg
4387ad8b1aafSjsg // copying data
43881bb76ff1Sjsg for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++)
43891bb76ff1Sjsg *dst++ = *src++;
4390ad8b1aafSjsg
4391ad8b1aafSjsg return true;
4392ad8b1aafSjsg }
4393ad8b1aafSjsg
43945ca02815Sjsg /**
43955ca02815Sjsg * @brief Removes the front entry in the ringbuffer.
43965ca02815Sjsg *
43975ca02815Sjsg * @param rb DMUB ringbuffer
43985ca02815Sjsg * @return true if the command was removed
43995ca02815Sjsg * @return false if there were no commands
44005ca02815Sjsg */
dmub_rb_pop_front(struct dmub_rb * rb)4401ad8b1aafSjsg static inline bool dmub_rb_pop_front(struct dmub_rb *rb)
4402ad8b1aafSjsg {
4403ad8b1aafSjsg if (dmub_rb_empty(rb))
4404ad8b1aafSjsg return false;
4405ad8b1aafSjsg
4406ad8b1aafSjsg rb->rptr += DMUB_RB_CMD_SIZE;
4407ad8b1aafSjsg
4408ad8b1aafSjsg if (rb->rptr >= rb->capacity)
4409ad8b1aafSjsg rb->rptr %= rb->capacity;
4410ad8b1aafSjsg
4411ad8b1aafSjsg return true;
4412ad8b1aafSjsg }
4413ad8b1aafSjsg
44145ca02815Sjsg /**
44155ca02815Sjsg * @brief Flushes commands in the ringbuffer to framebuffer memory.
44165ca02815Sjsg *
44175ca02815Sjsg * Avoids a race condition where DMCUB accesses memory while
44185ca02815Sjsg * there are still writes in flight to framebuffer.
44195ca02815Sjsg *
44205ca02815Sjsg * @param rb DMUB ringbuffer
44215ca02815Sjsg */
dmub_rb_flush_pending(const struct dmub_rb * rb)4422ad8b1aafSjsg static inline void dmub_rb_flush_pending(const struct dmub_rb *rb)
4423ad8b1aafSjsg {
4424ad8b1aafSjsg uint32_t rptr = rb->rptr;
4425ad8b1aafSjsg uint32_t wptr = rb->wrpt;
4426ad8b1aafSjsg
4427ad8b1aafSjsg while (rptr != wptr) {
44281bb76ff1Sjsg uint64_t *data = (uint64_t *)((uint8_t *)(rb->base_address) + rptr);
44291bb76ff1Sjsg uint8_t i;
4430ad8b1aafSjsg
44311bb76ff1Sjsg /* Don't remove this.
44321bb76ff1Sjsg * The contents need to actually be read from the ring buffer
44331bb76ff1Sjsg * for this function to be effective.
44341bb76ff1Sjsg */
44351bb76ff1Sjsg for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++)
44361bb76ff1Sjsg (void)READ_ONCE(*data++);
4437ad8b1aafSjsg
4438ad8b1aafSjsg rptr += DMUB_RB_CMD_SIZE;
4439ad8b1aafSjsg if (rptr >= rb->capacity)
4440ad8b1aafSjsg rptr %= rb->capacity;
4441ad8b1aafSjsg }
4442ad8b1aafSjsg }
4443ad8b1aafSjsg
44445ca02815Sjsg /**
44455ca02815Sjsg * @brief Initializes a DMCUB ringbuffer
44465ca02815Sjsg *
44475ca02815Sjsg * @param rb DMUB ringbuffer
44485ca02815Sjsg * @param init_params initial configuration for the ringbuffer
44495ca02815Sjsg */
dmub_rb_init(struct dmub_rb * rb,struct dmub_rb_init_params * init_params)4450ad8b1aafSjsg static inline void dmub_rb_init(struct dmub_rb *rb,
4451ad8b1aafSjsg struct dmub_rb_init_params *init_params)
4452ad8b1aafSjsg {
4453ad8b1aafSjsg rb->base_address = init_params->base_address;
4454ad8b1aafSjsg rb->capacity = init_params->capacity;
4455ad8b1aafSjsg rb->rptr = init_params->read_ptr;
4456ad8b1aafSjsg rb->wrpt = init_params->write_ptr;
4457ad8b1aafSjsg }
4458ad8b1aafSjsg
44595ca02815Sjsg /**
44605ca02815Sjsg * @brief Copies output data from in/out commands into the given command.
44615ca02815Sjsg *
44625ca02815Sjsg * @param rb DMUB ringbuffer
44635ca02815Sjsg * @param cmd Command to copy data into
44645ca02815Sjsg */
dmub_rb_get_return_data(struct dmub_rb * rb,union dmub_rb_cmd * cmd)44655ca02815Sjsg static inline void dmub_rb_get_return_data(struct dmub_rb *rb,
44665ca02815Sjsg union dmub_rb_cmd *cmd)
44675ca02815Sjsg {
44685ca02815Sjsg // Copy rb entry back into command
44695ca02815Sjsg uint8_t *rd_ptr = (rb->rptr == 0) ?
44705ca02815Sjsg (uint8_t *)rb->base_address + rb->capacity - DMUB_RB_CMD_SIZE :
44715ca02815Sjsg (uint8_t *)rb->base_address + rb->rptr - DMUB_RB_CMD_SIZE;
44725ca02815Sjsg
44735ca02815Sjsg dmub_memcpy(cmd, rd_ptr, DMUB_RB_CMD_SIZE);
44745ca02815Sjsg }
44755ca02815Sjsg
4476ad8b1aafSjsg #if defined(__cplusplus)
4477ad8b1aafSjsg }
4478ad8b1aafSjsg #endif
4479ad8b1aafSjsg
4480ad8b1aafSjsg //==============================================================================
4481ad8b1aafSjsg //</DMUB_RB>====================================================================
4482ad8b1aafSjsg //==============================================================================
4483ad8b1aafSjsg
4484c349dbc7Sjsg #endif /* _DMUB_CMD_H_ */
4485