@@ -202,6 +202,9 @@ void hdcp_update_display(struct hdcp_workqueue *hdcp_work,
202202 unsigned int conn_index = aconnector -> base .index ;
203203
204204 guard (mutex )(& hdcp_w -> mutex );
205+ drm_connector_get (& aconnector -> base );
206+ if (hdcp_w -> aconnector [conn_index ])
207+ drm_connector_put (& hdcp_w -> aconnector [conn_index ]-> base );
205208 hdcp_w -> aconnector [conn_index ] = aconnector ;
206209
207210 memset (& link_adjust , 0 , sizeof (link_adjust ));
@@ -249,7 +252,6 @@ static void hdcp_remove_display(struct hdcp_workqueue *hdcp_work,
249252 unsigned int conn_index = aconnector -> base .index ;
250253
251254 guard (mutex )(& hdcp_w -> mutex );
252- hdcp_w -> aconnector [conn_index ] = aconnector ;
253255
254256 /* the removal of display will invoke auth reset -> hdcp destroy and
255257 * we'd expect the Content Protection (CP) property changed back to
@@ -265,7 +267,10 @@ static void hdcp_remove_display(struct hdcp_workqueue *hdcp_work,
265267 }
266268
267269 mod_hdcp_remove_display (& hdcp_w -> hdcp , aconnector -> base .index , & hdcp_w -> output );
268-
270+ if (hdcp_w -> aconnector [conn_index ]) {
271+ drm_connector_put (& hdcp_w -> aconnector [conn_index ]-> base );
272+ hdcp_w -> aconnector [conn_index ] = NULL ;
273+ }
269274 process_output (hdcp_w );
270275}
271276
@@ -283,6 +288,10 @@ void hdcp_reset_display(struct hdcp_workqueue *hdcp_work, unsigned int link_inde
283288 for (conn_index = 0 ; conn_index < AMDGPU_DM_MAX_DISPLAY_INDEX ; conn_index ++ ) {
284289 hdcp_w -> encryption_status [conn_index ] =
285290 MOD_HDCP_ENCRYPTION_STATUS_HDCP_OFF ;
291+ if (hdcp_w -> aconnector [conn_index ]) {
292+ drm_connector_put (& hdcp_w -> aconnector [conn_index ]-> base );
293+ hdcp_w -> aconnector [conn_index ] = NULL ;
294+ }
286295 }
287296
288297 process_output (hdcp_w );
@@ -517,6 +526,7 @@ static void update_config(void *handle, struct cp_psp_stream_config *config)
517526 struct hdcp_workqueue * hdcp_work = handle ;
518527 struct amdgpu_dm_connector * aconnector = config -> dm_stream_ctx ;
519528 int link_index = aconnector -> dc_link -> link_index ;
529+ unsigned int conn_index = aconnector -> base .index ;
520530 struct mod_hdcp_display * display = & hdcp_work [link_index ].display ;
521531 struct mod_hdcp_link * link = & hdcp_work [link_index ].link ;
522532 struct hdcp_workqueue * hdcp_w = & hdcp_work [link_index ];
@@ -573,7 +583,10 @@ static void update_config(void *handle, struct cp_psp_stream_config *config)
573583 guard (mutex )(& hdcp_w -> mutex );
574584
575585 mod_hdcp_add_display (& hdcp_w -> hdcp , link , display , & hdcp_w -> output );
576-
586+ drm_connector_get (& aconnector -> base );
587+ if (hdcp_w -> aconnector [conn_index ])
588+ drm_connector_put (& hdcp_w -> aconnector [conn_index ]-> base );
589+ hdcp_w -> aconnector [conn_index ] = aconnector ;
577590 process_output (hdcp_w );
578591}
579592
0 commit comments