mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 04:34:08 +08:00
drm/rockchip: Add VOP2 driver
The VOP2 unit is found on Rockchip SoCs beginning with rk3566/rk3568. It replaces the VOP unit found in the older Rockchip SoCs. This driver has been derived from the downstream Rockchip Kernel and heavily modified: - All nonstandard DRM properties have been removed - dropped struct vop2_plane_state and pass around less data between functions - Dropped all DRM_FORMAT_* not known on upstream - rework register access to get rid of excessively used macros - Drop all waiting for framesyncs The driver is tested with HDMI and MIPI-DSI display on a RK3568-EVB board. Overlay support is tested with the modetest utility. AFBC support on the cluster windows is tested with weston-simple-dmabuf-egl on weston using the (yet to be upstreamed) panfrost driver support. Signed-off-by: Andy Yan <andy.yan@rock-chips.com> Co-Developed-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Tested-by: Michael Riesch <michael.riesch@wolfvision.net> [dt-binding-header:] Acked-by: Rob Herring <robh@kernel.org> [moved dt-binding header from dt-nodes patch to here and made checkpatch --strict happier] Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20220422072841.2206452-23-s.hauer@pengutronix.de
This commit is contained in:
parent
b382406a2c
commit
604be85547
@ -29,6 +29,12 @@ config ROCKCHIP_VOP
|
||||
This selects support for the VOP driver. You should enable it
|
||||
on older SoCs.
|
||||
|
||||
config ROCKCHIP_VOP2
|
||||
bool "Rockchip VOP2 driver"
|
||||
help
|
||||
This selects support for the VOP2 driver. The VOP2 hardware is
|
||||
first found on the RK3568.
|
||||
|
||||
config ROCKCHIP_ANALOGIX_DP
|
||||
bool "Rockchip specific extensions for Analogix DP driver"
|
||||
depends on ROCKCHIP_VOP
|
||||
|
@ -6,6 +6,7 @@
|
||||
rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \
|
||||
rockchip_drm_gem.o
|
||||
|
||||
rockchipdrm-$(CONFIG_ROCKCHIP_VOP2) += rockchip_drm_vop2.o rockchip_vop2_reg.o
|
||||
rockchipdrm-$(CONFIG_ROCKCHIP_VOP) += rockchip_drm_vop.o rockchip_vop_reg.o
|
||||
rockchipdrm-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o
|
||||
rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o
|
||||
|
@ -482,6 +482,7 @@ static int __init rockchip_drm_init(void)
|
||||
|
||||
num_rockchip_sub_drivers = 0;
|
||||
ADD_ROCKCHIP_SUB_DRIVER(vop_platform_driver, CONFIG_ROCKCHIP_VOP);
|
||||
ADD_ROCKCHIP_SUB_DRIVER(vop2_platform_driver, CONFIG_ROCKCHIP_VOP2);
|
||||
ADD_ROCKCHIP_SUB_DRIVER(rockchip_lvds_driver,
|
||||
CONFIG_ROCKCHIP_LVDS);
|
||||
ADD_ROCKCHIP_SUB_DRIVER(rockchip_dp_driver,
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#define ROCKCHIP_MAX_FB_BUFFER 3
|
||||
#define ROCKCHIP_MAX_CONNECTOR 2
|
||||
#define ROCKCHIP_MAX_CRTC 2
|
||||
#define ROCKCHIP_MAX_CRTC 4
|
||||
|
||||
struct drm_device;
|
||||
struct drm_connector;
|
||||
@ -31,6 +31,9 @@ struct rockchip_crtc_state {
|
||||
int output_bpc;
|
||||
int output_flags;
|
||||
bool enable_afbc;
|
||||
u32 bus_format;
|
||||
u32 bus_flags;
|
||||
int color_space;
|
||||
};
|
||||
#define to_rockchip_crtc_state(s) \
|
||||
container_of(s, struct rockchip_crtc_state, base)
|
||||
@ -72,6 +75,7 @@ extern struct platform_driver rockchip_dp_driver;
|
||||
extern struct platform_driver rockchip_lvds_driver;
|
||||
extern struct platform_driver vop_platform_driver;
|
||||
extern struct platform_driver rk3066_hdmi_driver;
|
||||
extern struct platform_driver vop2_platform_driver;
|
||||
|
||||
static inline struct rockchip_encoder *to_rockchip_encoder(struct drm_encoder *encoder)
|
||||
{
|
||||
|
@ -134,4 +134,6 @@ void rockchip_drm_mode_config_init(struct drm_device *dev)
|
||||
|
||||
dev->mode_config.funcs = &rockchip_drm_mode_config_funcs;
|
||||
dev->mode_config.helper_private = &rockchip_mode_config_helpers;
|
||||
|
||||
dev->mode_config.normalize_zpos = true;
|
||||
}
|
||||
|
@ -54,9 +54,23 @@ struct vop_afbc {
|
||||
struct vop_reg enable;
|
||||
struct vop_reg win_sel;
|
||||
struct vop_reg format;
|
||||
struct vop_reg rb_swap;
|
||||
struct vop_reg uv_swap;
|
||||
struct vop_reg auto_gating_en;
|
||||
struct vop_reg block_split_en;
|
||||
struct vop_reg pic_vir_width;
|
||||
struct vop_reg tile_num;
|
||||
struct vop_reg hreg_block_split;
|
||||
struct vop_reg pic_offset;
|
||||
struct vop_reg pic_size;
|
||||
struct vop_reg dsp_offset;
|
||||
struct vop_reg transform_offset;
|
||||
struct vop_reg hdr_ptr;
|
||||
struct vop_reg half_block_en;
|
||||
struct vop_reg xmirror;
|
||||
struct vop_reg ymirror;
|
||||
struct vop_reg rotate_270;
|
||||
struct vop_reg rotate_90;
|
||||
struct vop_reg rstn;
|
||||
};
|
||||
|
||||
|
2706
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
Normal file
2706
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
Normal file
File diff suppressed because it is too large
Load Diff
477
drivers/gpu/drm/rockchip/rockchip_drm_vop2.h
Normal file
477
drivers/gpu/drm/rockchip/rockchip_drm_vop2.h
Normal file
@ -0,0 +1,477 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
|
||||
* Author:Mark Yao <mark.yao@rock-chips.com>
|
||||
*/
|
||||
|
||||
#ifndef _ROCKCHIP_DRM_VOP2_H
|
||||
#define _ROCKCHIP_DRM_VOP2_H
|
||||
|
||||
#include "rockchip_drm_vop.h"
|
||||
|
||||
#include <linux/regmap.h>
|
||||
#include <drm/drm_modes.h>
|
||||
|
||||
#define VOP_FEATURE_OUTPUT_10BIT BIT(0)
|
||||
|
||||
#define WIN_FEATURE_AFBDC BIT(0)
|
||||
#define WIN_FEATURE_CLUSTER BIT(1)
|
||||
|
||||
/*
|
||||
* the delay number of a window in different mode.
|
||||
*/
|
||||
enum win_dly_mode {
|
||||
VOP2_DLY_MODE_DEFAULT, /**< default mode */
|
||||
VOP2_DLY_MODE_HISO_S, /** HDR in SDR out mode, as a SDR window */
|
||||
VOP2_DLY_MODE_HIHO_H, /** HDR in HDR out mode, as a HDR window */
|
||||
VOP2_DLY_MODE_MAX,
|
||||
};
|
||||
|
||||
struct vop_rect {
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
enum vop2_scale_up_mode {
|
||||
VOP2_SCALE_UP_NRST_NBOR,
|
||||
VOP2_SCALE_UP_BIL,
|
||||
VOP2_SCALE_UP_BIC,
|
||||
};
|
||||
|
||||
enum vop2_scale_down_mode {
|
||||
VOP2_SCALE_DOWN_NRST_NBOR,
|
||||
VOP2_SCALE_DOWN_BIL,
|
||||
VOP2_SCALE_DOWN_AVG,
|
||||
};
|
||||
|
||||
enum vop2_win_regs {
|
||||
VOP2_WIN_ENABLE,
|
||||
VOP2_WIN_FORMAT,
|
||||
VOP2_WIN_CSC_MODE,
|
||||
VOP2_WIN_XMIRROR,
|
||||
VOP2_WIN_YMIRROR,
|
||||
VOP2_WIN_RB_SWAP,
|
||||
VOP2_WIN_UV_SWAP,
|
||||
VOP2_WIN_ACT_INFO,
|
||||
VOP2_WIN_DSP_INFO,
|
||||
VOP2_WIN_DSP_ST,
|
||||
VOP2_WIN_YRGB_MST,
|
||||
VOP2_WIN_UV_MST,
|
||||
VOP2_WIN_YRGB_VIR,
|
||||
VOP2_WIN_UV_VIR,
|
||||
VOP2_WIN_YUV_CLIP,
|
||||
VOP2_WIN_Y2R_EN,
|
||||
VOP2_WIN_R2Y_EN,
|
||||
VOP2_WIN_COLOR_KEY,
|
||||
VOP2_WIN_COLOR_KEY_EN,
|
||||
VOP2_WIN_DITHER_UP,
|
||||
|
||||
/* scale regs */
|
||||
VOP2_WIN_SCALE_YRGB_X,
|
||||
VOP2_WIN_SCALE_YRGB_Y,
|
||||
VOP2_WIN_SCALE_CBCR_X,
|
||||
VOP2_WIN_SCALE_CBCR_Y,
|
||||
VOP2_WIN_YRGB_HOR_SCL_MODE,
|
||||
VOP2_WIN_YRGB_HSCL_FILTER_MODE,
|
||||
VOP2_WIN_YRGB_VER_SCL_MODE,
|
||||
VOP2_WIN_YRGB_VSCL_FILTER_MODE,
|
||||
VOP2_WIN_CBCR_VER_SCL_MODE,
|
||||
VOP2_WIN_CBCR_HSCL_FILTER_MODE,
|
||||
VOP2_WIN_CBCR_HOR_SCL_MODE,
|
||||
VOP2_WIN_CBCR_VSCL_FILTER_MODE,
|
||||
VOP2_WIN_VSD_CBCR_GT2,
|
||||
VOP2_WIN_VSD_CBCR_GT4,
|
||||
VOP2_WIN_VSD_YRGB_GT2,
|
||||
VOP2_WIN_VSD_YRGB_GT4,
|
||||
VOP2_WIN_BIC_COE_SEL,
|
||||
|
||||
/* cluster regs */
|
||||
VOP2_WIN_CLUSTER_ENABLE,
|
||||
VOP2_WIN_AFBC_ENABLE,
|
||||
VOP2_WIN_CLUSTER_LB_MODE,
|
||||
|
||||
/* afbc regs */
|
||||
VOP2_WIN_AFBC_FORMAT,
|
||||
VOP2_WIN_AFBC_RB_SWAP,
|
||||
VOP2_WIN_AFBC_UV_SWAP,
|
||||
VOP2_WIN_AFBC_AUTO_GATING_EN,
|
||||
VOP2_WIN_AFBC_BLOCK_SPLIT_EN,
|
||||
VOP2_WIN_AFBC_PIC_VIR_WIDTH,
|
||||
VOP2_WIN_AFBC_TILE_NUM,
|
||||
VOP2_WIN_AFBC_PIC_OFFSET,
|
||||
VOP2_WIN_AFBC_PIC_SIZE,
|
||||
VOP2_WIN_AFBC_DSP_OFFSET,
|
||||
VOP2_WIN_AFBC_TRANSFORM_OFFSET,
|
||||
VOP2_WIN_AFBC_HDR_PTR,
|
||||
VOP2_WIN_AFBC_HALF_BLOCK_EN,
|
||||
VOP2_WIN_AFBC_ROTATE_270,
|
||||
VOP2_WIN_AFBC_ROTATE_90,
|
||||
VOP2_WIN_MAX_REG,
|
||||
};
|
||||
|
||||
struct vop2_win_data {
|
||||
const char *name;
|
||||
unsigned int phys_id;
|
||||
|
||||
u32 base;
|
||||
enum drm_plane_type type;
|
||||
|
||||
u32 nformats;
|
||||
const u32 *formats;
|
||||
const uint64_t *format_modifiers;
|
||||
const unsigned int supported_rotations;
|
||||
|
||||
/**
|
||||
* @layer_sel_id: defined by register OVERLAY_LAYER_SEL of VOP2
|
||||
*/
|
||||
unsigned int layer_sel_id;
|
||||
uint64_t feature;
|
||||
|
||||
unsigned int max_upscale_factor;
|
||||
unsigned int max_downscale_factor;
|
||||
const u8 dly[VOP2_DLY_MODE_MAX];
|
||||
};
|
||||
|
||||
struct vop2_video_port_data {
|
||||
unsigned int id;
|
||||
u32 feature;
|
||||
u16 gamma_lut_len;
|
||||
u16 cubic_lut_len;
|
||||
struct vop_rect max_output;
|
||||
const u8 pre_scan_max_dly[4];
|
||||
const struct vop2_video_port_regs *regs;
|
||||
unsigned int offset;
|
||||
};
|
||||
|
||||
struct vop2_data {
|
||||
u8 nr_vps;
|
||||
const struct vop2_ctrl *ctrl;
|
||||
const struct vop2_win_data *win;
|
||||
const struct vop2_video_port_data *vp;
|
||||
const struct vop_csc_table *csc_table;
|
||||
struct vop_rect max_input;
|
||||
struct vop_rect max_output;
|
||||
|
||||
unsigned int win_size;
|
||||
unsigned int soc_id;
|
||||
};
|
||||
|
||||
/* interrupt define */
|
||||
#define FS_NEW_INTR BIT(4)
|
||||
#define ADDR_SAME_INTR BIT(5)
|
||||
#define LINE_FLAG1_INTR BIT(6)
|
||||
#define WIN0_EMPTY_INTR BIT(7)
|
||||
#define WIN1_EMPTY_INTR BIT(8)
|
||||
#define WIN2_EMPTY_INTR BIT(9)
|
||||
#define WIN3_EMPTY_INTR BIT(10)
|
||||
#define HWC_EMPTY_INTR BIT(11)
|
||||
#define POST_BUF_EMPTY_INTR BIT(12)
|
||||
#define PWM_GEN_INTR BIT(13)
|
||||
#define DMA_FINISH_INTR BIT(14)
|
||||
#define FS_FIELD_INTR BIT(15)
|
||||
#define FE_INTR BIT(16)
|
||||
#define WB_UV_FIFO_FULL_INTR BIT(17)
|
||||
#define WB_YRGB_FIFO_FULL_INTR BIT(18)
|
||||
#define WB_COMPLETE_INTR BIT(19)
|
||||
|
||||
/*
|
||||
* display output interface supported by rockchip lcdc
|
||||
*/
|
||||
#define ROCKCHIP_OUT_MODE_P888 0
|
||||
#define ROCKCHIP_OUT_MODE_BT1120 0
|
||||
#define ROCKCHIP_OUT_MODE_P666 1
|
||||
#define ROCKCHIP_OUT_MODE_P565 2
|
||||
#define ROCKCHIP_OUT_MODE_BT656 5
|
||||
#define ROCKCHIP_OUT_MODE_S888 8
|
||||
#define ROCKCHIP_OUT_MODE_S888_DUMMY 12
|
||||
#define ROCKCHIP_OUT_MODE_YUV420 14
|
||||
/* for use special outface */
|
||||
#define ROCKCHIP_OUT_MODE_AAAA 15
|
||||
|
||||
enum vop_csc_format {
|
||||
CSC_BT601L,
|
||||
CSC_BT709L,
|
||||
CSC_BT601F,
|
||||
CSC_BT2020,
|
||||
};
|
||||
|
||||
enum src_factor_mode {
|
||||
SRC_FAC_ALPHA_ZERO,
|
||||
SRC_FAC_ALPHA_ONE,
|
||||
SRC_FAC_ALPHA_DST,
|
||||
SRC_FAC_ALPHA_DST_INVERSE,
|
||||
SRC_FAC_ALPHA_SRC,
|
||||
SRC_FAC_ALPHA_SRC_GLOBAL,
|
||||
};
|
||||
|
||||
enum dst_factor_mode {
|
||||
DST_FAC_ALPHA_ZERO,
|
||||
DST_FAC_ALPHA_ONE,
|
||||
DST_FAC_ALPHA_SRC,
|
||||
DST_FAC_ALPHA_SRC_INVERSE,
|
||||
DST_FAC_ALPHA_DST,
|
||||
DST_FAC_ALPHA_DST_GLOBAL,
|
||||
};
|
||||
|
||||
#define RK3568_GRF_VO_CON1 0x0364
|
||||
/* System registers definition */
|
||||
#define RK3568_REG_CFG_DONE 0x000
|
||||
#define RK3568_VERSION_INFO 0x004
|
||||
#define RK3568_SYS_AUTO_GATING_CTRL 0x008
|
||||
#define RK3568_SYS_AXI_LUT_CTRL 0x024
|
||||
#define RK3568_DSP_IF_EN 0x028
|
||||
#define RK3568_DSP_IF_CTRL 0x02c
|
||||
#define RK3568_DSP_IF_POL 0x030
|
||||
#define RK3568_WB_CTRL 0x40
|
||||
#define RK3568_WB_XSCAL_FACTOR 0x44
|
||||
#define RK3568_WB_YRGB_MST 0x48
|
||||
#define RK3568_WB_CBR_MST 0x4C
|
||||
#define RK3568_OTP_WIN_EN 0x050
|
||||
#define RK3568_LUT_PORT_SEL 0x058
|
||||
#define RK3568_SYS_STATUS0 0x060
|
||||
#define RK3568_VP_LINE_FLAG(vp) (0x70 + (vp) * 0x4)
|
||||
#define RK3568_SYS0_INT_EN 0x80
|
||||
#define RK3568_SYS0_INT_CLR 0x84
|
||||
#define RK3568_SYS0_INT_STATUS 0x88
|
||||
#define RK3568_SYS1_INT_EN 0x90
|
||||
#define RK3568_SYS1_INT_CLR 0x94
|
||||
#define RK3568_SYS1_INT_STATUS 0x98
|
||||
#define RK3568_VP_INT_EN(vp) (0xA0 + (vp) * 0x10)
|
||||
#define RK3568_VP_INT_CLR(vp) (0xA4 + (vp) * 0x10)
|
||||
#define RK3568_VP_INT_STATUS(vp) (0xA8 + (vp) * 0x10)
|
||||
#define RK3568_VP_INT_RAW_STATUS(vp) (0xAC + (vp) * 0x10)
|
||||
|
||||
/* Video Port registers definition */
|
||||
#define RK3568_VP_DSP_CTRL 0x00
|
||||
#define RK3568_VP_MIPI_CTRL 0x04
|
||||
#define RK3568_VP_COLOR_BAR_CTRL 0x08
|
||||
#define RK3568_VP_3D_LUT_CTRL 0x10
|
||||
#define RK3568_VP_3D_LUT_MST 0x20
|
||||
#define RK3568_VP_DSP_BG 0x2C
|
||||
#define RK3568_VP_PRE_SCAN_HTIMING 0x30
|
||||
#define RK3568_VP_POST_DSP_HACT_INFO 0x34
|
||||
#define RK3568_VP_POST_DSP_VACT_INFO 0x38
|
||||
#define RK3568_VP_POST_SCL_FACTOR_YRGB 0x3C
|
||||
#define RK3568_VP_POST_SCL_CTRL 0x40
|
||||
#define RK3568_VP_POST_DSP_VACT_INFO_F1 0x44
|
||||
#define RK3568_VP_DSP_HTOTAL_HS_END 0x48
|
||||
#define RK3568_VP_DSP_HACT_ST_END 0x4C
|
||||
#define RK3568_VP_DSP_VTOTAL_VS_END 0x50
|
||||
#define RK3568_VP_DSP_VACT_ST_END 0x54
|
||||
#define RK3568_VP_DSP_VS_ST_END_F1 0x58
|
||||
#define RK3568_VP_DSP_VACT_ST_END_F1 0x5C
|
||||
#define RK3568_VP_BCSH_CTRL 0x60
|
||||
#define RK3568_VP_BCSH_BCS 0x64
|
||||
#define RK3568_VP_BCSH_H 0x68
|
||||
#define RK3568_VP_BCSH_COLOR_BAR 0x6C
|
||||
|
||||
/* Overlay registers definition */
|
||||
#define RK3568_OVL_CTRL 0x600
|
||||
#define RK3568_OVL_LAYER_SEL 0x604
|
||||
#define RK3568_OVL_PORT_SEL 0x608
|
||||
#define RK3568_CLUSTER0_MIX_SRC_COLOR_CTRL 0x610
|
||||
#define RK3568_CLUSTER0_MIX_DST_COLOR_CTRL 0x614
|
||||
#define RK3568_CLUSTER0_MIX_SRC_ALPHA_CTRL 0x618
|
||||
#define RK3568_CLUSTER0_MIX_DST_ALPHA_CTRL 0x61C
|
||||
#define RK3568_MIX0_SRC_COLOR_CTRL 0x650
|
||||
#define RK3568_MIX0_DST_COLOR_CTRL 0x654
|
||||
#define RK3568_MIX0_SRC_ALPHA_CTRL 0x658
|
||||
#define RK3568_MIX0_DST_ALPHA_CTRL 0x65C
|
||||
#define RK3568_HDR0_SRC_COLOR_CTRL 0x6C0
|
||||
#define RK3568_HDR0_DST_COLOR_CTRL 0x6C4
|
||||
#define RK3568_HDR0_SRC_ALPHA_CTRL 0x6C8
|
||||
#define RK3568_HDR0_DST_ALPHA_CTRL 0x6CC
|
||||
#define RK3568_VP_BG_MIX_CTRL(vp) (0x6E0 + (vp) * 4)
|
||||
#define RK3568_CLUSTER_DLY_NUM 0x6F0
|
||||
#define RK3568_SMART_DLY_NUM 0x6F8
|
||||
|
||||
/* Cluster register definition, offset relative to window base */
|
||||
#define RK3568_CLUSTER_WIN_CTRL0 0x00
|
||||
#define RK3568_CLUSTER_WIN_CTRL1 0x04
|
||||
#define RK3568_CLUSTER_WIN_YRGB_MST 0x10
|
||||
#define RK3568_CLUSTER_WIN_CBR_MST 0x14
|
||||
#define RK3568_CLUSTER_WIN_VIR 0x18
|
||||
#define RK3568_CLUSTER_WIN_ACT_INFO 0x20
|
||||
#define RK3568_CLUSTER_WIN_DSP_INFO 0x24
|
||||
#define RK3568_CLUSTER_WIN_DSP_ST 0x28
|
||||
#define RK3568_CLUSTER_WIN_SCL_FACTOR_YRGB 0x30
|
||||
#define RK3568_CLUSTER_WIN_AFBCD_TRANSFORM_OFFSET 0x3C
|
||||
#define RK3568_CLUSTER_WIN_AFBCD_OUTPUT_CTRL 0x50
|
||||
#define RK3568_CLUSTER_WIN_AFBCD_ROTATE_MODE 0x54
|
||||
#define RK3568_CLUSTER_WIN_AFBCD_HDR_PTR 0x58
|
||||
#define RK3568_CLUSTER_WIN_AFBCD_VIR_WIDTH 0x5C
|
||||
#define RK3568_CLUSTER_WIN_AFBCD_PIC_SIZE 0x60
|
||||
#define RK3568_CLUSTER_WIN_AFBCD_PIC_OFFSET 0x64
|
||||
#define RK3568_CLUSTER_WIN_AFBCD_DSP_OFFSET 0x68
|
||||
#define RK3568_CLUSTER_WIN_AFBCD_CTRL 0x6C
|
||||
|
||||
#define RK3568_CLUSTER_CTRL 0x100
|
||||
|
||||
/* (E)smart register definition, offset relative to window base */
|
||||
#define RK3568_SMART_CTRL0 0x00
|
||||
#define RK3568_SMART_CTRL1 0x04
|
||||
#define RK3568_SMART_REGION0_CTRL 0x10
|
||||
#define RK3568_SMART_REGION0_YRGB_MST 0x14
|
||||
#define RK3568_SMART_REGION0_CBR_MST 0x18
|
||||
#define RK3568_SMART_REGION0_VIR 0x1C
|
||||
#define RK3568_SMART_REGION0_ACT_INFO 0x20
|
||||
#define RK3568_SMART_REGION0_DSP_INFO 0x24
|
||||
#define RK3568_SMART_REGION0_DSP_ST 0x28
|
||||
#define RK3568_SMART_REGION0_SCL_CTRL 0x30
|
||||
#define RK3568_SMART_REGION0_SCL_FACTOR_YRGB 0x34
|
||||
#define RK3568_SMART_REGION0_SCL_FACTOR_CBR 0x38
|
||||
#define RK3568_SMART_REGION0_SCL_OFFSET 0x3C
|
||||
#define RK3568_SMART_REGION1_CTRL 0x40
|
||||
#define RK3568_SMART_REGION1_YRGB_MST 0x44
|
||||
#define RK3568_SMART_REGION1_CBR_MST 0x48
|
||||
#define RK3568_SMART_REGION1_VIR 0x4C
|
||||
#define RK3568_SMART_REGION1_ACT_INFO 0x50
|
||||
#define RK3568_SMART_REGION1_DSP_INFO 0x54
|
||||
#define RK3568_SMART_REGION1_DSP_ST 0x58
|
||||
#define RK3568_SMART_REGION1_SCL_CTRL 0x60
|
||||
#define RK3568_SMART_REGION1_SCL_FACTOR_YRGB 0x64
|
||||
#define RK3568_SMART_REGION1_SCL_FACTOR_CBR 0x68
|
||||
#define RK3568_SMART_REGION1_SCL_OFFSET 0x6C
|
||||
#define RK3568_SMART_REGION2_CTRL 0x70
|
||||
#define RK3568_SMART_REGION2_YRGB_MST 0x74
|
||||
#define RK3568_SMART_REGION2_CBR_MST 0x78
|
||||
#define RK3568_SMART_REGION2_VIR 0x7C
|
||||
#define RK3568_SMART_REGION2_ACT_INFO 0x80
|
||||
#define RK3568_SMART_REGION2_DSP_INFO 0x84
|
||||
#define RK3568_SMART_REGION2_DSP_ST 0x88
|
||||
#define RK3568_SMART_REGION2_SCL_CTRL 0x90
|
||||
#define RK3568_SMART_REGION2_SCL_FACTOR_YRGB 0x94
|
||||
#define RK3568_SMART_REGION2_SCL_FACTOR_CBR 0x98
|
||||
#define RK3568_SMART_REGION2_SCL_OFFSET 0x9C
|
||||
#define RK3568_SMART_REGION3_CTRL 0xA0
|
||||
#define RK3568_SMART_REGION3_YRGB_MST 0xA4
|
||||
#define RK3568_SMART_REGION3_CBR_MST 0xA8
|
||||
#define RK3568_SMART_REGION3_VIR 0xAC
|
||||
#define RK3568_SMART_REGION3_ACT_INFO 0xB0
|
||||
#define RK3568_SMART_REGION3_DSP_INFO 0xB4
|
||||
#define RK3568_SMART_REGION3_DSP_ST 0xB8
|
||||
#define RK3568_SMART_REGION3_SCL_CTRL 0xC0
|
||||
#define RK3568_SMART_REGION3_SCL_FACTOR_YRGB 0xC4
|
||||
#define RK3568_SMART_REGION3_SCL_FACTOR_CBR 0xC8
|
||||
#define RK3568_SMART_REGION3_SCL_OFFSET 0xCC
|
||||
#define RK3568_SMART_COLOR_KEY_CTRL 0xD0
|
||||
|
||||
/* HDR register definition */
|
||||
#define RK3568_HDR_LUT_CTRL 0x2000
|
||||
#define RK3568_HDR_LUT_MST 0x2004
|
||||
#define RK3568_SDR2HDR_CTRL 0x2010
|
||||
#define RK3568_HDR2SDR_CTRL 0x2020
|
||||
#define RK3568_HDR2SDR_SRC_RANGE 0x2024
|
||||
#define RK3568_HDR2SDR_NORMFACEETF 0x2028
|
||||
#define RK3568_HDR2SDR_DST_RANGE 0x202C
|
||||
#define RK3568_HDR2SDR_NORMFACCGAMMA 0x2030
|
||||
#define RK3568_HDR_EETF_OETF_Y0 0x203C
|
||||
#define RK3568_HDR_SAT_Y0 0x20C0
|
||||
#define RK3568_HDR_EOTF_OETF_Y0 0x20F0
|
||||
#define RK3568_HDR_OETF_DX_POW1 0x2200
|
||||
#define RK3568_HDR_OETF_XN1 0x2300
|
||||
|
||||
#define RK3568_REG_CFG_DONE__GLB_CFG_DONE_EN BIT(15)
|
||||
|
||||
#define RK3568_VP_DSP_CTRL__STANDBY BIT(31)
|
||||
#define RK3568_VP_DSP_CTRL__DITHER_DOWN_MODE BIT(20)
|
||||
#define RK3568_VP_DSP_CTRL__DITHER_DOWN_SEL GENMASK(19, 18)
|
||||
#define RK3568_VP_DSP_CTRL__DITHER_DOWN_EN BIT(17)
|
||||
#define RK3568_VP_DSP_CTRL__PRE_DITHER_DOWN_EN BIT(16)
|
||||
#define RK3568_VP_DSP_CTRL__POST_DSP_OUT_R2Y BIT(15)
|
||||
#define RK3568_VP_DSP_CTRL__DSP_RB_SWAP BIT(9)
|
||||
#define RK3568_VP_DSP_CTRL__DSP_INTERLACE BIT(7)
|
||||
#define RK3568_VP_DSP_CTRL__DSP_FILED_POL BIT(6)
|
||||
#define RK3568_VP_DSP_CTRL__P2I_EN BIT(5)
|
||||
#define RK3568_VP_DSP_CTRL__CORE_DCLK_DIV BIT(4)
|
||||
#define RK3568_VP_DSP_CTRL__OUT_MODE GENMASK(3, 0)
|
||||
|
||||
#define RK3568_VP_POST_SCL_CTRL__VSCALEDOWN BIT(1)
|
||||
#define RK3568_VP_POST_SCL_CTRL__HSCALEDOWN BIT(0)
|
||||
|
||||
#define RK3568_SYS_DSP_INFACE_EN_LVDS1_MUX GENMASK(26, 25)
|
||||
#define RK3568_SYS_DSP_INFACE_EN_LVDS1 BIT(24)
|
||||
#define RK3568_SYS_DSP_INFACE_EN_MIPI1_MUX GENMASK(22, 21)
|
||||
#define RK3568_SYS_DSP_INFACE_EN_MIPI1 BIT(20)
|
||||
#define RK3568_SYS_DSP_INFACE_EN_LVDS0_MUX GENMASK(19, 18)
|
||||
#define RK3568_SYS_DSP_INFACE_EN_MIPI0_MUX GENMASK(17, 16)
|
||||
#define RK3568_SYS_DSP_INFACE_EN_EDP_MUX GENMASK(15, 14)
|
||||
#define RK3568_SYS_DSP_INFACE_EN_HDMI_MUX GENMASK(11, 10)
|
||||
#define RK3568_SYS_DSP_INFACE_EN_RGB_MUX GENMASK(9, 8)
|
||||
#define RK3568_SYS_DSP_INFACE_EN_LVDS0 BIT(5)
|
||||
#define RK3568_SYS_DSP_INFACE_EN_MIPI0 BIT(4)
|
||||
#define RK3568_SYS_DSP_INFACE_EN_EDP BIT(3)
|
||||
#define RK3568_SYS_DSP_INFACE_EN_HDMI BIT(1)
|
||||
#define RK3568_SYS_DSP_INFACE_EN_RGB BIT(0)
|
||||
|
||||
#define RK3568_DSP_IF_POL__MIPI_PIN_POL GENMASK(19, 16)
|
||||
#define RK3568_DSP_IF_POL__EDP_PIN_POL GENMASK(15, 12)
|
||||
#define RK3568_DSP_IF_POL__HDMI_PIN_POL GENMASK(7, 4)
|
||||
#define RK3568_DSP_IF_POL__RGB_LVDS_PIN_POL GENMASK(3, 0)
|
||||
|
||||
#define RK3568_VP0_MIPI_CTRL__DCLK_DIV2_PHASE_LOCK BIT(5)
|
||||
#define RK3568_VP0_MIPI_CTRL__DCLK_DIV2 BIT(4)
|
||||
|
||||
#define RK3568_SYS_AUTO_GATING_CTRL__AUTO_GATING_EN BIT(31)
|
||||
|
||||
#define RK3568_DSP_IF_POL__CFG_DONE_IMD BIT(28)
|
||||
|
||||
#define VOP2_SYS_AXI_BUS_NUM 2
|
||||
|
||||
#define VOP2_CLUSTER_YUV444_10 0x12
|
||||
|
||||
#define VOP2_COLOR_KEY_MASK BIT(31)
|
||||
|
||||
#define RK3568_OVL_CTRL__LAYERSEL_REGDONE_IMD BIT(28)
|
||||
|
||||
#define RK3568_VP_BG_MIX_CTRL__BG_DLY GENMASK(31, 24)
|
||||
|
||||
#define RK3568_OVL_PORT_SEL__SEL_PORT GENMASK(31, 16)
|
||||
#define RK3568_OVL_PORT_SEL__SMART1 GENMASK(31, 30)
|
||||
#define RK3568_OVL_PORT_SEL__SMART0 GENMASK(29, 28)
|
||||
#define RK3568_OVL_PORT_SEL__ESMART1 GENMASK(27, 26)
|
||||
#define RK3568_OVL_PORT_SEL__ESMART0 GENMASK(25, 24)
|
||||
#define RK3568_OVL_PORT_SEL__CLUSTER1 GENMASK(19, 18)
|
||||
#define RK3568_OVL_PORT_SEL__CLUSTER0 GENMASK(17, 16)
|
||||
#define RK3568_OVL_PORT_SET__PORT2_MUX GENMASK(11, 8)
|
||||
#define RK3568_OVL_PORT_SET__PORT1_MUX GENMASK(7, 4)
|
||||
#define RK3568_OVL_PORT_SET__PORT0_MUX GENMASK(3, 0)
|
||||
#define RK3568_OVL_LAYER_SEL__LAYER(layer, x) ((x) << ((layer) * 4))
|
||||
|
||||
#define RK3568_CLUSTER_DLY_NUM__CLUSTER1_1 GENMASK(31, 24)
|
||||
#define RK3568_CLUSTER_DLY_NUM__CLUSTER1_0 GENMASK(23, 16)
|
||||
#define RK3568_CLUSTER_DLY_NUM__CLUSTER0_1 GENMASK(15, 8)
|
||||
#define RK3568_CLUSTER_DLY_NUM__CLUSTER0_0 GENMASK(7, 0)
|
||||
|
||||
#define RK3568_SMART_DLY_NUM__SMART1 GENMASK(31, 24)
|
||||
#define RK3568_SMART_DLY_NUM__SMART0 GENMASK(23, 16)
|
||||
#define RK3568_SMART_DLY_NUM__ESMART1 GENMASK(15, 8)
|
||||
#define RK3568_SMART_DLY_NUM__ESMART0 GENMASK(7, 0)
|
||||
|
||||
#define VP_INT_DSP_HOLD_VALID BIT(6)
|
||||
#define VP_INT_FS_FIELD BIT(5)
|
||||
#define VP_INT_POST_BUF_EMPTY BIT(4)
|
||||
#define VP_INT_LINE_FLAG1 BIT(3)
|
||||
#define VP_INT_LINE_FLAG0 BIT(2)
|
||||
#define VOP2_INT_BUS_ERRPR BIT(1)
|
||||
#define VP_INT_FS BIT(0)
|
||||
|
||||
#define POLFLAG_DCLK_INV BIT(3)
|
||||
|
||||
enum vop2_layer_phy_id {
|
||||
ROCKCHIP_VOP2_CLUSTER0 = 0,
|
||||
ROCKCHIP_VOP2_CLUSTER1,
|
||||
ROCKCHIP_VOP2_ESMART0,
|
||||
ROCKCHIP_VOP2_ESMART1,
|
||||
ROCKCHIP_VOP2_SMART0,
|
||||
ROCKCHIP_VOP2_SMART1,
|
||||
ROCKCHIP_VOP2_CLUSTER2,
|
||||
ROCKCHIP_VOP2_CLUSTER3,
|
||||
ROCKCHIP_VOP2_ESMART2,
|
||||
ROCKCHIP_VOP2_ESMART3,
|
||||
ROCKCHIP_VOP2_PHY_ID_INVALID = -1,
|
||||
};
|
||||
|
||||
extern const struct component_ops vop2_component_ops;
|
||||
|
||||
#endif /* _ROCKCHIP_DRM_VOP2_H */
|
281
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
Normal file
281
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
Normal file
@ -0,0 +1,281 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (C) Rockchip Electronics Co.Ltd
|
||||
* Author: Andy Yan <andy.yan@rock-chips.com>
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/component.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm/drm_plane.h>
|
||||
#include <drm/drm_print.h>
|
||||
|
||||
#include "rockchip_drm_vop2.h"
|
||||
|
||||
static const uint32_t formats_win_full_10bit[] = {
|
||||
DRM_FORMAT_XRGB8888,
|
||||
DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_XBGR8888,
|
||||
DRM_FORMAT_ABGR8888,
|
||||
DRM_FORMAT_RGB888,
|
||||
DRM_FORMAT_BGR888,
|
||||
DRM_FORMAT_RGB565,
|
||||
DRM_FORMAT_BGR565,
|
||||
DRM_FORMAT_NV12,
|
||||
DRM_FORMAT_NV16,
|
||||
DRM_FORMAT_NV24,
|
||||
};
|
||||
|
||||
static const uint32_t formats_win_full_10bit_yuyv[] = {
|
||||
DRM_FORMAT_XRGB8888,
|
||||
DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_XBGR8888,
|
||||
DRM_FORMAT_ABGR8888,
|
||||
DRM_FORMAT_RGB888,
|
||||
DRM_FORMAT_BGR888,
|
||||
DRM_FORMAT_RGB565,
|
||||
DRM_FORMAT_BGR565,
|
||||
DRM_FORMAT_NV12,
|
||||
DRM_FORMAT_NV16,
|
||||
DRM_FORMAT_NV24,
|
||||
DRM_FORMAT_YVYU,
|
||||
DRM_FORMAT_VYUY,
|
||||
};
|
||||
|
||||
static const uint32_t formats_win_lite[] = {
|
||||
DRM_FORMAT_XRGB8888,
|
||||
DRM_FORMAT_ARGB8888,
|
||||
DRM_FORMAT_XBGR8888,
|
||||
DRM_FORMAT_ABGR8888,
|
||||
DRM_FORMAT_RGB888,
|
||||
DRM_FORMAT_BGR888,
|
||||
DRM_FORMAT_RGB565,
|
||||
DRM_FORMAT_BGR565,
|
||||
};
|
||||
|
||||
static const uint64_t format_modifiers[] = {
|
||||
DRM_FORMAT_MOD_LINEAR,
|
||||
DRM_FORMAT_MOD_INVALID,
|
||||
};
|
||||
|
||||
static const uint64_t format_modifiers_afbc[] = {
|
||||
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16),
|
||||
|
||||
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
|
||||
AFBC_FORMAT_MOD_SPARSE),
|
||||
|
||||
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
|
||||
AFBC_FORMAT_MOD_YTR),
|
||||
|
||||
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
|
||||
AFBC_FORMAT_MOD_CBR),
|
||||
|
||||
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
|
||||
AFBC_FORMAT_MOD_YTR |
|
||||
AFBC_FORMAT_MOD_SPARSE),
|
||||
|
||||
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
|
||||
AFBC_FORMAT_MOD_CBR |
|
||||
AFBC_FORMAT_MOD_SPARSE),
|
||||
|
||||
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
|
||||
AFBC_FORMAT_MOD_YTR |
|
||||
AFBC_FORMAT_MOD_CBR),
|
||||
|
||||
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
|
||||
AFBC_FORMAT_MOD_YTR |
|
||||
AFBC_FORMAT_MOD_CBR |
|
||||
AFBC_FORMAT_MOD_SPARSE),
|
||||
|
||||
/* SPLIT mandates SPARSE, RGB modes mandates YTR */
|
||||
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
|
||||
AFBC_FORMAT_MOD_YTR |
|
||||
AFBC_FORMAT_MOD_SPARSE |
|
||||
AFBC_FORMAT_MOD_SPLIT),
|
||||
DRM_FORMAT_MOD_INVALID,
|
||||
};
|
||||
|
||||
static const struct vop2_video_port_data rk3568_vop_video_ports[] = {
|
||||
{
|
||||
.id = 0,
|
||||
.feature = VOP_FEATURE_OUTPUT_10BIT,
|
||||
.gamma_lut_len = 1024,
|
||||
.cubic_lut_len = 9 * 9 * 9,
|
||||
.max_output = { 4096, 2304 },
|
||||
.pre_scan_max_dly = { 69, 53, 53, 42 },
|
||||
.offset = 0xc00,
|
||||
}, {
|
||||
.id = 1,
|
||||
.gamma_lut_len = 1024,
|
||||
.max_output = { 2048, 1536 },
|
||||
.pre_scan_max_dly = { 40, 40, 40, 40 },
|
||||
.offset = 0xd00,
|
||||
}, {
|
||||
.id = 2,
|
||||
.gamma_lut_len = 1024,
|
||||
.max_output = { 1920, 1080 },
|
||||
.pre_scan_max_dly = { 40, 40, 40, 40 },
|
||||
.offset = 0xe00,
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* rk3568 vop with 2 cluster, 2 esmart win, 2 smart win.
|
||||
* Every cluster can work as 4K win or split into two win.
|
||||
* All win in cluster support AFBCD.
|
||||
*
|
||||
* Every esmart win and smart win support 4 Multi-region.
|
||||
*
|
||||
* Scale filter mode:
|
||||
*
|
||||
* * Cluster: bicubic for horizontal scale up, others use bilinear
|
||||
* * ESmart:
|
||||
* * nearest-neighbor/bilinear/bicubic for scale up
|
||||
* * nearest-neighbor/bilinear/average for scale down
|
||||
*
|
||||
*
|
||||
* @TODO describe the wind like cpu-map dt nodes;
|
||||
*/
|
||||
static const struct vop2_win_data rk3568_vop_win_data[] = {
|
||||
{
|
||||
.name = "Smart0-win0",
|
||||
.phys_id = ROCKCHIP_VOP2_SMART0,
|
||||
.base = 0x1c00,
|
||||
.formats = formats_win_lite,
|
||||
.nformats = ARRAY_SIZE(formats_win_lite),
|
||||
.format_modifiers = format_modifiers,
|
||||
.layer_sel_id = 3,
|
||||
.supported_rotations = DRM_MODE_REFLECT_Y,
|
||||
.type = DRM_PLANE_TYPE_PRIMARY,
|
||||
.max_upscale_factor = 8,
|
||||
.max_downscale_factor = 8,
|
||||
.dly = { 20, 47, 41 },
|
||||
}, {
|
||||
.name = "Smart1-win0",
|
||||
.phys_id = ROCKCHIP_VOP2_SMART1,
|
||||
.formats = formats_win_lite,
|
||||
.nformats = ARRAY_SIZE(formats_win_lite),
|
||||
.format_modifiers = format_modifiers,
|
||||
.base = 0x1e00,
|
||||
.layer_sel_id = 7,
|
||||
.supported_rotations = DRM_MODE_REFLECT_Y,
|
||||
.type = DRM_PLANE_TYPE_PRIMARY,
|
||||
.max_upscale_factor = 8,
|
||||
.max_downscale_factor = 8,
|
||||
.dly = { 20, 47, 41 },
|
||||
}, {
|
||||
.name = "Esmart1-win0",
|
||||
.phys_id = ROCKCHIP_VOP2_ESMART1,
|
||||
.formats = formats_win_full_10bit_yuyv,
|
||||
.nformats = ARRAY_SIZE(formats_win_full_10bit_yuyv),
|
||||
.format_modifiers = format_modifiers,
|
||||
.base = 0x1a00,
|
||||
.layer_sel_id = 6,
|
||||
.supported_rotations = DRM_MODE_REFLECT_Y,
|
||||
.type = DRM_PLANE_TYPE_PRIMARY,
|
||||
.max_upscale_factor = 8,
|
||||
.max_downscale_factor = 8,
|
||||
.dly = { 20, 47, 41 },
|
||||
}, {
|
||||
.name = "Esmart0-win0",
|
||||
.phys_id = ROCKCHIP_VOP2_ESMART0,
|
||||
.formats = formats_win_full_10bit_yuyv,
|
||||
.nformats = ARRAY_SIZE(formats_win_full_10bit_yuyv),
|
||||
.format_modifiers = format_modifiers,
|
||||
.base = 0x1800,
|
||||
.layer_sel_id = 2,
|
||||
.supported_rotations = DRM_MODE_REFLECT_Y,
|
||||
.type = DRM_PLANE_TYPE_OVERLAY,
|
||||
.max_upscale_factor = 8,
|
||||
.max_downscale_factor = 8,
|
||||
.dly = { 20, 47, 41 },
|
||||
}, {
|
||||
.name = "Cluster0-win0",
|
||||
.phys_id = ROCKCHIP_VOP2_CLUSTER0,
|
||||
.base = 0x1000,
|
||||
.formats = formats_win_full_10bit,
|
||||
.nformats = ARRAY_SIZE(formats_win_full_10bit),
|
||||
.format_modifiers = format_modifiers_afbc,
|
||||
.layer_sel_id = 0,
|
||||
.supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 |
|
||||
DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
|
||||
.max_upscale_factor = 4,
|
||||
.max_downscale_factor = 4,
|
||||
.dly = { 0, 27, 21 },
|
||||
.type = DRM_PLANE_TYPE_OVERLAY,
|
||||
.feature = WIN_FEATURE_AFBDC | WIN_FEATURE_CLUSTER,
|
||||
}, {
|
||||
.name = "Cluster1-win0",
|
||||
.phys_id = ROCKCHIP_VOP2_CLUSTER1,
|
||||
.base = 0x1200,
|
||||
.formats = formats_win_full_10bit,
|
||||
.nformats = ARRAY_SIZE(formats_win_full_10bit),
|
||||
.format_modifiers = format_modifiers_afbc,
|
||||
.layer_sel_id = 1,
|
||||
.supported_rotations = DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270 |
|
||||
DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y,
|
||||
.type = DRM_PLANE_TYPE_OVERLAY,
|
||||
.max_upscale_factor = 4,
|
||||
.max_downscale_factor = 4,
|
||||
.dly = { 0, 27, 21 },
|
||||
.feature = WIN_FEATURE_AFBDC | WIN_FEATURE_CLUSTER,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct vop2_data rk3566_vop = {
|
||||
.nr_vps = 3,
|
||||
.max_input = { 4096, 2304 },
|
||||
.max_output = { 4096, 2304 },
|
||||
.vp = rk3568_vop_video_ports,
|
||||
.win = rk3568_vop_win_data,
|
||||
.win_size = ARRAY_SIZE(rk3568_vop_win_data),
|
||||
.soc_id = 3566,
|
||||
};
|
||||
|
||||
static const struct vop2_data rk3568_vop = {
|
||||
.nr_vps = 3,
|
||||
.max_input = { 4096, 2304 },
|
||||
.max_output = { 4096, 2304 },
|
||||
.vp = rk3568_vop_video_ports,
|
||||
.win = rk3568_vop_win_data,
|
||||
.win_size = ARRAY_SIZE(rk3568_vop_win_data),
|
||||
.soc_id = 3568,
|
||||
};
|
||||
|
||||
static const struct of_device_id vop2_dt_match[] = {
|
||||
{
|
||||
.compatible = "rockchip,rk3566-vop",
|
||||
.data = &rk3566_vop,
|
||||
}, {
|
||||
.compatible = "rockchip,rk3568-vop",
|
||||
.data = &rk3568_vop,
|
||||
}, {
|
||||
},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, vop2_dt_match);
|
||||
|
||||
static int vop2_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
|
||||
return component_add(dev, &vop2_component_ops);
|
||||
}
|
||||
|
||||
static int vop2_remove(struct platform_device *pdev)
|
||||
{
|
||||
component_del(&pdev->dev, &vop2_component_ops);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct platform_driver vop2_platform_driver = {
|
||||
.probe = vop2_probe,
|
||||
.remove = vop2_remove,
|
||||
.driver = {
|
||||
.name = "rockchip-vop2",
|
||||
.of_match_table = of_match_ptr(vop2_dt_match),
|
||||
},
|
||||
};
|
14
include/dt-bindings/soc/rockchip,vop2.h
Normal file
14
include/dt-bindings/soc/rockchip,vop2.h
Normal file
@ -0,0 +1,14 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
|
||||
|
||||
#ifndef __DT_BINDINGS_ROCKCHIP_VOP2_H
|
||||
#define __DT_BINDINGS_ROCKCHIP_VOP2_H
|
||||
|
||||
#define ROCKCHIP_VOP2_EP_RGB0 1
|
||||
#define ROCKCHIP_VOP2_EP_HDMI0 2
|
||||
#define ROCKCHIP_VOP2_EP_EDP0 3
|
||||
#define ROCKCHIP_VOP2_EP_MIPI0 4
|
||||
#define ROCKCHIP_VOP2_EP_LVDS0 5
|
||||
#define ROCKCHIP_VOP2_EP_MIPI1 6
|
||||
#define ROCKCHIP_VOP2_EP_LVDS1 7
|
||||
|
||||
#endif /* __DT_BINDINGS_ROCKCHIP_VOP2_H */
|
Loading…
Reference in New Issue
Block a user