public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Chris Chiu <chiu@endlessm.com>
Cc: mathias.nyman@intel.com, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	Linux Upstreaming Team <linux@endlessm.com>
Subject: Re: Intel GemniLake xHCI connected devices can never wake up the system from suspend
Date: Thu, 15 Mar 2018 18:11:46 +0200	[thread overview]
Message-ID: <278fe5fa-7b33-02e5-12e3-b7760952b297@linux.intel.com> (raw)
In-Reply-To: <CAB4CAwf39wW2LmuY-TZNdfgL=SBiDZuXvRNu7MD7j5Nc8O-bkg@mail.gmail.com>

On 15.03.2018 15:28, Chris Chiu wrote:
> On Thu, Mar 15, 2018 at 7:46 PM, Mathias Nyman
> <mathias.nyman@linux.intel.com> wrote:
>> On 15.03.2018 06:40, Chris Chiu wrote:
>>>
>>> Hi,
>>>       I  have a ASUS AIO V222GA and another Acer Desktop XC-830 both
>>> have Intel CPU J5005 and they both hit the same problem. The XHCI
>>> connected USB keyboard/mouse can never wakeup the system from suspend.
>>> It reminds me that similiar thing happens on ApolloLake too which
>>> needs the XHCI_PME_STUCK_QUIRK to get it work. It's also mentioned in
>>>
>>> https://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/pentium-celeron-n-series-spec-update.pdf
>>> page #14 for N-seris intel CPU. And I also find the same problem
>>> description in
>>> https://www.intel.com/content/dam/www/public/us/en/documents/product-briefs/silver-celeron-spec-update.pdf
>>> page #16 for J-series Intel CPU. Seems that they have different
>>> workaround so I can not simply apply XHCI_PME_STUCK_QUIRK to make it
>>> work.
>>>
>>>       Anyone can help here?
>>>
>>
>> N-Series
>> CHP8: USB xHCI Controller May Not Re-Enter D3 State After a USB Wake Event
>> - needs XHCI_PME_STUCK_QUIRK in driver (sets bit 28 at offset 80a4)
>>
>> Intel® Pentium® Silver N5000
>> Intel® Pentium® Silver J5005
>> Intel® Celeron® N4000 and N4100
>> Intel® Celeron® J4105 and J4005
>>
>> USB xHCI Controller May Not Re-enter a D3 State After a USB Wake Even
>> Need to clear PME_EN bit of of the standard PCI PM_CSR register.
>> I think Linux does this anyway (clears enabling PME when reaching D0)
>> So if I remember correct there was no specific workaround needed for this.
>>
>> what is the PCI ID of your xhci controller? (lspci -nn)
> 
> They're both 8086:31a8. So you mean from the workaround description, it should
> work w/o any extra code? "Software should clear bit 8 (PME_EN) of PM_CSR" has
> been handled somewhere else?
> 
>>
>> One other possible cause is that xHCI never reaches PCI device D3 suspend
>> state during system suspend.
>> xHC can't generate PME# wake event from normal running PCI device D0 state.
>>
>> PCI code in Linux will check with ACPI about the lowest possible D state
>> when suspending,
>> If there is something missing from the xHCI entry in ACPI DSDT table it
>> might select D0.
>> as the suspend state, causing wake failure.
>>
> 
> Here's the DSDT ASL of the ASUS machine.
> https://gist.github.com/mschiu77/8e9c8a0e5a98b70a6dfff45620340bf1

Scope (_SB.PCI0.XHC) has _PS0 method, so Linux will look for a _S3W to get the
lowest possible D state in S3, but_S3W is missing, so Linux pci-acpi code will
probably default to D0

> 
> 
> ASUS said the BIOS has no problem on USB wakeup under Windows so I don't think
> there's any update. Anything else could be cause for this?

Linux and Windows probably check different DSDT values

You can try to force your xHC to D3 during suspend with a hack:

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 7815768..da46c52 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -488,6 +488,10 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev)
         else
                 d_max = ACPI_STATE_D3_COLD;
         acpi_state = acpi_pm_device_sleep_state(&pdev->dev, NULL, d_max);
+
+       if (pdev->device == 0x31a8)
+               acpi_state = ACPI_STATE_D3_HOT;
+
         if (acpi_state < 0)
                 return PCI_POWER_ERROR;
  
and see if usb wake starts to work

-Mathias

  reply	other threads:[~2018-03-15 16:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-15  4:40 Intel GemniLake xHCI connected devices can never wake up the system from suspend Chris Chiu
2018-03-15 11:46 ` Mathias Nyman
2018-03-15 13:28   ` Chris Chiu
2018-03-15 16:11     ` Mathias Nyman [this message]
2018-03-16  7:47       ` Daniel Drake
2018-03-16  8:23         ` Daniel Drake
2018-03-16  9:06           ` Mathias Nyman
2018-03-18 22:36             ` Rafael J. Wysocki
2018-03-19  4:00               ` Daniel Drake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=278fe5fa-7b33-02e5-12e3-b7760952b297@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=chiu@endlessm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@endlessm.com \
    --cc=mathias.nyman@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox