| .. | .. |
|---|
| 39 | 39 | #ifdef CONFIG_DRM_ANALOGIX_DP |
|---|
| 40 | 40 | #include <drm/bridge/analogix_dp.h> |
|---|
| 41 | 41 | #endif |
|---|
| 42 | | -#include <dt-bindings/soc/rockchip-system-status.h> |
|---|
| 43 | 42 | |
|---|
| 44 | 43 | #include <soc/rockchip/rockchip_dmc.h> |
|---|
| 45 | 44 | #include <soc/rockchip/rockchip-system-status.h> |
|---|
| .. | .. |
|---|
| 223 | 222 | struct dentry *debugfs; |
|---|
| 224 | 223 | struct drm_info_list *debugfs_files; |
|---|
| 225 | 224 | struct drm_property *plane_feature_prop; |
|---|
| 226 | | - struct drm_property *plane_mask_prop; |
|---|
| 227 | 225 | struct drm_property *feature_prop; |
|---|
| 228 | 226 | |
|---|
| 229 | 227 | bool is_iommu_enabled; |
|---|
| .. | .. |
|---|
| 238 | 236 | u32 background; |
|---|
| 239 | 237 | u32 line_flag; |
|---|
| 240 | 238 | u8 id; |
|---|
| 241 | | - u8 plane_mask; |
|---|
| 242 | 239 | u64 soc_id; |
|---|
| 243 | 240 | struct drm_prop_enum_list *plane_name_list; |
|---|
| 244 | 241 | |
|---|
| .. | .. |
|---|
| 318 | 315 | { MEDIA_BUS_FMT_UYYVYY8_0_5X24, "UYYVYY8_0_5X24" }, |
|---|
| 319 | 316 | { MEDIA_BUS_FMT_YUV10_1X30, "YUV10_1X30" }, |
|---|
| 320 | 317 | { MEDIA_BUS_FMT_UYYVYY10_0_5X30, "UYYVYY10_0_5X30" }, |
|---|
| 318 | + { MEDIA_BUS_FMT_RGB565_2X8_LE, "RGB565_2X8_LE" }, |
|---|
| 319 | + { MEDIA_BUS_FMT_RGB666_3X6, "RGB666_3X6" }, |
|---|
| 321 | 320 | { MEDIA_BUS_FMT_RGB888_3X8, "RGB888_3X8" }, |
|---|
| 322 | 321 | { MEDIA_BUS_FMT_RGB888_DUMMY_4X8, "RGB888_DUMMY_4X8" }, |
|---|
| 323 | 322 | { MEDIA_BUS_FMT_RGB888_1X24, "RGB888_1X24" }, |
|---|
| .. | .. |
|---|
| 463 | 462 | const struct vop_hdr_table *table = vop->data->hdr_table; |
|---|
| 464 | 463 | uint32_t sdr2hdr_eotf_oetf_yn[65]; |
|---|
| 465 | 464 | uint32_t sdr2hdr_oetf_dx_dxpow[64]; |
|---|
| 465 | + |
|---|
| 466 | + if (cmd != SDR2HDR_FOR_BT2020 && cmd != SDR2HDR_FOR_HDR && cmd != SDR2HDR_FOR_HLG_HDR) { |
|---|
| 467 | + DRM_WARN("unknown sdr2hdr oetf: %d\n", cmd); |
|---|
| 468 | + return; |
|---|
| 469 | + } |
|---|
| 466 | 470 | |
|---|
| 467 | 471 | for (i = 0; i < 65; i++) { |
|---|
| 468 | 472 | if (cmd == SDR2HDR_FOR_BT2020) |
|---|
| .. | .. |
|---|
| 1873 | 1877 | to_vop_plane_state(plane->state); |
|---|
| 1874 | 1878 | #endif |
|---|
| 1875 | 1879 | |
|---|
| 1876 | | - rockchip_drm_dbg(vop->dev, VOP_DEBUG_PLANE, "disable win%d-area%d by %s\n", |
|---|
| 1877 | | - win->win_id, win->area_id, current->comm); |
|---|
| 1878 | | - |
|---|
| 1879 | 1880 | if (!old_state->crtc) |
|---|
| 1880 | 1881 | return; |
|---|
| 1882 | + |
|---|
| 1883 | + rockchip_drm_dbg(vop->dev, VOP_DEBUG_PLANE, "disable win%d-area%d by %s\n", |
|---|
| 1884 | + win->win_id, win->area_id, current->comm); |
|---|
| 1881 | 1885 | |
|---|
| 1882 | 1886 | spin_lock(&vop->reg_lock); |
|---|
| 1883 | 1887 | |
|---|
| .. | .. |
|---|
| 3258 | 3262 | { |
|---|
| 3259 | 3263 | struct vop *vop = to_vop(crtc); |
|---|
| 3260 | 3264 | |
|---|
| 3265 | + /* |
|---|
| 3266 | + * If mcu_hold_mode is 1, set 1 to mcu_frame_st will |
|---|
| 3267 | + * refresh one frame from ddr. So mcu_frame_st is needed |
|---|
| 3268 | + * to be initialized as 0. |
|---|
| 3269 | + */ |
|---|
| 3270 | + VOP_CTRL_SET(vop, mcu_frame_st, 0); |
|---|
| 3261 | 3271 | VOP_CTRL_SET(vop, mcu_clk_sel, 1); |
|---|
| 3262 | 3272 | VOP_CTRL_SET(vop, mcu_type, 1); |
|---|
| 3263 | 3273 | |
|---|
| .. | .. |
|---|
| 4627 | 4637 | return 0; |
|---|
| 4628 | 4638 | } |
|---|
| 4629 | 4639 | |
|---|
| 4630 | | -static int vop_crtc_create_plane_mask_property(struct vop *vop, struct drm_crtc *crtc) |
|---|
| 4631 | | -{ |
|---|
| 4632 | | - struct drm_property *prop; |
|---|
| 4633 | | - |
|---|
| 4634 | | - static const struct drm_prop_enum_list props[] = { |
|---|
| 4635 | | - { ROCKCHIP_VOP_WIN0, "Win0" }, |
|---|
| 4636 | | - { ROCKCHIP_VOP_WIN1, "Win1" }, |
|---|
| 4637 | | - { ROCKCHIP_VOP_WIN2, "Win2" }, |
|---|
| 4638 | | - { ROCKCHIP_VOP_WIN3, "Win3" }, |
|---|
| 4639 | | - }; |
|---|
| 4640 | | - |
|---|
| 4641 | | - prop = drm_property_create_bitmask(vop->drm_dev, |
|---|
| 4642 | | - DRM_MODE_PROP_IMMUTABLE, "PLANE_MASK", |
|---|
| 4643 | | - props, ARRAY_SIZE(props), |
|---|
| 4644 | | - 0xffffffff); |
|---|
| 4645 | | - if (!prop) { |
|---|
| 4646 | | - DRM_DEV_ERROR(vop->dev, "create plane_mask prop for vp%d failed\n", vop->id); |
|---|
| 4647 | | - return -ENOMEM; |
|---|
| 4648 | | - } |
|---|
| 4649 | | - |
|---|
| 4650 | | - vop->plane_mask_prop = prop; |
|---|
| 4651 | | - drm_object_attach_property(&crtc->base, vop->plane_mask_prop, vop->plane_mask); |
|---|
| 4652 | | - |
|---|
| 4653 | | - return 0; |
|---|
| 4654 | | -} |
|---|
| 4655 | | - |
|---|
| 4656 | 4640 | static int vop_crtc_create_feature_property(struct vop *vop, struct drm_crtc *crtc) |
|---|
| 4657 | 4641 | { |
|---|
| 4658 | 4642 | const struct vop_data *vop_data = vop->data; |
|---|
| .. | .. |
|---|
| 4780 | 4764 | VOP_ATTACH_MODE_CONFIG_PROP(tv_top_margin_property, 100); |
|---|
| 4781 | 4765 | VOP_ATTACH_MODE_CONFIG_PROP(tv_bottom_margin_property, 100); |
|---|
| 4782 | 4766 | #undef VOP_ATTACH_MODE_CONFIG_PROP |
|---|
| 4783 | | - vop_crtc_create_plane_mask_property(vop, crtc); |
|---|
| 4784 | 4767 | vop_crtc_create_feature_property(vop, crtc); |
|---|
| 4785 | 4768 | ret = drm_self_refresh_helper_init(crtc); |
|---|
| 4786 | 4769 | if (ret) |
|---|
| .. | .. |
|---|
| 4949 | 4932 | vop_area->name = devm_kstrdup(vop->dev, name, GFP_KERNEL); |
|---|
| 4950 | 4933 | num_wins++; |
|---|
| 4951 | 4934 | } |
|---|
| 4952 | | - vop->plane_mask |= BIT(vop_win->win_id); |
|---|
| 4953 | 4935 | } |
|---|
| 4954 | 4936 | |
|---|
| 4955 | 4937 | vop->num_wins = num_wins; |
|---|