Skip to content

Commit 428e15c

Browse files
committed
drm/rockchip: vop: add rk3188 vop definitions
The rk3188 has 2 vops not using iommus which only output directly to a rgb interface per vop. So all other output modes like hdmi are provided by external brige chips. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Sandy Huang <hjc@rock-chips.com> Acked-by: Rob Herring <robh@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20180830110937.1739-1-heiko@sntech.de
1 parent 8d54423 commit 428e15c

3 files changed

Lines changed: 115 additions & 0 deletions

File tree

‎Documentation/devicetree/bindings/display/rockchip/rockchip-vop.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Required properties:
1010
"rockchip,rk3126-vop";
1111
"rockchip,px30-vop-lit";
1212
"rockchip,px30-vop-big";
13+
"rockchip,rk3188-vop";
1314
"rockchip,rk3288-vop";
1415
"rockchip,rk3368-vop";
1516
"rockchip,rk3366-vop";

‎drivers/gpu/drm/rockchip/rockchip_vop_reg.c‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,93 @@ static const struct vop_data px30_vop_lit = {
299299
.win_size = ARRAY_SIZE(px30_vop_lit_win_data),
300300
};
301301

302+
static const struct vop_scl_regs rk3188_win_scl = {
303+
.scale_yrgb_x = VOP_REG(RK3188_WIN0_SCL_FACTOR_YRGB, 0xffff, 0x0),
304+
.scale_yrgb_y = VOP_REG(RK3188_WIN0_SCL_FACTOR_YRGB, 0xffff, 16),
305+
.scale_cbcr_x = VOP_REG(RK3188_WIN0_SCL_FACTOR_CBR, 0xffff, 0x0),
306+
.scale_cbcr_y = VOP_REG(RK3188_WIN0_SCL_FACTOR_CBR, 0xffff, 16),
307+
};
308+
309+
static const struct vop_win_phy rk3188_win0_data = {
310+
.scl = &rk3188_win_scl,
311+
.data_formats = formats_win_full,
312+
.nformats = ARRAY_SIZE(formats_win_full),
313+
.enable = VOP_REG(RK3188_SYS_CTRL, 0x1, 0),
314+
.format = VOP_REG(RK3188_SYS_CTRL, 0x7, 3),
315+
.rb_swap = VOP_REG(RK3188_SYS_CTRL, 0x1, 15),
316+
.act_info = VOP_REG(RK3188_WIN0_ACT_INFO, 0x1fff1fff, 0),
317+
.dsp_info = VOP_REG(RK3188_WIN0_DSP_INFO, 0x0fff0fff, 0),
318+
.dsp_st = VOP_REG(RK3188_WIN0_DSP_ST, 0x1fff1fff, 0),
319+
.yrgb_mst = VOP_REG(RK3188_WIN0_YRGB_MST0, 0xffffffff, 0),
320+
.uv_mst = VOP_REG(RK3188_WIN0_CBR_MST0, 0xffffffff, 0),
321+
.yrgb_vir = VOP_REG(RK3188_WIN_VIR, 0x1fff, 0),
322+
};
323+
324+
static const struct vop_win_phy rk3188_win1_data = {
325+
.data_formats = formats_win_lite,
326+
.nformats = ARRAY_SIZE(formats_win_lite),
327+
.enable = VOP_REG(RK3188_SYS_CTRL, 0x1, 1),
328+
.format = VOP_REG(RK3188_SYS_CTRL, 0x7, 6),
329+
.rb_swap = VOP_REG(RK3188_SYS_CTRL, 0x1, 19),
330+
/* no act_info on window1 */
331+
.dsp_info = VOP_REG(RK3188_WIN1_DSP_INFO, 0x07ff07ff, 0),
332+
.dsp_st = VOP_REG(RK3188_WIN1_DSP_ST, 0x0fff0fff, 0),
333+
.yrgb_mst = VOP_REG(RK3188_WIN1_MST, 0xffffffff, 0),
334+
.yrgb_vir = VOP_REG(RK3188_WIN_VIR, 0x1fff, 16),
335+
};
336+
337+
static const struct vop_modeset rk3188_modeset = {
338+
.htotal_pw = VOP_REG(RK3188_DSP_HTOTAL_HS_END, 0x0fff0fff, 0),
339+
.hact_st_end = VOP_REG(RK3188_DSP_HACT_ST_END, 0x0fff0fff, 0),
340+
.vtotal_pw = VOP_REG(RK3188_DSP_VTOTAL_VS_END, 0x0fff0fff, 0),
341+
.vact_st_end = VOP_REG(RK3188_DSP_VACT_ST_END, 0x0fff0fff, 0),
342+
};
343+
344+
static const struct vop_output rk3188_output = {
345+
.pin_pol = VOP_REG(RK3188_DSP_CTRL0, 0xf, 4),
346+
};
347+
348+
static const struct vop_common rk3188_common = {
349+
.gate_en = VOP_REG(RK3188_SYS_CTRL, 0x1, 31),
350+
.standby = VOP_REG(RK3188_SYS_CTRL, 0x1, 30),
351+
.out_mode = VOP_REG(RK3188_DSP_CTRL0, 0xf, 0),
352+
.cfg_done = VOP_REG(RK3188_REG_CFG_DONE, 0x1, 0),
353+
.dsp_blank = VOP_REG(RK3188_DSP_CTRL1, 0x3, 24),
354+
};
355+
356+
static const struct vop_win_data rk3188_vop_win_data[] = {
357+
{ .base = 0x00, .phy = &rk3188_win0_data,
358+
.type = DRM_PLANE_TYPE_PRIMARY },
359+
{ .base = 0x00, .phy = &rk3188_win1_data,
360+
.type = DRM_PLANE_TYPE_CURSOR },
361+
};
362+
363+
static const int rk3188_vop_intrs[] = {
364+
0,
365+
FS_INTR,
366+
LINE_FLAG_INTR,
367+
BUS_ERROR_INTR,
368+
};
369+
370+
static const struct vop_intr rk3188_vop_intr = {
371+
.intrs = rk3188_vop_intrs,
372+
.nintrs = ARRAY_SIZE(rk3188_vop_intrs),
373+
.line_flag_num[0] = VOP_REG(RK3188_INT_STATUS, 0xfff, 12),
374+
.status = VOP_REG(RK3188_INT_STATUS, 0xf, 0),
375+
.enable = VOP_REG(RK3188_INT_STATUS, 0xf, 4),
376+
.clear = VOP_REG(RK3188_INT_STATUS, 0xf, 8),
377+
};
378+
379+
static const struct vop_data rk3188_vop = {
380+
.intr = &rk3188_vop_intr,
381+
.common = &rk3188_common,
382+
.modeset = &rk3188_modeset,
383+
.output = &rk3188_output,
384+
.win = rk3188_vop_win_data,
385+
.win_size = ARRAY_SIZE(rk3188_vop_win_data),
386+
.feature = VOP_FEATURE_INTERNAL_RGB,
387+
};
388+
302389
static const struct vop_scl_extension rk3288_win_full_scl_ext = {
303390
.cbcr_vsd_mode = VOP_REG(RK3288_WIN0_CTRL1, 0x1, 31),
304391
.cbcr_vsu_mode = VOP_REG(RK3288_WIN0_CTRL1, 0x1, 30),
@@ -667,6 +754,8 @@ static const struct of_device_id vop_driver_dt_match[] = {
667754
.data = &px30_vop_big },
668755
{ .compatible = "rockchip,px30-vop-lit",
669756
.data = &px30_vop_lit },
757+
{ .compatible = "rockchip,rk3188-vop",
758+
.data = &rk3188_vop },
670759
{ .compatible = "rockchip,rk3288-vop",
671760
.data = &rk3288_vop },
672761
{ .compatible = "rockchip,rk3368-vop",

‎drivers/gpu/drm/rockchip/rockchip_vop_reg.h‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,4 +958,29 @@
958958
#define PX30_GAMMA_LUT_ADDR 0x00a00
959959
/* px30 register definition end */
960960

961+
/* rk3188 register definition */
962+
#define RK3188_SYS_CTRL 0x00
963+
#define RK3188_DSP_CTRL0 0x04
964+
#define RK3188_DSP_CTRL1 0x08
965+
#define RK3188_INT_STATUS 0x10
966+
#define RK3188_WIN0_YRGB_MST0 0x20
967+
#define RK3188_WIN0_CBR_MST0 0x24
968+
#define RK3188_WIN0_YRGB_MST1 0x28
969+
#define RK3188_WIN0_CBR_MST1 0x2c
970+
#define RK3188_WIN_VIR 0x30
971+
#define RK3188_WIN0_ACT_INFO 0x34
972+
#define RK3188_WIN0_DSP_INFO 0x38
973+
#define RK3188_WIN0_DSP_ST 0x3c
974+
#define RK3188_WIN0_SCL_FACTOR_YRGB 0x40
975+
#define RK3188_WIN0_SCL_FACTOR_CBR 0x44
976+
#define RK3188_WIN1_MST 0x4c
977+
#define RK3188_WIN1_DSP_INFO 0x50
978+
#define RK3188_WIN1_DSP_ST 0x54
979+
#define RK3188_DSP_HTOTAL_HS_END 0x6c
980+
#define RK3188_DSP_HACT_ST_END 0x70
981+
#define RK3188_DSP_VTOTAL_VS_END 0x74
982+
#define RK3188_DSP_VACT_ST_END 0x78
983+
#define RK3188_REG_CFG_DONE 0x90
984+
/* rk3188 register definition end */
985+
961986
#endif /* _ROCKCHIP_VOP_REG_H */

0 commit comments

Comments
 (0)