All of lore.kernel.org
 help / color / mirror / Atom feed
* Wake from Thunderbolt dock doesn't work
@ 2022-04-21 19:52 Tomasz Moń
  2022-04-22  5:26 ` Mika Westerberg
  0 siblings, 1 reply; 8+ messages in thread
From: Tomasz Moń @ 2022-04-21 19:52 UTC (permalink / raw)
  To: linux-usb; +Cc: Andreas Noever, Michael Jamet, Mika Westerberg, Yehezkel Bernat

Hello,

I have observed that when I suspend to RAM, I cannot wakeup the host
(MacBook Pro 2019) with my low-speed USB keyboard (Microsoft Comfort
Curve Keyboard 2000) connected to Thunderbolt 3 dock (CalDigit USB-C
Pro Dock).

The host runs on Intel Core i9-9980HK and lspci shows Intel Corporation
JHL7540 Thunderbolt 3 NHI [Titan Ridge 4C 2018] and Intel Corporation
DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015].

On Windows and Mac OS the system can be successfully woken up by
pressing key on keyboard connected via the dock.

When the dock is connected to host via USB A converter, that is without
the configuration channel (so switch to thunderbolt alternate protocol
is not possible and thus the dock operates as self-powered USB hub),
the wakeup from USB keyboard works fine.

When the USB keyboard is connected directly to the host via USB-C to
USB A adapter, the wakeup from USB keyboard works fine.

I have tried enabling the wakeup from all usb devices. The only issue
is that when I enable wakeup from usb1 (xHCI Host Controller), I get
spurious wakeup immediately after suspending to RAM. When I enabled
wakeup from all USB devices (in /sys/bus/usb/devices) except the usb1,
the USB keyboard (connected via dock in thunderbolt mode) still cannot
wakeup the system.

I am not sure how to debug this further. Is it possible to mask the
thunderbolt alternate protocol capability on host? That is, to make the
host pretend that the Thunderbolt alternate mode is not supported (but
still allow DisplayPort alternate mode)?

Attached is lspci -vv output related to the dock. Included are only the
entries added after the dock is connected.

Best Regards,
Tomasz Mon


43:00.0 PCI bridge: Intel Corporation JHL7540 Thunderbolt 3 Bridge [Titan Ridge DD 2018] (rev 06) (prog-if 00 [Normal decode])
	Physical Slot: 4
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 81
	Bus: primary=43, secondary=44, subordinate=45, sec-latency=0
	I/O behind bridge: 00007000-00008fff [size=8K]
	Memory behind bridge: 88a00000-8f9fffff [size=112M]
	Prefetchable memory behind bridge: 00000000c8700000-00000000cf6fffff [size=112M]
	Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
	BridgeCtl: Parity- SERR+ NoISA- VGA- VGA16- MAbort- >Reset- FastB2B-
		PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
	Capabilities: [80] Power Management version 3
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [88] MSI: Enable+ Count=1/1 Maskable- 64bit+
		Address: 00000000fee00978  Data: 0000
	Capabilities: [ac] Subsystem: Intel Corporation Device 0000
	Capabilities: [c0] Express (v2) Upstream Port, MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0
			ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ SlotPowerLimit 0.000W
		DevCtl:	CorrErr- NonFatalErr- FatalErr- UnsupReq-
			RlxdOrd+ ExtTag+ PhantFunc- AuxPwr- NoSnoop+
			MaxPayload 128 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr+ TransPend-
		LnkCap:	Port #3, Speed 8GT/s, Width x4, ASPM L1, Exit Latency L1 <2us
			ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+
		LnkCtl:	ASPM Disabled; Disabled- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s (downgraded), Width x4 (ok)
			TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Not Supported, TimeoutDis- NROPrPrP- LTR+
			 10BitTagComp- 10BitTagReq- OBFF Not Supported, ExtFmt- EETLPPrefix-
			 EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit-
			 FRS-
			 AtomicOpsCap: Routing-
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR+ OBFF Disabled,
			 AtomicOpsCtl: EgressBlck-
		LnkCap2: Supported Link Speeds: 2.5-8GT/s, Crosslink- Retimer- 2Retimers- DRS-
		LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete- EqualizationPhase1-
			 EqualizationPhase2- EqualizationPhase3- LinkEqualizationRequest-
			 Retimer- 2Retimers- CrosslinkRes: unsupported
	Capabilities: [50] Capability ID 0x15 [0000]
	Capabilities: [100 v1] Device Serial Number 6a-4b-80-20-b3-b7-d0-00
	Capabilities: [200 v1] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES- TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr-
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr+
		AERCap:	First Error Pointer: 00, ECRCGenCap- ECRCGenEn- ECRCChkCap- ECRCChkEn-
			MultHdrRecCap- MultHdrRecEn- TLPPfxPres- HdrLogCap-
		HeaderLog: 00000000 00000000 00000000 00000000
	Capabilities: [300 v1] Virtual Channel
		Caps:	LPEVC=0 RefClk=100ns PATEntryBits=1
		Arb:	Fixed- WRR32- WRR64- WRR128-
		Ctrl:	ArbSelect=Fixed
		Status:	InProgress-
		VC0:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed+ WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
			Status:	NegoPending- InProgress-
	Capabilities: [400 v1] Power Budgeting <?>
	Capabilities: [500 v1] Vendor Specific Information: ID=1234 Rev=1 Len=100 <?>
	Capabilities: [600 v1] Vendor Specific Information: ID=8086 Rev=2 Len=04c <?>
	Capabilities: [700 v1] Secondary PCI Express
		LnkCtl3: LnkEquIntrruptEn- PerformEqu-
		LaneErrStat: 0
	Capabilities: [800 v1] Latency Tolerance Reporting
		Max snoop latency: 0ns
		Max no snoop latency: 0ns
	Capabilities: [a00 v1] L1 PM Substates
		L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+ L1_PM_Substates+
			  PortCommonModeRestoreTime=0us PortTPowerOnTime=10us
		L1SubCtl1: PCI-PM_L1.2- PCI-PM_L1.1- ASPM_L1.2- ASPM_L1.1-
			   T_CommonMode=0us LTR1.2_Threshold=0ns
		L1SubCtl2: T_PwrOn=10us
	Capabilities: [b00 v1] Precision Time Measurement
		PTMCap: Requester:+ Responder:+ Root:-
		PTMClockGranularity: Unimplemented
		PTMControl: Enabled:- RootSelected:-
		PTMEffectiveGranularity: Unknown
	Kernel driver in use: pcieport

44:02.0 PCI bridge: Intel Corporation JHL7540 Thunderbolt 3 Bridge [Titan Ridge DD 2018] (rev 06) (prog-if 00 [Normal decode])
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 82
	Bus: primary=44, secondary=45, subordinate=45, sec-latency=0
	I/O behind bridge: 00007000-00008fff [size=8K]
	Memory behind bridge: 88a00000-8f9fffff [size=112M]
	Prefetchable memory behind bridge: 00000000c8700000-00000000cf6fffff [size=112M]
	Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
	BridgeCtl: Parity- SERR+ NoISA- VGA- VGA16- MAbort- >Reset- FastB2B-
		PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
	Capabilities: [80] Power Management version 3
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [88] MSI: Enable+ Count=1/1 Maskable- 64bit+
		Address: 00000000fee00998  Data: 0000
	Capabilities: [ac] Subsystem: Intel Corporation Device 0000
	Capabilities: [c0] Express (v2) Downstream Port (Slot+), MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0
			ExtTag+ RBE+
		DevCtl:	CorrErr- NonFatalErr- FatalErr- UnsupReq-
			RlxdOrd+ ExtTag+ PhantFunc- AuxPwr- NoSnoop+
			MaxPayload 128 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr+ TransPend-
		LnkCap:	Port #2, Speed 2.5GT/s, Width x4, ASPM L1, Exit Latency L1 <1us
			ClockPM- Surprise- LLActRep- BwNot+ ASPMOptComp+
		LnkCtl:	ASPM Disabled; Disabled- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s (ok), Width x4 (ok)
			TrErr- Train- SlotClk+ DLActive- BWMgmt+ ABWMgmt-
		SltCap:	AttnBtn- PwrCtrl- MRL- AttnInd- PwrInd- HotPlug- Surprise-
			Slot #0, PowerLimit 0.000W; Interlock- NoCompl+
		SltCtl:	Enable: AttnBtn- PwrFlt- MRL- PresDet- CmdCplt- HPIrq- LinkChg-
			Control: AttnInd Unknown, PwrInd Unknown, Power- Interlock-
		SltSta:	Status: AttnBtn- PowerFlt- MRL- CmdCplt- PresDet+ Interlock-
			Changed: MRL- PresDet+ LinkState-
		DevCap2: Completion Timeout: Not Supported, TimeoutDis- NROPrPrP- LTR+
			 10BitTagComp- 10BitTagReq- OBFF Not Supported, ExtFmt- EETLPPrefix-
			 EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit-
			 FRS- ARIFwd-
			 AtomicOpsCap: Routing-
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR+ OBFF Disabled, ARIFwd-
			 AtomicOpsCtl: EgressBlck-
		LnkCap2: Supported Link Speeds: 2.5-8GT/s, Crosslink- Retimer- 2Retimers- DRS-
		LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-, Selectable De-emphasis: -6dB
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete- EqualizationPhase1-
			 EqualizationPhase2- EqualizationPhase3- LinkEqualizationRequest-
			 Retimer- 2Retimers- CrosslinkRes: unsupported
	Capabilities: [50] Capability ID 0x15 [0000]
	Capabilities: [100 v1] Device Serial Number 6a-4b-80-20-b3-b7-d0-00
	Capabilities: [200 v1] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES- TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr-
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr+
		AERCap:	First Error Pointer: 00, ECRCGenCap- ECRCGenEn- ECRCChkCap- ECRCChkEn-
			MultHdrRecCap- MultHdrRecEn- TLPPfxPres- HdrLogCap-
		HeaderLog: 00000000 00000000 00000000 00000000
	Capabilities: [300 v1] Virtual Channel
		Caps:	LPEVC=0 RefClk=100ns PATEntryBits=1
		Arb:	Fixed- WRR32- WRR64- WRR128-
		Ctrl:	ArbSelect=Fixed
		Status:	InProgress-
		VC0:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed+ WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
			Status:	NegoPending- InProgress-
	Capabilities: [400 v1] Power Budgeting <?>
	Capabilities: [500 v1] Vendor Specific Information: ID=1234 Rev=1 Len=100 <?>
	Capabilities: [600 v1] Vendor Specific Information: ID=8086 Rev=2 Len=04c <?>
	Capabilities: [700 v1] Secondary PCI Express
		LnkCtl3: LnkEquIntrruptEn- PerformEqu-
		LaneErrStat: 0
	Capabilities: [900 v1] Access Control Services
		ACSCap:	SrcValid+ TransBlk+ ReqRedir- CmpltRedir- UpstreamFwd+ EgressCtrl- DirectTrans-
		ACSCtl:	SrcValid- TransBlk- ReqRedir- CmpltRedir- UpstreamFwd- EgressCtrl- DirectTrans-
	Kernel driver in use: pcieport

45:00.0 USB controller: Intel Corporation JHL7540 Thunderbolt 3 USB Controller [Titan Ridge DD 2018] (rev 06) (prog-if 30 [XHCI])
	Subsystem: Intel Corporation Device 0000
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 256 bytes
	Interrupt: pin A routed to IRQ 83
	Region 0: Memory at 88a00000 (32-bit, non-prefetchable) [size=64K]
	Capabilities: [80] Power Management version 3
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
		Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [88] MSI: Enable+ Count=1/8 Maskable- 64bit+
		Address: 00000000fee009b8  Data: 0000
	Capabilities: [c0] Express (v2) Endpoint, MSI 00
		DevCap:	MaxPayload 128 bytes, PhantFunc 0, Latency L0s unlimited, L1 unlimited
			ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset- SlotPowerLimit 0.000W
		DevCtl:	CorrErr- NonFatalErr- FatalErr- UnsupReq-
			RlxdOrd+ ExtTag+ PhantFunc- AuxPwr- NoSnoop+
			MaxPayload 128 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr+ TransPend-
		LnkCap:	Port #0, Speed 2.5GT/s, Width x4, ASPM L1, Exit Latency L1 <1us
			ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp+
		LnkCtl:	ASPM Disabled; RCB 64 bytes, Disabled- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s (ok), Width x4 (ok)
			TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Range B, TimeoutDis+ NROPrPrP- LTR+
			 10BitTagComp- 10BitTagReq- OBFF Not Supported, ExtFmt- EETLPPrefix-
			 EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit-
			 FRS- TPHComp- ExtTPHComp-
			 AtomicOpsCap: 32bit- 64bit- 128bitCAS-
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR+ OBFF Disabled,
			 AtomicOpsCtl: ReqEn-
		LnkCap2: Supported Link Speeds: 2.5-8GT/s, Crosslink- Retimer- 2Retimers- DRS-
		LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete- EqualizationPhase1-
			 EqualizationPhase2- EqualizationPhase3- LinkEqualizationRequest-
			 Retimer- 2Retimers- CrosslinkRes: unsupported
	Capabilities: [100 v1] Device Serial Number 6a-4b-80-20-b3-b7-d0-00
	Capabilities: [200 v1] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES- TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr-
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr+
		AERCap:	First Error Pointer: 00, ECRCGenCap- ECRCGenEn- ECRCChkCap- ECRCChkEn-
			MultHdrRecCap- MultHdrRecEn- TLPPfxPres- HdrLogCap-
		HeaderLog: 00000000 00000000 00000000 00000000
	Capabilities: [300 v1] Virtual Channel
		Caps:	LPEVC=0 RefClk=100ns PATEntryBits=1
		Arb:	Fixed- WRR32- WRR64- WRR128-
		Ctrl:	ArbSelect=Fixed
		Status:	InProgress-
		VC0:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
			Status:	NegoPending- InProgress-
	Capabilities: [400 v1] Power Budgeting <?>
	Capabilities: [500 v1] Vendor Specific Information: ID=1234 Rev=1 Len=100 <?>
	Capabilities: [600 v1] Vendor Specific Information: ID=8086 Rev=2 Len=04c <?>
	Capabilities: [700 v1] Secondary PCI Express
		LnkCtl3: LnkEquIntrruptEn- PerformEqu-
		LaneErrStat: 0
	Capabilities: [800 v1] Latency Tolerance Reporting
		Max snoop latency: 0ns
		Max no snoop latency: 0ns
	Kernel driver in use: xhci_hcd


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Wake from Thunderbolt dock doesn't work
  2022-04-21 19:52 Wake from Thunderbolt dock doesn't work Tomasz Moń
@ 2022-04-22  5:26 ` Mika Westerberg
  2022-04-22  6:09   ` Tomasz Moń
  0 siblings, 1 reply; 8+ messages in thread
From: Mika Westerberg @ 2022-04-22  5:26 UTC (permalink / raw)
  To: Tomasz Moń; +Cc: linux-usb, Andreas Noever, Michael Jamet, Yehezkel Bernat

Hi,

On Thu, Apr 21, 2022 at 09:52:18PM +0200, Tomasz Moń wrote:
> Hello,
> 
> I have observed that when I suspend to RAM, I cannot wakeup the host
> (MacBook Pro 2019) with my low-speed USB keyboard (Microsoft Comfort
> Curve Keyboard 2000) connected to Thunderbolt 3 dock (CalDigit USB-C
> Pro Dock).
> 
> The host runs on Intel Core i9-9980HK and lspci shows Intel Corporation
> JHL7540 Thunderbolt 3 NHI [Titan Ridge 4C 2018] and Intel Corporation
> DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015].
> 
> On Windows and Mac OS the system can be successfully woken up by
> pressing key on keyboard connected via the dock.

Is the system that has the problem an Apple system or a regular PC?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Wake from Thunderbolt dock doesn't work
  2022-04-22  5:26 ` Mika Westerberg
