162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci===================== 462306a36Sopenharmony_ciIntel North Mux-Agent 562306a36Sopenharmony_ci===================== 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciIntroduction 862306a36Sopenharmony_ci============ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciNorth Mux-Agent is a function of the Intel PMC firmware that is supported on 1162306a36Sopenharmony_cimost Intel based platforms that have the PMC microcontroller. It's used for 1262306a36Sopenharmony_ciconfiguring the various USB Multiplexer/DeMultiplexers on the system. The 1362306a36Sopenharmony_ciplatforms that allow the mux-agent to be configured from the operating system 1462306a36Sopenharmony_cihave an ACPI device object (node) with HID "INTC105C" that represents it. 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ciThe North Mux-Agent (aka. Intel PMC Mux Control, or just mux-agent) driver 1762306a36Sopenharmony_cicommunicates with the PMC microcontroller by using the PMC IPC method 1862306a36Sopenharmony_ci(drivers/platform/x86/intel_scu_ipc.c). The driver registers with the USB Type-C 1962306a36Sopenharmony_ciMux Class which allows the USB Type-C Controller and Interface drivers to 2062306a36Sopenharmony_ciconfigure the cable plug orientation and mode (with Alternate Modes). The driver 2162306a36Sopenharmony_cialso registers with the USB Role Class in order to support both USB Host and 2262306a36Sopenharmony_ciDevice modes. The driver is located here: drivers/usb/typec/mux/intel_pmc_mux.c. 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ciPort nodes 2562306a36Sopenharmony_ci========== 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ciGeneral 2862306a36Sopenharmony_ci------- 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ciFor every USB Type-C connector under the mux-agent control on the system, there 3162306a36Sopenharmony_ciis a separate child node under the PMC mux-agent device node. Those nodes do not 3262306a36Sopenharmony_cirepresent the actual connectors, but instead the "channels" in the mux-agent 3362306a36Sopenharmony_cithat are associated with the connectors:: 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci Scope (_SB.PCI0.PMC.MUX) 3662306a36Sopenharmony_ci { 3762306a36Sopenharmony_ci Device (CH0) 3862306a36Sopenharmony_ci { 3962306a36Sopenharmony_ci Name (_ADR, 0) 4062306a36Sopenharmony_ci } 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci Device (CH1) 4362306a36Sopenharmony_ci { 4462306a36Sopenharmony_ci Name (_ADR, 1) 4562306a36Sopenharmony_ci } 4662306a36Sopenharmony_ci } 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci_PLD (Physical Location of Device) 4962306a36Sopenharmony_ci---------------------------------- 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ciThe optional _PLD object can be used with the port (the channel) nodes. If _PLD 5262306a36Sopenharmony_ciis supplied, it should match the connector node _PLD:: 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci Scope (_SB.PCI0.PMC.MUX) 5562306a36Sopenharmony_ci { 5662306a36Sopenharmony_ci Device (CH0) 5762306a36Sopenharmony_ci { 5862306a36Sopenharmony_ci Name (_ADR, 0) 5962306a36Sopenharmony_ci Method (_PLD, 0, NotSerialized) 6062306a36Sopenharmony_ci { 6162306a36Sopenharmony_ci /* Consider this as pseudocode. */ 6262306a36Sopenharmony_ci Return (\_SB.USBC.CON0._PLD()) 6362306a36Sopenharmony_ci } 6462306a36Sopenharmony_ci } 6562306a36Sopenharmony_ci } 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ciMux-agent specific _DSD Device Properties 6862306a36Sopenharmony_ci----------------------------------------- 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ciPort Numbers 7162306a36Sopenharmony_ci~~~~~~~~~~~~ 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ciIn order to configure the muxes behind a USB Type-C connector, the PMC firmware 7462306a36Sopenharmony_cineeds to know the USB2 port and the USB3 port that is associated with the 7562306a36Sopenharmony_ciconnector. The driver extracts the correct port numbers by reading specific _DSD 7662306a36Sopenharmony_cidevice properties named "usb2-port-number" and "usb3-port-number". These 7762306a36Sopenharmony_ciproperties have integer value that means the port index. The port index number 7862306a36Sopenharmony_ciis 1's based, and value 0 is illegal. The driver uses the numbers extracted from 7962306a36Sopenharmony_cithese device properties as-is when sending the mux-agent specific messages to 8062306a36Sopenharmony_cithe PMC:: 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci Name (_DSD, Package () { 8362306a36Sopenharmony_ci ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 8462306a36Sopenharmony_ci Package() { 8562306a36Sopenharmony_ci Package () {"usb2-port-number", 6}, 8662306a36Sopenharmony_ci Package () {"usb3-port-number", 3}, 8762306a36Sopenharmony_ci }, 8862306a36Sopenharmony_ci }) 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ciOrientation 9162306a36Sopenharmony_ci~~~~~~~~~~~ 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ciDepending on the platform, the data and SBU lines coming from the connector may 9462306a36Sopenharmony_cibe "fixed" from the mux-agent's point of view, which means the mux-agent driver 9562306a36Sopenharmony_cishould not configure them according to the cable plug orientation. This can 9662306a36Sopenharmony_cihappen for example if a retimer on the platform handles the cable plug 9762306a36Sopenharmony_ciorientation. The driver uses a specific device properties "sbu-orientation" 9862306a36Sopenharmony_ci(SBU) and "hsl-orientation" (data) to know if those lines are "fixed", and to 9962306a36Sopenharmony_ciwhich orientation. The value that these properties have is a string value, and 10062306a36Sopenharmony_ciit can be one that is defined for the USB Type-C connector orientation: "normal" 10162306a36Sopenharmony_cior "reversed":: 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci Name (_DSD, Package () { 10462306a36Sopenharmony_ci ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 10562306a36Sopenharmony_ci Package() { 10662306a36Sopenharmony_ci Package () {"sbu-orientation", "normal"}, 10762306a36Sopenharmony_ci Package () {"hsl-orientation", "normal"}, 10862306a36Sopenharmony_ci }, 10962306a36Sopenharmony_ci }) 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ciExample ASL 11262306a36Sopenharmony_ci=========== 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ciThe following ASL is an example that shows the mux-agent node, and two 11562306a36Sopenharmony_ciconnectors under its control:: 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci Scope (_SB.PCI0.PMC) 11862306a36Sopenharmony_ci { 11962306a36Sopenharmony_ci Device (MUX) 12062306a36Sopenharmony_ci { 12162306a36Sopenharmony_ci Name (_HID, "INTC105C") 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci Device (CH0) 12462306a36Sopenharmony_ci { 12562306a36Sopenharmony_ci Name (_ADR, 0) 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci Name (_DSD, Package () { 12862306a36Sopenharmony_ci ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 12962306a36Sopenharmony_ci Package() { 13062306a36Sopenharmony_ci Package () {"usb2-port-number", 6}, 13162306a36Sopenharmony_ci Package () {"usb3-port-number", 3}, 13262306a36Sopenharmony_ci Package () {"sbu-orientation", "normal"}, 13362306a36Sopenharmony_ci Package () {"hsl-orientation", "normal"}, 13462306a36Sopenharmony_ci }, 13562306a36Sopenharmony_ci }) 13662306a36Sopenharmony_ci } 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci Device (CH1) 13962306a36Sopenharmony_ci { 14062306a36Sopenharmony_ci Name (_ADR, 1) 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ci Name (_DSD, Package () { 14362306a36Sopenharmony_ci ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 14462306a36Sopenharmony_ci Package() { 14562306a36Sopenharmony_ci Package () {"usb2-port-number", 5}, 14662306a36Sopenharmony_ci Package () {"usb3-port-number", 2}, 14762306a36Sopenharmony_ci Package () {"sbu-orientation", "normal"}, 14862306a36Sopenharmony_ci Package () {"hsl-orientation", "normal"}, 14962306a36Sopenharmony_ci }, 15062306a36Sopenharmony_ci }) 15162306a36Sopenharmony_ci } 15262306a36Sopenharmony_ci } 15362306a36Sopenharmony_ci } 154