On Mon, 13 Jan 2020, Samuel Sadok wrote: > Hello, > > It's been a while that there was any discussion on this bug so here's > a brief context: There's a bug on some MacBook Pro's where the > built-in SD card reader would be missing after a suspend/resume cycle. > > After looking at the schematics for my laptop I noticed that > `OC6*/GPIO10` of the Intel PCH is connected to a net called > `SD_PWR_EN`. So I tried to set this pin to 0 and then to 1 again in > order to completely power cycle the card reader. Turns out this > finally makes the card reader appear after a suspend/resume cycle. > > For the record, here's the user space workaround: > https://gist.github.com/samuelsadok/6d7b3e3015d3370a92ed4702e4d3c4b5#gistcomment-3134437 > > Are there other buggy devices for which the kernel already implements > such a power cycle? Otherwise, where would be the right place to add > this? This is a platform-specific solution, so it belongs in a platform-specific region of the kernel. Any necessary changes would mostly have to go outside the USB stack -- after all, GPIO lines aren't USB devices. If the kernel already contains some system-setup code specific to the MacBook Pro, that's where such a fix belongs. > Additional observations: > - by default (after boot), GPIO10 is configured as input and shows > the state "high". In the schematics there's a pull-up resistor. and I > assume it goes to a mosfet (off-sheet). So the problem is not that the > card reader has no power after suspend. It just needs a power cycle. > - the card reader is connected to the PCH via the four USB3 data > lines, but the two USB2 data lines are not connected. Is this a legal > configuration? Might this prevent the card reader from receiving power > state commands? It is not allowed for a generic connection (i.e., to an external device) but I think it's okay for something that's built into the platform. It could prevent the card reader from working correctly if for some reason the USB-3 signalling failed and the device tried to switch over to USB-2 signalling. On the other hand, there's no real reason I can think of for the card reader to need a power cycle following resume. Fixing that problem, whatever it is, would be a better solution. Alan Stern