STRUCT UCSI_OPERATIONS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct ucsi_operations(9) πŸ’…

okay bestie, welcome to the Kernel API Manual page for struct ucsi_operations β€” UCSI I/O operations, aka the whole little vibe committee of function pointers that a UCSI driver has to fill in πŸŽ€


✨ SYNOPSIS ✨

like, here's the whole struct, exactly as it is, no cap:

struct ucsi_operations {
    int (*read_version)(struct ucsi *ucsi, u16 *version);
    int (*read_cci)(struct ucsi *ucsi, u32 *cci);
    int (*poll_cci)(struct ucsi *ucsi, u32 *cci);
    int (*read_message_in)(struct ucsi *ucsi, void *val, size_t
val_len);
    int (*write_message_out)(struct ucsi *ucsi, void *data, size_t
data_len);
    int (*sync_control)(struct ucsi *ucsi, u64 command, u32 *cci, void
*data, size_t size, void *msg_out, size_t msg_out_size);
    int (*async_control)(struct ucsi *ucsi, u64 command);
    bool (*update_altmodes)(struct ucsi *ucsi, u8 recipient, struct
ucsi_altmode *orig, struct ucsi_altmode *updated);
    void (*update_connector)(struct ucsi_connector *con);
    void (*connector_status)(struct ucsi_connector *con);
    void (*add_partner_altmodes)(struct ucsi_connector *con);
    void (*remove_partner_altmodes)(struct ucsi_connector *con);
 };

she's giving very much "fill in the blanks but make it USB-C" energy πŸ¦‹


🌸 MEMBERS 🌸

each one of these is a member, and yes we're going through all of them, periodt:

  • read_version β€” reads the implemented UCSI version ✨
  • read_cci β€” reads the CCI register πŸ‘‘
  • poll_cci β€” reads the CCI register while polling with notifications disabled πŸ’«
  • read_message_in β€” reads message data from UCSI πŸŽ€
  • write_message_out β€” writes message data to UCSI πŸ–ŠοΈ
  • sync_control β€” a blocking control operation, like it will literally sit there and wait πŸ™ˆ
  • async_control β€” a non-blocking control operation, main character energy, no waiting around πŸ’…
  • update_altmodes β€” squashes duplicate DP altmodes 🫢
  • update_connector β€” updates connector capabilities before registering 🌈
  • connector_status β€” updates connector status, and it's called holding the connector lock πŸ”’
  • add_partner_altmodes β€” starts mode selection ⭐
  • remove_partner_altmodes β€” cleans up mode selection 🧚

πŸ’– DESCRIPTION πŸ’–

so these are the read and write routines for the UCSI interface β€” the little I/O plumbing crew πŸ“

bestie, listen, this part is important: sync_write must wait for the Command Completion Event from the PPM before returning, and async_write must return immediately after sending the data to the PPM. no cap, that's the rule 😀

πŸ”₯ SEE ALSO πŸ”₯


that's the whole page, you ate that πŸ’…βœ¨ go forth and implement your ops, iykyk πŸ¦‹

signing off from ./drivers/usb/typec/ucsi β€” date on the tin says October 2026, so yeah, future vibes only πŸ‘‘

πŸ“¦ where this page comes from