2828#include "dp_audio.h"
2929#include "dp_debug.h"
3030
31+ static bool psr_enabled = false;
32+ module_param (psr_enabled , bool , 0 );
33+ MODULE_PARM_DESC (psr_enabled , "enable PSR for eDP and DP displays" );
34+
3135#define HPD_STRING_SIZE 30
3236
3337enum {
@@ -407,7 +411,7 @@ static int dp_display_process_hpd_high(struct dp_display_private *dp)
407411
408412 edid = dp -> panel -> edid ;
409413
410- dp -> dp_display .psr_supported = dp -> panel -> psr_cap .version ;
414+ dp -> dp_display .psr_supported = dp -> panel -> psr_cap .version && psr_enabled ;
411415
412416 dp -> audio_supported = drm_detect_monitor_audio (edid );
413417 dp_panel_handle_sink_request (dp -> panel );
@@ -616,12 +620,6 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data)
616620 dp -> hpd_state = ST_MAINLINK_READY ;
617621 }
618622
619- /* enable HDP irq_hpd/replug interrupt */
620- if (dp -> dp_display .internal_hpd )
621- dp_catalog_hpd_config_intr (dp -> catalog ,
622- DP_DP_IRQ_HPD_INT_MASK | DP_DP_HPD_REPLUG_INT_MASK ,
623- true);
624-
625623 drm_dbg_dp (dp -> drm_dev , "After, type=%d hpd_state=%d\n" ,
626624 dp -> dp_display .connector_type , state );
627625 mutex_unlock (& dp -> event_mutex );
@@ -659,12 +657,6 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)
659657 drm_dbg_dp (dp -> drm_dev , "Before, type=%d hpd_state=%d\n" ,
660658 dp -> dp_display .connector_type , state );
661659
662- /* disable irq_hpd/replug interrupts */
663- if (dp -> dp_display .internal_hpd )
664- dp_catalog_hpd_config_intr (dp -> catalog ,
665- DP_DP_IRQ_HPD_INT_MASK | DP_DP_HPD_REPLUG_INT_MASK ,
666- false);
667-
668660 /* unplugged, no more irq_hpd handle */
669661 dp_del_event (dp , EV_IRQ_HPD_INT );
670662
@@ -688,10 +680,6 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)
688680 return 0 ;
689681 }
690682
691- /* disable HPD plug interrupts */
692- if (dp -> dp_display .internal_hpd )
693- dp_catalog_hpd_config_intr (dp -> catalog , DP_DP_HPD_PLUG_INT_MASK , false);
694-
695683 /*
696684 * We don't need separate work for disconnect as
697685 * connect/attention interrupts are disabled
@@ -707,10 +695,6 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)
707695 /* signal the disconnect event early to ensure proper teardown */
708696 dp_display_handle_plugged_change (& dp -> dp_display , false);
709697
710- /* enable HDP plug interrupt to prepare for next plugin */
711- if (dp -> dp_display .internal_hpd )
712- dp_catalog_hpd_config_intr (dp -> catalog , DP_DP_HPD_PLUG_INT_MASK , true);
713-
714698 drm_dbg_dp (dp -> drm_dev , "After, type=%d hpd_state=%d\n" ,
715699 dp -> dp_display .connector_type , state );
716700
@@ -1083,26 +1067,6 @@ void msm_dp_snapshot(struct msm_disp_state *disp_state, struct msm_dp *dp)
10831067 mutex_unlock (& dp_display -> event_mutex );
10841068}
10851069
1086- static void dp_display_config_hpd (struct dp_display_private * dp )
1087- {
1088-
1089- dp_display_host_init (dp );
1090- dp_catalog_ctrl_hpd_config (dp -> catalog );
1091-
1092- /* Enable plug and unplug interrupts only if requested */
1093- if (dp -> dp_display .internal_hpd )
1094- dp_catalog_hpd_config_intr (dp -> catalog ,
1095- DP_DP_HPD_PLUG_INT_MASK |
1096- DP_DP_HPD_UNPLUG_INT_MASK ,
1097- true);
1098-
1099- /* Enable interrupt first time
1100- * we are leaving dp clocks on during disconnect
1101- * and never disable interrupt
1102- */
1103- enable_irq (dp -> irq );
1104- }
1105-
11061070void dp_display_set_psr (struct msm_dp * dp_display , bool enter )
11071071{
11081072 struct dp_display_private * dp ;
@@ -1177,7 +1141,7 @@ static int hpd_event_thread(void *data)
11771141
11781142 switch (todo -> event_id ) {
11791143 case EV_HPD_INIT_SETUP :
1180- dp_display_config_hpd (dp_priv );
1144+ dp_display_host_init (dp_priv );
11811145 break ;
11821146 case EV_HPD_PLUG_INT :
11831147 dp_hpd_plug_handle (dp_priv , todo -> data );
@@ -1283,7 +1247,6 @@ int dp_display_request_irq(struct msm_dp *dp_display)
12831247 dp -> irq , rc );
12841248 return rc ;
12851249 }
1286- disable_irq (dp -> irq );
12871250
12881251 return 0 ;
12891252}
@@ -1395,13 +1358,8 @@ static int dp_pm_resume(struct device *dev)
13951358 /* turn on dp ctrl/phy */
13961359 dp_display_host_init (dp );
13971360
1398- dp_catalog_ctrl_hpd_config (dp -> catalog );
1399-
1400- if (dp -> dp_display .internal_hpd )
1401- dp_catalog_hpd_config_intr (dp -> catalog ,
1402- DP_DP_HPD_PLUG_INT_MASK |
1403- DP_DP_HPD_UNPLUG_INT_MASK ,
1404- true);
1361+ if (dp_display -> is_edp )
1362+ dp_catalog_ctrl_hpd_enable (dp -> catalog );
14051363
14061364 if (dp_catalog_link_is_connected (dp -> catalog )) {
14071365 /*
@@ -1569,9 +1527,8 @@ static int dp_display_get_next_bridge(struct msm_dp *dp)
15691527
15701528 if (aux_bus && dp -> is_edp ) {
15711529 dp_display_host_init (dp_priv );
1572- dp_catalog_ctrl_hpd_config (dp_priv -> catalog );
1530+ dp_catalog_ctrl_hpd_enable (dp_priv -> catalog );
15731531 dp_display_host_phy_init (dp_priv );
1574- enable_irq (dp_priv -> irq );
15751532
15761533 /*
15771534 * The code below assumes that the panel will finish probing
@@ -1613,7 +1570,6 @@ static int dp_display_get_next_bridge(struct msm_dp *dp)
16131570
16141571error :
16151572 if (dp -> is_edp ) {
1616- disable_irq (dp_priv -> irq );
16171573 dp_display_host_phy_exit (dp_priv );
16181574 dp_display_host_deinit (dp_priv );
16191575 }
@@ -1802,16 +1758,31 @@ void dp_bridge_hpd_enable(struct drm_bridge *bridge)
18021758{
18031759 struct msm_dp_bridge * dp_bridge = to_dp_bridge (bridge );
18041760 struct msm_dp * dp_display = dp_bridge -> dp_display ;
1761+ struct dp_display_private * dp = container_of (dp_display , struct dp_display_private , dp_display );
1762+
1763+ mutex_lock (& dp -> event_mutex );
1764+ dp_catalog_ctrl_hpd_enable (dp -> catalog );
1765+
1766+ /* enable HDP interrupts */
1767+ dp_catalog_hpd_config_intr (dp -> catalog , DP_DP_HPD_INT_MASK , true);
18051768
18061769 dp_display -> internal_hpd = true;
1770+ mutex_unlock (& dp -> event_mutex );
18071771}
18081772
18091773void dp_bridge_hpd_disable (struct drm_bridge * bridge )
18101774{
18111775 struct msm_dp_bridge * dp_bridge = to_dp_bridge (bridge );
18121776 struct msm_dp * dp_display = dp_bridge -> dp_display ;
1777+ struct dp_display_private * dp = container_of (dp_display , struct dp_display_private , dp_display );
1778+
1779+ mutex_lock (& dp -> event_mutex );
1780+ /* disable HDP interrupts */
1781+ dp_catalog_hpd_config_intr (dp -> catalog , DP_DP_HPD_INT_MASK , false);
1782+ dp_catalog_ctrl_hpd_disable (dp -> catalog );
18131783
18141784 dp_display -> internal_hpd = false;
1785+ mutex_unlock (& dp -> event_mutex );
18151786}
18161787
18171788void dp_bridge_hpd_notify (struct drm_bridge * bridge ,
0 commit comments