0001
0002
0003
0004
0005
0006
0007 #ifndef TEGRA_DC_H
0008 #define TEGRA_DC_H 1
0009
0010 #include <linux/host1x.h>
0011
0012 #include <drm/drm_crtc.h>
0013
0014 #include "drm.h"
0015
0016 struct tegra_output;
0017
0018 #define TEGRA_DC_LEGACY_PLANES_NUM 7
0019
0020 struct tegra_dc_state {
0021 struct drm_crtc_state base;
0022
0023 struct clk *clk;
0024 unsigned long pclk;
0025 unsigned int div;
0026
0027 u32 planes;
0028 };
0029
0030 static inline struct tegra_dc_state *to_dc_state(struct drm_crtc_state *state)
0031 {
0032 if (state)
0033 return container_of(state, struct tegra_dc_state, base);
0034
0035 return NULL;
0036 }
0037
0038 struct tegra_dc_stats {
0039 unsigned long frames;
0040 unsigned long vblank;
0041 unsigned long underflow;
0042 unsigned long overflow;
0043
0044 unsigned long frames_total;
0045 unsigned long vblank_total;
0046 unsigned long underflow_total;
0047 unsigned long overflow_total;
0048 };
0049
0050 struct tegra_windowgroup_soc {
0051 unsigned int index;
0052 unsigned int dc;
0053 const unsigned int *windows;
0054 unsigned int num_windows;
0055 };
0056
0057 struct tegra_dc_soc_info {
0058 bool supports_background_color;
0059 bool supports_interlacing;
0060 bool supports_cursor;
0061 bool supports_block_linear;
0062 bool supports_sector_layout;
0063 bool has_legacy_blending;
0064 unsigned int pitch_align;
0065 bool has_powergate;
0066 bool coupled_pm;
0067 bool has_nvdisplay;
0068 const struct tegra_windowgroup_soc *wgrps;
0069 unsigned int num_wgrps;
0070 const u32 *primary_formats;
0071 unsigned int num_primary_formats;
0072 const u32 *overlay_formats;
0073 unsigned int num_overlay_formats;
0074 const u64 *modifiers;
0075 bool has_win_a_without_filters;
0076 bool has_win_b_vfilter_mem_client;
0077 bool has_win_c_without_vert_filter;
0078 bool plane_tiled_memory_bandwidth_x2;
0079 bool has_pll_d2_out0;
0080 };
0081
0082 struct tegra_dc {
0083 struct host1x_client client;
0084 struct host1x_syncpt *syncpt;
0085 struct device *dev;
0086
0087 struct drm_crtc base;
0088 unsigned int powergate;
0089 int pipe;
0090
0091 struct clk *clk;
0092 struct reset_control *rst;
0093 void __iomem *regs;
0094 int irq;
0095
0096 struct tegra_output *rgb;
0097
0098 struct tegra_dc_stats stats;
0099 struct list_head list;
0100
0101 struct drm_info_list *debugfs_files;
0102
0103 const struct tegra_dc_soc_info *soc;
0104
0105 bool has_opp_table;
0106 };
0107
0108 static inline struct tegra_dc *
0109 host1x_client_to_dc(struct host1x_client *client)
0110 {
0111 return container_of(client, struct tegra_dc, client);
0112 }
0113
0114 static inline struct tegra_dc *to_tegra_dc(struct drm_crtc *crtc)
0115 {
0116 return crtc ? container_of(crtc, struct tegra_dc, base) : NULL;
0117 }
0118
0119 static inline void tegra_dc_writel(struct tegra_dc *dc, u32 value,
0120 unsigned int offset)
0121 {
0122 trace_dc_writel(dc->dev, offset, value);
0123 writel(value, dc->regs + (offset << 2));
0124 }
0125
0126 static inline u32 tegra_dc_readl(struct tegra_dc *dc, unsigned int offset)
0127 {
0128 u32 value = readl(dc->regs + (offset << 2));
0129
0130 trace_dc_readl(dc->dev, offset, value);
0131
0132 return value;
0133 }
0134
0135 struct tegra_dc_window {
0136 struct {
0137 unsigned int x;
0138 unsigned int y;
0139 unsigned int w;
0140 unsigned int h;
0141 } src;
0142 struct {
0143 unsigned int x;
0144 unsigned int y;
0145 unsigned int w;
0146 unsigned int h;
0147 } dst;
0148 unsigned int bits_per_pixel;
0149 unsigned int stride[2];
0150 unsigned long base[3];
0151 unsigned int zpos;
0152 bool reflect_x;
0153 bool reflect_y;
0154
0155 struct tegra_bo_tiling tiling;
0156 u32 format;
0157 u32 swap;
0158 };
0159
0160
0161 bool tegra_dc_has_output(struct tegra_dc *dc, struct device *dev);
0162 void tegra_dc_commit(struct tegra_dc *dc);
0163 int tegra_dc_state_setup_clock(struct tegra_dc *dc,
0164 struct drm_crtc_state *crtc_state,
0165 struct clk *clk, unsigned long pclk,
0166 unsigned int div);
0167 void tegra_crtc_atomic_post_commit(struct drm_crtc *crtc,
0168 struct drm_atomic_state *state);
0169
0170
0171 int tegra_dc_rgb_probe(struct tegra_dc *dc);
0172 int tegra_dc_rgb_remove(struct tegra_dc *dc);
0173 int tegra_dc_rgb_init(struct drm_device *drm, struct tegra_dc *dc);
0174 int tegra_dc_rgb_exit(struct tegra_dc *dc);
0175
0176 #define DC_CMD_GENERAL_INCR_SYNCPT 0x000
0177 #define DC_CMD_GENERAL_INCR_SYNCPT_CNTRL 0x001
0178 #define SYNCPT_CNTRL_NO_STALL (1 << 8)
0179 #define SYNCPT_CNTRL_SOFT_RESET (1 << 0)
0180 #define DC_CMD_GENERAL_INCR_SYNCPT_ERROR 0x002
0181 #define DC_CMD_WIN_A_INCR_SYNCPT 0x008
0182 #define DC_CMD_WIN_A_INCR_SYNCPT_CNTRL 0x009
0183 #define DC_CMD_WIN_A_INCR_SYNCPT_ERROR 0x00a
0184 #define DC_CMD_WIN_B_INCR_SYNCPT 0x010
0185 #define DC_CMD_WIN_B_INCR_SYNCPT_CNTRL 0x011
0186 #define DC_CMD_WIN_B_INCR_SYNCPT_ERROR 0x012
0187 #define DC_CMD_WIN_C_INCR_SYNCPT 0x018
0188 #define DC_CMD_WIN_C_INCR_SYNCPT_CNTRL 0x019
0189 #define DC_CMD_WIN_C_INCR_SYNCPT_ERROR 0x01a
0190 #define DC_CMD_CONT_SYNCPT_VSYNC 0x028
0191 #define SYNCPT_VSYNC_ENABLE (1 << 8)
0192 #define DC_CMD_DISPLAY_COMMAND_OPTION0 0x031
0193 #define DC_CMD_DISPLAY_COMMAND 0x032
0194 #define DISP_CTRL_MODE_STOP (0 << 5)
0195 #define DISP_CTRL_MODE_C_DISPLAY (1 << 5)
0196 #define DISP_CTRL_MODE_NC_DISPLAY (2 << 5)
0197 #define DISP_CTRL_MODE_MASK (3 << 5)
0198 #define DC_CMD_SIGNAL_RAISE 0x033
0199 #define DC_CMD_DISPLAY_POWER_CONTROL 0x036
0200 #define PW0_ENABLE (1 << 0)
0201 #define PW1_ENABLE (1 << 2)
0202 #define PW2_ENABLE (1 << 4)
0203 #define PW3_ENABLE (1 << 6)
0204 #define PW4_ENABLE (1 << 8)
0205 #define PM0_ENABLE (1 << 16)
0206 #define PM1_ENABLE (1 << 18)
0207
0208 #define DC_CMD_INT_STATUS 0x037
0209 #define DC_CMD_INT_MASK 0x038
0210 #define DC_CMD_INT_ENABLE 0x039
0211 #define DC_CMD_INT_TYPE 0x03a
0212 #define DC_CMD_INT_POLARITY 0x03b
0213 #define CTXSW_INT (1 << 0)
0214 #define FRAME_END_INT (1 << 1)
0215 #define VBLANK_INT (1 << 2)
0216 #define V_PULSE3_INT (1 << 4)
0217 #define V_PULSE2_INT (1 << 5)
0218 #define REGION_CRC_INT (1 << 6)
0219 #define REG_TMOUT_INT (1 << 7)
0220 #define WIN_A_UF_INT (1 << 8)
0221 #define WIN_B_UF_INT (1 << 9)
0222 #define WIN_C_UF_INT (1 << 10)
0223 #define MSF_INT (1 << 12)
0224 #define WIN_A_OF_INT (1 << 14)
0225 #define WIN_B_OF_INT (1 << 15)
0226 #define WIN_C_OF_INT (1 << 16)
0227 #define HEAD_UF_INT (1 << 23)
0228 #define SD3_BUCKET_WALK_DONE_INT (1 << 24)
0229 #define DSC_OBUF_UF_INT (1 << 26)
0230 #define DSC_RBUF_UF_INT (1 << 27)
0231 #define DSC_BBUF_UF_INT (1 << 28)
0232 #define DSC_TO_UF_INT (1 << 29)
0233
0234 #define DC_CMD_SIGNAL_RAISE1 0x03c
0235 #define DC_CMD_SIGNAL_RAISE2 0x03d
0236 #define DC_CMD_SIGNAL_RAISE3 0x03e
0237
0238 #define DC_CMD_STATE_ACCESS 0x040
0239 #define READ_MUX (1 << 0)
0240 #define WRITE_MUX (1 << 2)
0241
0242 #define DC_CMD_STATE_CONTROL 0x041
0243 #define GENERAL_ACT_REQ (1 << 0)
0244 #define WIN_A_ACT_REQ (1 << 1)
0245 #define WIN_B_ACT_REQ (1 << 2)
0246 #define WIN_C_ACT_REQ (1 << 3)
0247 #define CURSOR_ACT_REQ (1 << 7)
0248 #define GENERAL_UPDATE (1 << 8)
0249 #define WIN_A_UPDATE (1 << 9)
0250 #define WIN_B_UPDATE (1 << 10)
0251 #define WIN_C_UPDATE (1 << 11)
0252 #define CURSOR_UPDATE (1 << 15)
0253 #define COMMON_ACTREQ (1 << 16)
0254 #define COMMON_UPDATE (1 << 17)
0255 #define NC_HOST_TRIG (1 << 24)
0256
0257 #define DC_CMD_DISPLAY_WINDOW_HEADER 0x042
0258 #define WINDOW_A_SELECT (1 << 4)
0259 #define WINDOW_B_SELECT (1 << 5)
0260 #define WINDOW_C_SELECT (1 << 6)
0261
0262 #define DC_CMD_REG_ACT_CONTROL 0x043
0263
0264 #define DC_COM_CRC_CONTROL 0x300
0265 #define DC_COM_CRC_CONTROL_ALWAYS (1 << 3)
0266 #define DC_COM_CRC_CONTROL_FULL_FRAME (0 << 2)
0267 #define DC_COM_CRC_CONTROL_ACTIVE_DATA (1 << 2)
0268 #define DC_COM_CRC_CONTROL_WAIT (1 << 1)
0269 #define DC_COM_CRC_CONTROL_ENABLE (1 << 0)
0270 #define DC_COM_CRC_CHECKSUM 0x301
0271 #define DC_COM_PIN_OUTPUT_ENABLE(x) (0x302 + (x))
0272 #define DC_COM_PIN_OUTPUT_POLARITY(x) (0x306 + (x))
0273 #define LVS_OUTPUT_POLARITY_LOW (1 << 28)
0274 #define LHS_OUTPUT_POLARITY_LOW (1 << 30)
0275 #define DC_COM_PIN_OUTPUT_DATA(x) (0x30a + (x))
0276 #define DC_COM_PIN_INPUT_ENABLE(x) (0x30e + (x))
0277 #define DC_COM_PIN_INPUT_DATA(x) (0x312 + (x))
0278 #define DC_COM_PIN_OUTPUT_SELECT(x) (0x314 + (x))
0279
0280 #define DC_COM_PIN_MISC_CONTROL 0x31b
0281 #define DC_COM_PIN_PM0_CONTROL 0x31c
0282 #define DC_COM_PIN_PM0_DUTY_CYCLE 0x31d
0283 #define DC_COM_PIN_PM1_CONTROL 0x31e
0284 #define DC_COM_PIN_PM1_DUTY_CYCLE 0x31f
0285
0286 #define DC_COM_SPI_CONTROL 0x320
0287 #define DC_COM_SPI_START_BYTE 0x321
0288 #define DC_COM_HSPI_WRITE_DATA_AB 0x322
0289 #define DC_COM_HSPI_WRITE_DATA_CD 0x323
0290 #define DC_COM_HSPI_CS_DC 0x324
0291 #define DC_COM_SCRATCH_REGISTER_A 0x325
0292 #define DC_COM_SCRATCH_REGISTER_B 0x326
0293 #define DC_COM_GPIO_CTRL 0x327
0294 #define DC_COM_GPIO_DEBOUNCE_COUNTER 0x328
0295 #define DC_COM_CRC_CHECKSUM_LATCHED 0x329
0296
0297 #define DC_COM_RG_UNDERFLOW 0x365
0298 #define UNDERFLOW_MODE_RED (1 << 8)
0299 #define UNDERFLOW_REPORT_ENABLE (1 << 0)
0300
0301 #define DC_DISP_DISP_SIGNAL_OPTIONS0 0x400
0302 #define H_PULSE0_ENABLE (1 << 8)
0303 #define H_PULSE1_ENABLE (1 << 10)
0304 #define H_PULSE2_ENABLE (1 << 12)
0305
0306 #define DC_DISP_DISP_SIGNAL_OPTIONS1 0x401
0307
0308 #define DC_DISP_DISP_WIN_OPTIONS 0x402
0309 #define HDMI_ENABLE (1 << 30)
0310 #define DSI_ENABLE (1 << 29)
0311 #define SOR1_TIMING_CYA (1 << 27)
0312 #define CURSOR_ENABLE (1 << 16)
0313
0314 #define SOR_ENABLE(x) (1 << (25 + (((x) > 1) ? ((x) + 1) : (x))))
0315
0316 #define DC_DISP_DISP_MEM_HIGH_PRIORITY 0x403
0317 #define CURSOR_THRESHOLD(x) (((x) & 0x03) << 24)
0318 #define WINDOW_A_THRESHOLD(x) (((x) & 0x7f) << 16)
0319 #define WINDOW_B_THRESHOLD(x) (((x) & 0x7f) << 8)
0320 #define WINDOW_C_THRESHOLD(x) (((x) & 0xff) << 0)
0321
0322 #define DC_DISP_DISP_MEM_HIGH_PRIORITY_TIMER 0x404
0323 #define CURSOR_DELAY(x) (((x) & 0x3f) << 24)
0324 #define WINDOW_A_DELAY(x) (((x) & 0x3f) << 16)
0325 #define WINDOW_B_DELAY(x) (((x) & 0x3f) << 8)
0326 #define WINDOW_C_DELAY(x) (((x) & 0x3f) << 0)
0327
0328 #define DC_DISP_DISP_TIMING_OPTIONS 0x405
0329 #define VSYNC_H_POSITION(x) ((x) & 0xfff)
0330
0331 #define DC_DISP_REF_TO_SYNC 0x406
0332 #define DC_DISP_SYNC_WIDTH 0x407
0333 #define DC_DISP_BACK_PORCH 0x408
0334 #define DC_DISP_ACTIVE 0x409
0335 #define DC_DISP_FRONT_PORCH 0x40a
0336 #define DC_DISP_H_PULSE0_CONTROL 0x40b
0337 #define DC_DISP_H_PULSE0_POSITION_A 0x40c
0338 #define DC_DISP_H_PULSE0_POSITION_B 0x40d
0339 #define DC_DISP_H_PULSE0_POSITION_C 0x40e
0340 #define DC_DISP_H_PULSE0_POSITION_D 0x40f
0341 #define DC_DISP_H_PULSE1_CONTROL 0x410
0342 #define DC_DISP_H_PULSE1_POSITION_A 0x411
0343 #define DC_DISP_H_PULSE1_POSITION_B 0x412
0344 #define DC_DISP_H_PULSE1_POSITION_C 0x413
0345 #define DC_DISP_H_PULSE1_POSITION_D 0x414
0346 #define DC_DISP_H_PULSE2_CONTROL 0x415
0347 #define DC_DISP_H_PULSE2_POSITION_A 0x416
0348 #define DC_DISP_H_PULSE2_POSITION_B 0x417
0349 #define DC_DISP_H_PULSE2_POSITION_C 0x418
0350 #define DC_DISP_H_PULSE2_POSITION_D 0x419
0351 #define DC_DISP_V_PULSE0_CONTROL 0x41a
0352 #define DC_DISP_V_PULSE0_POSITION_A 0x41b
0353 #define DC_DISP_V_PULSE0_POSITION_B 0x41c
0354 #define DC_DISP_V_PULSE0_POSITION_C 0x41d
0355 #define DC_DISP_V_PULSE1_CONTROL 0x41e
0356 #define DC_DISP_V_PULSE1_POSITION_A 0x41f
0357 #define DC_DISP_V_PULSE1_POSITION_B 0x420
0358 #define DC_DISP_V_PULSE1_POSITION_C 0x421
0359 #define DC_DISP_V_PULSE2_CONTROL 0x422
0360 #define DC_DISP_V_PULSE2_POSITION_A 0x423
0361 #define DC_DISP_V_PULSE3_CONTROL 0x424
0362 #define DC_DISP_V_PULSE3_POSITION_A 0x425
0363 #define DC_DISP_M0_CONTROL 0x426
0364 #define DC_DISP_M1_CONTROL 0x427
0365 #define DC_DISP_DI_CONTROL 0x428
0366 #define DC_DISP_PP_CONTROL 0x429
0367 #define DC_DISP_PP_SELECT_A 0x42a
0368 #define DC_DISP_PP_SELECT_B 0x42b
0369 #define DC_DISP_PP_SELECT_C 0x42c
0370 #define DC_DISP_PP_SELECT_D 0x42d
0371
0372 #define PULSE_MODE_NORMAL (0 << 3)
0373 #define PULSE_MODE_ONE_CLOCK (1 << 3)
0374 #define PULSE_POLARITY_HIGH (0 << 4)
0375 #define PULSE_POLARITY_LOW (1 << 4)
0376 #define PULSE_QUAL_ALWAYS (0 << 6)
0377 #define PULSE_QUAL_VACTIVE (2 << 6)
0378 #define PULSE_QUAL_VACTIVE1 (3 << 6)
0379 #define PULSE_LAST_START_A (0 << 8)
0380 #define PULSE_LAST_END_A (1 << 8)
0381 #define PULSE_LAST_START_B (2 << 8)
0382 #define PULSE_LAST_END_B (3 << 8)
0383 #define PULSE_LAST_START_C (4 << 8)
0384 #define PULSE_LAST_END_C (5 << 8)
0385 #define PULSE_LAST_START_D (6 << 8)
0386 #define PULSE_LAST_END_D (7 << 8)
0387
0388 #define PULSE_START(x) (((x) & 0xfff) << 0)
0389 #define PULSE_END(x) (((x) & 0xfff) << 16)
0390
0391 #define DC_DISP_DISP_CLOCK_CONTROL 0x42e
0392 #define PIXEL_CLK_DIVIDER_PCD1 (0 << 8)
0393 #define PIXEL_CLK_DIVIDER_PCD1H (1 << 8)
0394 #define PIXEL_CLK_DIVIDER_PCD2 (2 << 8)
0395 #define PIXEL_CLK_DIVIDER_PCD3 (3 << 8)
0396 #define PIXEL_CLK_DIVIDER_PCD4 (4 << 8)
0397 #define PIXEL_CLK_DIVIDER_PCD6 (5 << 8)
0398 #define PIXEL_CLK_DIVIDER_PCD8 (6 << 8)
0399 #define PIXEL_CLK_DIVIDER_PCD9 (7 << 8)
0400 #define PIXEL_CLK_DIVIDER_PCD12 (8 << 8)
0401 #define PIXEL_CLK_DIVIDER_PCD16 (9 << 8)
0402 #define PIXEL_CLK_DIVIDER_PCD18 (10 << 8)
0403 #define PIXEL_CLK_DIVIDER_PCD24 (11 << 8)
0404 #define PIXEL_CLK_DIVIDER_PCD13 (12 << 8)
0405 #define SHIFT_CLK_DIVIDER(x) ((x) & 0xff)
0406
0407 #define DC_DISP_DISP_INTERFACE_CONTROL 0x42f
0408 #define DISP_DATA_FORMAT_DF1P1C (0 << 0)
0409 #define DISP_DATA_FORMAT_DF1P2C24B (1 << 0)
0410 #define DISP_DATA_FORMAT_DF1P2C18B (2 << 0)
0411 #define DISP_DATA_FORMAT_DF1P2C16B (3 << 0)
0412 #define DISP_DATA_FORMAT_DF2S (4 << 0)
0413 #define DISP_DATA_FORMAT_DF3S (5 << 0)
0414 #define DISP_DATA_FORMAT_DFSPI (6 << 0)
0415 #define DISP_DATA_FORMAT_DF1P3C24B (7 << 0)
0416 #define DISP_DATA_FORMAT_DF1P3C18B (8 << 0)
0417 #define DISP_ALIGNMENT_MSB (0 << 8)
0418 #define DISP_ALIGNMENT_LSB (1 << 8)
0419 #define DISP_ORDER_RED_BLUE (0 << 9)
0420 #define DISP_ORDER_BLUE_RED (1 << 9)
0421
0422 #define DC_DISP_DISP_COLOR_CONTROL 0x430
0423 #define BASE_COLOR_SIZE666 ( 0 << 0)
0424 #define BASE_COLOR_SIZE111 ( 1 << 0)
0425 #define BASE_COLOR_SIZE222 ( 2 << 0)
0426 #define BASE_COLOR_SIZE333 ( 3 << 0)
0427 #define BASE_COLOR_SIZE444 ( 4 << 0)
0428 #define BASE_COLOR_SIZE555 ( 5 << 0)
0429 #define BASE_COLOR_SIZE565 ( 6 << 0)
0430 #define BASE_COLOR_SIZE332 ( 7 << 0)
0431 #define BASE_COLOR_SIZE888 ( 8 << 0)
0432 #define BASE_COLOR_SIZE101010 (10 << 0)
0433 #define BASE_COLOR_SIZE121212 (12 << 0)
0434 #define DITHER_CONTROL_MASK (3 << 8)
0435 #define DITHER_CONTROL_DISABLE (0 << 8)
0436 #define DITHER_CONTROL_ORDERED (2 << 8)
0437 #define DITHER_CONTROL_ERRDIFF (3 << 8)
0438 #define BASE_COLOR_SIZE_MASK (0xf << 0)
0439 #define BASE_COLOR_SIZE_666 ( 0 << 0)
0440 #define BASE_COLOR_SIZE_111 ( 1 << 0)
0441 #define BASE_COLOR_SIZE_222 ( 2 << 0)
0442 #define BASE_COLOR_SIZE_333 ( 3 << 0)
0443 #define BASE_COLOR_SIZE_444 ( 4 << 0)
0444 #define BASE_COLOR_SIZE_555 ( 5 << 0)
0445 #define BASE_COLOR_SIZE_565 ( 6 << 0)
0446 #define BASE_COLOR_SIZE_332 ( 7 << 0)
0447 #define BASE_COLOR_SIZE_888 ( 8 << 0)
0448 #define BASE_COLOR_SIZE_101010 ( 10 << 0)
0449 #define BASE_COLOR_SIZE_121212 ( 12 << 0)
0450
0451 #define DC_DISP_SHIFT_CLOCK_OPTIONS 0x431
0452 #define SC1_H_QUALIFIER_NONE (1 << 16)
0453 #define SC0_H_QUALIFIER_NONE (1 << 0)
0454
0455 #define DC_DISP_DATA_ENABLE_OPTIONS 0x432
0456 #define DE_SELECT_ACTIVE_BLANK (0 << 0)
0457 #define DE_SELECT_ACTIVE (1 << 0)
0458 #define DE_SELECT_ACTIVE_IS (2 << 0)
0459 #define DE_CONTROL_ONECLK (0 << 2)
0460 #define DE_CONTROL_NORMAL (1 << 2)
0461 #define DE_CONTROL_EARLY_EXT (2 << 2)
0462 #define DE_CONTROL_EARLY (3 << 2)
0463 #define DE_CONTROL_ACTIVE_BLANK (4 << 2)
0464
0465 #define DC_DISP_SERIAL_INTERFACE_OPTIONS 0x433
0466 #define DC_DISP_LCD_SPI_OPTIONS 0x434
0467 #define DC_DISP_BORDER_COLOR 0x435
0468 #define DC_DISP_COLOR_KEY0_LOWER 0x436
0469 #define DC_DISP_COLOR_KEY0_UPPER 0x437
0470 #define DC_DISP_COLOR_KEY1_LOWER 0x438
0471 #define DC_DISP_COLOR_KEY1_UPPER 0x439
0472
0473 #define DC_DISP_CURSOR_FOREGROUND 0x43c
0474 #define DC_DISP_CURSOR_BACKGROUND 0x43d
0475
0476 #define DC_DISP_CURSOR_START_ADDR 0x43e
0477 #define CURSOR_CLIP_DISPLAY (0 << 28)
0478 #define CURSOR_CLIP_WIN_A (1 << 28)
0479 #define CURSOR_CLIP_WIN_B (2 << 28)
0480 #define CURSOR_CLIP_WIN_C (3 << 28)
0481 #define CURSOR_SIZE_32x32 (0 << 24)
0482 #define CURSOR_SIZE_64x64 (1 << 24)
0483 #define CURSOR_SIZE_128x128 (2 << 24)
0484 #define CURSOR_SIZE_256x256 (3 << 24)
0485 #define DC_DISP_CURSOR_START_ADDR_NS 0x43f
0486
0487 #define DC_DISP_CURSOR_POSITION 0x440
0488 #define DC_DISP_CURSOR_POSITION_NS 0x441
0489
0490 #define DC_DISP_INIT_SEQ_CONTROL 0x442
0491 #define DC_DISP_SPI_INIT_SEQ_DATA_A 0x443
0492 #define DC_DISP_SPI_INIT_SEQ_DATA_B 0x444
0493 #define DC_DISP_SPI_INIT_SEQ_DATA_C 0x445
0494 #define DC_DISP_SPI_INIT_SEQ_DATA_D 0x446
0495
0496 #define DC_DISP_DC_MCCIF_FIFOCTRL 0x480
0497 #define DC_DISP_MCCIF_DISPLAY0A_HYST 0x481
0498 #define DC_DISP_MCCIF_DISPLAY0B_HYST 0x482
0499 #define DC_DISP_MCCIF_DISPLAY1A_HYST 0x483
0500 #define DC_DISP_MCCIF_DISPLAY1B_HYST 0x484
0501
0502 #define DC_DISP_DAC_CRT_CTRL 0x4c0
0503 #define DC_DISP_DISP_MISC_CONTROL 0x4c1
0504 #define DC_DISP_SD_CONTROL 0x4c2
0505 #define DC_DISP_SD_CSC_COEFF 0x4c3
0506 #define DC_DISP_SD_LUT(x) (0x4c4 + (x))
0507 #define DC_DISP_SD_FLICKER_CONTROL 0x4cd
0508 #define DC_DISP_DC_PIXEL_COUNT 0x4ce
0509 #define DC_DISP_SD_HISTOGRAM(x) (0x4cf + (x))
0510 #define DC_DISP_SD_BL_PARAMETERS 0x4d7
0511 #define DC_DISP_SD_BL_TF(x) (0x4d8 + (x))
0512 #define DC_DISP_SD_BL_CONTROL 0x4dc
0513 #define DC_DISP_SD_HW_K_VALUES 0x4dd
0514 #define DC_DISP_SD_MAN_K_VALUES 0x4de
0515
0516 #define DC_DISP_BLEND_BACKGROUND_COLOR 0x4e4
0517 #define BACKGROUND_COLOR_ALPHA(x) (((x) & 0xff) << 24)
0518 #define BACKGROUND_COLOR_BLUE(x) (((x) & 0xff) << 16)
0519 #define BACKGROUND_COLOR_GREEN(x) (((x) & 0xff) << 8)
0520 #define BACKGROUND_COLOR_RED(x) (((x) & 0xff) << 0)
0521
0522 #define DC_DISP_INTERLACE_CONTROL 0x4e5
0523 #define INTERLACE_STATUS (1 << 2)
0524 #define INTERLACE_START (1 << 1)
0525 #define INTERLACE_ENABLE (1 << 0)
0526
0527 #define DC_DISP_CURSOR_START_ADDR_HI 0x4ec
0528 #define DC_DISP_BLEND_CURSOR_CONTROL 0x4f1
0529 #define CURSOR_COMPOSITION_MODE_BLEND (0 << 25)
0530 #define CURSOR_COMPOSITION_MODE_XOR (1 << 25)
0531 #define CURSOR_MODE_LEGACY (0 << 24)
0532 #define CURSOR_MODE_NORMAL (1 << 24)
0533 #define CURSOR_DST_BLEND_ZERO (0 << 16)
0534 #define CURSOR_DST_BLEND_K1 (1 << 16)
0535 #define CURSOR_DST_BLEND_NEG_K1_TIMES_SRC (2 << 16)
0536 #define CURSOR_DST_BLEND_MASK (3 << 16)
0537 #define CURSOR_SRC_BLEND_K1 (0 << 8)
0538 #define CURSOR_SRC_BLEND_K1_TIMES_SRC (1 << 8)
0539 #define CURSOR_SRC_BLEND_MASK (3 << 8)
0540 #define CURSOR_ALPHA 0xff
0541
0542 #define DC_WIN_CORE_ACT_CONTROL 0x50e
0543 #define VCOUNTER (0 << 0)
0544 #define HCOUNTER (1 << 0)
0545
0546 #define DC_WIN_CORE_IHUB_WGRP_LATENCY_CTLA 0x543
0547 #define LATENCY_CTL_MODE_ENABLE (1 << 2)
0548
0549 #define DC_WIN_CORE_IHUB_WGRP_LATENCY_CTLB 0x544
0550 #define WATERMARK_MASK 0x1fffffff
0551
0552 #define DC_WIN_CORE_PRECOMP_WGRP_PIPE_METER 0x560
0553 #define PIPE_METER_INT(x) (((x) & 0xff) << 8)
0554 #define PIPE_METER_FRAC(x) (((x) & 0xff) << 0)
0555
0556 #define DC_WIN_CORE_IHUB_WGRP_POOL_CONFIG 0x561
0557 #define MEMPOOL_ENTRIES(x) (((x) & 0xffff) << 0)
0558
0559 #define DC_WIN_CORE_IHUB_WGRP_FETCH_METER 0x562
0560 #define SLOTS(x) (((x) & 0xff) << 0)
0561
0562 #define DC_WIN_CORE_IHUB_LINEBUF_CONFIG 0x563
0563 #define MODE_TWO_LINES (0 << 14)
0564 #define MODE_FOUR_LINES (1 << 14)
0565
0566 #define DC_WIN_CORE_IHUB_THREAD_GROUP 0x568
0567 #define THREAD_NUM_MASK (0x1f << 1)
0568 #define THREAD_NUM(x) (((x) & 0x1f) << 1)
0569 #define THREAD_GROUP_ENABLE (1 << 0)
0570
0571 #define DC_WIN_H_FILTER_P(p) (0x601 + (p))
0572 #define DC_WIN_V_FILTER_P(p) (0x619 + (p))
0573
0574 #define DC_WIN_CSC_YOF 0x611
0575 #define DC_WIN_CSC_KYRGB 0x612
0576 #define DC_WIN_CSC_KUR 0x613
0577 #define DC_WIN_CSC_KVR 0x614
0578 #define DC_WIN_CSC_KUG 0x615
0579 #define DC_WIN_CSC_KVG 0x616
0580 #define DC_WIN_CSC_KUB 0x617
0581 #define DC_WIN_CSC_KVB 0x618
0582
0583 #define DC_WIN_WIN_OPTIONS 0x700
0584 #define H_DIRECTION (1 << 0)
0585 #define V_DIRECTION (1 << 2)
0586 #define COLOR_EXPAND (1 << 6)
0587 #define H_FILTER (1 << 8)
0588 #define V_FILTER (1 << 10)
0589 #define CSC_ENABLE (1 << 18)
0590 #define WIN_ENABLE (1 << 30)
0591
0592 #define DC_WIN_BYTE_SWAP 0x701
0593 #define BYTE_SWAP_NOSWAP (0 << 0)
0594 #define BYTE_SWAP_SWAP2 (1 << 0)
0595 #define BYTE_SWAP_SWAP4 (2 << 0)
0596 #define BYTE_SWAP_SWAP4HW (3 << 0)
0597
0598 #define DC_WIN_BUFFER_CONTROL 0x702
0599 #define BUFFER_CONTROL_HOST (0 << 0)
0600 #define BUFFER_CONTROL_VI (1 << 0)
0601 #define BUFFER_CONTROL_EPP (2 << 0)
0602 #define BUFFER_CONTROL_MPEGE (3 << 0)
0603 #define BUFFER_CONTROL_SB2D (4 << 0)
0604
0605 #define DC_WIN_COLOR_DEPTH 0x703
0606 #define WIN_COLOR_DEPTH_P1 0
0607 #define WIN_COLOR_DEPTH_P2 1
0608 #define WIN_COLOR_DEPTH_P4 2
0609 #define WIN_COLOR_DEPTH_P8 3
0610 #define WIN_COLOR_DEPTH_B4G4R4A4 4
0611 #define WIN_COLOR_DEPTH_B5G5R5A1 5
0612 #define WIN_COLOR_DEPTH_B5G6R5 6
0613 #define WIN_COLOR_DEPTH_A1B5G5R5 7
0614 #define WIN_COLOR_DEPTH_B8G8R8A8 12
0615 #define WIN_COLOR_DEPTH_R8G8B8A8 13
0616 #define WIN_COLOR_DEPTH_B6x2G6x2R6x2A8 14
0617 #define WIN_COLOR_DEPTH_R6x2G6x2B6x2A8 15
0618 #define WIN_COLOR_DEPTH_YCbCr422 16
0619 #define WIN_COLOR_DEPTH_YUV422 17
0620 #define WIN_COLOR_DEPTH_YCbCr420P 18
0621 #define WIN_COLOR_DEPTH_YUV420P 19
0622 #define WIN_COLOR_DEPTH_YCbCr422P 20
0623 #define WIN_COLOR_DEPTH_YUV422P 21
0624 #define WIN_COLOR_DEPTH_YCbCr422R 22
0625 #define WIN_COLOR_DEPTH_YUV422R 23
0626 #define WIN_COLOR_DEPTH_YCbCr422RA 24
0627 #define WIN_COLOR_DEPTH_YUV422RA 25
0628 #define WIN_COLOR_DEPTH_R4G4B4A4 27
0629 #define WIN_COLOR_DEPTH_R5G5B5A 28
0630 #define WIN_COLOR_DEPTH_AR5G5B5 29
0631 #define WIN_COLOR_DEPTH_B5G5R5X1 30
0632 #define WIN_COLOR_DEPTH_X1B5G5R5 31
0633 #define WIN_COLOR_DEPTH_R5G5B5X1 32
0634 #define WIN_COLOR_DEPTH_X1R5G5B5 33
0635 #define WIN_COLOR_DEPTH_R5G6B5 34
0636 #define WIN_COLOR_DEPTH_A8R8G8B8 35
0637 #define WIN_COLOR_DEPTH_A8B8G8R8 36
0638 #define WIN_COLOR_DEPTH_B8G8R8X8 37
0639 #define WIN_COLOR_DEPTH_R8G8B8X8 38
0640 #define WIN_COLOR_DEPTH_YCbCr444P 41
0641 #define WIN_COLOR_DEPTH_YCrCb420SP 42
0642 #define WIN_COLOR_DEPTH_YCbCr420SP 43
0643 #define WIN_COLOR_DEPTH_YCrCb422SP 44
0644 #define WIN_COLOR_DEPTH_YCbCr422SP 45
0645 #define WIN_COLOR_DEPTH_YCrCb444SP 48
0646 #define WIN_COLOR_DEPTH_YCbCr444SP 49
0647 #define WIN_COLOR_DEPTH_X8B8G8R8 65
0648 #define WIN_COLOR_DEPTH_X8R8G8B8 66
0649
0650 #define DC_WIN_POSITION 0x704
0651 #define H_POSITION(x) (((x) & 0x1fff) << 0)
0652 #define V_POSITION(x) (((x) & 0x1fff) << 16)
0653
0654 #define DC_WIN_SIZE 0x705
0655 #define H_SIZE(x) (((x) & 0x1fff) << 0)
0656 #define V_SIZE(x) (((x) & 0x1fff) << 16)
0657
0658 #define DC_WIN_PRESCALED_SIZE 0x706
0659 #define H_PRESCALED_SIZE(x) (((x) & 0x7fff) << 0)
0660 #define V_PRESCALED_SIZE(x) (((x) & 0x1fff) << 16)
0661
0662 #define DC_WIN_H_INITIAL_DDA 0x707
0663 #define DC_WIN_V_INITIAL_DDA 0x708
0664 #define DC_WIN_DDA_INC 0x709
0665 #define H_DDA_INC(x) (((x) & 0xffff) << 0)
0666 #define V_DDA_INC(x) (((x) & 0xffff) << 16)
0667
0668 #define DC_WIN_LINE_STRIDE 0x70a
0669 #define DC_WIN_BUF_STRIDE 0x70b
0670 #define DC_WIN_UV_BUF_STRIDE 0x70c
0671 #define DC_WIN_BUFFER_ADDR_MODE 0x70d
0672 #define DC_WIN_BUFFER_ADDR_MODE_LINEAR (0 << 0)
0673 #define DC_WIN_BUFFER_ADDR_MODE_TILE (1 << 0)
0674 #define DC_WIN_BUFFER_ADDR_MODE_LINEAR_UV (0 << 16)
0675 #define DC_WIN_BUFFER_ADDR_MODE_TILE_UV (1 << 16)
0676
0677 #define DC_WIN_DV_CONTROL 0x70e
0678
0679 #define DC_WIN_BLEND_NOKEY 0x70f
0680 #define BLEND_WEIGHT1(x) (((x) & 0xff) << 16)
0681 #define BLEND_WEIGHT0(x) (((x) & 0xff) << 8)
0682
0683 #define DC_WIN_BLEND_1WIN 0x710
0684 #define BLEND_CONTROL_FIX (0 << 2)
0685 #define BLEND_CONTROL_ALPHA (1 << 2)
0686 #define BLEND_COLOR_KEY_NONE (0 << 0)
0687 #define BLEND_COLOR_KEY_0 (1 << 0)
0688 #define BLEND_COLOR_KEY_1 (2 << 0)
0689 #define BLEND_COLOR_KEY_BOTH (3 << 0)
0690
0691 #define DC_WIN_BLEND_2WIN_X 0x711
0692 #define BLEND_CONTROL_DEPENDENT (2 << 2)
0693
0694 #define DC_WIN_BLEND_2WIN_Y 0x712
0695 #define DC_WIN_BLEND_3WIN_XY 0x713
0696
0697 #define DC_WIN_HP_FETCH_CONTROL 0x714
0698
0699 #define DC_WINBUF_START_ADDR 0x800
0700 #define DC_WINBUF_START_ADDR_NS 0x801
0701 #define DC_WINBUF_START_ADDR_U 0x802
0702 #define DC_WINBUF_START_ADDR_U_NS 0x803
0703 #define DC_WINBUF_START_ADDR_V 0x804
0704 #define DC_WINBUF_START_ADDR_V_NS 0x805
0705
0706 #define DC_WINBUF_ADDR_H_OFFSET 0x806
0707 #define DC_WINBUF_ADDR_H_OFFSET_NS 0x807
0708 #define DC_WINBUF_ADDR_V_OFFSET 0x808
0709 #define DC_WINBUF_ADDR_V_OFFSET_NS 0x809
0710
0711 #define DC_WINBUF_UFLOW_STATUS 0x80a
0712 #define DC_WINBUF_SURFACE_KIND 0x80b
0713 #define DC_WINBUF_SURFACE_KIND_PITCH (0 << 0)
0714 #define DC_WINBUF_SURFACE_KIND_TILED (1 << 0)
0715 #define DC_WINBUF_SURFACE_KIND_BLOCK (2 << 0)
0716 #define DC_WINBUF_SURFACE_KIND_BLOCK_HEIGHT(x) (((x) & 0x7) << 4)
0717
0718 #define DC_WINBUF_START_ADDR_HI 0x80d
0719
0720 #define DC_WINBUF_START_ADDR_HI_U 0x80f
0721 #define DC_WINBUF_START_ADDR_HI_V 0x811
0722
0723 #define DC_WINBUF_CDE_CONTROL 0x82f
0724 #define ENABLE_SURFACE (1 << 0)
0725
0726 #define DC_WINBUF_AD_UFLOW_STATUS 0xbca
0727 #define DC_WINBUF_BD_UFLOW_STATUS 0xdca
0728 #define DC_WINBUF_CD_UFLOW_STATUS 0xfca
0729
0730
0731 #define DC_DISP_CORE_SOR_SET_CONTROL(x) (0x403 + (x))
0732 #define PROTOCOL_MASK (0xf << 8)
0733 #define PROTOCOL_SINGLE_TMDS_A (0x1 << 8)
0734
0735 #define DC_DISP_PCALC_HEAD_SET_CROPPED_POINT_IN_CURSOR 0x442
0736 #define DC_DISP_PCALC_HEAD_SET_CROPPED_SIZE_IN_CURSOR 0x446
0737
0738 #define DC_WINC_PRECOMP_WGRP_PIPE_CAPA 0x500
0739 #define DC_WINC_PRECOMP_WGRP_PIPE_CAPB 0x501
0740 #define DC_WINC_PRECOMP_WGRP_PIPE_CAPC 0x502
0741 #define MAX_PIXELS_5TAP444(x) ((x) & 0xffff)
0742 #define DC_WINC_PRECOMP_WGRP_PIPE_CAPD 0x503
0743 #define DC_WINC_PRECOMP_WGRP_PIPE_CAPE 0x504
0744 #define MAX_PIXELS_2TAP444(x) ((x) & 0xffff)
0745 #define DC_WINC_PRECOMP_WGRP_PIPE_CAPF 0x505
0746
0747 #define DC_WIN_CORE_WINDOWGROUP_SET_CONTROL 0x702
0748 #define OWNER_MASK (0xf << 0)
0749 #define OWNER(x) (((x) & 0xf) << 0)
0750
0751 #define DC_WIN_CROPPED_SIZE 0x706
0752
0753 #define DC_WIN_SET_INPUT_SCALER_H_START_PHASE 0x707
0754 #define DC_WIN_SET_INPUT_SCALER_V_START_PHASE 0x708
0755
0756 #define DC_WIN_PLANAR_STORAGE 0x709
0757 #define PITCH(x) (((x) >> 6) & 0x1fff)
0758
0759 #define DC_WIN_PLANAR_STORAGE_UV 0x70a
0760 #define PITCH_U(x) ((((x) >> 6) & 0x1fff) << 0)
0761 #define PITCH_V(x) ((((x) >> 6) & 0x1fff) << 16)
0762
0763 #define DC_WIN_SET_INPUT_SCALER_HPHASE_INCR 0x70b
0764 #define DC_WIN_SET_INPUT_SCALER_VPHASE_INCR 0x70c
0765
0766 #define DC_WIN_SET_PARAMS 0x70d
0767 #define CLAMP_BEFORE_BLEND (1 << 15)
0768 #define DEGAMMA_NONE (0 << 13)
0769 #define DEGAMMA_SRGB (1 << 13)
0770 #define DEGAMMA_YUV8_10 (2 << 13)
0771 #define DEGAMMA_YUV12 (3 << 13)
0772 #define INPUT_RANGE_BYPASS (0 << 10)
0773 #define INPUT_RANGE_LIMITED (1 << 10)
0774 #define INPUT_RANGE_FULL (2 << 10)
0775 #define COLOR_SPACE_RGB (0 << 8)
0776 #define COLOR_SPACE_YUV_601 (1 << 8)
0777 #define COLOR_SPACE_YUV_709 (2 << 8)
0778 #define COLOR_SPACE_YUV_2020 (3 << 8)
0779
0780 #define DC_WIN_WINDOWGROUP_SET_CONTROL_INPUT_SCALER 0x70e
0781 #define HORIZONTAL_TAPS_2 (1 << 3)
0782 #define HORIZONTAL_TAPS_5 (4 << 3)
0783 #define VERTICAL_TAPS_2 (1 << 0)
0784 #define VERTICAL_TAPS_5 (4 << 0)
0785
0786 #define DC_WIN_WINDOWGROUP_SET_INPUT_SCALER_COEFF 0x70f
0787 #define COEFF_INDEX(x) (((x) & 0xff) << 15)
0788 #define COEFF_DATA(x) (((x) & 0x3ff) << 0)
0789
0790 #define DC_WIN_WINDOWGROUP_SET_INPUT_SCALER_USAGE 0x711
0791 #define INPUT_SCALER_USE422 (1 << 2)
0792 #define INPUT_SCALER_VBYPASS (1 << 1)
0793 #define INPUT_SCALER_HBYPASS (1 << 0)
0794
0795 #define DC_WIN_BLEND_LAYER_CONTROL 0x716
0796 #define COLOR_KEY_NONE (0 << 25)
0797 #define COLOR_KEY_SRC (1 << 25)
0798 #define COLOR_KEY_DST (2 << 25)
0799 #define BLEND_BYPASS (1 << 24)
0800 #define K2(x) (((x) & 0xff) << 16)
0801 #define K1(x) (((x) & 0xff) << 8)
0802 #define WINDOW_LAYER_DEPTH(x) (((x) & 0xff) << 0)
0803
0804 #define DC_WIN_BLEND_MATCH_SELECT 0x717
0805 #define BLEND_FACTOR_DST_ALPHA_ZERO (0 << 12)
0806 #define BLEND_FACTOR_DST_ALPHA_ONE (1 << 12)
0807 #define BLEND_FACTOR_DST_ALPHA_NEG_K1_TIMES_SRC (2 << 12)
0808 #define BLEND_FACTOR_DST_ALPHA_K2 (3 << 12)
0809 #define BLEND_FACTOR_SRC_ALPHA_ZERO (0 << 8)
0810 #define BLEND_FACTOR_SRC_ALPHA_K1 (1 << 8)
0811 #define BLEND_FACTOR_SRC_ALPHA_K2 (2 << 8)
0812 #define BLEND_FACTOR_SRC_ALPHA_NEG_K1_TIMES_DST (3 << 8)
0813 #define BLEND_FACTOR_DST_COLOR_ZERO (0 << 4)
0814 #define BLEND_FACTOR_DST_COLOR_ONE (1 << 4)
0815 #define BLEND_FACTOR_DST_COLOR_K1 (2 << 4)
0816 #define BLEND_FACTOR_DST_COLOR_K2 (3 << 4)
0817 #define BLEND_FACTOR_DST_COLOR_K1_TIMES_DST (4 << 4)
0818 #define BLEND_FACTOR_DST_COLOR_NEG_K1_TIMES_DST (5 << 4)
0819 #define BLEND_FACTOR_DST_COLOR_NEG_K1_TIMES_SRC (6 << 4)
0820 #define BLEND_FACTOR_DST_COLOR_NEG_K1 (7 << 4)
0821 #define BLEND_FACTOR_SRC_COLOR_ZERO (0 << 0)
0822 #define BLEND_FACTOR_SRC_COLOR_ONE (1 << 0)
0823 #define BLEND_FACTOR_SRC_COLOR_K1 (2 << 0)
0824 #define BLEND_FACTOR_SRC_COLOR_K1_TIMES_DST (3 << 0)
0825 #define BLEND_FACTOR_SRC_COLOR_NEG_K1_TIMES_DST (4 << 0)
0826 #define BLEND_FACTOR_SRC_COLOR_K1_TIMES_SRC (5 << 0)
0827
0828 #define DC_WIN_BLEND_NOMATCH_SELECT 0x718
0829
0830 #define DC_WIN_PRECOMP_WGRP_PARAMS 0x724
0831 #define SWAP_UV (1 << 0)
0832
0833 #define DC_WIN_WINDOW_SET_CONTROL 0x730
0834 #define CONTROL_CSC_ENABLE (1 << 5)
0835
0836 #define DC_WINBUF_CROPPED_POINT 0x806
0837 #define OFFSET_Y(x) (((x) & 0xffff) << 16)
0838 #define OFFSET_X(x) (((x) & 0xffff) << 0)
0839
0840 #endif