0001
0002
0003
0004
0005 #ifndef _DPU_HW_PINGPONG_H
0006 #define _DPU_HW_PINGPONG_H
0007
0008 #include "dpu_hw_catalog.h"
0009 #include "dpu_hw_mdss.h"
0010 #include "dpu_hw_util.h"
0011
0012 #define DITHER_MATRIX_SZ 16
0013
0014 struct dpu_hw_pingpong;
0015
0016 struct dpu_hw_tear_check {
0017
0018
0019
0020
0021 u32 vsync_count;
0022 u32 sync_cfg_height;
0023 u32 vsync_init_val;
0024 u32 sync_threshold_start;
0025 u32 sync_threshold_continue;
0026 u32 start_pos;
0027 u32 rd_ptr_irq;
0028 u8 hw_vsync_mode;
0029 };
0030
0031 struct dpu_hw_pp_vsync_info {
0032 u32 rd_ptr_init_val;
0033 u32 rd_ptr_frame_count;
0034 u32 rd_ptr_line_count;
0035 u32 wr_ptr_line_count;
0036 };
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 struct dpu_hw_dither_cfg {
0049 u64 flags;
0050 u32 temporal_en;
0051 u32 c0_bitdepth;
0052 u32 c1_bitdepth;
0053 u32 c2_bitdepth;
0054 u32 c3_bitdepth;
0055 u32 matrix[DITHER_MATRIX_SZ];
0056 };
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070 struct dpu_hw_pingpong_ops {
0071
0072
0073
0074
0075 int (*setup_tearcheck)(struct dpu_hw_pingpong *pp,
0076 struct dpu_hw_tear_check *cfg);
0077
0078
0079
0080
0081 int (*enable_tearcheck)(struct dpu_hw_pingpong *pp,
0082 bool enable);
0083
0084
0085
0086
0087
0088 int (*connect_external_te)(struct dpu_hw_pingpong *pp,
0089 bool enable_external_te);
0090
0091
0092
0093
0094
0095 int (*get_vsync_info)(struct dpu_hw_pingpong *pp,
0096 struct dpu_hw_pp_vsync_info *info);
0097
0098
0099
0100
0101 void (*setup_autorefresh)(struct dpu_hw_pingpong *pp,
0102 u32 frame_count, bool enable);
0103
0104
0105
0106
0107 bool (*get_autorefresh)(struct dpu_hw_pingpong *pp,
0108 u32 *frame_count);
0109
0110
0111
0112
0113
0114 int (*poll_timeout_wr_ptr)(struct dpu_hw_pingpong *pp, u32 timeout_us);
0115
0116
0117
0118
0119 u32 (*get_line_count)(struct dpu_hw_pingpong *pp);
0120
0121
0122
0123
0124 void (*setup_dither)(struct dpu_hw_pingpong *pp,
0125 struct dpu_hw_dither_cfg *cfg);
0126
0127
0128
0129 int (*enable_dsc)(struct dpu_hw_pingpong *pp);
0130
0131
0132
0133
0134 void (*disable_dsc)(struct dpu_hw_pingpong *pp);
0135
0136
0137
0138
0139 int (*setup_dsc)(struct dpu_hw_pingpong *pp);
0140 };
0141
0142 struct dpu_hw_merge_3d;
0143
0144 struct dpu_hw_pingpong {
0145 struct dpu_hw_blk base;
0146 struct dpu_hw_blk_reg_map hw;
0147
0148
0149 enum dpu_pingpong idx;
0150 const struct dpu_pingpong_cfg *caps;
0151 struct dpu_hw_merge_3d *merge_3d;
0152
0153
0154 struct dpu_hw_pingpong_ops ops;
0155 };
0156
0157
0158
0159
0160
0161
0162 static inline struct dpu_hw_pingpong *to_dpu_hw_pingpong(struct dpu_hw_blk *hw)
0163 {
0164 return container_of(hw, struct dpu_hw_pingpong, base);
0165 }
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175 struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx,
0176 void __iomem *addr,
0177 const struct dpu_mdss_cfg *m);
0178
0179
0180
0181
0182
0183
0184 void dpu_hw_pingpong_destroy(struct dpu_hw_pingpong *pp);
0185
0186 #endif