提交 be488566 编写于 作者: J Jeykumar Sankaran 提交者: Greg Kroah-Hartman

drm/msm/dpu: handle failures while initializing displays

[ Upstream commit a802ee99c448ca0496fa307f3e46b834ae2a46a3 ]

Bail out KMS hw init on display initialization failures with
proper error logging.

changes in v3:
    - introduced in the series
changes in v4:
    - avoid duplicate return on errors (Sean Paul)
    - avoid spamming errors on failures (Jordon Crouse)
Signed-off-by: NJeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: NSean Paul <seanpaul@chromium.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
上级 b5b3bb03
...@@ -442,35 +442,38 @@ static void dpu_kms_wait_for_commit_done(struct msm_kms *kms, ...@@ -442,35 +442,38 @@ static void dpu_kms_wait_for_commit_done(struct msm_kms *kms,
} }
} }
static void _dpu_kms_initialize_dsi(struct drm_device *dev, static int _dpu_kms_initialize_dsi(struct drm_device *dev,
struct msm_drm_private *priv, struct msm_drm_private *priv,
struct dpu_kms *dpu_kms) struct dpu_kms *dpu_kms)
{ {
struct drm_encoder *encoder = NULL; struct drm_encoder *encoder = NULL;
int i, rc; int i, rc = 0;
if (!(priv->dsi[0] || priv->dsi[1]))
return rc;
/*TODO: Support two independent DSI connectors */ /*TODO: Support two independent DSI connectors */
encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI); encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
if (IS_ERR_OR_NULL(encoder)) { if (IS_ERR(encoder)) {
DPU_ERROR("encoder init failed for dsi display\n"); DPU_ERROR("encoder init failed for dsi display\n");
return; return PTR_ERR(encoder);
} }
priv->encoders[priv->num_encoders++] = encoder; priv->encoders[priv->num_encoders++] = encoder;
for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
if (!priv->dsi[i]) { if (!priv->dsi[i])
DPU_DEBUG("invalid msm_dsi for ctrl %d\n", i); continue;
return;
}
rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder); rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
if (rc) { if (rc) {
DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n", DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
i, rc); i, rc);
continue; break;
} }
} }
return rc;
} }
/** /**
...@@ -481,16 +484,16 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev, ...@@ -481,16 +484,16 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev,
* @dpu_kms: Pointer to dpu kms structure * @dpu_kms: Pointer to dpu kms structure
* Returns: Zero on success * Returns: Zero on success
*/ */
static void _dpu_kms_setup_displays(struct drm_device *dev, static int _dpu_kms_setup_displays(struct drm_device *dev,
struct msm_drm_private *priv, struct msm_drm_private *priv,
struct dpu_kms *dpu_kms) struct dpu_kms *dpu_kms)
{ {
_dpu_kms_initialize_dsi(dev, priv, dpu_kms);
/** /**
* Extend this function to initialize other * Extend this function to initialize other
* types of displays * types of displays
*/ */
return _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
} }
static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
...@@ -552,7 +555,9 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) ...@@ -552,7 +555,9 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
* Create encoder and query display drivers to create * Create encoder and query display drivers to create
* bridges and connectors * bridges and connectors
*/ */
_dpu_kms_setup_displays(dev, priv, dpu_kms); ret = _dpu_kms_setup_displays(dev, priv, dpu_kms);
if (ret)
goto fail;
max_crtc_count = min(catalog->mixer_count, priv->num_encoders); max_crtc_count = min(catalog->mixer_count, priv->num_encoders);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册