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
This commit is contained in:
@@ -250,6 +250,8 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
msm_dsi_manager_setup_encoder(msm_dsi->id);
|
||||||
|
|
||||||
priv->bridges[priv->num_bridges++] = msm_dsi->bridge;
|
priv->bridges[priv->num_bridges++] = msm_dsi->bridge;
|
||||||
priv->connectors[priv->num_connectors++] = msm_dsi->connector;
|
priv->connectors[priv->num_connectors++] = msm_dsi->connector;
|
||||||
|
|
||||||
|
@@ -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);
|
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);
|
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);
|
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);
|
int msm_dsi_manager_register(struct msm_dsi *msm_dsi);
|
||||||
void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi);
|
void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi);
|
||||||
bool msm_dsi_manager_validate_current_config(u8 id);
|
bool msm_dsi_manager_validate_current_config(u8 id);
|
||||||
|
@@ -1598,8 +1598,6 @@ static int dsi_host_attach(struct mipi_dsi_host *host,
|
|||||||
msm_host->format = dsi->format;
|
msm_host->format = dsi->format;
|
||||||
msm_host->mode_flags = dsi->mode_flags;
|
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 */
|
/* Some gpios defined in panel DT need to be controlled by host */
|
||||||
ret = dsi_host_init_panel_gpios(msm_host, &dsi->dev);
|
ret = dsi_host_init_panel_gpios(msm_host, &dsi->dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@@ -239,7 +239,7 @@ static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi)
|
|||||||
return !(host_flags & MIPI_DSI_MODE_VIDEO);
|
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_dsi *msm_dsi = dsi_mgr_get_dsi(id);
|
||||||
struct msm_drm_private *priv = msm_dsi->dev->dev_private;
|
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);
|
return PTR_ERR(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!panel)
|
if (!panel || !IS_DUAL_DSI())
|
||||||
return 0;
|
|
||||||
|
|
||||||
msm_dsi_manager_setup_encoder(id);
|
|
||||||
|
|
||||||
if (!IS_DUAL_DSI())
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
drm_object_attach_property(&conn->base,
|
drm_object_attach_property(&conn->base,
|
||||||
@@ -790,34 +785,6 @@ bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len)
|
|||||||
return true;
|
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;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* msm_dsi pointer is assigned to a valid dsi device only when
|
|
||||||
* msm_dsi_manager_register() succeeds. When panel hasnt probed yet
|
|
||||||
* dsi_mgr_setup_components() could potentially return -EDEFER and
|
|
||||||
* assign the msm_dsi->dev to NULL. When the panel now probes and calls
|
|
||||||
* mipi_dsi_attach(), this will call msm_dsi_manager_attach_dsi_device()
|
|
||||||
* which will result in a NULL pointer dereference
|
|
||||||
*/
|
|
||||||
|
|
||||||
dev = msm_dsi ? msm_dsi->dev : NULL;
|
|
||||||
|
|
||||||
if (!dev)
|
|
||||||
return;
|
|
||||||
|
|
||||||
msm_dsi_manager_setup_encoder(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
int msm_dsi_manager_register(struct msm_dsi *msm_dsi)
|
int msm_dsi_manager_register(struct msm_dsi *msm_dsi)
|
||||||
{
|
{
|
||||||
struct msm_dsi_manager *msm_dsim = &msm_dsim_glb;
|
struct msm_dsi_manager *msm_dsim = &msm_dsim_glb;
|
||||||
|
Reference in New Issue
Block a user