@ 2022-04-22  6:09   ` Tomasz Moń
  2022-04-22  6:30     ` Mika Westerberg
  0 siblings, 1 reply; 8+ messages in thread
From: Tomasz Moń @ 2022-04-22  6:09 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: linux-usb, Andreas Noever, Michael Jamet, Yehezkel Bernat,
	Tomasz Moń

On Fri, Apr 22, 2022 at 7:27 AM Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> On Thu, Apr 21, 2022 at 09:52:18PM +0200, Tomasz Moń wrote:
> > I have observed that when I suspend to RAM, I cannot wakeup the host
> > (MacBook Pro 2019) with my low-speed USB keyboard (Microsoft Comfort
> > Curve Keyboard 2000) connected to Thunderbolt 3 dock (CalDigit USB-C
> > Pro Dock).
> >
> > The host runs on Intel Core i9-9980HK and lspci shows Intel Corporation
> > JHL7540 Thunderbolt 3 NHI [Titan Ridge 4C 2018] and Intel Corporation
> > DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015].
> >
> > On Windows and Mac OS the system can be successfully woken up by
> > pressing key on keyboard connected via the dock.
>
> Is the system that has the problem an Apple system or a regular PC?

It is an Apple system (MacBook Pro 2019) as noted in in first
paragraph. All tests were performed on the same host with the same
equipment.

