return hdmirx_hw_check_frame_skip();
}
+bool hdmirx_dv_config(bool en, struct tvin_frontend_s *fe)
+{
+ set_dv_ll_mode(en);
+
+ return true;
+}
+
static struct tvin_state_machine_ops_s hdmirx_sm_ops = {
.nosig = hdmirx_is_nosig,
.fmt_changed = hdmirx_fmt_chg,
.vga_set_param = NULL,
.vga_get_param = NULL,
.check_frame_skip = hdmirx_check_frame_skip,
+ .hdmi_dv_config = hdmirx_dv_config,
};
/*
*
*
*/
-#define RX_VER2 "ver.2019/05/18"
+#define RX_VER2 "ver.2019/07/18"
/*print type*/
#define LOG_EN 0x01
rx_pr("%s-mute:%d\n", __func__, mute);
}
+void set_dv_ll_mode(bool en)
+{
+ if (en) {
+ hdmirx_wr_bits_top(TOP_VID_CNTL, _BIT(17), 1);
+ hdmirx_wr_bits_top(TOP_VID_CNTL, _BIT(19), 1);
+ } else {
+ hdmirx_wr_bits_top(TOP_VID_CNTL, _BIT(17), 0);
+ hdmirx_wr_bits_top(TOP_VID_CNTL, _BIT(19), 0);
+ }
+}
+
/*
* hdmirx_config_video - video mute config
*/
void hdmirx_config_video(void)
{
hdmirx_set_video_mute(0);
+ set_dv_ll_mode(false);
}
/*
extern void hdmirx_set_video_mute(bool mute);
extern void hdmirx_config_video(void);
extern void hdmirx_config_audio(void);
+extern void set_dv_ll_mode(bool en);
extern void rx_get_audinfo(struct aud_info_s *audio_info);
extern bool rx_clkrate_monitor(void);
struct tvin_frontend_s *fe);
bool (*check_frame_skip)(struct tvin_frontend_s *fe);
bool (*get_secam_phase)(struct tvin_frontend_s *fe);
+ bool (*hdmi_dv_config)(bool en, struct tvin_frontend_s *fe);
};
struct tvin_frontend_s {
/* #include <mach/am_regs.h> */
#include <linux/amlogic/iomap.h>
#include <linux/amlogic/cpu_version.h>
+#include <linux/amlogic/media/vfm/vframe.h>
#ifdef TVBUS_REG_ADDR
#define R_APB_REG(reg) aml_read_reg32(TVBUS_REG_ADDR(reg))
unsigned int vdin_hdr_Flag;
enum tvin_color_fmt_range_e color_fmt_range;
struct tvin_hdr_info_s hdr_info;
+ struct tvin_dv_vsif_s dv_vsif;/*dolby vsi info*/
bool dolby_vision;/*is signal dolby version*/
bool low_latency;/*is low latency dolby mode*/
uint8_t fps;
}
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
if ((devp->dv.dolby_input & (1 << devp->index)) ||
- (devp->dv.dv_flag && is_dolby_vision_enable()))
- format_convert = VDIN_FORMAT_CONVERT_YUV_YUV444;
+ (devp->dv.dv_flag && is_dolby_vision_enable())) {
+ if (devp->dv.low_latency) {
+ if (devp->prop.color_format == TVIN_YUV422)
+ format_convert = VDIN_FORMAT_CONVERT_YUV_YUV444;
+ else if (devp->prop.color_format == TVIN_RGB444)
+ format_convert = VDIN_FORMAT_CONVERT_RGB_RGB;
+ } else
+ format_convert = VDIN_FORMAT_CONVERT_YUV_YUV444;
+ }
#endif
devp->format_convert = format_convert;
}
devp->prop.hs, devp->prop.he,
devp->prop.vs, devp->prop.ve);
}
+ if (vdin_ctl_dbg)
+ pr_info("h_active=%d, v_active=%d\n",
+ devp->h_active, devp->v_active);
}
devp->prop.color_fmt_range,
devp->prop.vdin_hdr_Flag,
devp->color_range_mode);
-#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
+ #ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
if ((devp->dv.dolby_input & (1 << devp->index)) ||
(devp->dv.dv_flag && is_dolby_vision_enable()) ||
devp->parm.info.fmt == TVIN_SIG_FMT_CVBS_SECAM)
wr_bits(offset, VDIN_MATRIX_CTRL, 0,
VDIN_MATRIX_EN_BIT, VDIN_MATRIX_EN_WID);
-#endif
+ #endif
wr_bits(offset, VDIN_MATRIX_CTRL, 3,
VDIN_PROBE_SEL_BIT, VDIN_PROBE_SEL_WID);
} else {
devp->bt_path);
}
+void vdin_set_dolby_ll_tunnel(struct vdin_dev_s *devp)
+{
+ unsigned int vdin_data_bus_0 = VDIN_MAP_BPB;
+ unsigned int vdin_data_bus_1 = VDIN_MAP_Y_G;
+ unsigned int vdin_data_bus_2 = VDIN_MAP_RCR;
+ unsigned int offset;
+ struct tvin_state_machine_ops_s *sm_ops;
+
+ /* avoid null pointer oops */
+ if (!devp || !(devp->frontend) || !(devp->frontend->sm_ops)
+ || !(devp->frontend->sm_ops->hdmi_dv_config))
+ return;
+
+ if ((devp->dv.dv_flag) && is_dolby_vision_enable()
+ && (devp->dv.low_latency)
+ && (devp->prop.color_format == TVIN_YUV422)) {
+ offset = devp->addr_offset;
+ wr_bits(offset, VDIN_COM_CTRL0, vdin_data_bus_0,
+ COMP0_OUT_SWT_BIT, COMP0_OUT_SWT_WID);
+ wr_bits(offset, VDIN_COM_CTRL0, vdin_data_bus_1,
+ COMP1_OUT_SWT_BIT, COMP1_OUT_SWT_WID);
+ wr_bits(offset, VDIN_COM_CTRL0, vdin_data_bus_2,
+ COMP2_OUT_SWT_BIT, COMP2_OUT_SWT_WID);
+ sm_ops = devp->frontend->sm_ops;
+ sm_ops->hdmi_dv_config(true, devp->frontend);
+ }
+}
+
static void vdin_delay_line(unsigned short num, unsigned int offset)
{
wr_bits(offset, VDIN_COM_CTRL0, num,
/* else */
/* aml_write_cbus(HHI_VDIN_MEAS_CLK_CNTL, 0x00000000); */
vdin_hw_disable(offset);
+ vdin_dobly_mdata_write_en(offset, false);
}
}
#if 0
wr_bits(offset, VDIN_WR_CTRL2, 1,
VDIN_WR_10BIT_MODE_BIT, VDIN_WR_10BIT_MODE_WID);
break;
+ /*
+ * vdin not support 12bit now, when rx submit is 12bit,
+ * vdin config it as 10bit , 12 to 10
+ */
+ case COLOR_DEEPS_12BIT:
+ devp->source_bitdepth = 10;
+ wr_bits(offset, VDIN_WR_CTRL2, 1,
+ VDIN_WR_10BIT_MODE_BIT, VDIN_WR_10BIT_MODE_WID);
+ break;
case COLOR_DEEPS_AUTO:
/* vdin_bit_depth is set to 0 by defaut, in this case,
devp->source_bitdepth is controlled by colordepth
unsigned int offset = devp->addr_offset;
devp->dv.dv_config = 1;
+ devp->vfp->low_latency = devp->dv.low_latency;
+ memcpy(&devp->vfp->dv_vsif,
+ &devp->dv.dv_vsif, sizeof(struct tvin_dv_vsif_s));
wr_bits(offset, VDIN_DOLBY_DSC_CTRL0, 1, 30, 1);
wr_bits(offset, VDIN_DOLBY_DSC_CTRL0, 1, 26, 1);
wr_bits(offset, VDIN_DOLBY_DSC_CTRL0, 0, 26, 1);
wr_bits(offset, VDIN_DOLBY_AXI_CTRL0, 1, 5, 1);
wr_bits(offset, VDIN_DOLBY_AXI_CTRL0, 0, 5, 1);
wr_bits(offset, VDIN_DOLBY_AXI_CTRL0, 0, 4, 1);
+ /*enable wr memory*/
+ vdin_dobly_mdata_write_en(offset, 1);
} else {
+ /*disable wr memory*/
+ vdin_dobly_mdata_write_en(offset, 0);
wr(offset, VDIN_DOLBY_DSC_CTRL2, 0x5180c0d5);
wr(offset, VDIN_DOLBY_DSC_CTRL3, 0x0);
}
}
+void vdin_dobly_mdata_write_en(unsigned int offset, unsigned int en)
+{
+ /*printk("=========>> wr memory %d\n", en);*/
+ if (en) {
+ /*enable write metadate to memory*/
+ wr_bits(offset, VDIN_DOLBY_AXI_CTRL0, 1, 30, 1);
+ /*vdin0 dolby meta write enable*/
+ /*W_VCBUS_BIT(0x27af, 1, 2, 1);*/
+ } else {
+ /*disable write metadate to memory*/
+ wr_bits(offset, VDIN_DOLBY_AXI_CTRL0, 0, 30, 1);
+ /*vdin0 dolby meta write disable*/
+ /*W_VCBUS_BIT(0x27af, 0, 2, 1);*/
+ }
+}
+
unsigned int vdin0_afbce_debug_force;
int vdin_event_cb(int type, void *data, void *op_arg)
{
req->aux_size = 0;
req->dv_enhance_exist = 0;
/* TODO: need change the low latency flag when LL mode */
- req->low_latency = 0;
+ req->low_latency = p->low_latency;
+ memcpy(&req->dv_vsif,
+ &p->dv_vsif, sizeof(struct tvin_dv_vsif_s));
+
if (req->bot_flag)
index = (req->vf->index >> 8) & 0xff;
if (index != 0xff
if (devp->afbce_mode_pre)
type |= VIDTYPE_COMB_MODE;
} else if ((format_convert == VDIN_FORMAT_CONVERT_YUV_YUV422) ||
- (format_convert == VDIN_FORMAT_CONVERT_RGB_YUV422))
+ (format_convert == VDIN_FORMAT_CONVERT_RGB_YUV422)) {
type |= VIDTYPE_VIU_422;
- else if (devp->prop.dest_cfmt == TVIN_NV21) {
+ } else if ((format_convert == VDIN_FORMAT_CONVERT_YUV_RGB) ||
+ (format_convert == VDIN_FORMAT_CONVERT_RGB_RGB)) {
+ type |= VIDTYPE_RGB_444;
+ } else if (devp->prop.dest_cfmt == TVIN_NV21) {
type |= VIDTYPE_VIU_NV21;
type &= (~VIDTYPE_VIU_SINGLE_PLANE);
} else if (devp->prop.dest_cfmt == TVIN_NV12) {
/* type |= VIDTYPE_VIU_NV12; */
type &= (~VIDTYPE_VIU_SINGLE_PLANE);
-
}
if (devp->afbce_valid)
}
}
-
extern void vdin_vlock_input_sel(unsigned int type,
enum vframe_source_type_e source_type);
-
+extern void vdin_set_dolby_ll_tunnel(struct vdin_dev_s *devp);
extern void vdin_check_hdmi_hdr(struct vdin_dev_s *devp);
+extern void vdin_dobly_mdata_write_en(unsigned int offset, unsigned int en);
#endif
pr_info("vdin_drop_cnt: %d\n", vdin_drop_cnt);
pr_info("game_mode cfg : 0x%x\n", game_mode);
pr_info("game_mode cur: 0x%x\n", devp->game_mode);
- pr_info("dolby_input : %d\n", devp->dv.dolby_input);
- if ((devp->cma_config_en != 1) || !(devp->cma_config_flag & 0x100))
- pr_info("dolby_mem_start = %ld, dolby_mem_size = %d\n",
- (devp->mem_start +
- devp->mem_size - devp->canvas_max_num*dolby_size_byte),
- dolby_size_byte);
- else
- for (i = 0; i < devp->canvas_max_num; i++)
- pr_info("dolby_mem_start[%d] = %ld, dolby_mem_size = %d\n",
- i, (devp->vfmem_start[i] + devp->vfmem_size -
- dolby_size_byte), dolby_size_byte);
- for (i = 0; i < devp->canvas_max_num; i++) {
- pr_info("dv_mem(%d):0x%x\n",
- devp->vfp->dv_buf_size[i],
- devp->vfp->dv_buf_mem[i]);
- }
- pr_info("dv_flag:%d;dv_config:%d,dolby_vision:%d\n",
- devp->dv.dv_flag, devp->dv.dv_config, devp->prop.dolby_vision);
- pr_info("size of struct vdin_dev_s: %d\n", devp->vdin_dev_ssize);
pr_info("afbce_flag: 0x%x\n", devp->afbce_flag);
pr_info("afbce_mode: %d\n", devp->afbce_mode);
devp->afbce_info->frame_body_size);
}
}
+
+ pr_info("dolby_input : %d\n", devp->dv.dolby_input);
+ if ((devp->cma_config_en != 1) || !(devp->cma_config_flag & 0x100))
+ pr_info("dolby_mem_start = %ld, dolby_mem_size = %d\n",
+ (devp->mem_start +
+ devp->mem_size - devp->canvas_max_num*dolby_size_byte),
+ dolby_size_byte);
+ else
+ for (i = 0; i < devp->canvas_max_num; i++)
+ pr_info("dolby_mem_start[%d] = %ld, dolby_mem_size = %d\n",
+ i, (devp->vfmem_start[i] + devp->vfmem_size -
+ dolby_size_byte), dolby_size_byte);
+ for (i = 0; i < devp->canvas_max_num; i++) {
+ pr_info("dv_mem(%d):0x%x\n",
+ devp->vfp->dv_buf_size[i],
+ devp->vfp->dv_buf_mem[i]);
+ }
+ pr_info("dvEn:%d,dv_flag:%d;dv_cfg:%d,dolby_ver:%d,low_latency:(%d,%d,%d)\n",
+ is_dolby_vision_enable(),
+ devp->dv.dv_flag, devp->dv.dv_config, devp->prop.dolby_vision,
+ devp->dv.low_latency, devp->prop.low_latency,
+ devp->vfp->low_latency);
+
+ pr_info("size of struct vdin_dev_s: %d\n", devp->vdin_dev_ssize);
+ pr_info("devp->dv.dv_vsif:(%d,%d,%d,%d,%d,%d,%d,%d);\n",
+ devp->dv.dv_vsif.dobly_vision_signal,
+ devp->dv.dv_vsif.backlt_ctrl_MD_present,
+ devp->dv.dv_vsif.auxiliary_MD_present,
+ devp->dv.dv_vsif.eff_tmax_PQ_hi,
+ devp->dv.dv_vsif.eff_tmax_PQ_low,
+ devp->dv.dv_vsif.auxiliary_runmode,
+ devp->dv.dv_vsif.auxiliary_runversion,
+ devp->dv.dv_vsif.auxiliary_debug0);
+ pr_info("devp->prop.dv_vsif:(%d,%d,%d,%d,%d,%d,%d,%d)\n",
+ devp->prop.dv_vsif.dobly_vision_signal,
+ devp->prop.dv_vsif.backlt_ctrl_MD_present,
+ devp->prop.dv_vsif.auxiliary_MD_present,
+ devp->prop.dv_vsif.eff_tmax_PQ_hi,
+ devp->prop.dv_vsif.eff_tmax_PQ_low,
+ devp->prop.dv_vsif.auxiliary_runmode,
+ devp->prop.dv_vsif.auxiliary_runversion,
+ devp->prop.dv_vsif.auxiliary_debug0);
+ pr_info("devp->vfp->dv_vsif:(%d,%d,%d,%d,%d,%d,%d,%d)\n",
+ devp->vfp->dv_vsif.dobly_vision_signal,
+ devp->vfp->dv_vsif.backlt_ctrl_MD_present,
+ devp->vfp->dv_vsif.auxiliary_MD_present,
+ devp->vfp->dv_vsif.eff_tmax_PQ_hi,
+ devp->vfp->dv_vsif.eff_tmax_PQ_low,
+ devp->vfp->dv_vsif.auxiliary_runmode,
+ devp->vfp->dv_vsif.auxiliary_runversion,
+ devp->vfp->dv_vsif.auxiliary_debug0);
pr_info("Vdin driver version : %s\n", VDIN_VER);
}
#define VDIN_CLS_NAME "vdin"
#define PROVIDER_NAME "vdin"
+#define VDIN_DV_NAME "dv_vdin"
+
#define VDIN_PUT_INTERVAL (HZ/100) /* 10ms, #define HZ 100 */
static dev_t vdin_devno;
vdin_dolby_config(devp);
if (vdin_dbg_en)
pr_info("vdin start dec dv input config\n");
+ } else {
+ vdin_dobly_mdata_write_en(devp->addr_offset, 0);
}
#endif
devp->abnormal_cnt = 0;
vdin_hw_enable(devp->addr_offset);
vdin_set_all_regs(devp);
+ vdin_set_dolby_ll_tunnel(devp);
vdin_write_mif_or_afbce_init(devp);
-
if (!(devp->parm.flag & TVIN_PARM_FLAG_CAP) &&
(devp->frontend) &&
devp->frontend->dec_ops &&
#ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION
if ((devp->dv.dolby_input & (1 << devp->index)) ||
(devp->dv.dv_flag && is_dolby_vision_enable()))
- vf_notify_receiver("dv_vdin",
+ vf_notify_receiver(VDIN_DV_NAME,
VFRAME_EVENT_PROVIDER_START, NULL);
else
#endif
schedule_delayed_work(&devp->dv.dv_dwork,
dv_work_delby);
} else if (((dv_dbg_mask & DV_UPDATE_DATA_MODE_DELBY_WORK) == 0)
- && devp->dv.dv_config) {
+ && devp->dv.dv_config && !devp->dv.low_latency) {
vdin_dolby_buffer_update(devp,
devp->last_wr_vfe->vf.index);
vdin_dolby_addr_update(devp,
devp->curr_wr_vfe->vf.index);
} else
devp->dv.dv_crc_check = true;
+
+ if (devp->dv.low_latency != devp->vfp->low_latency)
+ devp->vfp->low_latency = devp->dv.low_latency;
+ memcpy(&devp->vfp->dv_vsif,
+ &devp->dv.dv_vsif, sizeof(struct tvin_dv_vsif_s));
if ((devp->dv.dv_crc_check == true) ||
(!(dv_dbg_mask & DV_CRC_CHECK))) {
provider_vf_put(devp->last_wr_vfe, devp->vfp);
if (((devp->dv.dolby_input & (1 << devp->index)) ||
(devp->dv.dv_flag && is_dolby_vision_enable())) &&
(devp->dv.dv_config == true))
- vf_notify_receiver("dv_vdin",
+ vf_notify_receiver(VDIN_DV_NAME,
VFRAME_EVENT_PROVIDER_VFRAME_READY, NULL);
else {
#endif
if (((devp->dv.dolby_input & (1 << devp->index)) ||
(devp->dv.dv_flag && is_dolby_vision_enable())) &&
(devp->dv.dv_config == true))
- vdin2nr = vf_notify_receiver("dv_vdin",
+ vdin2nr = vf_notify_receiver(VDIN_DV_NAME,
VFRAME_EVENT_PROVIDER_QUREY_VDIN2NR, NULL);
else
#endif
if (((devp->dv.dolby_input & (1 << devp->index)) ||
(devp->dv.dv_flag && is_dolby_vision_enable()))
&& (devp->dv.dv_config == true))
- vf_notify_receiver("dv_vdin",
+ vf_notify_receiver(VDIN_DV_NAME,
VFRAME_EVENT_PROVIDER_VFRAME_READY, NULL);
else {
#endif
sprintf(vdevp->name, "%s%d", PROVIDER_NAME, vdevp->index);
vf_provider_init(&vdevp->vprov, vdevp->name, &vdin_vf_ops, vdevp->vfp);
- vf_provider_init(&vdevp->dv.vprov_dv, "dv_vdin",
+ vf_provider_init(&vdevp->dv.vprov_dv, VDIN_DV_NAME,
&vdin_vf_ops, vdevp->vfp);
/* @todo canvas_config_mode */
if (canvas_config_mode == 0 || canvas_config_mode == 1)
/* Ref.2019/04/25: tl1 vdin0 afbce dynamically switch support,
* vpp also should support this function
*/
-#define VDIN_VER "Ref.2019/05/31"
+#define VDIN_VER "Ref.2019/07/08-add dv ll mode"
/*the counter of vdin*/
#define VDIN_MAX_DEVS 2
bool dv_config;
bool dv_crc_check;/*0:fail;1:ok*/
unsigned int dv_mem_alloced;
+ struct tvin_dv_vsif_s dv_vsif;/*dolby vsi info*/
+ bool low_latency;
};
struct vdin_afbce_s {
tvin_smr_init(devp->index);
devp->dv.dv_flag = prop->dolby_vision;
}
+
+ if (prop->low_latency != devp->dv.low_latency)
+ devp->dv.low_latency = prop->low_latency;
+ memcpy(&devp->dv.dv_vsif,
+ &prop->dv_vsif, sizeof(struct tvin_dv_vsif_s));
}
void reset_tvin_smr(unsigned int index)
spinlock_t fz_lock;
unsigned int tmp_list_size;
struct list_head tmp_list;
+ struct tvin_dv_vsif_s dv_vsif;/*dolby vsi info*/
spinlock_t tmp_lock;
spinlock_t log_lock;
spinlock_t dv_lock;/*dolby vision lock*/
struct isr_log_s isr_log;
#endif
atomic_t buffer_cnt;
+ unsigned int low_latency;
unsigned int dv_buf_mem[VDIN_DV_MAX_NUM];
void *dv_buf_vmem[VDIN_DV_MAX_NUM];
unsigned int dv_buf_size[VDIN_DV_MAX_NUM];
#define VIDTYPE_NO_DW 0x4000000
#define VIDTYPE_SUPPORT_COMPRESS 0x8000000
#define VIDTYPE_PRE_DI_AFBC 0x10000000
+#define VIDTYPE_RGB_444 0x20000000
#define DISP_RATIO_FORCECONFIG 0x80000000
#define DISP_RATIO_FORCE_NORMALWIDE 0x40000000
enum pic_mode_provider_e provider;
};
+/*vdin dolby vsi info param*/
+struct tvin_dv_vsif_s {
+ uint8_t dobly_vision_signal:1;
+ uint8_t backlt_ctrl_MD_present:1;
+ uint8_t auxiliary_MD_present:1;
+ uint8_t eff_tmax_PQ_hi;
+ uint8_t eff_tmax_PQ_low;
+ uint8_t auxiliary_runmode;
+ uint8_t auxiliary_runversion;
+ uint8_t auxiliary_debug0;
+};
+
#define BITDEPTH_Y_SHIFT 8
#define BITDEPTH_Y8 (0 << BITDEPTH_Y_SHIFT)
#define BITDEPTH_Y9 (1 << BITDEPTH_Y_SHIFT)
int aux_size;
int dv_enhance_exist;
int low_latency;
+ struct tvin_dv_vsif_s dv_vsif;/*dolby vsi info*/
};
struct provider_disp_mode_req_s {
/*input*/