xref: /linux/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_vpg.h (revision db5d28c0bfe566908719bec8e25443aabecbb802)
13c10f4fbSBhawanpreet Lakha /*
23c10f4fbSBhawanpreet Lakha  * Copyright 2020 Advanced Micro Devices, Inc.
33c10f4fbSBhawanpreet Lakha  *
43c10f4fbSBhawanpreet Lakha  * Permission is hereby granted, free of charge, to any person obtaining a
53c10f4fbSBhawanpreet Lakha  * copy of this software and associated documentation files (the "Software"),
63c10f4fbSBhawanpreet Lakha  * to deal in the Software without restriction, including without limitation
73c10f4fbSBhawanpreet Lakha  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
83c10f4fbSBhawanpreet Lakha  * and/or sell copies of the Software, and to permit persons to whom the
93c10f4fbSBhawanpreet Lakha  * Software is furnished to do so, subject to the following conditions:
103c10f4fbSBhawanpreet Lakha  *
113c10f4fbSBhawanpreet Lakha  * The above copyright notice and this permission notice shall be included in
123c10f4fbSBhawanpreet Lakha  * all copies or substantial portions of the Software.
133c10f4fbSBhawanpreet Lakha  *
143c10f4fbSBhawanpreet Lakha  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
153c10f4fbSBhawanpreet Lakha  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
163c10f4fbSBhawanpreet Lakha  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
173c10f4fbSBhawanpreet Lakha  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
183c10f4fbSBhawanpreet Lakha  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
193c10f4fbSBhawanpreet Lakha  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
203c10f4fbSBhawanpreet Lakha  * OTHER DEALINGS IN THE SOFTWARE.
213c10f4fbSBhawanpreet Lakha  *
223c10f4fbSBhawanpreet Lakha  * Authors: AMD
233c10f4fbSBhawanpreet Lakha  *
243c10f4fbSBhawanpreet Lakha  */
253c10f4fbSBhawanpreet Lakha 
263c10f4fbSBhawanpreet Lakha #ifndef __DAL_DCN30_VPG_H__
273c10f4fbSBhawanpreet Lakha #define __DAL_DCN30_VPG_H__
283c10f4fbSBhawanpreet Lakha 
29*ded99dacSParandhaman K #include "vpg.h"
303c10f4fbSBhawanpreet Lakha 
313c10f4fbSBhawanpreet Lakha #define DCN30_VPG_FROM_VPG(vpg)\
323c10f4fbSBhawanpreet Lakha 	container_of(vpg, struct dcn30_vpg, base)
333c10f4fbSBhawanpreet Lakha 
343c10f4fbSBhawanpreet Lakha #define VPG_DCN3_REG_LIST(id) \
353c10f4fbSBhawanpreet Lakha 	SRI(VPG_GENERIC_STATUS, VPG, id), \
363c10f4fbSBhawanpreet Lakha 	SRI(VPG_GENERIC_PACKET_ACCESS_CTRL, VPG, id), \
373c10f4fbSBhawanpreet Lakha 	SRI(VPG_GENERIC_PACKET_DATA, VPG, id), \
38a013dd15SJudy Cai 	SRI(VPG_GSP_FRAME_UPDATE_CTRL, VPG, id), \
39a013dd15SJudy Cai 	SRI(VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG, id)
403c10f4fbSBhawanpreet Lakha 
413c10f4fbSBhawanpreet Lakha struct dcn30_vpg_registers {
423c10f4fbSBhawanpreet Lakha 	uint32_t VPG_GENERIC_STATUS;
433c10f4fbSBhawanpreet Lakha 	uint32_t VPG_GENERIC_PACKET_ACCESS_CTRL;
443c10f4fbSBhawanpreet Lakha 	uint32_t VPG_GENERIC_PACKET_DATA;
453c10f4fbSBhawanpreet Lakha 	uint32_t VPG_GSP_FRAME_UPDATE_CTRL;
46a013dd15SJudy Cai 	uint32_t VPG_GSP_IMMEDIATE_UPDATE_CTRL;
473c10f4fbSBhawanpreet Lakha };
483c10f4fbSBhawanpreet Lakha 
493c10f4fbSBhawanpreet Lakha #define DCN3_VPG_MASK_SH_LIST(mask_sh)\
503c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GENERIC_STATUS, VPG_GENERIC_CONFLICT_OCCURED, mask_sh),\
513c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GENERIC_STATUS, VPG_GENERIC_CONFLICT_CLR, mask_sh),\
523c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GENERIC_PACKET_ACCESS_CTRL, VPG_GENERIC_DATA_INDEX, mask_sh),\
533c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GENERIC_PACKET_DATA, VPG_GENERIC_DATA_BYTE0, mask_sh),\
543c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GENERIC_PACKET_DATA, VPG_GENERIC_DATA_BYTE1, mask_sh),\
553c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GENERIC_PACKET_DATA, VPG_GENERIC_DATA_BYTE2, mask_sh),\
563c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GENERIC_PACKET_DATA, VPG_GENERIC_DATA_BYTE3, mask_sh),\
573c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC0_FRAME_UPDATE, mask_sh),\
583c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC1_FRAME_UPDATE, mask_sh),\
593c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC2_FRAME_UPDATE, mask_sh),\
603c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC3_FRAME_UPDATE, mask_sh),\
613c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC4_FRAME_UPDATE, mask_sh),\
623c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC5_FRAME_UPDATE, mask_sh),\
633c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC6_FRAME_UPDATE, mask_sh),\
643c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC7_FRAME_UPDATE, mask_sh),\
653c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC8_FRAME_UPDATE, mask_sh),\
663c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC9_FRAME_UPDATE, mask_sh),\
673c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC10_FRAME_UPDATE, mask_sh),\
683c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC11_FRAME_UPDATE, mask_sh),\
693c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC12_FRAME_UPDATE, mask_sh),\
703c10f4fbSBhawanpreet Lakha 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC13_FRAME_UPDATE, mask_sh),\
71a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_FRAME_UPDATE_CTRL, VPG_GENERIC14_FRAME_UPDATE, mask_sh),\
72a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC0_IMMEDIATE_UPDATE, mask_sh),\
73a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC1_IMMEDIATE_UPDATE, mask_sh),\
74a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC2_IMMEDIATE_UPDATE, mask_sh),\
75a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC3_IMMEDIATE_UPDATE, mask_sh),\
76a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC4_IMMEDIATE_UPDATE, mask_sh),\
77a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC5_IMMEDIATE_UPDATE, mask_sh),\
78a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC6_IMMEDIATE_UPDATE, mask_sh),\
79a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC7_IMMEDIATE_UPDATE, mask_sh),\
80a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC8_IMMEDIATE_UPDATE, mask_sh),\
81a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC9_IMMEDIATE_UPDATE, mask_sh),\
82a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC10_IMMEDIATE_UPDATE, mask_sh),\
83a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC11_IMMEDIATE_UPDATE, mask_sh),\
84a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC12_IMMEDIATE_UPDATE, mask_sh),\
85a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC13_IMMEDIATE_UPDATE, mask_sh),\
86a013dd15SJudy Cai 	SE_SF(VPG0_VPG_GSP_IMMEDIATE_UPDATE_CTRL, VPG_GENERIC14_IMMEDIATE_UPDATE, mask_sh)
873c10f4fbSBhawanpreet Lakha 
883c10f4fbSBhawanpreet Lakha #define VPG_DCN3_REG_FIELD_LIST(type) \
893c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC_CONFLICT_OCCURED;\
903c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC_CONFLICT_CLR;\
913c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC_DATA_INDEX;\
923c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC_DATA_BYTE0;\
933c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC_DATA_BYTE1;\
943c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC_DATA_BYTE2;\
953c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC_DATA_BYTE3;\
963c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC0_FRAME_UPDATE;\
973c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC1_FRAME_UPDATE;\
983c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC2_FRAME_UPDATE;\
993c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC3_FRAME_UPDATE;\
1003c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC4_FRAME_UPDATE;\
1013c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC5_FRAME_UPDATE;\
1023c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC6_FRAME_UPDATE;\
1033c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC7_FRAME_UPDATE;\
1043c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC8_FRAME_UPDATE;\
1053c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC9_FRAME_UPDATE;\
1063c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC10_FRAME_UPDATE;\
1073c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC11_FRAME_UPDATE;\
1083c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC12_FRAME_UPDATE;\
1093c10f4fbSBhawanpreet Lakha 	type VPG_GENERIC13_FRAME_UPDATE;\
110a013dd15SJudy Cai 	type VPG_GENERIC14_FRAME_UPDATE;\
111a013dd15SJudy Cai 	type VPG_GENERIC0_IMMEDIATE_UPDATE;\
112a013dd15SJudy Cai 	type VPG_GENERIC1_IMMEDIATE_UPDATE;\
113a013dd15SJudy Cai 	type VPG_GENERIC2_IMMEDIATE_UPDATE;\
114a013dd15SJudy Cai 	type VPG_GENERIC3_IMMEDIATE_UPDATE;\
115a013dd15SJudy Cai 	type VPG_GENERIC4_IMMEDIATE_UPDATE;\
116a013dd15SJudy Cai 	type VPG_GENERIC5_IMMEDIATE_UPDATE;\
117a013dd15SJudy Cai 	type VPG_GENERIC6_IMMEDIATE_UPDATE;\
118a013dd15SJudy Cai 	type VPG_GENERIC7_IMMEDIATE_UPDATE;\
119a013dd15SJudy Cai 	type VPG_GENERIC8_IMMEDIATE_UPDATE;\
120a013dd15SJudy Cai 	type VPG_GENERIC9_IMMEDIATE_UPDATE;\
121a013dd15SJudy Cai 	type VPG_GENERIC10_IMMEDIATE_UPDATE;\
122a013dd15SJudy Cai 	type VPG_GENERIC11_IMMEDIATE_UPDATE;\
123a013dd15SJudy Cai 	type VPG_GENERIC12_IMMEDIATE_UPDATE;\
124a013dd15SJudy Cai 	type VPG_GENERIC13_IMMEDIATE_UPDATE;\
125a013dd15SJudy Cai 	type VPG_GENERIC14_IMMEDIATE_UPDATE
1263c10f4fbSBhawanpreet Lakha 
1273c10f4fbSBhawanpreet Lakha 
1283c10f4fbSBhawanpreet Lakha struct dcn30_vpg_shift {
1293c10f4fbSBhawanpreet Lakha 	VPG_DCN3_REG_FIELD_LIST(uint8_t);
1303c10f4fbSBhawanpreet Lakha };
1313c10f4fbSBhawanpreet Lakha 
1323c10f4fbSBhawanpreet Lakha struct dcn30_vpg_mask {
1333c10f4fbSBhawanpreet Lakha 	VPG_DCN3_REG_FIELD_LIST(uint32_t);
1343c10f4fbSBhawanpreet Lakha };
1353c10f4fbSBhawanpreet Lakha 
1363c10f4fbSBhawanpreet Lakha struct dcn30_vpg {
1373c10f4fbSBhawanpreet Lakha 	struct vpg base;
1383c10f4fbSBhawanpreet Lakha 	const struct dcn30_vpg_registers *regs;
1393c10f4fbSBhawanpreet Lakha 	const struct dcn30_vpg_shift *vpg_shift;
1403c10f4fbSBhawanpreet Lakha 	const struct dcn30_vpg_mask *vpg_mask;
1413c10f4fbSBhawanpreet Lakha };
1423c10f4fbSBhawanpreet Lakha 
14318b4f1a0SMichael Strauss void vpg3_update_generic_info_packet(
14418b4f1a0SMichael Strauss 	struct vpg *vpg,
14518b4f1a0SMichael Strauss 	uint32_t packet_index,
146253a5591SGuo, Bing 	const struct dc_info_packet *info_packet,
147253a5591SGuo, Bing 	bool immediate_update);
14818b4f1a0SMichael Strauss 
1493c10f4fbSBhawanpreet Lakha void vpg3_construct(struct dcn30_vpg *vpg3,
1503c10f4fbSBhawanpreet Lakha 	struct dc_context *ctx,
1513c10f4fbSBhawanpreet Lakha 	uint32_t inst,
1523c10f4fbSBhawanpreet Lakha 	const struct dcn30_vpg_registers *vpg_regs,
1533c10f4fbSBhawanpreet Lakha 	const struct dcn30_vpg_shift *vpg_shift,
1543c10f4fbSBhawanpreet Lakha 	const struct dcn30_vpg_mask *vpg_mask);
1553c10f4fbSBhawanpreet Lakha 
1563c10f4fbSBhawanpreet Lakha 
1573c10f4fbSBhawanpreet Lakha #endif
158