The problem occurs when running Linux 5.17.3.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Wake from Thunderbolt dock doesn't work
  2022-04-22  6:09   ` Tomasz Moń
@ 2022-04-22  6:30     ` Mika Westerberg
  2022-04-22 13:54       ` Tomasz Moń
  0 siblings, 1 reply; 8+ messages in thread
From: Mika Westerberg @ 2022-04-22  6:30 UTC (permalink / raw)
  To: Tomasz Moń; +Cc: linux-usb, Andreas Noever, Michael Jamet, Yehezkel Bernat

On Fri, Apr 22, 2022 at 08:09:23AM +0200, Tomasz Moń wrote:
> On Fri, Apr 22, 2022 at 7:27 AM Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
> > On Thu, Apr 21, 2022 at 09:52:18PM +0200, Tomasz Moń wrote:
> > > I have observed that when I suspend to RAM, I cannot wakeup the host
> > > (MacBook Pro 2019) with my low-speed USB keyboard (Microsoft Comfort
> > > Curve Keyboard 2000) connected to Thunderbolt 3 dock (CalDigit USB-C
> > > Pro Dock).
> > >
> > > The host runs on Intel Core i9-9980HK and lspci shows Intel Corporation
> > > JHL7540 Thunderbolt 3 NHI [Titan Ridge 4C 2018] and Intel Corporation
> > > DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015].
> > >
> > > On Windows and Mac OS the system can be successfully woken up by
> > > pressing key on keyboard connected via the dock.
> >
> > Is the system that has the problem an Apple system or a regular PC?
> 
> It is an Apple system (MacBook Pro 2019) as noted in in first
> paragraph. All tests were performed on the same host with the same
> equipment.

OK, I see. I was bit confused because you mention that it works in
Windows. I guess you run the Windows on boot camp or so? If that's the
case then you should be getting same kind of "support" by passing
"thunderbolt.start_icm=1" in the kernel command line. That should do the
same than what the boot camp does and start the TBT firmware connection
manager.

Apple systems by default have the firmware connection manager disabled
so the OS does all the tunneling and in Linux we do not support
Thunderbolt 3 hosts fully in the software connection manager side (we do
support devices, though).  Mostly it's the power management that is
missing and I don't see it being fully supported in the future either
because the Apple systems are not like the most standardized systems in
the market so there are lots of "magic" things happening that are
completely undocumented :(

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Wake from Thunderbolt dock doesn't work
  2022-04-22  6:30     ` Mika Westerberg
