162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd 462306a36Sopenharmony_ci * Author:Mark Yao <mark.yao@rock-chips.com> 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#ifndef _ROCKCHIP_DRM_VOP2_H 862306a36Sopenharmony_ci#define _ROCKCHIP_DRM_VOP2_H 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#include "rockchip_drm_vop.h" 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include <linux/regmap.h> 1362306a36Sopenharmony_ci#include <drm/drm_modes.h> 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#define VOP_FEATURE_OUTPUT_10BIT BIT(0) 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#define WIN_FEATURE_AFBDC BIT(0) 1862306a36Sopenharmony_ci#define WIN_FEATURE_CLUSTER BIT(1) 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci/* 2162306a36Sopenharmony_ci * the delay number of a window in different mode. 2262306a36Sopenharmony_ci */ 2362306a36Sopenharmony_cienum win_dly_mode { 2462306a36Sopenharmony_ci VOP2_DLY_MODE_DEFAULT, /**< default mode */ 2562306a36Sopenharmony_ci VOP2_DLY_MODE_HISO_S, /** HDR in SDR out mode, as a SDR window */ 2662306a36Sopenharmony_ci VOP2_DLY_MODE_HIHO_H, /** HDR in HDR out mode, as a HDR window */ 2762306a36Sopenharmony_ci VOP2_DLY_MODE_MAX, 2862306a36Sopenharmony_ci}; 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_cienum vop2_scale_up_mode { 3162306a36Sopenharmony_ci VOP2_SCALE_UP_NRST_NBOR, 3262306a36Sopenharmony_ci VOP2_SCALE_UP_BIL, 3362306a36Sopenharmony_ci VOP2_SCALE_UP_BIC, 3462306a36Sopenharmony_ci}; 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_cienum vop2_scale_down_mode { 3762306a36Sopenharmony_ci VOP2_SCALE_DOWN_NRST_NBOR, 3862306a36Sopenharmony_ci VOP2_SCALE_DOWN_BIL, 3962306a36Sopenharmony_ci VOP2_SCALE_DOWN_AVG, 4062306a36Sopenharmony_ci}; 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_cienum vop2_win_regs { 4362306a36Sopenharmony_ci VOP2_WIN_ENABLE, 4462306a36Sopenharmony_ci VOP2_WIN_FORMAT, 4562306a36Sopenharmony_ci VOP2_WIN_CSC_MODE, 4662306a36Sopenharmony_ci VOP2_WIN_XMIRROR, 4762306a36Sopenharmony_ci VOP2_WIN_YMIRROR, 4862306a36Sopenharmony_ci VOP2_WIN_RB_SWAP, 4962306a36Sopenharmony_ci VOP2_WIN_UV_SWAP, 5062306a36Sopenharmony_ci VOP2_WIN_ACT_INFO, 5162306a36Sopenharmony_ci VOP2_WIN_DSP_INFO, 5262306a36Sopenharmony_ci VOP2_WIN_DSP_ST, 5362306a36Sopenharmony_ci VOP2_WIN_YRGB_MST, 5462306a36Sopenharmony_ci VOP2_WIN_UV_MST, 5562306a36Sopenharmony_ci VOP2_WIN_YRGB_VIR, 5662306a36Sopenharmony_ci VOP2_WIN_UV_VIR, 5762306a36Sopenharmony_ci VOP2_WIN_YUV_CLIP, 5862306a36Sopenharmony_ci VOP2_WIN_Y2R_EN, 5962306a36Sopenharmony_ci VOP2_WIN_R2Y_EN, 6062306a36Sopenharmony_ci VOP2_WIN_COLOR_KEY, 6162306a36Sopenharmony_ci VOP2_WIN_COLOR_KEY_EN, 6262306a36Sopenharmony_ci VOP2_WIN_DITHER_UP, 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci /* scale regs */ 6562306a36Sopenharmony_ci VOP2_WIN_SCALE_YRGB_X, 6662306a36Sopenharmony_ci VOP2_WIN_SCALE_YRGB_Y, 6762306a36Sopenharmony_ci VOP2_WIN_SCALE_CBCR_X, 6862306a36Sopenharmony_ci VOP2_WIN_SCALE_CBCR_Y, 6962306a36Sopenharmony_ci VOP2_WIN_YRGB_HOR_SCL_MODE, 7062306a36Sopenharmony_ci VOP2_WIN_YRGB_HSCL_FILTER_MODE, 7162306a36Sopenharmony_ci VOP2_WIN_YRGB_VER_SCL_MODE, 7262306a36Sopenharmony_ci VOP2_WIN_YRGB_VSCL_FILTER_MODE, 7362306a36Sopenharmony_ci VOP2_WIN_CBCR_VER_SCL_MODE, 7462306a36Sopenharmony_ci VOP2_WIN_CBCR_HSCL_FILTER_MODE, 7562306a36Sopenharmony_ci VOP2_WIN_CBCR_HOR_SCL_MODE, 7662306a36Sopenharmony_ci VOP2_WIN_CBCR_VSCL_FILTER_MODE, 7762306a36Sopenharmony_ci VOP2_WIN_VSD_CBCR_GT2, 7862306a36Sopenharmony_ci VOP2_WIN_VSD_CBCR_GT4, 7962306a36Sopenharmony_ci VOP2_WIN_VSD_YRGB_GT2, 8062306a36Sopenharmony_ci VOP2_WIN_VSD_YRGB_GT4, 8162306a36Sopenharmony_ci VOP2_WIN_BIC_COE_SEL, 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_ci /* cluster regs */ 8462306a36Sopenharmony_ci VOP2_WIN_CLUSTER_ENABLE, 8562306a36Sopenharmony_ci VOP2_WIN_AFBC_ENABLE, 8662306a36Sopenharmony_ci VOP2_WIN_CLUSTER_LB_MODE, 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci /* afbc regs */ 8962306a36Sopenharmony_ci VOP2_WIN_AFBC_FORMAT, 9062306a36Sopenharmony_ci VOP2_WIN_AFBC_RB_SWAP, 9162306a36Sopenharmony_ci VOP2_WIN_AFBC_UV_SWAP, 9262306a36Sopenharmony_ci VOP2_WIN_AFBC_AUTO_GATING_EN, 9362306a36Sopenharmony_ci VOP2_WIN_AFBC_BLOCK_SPLIT_EN, 9462306a36Sopenharmony_ci VOP2_WIN_AFBC_PIC_VIR_WIDTH, 9562306a36Sopenharmony_ci VOP2_WIN_AFBC_TILE_NUM, 9662306a36Sopenharmony_ci VOP2_WIN_AFBC_PIC_OFFSET, 9762306a36Sopenharmony_ci VOP2_WIN_AFBC_PIC_SIZE, 9862306a36Sopenharmony_ci VOP2_WIN_AFBC_DSP_OFFSET, 9962306a36Sopenharmony_ci VOP2_WIN_AFBC_TRANSFORM_OFFSET, 10062306a36Sopenharmony_ci VOP2_WIN_AFBC_HDR_PTR, 10162306a36Sopenharmony_ci VOP2_WIN_AFBC_HALF_BLOCK_EN, 10262306a36Sopenharmony_ci VOP2_WIN_AFBC_ROTATE_270, 10362306a36Sopenharmony_ci VOP2_WIN_AFBC_ROTATE_90, 10462306a36Sopenharmony_ci VOP2_WIN_MAX_REG, 10562306a36Sopenharmony_ci}; 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_cistruct vop2_win_data { 10862306a36Sopenharmony_ci const char *name; 10962306a36Sopenharmony_ci unsigned int phys_id; 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci u32 base; 11262306a36Sopenharmony_ci enum drm_plane_type type; 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci u32 nformats; 11562306a36Sopenharmony_ci const u32 *formats; 11662306a36Sopenharmony_ci const uint64_t *format_modifiers; 11762306a36Sopenharmony_ci const unsigned int supported_rotations; 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci /** 12062306a36Sopenharmony_ci * @layer_sel_id: defined by register OVERLAY_LAYER_SEL of VOP2 12162306a36Sopenharmony_ci */ 12262306a36Sopenharmony_ci unsigned int layer_sel_id; 12362306a36Sopenharmony_ci uint64_t feature; 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci unsigned int max_upscale_factor; 12662306a36Sopenharmony_ci unsigned int max_downscale_factor; 12762306a36Sopenharmony_ci const u8 dly[VOP2_DLY_MODE_MAX]; 12862306a36Sopenharmony_ci}; 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_cistruct vop2_video_port_data { 13162306a36Sopenharmony_ci unsigned int id; 13262306a36Sopenharmony_ci u32 feature; 13362306a36Sopenharmony_ci u16 gamma_lut_len; 13462306a36Sopenharmony_ci u16 cubic_lut_len; 13562306a36Sopenharmony_ci struct vop_rect max_output; 13662306a36Sopenharmony_ci const u8 pre_scan_max_dly[4]; 13762306a36Sopenharmony_ci const struct vop2_video_port_regs *regs; 13862306a36Sopenharmony_ci unsigned int offset; 13962306a36Sopenharmony_ci}; 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_cistruct vop2_data { 14262306a36Sopenharmony_ci u8 nr_vps; 14362306a36Sopenharmony_ci const struct vop2_ctrl *ctrl; 14462306a36Sopenharmony_ci const struct vop2_win_data *win; 14562306a36Sopenharmony_ci const struct vop2_video_port_data *vp; 14662306a36Sopenharmony_ci const struct vop_csc_table *csc_table; 14762306a36Sopenharmony_ci struct vop_rect max_input; 14862306a36Sopenharmony_ci struct vop_rect max_output; 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci unsigned int win_size; 15162306a36Sopenharmony_ci unsigned int soc_id; 15262306a36Sopenharmony_ci}; 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_ci/* interrupt define */ 15562306a36Sopenharmony_ci#define FS_NEW_INTR BIT(4) 15662306a36Sopenharmony_ci#define ADDR_SAME_INTR BIT(5) 15762306a36Sopenharmony_ci#define LINE_FLAG1_INTR BIT(6) 15862306a36Sopenharmony_ci#define WIN0_EMPTY_INTR BIT(7) 15962306a36Sopenharmony_ci#define WIN1_EMPTY_INTR BIT(8) 16062306a36Sopenharmony_ci#define WIN2_EMPTY_INTR BIT(9) 16162306a36Sopenharmony_ci#define WIN3_EMPTY_INTR BIT(10) 16262306a36Sopenharmony_ci#define HWC_EMPTY_INTR BIT(11) 16362306a36Sopenharmony_ci#define POST_BUF_EMPTY_INTR BIT(12) 16462306a36Sopenharmony_ci#define PWM_GEN_INTR BIT(13) 16562306a36Sopenharmony_ci#define DMA_FINISH_INTR BIT(14) 16662306a36Sopenharmony_ci#define FS_FIELD_INTR BIT(15) 16762306a36Sopenharmony_ci#define FE_INTR BIT(16) 16862306a36Sopenharmony_ci#define WB_UV_FIFO_FULL_INTR BIT(17) 16962306a36Sopenharmony_ci#define WB_YRGB_FIFO_FULL_INTR BIT(18) 17062306a36Sopenharmony_ci#define WB_COMPLETE_INTR BIT(19) 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci/* 17362306a36Sopenharmony_ci * display output interface supported by rockchip lcdc 17462306a36Sopenharmony_ci */ 17562306a36Sopenharmony_ci#define ROCKCHIP_OUT_MODE_P888 0 17662306a36Sopenharmony_ci#define ROCKCHIP_OUT_MODE_BT1120 0 17762306a36Sopenharmony_ci#define ROCKCHIP_OUT_MODE_P666 1 17862306a36Sopenharmony_ci#define ROCKCHIP_OUT_MODE_P565 2 17962306a36Sopenharmony_ci#define ROCKCHIP_OUT_MODE_BT656 5 18062306a36Sopenharmony_ci#define ROCKCHIP_OUT_MODE_S888 8 18162306a36Sopenharmony_ci#define ROCKCHIP_OUT_MODE_S888_DUMMY 12 18262306a36Sopenharmony_ci#define ROCKCHIP_OUT_MODE_YUV420 14 18362306a36Sopenharmony_ci/* for use special outface */ 18462306a36Sopenharmony_ci#define ROCKCHIP_OUT_MODE_AAAA 15 18562306a36Sopenharmony_ci 18662306a36Sopenharmony_cienum vop_csc_format { 18762306a36Sopenharmony_ci CSC_BT601L, 18862306a36Sopenharmony_ci CSC_BT709L, 18962306a36Sopenharmony_ci CSC_BT601F, 19062306a36Sopenharmony_ci CSC_BT2020, 19162306a36Sopenharmony_ci}; 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_cienum src_factor_mode { 19462306a36Sopenharmony_ci SRC_FAC_ALPHA_ZERO, 19562306a36Sopenharmony_ci SRC_FAC_ALPHA_ONE, 19662306a36Sopenharmony_ci SRC_FAC_ALPHA_DST, 19762306a36Sopenharmony_ci SRC_FAC_ALPHA_DST_INVERSE, 19862306a36Sopenharmony_ci SRC_FAC_ALPHA_SRC, 19962306a36Sopenharmony_ci SRC_FAC_ALPHA_SRC_GLOBAL, 20062306a36Sopenharmony_ci}; 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_cienum dst_factor_mode { 20362306a36Sopenharmony_ci DST_FAC_ALPHA_ZERO, 20462306a36Sopenharmony_ci DST_FAC_ALPHA_ONE, 20562306a36Sopenharmony_ci DST_FAC_ALPHA_SRC, 20662306a36Sopenharmony_ci DST_FAC_ALPHA_SRC_INVERSE, 20762306a36Sopenharmony_ci DST_FAC_ALPHA_DST, 20862306a36Sopenharmony_ci DST_FAC_ALPHA_DST_GLOBAL, 20962306a36Sopenharmony_ci}; 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci#define RK3568_GRF_VO_CON1 0x0364 21262306a36Sopenharmony_ci/* System registers definition */ 21362306a36Sopenharmony_ci#define RK3568_REG_CFG_DONE 0x000 21462306a36Sopenharmony_ci#define RK3568_VERSION_INFO 0x004 21562306a36Sopenharmony_ci#define RK3568_SYS_AUTO_GATING_CTRL 0x008 21662306a36Sopenharmony_ci#define RK3568_SYS_AXI_LUT_CTRL 0x024 21762306a36Sopenharmony_ci#define RK3568_DSP_IF_EN 0x028 21862306a36Sopenharmony_ci#define RK3568_DSP_IF_CTRL 0x02c 21962306a36Sopenharmony_ci#define RK3568_DSP_IF_POL 0x030 22062306a36Sopenharmony_ci#define RK3568_WB_CTRL 0x40 22162306a36Sopenharmony_ci#define RK3568_WB_XSCAL_FACTOR 0x44 22262306a36Sopenharmony_ci#define RK3568_WB_YRGB_MST 0x48 22362306a36Sopenharmony_ci#define RK3568_WB_CBR_MST 0x4C 22462306a36Sopenharmony_ci#define RK3568_OTP_WIN_EN 0x050 22562306a36Sopenharmony_ci#define RK3568_LUT_PORT_SEL 0x058 22662306a36Sopenharmony_ci#define RK3568_SYS_STATUS0 0x060 22762306a36Sopenharmony_ci#define RK3568_VP_LINE_FLAG(vp) (0x70 + (vp) * 0x4) 22862306a36Sopenharmony_ci#define RK3568_SYS0_INT_EN 0x80 22962306a36Sopenharmony_ci#define RK3568_SYS0_INT_CLR 0x84 23062306a36Sopenharmony_ci#define RK3568_SYS0_INT_STATUS 0x88 23162306a36Sopenharmony_ci#define RK3568_SYS1_INT_EN 0x90 23262306a36Sopenharmony_ci#define RK3568_SYS1_INT_CLR 0x94 23362306a36Sopenharmony_ci#define RK3568_SYS1_INT_STATUS 0x98 23462306a36Sopenharmony_ci#define RK3568_VP_INT_EN(vp) (0xA0 + (vp) * 0x10) 23562306a36Sopenharmony_ci#define RK3568_VP_INT_CLR(vp) (0xA4 + (vp) * 0x10) 23662306a36Sopenharmony_ci#define RK3568_VP_INT_STATUS(vp) (0xA8 + (vp) * 0x10) 23762306a36Sopenharmony_ci#define RK3568_VP_INT_RAW_STATUS(vp) (0xAC + (vp) * 0x10) 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_ci/* Video Port registers definition */ 24062306a36Sopenharmony_ci#define RK3568_VP_DSP_CTRL 0x00 24162306a36Sopenharmony_ci#define RK3568_VP_MIPI_CTRL 0x04 24262306a36Sopenharmony_ci#define RK3568_VP_COLOR_BAR_CTRL 0x08 24362306a36Sopenharmony_ci#define RK3568_VP_3D_LUT_CTRL 0x10 24462306a36Sopenharmony_ci#define RK3568_VP_3D_LUT_MST 0x20 24562306a36Sopenharmony_ci#define RK3568_VP_DSP_BG 0x2C 24662306a36Sopenharmony_ci#define RK3568_VP_PRE_SCAN_HTIMING 0x30 24762306a36Sopenharmony_ci#define RK3568_VP_POST_DSP_HACT_INFO 0x34 24862306a36Sopenharmony_ci#define RK3568_VP_POST_DSP_VACT_INFO 0x38 24962306a36Sopenharmony_ci#define RK3568_VP_POST_SCL_FACTOR_YRGB 0x3C 25062306a36Sopenharmony_ci#define RK3568_VP_POST_SCL_CTRL 0x40 25162306a36Sopenharmony_ci#define RK3568_VP_POST_DSP_VACT_INFO_F1 0x44 25262306a36Sopenharmony_ci#define RK3568_VP_DSP_HTOTAL_HS_END 0x48 25362306a36Sopenharmony_ci#define RK3568_VP_DSP_HACT_ST_END 0x4C 25462306a36Sopenharmony_ci#define RK3568_VP_DSP_VTOTAL_VS_END 0x50 25562306a36Sopenharmony_ci#define RK3568_VP_DSP_VACT_ST_END 0x54 25662306a36Sopenharmony_ci#define RK3568_VP_DSP_VS_ST_END_F1 0x58 25762306a36Sopenharmony_ci#define RK3568_VP_DSP_VACT_ST_END_F1 0x5C 25862306a36Sopenharmony_ci#define RK3568_VP_BCSH_CTRL 0x60 25962306a36Sopenharmony_ci#define RK3568_VP_BCSH_BCS 0x64 26062306a36Sopenharmony_ci#define RK3568_VP_BCSH_H 0x68 26162306a36Sopenharmony_ci#define RK3568_VP_BCSH_COLOR_BAR 0x6C 26262306a36Sopenharmony_ci 26362306a36Sopenharmony_ci/* Overlay registers definition */ 26462306a36Sopenharmony_ci#define RK3568_OVL_CTRL 0x600 26562306a36Sopenharmony_ci#define RK3568_OVL_LAYER_SEL 0x604 26662306a36Sopenharmony_ci#define RK3568_OVL_PORT_SEL 0x608 26762306a36Sopenharmony_ci#define RK3568_CLUSTER0_MIX_SRC_COLOR_CTRL 0x610 26862306a36Sopenharmony_ci#define RK3568_CLUSTER0_MIX_DST_COLOR_CTRL 0x614 26962306a36Sopenharmony_ci#define RK3568_CLUSTER0_MIX_SRC_ALPHA_CTRL 0x618 27062306a36Sopenharmony_ci#define RK3568_CLUSTER0_MIX_DST_ALPHA_CTRL 0x61C 27162306a36Sopenharmony_ci#define RK3568_MIX0_SRC_COLOR_CTRL 0x650 27262306a36Sopenharmony_ci#define RK3568_MIX0_DST_COLOR_CTRL 0x654 27362306a36Sopenharmony_ci#define RK3568_MIX0_SRC_ALPHA_CTRL 0x658 27462306a36Sopenharmony_ci#define RK3568_MIX0_DST_ALPHA_CTRL 0x65C 27562306a36Sopenharmony_ci#define RK3568_HDR0_SRC_COLOR_CTRL 0x6C0 27662306a36Sopenharmony_ci#define RK3568_HDR0_DST_COLOR_CTRL 0x6C4 27762306a36Sopenharmony_ci#define RK3568_HDR0_SRC_ALPHA_CTRL 0x6C8 27862306a36Sopenharmony_ci#define RK3568_HDR0_DST_ALPHA_CTRL 0x6CC 27962306a36Sopenharmony_ci#define RK3568_VP_BG_MIX_CTRL(vp) (0x6E0 + (vp) * 4) 28062306a36Sopenharmony_ci#define RK3568_CLUSTER_DLY_NUM 0x6F0 28162306a36Sopenharmony_ci#define RK3568_SMART_DLY_NUM 0x6F8 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_ci/* Cluster register definition, offset relative to window base */ 28462306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_CTRL0 0x00 28562306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_CTRL1 0x04 28662306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_YRGB_MST 0x10 28762306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_CBR_MST 0x14 28862306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_VIR 0x18 28962306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_ACT_INFO 0x20 29062306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_DSP_INFO 0x24 29162306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_DSP_ST 0x28 29262306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_SCL_FACTOR_YRGB 0x30 29362306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_AFBCD_TRANSFORM_OFFSET 0x3C 29462306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_AFBCD_OUTPUT_CTRL 0x50 29562306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_AFBCD_ROTATE_MODE 0x54 29662306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_AFBCD_HDR_PTR 0x58 29762306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_AFBCD_VIR_WIDTH 0x5C 29862306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_AFBCD_PIC_SIZE 0x60 29962306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_AFBCD_PIC_OFFSET 0x64 30062306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_AFBCD_DSP_OFFSET 0x68 30162306a36Sopenharmony_ci#define RK3568_CLUSTER_WIN_AFBCD_CTRL 0x6C 30262306a36Sopenharmony_ci 30362306a36Sopenharmony_ci#define RK3568_CLUSTER_CTRL 0x100 30462306a36Sopenharmony_ci 30562306a36Sopenharmony_ci/* (E)smart register definition, offset relative to window base */ 30662306a36Sopenharmony_ci#define RK3568_SMART_CTRL0 0x00 30762306a36Sopenharmony_ci#define RK3568_SMART_CTRL1 0x04 30862306a36Sopenharmony_ci#define RK3568_SMART_REGION0_CTRL 0x10 30962306a36Sopenharmony_ci#define RK3568_SMART_REGION0_YRGB_MST 0x14 31062306a36Sopenharmony_ci#define RK3568_SMART_REGION0_CBR_MST 0x18 31162306a36Sopenharmony_ci#define RK3568_SMART_REGION0_VIR 0x1C 31262306a36Sopenharmony_ci#define RK3568_SMART_REGION0_ACT_INFO 0x20 31362306a36Sopenharmony_ci#define RK3568_SMART_REGION0_DSP_INFO 0x24 31462306a36Sopenharmony_ci#define RK3568_SMART_REGION0_DSP_ST 0x28 31562306a36Sopenharmony_ci#define RK3568_SMART_REGION0_SCL_CTRL 0x30 31662306a36Sopenharmony_ci#define RK3568_SMART_REGION0_SCL_FACTOR_YRGB 0x34 31762306a36Sopenharmony_ci#define RK3568_SMART_REGION0_SCL_FACTOR_CBR 0x38 31862306a36Sopenharmony_ci#define RK3568_SMART_REGION0_SCL_OFFSET 0x3C 31962306a36Sopenharmony_ci#define RK3568_SMART_REGION1_CTRL 0x40 32062306a36Sopenharmony_ci#define RK3568_SMART_REGION1_YRGB_MST 0x44 32162306a36Sopenharmony_ci#define RK3568_SMART_REGION1_CBR_MST 0x48 32262306a36Sopenharmony_ci#define RK3568_SMART_REGION1_VIR 0x4C 32362306a36Sopenharmony_ci#define RK3568_SMART_REGION1_ACT_INFO 0x50 32462306a36Sopenharmony_ci#define RK3568_SMART_REGION1_DSP_INFO 0x54 32562306a36Sopenharmony_ci#define RK3568_SMART_REGION1_DSP_ST 0x58 32662306a36Sopenharmony_ci#define RK3568_SMART_REGION1_SCL_CTRL 0x60 32762306a36Sopenharmony_ci#define RK3568_SMART_REGION1_SCL_FACTOR_YRGB 0x64 32862306a36Sopenharmony_ci#define RK3568_SMART_REGION1_SCL_FACTOR_CBR 0x68 32962306a36Sopenharmony_ci#define RK3568_SMART_REGION1_SCL_OFFSET 0x6C 33062306a36Sopenharmony_ci#define RK3568_SMART_REGION2_CTRL 0x70 33162306a36Sopenharmony_ci#define RK3568_SMART_REGION2_YRGB_MST 0x74 33262306a36Sopenharmony_ci#define RK3568_SMART_REGION2_CBR_MST 0x78 33362306a36Sopenharmony_ci#define RK3568_SMART_REGION2_VIR 0x7C 33462306a36Sopenharmony_ci#define RK3568_SMART_REGION2_ACT_INFO 0x80 33562306a36Sopenharmony_ci#define RK3568_SMART_REGION2_DSP_INFO 0x84 33662306a36Sopenharmony_ci#define RK3568_SMART_REGION2_DSP_ST 0x88 33762306a36Sopenharmony_ci#define RK3568_SMART_REGION2_SCL_CTRL 0x90 33862306a36Sopenharmony_ci#define RK3568_SMART_REGION2_SCL_FACTOR_YRGB 0x94 33962306a36Sopenharmony_ci#define RK3568_SMART_REGION2_SCL_FACTOR_CBR 0x98 34062306a36Sopenharmony_ci#define RK3568_SMART_REGION2_SCL_OFFSET 0x9C 34162306a36Sopenharmony_ci#define RK3568_SMART_REGION3_CTRL 0xA0 34262306a36Sopenharmony_ci#define RK3568_SMART_REGION3_YRGB_MST 0xA4 34362306a36Sopenharmony_ci#define RK3568_SMART_REGION3_CBR_MST 0xA8 34462306a36Sopenharmony_ci#define RK3568_SMART_REGION3_VIR 0xAC 34562306a36Sopenharmony_ci#define RK3568_SMART_REGION3_ACT_INFO 0xB0 34662306a36Sopenharmony_ci#define RK3568_SMART_REGION3_DSP_INFO 0xB4 34762306a36Sopenharmony_ci#define RK3568_SMART_REGION3_DSP_ST 0xB8 34862306a36Sopenharmony_ci#define RK3568_SMART_REGION3_SCL_CTRL 0xC0 34962306a36Sopenharmony_ci#define RK3568_SMART_REGION3_SCL_FACTOR_YRGB 0xC4 35062306a36Sopenharmony_ci#define RK3568_SMART_REGION3_SCL_FACTOR_CBR 0xC8 35162306a36Sopenharmony_ci#define RK3568_SMART_REGION3_SCL_OFFSET 0xCC 35262306a36Sopenharmony_ci#define RK3568_SMART_COLOR_KEY_CTRL 0xD0 35362306a36Sopenharmony_ci 35462306a36Sopenharmony_ci/* HDR register definition */ 35562306a36Sopenharmony_ci#define RK3568_HDR_LUT_CTRL 0x2000 35662306a36Sopenharmony_ci#define RK3568_HDR_LUT_MST 0x2004 35762306a36Sopenharmony_ci#define RK3568_SDR2HDR_CTRL 0x2010 35862306a36Sopenharmony_ci#define RK3568_HDR2SDR_CTRL 0x2020 35962306a36Sopenharmony_ci#define RK3568_HDR2SDR_SRC_RANGE 0x2024 36062306a36Sopenharmony_ci#define RK3568_HDR2SDR_NORMFACEETF 0x2028 36162306a36Sopenharmony_ci#define RK3568_HDR2SDR_DST_RANGE 0x202C 36262306a36Sopenharmony_ci#define RK3568_HDR2SDR_NORMFACCGAMMA 0x2030 36362306a36Sopenharmony_ci#define RK3568_HDR_EETF_OETF_Y0 0x203C 36462306a36Sopenharmony_ci#define RK3568_HDR_SAT_Y0 0x20C0 36562306a36Sopenharmony_ci#define RK3568_HDR_EOTF_OETF_Y0 0x20F0 36662306a36Sopenharmony_ci#define RK3568_HDR_OETF_DX_POW1 0x2200 36762306a36Sopenharmony_ci#define RK3568_HDR_OETF_XN1 0x2300 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ci#define RK3568_REG_CFG_DONE__GLB_CFG_DONE_EN BIT(15) 37062306a36Sopenharmony_ci 37162306a36Sopenharmony_ci#define RK3568_VP_DSP_CTRL__STANDBY BIT(31) 37262306a36Sopenharmony_ci#define RK3568_VP_DSP_CTRL__DITHER_DOWN_MODE BIT(20) 37362306a36Sopenharmony_ci#define RK3568_VP_DSP_CTRL__DITHER_DOWN_SEL GENMASK(19, 18) 37462306a36Sopenharmony_ci#define RK3568_VP_DSP_CTRL__DITHER_DOWN_EN BIT(17) 37562306a36Sopenharmony_ci#define RK3568_VP_DSP_CTRL__PRE_DITHER_DOWN_EN BIT(16) 37662306a36Sopenharmony_ci#define RK3568_VP_DSP_CTRL__POST_DSP_OUT_R2Y BIT(15) 37762306a36Sopenharmony_ci#define RK3568_VP_DSP_CTRL__DSP_RB_SWAP BIT(9) 37862306a36Sopenharmony_ci#define RK3568_VP_DSP_CTRL__DSP_INTERLACE BIT(7) 37962306a36Sopenharmony_ci#define RK3568_VP_DSP_CTRL__DSP_FILED_POL BIT(6) 38062306a36Sopenharmony_ci#define RK3568_VP_DSP_CTRL__P2I_EN BIT(5) 38162306a36Sopenharmony_ci#define RK3568_VP_DSP_CTRL__CORE_DCLK_DIV BIT(4) 38262306a36Sopenharmony_ci#define RK3568_VP_DSP_CTRL__OUT_MODE GENMASK(3, 0) 38362306a36Sopenharmony_ci 38462306a36Sopenharmony_ci#define RK3568_VP_POST_SCL_CTRL__VSCALEDOWN BIT(1) 38562306a36Sopenharmony_ci#define RK3568_VP_POST_SCL_CTRL__HSCALEDOWN BIT(0) 38662306a36Sopenharmony_ci 38762306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_LVDS1_MUX GENMASK(26, 25) 38862306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_LVDS1 BIT(24) 38962306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_MIPI1_MUX GENMASK(22, 21) 39062306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_MIPI1 BIT(20) 39162306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_LVDS0_MUX GENMASK(19, 18) 39262306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_MIPI0_MUX GENMASK(17, 16) 39362306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_EDP_MUX GENMASK(15, 14) 39462306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_HDMI_MUX GENMASK(11, 10) 39562306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_RGB_MUX GENMASK(9, 8) 39662306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_LVDS0 BIT(5) 39762306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_MIPI0 BIT(4) 39862306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_EDP BIT(3) 39962306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_HDMI BIT(1) 40062306a36Sopenharmony_ci#define RK3568_SYS_DSP_INFACE_EN_RGB BIT(0) 40162306a36Sopenharmony_ci 40262306a36Sopenharmony_ci#define RK3568_DSP_IF_POL__MIPI_PIN_POL GENMASK(19, 16) 40362306a36Sopenharmony_ci#define RK3568_DSP_IF_POL__EDP_PIN_POL GENMASK(15, 12) 40462306a36Sopenharmony_ci#define RK3568_DSP_IF_POL__HDMI_PIN_POL GENMASK(7, 4) 40562306a36Sopenharmony_ci#define RK3568_DSP_IF_POL__RGB_LVDS_PIN_POL GENMASK(3, 0) 40662306a36Sopenharmony_ci 40762306a36Sopenharmony_ci#define RK3568_VP0_MIPI_CTRL__DCLK_DIV2_PHASE_LOCK BIT(5) 40862306a36Sopenharmony_ci#define RK3568_VP0_MIPI_CTRL__DCLK_DIV2 BIT(4) 40962306a36Sopenharmony_ci 41062306a36Sopenharmony_ci#define RK3568_SYS_AUTO_GATING_CTRL__AUTO_GATING_EN BIT(31) 41162306a36Sopenharmony_ci 41262306a36Sopenharmony_ci#define RK3568_DSP_IF_POL__CFG_DONE_IMD BIT(28) 41362306a36Sopenharmony_ci 41462306a36Sopenharmony_ci#define VOP2_SYS_AXI_BUS_NUM 2 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_ci#define VOP2_CLUSTER_YUV444_10 0x12 41762306a36Sopenharmony_ci 41862306a36Sopenharmony_ci#define VOP2_COLOR_KEY_MASK BIT(31) 41962306a36Sopenharmony_ci 42062306a36Sopenharmony_ci#define RK3568_OVL_CTRL__LAYERSEL_REGDONE_IMD BIT(28) 42162306a36Sopenharmony_ci 42262306a36Sopenharmony_ci#define RK3568_VP_BG_MIX_CTRL__BG_DLY GENMASK(31, 24) 42362306a36Sopenharmony_ci 42462306a36Sopenharmony_ci#define RK3568_OVL_PORT_SEL__SEL_PORT GENMASK(31, 16) 42562306a36Sopenharmony_ci#define RK3568_OVL_PORT_SEL__SMART1 GENMASK(31, 30) 42662306a36Sopenharmony_ci#define RK3568_OVL_PORT_SEL__SMART0 GENMASK(29, 28) 42762306a36Sopenharmony_ci#define RK3568_OVL_PORT_SEL__ESMART1 GENMASK(27, 26) 42862306a36Sopenharmony_ci#define RK3568_OVL_PORT_SEL__ESMART0 GENMASK(25, 24) 42962306a36Sopenharmony_ci#define RK3568_OVL_PORT_SEL__CLUSTER1 GENMASK(19, 18) 43062306a36Sopenharmony_ci#define RK3568_OVL_PORT_SEL__CLUSTER0 GENMASK(17, 16) 43162306a36Sopenharmony_ci#define RK3568_OVL_PORT_SET__PORT2_MUX GENMASK(11, 8) 43262306a36Sopenharmony_ci#define RK3568_OVL_PORT_SET__PORT1_MUX GENMASK(7, 4) 43362306a36Sopenharmony_ci#define RK3568_OVL_PORT_SET__PORT0_MUX GENMASK(3, 0) 43462306a36Sopenharmony_ci#define RK3568_OVL_LAYER_SEL__LAYER(layer, x) ((x) << ((layer) * 4)) 43562306a36Sopenharmony_ci 43662306a36Sopenharmony_ci#define RK3568_CLUSTER_DLY_NUM__CLUSTER1_1 GENMASK(31, 24) 43762306a36Sopenharmony_ci#define RK3568_CLUSTER_DLY_NUM__CLUSTER1_0 GENMASK(23, 16) 43862306a36Sopenharmony_ci#define RK3568_CLUSTER_DLY_NUM__CLUSTER0_1 GENMASK(15, 8) 43962306a36Sopenharmony_ci#define RK3568_CLUSTER_DLY_NUM__CLUSTER0_0 GENMASK(7, 0) 44062306a36Sopenharmony_ci 44162306a36Sopenharmony_ci#define RK3568_SMART_DLY_NUM__SMART1 GENMASK(31, 24) 44262306a36Sopenharmony_ci#define RK3568_SMART_DLY_NUM__SMART0 GENMASK(23, 16) 44362306a36Sopenharmony_ci#define RK3568_SMART_DLY_NUM__ESMART1 GENMASK(15, 8) 44462306a36Sopenharmony_ci#define RK3568_SMART_DLY_NUM__ESMART0 GENMASK(7, 0) 44562306a36Sopenharmony_ci 44662306a36Sopenharmony_ci#define VP_INT_DSP_HOLD_VALID BIT(6) 44762306a36Sopenharmony_ci#define VP_INT_FS_FIELD BIT(5) 44862306a36Sopenharmony_ci#define VP_INT_POST_BUF_EMPTY BIT(4) 44962306a36Sopenharmony_ci#define VP_INT_LINE_FLAG1 BIT(3) 45062306a36Sopenharmony_ci#define VP_INT_LINE_FLAG0 BIT(2) 45162306a36Sopenharmony_ci#define VOP2_INT_BUS_ERRPR BIT(1) 45262306a36Sopenharmony_ci#define VP_INT_FS BIT(0) 45362306a36Sopenharmony_ci 45462306a36Sopenharmony_ci#define POLFLAG_DCLK_INV BIT(3) 45562306a36Sopenharmony_ci 45662306a36Sopenharmony_cienum vop2_layer_phy_id { 45762306a36Sopenharmony_ci ROCKCHIP_VOP2_CLUSTER0 = 0, 45862306a36Sopenharmony_ci ROCKCHIP_VOP2_CLUSTER1, 45962306a36Sopenharmony_ci ROCKCHIP_VOP2_ESMART0, 46062306a36Sopenharmony_ci ROCKCHIP_VOP2_ESMART1, 46162306a36Sopenharmony_ci ROCKCHIP_VOP2_SMART0, 46262306a36Sopenharmony_ci ROCKCHIP_VOP2_SMART1, 46362306a36Sopenharmony_ci ROCKCHIP_VOP2_CLUSTER2, 46462306a36Sopenharmony_ci ROCKCHIP_VOP2_CLUSTER3, 46562306a36Sopenharmony_ci ROCKCHIP_VOP2_ESMART2, 46662306a36Sopenharmony_ci ROCKCHIP_VOP2_ESMART3, 46762306a36Sopenharmony_ci ROCKCHIP_VOP2_PHY_ID_INVALID = -1, 46862306a36Sopenharmony_ci}; 46962306a36Sopenharmony_ci 47062306a36Sopenharmony_ciextern const struct component_ops vop2_component_ops; 47162306a36Sopenharmony_ci 47262306a36Sopenharmony_ci#endif /* _ROCKCHIP_DRM_VOP2_H */ 473