[Bug 210425] Plugging in or unplugging power cord while system is suspended does not trigger updates

From
<hidden>
Date
2021-10-24 12:10:01
https://bugzilla.kernel.org/show_bug.cgi?id=210425

Méven Car (meven29@gmail.com) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |meven29@gmail.com
--- Comment #5 from Méven Car (meven29@gmail.com) ---
It seems to me `ucsi_resume()` should take into account that connectors can be
plugged-in/out while the system is suspended.

Upon wake-up it should someway scan its connectors and notify userspace then.

Instead resume only hook the notification after the fact and does not check
current state. 
int ucsi_resume(struct ucsi *ucsi)
{
      u64 command;

      /* Restore UCSI notification enable mask after system resume */
      command = UCSI_SET_NOTIFICATION_ENABLE | ucsi->ntfy;

      return ucsi_send_command(ucsi, command, NULL, 0);
}
Consequently after suspending, unplugging AC and resuming
cat /sys/class/power_supply/ucsi-source-psy-USBC000\:001/online
1
Regardless of the connector state (re-plugging is not signaled either).
We don't get any `udevadm monitor` notification from the usci subsystem.

AFAICT We should have a call to
"power_supply_changed(usci->connector[i]->psy);" somewhere for the usci
connector concerned resulting from `ucsi_resume` after the connector state has
been updated with `ucsi_handle_connector_change()` for instance. But I don't
know about the work_struct API. 
Either this or a bug in `ucsi_handle_connector_change()` not taking into
account the unplugged-during-suspend usecase. 

I would welcome any code hint to come up with a proper patch or a patch that I
would be happy to test.

My hardware is a DELL XPS 9370.

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
Thread (1 message) 1 message, 1 author, last reply 2021-10-24
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help