drm/msm/dpu: add support for independent DSI config
v2 cover drm/msm/dpu: add support for independent DSI config
This patchseries adds support for independent DSI config to DPU1 display subdriver. Also drop one of msm_kms_funcs callbacks, made unnecessary now.
Tested on RB5 (dpu, dsi). Previous iteration was tested by Alexey Minnekhanov.
Cahanges since v1:
- Rewrote dsi encoder setup function by separating common code sequence and calling it either for the bonded interface or twice for each of the DSI hosts.
Changes since RFC:
- renamed dual DSI to bonded DSI as suggsted by Abhinav
- added comments to _dpu_kms_initialize_dsi() regarding encoders usage
The following changes since commit e88bbc91849b2bf57683119c339e52916d34433f:
Revert "drm/msm/mdp5: provide dynamic bandwidth management" (2021-06-23 14:06:20 -0700)
are available in the Git repository at:
https://git.linaro.org/people/dmitry.baryshkov/kernel.git msm-drm-drop-set-encoder-mode-2
for you to fetch changes up to 3e10b945035d638bdf94f06b3fc86a6deaa41e63:
drm/msm/kms: drop set_encoder_mode callback (2021-07-10 02:46:00 +0300)
----------------------------------------------------------------
Dmitry Baryshkov (7):
drm/msm/dsi: rename dual DSI to bonded DSI
drm/msm/dsi: add two helper functions
drm/msm/dpu: support setting up two independent DSI connectors drm/msm/mdp5: move mdp5_encoder_set_intf_mode after msm_dsi_modeset_init drm/msm/dp: stop calling set_encoder_mode callback drm/msm/dsi: stop calling set_encoder_mode callback drm/msm/kms: drop set_encoder_mode callback
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 130 +++++++++++++++++++------------ drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 11 +-- drivers/gpu/drm/msm/dp/dp_display.c | 18 ----- drivers/gpu/drm/msm/dsi/dsi.c | 9 ++- drivers/gpu/drm/msm/dsi/dsi.h | 9 +-- drivers/gpu/drm/msm/dsi/dsi_cfg.h | 2 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 30 +++---- drivers/gpu/drm/msm/dsi/dsi_manager.c | 93 ++++++++++------------ drivers/gpu/drm/msm/msm_drv.h | 12 ++- drivers/gpu/drm/msm/msm_kms.h | 3 - 10 files changed, 158 insertions(+), 159 deletions(-)
PATCH v2 1/7 drm/msm/dsi: rename dual DSI to bonded DSI
We are preparing to support two independent DSI hosts in the DSI/DPU code. To remove possible confusion (as both configurations can be referenced as dual DSI) let's rename old "dual DSI" (two DSI hosts driving single device, with clocks being locked) to "bonded DSI".
--- drivers/gpu/drm/msm/dsi/dsi.h | 8 ++-- drivers/gpu/drm/msm/dsi/dsi_cfg.h | 2 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 30 ++++++------ drivers/gpu/drm/msm/dsi/dsi_manager.c | 69 +++++++++++++-------------- 4 files changed, 54 insertions(+), 55 deletions(-)
drivers/gpu/drm/msm/dsi/dsi.h +4 -4
@@ -109,7 +109,7 @@ int msm_dsi_host_enable(struct mipi_dsi_host *host);int msm_dsi_host_disable (struct mipi_dsi_host *host);int msm_dsi_host_power_on (struct mipi_dsi_host *host,struct msm_dsi_phy_shared_timings *phy_shared_timings, -bool is_dual_dsi); +bool is_bonded_dsi);int msm_dsi_host_power_off (struct mipi_dsi_host *host);int msm_dsi_host_set_display_mode (struct mipi_dsi_host *host,const struct drm_display_mode *mode);
@@ -123,7 +123,7 @@ int msm_dsi_host_set_src_pll(struct mipi_dsi_host *host,void msm_dsi_host_reset_phy (struct mipi_dsi_host *host);void msm_dsi_host_get_phy_clk_req (struct mipi_dsi_host *host,struct msm_dsi_phy_clk_request *clk_req, -bool is_dual_dsi); +bool is_bonded_dsi);void msm_dsi_host_destroy (struct mipi_dsi_host *host);int msm_dsi_host_modeset_init (struct mipi_dsi_host *host,struct drm_device *dev);
@@ -145,8 +145,8 @@ int dsi_dma_base_get_6g(struct msm_dsi_host *msm_host, uint64_t *iova);int dsi_dma_base_get_v2 (struct msm_dsi_host *msm_host,uint64_t *iova);int dsi_clk_init_v2 (struct msm_dsi_host *msm_host);int dsi_clk_init_6g_v2 (struct msm_dsi_host *msm_host); -int dsi_calc_clk_rate_v2 (struct msm_dsi_host *msm_host,bool is_dual_dsi); -int dsi_calc_clk_rate_6g (struct msm_dsi_host *msm_host,bool is_dual_dsi); +int dsi_calc_clk_rate_v2 (struct msm_dsi_host *msm_host,bool is_bonded_dsi); +int dsi_calc_clk_rate_6g (struct msm_dsi_host *msm_host,bool is_bonded_dsi);void msm_dsi_host_snapshot (struct msm_disp_state *disp_state,struct mipi_dsi_host *host);/* dsi phy */ struct msm_dsi_phy ;
drivers/gpu/drm/msm/dsi/dsi_cfg.h +1 -1
@@ -47,7 +47,7 @@ struct msm_dsi_host_cfg_ops {void * (*tx_buf_get)(struct msm_dsi_host *msm_host);void (*tx_buf_put)(struct msm_dsi_host *msm_host);int (*dma_base_get)(struct msm_dsi_host *msm_host,uint64_t *iova); -int (*calc_clk_rate)(struct msm_dsi_host *msm_host,bool is_dual_dsi); +int (*calc_clk_rate)(struct msm_dsi_host *msm_host,bool is_bonded_dsi); };struct msm_dsi_cfg_handler {
drivers/gpu/drm/msm/dsi/dsi_host.c +15 -15
@@ -679,7 +679,7 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host)clk_disable_unprepare (msm_host->byte_clk); } -static u32 dsi_get_pclk_rate (struct msm_dsi_host *msm_host,bool is_dual_dsi) +static u32 dsi_get_pclk_rate (struct msm_dsi_host *msm_host,bool is_bonded_dsi) {struct drm_display_mode *mode = msm_host->mode;u32 pclk_rate;
@@ -692,17 +692,17 @@ static u32 dsi_get_pclk_rate(struct msm_dsi_host *msm_host, bool is_dual_dsi)* the clock rates have to be split between the two dsi controllers. * Adjust the byte and pixel clock rates for each dsi host accordingly. */ -if (is_dual_dsi) +if (is_bonded_dsi) pclk_rate /=2 ;return pclk_rate; } -static void dsi_calc_pclk (struct msm_dsi_host *msm_host,bool is_dual_dsi) +static void dsi_calc_pclk (struct msm_dsi_host *msm_host,bool is_bonded_dsi) {u8 lanes = msm_host->lanes;u32 bpp =dsi_get_bpp (msm_host->format); -u32 pclk_rate =dsi_get_pclk_rate (msm_host, is_dual_dsi); +u32 pclk_rate =dsi_get_pclk_rate (msm_host, is_bonded_dsi);u64 pclk_bpp = (u64 )pclk_rate * bpp;if (lanes ==0 ) {
@@ -720,28 +720,28 @@ static void dsi_calc_pclk(struct msm_dsi_host *msm_host, bool is_dual_dsi) } -int dsi_calc_clk_rate_6g (struct msm_dsi_host *msm_host,bool is_dual_dsi) +int dsi_calc_clk_rate_6g (struct msm_dsi_host *msm_host,bool is_bonded_dsi) {if (!msm_host->mode) {pr_err ("%s: mode not set\n" , __func__);return -EINVAL ; } -dsi_calc_pclk (msm_host, is_dual_dsi); +dsi_calc_pclk (msm_host, is_bonded_dsi); msm_host->esc_clk_rate =clk_get_rate (msm_host->esc_clk);return 0 ; } -int dsi_calc_clk_rate_v2 (struct msm_dsi_host *msm_host,bool is_dual_dsi) +int dsi_calc_clk_rate_v2 (struct msm_dsi_host *msm_host,bool is_bonded_dsi) {u32 bpp =dsi_get_bpp (msm_host->format);u64 pclk_bpp;unsigned int esc_mhz, esc_div;unsigned long byte_mhz; -dsi_calc_pclk (msm_host, is_dual_dsi); +dsi_calc_pclk (msm_host, is_bonded_dsi); - pclk_bpp = (u64 )dsi_get_pclk_rate (msm_host, is_dual_dsi) * bpp; + pclk_bpp = (u64 )dsi_get_pclk_rate (msm_host, is_bonded_dsi) * bpp;do_div (pclk_bpp,8 ); msm_host->src_clk_rate = pclk_bpp;
@@ -938,7 +938,7 @@ static void dsi_ctrl_config(struct msm_dsi_host *msm_host, bool enable,dsi_write (msm_host,REG_DSI_CTRL , data); } -static void dsi_timing_setup (struct msm_dsi_host *msm_host,bool is_dual_dsi) +static void dsi_timing_setup (struct msm_dsi_host *msm_host,bool is_bonded_dsi) {struct drm_display_mode *mode = msm_host->mode;u32 hs_start =0 , vs_start =0 ;/* take sync start as 0 */
@@ -962,7 +962,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_dual_dsi)* timings have to be split between the two dsi controllers. * Adjust the DSI host timing values accordingly. */ -if (is_dual_dsi) { +if (is_bonded_dsi) { h_total /=2 ; hs_end /=2 ; ha_start /=2 ;
@@ -2285,13 +2285,13 @@ void msm_dsi_host_reset_phy(struct mipi_dsi_host *host)void msm_dsi_host_get_phy_clk_req (struct mipi_dsi_host *host,struct msm_dsi_phy_clk_request *clk_req, -bool is_dual_dsi) +bool is_bonded_dsi) {struct msm_dsi_host *msm_host =to_msm_dsi_host (host);const struct msm_dsi_cfg_handler *cfg_hnd = msm_host->cfg_hnd;int ret; - ret = cfg_hnd->ops->calc_clk_rate (msm_host, is_dual_dsi); + ret = cfg_hnd->ops->calc_clk_rate (msm_host, is_bonded_dsi);if (ret) {pr_err ("%s: unable to calc clk rate, %d\n" , __func__, ret);return ;
@@ -2354,7 +2354,7 @@ static void msm_dsi_sfpb_config(struct msm_dsi_host *msm_host, bool enable)int msm_dsi_host_power_on (struct mipi_dsi_host *host,struct msm_dsi_phy_shared_timings *phy_shared_timings, -bool is_dual_dsi) +bool is_bonded_dsi) {struct msm_dsi_host *msm_host =to_msm_dsi_host (host);const struct msm_dsi_cfg_handler *cfg_hnd = msm_host->cfg_hnd;
@@ -2392,7 +2392,7 @@ int msm_dsi_host_power_on(struct mipi_dsi_host *host, goto fail_disable_clk; } -dsi_timing_setup (msm_host, is_dual_dsi); +dsi_timing_setup (msm_host, is_bonded_dsi);dsi_sw_reset (msm_host);dsi_ctrl_config (msm_host, true, phy_shared_timings);
drivers/gpu/drm/msm/dsi/dsi_manager.c +34 -35
245 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH v2 2/7 drm/msm/dsi: add two helper functions
In reply to Dmitry BaryshkovAdd two helper functions to be used by display drivers for setting up encoders.
--- drivers/gpu/drm/msm/dsi/dsi.c | 7 +++++++ drivers/gpu/drm/msm/dsi/dsi_manager.c | 14 ++++++-------- drivers/gpu/drm/msm/msm_drv.h | 12 ++++++++++-- 3 files changed, 23 insertions(+), 10 deletions(-)
drivers/gpu/drm/msm/dsi/dsi.c +7 -0
@@ -13,6 +13,13 @@ struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi)return msm_dsi->encoder; } +bool msm_dsi_is_cmd_mode (struct msm_dsi *msm_dsi) +{ +unsigned long host_flags =msm_dsi_host_get_mode_flags (msm_dsi->host); + +return !(host_flags &MIPI_DSI_MODE_VIDEO ); +} +static int dsi_get_phy (struct msm_dsi *msm_dsi) {struct platform_device *pdev = msm_dsi->pdev;
drivers/gpu/drm/msm/dsi/dsi_manager.c +6 -8
@@ -216,12 +216,6 @@ static int dsi_mgr_bridge_get_id(struct drm_bridge *bridge)return dsi_bridge->id; } -static bool dsi_mgr_is_cmd_mode (struct msm_dsi *msm_dsi) -{ -unsigned long host_flags =msm_dsi_host_get_mode_flags (msm_dsi->host); -return !(host_flags &MIPI_DSI_MODE_VIDEO ); -} -void msm_dsi_manager_setup_encoder (int id) {struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id);
@@ -231,7 +225,7 @@ void msm_dsi_manager_setup_encoder(int id)if (encoder && kms->funcs->set_encoder_mode) kms->funcs->set_encoder_mode (kms, encoder, -dsi_mgr_is_cmd_mode (msm_dsi)); +msm_dsi_is_cmd_mode (msm_dsi)); }static int msm_dsi_manager_panel_init (struct drm_connector *conn,u8 id)
@@ -276,7 +270,7 @@ static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 id)if (other_dsi && other_dsi->panel && kms->funcs->set_split_display) { kms->funcs->set_split_display (kms, master_dsi->encoder, slave_dsi->encoder, -dsi_mgr_is_cmd_mode (msm_dsi)); +msm_dsi_is_cmd_mode (msm_dsi)); } out:
@@ -839,3 +833,7 @@ void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi) msm_dsim->dsi[msm_dsi->id] =NULL ; } +bool msm_dsi_is_bonded_dsi (struct msm_dsi *msm_dsi) +{ +return IS_BONDED_DSI (); +}
drivers/gpu/drm/msm/msm_drv.h +10 -2
@@ -350,7 +350,8 @@ void __exit msm_dsi_unregister(void);int msm_dsi_modeset_init (struct msm_dsi *msm_dsi,struct drm_device *dev,struct drm_encoder *encoder);void msm_dsi_snapshot (struct msm_disp_state *disp_state,struct msm_dsi *msm_dsi); - +bool msm_dsi_is_cmd_mode (struct msm_dsi *msm_dsi); +bool msm_dsi_is_bonded_dsi (struct msm_dsi *msm_dsi);#else static inline void __init msm_dsi_register (void ) {
@@ -367,7 +368,14 @@ static inline int msm_dsi_modeset_init(struct msm_dsi *msm_dsi,static inline void msm_dsi_snapshot (struct msm_disp_state *disp_state,struct msm_dsi *msm_dsi) { } - +static inline bool msm_dsi_is_cmd_mode (struct msm_dsi *msm_dsi) +{ +return false; +} +static bool msm_dsi_is_bonded_dsi (struct msm_dsi *msm_dsi) +{ +return false; +}#endif #ifdef CONFIG_DRM_MSM_DP
Signature · 1 line
2.30.2
PATCH v2 3/7 drm/msm/dpu: support setting up two independent DSI connectors
In reply to Dmitry BaryshkovMove setting up encoders from set_encoder_mode to _dpu_kms_initialize_dsi() / _dpu_kms_initialize_displayport(). This allows us to support not only "single DSI" and "bonded DSI" but also "two independent DSI" configurations. In future this would also help adding support for multiple DP connectors.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 130 ++++++++++++++---------- 1 file changed, 79 insertions(+), 51 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +79 -51
@@ -466,17 +466,16 @@ static void dpu_kms_wait_flush(struct msm_kms *kms, unsigned crtc_mask)dpu_kms_wait_for_commit_done (kms, crtc); } -static int _dpu_kms_initialize_dsi (struct drm_device *dev, -struct msm_drm_private *priv, -struct dpu_kms *dpu_kms) +static int _dpu_kms_initialize_dsi_encoder (struct drm_device *dev, +struct msm_drm_private *priv, +struct dpu_kms *dpu_kms, +int dsi_id,int dsi_id1) { +struct msm_dsi *dsi = priv->dsi[dsi_id];struct drm_encoder *encoder =NULL ; -int i, rc =0 ; - -if (!(priv->dsi[0 ] || priv->dsi[1 ])) -return rc; +struct msm_display_info info; +int rc =0 ; -/*TODO: Support two independent DSI connectors */ encoder =dpu_encoder_init (dev,DRM_MODE_ENCODER_DSI );if (IS_ERR (encoder)) {DPU_ERROR ("encoder init failed for dsi display\n" );
@@ -485,19 +484,74 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev, priv->encoders[priv->num_encoders++] = encoder; -for (i =0 ; i <ARRAY_SIZE (priv->dsi); i++) { -if (!priv->dsi[i]) -continue ; + rc =msm_dsi_modeset_init (dsi, dev, encoder); +if (rc) { +DPU_ERROR ("modeset_init failed for dsi[%d], rc = %d\n" , + dsi_id, rc); +return rc; + } + +memset (&info,0 ,sizeof (info)); + info.intf_type = encoder->encoder_type; + info.capabilities =msm_dsi_is_cmd_mode (dsi) ? +MSM_DISPLAY_CAP_CMD_MODE : +MSM_DISPLAY_CAP_VID_MODE ; + info.h_tile_instance[info.num_of_h_tiles++] = dsi_id; - rc =msm_dsi_modeset_init (priv->dsi[i], dev, encoder); +/* For the bonded DSI setup we have second DSI host */ +if (dsi_id1 >=0 ) { +struct msm_dsi *dsi1 = priv->dsi[dsi_id1]; + + rc =msm_dsi_modeset_init (dsi1, dev, encoder);if (rc) {DPU_ERROR ("modeset_init failed for dsi[%d], rc = %d\n" , - i, rc); -break ; + dsi_id1, rc); +return rc; } + + info.h_tile_instance[info.num_of_h_tiles++] = dsi_id1; } -return rc; + rc =dpu_encoder_setup (dev, encoder, &info); +if (rc) { +DPU_ERROR ("failed to setup DPU encoder %d: rc:%d\n" , + encoder->base.id, rc); +return rc; + } + +return 0 ; +} + +static int _dpu_kms_initialize_dsi (struct drm_device *dev, +struct msm_drm_private *priv, +struct dpu_kms *dpu_kms) +{ +int i, rc =0 ; + +if (!(priv->dsi[0 ] || priv->dsi[1 ])) +return rc; + +/* +* We support following confiurations: +* - Single DSI host (dsi0 or dsi1) +* - Two independent DSI hosts +* - Bonded DSI0 and DSI1 hosts +* +* TODO: Support swapping DSI0 and DSI1 in the bonded setup. +*/ +if (priv->dsi[0 ] && priv->dsi[1 ] &&msm_dsi_is_bonded_dsi (priv->dsi[0 ])) +return _dpu_kms_initialize_dsi_encoder (dev, priv, dpu_kms,0 ,1 ); + +for (i =0 ; i <ARRAY_SIZE (priv->dsi); i++) { +if (!priv->dsi[i]) +continue ; + + rc =_dpu_kms_initialize_dsi_encoder (dev, priv, dpu_kms, i,-1 ); +if (rc) +return rc; + } + +return 0 ; } static int _dpu_kms_initialize_displayport(struct drm_device *dev,
@@ -505,6 +559,7 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev, struct dpu_kms *dpu_kms) {struct drm_encoder *encoder =NULL ; +struct msm_display_info info;int rc =0 ;if (!priv->dp)
@@ -516,6 +571,7 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev,return PTR_ERR (encoder); } +memset (&info,0 ,sizeof (info)); rc =msm_dp_modeset_init (priv->dp, dev, encoder);if (rc) {DPU_ERROR ("modeset_init failed for DP, rc = %d\n" , rc);
@@ -524,6 +580,14 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev, } priv->encoders[priv->num_encoders++] = encoder; + + info.num_of_h_tiles =1 ; + info.capabilities =MSM_DISPLAY_CAP_VID_MODE ; + info.intf_type = encoder->encoder_type; + rc =dpu_encoder_setup (dev, encoder, &info); +if (rc) +DPU_ERROR ("failed to setup DPU encoder %d: rc:%d\n" , + encoder->base.id, rc);return rc; }
@@ -726,41 +790,6 @@ static void dpu_kms_destroy(struct msm_kms *kms)msm_kms_destroy (&dpu_kms->base); } -static void _dpu_kms_set_encoder_mode (struct msm_kms *kms, -struct drm_encoder *encoder, -bool cmd_mode) -{ -struct msm_display_info info; -struct msm_drm_private *priv = encoder->dev->dev_private; -int i, rc =0 ; - -memset (&info,0 ,sizeof (info)); - - info.intf_type = encoder->encoder_type; - info.capabilities = cmd_mode ?MSM_DISPLAY_CAP_CMD_MODE : -MSM_DISPLAY_CAP_VID_MODE ; - -switch (info.intf_type) { -case DRM_MODE_ENCODER_DSI : -/* TODO: No support for DSI swap */ -for (i =0 ; i <ARRAY_SIZE (priv->dsi); i++) { -if (priv->dsi[i]) { - info.h_tile_instance[info.num_of_h_tiles] = i; - info.num_of_h_tiles++; - } - } -break ; -case DRM_MODE_ENCODER_TMDS : - info.num_of_h_tiles =1 ; -break ; - } - - rc =dpu_encoder_setup (encoder->dev, encoder, &info); -if (rc) -DPU_ERROR ("failed to setup DPU encoder %d: rc:%d\n" , - encoder->base.id, rc); -} -static irqreturn_t dpu_irq (struct msm_kms *kms) {struct dpu_kms *dpu_kms =to_dpu_kms (kms);
@@ -863,7 +892,6 @@ static const struct msm_kms_funcs kms_funcs = { .get_format = dpu_get_msm_format, .round_pixclk = dpu_kms_round_pixclk, .destroy = dpu_kms_destroy, - .set_encoder_mode = _dpu_kms_set_encoder_mode, .snapshot = dpu_kms_mdp_snapshot, #ifdef CONFIG_DEBUG_FS .debugfs_init = dpu_kms_debugfs_init,
Signature · 1 line
2.30.2
Re: [Freedreno] [PATCH v2 3/7] drm/msm/dpu: support setting up two independent DSI connectors
Quoted 114 lines · Dmitry Baryshkov
Move setting up encoders from
set_encoder_modeto_dpu_kms_initialize_dsi()/_dpu_kms_initialize_displayport(). This allows us to support not only "single DSI" and "bonded DSI" but also "two independent DSI" configurations. In future this would also help adding support for multiple DP connectors.Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 130 ++++++++++++++---------- 1 file changed, 79 insertions(+), 51 deletions(-)drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +7
-8@@ -466,17 +466,16 @@ static void dpu_kms_wait_flush(struct msm_kms *kms, unsigned crtc_mask)dpu_kms_wait_for_commit_done (kms, crtc); } -static int _dpu_kms_initialize_dsi (struct drm_device *dev, -struct msm_drm_private *priv, -struct dpu_kms *dpu_kms) +static int _dpu_kms_initialize_dsi_encoder (struct drm_device *dev, +struct msm_drm_private *priv, +struct dpu_kms *dpu_kms, +int dsi_id,int dsi_id1) { +struct msm_dsi *dsi = priv->dsi[dsi_id];struct drm_encoder *encoder =NULL ; -int i, rc =0 ; - -if (!(priv->dsi[0 ] || priv->dsi[1 ])) -return rc; +struct msm_display_info info; +int rc =0 ; -/*TODO: Support two independent DSI connectors */ encoder =dpu_encoder_init (dev,DRM_MODE_ENCODER_DSI );if (IS_ERR (encoder)) {drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +53
-7DPU_ERROR ("encoder init failed for dsi display\n" );@@ -485,19 +484,74 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev, priv->encoders[priv->num_encoders++] = encoder; -for (i =0 ; i <ARRAY_SIZE (priv->dsi); i++) { -if (!priv->dsi[i]) -continue ; + rc =msm_dsi_modeset_init (dsi, dev, encoder); +if (rc) { +DPU_ERROR ("modeset_init failed for dsi[%d], rc = %d\n" , + dsi_id, rc); +return rc; + } + +memset (&info,0 ,sizeof (info)); + info.intf_type = encoder->encoder_type; + info.capabilities =msm_dsi_is_cmd_mode (dsi) ? +MSM_DISPLAY_CAP_CMD_MODE : +MSM_DISPLAY_CAP_VID_MODE ; + info.h_tile_instance[info.num_of_h_tiles++] = dsi_id; - rc =msm_dsi_modeset_init (priv->dsi[i], dev, encoder); +/* For the bonded DSI setup we have second DSI host */ +if (dsi_id1 >=0 ) { +struct msm_dsi *dsi1 = priv->dsi[dsi_id1]; + + rc =msm_dsi_modeset_init (dsi1, dev, encoder);if (rc) {DPU_ERROR ("modeset_init failed for dsi[%d], rc = %d\n" , - i, rc); -break ; + dsi_id1, rc); +return rc; } + + info.h_tile_instance[info.num_of_h_tiles++] = dsi_id1; } -return rc; + rc =dpu_encoder_setup (dev, encoder, &info); +if (rc) { +DPU_ERROR ("failed to setup DPU encoder %d: rc:%d\n" , + encoder->base.id, rc); +return rc; + } + +return 0 ; +} + +static int _dpu_kms_initialize_dsi (struct drm_device *dev, +struct msm_drm_private *priv, +struct dpu_kms *dpu_kms) +{ +int i, rc =0 ; + +if (!(priv->dsi[0 ] || priv->dsi[1 ])) +return rc; + +/* +* We support following confiurations: +* - Single DSI host (dsi0 or dsi1) +* - Two independent DSI hosts +* - Bonded DSI0 and DSI1 hosts +* +* TODO: Support swapping DSI0 and DSI1 in the bonded setup. +*/ +if (priv->dsi[0 ] && priv->dsi[1 ] &&msm_dsi_is_bonded_dsi (priv->dsi[0 ])) +return _dpu_kms_initialize_dsi_encoder (dev, priv, dpu_kms,0 ,1 ); + +for (i =0 ; i <ARRAY_SIZE (priv->dsi); i++) {
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c static int _dpu_kms_initialize_dsi(struct · line 557
Quoted 10 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +9
-0+if (!priv->dsi[i]) +continue ; + + rc =_dpu_kms_initialize_dsi_encoder (dev, priv, dpu_kms, i,-1 ); +if (rc) +return rc; + } + +return 0 ; }
Can we simplify this a bit like below?
static int _dpu_kms_initialize_dsi(struct drm_device *dev,
struct msm_drm_private *priv, struct dpu_kms *dpu_kms)
{
int i, rc = 0;
if (!(priv->dsi[0] || priv->dsi[1]))
return rc;
/*
* We support following confiurations:
* - Single DSI host (dsi0 or dsi1)
* - Two independent DSI hosts
* - Bonded DSI0 and DSI1 hosts
*
* TODO: Support swapping DSI0 and DSI1 in the bonded setup.
for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
if (!priv->dsi[i])
continue;
rc = _dpu_kms_initialize_dsi(dev, priv, dpu_kms); // this API does
everything except encoder setup
if (rc)
return rc;
if (!is_bonded_dsi)
_dpu_kms_initialize_dsi_encoder(...);
else if (dsi_0) // only one encoder setup for dsi_0
_dpu_kms_initialize_dsi_encoder(...);
}
}Let me know if you think this is a little less complicated.
Quoted 86 lines
static int _dpu_kms_initialize_displayport(struct
drm_device*dev,drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1
-0@@ -505,6 +559,7 @@ static int _dpu_kms_initialize_displayport(structdrm_device *dev, struct dpu_kms *dpu_kms) { struct drm_encoder *encoder = NULL; +struct msm_display_info info;int rc =0 ;drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1
-0if (!priv->dp)@@ -516,6 +571,7 @@ static int _dpu_kms_initialize_displayport(structdrm_device *dev, return PTR_ERR(encoder); } +memset (&info,0 ,sizeof (info)); rc =msm_dp_modeset_init (priv->dp, dev, encoder);if (rc) {drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +8
-36DPU_ERROR ("modeset_init failed for DP, rc = %d\n" , rc);@@ -524,6 +580,14 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev, } priv->encoders[priv->num_encoders++] = encoder; + + info.num_of_h_tiles =1 ; + info.capabilities =MSM_DISPLAY_CAP_VID_MODE ; + info.intf_type = encoder->encoder_type; + rc =dpu_encoder_setup (dev, encoder, &info); +if (rc) +DPU_ERROR ("failed to setup DPU encoder %d: rc:%d\n" , + encoder->base.id, rc);return rc; }@@ -726,41 +790,6 @@ static void dpu_kms_destroy(struct msm_kms *kms)msm_kms_destroy (&dpu_kms->base); } -static void _dpu_kms_set_encoder_mode (struct msm_kms *kms, -struct drm_encoder *encoder, -bool cmd_mode) -{ -struct msm_display_info info; -struct msm_drm_private *priv = encoder->dev->dev_private; -int i, rc =0 ; - -memset (&info,0 ,sizeof (info)); - - info.intf_type = encoder->encoder_type; - info.capabilities = cmd_mode ?MSM_DISPLAY_CAP_CMD_MODE : -MSM_DISPLAY_CAP_VID_MODE ; - -switch (info.intf_type) { -case DRM_MODE_ENCODER_DSI : -/* TODO: No support for DSI swap */ -for (i =0 ; i <ARRAY_SIZE (priv->dsi); i++) { -if (priv->dsi[i]) { - info.h_tile_instance[info.num_of_h_tiles] = i; - info.num_of_h_tiles++; - } - } -break ; -case DRM_MODE_ENCODER_TMDS : - info.num_of_h_tiles =1 ; -break ; - } - - rc =dpu_encoder_setup (encoder->dev, encoder, &info); -if (rc) -DPU_ERROR ("failed to setup DPU encoder %d: rc:%d\n" , - encoder->base.id, rc); -} -static irqreturn_t dpu_irq (struct msm_kms *kms) {struct dpu_kms *dpu_kms =to_dpu_kms (kms);@@ -863,7 +892,6 @@ static const struct msm_kms_funcs kms_funcs = { .get_format = dpu_get_msm_format, .round_pixclk = dpu_kms_round_pixclk, .destroy = dpu_kms_destroy, - .set_encoder_mode = _dpu_kms_set_encoder_mode, .snapshot = dpu_kms_mdp_snapshot, #ifdef CONFIG_DEBUG_FS .debugfs_init = dpu_kms_debugfs_init,
Re: [Freedreno] [PATCH v2 3/7] drm/msm/dpu: support setting up two independent DSI connectors
Quoted 158 lines · On 10/07/2021 03:30, [email protected] wrote:
Quoted 124 lines · Dmitry Baryshkov
Move setting up encoders from
set_encoder_modeto_dpu_kms_initialize_dsi()/_dpu_kms_initialize_displayport(). This allows us to support not only "single DSI" and "bonded DSI" but also "two independent DSI" configurations. In future this would also help adding support for multiple DP connectors.Signed-off-by Dmitry Baryshkov <[email protected]>---
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 130 ++++++++++++++----------1 file changed, 79 insertions(+), 51 deletions(-)drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +7
-8@@ -466,17 +466,16 @@ static void dpu_kms_wait_flush(struct msm_kms *kms, unsigned crtc_mask) dpu_kms_wait_for_commit_done(kms, crtc); } -static int _dpu_kms_initialize_dsi (struct drm_device *dev, - struct msm_drm_private *priv, - struct dpu_kms *dpu_kms) +static int _dpu_kms_initialize_dsi_encoder (struct drm_device *dev, + struct msm_drm_private *priv, + struct dpu_kms *dpu_kms, + int dsi_id, int dsi_id1) { + struct msm_dsi *dsi = priv->dsi[dsi_id]; struct drm_encoder *encoder = NULL; - int i, rc = 0; - - if (!(priv->dsi[0] || priv->dsi[1])) - return rc; + struct msm_display_info info; + int rc = 0; - /*TODO: Support two independent DSI connectors */ encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI); if (IS_ERR(encoder)) {
DPU_ERROR("encoder init failed for dsi display\n");drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +62
-7@@ -485,19 +484,74 @@ static int _dpu_kms_initialize_dsi(structdrm_device *dev, priv->encoders[priv->num_encoders++] = encoder; - for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { - if (!priv->dsi[i]) - continue; + rc = msm_dsi_modeset_init(dsi, dev, encoder); + if (rc) { + DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n", + dsi_id, rc); + return rc; + } + + memset(&info, 0, sizeof(info)); + info.intf_type = encoder->encoder_type; + info.capabilities = msm_dsi_is_cmd_mode(dsi) ? + MSM_DISPLAY_CAP_CMD_MODE : + MSM_DISPLAY_CAP_VID_MODE; + info.h_tile_instance[info.num_of_h_tiles++] = dsi_id; - rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder); + /* For the bonded DSI setup we have second DSI host */ + if (dsi_id1 >= 0) { + struct msm_dsi *dsi1 = priv->dsi[dsi_id1]; + + rc = msm_dsi_modeset_init(dsi1, dev, encoder); if (rc) { DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n", - i, rc); - break; + dsi_id1, rc); + return rc; } + + info.h_tile_instance[info.num_of_h_tiles++] = dsi_id1; } - return rc; + rc = dpu_encoder_setup(dev, encoder, &info); + if (rc) { + DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n", + encoder->base.id, rc); + return rc; + } + + return 0; +} + +static int _dpu_kms_initialize_dsi (struct drm_device *dev, + struct msm_drm_private *priv, + struct dpu_kms *dpu_kms) +{ + int i, rc = 0; + + if (!(priv->dsi[0] || priv->dsi[1])) + return rc; + + /* + * We support following confiurations: + * - Single DSI host (dsi0 or dsi1) + * - Two independent DSI hosts + * - Bonded DSI0 and DSI1 hosts + * + * TODO: Support swapping DSI0 and DSI1 in the bonded setup. + */ + if (priv->dsi[0] && priv->dsi[1] &&msm_dsi_is_bonded_dsi (priv->dsi[0 ])) + return _dpu_kms_initialize_dsi_encoder(dev, priv, dpu_kms, 0,1 ); + + for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { + if (!priv->dsi[i]) + continue; + + rc = _dpu_kms_initialize_dsi_encoder(dev, priv, dpu_kms, i, -1); + if (rc) + return rc; + } + + return 0;Quoted 1 line
}
Can we simplify this a bit like below?
static int _dpu_kms_initialize_dsi(struct
drm_device*dev,
structmsm_drm_private*priv, structdpu_kms*dpu_kms)
{
int i, rc = 0;if (!(priv->dsi[0] || priv->dsi[1]))
return rc;/*
* We support following confiurations:
* - Single DSI host (dsi0 or dsi1)
* - Two independent DSI hosts
* - Bonded DSI0 and DSI1 hosts
*
* TODO: Support swapping DSI0 and DSI1 in the bonded setup. for (i = 0; i <ARRAY_SIZE(priv->dsi); i++) { if (!priv->dsi[i])
continue;rc =
_dpu_kms_initialize_dsi(dev, priv, dpu_kms); // this API
does everything except encoder setup
if (rc)
return rc;
if (!is_bonded_dsi)_dpu_kms_initialize_dsi_encoder(...); else if (dsi_0) // only one encoder setup fordsi_0_dpu_kms_initialize_dsi_encoder(...);
Quoted 4 lines
}
}Let me know if you think this is a little less complicated.
I don't think this will work out of the box, currently we pass encoder to DSI initialization (modeset_init). Adding extra cases in the middle of the loop also doesn't seem like a clear solution.
Quoted 87 lines
Quoted 87 lines
static int _dpu_kms_initialize_displayport(struct
drm_device*dev,drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1
-0@@ -505,6 +559,7 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev, struct dpu_kms *dpu_kms) { struct drm_encoder *encoder = NULL; + struct msm_display_info info; int rc = 0;if (!priv->dp)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1
-0@@ -516,6 +571,7 @@ static int _dpu_kms_initialize_displayport(structdrm_device *dev, return PTR_ERR(encoder); } + memset(&info, 0, sizeof(info)); rc = msm_dp_modeset_init(priv->dp, dev, encoder); if (rc) {
DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +8
-36@@ -524,6 +580,14 @@ static int _dpu_kms_initialize_displayport(structdrm_device *dev, } priv->encoders[priv->num_encoders++] = encoder; + + info.num_of_h_tiles = 1; + info.capabilities = MSM_DISPLAY_CAP_VID_MODE; + info.intf_type = encoder->encoder_type; + rc = dpu_encoder_setup(dev, encoder, &info); + if (rc) + DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n", + encoder->base.id, rc); return rc; }@@ -726,41 +790,6 @@ static void dpu_kms_destroy(struct msm_kms *kms) msm_kms_destroy(&dpu_kms->base); } -static void _dpu_kms_set_encoder_mode (struct msm_kms *kms, - struct drm_encoder *encoder, - bool cmd_mode) -{ - struct msm_display_info info; - struct msm_drm_private *priv = encoder->dev->dev_private; - int i, rc = 0; - - memset(&info, 0, sizeof(info)); - - info.intf_type = encoder->encoder_type; - info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE : - MSM_DISPLAY_CAP_VID_MODE; - - switch (info.intf_type) { - case DRM_MODE_ENCODER_DSI: - /* TODO: No support for DSI swap */ - for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { - if (priv->dsi[i]) { - info.h_tile_instance[info.num_of_h_tiles] = i; - info.num_of_h_tiles++; - } - } - break; - case DRM_MODE_ENCODER_TMDS: - info.num_of_h_tiles = 1; - break; - } - - rc = dpu_encoder_setup(encoder->dev, encoder, &info); - if (rc) - DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n", - encoder->base.id, rc); -} - static irqreturn_t dpu_irq(struct msm_kms *kms) { struct dpu_kms *dpu_kms = to_dpu_kms(kms);@@ -863,7 +892,6 @@ static const struct msm_kms_funcs kms_funcs = { .get_format = dpu_get_msm_format, .round_pixclk = dpu_kms_round_pixclk, .destroy = dpu_kms_destroy, - .set_encoder_mode = _dpu_kms_set_encoder_mode, .snapshot = dpu_kms_mdp_snapshot, #ifdef CONFIG_DEBUG_FS .debugfs_init = dpu_kms_debugfs_init,
Signature · 2 lines
With best wishes Dmitry
Re: [Freedreno] [PATCH v2 3/7] drm/msm/dpu: support setting up two independent DSI connectors
Quoted 161 lines · Dmitry Baryshkov
Quoted 160 lines · On 10/07/2021 03:30, [email protected] wrote:
Quoted 126 lines · Dmitry Baryshkov
Move setting up encoders from
set_encoder_modeto_dpu_kms_initialize_dsi()/_dpu_kms_initialize_displayport(). This allows us to support not only "single DSI" and "bonded DSI" but also "two independent DSI" configurations. In future this would also help adding support for multiple DP connectors.Signed-off-by Dmitry Baryshkov <[email protected]>---
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 130
++++++++++++++----------1 file changed, 79 insertions(+), 51 deletions(-)drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +7
-8@@ -466,17 +466,16 @@ static void dpu_kms_wait_flush(struct msm_kms *kms, unsigned crtc_mask) dpu_kms_wait_for_commit_done(kms, crtc); } -static int _dpu_kms_initialize_dsi (struct drm_device *dev, - struct msm_drm_private *priv, - struct dpu_kms *dpu_kms) +static int _dpu_kms_initialize_dsi_encoder (struct drm_device *dev, + struct msm_drm_private *priv, + struct dpu_kms *dpu_kms, + int dsi_id, int dsi_id1) { + struct msm_dsi *dsi = priv->dsi[dsi_id]; struct drm_encoder *encoder = NULL; - int i, rc = 0; - - if (!(priv->dsi[0] || priv->dsi[1])) - return rc; + struct msm_display_info info; + int rc = 0; - /*TODO: Support two independent DSI connectors */ encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI); if (IS_ERR(encoder)) {
DPU_ERROR("encoder init failed for dsi display\n");drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +62
-8@@ -485,19 +484,74 @@ static int _dpu_kms_initialize_dsi(structdrm_device *dev, priv->encoders[priv->num_encoders++] = encoder; - for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { - if (!priv->dsi[i]) - continue; + rc = msm_dsi_modeset_init(dsi, dev, encoder); + if (rc) { + DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n", + dsi_id, rc); + return rc; + } + + memset(&info, 0, sizeof(info)); + info.intf_type = encoder->encoder_type; + info.capabilities = msm_dsi_is_cmd_mode(dsi) ? + MSM_DISPLAY_CAP_CMD_MODE : + MSM_DISPLAY_CAP_VID_MODE; + info.h_tile_instance[info.num_of_h_tiles++] = dsi_id; - rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder); + /* For the bonded DSI setup we have second DSI host */ + if (dsi_id1 >= 0) { + struct msm_dsi *dsi1 = priv->dsi[dsi_id1]; + + rc = msm_dsi_modeset_init(dsi1, dev, encoder); if (rc) { DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n", - i, rc); - break; + dsi_id1, rc); + return rc; } + + info.h_tile_instance[info.num_of_h_tiles++] = dsi_id1; } - return rc; + rc = dpu_encoder_setup(dev, encoder, &info); + if (rc) { + DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n", + encoder->base.id, rc); + return rc; + } + + return 0; +} + +static int _dpu_kms_initialize_dsi (struct drm_device *dev, + struct msm_drm_private *priv, + struct dpu_kms *dpu_kms) +{ + int i, rc = 0; + + if (!(priv->dsi[0] || priv->dsi[1])) + return rc; + + /* + * We support following confiurations: + * - Single DSI host (dsi0 or dsi1) + * - Two independent DSI hosts + * - Bonded DSI0 and DSI1 hosts + * + * TODO: Support swapping DSI0 and DSI1 in the bonded setup. + */ + if (priv->dsi[0] && priv->dsi[1] &&msm_dsi_is_bonded_dsi (priv->dsi[0 ])) + return _dpu_kms_initialize_dsi_encoder(dev, priv, dpu_kms,0 ,1 ); + + for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { + if (!priv->dsi[i]) + continue; + + rc = _dpu_kms_initialize_dsi_encoder(dev, priv, dpu_kms, i, -1); + if (rc) + return rc; + } + + return 0;Quoted 1 line
}
Can we simplify this a bit like below?
static int _dpu_kms_initialize_dsi(struct
drm_device*dev,
structmsm_drm_private*priv, structdpu_kms*dpu_kms)
{
int i, rc = 0;if (!(priv->dsi[0] || priv->dsi[1]))
return rc;/*
* We support following confiurations:
* - Single DSI host (dsi0 or dsi1)
* - Two independent DSI hosts
* - Bonded DSI0 and DSI1 hosts
*
* TODO: Support swapping DSI0 and DSI1 in the bonded setup. for (i = 0; i <ARRAY_SIZE(priv->dsi); i++) { if (!priv->dsi[i])
continue;rc =
_dpu_kms_initialize_dsi(dev, priv, dpu_kms); // this API
does everything except encoder setup
if (rc)
return rc;
if (!is_bonded_dsi)_dpu_kms_initialize_dsi_encoder(...); else if (dsi_0) // only one encoder setup fordsi_0_dpu_kms_initialize_dsi_encoder(...);
Quoted 8 lines
Quoted 4 lines
}
}Let me know if you think this is a little less complicated.
I don't think this will work out of the box, currently we pass encoder to DSI initialization (
modeset_init). Adding extra cases in the middle of the loop also doesn't seem like a clear solution.
In that case the previous attempt was actually a little better with the change I suggested of using the msm_dsi_is_bonded_dsi() API instead of hard-coding the encoder to NULL.
This one has some additional changes like passing 1 and/or -1 of the dsi1. Just felt a bit of an overkill. The previous one was better than this one.
Quoted 89 lines
Quoted 89 lines
Quoted 89 lines
static int _dpu_kms_initialize_displayport(struct
drm_device*dev,drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1
-0@@ -505,6 +559,7 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev, struct dpu_kms *dpu_kms) { struct drm_encoder *encoder = NULL; + struct msm_display_info info; int rc = 0;if (!priv->dp)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1
-0@@ -516,6 +571,7 @@ static int _dpu_kms_initialize_displayport(structdrm_device *dev, return PTR_ERR(encoder); } + memset(&info, 0, sizeof(info)); rc = msm_dp_modeset_init(priv->dp, dev, encoder); if (rc) {
DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +0
-0@@ -524,6 +580,14 @@ static int_dpu_kms_initialize_displayport(struct
drm_device*dev,
}priv->encoders[priv->num_encoders++] = encoder; +
+ info.num_of_h_tiles = 1;
+ info.capabilities =MSM_DISPLAY_CAP_VID_MODE; + info.intf_type =encoder->encoder_type;
+ rc =dpu_encoder_setup(dev, encoder, &info);
+ if (rc)
+DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n", + encoder->base.id, rc);
return rc;
}drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +0
-36@@ -726,41 +790,6 @@ static void dpu_kms_destroy(struct msm_kms *kms) msm_kms_destroy(&dpu_kms->base); } -static void _dpu_kms_set_encoder_mode (struct msm_kms *kms, - struct drm_encoder *encoder, - bool cmd_mode) -{ - struct msm_display_info info; - struct msm_drm_private *priv = encoder->dev->dev_private; - int i, rc = 0; - - memset(&info, 0, sizeof(info)); - - info.intf_type = encoder->encoder_type; - info.capabilities = cmd_mode ? MSM_DISPLAY_CAP_CMD_MODE : - MSM_DISPLAY_CAP_VID_MODE; - - switch (info.intf_type) { - case DRM_MODE_ENCODER_DSI: - /* TODO: No support for DSI swap */ - for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { - if (priv->dsi[i]) { - info.h_tile_instance[info.num_of_h_tiles] = i; - info.num_of_h_tiles++; - } - } - break; - case DRM_MODE_ENCODER_TMDS: - info.num_of_h_tiles = 1; - break; - } - - rc = dpu_encoder_setup(encoder->dev, encoder, &info); - if (rc) - DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n", - encoder->base.id, rc); -} - static irqreturn_t dpu_irq(struct msm_kms *kms) { struct dpu_kms *dpu_kms = to_dpu_kms(kms);@@ -863,7 +892,6 @@ static const struct msm_kms_funcs kms_funcs = { .get_format = dpu_get_msm_format, .round_pixclk = dpu_kms_round_pixclk, .destroy = dpu_kms_destroy, - .set_encoder_mode = _dpu_kms_set_encoder_mode, .snapshot = dpu_kms_mdp_snapshot, #ifdef CONFIG_DEBUG_FS .debugfs_init = dpu_kms_debugfs_init,
PATCH v2 4/7 drm/msm/mdp5: move mdp5_encoder_set_intf_mode after msm_dsi_modeset_init
In reply to Dmitry BaryshkovMove a call to mdp5_encoder_set_intf_mode() after msm_dsi_modeset_init(), removing set_encoder_mode callback.
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +3 -8
@@ -209,13 +209,6 @@ static int mdp5_set_split_display(struct msm_kms *kms, slave_encoder); } -static void mdp5_set_encoder_mode (struct msm_kms *kms, -struct drm_encoder *encoder, -bool cmd_mode) -{ -mdp5_encoder_set_intf_mode (encoder, cmd_mode); -} -static void mdp5_kms_destroy (struct msm_kms *kms) {struct mdp5_kms *mdp5_kms =to_mdp5_kms (to_mdp_kms (kms));
@@ -287,7 +280,6 @@ static const struct mdp_kms_funcs kms_funcs = { .get_format = mdp_get_format, .round_pixclk = mdp5_round_pixclk, .set_split_display = mdp5_set_split_display, - .set_encoder_mode = mdp5_set_encoder_mode, .destroy = mdp5_kms_destroy, #ifdef CONFIG_DEBUG_FS .debugfs_init = mdp5_kms_debugfs_init,
@@ -448,6 +440,9 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms, } ret =msm_dsi_modeset_init (priv->dsi[dsi_id], dev, encoder); +if (!ret) +mdp5_encoder_set_intf_mode (encoder,msm_dsi_is_cmd_mode (priv->dsi[dsi_id])); +break ; }default :
Signature · 1 line
2.30.2
PATCH v2 5/7 drm/msm/dp: stop calling set_encoder_mode callback
In reply to Dmitry BaryshkovNone of the display drivers now implement set_encoder_mode callback. Stop calling it from the modeset init code.
--- drivers/gpu/drm/msm/dp/dp_display.c | 18 ------------------ 1 file changed, 18 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +0 -18
@@ -102,8 +102,6 @@ struct dp_display_private {struct dp_display_mode dp_mode;struct msm_dp dp_display; -bool encoder_mode_set; -/* wait for audio signaling */ struct completion audio_comp;
@@ -283,20 +281,6 @@ static void dp_display_send_hpd_event(struct msm_dp *dp_display) } -static void dp_display_set_encoder_mode (struct dp_display_private *dp) -{ -struct msm_drm_private *priv = dp->dp_display.drm_dev->dev_private; -struct msm_kms *kms = priv->kms; - -if (!dp->encoder_mode_set && dp->dp_display.encoder && - kms->funcs->set_encoder_mode) { - kms->funcs->set_encoder_mode (kms, - dp->dp_display.encoder, false); - - dp->encoder_mode_set = true; - } -} -static int dp_display_send_hpd_notification (struct dp_display_private *dp,bool hpd) {
@@ -369,8 +353,6 @@ static void dp_display_host_init(struct dp_display_private *dp, int reset)if (dp->usbpd->orientation ==ORIENTATION_CC2 ) flip = true; -dp_display_set_encoder_mode (dp); -dp_power_init (dp->power, flip);dp_ctrl_host_init (dp->ctrl, flip, reset);dp_aux_init (dp->aux);
Signature · 1 line
2.30.2
PATCH v2 6/7 drm/msm/dsi: stop calling set_encoder_mode callback
In reply to Dmitry BaryshkovNone of the display drivers now implement set_encoder_mode callback. Stop calling it from the modeset init code.
--- drivers/gpu/drm/msm/dsi/dsi.c | 2 -- drivers/gpu/drm/msm/dsi/dsi.h | 1 - drivers/gpu/drm/msm/dsi/dsi_manager.c | 12 ------------ 3 files changed, 15 deletions(-)
drivers/gpu/drm/msm/dsi/dsi.c +0 -2
@@ -251,8 +251,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, goto fail; } -msm_dsi_manager_setup_encoder (msm_dsi->id); - priv->bridges[priv->num_bridges++] = msm_dsi->bridge; priv->connectors[priv->num_connectors++] = msm_dsi->connector;
drivers/gpu/drm/msm/dsi/dsi.h +0 -1
@@ -80,7 +80,6 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id);struct drm_connector *msm_dsi_manager_ext_bridge_init (u8 id);int msm_dsi_manager_cmd_xfer (int id,const struct mipi_dsi_msg *msg);bool msm_dsi_manager_cmd_xfer_trigger (int id,u32 dma_base,u32 len); -void msm_dsi_manager_setup_encoder (int id);int msm_dsi_manager_register (struct msm_dsi *msm_dsi);void msm_dsi_manager_unregister (struct msm_dsi *msm_dsi);bool msm_dsi_manager_validate_current_config (u8 id);
drivers/gpu/drm/msm/dsi/dsi_manager.c +0 -12
@@ -216,18 +216,6 @@ static int dsi_mgr_bridge_get_id(struct drm_bridge *bridge)return dsi_bridge->id; } -void msm_dsi_manager_setup_encoder (int id) -{ -struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id); -struct msm_drm_private *priv = msm_dsi->dev->dev_private; -struct msm_kms *kms = priv->kms; -struct drm_encoder *encoder =msm_dsi_get_encoder (msm_dsi); - -if (encoder && kms->funcs->set_encoder_mode) - kms->funcs->set_encoder_mode (kms, encoder, -msm_dsi_is_cmd_mode (msm_dsi)); -} -static int msm_dsi_manager_panel_init (struct drm_connector *conn,u8 id) {struct msm_drm_private *priv = conn->dev->dev_private;
Signature · 1 line
2.30.2
PATCH v2 7/7 drm/msm/kms: drop set_encoder_mode callback
In reply to Dmitry Baryshkovset_encoder_mode callback is completely unused now. Drop it from msm_kms_func().
--- drivers/gpu/drm/msm/msm_kms.h | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/msm/msm_kms.h +0 -3
@@ -117,9 +117,6 @@ struct msm_kms_funcs {struct drm_encoder *encoder, struct drm_encoder *slave_encoder, bool is_cmd_mode); -void (*set_encoder_mode)(struct msm_kms *kms, -struct drm_encoder *encoder, -bool cmd_mode);/* cleanup: */ void (*destroy)(struct msm_kms *kms);
Signature · 1 line
2.30.2