| .. | .. |
|---|
| 7 | 7 | #ifndef _ROCKCHIP_DISPLAY_H |
|---|
| 8 | 8 | #define _ROCKCHIP_DISPLAY_H |
|---|
| 9 | 9 | |
|---|
| 10 | +#ifdef CONFIG_SPL_BUILD |
|---|
| 11 | +#include <linux/hdmi.h> |
|---|
| 12 | +#include <linux/media-bus-format.h> |
|---|
| 13 | +#else |
|---|
| 10 | 14 | #include <bmp_layout.h> |
|---|
| 11 | | -#include <drm_modes.h> |
|---|
| 12 | 15 | #include <edid.h> |
|---|
| 16 | +#endif |
|---|
| 17 | +#include <drm_modes.h> |
|---|
| 13 | 18 | #include <dm/ofnode.h> |
|---|
| 14 | 19 | #include <drm/drm_dsc.h> |
|---|
| 20 | +#include <spl_display.h> |
|---|
| 21 | +#include <clk.h> |
|---|
| 15 | 22 | |
|---|
| 16 | 23 | /* |
|---|
| 17 | | - * major: IP major vertion, used for IP structure |
|---|
| 24 | + * major: IP major version, used for IP structure |
|---|
| 18 | 25 | * minor: big feature change under same structure |
|---|
| 26 | + * build: RTL current SVN number |
|---|
| 19 | 27 | */ |
|---|
| 20 | | -#define VOP_VERSION(major, minor) ((major) << 8 | (minor)) |
|---|
| 21 | | -#define VOP_MAJOR(version) ((version) >> 8) |
|---|
| 22 | | -#define VOP_MINOR(version) ((version) & 0xff) |
|---|
| 28 | +#define VOP_VERSION(major, minor) ((major) << 8 | (minor)) |
|---|
| 29 | +#define VOP_MAJOR(version) ((version) >> 8) |
|---|
| 30 | +#define VOP_MINOR(version) ((version) & 0xff) |
|---|
| 23 | 31 | |
|---|
| 24 | | -#define VOP_VERSION_RK3568 VOP_VERSION(0x40, 0x15) |
|---|
| 25 | | -#define VOP_VERSION_RK3588 VOP_VERSION(0x40, 0x17) |
|---|
| 32 | +#define VOP2_VERSION(major, minor, build) ((major) << 24 | (minor) << 16 | (build)) |
|---|
| 33 | +#define VOP2_MAJOR(version) (((version) >> 24) & 0xff) |
|---|
| 34 | +#define VOP2_MINOR(version) (((version) >> 16) & 0xff) |
|---|
| 35 | +#define VOP2_BUILD(version) ((version) & 0xffff) |
|---|
| 36 | + |
|---|
| 37 | +#define VOP_VERSION_RK3528 VOP2_VERSION(0x50, 0x17, 0x1263) |
|---|
| 38 | +#define VOP_VERSION_RK3562 VOP2_VERSION(0x50, 0x17, 0x4350) |
|---|
| 39 | +#define VOP_VERSION_RK3568 VOP2_VERSION(0x40, 0x15, 0x8023) |
|---|
| 40 | +#define VOP_VERSION_RK3588 VOP2_VERSION(0x40, 0x17, 0x6786) |
|---|
| 26 | 41 | |
|---|
| 27 | 42 | #define ROCKCHIP_OUTPUT_DUAL_CHANNEL_LEFT_RIGHT_MODE BIT(0) |
|---|
| 28 | 43 | #define ROCKCHIP_OUTPUT_DUAL_CHANNEL_ODD_EVEN_MODE BIT(1) |
|---|
| .. | .. |
|---|
| 66 | 81 | #define ROCKCHIP_OUT_MODE_P565 2 |
|---|
| 67 | 82 | #define ROCKCHIP_OUT_MODE_BT656 5 |
|---|
| 68 | 83 | #define ROCKCHIP_OUT_MODE_S888 8 |
|---|
| 84 | +#define ROCKCHIP_OUT_MODE_YUV422 9 |
|---|
| 69 | 85 | #define ROCKCHIP_OUT_MODE_S888_DUMMY 12 |
|---|
| 70 | 86 | #define ROCKCHIP_OUT_MODE_YUV420 14 |
|---|
| 71 | 87 | /* for use special outface */ |
|---|
| .. | .. |
|---|
| 141 | 157 | void *private; |
|---|
| 142 | 158 | ofnode node; |
|---|
| 143 | 159 | struct device_node *ports_node; /* if (ports_node) it's vop2; */ |
|---|
| 160 | + struct clk dclk; |
|---|
| 144 | 161 | int crtc_id; |
|---|
| 145 | 162 | |
|---|
| 146 | 163 | int format; |
|---|
| .. | .. |
|---|
| 160 | 177 | bool post_y2r_en; |
|---|
| 161 | 178 | bool bcsh_en; |
|---|
| 162 | 179 | bool splice_mode; |
|---|
| 180 | + bool soft_te; |
|---|
| 163 | 181 | u8 splice_crtc_id; |
|---|
| 164 | 182 | u8 dsc_id; |
|---|
| 165 | 183 | u8 dsc_enable; |
|---|
| .. | .. |
|---|
| 198 | 216 | struct overscan overscan; |
|---|
| 199 | 217 | u8 edid[EDID_SIZE * 4]; |
|---|
| 200 | 218 | int bus_format; |
|---|
| 219 | + u32 bus_flags; |
|---|
| 201 | 220 | int output_mode; |
|---|
| 202 | 221 | int type; |
|---|
| 203 | 222 | int output_if; |
|---|
| .. | .. |
|---|
| 223 | 242 | u64 dsc_cds_clk; |
|---|
| 224 | 243 | struct rockchip_dsc_sink_cap dsc_sink_cap; |
|---|
| 225 | 244 | struct drm_dsc_picture_parameter_set pps; |
|---|
| 245 | + |
|---|
| 246 | + struct gpio_desc *te_gpio; |
|---|
| 226 | 247 | |
|---|
| 227 | 248 | struct { |
|---|
| 228 | 249 | u32 *lut; |
|---|
| .. | .. |
|---|
| 268 | 289 | int enable; |
|---|
| 269 | 290 | int is_init; |
|---|
| 270 | 291 | int is_enable; |
|---|
| 292 | + bool is_klogo_valid; |
|---|
| 271 | 293 | bool force_output; |
|---|
| 294 | + bool enabled_at_spl; |
|---|
| 272 | 295 | struct drm_display_mode force_mode; |
|---|
| 273 | 296 | u32 force_bus_format; |
|---|
| 274 | 297 | }; |
|---|
| .. | .. |
|---|
| 282 | 305 | void drm_mode_max_resolution_filter(struct hdmi_edid_data *edid_data, |
|---|
| 283 | 306 | struct vop_rect *max_output); |
|---|
| 284 | 307 | unsigned long get_cubic_lut_buffer(int crtc_id); |
|---|
| 285 | | -int rockchip_ofnode_get_display_mode(ofnode node, struct drm_display_mode *mode); |
|---|
| 308 | +int rockchip_ofnode_get_display_mode(ofnode node, struct drm_display_mode *mode, |
|---|
| 309 | + u32 *bus_flags); |
|---|
| 310 | +void rockchip_display_make_crc32_table(void); |
|---|
| 311 | +uint32_t rockchip_display_crc32c_cal(unsigned char *data, int length); |
|---|
| 312 | +void drm_mode_set_crtcinfo(struct drm_display_mode *p, int adjust_flags); |
|---|
| 286 | 313 | |
|---|
| 287 | 314 | int display_rect_calc_hscale(struct display_rect *src, struct display_rect *dst, |
|---|
| 288 | 315 | int min_hscale, int max_hscale); |
|---|
| 289 | 316 | int display_rect_calc_vscale(struct display_rect *src, struct display_rect *dst, |
|---|
| 290 | 317 | int min_vscale, int max_vscale); |
|---|
| 318 | +const struct device_node * |
|---|
| 319 | +rockchip_of_graph_get_endpoint_by_regs(ofnode node, int port, int endpoint); |
|---|
| 291 | 320 | |
|---|
| 321 | +#ifdef CONFIG_SPL_BUILD |
|---|
| 322 | +int rockchip_spl_vop_probe(struct crtc_state *crtc_state); |
|---|
| 323 | +int rockchip_spl_dw_hdmi_probe(struct connector_state *conn_state); |
|---|
| 324 | +int inno_spl_hdmi_phy_probe(struct display_state *state); |
|---|
| 325 | +#endif |
|---|
| 292 | 326 | #endif |
|---|