Lines Matching +full:vsync +full:- +full:polarity +full:- +full:high
1 // SPDX-License-Identifier: GPL-2.0-or-later
25 * - CVBS Encoding via the ENCI encoder and VDAC digital to analog converter
26 * - TMDS/HDMI Encoding via ENCI_DIV and ENCP
27 * - Setup of more clock rates for HDMI modes
31 * - LCD Panel encoding via ENCL
32 * - TV Panel encoding via ENCT
39 * vd1---| |-| | | VENC /---------|----VDAC
40 * vd2---| VIU |-| VPP |-|-----ENCI/-ENCI_DVI-|-|
41 * osd1--| |-| | | \ | X--HDMI-TX
42 * osd2--|_____|-|_____| | |\-ENCP--ENCP_DVI-|-|
44 * | \--ENCL-----------|----LVDS
706 .max_pxcnt = 3840+1660-1,
748 .max_pxcnt = 3840+1440-1,
790 .max_pxcnt = 3840+560-1,
853 return a - 16; in to_signed()
859 return a - b; in modulo()
867 if (mode->flags & ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NHSYNC | in meson_venc_hdmi_supported_mode()
871 if (mode->hdisplay < 400 || mode->hdisplay > 1920) in meson_venc_hdmi_supported_mode()
874 if (mode->vdisplay < 480 || mode->vdisplay > 1920) in meson_venc_hdmi_supported_mode()
885 while (vmode->vic && vmode->mode) { in meson_venc_hdmi_supported_vic()
886 if (vmode->vic == vic) in meson_venc_hdmi_supported_vic()
900 dmt_mode->encp.dvi_settings = 0x21; in meson_venc_hdmi_get_dmt_vmode()
901 dmt_mode->encp.video_mode = 0x4040; in meson_venc_hdmi_get_dmt_vmode()
902 dmt_mode->encp.video_mode_adv = 0x18; in meson_venc_hdmi_get_dmt_vmode()
903 dmt_mode->encp.max_pxcnt = mode->htotal - 1; in meson_venc_hdmi_get_dmt_vmode()
904 dmt_mode->encp.havon_begin = mode->htotal - mode->hsync_start; in meson_venc_hdmi_get_dmt_vmode()
905 dmt_mode->encp.havon_end = dmt_mode->encp.havon_begin + in meson_venc_hdmi_get_dmt_vmode()
906 mode->hdisplay - 1; in meson_venc_hdmi_get_dmt_vmode()
907 dmt_mode->encp.vavon_bline = mode->vtotal - mode->vsync_start; in meson_venc_hdmi_get_dmt_vmode()
908 dmt_mode->encp.vavon_eline = dmt_mode->encp.vavon_bline + in meson_venc_hdmi_get_dmt_vmode()
909 mode->vdisplay - 1; in meson_venc_hdmi_get_dmt_vmode()
910 dmt_mode->encp.hso_begin = 0; in meson_venc_hdmi_get_dmt_vmode()
911 dmt_mode->encp.hso_end = mode->hsync_end - mode->hsync_start; in meson_venc_hdmi_get_dmt_vmode()
912 dmt_mode->encp.vso_begin = 30; in meson_venc_hdmi_get_dmt_vmode()
913 dmt_mode->encp.vso_end = 50; in meson_venc_hdmi_get_dmt_vmode()
914 dmt_mode->encp.vso_bline = 0; in meson_venc_hdmi_get_dmt_vmode()
915 dmt_mode->encp.vso_eline = mode->vsync_end - mode->vsync_start; in meson_venc_hdmi_get_dmt_vmode()
916 dmt_mode->encp.vso_eline_present = true; in meson_venc_hdmi_get_dmt_vmode()
917 dmt_mode->encp.max_lncnt = mode->vtotal - 1; in meson_venc_hdmi_get_dmt_vmode()
924 while (vmode->vic && vmode->mode) { in meson_venc_hdmi_get_vic_vmode()
925 if (vmode->vic == vic) in meson_venc_hdmi_get_vic_vmode()
926 return vmode->mode; in meson_venc_hdmi_get_vic_vmode()
986 if (mode->flags & DRM_MODE_FLAG_DBLCLK) { in meson_venc_hdmi_mode_set()
995 dev_err(priv->dev, "%s: Fatal Error, unsupported mode " in meson_venc_hdmi_mode_set()
1010 eof_lines = mode->vsync_start - mode->vdisplay; in meson_venc_hdmi_mode_set()
1011 if (mode->flags & DRM_MODE_FLAG_INTERLACE) in meson_venc_hdmi_mode_set()
1013 sof_lines = mode->vtotal - mode->vsync_end; in meson_venc_hdmi_mode_set()
1014 if (mode->flags & DRM_MODE_FLAG_INTERLACE) in meson_venc_hdmi_mode_set()
1016 vsync_lines = mode->vsync_end - mode->vsync_start; in meson_venc_hdmi_mode_set()
1017 if (mode->flags & DRM_MODE_FLAG_INTERLACE) in meson_venc_hdmi_mode_set()
1020 total_pixels_venc = mode->htotal; in meson_venc_hdmi_mode_set()
1026 active_pixels_venc = mode->hdisplay; in meson_venc_hdmi_mode_set()
1032 front_porch_venc = (mode->hsync_start - mode->hdisplay); in meson_venc_hdmi_mode_set()
1038 hsync_pixels_venc = (mode->hsync_end - mode->hsync_start); in meson_venc_hdmi_mode_set()
1046 priv->io_base + _REG(VENC_VDAC_SETTING)); in meson_venc_hdmi_mode_set()
1048 writel_relaxed(0, priv->io_base + _REG(ENCI_VIDEO_EN)); in meson_venc_hdmi_mode_set()
1049 writel_relaxed(0, priv->io_base + _REG(ENCP_VIDEO_EN)); in meson_venc_hdmi_mode_set()
1057 priv->io_base + _REG(ENCI_CFILT_CTRL)); in meson_venc_hdmi_mode_set()
1060 priv->io_base + _REG(ENCI_CFILT_CTRL2)); in meson_venc_hdmi_mode_set()
1063 writel_relaxed(0, priv->io_base + _REG(VENC_DVI_SETTING)); in meson_venc_hdmi_mode_set()
1066 writel_relaxed(0, priv->io_base + _REG(ENCI_VIDEO_MODE)); in meson_venc_hdmi_mode_set()
1067 writel_relaxed(0, priv->io_base + _REG(ENCI_VIDEO_MODE_ADV)); in meson_venc_hdmi_mode_set()
1070 writel_relaxed(vmode->enci.hso_begin, in meson_venc_hdmi_mode_set()
1071 priv->io_base + _REG(ENCI_SYNC_HSO_BEGIN)); in meson_venc_hdmi_mode_set()
1072 writel_relaxed(vmode->enci.hso_end, in meson_venc_hdmi_mode_set()
1073 priv->io_base + _REG(ENCI_SYNC_HSO_END)); in meson_venc_hdmi_mode_set()
1076 writel_relaxed(vmode->enci.vso_even, in meson_venc_hdmi_mode_set()
1077 priv->io_base + _REG(ENCI_SYNC_VSO_EVNLN)); in meson_venc_hdmi_mode_set()
1078 writel_relaxed(vmode->enci.vso_odd, in meson_venc_hdmi_mode_set()
1079 priv->io_base + _REG(ENCI_SYNC_VSO_ODDLN)); in meson_venc_hdmi_mode_set()
1083 ENCI_MACV_MAX_AMP_VAL(vmode->enci.macv_max_amp), in meson_venc_hdmi_mode_set()
1084 priv->io_base + _REG(ENCI_MACV_MAX_AMP)); in meson_venc_hdmi_mode_set()
1087 writel_relaxed(vmode->enci.video_prog_mode, in meson_venc_hdmi_mode_set()
1088 priv->io_base + _REG(VENC_VIDEO_PROG_MODE)); in meson_venc_hdmi_mode_set()
1089 writel_relaxed(vmode->enci.video_mode, in meson_venc_hdmi_mode_set()
1090 priv->io_base + _REG(ENCI_VIDEO_MODE)); in meson_venc_hdmi_mode_set()
1096 * High bandwidth Luma Filter in meson_venc_hdmi_mode_set()
1104 priv->io_base + _REG(ENCI_VIDEO_MODE_ADV)); in meson_venc_hdmi_mode_set()
1106 writel(vmode->enci.sch_adjust, in meson_venc_hdmi_mode_set()
1107 priv->io_base + _REG(ENCI_VIDEO_SCH)); in meson_venc_hdmi_mode_set()
1110 writel_relaxed(0x07, priv->io_base + _REG(ENCI_SYNC_MODE)); in meson_venc_hdmi_mode_set()
1112 if (vmode->enci.yc_delay) in meson_venc_hdmi_mode_set()
1113 writel_relaxed(vmode->enci.yc_delay, in meson_venc_hdmi_mode_set()
1114 priv->io_base + _REG(ENCI_YC_DELAY)); in meson_venc_hdmi_mode_set()
1118 writel_relaxed(0, priv->io_base + _REG(ENCI_DBG_PX_RST)); in meson_venc_hdmi_mode_set()
1130 priv->io_base + _REG(ENCI_VFIFO2VD_CTL)); in meson_venc_hdmi_mode_set()
1133 writel_relaxed(vmode->enci.pixel_start, in meson_venc_hdmi_mode_set()
1134 priv->io_base + _REG(ENCI_VFIFO2VD_PIXEL_START)); in meson_venc_hdmi_mode_set()
1135 writel_relaxed(vmode->enci.pixel_end, in meson_venc_hdmi_mode_set()
1136 priv->io_base + _REG(ENCI_VFIFO2VD_PIXEL_END)); in meson_venc_hdmi_mode_set()
1138 writel_relaxed(vmode->enci.top_field_line_start, in meson_venc_hdmi_mode_set()
1139 priv->io_base + _REG(ENCI_VFIFO2VD_LINE_TOP_START)); in meson_venc_hdmi_mode_set()
1140 writel_relaxed(vmode->enci.top_field_line_end, in meson_venc_hdmi_mode_set()
1141 priv->io_base + _REG(ENCI_VFIFO2VD_LINE_TOP_END)); in meson_venc_hdmi_mode_set()
1143 writel_relaxed(vmode->enci.bottom_field_line_start, in meson_venc_hdmi_mode_set()
1144 priv->io_base + _REG(ENCI_VFIFO2VD_LINE_BOT_START)); in meson_venc_hdmi_mode_set()
1145 writel_relaxed(vmode->enci.bottom_field_line_end, in meson_venc_hdmi_mode_set()
1146 priv->io_base + _REG(ENCI_VFIFO2VD_LINE_BOT_END)); in meson_venc_hdmi_mode_set()
1153 priv->io_base + _REG(ENCI_VIDEO_EN)); in meson_venc_hdmi_mode_set()
1155 lines_f0 = mode->vtotal >> 1; in meson_venc_hdmi_mode_set()
1158 de_h_begin = modulo(readl_relaxed(priv->io_base + in meson_venc_hdmi_mode_set()
1166 priv->io_base + _REG(ENCI_DE_H_BEGIN)); in meson_venc_hdmi_mode_set()
1168 priv->io_base + _REG(ENCI_DE_H_END)); in meson_venc_hdmi_mode_set()
1170 de_v_begin_even = readl_relaxed(priv->io_base + in meson_venc_hdmi_mode_set()
1172 de_v_end_even = de_v_begin_even + mode->vdisplay; in meson_venc_hdmi_mode_set()
1173 de_v_begin_odd = readl_relaxed(priv->io_base + in meson_venc_hdmi_mode_set()
1175 de_v_end_odd = de_v_begin_odd + mode->vdisplay; in meson_venc_hdmi_mode_set()
1178 priv->io_base + _REG(ENCI_DE_V_BEGIN_EVEN)); in meson_venc_hdmi_mode_set()
1180 priv->io_base + _REG(ENCI_DE_V_END_EVEN)); in meson_venc_hdmi_mode_set()
1182 priv->io_base + _REG(ENCI_DE_V_BEGIN_ODD)); in meson_venc_hdmi_mode_set()
1184 priv->io_base + _REG(ENCI_DE_V_END_ODD)); in meson_venc_hdmi_mode_set()
1189 hs_begin -= total_pixels_venc; in meson_venc_hdmi_mode_set()
1199 priv->io_base + _REG(ENCI_DVI_HSO_BEGIN)); in meson_venc_hdmi_mode_set()
1201 priv->io_base + _REG(ENCI_DVI_HSO_END)); in meson_venc_hdmi_mode_set()
1203 /* Program Vsync timing for even field */ in meson_venc_hdmi_mode_set()
1204 if (((de_v_end_odd - 1) + eof_lines + vs_adjust) >= lines_f1) { in meson_venc_hdmi_mode_set()
1205 vs_bline_evn = (de_v_end_odd - 1) in meson_venc_hdmi_mode_set()
1208 - lines_f1; in meson_venc_hdmi_mode_set()
1212 priv->io_base + _REG(ENCI_DVI_VSO_BLINE_EVN)); in meson_venc_hdmi_mode_set()
1215 priv->io_base + _REG(ENCI_DVI_VSO_ELINE_EVN)); in meson_venc_hdmi_mode_set()
1218 priv->io_base + _REG(ENCI_DVI_VSO_BEGIN_EVN)); in meson_venc_hdmi_mode_set()
1220 priv->io_base + _REG(ENCI_DVI_VSO_END_EVN)); in meson_venc_hdmi_mode_set()
1222 vs_bline_odd = (de_v_end_odd - 1) in meson_venc_hdmi_mode_set()
1227 priv->io_base + _REG(ENCI_DVI_VSO_BLINE_ODD)); in meson_venc_hdmi_mode_set()
1230 priv->io_base + _REG(ENCI_DVI_VSO_BEGIN_ODD)); in meson_venc_hdmi_mode_set()
1235 - lines_f1; in meson_venc_hdmi_mode_set()
1237 writel_relaxed(vs_eline_evn, priv->io_base in meson_venc_hdmi_mode_set()
1240 writel_relaxed(hs_begin, priv->io_base in meson_venc_hdmi_mode_set()
1246 writel_relaxed(vs_eline_odd, priv->io_base in meson_venc_hdmi_mode_set()
1249 writel_relaxed(hs_begin, priv->io_base in meson_venc_hdmi_mode_set()
1254 /* Program Vsync timing for odd field */ in meson_venc_hdmi_mode_set()
1255 if (((de_v_end_even - 1) + (eof_lines + 1)) >= lines_f0) { in meson_venc_hdmi_mode_set()
1256 vs_bline_odd = (de_v_end_even - 1) in meson_venc_hdmi_mode_set()
1258 - lines_f0; in meson_venc_hdmi_mode_set()
1262 priv->io_base + _REG(ENCI_DVI_VSO_BLINE_ODD)); in meson_venc_hdmi_mode_set()
1265 priv->io_base + _REG(ENCI_DVI_VSO_ELINE_ODD)); in meson_venc_hdmi_mode_set()
1272 priv->io_base + _REG(ENCI_DVI_VSO_BEGIN_ODD)); in meson_venc_hdmi_mode_set()
1274 priv->io_base + _REG(ENCI_DVI_VSO_END_ODD)); in meson_venc_hdmi_mode_set()
1276 vs_bline_evn = (de_v_end_even - 1) in meson_venc_hdmi_mode_set()
1280 priv->io_base + _REG(ENCI_DVI_VSO_BLINE_EVN)); in meson_venc_hdmi_mode_set()
1286 writel_relaxed(vso_begin_evn, priv->io_base in meson_venc_hdmi_mode_set()
1292 - lines_f0; in meson_venc_hdmi_mode_set()
1294 writel_relaxed(vs_eline_odd, priv->io_base in meson_venc_hdmi_mode_set()
1297 writel_relaxed(vso_begin_evn, priv->io_base in meson_venc_hdmi_mode_set()
1302 writel_relaxed(vs_eline_evn, priv->io_base in meson_venc_hdmi_mode_set()
1305 writel_relaxed(vso_begin_evn, priv->io_base in meson_venc_hdmi_mode_set()
1310 writel_relaxed(vmode->encp.dvi_settings, in meson_venc_hdmi_mode_set()
1311 priv->io_base + _REG(VENC_DVI_SETTING)); in meson_venc_hdmi_mode_set()
1312 writel_relaxed(vmode->encp.video_mode, in meson_venc_hdmi_mode_set()
1313 priv->io_base + _REG(ENCP_VIDEO_MODE)); in meson_venc_hdmi_mode_set()
1314 writel_relaxed(vmode->encp.video_mode_adv, in meson_venc_hdmi_mode_set()
1315 priv->io_base + _REG(ENCP_VIDEO_MODE_ADV)); in meson_venc_hdmi_mode_set()
1316 if (vmode->encp.video_prog_mode_present) in meson_venc_hdmi_mode_set()
1317 writel_relaxed(vmode->encp.video_prog_mode, in meson_venc_hdmi_mode_set()
1318 priv->io_base + _REG(VENC_VIDEO_PROG_MODE)); in meson_venc_hdmi_mode_set()
1319 if (vmode->encp.video_sync_mode_present) in meson_venc_hdmi_mode_set()
1320 writel_relaxed(vmode->encp.video_sync_mode, in meson_venc_hdmi_mode_set()
1321 priv->io_base + _REG(ENCP_VIDEO_SYNC_MODE)); in meson_venc_hdmi_mode_set()
1322 if (vmode->encp.video_yc_dly_present) in meson_venc_hdmi_mode_set()
1323 writel_relaxed(vmode->encp.video_yc_dly, in meson_venc_hdmi_mode_set()
1324 priv->io_base + _REG(ENCP_VIDEO_YC_DLY)); in meson_venc_hdmi_mode_set()
1325 if (vmode->encp.video_rgb_ctrl_present) in meson_venc_hdmi_mode_set()
1326 writel_relaxed(vmode->encp.video_rgb_ctrl, in meson_venc_hdmi_mode_set()
1327 priv->io_base + _REG(ENCP_VIDEO_RGB_CTRL)); in meson_venc_hdmi_mode_set()
1328 if (vmode->encp.video_filt_ctrl_present) in meson_venc_hdmi_mode_set()
1329 writel_relaxed(vmode->encp.video_filt_ctrl, in meson_venc_hdmi_mode_set()
1330 priv->io_base + _REG(ENCP_VIDEO_FILT_CTRL)); in meson_venc_hdmi_mode_set()
1331 if (vmode->encp.video_ofld_voav_ofst_present) in meson_venc_hdmi_mode_set()
1332 writel_relaxed(vmode->encp.video_ofld_voav_ofst, in meson_venc_hdmi_mode_set()
1333 priv->io_base in meson_venc_hdmi_mode_set()
1335 writel_relaxed(vmode->encp.yfp1_htime, in meson_venc_hdmi_mode_set()
1336 priv->io_base + _REG(ENCP_VIDEO_YFP1_HTIME)); in meson_venc_hdmi_mode_set()
1337 writel_relaxed(vmode->encp.yfp2_htime, in meson_venc_hdmi_mode_set()
1338 priv->io_base + _REG(ENCP_VIDEO_YFP2_HTIME)); in meson_venc_hdmi_mode_set()
1339 writel_relaxed(vmode->encp.max_pxcnt, in meson_venc_hdmi_mode_set()
1340 priv->io_base + _REG(ENCP_VIDEO_MAX_PXCNT)); in meson_venc_hdmi_mode_set()
1341 writel_relaxed(vmode->encp.hspuls_begin, in meson_venc_hdmi_mode_set()
1342 priv->io_base + _REG(ENCP_VIDEO_HSPULS_BEGIN)); in meson_venc_hdmi_mode_set()
1343 writel_relaxed(vmode->encp.hspuls_end, in meson_venc_hdmi_mode_set()
1344 priv->io_base + _REG(ENCP_VIDEO_HSPULS_END)); in meson_venc_hdmi_mode_set()
1345 writel_relaxed(vmode->encp.hspuls_switch, in meson_venc_hdmi_mode_set()
1346 priv->io_base + _REG(ENCP_VIDEO_HSPULS_SWITCH)); in meson_venc_hdmi_mode_set()
1347 writel_relaxed(vmode->encp.vspuls_begin, in meson_venc_hdmi_mode_set()
1348 priv->io_base + _REG(ENCP_VIDEO_VSPULS_BEGIN)); in meson_venc_hdmi_mode_set()
1349 writel_relaxed(vmode->encp.vspuls_end, in meson_venc_hdmi_mode_set()
1350 priv->io_base + _REG(ENCP_VIDEO_VSPULS_END)); in meson_venc_hdmi_mode_set()
1351 writel_relaxed(vmode->encp.vspuls_bline, in meson_venc_hdmi_mode_set()
1352 priv->io_base + _REG(ENCP_VIDEO_VSPULS_BLINE)); in meson_venc_hdmi_mode_set()
1353 writel_relaxed(vmode->encp.vspuls_eline, in meson_venc_hdmi_mode_set()
1354 priv->io_base + _REG(ENCP_VIDEO_VSPULS_ELINE)); in meson_venc_hdmi_mode_set()
1355 if (vmode->encp.eqpuls_begin_present) in meson_venc_hdmi_mode_set()
1356 writel_relaxed(vmode->encp.eqpuls_begin, in meson_venc_hdmi_mode_set()
1357 priv->io_base + _REG(ENCP_VIDEO_EQPULS_BEGIN)); in meson_venc_hdmi_mode_set()
1358 if (vmode->encp.eqpuls_end_present) in meson_venc_hdmi_mode_set()
1359 writel_relaxed(vmode->encp.eqpuls_end, in meson_venc_hdmi_mode_set()
1360 priv->io_base + _REG(ENCP_VIDEO_EQPULS_END)); in meson_venc_hdmi_mode_set()
1361 if (vmode->encp.eqpuls_bline_present) in meson_venc_hdmi_mode_set()
1362 writel_relaxed(vmode->encp.eqpuls_bline, in meson_venc_hdmi_mode_set()
1363 priv->io_base + _REG(ENCP_VIDEO_EQPULS_BLINE)); in meson_venc_hdmi_mode_set()
1364 if (vmode->encp.eqpuls_eline_present) in meson_venc_hdmi_mode_set()
1365 writel_relaxed(vmode->encp.eqpuls_eline, in meson_venc_hdmi_mode_set()
1366 priv->io_base + _REG(ENCP_VIDEO_EQPULS_ELINE)); in meson_venc_hdmi_mode_set()
1367 writel_relaxed(vmode->encp.havon_begin, in meson_venc_hdmi_mode_set()
1368 priv->io_base + _REG(ENCP_VIDEO_HAVON_BEGIN)); in meson_venc_hdmi_mode_set()
1369 writel_relaxed(vmode->encp.havon_end, in meson_venc_hdmi_mode_set()
1370 priv->io_base + _REG(ENCP_VIDEO_HAVON_END)); in meson_venc_hdmi_mode_set()
1371 writel_relaxed(vmode->encp.vavon_bline, in meson_venc_hdmi_mode_set()
1372 priv->io_base + _REG(ENCP_VIDEO_VAVON_BLINE)); in meson_venc_hdmi_mode_set()
1373 writel_relaxed(vmode->encp.vavon_eline, in meson_venc_hdmi_mode_set()
1374 priv->io_base + _REG(ENCP_VIDEO_VAVON_ELINE)); in meson_venc_hdmi_mode_set()
1375 writel_relaxed(vmode->encp.hso_begin, in meson_venc_hdmi_mode_set()
1376 priv->io_base + _REG(ENCP_VIDEO_HSO_BEGIN)); in meson_venc_hdmi_mode_set()
1377 writel_relaxed(vmode->encp.hso_end, in meson_venc_hdmi_mode_set()
1378 priv->io_base + _REG(ENCP_VIDEO_HSO_END)); in meson_venc_hdmi_mode_set()
1379 writel_relaxed(vmode->encp.vso_begin, in meson_venc_hdmi_mode_set()
1380 priv->io_base + _REG(ENCP_VIDEO_VSO_BEGIN)); in meson_venc_hdmi_mode_set()
1381 writel_relaxed(vmode->encp.vso_end, in meson_venc_hdmi_mode_set()
1382 priv->io_base + _REG(ENCP_VIDEO_VSO_END)); in meson_venc_hdmi_mode_set()
1383 writel_relaxed(vmode->encp.vso_bline, in meson_venc_hdmi_mode_set()
1384 priv->io_base + _REG(ENCP_VIDEO_VSO_BLINE)); in meson_venc_hdmi_mode_set()
1385 if (vmode->encp.vso_eline_present) in meson_venc_hdmi_mode_set()
1386 writel_relaxed(vmode->encp.vso_eline, in meson_venc_hdmi_mode_set()
1387 priv->io_base + _REG(ENCP_VIDEO_VSO_ELINE)); in meson_venc_hdmi_mode_set()
1388 if (vmode->encp.sy_val_present) in meson_venc_hdmi_mode_set()
1389 writel_relaxed(vmode->encp.sy_val, in meson_venc_hdmi_mode_set()
1390 priv->io_base + _REG(ENCP_VIDEO_SY_VAL)); in meson_venc_hdmi_mode_set()
1391 if (vmode->encp.sy2_val_present) in meson_venc_hdmi_mode_set()
1392 writel_relaxed(vmode->encp.sy2_val, in meson_venc_hdmi_mode_set()
1393 priv->io_base + _REG(ENCP_VIDEO_SY2_VAL)); in meson_venc_hdmi_mode_set()
1394 writel_relaxed(vmode->encp.max_lncnt, in meson_venc_hdmi_mode_set()
1395 priv->io_base + _REG(ENCP_VIDEO_MAX_LNCNT)); in meson_venc_hdmi_mode_set()
1397 writel_relaxed(1, priv->io_base + _REG(ENCP_VIDEO_EN)); in meson_venc_hdmi_mode_set()
1399 /* Set DE signal’s polarity is active high */ in meson_venc_hdmi_mode_set()
1402 priv->io_base + _REG(ENCP_VIDEO_MODE)); in meson_venc_hdmi_mode_set()
1405 de_h_begin = modulo(readl_relaxed(priv->io_base + in meson_venc_hdmi_mode_set()
1413 priv->io_base + _REG(ENCP_DE_H_BEGIN)); in meson_venc_hdmi_mode_set()
1415 priv->io_base + _REG(ENCP_DE_H_END)); in meson_venc_hdmi_mode_set()
1418 de_v_begin_even = readl_relaxed(priv->io_base in meson_venc_hdmi_mode_set()
1420 if (mode->flags & DRM_MODE_FLAG_INTERLACE) in meson_venc_hdmi_mode_set()
1422 (mode->vdisplay / 2); in meson_venc_hdmi_mode_set()
1424 de_v_end_even = de_v_begin_even + mode->vdisplay; in meson_venc_hdmi_mode_set()
1427 priv->io_base + _REG(ENCP_DE_V_BEGIN_EVEN)); in meson_venc_hdmi_mode_set()
1429 priv->io_base + _REG(ENCP_DE_V_END_EVEN)); in meson_venc_hdmi_mode_set()
1432 if (mode->flags & DRM_MODE_FLAG_INTERLACE) { in meson_venc_hdmi_mode_set()
1434 readl_relaxed(priv->io_base + in meson_venc_hdmi_mode_set()
1438 + ((mode->vtotal - 1) / 2); in meson_venc_hdmi_mode_set()
1439 de_v_end_odd = de_v_begin_odd + (mode->vdisplay / 2); in meson_venc_hdmi_mode_set()
1442 priv->io_base + _REG(ENCP_DE_V_BEGIN_ODD)); in meson_venc_hdmi_mode_set()
1444 priv->io_base + _REG(ENCP_DE_V_END_ODD)); in meson_venc_hdmi_mode_set()
1451 - total_pixels_venc; in meson_venc_hdmi_mode_set()
1463 priv->io_base + _REG(ENCP_DVI_HSO_BEGIN)); in meson_venc_hdmi_mode_set()
1465 priv->io_base + _REG(ENCP_DVI_HSO_END)); in meson_venc_hdmi_mode_set()
1467 /* Program Vsync timing for even field */ in meson_venc_hdmi_mode_set()
1469 (sof_lines + vsync_lines + (1 - vs_adjust))) in meson_venc_hdmi_mode_set()
1471 - sof_lines in meson_venc_hdmi_mode_set()
1472 - vsync_lines in meson_venc_hdmi_mode_set()
1473 - (1 - vs_adjust); in meson_venc_hdmi_mode_set()
1475 vs_bline_evn = mode->vtotal in meson_venc_hdmi_mode_set()
1477 - sof_lines in meson_venc_hdmi_mode_set()
1478 - vsync_lines in meson_venc_hdmi_mode_set()
1479 - (1 - vs_adjust); in meson_venc_hdmi_mode_set()
1482 mode->vtotal); in meson_venc_hdmi_mode_set()
1485 priv->io_base + _REG(ENCP_DVI_VSO_BLINE_EVN)); in meson_venc_hdmi_mode_set()
1487 priv->io_base + _REG(ENCP_DVI_VSO_ELINE_EVN)); in meson_venc_hdmi_mode_set()
1491 priv->io_base + _REG(ENCP_DVI_VSO_BEGIN_EVN)); in meson_venc_hdmi_mode_set()
1493 priv->io_base + _REG(ENCP_DVI_VSO_END_EVN)); in meson_venc_hdmi_mode_set()
1495 /* Program Vsync timing for odd field if needed */ in meson_venc_hdmi_mode_set()
1496 if (mode->flags & DRM_MODE_FLAG_INTERLACE) { in meson_venc_hdmi_mode_set()
1497 vs_bline_odd = (de_v_begin_odd - 1) in meson_venc_hdmi_mode_set()
1498 - sof_lines in meson_venc_hdmi_mode_set()
1499 - vsync_lines; in meson_venc_hdmi_mode_set()
1500 vs_eline_odd = (de_v_begin_odd - 1) in meson_venc_hdmi_mode_set()
1501 - vsync_lines; in meson_venc_hdmi_mode_set()
1507 priv->io_base + _REG(ENCP_DVI_VSO_BLINE_ODD)); in meson_venc_hdmi_mode_set()
1509 priv->io_base + _REG(ENCP_DVI_VSO_ELINE_ODD)); in meson_venc_hdmi_mode_set()
1511 priv->io_base + _REG(ENCP_DVI_VSO_BEGIN_ODD)); in meson_venc_hdmi_mode_set()
1513 priv->io_base + _REG(ENCP_DVI_VSO_END_ODD)); in meson_venc_hdmi_mode_set()
1527 /* Invert polarity of HSYNC from VENC */ in meson_venc_hdmi_mode_set()
1528 if (mode->flags & DRM_MODE_FLAG_PHSYNC) in meson_venc_hdmi_mode_set()
1531 /* Invert polarity of VSYNC from VENC */ in meson_venc_hdmi_mode_set()
1532 if (mode->flags & DRM_MODE_FLAG_PVSYNC) in meson_venc_hdmi_mode_set()
1552 writel_relaxed(reg, priv->io_base + _REG(VPU_HDMI_SETTING)); in meson_venc_hdmi_mode_set()
1554 priv->venc.hdmi_repeat = hdmi_repeat; in meson_venc_hdmi_mode_set()
1555 priv->venc.venc_repeat = venc_repeat; in meson_venc_hdmi_mode_set()
1556 priv->venc.hdmi_use_enci = use_enci; in meson_venc_hdmi_mode_set()
1558 priv->venc.current_mode = MESON_VENC_MODE_HDMI; in meson_venc_hdmi_mode_set()
1588 priv->io_base + _REG(L_GAMMA_CNTL_PORT)); in meson_encl_set_gamma_table()
1590 ret = readl_relaxed_poll_timeout(priv->io_base + _REG(L_GAMMA_CNTL_PORT), in meson_encl_set_gamma_table()
1597 priv->io_base + _REG(L_GAMMA_ADDR_PORT)); in meson_encl_set_gamma_table()
1600 ret = readl_relaxed_poll_timeout(priv->io_base + _REG(L_GAMMA_CNTL_PORT), in meson_encl_set_gamma_table()
1606 writel_relaxed(data[i], priv->io_base + _REG(L_GAMMA_DATA_PORT)); in meson_encl_set_gamma_table()
1609 ret = readl_relaxed_poll_timeout(priv->io_base + _REG(L_GAMMA_CNTL_PORT), in meson_encl_set_gamma_table()
1616 priv->io_base + _REG(L_GAMMA_ADDR_PORT)); in meson_encl_set_gamma_table()
1626 priv->io_base + _REG(L_GAMMA_CNTL_PORT)); in meson_encl_load_gamma()
1645 max_pxcnt = mode->htotal - 1; in meson_venc_mipi_dsi_mode_set()
1646 max_lncnt = mode->vtotal - 1; in meson_venc_mipi_dsi_mode_set()
1647 havon_begin = mode->htotal - mode->hsync_start; in meson_venc_mipi_dsi_mode_set()
1648 havon_end = havon_begin + mode->hdisplay - 1; in meson_venc_mipi_dsi_mode_set()
1649 vavon_bline = mode->vtotal - mode->vsync_start; in meson_venc_mipi_dsi_mode_set()
1650 vavon_eline = vavon_bline + mode->vdisplay - 1; in meson_venc_mipi_dsi_mode_set()
1652 hso_end = mode->hsync_end - mode->hsync_start; in meson_venc_mipi_dsi_mode_set()
1656 vso_eline = mode->vsync_end - mode->vsync_start; in meson_venc_mipi_dsi_mode_set()
1660 writel_relaxed(0, priv->io_base + _REG(ENCL_VIDEO_EN)); in meson_venc_mipi_dsi_mode_set()
1662 writel_relaxed(ENCL_PX_LN_CNT_SHADOW_EN, priv->io_base + _REG(ENCL_VIDEO_MODE)); in meson_venc_mipi_dsi_mode_set()
1665 ENCL_SEL_GAMMA_RGB_IN, priv->io_base + _REG(ENCL_VIDEO_MODE_ADV)); in meson_venc_mipi_dsi_mode_set()
1668 priv->io_base + _REG(ENCL_VIDEO_FILT_CTRL)); in meson_venc_mipi_dsi_mode_set()
1669 writel_relaxed(max_pxcnt, priv->io_base + _REG(ENCL_VIDEO_MAX_PXCNT)); in meson_venc_mipi_dsi_mode_set()
1670 writel_relaxed(max_lncnt, priv->io_base + _REG(ENCL_VIDEO_MAX_LNCNT)); in meson_venc_mipi_dsi_mode_set()
1671 writel_relaxed(havon_begin, priv->io_base + _REG(ENCL_VIDEO_HAVON_BEGIN)); in meson_venc_mipi_dsi_mode_set()
1672 writel_relaxed(havon_end, priv->io_base + _REG(ENCL_VIDEO_HAVON_END)); in meson_venc_mipi_dsi_mode_set()
1673 writel_relaxed(vavon_bline, priv->io_base + _REG(ENCL_VIDEO_VAVON_BLINE)); in meson_venc_mipi_dsi_mode_set()
1674 writel_relaxed(vavon_eline, priv->io_base + _REG(ENCL_VIDEO_VAVON_ELINE)); in meson_venc_mipi_dsi_mode_set()
1676 writel_relaxed(hso_begin, priv->io_base + _REG(ENCL_VIDEO_HSO_BEGIN)); in meson_venc_mipi_dsi_mode_set()
1677 writel_relaxed(hso_end, priv->io_base + _REG(ENCL_VIDEO_HSO_END)); in meson_venc_mipi_dsi_mode_set()
1678 writel_relaxed(vso_begin, priv->io_base + _REG(ENCL_VIDEO_VSO_BEGIN)); in meson_venc_mipi_dsi_mode_set()
1679 writel_relaxed(vso_end, priv->io_base + _REG(ENCL_VIDEO_VSO_END)); in meson_venc_mipi_dsi_mode_set()
1680 writel_relaxed(vso_bline, priv->io_base + _REG(ENCL_VIDEO_VSO_BLINE)); in meson_venc_mipi_dsi_mode_set()
1681 writel_relaxed(vso_eline, priv->io_base + _REG(ENCL_VIDEO_VSO_ELINE)); in meson_venc_mipi_dsi_mode_set()
1683 priv->io_base + _REG(ENCL_VIDEO_RGBIN_CTRL)); in meson_venc_mipi_dsi_mode_set()
1686 writel_relaxed(0, priv->io_base + _REG(ENCL_TST_MDSEL)); in meson_venc_mipi_dsi_mode_set()
1687 writel_relaxed(0, priv->io_base + _REG(ENCL_TST_Y)); in meson_venc_mipi_dsi_mode_set()
1688 writel_relaxed(0, priv->io_base + _REG(ENCL_TST_CB)); in meson_venc_mipi_dsi_mode_set()
1689 writel_relaxed(0, priv->io_base + _REG(ENCL_TST_CR)); in meson_venc_mipi_dsi_mode_set()
1690 writel_relaxed(1, priv->io_base + _REG(ENCL_TST_EN)); in meson_venc_mipi_dsi_mode_set()
1692 priv->io_base + _REG(ENCL_VIDEO_MODE_ADV)); in meson_venc_mipi_dsi_mode_set()
1694 writel_relaxed(1, priv->io_base + _REG(ENCL_VIDEO_EN)); in meson_venc_mipi_dsi_mode_set()
1696 writel_relaxed(0, priv->io_base + _REG(L_RGB_BASE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1697 writel_relaxed(0x400, priv->io_base + _REG(L_RGB_COEFF_ADDR)); /* Magic value */ in meson_venc_mipi_dsi_mode_set()
1699 writel_relaxed(L_DITH_CNTL_DITH10_EN, priv->io_base + _REG(L_DITH_CNTL_ADDR)); in meson_venc_mipi_dsi_mode_set()
1702 writel_relaxed(havon_begin, priv->io_base + _REG(L_OEH_HS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1703 writel_relaxed(havon_end + 1, priv->io_base + _REG(L_OEH_HE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1704 writel_relaxed(vavon_bline, priv->io_base + _REG(L_OEH_VS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1705 writel_relaxed(vavon_eline, priv->io_base + _REG(L_OEH_VE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1708 writel_relaxed(havon_begin, priv->io_base + _REG(L_OEV1_HS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1709 writel_relaxed(havon_end + 1, priv->io_base + _REG(L_OEV1_HE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1710 writel_relaxed(vavon_bline, priv->io_base + _REG(L_OEV1_VS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1711 writel_relaxed(vavon_eline, priv->io_base + _REG(L_OEV1_VE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1714 if (mode->flags & DRM_MODE_FLAG_PHSYNC) { in meson_venc_mipi_dsi_mode_set()
1715 writel_relaxed(hso_begin, priv->io_base + _REG(L_STH1_HS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1716 writel_relaxed(hso_end, priv->io_base + _REG(L_STH1_HE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1718 writel_relaxed(hso_end, priv->io_base + _REG(L_STH1_HS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1719 writel_relaxed(hso_begin, priv->io_base + _REG(L_STH1_HE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1721 writel_relaxed(0, priv->io_base + _REG(L_STH1_VS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1722 writel_relaxed(max_lncnt, priv->io_base + _REG(L_STH1_VE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1724 /* Vsync signal for TTL */ in meson_venc_mipi_dsi_mode_set()
1725 writel_relaxed(vso_begin, priv->io_base + _REG(L_STV1_HS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1726 writel_relaxed(vso_end, priv->io_base + _REG(L_STV1_HE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1727 if (mode->flags & DRM_MODE_FLAG_PVSYNC) { in meson_venc_mipi_dsi_mode_set()
1728 writel_relaxed(vso_bline, priv->io_base + _REG(L_STV1_VS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1729 writel_relaxed(vso_eline, priv->io_base + _REG(L_STV1_VE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1731 writel_relaxed(vso_eline, priv->io_base + _REG(L_STV1_VS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1732 writel_relaxed(vso_bline, priv->io_base + _REG(L_STV1_VE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1736 writel_relaxed(havon_begin, priv->io_base + _REG(L_DE_HS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1737 writel_relaxed(havon_end + 1, priv->io_base + _REG(L_DE_HE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1738 writel_relaxed(vavon_bline, priv->io_base + _REG(L_DE_VS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1739 writel_relaxed(vavon_eline, priv->io_base + _REG(L_DE_VE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1742 writel_relaxed(hso_begin, priv->io_base + _REG(L_HSYNC_HS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1743 writel_relaxed(hso_end, priv->io_base + _REG(L_HSYNC_HE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1744 writel_relaxed(0, priv->io_base + _REG(L_HSYNC_VS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1745 writel_relaxed(max_lncnt, priv->io_base + _REG(L_HSYNC_VE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1747 /* Vsync signal */ in meson_venc_mipi_dsi_mode_set()
1748 writel_relaxed(vso_begin, priv->io_base + _REG(L_VSYNC_HS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1749 writel_relaxed(vso_end, priv->io_base + _REG(L_VSYNC_HE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1750 writel_relaxed(vso_bline, priv->io_base + _REG(L_VSYNC_VS_ADDR)); in meson_venc_mipi_dsi_mode_set()
1751 writel_relaxed(vso_eline, priv->io_base + _REG(L_VSYNC_VE_ADDR)); in meson_venc_mipi_dsi_mode_set()
1753 writel_relaxed(0, priv->io_base + _REG(L_INV_CNT_ADDR)); in meson_venc_mipi_dsi_mode_set()
1755 priv->io_base + _REG(L_TCON_MISC_SEL_ADDR)); in meson_venc_mipi_dsi_mode_set()
1757 priv->venc.current_mode = MESON_VENC_MODE_MIPI_DSI; in meson_venc_mipi_dsi_mode_set()
1766 if (mode->mode_tag == priv->venc.current_mode) in meson_venci_cvbs_mode_set()
1771 priv->io_base + _REG(ENCI_CFILT_CTRL)); in meson_venci_cvbs_mode_set()
1774 priv->io_base + _REG(ENCI_CFILT_CTRL2)); in meson_venci_cvbs_mode_set()
1777 writel_relaxed(0, priv->io_base + _REG(VENC_DVI_SETTING)); in meson_venci_cvbs_mode_set()
1780 writel_relaxed(0, priv->io_base + _REG(ENCI_VIDEO_MODE)); in meson_venci_cvbs_mode_set()
1781 writel_relaxed(0, priv->io_base + _REG(ENCI_VIDEO_MODE_ADV)); in meson_venci_cvbs_mode_set()
1784 writel_relaxed(mode->hso_begin, in meson_venci_cvbs_mode_set()
1785 priv->io_base + _REG(ENCI_SYNC_HSO_BEGIN)); in meson_venci_cvbs_mode_set()
1786 writel_relaxed(mode->hso_end, in meson_venci_cvbs_mode_set()
1787 priv->io_base + _REG(ENCI_SYNC_HSO_END)); in meson_venci_cvbs_mode_set()
1790 writel_relaxed(mode->vso_even, in meson_venci_cvbs_mode_set()
1791 priv->io_base + _REG(ENCI_SYNC_VSO_EVNLN)); in meson_venci_cvbs_mode_set()
1792 writel_relaxed(mode->vso_odd, in meson_venci_cvbs_mode_set()
1793 priv->io_base + _REG(ENCI_SYNC_VSO_ODDLN)); in meson_venci_cvbs_mode_set()
1797 ENCI_MACV_MAX_AMP_VAL(mode->macv_max_amp), in meson_venci_cvbs_mode_set()
1798 priv->io_base + _REG(ENCI_MACV_MAX_AMP)); in meson_venci_cvbs_mode_set()
1801 writel_relaxed(mode->video_prog_mode, in meson_venci_cvbs_mode_set()
1802 priv->io_base + _REG(VENC_VIDEO_PROG_MODE)); in meson_venci_cvbs_mode_set()
1803 writel_relaxed(mode->video_mode, in meson_venci_cvbs_mode_set()
1804 priv->io_base + _REG(ENCI_VIDEO_MODE)); in meson_venci_cvbs_mode_set()
1810 * High bandwidth Luma Filter in meson_venci_cvbs_mode_set()
1818 priv->io_base + _REG(ENCI_VIDEO_MODE_ADV)); in meson_venci_cvbs_mode_set()
1820 writel(mode->sch_adjust, priv->io_base + _REG(ENCI_VIDEO_SCH)); in meson_venci_cvbs_mode_set()
1823 writel_relaxed(0x07, priv->io_base + _REG(ENCI_SYNC_MODE)); in meson_venci_cvbs_mode_set()
1826 writel_relaxed(mode->yc_delay, priv->io_base + _REG(ENCI_YC_DELAY)); in meson_venci_cvbs_mode_set()
1829 writel_relaxed(mode->pixel_start, in meson_venci_cvbs_mode_set()
1830 priv->io_base + _REG(ENCI_VFIFO2VD_PIXEL_START)); in meson_venci_cvbs_mode_set()
1831 writel_relaxed(mode->pixel_end, in meson_venci_cvbs_mode_set()
1832 priv->io_base + _REG(ENCI_VFIFO2VD_PIXEL_END)); in meson_venci_cvbs_mode_set()
1834 writel_relaxed(mode->top_field_line_start, in meson_venci_cvbs_mode_set()
1835 priv->io_base + _REG(ENCI_VFIFO2VD_LINE_TOP_START)); in meson_venci_cvbs_mode_set()
1836 writel_relaxed(mode->top_field_line_end, in meson_venci_cvbs_mode_set()
1837 priv->io_base + _REG(ENCI_VFIFO2VD_LINE_TOP_END)); in meson_venci_cvbs_mode_set()
1839 writel_relaxed(mode->bottom_field_line_start, in meson_venci_cvbs_mode_set()
1840 priv->io_base + _REG(ENCI_VFIFO2VD_LINE_BOT_START)); in meson_venci_cvbs_mode_set()
1841 writel_relaxed(mode->bottom_field_line_end, in meson_venci_cvbs_mode_set()
1842 priv->io_base + _REG(ENCI_VFIFO2VD_LINE_BOT_END)); in meson_venci_cvbs_mode_set()
1845 writel_relaxed(0, priv->io_base + _REG(VENC_SYNC_ROUTE)); in meson_venci_cvbs_mode_set()
1848 writel_relaxed(0, priv->io_base + _REG(ENCI_DBG_PX_RST)); in meson_venci_cvbs_mode_set()
1860 priv->io_base + _REG(ENCI_VFIFO2VD_CTL)); in meson_venci_cvbs_mode_set()
1863 writel_relaxed(0, priv->io_base + _REG(VENC_VDAC_SETTING)); in meson_venci_cvbs_mode_set()
1876 * Interlace High Bandwidth Luma in meson_venci_cvbs_mode_set()
1879 priv->io_base + _REG(VENC_UPSAMPLE_CTRL0)); in meson_venci_cvbs_mode_set()
1886 priv->io_base + _REG(VENC_UPSAMPLE_CTRL1)); in meson_venci_cvbs_mode_set()
1893 priv->io_base + _REG(VENC_UPSAMPLE_CTRL2)); in meson_venci_cvbs_mode_set()
1896 writel_relaxed(0, priv->io_base + _REG(VENC_VDAC_DACSEL0)); in meson_venci_cvbs_mode_set()
1897 writel_relaxed(0, priv->io_base + _REG(VENC_VDAC_DACSEL1)); in meson_venci_cvbs_mode_set()
1898 writel_relaxed(0, priv->io_base + _REG(VENC_VDAC_DACSEL2)); in meson_venci_cvbs_mode_set()
1899 writel_relaxed(0, priv->io_base + _REG(VENC_VDAC_DACSEL3)); in meson_venci_cvbs_mode_set()
1900 writel_relaxed(0, priv->io_base + _REG(VENC_VDAC_DACSEL4)); in meson_venci_cvbs_mode_set()
1901 writel_relaxed(0, priv->io_base + _REG(VENC_VDAC_DACSEL5)); in meson_venci_cvbs_mode_set()
1908 priv->io_base + _REG(VENC_VDAC_FIFO_CTRL)); in meson_venci_cvbs_mode_set()
1911 writel_relaxed(0x11, priv->io_base + _REG(ENCI_DACSEL_0)); in meson_venci_cvbs_mode_set()
1912 writel_relaxed(0x11, priv->io_base + _REG(ENCI_DACSEL_1)); in meson_venci_cvbs_mode_set()
1916 priv->io_base + _REG(ENCI_VIDEO_EN)); in meson_venci_cvbs_mode_set()
1919 writel_relaxed(mode->video_saturation, in meson_venci_cvbs_mode_set()
1920 priv->io_base + _REG(ENCI_VIDEO_SAT)); in meson_venci_cvbs_mode_set()
1921 writel_relaxed(mode->video_contrast, in meson_venci_cvbs_mode_set()
1922 priv->io_base + _REG(ENCI_VIDEO_CONT)); in meson_venci_cvbs_mode_set()
1923 writel_relaxed(mode->video_brightness, in meson_venci_cvbs_mode_set()
1924 priv->io_base + _REG(ENCI_VIDEO_BRIGHT)); in meson_venci_cvbs_mode_set()
1925 writel_relaxed(mode->video_hue, in meson_venci_cvbs_mode_set()
1926 priv->io_base + _REG(ENCI_VIDEO_HUE)); in meson_venci_cvbs_mode_set()
1930 priv->io_base + _REG(VENC_VDAC_DAC0_FILT_CTRL0)); in meson_venci_cvbs_mode_set()
1931 writel_relaxed(0xfc48, priv->io_base + _REG(VENC_VDAC_DAC0_FILT_CTRL1)); in meson_venci_cvbs_mode_set()
1934 writel_relaxed(0, priv->io_base + _REG(ENCI_MACV_N0)); in meson_venci_cvbs_mode_set()
1937 writel_relaxed(mode->analog_sync_adj, in meson_venci_cvbs_mode_set()
1938 priv->io_base + _REG(ENCI_SYNC_ADJ)); in meson_venci_cvbs_mode_set()
1940 priv->venc.current_mode = mode->mode_tag; in meson_venci_cvbs_mode_set()
1943 /* Returns the current ENCI field polarity */
1946 return readl_relaxed(priv->io_base + _REG(ENCI_INFO_READ)) & BIT(29); in meson_venci_get_field()
1951 switch (priv->venc.current_mode) { in meson_venc_enable_vsync()
1954 priv->io_base + _REG(VENC_INTCTRL)); in meson_venc_enable_vsync()
1958 priv->io_base + _REG(VENC_INTCTRL)); in meson_venc_enable_vsync()
1960 regmap_update_bits(priv->hhi, HHI_GCLK_MPEG2, BIT(25), BIT(25)); in meson_venc_enable_vsync()
1965 regmap_update_bits(priv->hhi, HHI_GCLK_MPEG2, BIT(25), 0); in meson_venc_disable_vsync()
1966 writel_relaxed(0, priv->io_base + _REG(VENC_INTCTRL)); in meson_venc_disable_vsync()
1973 regmap_write(priv->hhi, HHI_VDAC_CNTL0_G12A, 0); in meson_venc_init()
1974 regmap_write(priv->hhi, HHI_VDAC_CNTL1_G12A, 8); in meson_venc_init()
1976 regmap_write(priv->hhi, HHI_VDAC_CNTL0, 0); in meson_venc_init()
1977 regmap_write(priv->hhi, HHI_VDAC_CNTL1, 8); in meson_venc_init()
1981 writel_relaxed(0xff, priv->io_base + _REG(VENC_VDAC_SETTING)); in meson_venc_init()
1984 regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, 0); in meson_venc_init()
1989 priv->io_base + _REG(VPU_HDMI_SETTING)); in meson_venc_init()
1992 writel_relaxed(0, priv->io_base + _REG(ENCI_VIDEO_EN)); in meson_venc_init()
1993 writel_relaxed(0, priv->io_base + _REG(ENCP_VIDEO_EN)); in meson_venc_init()
1994 writel_relaxed(0, priv->io_base + _REG(ENCL_VIDEO_EN)); in meson_venc_init()
1996 /* Disable VSync IRQ */ in meson_venc_init()
1999 priv->venc.current_mode = MESON_VENC_MODE_NONE; in meson_venc_init()