@ 2022-04-22 13:54       ` Tomasz Moń
  2022-04-22 15:05         ` Mika Westerberg
  0 siblings, 1 reply; 8+ messages in thread
From: Tomasz Moń @ 2022-04-22 13:54 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: linux-usb, Andreas Noever, Michael Jamet, Yehezkel Bernat,
	Tomasz Moń

On Fri, 2022-04-22 at 09:30 +0300, Mika Westerberg wrote:
> On Fri, Apr 22, 2022 at 08:09:23AM +0200, Tomasz Moń wrote:
> > On Fri, Apr 22, 2022 at 7:27 AM Mika Westerberg
> > <mika.westerberg@linux.intel.com> wrote:
> > > On Thu, Apr 21, 2022 at 09:52:18PM +0200, Tomasz Moń wrote:
> > > > I have observed that when I suspend to RAM, I cannot wakeup the
> > > > host
> > > > (MacBook Pro 2019) with my low-speed USB keyboard (Microsoft
> > > > Comfort
> > > > Curve Keyboard 2000) connected to Thunderbolt 3 dock (CalDigit
> > > > USB-C
> > > > Pro Dock).
> > > > 
> > > > The host runs on Intel Core i9-9980HK and lspci shows Intel
> > > > Corporation
> > > > JHL7540 Thunderbolt 3 NHI [Titan Ridge 4C 2018] and Intel
> > > > Corporation
> > > > DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015].
> > > > 
> > > > On Windows and Mac OS the system can be successfully woken up
> > > > by
> > > > pressing key on keyboard connected via the dock.
> > > 
> > > Is the system that has the problem an Apple system or a regular
> > > PC?
> > 
> > It is an Apple system (MacBook Pro 2019) as noted in in first
> > paragraph. All tests were performed on the same host with the same
> > equipment.
> 
> OK, I see. I was bit confused because you mention that it works in
> Windows. I guess you run the Windows on boot camp or so?

