mirror of
https://github.com/hardkernel/kernel_common_drivers.git
synced 2026-06-25 12:03:48 +09:00
hdmitx: clean hdmitx_mode_set.c [1/1]
PD#SWPL-204167 Problem: clean hdmitx_mode_set.c Solution: clean hdmitx_mode_set.c Verify: sc2 Test: DRM-TX-5, DRM-TX-78 Change-Id: I76cc10737430d34c4e899516b1bd50223e1ca3b8 Signed-off-by: Ao Xu <ao.xu@amlogic.com> Signed-off-by: hang cheng <hang.cheng@amlogic.com>
This commit is contained in:
@@ -253,6 +253,7 @@ ddk_module(
|
||||
"vout/hdmitx/hdmitx_mode.c",
|
||||
"vout/hdmitx/hdmitx_format_para.c",
|
||||
"vout/hdmitx/hdmitx_mode_set.c",
|
||||
"vout/hdmitx/hdmitx_vout.c",
|
||||
"vout/hdmitx/hdmitx_audio.c",
|
||||
"vout/hdmitx/hdmitx_tracer_linux.c",
|
||||
"vout/hdmitx/hdmitx_event_mgr_linux.c",
|
||||
|
||||
@@ -16,6 +16,7 @@ $(MEDIA_MODULE_NAME)-$(CONFIG_AMLOGIC_HDMITX_COMMON) += \
|
||||
vout/hdmitx/hdmitx_mode.o \
|
||||
vout/hdmitx/hdmitx_format_para.o \
|
||||
vout/hdmitx/hdmitx_mode_set.o \
|
||||
vout/hdmitx/hdmitx_vout.o \
|
||||
vout/hdmitx/hdmitx_audio.o \
|
||||
vout/hdmitx/hdmitx_tracer_linux.o \
|
||||
vout/hdmitx/hdmitx_event_mgr_linux.o \
|
||||
|
||||
@@ -344,18 +344,6 @@ bool hdmitx_common_get_hdmi_used_state(struct hdmitx_common *tx_comm)
|
||||
}
|
||||
EXPORT_SYMBOL(hdmitx_common_get_hdmi_used_state);
|
||||
|
||||
int hdmitx_setup_attr(struct hdmitx_common *tx_comm, const char *buf)
|
||||
{
|
||||
char attr[16] = {0};
|
||||
int len = strlen(buf);
|
||||
|
||||
if (len <= 16)
|
||||
memcpy(attr, buf, len);
|
||||
memcpy(tx_comm->fmt_attr, attr, sizeof(tx_comm->fmt_attr));
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(hdmitx_setup_attr);
|
||||
|
||||
int hdmitx_get_attr(struct hdmitx_common *tx_comm, char attr[16])
|
||||
{
|
||||
memcpy(attr, tx_comm->fmt_attr, sizeof(tx_comm->fmt_attr));
|
||||
@@ -845,7 +833,7 @@ EXPORT_SYMBOL(hdmitx_common_avmute_locked);
|
||||
|
||||
/********************************Debug function***********************************/
|
||||
|
||||
int hdmitx_common_edid_tracer_post_proc(struct hdmitx_common *tx_comm, struct rx_cap *prxcap)
|
||||
static int hdmitx_common_edid_tracer_post_proc(struct hdmitx_common *tx_comm, struct rx_cap *prxcap)
|
||||
{
|
||||
struct dv_info *dv;
|
||||
struct hdr_info *hdr;
|
||||
@@ -873,7 +861,6 @@ int hdmitx_common_edid_tracer_post_proc(struct hdmitx_common *tx_comm, struct rx
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(hdmitx_common_edid_tracer_post_proc);
|
||||
|
||||
int hdmitx_common_get_edid(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
@@ -975,6 +962,11 @@ void hdmitx_common_edid_clear(struct hdmitx_common *tx_comm)
|
||||
/* rx_edid_physical_addr(0, 0, 0, 0); */
|
||||
}
|
||||
|
||||
void hdmitx_current_status(struct hdmitx_common *tx_comm, enum hdmitx_event_log_bits event)
|
||||
{
|
||||
hdmitx_tracer_write_event(tx_comm->tx_tracer, event);
|
||||
}
|
||||
|
||||
void hdmitx_hdr_state_init(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
enum hdmi_tf_type hdr_type = HDMI_NONE;
|
||||
@@ -1247,10 +1239,10 @@ enum frl_rate_enum hdmitx_select_frl_rate(u8 *dsc_en, u8 dsc_policy, enum hdmi_v
|
||||
return frl_rate;
|
||||
}
|
||||
|
||||
unsigned int hdmitx_get_frame_duration(void)
|
||||
unsigned int hdmitx_get_frame_duration(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
unsigned int frame_duration;
|
||||
struct vinfo_s *vinfo = hdmitx_get_current_vinfo(NULL);
|
||||
struct vinfo_s *vinfo = hdmitx_get_current_vinfo(tx_comm);
|
||||
|
||||
if (!vinfo || !vinfo->sync_duration_num)
|
||||
return 0;
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "hdmitx_module.h"
|
||||
#include "hdmitx_compliance.h"
|
||||
#include "hdmitx_dump.h"
|
||||
#include "hdmitx_vout.h"
|
||||
|
||||
#ifdef CONFIG_AMLOGIC_HDMITX
|
||||
|
||||
@@ -957,14 +958,6 @@ static int amhdmitx_probe(struct platform_device *pdev)
|
||||
* load fmt para from hw info
|
||||
*/
|
||||
hdmitx_common_init_bootup_format_para(tx_comm, &tx_comm->fmt_para);
|
||||
/*
|
||||
* update fmt_attr string from fmt_para, note that fmt_attr is already
|
||||
* set by hdmitx_common_init() with boot arg, and below is un-necessary,
|
||||
* and it will set attr sysfs node as empty if hdmitx not enabled under
|
||||
* uboot as fmt para is in reset state
|
||||
*/
|
||||
hdmitx_format_para_rebuild_fmtattr_str(&tx_comm->fmt_para,
|
||||
tx_comm->fmt_attr, sizeof(tx_comm->fmt_attr));
|
||||
/* load init hdr state from HW info */
|
||||
hdmitx_hdr_state_init(tx_comm);
|
||||
hdmitx_bootup_post_process(tx_comm);
|
||||
@@ -1106,6 +1099,19 @@ void hdmitx_clear_packets(struct hdmitx_common *tx_comm)
|
||||
hdmitx_clear_all_infoframe_pkt(tx_comm);
|
||||
}
|
||||
|
||||
void hdmitx_ext_plugin_handler(void)
|
||||
{
|
||||
struct hdmitx_common *tx_comm = get_hdmitx_common();
|
||||
|
||||
if (tx_comm) {
|
||||
mutex_lock(&tx_comm->hdmimode_mutex);
|
||||
hdmitx_common_get_edid(tx_comm);
|
||||
mutex_unlock(&tx_comm->hdmimode_mutex);
|
||||
HDMITX_INFO("read edid by erac\n");
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(hdmitx_ext_plugin_handler);
|
||||
|
||||
void print_hsty_hdmiaud_config_data(void)
|
||||
{
|
||||
struct aud_para *data;
|
||||
@@ -1540,9 +1546,6 @@ static int amhdmitx_pm_restore(struct device *dev)
|
||||
hdmitx_process_plugout(tx_comm);
|
||||
/* load fmt para from hw info */
|
||||
hdmitx_common_init_bootup_format_para(tx_comm, &tx_comm->fmt_para);
|
||||
/* rebuild fmt attr */
|
||||
hdmitx_format_para_rebuild_fmtattr_str(&tx_comm->fmt_para,
|
||||
tx_comm->fmt_attr, sizeof(tx_comm->fmt_attr));
|
||||
/* load init hdr state for HW info */
|
||||
hdmitx_hdr_state_init(tx_comm);
|
||||
hdmitx_bootup_post_process(tx_comm);
|
||||
|
||||
@@ -314,12 +314,12 @@ int dump_hdmitx_basic_config(struct seq_file *s, void *p)
|
||||
if (hdmitx_hw_cntl_ddc(hw_comm, DDC_HDCP_14_LSTORE, 0))
|
||||
hdcp_lstore |= BIT(0);
|
||||
else
|
||||
hdmitx_current_status(HDMITX_HDCP_AUTH_NO_14_KEYS_ERROR);
|
||||
hdmitx_current_status(tx_comm, HDMITX_HDCP_AUTH_NO_14_KEYS_ERROR);
|
||||
if (hdmitx_hw_cntl_ddc(hw_comm,
|
||||
DDC_HDCP_22_LSTORE, 0))
|
||||
hdcp_lstore |= BIT(1);
|
||||
else
|
||||
hdmitx_current_status(HDMITX_HDCP_AUTH_NO_22_KEYS_ERROR);
|
||||
hdmitx_current_status(tx_comm, HDMITX_HDCP_AUTH_NO_22_KEYS_ERROR);
|
||||
}
|
||||
if ((hdcp_lstore & 0x3) == 0x3) {
|
||||
seq_puts(s, "14+22\n");
|
||||
|
||||
@@ -215,4 +215,3 @@ int hdmitx_format_para_rebuild_fmtattr_str(struct hdmi_format_para *para, char *
|
||||
HDMITX_DEBUG("rebuild fmt_string %s from (%d,%d)\n", attr_str, para->cs, para->cd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -724,7 +724,7 @@ void hdr_unmute_work_func(struct work_struct *work)
|
||||
work_hdr_unmute);
|
||||
|
||||
if (tx_comm->hdr_mute_frame) {
|
||||
mute_us = tx_comm->hdr_mute_frame * hdmitx_get_frame_duration();
|
||||
mute_us = tx_comm->hdr_mute_frame * hdmitx_get_frame_duration(tx_comm);
|
||||
usleep_range(mute_us, mute_us + 10);
|
||||
hdmitx_video_mute_op(false);
|
||||
}
|
||||
|
||||
@@ -560,7 +560,6 @@ const struct hdmi_timing *hdmitx_mode_match_timing_name(const char *name)
|
||||
|
||||
return INVALID_HDMI_TIMING;
|
||||
}
|
||||
EXPORT_SYMBOL(hdmitx_mode_match_timing_name);
|
||||
|
||||
const char *hdmitx_mode_get_timing_name(enum hdmi_vic vic)
|
||||
{
|
||||
|
||||
@@ -12,172 +12,9 @@
|
||||
|
||||
#include "hdmitx_log.h"
|
||||
#include "hdmitx_check_valid.h"
|
||||
#include "hdmitx_vout.h"
|
||||
|
||||
const struct hdmi_timing *hdmitx_mode_match_timing_name(const char *name);
|
||||
static int hdmitx_module_disable(enum vmode_e cur_vmod, void *data);
|
||||
|
||||
/*!!Only one instance supported.*/
|
||||
static struct hdmitx_common *global_tx_common;
|
||||
static struct hdmitx_hw_common *global_tx_hw;
|
||||
|
||||
static void hdmi_physical_size_to_vinfo(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
u32 width, height;
|
||||
struct vinfo_s *info = &tx_comm->hdmitx_vinfo;
|
||||
|
||||
if (info->mode == VMODE_HDMI) {
|
||||
width = tx_comm->rxcap.physical_width;
|
||||
height = tx_comm->rxcap.physical_height;
|
||||
if (width == 0 || height == 0) {
|
||||
info->screen_real_width = info->aspect_ratio_num;
|
||||
info->screen_real_height = info->aspect_ratio_den;
|
||||
} else {
|
||||
info->screen_real_width = width;
|
||||
info->screen_real_height = height;
|
||||
}
|
||||
HDMITX_DEBUG("update physical size: %d %d\n",
|
||||
info->screen_real_width, info->screen_real_height);
|
||||
}
|
||||
}
|
||||
|
||||
static void rxlatency_to_vinfo(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
struct vinfo_s *info = &tx_comm->hdmitx_vinfo;
|
||||
|
||||
info->rx_latency.vLatency = tx_comm->rxcap.vLatency;
|
||||
info->rx_latency.aLatency = tx_comm->rxcap.aLatency;
|
||||
info->rx_latency.i_vLatency = tx_comm->rxcap.i_vLatency;
|
||||
info->rx_latency.i_aLatency = tx_comm->rxcap.i_aLatency;
|
||||
}
|
||||
|
||||
static void edidinfo_attach_to_vinfo(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
struct vinfo_s *info = &tx_comm->hdmitx_vinfo;
|
||||
struct hdmi_format_para *para = &tx_comm->fmt_para;
|
||||
struct rx_cap *prxcap = &tx_comm->rxcap;
|
||||
|
||||
/* if currently config_csc_en is true, and EDID
|
||||
* support 422, Need to switch small mode in output
|
||||
* hdr10/hlg/hdr10plus, Since hdmitx csc does not support
|
||||
* 420 conversion, the hdr capability of 420 is blocked.
|
||||
* Otherwise, the 8-bit output will shield the HDR capability.
|
||||
*/
|
||||
if (para->cd == COLORDEPTH_24B && !tx_comm->hdr_8bit_en) {
|
||||
if (!tx_comm->config_csc_en || !is_support_y422(prxcap) ||
|
||||
para->cs == HDMI_COLORSPACE_YUV420)
|
||||
memset(&info->hdr_info, 0, sizeof(struct hdr_info));
|
||||
}
|
||||
|
||||
rxlatency_to_vinfo(tx_comm);
|
||||
hdmi_physical_size_to_vinfo(tx_comm);
|
||||
memcpy(info->hdmichecksum, tx_comm->rxcap.hdmichecksum, 10);
|
||||
}
|
||||
|
||||
static void edidinfo_detach_to_vinfo(struct vinfo_s *info)
|
||||
{
|
||||
memset(&info->dv_info, 0, sizeof(info->dv_info));
|
||||
memset(&info->hdr_info, 0, sizeof(info->hdr_info));
|
||||
memset(&info->rx_latency, 0, sizeof(info->rx_latency));
|
||||
|
||||
info->screen_real_width = 0;
|
||||
info->screen_real_height = 0;
|
||||
memset(info->hdmichecksum, 0, sizeof(info->hdmichecksum));
|
||||
}
|
||||
|
||||
static int calc_vinfo_from_hdmi_timing(const struct hdmi_timing *timing, struct vinfo_s *tx_vinfo)
|
||||
{
|
||||
/* manually assign hdmitx_vinfo from timing */
|
||||
tx_vinfo->name = timing->sname ? timing->sname : timing->name;
|
||||
tx_vinfo->mode = VMODE_HDMI;
|
||||
tx_vinfo->frac = 0; /* TODO */
|
||||
if (timing->pixel_repetition_factor)
|
||||
tx_vinfo->width = timing->h_active >> 1;
|
||||
else
|
||||
tx_vinfo->width = timing->h_active;
|
||||
tx_vinfo->height = timing->v_active;
|
||||
tx_vinfo->field_height = timing->pi_mode ?
|
||||
timing->v_active : timing->v_active / 2;
|
||||
tx_vinfo->aspect_ratio_num = timing->h_pict;
|
||||
tx_vinfo->aspect_ratio_den = timing->v_pict;
|
||||
if (timing->v_freq % 1000 == 0) {
|
||||
tx_vinfo->sync_duration_num = timing->v_freq / 1000;
|
||||
tx_vinfo->sync_duration_den = 1;
|
||||
} else {
|
||||
tx_vinfo->sync_duration_num = timing->v_freq;
|
||||
tx_vinfo->sync_duration_den = 1000;
|
||||
}
|
||||
tx_vinfo->brr_duration = 0;
|
||||
tx_vinfo->video_clk = timing->pixel_freq;
|
||||
tx_vinfo->htotal = timing->h_total;
|
||||
tx_vinfo->vtotal = timing->v_total;
|
||||
tx_vinfo->fr_adj_type = VOUT_FR_ADJ_HDMI;
|
||||
tx_vinfo->viu_color_fmt = COLOR_FMT_YUV444;
|
||||
tx_vinfo->viu_mux = timing->pi_mode ? VIU_MUX_ENCP : VIU_MUX_ENCI;
|
||||
/* 1080i use the ENCP, not ENCI */
|
||||
if (timing->name && strstr(timing->name, "1080i"))
|
||||
tx_vinfo->viu_mux = VIU_MUX_ENCP;
|
||||
tx_vinfo->viu_mux |= global_tx_common->enc_idx << 4;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void update_vinfo_from_formatpara(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
struct vinfo_s *vinfo = &tx_comm->hdmitx_vinfo;
|
||||
struct hdmi_format_para *fmtpara = &tx_comm->fmt_para;
|
||||
|
||||
/* update vinfo for out device */
|
||||
calc_vinfo_from_hdmi_timing(&fmtpara->timing, vinfo);
|
||||
/*
|
||||
* vinfo->info_3d = NON_3D;
|
||||
* if (tx_comm->flag_3dfp)
|
||||
* vinfo->info_3d = FP_3D;
|
||||
* if (tx_comm->flag_3dtb)
|
||||
* vinfo->info_3d = TB_3D;
|
||||
* if (tx_comm->flag_3dss)
|
||||
* vinfo->info_3d = SS_3D;
|
||||
*/
|
||||
/* dynamic info, always need set */
|
||||
vinfo->cs = fmtpara->cs;
|
||||
vinfo->cd = fmtpara->cd;
|
||||
/* update ppc and color fmt info for vpp, only for FRL/DSC */
|
||||
if (tx_comm->tx_hw->chip_data->chip_type >= MESON_CPU_ID_T7) {
|
||||
vinfo->cur_enc_ppc = 1;
|
||||
if (fmtpara->frl_rate > FRL_NONE)
|
||||
vinfo->cur_enc_ppc = 4;
|
||||
#ifdef CONFIG_AMLOGIC_DSC
|
||||
if (fmtpara->dsc_en) {
|
||||
if (tx_comm->fmt_para.cs == HDMI_COLORSPACE_RGB)
|
||||
vinfo->vpp_post_out_color_fmt = 1;
|
||||
else
|
||||
vinfo->vpp_post_out_color_fmt = 0;
|
||||
} else {
|
||||
vinfo->vpp_post_out_color_fmt = 0;
|
||||
}
|
||||
#endif
|
||||
HDMITX_INFO("vinfo: set cur_enc_ppc as %d, vpp color: %d\n",
|
||||
vinfo->cur_enc_ppc, vinfo->vpp_post_out_color_fmt);
|
||||
}
|
||||
}
|
||||
|
||||
static void hdmitx_update_vinfo(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
if (!tx_comm) {
|
||||
HDMITX_ERROR("%s NULL tx_comm pointer\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
edidinfo_attach_to_vinfo(tx_comm);
|
||||
update_vinfo_from_formatpara(tx_comm);
|
||||
}
|
||||
|
||||
static void hdmitx_reset_vinfo(struct vinfo_s *tx_vinfo)
|
||||
{
|
||||
tx_vinfo->name = "invalid";
|
||||
tx_vinfo->mode = VMODE_MAX;
|
||||
|
||||
edidinfo_detach_to_vinfo(tx_vinfo);
|
||||
}
|
||||
|
||||
static int hdmitx_common_pre_enable_mode(struct hdmitx_common *tx_comm,
|
||||
struct hdmi_format_para *para)
|
||||
@@ -216,10 +53,6 @@ static int hdmitx_common_pre_enable_mode(struct hdmitx_common *tx_comm,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* update fmt_attr: userspace still need this.*/
|
||||
hdmitx_format_para_rebuild_fmtattr_str(&tx_comm->fmt_para, tx_comm->fmt_attr,
|
||||
sizeof(tx_comm->fmt_attr));
|
||||
|
||||
hdmitx_hw_cntl_misc(tx_comm->tx_hw, MISC_PRE_ENABLE_MODE, 0);
|
||||
|
||||
mutex_unlock(&tx_comm->valid_mutex);
|
||||
@@ -313,56 +146,6 @@ fail:
|
||||
}
|
||||
EXPORT_SYMBOL(hdmitx_common_do_mode_setting);
|
||||
|
||||
/* below for pxp mode set test */
|
||||
static void convert_attr_str(char *attr_str, enum hdmi_colorspace *cs, int *cd)
|
||||
{
|
||||
if (!attr_str || !cs || !cd)
|
||||
return;
|
||||
|
||||
if (strstr(attr_str, "420")) {
|
||||
*cs = HDMI_COLORSPACE_YUV420;
|
||||
} else if (strstr(attr_str, "422")) {
|
||||
*cs = HDMI_COLORSPACE_YUV422;
|
||||
} else if (strstr(attr_str, "444")) {
|
||||
*cs = HDMI_COLORSPACE_YUV444;
|
||||
} else if (strstr(attr_str, "rgb")) {
|
||||
*cs = HDMI_COLORSPACE_RGB;
|
||||
} else {
|
||||
*cs = HDMI_COLORSPACE_RGB;
|
||||
HDMITX_ERROR("%s wrong color format, fallback to default rgb\n");
|
||||
}
|
||||
|
||||
/*parse colorspace success*/
|
||||
if (strstr(attr_str, "12bit")) {
|
||||
*cd = COLORDEPTH_36B;
|
||||
} else if (strstr(attr_str, "10bit")) {
|
||||
*cd = COLORDEPTH_30B;
|
||||
} else if (strstr(attr_str, "8bit")) {
|
||||
*cd = COLORDEPTH_24B;
|
||||
} else {
|
||||
*cd = COLORDEPTH_24B;
|
||||
HDMITX_ERROR("%s wrong color depth, fallback to default 8bit\n");
|
||||
}
|
||||
}
|
||||
|
||||
static int hdmitx_setup_fmt_para(struct hdmitx_common *tx_comm, struct hdmi_format_para *fmt_para,
|
||||
enum hdmi_vic vic, char *attr_str)
|
||||
{
|
||||
int ret = 0;
|
||||
enum hdmi_colorspace cs = HDMI_COLORSPACE_RGB;
|
||||
int cd = 8;
|
||||
|
||||
if (!tx_comm || !fmt_para || !attr_str)
|
||||
return -1;
|
||||
|
||||
convert_attr_str(attr_str, &cs, &cd);
|
||||
|
||||
ret = hdmitx_common_build_format_para(tx_comm, fmt_para,
|
||||
vic, tx_comm->frac_rate_policy,
|
||||
cs, cd, HDMI_QUANTIZATION_RANGE_FULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* sync with hdmitx_common_do_mode_setting() */
|
||||
static int hdmitx_common_do_mode_setting_test(struct hdmitx_common *tx_comm,
|
||||
enum hdmi_vic vic, char *attr_str)
|
||||
@@ -375,7 +158,12 @@ static int hdmitx_common_do_mode_setting_test(struct hdmitx_common *tx_comm,
|
||||
|
||||
mutex_lock(&tx_comm->hdmimode_mutex);
|
||||
memset(&new_para, 0, sizeof(new_para));
|
||||
ret = hdmitx_setup_fmt_para(tx_comm, &new_para, vic, attr_str);
|
||||
|
||||
hdmitx_parse_color_attr(attr_str, &new_para.cs, &new_para.cd, &new_para.cr);
|
||||
ret = hdmitx_common_build_format_para(tx_comm, &new_para,
|
||||
vic, tx_comm->frac_rate_policy,
|
||||
new_para.cs, new_para.cd,
|
||||
HDMI_QUANTIZATION_RANGE_FULL);
|
||||
if (ret < 0) {
|
||||
HDMITX_ERROR("%s format para build fail\n", __func__);
|
||||
goto fail;
|
||||
@@ -401,12 +189,7 @@ fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void hdmitx_common_disable_mode_test(void)
|
||||
{
|
||||
hdmitx_module_disable(VMODE_HDMI, NULL);
|
||||
}
|
||||
|
||||
int set_disp_mode(struct hdmitx_common *tx_comm, const char *mode)
|
||||
int set_disp_mode_debug(struct hdmitx_common *tx_comm, const char *mode)
|
||||
{
|
||||
int ret = 0;
|
||||
enum hdmi_vic vic;
|
||||
@@ -418,7 +201,7 @@ int set_disp_mode(struct hdmitx_common *tx_comm, const char *mode)
|
||||
if (!strncmp(mode, "off", strlen("off")) ||
|
||||
!strncmp(mode, "null", strlen("null")) ||
|
||||
!strncmp(mode, "invalid", strlen("invalid"))) {
|
||||
hdmitx_common_disable_mode_test();
|
||||
hdmitx_common_disable_mode(tx_comm, NULL);
|
||||
HDMITX_INFO("%s: disable hdmi mode\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
@@ -504,160 +287,6 @@ int hdmitx_common_disable_mode(struct hdmitx_common *tx_comm,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_AMLOGIC_VOUT_SERVE
|
||||
struct vinfo_s *hdmitx_get_current_vinfo(void *data)
|
||||
{
|
||||
global_tx_common->hdmitx_vinfo.connector_type = DRM_MODE_CONNECTOR_MESON_HDMIA_A
|
||||
+ global_tx_common->enc_idx;
|
||||
/* update hdr_info and dv_info */
|
||||
hdmitx_set_hdr_priority(global_tx_common, global_tx_common->hdr_priority,
|
||||
&global_tx_common->hdmitx_vinfo.hdr_info,
|
||||
&global_tx_common->hdmitx_vinfo.dv_info);
|
||||
|
||||
return &global_tx_common->hdmitx_vinfo;
|
||||
}
|
||||
|
||||
static int hdmitx_set_current_vmode(enum vmode_e mode, void *data)
|
||||
{
|
||||
if (!(mode & VMODE_INIT_BIT_MASK))
|
||||
HDMITX_INFO("warning, echo /sys/class/display/mode is disabled\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static enum vmode_e hdmitx_validate_vmode(char *mode, unsigned int frac, void *data)
|
||||
{
|
||||
struct vinfo_s *vinfo = &global_tx_common->hdmitx_vinfo;
|
||||
const struct hdmi_timing *timing = 0;
|
||||
|
||||
/* vout validate vmode only used to confirm the mode is
|
||||
* supported by this server. And dont check with edid,
|
||||
* maybe we dont have edid when this function called.
|
||||
*/
|
||||
timing = hdmitx_mode_match_timing_name(mode);
|
||||
if (hdmitx_common_validate_vic(global_tx_common, timing->vic) == 0) {
|
||||
/*should save mode name to vinfo, will be used in set_vmode*/
|
||||
calc_vinfo_from_hdmi_timing(timing, vinfo);
|
||||
vinfo->vout_device = global_tx_common->vdev;
|
||||
return VMODE_HDMI;
|
||||
}
|
||||
|
||||
HDMITX_ERROR("%s validate %s fail\n", __func__, mode);
|
||||
return VMODE_MAX;
|
||||
}
|
||||
|
||||
static int hdmitx_vmode_is_supported(enum vmode_e mode, void *data)
|
||||
{
|
||||
if ((mode & VMODE_MODE_BIT_MASK) == VMODE_HDMI)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static int hdmitx_module_disable(enum vmode_e cur_vmod, void *data)
|
||||
{
|
||||
hdmitx_common_disable_mode(global_tx_common, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hdmitx_vout_state;
|
||||
static int hdmitx_vout_set_state(int index, void *data)
|
||||
{
|
||||
hdmitx_vout_state |= (1 << index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hdmitx_vout_clr_state(int index, void *data)
|
||||
{
|
||||
hdmitx_vout_state &= ~(1 << index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hdmitx_vout_get_state(void *data)
|
||||
{
|
||||
return hdmitx_vout_state;
|
||||
}
|
||||
|
||||
/* if cs/cd/frac_rate is changed, then return 0 */
|
||||
static int hdmitx_check_same_vmodeattr(char *name, void *data)
|
||||
{
|
||||
HDMITX_ERROR("not support anymore\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hdmitx_vout_get_disp_cap(char *buf, void *data)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
pos += snprintf(buf + pos, PAGE_SIZE, "check disp_cap sysfs node in hdmitx.\n");
|
||||
return pos;
|
||||
}
|
||||
|
||||
static void hdmitx_set_bist(u32 num, void *data)
|
||||
{
|
||||
HDMITX_ERROR("Not Support: try debug sysfs node in amhdmitx\n");
|
||||
}
|
||||
|
||||
static int hdmitx_vout_set_vframe_rate_hint(int duration, void *data)
|
||||
{
|
||||
HDMITX_ERROR("not support %S\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hdmitx_vout_get_vframe_rate_hint(void *data)
|
||||
{
|
||||
HDMITX_ERROR("not support %S\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct vout_server_s hdmitx_vout_server = {
|
||||
.name = "hdmitx_vout_server",
|
||||
.op = {
|
||||
.get_vinfo = hdmitx_get_current_vinfo,
|
||||
.set_vmode = hdmitx_set_current_vmode,
|
||||
.validate_vmode = hdmitx_validate_vmode,
|
||||
.check_same_vmodeattr = hdmitx_check_same_vmodeattr,
|
||||
.vmode_is_supported = hdmitx_vmode_is_supported,
|
||||
.disable = hdmitx_module_disable,
|
||||
.set_state = hdmitx_vout_set_state,
|
||||
.clr_state = hdmitx_vout_clr_state,
|
||||
.get_state = hdmitx_vout_get_state,
|
||||
.get_disp_cap = hdmitx_vout_get_disp_cap,
|
||||
.set_vframe_rate_hint = hdmitx_vout_set_vframe_rate_hint,
|
||||
.get_vframe_rate_hint = hdmitx_vout_get_vframe_rate_hint,
|
||||
.set_bist = hdmitx_set_bist,
|
||||
#ifdef CONFIG_PM
|
||||
.vout_suspend = NULL,
|
||||
.vout_resume = NULL,
|
||||
#endif
|
||||
},
|
||||
.data = NULL,
|
||||
};
|
||||
#else
|
||||
static struct vinfo_s *hdmitx_get_current_vinfo(void *data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
void hdmitx_vout_init(struct hdmitx_common *tx_comm, struct hdmitx_hw_common *tx_hw)
|
||||
{
|
||||
global_tx_common = tx_comm;
|
||||
global_tx_hw = tx_hw;
|
||||
|
||||
#ifdef CONFIG_AMLOGIC_VOUT_SERVE
|
||||
hdmitx_vout_server.connector_type = DRM_MODE_CONNECTOR_MESON_HDMIA_A
|
||||
+ tx_comm->enc_idx;
|
||||
vout_register_server(&hdmitx_vout_server);
|
||||
#endif
|
||||
}
|
||||
|
||||
void hdmitx_vout_uninit(void)
|
||||
{
|
||||
#ifdef CONFIG_AMLOGIC_VOUT_SERVE
|
||||
vout_unregister_server(&hdmitx_vout_server);
|
||||
#endif
|
||||
}
|
||||
|
||||
void hdmitx_common_late_resume(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
@@ -884,20 +513,3 @@ void hdmitx_bootup_post_process(struct hdmitx_common *tx_comm)
|
||||
queue_delayed_work(tx_comm->cedst_wq, &tx_comm->work_cedst, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void hdmitx_ext_plugin_handler(void)
|
||||
{
|
||||
/*read edid*/
|
||||
if (global_tx_common) {
|
||||
mutex_lock(&global_tx_common->hdmimode_mutex);
|
||||
hdmitx_common_get_edid(global_tx_common);
|
||||
mutex_unlock(&global_tx_common->hdmimode_mutex);
|
||||
HDMITX_INFO("read edid by erac\n");
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(hdmitx_ext_plugin_handler);
|
||||
|
||||
void hdmitx_current_status(enum hdmitx_event_log_bits event)
|
||||
{
|
||||
hdmitx_tracer_write_event(global_tx_common->tx_tracer, event);
|
||||
}
|
||||
|
||||
@@ -51,8 +51,10 @@ static ssize_t attr_show(struct device *dev,
|
||||
int pos = 0;
|
||||
char fmt_attr[16];
|
||||
struct hdmitx_common *tx_comm = dev_get_drvdata(dev);
|
||||
struct hdmi_format_para *para = &tx_comm->fmt_para;
|
||||
|
||||
hdmitx_format_para_rebuild_fmtattr_str(para, fmt_attr, sizeof(fmt_attr));
|
||||
|
||||
hdmitx_get_attr(tx_comm, fmt_attr);
|
||||
pos = snprintf(buf, PAGE_SIZE, "%s\n\r", fmt_attr);
|
||||
|
||||
return pos;
|
||||
@@ -65,11 +67,9 @@ static ssize_t test_attr_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
int pos = 0;
|
||||
char fmt_attr[16] = {0};
|
||||
struct hdmitx_common *tx_comm = dev_get_drvdata(dev);
|
||||
|
||||
memcpy(fmt_attr, tx_comm->tst_fmt_attr, sizeof(fmt_attr));
|
||||
pos = snprintf(buf, PAGE_SIZE, "%s\n\r", fmt_attr);
|
||||
pos = snprintf(buf, PAGE_SIZE, "%s\n\r", tx_comm->tst_fmt_attr);
|
||||
|
||||
return pos;
|
||||
}
|
||||
@@ -914,7 +914,7 @@ static ssize_t phy_store(struct device *dev,
|
||||
int delay_frame = 5;
|
||||
|
||||
HDMITX_INFO("%s %s\n", __func__, buf);
|
||||
mute_us = hdmitx_get_frame_duration();
|
||||
mute_us = hdmitx_get_frame_duration(tx_comm);
|
||||
if (strncmp(buf, "0", 1) == 0) {
|
||||
#ifndef CONFIG_AMLOGIC_ZAPPER_CUT
|
||||
/* for s5 frl mode */
|
||||
@@ -1925,7 +1925,7 @@ static ssize_t disp_mode_store(struct device *dev,
|
||||
int ret = 0;
|
||||
struct hdmitx_common *tx_comm = dev_get_drvdata(dev);
|
||||
|
||||
ret = set_disp_mode(tx_comm, buf);
|
||||
ret = set_disp_mode_debug(tx_comm, buf);
|
||||
if (ret < 0)
|
||||
HDMITX_ERROR("%s: set mode failed\n", __func__);
|
||||
return count;
|
||||
@@ -2260,12 +2260,12 @@ ssize_t hdcp_lstore_show(struct device *dev,
|
||||
if (hdmitx_hw_cntl_ddc(tx_hw, DDC_HDCP_14_LSTORE, 0))
|
||||
lstore |= BIT(0);
|
||||
else
|
||||
hdmitx_current_status(HDMITX_HDCP_AUTH_NO_14_KEYS_ERROR);
|
||||
hdmitx_current_status(tx_comm, HDMITX_HDCP_AUTH_NO_14_KEYS_ERROR);
|
||||
if (hdmitx_hw_cntl_ddc(tx_hw,
|
||||
DDC_HDCP_22_LSTORE, 0))
|
||||
lstore |= BIT(1);
|
||||
else
|
||||
hdmitx_current_status(HDMITX_HDCP_AUTH_NO_22_KEYS_ERROR);
|
||||
hdmitx_current_status(tx_comm, HDMITX_HDCP_AUTH_NO_22_KEYS_ERROR);
|
||||
}
|
||||
if ((lstore & 0x3) == 0x3) {
|
||||
pos += snprintf(buf + pos, PAGE_SIZE - pos, "14+22\n");
|
||||
|
||||
@@ -0,0 +1,337 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
/*
|
||||
* Copyright (c) 2019 Amlogic, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/printk.h>
|
||||
#include <linux/amlogic/media/vout/hdmitx_common/hdmitx_common.h>
|
||||
#include <linux/amlogic/media/vout/hdmitx_common/hdmitx_edid.h>
|
||||
#include <linux/amlogic/media/vout/hdmi_tx_repeater.h>
|
||||
|
||||
#include "hdmitx_log.h"
|
||||
#include "hdmitx_check_valid.h"
|
||||
#include "hdmitx_vout.h"
|
||||
|
||||
const struct hdmi_timing *hdmitx_mode_match_timing_name(const char *name);
|
||||
|
||||
static void hdmi_physical_size_to_vinfo(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
u32 width, height;
|
||||
struct vinfo_s *info = &tx_comm->hdmitx_vinfo;
|
||||
struct rx_cap *prxcap = &tx_comm->rxcap;
|
||||
|
||||
if (info->mode == VMODE_HDMI) {
|
||||
width = prxcap->physical_width;
|
||||
height = prxcap->physical_height;
|
||||
if (width == 0 || height == 0) {
|
||||
info->screen_real_width = info->aspect_ratio_num;
|
||||
info->screen_real_height = info->aspect_ratio_den;
|
||||
} else {
|
||||
info->screen_real_width = width;
|
||||
info->screen_real_height = height;
|
||||
}
|
||||
HDMITX_DEBUG("update physical size: %d %d\n",
|
||||
info->screen_real_width, info->screen_real_height);
|
||||
}
|
||||
}
|
||||
|
||||
static void rxlatency_to_vinfo(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
struct vinfo_s *info = &tx_comm->hdmitx_vinfo;
|
||||
struct rx_cap *prxcap = &tx_comm->rxcap;
|
||||
|
||||
info->rx_latency.vLatency = prxcap->vLatency;
|
||||
info->rx_latency.aLatency = prxcap->aLatency;
|
||||
info->rx_latency.i_vLatency = prxcap->i_vLatency;
|
||||
info->rx_latency.i_aLatency = prxcap->i_aLatency;
|
||||
}
|
||||
|
||||
static void edidinfo_attach_to_vinfo(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
struct vinfo_s *info = &tx_comm->hdmitx_vinfo;
|
||||
struct hdmi_format_para *para = &tx_comm->fmt_para;
|
||||
struct rx_cap *prxcap = &tx_comm->rxcap;
|
||||
|
||||
/* if currently config_csc_en is true, and EDID
|
||||
* support 422, Need to switch small mode in output
|
||||
* hdr10/hlg/hdr10plus, Since hdmitx csc does not support
|
||||
* 420 conversion, the hdr capability of 420 is blocked.
|
||||
* Otherwise, the 8-bit output will shield the HDR capability.
|
||||
*/
|
||||
if (para->cd == COLORDEPTH_24B && !tx_comm->hdr_8bit_en) {
|
||||
if (!tx_comm->config_csc_en || !is_support_y422(prxcap) ||
|
||||
para->cs == HDMI_COLORSPACE_YUV420)
|
||||
memset(&info->hdr_info, 0, sizeof(struct hdr_info));
|
||||
}
|
||||
|
||||
rxlatency_to_vinfo(tx_comm);
|
||||
hdmi_physical_size_to_vinfo(tx_comm);
|
||||
memcpy(info->hdmichecksum, prxcap->hdmichecksum, 10);
|
||||
}
|
||||
|
||||
static void edidinfo_detach_to_vinfo(struct vinfo_s *info)
|
||||
{
|
||||
memset(&info->dv_info, 0, sizeof(info->dv_info));
|
||||
memset(&info->hdr_info, 0, sizeof(info->hdr_info));
|
||||
memset(&info->rx_latency, 0, sizeof(info->rx_latency));
|
||||
|
||||
info->screen_real_width = 0;
|
||||
info->screen_real_height = 0;
|
||||
memset(info->hdmichecksum, 0, sizeof(info->hdmichecksum));
|
||||
}
|
||||
|
||||
static int calc_vinfo_from_hdmi_timing(struct hdmitx_common *tx_comm,
|
||||
const struct hdmi_timing *timing, struct vinfo_s *tx_vinfo)
|
||||
{
|
||||
/* manually assign hdmitx_vinfo from timing */
|
||||
tx_vinfo->name = timing->sname ? timing->sname : timing->name;
|
||||
tx_vinfo->mode = VMODE_HDMI;
|
||||
tx_vinfo->frac = 0; /* TODO */
|
||||
if (timing->pixel_repetition_factor)
|
||||
tx_vinfo->width = timing->h_active >> 1;
|
||||
else
|
||||
tx_vinfo->width = timing->h_active;
|
||||
tx_vinfo->height = timing->v_active;
|
||||
tx_vinfo->field_height = timing->pi_mode ?
|
||||
timing->v_active : timing->v_active / 2;
|
||||
tx_vinfo->aspect_ratio_num = timing->h_pict;
|
||||
tx_vinfo->aspect_ratio_den = timing->v_pict;
|
||||
if (timing->v_freq % 1000 == 0) {
|
||||
tx_vinfo->sync_duration_num = timing->v_freq / 1000;
|
||||
tx_vinfo->sync_duration_den = 1;
|
||||
} else {
|
||||
tx_vinfo->sync_duration_num = timing->v_freq;
|
||||
tx_vinfo->sync_duration_den = 1000;
|
||||
}
|
||||
tx_vinfo->brr_duration = 0;
|
||||
tx_vinfo->video_clk = timing->pixel_freq;
|
||||
tx_vinfo->htotal = timing->h_total;
|
||||
tx_vinfo->vtotal = timing->v_total;
|
||||
tx_vinfo->fr_adj_type = VOUT_FR_ADJ_HDMI;
|
||||
tx_vinfo->viu_color_fmt = COLOR_FMT_YUV444;
|
||||
tx_vinfo->viu_mux = timing->pi_mode ? VIU_MUX_ENCP : VIU_MUX_ENCI;
|
||||
/* 1080i use the ENCP, not ENCI */
|
||||
if (timing->name && strstr(timing->name, "1080i"))
|
||||
tx_vinfo->viu_mux = VIU_MUX_ENCP;
|
||||
tx_vinfo->viu_mux |= tx_comm->enc_idx << 4;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void update_vinfo_from_formatpara(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
struct vinfo_s *vinfo = &tx_comm->hdmitx_vinfo;
|
||||
struct hdmi_format_para *fmtpara = &tx_comm->fmt_para;
|
||||
|
||||
/* update vinfo for out device */
|
||||
calc_vinfo_from_hdmi_timing(tx_comm, &fmtpara->timing, vinfo);
|
||||
/*
|
||||
* vinfo->info_3d = NON_3D;
|
||||
* if (tx_comm->flag_3dfp)
|
||||
* vinfo->info_3d = FP_3D;
|
||||
* if (tx_comm->flag_3dtb)
|
||||
* vinfo->info_3d = TB_3D;
|
||||
* if (tx_comm->flag_3dss)
|
||||
* vinfo->info_3d = SS_3D;
|
||||
*/
|
||||
/* dynamic info, always need set */
|
||||
vinfo->cs = fmtpara->cs;
|
||||
vinfo->cd = fmtpara->cd;
|
||||
/* update ppc and color fmt info for vpp, only for FRL/DSC */
|
||||
if (tx_comm->tx_hw->chip_data->chip_type >= MESON_CPU_ID_T7) {
|
||||
vinfo->cur_enc_ppc = 1;
|
||||
if (fmtpara->frl_rate > FRL_NONE)
|
||||
vinfo->cur_enc_ppc = 4;
|
||||
#ifdef CONFIG_AMLOGIC_DSC
|
||||
if (fmtpara->dsc_en) {
|
||||
if (tx_comm->fmt_para.cs == HDMI_COLORSPACE_RGB)
|
||||
vinfo->vpp_post_out_color_fmt = 1;
|
||||
else
|
||||
vinfo->vpp_post_out_color_fmt = 0;
|
||||
} else {
|
||||
vinfo->vpp_post_out_color_fmt = 0;
|
||||
}
|
||||
#endif
|
||||
HDMITX_INFO("vinfo: set cur_enc_ppc as %d, vpp color: %d\n",
|
||||
vinfo->cur_enc_ppc, vinfo->vpp_post_out_color_fmt);
|
||||
}
|
||||
}
|
||||
|
||||
void hdmitx_update_vinfo(struct hdmitx_common *tx_comm)
|
||||
{
|
||||
if (!tx_comm) {
|
||||
HDMITX_ERROR("%s NULL tx_comm pointer\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
edidinfo_attach_to_vinfo(tx_comm);
|
||||
update_vinfo_from_formatpara(tx_comm);
|
||||
}
|
||||
|
||||
void hdmitx_reset_vinfo(struct vinfo_s *tx_vinfo)
|
||||
{
|
||||
tx_vinfo->name = "invalid";
|
||||
tx_vinfo->mode = VMODE_MAX;
|
||||
|
||||
edidinfo_detach_to_vinfo(tx_vinfo);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_AMLOGIC_VOUT_SERVE
|
||||
struct vinfo_s *hdmitx_get_current_vinfo(void *data)
|
||||
{
|
||||
struct hdmitx_common *tx_comm = (struct hdmitx_common *)data;
|
||||
|
||||
tx_comm->hdmitx_vinfo.connector_type = DRM_MODE_CONNECTOR_MESON_HDMIA_A
|
||||
+ tx_comm->enc_idx;
|
||||
/* update hdr_info and dv_info */
|
||||
hdmitx_set_hdr_priority(tx_comm, tx_comm->hdr_priority,
|
||||
&tx_comm->hdmitx_vinfo.hdr_info,
|
||||
&tx_comm->hdmitx_vinfo.dv_info);
|
||||
|
||||
return &tx_comm->hdmitx_vinfo;
|
||||
}
|
||||
|
||||
static int hdmitx_set_current_vmode(enum vmode_e mode, void *data)
|
||||
{
|
||||
if (!(mode & VMODE_INIT_BIT_MASK))
|
||||
HDMITX_INFO("warning, echo /sys/class/display/mode is disabled\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static enum vmode_e hdmitx_validate_vmode(char *mode, unsigned int frac, void *data)
|
||||
{
|
||||
struct hdmitx_common *tx_comm = (struct hdmitx_common *)data;
|
||||
struct vinfo_s *vinfo = &tx_comm->hdmitx_vinfo;
|
||||
const struct hdmi_timing *timing = 0;
|
||||
|
||||
/* vout validate vmode only used to confirm the mode is
|
||||
* supported by this server. And dont check with edid,
|
||||
* maybe we dont have edid when this function called.
|
||||
*/
|
||||
timing = hdmitx_mode_match_timing_name(mode);
|
||||
if (hdmitx_common_validate_vic(tx_comm, timing->vic) == 0) {
|
||||
/*should save mode name to vinfo, will be used in set_vmode*/
|
||||
calc_vinfo_from_hdmi_timing(tx_comm, timing, vinfo);
|
||||
vinfo->vout_device = tx_comm->vdev;
|
||||
return VMODE_HDMI;
|
||||
}
|
||||
|
||||
HDMITX_ERROR("%s validate %s fail\n", __func__, mode);
|
||||
return VMODE_MAX;
|
||||
}
|
||||
|
||||
static int hdmitx_vmode_is_supported(enum vmode_e mode, void *data)
|
||||
{
|
||||
if ((mode & VMODE_MODE_BIT_MASK) == VMODE_HDMI)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static int hdmitx_module_disable(enum vmode_e cur_vmod, void *data)
|
||||
{
|
||||
struct hdmitx_common *tx_comm = (struct hdmitx_common *)data;
|
||||
|
||||
hdmitx_common_disable_mode(tx_comm, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hdmitx_vout_state;
|
||||
static int hdmitx_vout_set_state(int index, void *data)
|
||||
{
|
||||
hdmitx_vout_state |= (1 << index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hdmitx_vout_clr_state(int index, void *data)
|
||||
{
|
||||
hdmitx_vout_state &= ~(1 << index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hdmitx_vout_get_state(void *data)
|
||||
{
|
||||
return hdmitx_vout_state;
|
||||
}
|
||||
|
||||
/* if cs/cd/frac_rate is changed, then return 0 */
|
||||
static int hdmitx_check_same_vmodeattr(char *name, void *data)
|
||||
{
|
||||
HDMITX_ERROR("not support anymore\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hdmitx_vout_get_disp_cap(char *buf, void *data)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
pos += snprintf(buf + pos, PAGE_SIZE, "check disp_cap sysfs node in hdmitx.\n");
|
||||
return pos;
|
||||
}
|
||||
|
||||
static void hdmitx_set_bist(u32 num, void *data)
|
||||
{
|
||||
HDMITX_ERROR("Not Support: try debug sysfs node in amhdmitx\n");
|
||||
}
|
||||
|
||||
static int hdmitx_vout_set_vframe_rate_hint(int duration, void *data)
|
||||
{
|
||||
HDMITX_ERROR("not support %S\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hdmitx_vout_get_vframe_rate_hint(void *data)
|
||||
{
|
||||
HDMITX_ERROR("not support %S\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct vout_server_s hdmitx_vout_server = {
|
||||
.name = "hdmitx_vout_server",
|
||||
.op = {
|
||||
.get_vinfo = hdmitx_get_current_vinfo,
|
||||
.set_vmode = hdmitx_set_current_vmode,
|
||||
.validate_vmode = hdmitx_validate_vmode,
|
||||
.check_same_vmodeattr = hdmitx_check_same_vmodeattr,
|
||||
.vmode_is_supported = hdmitx_vmode_is_supported,
|
||||
.disable = hdmitx_module_disable,
|
||||
.set_state = hdmitx_vout_set_state,
|
||||
.clr_state = hdmitx_vout_clr_state,
|
||||
.get_state = hdmitx_vout_get_state,
|
||||
.get_disp_cap = hdmitx_vout_get_disp_cap,
|
||||
.set_vframe_rate_hint = hdmitx_vout_set_vframe_rate_hint,
|
||||
.get_vframe_rate_hint = hdmitx_vout_get_vframe_rate_hint,
|
||||
.set_bist = hdmitx_set_bist,
|
||||
#ifdef CONFIG_PM
|
||||
.vout_suspend = NULL,
|
||||
.vout_resume = NULL,
|
||||
#endif
|
||||
},
|
||||
.data = NULL,
|
||||
};
|
||||
#else
|
||||
static struct vinfo_s *hdmitx_get_current_vinfo(void *data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
void hdmitx_vout_init(struct hdmitx_common *tx_comm, struct hdmitx_hw_common *tx_hw)
|
||||
{
|
||||
#ifdef CONFIG_AMLOGIC_VOUT_SERVE
|
||||
hdmitx_vout_server.connector_type = DRM_MODE_CONNECTOR_MESON_HDMIA_A
|
||||
+ tx_comm->enc_idx;
|
||||
hdmitx_vout_server.data = tx_comm;
|
||||
vout_register_server(&hdmitx_vout_server);
|
||||
#endif
|
||||
}
|
||||
|
||||
void hdmitx_vout_uninit(void)
|
||||
{
|
||||
#ifdef CONFIG_AMLOGIC_VOUT_SERVE
|
||||
vout_unregister_server(&hdmitx_vout_server);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
|
||||
/*
|
||||
* Copyright (c) 2019 Amlogic, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __HDMITX_VOUT_H
|
||||
#define __HDMITX_VOUT_H
|
||||
|
||||
#include <linux/amlogic/media/vout/hdmitx_common/hdmitx_common.h>
|
||||
|
||||
void hdmitx_update_vinfo(struct hdmitx_common *tx_comm);
|
||||
void hdmitx_reset_vinfo(struct vinfo_s *tx_vinfo);
|
||||
void hdmitx_vout_init(struct hdmitx_common *tx_comm, struct hdmitx_hw_common *tx_hw);
|
||||
void hdmitx_vout_uninit(void);
|
||||
|
||||
#endif
|
||||
@@ -240,7 +240,7 @@ void edid_read_head_8bytes(void)
|
||||
* Note: read 8 Bytes of EDID data every time
|
||||
*/
|
||||
#define EDID_WAIT_TIMEOUT 10
|
||||
void hdmitx_read_edid(unsigned char *rx_edid)
|
||||
void hdmitx_read_edid(struct hdmitx_common *tx_comm, unsigned char *rx_edid)
|
||||
{
|
||||
unsigned int timeout = 0;
|
||||
unsigned int timeout_cnt = 0;
|
||||
@@ -271,7 +271,7 @@ void hdmitx_read_edid(unsigned char *rx_edid)
|
||||
timeout_cnt++;
|
||||
}
|
||||
if (timeout == EDID_WAIT_TIMEOUT)
|
||||
hdmitx_current_status(HDMITX_EDID_I2C_ERROR);
|
||||
hdmitx_current_status(tx_comm, HDMITX_EDID_I2C_ERROR);
|
||||
|
||||
hdmitx_wr_reg(HDMITX_DWC_IH_I2CM_STAT0, 1 << 1);
|
||||
/* Read back 8 bytes */
|
||||
|
||||
@@ -85,6 +85,6 @@ uint32_t hdcp_rd_hdcp22_ver(void);
|
||||
void scdc_config(struct hdmitx20_dev *hdev);
|
||||
void edid_read_head_8bytes(void);
|
||||
int scdc_status_flags(struct hdmitx20_dev *hdev);
|
||||
void hdmitx_read_edid(unsigned char *rx_edid);
|
||||
void hdmitx_read_edid(struct hdmitx_common *tx_comm, unsigned char *rx_edid);
|
||||
|
||||
#endif /* __HDMI_TX_SCDC_H__ */
|
||||
|
||||
@@ -220,7 +220,7 @@ static int hdmitx_hdcp_task(void *data)
|
||||
auth_trigger);
|
||||
// Only collect the metric when hdmi is plugged in.
|
||||
if (hdev->tx_comm.hpd_state == 1) {
|
||||
hdmitx_current_status(auth_trigger
|
||||
hdmitx_current_status(&hdev->tx_comm, auth_trigger
|
||||
? HDMITX_HDCP_AUTH_SUCCESS
|
||||
: HDMITX_HDCP_AUTH_FAILURE);
|
||||
}
|
||||
@@ -306,7 +306,7 @@ static void hdmitx20_set_hdcp_mode(struct hdmitx_common *tx_comm, const char *bu
|
||||
hdmitx_hw_get_state(tx_comm->tx_hw, STAT_VIDEO_VIC, 0);
|
||||
|
||||
if (hdmitx_hw_cntl_misc(tx_comm->tx_hw, MISC_TMDS_RXSENSE, 0) == 0)
|
||||
hdmitx_current_status(HDMITX_HDCP_DEVICE_NOT_READY_ERROR);
|
||||
hdmitx_current_status(tx_comm, HDMITX_HDCP_DEVICE_NOT_READY_ERROR);
|
||||
/*
|
||||
* there's risk:
|
||||
* hdcp2.2 start auth-->enter early suspend, stop hdcp-->
|
||||
@@ -328,7 +328,7 @@ static void hdmitx20_set_hdcp_mode(struct hdmitx_common *tx_comm, const char *bu
|
||||
hdmitx_hw_cntl_ddc(tx_comm->tx_hw,
|
||||
DDC_HDCP_OP, HDCP14_OFF);
|
||||
hdmitx_hdcp_do_work(tx_comm);
|
||||
hdmitx_current_status(HDMITX_HDCP_NOT_ENABLED);
|
||||
hdmitx_current_status(tx_comm, HDMITX_HDCP_NOT_ENABLED);
|
||||
}
|
||||
if (strncmp(buf, "1", 1) == 0) {
|
||||
if (vic == HDMI_17_720x576p50_4x3 || vic == HDMI_18_720x576p50_16x9)
|
||||
@@ -337,7 +337,7 @@ static void hdmitx20_set_hdcp_mode(struct hdmitx_common *tx_comm, const char *bu
|
||||
hdmitx_hdcp_do_work(tx_comm);
|
||||
hdmitx_hw_cntl_ddc(tx_comm->tx_hw,
|
||||
DDC_HDCP_OP, HDCP14_ON);
|
||||
hdmitx_current_status(HDMITX_HDCP_HDCP_1_ENABLED);
|
||||
hdmitx_current_status(tx_comm, HDMITX_HDCP_HDCP_1_ENABLED);
|
||||
}
|
||||
if (strncmp(buf, "2", 1) == 0) {
|
||||
if (tx_comm->efuse_dis_hdcp_tx22) {
|
||||
@@ -349,7 +349,7 @@ static void hdmitx20_set_hdcp_mode(struct hdmitx_common *tx_comm, const char *bu
|
||||
hdmitx_hdcp_do_work(tx_comm);
|
||||
hdmitx_hw_cntl_ddc(tx_comm->tx_hw,
|
||||
DDC_HDCP_MUX_INIT, 2);
|
||||
hdmitx_current_status(HDMITX_HDCP_HDCP_2_ENABLED);
|
||||
hdmitx_current_status(tx_comm, HDMITX_HDCP_HDCP_2_ENABLED);
|
||||
}
|
||||
mutex_unlock(&tx_comm->hdmimode_mutex);
|
||||
}
|
||||
@@ -962,7 +962,7 @@ void drm_hdmitx_disable_hdcp_mode(unsigned int content_type)
|
||||
|
||||
hdev->tx_comm.hdcp_mode = 0;
|
||||
hdmitx_hdcp_do_work(&hdev->tx_comm);
|
||||
hdmitx_current_status(HDMITX_HDCP_NOT_ENABLED);
|
||||
hdmitx_current_status(&hdev->tx_comm, HDMITX_HDCP_NOT_ENABLED);
|
||||
}
|
||||
|
||||
unsigned char drm_hdmitx_get_hdcp_topo_info(void)
|
||||
|
||||
@@ -4529,7 +4529,8 @@ static void hdcp_ksv_sha1_calc(struct hdmitx20_dev *hdev)
|
||||
valid = HDCP_KSVLIST_VALID;
|
||||
} else {
|
||||
valid = HDCP_KSVLIST_INVALID;
|
||||
hdmitx_current_status(HDMITX_HDCP_AUTH_VI_MISMATCH_ERROR);
|
||||
hdmitx_current_status(&hdev->tx_comm,
|
||||
HDMITX_HDCP_AUTH_VI_MISMATCH_ERROR);
|
||||
}
|
||||
ksv_sha_matched = valid;
|
||||
}
|
||||
@@ -4591,7 +4592,7 @@ static void hdcptx_events_handle(struct timer_list *t)
|
||||
topo14->max_devs_exceeded = 1;
|
||||
topo14->max_cascade_exceeded = 1;
|
||||
hdev->hdcp_max_exceed_state = 1;
|
||||
hdmitx_current_status(HDMITX_HDCP_AUTH_TOPOLOGY_ERROR);
|
||||
hdmitx_current_status(&hdev->tx_comm, HDMITX_HDCP_AUTH_TOPOLOGY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4649,16 +4650,17 @@ static void hdcptx_events_handle(struct timer_list *t)
|
||||
hdmitx_hw_cntl_ddc(&hdev->hw_comm,
|
||||
DDC_HDCP14_SAVE_OBS, (unsigned long)&obs_cur);
|
||||
if (obs_cur.intstat & (3 << 3))
|
||||
hdmitx_current_status(HDMITX_HDCP_I2C_ERROR);
|
||||
hdmitx_current_status(&hdev->tx_comm, HDMITX_HDCP_I2C_ERROR);
|
||||
if (((obs_cur.obs0 >> 4) == 3) && (((obs_cur.obs0 >> 1) & 0x7) == 0))
|
||||
hdmitx_current_status(HDMITX_HDCP_AUTH_R0_MISMATCH_ERROR);
|
||||
hdmitx_current_status(&hdev->tx_comm, HDMITX_HDCP_AUTH_R0_MISMATCH_ERROR);
|
||||
if (((obs_cur.obs0 >> 4) == 9) && (((obs_cur.obs0 >> 1) & 0x7) == 2))
|
||||
hdmitx_current_status(HDMITX_HDCP_AUTH_VI_MISMATCH_ERROR);
|
||||
hdmitx_current_status(&hdev->tx_comm, HDMITX_HDCP_AUTH_VI_MISMATCH_ERROR);
|
||||
if (((obs_cur.obs0 >> 4) == 8) && (((obs_cur.obs0 >> 1) & 0x7) == 1))
|
||||
hdmitx_current_status(HDMITX_HDCP_AUTH_REPEATER_DELAY_ERROR);
|
||||
hdmitx_current_status(&hdev->tx_comm,
|
||||
HDMITX_HDCP_AUTH_REPEATER_DELAY_ERROR);
|
||||
}
|
||||
if (st_flag & (1 << 4))
|
||||
hdmitx_current_status(HDMITX_HDCP_I2C_ERROR);
|
||||
hdmitx_current_status(&hdev->tx_comm, HDMITX_HDCP_I2C_ERROR);
|
||||
|
||||
if (st_flag & (1 << 1)) {
|
||||
hdmitx_wr_reg(HDMITX_DWC_A_APIINTCLR, (1 << 1));
|
||||
@@ -4781,7 +4783,7 @@ static int hdmitx_cntl_ddc(struct hdmitx_hw_common *tx_hw,
|
||||
hdmitx_wr_reg(HDMITX_DWC_I2CM_SOFTRSTZ, 0);
|
||||
break;
|
||||
case DDC_EDID_READ_DATA:
|
||||
hdmitx_read_edid(hdev->tx_comm.EDID_buf);
|
||||
hdmitx_read_edid(&hdev->tx_comm, hdev->tx_comm.EDID_buf);
|
||||
break;
|
||||
case DDC_GLITCH_FILTER_RESET:
|
||||
hdmitx_set_reg_bits(HDMITX_TOP_SW_RESET, 1, 6, 1);
|
||||
|
||||
@@ -477,8 +477,6 @@ int hdmitx_common_set_allm_mode(struct hdmitx_common *tx_comm, int mode);
|
||||
int hdmitx_common_avmute_locked(struct hdmitx_common *tx_comm,
|
||||
int mute_flag, int mute_path_hint);
|
||||
|
||||
/*edid tracer post-processing*/
|
||||
int hdmitx_common_edid_tracer_post_proc(struct hdmitx_common *tx_comm, struct rx_cap *prxcap);
|
||||
/*read edid raw data and parse edid to rxcap*/
|
||||
int hdmitx_common_get_edid(struct hdmitx_common *tx_comm);
|
||||
|
||||
@@ -491,13 +489,13 @@ int hdmitx_common_validate_mode_locked(struct hdmitx_common *tx_comm,
|
||||
char *mode, char *attr, bool brr_valid);
|
||||
int hdmitx_common_disable_mode(struct hdmitx_common *tx_comm,
|
||||
struct hdmitx_common_state *new_state);
|
||||
int set_disp_mode(struct hdmitx_common *tx_comm, const char *mode);
|
||||
int set_disp_mode_debug(struct hdmitx_common *tx_comm, const char *mode);
|
||||
|
||||
/*packet api*/
|
||||
int hdmitx_common_setup_vsif_packet(struct hdmitx_common *tx_comm,
|
||||
enum vsif_type type, int on, void *param);
|
||||
|
||||
unsigned int hdmitx_get_frame_duration(void);
|
||||
unsigned int hdmitx_get_frame_duration(struct hdmitx_common *tx_comm);
|
||||
|
||||
/* hdcp api*/
|
||||
void hdmitx_set_hdcp_mode(struct hdmitx_common *tx_comm, const char *buf);
|
||||
@@ -532,7 +530,6 @@ bool hdmitx_common_get_edid_valid_state(struct hdmitx_common *tx_comm);
|
||||
bool hdmitx_common_get_hdcp_user_state(struct hdmitx_common *tx_comm);
|
||||
bool hdmitx_common_get_hdmi_used_state(struct hdmitx_common *tx_comm);
|
||||
|
||||
int hdmitx_setup_attr(struct hdmitx_common *tx_comm, const char *buf);
|
||||
int hdmitx_get_attr(struct hdmitx_common *tx_comm, char attr[16]);
|
||||
|
||||
int hdmitx_get_hdrinfo(struct hdmitx_common *tx_comm, struct hdr_info *hdrinfo);
|
||||
@@ -559,9 +556,9 @@ bool is_tv_changed(char *cur_edid_chksum, char *boot_param_edid_chksum);
|
||||
|
||||
void hdmitx_vout_init(struct hdmitx_common *tx_comm, struct hdmitx_hw_common *tx_hw);
|
||||
void hdmitx_vout_uninit(void);
|
||||
struct vinfo_s *hdmitx_get_current_vinfo(void *data);
|
||||
struct vinfo_s *hdmitx_get_current_vinfo(void *tx_comm);
|
||||
void hdmitx_build_fmt_attr_str(struct hdmitx_common *tx_comm);
|
||||
void hdmitx_current_status(enum hdmitx_event_log_bits event);
|
||||
void hdmitx_current_status(struct hdmitx_common *tx_comm, enum hdmitx_event_log_bits event);
|
||||
ssize_t hdcp_lstore_show(struct device *dev, struct device_attribute *attr,
|
||||
char *buf);
|
||||
ssize_t hdcp_mode_show(struct device *dev, struct device_attribute *attr,
|
||||
@@ -585,7 +582,6 @@ void hdmitx_common_late_resume(struct hdmitx_common *tx_comm);
|
||||
/* common disable hdmitx output api */
|
||||
void hdmitx_common_output_disable(struct hdmitx_common *tx_comm,
|
||||
bool phy_dis, bool hdcp_reset, bool pkt_clear, bool edid_clear);
|
||||
unsigned int hdmitx_get_frame_duration(void);
|
||||
|
||||
/*******************************drm hdmitx api*******************************/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user