197fb5e8dSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
225fdd593SJeykumar Sankaran /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
30d1b10c6SAbhinav Kumar  * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
425fdd593SJeykumar Sankaran  */
525fdd593SJeykumar Sankaran 
625fdd593SJeykumar Sankaran #define pr_fmt(fmt)	"[drm:%s:%d] " fmt, __func__, __LINE__
725fdd593SJeykumar Sankaran #include <linux/slab.h>
825fdd593SJeykumar Sankaran #include <linux/of_address.h>
925fdd593SJeykumar Sankaran #include <linux/platform_device.h>
1025fdd593SJeykumar Sankaran #include "dpu_hw_mdss.h"
11597762d5SDmitry Baryshkov #include "dpu_hw_interrupts.h"
1225fdd593SJeykumar Sankaran #include "dpu_hw_catalog.h"
1325fdd593SJeykumar Sankaran #include "dpu_kms.h"
1425fdd593SJeykumar Sankaran 
15a2a448b4SDmitry Baryshkov #define VIG_BASE_MASK \
167e3d6c54SDmitry Baryshkov 	(BIT(DPU_SSPP_QOS) |\
17a2a448b4SDmitry Baryshkov 	BIT(DPU_SSPP_CDP) |\
1825fdd593SJeykumar Sankaran 	BIT(DPU_SSPP_TS_PREFILL) | BIT(DPU_SSPP_EXCL_RECT))
1925fdd593SJeykumar Sankaran 
20a2a448b4SDmitry Baryshkov #define VIG_MASK \
21a2a448b4SDmitry Baryshkov 	(VIG_BASE_MASK | \
22a2a448b4SDmitry Baryshkov 	BIT(DPU_SSPP_CSC_10BIT))
23a2a448b4SDmitry Baryshkov 
2494391a14SAngeloGioacchino Del Regno #define VIG_MSM8998_MASK \
2594391a14SAngeloGioacchino Del Regno 	(VIG_MASK | BIT(DPU_SSPP_SCALER_QSEED3))
2694391a14SAngeloGioacchino Del Regno 
277bdc0c4bSKalyan Thota #define VIG_SDM845_MASK \
28b8dab65bSAngeloGioacchino Del Regno 	(VIG_MASK | BIT(DPU_SSPP_QOS_8LVL) | BIT(DPU_SSPP_SCALER_QSEED3))
297bdc0c4bSKalyan Thota 
308b409996SDmitry Baryshkov #define VIG_SDM845_MASK_SDMA \
318b409996SDmitry Baryshkov 	(VIG_SDM845_MASK | BIT(DPU_SSPP_SMART_DMA_V2))
328b409996SDmitry Baryshkov 
337bdc0c4bSKalyan Thota #define VIG_SC7180_MASK \
34b8dab65bSAngeloGioacchino Del Regno 	(VIG_MASK | BIT(DPU_SSPP_QOS_8LVL) | BIT(DPU_SSPP_SCALER_QSEED4))
357bdc0c4bSKalyan Thota 
369b6f4fedSMarijn Suijten #define VIG_SM6125_MASK \
379b6f4fedSMarijn Suijten 	(VIG_MASK | BIT(DPU_SSPP_QOS_8LVL) | BIT(DPU_SSPP_SCALER_QSEED3LITE))
389b6f4fedSMarijn Suijten 
398b409996SDmitry Baryshkov #define VIG_SC7180_MASK_SDMA \
408b409996SDmitry Baryshkov 	(VIG_SC7180_MASK | BIT(DPU_SSPP_SMART_DMA_V2))
418b409996SDmitry Baryshkov 
42a2a448b4SDmitry Baryshkov #define VIG_QCM2290_MASK (VIG_BASE_MASK | BIT(DPU_SSPP_QOS_8LVL))
435334087eSLoic Poulain 
4494391a14SAngeloGioacchino Del Regno #define DMA_MSM8998_MASK \
457e3d6c54SDmitry Baryshkov 	(BIT(DPU_SSPP_QOS) |\
4694391a14SAngeloGioacchino Del Regno 	BIT(DPU_SSPP_TS_PREFILL) | BIT(DPU_SSPP_TS_PREFILL_REC1) |\
4794391a14SAngeloGioacchino Del Regno 	BIT(DPU_SSPP_CDP) | BIT(DPU_SSPP_EXCL_RECT))
4894391a14SAngeloGioacchino Del Regno 
49dabfdd89SVinod Polimera #define VIG_SC7280_MASK \
50dabfdd89SVinod Polimera 	(VIG_SC7180_MASK | BIT(DPU_SSPP_INLINE_ROTATION))
51dabfdd89SVinod Polimera 
528b409996SDmitry Baryshkov #define VIG_SC7280_MASK_SDMA \
538b409996SDmitry Baryshkov 	(VIG_SC7280_MASK | BIT(DPU_SSPP_SMART_DMA_V2))
548b409996SDmitry Baryshkov 
5525fdd593SJeykumar Sankaran #define DMA_SDM845_MASK \
567e3d6c54SDmitry Baryshkov 	(BIT(DPU_SSPP_QOS) | BIT(DPU_SSPP_QOS_8LVL) |\
5725fdd593SJeykumar Sankaran 	BIT(DPU_SSPP_TS_PREFILL) | BIT(DPU_SSPP_TS_PREFILL_REC1) |\
5825fdd593SJeykumar Sankaran 	BIT(DPU_SSPP_CDP) | BIT(DPU_SSPP_EXCL_RECT))
5925fdd593SJeykumar Sankaran 
6007ca1fc0SSravanthi Kollukuduru #define DMA_CURSOR_SDM845_MASK \
6107ca1fc0SSravanthi Kollukuduru 	(DMA_SDM845_MASK | BIT(DPU_SSPP_CURSOR))
6207ca1fc0SSravanthi Kollukuduru 
638b409996SDmitry Baryshkov #define DMA_SDM845_MASK_SDMA \
648b409996SDmitry Baryshkov 	(DMA_SDM845_MASK | BIT(DPU_SSPP_SMART_DMA_V2))
658b409996SDmitry Baryshkov 
668b409996SDmitry Baryshkov #define DMA_CURSOR_SDM845_MASK_SDMA \
678b409996SDmitry Baryshkov 	(DMA_CURSOR_SDM845_MASK | BIT(DPU_SSPP_SMART_DMA_V2))
688b409996SDmitry Baryshkov 
6994391a14SAngeloGioacchino Del Regno #define DMA_CURSOR_MSM8998_MASK \
7094391a14SAngeloGioacchino Del Regno 	(DMA_MSM8998_MASK | BIT(DPU_SSPP_CURSOR))
7194391a14SAngeloGioacchino Del Regno 
722d8a4edbSDmitry Baryshkov #define MIXER_MSM8998_MASK \
73a5045b00SDmitry Baryshkov 	(BIT(DPU_MIXER_SOURCESPLIT))
7425fdd593SJeykumar Sankaran 
752d8a4edbSDmitry Baryshkov #define MIXER_SDM845_MASK \
762d8a4edbSDmitry Baryshkov 	(BIT(DPU_MIXER_SOURCESPLIT) | BIT(DPU_DIM_LAYER) | BIT(DPU_MIXER_COMBINED_ALPHA))
772d8a4edbSDmitry Baryshkov 
7800feff8fSDmitry Baryshkov #define MIXER_QCM2290_MASK \
792d8a4edbSDmitry Baryshkov 	(BIT(DPU_DIM_LAYER) | BIT(DPU_MIXER_COMBINED_ALPHA))
807bdc0c4bSKalyan Thota 
81fe9d66cfSMarijn Suijten #define PINGPONG_SDM845_MASK \
82c20c4440SKuogee Hsieh 	(BIT(DPU_PINGPONG_DITHER) | BIT(DPU_PINGPONG_TE) | BIT(DPU_PINGPONG_DSC))
8325fdd593SJeykumar Sankaran 
84fe9d66cfSMarijn Suijten #define PINGPONG_SDM845_TE2_MASK \
8525fdd593SJeykumar Sankaran 	(PINGPONG_SDM845_MASK | BIT(DPU_PINGPONG_TE2))
8625fdd593SJeykumar Sankaran 
87fe9d66cfSMarijn Suijten #define PINGPONG_SM8150_MASK \
88c20c4440SKuogee Hsieh 	(BIT(DPU_PINGPONG_DITHER) | BIT(DPU_PINGPONG_DSC))
89fe9d66cfSMarijn Suijten 
90591e34a0SKrishna Manikandan #define CTL_SC7280_MASK \
9183a58b20SKalyan Thota 	(BIT(DPU_CTL_ACTIVE_CFG) | \
9283a58b20SKalyan Thota 	 BIT(DPU_CTL_FETCH_ACTIVE) | \
9383a58b20SKalyan Thota 	 BIT(DPU_CTL_VM_CFG) | \
9483a58b20SKalyan Thota 	 BIT(DPU_CTL_DSPP_SUB_BLOCK_FLUSH))
95591e34a0SKrishna Manikandan 
96e92a4ae1SDmitry Baryshkov #define CTL_SM8550_MASK \
97e92a4ae1SDmitry Baryshkov 	(CTL_SC7280_MASK | BIT(DPU_CTL_HAS_LAYER_EXT4))
98e92a4ae1SDmitry Baryshkov 
994259ff7aSKalyan Thota #define DSPP_SC7180_MASK BIT(DPU_DSPP_PCC)
100e47616dfSKalyan Thota 
101e3969eadSVinod Polimera #define INTF_SC7180_MASK \
102a7129231SKonrad Dybcio 	(BIT(DPU_INTF_INPUT_CTRL) | \
103a7129231SKonrad Dybcio 	 BIT(DPU_INTF_TE) | \
104a7129231SKonrad Dybcio 	 BIT(DPU_INTF_STATUS_SUPPORTED) | \
105a7129231SKonrad Dybcio 	 BIT(DPU_DATA_HCTL_EN))
106cace3ac4SJonathan Marek 
10778145228SAbhinav Kumar #define INTF_SC7280_MASK (INTF_SC7180_MASK)
108591e34a0SKrishna Manikandan 
10953324b99SAbhinav Kumar #define WB_SM8250_MASK (BIT(DPU_WB_LINE_MODE) | \
11053324b99SAbhinav Kumar 			 BIT(DPU_WB_UBWC) | \
11153324b99SAbhinav Kumar 			 BIT(DPU_WB_YUV_CONFIG) | \
11253324b99SAbhinav Kumar 			 BIT(DPU_WB_PIPE_ALPHA) | \
11353324b99SAbhinav Kumar 			 BIT(DPU_WB_XY_ROI_OFFSET) | \
11453324b99SAbhinav Kumar 			 BIT(DPU_WB_QOS) | \
11553324b99SAbhinav Kumar 			 BIT(DPU_WB_QOS_8LVL) | \
11653324b99SAbhinav Kumar 			 BIT(DPU_WB_CDP) | \
11753324b99SAbhinav Kumar 			 BIT(DPU_WB_INPUT_CTRL))
11853324b99SAbhinav Kumar 
11925fdd593SJeykumar Sankaran #define DEFAULT_PIXEL_RAM_SIZE		(50 * 1024)
12025fdd593SJeykumar Sankaran #define DEFAULT_DPU_LINE_WIDTH		2048
12125fdd593SJeykumar Sankaran #define DEFAULT_DPU_OUTPUT_LINE_WIDTH	2560
12225fdd593SJeykumar Sankaran 
12325fdd593SJeykumar Sankaran #define MAX_HORZ_DECIMATION	4
12425fdd593SJeykumar Sankaran #define MAX_VERT_DECIMATION	4
12525fdd593SJeykumar Sankaran 
12625fdd593SJeykumar Sankaran #define MAX_UPSCALE_RATIO	20
12725fdd593SJeykumar Sankaran #define MAX_DOWNSCALE_RATIO	4
12825fdd593SJeykumar Sankaran #define SSPP_UNITY_SCALE	1
12925fdd593SJeykumar Sankaran 
13025fdd593SJeykumar Sankaran #define STRCAT(X, Y) (X Y)
13125fdd593SJeykumar Sankaran 
13209c7e370SLee Jones static const uint32_t plane_formats[] = {
13309c7e370SLee Jones 	DRM_FORMAT_ARGB8888,
13409c7e370SLee Jones 	DRM_FORMAT_ABGR8888,
13509c7e370SLee Jones 	DRM_FORMAT_RGBA8888,
13609c7e370SLee Jones 	DRM_FORMAT_BGRA8888,
13709c7e370SLee Jones 	DRM_FORMAT_XRGB8888,
13809c7e370SLee Jones 	DRM_FORMAT_RGBX8888,
13909c7e370SLee Jones 	DRM_FORMAT_BGRX8888,
14009c7e370SLee Jones 	DRM_FORMAT_XBGR8888,
141ffbbed63SLeonard Lausen 	DRM_FORMAT_ARGB2101010,
142da7716a2SJessica Zhang 	DRM_FORMAT_XRGB2101010,
14309c7e370SLee Jones 	DRM_FORMAT_RGB888,
14409c7e370SLee Jones 	DRM_FORMAT_BGR888,
14509c7e370SLee Jones 	DRM_FORMAT_RGB565,
14609c7e370SLee Jones 	DRM_FORMAT_BGR565,
14709c7e370SLee Jones 	DRM_FORMAT_ARGB1555,
14809c7e370SLee Jones 	DRM_FORMAT_ABGR1555,
14909c7e370SLee Jones 	DRM_FORMAT_RGBA5551,
15009c7e370SLee Jones 	DRM_FORMAT_BGRA5551,
15109c7e370SLee Jones 	DRM_FORMAT_XRGB1555,
15209c7e370SLee Jones 	DRM_FORMAT_XBGR1555,
15309c7e370SLee Jones 	DRM_FORMAT_RGBX5551,
15409c7e370SLee Jones 	DRM_FORMAT_BGRX5551,
15509c7e370SLee Jones 	DRM_FORMAT_ARGB4444,
15609c7e370SLee Jones 	DRM_FORMAT_ABGR4444,
15709c7e370SLee Jones 	DRM_FORMAT_RGBA4444,
15809c7e370SLee Jones 	DRM_FORMAT_BGRA4444,
15909c7e370SLee Jones 	DRM_FORMAT_XRGB4444,
16009c7e370SLee Jones 	DRM_FORMAT_XBGR4444,
16109c7e370SLee Jones 	DRM_FORMAT_RGBX4444,
16209c7e370SLee Jones 	DRM_FORMAT_BGRX4444,
16309c7e370SLee Jones };
16409c7e370SLee Jones 
16509c7e370SLee Jones static const uint32_t plane_formats_yuv[] = {
16609c7e370SLee Jones 	DRM_FORMAT_ARGB8888,
16709c7e370SLee Jones 	DRM_FORMAT_ABGR8888,
16809c7e370SLee Jones 	DRM_FORMAT_RGBA8888,
16909c7e370SLee Jones 	DRM_FORMAT_BGRX8888,
17009c7e370SLee Jones 	DRM_FORMAT_BGRA8888,
171ffbbed63SLeonard Lausen 	DRM_FORMAT_ARGB2101010,
172da7716a2SJessica Zhang 	DRM_FORMAT_XRGB2101010,
17309c7e370SLee Jones 	DRM_FORMAT_XRGB8888,
17409c7e370SLee Jones 	DRM_FORMAT_XBGR8888,
17509c7e370SLee Jones 	DRM_FORMAT_RGBX8888,
17609c7e370SLee Jones 	DRM_FORMAT_RGB888,
17709c7e370SLee Jones 	DRM_FORMAT_BGR888,
17809c7e370SLee Jones 	DRM_FORMAT_RGB565,
17909c7e370SLee Jones 	DRM_FORMAT_BGR565,
18009c7e370SLee Jones 	DRM_FORMAT_ARGB1555,
18109c7e370SLee Jones 	DRM_FORMAT_ABGR1555,
18209c7e370SLee Jones 	DRM_FORMAT_RGBA5551,
18309c7e370SLee Jones 	DRM_FORMAT_BGRA5551,
18409c7e370SLee Jones 	DRM_FORMAT_XRGB1555,
18509c7e370SLee Jones 	DRM_FORMAT_XBGR1555,
18609c7e370SLee Jones 	DRM_FORMAT_RGBX5551,
18709c7e370SLee Jones 	DRM_FORMAT_BGRX5551,
18809c7e370SLee Jones 	DRM_FORMAT_ARGB4444,
18909c7e370SLee Jones 	DRM_FORMAT_ABGR4444,
19009c7e370SLee Jones 	DRM_FORMAT_RGBA4444,
19109c7e370SLee Jones 	DRM_FORMAT_BGRA4444,
19209c7e370SLee Jones 	DRM_FORMAT_XRGB4444,
19309c7e370SLee Jones 	DRM_FORMAT_XBGR4444,
19409c7e370SLee Jones 	DRM_FORMAT_RGBX4444,
19509c7e370SLee Jones 	DRM_FORMAT_BGRX4444,
19609c7e370SLee Jones 
197f07c9946SJessica Zhang 	DRM_FORMAT_P010,
19809c7e370SLee Jones 	DRM_FORMAT_NV12,
19909c7e370SLee Jones 	DRM_FORMAT_NV21,
20009c7e370SLee Jones 	DRM_FORMAT_NV16,
20109c7e370SLee Jones 	DRM_FORMAT_NV61,
20209c7e370SLee Jones 	DRM_FORMAT_VYUY,
20309c7e370SLee Jones 	DRM_FORMAT_UYVY,
20409c7e370SLee Jones 	DRM_FORMAT_YUYV,
20509c7e370SLee Jones 	DRM_FORMAT_YVYU,
20609c7e370SLee Jones 	DRM_FORMAT_YUV420,
20709c7e370SLee Jones 	DRM_FORMAT_YVU420,
20809c7e370SLee Jones };
20909c7e370SLee Jones 
210dabfdd89SVinod Polimera static const u32 rotation_v2_formats[] = {
211dabfdd89SVinod Polimera 	DRM_FORMAT_NV12,
212dabfdd89SVinod Polimera 	/* TODO add formats after validation */
213dabfdd89SVinod Polimera };
214dabfdd89SVinod Polimera 
21553324b99SAbhinav Kumar static const uint32_t wb2_formats[] = {
21653324b99SAbhinav Kumar 	DRM_FORMAT_RGB565,
21753324b99SAbhinav Kumar 	DRM_FORMAT_BGR565,
21853324b99SAbhinav Kumar 	DRM_FORMAT_RGB888,
21953324b99SAbhinav Kumar 	DRM_FORMAT_ARGB8888,
22053324b99SAbhinav Kumar 	DRM_FORMAT_RGBA8888,
22153324b99SAbhinav Kumar 	DRM_FORMAT_ABGR8888,
22253324b99SAbhinav Kumar 	DRM_FORMAT_XRGB8888,
22353324b99SAbhinav Kumar 	DRM_FORMAT_RGBX8888,
22453324b99SAbhinav Kumar 	DRM_FORMAT_XBGR8888,
22553324b99SAbhinav Kumar 	DRM_FORMAT_ARGB1555,
22653324b99SAbhinav Kumar 	DRM_FORMAT_RGBA5551,
22753324b99SAbhinav Kumar 	DRM_FORMAT_XRGB1555,
22853324b99SAbhinav Kumar 	DRM_FORMAT_RGBX5551,
22953324b99SAbhinav Kumar 	DRM_FORMAT_ARGB4444,
23053324b99SAbhinav Kumar 	DRM_FORMAT_RGBA4444,
23153324b99SAbhinav Kumar 	DRM_FORMAT_RGBX4444,
23253324b99SAbhinav Kumar 	DRM_FORMAT_XRGB4444,
23353324b99SAbhinav Kumar 	DRM_FORMAT_BGR565,
23453324b99SAbhinav Kumar 	DRM_FORMAT_BGR888,
23553324b99SAbhinav Kumar 	DRM_FORMAT_ABGR8888,
23653324b99SAbhinav Kumar 	DRM_FORMAT_BGRA8888,
23753324b99SAbhinav Kumar 	DRM_FORMAT_BGRX8888,
23853324b99SAbhinav Kumar 	DRM_FORMAT_XBGR8888,
23953324b99SAbhinav Kumar 	DRM_FORMAT_ABGR1555,
24053324b99SAbhinav Kumar 	DRM_FORMAT_BGRA5551,
24153324b99SAbhinav Kumar 	DRM_FORMAT_XBGR1555,
24253324b99SAbhinav Kumar 	DRM_FORMAT_BGRX5551,
24353324b99SAbhinav Kumar 	DRM_FORMAT_ABGR4444,
24453324b99SAbhinav Kumar 	DRM_FORMAT_BGRA4444,
24553324b99SAbhinav Kumar 	DRM_FORMAT_BGRX4444,
24653324b99SAbhinav Kumar 	DRM_FORMAT_XBGR4444,
24753324b99SAbhinav Kumar };
24853324b99SAbhinav Kumar 
24925fdd593SJeykumar Sankaran /*************************************************************
25025fdd593SJeykumar Sankaran  * SSPP sub blocks config
25125fdd593SJeykumar Sankaran  *************************************************************/
25225fdd593SJeykumar Sankaran 
253bef71390SDmitry Baryshkov #define SSPP_SCALER_VER(maj, min) (((maj) << 16) | (min))
254bef71390SDmitry Baryshkov 
25525fdd593SJeykumar Sankaran /* SSPP common configuration */
256bef71390SDmitry Baryshkov #define _VIG_SBLK(sdma_pri, qseed_ver, scaler_ver) \
25725fdd593SJeykumar Sankaran 	{ \
25825fdd593SJeykumar Sankaran 	.maxdwnscale = MAX_DOWNSCALE_RATIO, \
25925fdd593SJeykumar Sankaran 	.maxupscale = MAX_UPSCALE_RATIO, \
26025fdd593SJeykumar Sankaran 	.smart_dma_priority = sdma_pri, \
261274909a8SRyan McCann 	.scaler_blk = {.name = "scaler", \
262b75ab05aSShubhashree Dhar 		.id = qseed_ver, \
263bef71390SDmitry Baryshkov 		.version = scaler_ver, \
26425fdd593SJeykumar Sankaran 		.base = 0xa00, .len = 0xa0,}, \
265274909a8SRyan McCann 	.csc_blk = {.name = "csc", \
26625fdd593SJeykumar Sankaran 		.id = DPU_SSPP_CSC_10BIT, \
26725fdd593SJeykumar Sankaran 		.base = 0x1a00, .len = 0x100,}, \
26825fdd593SJeykumar Sankaran 	.format_list = plane_formats_yuv, \
269e6b63a7bSFritz Koenig 	.num_formats = ARRAY_SIZE(plane_formats_yuv), \
27025fdd593SJeykumar Sankaran 	.virt_format_list = plane_formats, \
271e6b63a7bSFritz Koenig 	.virt_num_formats = ARRAY_SIZE(plane_formats), \
272dabfdd89SVinod Polimera 	.rotation_cfg = NULL, \
273dabfdd89SVinod Polimera 	}
274dabfdd89SVinod Polimera 
275bef71390SDmitry Baryshkov #define _VIG_SBLK_ROT(sdma_pri, qseed_ver, scaler_ver, rot_cfg) \
276dabfdd89SVinod Polimera 	{ \
277dabfdd89SVinod Polimera 	.maxdwnscale = MAX_DOWNSCALE_RATIO, \
278dabfdd89SVinod Polimera 	.maxupscale = MAX_UPSCALE_RATIO, \
279dabfdd89SVinod Polimera 	.smart_dma_priority = sdma_pri, \
280274909a8SRyan McCann 	.scaler_blk = {.name = "scaler", \
281dabfdd89SVinod Polimera 		.id = qseed_ver, \
282bef71390SDmitry Baryshkov 		.version = scaler_ver, \
283dabfdd89SVinod Polimera 		.base = 0xa00, .len = 0xa0,}, \
284274909a8SRyan McCann 	.csc_blk = {.name = "csc", \
285dabfdd89SVinod Polimera 		.id = DPU_SSPP_CSC_10BIT, \
286dabfdd89SVinod Polimera 		.base = 0x1a00, .len = 0x100,}, \
287dabfdd89SVinod Polimera 	.format_list = plane_formats_yuv, \
288dabfdd89SVinod Polimera 	.num_formats = ARRAY_SIZE(plane_formats_yuv), \
289dabfdd89SVinod Polimera 	.virt_format_list = plane_formats, \
290dabfdd89SVinod Polimera 	.virt_num_formats = ARRAY_SIZE(plane_formats), \
291dabfdd89SVinod Polimera 	.rotation_cfg = rot_cfg, \
29225fdd593SJeykumar Sankaran 	}
29325fdd593SJeykumar Sankaran 
2941071a22cSRyan McCann #define _DMA_SBLK(sdma_pri) \
29525fdd593SJeykumar Sankaran 	{ \
29625fdd593SJeykumar Sankaran 	.maxdwnscale = SSPP_UNITY_SCALE, \
29725fdd593SJeykumar Sankaran 	.maxupscale = SSPP_UNITY_SCALE, \
29825fdd593SJeykumar Sankaran 	.smart_dma_priority = sdma_pri, \
29925fdd593SJeykumar Sankaran 	.format_list = plane_formats, \
300e6b63a7bSFritz Koenig 	.num_formats = ARRAY_SIZE(plane_formats), \
30125fdd593SJeykumar Sankaran 	.virt_format_list = plane_formats, \
302e6b63a7bSFritz Koenig 	.virt_num_formats = ARRAY_SIZE(plane_formats), \
30325fdd593SJeykumar Sankaran 	}
30425fdd593SJeykumar Sankaran 
30594391a14SAngeloGioacchino Del Regno static const struct dpu_sspp_sub_blks msm8998_vig_sblk_0 =
306bef71390SDmitry Baryshkov 				_VIG_SBLK(0, DPU_SSPP_SCALER_QSEED3,
307bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(1, 2));
30894391a14SAngeloGioacchino Del Regno static const struct dpu_sspp_sub_blks msm8998_vig_sblk_1 =
309bef71390SDmitry Baryshkov 				_VIG_SBLK(0, DPU_SSPP_SCALER_QSEED3,
310bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(1, 2));
31194391a14SAngeloGioacchino Del Regno static const struct dpu_sspp_sub_blks msm8998_vig_sblk_2 =
312bef71390SDmitry Baryshkov 				_VIG_SBLK(0, DPU_SSPP_SCALER_QSEED3,
313bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(1, 2));
31494391a14SAngeloGioacchino Del Regno static const struct dpu_sspp_sub_blks msm8998_vig_sblk_3 =
315bef71390SDmitry Baryshkov 				_VIG_SBLK(0, DPU_SSPP_SCALER_QSEED3,
316bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(1, 2));
31794391a14SAngeloGioacchino Del Regno 
318dabfdd89SVinod Polimera static const struct dpu_rotation_cfg dpu_rot_sc7280_cfg_v2 = {
319dabfdd89SVinod Polimera 	.rot_maxheight = 1088,
320dabfdd89SVinod Polimera 	.rot_num_formats = ARRAY_SIZE(rotation_v2_formats),
321dabfdd89SVinod Polimera 	.rot_format_list = rotation_v2_formats,
322dabfdd89SVinod Polimera };
323dabfdd89SVinod Polimera 
324b75ab05aSShubhashree Dhar static const struct dpu_sspp_sub_blks sdm845_vig_sblk_0 =
325bef71390SDmitry Baryshkov 				_VIG_SBLK(5, DPU_SSPP_SCALER_QSEED3,
326bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(1, 3));
327b75ab05aSShubhashree Dhar static const struct dpu_sspp_sub_blks sdm845_vig_sblk_1 =
328bef71390SDmitry Baryshkov 				_VIG_SBLK(6, DPU_SSPP_SCALER_QSEED3,
329bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(1, 3));
330b75ab05aSShubhashree Dhar static const struct dpu_sspp_sub_blks sdm845_vig_sblk_2 =
331bef71390SDmitry Baryshkov 				_VIG_SBLK(7, DPU_SSPP_SCALER_QSEED3,
332bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(1, 3));
333b75ab05aSShubhashree Dhar static const struct dpu_sspp_sub_blks sdm845_vig_sblk_3 =
334bef71390SDmitry Baryshkov 				_VIG_SBLK(8, DPU_SSPP_SCALER_QSEED3,
335bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(1, 3));
336bef71390SDmitry Baryshkov 
337bef71390SDmitry Baryshkov static const struct dpu_sspp_sub_blks sm8150_vig_sblk_0 =
338bef71390SDmitry Baryshkov 				_VIG_SBLK(5, DPU_SSPP_SCALER_QSEED3,
339bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(1, 4));
340bef71390SDmitry Baryshkov static const struct dpu_sspp_sub_blks sm8150_vig_sblk_1 =
341bef71390SDmitry Baryshkov 				_VIG_SBLK(6, DPU_SSPP_SCALER_QSEED3,
342bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(1, 4));
343bef71390SDmitry Baryshkov static const struct dpu_sspp_sub_blks sm8150_vig_sblk_2 =
344bef71390SDmitry Baryshkov 				_VIG_SBLK(7, DPU_SSPP_SCALER_QSEED3,
345bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(1, 4));
346bef71390SDmitry Baryshkov static const struct dpu_sspp_sub_blks sm8150_vig_sblk_3 =
347bef71390SDmitry Baryshkov 				_VIG_SBLK(8, DPU_SSPP_SCALER_QSEED3,
348bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(1, 4));
34925fdd593SJeykumar Sankaran 
3501071a22cSRyan McCann static const struct dpu_sspp_sub_blks sdm845_dma_sblk_0 = _DMA_SBLK(1);
3511071a22cSRyan McCann static const struct dpu_sspp_sub_blks sdm845_dma_sblk_1 = _DMA_SBLK(2);
3521071a22cSRyan McCann static const struct dpu_sspp_sub_blks sdm845_dma_sblk_2 = _DMA_SBLK(3);
3531071a22cSRyan McCann static const struct dpu_sspp_sub_blks sdm845_dma_sblk_3 = _DMA_SBLK(4);
35425fdd593SJeykumar Sankaran 
355b75ab05aSShubhashree Dhar static const struct dpu_sspp_sub_blks sc7180_vig_sblk_0 =
356bef71390SDmitry Baryshkov 				_VIG_SBLK(4, DPU_SSPP_SCALER_QSEED4,
357bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 0));
358b75ab05aSShubhashree Dhar 
359dabfdd89SVinod Polimera static const struct dpu_sspp_sub_blks sc7280_vig_sblk_0 =
360bef71390SDmitry Baryshkov 			_VIG_SBLK_ROT(4, DPU_SSPP_SCALER_QSEED4,
361bef71390SDmitry Baryshkov 				      SSPP_SCALER_VER(3, 0),
362bef71390SDmitry Baryshkov 				      &dpu_rot_sc7280_cfg_v2);
363dabfdd89SVinod Polimera 
3643581b706SAdam Skladowski static const struct dpu_sspp_sub_blks sm6115_vig_sblk_0 =
365bef71390SDmitry Baryshkov 				_VIG_SBLK(2, DPU_SSPP_SCALER_QSEED4,
366bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 0));
3673581b706SAdam Skladowski 
3689b6f4fedSMarijn Suijten static const struct dpu_sspp_sub_blks sm6125_vig_sblk_0 =
369bef71390SDmitry Baryshkov 				_VIG_SBLK(3, DPU_SSPP_SCALER_QSEED3LITE,
370bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(2, 4));
3719b6f4fedSMarijn Suijten 
372d21fc5dfSDmitry Baryshkov static const struct dpu_sspp_sub_blks sm8250_vig_sblk_0 =
373bef71390SDmitry Baryshkov 				_VIG_SBLK(5, DPU_SSPP_SCALER_QSEED4,
374bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 0));
375d21fc5dfSDmitry Baryshkov static const struct dpu_sspp_sub_blks sm8250_vig_sblk_1 =
376bef71390SDmitry Baryshkov 				_VIG_SBLK(6, DPU_SSPP_SCALER_QSEED4,
377bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 0));
378d21fc5dfSDmitry Baryshkov static const struct dpu_sspp_sub_blks sm8250_vig_sblk_2 =
379bef71390SDmitry Baryshkov 				_VIG_SBLK(7, DPU_SSPP_SCALER_QSEED4,
380bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 0));
381d21fc5dfSDmitry Baryshkov static const struct dpu_sspp_sub_blks sm8250_vig_sblk_3 =
382bef71390SDmitry Baryshkov 				_VIG_SBLK(8, DPU_SSPP_SCALER_QSEED4,
383bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 0));
384bef71390SDmitry Baryshkov 
385bef71390SDmitry Baryshkov static const struct dpu_sspp_sub_blks sm8450_vig_sblk_0 =
386bef71390SDmitry Baryshkov 				_VIG_SBLK(5, DPU_SSPP_SCALER_QSEED4,
387bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 1));
388bef71390SDmitry Baryshkov static const struct dpu_sspp_sub_blks sm8450_vig_sblk_1 =
389bef71390SDmitry Baryshkov 				_VIG_SBLK(6, DPU_SSPP_SCALER_QSEED4,
390bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 1));
391bef71390SDmitry Baryshkov static const struct dpu_sspp_sub_blks sm8450_vig_sblk_2 =
392bef71390SDmitry Baryshkov 				_VIG_SBLK(7, DPU_SSPP_SCALER_QSEED4,
393bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 1));
394bef71390SDmitry Baryshkov static const struct dpu_sspp_sub_blks sm8450_vig_sblk_3 =
395bef71390SDmitry Baryshkov 				_VIG_SBLK(8, DPU_SSPP_SCALER_QSEED4,
396bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 1));
397d21fc5dfSDmitry Baryshkov 
398efcd0107SNeil Armstrong static const struct dpu_sspp_sub_blks sm8550_vig_sblk_0 =
399bef71390SDmitry Baryshkov 				_VIG_SBLK(7, DPU_SSPP_SCALER_QSEED4,
400bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 2));
401efcd0107SNeil Armstrong static const struct dpu_sspp_sub_blks sm8550_vig_sblk_1 =
402bef71390SDmitry Baryshkov 				_VIG_SBLK(8, DPU_SSPP_SCALER_QSEED4,
403bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 2));
404efcd0107SNeil Armstrong static const struct dpu_sspp_sub_blks sm8550_vig_sblk_2 =
405bef71390SDmitry Baryshkov 				_VIG_SBLK(9, DPU_SSPP_SCALER_QSEED4,
406bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 2));
407efcd0107SNeil Armstrong static const struct dpu_sspp_sub_blks sm8550_vig_sblk_3 =
408bef71390SDmitry Baryshkov 				_VIG_SBLK(10, DPU_SSPP_SCALER_QSEED4,
409bef71390SDmitry Baryshkov 					  SSPP_SCALER_VER(3, 2));
4101071a22cSRyan McCann static const struct dpu_sspp_sub_blks sm8550_dma_sblk_4 = _DMA_SBLK(5);
4111071a22cSRyan McCann static const struct dpu_sspp_sub_blks sm8550_dma_sblk_5 = _DMA_SBLK(6);
412efcd0107SNeil Armstrong 
4131071a22cSRyan McCann #define _VIG_SBLK_NOSCALE(sdma_pri) \
4145334087eSLoic Poulain 	{ \
4155334087eSLoic Poulain 	.maxdwnscale = SSPP_UNITY_SCALE, \
4165334087eSLoic Poulain 	.maxupscale = SSPP_UNITY_SCALE, \
4175334087eSLoic Poulain 	.smart_dma_priority = sdma_pri, \
4185334087eSLoic Poulain 	.format_list = plane_formats_yuv, \
4195334087eSLoic Poulain 	.num_formats = ARRAY_SIZE(plane_formats_yuv), \
4205334087eSLoic Poulain 	.virt_format_list = plane_formats, \
4215334087eSLoic Poulain 	.virt_num_formats = ARRAY_SIZE(plane_formats), \
4225334087eSLoic Poulain 	}
4235334087eSLoic Poulain 
4241071a22cSRyan McCann static const struct dpu_sspp_sub_blks qcm2290_vig_sblk_0 = _VIG_SBLK_NOSCALE(2);
4251071a22cSRyan McCann static const struct dpu_sspp_sub_blks qcm2290_dma_sblk_0 = _DMA_SBLK(1);
4265334087eSLoic Poulain 
42725fdd593SJeykumar Sankaran /*************************************************************
42825fdd593SJeykumar Sankaran  * MIXER sub blocks config
42925fdd593SJeykumar Sankaran  *************************************************************/
4307bdc0c4bSKalyan Thota 
43194391a14SAngeloGioacchino Del Regno /* MSM8998 */
43294391a14SAngeloGioacchino Del Regno 
43394391a14SAngeloGioacchino Del Regno static const struct dpu_lm_sub_blks msm8998_lm_sblk = {
43494391a14SAngeloGioacchino Del Regno 	.maxwidth = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
43594391a14SAngeloGioacchino Del Regno 	.maxblendstages = 7, /* excluding base layer */
43694391a14SAngeloGioacchino Del Regno 	.blendstage_base = { /* offsets relative to mixer base */
43794391a14SAngeloGioacchino Del Regno 		0x20, 0x50, 0x80, 0xb0, 0x230,
43894391a14SAngeloGioacchino Del Regno 		0x260, 0x290
43994391a14SAngeloGioacchino Del Regno 	},
44094391a14SAngeloGioacchino Del Regno };
44194391a14SAngeloGioacchino Del Regno 
44294391a14SAngeloGioacchino Del Regno /* SDM845 */
44394391a14SAngeloGioacchino Del Regno 
44494391a14SAngeloGioacchino Del Regno static const struct dpu_lm_sub_blks sdm845_lm_sblk = {
44594391a14SAngeloGioacchino Del Regno 	.maxwidth = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
44694391a14SAngeloGioacchino Del Regno 	.maxblendstages = 11, /* excluding base layer */
44794391a14SAngeloGioacchino Del Regno 	.blendstage_base = { /* offsets relative to mixer base */
44894391a14SAngeloGioacchino Del Regno 		0x20, 0x38, 0x50, 0x68, 0x80, 0x98,
44994391a14SAngeloGioacchino Del Regno 		0xb0, 0xc8, 0xe0, 0xf8, 0x110
45094391a14SAngeloGioacchino Del Regno 	},
45194391a14SAngeloGioacchino Del Regno };
45294391a14SAngeloGioacchino Del Regno 
4537bdc0c4bSKalyan Thota /* SC7180 */
4547bdc0c4bSKalyan Thota 
4557bdc0c4bSKalyan Thota static const struct dpu_lm_sub_blks sc7180_lm_sblk = {
4567bdc0c4bSKalyan Thota 	.maxwidth = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
4577bdc0c4bSKalyan Thota 	.maxblendstages = 7, /* excluding base layer */
4587bdc0c4bSKalyan Thota 	.blendstage_base = { /* offsets relative to mixer base */
4597bdc0c4bSKalyan Thota 		0x20, 0x38, 0x50, 0x68, 0x80, 0x98, 0xb0
4607bdc0c4bSKalyan Thota 	},
4617bdc0c4bSKalyan Thota };
4627bdc0c4bSKalyan Thota 
4635334087eSLoic Poulain /* QCM2290 */
4645334087eSLoic Poulain 
4655334087eSLoic Poulain static const struct dpu_lm_sub_blks qcm2290_lm_sblk = {
466da06be8bSDmitry Baryshkov 	.maxwidth = DEFAULT_DPU_LINE_WIDTH,
4675334087eSLoic Poulain 	.maxblendstages = 4, /* excluding base layer */
4685334087eSLoic Poulain 	.blendstage_base = { /* offsets relative to mixer base */
4695334087eSLoic Poulain 		0x20, 0x38, 0x50, 0x68
4705334087eSLoic Poulain 	},
4715334087eSLoic Poulain };
4725334087eSLoic Poulain 
47325fdd593SJeykumar Sankaran /*************************************************************
474e47616dfSKalyan Thota  * DSPP sub blocks config
475e47616dfSKalyan Thota  *************************************************************/
47694391a14SAngeloGioacchino Del Regno static const struct dpu_dspp_sub_blks msm8998_dspp_sblk = {
47746998bf8SRyan McCann 	.pcc = {.name = "pcc", .id = DPU_DSPP_PCC, .base = 0x1700,
47894391a14SAngeloGioacchino Del Regno 		.len = 0x90, .version = 0x10007},
47994391a14SAngeloGioacchino Del Regno };
48094391a14SAngeloGioacchino Del Regno 
4819891b3dfSKonrad Dybcio static const struct dpu_dspp_sub_blks sdm845_dspp_sblk = {
48246998bf8SRyan McCann 	.pcc = {.name = "pcc", .id = DPU_DSPP_PCC, .base = 0x1700,
48305ae91d9SDmitry Baryshkov 		.len = 0x90, .version = 0x40000},
48405ae91d9SDmitry Baryshkov };
48505ae91d9SDmitry Baryshkov 
486e47616dfSKalyan Thota /*************************************************************
48725fdd593SJeykumar Sankaran  * PINGPONG sub blocks config
48825fdd593SJeykumar Sankaran  *************************************************************/
48925fdd593SJeykumar Sankaran static const struct dpu_pingpong_sub_blks sdm845_pp_sblk_te = {
49046998bf8SRyan McCann 	.te2 = {.name = "te2", .id = DPU_PINGPONG_TE2, .base = 0x2000, .len = 0x0,
49125fdd593SJeykumar Sankaran 		.version = 0x1},
49246998bf8SRyan McCann 	.dither = {.name = "dither", .id = DPU_PINGPONG_DITHER, .base = 0x30e0,
49325fdd593SJeykumar Sankaran 		.len = 0x20, .version = 0x10000},
49425fdd593SJeykumar Sankaran };
49525fdd593SJeykumar Sankaran 
49625fdd593SJeykumar Sankaran static const struct dpu_pingpong_sub_blks sdm845_pp_sblk = {
49746998bf8SRyan McCann 	.dither = {.name = "dither", .id = DPU_PINGPONG_DITHER, .base = 0x30e0,
49825fdd593SJeykumar Sankaran 		.len = 0x20, .version = 0x10000},
49925fdd593SJeykumar Sankaran };
50025fdd593SJeykumar Sankaran 
501591e34a0SKrishna Manikandan static const struct dpu_pingpong_sub_blks sc7280_pp_sblk = {
50246998bf8SRyan McCann 	.dither = {.name = "dither", .id = DPU_PINGPONG_DITHER, .base = 0xe0,
503591e34a0SKrishna Manikandan 	.len = 0x20, .version = 0x20000},
504591e34a0SKrishna Manikandan };
505591e34a0SKrishna Manikandan 
5064369c93cSDmitry Baryshkov /*************************************************************
5077c5ab05eSVinod Koul  * DSC sub blocks config
5087c5ab05eSVinod Koul  *************************************************************/
5090d1b10c6SAbhinav Kumar static const struct dpu_dsc_sub_blks dsc_sblk_0 = {
51057a1ca6cSDmitry Baryshkov 	.enc = {.name = "enc", .base = 0x100, .len = 0x9c},
51146998bf8SRyan McCann 	.ctl = {.name = "ctl", .base = 0xF00, .len = 0x10},
5120d1b10c6SAbhinav Kumar };
5130d1b10c6SAbhinav Kumar 
5140d1b10c6SAbhinav Kumar static const struct dpu_dsc_sub_blks dsc_sblk_1 = {
51557a1ca6cSDmitry Baryshkov 	.enc = {.name = "enc", .base = 0x200, .len = 0x9c},
51646998bf8SRyan McCann 	.ctl = {.name = "ctl", .base = 0xF80, .len = 0x10},
5170d1b10c6SAbhinav Kumar };
5180d1b10c6SAbhinav Kumar 
51925fdd593SJeykumar Sankaran /*************************************************************
52025fdd593SJeykumar Sankaran  * VBIF sub blocks config
52125fdd593SJeykumar Sankaran  *************************************************************/
52225fdd593SJeykumar Sankaran /* VBIF QOS remap */
52394391a14SAngeloGioacchino Del Regno static const u32 msm8998_rt_pri_lvl[] = {1, 2, 2, 2};
52494391a14SAngeloGioacchino Del Regno static const u32 msm8998_nrt_pri_lvl[] = {1, 1, 1, 1};
525abda0d92SStephen Boyd static const u32 sdm845_rt_pri_lvl[] = {3, 3, 4, 4, 5, 5, 6, 6};
526abda0d92SStephen Boyd static const u32 sdm845_nrt_pri_lvl[] = {3, 3, 3, 3, 3, 3, 3, 3};
52725fdd593SJeykumar Sankaran 
52894391a14SAngeloGioacchino Del Regno static const struct dpu_vbif_dynamic_ot_cfg msm8998_ot_rdwr_cfg[] = {
52994391a14SAngeloGioacchino Del Regno 	{
5303f23a52fSArnaud Vrac 		.pps = 1920 * 1080 * 30,
53194391a14SAngeloGioacchino Del Regno 		.ot_limit = 2,
53294391a14SAngeloGioacchino Del Regno 	},
53394391a14SAngeloGioacchino Del Regno 	{
5343f23a52fSArnaud Vrac 		.pps = 1920 * 1080 * 60,
5353f23a52fSArnaud Vrac 		.ot_limit = 4,
53694391a14SAngeloGioacchino Del Regno 	},
53794391a14SAngeloGioacchino Del Regno 	{
53894391a14SAngeloGioacchino Del Regno 		.pps = 3840 * 2160 * 30,
53994391a14SAngeloGioacchino Del Regno 		.ot_limit = 16,
54094391a14SAngeloGioacchino Del Regno 	},
54194391a14SAngeloGioacchino Del Regno };
54294391a14SAngeloGioacchino Del Regno 
54394391a14SAngeloGioacchino Del Regno static const struct dpu_vbif_cfg msm8998_vbif[] = {
54494391a14SAngeloGioacchino Del Regno 	{
545606f015bSDmitry Baryshkov 	.name = "vbif_rt", .id = VBIF_RT,
54694391a14SAngeloGioacchino Del Regno 	.base = 0, .len = 0x1040,
54794391a14SAngeloGioacchino Del Regno 	.default_ot_rd_limit = 32,
54894391a14SAngeloGioacchino Del Regno 	.default_ot_wr_limit = 32,
54994391a14SAngeloGioacchino Del Regno 	.features = BIT(DPU_VBIF_QOS_REMAP) | BIT(DPU_VBIF_QOS_OTLIM),
55094391a14SAngeloGioacchino Del Regno 	.xin_halt_timeout = 0x4000,
551c8744315SDmitry Baryshkov 	.qos_rp_remap_size = 0x20,
55294391a14SAngeloGioacchino Del Regno 	.dynamic_ot_rd_tbl = {
55394391a14SAngeloGioacchino Del Regno 		.count = ARRAY_SIZE(msm8998_ot_rdwr_cfg),
55494391a14SAngeloGioacchino Del Regno 		.cfg = msm8998_ot_rdwr_cfg,
55594391a14SAngeloGioacchino Del Regno 		},
55694391a14SAngeloGioacchino Del Regno 	.dynamic_ot_wr_tbl = {
55794391a14SAngeloGioacchino Del Regno 		.count = ARRAY_SIZE(msm8998_ot_rdwr_cfg),
55894391a14SAngeloGioacchino Del Regno 		.cfg = msm8998_ot_rdwr_cfg,
55994391a14SAngeloGioacchino Del Regno 		},
56094391a14SAngeloGioacchino Del Regno 	.qos_rt_tbl = {
56194391a14SAngeloGioacchino Del Regno 		.npriority_lvl = ARRAY_SIZE(msm8998_rt_pri_lvl),
56294391a14SAngeloGioacchino Del Regno 		.priority_lvl = msm8998_rt_pri_lvl,
56394391a14SAngeloGioacchino Del Regno 		},
56494391a14SAngeloGioacchino Del Regno 	.qos_nrt_tbl = {
56594391a14SAngeloGioacchino Del Regno 		.npriority_lvl = ARRAY_SIZE(msm8998_nrt_pri_lvl),
56694391a14SAngeloGioacchino Del Regno 		.priority_lvl = msm8998_nrt_pri_lvl,
56794391a14SAngeloGioacchino Del Regno 		},
56894391a14SAngeloGioacchino Del Regno 	.memtype_count = 14,
56994391a14SAngeloGioacchino Del Regno 	.memtype = {2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2},
57094391a14SAngeloGioacchino Del Regno 	},
57194391a14SAngeloGioacchino Del Regno };
57294391a14SAngeloGioacchino Del Regno 
573abda0d92SStephen Boyd static const struct dpu_vbif_cfg sdm845_vbif[] = {
57425fdd593SJeykumar Sankaran 	{
575606f015bSDmitry Baryshkov 	.name = "vbif_rt", .id = VBIF_RT,
57625fdd593SJeykumar Sankaran 	.base = 0, .len = 0x1040,
57725fdd593SJeykumar Sankaran 	.features = BIT(DPU_VBIF_QOS_REMAP),
57825fdd593SJeykumar Sankaran 	.xin_halt_timeout = 0x4000,
579c8744315SDmitry Baryshkov 	.qos_rp_remap_size = 0x40,
58025fdd593SJeykumar Sankaran 	.qos_rt_tbl = {
58125fdd593SJeykumar Sankaran 		.npriority_lvl = ARRAY_SIZE(sdm845_rt_pri_lvl),
58225fdd593SJeykumar Sankaran 		.priority_lvl = sdm845_rt_pri_lvl,
58325fdd593SJeykumar Sankaran 		},
58425fdd593SJeykumar Sankaran 	.qos_nrt_tbl = {
58525fdd593SJeykumar Sankaran 		.npriority_lvl = ARRAY_SIZE(sdm845_nrt_pri_lvl),
58625fdd593SJeykumar Sankaran 		.priority_lvl = sdm845_nrt_pri_lvl,
58725fdd593SJeykumar Sankaran 		},
58825fdd593SJeykumar Sankaran 	.memtype_count = 14,
58925fdd593SJeykumar Sankaran 	.memtype = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
59025fdd593SJeykumar Sankaran 	},
59125fdd593SJeykumar Sankaran };
59225fdd593SJeykumar Sankaran 
59342d0d253SJonathan Marek static const struct dpu_vbif_cfg sm8550_vbif[] = {
59442d0d253SJonathan Marek 	{
59542d0d253SJonathan Marek 	.name = "vbif_rt", .id = VBIF_RT,
59642d0d253SJonathan Marek 	.base = 0, .len = 0x1040,
59742d0d253SJonathan Marek 	.features = BIT(DPU_VBIF_QOS_REMAP),
59842d0d253SJonathan Marek 	.xin_halt_timeout = 0x4000,
59942d0d253SJonathan Marek 	.qos_rp_remap_size = 0x40,
60042d0d253SJonathan Marek 	.qos_rt_tbl = {
60142d0d253SJonathan Marek 		.npriority_lvl = ARRAY_SIZE(sdm845_rt_pri_lvl),
60242d0d253SJonathan Marek 		.priority_lvl = sdm845_rt_pri_lvl,
60342d0d253SJonathan Marek 		},
60442d0d253SJonathan Marek 	.qos_nrt_tbl = {
60542d0d253SJonathan Marek 		.npriority_lvl = ARRAY_SIZE(sdm845_nrt_pri_lvl),
60642d0d253SJonathan Marek 		.priority_lvl = sdm845_nrt_pri_lvl,
60742d0d253SJonathan Marek 		},
60842d0d253SJonathan Marek 	.memtype_count = 16,
60942d0d253SJonathan Marek 	.memtype = {3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
61042d0d253SJonathan Marek 	},
61142d0d253SJonathan Marek };
61242d0d253SJonathan Marek 
61325fdd593SJeykumar Sankaran /*************************************************************
61425fdd593SJeykumar Sankaran  * PERF data config
61525fdd593SJeykumar Sankaran  *************************************************************/
61625fdd593SJeykumar Sankaran 
61725fdd593SJeykumar Sankaran /* SSPP QOS LUTs */
61894391a14SAngeloGioacchino Del Regno static const struct dpu_qos_lut_entry msm8998_qos_linear[] = {
61994391a14SAngeloGioacchino Del Regno 	{.fl = 4,  .lut = 0x1b},
62094391a14SAngeloGioacchino Del Regno 	{.fl = 5,  .lut = 0x5b},
62194391a14SAngeloGioacchino Del Regno 	{.fl = 6,  .lut = 0x15b},
62294391a14SAngeloGioacchino Del Regno 	{.fl = 7,  .lut = 0x55b},
62394391a14SAngeloGioacchino Del Regno 	{.fl = 8,  .lut = 0x155b},
62494391a14SAngeloGioacchino Del Regno 	{.fl = 9,  .lut = 0x555b},
62594391a14SAngeloGioacchino Del Regno 	{.fl = 10, .lut = 0x1555b},
62694391a14SAngeloGioacchino Del Regno 	{.fl = 11, .lut = 0x5555b},
62794391a14SAngeloGioacchino Del Regno 	{.fl = 12, .lut = 0x15555b},
6283f23a52fSArnaud Vrac 	{.fl = 0,  .lut = 0x55555b}
62994391a14SAngeloGioacchino Del Regno };
63094391a14SAngeloGioacchino Del Regno 
631abda0d92SStephen Boyd static const struct dpu_qos_lut_entry sdm845_qos_linear[] = {
63225fdd593SJeykumar Sankaran 	{.fl = 4, .lut = 0x357},
63325fdd593SJeykumar Sankaran 	{.fl = 5, .lut = 0x3357},
63425fdd593SJeykumar Sankaran 	{.fl = 6, .lut = 0x23357},
63525fdd593SJeykumar Sankaran 	{.fl = 7, .lut = 0x223357},
63625fdd593SJeykumar Sankaran 	{.fl = 8, .lut = 0x2223357},
63725fdd593SJeykumar Sankaran 	{.fl = 9, .lut = 0x22223357},
63825fdd593SJeykumar Sankaran 	{.fl = 10, .lut = 0x222223357},
63925fdd593SJeykumar Sankaran 	{.fl = 11, .lut = 0x2222223357},
64025fdd593SJeykumar Sankaran 	{.fl = 12, .lut = 0x22222223357},
64125fdd593SJeykumar Sankaran 	{.fl = 13, .lut = 0x222222223357},
64225fdd593SJeykumar Sankaran 	{.fl = 14, .lut = 0x1222222223357},
64325fdd593SJeykumar Sankaran 	{.fl = 0, .lut = 0x11222222223357}
64425fdd593SJeykumar Sankaran };
64525fdd593SJeykumar Sankaran 
64694391a14SAngeloGioacchino Del Regno static const struct dpu_qos_lut_entry msm8998_qos_macrotile[] = {
64794391a14SAngeloGioacchino Del Regno 	{.fl = 10, .lut = 0x1aaff},
64894391a14SAngeloGioacchino Del Regno 	{.fl = 11, .lut = 0x5aaff},
64994391a14SAngeloGioacchino Del Regno 	{.fl = 12, .lut = 0x15aaff},
6503f23a52fSArnaud Vrac 	{.fl = 0,  .lut = 0x55aaff},
65194391a14SAngeloGioacchino Del Regno };
65294391a14SAngeloGioacchino Del Regno 
6537bdc0c4bSKalyan Thota static const struct dpu_qos_lut_entry sc7180_qos_linear[] = {
6547bdc0c4bSKalyan Thota 	{.fl = 0, .lut = 0x0011222222335777},
6557bdc0c4bSKalyan Thota };
6567bdc0c4bSKalyan Thota 
6573186acbaSKonrad Dybcio static const struct dpu_qos_lut_entry sm6350_qos_linear_macrotile[] = {
6583186acbaSKonrad Dybcio 	{.fl = 0, .lut = 0x0011223445566777 },
6593186acbaSKonrad Dybcio };
6603186acbaSKonrad Dybcio 
661386fced3SJonathan Marek static const struct dpu_qos_lut_entry sm8150_qos_linear[] = {
662386fced3SJonathan Marek 	{.fl = 0, .lut = 0x0011222222223357 },
663386fced3SJonathan Marek };
664386fced3SJonathan Marek 
665f3af2d6eSRob Clark static const struct dpu_qos_lut_entry sc8180x_qos_linear[] = {
666f3af2d6eSRob Clark 	{.fl = 4, .lut = 0x0000000000000357 },
667f3af2d6eSRob Clark };
668f3af2d6eSRob Clark 
6695334087eSLoic Poulain static const struct dpu_qos_lut_entry qcm2290_qos_linear[] = {
6705334087eSLoic Poulain 	{.fl = 0, .lut = 0x0011222222335777},
6715334087eSLoic Poulain };
6725334087eSLoic Poulain 
673abda0d92SStephen Boyd static const struct dpu_qos_lut_entry sdm845_qos_macrotile[] = {
67425fdd593SJeykumar Sankaran 	{.fl = 10, .lut = 0x344556677},
67525fdd593SJeykumar Sankaran 	{.fl = 11, .lut = 0x3344556677},
67625fdd593SJeykumar Sankaran 	{.fl = 12, .lut = 0x23344556677},
67725fdd593SJeykumar Sankaran 	{.fl = 13, .lut = 0x223344556677},
67825fdd593SJeykumar Sankaran 	{.fl = 14, .lut = 0x1223344556677},
67925fdd593SJeykumar Sankaran 	{.fl = 0, .lut = 0x112233344556677},
68025fdd593SJeykumar Sankaran };
68125fdd593SJeykumar Sankaran 
6827bdc0c4bSKalyan Thota static const struct dpu_qos_lut_entry sc7180_qos_macrotile[] = {
6837bdc0c4bSKalyan Thota 	{.fl = 0, .lut = 0x0011223344556677},
6847bdc0c4bSKalyan Thota };
6857bdc0c4bSKalyan Thota 
686f3af2d6eSRob Clark static const struct dpu_qos_lut_entry sc8180x_qos_macrotile[] = {
687f3af2d6eSRob Clark 	{.fl = 10, .lut = 0x0000000344556677},
688f3af2d6eSRob Clark };
689f3af2d6eSRob Clark 
69094391a14SAngeloGioacchino Del Regno static const struct dpu_qos_lut_entry msm8998_qos_nrt[] = {
69194391a14SAngeloGioacchino Del Regno 	{.fl = 0, .lut = 0x0},
69294391a14SAngeloGioacchino Del Regno };
69394391a14SAngeloGioacchino Del Regno 
694abda0d92SStephen Boyd static const struct dpu_qos_lut_entry sdm845_qos_nrt[] = {
69525fdd593SJeykumar Sankaran 	{.fl = 0, .lut = 0x0},
69625fdd593SJeykumar Sankaran };
69725fdd593SJeykumar Sankaran 
6987bdc0c4bSKalyan Thota static const struct dpu_qos_lut_entry sc7180_qos_nrt[] = {
6997bdc0c4bSKalyan Thota 	{.fl = 0, .lut = 0x0},
7007bdc0c4bSKalyan Thota };
7017bdc0c4bSKalyan Thota 
70225fdd593SJeykumar Sankaran /*************************************************************
703de7d480fSDmitry Baryshkov  * Hardware catalog
70425fdd593SJeykumar Sankaran  *************************************************************/
70525fdd593SJeykumar Sankaran 
7061c611c48SDmitry Baryshkov #include "catalog/dpu_3_0_msm8998.h"
7071c611c48SDmitry Baryshkov 
708460c410fSDmitry Baryshkov #include "catalog/dpu_4_0_sdm845.h"
709460c410fSDmitry Baryshkov 
71025035306SDmitry Baryshkov #include "catalog/dpu_5_0_sm8150.h"
71197e2c803SDmitry Baryshkov #include "catalog/dpu_5_1_sc8180x.h"
7129b6f4fedSMarijn Suijten #include "catalog/dpu_5_4_sm6125.h"
713f3af2d6eSRob Clark 
7142f36168eSDmitry Baryshkov #include "catalog/dpu_6_0_sm8250.h"
715c9cd1552SDmitry Baryshkov #include "catalog/dpu_6_2_sc7180.h"
71601f2e9a7SDmitry Baryshkov #include "catalog/dpu_6_3_sm6115.h"
7173186acbaSKonrad Dybcio #include "catalog/dpu_6_4_sm6350.h"
7185ce22484SDmitry Baryshkov #include "catalog/dpu_6_5_qcm2290.h"
71927f0df03SKonrad Dybcio #include "catalog/dpu_6_9_sm6375.h"
72001f2e9a7SDmitry Baryshkov 
721b8ece0c6SDmitry Baryshkov #include "catalog/dpu_7_0_sm8350.h"
722f0f2c32aSDmitry Baryshkov #include "catalog/dpu_7_2_sc7280.h"
723f0f2c32aSDmitry Baryshkov 
724225978f4SDmitry Baryshkov #include "catalog/dpu_8_0_sc8280xp.h"
7259cc54793SDmitry Baryshkov #include "catalog/dpu_8_1_sm8450.h"
7269cc54793SDmitry Baryshkov 
7279cc54793SDmitry Baryshkov #include "catalog/dpu_9_0_sm8550.h"
728