msm: adv7533: proper AVI info frame setup
Program correct aspect ratio and scan information for adv7533 chip based on the current resolution being set, so that proper AVI info frame is sent to TV. Change-Id: I5f55e9897243ee82632e3ee39ab4c903b5fa1104 Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
This commit is contained in:
parent
3883a6be5b
commit
c92edb8e90
|
@ -410,6 +410,45 @@ end:
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int mdss_dba_get_vic_panel_info(struct mdss_dba_utils_data *udata,
|
||||
struct mdss_panel_info *pinfo)
|
||||
{
|
||||
struct msm_hdmi_mode_timing_info timing;
|
||||
struct hdmi_util_ds_data ds_data;
|
||||
u32 h_total, v_total, vic = 0;
|
||||
|
||||
if (!udata || !pinfo) {
|
||||
pr_err("%s: invalid input\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
timing.active_h = pinfo->xres;
|
||||
timing.back_porch_h = pinfo->lcdc.h_back_porch;
|
||||
timing.front_porch_h = pinfo->lcdc.h_front_porch;
|
||||
timing.pulse_width_h = pinfo->lcdc.h_pulse_width;
|
||||
h_total = (timing.active_h + timing.back_porch_h +
|
||||
timing.front_porch_h + timing.pulse_width_h);
|
||||
|
||||
timing.active_v = pinfo->yres;
|
||||
timing.back_porch_v = pinfo->lcdc.v_back_porch;
|
||||
timing.front_porch_v = pinfo->lcdc.v_front_porch;
|
||||
timing.pulse_width_v = pinfo->lcdc.v_pulse_width;
|
||||
v_total = (timing.active_v + timing.back_porch_v +
|
||||
timing.front_porch_v + timing.pulse_width_v);
|
||||
|
||||
timing.refresh_rate = pinfo->mipi.frame_rate * 1000;
|
||||
timing.pixel_freq = (h_total * v_total *
|
||||
pinfo->mipi.frame_rate) / 1000;
|
||||
|
||||
ds_data.ds_registered = true;
|
||||
ds_data.ds_max_clk = MSM_DBA_MAX_PCLK;
|
||||
|
||||
vic = hdmi_get_video_id_code(&timing, &ds_data);
|
||||
pr_debug("%s: current vic code is %d\n", __func__, vic);
|
||||
|
||||
return vic;
|
||||
}
|
||||
|
||||
/**
|
||||
* mdss_dba_utils_video_on() - Allow clients to switch on the video
|
||||
* @data: DBA utils instance which was allocated during registration
|
||||
|
@ -455,6 +494,10 @@ int mdss_dba_utils_video_on(void *data, struct mdss_panel_info *pinfo)
|
|||
if (pinfo->mipi.data_lane3)
|
||||
video_cfg.num_of_input_lanes++;
|
||||
|
||||
/* Get scan information from EDID */
|
||||
video_cfg.vic = mdss_dba_get_vic_panel_info(ud, pinfo);
|
||||
video_cfg.scaninfo = hdmi_edid_get_sink_scaninfo(ud->edid_data,
|
||||
video_cfg.vic);
|
||||
if (ud->ops.video_on)
|
||||
ret = ud->ops.video_on(ud->dba_data, true, &video_cfg, 0);
|
||||
|
||||
|
|
|
@ -1227,8 +1227,6 @@ static void adv7533_video_setup(struct adv7533 *pdata,
|
|||
v_total, cfg->v_active, cfg->v_front_porch,
|
||||
cfg->v_pulse_width, cfg->v_back_porch);
|
||||
|
||||
/* aspect ratio and sync polarity */
|
||||
ADV7533_WRITE(I2C_ADDR_MAIN, 0x17, 0x02);
|
||||
|
||||
/* h_width */
|
||||
ADV7533_WRITE(I2C_ADDR_CEC_DSI, 0x28, ((h_total & 0xFF0) >> 4));
|
||||
|
@ -1270,6 +1268,7 @@ static int adv7533_video_on(void *client, bool on,
|
|||
{
|
||||
int ret = -EINVAL;
|
||||
u8 lanes;
|
||||
u8 reg_val = 0;
|
||||
struct adv7533 *pdata = adv7533_get_platform_data(client);
|
||||
|
||||
if (!pdata || !cfg) {
|
||||
|
@ -1291,6 +1290,27 @@ static int adv7533_video_on(void *client, bool on,
|
|||
else
|
||||
ADV7533_WRITE(I2C_ADDR_MAIN, 0xAF, 0x04);
|
||||
|
||||
/* set scan info for AVI Infoframe*/
|
||||
if (cfg->scaninfo) {
|
||||
ADV7533_READ(I2C_ADDR_MAIN, 0x55, ®_val, 1);
|
||||
reg_val |= cfg->scaninfo & (BIT(1) | BIT(0));
|
||||
ADV7533_WRITE(I2C_ADDR_MAIN, 0x55, reg_val);
|
||||
}
|
||||
|
||||
/*
|
||||
* aspect ratio and sync polarity set up.
|
||||
* Currently adv only supports 16:9 or 4:3 aspect ratio
|
||||
* configuration.
|
||||
*/
|
||||
if (cfg->h_active * 3 - cfg->v_active * 4) {
|
||||
ADV7533_WRITE(I2C_ADDR_MAIN, 0x17, 0x02);
|
||||
ADV7533_WRITE(I2C_ADDR_MAIN, 0x56, 0x28);
|
||||
} else {
|
||||
/* 4:3 aspect ratio */
|
||||
ADV7533_WRITE(I2C_ADDR_MAIN, 0x17, 0x00);
|
||||
ADV7533_WRITE(I2C_ADDR_MAIN, 0x56, 0x18);
|
||||
}
|
||||
|
||||
ADV7533_WRITE_ARRAY(adv7533_video_en);
|
||||
end:
|
||||
mutex_unlock(&pdata->ops_mutex);
|
||||
|
|
|
@ -366,6 +366,7 @@ struct msm_dba_video_cfg {
|
|||
bool hdmi_mode;
|
||||
enum msm_dba_video_aspect_ratio ar;
|
||||
u32 num_of_input_lanes;
|
||||
u8 scaninfo;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue