Skip to content

Commit 86629e0

Browse files
Badhri Jagan Sridharangregkh
authored andcommitted
usb: typec: tcpm: Invoke power_supply_changed for tcpm-source-psy-
tcpm-source-psy- does not invoke power_supply_changed API when one of the published power supply properties is changed. power_supply_changed needs to be called to notify userspace clients(uevents) and kernel clients. Fixes: f2a8aa0 ("typec: tcpm: Represent source supply through power_supply") Reviewed-by: Guenter Roeck <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Signed-off-by: Badhri Jagan Sridharan <[email protected]> Cc: stable <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3cac910 commit 86629e0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/usb/typec/tcpm/tcpm.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ static int tcpm_set_current_limit(struct tcpm_port *port, u32 max_ma, u32 mv)
942942

943943
port->supply_voltage = mv;
944944
port->current_limit = max_ma;
945+
power_supply_changed(port->psy);
945946

946947
if (port->tcpc->set_current_limit)
947948
ret = port->tcpc->set_current_limit(port->tcpc, max_ma, mv);
@@ -2928,6 +2929,7 @@ static int tcpm_pd_select_pdo(struct tcpm_port *port, int *sink_pdo,
29282929

29292930
port->pps_data.supported = false;
29302931
port->usb_type = POWER_SUPPLY_USB_TYPE_PD;
2932+
power_supply_changed(port->psy);
29312933

29322934
/*
29332935
* Select the source PDO providing the most power which has a
@@ -2952,6 +2954,7 @@ static int tcpm_pd_select_pdo(struct tcpm_port *port, int *sink_pdo,
29522954
port->pps_data.supported = true;
29532955
port->usb_type =
29542956
POWER_SUPPLY_USB_TYPE_PD_PPS;
2957+
power_supply_changed(port->psy);
29552958
}
29562959
continue;
29572960
default:
@@ -3109,6 +3112,7 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port)
31093112
port->pps_data.out_volt));
31103113
port->pps_data.op_curr = min(port->pps_data.max_curr,
31113114
port->pps_data.op_curr);
3115+
power_supply_changed(port->psy);
31123116
}
31133117

31143118
return src_pdo;
@@ -3344,6 +3348,7 @@ static int tcpm_set_charge(struct tcpm_port *port, bool charge)
33443348
return ret;
33453349
}
33463350
port->vbus_charge = charge;
3351+
power_supply_changed(port->psy);
33473352
return 0;
33483353
}
33493354

@@ -3523,6 +3528,7 @@ static void tcpm_reset_port(struct tcpm_port *port)
35233528
port->try_src_count = 0;
35243529
port->try_snk_count = 0;
35253530
port->usb_type = POWER_SUPPLY_USB_TYPE_C;
3531+
power_supply_changed(port->psy);
35263532
port->nr_sink_caps = 0;
35273533
port->sink_cap_done = false;
35283534
if (port->tcpc->enable_frs)
@@ -5905,7 +5911,7 @@ static int tcpm_psy_set_prop(struct power_supply *psy,
59055911
ret = -EINVAL;
59065912
break;
59075913
}
5908-
5914+
power_supply_changed(port->psy);
59095915
return ret;
59105916
}
59115917

@@ -6058,6 +6064,7 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
60586064
err = devm_tcpm_psy_register(port);
60596065
if (err)
60606066
goto out_role_sw_put;
6067+
power_supply_changed(port->psy);
60616068

60626069
port->typec_port = typec_register_port(port->dev, &port->typec_caps);
60636070
if (IS_ERR(port->typec_port)) {

0 commit comments

Comments
 (0)