module_param(vpotch, uint, 0664);
MODULE_PARM_DESC(vpotch, "\n vpotch\n");
-module_param(g_vpotch, uint, 0664);
-MODULE_PARM_DESC(g_vpotch, "\n vpotch\n");
+/* for core2 timing setup tuning */
+/* g_vtotal_add << 24 | g_vsize_add << 16 */
+/* | g_vwidth << 8 | g_vpotch */
+static unsigned int g_vtiming;
+module_param(g_vtiming, uint, 0664);
+MODULE_PARM_DESC(g_vtiming, "\n vpotch\n");
static unsigned int dolby_vision_target_min = 50; /* 0.0001 */
#ifdef V2_4
(debug_dolby_frame + 1 == frame_count))
static int is_graphics_output_off(void)
{
- if (is_meson_g12())
+ if (is_meson_g12() || is_meson_tm2_stbmode())
return !(READ_VPP_REG(OSD1_BLEND_SRC_CTRL) & (0xf<<8))
&& !(READ_VPP_REG(OSD2_BLEND_SRC_CTRL) & (0xf<<8));
else
else
return false;
}
+
bool is_meson_tm2_tvmode(void)
{
if ((is_meson_tm2()) && (tv_mode == 1))
VSYNC_WR_DV_REG(DOLBY_CORE2A_SWAP_CTRL0, 0);
if (is_meson_box() || is_meson_tm2_stbmode() || reset) {
VSYNC_WR_DV_REG(DOLBY_CORE2A_SWAP_CTRL1,
- ((hsize + g_htotal_add) << 16)
- | (vsize + g_vtotal_add + g_vsize_add));
+ ((hsize + g_htotal_add) << 16) | (vsize
+ + ((g_vtiming & 0xff000000) ?
+ ((g_vtiming >> 24) & 0xff) : g_vtotal_add)
+ + ((g_vtiming & 0xff0000) ?
+ ((g_vtiming >> 16) & 0xff) : g_vsize_add)));
VSYNC_WR_DV_REG(DOLBY_CORE2A_SWAP_CTRL2,
- (hsize << 16) | (vsize + g_vsize_add));
+ (hsize << 16) | (vsize
+ + ((g_vtiming & 0xff0000) ?
+ ((g_vtiming >> 16) & 0xff) : g_vsize_add)));
}
if (debug_dolby & 2)
pr_dolby_dbg("g_hpotch %x, g_vpotch %x\n",
g_hpotch, g_vpotch);
VSYNC_WR_DV_REG(DOLBY_CORE2A_SWAP_CTRL3,
- (g_hwidth << 16) | g_vwidth);
+ (g_hwidth << 16) | ((g_vtiming & 0xff00) ?
+ ((g_vtiming >> 8) & 0xff) : g_vwidth));
VSYNC_WR_DV_REG(DOLBY_CORE2A_SWAP_CTRL4,
- (g_hpotch << 16) | g_vpotch);
+ (g_hpotch << 16) | ((g_vtiming & 0xff) ?
+ (g_vtiming & 0xff) : g_vpotch));
if (is_meson_txlx_stbmode() || force_stb_mode)
VSYNC_WR_DV_REG(DOLBY_CORE2A_SWAP_CTRL5, 0xf8000000);
else if (is_meson_g12() || is_meson_tm2_stbmode())
}
return ret;
}
-
-static void apply_stb_core_settings(
- int enable, unsigned int mask,
- bool reset, u32 frame_size, u8 pps_state)
+static void adjust_vpotch(void)
{
const struct vinfo_s *vinfo = get_current_vinfo();
- u32 h_size = (frame_size >> 16) & 0xffff;
- u32 v_size = frame_size & 0xffff;
-#ifdef V2_4
- u32 core1_dm_count = 27;
-#else
- u32 core1_dm_count = 24;
-#endif
- u32 graphics_w = osd_graphic_width;
- u32 graphics_h = osd_graphic_height;
- if (is_dolby_vision_stb_mode()
- && (dolby_vision_flags & FLAG_CERTIFICAION)) {
- graphics_w = dv_cert_graphic_width;
- graphics_h = dv_cert_graphic_height;
- }
if (is_meson_txlx_stbmode()
|| force_stb_mode) {
if ((vinfo->width >= 1920) &&
g_vpotch = 0x60;
else
g_vpotch = 0x20;
- } else if (is_meson_g12() || is_meson_tm2_stbmode()) {
+ } else if (is_meson_g12()) {
if (vinfo) {
if (debug_dolby & 2)
pr_dolby_dbg("vinfo %d %d %d\n",
g_vpotch = 0x20;
} else
g_vpotch = 0x20;
+ } else if (is_meson_tm2_stbmode()) {
+ if (vinfo) {
+ if (debug_dolby & 2)
+ pr_dolby_dbg("vinfo %d %d %d\n",
+ vinfo->width,
+ vinfo->height,
+ vinfo->field_height);
+ if ((vinfo->width < 1280) &&
+ (vinfo->height < 720) &&
+ (vinfo->field_height < 720))
+ g_vpotch = 0x60;
+ else if ((vinfo->width <= 1920) &&
+ (vinfo->height <= 1080) &&
+ (vinfo->field_height <= 1080))
+ g_vpotch = 0x50;
+ else
+ g_vpotch = 0x20;
+ } else
+ g_vpotch = 0x20;
}
+}
+
+static void apply_stb_core_settings(
+ int enable, unsigned int mask,
+ bool reset, u32 frame_size, u8 pps_state)
+{
+ const struct vinfo_s *vinfo = get_current_vinfo();
+ u32 h_size = (frame_size >> 16) & 0xffff;
+ u32 v_size = frame_size & 0xffff;
+#ifdef V2_4
+ u32 core1_dm_count = 27;
+#else
+ u32 core1_dm_count = 24;
+#endif
+ u32 graphics_w = osd_graphic_width;
+ u32 graphics_h = osd_graphic_height;
+
+ if (is_dolby_vision_stb_mode()
+ && (dolby_vision_flags & FLAG_CERTIFICAION)) {
+ graphics_w = dv_cert_graphic_width;
+ graphics_h = dv_cert_graphic_height;
+ }
+ adjust_vpotch();
if (mask & 1) {
if (is_meson_txlx_stbmode()
|| force_stb_mode) {
return 0;
if (dolby_vision_flags & FLAG_DISABLE_DOVI_OUT)
return 0;
+ /* for sink not support 60 dovi */
if ((strstr(vinfo->name, "2160p60hz") != NULL) ||
(strstr(vinfo->name, "2160p50hz") != NULL)) {
if (!vinfo->vout_device->dv_info->sup_2160p60hz)
return 0;
}
+ /* for interlace output */
+ if (vinfo->height != vinfo->field_height)
+ return 0;
return 1;
}
int ret = -1;
unsigned int reg_clk;
unsigned int reg_value;
- struct pq_config_s *pq_config;
- const struct vinfo_s *vinfo = get_current_vinfo();
+ struct pq_config_s *pq_config;
if ((!p_funcs_stb || !p_funcs_tv) && func) {
if (func->control_path && !p_funcs_stb) {
if (!tv_dovi_setting)
return -ENOMEM;
}
- /* adjust core2 setting to work around fixing with 1080p24hz */
- if (is_meson_txlx())
- g_vpotch = 0x20;
- else if (is_meson_g12() || is_meson_tm2_stbmode()) {
- if (vinfo) {
- if ((vinfo->width < 1280) &&
- (vinfo->height < 720) &&
- (vinfo->field_height < 720))
- g_vpotch = 0x60;
- else
- g_vpotch = 0x20;
- } else
- g_vpotch = 0x20;
- } else
- g_vpotch = 0x8;
+ adjust_vpotch();
}
return ret;
}