summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c')
-rw-r--r--drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
index 56c3fd08c6a0..e642c15587ac 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
@@ -12,6 +12,7 @@
#include <linux/component.h>
#include <linux/debugfs.h>
#include <linux/iopoll.h>
+#include <linux/math64.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/pm_runtime.h>
@@ -386,8 +387,6 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host *host,
drm_of_panel_bridge_remove(host->dev->of_node, 1, 0);
- drm_bridge_remove(&dsi->bridge);
-
return 0;
}
@@ -654,7 +653,7 @@ static void dw_mipi_dsi_init(struct dw_mipi_dsi *dsi)
* timeout clock division should be computed with the
* high speed transmission counter timeout and byte lane...
*/
- dsi_write(dsi, DSI_CLKMGR_CFG, TO_CLK_DIVISION(10) |
+ dsi_write(dsi, DSI_CLKMGR_CFG, TO_CLK_DIVISION(0) |
TX_ESC_CLK_DIVISION(esc_clk_division));
}
@@ -733,8 +732,15 @@ static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi,
u32 hcomponent)
{
u32 frac, lbcc;
+ int bpp;
+
+ bpp = mipi_dsi_pixel_format_to_bpp(dsi->format);
+ if (bpp < 0) {
+ dev_err(dsi->dev, "failed to get bpp\n");
+ return 0;
+ }
- lbcc = hcomponent * dsi->lane_mbps * MSEC_PER_SEC / 8;
+ lbcc = div_u64((u64)hcomponent * mode->clock * bpp, dsi->lanes * 8);
frac = lbcc % mode->clock;
lbcc = lbcc / mode->clock;
@@ -1216,6 +1222,8 @@ __dw_mipi_dsi_probe(struct platform_device *pdev,
static void __dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi)
{
+ drm_bridge_remove(&dsi->bridge);
+
mipi_dsi_host_unregister(&dsi->dsi_host);
pm_runtime_disable(dsi->dev);