Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: bridge: ti-sn65dsi83: Pass mode explicitly to helper functions

Pass the display mode explicitly to the sn65dsi83_get_lvds_range() and
sn65dsi83_get_dsi_range() functions to prepare for its removal from the
sn65dsi83 structure. This is not meant to bring any functional change.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210621125518.13715-3-laurent.pinchart@ideasonboard.com

authored by

Laurent Pinchart and committed by
Robert Foss
7f0b7f5e b966d857

+8 -6
+8 -6
drivers/gpu/drm/bridge/ti-sn65dsi83.c
··· 306 306 usleep_range(1000, 1100); 307 307 } 308 308 309 - static u8 sn65dsi83_get_lvds_range(struct sn65dsi83 *ctx) 309 + static u8 sn65dsi83_get_lvds_range(struct sn65dsi83 *ctx, 310 + const struct drm_display_mode *mode) 310 311 { 311 312 /* 312 313 * The encoding of the LVDS_CLK_RANGE is as follows: ··· 323 322 * the clock to 25..154 MHz, the range calculation can be simplified 324 323 * as follows: 325 324 */ 326 - int mode_clock = ctx->mode.clock; 325 + int mode_clock = mode->clock; 327 326 328 327 if (ctx->lvds_dual_link) 329 328 mode_clock /= 2; ··· 331 330 return (mode_clock - 12500) / 25000; 332 331 } 333 332 334 - static u8 sn65dsi83_get_dsi_range(struct sn65dsi83 *ctx) 333 + static u8 sn65dsi83_get_dsi_range(struct sn65dsi83 *ctx, 334 + const struct drm_display_mode *mode) 335 335 { 336 336 /* 337 337 * The encoding of the CHA_DSI_CLK_RANGE is as follows: ··· 348 346 * DSI_CLK = mode clock * bpp / dsi_data_lanes / 2 349 347 * the 2 is there because the bus is DDR. 350 348 */ 351 - return DIV_ROUND_UP(clamp((unsigned int)ctx->mode.clock * 349 + return DIV_ROUND_UP(clamp((unsigned int)mode->clock * 352 350 mipi_dsi_pixel_format_to_bpp(ctx->dsi->format) / 353 351 ctx->dsi_lanes / 2, 40000U, 500000U), 5000U); 354 352 } ··· 380 378 381 379 /* Reference clock derived from DSI link clock. */ 382 380 regmap_write(ctx->regmap, REG_RC_LVDS_PLL, 383 - REG_RC_LVDS_PLL_LVDS_CLK_RANGE(sn65dsi83_get_lvds_range(ctx)) | 381 + REG_RC_LVDS_PLL_LVDS_CLK_RANGE(sn65dsi83_get_lvds_range(ctx, &ctx->mode)) | 384 382 REG_RC_LVDS_PLL_HS_CLK_SRC_DPHY); 385 383 regmap_write(ctx->regmap, REG_DSI_CLK, 386 - REG_DSI_CLK_CHA_DSI_CLK_RANGE(sn65dsi83_get_dsi_range(ctx))); 384 + REG_DSI_CLK_CHA_DSI_CLK_RANGE(sn65dsi83_get_dsi_range(ctx, &ctx->mode))); 387 385 regmap_write(ctx->regmap, REG_RC_DSI_CLK, 388 386 REG_RC_DSI_CLK_DSI_CLK_DIVIDER(sn65dsi83_get_dsi_div(ctx))); 389 387