]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: typec: ucsi: Update power_supply on power role change
authorMyrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
Mon, 21 Jul 2025 06:32:51 +0000 (13:32 +0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Jul 2025 14:33:23 +0000 (16:33 +0200)
The current power direction of an USB-C port also influences the
power_supply's online status, so a power role change should also update
the power_supply.

Fixes an issue on some systems where plugging in a normal USB device in
for the first time after a reboot will cause upower to erroneously
consider the system to be connected to AC power.

Cc: stable <stable@kernel.org>
Fixes: 0e6371fbfba3 ("usb: typec: ucsi: Report power supply changes")
Signed-off-by: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20250721-fix-ucsi-pwr-dir-notify-v1-1-e53d5340cb38@qtmlabs.xyz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/ucsi/ucsi.c

index e913d099f934c7728cb678fc8e21e75ab0a00cce..5739ea2abdd1a7c3b09d8f79c0dac43c75eb6837 100644 (file)
@@ -1245,6 +1245,7 @@ static void ucsi_handle_connector_change(struct work_struct *work)
 
        if (change & UCSI_CONSTAT_POWER_DIR_CHANGE) {
                typec_set_pwr_role(con->port, role);
+               ucsi_port_psy_changed(con);
 
                /* Complete pending power role swap */
                if (!completion_done(&con->complete))