drm/bridge: imx: Add i.MX93 MIPI DSI support
Subsystems (6)
Ying Liu
maintainerv2 cover drm/bridge: imx: Add i.MX93 MIPI DSI support
Hi,
This series aims to add MIPI DSI support for Freescale i.MX93 SoC.
There is a Synopsys DesignWare MIPI DSI host controller and a Synopsys Designware MIPI DPHY embedded in i.MX93. Some configurations and extensions to them are controlled by i.MX93 media blk-ctrl.
Add a DRM bridge for i.MX93 MIPI DSI by using existing DW MIPI DSI bridge helpers and implementing i.MX93 MIPI DSI specific extensions.
Note that since this series touches the dw-mipi-dsi driver, tests are needed to be done for meson, rockchip and stm.
Patch 1 ~ 7 do preparation work for adding i.MX93 MIPI DSI DRM bridge driver.
Patch 8 adds DT-binding documentation for i.MX93 MIPI DSI.
Patch 9 adds i.MX93 MIPI DSI DRM bridge.
v1->v2:
* Add Rob's R-b tag on patch 8.
* Use dev_err_probe() to replace DRM_DEV_ERROR() in patch 9. (Sam and Alexander)
* Use dev_*() to replace DRM_*() in patch 9. (Sam)
* Fix build for arm architecture in patch 9.
(Reported-by: kernel test robot <[email protected]>)
* Improve error messages for imx93_dsi_phy_init() in patch 9.
Liu Ying (9):
drm/bridge: synopsys: dw-mipi-dsi: Add dw_mipi_dsi_get_bridge() helper drm/bridge: synopsys: dw-mipi-dsi: Add input bus format negotiation
support
drm/bridge: synopsys: dw-mipi-dsi: Force input bus flags drm/bridge: synopsys: dw-mipi-dsi: Add mode fixup support drm/bridge: synopsys: dw-mipi-dsi: Use pixel clock rate to calculate
lbcc
drm/bridge: synopsys: dw-mipi-dsi: Set minimum lane byte clock cycles
for HSA and HBP
drm/bridge: synopsys: dw-mipi-dsi: Disable HSTX and LPRX timeout check
dt-bindings: display: bridge: Document Freescale i.MX93 MIPI DSI drm/bridge: imx: Add i.MX93 MIPI DSI support
.../display/bridge/fsl,imx93-mipi-dsi.yaml | 115 +++ drivers/gpu/drm/bridge/imx/Kconfig | 10 + drivers/gpu/drm/bridge/imx/Makefile | 1 + drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c | 917 ++++++++++++++++++ drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 91 +- include/drm/bridge/dw_mipi_dsi.h | 16 + 6 files changed, 1146 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx93-mipi-dsi.yaml create mode 100644 drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c
Signature · 1 line
2.37.1
Ying Liu
maintainerPATCH v2 1/9 drm/bridge: synopsys: dw-mipi-dsi: Add dw_mipi_dsi_get_bridge() helper
Add dw_mipi_dsi_get_bridge() helper so that it can be used by vendor drivers which implement vendor specific extensions to Synopsys DW MIPI DSI.
---v1->v2:
* No change.
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 6 ++++++ include/drm/bridge/dw_mipi_dsi.h | 2 ++ 2 files changed, 8 insertions(+)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +6 -0
@@ -1207,6 +1207,12 @@ void dw_mipi_dsi_set_slave(struct dw_mipi_dsi *dsi, struct dw_mipi_dsi *slave) }EXPORT_SYMBOL_GPL (dw_mipi_dsi_set_slave); +struct drm_bridge *dw_mipi_dsi_get_bridge (struct dw_mipi_dsi *dsi) +{ +return &dsi->bridge; +} +EXPORT_SYMBOL_GPL (dw_mipi_dsi_get_bridge); +/* * Probe/remove API, used from platforms based on the DRM bridge API. */
include/drm/bridge/dw_mipi_dsi.h +2 -0
@@ -11,6 +11,7 @@#include <linux/types.h> +#include <drm/drm_bridge.h> #include <drm/drm_modes.h> struct drm_display_mode ;
@@ -68,5 +69,6 @@ void dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi);int dw_mipi_dsi_bind (struct dw_mipi_dsi *dsi,struct drm_encoder *encoder);void dw_mipi_dsi_unbind (struct dw_mipi_dsi *dsi);void dw_mipi_dsi_set_slave (struct dw_mipi_dsi *dsi,struct dw_mipi_dsi *slave); +struct drm_bridge *dw_mipi_dsi_get_bridge (struct dw_mipi_dsi *dsi);#endif /* __DW_MIPI_DSI__ */
Signature · 1 line
2.37.1
Ying Liu
maintainerPATCH v2 2/9 drm/bridge: synopsys: dw-mipi-dsi: Add input bus format negotiation support
In reply to Ying LiuIntroduce ->get_input_bus_fmts() callback to struct dw_mipi_dsi_plat_data so that vendor drivers can implement specific methods to get input bus formats for Synopsys DW MIPI DSI.
While at it, implement a generic callback for ->atomic_get_input_bus_fmts(), where we try to get the input bus formats through pdata->get_input_bus_fmts() first. If it's unavailable, fall back to the only format - MEDIA_BUS_FMT_FIXED, which matches the default behavior if ->atomic_get_input_bus_fmts() is not implemented as ->atomic_get_input_bus_fmts()'s kerneldoc indicates.
---v1->v2:
* No change.
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 30 +++++++++++++++++++ include/drm/bridge/dw_mipi_dsi.h | 11 +++++++ 2 files changed, 41 insertions(+)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +30 -0
@@ -12,6 +12,7 @@#include <linux/component.h> #include <linux/debugfs.h> #include <linux/iopoll.h> +#include <linux/media-bus-format.h> #include <linux/module.h> #include <linux/of_device.h> #include <linux/pm_runtime.h>
@@ -536,6 +537,34 @@ static const struct mipi_dsi_host_ops dw_mipi_dsi_host_ops = { .transfer = dw_mipi_dsi_host_transfer, }; +static u32 * +dw_mipi_dsi_bridge_atomic_get_input_bus_fmts (struct drm_bridge *bridge, +struct drm_bridge_state *bridge_state, +struct drm_crtc_state *crtc_state, +struct drm_connector_state *conn_state, +u32 output_fmt, +unsigned int *num_input_fmts) +{ +struct dw_mipi_dsi *dsi =bridge_to_dsi (bridge); +const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data; +u32 *input_fmts; + +if (pdata->get_input_bus_fmts) +return pdata->get_input_bus_fmts (pdata->priv_data, + bridge, bridge_state, + crtc_state, conn_state, + output_fmt, num_input_fmts); + +/* Fall back to MEDIA_BUS_FMT_FIXED as the only input format. */ + input_fmts =kmalloc (sizeof (*input_fmts),GFP_KERNEL ); +if (!input_fmts) +return NULL ; + input_fmts[0 ] =MEDIA_BUS_FMT_FIXED ; + *num_input_fmts =1 ; + +return input_fmts; +} +static void dw_mipi_dsi_video_mode_config (struct dw_mipi_dsi *dsi) {u32 val;
@@ -1003,6 +1032,7 @@ static int dw_mipi_dsi_bridge_attach(struct drm_bridge *bridge,static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_get_input_bus_fmts = dw_mipi_dsi_bridge_atomic_get_input_bus_fmts, .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_enable = dw_mipi_dsi_bridge_atomic_enable, .atomic_post_disable = dw_mipi_dsi_bridge_post_atomic_disable,
include/drm/bridge/dw_mipi_dsi.h +11 -0
@@ -11,7 +11,10 @@#include <linux/types.h> +#include <drm/drm_atomic.h> #include <drm/drm_bridge.h> +#include <drm/drm_connector.h> +#include <drm/drm_crtc.h> #include <drm/drm_modes.h> struct drm_display_mode ;
@@ -56,6 +59,14 @@ struct dw_mipi_dsi_plat_data {unsigned long mode_flags, u32 lanes, u32 format); +u32 *(*get_input_bus_fmts)(void *priv_data, +struct drm_bridge *bridge, +struct drm_bridge_state *bridge_state, +struct drm_crtc_state *crtc_state, +struct drm_connector_state *conn_state, +u32 output_fmt, +unsigned int *num_input_fmts); +const struct dw_mipi_dsi_phy_ops *phy_ops;const struct dw_mipi_dsi_host_ops *host_ops;
Signature · 1 line
2.37.1
Re: [PATCH v2 2/9] drm/bridge: synopsys: dw-mipi-dsi: Add input bus format negotiation support
Quoted 43 lines · Ying Liu
Introduce ->get_input_bus_fmts() callback to struct
dw_mipi_dsi_plat_dataso that vendor drivers can implement specific methods to get input bus formats for Synopsys DW MIPI DSI.While at it, implement a generic callback for ->atomic_get_input_bus_fmts(), where we try to get the input bus formats through
pdata->get_input_bus_fmts()first. If it's unavailable, fall back to the only format -MEDIA_BUS_FMT_FIXED, which matches the default behavior if ->atomic_get_input_bus_fmts() is not implemented as ->atomic_get_input_bus_fmts()'s kerneldoc indicates.Signed-off-by Liu Ying <[email protected]>---
v1->v2:
* No change.drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 30 +++++++++++++++++++ include/drm/bridge/dw_mipi_dsi.h | 11 +++++++ 2 files changed, 41 insertions(+)drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +8
-0@@ -12,6 +12,7 @@#include <linux/component.h> #include <linux/debugfs.h> #include <linux/iopoll.h> +#include <linux/media-bus-format.h> #include <linux/module.h> #include <linux/of_device.h> #include <linux/pm_runtime.h> @@ -536,6 +537,34 @@ static const struct mipi_dsi_host_ops dw_mipi_dsi_host_ops = { .transfer = dw_mipi_dsi_host_transfer, }; +static u32 * +dw_mipi_dsi_bridge_atomic_get_input_bus_fmts (struct drm_bridge *bridge, +struct drm_bridge_state *bridge_state, +struct drm_crtc_state *crtc_state, +struct drm_connector_state *conn_state, +u32 output_fmt, +unsigned int *num_input_fmts)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static const struct mipi_dsi_host_ops dw_mipi_dsi_host_ops = { · line 556
Quoted 10 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +10
-0+{ +struct dw_mipi_dsi *dsi =bridge_to_dsi (bridge); +const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data; +u32 *input_fmts; + +if (pdata->get_input_bus_fmts) +return pdata->get_input_bus_fmts (pdata->priv_data, + bridge, bridge_state, + crtc_state, conn_state, + output_fmt, num_input_fmts);
Why do we need platform-controlled bus formats? The supported bridge formats are common across all platforms and it is specific to the list of formats supported by DW-MIPI DSI. isn't it?
Thanks,
Jagan.
Ying Liu
maintainerRE: [PATCH v2 2/9] drm/bridge: synopsys: dw-mipi-dsi: Add input bus format negotiation support
Quoted 59 lines · Jagan Teki
Quoted 10 lines · Ying Liu
Introduce ->get_input_bus_fmts() callback to struct
dw_mipi_dsi_plat_dataso that vendor drivers can implement specific methods to get input bus formats for Synopsys DW MIPI DSI.While at it, implement a generic callback for -
atomic_get_input_bus_fmts(),
where we try to get the input bus formats through pdata-get_input_bus_fmts()
first. If it's unavailable, fall back to the only format -
MEDIA_BUS_FMT_FIXED,Quoted 1 line
which matches the default behavior if ->atomic_get_input_bus_fmts() is
not
Quoted 8 lines
implemented as ->atomic_get_input_bus_fmts()'s kerneldoc indicates.
Signed-off-by Liu Ying <[email protected]>---
v1->v2:
* No change.drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 30+++++++++++++++++++
Review
Quoted 4 lines
include/drm/bridge/dw_mipi_dsi.h | 11 +++++++ 2 files changed, 41 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.cdrivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static const struct mipi_dsi_host_ops
Quoted 12 lines
index
57eae0fdd970..8580b8a97fb1100644drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1
-0@@ -12,6 +12,7 @@#include <linux/component.h> #include <linux/debugfs.h> #include <linux/iopoll.h> +#include <linux/media-bus-format.h> #include <linux/module.h> #include <linux/of_device.h> #include <linux/pm_runtime.h> @@ -536,6 +537,34 @@ static const struct mipi_dsi_host_ops
dw_mipi_dsi_host_ops= {drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static const struct mipi_dsi_host_ops dw_mipi_dsi_host_ops = {
Quoted 5 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +2
-0.transfer = dw_mipi_dsi_host_transfer, }; +static u32 * +dw_mipi_dsi_bridge_atomic_get_input_bus_fmts(struct drm_bridge*bridge,
Quoted 11 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +11
-0+struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + u32 output_fmt, + unsigned int *num_input_fmts) +{ + struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); +const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data; +u32 *input_fmts; + +if (pdata->get_input_bus_fmts)
Quoted 8 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c static const struct mipi_dsi_host_ops dw_mipi_dsi_host_ops = { · line 556
Quoted 4 lines
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +4
-0+return pdata->get_input_bus_fmts (pdata->priv_data, + bridge, bridge_state, + crtc_state, conn_state, + output_fmt, num_input_fmts);Why do we need platform-controlled bus formats? The supported bridge formats are common across all platforms and it is specific to the list of formats supported by DW-MIPI DSI. isn't it?
Ideally, yes. But, if we consider some SoC logics introduced due to DW MIPI DSI integration(like the DISPLAY_MUX register in i.MX93 media blk-ctrl as a syscon), then pdata->get_input_bus_fmts is handy to cover the logics. Meson's MIPI_DSI_TOP_CNTL register and stm's DSI_WCFGR register are the similar cases for integration. Rockchip directly sets display controller's output bus format in ->atomic_check().
Granted those SoC logics can be a standalone DRM bridge as the previous bridge of the DW MIPI DSI bridge. However, the question is that are the logics worth a separate DRM bridge driver, considering pdata->get_input_bus_fmts is quite handy?
Implementing a separate DRM bridge driver for i.MX93 DISPLAY_MUX to add two DRM bridges is a bit hard, because the single register controls both external parallel display pixel format and DSI controller input pixel format with different bit fields. And, I've already sent a patch series[1] to add a DRM bridge driver for the external parallel display pixel format control.
[1] https://patchwork.freedesktop.org/series/113457/
Regards,
Liu Ying
Quoted 3 lines
Thanks,
Jagan.
Ying Liu
maintainerPATCH v2 3/9 drm/bridge: synopsys: dw-mipi-dsi: Force input bus flags
In reply to Ying LiuThe DATAEN_ACTIVE_LOW bit in DSI_DPI_CFG_POL register is set to zero, so set the DRM_BUS_FLAG_DE_HIGH flag in input_bus_cfg.flags. It appears that the DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE flag also makes sense, so set it in input_bus_cfg.flags too. With this patch, the flags set by drm_atomic_bridge_propagate_bus_flags() are overridden (see comment in that function) in case any downstream bridges propagates invalid flags to this bridge. A real problematic case is to connect a RM67191 MIPI DSI panel whose driver sets DRM_BUS_FLAG_DE_LOW and DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE bus flags.
---v1->v2:
* No change.
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +13 -0
@@ -23,6 +23,7 @@#include <drm/bridge/dw_mipi_dsi.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_bridge.h> +#include <drm/drm_connector.h> #include <drm/drm_crtc.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_modes.h>
@@ -565,6 +566,17 @@ dw_mipi_dsi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,return input_fmts; } +static int dw_mipi_dsi_bridge_atomic_check (struct drm_bridge *bridge, +struct drm_bridge_state *bridge_state, +struct drm_crtc_state *crtc_state, +struct drm_connector_state *conn_state) +{ + bridge_state->input_bus_cfg.flags = +DRM_BUS_FLAG_DE_HIGH |DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE ; + +return 0 ; +} +static void dw_mipi_dsi_video_mode_config (struct dw_mipi_dsi *dsi) {u32 val;
@@ -1033,6 +1045,7 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_get_input_bus_fmts = dw_mipi_dsi_bridge_atomic_get_input_bus_fmts, + .atomic_check = dw_mipi_dsi_bridge_atomic_check, .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_enable = dw_mipi_dsi_bridge_atomic_enable, .atomic_post_disable = dw_mipi_dsi_bridge_post_atomic_disable,
Signature · 1 line
2.37.1
Ying Liu
maintainerPATCH v2 4/9 drm/bridge: synopsys: dw-mipi-dsi: Add mode fixup support
In reply to Ying LiuVendor drivers may need to fixup mode due to pixel clock tree limitation, so introduce the ->mode_fixup() callcack to struct dw_mipi_dsi_plat_data and call it at atomic check stage if available.
---v1->v2:
* No change.
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 14 ++++++++++++++ include/drm/bridge/dw_mipi_dsi.h | 3 +++ 2 files changed, 17 insertions(+)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +14 -0
@@ -571,9 +571,23 @@ static int dw_mipi_dsi_bridge_atomic_check(struct drm_bridge *bridge,struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) { + struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); +const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data; +bool ret; + bridge_state->input_bus_cfg.flags =DRM_BUS_FLAG_DE_HIGH |DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE ; +if (pdata->mode_fixup) { + ret = pdata->mode_fixup (pdata->priv_data, &crtc_state->mode, + &crtc_state->adjusted_mode); +if (!ret) { +DRM_DEBUG_DRIVER ("failed to fixup mode " DRM_MODE_FMT "\n" , +DRM_MODE_ARG (&crtc_state->mode)); +return -EINVAL ; + } + } +return 0 ; }
include/drm/bridge/dw_mipi_dsi.h +3 -0
@@ -59,6 +59,9 @@ struct dw_mipi_dsi_plat_data {unsigned long mode_flags, u32 lanes, u32 format); +bool (*mode_fixup)(void *priv_data,const struct drm_display_mode *mode, +struct drm_display_mode *adjusted_mode); + u32 *(*get_input_bus_fmts)(void *priv_data, struct drm_bridge *bridge, struct drm_bridge_state *bridge_state,
Signature · 1 line
2.37.1
Ying Liu
maintainerPATCH v2 5/9 drm/bridge: synopsys: dw-mipi-dsi: Use pixel clock rate to calculate lbcc
In reply to Ying LiuTo get better accuration, use pixel clock rate to calculate lbcc instead of lane_mbps since the pixel clock rate is in KHz while lane_mbps is in MHz. Without this, distorted image can be seen on a HDMI monitor connected with i.MX93 11x11 EVK through ADV7535 DSI to HDMI bridge in 1920x1080p@60 video mode.
---v1->v2:
* No change.
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +9 -1
@@ -12,6 +12,7 @@#include <linux/component.h> #include <linux/debugfs.h> #include <linux/iopoll.h> +#include <linux/math64.h> #include <linux/media-bus-format.h> #include <linux/module.h> #include <linux/of_device.h>
@@ -762,8 +763,15 @@ static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi, u32 hcomponent) {u32 frac, lbcc; +int bpp; - lbcc = hcomponent * dsi->lane_mbps *MSEC_PER_SEC /8 ; + bpp =mipi_dsi_pixel_format_to_bpp (dsi->format); +if (bpp <0 ) { +dev_err (dsi->dev,"failed to get bpp\n" ); +return 0 ; + } + + lbcc =div_u64 ((u64 )hcomponent * mode->clock * bpp, dsi->lanes *8 ); frac = lbcc % mode->clock; lbcc = lbcc / mode->clock;
Signature · 1 line
2.37.1
Ying Liu
maintainerPATCH v2 6/9 drm/bridge: synopsys: dw-mipi-dsi: Set minimum lane byte clock cycles for HSA and HBP
In reply to Ying LiuAccording to Synopsys support channel, each region of HSA, HBP and HFP must have minimum number of 10 bytes where constant 4 bytes are for HSS or HSE and 6 bytes are for blanking packet(header + CRC). Hence, the below table comes in.
+------------+----------+-------+ | data lanes | min lbcc | bytes | +------------+----------+-------+ | 1 | 10 | 1*10 | +------------+----------+-------+ | 2 | 5 | 2*5 | +------------+----------+-------+ | 3 | 4 | 3*4 | +------------+----------+-------+ | 4 | 3 | 4*3 | +------------+----------+-------+
Implement the minimum lbcc numbers to make sure that the values programmed into DSI_VID_HSA_TIME and DSI_VID_HBP_TIME registers meet the minimum number requirement. For DSI_VID_HLINE_TIME register, it seems that the value programmed should be based on mode->htotal as-is, instead of sum up HSA, HBP, HFP and HDISPLAY.
This helps the case where Raydium RM67191 DSI panel is connected, since it's video timing for hsync length is only 2 pixels and without this patch the programmed value for DSI_VID_HSA_TIME is only 2 with 4 data lanes.
---v1->v2:
* No change.
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +13 -1
@@ -757,12 +757,19 @@ static void dw_mipi_dsi_command_mode_config(struct dw_mipi_dsi *dsi)dsi_write (dsi,DSI_MODE_CFG ,ENABLE_CMD_MODE ); } +static const u32 minimum_lbccs[] = {10 ,5 ,4 ,3 }; + +static inline u32 dw_mipi_dsi_get_minimum_lbcc (struct dw_mipi_dsi *dsi) +{ +return minimum_lbccs[dsi->lanes -1 ]; +} +/* Get lane byte clock cycles. */ static u32 dw_mipi_dsi_get_hcomponent_lbcc (struct dw_mipi_dsi *dsi,const struct drm_display_mode *mode,u32 hcomponent) { -u32 frac, lbcc; +u32 frac, lbcc, minimum_lbcc;int bpp; bpp =mipi_dsi_pixel_format_to_bpp (dsi->format);
@@ -778,6 +785,11 @@ static u32 dw_mipi_dsi_get_hcomponent_lbcc(struct dw_mipi_dsi *dsi,if (frac) lbcc++; + minimum_lbcc =dw_mipi_dsi_get_minimum_lbcc (dsi); + +if (lbcc < minimum_lbcc) + lbcc = minimum_lbcc; +return lbcc; }
Signature · 1 line
2.37.1
Ying Liu
maintainerPATCH v2 7/9 drm/bridge: synopsys: dw-mipi-dsi: Disable HSTX and LPRX timeout check
In reply to Ying LiuAccording to Synopsys DW MIPI DSI host databook, HSTX and LPRX timeout contention detections are measured in TO_CLK_DIVISION cycles. However, the current driver programs magic values to TO_CLK_DIVISION, HSTX_TO_CNT and LPRX_TO_CNT register fields, which makes timeout error event wrongly happen for some video modes, at least for the typical 1920x1080p@60 video mode read from a HDMI monitor driven by ADV7535 DSI to HDMI bridge. While at it, the current driver doesn't enable interrupt to handle or complain about the error status, so true error just happens silently except for display distortions by visual check.
Disable the timeout check by setting those timeout register fields to zero for now until someone comes along with better computations for the timeout values. Although the databook doesn't mention what happens when they are set to zero, it turns out the false error doesn't happen for the 1920x1080p@60 video mode at least.
---v1->v2:
* No change.
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +2 -2
@@ -684,7 +684,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)); }
@@ -747,7 +747,7 @@ static void dw_mipi_dsi_command_mode_config(struct dw_mipi_dsi *dsi)* compute high speed transmission counter timeout according * to the timeout clock division (TO_CLK_DIVISION) and byte lane... */ -dsi_write (dsi,DSI_TO_CNT_CFG ,HSTX_TO_CNT (1000 ) |LPRX_TO_CNT (1000 )); +dsi_write (dsi,DSI_TO_CNT_CFG ,HSTX_TO_CNT (0 ) |LPRX_TO_CNT (0 ));/* * TODO dw drv improvements * the Bus-Turn-Around Timeout Counter should be computed
Signature · 1 line
2.37.1
Ying Liu
maintainerPATCH v2 8/9 dt-bindings: display: bridge: Document Freescale i.MX93 MIPI DSI
In reply to Ying LiuFreescale i.MX93 SoC embeds a Synopsys Designware MIPI DSI host controller and a Synopsys Designware MIPI DPHY. Some configurations and extensions to them are controlled by i.MX93 media blk-ctrl.
---v1->v2:
* Add Rob's R-b tag.
.../display/bridge/fsl,imx93-mipi-dsi.yaml | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/fsl,imx93-mipi-dsi.yaml
Documentation/devicetree/bindings/display/bridge/fsl,imx93-mipi-dsi.yaml new file +115 -0
@@ -0,0 +1,115 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/fsl,imx93-mipi-dsi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale i.MX93 specific extensions to Synopsys Designware MIPI DSI + +maintainers: + - Liu Ying <[email protected]> + +description: | + There is a Synopsys Designware MIPI DSI Host Controller and a Synopsys + Designware MIPI DPHY embedded in Freescale i.MX93 SoC. Some configurations + and extensions to them are controlled by i.MX93 media blk-ctrl. + +allOf: + - $ref: snps,dw-mipi-dsi.yaml# + +properties: + compatible: + const: fsl,imx93-mipi-dsi + + clocks: + items: + - description: apb clock + - description: pixel clock + - description: PHY configuration clock + - description: PHY reference clock + + clock-names: + items: + - const: pclk + - const: pix + - const: phy_cfg + - const: phy_ref + + interrupts: + maxItems: 1 + + fsl,media-blk-ctrl: + $ref: /schemas/types.yaml#/definitions/phandle + description: + i.MX93 media blk-ctrl, as a syscon, controls pixel component bit map + configurations from LCDIF display controller to the MIPI DSI host + controller and MIPI DPHY PLL related configurations through PLL SoC + interface. + + power-domains: + maxItems: 1 + +required: + - compatible + - interrupts + - fsl,media-blk-ctrl + - power-domains + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/imx93-clock.h> + #include <dt-bindings/gpio/gpio.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/power/fsl,imx93-power.h> + + dsi@4ae10000 { + compatible = "fsl,imx93-mipi-dsi"; + reg = <0x4ae10000 0x10000>; + interrupts = <GIC_SPI 177 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clk IMX93_CLK_MIPI_DSI_GATE>, + <&clk IMX93_CLK_MEDIA_DISP_PIX>, + <&clk IMX93_CLK_MIPI_PHY_CFG>, + <&clk IMX93_CLK_24M>; + clock-names = "pclk", "pix", "phy_cfg", "phy_ref"; + fsl,media-blk-ctrl = <&media_blk_ctrl>; + power-domains = <&media_blk_ctrl IMX93_MEDIABLK_PD_MIPI_DSI>; + #address-cells = <1>; + #size-cells = <0>; + + panel@0 { + compatible = "raydium,rm67191"; + reg = <0>; + reset-gpios = <&adp5585gpio 6 GPIO_ACTIVE_LOW>; + dsi-lanes = <4>; + video-mode = <2>; + + port { + panel_in: endpoint { + remote-endpoint = <&dsi_out>; + }; + }; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + dsi_to_lcdif: endpoint { + remote-endpoint = <&lcdif_to_dsi>; + }; + }; + + port@1 { + reg = <1>; + + dsi_out: endpoint { + remote-endpoint = <&panel_in>; + }; + }; + }; + };
Signature · 1 line
2.37.1
Ying Liu
maintainerPATCH v2 9/9 drm/bridge: imx: Add i.MX93 MIPI DSI support
In reply to Ying LiuFreescale i.MX93 SoC embeds a Synopsys Designware MIPI DSI host controller and a Synopsys Designware MIPI DPHY. Some configurations and extensions to them are controlled by i.MX93 media blk-ctrl.
Add a DRM bridge for i.MX93 MIPI DSI by using existing DW MIPI DSI bridge helpers and implementing i.MX93 MIPI DSI specific extensions.
---v1->v2:
* Use dev_err_probe() to replace DRM_DEV_ERROR(). (Sam and Alexander)
* Use dev_*() to replace DRM_*(). (Sam)
* Fix build for arm architecture.
(Reported-by: kernel test robot <[email protected]>)
* Improve error messages for imx93_dsi_phy_init().
drivers/gpu/drm/bridge/imx/Kconfig | 10 + drivers/gpu/drm/bridge/imx/Makefile | 1 + drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c | 917 ++++++++++++++++++++ 3 files changed, 928 insertions(+) create mode 100644 drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c
drivers/gpu/drm/bridge/imx/Kconfig +10 -0
@@ -49,4 +49,14 @@ config DRM_IMX8QXP_PIXEL_LINK_TO_DPI Choose this to enable pixel link to display pixel interface(PXL2DPI) found in Freescale i.MX8qxp processor. +config DRM_IMX93_MIPI_DSI + tristate "Freescale i.MX93 specific extensions for Synopsys DW MIPI DSI" + depends on OF + depends on COMMON_CLK + select DRM_DW_MIPI_DSI + select GENERIC_PHY_MIPI_DPHY + help + Choose this to enable MIPI DSI controller found in Freescale i.MX93 + processor. + endif # ARCH_MXC || COMPILE_TEST
drivers/gpu/drm/bridge/imx/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o obj-$(CONFIG_DRM_IMX8QXP_PIXEL_COMBINER) += imx8qxp-pixel-combiner.o obj-$(CONFIG_DRM_IMX8QXP_PIXEL_LINK) += imx8qxp-pixel-link.o obj-$(CONFIG_DRM_IMX8QXP_PIXEL_LINK_TO_DPI) += imx8qxp-pxl2dpi.o +obj-$(CONFIG_DRM_IMX93_MIPI_DSI) += imx93-mipi-dsi.o
drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c new file +917 -0
917 lines not on this page · raw message
Signature · 1 line
2.37.1