File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -238,4 +238,13 @@ void ucsi_unregister_port_psy(struct ucsi_connector *con)
238
238
return ;
239
239
240
240
power_supply_unregister (con -> psy );
241
+ con -> psy = NULL ;
242
+ }
243
+
244
+ void ucsi_port_psy_changed (struct ucsi_connector * con )
245
+ {
246
+ if (IS_ERR_OR_NULL (con -> psy ))
247
+ return ;
248
+
249
+ power_supply_changed (con -> psy );
241
250
}
Original file line number Diff line number Diff line change @@ -643,8 +643,10 @@ static void ucsi_handle_connector_change(struct work_struct *work)
643
643
role = !!(con -> status .flags & UCSI_CONSTAT_PWR_DIR );
644
644
645
645
if (con -> status .change & UCSI_CONSTAT_POWER_OPMODE_CHANGE ||
646
- con -> status .change & UCSI_CONSTAT_POWER_LEVEL_CHANGE )
646
+ con -> status .change & UCSI_CONSTAT_POWER_LEVEL_CHANGE ) {
647
647
ucsi_pwr_opmode_change (con );
648
+ ucsi_port_psy_changed (con );
649
+ }
648
650
649
651
if (con -> status .change & UCSI_CONSTAT_POWER_DIR_CHANGE ) {
650
652
typec_set_pwr_role (con -> port , role );
@@ -674,6 +676,8 @@ static void ucsi_handle_connector_change(struct work_struct *work)
674
676
ucsi_register_partner (con );
675
677
else
676
678
ucsi_unregister_partner (con );
679
+
680
+ ucsi_port_psy_changed (con );
677
681
}
678
682
679
683
if (con -> status .change & UCSI_CONSTAT_CAM_CHANGE ) {
@@ -994,6 +998,7 @@ static int ucsi_register_port(struct ucsi *ucsi, int index)
994
998
!!(con -> status .flags & UCSI_CONSTAT_PWR_DIR ));
995
999
ucsi_pwr_opmode_change (con );
996
1000
ucsi_register_partner (con );
1001
+ ucsi_port_psy_changed (con );
997
1002
}
998
1003
999
1004
if (con -> partner ) {
Original file line number Diff line number Diff line change @@ -340,9 +340,11 @@ int ucsi_resume(struct ucsi *ucsi);
340
340
#if IS_ENABLED (CONFIG_POWER_SUPPLY )
341
341
int ucsi_register_port_psy (struct ucsi_connector * con );
342
342
void ucsi_unregister_port_psy (struct ucsi_connector * con );
343
+ void ucsi_port_psy_changed (struct ucsi_connector * con );
343
344
#else
344
345
static inline int ucsi_register_port_psy (struct ucsi_connector * con ) { return 0 ; }
345
346
static inline void ucsi_unregister_port_psy (struct ucsi_connector * con ) { }
347
+ static inline void ucsi_port_psy_changed (struct ucsi_connector * con ) { }
346
348
#endif /* CONFIG_POWER_SUPPLY */
347
349
348
350
#if IS_ENABLED (CONFIG_TYPEC_DP_ALTMODE )
You can’t perform that action at this time.
0 commit comments