Yes, Windows was installed using Boot Camp Assistant.

> If that's the case then you should be getting same kind of "support"
> by passing "thunderbolt.start_icm=1" in the kernel command line.

Passing "thunderbolt.start_icm=1" in the kernel command line made
things worse. The system does not wake from suspend at all. It does not
wake from USB keyboard connected directly to the host. And it does not
wake after opening the lid nor after pressing power button (Touch ID).

The only way to get system back running seemed to be pressing and
holding power button long enough until the Apple bootloader starts.

> That should do the same than what the boot camp does and start the
> TBT firmware connection manager.

I have no idea what boot camp does on the low level, but atleast
Windows can wakeup successfully.


> Apple systems by default have the firmware connection manager
> disabled so the OS does all the tunneling and in Linux we do not
> supportThunderbolt 3 hosts fully in the software connection manager
> side (we do support devices, though).  Mostly it's the power
> management that is missing and I don't see it being fully supported
> in the future either because the Apple systems are not like the most
> standardized systems in the market so there are lots of "magic"
> things happening that are completely undocumented :(

Apple "magic" is just one thing, but for someone outside Intel it is
even worse, as basically the whole JHL7540 is just a black box. Or is
there a way for casual programmer to get hold on the Intel Thunderbolt
3 datasheet/specification?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Wake from Thunderbolt dock doesn't work
  2022-04-22 13:54       ` Tomasz Moń
@ 2022-04-22 15:05         ` Mika Westerberg
  2022-04-22 20:38           ` Tomasz Moń
  0 siblings, 1 reply; 8+ messages in thread
From: Mika Westerberg @ 2022-04-22 15:05 UTC (permalink / raw)
  To: Tomasz Moń; +Cc: linux-usb, Andreas Noever, Michael Jamet, Yehezkel Bernat

On Fri, Apr 22, 2022 at 03:54:16PM +0200, Tomasz Moń wrote:
> On Fri, 2022-04-22 at 09:30 +0300, Mika Westerberg wrote:
> > On Fri, Apr 22, 2022 at 08:09:23AM +0200, Tomasz Moń wrote:
> > > On Fri, Apr 22, 2022 at 7:27 AM Mika Westerberg
> > > <mika.westerberg@linux.intel.com> wrote:
> > > > On Thu, Apr 21, 2022 at 09:52:18PM +0200, Tomasz Moń wrote:
> > > > > I have observed that when I suspend to RAM, I cannot wakeup the
> > > > > host
> > > > > (MacBook Pro 2019) with my low-speed USB keyboard (Microsoft
> > > > > Comfort
> > > > > Curve Keyboard 2000) connected to Thunderbolt 3 dock (CalDigit
> > > > > USB-C
> > > > > Pro Dock).
> > > > > 
> > > > > The host runs on Intel Core i9-9980HK and lspci shows Intel
> > > > > Corporation
> > > > > JHL7540 Thunderbolt 3 NHI [Titan Ridge 4C 2018] and Intel
> > > > > Corporation
> > > > > DSL6540 Thunderbolt 3 Bridge [Alpine Ridge 4C 2015].
> > > > > 
> > > > > On Windows and Mac OS the system can be successfully woken up
> > > > > by
> > > > > pressing key on keyboard connected via the dock.
> > > > 
> > > > Is the system that has the problem an Apple system or a regular
> > > > PC?
> > > 
> > > It is an Apple system (MacBook Pro 2019) as noted in in first
> > > paragraph. All tests were performed on the same host with the same
> > > equipment.
> > 
> > OK, I see. I was bit confused because you mention that it works in
> > Windows. I guess you run the Windows on boot camp or so?
> 
> Yes, Windows was installed using Boot Camp Assistant.

OK.

> > If that's the case then you should be getting same kind of "support"
> > by passing "thunderbolt.start_icm=1" in the kernel command line.
> 
> Passing "thunderbolt.start_icm=1" in the kernel command line made
> things worse. The system does not wake from suspend at all. It does not
> wake from USB keyboard connected directly to the host. And it does not
> wake after opening the lid nor after pressing power button (Touch ID).
> 
> The only way to get system back running seemed to be pressing and
> holding power button long enough until the Apple bootloader starts.

OK. The start_icm=1 starts the connection manager firmware which is one
thing that Windows relies too. However, all the PM stuff is still not
there unfortunately.

> > That should do the same than what the boot camp does and start the
> > TBT firmware connection manager.
> 
> I have no idea what boot camp does on the low level, but atleast
> Windows can wakeup successfully.

please try the same in Linux if that's possible. Running Linux natively
will likely have issues because all the non-standard stuff in those
systems.

> > Apple systems by default have the firmware connection manager
> > disabled so the OS does all the tunneling and in Linux we do not
> > supportThunderbolt 3 hosts fully in the software connection manager
> > side (we do support devices, though).  Mostly it's the power
> > management that is missing and I don't see it being fully supported
> > in the future either because the Apple systems are not like the most
> > standardized systems in the market so there are lots of "magic"
> > things happening that are completely undocumented :(
> 
> Apple "magic" is just one thing, but for someone outside Intel it is
> even worse, as basically the whole JHL7540 is just a black box. Or is
> there a way for casual programmer to get hold on the Intel Thunderbolt
> 3 datasheet/specification?

It is not about the TBT spec. It is how Apple wired and implemented the
power management of it. In PC world it's all standard ACPI methods that
are used to turn off/on power to the chip and implement the PCIe L2/3
handshake etc. All that is most likely different in Apple systems.

If you are interested the USB4 spec [1], which is public, describes the
TBT3 power management but again this is host and it is pretty much
implementation specific.

[1] https://usb.org/sites/default/files/USB4%20Specification%2020220331.zip

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Wake from Thunderbolt dock doesn't work
  2022-04-22 15:05         ` Mika Westerberg
@ 2022-04-22 20:38           ` Tomasz Moń
  2022-04-25  5:05             ` Mika Westerberg
  0 siblings, 1 reply; 8+ messages in thread
From: Tomasz Moń @ 2022-04-22 20:38 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: linux-usb, Andreas Noever, Michael Jamet, Yehezkel Bernat

On Fri, 2022-04-22 at 18:05 +0300, Mika Westerberg wrote:
> On Fri, Apr 22, 2022 at 03:54:16PM +0200, Tomasz Moń wrote:
> > On Fri, 2022-04-22 at 09:30 +0300, Mika Westerberg wrote:
> > > If that's the case then you should be getting same kind of "support"
> > > by passing "thunderbolt.start_icm=1" in the kernel command line.
> > 
> > Passing "thunderbolt.start_icm=1" in the kernel command line made
> > things worse. The system does not wake from suspend at all. It does not
> > wake from USB keyboard connected directly to the host. And it does not
> > wake after opening the lid nor after pressing power button (Touch ID).
> > 
> > The only way to get system back running seemed to be pressing and
> > holding power button long enough until the Apple bootloader starts.
> 
> OK. The start_icm=1 starts the connection manager firmware which is one
> thing that Windows relies too. However, all the PM stuff is still not
> there unfortunately.

Is the connection manager firmware interface (from Linux perspective)
implementation specific or is it standarized?

> > > That should do the same than what the boot camp does and start the TBT firmware connection manager.
> > 
> > I have no idea what boot camp does on the low level, but atleast
> > Windows can wakeup successfully.
> 
> please try the same in Linux if that's possible. Running Linux natively
> will likely have issues because all the non-standard stuff in those
> systems.

What do you mean by trying the same in Linux? I would like to, but I
simply don't know how.

Using "thunderbolt.start_icm=1" results in Linux being unable to wakeup
at all.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Wake from Thunderbolt dock doesn't work
  2022-04-22 20:38           ` Tomasz Moń
@ 2022-04-25  5:05             ` Mika Westerberg
  0 siblings, 0 replies; 8+ messages in thread
From: Mika Westerberg @ 2022-04-25  5:05 UTC (permalink / raw)
  To: Tomasz Moń; +Cc: linux-usb, Andreas Noever, Michael Jamet, Yehezkel Bernat

On Fri, Apr 22, 2022 at 10:38:29PM +0200, Tomasz Moń wrote:
> On Fri, 2022-04-22 at 18:05 +0300, Mika Westerberg wrote:
> > On Fri, Apr 22, 2022 at 03:54:16PM +0200, Tomasz Moń wrote:
> > > On Fri, 2022-04-22 at 09:30 +0300, Mika Westerberg wrote:
> > > > If that's the case then you should be getting same kind of "support"
> > > > by passing "thunderbolt.start_icm=1" in the kernel command line.
> > > 
> > > Passing "thunderbolt.start_icm=1" in the kernel command line made
> > > things worse. The system does not wake from suspend at all. It does not
> > > wake from USB keyboard connected directly to the host. And it does not
> > > wake after opening the lid nor after pressing power button (Touch ID).
> > > 
> > > The only way to get system back running seemed to be pressing and
> > > holding power button long enough until the Apple bootloader starts.
> > 
> > OK. The start_icm=1 starts the connection manager firmware which is one
> > thing that Windows relies too. However, all the PM stuff is still not
> > there unfortunately.
> 
> Is the connection manager firmware interface (from Linux perspective)
> implementation specific or is it standarized?

Implementation specific. Apple does not use it on macOS at all and this
is the behaviour you get when you boot Linux there too (on bare metal).
However, with boot camp the firmware is started and the whole
environment (PM stuff) is made more standardized so that Windows can run
on it.

> 
> > > > That should do the same than what the boot camp does and start the TBT firmware connection manager.
> > > 
> > > I have no idea what boot camp does on the low level, but atleast
> > > Windows can wakeup successfully.
> > 
> > please try the same in Linux if that's possible. Running Linux natively
> > will likely have issues because all the non-standard stuff in those
> > systems.
> 
> What do you mean by trying the same in Linux? I would like to, but I
> simply don't know how.

I'm suggesting to boot linux on the boot camp too. I have no idea if
that is even posible but if it is then that would be the closest to get
similar behaviour between Windows on Apple and Linux.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-04-25  5:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 19:52 Wake from Thunderbolt dock doesn't work Tomasz Moń
2022-04-22  5:26 ` Mika Westerberg
2022-04-22  6:09   ` Tomasz Moń
2022-04-22  6:30     ` Mika Westerberg
2022-04-22 13:54       ` Tomasz Moń
2022-04-22 15:05         ` Mika Westerberg
2022-04-22 20:38           ` Tomasz Moń
2022-04-25  5:05             ` Mika Westerberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.