diff options
author | Sean Paul <seanpaul@chromium.org> | 2019-06-17 16:12:58 -0400 |
---|---|---|
committer | Sean Paul <seanpaul@chromium.org> | 2019-06-20 14:42:19 -0400 |
commit | 03436e3ec69c8e026224a5f172e5d0431f722305 (patch) | |
tree | 8082d72c8eb37aae77f24ef59771da7d134938d3 | |
parent | 6d5e78406991a144b7c44cd57b21e290fdb1d227 (diff) |
drm/msm/dsi: Move setup_encoder to modeset_init
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.
Reviewed-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190617201301.133275-10-sean@poorly.run
-rw-r--r-- | drivers/gpu/drm/msm/dsi/dsi.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/dsi/dsi.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/dsi/dsi_host.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/msm/dsi/dsi_manager.c | 37 |
4 files changed, 5 insertions, 38 deletions
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 7b2a1e6a8810..d45b0a40aaf3 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c | |||
@@ -250,6 +250,8 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, | |||
250 | goto fail; | 250 | goto fail; |
251 | } | 251 | } |
252 | 252 | ||
253 | msm_dsi_manager_setup_encoder(msm_dsi->id); | ||
254 | |||
253 | priv->bridges[priv->num_bridges++] = msm_dsi->bridge; | 255 | priv->bridges[priv->num_bridges++] = msm_dsi->bridge; |
254 | priv->connectors[priv->num_connectors++] = msm_dsi->connector; | 256 | priv->connectors[priv->num_connectors++] = msm_dsi->connector; |
255 | 257 | ||
diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index f8a611725f2e..53bb124e8259 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h | |||
@@ -96,7 +96,7 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id); | |||
96 | struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id); | 96 | struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id); |
97 | int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg); | 97 | int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg); |
98 | bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len); | 98 | bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len); |
99 | void msm_dsi_manager_attach_dsi_device(int id); | 99 | void msm_dsi_manager_setup_encoder(int id); |
100 | int msm_dsi_manager_register(struct msm_dsi *msm_dsi); | 100 | int msm_dsi_manager_register(struct msm_dsi *msm_dsi); |
101 | void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi); | 101 | void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi); |
102 | bool msm_dsi_manager_validate_current_config(u8 id); | 102 | bool msm_dsi_manager_validate_current_config(u8 id); |
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index f6eb91cf97e6..1ae2f5522979 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c | |||
@@ -1598,8 +1598,6 @@ static int dsi_host_attach(struct mipi_dsi_host *host, | |||
1598 | msm_host->format = dsi->format; | 1598 | msm_host->format = dsi->format; |
1599 | msm_host->mode_flags = dsi->mode_flags; | 1599 | msm_host->mode_flags = dsi->mode_flags; |
1600 | 1600 | ||
1601 | msm_dsi_manager_attach_dsi_device(msm_host->id); | ||
1602 | |||
1603 | /* Some gpios defined in panel DT need to be controlled by host */ | 1601 | /* Some gpios defined in panel DT need to be controlled by host */ |
1604 | ret = dsi_host_init_panel_gpios(msm_host, &dsi->dev); | 1602 | ret = dsi_host_init_panel_gpios(msm_host, &dsi->dev); |
1605 | if (ret) | 1603 | if (ret) |
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 630af00bbe9a..ff39ce6150ad 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c | |||
@@ -239,7 +239,7 @@ static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi) | |||
239 | return !(host_flags & MIPI_DSI_MODE_VIDEO); | 239 | return !(host_flags & MIPI_DSI_MODE_VIDEO); |
240 | } | 240 | } |
241 | 241 | ||
242 | static void msm_dsi_manager_setup_encoder(int id) | 242 | void msm_dsi_manager_setup_encoder(int id) |
243 | { | 243 | { |
244 | struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); | 244 | struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); |
245 | struct msm_drm_private *priv = msm_dsi->dev->dev_private; | 245 | 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) | |||
280 | return PTR_ERR(panel); | 280 | return PTR_ERR(panel); |
281 | } | 281 | } |
282 | 282 | ||
283 | if (!panel) | 283 | if (!panel || !IS_DUAL_DSI()) |
284 | return 0; | ||
285 | |||
286 | msm_dsi_manager_setup_encoder(id); | ||
287 | |||
288 | if (!IS_DUAL_DSI()) | ||
289 | goto out; | 284 | goto out; |
290 | 285 | ||
291 | drm_object_attach_property(&conn->base, | 286 | drm_object_attach_property(&conn->base, |
@@ -790,34 +785,6 @@ bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len) | |||
790 | return true; | 785 | return true; |
791 | } | 786 | } |
792 | 787 | ||
793 | void msm_dsi_manager_attach_dsi_device(int id) | ||
794 | { | ||
795 | struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); | ||
796 | struct drm_device *dev; | ||
797 | |||
798 | /* | ||
799 | * drm_device pointer is assigned to msm_dsi only in the modeset_init | ||
800 | * path. If mipi_dsi_attach() happens in DSI driver's probe path | ||
801 | * (generally the case when we're connected to a drm_panel of the type | ||
802 | * mipi_dsi_device), this would be NULL. In such cases, try to set the | ||
803 | * encoder mode in the DSI connector's detect() op. | ||
804 | * | ||
805 | * msm_dsi pointer is assigned to a valid dsi device only when | ||
806 | * msm_dsi_manager_register() succeeds. When panel hasnt probed yet | ||
807 | * dsi_mgr_setup_components() could potentially return -EDEFER and | ||
808 | * assign the msm_dsi->dev to NULL. When the panel now probes and calls | ||
809 | * mipi_dsi_attach(), this will call msm_dsi_manager_attach_dsi_device() | ||
810 | * which will result in a NULL pointer dereference | ||
811 | */ | ||
812 | |||
813 | dev = msm_dsi ? msm_dsi->dev : NULL; | ||
814 | |||
815 | if (!dev) | ||
816 | return; | ||
817 | |||
818 | msm_dsi_manager_setup_encoder(id); | ||
819 | } | ||
820 | |||
821 | int msm_dsi_manager_register(struct msm_dsi *msm_dsi) | 788 | int msm_dsi_manager_register(struct msm_dsi *msm_dsi) |
822 | { | 789 | { |
823 | struct msm_dsi_manager *msm_dsim = &msm_dsim_glb; | 790 | struct msm_dsi_manager *msm_dsim = &msm_dsim_glb; |