drm/msm/dsi-staging: update dsi clock calculations

Change updates dsi clock calculations for command mode
as per recommendation. Now dsi clocks are tied to
frame transer time. Propagate correct frame transfer
time to hal to update mdp clocks and bandwidth needed
accordingly.

Change-Id: I46f9038622ddd47cc53c5f3d54229f69a7008c8a
Signed-off-by: Vara Reddy <varar@codeaurora.org>
Este commit está contenido en:
Vara Reddy
2019-05-02 13:42:06 -07:00
padre 74f328561e
commit f28b596aac
Se han modificado 6 ficheros con 143 adiciones y 19 borrados

Ver fichero

@@ -873,6 +873,8 @@ static int dsi_panel_parse_pixel_format(struct dsi_host_common_cfg *host,
return rc;
}
host->bpp = bpp;
switch (bpp) {
case 3:
fmt = DSI_PIXEL_FORMAT_RGB111;
@@ -913,6 +915,7 @@ static int dsi_panel_parse_lane_states(struct dsi_host_common_cfg *host,
{
int rc = 0;
bool lane_enabled;
u32 num_of_lanes = 0;
lane_enabled = utils->read_bool(utils->data,
"qcom,mdss-dsi-lane-0-state");
@@ -930,6 +933,17 @@ static int dsi_panel_parse_lane_states(struct dsi_host_common_cfg *host,
"qcom,mdss-dsi-lane-3-state");
host->data_lanes |= (lane_enabled ? DSI_DATA_LANE_3 : 0);
if (host->data_lanes & DSI_DATA_LANE_0)
num_of_lanes++;
if (host->data_lanes & DSI_DATA_LANE_1)
num_of_lanes++;
if (host->data_lanes & DSI_DATA_LANE_2)
num_of_lanes++;
if (host->data_lanes & DSI_DATA_LANE_3)
num_of_lanes++;
host->num_data_lanes = num_of_lanes;
if (host->data_lanes == 0) {
pr_err("[%s] No data lanes are enabled, rc=%d\n", name, rc);
rc = -EINVAL;
@@ -3294,6 +3308,55 @@ void dsi_panel_put_mode(struct dsi_display_mode *mode)
kfree(mode->priv_info);
}
void dsi_panel_calc_dsi_transfer_time(struct dsi_host_common_cfg *config,
struct dsi_mode_info *timing)
{
u32 frame_time_us,nslices;
u64 min_bitclk, total_active_pixels, bits_per_line;
struct msm_display_dsc_info *dsc = timing->dsc;
/* Packet overlead in bits,2 bytes header + 2 bytes checksum
* + 1 byte dcs data command.
*/
const u32 packet_overhead = 56;
/* Default time between pingpong done to TE in microsecs */
const u32 max_tx_threshold_time = 2166;
frame_time_us = mult_frac(1000, 1000, (timing->refresh_rate));
if (timing->dsc_enabled) {
nslices = (timing->h_active)/(dsc->slice_width);
/* (slice width x bit-per-pixel + packet overhead) x
* number of slices x height x fps / lane
*/
bits_per_line = ((dsc->slice_width * dsc->bpp) +
packet_overhead) * nslices;
bits_per_line = bits_per_line / (config->num_data_lanes);
min_bitclk = (bits_per_line * timing->v_active *
timing->refresh_rate);
} else {
total_active_pixels = ((DSI_H_ACTIVE_DSC(timing)
* timing->v_active));
/* calculate the actual bitclk needed to transfer the frame */
min_bitclk = (total_active_pixels * (timing->refresh_rate) *
(config->bpp)) / (config->num_data_lanes);
}
timing->min_dsi_clk_hz = min_bitclk;
if (timing->clk_rate_hz) {
/* adjust the transfer time proportionately for bit clk*/
timing->dsi_transfer_time_us = mult_frac(frame_time_us,
min_bitclk, timing->clk_rate_hz);
} else {
timing->dsi_transfer_time_us = frame_time_us -
max_tx_threshold_time;
}
}
int dsi_panel_get_mode(struct dsi_panel *panel,
u32 index, struct dsi_display_mode *mode,
int topology_override)