More Related Content



  1. Type C plugs and USB 3.1 Oliver Neukum Senior Software Engineer SUSE
  2. Type C connector
  3. 3 Purpose of the Connector • Versatile • Flat • Durable • Fast • Powerful • Nondirectional →The plan is to create a universal connector Ash nazg durbatulûk, ash nazg gimbatul, Ash nazg thrakatulûk agh burzum-ishi krimpatul. Sauron
  4. 4 Functionality of the Connector • Features ‒ Provide faster USB ‒ Provide Alternate Modes ‒ Needs full USB PD ‒ But no features of USB PD ‒ Let Accessories operate over the cable ‒ Use the connector for power supply • Technologies ‒ Type C itself ‒ USB (3.1) ‒ USB PD Simple doesn't mean stupid. Thinking that it does, does. Paul Krugman
  5. 5 Composition of the connector • 3.x wires – 4 of them ‒ Can do 3.0 and 3.1 ‒ Symmetrical and electrically switched ‒ Alternate modes are run over these wires • 2.x wires - Fallback for alternate modes • Sideband wires – accessories and auxillary use • Diverse power wires ‒ Higher and lower voltages ‒ Supply for cable and device separated • The cable becomes an active component
  6. 6 Switching Modes and Roles • All switching is optional ‒ Switching Roles ‒ The cables are symmetric ‒ Roles still exist ‒ Master and Slave can change roles on either side's initiative ‒ Ports can express preferences ‒ Switching Modes ‒ Switching Power Supply • Role, Mode and Power switch independently • USB 2.0 is mandatory minimum ‒ Connectors must support it ‒ Cables need not Plucked her eyebrows on the way Shaved her legs and then he was a she Lou Reed – Walk on the Wild Side
  7. 7 Switching Modes and Roles • All switching is optional ‒ Switching Roles ‒ Switching Modes ‒ The slave advertises its supported modes ‒ The master selects the mode ‒ The master must check the cable's capability ‒ In case of adapter cables, the cable operates as slave ‒ Switching Power Supply • Role, Mode and Power switch independently A girl is not ready to become no one. But she is ready to become someone else. Jaqen H'ghar
  8. 8 Switching Modes and Roles • All switching is optional ‒ Switching Roles ‒ Switching Modes ‒ Switching Power Supply ‒ Power sources and sinks switch ‒ Supply of the cable and devices is independent ‒ A power brick can be connected to a hub's downstream • Role, Mode and Power Delivery switch independently We will make electricity so cheap that only the rich will burn candles. Thomas A. Edison
  9. USB 3.1 Citius, Altius, Fortius Pierre de Coubertin
  10. 10 Features of USB 3.1 • Speed ‒ Raw bus speed doubled ‒ Higher maximum isochronous bandwidth per stream • Better timing ‒ Delays can be measured more precisely ‒ Discoverable delays due to runtime PM • Symmetric ‒ Master and slave roles can be switched on the fly ‒ But still not combined ‒ Switching amounts to an unplug and replug ‒ Preferences can be expressed • Authentication
  11. USB Power Delivery The Spice must flow. A Master of the Guild
  12. 12 Features of Power Delivery • Not limited to USB ‒ Can be used for pure chargers without data traffic ‒ Also used in alternate modes • Defined for hubs ‒ But only for USB ‒ With bridges as exception to the limit ‒ In alternate modes it is point to point ‒ Hubs can operate in graded degrees of autonomy I'm a wild and untamed thing I'm a bee with a deadly sting Meatloaf
  13. 13 Communication in PD • PD is messages from peer to peer • On an independent channel • Response can be threefold ‒ Yes and no: obvious ‒ Later: That allows deferred decisions ‒ Policies set by user space ‒ Policies executed in kernel space • How much is done in hardware? Talker Listener Command Response Tight time limit → kernel space or hardware Understood Understood If a man says he will do something he will. There is no need to remind him about it every 6 months. unknown Action
  14. 14 Control function of PD • Power ‒ Advertising power needs and offerings ‒ Selecting voltages and power consumption ‒ Control of battery charging ‒ Control of base load and peak power • USB Data Role switching on the fly • Cryptographic Authentication • Firmware updates • Alternate Modes • Reset Handling • Cable capabilities
  15. 15 Power Budgeting • Both sides advertise power attributes ‒ Tuples of voltages, current and attributes ‒ Slaves say how much of the offer they take now and at most ‒ Slaves say how much they can relinquish immediately ‒ In case of a mismatch slaves take the default and complain • Masters must manage reserves • Contracts can be renegotiated on either side's request • Power can be reclaimed ‒ Renegotiation / Role switch ‒ USB suspend ‒ Suspension of battery charging The power to destroy a thing is the absolute control over it. Paul Muad'dib
  16. Alternate Modes πάντα εῥ ῖ ράκλειτος φέσιοςἩ ὁ Ἐ
  17. 17 Alternate Modes • Running alternatives protocols over type C ‒ DP, Thunderbolt, MHL, PCI ... ‒ Always additions to USB ‒ But the cables need not do USB: type C ↔ HDMI is valid • Can be seen as a virtual bus ‒ A bus without IO ‒ With hotplug of multiple devices, cables can be shared ‒ With an interrupt line ‒ With shared error handling
  18. Control Доверяй, но проверяй Vladimir Il'ič Ul'janov
  19. 19 How to make a port do what we want • Port Controller Specification ‒ Works over i2c with defined registers and commands ‒ A controller for each port (TCPC) and a master (TCPM) ‒ Full control over all features • UCSI ‒ ACPI Black Box ‒ Reduced semantics ‒ No notifications • Home Brew ‒ Vendor specific registers on XHCI ‒ Totally different nastinesses
  20. Kernel support
  21. 21 Driver support – USB 3.1 • The general features are done (4.4, fixes ongoing) • Controllers ‒ XHCI is done (4.4) ‒ dwc3 is done (4.5) ‒ Other controllers are under way • Device drivers ‒ Storage (4.5) ‒ Other stuff (queued for 4.7) The work is basically completed. Testing and bug fixes are left.
  22. 22 Driver support – Type C connector • UCSI (ACPI) (4.6 – untested outside Intel) ‒ Requires ACPI support ‒ Switching data roles ‒ Selecting Alternate Modes • TCPM ‒ Not even started ‒ How to differentiate between PD and Alternate Modes To know a thing well, know it limits Frank Herbert – Chapterhouse: Dune
  23. 23 Power Delivery • The ugly part of the standard ‒ Quite low level ‒ Conceptually hard to place right • Must include support for hubs ‒ That argues for making it part of usb and emulating it in the root hub ‒ It is used for alternate modes arguing for treating it stand alone • Needs a user space component for policy ‒ Battery charging requires choice ‒ Among batteries ‒ Between the host and devices
  24. 24 Accessories • Sound – should be covered by ALSA • Debug – up in the air – not even plans and discussion
  25. User space support
  26. 26 Missing APIs to user space • Everything is missing or not yet in the kernel • Undecided questions ‒ How to split this up? Current thinking: ‒ Alternate Modes + Data roles (filled by UCSI) ‒ Power Control + Reset handling ‒ How to notify user space ‒ Masters: notifications for resets ‒ Slaves: notifications for resets and power events ‒ Alternate Modes ‒ Switches only as hotplug events? ‒ How to tell a controlled exit and an error condition apart ‒ Where are resets to go
  27. 27 Missing APIs to user space • Settled questions ‒ Available Modes and Roles to be expressed in sysfs ‒ Attributes per port ‒ Alternate Modes as SVID entries in a directory ‒ Each Alternate Mode will need a kernel driver ‒ Split between kernel and user space is clear ‒ Timing constraints push the implementation into the kernel ‒ As block devices are involved PM must also be in kernel space ‒ Setting the preferred role needs a method without sysfs
  28. 28 Needed new components • Data roles ‒ GUIs needed for deviation from the default ‒ Distros need to do something sensible as slaves • Alternate Modes ‒ Support for the Billboard Class is needed ‒ A database is needed ‒ Graphics is involved ‒ Support to determine bandwith would be good ‒ Support for PM would be good • PM as a sink must be implemented
  29. 29 PD components • Power needs to be distributed and rationed ‒ A demon for reacting to power events is needed ‒ A way to implement a system policy on power priorities is needed • Runtime PM needs to call down into USB PD ‒ Reduce voltages in sleep states ‒ Kernel or user space or both • Dependencies between PD and the block layer ‒ Runtime PM must partially be in kernel space ‒ Peak load management cannot call out to user space • Booting - what has the firmware done
  30. 30 User Space Power Management IO User Space Kernel Space Disk Driver More power needed Power Budgeter Request to power down something Power Management Daemon Needs memory More IO → User Space runtime Power Management will deadlock. It is a principal issue of virtual memory and cannot be avoided.
  31. 31 Workable Power Management IO User Space Kernel Space Disk Driver More power needed Power Regulator Power Policy Daemon Power Policy Power Driver Implementation Of Policy Power Events
  32. Questions? Let's go already! Bender