mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 00:53:34 +02:00
drm/bridge: cdns-dsi: Drop crtc_* code
With recent change the cdns_dsi_check_conf() is always called with mode_valid_check = true. We can thus remove all the code related to the "false" paths. Tested-by: Parth Pancholi <parth.pancholi@toradex.com> Tested-by: Jayesh Choudhary <j-choudhary@ti.com> Reviewed-by: Devarsh Thakkar <devarsht@ti.com> Link: https://lore.kernel.org/r/20250723-cdns-dsi-impro-v5-5-e61cc06074c2@ideasonboard.com Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
This commit is contained in:
parent
661598d90c
commit
2325e509ae
|
|
@ -452,15 +452,6 @@ bridge_to_cdns_dsi_input(struct drm_bridge *bridge)
|
|||
return container_of(bridge, struct cdns_dsi_input, bridge);
|
||||
}
|
||||
|
||||
static unsigned int mode_to_dpi_hfp(const struct drm_display_mode *mode,
|
||||
bool mode_valid_check)
|
||||
{
|
||||
if (mode_valid_check)
|
||||
return mode->hsync_start - mode->hdisplay;
|
||||
|
||||
return mode->crtc_hsync_start - mode->crtc_hdisplay;
|
||||
}
|
||||
|
||||
static unsigned int dpi_to_dsi_timing(unsigned int dpi_timing,
|
||||
unsigned int dpi_bpp,
|
||||
unsigned int dsi_pkt_overhead)
|
||||
|
|
@ -477,8 +468,7 @@ static unsigned int dpi_to_dsi_timing(unsigned int dpi_timing,
|
|||
|
||||
static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi,
|
||||
const struct drm_display_mode *mode,
|
||||
struct cdns_dsi_cfg *dsi_cfg,
|
||||
bool mode_valid_check)
|
||||
struct cdns_dsi_cfg *dsi_cfg)
|
||||
{
|
||||
struct cdns_dsi_output *output = &dsi->output;
|
||||
unsigned int tmp;
|
||||
|
|
@ -492,30 +482,20 @@ static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi,
|
|||
|
||||
bpp = mipi_dsi_pixel_format_to_bpp(output->dev->format);
|
||||
|
||||
if (mode_valid_check)
|
||||
tmp = mode->htotal -
|
||||
(sync_pulse ? mode->hsync_end : mode->hsync_start);
|
||||
else
|
||||
tmp = mode->crtc_htotal -
|
||||
(sync_pulse ?
|
||||
mode->crtc_hsync_end : mode->crtc_hsync_start);
|
||||
tmp = mode->htotal -
|
||||
(sync_pulse ? mode->hsync_end : mode->hsync_start);
|
||||
|
||||
dsi_cfg->hbp = dpi_to_dsi_timing(tmp, bpp, DSI_HBP_FRAME_OVERHEAD);
|
||||
|
||||
if (sync_pulse) {
|
||||
if (mode_valid_check)
|
||||
tmp = mode->hsync_end - mode->hsync_start;
|
||||
else
|
||||
tmp = mode->crtc_hsync_end - mode->crtc_hsync_start;
|
||||
tmp = mode->hsync_end - mode->hsync_start;
|
||||
|
||||
dsi_cfg->hsa = dpi_to_dsi_timing(tmp, bpp,
|
||||
DSI_HSA_FRAME_OVERHEAD);
|
||||
}
|
||||
|
||||
dsi_cfg->hact = dpi_to_dsi_timing(mode_valid_check ?
|
||||
mode->hdisplay : mode->crtc_hdisplay,
|
||||
bpp, 0);
|
||||
dsi_cfg->hfp = dpi_to_dsi_timing(mode_to_dpi_hfp(mode, mode_valid_check),
|
||||
dsi_cfg->hact = dpi_to_dsi_timing(mode->hdisplay, bpp, 0);
|
||||
dsi_cfg->hfp = dpi_to_dsi_timing(mode->hsync_start - mode->hdisplay,
|
||||
bpp, DSI_HFP_FRAME_OVERHEAD);
|
||||
|
||||
return 0;
|
||||
|
|
@ -524,14 +504,12 @@ static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi,
|
|||
static int cdns_dsi_adjust_phy_config(struct cdns_dsi *dsi,
|
||||
struct cdns_dsi_cfg *dsi_cfg,
|
||||
struct phy_configure_opts_mipi_dphy *phy_cfg,
|
||||
const struct drm_display_mode *mode,
|
||||
bool mode_valid_check)
|
||||
const struct drm_display_mode *mode)
|
||||
{
|
||||
struct cdns_dsi_output *output = &dsi->output;
|
||||
unsigned long long dlane_bps;
|
||||
unsigned long adj_dsi_htotal;
|
||||
unsigned long dsi_htotal;
|
||||
unsigned long dpi_htotal;
|
||||
unsigned long dpi_hz;
|
||||
unsigned int dsi_hfp_ext;
|
||||
unsigned int lanes = output->dev->lanes;
|
||||
|
|
@ -552,12 +530,11 @@ static int cdns_dsi_adjust_phy_config(struct cdns_dsi *dsi,
|
|||
if (dsi_htotal % lanes)
|
||||
adj_dsi_htotal += lanes - (dsi_htotal % lanes);
|
||||
|
||||
dpi_hz = (mode_valid_check ? mode->clock : mode->crtc_clock) * 1000;
|
||||
dpi_hz = mode->clock * 1000;
|
||||
dlane_bps = (unsigned long long)dpi_hz * adj_dsi_htotal;
|
||||
|
||||
/* data rate in bytes/sec is not an integer, refuse the mode. */
|
||||
dpi_htotal = mode_valid_check ? mode->htotal : mode->crtc_htotal;
|
||||
if (do_div(dlane_bps, lanes * dpi_htotal))
|
||||
if (do_div(dlane_bps, lanes * mode->htotal))
|
||||
return -EINVAL;
|
||||
|
||||
/* data rate was in bytes/sec, convert to bits/sec. */
|
||||
|
|
@ -572,27 +549,25 @@ static int cdns_dsi_adjust_phy_config(struct cdns_dsi *dsi,
|
|||
|
||||
static int cdns_dsi_check_conf(struct cdns_dsi *dsi,
|
||||
const struct drm_display_mode *mode,
|
||||
struct cdns_dsi_cfg *dsi_cfg,
|
||||
bool mode_valid_check)
|
||||
struct cdns_dsi_cfg *dsi_cfg)
|
||||
{
|
||||
struct cdns_dsi_output *output = &dsi->output;
|
||||
struct phy_configure_opts_mipi_dphy *phy_cfg = &output->phy_opts.mipi_dphy;
|
||||
unsigned long dsi_hss_hsa_hse_hbp;
|
||||
unsigned int nlanes = output->dev->lanes;
|
||||
int mode_clock = (mode_valid_check ? mode->clock : mode->crtc_clock);
|
||||
int ret;
|
||||
|
||||
ret = cdns_dsi_mode2cfg(dsi, mode, dsi_cfg, mode_valid_check);
|
||||
ret = cdns_dsi_mode2cfg(dsi, mode, dsi_cfg);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = phy_mipi_dphy_get_default_config(mode_clock * 1000,
|
||||
ret = phy_mipi_dphy_get_default_config(mode->clock * 1000,
|
||||
mipi_dsi_pixel_format_to_bpp(output->dev->format),
|
||||
nlanes, phy_cfg);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = cdns_dsi_adjust_phy_config(dsi, dsi_cfg, phy_cfg, mode, mode_valid_check);
|
||||
ret = cdns_dsi_adjust_phy_config(dsi, dsi_cfg, phy_cfg, mode);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
@ -610,9 +585,8 @@ static int cdns_dsi_check_conf(struct cdns_dsi *dsi,
|
|||
* interface.
|
||||
*/
|
||||
if ((u64)phy_cfg->hs_clk_rate *
|
||||
mode_to_dpi_hfp(mode, mode_valid_check) * nlanes <
|
||||
(u64)dsi_hss_hsa_hse_hbp *
|
||||
(mode_valid_check ? mode->clock : mode->crtc_clock) * 1000)
|
||||
(mode->hsync_start - mode->hdisplay) * nlanes <
|
||||
(u64)dsi_hss_hsa_hse_hbp * mode->clock * 1000)
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
|
|
@ -663,7 +637,7 @@ cdns_dsi_bridge_mode_valid(struct drm_bridge *bridge,
|
|||
if ((mode->hdisplay * bpp) % 32)
|
||||
return MODE_H_ILLEGAL;
|
||||
|
||||
ret = cdns_dsi_check_conf(dsi, mode, &dsi_cfg, true);
|
||||
ret = cdns_dsi_check_conf(dsi, mode, &dsi_cfg);
|
||||
if (ret)
|
||||
return MODE_BAD;
|
||||
|
||||
|
|
@ -1000,7 +974,7 @@ static int cdns_dsi_bridge_atomic_check(struct drm_bridge *bridge,
|
|||
const struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode;
|
||||
struct cdns_dsi_cfg *dsi_cfg = &dsi_state->dsi_cfg;
|
||||
|
||||
return cdns_dsi_check_conf(dsi, adjusted_mode, dsi_cfg, true);
|
||||
return cdns_dsi_check_conf(dsi, adjusted_mode, dsi_cfg);
|
||||
}
|
||||
|
||||
static struct drm_bridge_state *
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user