Re: [RFC PATCH 0/2] Fix for the internal card reader and suspend on MacBooks
On Thu, 2019-02-14 at 22:32 +0500, Ivan Mironov wrote: > On Thu, 2019-02-14 at 06:40 +0500, Ivan Mironov wrote: > > Unfortunately, everything broke again after yet another suspend/resume. > > Currently I'm suspecting that my patch maybe only helps to survive the > > short suspend, but not the long one. > > > > After this bad suspend/resume, card reader disappeared again. Debug > > logging was not enabled this time, so not too many information in the > > dmesg: > > > > [44013.429613] usb 2-4: Disable of device-initiated U1 failed. > > [44018.549809] usb 2-4: Disable of device-initiated U2 failed. > > [44024.182043] xhci_hcd :00:14.0: Timeout while waiting for setup > > device command > > [44029.814239] xhci_hcd :00:14.0: Timeout while waiting for setup > > device command > > [44030.022207] usb 2-4: device not accepting address 2, error -62 > > [44035.446526] xhci_hcd :00:14.0: Timeout while waiting for setup > > device command > > [44041.078732] xhci_hcd :00:14.0: Timeout while waiting for setup > > device command > > [44041.286640] usb 2-4: device not accepting address 2, error -62 > > [44046.710928] xhci_hcd :00:14.0: Timeout while waiting for setup > > device command > > [44052.343184] xhci_hcd :00:14.0: Timeout while waiting for setup > > device command > > [44052.551120] usb 2-4: device not accepting address 2, error -62 > > [44057.975369] xhci_hcd :00:14.0: Timeout while waiting for setup > > device command > > [44063.607605] xhci_hcd :00:14.0: Timeout while waiting for setup > > device command > > [44063.815538] usb 2-4: device not accepting address 2, error -62 > > [44063.882505] PM: resume devices took 55.895 seconds > > [44063.882508] [ cut here ] > > [44063.882511] Component: resume devices, time: 55895 > > [44063.882530] WARNING: CPU: 1 PID: 10887 at kernel/power/suspend_test.c:55 > > suspend_test_finish+0x6b/0x70 > > [44063.882531] Modules linked in: vfat fat rfcomm fuse xt_CHECKSUM > > ipt_MASQUERADE tun bridge stp llc devlink nf_conntrack_netbios_ns > > nf_conntrack_broadcast xt_CT ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 > > xt_conntrack ebtable_nat ip6table_nat nf_nat_ipv6 ip6table_mangle > > ip6table_raw ip6table_security iptable_nat nf_nat_ipv4 nf_nat > > iptable_mangle iptable_raw iptable_security nf_conntrack nf_defrag_ipv6 > > nf_defrag_ipv4 ip_set nfnetlink ebtable_filter ebtables ip6table_filter > > ip6_tables cmac bnep sunrpc nls_utf8 hfsplus joydev iTCO_wdt > > iTCO_vendor_support intel_rapl x86_pkg_temp_thermal btusb intel_powerclamp > > applesmc btrtl input_polldev brcmfmac btbcm coretemp btintel bluetooth > > kvm_intel brcmutil snd_hda_codec_cirrus snd_hda_codec_generic > > snd_hda_codec_hdmi intel_cstate snd_hda_intel intel_uncore cfg80211 > > snd_hda_codec ecdh_generic intel_rapl_perf snd_hda_core snd_hwdep bcm5974 > > snd_seq snd_seq_device snd_pcm mmc_core rfkill thunderbolt snd_timer snd > > mei_me mei soundcore i2c_i801 intel_pch_thermal > > [44063.882614] lpc_ich sbs acpi_als kfifo_buf sbshc industrialio > > apple_gmux pcc_cpufreq apple_bl binfmt_misc xfs libcrc32c dm_crypt i915 > > kvmgt mdev vfio kvm irqbypass i2c_algo_bit drm_kms_helper crct10dif_pclmul > > crc32_pclmul crc32c_intel drm uas ghash_clmulni_intel usb_storage video > > hid_apple > > [44063.882648] CPU: 1 PID: 10887 Comm: systemd-sleep Not tainted > > 4.20.7-200.ivan3.fc29.x86_64 #1 > > [44063.882651] Hardware name: Apple Inc. > > MacBookPro11,4/Mac-06F11FD93F0323C5, BIOS MBP114.88Z.0184.B00.1806051659 > > 06/05/2018 > > [44063.882656] RIP: 0010:suspend_test_finish+0x6b/0x70 > > [44063.882660] Code: 06 69 c2 e8 03 00 00 29 c1 e8 df a3 00 00 81 fd 10 27 > > 00 00 77 03 5b 5d c3 89 ea 48 89 de 48 c7 c7 e9 bb 0c b3 e8 1f 56 fa ff > > <0f> 0b eb e8 90 0f 1f 44 00 00 0f b6 05 49 e5 88 01 c3 0f 1f 00 0f > > [44063.882663] RSP: :bad682b0fd30 EFLAGS: 00010286 > > [44063.882666] RAX: RBX: b30cb9c2 RCX: > > 0006 > > [44063.882669] RDX: 0007 RSI: 0082 RDI: > > 8f70af0568c0 > > [44063.882671] RBP: da57 R08: 0002 R09: > > 000207c0 > > [44063.882674] R10: 002394f2f376 R11: 0001cd94 R12: > > > > [44063.882676] R13: b3254210 R14: R15: > > bad682b0fd60 > > [44063.882681] FS: 7fd487426940() GS:8f70af04() > > knlGS: > > [44063.882683] CS: 0010 DS: ES: CR0: 80050033 > > [44063.882686] CR2: CR3: 0003fcc92002 CR4: > > 001606e0 > > [44063.882688] Call Trace: > > [44063.882699] suspend_devices_and_enter+0x248/0x7f0 > > [44063.882706] pm_suspend.cold.5+0x33c/0x392 > > [44063.882711] state_store+0x80/0xe0 > > [44063.882718] kernfs_fop_write+0x116/0x190 > > [44063.882728] __vfs_write+0x36/0x1a0 > > [44063.882736] ? selinux_file_permission+0xf0/0x130 > > [44063.882745] ? security_file_per
Re: [RFC PATCH 0/2] Fix for the internal card reader and suspend on MacBooks
On Wed, Feb 13, 2019 at 1:14 PM Ivan Mironov wrote: > > First patch adds code for this new quirk, and second patch enables this > quirk for card reader device which is used in my macbook. Hi Ivan, Thanks for sending these patches along. I've applied them against 4.20.8 and they fix the suspend/resume issues I've hit since November in the -stable series. On resume, I see logs indicating that the stuck card reader on usb2-3 on my MacBook Pro is being reset. It shows up fine afterwards. Thanks, Eric
Re: [RFC PATCH 0/2] Fix for the internal card reader and suspend on MacBooks
On Thu, 2019-02-14 at 06:40 +0500, Ivan Mironov wrote: > Unfortunately, everything broke again after yet another suspend/resume. > Currently I'm suspecting that my patch maybe only helps to survive the > short suspend, but not the long one. > > After this bad suspend/resume, card reader disappeared again. Debug > logging was not enabled this time, so not too many information in the > dmesg: > > [44013.429613] usb 2-4: Disable of device-initiated U1 failed. > [44018.549809] usb 2-4: Disable of device-initiated U2 failed. > [44024.182043] xhci_hcd :00:14.0: Timeout while waiting for setup device > command > [44029.814239] xhci_hcd :00:14.0: Timeout while waiting for setup device > command > [44030.022207] usb 2-4: device not accepting address 2, error -62 > [44035.446526] xhci_hcd :00:14.0: Timeout while waiting for setup device > command > [44041.078732] xhci_hcd :00:14.0: Timeout while waiting for setup device > command > [44041.286640] usb 2-4: device not accepting address 2, error -62 > [44046.710928] xhci_hcd :00:14.0: Timeout while waiting for setup device > command > [44052.343184] xhci_hcd :00:14.0: Timeout while waiting for setup device > command > [44052.551120] usb 2-4: device not accepting address 2, error -62 > [44057.975369] xhci_hcd :00:14.0: Timeout while waiting for setup device > command > [44063.607605] xhci_hcd :00:14.0: Timeout while waiting for setup device > command > [44063.815538] usb 2-4: device not accepting address 2, error -62 > [44063.882505] PM: resume devices took 55.895 seconds > [44063.882508] [ cut here ] > [44063.882511] Component: resume devices, time: 55895 > [44063.882530] WARNING: CPU: 1 PID: 10887 at kernel/power/suspend_test.c:55 > suspend_test_finish+0x6b/0x70 > [44063.882531] Modules linked in: vfat fat rfcomm fuse xt_CHECKSUM > ipt_MASQUERADE tun bridge stp llc devlink nf_conntrack_netbios_ns > nf_conntrack_broadcast xt_CT ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 > xt_conntrack ebtable_nat ip6table_nat nf_nat_ipv6 ip6table_mangle > ip6table_raw ip6table_security iptable_nat nf_nat_ipv4 nf_nat iptable_mangle > iptable_raw iptable_security nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 > ip_set nfnetlink ebtable_filter ebtables ip6table_filter ip6_tables cmac bnep > sunrpc nls_utf8 hfsplus joydev iTCO_wdt iTCO_vendor_support intel_rapl > x86_pkg_temp_thermal btusb intel_powerclamp applesmc btrtl input_polldev > brcmfmac btbcm coretemp btintel bluetooth kvm_intel brcmutil > snd_hda_codec_cirrus snd_hda_codec_generic snd_hda_codec_hdmi intel_cstate > snd_hda_intel intel_uncore cfg80211 snd_hda_codec ecdh_generic > intel_rapl_perf snd_hda_core snd_hwdep bcm5974 snd_seq snd_seq_device snd_pcm > mmc_core rfkill thunderbolt snd_timer snd mei_me mei soundcore i2c_i801 > intel_pch_thermal > [44063.882614] lpc_ich sbs acpi_als kfifo_buf sbshc industrialio apple_gmux > pcc_cpufreq apple_bl binfmt_misc xfs libcrc32c dm_crypt i915 kvmgt mdev vfio > kvm irqbypass i2c_algo_bit drm_kms_helper crct10dif_pclmul crc32_pclmul > crc32c_intel drm uas ghash_clmulni_intel usb_storage video hid_apple > [44063.882648] CPU: 1 PID: 10887 Comm: systemd-sleep Not tainted > 4.20.7-200.ivan3.fc29.x86_64 #1 > [44063.882651] Hardware name: Apple Inc. MacBookPro11,4/Mac-06F11FD93F0323C5, > BIOS MBP114.88Z.0184.B00.1806051659 06/05/2018 > [44063.882656] RIP: 0010:suspend_test_finish+0x6b/0x70 > [44063.882660] Code: 06 69 c2 e8 03 00 00 29 c1 e8 df a3 00 00 81 fd 10 27 00 > 00 77 03 5b 5d c3 89 ea 48 89 de 48 c7 c7 e9 bb 0c b3 e8 1f 56 fa ff <0f> 0b > eb e8 90 0f 1f 44 00 00 0f b6 05 49 e5 88 01 c3 0f 1f 00 0f > [44063.882663] RSP: :bad682b0fd30 EFLAGS: 00010286 > [44063.882666] RAX: RBX: b30cb9c2 RCX: > 0006 > [44063.882669] RDX: 0007 RSI: 0082 RDI: > 8f70af0568c0 > [44063.882671] RBP: da57 R08: 0002 R09: > 000207c0 > [44063.882674] R10: 002394f2f376 R11: 0001cd94 R12: > > [44063.882676] R13: b3254210 R14: R15: > bad682b0fd60 > [44063.882681] FS: 7fd487426940() GS:8f70af04() > knlGS: > [44063.882683] CS: 0010 DS: ES: CR0: 80050033 > [44063.882686] CR2: CR3: 0003fcc92002 CR4: > 001606e0 > [44063.882688] Call Trace: > [44063.882699] suspend_devices_and_enter+0x248/0x7f0 > [44063.882706] pm_suspend.cold.5+0x33c/0x392 > [44063.882711] state_store+0x80/0xe0 > [44063.882718] kernfs_fop_write+0x116/0x190 > [44063.882728] __vfs_write+0x36/0x1a0 > [44063.882736] ? selinux_file_permission+0xf0/0x130 > [44063.882745] ? security_file_permission+0x2c/0xb0 > [44063.882751] vfs_write+0xa5/0x1a0 > [44063.882758] ksys_write+0x4f/0xb0 > [44063.882767] do_syscall_64+0x5b/0x160 > [44063.882776] entry_SYSCALL_64_after_hwframe+0x44/0xa9 > [44063.882781] RIP: 0033:0x7fd48816dff8
Re: [RFC PATCH 0/2] Fix for the internal card reader and suspend on MacBooks
On Thu, 2019-02-14 at 17:03 +0200, Mathias Nyman wrote: > This card reader prevents second system suspend on latest kernels, see thread: > https://marc.info/?l=linux-usb&m=154816680816246&w=2 > > In that case the card reader fails to resume from usb3 U3 suspend state, > and ends up stuck in USB3 polling state, which now prevents suspend > > Could you try a testpatch (attached) to see if it helps? > > Thanks > -Mathias Hi Mathias, thanks for your patch. I applied it on top of current master (5.0.0- rc6+ 1f947a7a011fcceb14cb912f5481a53b18f1879a) and tested it. Unfortunately, without success. Card reader disappeared after the first suspend/resume cycle. Second suspend failed. Complete dmesg is here: https://raw.githubusercontent.com/im-0/investigate-card-reader-suspend-problem-on-mbp11.4/master/test-18/dmesg
Re: [RFC PATCH 0/2] Fix for the internal card reader and suspend on MacBooks
On 13.2.2019 23.13, Ivan Mironov wrote: Hi all, There is a known problem on some MacBooks: internal card reader disappears after the first suspend/resume and all subsequent attempts to suspend laptop are failing. This was reported[1][2] and even discussed in the mailing lists[3], without any real solution. After trying various things[4], including some existing quirks, I discovered that switching link state to DISABLED before suspend both fixes the card reader device and allows any subsequent suspend to succeed. First patch adds code for this new quirk, and second patch enables this quirk for card reader device which is used in my macbook. I'm not really familiar with either USB standards or kernel code to support them, so this patch series is RFC. I'm especially unsure with the "resume" part, because I implemented it by trial and error mostly. However, I'm using kernel with these patches and it works for me. Also, feel free to suggest other kernel patches or existing quirks or quirk combinations to fix the same problem. Oh, and by the way: I've checked schematics of various macbooks available on the internet. It seems that the actual chip is Genesys Logic GL3219, probably just with the custom ID. What I found curious, is that USB 2.0 pins of this chip (D+ and D-) are not really connected anywhere, but instead shorted through the resistor. Could it be possible that this somehow messes up some logic inside the device, host controller or linux kernel? This card reader prevents second system suspend on latest kernels, see thread: https://marc.info/?l=linux-usb&m=154816680816246&w=2 In that case the card reader fails to resume from usb3 U3 suspend state, and ends up stuck in USB3 polling state, which now prevents suspend Could you try a testpatch (attached) to see if it helps? Thanks -Mathias >From 6b3b9f3d41b8ac9cf993bf4b88a20e30c99e3b7f Mon Sep 17 00:00:00 2001 From: Mathias Nyman Date: Thu, 14 Feb 2019 15:40:12 +0200 Subject: [PATCH] usb: warm reset USB3 ports stuck in polling warm reset USB3 ports stuck in polling after 360ms. In the polling state USB3 ports are link training, which should not take longer than 360ms according to USB3 specification tPollingLFPSTimeout value. The card reader connected to xhci in MacBookPro is found stuck in this state after resuming from suspend. Signed-off-by: Mathias Nyman --- drivers/usb/core/hub.c | 36 +--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 8d4631c..448884d 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1151,9 +1151,10 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) */ if (hub_is_superspeed(hdev) && ((portstatus & USB_PORT_STAT_LINK_STATE) == - USB_SS_PORT_LS_POLLING)) + USB_SS_PORT_LS_POLLING)) { need_debounce_delay = true; - + set_bit(port1, hub->event_bits); + } /* Clear status-change flags; we'll debounce later */ if (portchange & USB_PORT_STAT_C_CONNECTION) { need_debounce_delay = true; @@ -2697,6 +2698,9 @@ static unsigned hub_is_wusb(struct usb_hub *hub) #define HUB_LONG_RESET_TIME 200 #define HUB_RESET_TIMEOUT 800 +#define HUB_LFPS_TIME 24 +#define HUB_LFPS_TIMEOUT 360 + /* * "New scheme" enumeration causes an extra state transition to be * exposed to an xhci host and causes USB3 devices to receive control @@ -2737,6 +2741,31 @@ static bool hub_port_warm_reset_required(struct usb_hub *hub, int port1, || link_state == USB_SS_PORT_LS_COMP_MOD; } +static bool hub_port_stuck_in_polling(struct usb_hub *hub, int port1, + u16 portstatus) +{ + u16 link_state; + u16 portchange; + int lfps_delay = 0; + + if (!hub_is_superspeed(hub->hdev)) + return false; + + link_state = portstatus & USB_PORT_STAT_LINK_STATE; + + while (link_state == USB_SS_PORT_LS_POLLING) { + msleep(HUB_LFPS_TIME); + + hub_port_status(hub, port1, &portstatus, &portchange); + link_state = portstatus & USB_PORT_STAT_LINK_STATE; + + lfps_delay += HUB_LFPS_TIME; + if (lfps_delay > HUB_LFPS_TIMEOUT) + return true; + } + return false; +} + static int hub_port_wait_reset(struct usb_hub *hub, int port1, struct usb_device *udev, unsigned int delay, bool warm) { @@ -5329,7 +5358,8 @@ static void port_event(struct usb_hub *hub, int port1) * Warm reset a USB3 protocol port if it's in * SS.Inactive state. */ - if (hub_port_warm_reset_required(hub, port1, portstatus)) { + if (hub_port_warm_reset_required(hub, port1, portstatus) || + hub_port_stuck_in_polling(hub, port1, portstatus)) { dev_dbg(&port_dev->dev, "do warm reset\n"); if (!udev || !(portstatus & USB_PORT_STAT_CONNECTION) || udev->state == USB_STATE_NOTATTACHED) { -- 2.7.4
Re: [RFC PATCH 0/2] Fix for the internal card reader and suspend on MacBooks
Unfortunately, everything broke again after yet another suspend/resume. Currently I'm suspecting that my patch maybe only helps to survive the short suspend, but not the long one. After this bad suspend/resume, card reader disappeared again. Debug logging was not enabled this time, so not too many information in the dmesg: [44013.429613] usb 2-4: Disable of device-initiated U1 failed. [44018.549809] usb 2-4: Disable of device-initiated U2 failed. [44024.182043] xhci_hcd :00:14.0: Timeout while waiting for setup device command [44029.814239] xhci_hcd :00:14.0: Timeout while waiting for setup device command [44030.022207] usb 2-4: device not accepting address 2, error -62 [44035.446526] xhci_hcd :00:14.0: Timeout while waiting for setup device command [44041.078732] xhci_hcd :00:14.0: Timeout while waiting for setup device command [44041.286640] usb 2-4: device not accepting address 2, error -62 [44046.710928] xhci_hcd :00:14.0: Timeout while waiting for setup device command [44052.343184] xhci_hcd :00:14.0: Timeout while waiting for setup device command [44052.551120] usb 2-4: device not accepting address 2, error -62 [44057.975369] xhci_hcd :00:14.0: Timeout while waiting for setup device command [44063.607605] xhci_hcd :00:14.0: Timeout while waiting for setup device command [44063.815538] usb 2-4: device not accepting address 2, error -62 [44063.882505] PM: resume devices took 55.895 seconds [44063.882508] [ cut here ] [44063.882511] Component: resume devices, time: 55895 [44063.882530] WARNING: CPU: 1 PID: 10887 at kernel/power/suspend_test.c:55 suspend_test_finish+0x6b/0x70 [44063.882531] Modules linked in: vfat fat rfcomm fuse xt_CHECKSUM ipt_MASQUERADE tun bridge stp llc devlink nf_conntrack_netbios_ns nf_conntrack_broadcast xt_CT ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 xt_conntrack ebtable_nat ip6table_nat nf_nat_ipv6 ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_nat_ipv4 nf_nat iptable_mangle iptable_raw iptable_security nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nfnetlink ebtable_filter ebtables ip6table_filter ip6_tables cmac bnep sunrpc nls_utf8 hfsplus joydev iTCO_wdt iTCO_vendor_support intel_rapl x86_pkg_temp_thermal btusb intel_powerclamp applesmc btrtl input_polldev brcmfmac btbcm coretemp btintel bluetooth kvm_intel brcmutil snd_hda_codec_cirrus snd_hda_codec_generic snd_hda_codec_hdmi intel_cstate snd_hda_intel intel_uncore cfg80211 snd_hda_codec ecdh_generic intel_rapl_perf snd_hda_core snd_hwdep bcm5974 snd_seq snd_seq_device snd_pcm mmc_core rfkill thunderbolt snd_timer snd mei_me mei soundcore i2c_i801 intel_pch_thermal [44063.882614] lpc_ich sbs acpi_als kfifo_buf sbshc industrialio apple_gmux pcc_cpufreq apple_bl binfmt_misc xfs libcrc32c dm_crypt i915 kvmgt mdev vfio kvm irqbypass i2c_algo_bit drm_kms_helper crct10dif_pclmul crc32_pclmul crc32c_intel drm uas ghash_clmulni_intel usb_storage video hid_apple [44063.882648] CPU: 1 PID: 10887 Comm: systemd-sleep Not tainted 4.20.7-200.ivan3.fc29.x86_64 #1 [44063.882651] Hardware name: Apple Inc. MacBookPro11,4/Mac-06F11FD93F0323C5, BIOS MBP114.88Z.0184.B00.1806051659 06/05/2018 [44063.882656] RIP: 0010:suspend_test_finish+0x6b/0x70 [44063.882660] Code: 06 69 c2 e8 03 00 00 29 c1 e8 df a3 00 00 81 fd 10 27 00 00 77 03 5b 5d c3 89 ea 48 89 de 48 c7 c7 e9 bb 0c b3 e8 1f 56 fa ff <0f> 0b eb e8 90 0f 1f 44 00 00 0f b6 05 49 e5 88 01 c3 0f 1f 00 0f [44063.882663] RSP: :bad682b0fd30 EFLAGS: 00010286 [44063.882666] RAX: RBX: b30cb9c2 RCX: 0006 [44063.882669] RDX: 0007 RSI: 0082 RDI: 8f70af0568c0 [44063.882671] RBP: da57 R08: 0002 R09: 000207c0 [44063.882674] R10: 002394f2f376 R11: 0001cd94 R12: [44063.882676] R13: b3254210 R14: R15: bad682b0fd60 [44063.882681] FS: 7fd487426940() GS:8f70af04() knlGS: [44063.882683] CS: 0010 DS: ES: CR0: 80050033 [44063.882686] CR2: CR3: 0003fcc92002 CR4: 001606e0 [44063.882688] Call Trace: [44063.882699] suspend_devices_and_enter+0x248/0x7f0 [44063.882706] pm_suspend.cold.5+0x33c/0x392 [44063.882711] state_store+0x80/0xe0 [44063.882718] kernfs_fop_write+0x116/0x190 [44063.882728] __vfs_write+0x36/0x1a0 [44063.882736] ? selinux_file_permission+0xf0/0x130 [44063.882745] ? security_file_permission+0x2c/0xb0 [44063.882751] vfs_write+0xa5/0x1a0 [44063.882758] ksys_write+0x4f/0xb0 [44063.882767] do_syscall_64+0x5b/0x160 [44063.882776] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [44063.882781] RIP: 0033:0x7fd48816dff8 [44063.882785] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 25 77 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55 [44063.882788] RSP: 002b:0
[RFC PATCH 0/2] Fix for the internal card reader and suspend on MacBooks
Hi all, There is a known problem on some MacBooks: internal card reader disappears after the first suspend/resume and all subsequent attempts to suspend laptop are failing. This was reported[1][2] and even discussed in the mailing lists[3], without any real solution. After trying various things[4], including some existing quirks, I discovered that switching link state to DISABLED before suspend both fixes the card reader device and allows any subsequent suspend to succeed. First patch adds code for this new quirk, and second patch enables this quirk for card reader device which is used in my macbook. I'm not really familiar with either USB standards or kernel code to support them, so this patch series is RFC. I'm especially unsure with the "resume" part, because I implemented it by trial and error mostly. However, I'm using kernel with these patches and it works for me. Also, feel free to suggest other kernel patches or existing quirks or quirk combinations to fix the same problem. Oh, and by the way: I've checked schematics of various macbooks available on the internet. It seems that the actual chip is Genesys Logic GL3219, probably just with the custom ID. What I found curious, is that USB 2.0 pins of this chip (D+ and D-) are not really connected anywhere, but instead shorted through the resistor. Could it be possible that this somehow messes up some logic inside the device, host controller or linux kernel? [1] https://bugzilla.kernel.org/show_bug.cgi?id=111201 [2] https://bugzilla.kernel.org/show_bug.cgi?id=202509 [3] https://www.spinics.net/lists/linux-usb/msg164261.html [4] https://github.com/im-0/investigate-card-reader-suspend-problem-on-mbp11.4 Ivan Mironov (2): usb: core: Add support of disabling SS link before system suspend usb: quirks: Add quirk to fix card reader and suspend on MacBooks drivers/usb/core/driver.c | 6 +++ drivers/usb/core/hub.c | 84 -- drivers/usb/core/quirks.c | 7 include/linux/usb.h| 3 ++ include/linux/usb/quirks.h | 9 5 files changed, 105 insertions(+), 4 deletions(-) -- 2.20.1