drm/msm/dpu: Remove call to drm_mode_set_crtcinfo
PATCH RESEND 1/13 drm/msm/dpu: Remove call to drm_mode_set_crtcinfo
From: Sean Paul <[email protected]>
Now that mode_fixup has been removed, we can just rely on the call from drm_helper_probe_single_connector_modes(),
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +0 -3
@@ -622,9 +622,6 @@ static int dpu_encoder_virt_atomic_check( } } -if (!ret) -drm_mode_set_crtcinfo (adj_mode,0 ); -trace_dpu_enc_atomic_check_flags (DRMID (drm_enc), adj_mode->flags, adj_mode->private_flags);
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
A message that is not in the archive (sent off-list or not yet received): 20190617200405.131843-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org
PATCH RESEND 2/13 drm/msm/dpu: Fix mmu init/destroy functions
From: Sean Paul <[email protected]>
There's a comment in _dpu_kms_hw_destroy() that reads "safe to call these more than once during shutdown", referring to _dpu_kms_mmu_destroy(). Unfortunately that's not the case, mmu_destroy will fail hard if it's called twice. So fix that function to ensure it can be called multiple times without burning.
While I'm at it, fix the error paths in _dpu_kms_mmu_init() to properly clean up the iommu domain and not call _dpu_kms_mmu_destroy() when things are only partially setup.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +8 -9
@@ -729,12 +729,16 @@ static int _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms) {struct msm_mmu *mmu; +if (!dpu_kms->base.aspace) +return 0 ; + mmu = dpu_kms->base.aspace->mmu; mmu->funcs->detach (mmu, (const char **)iommu_ports,ARRAY_SIZE (iommu_ports));msm_gem_address_space_put (dpu_kms->base.aspace); + dpu_kms->base.aspace =NULL ;return 0 ; }
@@ -754,25 +758,20 @@ static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms) aspace =msm_gem_address_space_create (dpu_kms->dev->dev, domain,"dpu1" );if (IS_ERR (aspace)) { - ret =PTR_ERR (aspace); - goto fail; +iommu_domain_free (domain); +return PTR_ERR (aspace); } - dpu_kms->base.aspace = aspace; - ret = aspace->mmu->funcs->attach (aspace->mmu, iommu_ports,ARRAY_SIZE (iommu_ports));if (ret) {DPU_ERROR ("failed to attach iommu %d\n" , ret);msm_gem_address_space_put (aspace); - goto fail; +return ret; } + dpu_kms->base.aspace = aspace;return 0 ; -fail: -_dpu_kms_mmu_destroy (dpu_kms); - -return ret; } static struct dss_clk *_dpu_kms_get_clk(struct dpu_kms *dpu_kms,
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH 3/13 drm/msm/phy/dsi_phy: Set pll to NULL in case initialization fails
In reply to a message not in the archiveFrom: Sean Paul <[email protected]>
We have if (!phy->pll) checks scattered through the driver and if phy->pll is an error pointer, those checks will pass and bad things will happen :(
--- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +3 -1
@@ -616,10 +616,12 @@ static int dsi_phy_driver_probe(struct platform_device *pdev) goto fail; phy->pll =msm_dsi_pll_init (pdev, phy->cfg->type, phy->id); -if (IS_ERR_OR_NULL (phy->pll)) +if (IS_ERR_OR_NULL (phy->pll)) {DRM_DEV_INFO (dev,"%s: pll init failed: %ld, need separate pll clk driver\n" , __func__,PTR_ERR (phy->pll)); + phy->pll =NULL ; + }dsi_phy_disable_resource (phy);
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH 4/13 drm/msm/dsi_pll_10nm: Release clk hw on destroy and failure
In reply to a message not in the archiveFrom: Sean Paul <[email protected]>
The 10nm pll driver didn't have any failure-path cleanup in register, and the destroy function didn't unregister any of the hardware. This patch adds both.
The reason things haven't been blowing up horribly is that msm_drv has a reference count issue that keeps devices alive, so the destroy function was never called. That will be fixed in a follow-up patch.
--- drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c | 103 +++++++++++++++------ 1 file changed, 73 insertions(+), 30 deletions(-)
drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c +73 -30
@@ -104,8 +104,13 @@ struct dsi_pll_10nm {struct dsi_pll_regs reg_setup;/* private clocks: */ -struct clk_hw *hws[NUM_DSI_CLOCKS_MAX ]; -u32 num_hws; +struct clk_hw *out_div_clk_hw; +struct clk_hw *bit_clk_hw; +struct clk_hw *byte_clk_hw; +struct clk_hw *by_2_bit_clk_hw; +struct clk_hw *post_out_div_clk_hw; +struct clk_hw *pclk_mux_hw; +struct clk_hw *out_dsiclk_hw;/* clock-provider: */ struct clk_hw_onecell_data *hw_data;
@@ -617,8 +622,19 @@ static int dsi_pll_10nm_get_provider(struct msm_dsi_pll *pll,static void dsi_pll_10nm_destroy (struct msm_dsi_pll *pll) {struct dsi_pll_10nm *pll_10nm =to_pll_10nm (pll); +struct device *dev = &pll_10nm->pdev->dev;DBG ("DSI PLL%d" , pll_10nm->id); +of_clk_del_provider (dev->of_node); + +clk_hw_unregister_divider (pll_10nm->out_dsiclk_hw); +clk_hw_unregister_mux (pll_10nm->pclk_mux_hw); +clk_hw_unregister_fixed_factor (pll_10nm->post_out_div_clk_hw); +clk_hw_unregister_fixed_factor (pll_10nm->by_2_bit_clk_hw); +clk_hw_unregister_fixed_factor (pll_10nm->byte_clk_hw); +clk_hw_unregister_divider (pll_10nm->bit_clk_hw); +clk_hw_unregister_divider (pll_10nm->out_div_clk_hw); +clk_hw_unregister (&pll_10nm->base.clk_hw); }/*
@@ -639,10 +655,8 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) .ops = &clk_ops_dsi_pll_10nm_vco, };struct device *dev = &pll_10nm->pdev->dev; -struct clk_hw **hws = pll_10nm->hws;struct clk_hw_onecell_data *hw_data;struct clk_hw *hw; -int num =0 ;int ret;DBG ("DSI%d" , pll_10nm->id);
@@ -660,8 +674,6 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm)if (ret)return ret; - hws[num++] = &pll_10nm->base.clk_hw; -snprintf (clk_name,32 ,"dsi%d_pll_out_div_clk" , pll_10nm->id);snprintf (parent,32 ,"dsi%dvco_clk" , pll_10nm->id);
@@ -670,10 +682,12 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) pll_10nm->mmio + REG_DSI_10nm_PHY_PLL_PLL_OUTDIV_RATE, 0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL); -if (IS_ERR (hw)) -return PTR_ERR (hw); +if (IS_ERR (hw)) { + ret =PTR_ERR (hw); + goto err_base_clk_hw; + } - hws[num++] = hw; + pll_10nm->out_div_clk_hw = hw;snprintf (clk_name,32 ,"dsi%d_pll_bit_clk" , pll_10nm->id);snprintf (parent,32 ,"dsi%d_pll_out_div_clk" , pll_10nm->id);
@@ -685,10 +699,12 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) REG_DSI_10nm_PHY_CMN_CLK_CFG0,0 ,4 ,CLK_DIVIDER_ONE_BASED , &pll_10nm->postdiv_lock); -if (IS_ERR (hw)) -return PTR_ERR (hw); +if (IS_ERR (hw)) { + ret =PTR_ERR (hw); + goto err_out_div_clk_hw; + } - hws[num++] = hw; + pll_10nm->bit_clk_hw = hw;snprintf (clk_name,32 ,"dsi%d_phy_pll_out_byteclk" , pll_10nm->id);snprintf (parent,32 ,"dsi%d_pll_bit_clk" , pll_10nm->id);
@@ -696,10 +712,12 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm)/* DSI Byte clock = VCO_CLK / OUT_DIV / BIT_DIV / 8 */ hw =clk_hw_register_fixed_factor (dev, clk_name, parent,CLK_SET_RATE_PARENT ,1 ,8 ); -if (IS_ERR (hw)) -return PTR_ERR (hw); +if (IS_ERR (hw)) { + ret =PTR_ERR (hw); + goto err_bit_clk_hw; + } - hws[num++] = hw; + pll_10nm->byte_clk_hw = hw; hw_data->hws[DSI_BYTE_PLL_CLK ] = hw;snprintf (clk_name,32 ,"dsi%d_pll_by_2_bit_clk" , pll_10nm->id);
@@ -707,20 +725,24 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) hw =clk_hw_register_fixed_factor (dev, clk_name, parent,0 ,1 ,2 ); -if (IS_ERR (hw)) -return PTR_ERR (hw); +if (IS_ERR (hw)) { + ret =PTR_ERR (hw); + goto err_byte_clk_hw; + } - hws[num++] = hw; + pll_10nm->by_2_bit_clk_hw = hw;snprintf (clk_name,32 ,"dsi%d_pll_post_out_div_clk" , pll_10nm->id);snprintf (parent,32 ,"dsi%d_pll_out_div_clk" , pll_10nm->id); hw =clk_hw_register_fixed_factor (dev, clk_name, parent,0 ,1 ,4 ); -if (IS_ERR (hw)) -return PTR_ERR (hw); +if (IS_ERR (hw)) { + ret =PTR_ERR (hw); + goto err_by_2_bit_clk_hw; + } - hws[num++] = hw; + pll_10nm->post_out_div_clk_hw = hw;snprintf (clk_name,32 ,"dsi%d_pclk_mux" , pll_10nm->id);snprintf (parent,32 ,"dsi%d_pll_bit_clk" , pll_10nm->id);
@@ -734,10 +756,12 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) }, 4, 0, pll_10nm->phy_cmn_mmio + REG_DSI_10nm_PHY_CMN_CLK_CFG1, 0, 2, 0, NULL); -if (IS_ERR (hw)) -return PTR_ERR (hw); +if (IS_ERR (hw)) { + ret =PTR_ERR (hw); + goto err_post_out_div_clk_hw; + } - hws[num++] = hw; + pll_10nm->pclk_mux_hw = hw;snprintf (clk_name,32 ,"dsi%d_phy_pll_out_dsiclk" , pll_10nm->id);snprintf (parent,32 ,"dsi%d_pclk_mux" , pll_10nm->id);
@@ -748,14 +772,14 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) REG_DSI_10nm_PHY_CMN_CLK_CFG0,4 ,4 ,CLK_DIVIDER_ONE_BASED , &pll_10nm->postdiv_lock); -if (IS_ERR (hw)) -return PTR_ERR (hw); +if (IS_ERR (hw)) { + ret =PTR_ERR (hw); + goto err_pclk_mux_hw; + } - hws[num++] = hw; + pll_10nm->out_dsiclk_hw = hw; hw_data->hws[DSI_PIXEL_PLL_CLK ] = hw; - pll_10nm->num_hws = num; - hw_data->num =NUM_PROVIDED_CLKS ; pll_10nm->hw_data = hw_data;
@@ -763,10 +787,29 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) pll_10nm->hw_data);if (ret) {DRM_DEV_ERROR (dev,"failed to register clk provider: %d\n" , ret); -return ret; + goto err_dsiclk_hw; }return 0 ; + +err_dsiclk_hw: +clk_hw_unregister_divider (pll_10nm->out_dsiclk_hw); +err_pclk_mux_hw: +clk_hw_unregister_mux (pll_10nm->pclk_mux_hw); +err_post_out_div_clk_hw: +clk_hw_unregister_fixed_factor (pll_10nm->post_out_div_clk_hw); +err_by_2_bit_clk_hw: +clk_hw_unregister_fixed_factor (pll_10nm->by_2_bit_clk_hw); +err_byte_clk_hw: +clk_hw_unregister_fixed_factor (pll_10nm->byte_clk_hw); +err_bit_clk_hw: +clk_hw_unregister_divider (pll_10nm->bit_clk_hw); +err_out_div_clk_hw: +clk_hw_unregister_divider (pll_10nm->out_div_clk_hw); +err_base_clk_hw: +clk_hw_unregister (&pll_10nm->base.clk_hw); + +return ret; }struct msm_dsi_pll *msm_dsi_pll_10nm_init (struct platform_device *pdev,int id)
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
A message that is not in the archive (sent off-list or not yet received): 20190617201301.133275-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org
PATCH 6/13 drm/msm: Depopulate platform on probe failure
From: Sean Paul <[email protected]>
add_display_components() calls of_platform_populate, and we depopluate on pdev remove, but not when probe fails. So if we get a probe deferral in one of the components, we won't depopulate the platform. This causes the core to keep references to devices which should be destroyed, which causes issues when those same devices try to re-initialize on the next probe attempt.
I think this is the reason we had issues with the gmu's device-managed resources on deferral (worked around in commit 94e3a17f33a5).
--- drivers/gpu/drm/msm/msm_drv.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +11 -3
@@ -1317,16 +1317,24 @@ static int msm_pdev_probe(struct platform_device *pdev) ret =add_gpu_components (&pdev->dev, &match);if (ret) -return ret; + goto fail;/* on all devices that I am aware of, iommu's which can map * any address the cpu can see are used: */ ret =dma_set_mask_and_coherent (&pdev->dev, ~0 );if (ret) -return ret; + goto fail; + + ret =component_master_add_with_match (&pdev->dev, &msm_drm_ops, match); +if (ret) + goto fail; -return component_master_add_with_match (&pdev->dev, &msm_drm_ops, match); +return 0 ; + +fail: +of_platform_depopulate (&pdev->dev); +return ret; }static int msm_pdev_remove (struct platform_device *pdev)
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH 8/13 drm/msm/dsi: Don't store dsi host mode_flags in msm_dsi
In reply to a message not in the archiveFrom: Sean Paul <[email protected]>
It's a bit dangerous to store the flags in msm_dsi since there's no way to tell when they're populated. Fortunately the only place that uses them is the same place that fills them. So just use a local variable and delete the struct member.
--- drivers/gpu/drm/msm/dsi/dsi.h | 1 - drivers/gpu/drm/msm/dsi/dsi_manager.c | 17 +++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/msm/dsi/dsi.h +0 -1
@@ -79,7 +79,6 @@ struct msm_dsi {*/ struct drm_panel *panel;struct drm_bridge *external_bridge; -unsigned long device_flags;struct device *phy_dev;bool phy_enabled;
drivers/gpu/drm/msm/dsi/dsi_manager.c +9 -8
@@ -233,6 +233,12 @@ 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 ); +} +static enum drm_connector_status dsi_mgr_connector_detect (struct drm_connector *connector,bool force) {
@@ -241,17 +247,15 @@ static enum drm_connector_status dsi_mgr_connector_detect(struct msm_dsi *other_dsi =dsi_mgr_get_other_dsi (id);struct msm_drm_private *priv = connector->dev->dev_private;struct msm_kms *kms = priv->kms; +bool cmd_mode;DBG ("id=%d" , id);if (!msm_dsi->panel) { msm_dsi->panel =msm_dsi_host_get_panel (msm_dsi->host); - msm_dsi->device_flags =msm_dsi_host_get_mode_flags ( - msm_dsi->host);/* There is only 1 panel in the global panel list * for dual DSI mode. Therefore slave dsi should get -* the drm_panel instance from master dsi, and -* keep using the panel flags got from the current DSI link. +* the drm_panel instance from master dsi. */ if (!msm_dsi->panel &&IS_DUAL_DSI () && !IS_MASTER_DSI_LINK (id) && other_dsi)
@@ -259,9 +263,8 @@ static enum drm_connector_status dsi_mgr_connector_detect( other_dsi->host); + cmd_mode =dsi_mgr_is_cmd_mode (msm_dsi);if (msm_dsi->panel && kms->funcs->set_encoder_mode) { -bool cmd_mode = !(msm_dsi->device_flags & -MIPI_DSI_MODE_VIDEO );struct drm_encoder *encoder =msm_dsi_get_encoder (msm_dsi);
@@ -277,8 +280,6 @@ static enum drm_connector_status dsi_mgr_connector_detect(*/ if (msm_dsi->panel &&IS_DUAL_DSI () && other_dsi && other_dsi->panel) { -bool cmd_mode = !(msm_dsi->device_flags & -MIPI_DSI_MODE_VIDEO );struct drm_encoder *encoder =msm_dsi_get_encoder (dsi_mgr_get_dsi (DSI_ENCODER_MASTER )); struct drm_encoder *slave_enc = msm_dsi_get_encoder(
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH 9/13 drm/msm/dsi: Pull out panel init code into function
In reply to a message not in the archiveFrom: Sean Paul <[email protected]>
Pull all of the panel init code out of detect() and put it in its own function. This will be useful in future patches where it's moved from detect().
--- drivers/gpu/drm/msm/dsi/dsi_manager.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_manager.c +12 -4
@@ -239,17 +239,14 @@ static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi)return !(host_flags &MIPI_DSI_MODE_VIDEO ); } -static enum drm_connector_status dsi_mgr_connector_detect ( -struct drm_connector *connector,bool force) +static void msm_dsi_manager_panel_init (struct drm_connector *connector,u8 id) { -int id =dsi_mgr_connector_get_id (connector);struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id);struct msm_dsi *other_dsi =dsi_mgr_get_other_dsi (id);struct msm_drm_private *priv = connector->dev->dev_private;struct msm_kms *kms = priv->kms;bool cmd_mode; -DBG ("id=%d" , id);if (!msm_dsi->panel) { msm_dsi->panel =msm_dsi_host_get_panel (msm_dsi->host);
@@ -292,6 +289,17 @@ static enum drm_connector_status dsi_mgr_connector_detect(pr_err ("mdp does not support dual DSI\n" ); } } +} + +static enum drm_connector_status dsi_mgr_connector_detect ( +struct drm_connector *connector,bool force) +{ +int id =dsi_mgr_connector_get_id (connector); +struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id); + +DBG ("id=%d" , id); +if (!msm_dsi->panel) +msm_dsi_manager_panel_init (connector, id);return msm_dsi->panel ? connector_status_connected : connector_status_disconnected;
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH 10/13 drm/msm/dsi: Simplify the logic in msm_dsi_manager_panel_init()
In reply to a message not in the archiveFrom: Sean Paul <[email protected]>
This patch moves things around a bit to be a little more readable and pulls out the set_encoder_mode() call into its own function for later use.
--- drivers/gpu/drm/msm/dsi/dsi_manager.c | 100 +++++++++++++++----------- 1 file changed, 59 insertions(+), 41 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_manager.c +59 -41
@@ -239,56 +239,71 @@ static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi)return !(host_flags &MIPI_DSI_MODE_VIDEO ); } -static void msm_dsi_manager_panel_init (struct drm_connector *connector,u8 id) +static void msm_dsi_manager_setup_encoder (int id) {struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id); -struct msm_dsi *other_dsi =dsi_mgr_get_other_dsi (id); -struct msm_drm_private *priv = connector->dev->dev_private; +struct msm_drm_private *priv = msm_dsi->dev->dev_private;struct msm_kms *kms = priv->kms; -bool cmd_mode; +struct drm_encoder *encoder =msm_dsi_get_encoder (msm_dsi); -if (!msm_dsi->panel) { - msm_dsi->panel =msm_dsi_host_get_panel (msm_dsi->host); +if (encoder && kms->funcs->set_encoder_mode) + kms->funcs->set_encoder_mode (kms, encoder, +dsi_mgr_is_cmd_mode (msm_dsi)); +} -/* There is only 1 panel in the global panel list -* for dual DSI mode. Therefore slave dsi should get -* the drm_panel instance from master dsi. -*/ -if (!msm_dsi->panel &&IS_DUAL_DSI () && - !IS_MASTER_DSI_LINK (id) && other_dsi) - msm_dsi->panel =msm_dsi_host_get_panel ( - other_dsi->host); +static int msm_dsi_manager_panel_init (struct drm_connector *conn,u8 id) +{ +struct msm_drm_private *priv = conn->dev->dev_private; +struct msm_kms *kms = priv->kms; +struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id); +struct msm_dsi *other_dsi =dsi_mgr_get_other_dsi (id); +struct msm_dsi *master_dsi, *slave_dsi; +struct drm_panel *panel; +if (IS_DUAL_DSI () && !IS_MASTER_DSI_LINK (id)) { + master_dsi = other_dsi; + slave_dsi = msm_dsi; + }else { + master_dsi = msm_dsi; + slave_dsi = other_dsi; + } - cmd_mode =dsi_mgr_is_cmd_mode (msm_dsi); -if (msm_dsi->panel && kms->funcs->set_encoder_mode) { -struct drm_encoder *encoder = -msm_dsi_get_encoder (msm_dsi); +/* +* There is only 1 panel in the global panel list for dual DSI mode. +* Therefore slave dsi should get the drm_panel instance from master +* dsi. +*/ + panel =msm_dsi_host_get_panel (master_dsi->host); +if (IS_ERR (panel)) { +DRM_ERROR ("Could not find panel for %u (%ld)\n" , msm_dsi->id, +PTR_ERR (panel)); +return PTR_ERR (panel); + } - kms->funcs->set_encoder_mode (kms, encoder, cmd_mode); - } +if (!panel) +return 0 ; -if (msm_dsi->panel &&IS_DUAL_DSI ()) -drm_object_attach_property (&connector->base, - connector->dev->mode_config.tile_property,0 ); +msm_dsi_manager_setup_encoder (id); -/* Set split display info to kms once dual DSI panel is -* connected to both hosts. -*/ -if (msm_dsi->panel &&IS_DUAL_DSI () && - other_dsi && other_dsi->panel) { -struct drm_encoder *encoder =msm_dsi_get_encoder ( -dsi_mgr_get_dsi (DSI_ENCODER_MASTER )); -struct drm_encoder *slave_enc =msm_dsi_get_encoder ( -dsi_mgr_get_dsi (DSI_ENCODER_SLAVE )); - -if (kms->funcs->set_split_display) - kms->funcs->set_split_display (kms, encoder, - slave_enc, cmd_mode); -else -pr_err ("mdp does not support dual DSI\n" ); - } +if (!IS_DUAL_DSI ()) + goto out; + +drm_object_attach_property (&conn->base, + conn->dev->mode_config.tile_property,0 ); + +/* +* Set split display info to kms once dual DSI panel is connected to +* both hosts. +*/ +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)); } + +out: + msm_dsi->panel = panel; +return 0 ; } static enum drm_connector_status dsi_mgr_connector_detect(
@@ -298,8 +313,11 @@ static enum drm_connector_status dsi_mgr_connector_detect(struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id);DBG ("id=%d" , id); -if (!msm_dsi->panel) -msm_dsi_manager_panel_init (connector, id); +if (!msm_dsi->panel) { +int ret =msm_dsi_manager_panel_init (connector, id); +if (ret) +return connector_status_disconnected; + }return msm_dsi->panel ? connector_status_connected : connector_status_disconnected;
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH 11/13 drm/msm/dsi: Use the new setup_encoder function in attach_dsi_device
In reply to a message not in the archiveFrom: Sean Paul <[email protected]>
Now that we have a function to call set_encoder_mode() for us, use it.
--- drivers/gpu/drm/msm/dsi/dsi.h | 2 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +- drivers/gpu/drm/msm/dsi/dsi_manager.c | 15 ++------------- 3 files changed, 4 insertions(+), 15 deletions(-)
drivers/gpu/drm/msm/dsi/dsi.h +1 -1
@@ -96,7 +96,7 @@ 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_attach_dsi_device (int id,u32 device_flags); +void msm_dsi_manager_attach_dsi_device (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_host.c +1 -1
@@ -1598,7 +1598,7 @@ static int dsi_host_attach(struct mipi_dsi_host *host, msm_host->format = dsi->format; msm_host->mode_flags = dsi->mode_flags; -msm_dsi_manager_attach_dsi_device (msm_host->id, dsi->mode_flags); +msm_dsi_manager_attach_dsi_device (msm_host->id);/* Some gpios defined in panel DT need to be controlled by host */ ret =dsi_host_init_panel_gpios (msm_host, &dsi->dev);
drivers/gpu/drm/msm/dsi/dsi_manager.c +2 -13
@@ -787,14 +787,10 @@ bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len)return true; } -void msm_dsi_manager_attach_dsi_device (int id,u32 device_flags) +void msm_dsi_manager_attach_dsi_device (int id) {struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id);struct drm_device *dev = msm_dsi->dev; -struct msm_drm_private *priv; -struct msm_kms *kms; -struct drm_encoder *encoder; -bool cmd_mode;/* * drm_device pointer is assigned to msm_dsi only in the modeset_init
@@ -806,14 +802,7 @@ void msm_dsi_manager_attach_dsi_device(int id, u32 device_flags)if (!dev)return ; - priv = dev->dev_private; - kms = priv->kms; - encoder =msm_dsi_get_encoder (msm_dsi); - cmd_mode = !(device_flags & -MIPI_DSI_MODE_VIDEO ); - -if (encoder && kms->funcs->set_encoder_mode) - kms->funcs->set_encoder_mode (kms, encoder, cmd_mode); +msm_dsi_manager_setup_encoder (id); }int msm_dsi_manager_register (struct msm_dsi *msm_dsi)
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH 12/13 drm/msm/dsi: Move dsi panel init into modeset init path
In reply to a message not in the archiveFrom: Sean Paul <[email protected]>
Since deferred probe from the modeset init path now works, we can move the panel initialization from detect() into connector init. This avoids doing work in detect() and hopefully will result in a more deterministic boot sequence between devices with a dsi panel, and those with an external bridge.
--- drivers/gpu/drm/msm/dsi/dsi_manager.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_manager.c +10 -7
@@ -312,13 +312,6 @@ static enum drm_connector_status dsi_mgr_connector_detect(int id =dsi_mgr_connector_get_id (connector);struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id); -DBG ("id=%d" , id); -if (!msm_dsi->panel) { -int ret =msm_dsi_manager_panel_init (connector, id); -if (ret) -return connector_status_disconnected; - } -return msm_dsi->panel ? connector_status_connected : connector_status_disconnected; }
@@ -631,7 +624,17 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id)drm_connector_attach_encoder (connector, msm_dsi->encoder); + ret =msm_dsi_manager_panel_init (connector, id); +if (ret) { +DRM_DEV_ERROR (msm_dsi->dev->dev,"init panel failed %d\n" , ret); + goto fail; + } +return connector; + +fail: + connector->funcs->destroy (msm_dsi->connector); +return ERR_PTR (ret); }bool msm_dsi_manager_validate_current_config (u8 id)
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH 13/13 drm/msm/dsi: Move setup_encoder to modeset_init
In reply to a message not in the archiveFrom: Sean Paul <[email protected]>
Now that the panel probe/setup is in the modeset path, we can call dsi_manager_setup_encoder() in a common place for both internal and external bridge setups.
--- drivers/gpu/drm/msm/dsi/dsi.c | 2 ++ drivers/gpu/drm/msm/dsi/dsi.h | 2 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 -- drivers/gpu/drm/msm/dsi/dsi_manager.c | 27 ++------------------------- 4 files changed, 5 insertions(+), 28 deletions(-)
drivers/gpu/drm/msm/dsi/dsi.c +2 -0
@@ -250,6 +250,8 @@ 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 +1 -1
@@ -96,7 +96,7 @@ 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_attach_dsi_device (int id); +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_host.c +0 -2
@@ -1598,8 +1598,6 @@ static int dsi_host_attach(struct mipi_dsi_host *host, msm_host->format = dsi->format; msm_host->mode_flags = dsi->mode_flags; -msm_dsi_manager_attach_dsi_device (msm_host->id); -/* Some gpios defined in panel DT need to be controlled by host */ ret =dsi_host_init_panel_gpios (msm_host, &dsi->dev);if (ret)
drivers/gpu/drm/msm/dsi/dsi_manager.c +2 -25
@@ -239,7 +239,7 @@ static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi)return !(host_flags &MIPI_DSI_MODE_VIDEO ); } -static void msm_dsi_manager_setup_encoder (int 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;
@@ -280,12 +280,7 @@ static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 id)return PTR_ERR (panel); } -if (!panel) -return 0 ; - -msm_dsi_manager_setup_encoder (id); - -if (!IS_DUAL_DSI ()) +if (!panel || !IS_DUAL_DSI ()) goto out; drm_object_attach_property(&conn->base,
@@ -790,24 +785,6 @@ bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len)return true; } -void msm_dsi_manager_attach_dsi_device (int id) -{ -struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id); -struct drm_device *dev = msm_dsi->dev; - -/* -* drm_device pointer is assigned to msm_dsi only in the modeset_init -* path. If mipi_dsi_attach() happens in DSI driver's probe path -* (generally the case when we're connected to a drm_panel of the type -* mipi_dsi_device), this would be NULL. In such cases, try to set the -* encoder mode in the DSI connector's detect() op. -*/ -if (!dev) -return ; - -msm_dsi_manager_setup_encoder (id); -} -int msm_dsi_manager_register (struct msm_dsi *msm_dsi) {struct msm_dsi_manager *msm_dsim = &msm_dsim_glb;
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Sean Paul
reviewerPATCH 5/13 drm/msm/dsi_pll_10nm: Remove impossible check
In reply to Sean PaulFrom: Sean Paul <[email protected]>
While I'm in here, cut this out, pdev can't be NULL
--- drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c +0 -3
@@ -818,9 +818,6 @@ struct msm_dsi_pll *msm_dsi_pll_10nm_init(struct platform_device *pdev, int id)struct msm_dsi_pll *pll;int ret; -if (!pdev) -return ERR_PTR (-ENODEV ); - pll_10nm =devm_kzalloc (&pdev->dev,sizeof (*pll_10nm),GFP_KERNEL );if (!pll_10nm)return ERR_PTR (-ENOMEM );
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sean Paul
reviewerPATCH 7/13 drm/msm/dsi: Split mode_flags out of msm_dsi_host_get_panel()
In reply to Sean PaulFrom: Sean Paul <[email protected]>
We use the flags in more places than just get_panel, so split them out into a separate function.
--- drivers/gpu/drm/msm/dsi/dsi.h | 4 ++-- drivers/gpu/drm/msm/dsi/dsi_host.c | 15 ++++++--------- drivers/gpu/drm/msm/dsi/dsi_manager.c | 7 ++++--- 3 files changed, 12 insertions(+), 14 deletions(-)
drivers/gpu/drm/msm/dsi/dsi.h +2 -2
@@ -169,8 +169,8 @@ int msm_dsi_host_power_on(struct mipi_dsi_host *host,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); -struct drm_panel *msm_dsi_host_get_panel (struct mipi_dsi_host *host, -unsigned long *panel_flags); +struct drm_panel *msm_dsi_host_get_panel (struct mipi_dsi_host *host); +unsigned long msm_dsi_host_get_mode_flags (struct mipi_dsi_host *host);struct drm_bridge *msm_dsi_host_get_bridge (struct mipi_dsi_host *host);int msm_dsi_host_register (struct mipi_dsi_host *host,bool check_defer);void msm_dsi_host_unregister (struct mipi_dsi_host *host);
drivers/gpu/drm/msm/dsi/dsi_host.c +6 -9
@@ -2442,17 +2442,14 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host,return 0 ; } -struct drm_panel *msm_dsi_host_get_panel (struct mipi_dsi_host *host, -unsigned long *panel_flags) +struct drm_panel *msm_dsi_host_get_panel (struct mipi_dsi_host *host) { -struct msm_dsi_host *msm_host =to_msm_dsi_host (host); -struct drm_panel *panel; - - panel =of_drm_find_panel (msm_host->device_node); -if (panel_flags) - *panel_flags = msm_host->mode_flags; +return of_drm_find_panel (to_msm_dsi_host (host)->device_node); +} -return panel; +unsigned long msm_dsi_host_get_mode_flags (struct mipi_dsi_host *host) +{ +return to_msm_dsi_host (host)->mode_flags; }struct drm_bridge *msm_dsi_host_get_bridge (struct mipi_dsi_host *host)
drivers/gpu/drm/msm/dsi/dsi_manager.c +4 -3
@@ -244,8 +244,9 @@ static enum drm_connector_status dsi_mgr_connector_detect(DBG ("id=%d" , id);if (!msm_dsi->panel) { - msm_dsi->panel =msm_dsi_host_get_panel (msm_dsi->host, - &msm_dsi->device_flags); + msm_dsi->panel =msm_dsi_host_get_panel (msm_dsi->host); + msm_dsi->device_flags =msm_dsi_host_get_mode_flags ( + msm_dsi->host);/* There is only 1 panel in the global panel list * for dual DSI mode. Therefore slave dsi should get
@@ -255,7 +256,7 @@ static enum drm_connector_status dsi_mgr_connector_detect(if (!msm_dsi->panel &&IS_DUAL_DSI () && !IS_MASTER_DSI_LINK (id) && other_dsi) msm_dsi->panel =msm_dsi_host_get_panel ( - other_dsi->host,NULL ); + other_dsi->host);if (msm_dsi->panel && kms->funcs->set_encoder_mode) {
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel