1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun===================== 4*4882a593SmuzhiyunIntel North Mux-Agent 5*4882a593Smuzhiyun===================== 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunIntroduction 8*4882a593Smuzhiyun============ 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunNorth Mux-Agent is a function of the Intel PMC firmware that is supported on 11*4882a593Smuzhiyunmost Intel based platforms that have the PMC microcontroller. It's used for 12*4882a593Smuzhiyunconfiguring the various USB Multiplexer/DeMultiplexers on the system. The 13*4882a593Smuzhiyunplatforms that allow the mux-agent to be configured from the operating system 14*4882a593Smuzhiyunhave an ACPI device object (node) with HID "INTC105C" that represents it. 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunThe North Mux-Agent (aka. Intel PMC Mux Control, or just mux-agent) driver 17*4882a593Smuzhiyuncommunicates with the PMC microcontroller by using the PMC IPC method 18*4882a593Smuzhiyun(drivers/platform/x86/intel_scu_ipc.c). The driver registers with the USB Type-C 19*4882a593SmuzhiyunMux Class which allows the USB Type-C Controller and Interface drivers to 20*4882a593Smuzhiyunconfigure the cable plug orientation and mode (with Alternate Modes). The driver 21*4882a593Smuzhiyunalso registers with the USB Role Class in order to support both USB Host and 22*4882a593SmuzhiyunDevice modes. The driver is located here: drivers/usb/typec/mux/intel_pmc_mux.c. 23*4882a593Smuzhiyun 24*4882a593SmuzhiyunPort nodes 25*4882a593Smuzhiyun========== 26*4882a593Smuzhiyun 27*4882a593SmuzhiyunGeneral 28*4882a593Smuzhiyun------- 29*4882a593Smuzhiyun 30*4882a593SmuzhiyunFor every USB Type-C connector under the mux-agent control on the system, there 31*4882a593Smuzhiyunis a separate child node under the PMC mux-agent device node. Those nodes do not 32*4882a593Smuzhiyunrepresent the actual connectors, but instead the "channels" in the mux-agent 33*4882a593Smuzhiyunthat are associated with the connectors:: 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun Scope (_SB.PCI0.PMC.MUX) 36*4882a593Smuzhiyun { 37*4882a593Smuzhiyun Device (CH0) 38*4882a593Smuzhiyun { 39*4882a593Smuzhiyun Name (_ADR, 0) 40*4882a593Smuzhiyun } 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun Device (CH1) 43*4882a593Smuzhiyun { 44*4882a593Smuzhiyun Name (_ADR, 1) 45*4882a593Smuzhiyun } 46*4882a593Smuzhiyun } 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun_PLD (Physical Location of Device) 49*4882a593Smuzhiyun---------------------------------- 50*4882a593Smuzhiyun 51*4882a593SmuzhiyunThe optional _PLD object can be used with the port (the channel) nodes. If _PLD 52*4882a593Smuzhiyunis supplied, it should match the connector node _PLD:: 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun Scope (_SB.PCI0.PMC.MUX) 55*4882a593Smuzhiyun { 56*4882a593Smuzhiyun Device (CH0) 57*4882a593Smuzhiyun { 58*4882a593Smuzhiyun Name (_ADR, 0) 59*4882a593Smuzhiyun Method (_PLD, 0, NotSerialized) 60*4882a593Smuzhiyun { 61*4882a593Smuzhiyun /* Consider this as pseudocode. */ 62*4882a593Smuzhiyun Return (\_SB.USBC.CON0._PLD()) 63*4882a593Smuzhiyun } 64*4882a593Smuzhiyun } 65*4882a593Smuzhiyun } 66*4882a593Smuzhiyun 67*4882a593SmuzhiyunMux-agent specific _DSD Device Properties 68*4882a593Smuzhiyun----------------------------------------- 69*4882a593Smuzhiyun 70*4882a593SmuzhiyunPort Numbers 71*4882a593Smuzhiyun~~~~~~~~~~~~ 72*4882a593Smuzhiyun 73*4882a593SmuzhiyunIn order to configure the muxes behind a USB Type-C connector, the PMC firmware 74*4882a593Smuzhiyunneeds to know the USB2 port and the USB3 port that is associated with the 75*4882a593Smuzhiyunconnector. The driver extracts the correct port numbers by reading specific _DSD 76*4882a593Smuzhiyundevice properties named "usb2-port-number" and "usb3-port-number". These 77*4882a593Smuzhiyunproperties have integer value that means the port index. The port index number 78*4882a593Smuzhiyunis 1's based, and value 0 is illegal. The driver uses the numbers extracted from 79*4882a593Smuzhiyunthese device properties as-is when sending the mux-agent specific messages to 80*4882a593Smuzhiyunthe PMC:: 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun Name (_DSD, Package () { 83*4882a593Smuzhiyun ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 84*4882a593Smuzhiyun Package() { 85*4882a593Smuzhiyun Package () {"usb2-port-number", 6}, 86*4882a593Smuzhiyun Package () {"usb3-port-number", 3}, 87*4882a593Smuzhiyun }, 88*4882a593Smuzhiyun }) 89*4882a593Smuzhiyun 90*4882a593SmuzhiyunOrientation 91*4882a593Smuzhiyun~~~~~~~~~~~ 92*4882a593Smuzhiyun 93*4882a593SmuzhiyunDepending on the platform, the data and SBU lines coming from the connector may 94*4882a593Smuzhiyunbe "fixed" from the mux-agent's point of view, which means the mux-agent driver 95*4882a593Smuzhiyunshould not configure them according to the cable plug orientation. This can 96*4882a593Smuzhiyunhappen for example if a retimer on the platform handles the cable plug 97*4882a593Smuzhiyunorientation. The driver uses a specific device properties "sbu-orientation" 98*4882a593Smuzhiyun(SBU) and "hsl-orientation" (data) to know if those lines are "fixed", and to 99*4882a593Smuzhiyunwhich orientation. The value that these properties have is a string value, and 100*4882a593Smuzhiyunit can be one that is defined for the USB Type-C connector orientation: "normal" 101*4882a593Smuzhiyunor "reversed":: 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun Name (_DSD, Package () { 104*4882a593Smuzhiyun ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 105*4882a593Smuzhiyun Package() { 106*4882a593Smuzhiyun Package () {"sbu-orientation", "normal"}, 107*4882a593Smuzhiyun Package () {"hsl-orientation", "normal"}, 108*4882a593Smuzhiyun }, 109*4882a593Smuzhiyun }) 110*4882a593Smuzhiyun 111*4882a593SmuzhiyunExample ASL 112*4882a593Smuzhiyun=========== 113*4882a593Smuzhiyun 114*4882a593SmuzhiyunThe following ASL is an example that shows the mux-agent node, and two 115*4882a593Smuzhiyunconnectors under its control:: 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun Scope (_SB.PCI0.PMC) 118*4882a593Smuzhiyun { 119*4882a593Smuzhiyun Device (MUX) 120*4882a593Smuzhiyun { 121*4882a593Smuzhiyun Name (_HID, "INTC105C") 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun Device (CH0) 124*4882a593Smuzhiyun { 125*4882a593Smuzhiyun Name (_ADR, 0) 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun Name (_DSD, Package () { 128*4882a593Smuzhiyun ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 129*4882a593Smuzhiyun Package() { 130*4882a593Smuzhiyun Package () {"usb2-port-number", 6}, 131*4882a593Smuzhiyun Package () {"usb3-port-number", 3}, 132*4882a593Smuzhiyun Package () {"sbu-orientation", "normal"}, 133*4882a593Smuzhiyun Package () {"hsl-orientation", "normal"}, 134*4882a593Smuzhiyun }, 135*4882a593Smuzhiyun }) 136*4882a593Smuzhiyun } 137*4882a593Smuzhiyun 138*4882a593Smuzhiyun Device (CH1) 139*4882a593Smuzhiyun { 140*4882a593Smuzhiyun Name (_ADR, 1) 141*4882a593Smuzhiyun 142*4882a593Smuzhiyun Name (_DSD, Package () { 143*4882a593Smuzhiyun ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 144*4882a593Smuzhiyun Package() { 145*4882a593Smuzhiyun Package () {"usb2-port-number", 5}, 146*4882a593Smuzhiyun Package () {"usb3-port-number", 2}, 147*4882a593Smuzhiyun Package () {"sbu-orientation", "normal"}, 148*4882a593Smuzhiyun Package () {"hsl-orientation", "normal"}, 149*4882a593Smuzhiyun }, 150*4882a593Smuzhiyun }) 151*4882a593Smuzhiyun } 152*4882a593Smuzhiyun } 153*4882a593Smuzhiyun } 154