diff --git a/drivers/gpu/drm/msm/dp/dp_audio.c b/drivers/gpu/drm/msm/dp/dp_audio.c index c4a60dc87e9d..6ac692f77bb2 100644 --- a/drivers/gpu/drm/msm/dp/dp_audio.c +++ b/drivers/gpu/drm/msm/dp/dp_audio.c @@ -428,7 +428,7 @@ static void dp_audio_enable(struct dp_audio_private *audio, bool enable) audio->engine_on = enable; } -static struct dp_audio_private *get_audio_get_data(struct platform_device *pdev) +static struct dp_audio_private *dp_audio_get_data(struct platform_device *pdev) { struct msm_ext_disp_data *ext_data; struct dp_audio *dp_audio; @@ -459,7 +459,7 @@ static int dp_audio_info_setup(struct platform_device *pdev, int rc = 0; struct dp_audio_private *audio; - audio = get_audio_get_data(pdev); + audio = dp_audio_get_data(pdev); if (IS_ERR(audio)) { rc = PTR_ERR(audio); goto end; @@ -482,7 +482,7 @@ static int dp_audio_get_edid_blk(struct platform_device *pdev, struct dp_audio_private *audio; struct sde_edid_ctrl *edid; - audio = get_audio_get_data(pdev); + audio = dp_audio_get_data(pdev); if (IS_ERR(audio)) { rc = PTR_ERR(audio); goto end; @@ -510,18 +510,12 @@ static int dp_audio_get_cable_status(struct platform_device *pdev, u32 vote) int rc = 0; struct dp_audio_private *audio; - audio = get_audio_get_data(pdev); + audio = dp_audio_get_data(pdev); if (IS_ERR(audio)) { rc = PTR_ERR(audio); goto end; } - if (!audio->panel) { - pr_err("invalid panel data\n"); - rc = -EINVAL; - goto end; - } - return audio->session_on; end: return rc; @@ -532,7 +526,7 @@ static int dp_audio_get_intf_id(struct platform_device *pdev) int rc = 0; struct dp_audio_private *audio; - audio = get_audio_get_data(pdev); + audio = dp_audio_get_data(pdev); if (IS_ERR(audio)) { rc = PTR_ERR(audio); goto end; @@ -547,15 +541,10 @@ static void dp_audio_teardown_done(struct platform_device *pdev) { struct dp_audio_private *audio; - audio = get_audio_get_data(pdev); + audio = dp_audio_get_data(pdev); if (IS_ERR(audio)) return; - if (!audio->panel) { - pr_err("invalid panel data\n"); - return; - } - dp_audio_enable(audio, false); complete_all(&audio->hpd_comp); @@ -568,7 +557,7 @@ static int dp_audio_ack_done(struct platform_device *pdev, u32 ack) int rc = 0, ack_hpd; struct dp_audio_private *audio; - audio = get_audio_get_data(pdev); + audio = dp_audio_get_data(pdev); if (IS_ERR(audio)) { rc = PTR_ERR(audio); goto end; diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c index 13ca6b24c1b0..bedceac80442 100644 --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -973,7 +973,7 @@ static int dp_ctrl_link_train(struct dp_ctrl_private *ctrl) } /* print success info as this is a result of user initiated action */ - pr_debug("link training #2 successful\n"); + pr_info("link training #2 successful\n"); end: dp_ctrl_state_ctrl(ctrl, 0); diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index a3425ffa5218..7eb2306f5024 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -375,12 +375,6 @@ static int dp_display_bind(struct device *dev, struct device *master, goto end; } - rc = dp->panel->sde_edid_register(dp->panel); - if (rc) { - pr_err("DRM DP EDID register failed\n"); - goto end; - } - rc = dp->power->power_client_init(dp->power, &priv->phandle); if (rc) { pr_err("Power client create failed\n"); @@ -414,7 +408,6 @@ static void dp_display_unbind(struct device *dev, struct device *master, } (void)dp->power->power_client_deinit(dp->power); - (void)dp->panel->sde_edid_deregister(dp->panel); (void)dp->aux->drm_aux_deregister(dp->aux); dp_display_deinitialize_hdcp(dp); } @@ -923,7 +916,7 @@ static int dp_display_set_mode(struct dp_display *dp_display, mode->timing.bpp, mode->timing.pixel_clk_khz); dp->panel->pinfo = mode->timing; - dp->panel->init_info(dp->panel); + dp->panel->init(dp->panel); mutex_unlock(&dp->session_lock); return 0; @@ -1058,6 +1051,7 @@ static int dp_display_disable(struct dp_display *dp_display) } dp->ctrl->off(dp->ctrl); + dp->panel->deinit(dp->panel); dp->power_on = false; diff --git a/drivers/gpu/drm/msm/dp/dp_panel.c b/drivers/gpu/drm/msm/dp/dp_panel.c index 639712f23665..56542127c861 100644 --- a/drivers/gpu/drm/msm/dp/dp_panel.c +++ b/drivers/gpu/drm/msm/dp/dp_panel.c @@ -187,6 +187,12 @@ static int dp_panel_read_edid(struct dp_panel *dp_panel, panel->aux->reconfig(panel->aux); panel->aux_cfg_update_done = true; } else { + u8 *buf = (u8 *)dp_panel->edid_ctrl->edid; + u32 size = buf[0x7F] ? 256 : 128; + + print_hex_dump(KERN_DEBUG, "[drm-dp] SINK EDID: ", + DUMP_PREFIX_NONE, 16, 1, buf, size, false); + return 0; } } while (retry_cnt < max_retry); @@ -428,34 +434,22 @@ end: return rc; } -static int dp_panel_edid_register(struct dp_panel *dp_panel) +static int dp_panel_edid_register(struct dp_panel_private *panel) { int rc = 0; - if (!dp_panel) { - pr_err("invalid input\n"); - rc = -EINVAL; - goto end; - } - - dp_panel->edid_ctrl = sde_edid_init(); - if (!dp_panel->edid_ctrl) { + panel->dp_panel.edid_ctrl = sde_edid_init(); + if (!panel->dp_panel.edid_ctrl) { pr_err("sde edid init for DP failed\n"); rc = -ENOMEM; - goto end; } -end: + return rc; } -static void dp_panel_edid_deregister(struct dp_panel *dp_panel) +static void dp_panel_edid_deregister(struct dp_panel_private *panel) { - if (!dp_panel) { - pr_err("invalid input\n"); - return; - } - - sde_edid_deinit((void **)&dp_panel->edid_ctrl); + sde_edid_deinit((void **)&panel->dp_panel.edid_ctrl); } static int dp_panel_init_panel_info(struct dp_panel *dp_panel) @@ -494,6 +488,26 @@ end: return rc; } +static int dp_panel_deinit_panel_info(struct dp_panel *dp_panel) +{ + int rc = 0; + struct dp_panel_private *panel; + + if (!dp_panel) { + pr_err("invalid input\n"); + return -EINVAL; + } + + panel = container_of(dp_panel, struct dp_panel_private, dp_panel); + + if (!panel->custom_edid) + sde_free_edid((void **)&dp_panel->edid_ctrl); + + memset(&dp_panel->pinfo, 0, sizeof(dp_panel->pinfo)); + + return rc; +} + static u32 dp_panel_get_min_req_link_rate(struct dp_panel *dp_panel) { const u32 encoding_factx10 = 8; @@ -547,9 +561,8 @@ struct dp_panel *dp_panel_get(struct dp_panel_in *in) panel->aux_cfg_update_done = false; dp_panel->max_bw_code = DP_LINK_BW_8_1; - dp_panel->sde_edid_register = dp_panel_edid_register; - dp_panel->sde_edid_deregister = dp_panel_edid_deregister; - dp_panel->init_info = dp_panel_init_panel_info; + dp_panel->init = dp_panel_init_panel_info; + dp_panel->deinit = dp_panel_deinit_panel_info; dp_panel->timing_cfg = dp_panel_timing_cfg; dp_panel->read_sink_caps = dp_panel_read_sink_caps; dp_panel->get_min_req_link_rate = dp_panel_get_min_req_link_rate; @@ -558,6 +571,8 @@ struct dp_panel *dp_panel_get(struct dp_panel_in *in) dp_panel->handle_sink_request = dp_panel_handle_sink_request; dp_panel->set_edid = dp_panel_set_edid; + dp_panel_edid_register(panel); + return dp_panel; error: return ERR_PTR(rc); @@ -572,5 +587,6 @@ void dp_panel_put(struct dp_panel *dp_panel) panel = container_of(dp_panel, struct dp_panel_private, dp_panel); + dp_panel_edid_deregister(panel); devm_kfree(panel->dev, panel); } diff --git a/drivers/gpu/drm/msm/dp/dp_panel.h b/drivers/gpu/drm/msm/dp/dp_panel.h index cedfe479a76a..ea4ac3929e33 100644 --- a/drivers/gpu/drm/msm/dp/dp_panel.h +++ b/drivers/gpu/drm/msm/dp/dp_panel.h @@ -64,7 +64,6 @@ struct dp_panel { struct drm_dp_link link_info; struct sde_edid_ctrl *edid_ctrl; - struct drm_connector *connector; struct dp_panel_info pinfo; bool video_test; @@ -74,9 +73,8 @@ struct dp_panel { /* debug */ u32 max_bw_code; - int (*sde_edid_register)(struct dp_panel *dp_panel); - void (*sde_edid_deregister)(struct dp_panel *dp_panel); - int (*init_info)(struct dp_panel *dp_panel); + int (*init)(struct dp_panel *dp_panel); + int (*deinit)(struct dp_panel *dp_panel); int (*timing_cfg)(struct dp_panel *dp_panel); int (*read_sink_caps)(struct dp_panel *dp_panel, struct drm_connector *connector);