Lines Matching full:dp

174 	{ .compatible = "qcom,sc7180-dp", .data = &sc7180_dp_cfg },
175 { .compatible = "qcom,sc7280-dp", .data = &sc7280_dp_cfg },
177 { .compatible = "qcom,sc8180x-dp", .data = &sc8180x_dp_cfg },
179 { .compatible = "qcom,sm8350-dp", .data = &sm8350_dp_cfg },
185 struct msm_dp *dp = dev_get_drvdata(dev); in dev_get_dp_display_private() local
187 return container_of(dp, struct dp_display_private, dp_display); in dev_get_dp_display_private()
246 struct dp_display_private *dp; in dp_display_signal_audio_start() local
248 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_display_signal_audio_start()
250 reinit_completion(&dp->audio_comp); in dp_display_signal_audio_start()
255 struct dp_display_private *dp; in dp_display_signal_audio_complete() local
257 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_display_signal_audio_complete()
259 complete_all(&dp->audio_comp); in dp_display_signal_audio_complete()
268 struct dp_display_private *dp = dev_get_dp_display_private(dev); in dp_display_bind() local
272 dp->dp_display.drm_dev = drm; in dp_display_bind()
273 priv->dp[dp->id] = &dp->dp_display; in dp_display_bind()
275 rc = dp->parser->parse(dp->parser); in dp_display_bind()
282 dp->drm_dev = drm; in dp_display_bind()
283 dp->aux->drm_dev = drm; in dp_display_bind()
284 rc = dp_aux_register(dp->aux); in dp_display_bind()
286 DRM_ERROR("DRM DP AUX register failed\n"); in dp_display_bind()
290 rc = dp_power_client_init(dp->power); in dp_display_bind()
296 rc = dp_register_audio_driver(dev, dp->audio); in dp_display_bind()
298 DRM_ERROR("Audio registration Dp failed\n"); in dp_display_bind()
302 rc = dp_hpd_event_thread_start(dp); in dp_display_bind()
316 struct dp_display_private *dp = dev_get_dp_display_private(dev); in dp_display_unbind() local
320 if (dp->core_initialized) in dp_display_unbind()
321 dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_INT_MASK, false); in dp_display_unbind()
323 kthread_stop(dp->ev_tsk); in dp_display_unbind()
325 dp_power_client_deinit(dp->power); in dp_display_unbind()
326 dp_aux_unregister(dp->aux); in dp_display_unbind()
327 dp->drm_dev = NULL; in dp_display_unbind()
328 dp->aux->drm_dev = NULL; in dp_display_unbind()
329 priv->dp[dp->id] = NULL; in dp_display_unbind()
343 static bool dp_display_is_sink_count_zero(struct dp_display_private *dp) in dp_display_is_sink_count_zero() argument
345 drm_dbg_dp(dp->drm_dev, "present=%#x sink_count=%d\n", in dp_display_is_sink_count_zero()
346 dp->panel->dpcd[DP_DOWNSTREAMPORT_PRESENT], in dp_display_is_sink_count_zero()
347 dp->link->sink_count); in dp_display_is_sink_count_zero()
348 return dp_display_is_ds_bridge(dp->panel) && in dp_display_is_sink_count_zero()
349 (dp->link->sink_count == 0); in dp_display_is_sink_count_zero()
354 struct dp_display_private *dp; in dp_display_send_hpd_event() local
357 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_display_send_hpd_event()
359 connector = dp->dp_display.connector; in dp_display_send_hpd_event()
364 static int dp_display_send_hpd_notification(struct dp_display_private *dp, in dp_display_send_hpd_notification() argument
367 if ((hpd && dp->dp_display.is_connected) || in dp_display_send_hpd_notification()
368 (!hpd && !dp->dp_display.is_connected)) { in dp_display_send_hpd_notification()
369 drm_dbg_dp(dp->drm_dev, "HPD already %s\n", in dp_display_send_hpd_notification()
376 dp->panel->video_test = false; in dp_display_send_hpd_notification()
378 dp->dp_display.is_connected = hpd; in dp_display_send_hpd_notification()
380 drm_dbg_dp(dp->drm_dev, "type=%d hpd=%d\n", in dp_display_send_hpd_notification()
381 dp->dp_display.connector_type, hpd); in dp_display_send_hpd_notification()
382 dp_display_send_hpd_event(&dp->dp_display); in dp_display_send_hpd_notification()
387 static int dp_display_process_hpd_high(struct dp_display_private *dp) in dp_display_process_hpd_high() argument
392 dp->panel->max_dp_lanes = dp->parser->max_dp_lanes; in dp_display_process_hpd_high()
394 rc = dp_panel_read_sink_caps(dp->panel, dp->dp_display.connector); in dp_display_process_hpd_high()
398 dp_link_process_request(dp->link); in dp_display_process_hpd_high()
400 edid = dp->panel->edid; in dp_display_process_hpd_high()
402 dp->audio_supported = drm_detect_monitor_audio(edid); in dp_display_process_hpd_high()
403 dp_panel_handle_sink_request(dp->panel); in dp_display_process_hpd_high()
405 dp->dp_display.max_dp_lanes = dp->parser->max_dp_lanes; in dp_display_process_hpd_high()
411 dp_link_psm_config(dp->link, &dp->panel->link_info, false); in dp_display_process_hpd_high()
413 dp_link_reset_phy_params_vx_px(dp->link); in dp_display_process_hpd_high()
414 rc = dp_ctrl_on_link(dp->ctrl); in dp_display_process_hpd_high()
416 DRM_ERROR("failed to complete DP link training\n"); in dp_display_process_hpd_high()
420 dp_add_event(dp, EV_USER_NOTIFICATION, true, 0); in dp_display_process_hpd_high()
426 static void dp_display_host_phy_init(struct dp_display_private *dp) in dp_display_host_phy_init() argument
428 drm_dbg_dp(dp->drm_dev, "type=%d core_init=%d phy_init=%d\n", in dp_display_host_phy_init()
429 dp->dp_display.connector_type, dp->core_initialized, in dp_display_host_phy_init()
430 dp->phy_initialized); in dp_display_host_phy_init()
432 if (!dp->phy_initialized) { in dp_display_host_phy_init()
433 dp_ctrl_phy_init(dp->ctrl); in dp_display_host_phy_init()
434 dp->phy_initialized = true; in dp_display_host_phy_init()
438 static void dp_display_host_phy_exit(struct dp_display_private *dp) in dp_display_host_phy_exit() argument
440 drm_dbg_dp(dp->drm_dev, "type=%d core_init=%d phy_init=%d\n", in dp_display_host_phy_exit()
441 dp->dp_display.connector_type, dp->core_initialized, in dp_display_host_phy_exit()
442 dp->phy_initialized); in dp_display_host_phy_exit()
444 if (dp->phy_initialized) { in dp_display_host_phy_exit()
445 dp_ctrl_phy_exit(dp->ctrl); in dp_display_host_phy_exit()
446 dp->phy_initialized = false; in dp_display_host_phy_exit()
450 static void dp_display_host_init(struct dp_display_private *dp) in dp_display_host_init() argument
452 drm_dbg_dp(dp->drm_dev, "type=%d core_init=%d phy_init=%d\n", in dp_display_host_init()
453 dp->dp_display.connector_type, dp->core_initialized, in dp_display_host_init()
454 dp->phy_initialized); in dp_display_host_init()
456 dp_power_init(dp->power, false); in dp_display_host_init()
457 dp_ctrl_reset_irq_ctrl(dp->ctrl, true); in dp_display_host_init()
458 dp_aux_init(dp->aux); in dp_display_host_init()
459 dp->core_initialized = true; in dp_display_host_init()
462 static void dp_display_host_deinit(struct dp_display_private *dp) in dp_display_host_deinit() argument
464 drm_dbg_dp(dp->drm_dev, "type=%d core_init=%d phy_init=%d\n", in dp_display_host_deinit()
465 dp->dp_display.connector_type, dp->core_initialized, in dp_display_host_deinit()
466 dp->phy_initialized); in dp_display_host_deinit()
468 dp_ctrl_reset_irq_ctrl(dp->ctrl, false); in dp_display_host_deinit()
469 dp_aux_deinit(dp->aux); in dp_display_host_deinit()
470 dp_power_deinit(dp->power); in dp_display_host_deinit()
471 dp->core_initialized = false; in dp_display_host_deinit()
476 struct dp_display_private *dp = dev_get_dp_display_private(dev); in dp_display_usbpd_configure_cb() local
478 dp_display_host_phy_init(dp); in dp_display_usbpd_configure_cb()
480 return dp_display_process_hpd_high(dp); in dp_display_usbpd_configure_cb()
490 struct dp_display_private *dp = dev_get_dp_display_private(dev); in dp_display_notify_disconnect() local
492 dp_add_event(dp, EV_USER_NOTIFICATION, false, 0); in dp_display_notify_disconnect()
497 static void dp_display_handle_video_request(struct dp_display_private *dp) in dp_display_handle_video_request() argument
499 if (dp->link->sink_request & DP_TEST_LINK_VIDEO_PATTERN) { in dp_display_handle_video_request()
500 dp->panel->video_test = true; in dp_display_handle_video_request()
501 dp_link_send_test_response(dp->link); in dp_display_handle_video_request()
505 static int dp_display_handle_port_ststus_changed(struct dp_display_private *dp) in dp_display_handle_port_ststus_changed() argument
509 if (dp_display_is_sink_count_zero(dp)) { in dp_display_handle_port_ststus_changed()
510 drm_dbg_dp(dp->drm_dev, "sink count is zero, nothing to do\n"); in dp_display_handle_port_ststus_changed()
511 if (dp->hpd_state != ST_DISCONNECTED) { in dp_display_handle_port_ststus_changed()
512 dp->hpd_state = ST_DISCONNECT_PENDING; in dp_display_handle_port_ststus_changed()
513 dp_add_event(dp, EV_USER_NOTIFICATION, false, 0); in dp_display_handle_port_ststus_changed()
516 if (dp->hpd_state == ST_DISCONNECTED) { in dp_display_handle_port_ststus_changed()
517 dp->hpd_state = ST_MAINLINK_READY; in dp_display_handle_port_ststus_changed()
518 rc = dp_display_process_hpd_high(dp); in dp_display_handle_port_ststus_changed()
520 dp->hpd_state = ST_DISCONNECTED; in dp_display_handle_port_ststus_changed()
527 static int dp_display_handle_irq_hpd(struct dp_display_private *dp) in dp_display_handle_irq_hpd() argument
529 u32 sink_request = dp->link->sink_request; in dp_display_handle_irq_hpd()
531 drm_dbg_dp(dp->drm_dev, "%d\n", sink_request); in dp_display_handle_irq_hpd()
532 if (dp->hpd_state == ST_DISCONNECTED) { in dp_display_handle_irq_hpd()
534 drm_dbg_dp(dp->drm_dev, "Disconnected sink_request: %d\n", in dp_display_handle_irq_hpd()
541 dp_ctrl_handle_sink_request(dp->ctrl); in dp_display_handle_irq_hpd()
544 dp_display_handle_video_request(dp); in dp_display_handle_irq_hpd()
553 struct dp_display_private *dp = dev_get_dp_display_private(dev); in dp_display_usbpd_attention_cb() local
556 rc = dp_link_process_request(dp->link); in dp_display_usbpd_attention_cb()
558 sink_request = dp->link->sink_request; in dp_display_usbpd_attention_cb()
559 drm_dbg_dp(dp->drm_dev, "hpd_state=%d sink_request=%d\n", in dp_display_usbpd_attention_cb()
560 dp->hpd_state, sink_request); in dp_display_usbpd_attention_cb()
562 rc = dp_display_handle_port_ststus_changed(dp); in dp_display_usbpd_attention_cb()
564 rc = dp_display_handle_irq_hpd(dp); in dp_display_usbpd_attention_cb()
570 static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data) in dp_hpd_plug_handle() argument
572 struct dp_usbpd *hpd = dp->usbpd; in dp_hpd_plug_handle()
579 mutex_lock(&dp->event_mutex); in dp_hpd_plug_handle()
581 state = dp->hpd_state; in dp_hpd_plug_handle()
582 drm_dbg_dp(dp->drm_dev, "Before, type=%d hpd_state=%d\n", in dp_hpd_plug_handle()
583 dp->dp_display.connector_type, state); in dp_hpd_plug_handle()
586 mutex_unlock(&dp->event_mutex); in dp_hpd_plug_handle()
591 mutex_unlock(&dp->event_mutex); in dp_hpd_plug_handle()
597 dp_add_event(dp, EV_HPD_PLUG_INT, 0, 1); /* delay = 1 */ in dp_hpd_plug_handle()
598 mutex_unlock(&dp->event_mutex); in dp_hpd_plug_handle()
602 ret = dp_display_usbpd_configure_cb(&dp->pdev->dev); in dp_hpd_plug_handle()
604 dp->hpd_state = ST_DISCONNECTED; in dp_hpd_plug_handle()
606 dp->hpd_state = ST_MAINLINK_READY; in dp_hpd_plug_handle()
610 dp_catalog_hpd_config_intr(dp->catalog, in dp_hpd_plug_handle()
613 drm_dbg_dp(dp->drm_dev, "After, type=%d hpd_state=%d\n", in dp_hpd_plug_handle()
614 dp->dp_display.connector_type, state); in dp_hpd_plug_handle()
615 mutex_unlock(&dp->event_mutex); in dp_hpd_plug_handle()
624 struct dp_display_private *dp; in dp_display_handle_plugged_change() local
626 dp = container_of(dp_display, in dp_display_handle_plugged_change()
631 dp->audio_supported) in dp_display_handle_plugged_change()
635 static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data) in dp_hpd_unplug_handle() argument
637 struct dp_usbpd *hpd = dp->usbpd; in dp_hpd_unplug_handle()
643 mutex_lock(&dp->event_mutex); in dp_hpd_unplug_handle()
645 state = dp->hpd_state; in dp_hpd_unplug_handle()
647 drm_dbg_dp(dp->drm_dev, "Before, type=%d hpd_state=%d\n", in dp_hpd_unplug_handle()
648 dp->dp_display.connector_type, state); in dp_hpd_unplug_handle()
651 dp_catalog_hpd_config_intr(dp->catalog, in dp_hpd_unplug_handle()
655 dp_del_event(dp, EV_IRQ_HPD_INT); in dp_hpd_unplug_handle()
659 if (dp->link->sink_count == 0) { in dp_hpd_unplug_handle()
660 dp_display_host_phy_exit(dp); in dp_hpd_unplug_handle()
662 dp_display_notify_disconnect(&dp->pdev->dev); in dp_hpd_unplug_handle()
663 mutex_unlock(&dp->event_mutex); in dp_hpd_unplug_handle()
666 mutex_unlock(&dp->event_mutex); in dp_hpd_unplug_handle()
669 dp_ctrl_off_link(dp->ctrl); in dp_hpd_unplug_handle()
670 dp_display_host_phy_exit(dp); in dp_hpd_unplug_handle()
671 dp->hpd_state = ST_DISCONNECTED; in dp_hpd_unplug_handle()
672 dp_display_notify_disconnect(&dp->pdev->dev); in dp_hpd_unplug_handle()
673 mutex_unlock(&dp->event_mutex); in dp_hpd_unplug_handle()
678 dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_PLUG_INT_MASK, false); in dp_hpd_unplug_handle()
684 dp_display_notify_disconnect(&dp->pdev->dev); in dp_hpd_unplug_handle()
687 dp->hpd_state = ST_DISCONNECTED; in dp_hpd_unplug_handle()
689 dp->hpd_state = ST_DISCONNECT_PENDING; in dp_hpd_unplug_handle()
693 dp_display_handle_plugged_change(&dp->dp_display, false); in dp_hpd_unplug_handle()
696 if (!dp->dp_display.is_edp) in dp_hpd_unplug_handle()
697 dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_PLUG_INT_MASK, true); in dp_hpd_unplug_handle()
699 drm_dbg_dp(dp->drm_dev, "After, type=%d hpd_state=%d\n", in dp_hpd_unplug_handle()
700 dp->dp_display.connector_type, state); in dp_hpd_unplug_handle()
703 mutex_unlock(&dp->event_mutex); in dp_hpd_unplug_handle()
707 static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data) in dp_irq_hpd_handle() argument
711 mutex_lock(&dp->event_mutex); in dp_irq_hpd_handle()
714 state = dp->hpd_state; in dp_irq_hpd_handle()
715 drm_dbg_dp(dp->drm_dev, "Before, type=%d hpd_state=%d\n", in dp_irq_hpd_handle()
716 dp->dp_display.connector_type, state); in dp_irq_hpd_handle()
719 mutex_unlock(&dp->event_mutex); in dp_irq_hpd_handle()
725 dp_add_event(dp, EV_IRQ_HPD_INT, 0, 1); /* delay = 1 */ in dp_irq_hpd_handle()
726 mutex_unlock(&dp->event_mutex); in dp_irq_hpd_handle()
730 dp_display_usbpd_attention_cb(&dp->pdev->dev); in dp_irq_hpd_handle()
732 drm_dbg_dp(dp->drm_dev, "After, type=%d hpd_state=%d\n", in dp_irq_hpd_handle()
733 dp->dp_display.connector_type, state); in dp_irq_hpd_handle()
735 mutex_unlock(&dp->event_mutex); in dp_irq_hpd_handle()
740 static void dp_display_deinit_sub_modules(struct dp_display_private *dp) in dp_display_deinit_sub_modules() argument
742 dp_debug_put(dp->debug); in dp_display_deinit_sub_modules()
743 dp_audio_put(dp->audio); in dp_display_deinit_sub_modules()
744 dp_panel_put(dp->panel); in dp_display_deinit_sub_modules()
745 dp_aux_put(dp->aux); in dp_display_deinit_sub_modules()
748 static int dp_init_sub_modules(struct dp_display_private *dp) in dp_init_sub_modules() argument
751 struct device *dev = &dp->pdev->dev; in dp_init_sub_modules()
752 struct dp_usbpd_cb *cb = &dp->usbpd_cb; in dp_init_sub_modules()
762 dp->usbpd = dp_hpd_get(dev, cb); in dp_init_sub_modules()
763 if (IS_ERR(dp->usbpd)) { in dp_init_sub_modules()
764 rc = PTR_ERR(dp->usbpd); in dp_init_sub_modules()
766 dp->usbpd = NULL; in dp_init_sub_modules()
770 dp->parser = dp_parser_get(dp->pdev); in dp_init_sub_modules()
771 if (IS_ERR(dp->parser)) { in dp_init_sub_modules()
772 rc = PTR_ERR(dp->parser); in dp_init_sub_modules()
774 dp->parser = NULL; in dp_init_sub_modules()
778 dp->catalog = dp_catalog_get(dev, &dp->parser->io); in dp_init_sub_modules()
779 if (IS_ERR(dp->catalog)) { in dp_init_sub_modules()
780 rc = PTR_ERR(dp->catalog); in dp_init_sub_modules()
782 dp->catalog = NULL; in dp_init_sub_modules()
786 dp->power = dp_power_get(dev, dp->parser); in dp_init_sub_modules()
787 if (IS_ERR(dp->power)) { in dp_init_sub_modules()
788 rc = PTR_ERR(dp->power); in dp_init_sub_modules()
790 dp->power = NULL; in dp_init_sub_modules()
794 dp->aux = dp_aux_get(dev, dp->catalog, dp->dp_display.is_edp); in dp_init_sub_modules()
795 if (IS_ERR(dp->aux)) { in dp_init_sub_modules()
796 rc = PTR_ERR(dp->aux); in dp_init_sub_modules()
798 dp->aux = NULL; in dp_init_sub_modules()
802 dp->link = dp_link_get(dev, dp->aux); in dp_init_sub_modules()
803 if (IS_ERR(dp->link)) { in dp_init_sub_modules()
804 rc = PTR_ERR(dp->link); in dp_init_sub_modules()
806 dp->link = NULL; in dp_init_sub_modules()
810 panel_in.aux = dp->aux; in dp_init_sub_modules()
811 panel_in.catalog = dp->catalog; in dp_init_sub_modules()
812 panel_in.link = dp->link; in dp_init_sub_modules()
814 dp->panel = dp_panel_get(&panel_in); in dp_init_sub_modules()
815 if (IS_ERR(dp->panel)) { in dp_init_sub_modules()
816 rc = PTR_ERR(dp->panel); in dp_init_sub_modules()
818 dp->panel = NULL; in dp_init_sub_modules()
822 dp->ctrl = dp_ctrl_get(dev, dp->link, dp->panel, dp->aux, in dp_init_sub_modules()
823 dp->power, dp->catalog, dp->parser); in dp_init_sub_modules()
824 if (IS_ERR(dp->ctrl)) { in dp_init_sub_modules()
825 rc = PTR_ERR(dp->ctrl); in dp_init_sub_modules()
827 dp->ctrl = NULL; in dp_init_sub_modules()
831 dp->audio = dp_audio_get(dp->pdev, dp->panel, dp->catalog); in dp_init_sub_modules()
832 if (IS_ERR(dp->audio)) { in dp_init_sub_modules()
833 rc = PTR_ERR(dp->audio); in dp_init_sub_modules()
835 dp->audio = NULL; in dp_init_sub_modules()
840 dp->ctrl->wide_bus_en = dp->wide_bus_en; in dp_init_sub_modules()
841 dp->catalog->wide_bus_en = dp->wide_bus_en; in dp_init_sub_modules()
846 dp_panel_put(dp->panel); in dp_init_sub_modules()
848 dp_aux_put(dp->aux); in dp_init_sub_modules()
856 struct dp_display_private *dp; in dp_display_set_mode() local
858 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_display_set_mode()
860 dp->panel->dp_mode.drm_mode = mode->drm_mode; in dp_display_set_mode()
861 dp->panel->dp_mode.bpp = mode->bpp; in dp_display_set_mode()
862 dp->panel->dp_mode.capabilities = mode->capabilities; in dp_display_set_mode()
863 dp_panel_init_panel_info(dp->panel); in dp_display_set_mode()
867 static int dp_display_enable(struct dp_display_private *dp, bool force_link_train) in dp_display_enable() argument
870 struct msm_dp *dp_display = &dp->dp_display; in dp_display_enable()
872 drm_dbg_dp(dp->drm_dev, "sink_count=%d\n", dp->link->sink_count); in dp_display_enable()
874 drm_dbg_dp(dp->drm_dev, "Link already setup, return\n"); in dp_display_enable()
878 rc = dp_ctrl_on_stream(dp->ctrl, force_link_train); in dp_display_enable()
887 struct dp_display_private *dp; in dp_display_post_enable() local
890 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_display_post_enable()
892 rate = dp->link->link_params.rate; in dp_display_post_enable()
894 if (dp->audio_supported) { in dp_display_post_enable()
895 dp->audio->bw_code = drm_dp_link_rate_to_bw_code(rate); in dp_display_post_enable()
896 dp->audio->lane_count = dp->link->link_params.num_lanes; in dp_display_post_enable()
904 static int dp_display_disable(struct dp_display_private *dp) in dp_display_disable() argument
906 struct msm_dp *dp_display = &dp->dp_display; in dp_display_disable()
915 if (!wait_for_completion_timeout(&dp->audio_comp, in dp_display_disable()
922 if (dp->link->sink_count == 0) { in dp_display_disable()
927 dp_ctrl_off_link_stream(dp->ctrl); in dp_display_disable()
933 dp_ctrl_off(dp->ctrl); in dp_display_disable()
934 dp_display_host_phy_exit(dp); in dp_display_disable()
939 drm_dbg_dp(dp->drm_dev, "sink count: %d\n", dp->link->sink_count); in dp_display_disable()
971 struct msm_dp *dp; in dp_bridge_mode_valid() local
974 dp = to_dp_bridge(bridge)->dp_display; in dp_bridge_mode_valid()
976 if (!dp || !mode_pclk_khz || !dp->connector) { in dp_bridge_mode_valid()
986 if (dp->is_edp) in dp_bridge_mode_valid()
992 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_bridge_mode_valid()
995 mode_bpp = dp->connector->display_info.bpc * num_components; in dp_bridge_mode_valid()
1011 int dp_display_get_modes(struct msm_dp *dp) in dp_display_get_modes() argument
1015 if (!dp) { in dp_display_get_modes()
1020 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_display_get_modes()
1023 dp->connector); in dp_display_get_modes()
1026 bool dp_display_check_video_test(struct msm_dp *dp) in dp_display_check_video_test() argument
1030 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_display_check_video_test()
1035 int dp_display_get_test_bpp(struct msm_dp *dp) in dp_display_get_test_bpp() argument
1039 if (!dp) { in dp_display_get_test_bpp()
1044 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_display_get_test_bpp()
1050 void msm_dp_snapshot(struct msm_disp_state *disp_state, struct msm_dp *dp) in msm_dp_snapshot() argument
1054 dp_display = container_of(dp, struct dp_display_private, dp_display); in msm_dp_snapshot()
1058 * however till DP cable is connected this will not happen as we in msm_dp_snapshot()
1060 * power_on status before dumping DP registers to avoid crash due in msm_dp_snapshot()
1065 if (!dp->power_on) { in msm_dp_snapshot()
1075 static void dp_display_config_hpd(struct dp_display_private *dp) in dp_display_config_hpd() argument
1078 dp_display_host_init(dp); in dp_display_config_hpd()
1079 dp_catalog_ctrl_hpd_config(dp->catalog); in dp_display_config_hpd()
1082 if (!dp->dp_display.is_edp) in dp_display_config_hpd()
1083 dp_catalog_hpd_config_intr(dp->catalog, in dp_display_config_hpd()
1089 * we are leaving dp clocks on during disconnect in dp_display_config_hpd()
1092 enable_irq(dp->irq); in dp_display_config_hpd()
1194 struct dp_display_private *dp = dev_id; in dp_display_irq_handler() local
1198 if (!dp) { in dp_display_irq_handler()
1203 hpd_isr_status = dp_catalog_hpd_get_intr_status(dp->catalog); in dp_display_irq_handler()
1206 drm_dbg_dp(dp->drm_dev, "type=%d isr=0x%x\n", in dp_display_irq_handler()
1207 dp->dp_display.connector_type, hpd_isr_status); in dp_display_irq_handler()
1210 dp_add_event(dp, EV_HPD_PLUG_INT, 0, 0); in dp_display_irq_handler()
1213 dp_add_event(dp, EV_IRQ_HPD_INT, 0, 0); in dp_display_irq_handler()
1217 dp_add_event(dp, EV_HPD_UNPLUG_INT, 0, 0); in dp_display_irq_handler()
1218 dp_add_event(dp, EV_HPD_PLUG_INT, 0, 3); in dp_display_irq_handler()
1222 dp_add_event(dp, EV_HPD_UNPLUG_INT, 0, 0); in dp_display_irq_handler()
1225 /* DP controller isr */ in dp_display_irq_handler()
1226 dp_ctrl_isr(dp->ctrl); in dp_display_irq_handler()
1228 /* DP aux isr */ in dp_display_irq_handler()
1229 dp_aux_isr(dp->aux); in dp_display_irq_handler()
1237 struct dp_display_private *dp; in dp_display_request_irq() local
1244 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_display_request_irq()
1246 dp->irq = irq_of_parse_and_map(dp->pdev->dev.of_node, 0); in dp_display_request_irq()
1247 if (!dp->irq) { in dp_display_request_irq()
1252 rc = devm_request_irq(dp_display->drm_dev->dev, dp->irq, in dp_display_request_irq()
1254 IRQF_TRIGGER_HIGH, "dp_display_isr", dp); in dp_display_request_irq()
1257 dp->irq, rc); in dp_display_request_irq()
1260 disable_irq(dp->irq); in dp_display_request_irq()
1290 struct dp_display_private *dp; in dp_display_probe() local
1298 dp = devm_kzalloc(&pdev->dev, sizeof(*dp), GFP_KERNEL); in dp_display_probe()
1299 if (!dp) in dp_display_probe()
1302 desc = dp_display_get_desc(pdev, &dp->id); in dp_display_probe()
1306 dp->pdev = pdev; in dp_display_probe()
1307 dp->name = "drm_dp"; in dp_display_probe()
1308 dp->dp_display.connector_type = desc->connector_type; in dp_display_probe()
1309 dp->wide_bus_en = desc->wide_bus_en; in dp_display_probe()
1310 dp->dp_display.is_edp = in dp_display_probe()
1311 (dp->dp_display.connector_type == DRM_MODE_CONNECTOR_eDP); in dp_display_probe()
1313 rc = dp_init_sub_modules(dp); in dp_display_probe()
1320 mutex_init(&dp->event_mutex); in dp_display_probe()
1321 init_waitqueue_head(&dp->event_q); in dp_display_probe()
1322 spin_lock_init(&dp->event_lock); in dp_display_probe()
1324 /* Store DP audio handle inside DP display */ in dp_display_probe()
1325 dp->dp_display.dp_audio = dp->audio; in dp_display_probe()
1327 init_completion(&dp->audio_comp); in dp_display_probe()
1329 platform_set_drvdata(pdev, &dp->dp_display); in dp_display_probe()
1334 dp_display_deinit_sub_modules(dp); in dp_display_probe()
1342 struct dp_display_private *dp = dev_get_dp_display_private(&pdev->dev); in dp_display_remove() local
1344 dp_display_deinit_sub_modules(dp); in dp_display_remove()
1356 struct dp_display_private *dp; in dp_pm_resume() local
1359 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_pm_resume()
1361 mutex_lock(&dp->event_mutex); in dp_pm_resume()
1363 drm_dbg_dp(dp->drm_dev, in dp_pm_resume()
1365 dp->dp_display.connector_type, dp->core_initialized, in dp_pm_resume()
1366 dp->phy_initialized, dp_display->power_on); in dp_pm_resume()
1369 dp->hpd_state = ST_DISCONNECTED; in dp_pm_resume()
1371 /* turn on dp ctrl/phy */ in dp_pm_resume()
1372 dp_display_host_init(dp); in dp_pm_resume()
1374 dp_catalog_ctrl_hpd_config(dp->catalog); in dp_pm_resume()
1377 if (!dp->dp_display.is_edp) in dp_pm_resume()
1378 dp_catalog_hpd_config_intr(dp->catalog, in dp_pm_resume()
1383 if (dp_catalog_link_is_connected(dp->catalog)) { in dp_pm_resume()
1388 dp_display_host_phy_init(dp); in dp_pm_resume()
1389 dp_link_psm_config(dp->link, &dp->panel->link_info, false); in dp_pm_resume()
1390 sink_count = drm_dp_read_sink_count(dp->aux); in dp_pm_resume()
1394 dp_display_host_phy_exit(dp); in dp_pm_resume()
1397 dp->link->sink_count = sink_count; in dp_pm_resume()
1404 if (dp->link->sink_count) { in dp_pm_resume()
1405 dp->dp_display.is_connected = true; in dp_pm_resume()
1407 dp->dp_display.is_connected = false; in dp_pm_resume()
1411 drm_dbg_dp(dp->drm_dev, in dp_pm_resume()
1413 dp->dp_display.connector_type, dp->link->sink_count, in dp_pm_resume()
1414 dp->dp_display.is_connected, dp->core_initialized, in dp_pm_resume()
1415 dp->phy_initialized, dp_display->power_on); in dp_pm_resume()
1417 mutex_unlock(&dp->event_mutex); in dp_pm_resume()
1426 struct dp_display_private *dp; in dp_pm_suspend() local
1428 dp = container_of(dp_display, struct dp_display_private, dp_display); in dp_pm_suspend()
1430 mutex_lock(&dp->event_mutex); in dp_pm_suspend()
1432 drm_dbg_dp(dp->drm_dev, in dp_pm_suspend()
1434 dp->dp_display.connector_type, dp->core_initialized, in dp_pm_suspend()
1435 dp->phy_initialized, dp_display->power_on); in dp_pm_suspend()
1438 if (dp_power_clk_status(dp->power, DP_CTRL_PM)) in dp_pm_suspend()
1439 dp_ctrl_off_link_stream(dp->ctrl); in dp_pm_suspend()
1441 dp_display_host_phy_exit(dp); in dp_pm_suspend()
1444 dp_display_host_deinit(dp); in dp_pm_suspend()
1446 dp->hpd_state = ST_SUSPENDED; in dp_pm_suspend()
1448 drm_dbg_dp(dp->drm_dev, in dp_pm_suspend()
1450 dp->dp_display.connector_type, dp->core_initialized, in dp_pm_suspend()
1451 dp->phy_initialized, dp_display->power_on); in dp_pm_suspend()
1453 mutex_unlock(&dp->event_mutex); in dp_pm_suspend()
1467 .name = "msm-dp-display",
1480 DRM_ERROR("Dp display driver register failed"); in msm_dp_register()
1492 struct dp_display_private *dp; in msm_dp_irq_postinstall() local
1497 dp = container_of(dp_display, struct dp_display_private, dp_display); in msm_dp_irq_postinstall()
1500 dp_add_event(dp, EV_HPD_INIT_SETUP, 0, 100); in msm_dp_irq_postinstall()
1505 struct dp_display_private *dp; in msm_dp_wide_bus_available() local
1507 dp = container_of(dp_display, struct dp_display_private, dp_display); in msm_dp_wide_bus_available()
1509 return dp->wide_bus_en; in msm_dp_wide_bus_available()
1514 struct dp_display_private *dp; in msm_dp_debugfs_init() local
1518 dp = container_of(dp_display, struct dp_display_private, dp_display); in msm_dp_debugfs_init()
1519 dev = &dp->pdev->dev; in msm_dp_debugfs_init()
1521 dp->debug = dp_debug_get(dev, dp->panel, dp->usbpd, in msm_dp_debugfs_init()
1522 dp->link, dp->dp_display.connector, in msm_dp_debugfs_init()
1524 if (IS_ERR(dp->debug)) { in msm_dp_debugfs_init()
1525 rc = PTR_ERR(dp->debug); in msm_dp_debugfs_init()
1527 dp->debug = NULL; in msm_dp_debugfs_init()
1536 static int dp_display_get_next_bridge(struct msm_dp *dp) in dp_display_get_next_bridge() argument
1543 dp_priv = container_of(dp, struct dp_display_private, dp_display); in dp_display_get_next_bridge()
1547 if (aux_bus && dp->is_edp) { in dp_display_get_next_bridge()
1565 rc = devm_add_action_or_reset(dp->drm_dev->dev, in dp_display_get_next_bridge()
1570 } else if (dp->is_edp) { in dp_display_get_next_bridge()
1582 rc = devm_dp_parser_find_next_bridge(dp->drm_dev->dev, dp_priv->parser); in dp_display_get_next_bridge()
1583 if (!dp->is_edp && rc == -ENODEV) in dp_display_get_next_bridge()
1587 dp->next_bridge = dp_priv->parser->next_bridge; in dp_display_get_next_bridge()
1592 if (dp->is_edp) { in dp_display_get_next_bridge()
1635 "failed to create dp bridge: %d\n", ret); in msm_dp_modeset_init()
1646 "failed to create dp connector: %d\n", ret); in msm_dp_modeset_init()
1659 struct msm_dp *dp = dp_bridge->dp_display; in dp_bridge_enable() local
1665 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_bridge_enable()
1671 if (dp->is_edp) in dp_bridge_enable()
1682 rc = dp_display_set_mode(dp, &dp_display->dp_mode); in dp_bridge_enable()
1698 rc = dp_display_post_enable(dp); in dp_bridge_enable()
1700 DRM_ERROR("DP display post enable failed, rc=%d\n", rc); in dp_bridge_enable()
1707 drm_dbg_dp(dp->drm_dev, "type=%d Done\n", dp->connector_type); in dp_bridge_enable()
1714 struct msm_dp *dp = dp_bridge->dp_display; in dp_bridge_disable() local
1717 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_bridge_disable()
1725 struct msm_dp *dp = dp_bridge->dp_display; in dp_bridge_post_disable() local
1729 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_bridge_post_disable()
1731 if (dp->is_edp) in dp_bridge_post_disable()
1752 drm_dbg_dp(dp->drm_dev, "type=%d Done\n", dp->connector_type); in dp_bridge_post_disable()
1761 struct msm_dp *dp = dp_bridge->dp_display; in dp_bridge_mode_set() local
1764 dp_display = container_of(dp, struct dp_display_private, dp_display); in dp_bridge_mode_set()
1768 if (dp_display_check_video_test(dp)) in dp_bridge_mode_set()
1769 dp_display->dp_mode.bpp = dp_display_get_test_bpp(dp); in dp_bridge_mode_set()
1771 dp_display->dp_mode.bpp = dp->connector->display_info.bpc * 3; in dp_bridge_mode_set()