Lines Matching +full:dp +full:- +full:bridge
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
32 MODULE_PARM_DESC(psr_enabled, "enable PSR for eDP and DP displays");
165 { .compatible = "qcom,sc7180-dp", .data = &sc7180_dp_descs },
166 { .compatible = "qcom,sc7280-dp", .data = &sc7280_dp_descs },
167 { .compatible = "qcom,sc7280-edp", .data = &sc7280_dp_descs },
168 { .compatible = "qcom,sc8180x-dp", .data = &sc8180x_dp_descs },
169 { .compatible = "qcom,sc8180x-edp", .data = &sc8180x_dp_descs },
170 { .compatible = "qcom,sc8280xp-dp", .data = &sc8280xp_dp_descs },
171 { .compatible = "qcom,sc8280xp-edp", .data = &sc8280xp_dp_descs },
172 { .compatible = "qcom,sdm845-dp", .data = &sc7180_dp_descs },
173 { .compatible = "qcom,sm8350-dp", .data = &sc7180_dp_descs },
174 { .compatible = "qcom,sm8650-dp", .data = &sm8650_dp_descs },
175 { .compatible = "qcom,x1e80100-dp", .data = &x1e80100_dp_descs },
181 struct msm_dp *dp = dev_get_drvdata(dev); in dev_get_dp_display_private() local
183 return container_of(dp, struct dp_display_private, dp_display); in dev_get_dp_display_private()
193 spin_lock_irqsave(&dp_priv->event_lock, flag); in dp_add_event()
194 pndx = dp_priv->event_pndx + 1; in dp_add_event()
196 if (pndx == dp_priv->event_gndx) { in dp_add_event()
198 dp_priv->event_pndx, dp_priv->event_gndx); in dp_add_event()
199 spin_unlock_irqrestore(&dp_priv->event_lock, flag); in dp_add_event()
200 return -EPERM; in dp_add_event()
202 todo = &dp_priv->event_list[dp_priv->event_pndx++]; in dp_add_event()
203 dp_priv->event_pndx %= DP_EVENT_Q_MAX; in dp_add_event()
204 todo->event_id = event; in dp_add_event()
205 todo->data = data; in dp_add_event()
206 todo->delay = delay; in dp_add_event()
207 wake_up(&dp_priv->event_q); in dp_add_event()
208 spin_unlock_irqrestore(&dp_priv->event_lock, flag); in dp_add_event()
219 spin_lock_irqsave(&dp_priv->event_lock, flag); in dp_del_event()
220 if (dp_priv->event_pndx == dp_priv->event_gndx) { in dp_del_event()
221 spin_unlock_irqrestore(&dp_priv->event_lock, flag); in dp_del_event()
222 return -ENOENT; in dp_del_event()
225 gndx = dp_priv->event_gndx; in dp_del_event()
226 while (dp_priv->event_pndx != gndx) { in dp_del_event()
227 todo = &dp_priv->event_list[gndx]; in dp_del_event()
228 if (todo->event_id == event) { in dp_del_event()
229 todo->event_id = EV_NO_EVENT; /* deleted */ in dp_del_event()
230 todo->delay = 0; in dp_del_event()
235 spin_unlock_irqrestore(&dp_priv->event_lock, flag); in dp_del_event()
242 struct dp_display_private *dp; in dp_display_signal_audio_start() local
244 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_display_signal_audio_start()
246 reinit_completion(&dp->audio_comp); in dp_display_signal_audio_start()
251 struct dp_display_private *dp; in dp_display_signal_audio_complete() local
253 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_display_signal_audio_complete()
255 complete_all(&dp->audio_comp); in dp_display_signal_audio_complete()
264 struct dp_display_private *dp = dev_get_dp_display_private(dev); in dp_display_bind() local
266 struct drm_device *drm = priv->dev; in dp_display_bind()
268 dp->dp_display.drm_dev = drm; in dp_display_bind()
269 priv->dp[dp->id] = &dp->dp_display; in dp_display_bind()
273 dp->drm_dev = drm; in dp_display_bind()
274 dp->aux->drm_dev = drm; in dp_display_bind()
275 rc = dp_aux_register(dp->aux); in dp_display_bind()
277 DRM_ERROR("DRM DP AUX register failed\n"); in dp_display_bind()
282 rc = dp_register_audio_driver(dev, dp->audio); in dp_display_bind()
284 DRM_ERROR("Audio registration Dp failed\n"); in dp_display_bind()
288 rc = dp_hpd_event_thread_start(dp); in dp_display_bind()
302 struct dp_display_private *dp = dev_get_dp_display_private(dev); in dp_display_unbind() local
305 kthread_stop(dp->ev_tsk); in dp_display_unbind()
307 of_dp_aux_depopulate_bus(dp->aux); in dp_display_unbind()
309 dp_unregister_audio_driver(dev, dp->audio); in dp_display_unbind()
310 dp_aux_unregister(dp->aux); in dp_display_unbind()
311 dp->drm_dev = NULL; in dp_display_unbind()
312 dp->aux->drm_dev = NULL; in dp_display_unbind()
313 priv->dp[dp->id] = NULL; in dp_display_unbind()
323 struct dp_display_private *dp; in dp_display_send_hpd_event() local
326 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_display_send_hpd_event()
328 connector = dp->dp_display.connector; in dp_display_send_hpd_event()
329 drm_helper_hpd_irq_event(connector->dev); in dp_display_send_hpd_event()
332 static int dp_display_send_hpd_notification(struct dp_display_private *dp, in dp_display_send_hpd_notification() argument
335 if ((hpd && dp->dp_display.link_ready) || in dp_display_send_hpd_notification()
336 (!hpd && !dp->dp_display.link_ready)) { in dp_display_send_hpd_notification()
337 drm_dbg_dp(dp->drm_dev, "HPD already %s\n", in dp_display_send_hpd_notification()
344 dp->panel->video_test = false; in dp_display_send_hpd_notification()
345 if (!dp->dp_display.is_edp) in dp_display_send_hpd_notification()
346 drm_dp_set_subconnector_property(dp->dp_display.connector, in dp_display_send_hpd_notification()
348 dp->panel->dpcd, in dp_display_send_hpd_notification()
349 dp->panel->downstream_ports); in dp_display_send_hpd_notification()
352 dp->dp_display.link_ready = hpd; in dp_display_send_hpd_notification()
354 drm_dbg_dp(dp->drm_dev, "type=%d hpd=%d\n", in dp_display_send_hpd_notification()
355 dp->dp_display.connector_type, hpd); in dp_display_send_hpd_notification()
356 dp_display_send_hpd_event(&dp->dp_display); in dp_display_send_hpd_notification()
361 static int dp_display_process_hpd_high(struct dp_display_private *dp) in dp_display_process_hpd_high() argument
363 struct drm_connector *connector = dp->dp_display.connector; in dp_display_process_hpd_high()
364 const struct drm_display_info *info = &connector->display_info; in dp_display_process_hpd_high()
367 rc = dp_panel_read_sink_caps(dp->panel, connector); in dp_display_process_hpd_high()
371 dp_link_process_request(dp->link); in dp_display_process_hpd_high()
373 if (!dp->dp_display.is_edp) in dp_display_process_hpd_high()
376 dp->panel->dpcd, in dp_display_process_hpd_high()
377 dp->panel->downstream_ports); in dp_display_process_hpd_high()
379 dp->dp_display.psr_supported = dp->panel->psr_cap.version && psr_enabled; in dp_display_process_hpd_high()
381 dp->audio_supported = info->has_audio; in dp_display_process_hpd_high()
382 dp_panel_handle_sink_request(dp->panel); in dp_display_process_hpd_high()
385 * set sink to normal operation mode -- D0 in dp_display_process_hpd_high()
388 dp_link_psm_config(dp->link, &dp->panel->link_info, false); in dp_display_process_hpd_high()
390 dp_link_reset_phy_params_vx_px(dp->link); in dp_display_process_hpd_high()
391 rc = dp_ctrl_on_link(dp->ctrl); in dp_display_process_hpd_high()
393 DRM_ERROR("failed to complete DP link training\n"); in dp_display_process_hpd_high()
397 dp_add_event(dp, EV_USER_NOTIFICATION, true, 0); in dp_display_process_hpd_high()
403 static void dp_display_host_phy_init(struct dp_display_private *dp) in dp_display_host_phy_init() argument
405 drm_dbg_dp(dp->drm_dev, "type=%d core_init=%d phy_init=%d\n", in dp_display_host_phy_init()
406 dp->dp_display.connector_type, dp->core_initialized, in dp_display_host_phy_init()
407 dp->phy_initialized); in dp_display_host_phy_init()
409 if (!dp->phy_initialized) { in dp_display_host_phy_init()
410 dp_ctrl_phy_init(dp->ctrl); in dp_display_host_phy_init()
411 dp->phy_initialized = true; in dp_display_host_phy_init()
415 static void dp_display_host_phy_exit(struct dp_display_private *dp) in dp_display_host_phy_exit() argument
417 drm_dbg_dp(dp->drm_dev, "type=%d core_init=%d phy_init=%d\n", in dp_display_host_phy_exit()
418 dp->dp_display.connector_type, dp->core_initialized, in dp_display_host_phy_exit()
419 dp->phy_initialized); in dp_display_host_phy_exit()
421 if (dp->phy_initialized) { in dp_display_host_phy_exit()
422 dp_ctrl_phy_exit(dp->ctrl); in dp_display_host_phy_exit()
423 dp->phy_initialized = false; in dp_display_host_phy_exit()
427 static void dp_display_host_init(struct dp_display_private *dp) in dp_display_host_init() argument
429 drm_dbg_dp(dp->drm_dev, "type=%d core_init=%d phy_init=%d\n", in dp_display_host_init()
430 dp->dp_display.connector_type, dp->core_initialized, in dp_display_host_init()
431 dp->phy_initialized); in dp_display_host_init()
433 dp_ctrl_core_clk_enable(dp->ctrl); in dp_display_host_init()
434 dp_ctrl_reset_irq_ctrl(dp->ctrl, true); in dp_display_host_init()
435 dp_aux_init(dp->aux); in dp_display_host_init()
436 dp->core_initialized = true; in dp_display_host_init()
439 static void dp_display_host_deinit(struct dp_display_private *dp) in dp_display_host_deinit() argument
441 drm_dbg_dp(dp->drm_dev, "type=%d core_init=%d phy_init=%d\n", in dp_display_host_deinit()
442 dp->dp_display.connector_type, dp->core_initialized, in dp_display_host_deinit()
443 dp->phy_initialized); in dp_display_host_deinit()
445 dp_ctrl_reset_irq_ctrl(dp->ctrl, false); in dp_display_host_deinit()
446 dp_aux_deinit(dp->aux); in dp_display_host_deinit()
447 dp_ctrl_core_clk_disable(dp->ctrl); in dp_display_host_deinit()
448 dp->core_initialized = false; in dp_display_host_deinit()
453 struct dp_display_private *dp = dev_get_dp_display_private(dev); in dp_display_usbpd_configure_cb() local
455 dp_display_host_phy_init(dp); in dp_display_usbpd_configure_cb()
457 return dp_display_process_hpd_high(dp); in dp_display_usbpd_configure_cb()
462 struct dp_display_private *dp = dev_get_dp_display_private(dev); in dp_display_notify_disconnect() local
464 dp_add_event(dp, EV_USER_NOTIFICATION, false, 0); in dp_display_notify_disconnect()
469 static void dp_display_handle_video_request(struct dp_display_private *dp) in dp_display_handle_video_request() argument
471 if (dp->link->sink_request & DP_TEST_LINK_VIDEO_PATTERN) { in dp_display_handle_video_request()
472 dp->panel->video_test = true; in dp_display_handle_video_request()
473 dp_link_send_test_response(dp->link); in dp_display_handle_video_request()
477 static int dp_display_handle_port_status_changed(struct dp_display_private *dp) in dp_display_handle_port_status_changed() argument
481 if (drm_dp_is_branch(dp->panel->dpcd) && dp->link->sink_count == 0) { in dp_display_handle_port_status_changed()
482 drm_dbg_dp(dp->drm_dev, "sink count is zero, nothing to do\n"); in dp_display_handle_port_status_changed()
483 if (dp->hpd_state != ST_DISCONNECTED) { in dp_display_handle_port_status_changed()
484 dp->hpd_state = ST_DISCONNECT_PENDING; in dp_display_handle_port_status_changed()
485 dp_add_event(dp, EV_USER_NOTIFICATION, false, 0); in dp_display_handle_port_status_changed()
488 if (dp->hpd_state == ST_DISCONNECTED) { in dp_display_handle_port_status_changed()
489 dp->hpd_state = ST_MAINLINK_READY; in dp_display_handle_port_status_changed()
490 rc = dp_display_process_hpd_high(dp); in dp_display_handle_port_status_changed()
492 dp->hpd_state = ST_DISCONNECTED; in dp_display_handle_port_status_changed()
499 static int dp_display_handle_irq_hpd(struct dp_display_private *dp) in dp_display_handle_irq_hpd() argument
501 u32 sink_request = dp->link->sink_request; in dp_display_handle_irq_hpd()
503 drm_dbg_dp(dp->drm_dev, "%d\n", sink_request); in dp_display_handle_irq_hpd()
504 if (dp->hpd_state == ST_DISCONNECTED) { in dp_display_handle_irq_hpd()
506 drm_dbg_dp(dp->drm_dev, "Disconnected sink_request: %d\n", in dp_display_handle_irq_hpd()
509 return -EINVAL; in dp_display_handle_irq_hpd()
513 dp_ctrl_handle_sink_request(dp->ctrl); in dp_display_handle_irq_hpd()
516 dp_display_handle_video_request(dp); in dp_display_handle_irq_hpd()
525 struct dp_display_private *dp = dev_get_dp_display_private(dev); in dp_display_usbpd_attention_cb() local
528 rc = dp_link_process_request(dp->link); in dp_display_usbpd_attention_cb()
530 sink_request = dp->link->sink_request; in dp_display_usbpd_attention_cb()
531 drm_dbg_dp(dp->drm_dev, "hpd_state=%d sink_request=%d\n", in dp_display_usbpd_attention_cb()
532 dp->hpd_state, sink_request); in dp_display_usbpd_attention_cb()
534 rc = dp_display_handle_port_status_changed(dp); in dp_display_usbpd_attention_cb()
536 rc = dp_display_handle_irq_hpd(dp); in dp_display_usbpd_attention_cb()
542 static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data) in dp_hpd_plug_handle() argument
546 struct platform_device *pdev = dp->dp_display.pdev; in dp_hpd_plug_handle()
548 dp_aux_enable_xfers(dp->aux, true); in dp_hpd_plug_handle()
550 mutex_lock(&dp->event_mutex); in dp_hpd_plug_handle()
552 state = dp->hpd_state; in dp_hpd_plug_handle()
553 drm_dbg_dp(dp->drm_dev, "Before, type=%d hpd_state=%d\n", in dp_hpd_plug_handle()
554 dp->dp_display.connector_type, state); in dp_hpd_plug_handle()
557 mutex_unlock(&dp->event_mutex); in dp_hpd_plug_handle()
562 mutex_unlock(&dp->event_mutex); in dp_hpd_plug_handle()
568 dp_add_event(dp, EV_HPD_PLUG_INT, 0, 1); /* delay = 1 */ in dp_hpd_plug_handle()
569 mutex_unlock(&dp->event_mutex); in dp_hpd_plug_handle()
573 ret = pm_runtime_resume_and_get(&pdev->dev); in dp_hpd_plug_handle()
576 mutex_unlock(&dp->event_mutex); in dp_hpd_plug_handle()
580 ret = dp_display_usbpd_configure_cb(&pdev->dev); in dp_hpd_plug_handle()
582 dp->hpd_state = ST_DISCONNECTED; in dp_hpd_plug_handle()
583 pm_runtime_put_sync(&pdev->dev); in dp_hpd_plug_handle()
585 dp->hpd_state = ST_MAINLINK_READY; in dp_hpd_plug_handle()
588 drm_dbg_dp(dp->drm_dev, "After, type=%d hpd_state=%d\n", in dp_hpd_plug_handle()
589 dp->dp_display.connector_type, state); in dp_hpd_plug_handle()
590 mutex_unlock(&dp->event_mutex); in dp_hpd_plug_handle()
599 struct dp_display_private *dp; in dp_display_handle_plugged_change() local
601 dp = container_of(dp_display, in dp_display_handle_plugged_change()
605 if (dp_display->plugged_cb && dp_display->codec_dev && in dp_display_handle_plugged_change()
606 dp->audio_supported) in dp_display_handle_plugged_change()
607 dp_display->plugged_cb(dp_display->codec_dev, plugged); in dp_display_handle_plugged_change()
610 static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data) in dp_hpd_unplug_handle() argument
613 struct platform_device *pdev = dp->dp_display.pdev; in dp_hpd_unplug_handle()
615 dp_aux_enable_xfers(dp->aux, false); in dp_hpd_unplug_handle()
617 mutex_lock(&dp->event_mutex); in dp_hpd_unplug_handle()
619 state = dp->hpd_state; in dp_hpd_unplug_handle()
621 drm_dbg_dp(dp->drm_dev, "Before, type=%d hpd_state=%d\n", in dp_hpd_unplug_handle()
622 dp->dp_display.connector_type, state); in dp_hpd_unplug_handle()
625 dp_del_event(dp, EV_IRQ_HPD_INT); in dp_hpd_unplug_handle()
629 if (dp->link->sink_count == 0) { in dp_hpd_unplug_handle()
630 dp_display_host_phy_exit(dp); in dp_hpd_unplug_handle()
632 dp_display_notify_disconnect(&dp->dp_display.pdev->dev); in dp_hpd_unplug_handle()
633 mutex_unlock(&dp->event_mutex); in dp_hpd_unplug_handle()
636 mutex_unlock(&dp->event_mutex); in dp_hpd_unplug_handle()
639 dp_ctrl_off_link(dp->ctrl); in dp_hpd_unplug_handle()
640 dp_display_host_phy_exit(dp); in dp_hpd_unplug_handle()
641 dp->hpd_state = ST_DISCONNECTED; in dp_hpd_unplug_handle()
642 dp_display_notify_disconnect(&dp->dp_display.pdev->dev); in dp_hpd_unplug_handle()
643 pm_runtime_put_sync(&pdev->dev); in dp_hpd_unplug_handle()
644 mutex_unlock(&dp->event_mutex); in dp_hpd_unplug_handle()
652 dp_display_notify_disconnect(&dp->dp_display.pdev->dev); in dp_hpd_unplug_handle()
655 dp->hpd_state = ST_DISCONNECTED; in dp_hpd_unplug_handle()
657 dp->hpd_state = ST_DISCONNECT_PENDING; in dp_hpd_unplug_handle()
661 dp_display_handle_plugged_change(&dp->dp_display, false); in dp_hpd_unplug_handle()
663 drm_dbg_dp(dp->drm_dev, "After, type=%d hpd_state=%d\n", in dp_hpd_unplug_handle()
664 dp->dp_display.connector_type, state); in dp_hpd_unplug_handle()
667 pm_runtime_put_sync(&pdev->dev); in dp_hpd_unplug_handle()
668 mutex_unlock(&dp->event_mutex); in dp_hpd_unplug_handle()
672 static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data) in dp_irq_hpd_handle() argument
676 mutex_lock(&dp->event_mutex); in dp_irq_hpd_handle()
679 state = dp->hpd_state; in dp_irq_hpd_handle()
680 drm_dbg_dp(dp->drm_dev, "Before, type=%d hpd_state=%d\n", in dp_irq_hpd_handle()
681 dp->dp_display.connector_type, state); in dp_irq_hpd_handle()
684 mutex_unlock(&dp->event_mutex); in dp_irq_hpd_handle()
690 dp_add_event(dp, EV_IRQ_HPD_INT, 0, 1); /* delay = 1 */ in dp_irq_hpd_handle()
691 mutex_unlock(&dp->event_mutex); in dp_irq_hpd_handle()
695 dp_display_usbpd_attention_cb(&dp->dp_display.pdev->dev); in dp_irq_hpd_handle()
697 drm_dbg_dp(dp->drm_dev, "After, type=%d hpd_state=%d\n", in dp_irq_hpd_handle()
698 dp->dp_display.connector_type, state); in dp_irq_hpd_handle()
700 mutex_unlock(&dp->event_mutex); in dp_irq_hpd_handle()
705 static void dp_display_deinit_sub_modules(struct dp_display_private *dp) in dp_display_deinit_sub_modules() argument
707 dp_audio_put(dp->audio); in dp_display_deinit_sub_modules()
708 dp_panel_put(dp->panel); in dp_display_deinit_sub_modules()
709 dp_aux_put(dp->aux); in dp_display_deinit_sub_modules()
712 static int dp_init_sub_modules(struct dp_display_private *dp) in dp_init_sub_modules() argument
715 struct device *dev = &dp->dp_display.pdev->dev; in dp_init_sub_modules()
721 phy = devm_phy_get(dev, "dp"); in dp_init_sub_modules()
726 dp->dp_display.is_edp ? PHY_SUBMODE_EDP : PHY_SUBMODE_DP); in dp_init_sub_modules()
729 dp->catalog = NULL; in dp_init_sub_modules()
733 dp->catalog = dp_catalog_get(dev); in dp_init_sub_modules()
734 if (IS_ERR(dp->catalog)) { in dp_init_sub_modules()
735 rc = PTR_ERR(dp->catalog); in dp_init_sub_modules()
737 dp->catalog = NULL; in dp_init_sub_modules()
741 dp->aux = dp_aux_get(dev, dp->catalog, in dp_init_sub_modules()
743 dp->dp_display.is_edp); in dp_init_sub_modules()
744 if (IS_ERR(dp->aux)) { in dp_init_sub_modules()
745 rc = PTR_ERR(dp->aux); in dp_init_sub_modules()
747 dp->aux = NULL; in dp_init_sub_modules()
751 dp->link = dp_link_get(dev, dp->aux); in dp_init_sub_modules()
752 if (IS_ERR(dp->link)) { in dp_init_sub_modules()
753 rc = PTR_ERR(dp->link); in dp_init_sub_modules()
755 dp->link = NULL; in dp_init_sub_modules()
759 panel_in.aux = dp->aux; in dp_init_sub_modules()
760 panel_in.catalog = dp->catalog; in dp_init_sub_modules()
761 panel_in.link = dp->link; in dp_init_sub_modules()
763 dp->panel = dp_panel_get(&panel_in); in dp_init_sub_modules()
764 if (IS_ERR(dp->panel)) { in dp_init_sub_modules()
765 rc = PTR_ERR(dp->panel); in dp_init_sub_modules()
767 dp->panel = NULL; in dp_init_sub_modules()
771 dp->ctrl = dp_ctrl_get(dev, dp->link, dp->panel, dp->aux, in dp_init_sub_modules()
772 dp->catalog, in dp_init_sub_modules()
774 if (IS_ERR(dp->ctrl)) { in dp_init_sub_modules()
775 rc = PTR_ERR(dp->ctrl); in dp_init_sub_modules()
777 dp->ctrl = NULL; in dp_init_sub_modules()
781 dp->audio = dp_audio_get(dp->dp_display.pdev, dp->panel, dp->catalog); in dp_init_sub_modules()
782 if (IS_ERR(dp->audio)) { in dp_init_sub_modules()
783 rc = PTR_ERR(dp->audio); in dp_init_sub_modules()
785 dp->audio = NULL; in dp_init_sub_modules()
792 dp_panel_put(dp->panel); in dp_init_sub_modules()
794 dp_aux_put(dp->aux); in dp_init_sub_modules()
802 struct dp_display_private *dp; in dp_display_set_mode() local
804 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_display_set_mode()
806 drm_mode_copy(&dp->panel->dp_mode.drm_mode, &mode->drm_mode); in dp_display_set_mode()
807 dp->panel->dp_mode.bpp = mode->bpp; in dp_display_set_mode()
808 dp->panel->dp_mode.out_fmt_is_yuv_420 = mode->out_fmt_is_yuv_420; in dp_display_set_mode()
809 dp_panel_init_panel_info(dp->panel); in dp_display_set_mode()
813 static int dp_display_enable(struct dp_display_private *dp, bool force_link_train) in dp_display_enable() argument
816 struct msm_dp *dp_display = &dp->dp_display; in dp_display_enable()
818 drm_dbg_dp(dp->drm_dev, "sink_count=%d\n", dp->link->sink_count); in dp_display_enable()
819 if (dp_display->power_on) { in dp_display_enable()
820 drm_dbg_dp(dp->drm_dev, "Link already setup, return\n"); in dp_display_enable()
824 rc = dp_ctrl_on_stream(dp->ctrl, force_link_train); in dp_display_enable()
826 dp_display->power_on = true; in dp_display_enable()
833 struct dp_display_private *dp; in dp_display_post_enable() local
836 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_display_post_enable()
838 rate = dp->link->link_params.rate; in dp_display_post_enable()
840 if (dp->audio_supported) { in dp_display_post_enable()
841 dp->audio->bw_code = drm_dp_link_rate_to_bw_code(rate); in dp_display_post_enable()
842 dp->audio->lane_count = dp->link->link_params.num_lanes; in dp_display_post_enable()
848 if (dp_display->psr_supported) in dp_display_post_enable()
849 dp_ctrl_config_psr(dp->ctrl); in dp_display_post_enable()
854 static int dp_display_disable(struct dp_display_private *dp) in dp_display_disable() argument
856 struct msm_dp *dp_display = &dp->dp_display; in dp_display_disable()
858 if (!dp_display->power_on) in dp_display_disable()
862 if (dp_display->audio_enabled) { in dp_display_disable()
865 if (!wait_for_completion_timeout(&dp->audio_comp, in dp_display_disable()
870 dp_display->audio_enabled = false; in dp_display_disable()
872 if (dp->link->sink_count == 0) { in dp_display_disable()
877 dp_ctrl_off_link_stream(dp->ctrl); in dp_display_disable()
883 dp_ctrl_off(dp->ctrl); in dp_display_disable()
884 dp_display_host_phy_exit(dp); in dp_display_disable()
887 dp_display->power_on = false; in dp_display_disable()
889 drm_dbg_dp(dp->drm_dev, "sink count: %d\n", dp->link->sink_count); in dp_display_disable()
898 dp_display->plugged_cb = fn; in dp_display_set_plugged_cb()
899 dp_display->codec_dev = codec_dev; in dp_display_set_plugged_cb()
900 plugged = dp_display->link_ready; in dp_display_set_plugged_cb()
907 * dp_bridge_mode_valid - callback to determine if specified mode is valid
908 * @bridge: Pointer to drm bridge structure
913 enum drm_mode_status dp_bridge_mode_valid(struct drm_bridge *bridge, in dp_bridge_mode_valid() argument
921 struct msm_dp *dp; in dp_bridge_mode_valid() local
922 int mode_pclk_khz = mode->clock; in dp_bridge_mode_valid()
924 dp = to_dp_bridge(bridge)->dp_display; in dp_bridge_mode_valid()
926 if (!dp || !mode_pclk_khz || !dp->connector) { in dp_bridge_mode_valid()
928 return -EINVAL; in dp_bridge_mode_valid()
931 if (mode->clock > DP_MAX_PIXEL_CLK_KHZ) in dp_bridge_mode_valid()
934 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_bridge_mode_valid()
935 link_info = &dp_display->panel->link_info; in dp_bridge_mode_valid()
937 if (drm_mode_is_420_only(&dp->connector->display_info, mode) && in dp_bridge_mode_valid()
938 dp_display->panel->vsc_sdp_supported) in dp_bridge_mode_valid()
941 mode_bpp = dp->connector->display_info.bpc * num_components; in dp_bridge_mode_valid()
945 mode_bpp = dp_panel_get_mode_bpp(dp_display->panel, in dp_bridge_mode_valid()
949 supported_rate_khz = link_info->num_lanes * link_info->rate * 8; in dp_bridge_mode_valid()
957 int dp_display_get_modes(struct msm_dp *dp) in dp_display_get_modes() argument
961 if (!dp) { in dp_display_get_modes()
966 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_display_get_modes()
968 return dp_panel_get_modes(dp_display->panel, in dp_display_get_modes()
969 dp->connector); in dp_display_get_modes()
972 bool dp_display_check_video_test(struct msm_dp *dp) in dp_display_check_video_test() argument
976 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_display_check_video_test()
978 return dp_display->panel->video_test; in dp_display_check_video_test()
981 int dp_display_get_test_bpp(struct msm_dp *dp) in dp_display_get_test_bpp() argument
985 if (!dp) { in dp_display_get_test_bpp()
990 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_display_get_test_bpp()
993 dp_display->link->test_video.test_bit_depth); in dp_display_get_test_bpp()
996 void msm_dp_snapshot(struct msm_disp_state *disp_state, struct msm_dp *dp) in msm_dp_snapshot() argument
1000 dp_display = container_of(dp, struct dp_display_private, dp_display); in msm_dp_snapshot()
1004 * however till DP cable is connected this will not happen as we in msm_dp_snapshot()
1006 * power_on status before dumping DP registers to avoid crash due in msm_dp_snapshot()
1009 mutex_lock(&dp_display->event_mutex); in msm_dp_snapshot()
1011 if (!dp->power_on) { in msm_dp_snapshot()
1012 mutex_unlock(&dp_display->event_mutex); in msm_dp_snapshot()
1016 dp_catalog_snapshot(dp_display->catalog, disp_state); in msm_dp_snapshot()
1018 mutex_unlock(&dp_display->event_mutex); in msm_dp_snapshot()
1023 struct dp_display_private *dp; in dp_display_set_psr() local
1030 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_display_set_psr()
1031 dp_ctrl_set_psr(dp->ctrl, enter); in dp_display_set_psr()
1045 wait_event_timeout(dp_priv->event_q, in hpd_event_thread()
1046 (dp_priv->event_pndx == dp_priv->event_gndx) || in hpd_event_thread()
1049 wait_event_interruptible(dp_priv->event_q, in hpd_event_thread()
1050 (dp_priv->event_pndx != dp_priv->event_gndx) || in hpd_event_thread()
1057 spin_lock_irqsave(&dp_priv->event_lock, flag); in hpd_event_thread()
1058 todo = &dp_priv->event_list[dp_priv->event_gndx]; in hpd_event_thread()
1059 if (todo->delay) { in hpd_event_thread()
1062 dp_priv->event_gndx++; in hpd_event_thread()
1063 dp_priv->event_gndx %= DP_EVENT_Q_MAX; in hpd_event_thread()
1066 todo_next = &dp_priv->event_list[dp_priv->event_pndx++]; in hpd_event_thread()
1067 dp_priv->event_pndx %= DP_EVENT_Q_MAX; in hpd_event_thread()
1068 todo_next->event_id = todo->event_id; in hpd_event_thread()
1069 todo_next->data = todo->data; in hpd_event_thread()
1070 todo_next->delay = todo->delay - 1; in hpd_event_thread()
1073 todo->event_id = EV_NO_EVENT; in hpd_event_thread()
1074 todo->delay = 0; in hpd_event_thread()
1078 spin_unlock_irqrestore(&dp_priv->event_lock, flag); in hpd_event_thread()
1083 if (dp_priv->event_pndx == dp_priv->event_gndx) { in hpd_event_thread()
1084 spin_unlock_irqrestore(&dp_priv->event_lock, flag); in hpd_event_thread()
1088 dp_priv->event_gndx++; in hpd_event_thread()
1089 dp_priv->event_gndx %= DP_EVENT_Q_MAX; in hpd_event_thread()
1091 spin_unlock_irqrestore(&dp_priv->event_lock, flag); in hpd_event_thread()
1093 switch (todo->event_id) { in hpd_event_thread()
1095 dp_hpd_plug_handle(dp_priv, todo->data); in hpd_event_thread()
1098 dp_hpd_unplug_handle(dp_priv, todo->data); in hpd_event_thread()
1101 dp_irq_hpd_handle(dp_priv, todo->data); in hpd_event_thread()
1105 todo->data); in hpd_event_thread()
1118 dp_priv->event_gndx = 0; in dp_hpd_event_thread_start()
1119 dp_priv->event_pndx = 0; in dp_hpd_event_thread_start()
1121 dp_priv->ev_tsk = kthread_run(hpd_event_thread, dp_priv, "dp_hpd_handler"); in dp_hpd_event_thread_start()
1122 if (IS_ERR(dp_priv->ev_tsk)) in dp_hpd_event_thread_start()
1123 return PTR_ERR(dp_priv->ev_tsk); in dp_hpd_event_thread_start()
1130 struct dp_display_private *dp = dev_id; in dp_display_irq_handler() local
1134 if (!dp) { in dp_display_irq_handler()
1139 hpd_isr_status = dp_catalog_hpd_get_intr_status(dp->catalog); in dp_display_irq_handler()
1142 drm_dbg_dp(dp->drm_dev, "type=%d isr=0x%x\n", in dp_display_irq_handler()
1143 dp->dp_display.connector_type, hpd_isr_status); in dp_display_irq_handler()
1146 dp_add_event(dp, EV_HPD_PLUG_INT, 0, 0); in dp_display_irq_handler()
1149 dp_add_event(dp, EV_IRQ_HPD_INT, 0, 0); in dp_display_irq_handler()
1153 dp_add_event(dp, EV_HPD_UNPLUG_INT, 0, 0); in dp_display_irq_handler()
1154 dp_add_event(dp, EV_HPD_PLUG_INT, 0, 3); in dp_display_irq_handler()
1158 dp_add_event(dp, EV_HPD_UNPLUG_INT, 0, 0); in dp_display_irq_handler()
1163 /* DP controller isr */ in dp_display_irq_handler()
1164 ret |= dp_ctrl_isr(dp->ctrl); in dp_display_irq_handler()
1166 /* DP aux isr */ in dp_display_irq_handler()
1167 ret |= dp_aux_isr(dp->aux); in dp_display_irq_handler()
1172 static int dp_display_request_irq(struct dp_display_private *dp) in dp_display_request_irq() argument
1175 struct platform_device *pdev = dp->dp_display.pdev; in dp_display_request_irq()
1177 dp->irq = platform_get_irq(pdev, 0); in dp_display_request_irq()
1178 if (dp->irq < 0) { in dp_display_request_irq()
1180 return dp->irq; in dp_display_request_irq()
1183 rc = devm_request_irq(&pdev->dev, dp->irq, dp_display_irq_handler, in dp_display_request_irq()
1185 "dp_display_isr", dp); in dp_display_request_irq()
1189 dp->irq, rc); in dp_display_request_irq()
1198 const struct msm_dp_desc *descs = of_device_get_match_data(&pdev->dev); in dp_display_get_desc()
1207 if (descs[i].io_start == res->start) in dp_display_get_desc()
1211 dev_err(&pdev->dev, "unknown displayport instance\n"); in dp_display_get_desc()
1217 struct msm_dp *dp = dev_get_drvdata(dev); in dp_display_probe_tail() local
1222 * provide at least an eDP panel (which gets wrapped into panel-bridge). in dp_display_probe_tail()
1225 * silently ignore an error if one is not present (-ENODEV). in dp_display_probe_tail()
1227 dp->next_bridge = devm_drm_of_get_bridge(&dp->pdev->dev, dp->pdev->dev.of_node, 1, 0); in dp_display_probe_tail()
1228 if (IS_ERR(dp->next_bridge)) { in dp_display_probe_tail()
1229 ret = PTR_ERR(dp->next_bridge); in dp_display_probe_tail()
1230 dp->next_bridge = NULL; in dp_display_probe_tail()
1231 if (dp->is_edp || ret != -ENODEV) in dp_display_probe_tail()
1244 return dp_display_probe_tail(aux->dev); in dp_auxbus_done_probe()
1250 struct device_node *node = pdev->dev.of_node; in dp_display_get_connector_type()
1251 struct device_node *aux_bus = of_get_child_by_name(node, "aux-bus"); in dp_display_get_connector_type()
1269 struct dp_display_private *dp; in dp_display_probe() local
1272 if (!pdev || !pdev->dev.of_node) { in dp_display_probe()
1274 return -ENODEV; in dp_display_probe()
1277 dp = devm_kzalloc(&pdev->dev, sizeof(*dp), GFP_KERNEL); in dp_display_probe()
1278 if (!dp) in dp_display_probe()
1279 return -ENOMEM; in dp_display_probe()
1283 return -EINVAL; in dp_display_probe()
1285 dp->dp_display.pdev = pdev; in dp_display_probe()
1286 dp->id = desc->id; in dp_display_probe()
1287 dp->dp_display.connector_type = dp_display_get_connector_type(pdev, desc); in dp_display_probe()
1288 dp->wide_bus_supported = desc->wide_bus_supported; in dp_display_probe()
1289 dp->dp_display.is_edp = in dp_display_probe()
1290 (dp->dp_display.connector_type == DRM_MODE_CONNECTOR_eDP); in dp_display_probe()
1292 rc = dp_init_sub_modules(dp); in dp_display_probe()
1295 return -EPROBE_DEFER; in dp_display_probe()
1299 mutex_init(&dp->event_mutex); in dp_display_probe()
1300 init_waitqueue_head(&dp->event_q); in dp_display_probe()
1301 spin_lock_init(&dp->event_lock); in dp_display_probe()
1303 /* Store DP audio handle inside DP display */ in dp_display_probe()
1304 dp->dp_display.dp_audio = dp->audio; in dp_display_probe()
1306 init_completion(&dp->audio_comp); in dp_display_probe()
1308 platform_set_drvdata(pdev, &dp->dp_display); in dp_display_probe()
1310 rc = devm_pm_runtime_enable(&pdev->dev); in dp_display_probe()
1314 rc = dp_display_request_irq(dp); in dp_display_probe()
1318 if (dp->dp_display.is_edp) { in dp_display_probe()
1319 rc = devm_of_dp_aux_populate_bus(dp->aux, dp_auxbus_done_probe); in dp_display_probe()
1325 rc = dp_display_probe_tail(&pdev->dev); in dp_display_probe()
1333 dp_display_deinit_sub_modules(dp); in dp_display_probe()
1339 struct dp_display_private *dp = dev_get_dp_display_private(&pdev->dev); in dp_display_remove() local
1341 component_del(&pdev->dev, &dp_display_comp_ops); in dp_display_remove()
1342 dp_display_deinit_sub_modules(dp); in dp_display_remove()
1348 struct dp_display_private *dp = dev_get_dp_display_private(dev); in dp_pm_runtime_suspend() local
1350 disable_irq(dp->irq); in dp_pm_runtime_suspend()
1352 if (dp->dp_display.is_edp) { in dp_pm_runtime_suspend()
1353 dp_display_host_phy_exit(dp); in dp_pm_runtime_suspend()
1354 dp_catalog_ctrl_hpd_disable(dp->catalog); in dp_pm_runtime_suspend()
1356 dp_display_host_deinit(dp); in dp_pm_runtime_suspend()
1363 struct dp_display_private *dp = dev_get_dp_display_private(dev); in dp_pm_runtime_resume() local
1369 * for DP, only host controller is enabled here. in dp_pm_runtime_resume()
1373 dp_display_host_init(dp); in dp_pm_runtime_resume()
1374 if (dp->dp_display.is_edp) { in dp_pm_runtime_resume()
1375 dp_catalog_ctrl_hpd_enable(dp->catalog); in dp_pm_runtime_resume()
1376 dp_display_host_phy_init(dp); in dp_pm_runtime_resume()
1379 enable_irq(dp->irq); in dp_pm_runtime_resume()
1393 .name = "msm-dp-display",
1406 DRM_ERROR("Dp display driver register failed"); in msm_dp_register()
1419 struct dp_display_private *dp; in msm_dp_is_yuv_420_enabled() local
1422 dp = container_of(dp_display, struct dp_display_private, dp_display); in msm_dp_is_yuv_420_enabled()
1423 info = &dp_display->connector->display_info; in msm_dp_is_yuv_420_enabled()
1425 return dp->panel->vsc_sdp_supported && drm_mode_is_420_only(info, mode); in msm_dp_is_yuv_420_enabled()
1436 struct dp_display_private *dp; in msm_dp_wide_bus_available() local
1438 dp = container_of(dp_display, struct dp_display_private, dp_display); in msm_dp_wide_bus_available()
1440 if (dp->dp_mode.out_fmt_is_yuv_420) in msm_dp_wide_bus_available()
1443 return dp->wide_bus_supported; in msm_dp_wide_bus_available()
1448 struct dp_display_private *dp; in dp_display_debugfs_init() local
1452 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_display_debugfs_init()
1453 dev = &dp->dp_display.pdev->dev; in dp_display_debugfs_init()
1455 rc = dp_debug_init(dev, dp->panel, dp->link, dp->dp_display.connector, root, is_edp); in dp_display_debugfs_init()
1466 dp_display->drm_dev = dev; in msm_dp_modeset_init()
1472 DRM_DEV_ERROR(dev->dev, in msm_dp_modeset_init()
1473 "failed to create dp bridge: %d\n", ret); in msm_dp_modeset_init()
1477 dp_display->connector = dp_drm_connector_init(dp_display, encoder, yuv_supported); in msm_dp_modeset_init()
1478 if (IS_ERR(dp_display->connector)) { in msm_dp_modeset_init()
1479 ret = PTR_ERR(dp_display->connector); in msm_dp_modeset_init()
1480 DRM_DEV_ERROR(dev->dev, in msm_dp_modeset_init()
1481 "failed to create dp connector: %d\n", ret); in msm_dp_modeset_init()
1482 dp_display->connector = NULL; in msm_dp_modeset_init()
1486 dp_priv->panel->connector = dp_display->connector; in msm_dp_modeset_init()
1495 struct msm_dp *dp = dp_bridge->dp_display; in dp_bridge_atomic_enable() local
1501 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_bridge_atomic_enable()
1502 if (!dp_display->dp_mode.drm_mode.clock) { in dp_bridge_atomic_enable()
1507 if (dp->is_edp) in dp_bridge_atomic_enable()
1510 mutex_lock(&dp_display->event_mutex); in dp_bridge_atomic_enable()
1511 if (pm_runtime_resume_and_get(&dp->pdev->dev)) { in dp_bridge_atomic_enable()
1513 mutex_unlock(&dp_display->event_mutex); in dp_bridge_atomic_enable()
1517 state = dp_display->hpd_state; in dp_bridge_atomic_enable()
1519 mutex_unlock(&dp_display->event_mutex); in dp_bridge_atomic_enable()
1523 rc = dp_display_set_mode(dp, &dp_display->dp_mode); in dp_bridge_atomic_enable()
1526 mutex_unlock(&dp_display->event_mutex); in dp_bridge_atomic_enable()
1530 state = dp_display->hpd_state; in dp_bridge_atomic_enable()
1539 rc = dp_display_post_enable(dp); in dp_bridge_atomic_enable()
1541 DRM_ERROR("DP display post enable failed, rc=%d\n", rc); in dp_bridge_atomic_enable()
1546 dp_display->hpd_state = ST_CONNECTED; in dp_bridge_atomic_enable()
1548 drm_dbg_dp(dp->drm_dev, "type=%d Done\n", dp->connector_type); in dp_bridge_atomic_enable()
1549 mutex_unlock(&dp_display->event_mutex); in dp_bridge_atomic_enable()
1556 struct msm_dp *dp = dp_bridge->dp_display; in dp_bridge_atomic_disable() local
1559 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_bridge_atomic_disable()
1561 dp_ctrl_push_idle(dp_display->ctrl); in dp_bridge_atomic_disable()
1568 struct msm_dp *dp = dp_bridge->dp_display; in dp_bridge_atomic_post_disable() local
1572 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_bridge_atomic_post_disable()
1574 if (dp->is_edp) in dp_bridge_atomic_post_disable()
1577 mutex_lock(&dp_display->event_mutex); in dp_bridge_atomic_post_disable()
1579 state = dp_display->hpd_state; in dp_bridge_atomic_post_disable()
1581 drm_dbg_dp(dp->drm_dev, "type=%d wrong hpd_state=%d\n", in dp_bridge_atomic_post_disable()
1582 dp->connector_type, state); in dp_bridge_atomic_post_disable()
1586 state = dp_display->hpd_state; in dp_bridge_atomic_post_disable()
1589 dp_display->hpd_state = ST_DISCONNECTED; in dp_bridge_atomic_post_disable()
1591 dp_display->hpd_state = ST_DISPLAY_OFF; in dp_bridge_atomic_post_disable()
1594 drm_dbg_dp(dp->drm_dev, "type=%d Done\n", dp->connector_type); in dp_bridge_atomic_post_disable()
1596 pm_runtime_put_sync(&dp->pdev->dev); in dp_bridge_atomic_post_disable()
1597 mutex_unlock(&dp_display->event_mutex); in dp_bridge_atomic_post_disable()
1605 struct msm_dp *dp = dp_bridge->dp_display; in dp_bridge_mode_set() local
1609 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_bridge_mode_set()
1610 dp_panel = dp_display->panel; in dp_bridge_mode_set()
1612 memset(&dp_display->dp_mode, 0x0, sizeof(struct dp_display_mode)); in dp_bridge_mode_set()
1614 if (dp_display_check_video_test(dp)) in dp_bridge_mode_set()
1615 dp_display->dp_mode.bpp = dp_display_get_test_bpp(dp); in dp_bridge_mode_set()
1617 dp_display->dp_mode.bpp = dp->connector->display_info.bpc * 3; in dp_bridge_mode_set()
1619 if (!dp_display->dp_mode.bpp) in dp_bridge_mode_set()
1620 dp_display->dp_mode.bpp = 24; /* Default bpp */ in dp_bridge_mode_set()
1622 drm_mode_copy(&dp_display->dp_mode.drm_mode, adjusted_mode); in dp_bridge_mode_set()
1624 dp_display->dp_mode.v_active_low = in dp_bridge_mode_set()
1625 !!(dp_display->dp_mode.drm_mode.flags & DRM_MODE_FLAG_NVSYNC); in dp_bridge_mode_set()
1627 dp_display->dp_mode.h_active_low = in dp_bridge_mode_set()
1628 !!(dp_display->dp_mode.drm_mode.flags & DRM_MODE_FLAG_NHSYNC); in dp_bridge_mode_set()
1630 dp_display->dp_mode.out_fmt_is_yuv_420 = in dp_bridge_mode_set()
1631 drm_mode_is_420_only(&dp->connector->display_info, adjusted_mode) && in dp_bridge_mode_set()
1632 dp_panel->vsc_sdp_supported; in dp_bridge_mode_set()
1635 dp_display->ctrl->wide_bus_en = in dp_bridge_mode_set()
1636 dp_display->dp_mode.out_fmt_is_yuv_420 ? false : dp_display->wide_bus_supported; in dp_bridge_mode_set()
1637 dp_display->catalog->wide_bus_en = in dp_bridge_mode_set()
1638 dp_display->dp_mode.out_fmt_is_yuv_420 ? false : dp_display->wide_bus_supported; in dp_bridge_mode_set()
1641 void dp_bridge_hpd_enable(struct drm_bridge *bridge) in dp_bridge_hpd_enable() argument
1643 struct msm_dp_bridge *dp_bridge = to_dp_bridge(bridge); in dp_bridge_hpd_enable()
1644 struct msm_dp *dp_display = dp_bridge->dp_display; in dp_bridge_hpd_enable()
1645 struct dp_display_private *dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_bridge_hpd_enable() local
1648 * this is for external DP with hpd irq enabled case, in dp_bridge_hpd_enable()
1649 * step-1: dp_pm_runtime_resume() enable dp host only in dp_bridge_hpd_enable()
1650 * step-2: enable hdp block and have hpd irq enabled here in dp_bridge_hpd_enable()
1651 * step-3: waiting for plugin irq while phy is not initialized in dp_bridge_hpd_enable()
1652 * step-4: DP PHY is initialized at plugin handler before link training in dp_bridge_hpd_enable()
1655 mutex_lock(&dp->event_mutex); in dp_bridge_hpd_enable()
1656 if (pm_runtime_resume_and_get(&dp_display->pdev->dev)) { in dp_bridge_hpd_enable()
1658 mutex_unlock(&dp->event_mutex); in dp_bridge_hpd_enable()
1662 dp_catalog_ctrl_hpd_enable(dp->catalog); in dp_bridge_hpd_enable()
1665 dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_INT_MASK, true); in dp_bridge_hpd_enable()
1667 dp_display->internal_hpd = true; in dp_bridge_hpd_enable()
1668 mutex_unlock(&dp->event_mutex); in dp_bridge_hpd_enable()
1671 void dp_bridge_hpd_disable(struct drm_bridge *bridge) in dp_bridge_hpd_disable() argument
1673 struct msm_dp_bridge *dp_bridge = to_dp_bridge(bridge); in dp_bridge_hpd_disable()
1674 struct msm_dp *dp_display = dp_bridge->dp_display; in dp_bridge_hpd_disable()
1675 struct dp_display_private *dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_bridge_hpd_disable() local
1677 mutex_lock(&dp->event_mutex); in dp_bridge_hpd_disable()
1679 dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_INT_MASK, false); in dp_bridge_hpd_disable()
1680 dp_catalog_ctrl_hpd_disable(dp->catalog); in dp_bridge_hpd_disable()
1682 dp_display->internal_hpd = false; in dp_bridge_hpd_disable()
1684 pm_runtime_put_sync(&dp_display->pdev->dev); in dp_bridge_hpd_disable()
1685 mutex_unlock(&dp->event_mutex); in dp_bridge_hpd_disable()
1688 void dp_bridge_hpd_notify(struct drm_bridge *bridge, in dp_bridge_hpd_notify() argument
1691 struct msm_dp_bridge *dp_bridge = to_dp_bridge(bridge); in dp_bridge_hpd_notify()
1692 struct msm_dp *dp_display = dp_bridge->dp_display; in dp_bridge_hpd_notify()
1693 struct dp_display_private *dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_bridge_hpd_notify() local
1695 /* Without next_bridge interrupts are handled by the DP core directly */ in dp_bridge_hpd_notify()
1696 if (dp_display->internal_hpd) in dp_bridge_hpd_notify()
1699 if (!dp_display->link_ready && status == connector_status_connected) in dp_bridge_hpd_notify()
1700 dp_add_event(dp, EV_HPD_PLUG_INT, 0, 0); in dp_bridge_hpd_notify()
1701 else if (dp_display->link_ready && status == connector_status_disconnected) in dp_bridge_hpd_notify()
1702 dp_add_event(dp, EV_HPD_UNPLUG_INT, 0, 0); in dp_bridge_hpd_notify()