18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci===================== 48c2ecf20Sopenharmony_ciIntel North Mux-Agent 58c2ecf20Sopenharmony_ci===================== 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ciIntroduction 88c2ecf20Sopenharmony_ci============ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciNorth Mux-Agent is a function of the Intel PMC firmware that is supported on 118c2ecf20Sopenharmony_cimost Intel based platforms that have the PMC microcontroller. It's used for 128c2ecf20Sopenharmony_ciconfiguring the various USB Multiplexer/DeMultiplexers on the system. The 138c2ecf20Sopenharmony_ciplatforms that allow the mux-agent to be configured from the operating system 148c2ecf20Sopenharmony_cihave an ACPI device object (node) with HID "INTC105C" that represents it. 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciThe North Mux-Agent (aka. Intel PMC Mux Control, or just mux-agent) driver 178c2ecf20Sopenharmony_cicommunicates with the PMC microcontroller by using the PMC IPC method 188c2ecf20Sopenharmony_ci(drivers/platform/x86/intel_scu_ipc.c). The driver registers with the USB Type-C 198c2ecf20Sopenharmony_ciMux Class which allows the USB Type-C Controller and Interface drivers to 208c2ecf20Sopenharmony_ciconfigure the cable plug orientation and mode (with Alternate Modes). The driver 218c2ecf20Sopenharmony_cialso registers with the USB Role Class in order to support both USB Host and 228c2ecf20Sopenharmony_ciDevice modes. The driver is located here: drivers/usb/typec/mux/intel_pmc_mux.c. 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ciPort nodes 258c2ecf20Sopenharmony_ci========== 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ciGeneral 288c2ecf20Sopenharmony_ci------- 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ciFor every USB Type-C connector under the mux-agent control on the system, there 318c2ecf20Sopenharmony_ciis a separate child node under the PMC mux-agent device node. Those nodes do not 328c2ecf20Sopenharmony_cirepresent the actual connectors, but instead the "channels" in the mux-agent 338c2ecf20Sopenharmony_cithat are associated with the connectors:: 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci Scope (_SB.PCI0.PMC.MUX) 368c2ecf20Sopenharmony_ci { 378c2ecf20Sopenharmony_ci Device (CH0) 388c2ecf20Sopenharmony_ci { 398c2ecf20Sopenharmony_ci Name (_ADR, 0) 408c2ecf20Sopenharmony_ci } 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci Device (CH1) 438c2ecf20Sopenharmony_ci { 448c2ecf20Sopenharmony_ci Name (_ADR, 1) 458c2ecf20Sopenharmony_ci } 468c2ecf20Sopenharmony_ci } 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci_PLD (Physical Location of Device) 498c2ecf20Sopenharmony_ci---------------------------------- 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ciThe optional _PLD object can be used with the port (the channel) nodes. If _PLD 528c2ecf20Sopenharmony_ciis supplied, it should match the connector node _PLD:: 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci Scope (_SB.PCI0.PMC.MUX) 558c2ecf20Sopenharmony_ci { 568c2ecf20Sopenharmony_ci Device (CH0) 578c2ecf20Sopenharmony_ci { 588c2ecf20Sopenharmony_ci Name (_ADR, 0) 598c2ecf20Sopenharmony_ci Method (_PLD, 0, NotSerialized) 608c2ecf20Sopenharmony_ci { 618c2ecf20Sopenharmony_ci /* Consider this as pseudocode. */ 628c2ecf20Sopenharmony_ci Return (\_SB.USBC.CON0._PLD()) 638c2ecf20Sopenharmony_ci } 648c2ecf20Sopenharmony_ci } 658c2ecf20Sopenharmony_ci } 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ciMux-agent specific _DSD Device Properties 688c2ecf20Sopenharmony_ci----------------------------------------- 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ciPort Numbers 718c2ecf20Sopenharmony_ci~~~~~~~~~~~~ 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ciIn order to configure the muxes behind a USB Type-C connector, the PMC firmware 748c2ecf20Sopenharmony_cineeds to know the USB2 port and the USB3 port that is associated with the 758c2ecf20Sopenharmony_ciconnector. The driver extracts the correct port numbers by reading specific _DSD 768c2ecf20Sopenharmony_cidevice properties named "usb2-port-number" and "usb3-port-number". These 778c2ecf20Sopenharmony_ciproperties have integer value that means the port index. The port index number 788c2ecf20Sopenharmony_ciis 1's based, and value 0 is illegal. The driver uses the numbers extracted from 798c2ecf20Sopenharmony_cithese device properties as-is when sending the mux-agent specific messages to 808c2ecf20Sopenharmony_cithe PMC:: 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci Name (_DSD, Package () { 838c2ecf20Sopenharmony_ci ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 848c2ecf20Sopenharmony_ci Package() { 858c2ecf20Sopenharmony_ci Package () {"usb2-port-number", 6}, 868c2ecf20Sopenharmony_ci Package () {"usb3-port-number", 3}, 878c2ecf20Sopenharmony_ci }, 888c2ecf20Sopenharmony_ci }) 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ciOrientation 918c2ecf20Sopenharmony_ci~~~~~~~~~~~ 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ciDepending on the platform, the data and SBU lines coming from the connector may 948c2ecf20Sopenharmony_cibe "fixed" from the mux-agent's point of view, which means the mux-agent driver 958c2ecf20Sopenharmony_cishould not configure them according to the cable plug orientation. This can 968c2ecf20Sopenharmony_cihappen for example if a retimer on the platform handles the cable plug 978c2ecf20Sopenharmony_ciorientation. The driver uses a specific device properties "sbu-orientation" 988c2ecf20Sopenharmony_ci(SBU) and "hsl-orientation" (data) to know if those lines are "fixed", and to 998c2ecf20Sopenharmony_ciwhich orientation. The value that these properties have is a string value, and 1008c2ecf20Sopenharmony_ciit can be one that is defined for the USB Type-C connector orientation: "normal" 1018c2ecf20Sopenharmony_cior "reversed":: 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci Name (_DSD, Package () { 1048c2ecf20Sopenharmony_ci ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 1058c2ecf20Sopenharmony_ci Package() { 1068c2ecf20Sopenharmony_ci Package () {"sbu-orientation", "normal"}, 1078c2ecf20Sopenharmony_ci Package () {"hsl-orientation", "normal"}, 1088c2ecf20Sopenharmony_ci }, 1098c2ecf20Sopenharmony_ci }) 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ciExample ASL 1128c2ecf20Sopenharmony_ci=========== 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ciThe following ASL is an example that shows the mux-agent node, and two 1158c2ecf20Sopenharmony_ciconnectors under its control:: 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci Scope (_SB.PCI0.PMC) 1188c2ecf20Sopenharmony_ci { 1198c2ecf20Sopenharmony_ci Device (MUX) 1208c2ecf20Sopenharmony_ci { 1218c2ecf20Sopenharmony_ci Name (_HID, "INTC105C") 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci Device (CH0) 1248c2ecf20Sopenharmony_ci { 1258c2ecf20Sopenharmony_ci Name (_ADR, 0) 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci Name (_DSD, Package () { 1288c2ecf20Sopenharmony_ci ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 1298c2ecf20Sopenharmony_ci Package() { 1308c2ecf20Sopenharmony_ci Package () {"usb2-port-number", 6}, 1318c2ecf20Sopenharmony_ci Package () {"usb3-port-number", 3}, 1328c2ecf20Sopenharmony_ci Package () {"sbu-orientation", "normal"}, 1338c2ecf20Sopenharmony_ci Package () {"hsl-orientation", "normal"}, 1348c2ecf20Sopenharmony_ci }, 1358c2ecf20Sopenharmony_ci }) 1368c2ecf20Sopenharmony_ci } 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci Device (CH1) 1398c2ecf20Sopenharmony_ci { 1408c2ecf20Sopenharmony_ci Name (_ADR, 1) 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci Name (_DSD, Package () { 1438c2ecf20Sopenharmony_ci ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 1448c2ecf20Sopenharmony_ci Package() { 1458c2ecf20Sopenharmony_ci Package () {"usb2-port-number", 5}, 1468c2ecf20Sopenharmony_ci Package () {"usb3-port-number", 2}, 1478c2ecf20Sopenharmony_ci Package () {"sbu-orientation", "normal"}, 1488c2ecf20Sopenharmony_ci Package () {"hsl-orientation", "normal"}, 1498c2ecf20Sopenharmony_ci }, 1508c2ecf20Sopenharmony_ci }) 1518c2ecf20Sopenharmony_ci } 1528c2ecf20Sopenharmony_ci } 1538c2ecf20Sopenharmony_ci } 154