All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: xhci: skip re-check pending port event if hibernated
@ 2021-12-09  7:22 ` Chunfeng Yun
  0 siblings, 0 replies; 18+ messages in thread
From: Chunfeng Yun @ 2021-12-09  7:22 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Eddie Hung,
	Yun-Chien Yu

When xHCI controller hibernated, the root hub lost power, if controller
support Port Power Control (PPC), PP is not set at xhci_resume() and
set by hub_reset_resume() later, so no need check pending port event.
If PPC is not supported, device is disconneced, seems do not send out
U3 LFPS wake signal, no need re-check again and drop 120ms delay to
save resume time.

Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 902f410874e8..686d8e6f03f6 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1235,7 +1235,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 		 * the first wake signalling failed, give it that chance.
 		 */
 		pending_portevent = xhci_pending_portevent(xhci);
-		if (!pending_portevent) {
+		if (!pending_portevent && !hibernated) {
 			msleep(120);
 			pending_portevent = xhci_pending_portevent(xhci);
 		}
-- 
2.18.0


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

* [PATCH] usb: xhci: skip re-check pending port event if hibernated
@ 2021-12-09  7:22 ` Chunfeng Yun
  0 siblings, 0 replies; 18+ messages in thread
From: Chunfeng Yun @ 2021-12-09  7:22 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Eddie Hung,
	Yun-Chien Yu

When xHCI controller hibernated, the root hub lost power, if controller
support Port Power Control (PPC), PP is not set at xhci_resume() and
set by hub_reset_resume() later, so no need check pending port event.
If PPC is not supported, device is disconneced, seems do not send out
U3 LFPS wake signal, no need re-check again and drop 120ms delay to
save resume time.

Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 902f410874e8..686d8e6f03f6 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1235,7 +1235,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 		 * the first wake signalling failed, give it that chance.
 		 */
 		pending_portevent = xhci_pending_portevent(xhci);
-		if (!pending_portevent) {
+		if (!pending_portevent && !hibernated) {
 			msleep(120);
 			pending_portevent = xhci_pending_portevent(xhci);
 		}
-- 
2.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH] usb: xhci: skip re-check pending port event if hibernated
@ 2021-12-09  7:22 ` Chunfeng Yun
  0 siblings, 0 replies; 18+ messages in thread
From: Chunfeng Yun @ 2021-12-09  7:22 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Eddie Hung,
	Yun-Chien Yu

When xHCI controller hibernated, the root hub lost power, if controller
support Port Power Control (PPC), PP is not set at xhci_resume() and
set by hub_reset_resume() later, so no need check pending port event.
If PPC is not supported, device is disconneced, seems do not send out
U3 LFPS wake signal, no need re-check again and drop 120ms delay to
save resume time.

Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 902f410874e8..686d8e6f03f6 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1235,7 +1235,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 		 * the first wake signalling failed, give it that chance.
 		 */
 		pending_portevent = xhci_pending_portevent(xhci);
-		if (!pending_portevent) {
+		if (!pending_portevent && !hibernated) {
 			msleep(120);
 			pending_portevent = xhci_pending_portevent(xhci);
 		}
-- 
2.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
  2021-12-09  7:22 ` Chunfeng Yun
  (?)
@ 2021-12-10 13:33   ` Mathias Nyman
  -1 siblings, 0 replies; 18+ messages in thread
From: Mathias Nyman @ 2021-12-10 13:33 UTC (permalink / raw)
  To: Chunfeng Yun, Mathias Nyman
  Cc: Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Eddie Hung,
	Yun-Chien Yu

On 9.12.2021 9.22, Chunfeng Yun wrote:
> When xHCI controller hibernated, the root hub lost power, if controller
> support Port Power Control (PPC), PP is not set at xhci_resume() and
> set by hub_reset_resume() later, so no need check pending port event.
> If PPC is not supported, device is disconneced, seems do not send out
> U3 LFPS wake signal, no need re-check again and drop 120ms delay to
> save resume time.
> 
> Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---

Thanks, adding

-Mathias

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
@ 2021-12-10 13:33   ` Mathias Nyman
  0 siblings, 0 replies; 18+ messages in thread
From: Mathias Nyman @ 2021-12-10 13:33 UTC (permalink / raw)
  To: Chunfeng Yun, Mathias Nyman
  Cc: Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Eddie Hung,
	Yun-Chien Yu

On 9.12.2021 9.22, Chunfeng Yun wrote:
> When xHCI controller hibernated, the root hub lost power, if controller
> support Port Power Control (PPC), PP is not set at xhci_resume() and
> set by hub_reset_resume() later, so no need check pending port event.
> If PPC is not supported, device is disconneced, seems do not send out
> U3 LFPS wake signal, no need re-check again and drop 120ms delay to
> save resume time.
> 
> Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---

Thanks, adding

-Mathias

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
@ 2021-12-10 13:33   ` Mathias Nyman
  0 siblings, 0 replies; 18+ messages in thread
From: Mathias Nyman @ 2021-12-10 13:33 UTC (permalink / raw)
  To: Chunfeng Yun, Mathias Nyman
  Cc: Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, linux-kernel, Eddie Hung,
	Yun-Chien Yu

On 9.12.2021 9.22, Chunfeng Yun wrote:
> When xHCI controller hibernated, the root hub lost power, if controller
> support Port Power Control (PPC), PP is not set at xhci_resume() and
> set by hub_reset_resume() later, so no need check pending port event.
> If PPC is not supported, device is disconneced, seems do not send out
> U3 LFPS wake signal, no need re-check again and drop 120ms delay to
> save resume time.
> 
> Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---

Thanks, adding

-Mathias

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
  2021-12-10 13:33   ` Mathias Nyman
  (?)
@ 2021-12-14  8:00     ` Jun Li
  -1 siblings, 0 replies; 18+ messages in thread
From: Jun Li @ 2021-12-14  8:00 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Mathias Nyman, Greg Kroah-Hartman,
	Matthias Brugger, Linux USB List, linux-arm-kernel,
	linux-mediatek, lkml, Eddie Hung, Yun-Chien Yu

Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月11日周六 01:56写道:
>
> On 9.12.2021 9.22, Chunfeng Yun wrote:
> > When xHCI controller hibernated, the root hub lost power, if controller
> > support Port Power Control (PPC), PP is not set at xhci_resume() and
> > set by hub_reset_resume() later, so no need check pending port event.
> > If PPC is not supported, device is disconneced, seems do not send out
> > U3 LFPS wake signal, no need re-check again and drop 120ms delay to
> > save resume time.
> >
> > Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
>
> Thanks, adding

Hi Mathias, Chunfeng

I have a question on this, if there is no any usb devices connected
before suspend, do we need this 120ms delay to check again?
So do we need one more condition to limit this like?
if (!pending_portevent && !hibernated && xhci_has_child_device())

thanks
Li Jun
>
> -Mathias

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
@ 2021-12-14  8:00     ` Jun Li
  0 siblings, 0 replies; 18+ messages in thread
From: Jun Li @ 2021-12-14  8:00 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Mathias Nyman, Greg Kroah-Hartman,
	Matthias Brugger, Linux USB List, linux-arm-kernel,
	linux-mediatek, lkml, Eddie Hung, Yun-Chien Yu

Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月11日周六 01:56写道:
>
> On 9.12.2021 9.22, Chunfeng Yun wrote:
> > When xHCI controller hibernated, the root hub lost power, if controller
> > support Port Power Control (PPC), PP is not set at xhci_resume() and
> > set by hub_reset_resume() later, so no need check pending port event.
> > If PPC is not supported, device is disconneced, seems do not send out
> > U3 LFPS wake signal, no need re-check again and drop 120ms delay to
> > save resume time.
> >
> > Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
>
> Thanks, adding

Hi Mathias, Chunfeng

I have a question on this, if there is no any usb devices connected
before suspend, do we need this 120ms delay to check again?
So do we need one more condition to limit this like?
if (!pending_portevent && !hibernated && xhci_has_child_device())

thanks
Li Jun
>
> -Mathias

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
@ 2021-12-14  8:00     ` Jun Li
  0 siblings, 0 replies; 18+ messages in thread
From: Jun Li @ 2021-12-14  8:00 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Mathias Nyman, Greg Kroah-Hartman,
	Matthias Brugger, Linux USB List, linux-arm-kernel,
	linux-mediatek, lkml, Eddie Hung, Yun-Chien Yu

Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月11日周六 01:56写道:
>
> On 9.12.2021 9.22, Chunfeng Yun wrote:
> > When xHCI controller hibernated, the root hub lost power, if controller
> > support Port Power Control (PPC), PP is not set at xhci_resume() and
> > set by hub_reset_resume() later, so no need check pending port event.
> > If PPC is not supported, device is disconneced, seems do not send out
> > U3 LFPS wake signal, no need re-check again and drop 120ms delay to
> > save resume time.
> >
> > Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
>
> Thanks, adding

Hi Mathias, Chunfeng

I have a question on this, if there is no any usb devices connected
before suspend, do we need this 120ms delay to check again?
So do we need one more condition to limit this like?
if (!pending_portevent && !hibernated && xhci_has_child_device())

thanks
Li Jun
>
> -Mathias

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
  2021-12-14  8:00     ` Jun Li
  (?)
@ 2021-12-14 10:05       ` Mathias Nyman
  -1 siblings, 0 replies; 18+ messages in thread
From: Mathias Nyman @ 2021-12-14 10:05 UTC (permalink / raw)
  To: Jun Li
  Cc: Chunfeng Yun, Mathias Nyman, Greg Kroah-Hartman,
	Matthias Brugger, Linux USB List, linux-arm-kernel,
	linux-mediatek, lkml, Eddie Hung, Yun-Chien Yu

On 14.12.2021 10.00, Jun Li wrote:
> Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月11日周六 01:56写道:
>>
>> On 9.12.2021 9.22, Chunfeng Yun wrote:
>>> When xHCI controller hibernated, the root hub lost power, if controller
>>> support Port Power Control (PPC), PP is not set at xhci_resume() and
>>> set by hub_reset_resume() later, so no need check pending port event.
>>> If PPC is not supported, device is disconneced, seems do not send out
>>> U3 LFPS wake signal, no need re-check again and drop 120ms delay to
>>> save resume time.
>>>
>>> Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
>>> ---
>>
>> Thanks, adding
> 
> Hi Mathias, Chunfeng
> 
> I have a question on this, if there is no any usb devices connected
> before suspend, do we need this 120ms delay to check again?
> So do we need one more condition to limit this like?
> if (!pending_portevent && !hibernated && xhci_has_child_device())

The 120ms delay was added to make sure we catch the second wake signal
from a device in case host missed the first U3 exit LFPS wakeup signal.

Even if no devices are connected this might be helpful if a device is
connected while host is suspended.
I haven't checked any timing for the link training during enumeration,
but it also uses LFPS signalling, and connected device isn't visible to
driver until link is successfully trained.

So the original 120ms delay patch might as a positive side effect ensure
driver doesn't suspend host mid device enumeration.

Could be looked into more, but I don't think we should this patch by
Chunfeng

Thanks
Mathias

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
@ 2021-12-14 10:05       ` Mathias Nyman
  0 siblings, 0 replies; 18+ messages in thread
From: Mathias Nyman @ 2021-12-14 10:05 UTC (permalink / raw)
  To: Jun Li
  Cc: Chunfeng Yun, Mathias Nyman, Greg Kroah-Hartman,
	Matthias Brugger, Linux USB List, linux-arm-kernel,
	linux-mediatek, lkml, Eddie Hung, Yun-Chien Yu

On 14.12.2021 10.00, Jun Li wrote:
> Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月11日周六 01:56写道:
>>
>> On 9.12.2021 9.22, Chunfeng Yun wrote:
>>> When xHCI controller hibernated, the root hub lost power, if controller
>>> support Port Power Control (PPC), PP is not set at xhci_resume() and
>>> set by hub_reset_resume() later, so no need check pending port event.
>>> If PPC is not supported, device is disconneced, seems do not send out
>>> U3 LFPS wake signal, no need re-check again and drop 120ms delay to
>>> save resume time.
>>>
>>> Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
>>> ---
>>
>> Thanks, adding
> 
> Hi Mathias, Chunfeng
> 
> I have a question on this, if there is no any usb devices connected
> before suspend, do we need this 120ms delay to check again?
> So do we need one more condition to limit this like?
> if (!pending_portevent && !hibernated && xhci_has_child_device())

The 120ms delay was added to make sure we catch the second wake signal
from a device in case host missed the first U3 exit LFPS wakeup signal.

Even if no devices are connected this might be helpful if a device is
connected while host is suspended.
I haven't checked any timing for the link training during enumeration,
but it also uses LFPS signalling, and connected device isn't visible to
driver until link is successfully trained.

So the original 120ms delay patch might as a positive side effect ensure
driver doesn't suspend host mid device enumeration.

Could be looked into more, but I don't think we should this patch by
Chunfeng

Thanks
Mathias

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
@ 2021-12-14 10:05       ` Mathias Nyman
  0 siblings, 0 replies; 18+ messages in thread
From: Mathias Nyman @ 2021-12-14 10:05 UTC (permalink / raw)
  To: Jun Li
  Cc: Chunfeng Yun, Mathias Nyman, Greg Kroah-Hartman,
	Matthias Brugger, Linux USB List, linux-arm-kernel,
	linux-mediatek, lkml, Eddie Hung, Yun-Chien Yu

On 14.12.2021 10.00, Jun Li wrote:
> Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月11日周六 01:56写道:
>>
>> On 9.12.2021 9.22, Chunfeng Yun wrote:
>>> When xHCI controller hibernated, the root hub lost power, if controller
>>> support Port Power Control (PPC), PP is not set at xhci_resume() and
>>> set by hub_reset_resume() later, so no need check pending port event.
>>> If PPC is not supported, device is disconneced, seems do not send out
>>> U3 LFPS wake signal, no need re-check again and drop 120ms delay to
>>> save resume time.
>>>
>>> Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
>>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
>>> ---
>>
>> Thanks, adding
> 
> Hi Mathias, Chunfeng
> 
> I have a question on this, if there is no any usb devices connected
> before suspend, do we need this 120ms delay to check again?
> So do we need one more condition to limit this like?
> if (!pending_portevent && !hibernated && xhci_has_child_device())

The 120ms delay was added to make sure we catch the second wake signal
from a device in case host missed the first U3 exit LFPS wakeup signal.

Even if no devices are connected this might be helpful if a device is
connected while host is suspended.
I haven't checked any timing for the link training during enumeration,
but it also uses LFPS signalling, and connected device isn't visible to
driver until link is successfully trained.

So the original 120ms delay patch might as a positive side effect ensure
driver doesn't suspend host mid device enumeration.

Could be looked into more, but I don't think we should this patch by
Chunfeng

Thanks
Mathias

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
  2021-12-14 10:05       ` Mathias Nyman
  (?)
@ 2021-12-15  2:09         ` Jun Li
  -1 siblings, 0 replies; 18+ messages in thread
From: Jun Li @ 2021-12-15  2:09 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Mathias Nyman, Greg Kroah-Hartman,
	Matthias Brugger, Linux USB List, linux-arm-kernel,
	linux-mediatek, lkml, Eddie Hung, Yun-Chien Yu

Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月14日周二 18:03写道:
>
> On 14.12.2021 10.00, Jun Li wrote:
> > Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月11日周六 01:56写道:
> >>
> >> On 9.12.2021 9.22, Chunfeng Yun wrote:
> >>> When xHCI controller hibernated, the root hub lost power, if controller
> >>> support Port Power Control (PPC), PP is not set at xhci_resume() and
> >>> set by hub_reset_resume() later, so no need check pending port event.
> >>> If PPC is not supported, device is disconneced, seems do not send out
> >>> U3 LFPS wake signal, no need re-check again and drop 120ms delay to
> >>> save resume time.
> >>>
> >>> Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
> >>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> >>> ---
> >>
> >> Thanks, adding
> >
> > Hi Mathias, Chunfeng
> >
> > I have a question on this, if there is no any usb devices connected
> > before suspend, do we need this 120ms delay to check again?
> > So do we need one more condition to limit this like?
> > if (!pending_portevent && !hibernated && xhci_has_child_device())
>
> The 120ms delay was added to make sure we catch the second wake signal
> from a device in case host missed the first U3 exit LFPS wakeup signal.
>
> Even if no devices are connected this might be helpful if a device is
> connected while host is suspended.

Agree this may also help on this case.

> I haven't checked any timing for the link training during enumeration,
> but it also uses LFPS signalling, and connected device isn't visible to
> driver until link is successfully trained.
>
> So the original 120ms delay patch might as a positive side effect ensure
> driver doesn't suspend host mid device enumeration.

Is this unexpected suspend can be prevented by adding auto suspend
delay?

Thanks
Li Jun
>
> Could be looked into more, but I don't think we should this patch by
> Chunfeng
>
> Thanks
> Mathias

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
@ 2021-12-15  2:09         ` Jun Li
  0 siblings, 0 replies; 18+ messages in thread
From: Jun Li @ 2021-12-15  2:09 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Mathias Nyman, Greg Kroah-Hartman,
	Matthias Brugger, Linux USB List, linux-arm-kernel,
	linux-mediatek, lkml, Eddie Hung, Yun-Chien Yu

Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月14日周二 18:03写道:
>
> On 14.12.2021 10.00, Jun Li wrote:
> > Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月11日周六 01:56写道:
> >>
> >> On 9.12.2021 9.22, Chunfeng Yun wrote:
> >>> When xHCI controller hibernated, the root hub lost power, if controller
> >>> support Port Power Control (PPC), PP is not set at xhci_resume() and
> >>> set by hub_reset_resume() later, so no need check pending port event.
> >>> If PPC is not supported, device is disconneced, seems do not send out
> >>> U3 LFPS wake signal, no need re-check again and drop 120ms delay to
> >>> save resume time.
> >>>
> >>> Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
> >>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> >>> ---
> >>
> >> Thanks, adding
> >
> > Hi Mathias, Chunfeng
> >
> > I have a question on this, if there is no any usb devices connected
> > before suspend, do we need this 120ms delay to check again?
> > So do we need one more condition to limit this like?
> > if (!pending_portevent && !hibernated && xhci_has_child_device())
>
> The 120ms delay was added to make sure we catch the second wake signal
> from a device in case host missed the first U3 exit LFPS wakeup signal.
>
> Even if no devices are connected this might be helpful if a device is
> connected while host is suspended.

Agree this may also help on this case.

> I haven't checked any timing for the link training during enumeration,
> but it also uses LFPS signalling, and connected device isn't visible to
> driver until link is successfully trained.
>
> So the original 120ms delay patch might as a positive side effect ensure
> driver doesn't suspend host mid device enumeration.

Is this unexpected suspend can be prevented by adding auto suspend
delay?

Thanks
Li Jun
>
> Could be looked into more, but I don't think we should this patch by
> Chunfeng
>
> Thanks
> Mathias

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
@ 2021-12-15  2:09         ` Jun Li
  0 siblings, 0 replies; 18+ messages in thread
From: Jun Li @ 2021-12-15  2:09 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Chunfeng Yun, Mathias Nyman, Greg Kroah-Hartman,
	Matthias Brugger, Linux USB List, linux-arm-kernel,
	linux-mediatek, lkml, Eddie Hung, Yun-Chien Yu

Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月14日周二 18:03写道:
>
> On 14.12.2021 10.00, Jun Li wrote:
> > Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月11日周六 01:56写道:
> >>
> >> On 9.12.2021 9.22, Chunfeng Yun wrote:
> >>> When xHCI controller hibernated, the root hub lost power, if controller
> >>> support Port Power Control (PPC), PP is not set at xhci_resume() and
> >>> set by hub_reset_resume() later, so no need check pending port event.
> >>> If PPC is not supported, device is disconneced, seems do not send out
> >>> U3 LFPS wake signal, no need re-check again and drop 120ms delay to
> >>> save resume time.
> >>>
> >>> Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
> >>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> >>> ---
> >>
> >> Thanks, adding
> >
> > Hi Mathias, Chunfeng
> >
> > I have a question on this, if there is no any usb devices connected
> > before suspend, do we need this 120ms delay to check again?
> > So do we need one more condition to limit this like?
> > if (!pending_portevent && !hibernated && xhci_has_child_device())
>
> The 120ms delay was added to make sure we catch the second wake signal
> from a device in case host missed the first U3 exit LFPS wakeup signal.
>
> Even if no devices are connected this might be helpful if a device is
> connected while host is suspended.

Agree this may also help on this case.

> I haven't checked any timing for the link training during enumeration,
> but it also uses LFPS signalling, and connected device isn't visible to
> driver until link is successfully trained.
>
> So the original 120ms delay patch might as a positive side effect ensure
> driver doesn't suspend host mid device enumeration.

Is this unexpected suspend can be prevented by adding auto suspend
delay?

Thanks
Li Jun
>
> Could be looked into more, but I don't think we should this patch by
> Chunfeng
>
> Thanks
> Mathias

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
  2021-12-14 10:05       ` Mathias Nyman
  (?)
@ 2021-12-17  9:40         ` Chunfeng Yun
  -1 siblings, 0 replies; 18+ messages in thread
From: Chunfeng Yun @ 2021-12-17  9:40 UTC (permalink / raw)
  To: Mathias Nyman, Jun Li
  Cc: Mathias Nyman, Greg Kroah-Hartman, Matthias Brugger,
	Linux USB List, linux-arm-kernel, linux-mediatek, lkml,
	Eddie Hung, Yun-Chien Yu

On Tue, 2021-12-14 at 12:05 +0200, Mathias Nyman wrote:
> On 14.12.2021 10.00, Jun Li wrote:
> > Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月11日周六
> > 01:56写道:
> > > 
> > > On 9.12.2021 9.22, Chunfeng Yun wrote:
> > > > When xHCI controller hibernated, the root hub lost power, if
> > > > controller
> > > > support Port Power Control (PPC), PP is not set at
> > > > xhci_resume() and
> > > > set by hub_reset_resume() later, so no need check pending port
> > > > event.
> > > > If PPC is not supported, device is disconneced, seems do not
> > > > send out
> > > > U3 LFPS wake signal, no need re-check again and drop 120ms
> > > > delay to
> > > > save resume time.
> > > > 
> > > > Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
> > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > > ---
> > > 
> > > Thanks, adding
> > 
> > Hi Mathias, Chunfeng
> > 
> > I have a question on this, if there is no any usb devices connected
> > before suspend, do we need this 120ms delay to check again?
> > So do we need one more condition to limit this like?
> > if (!pending_portevent && !hibernated && xhci_has_child_device())
> 
> The 120ms delay was added to make sure we catch the second wake
> signal
> from a device in case host missed the first U3 exit LFPS wakeup
> signal.
> 
> Even if no devices are connected this might be helpful if a device is
> connected while host is suspended.
> I haven't checked any timing for the link training during
> enumeration,
> but it also uses LFPS signalling, and connected device isn't visible
> to
> driver until link is successfully trained.
For xhci-mtk, roothub can't detect device until root hub set PortPower,
seems also the same for other xhci controllers that support Port Power
Control.
> 
> So the original 120ms delay patch might as a positive side effect
> ensure
> driver doesn't suspend host mid device enumeration.
this is in resume?

> 
> Could be looked into more, but I don't think we should this patch by
> Chunfeng
> 
> Thanks
> Mathias

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
@ 2021-12-17  9:40         ` Chunfeng Yun
  0 siblings, 0 replies; 18+ messages in thread
From: Chunfeng Yun @ 2021-12-17  9:40 UTC (permalink / raw)
  To: Mathias Nyman, Jun Li
  Cc: Mathias Nyman, Greg Kroah-Hartman, Matthias Brugger,
	Linux USB List, linux-arm-kernel, linux-mediatek, lkml,
	Eddie Hung, Yun-Chien Yu

On Tue, 2021-12-14 at 12:05 +0200, Mathias Nyman wrote:
> On 14.12.2021 10.00, Jun Li wrote:
> > Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月11日周六
> > 01:56写道:
> > > 
> > > On 9.12.2021 9.22, Chunfeng Yun wrote:
> > > > When xHCI controller hibernated, the root hub lost power, if
> > > > controller
> > > > support Port Power Control (PPC), PP is not set at
> > > > xhci_resume() and
> > > > set by hub_reset_resume() later, so no need check pending port
> > > > event.
> > > > If PPC is not supported, device is disconneced, seems do not
> > > > send out
> > > > U3 LFPS wake signal, no need re-check again and drop 120ms
> > > > delay to
> > > > save resume time.
> > > > 
> > > > Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
> > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > > ---
> > > 
> > > Thanks, adding
> > 
> > Hi Mathias, Chunfeng
> > 
> > I have a question on this, if there is no any usb devices connected
> > before suspend, do we need this 120ms delay to check again?
> > So do we need one more condition to limit this like?
> > if (!pending_portevent && !hibernated && xhci_has_child_device())
> 
> The 120ms delay was added to make sure we catch the second wake
> signal
> from a device in case host missed the first U3 exit LFPS wakeup
> signal.
> 
> Even if no devices are connected this might be helpful if a device is
> connected while host is suspended.
> I haven't checked any timing for the link training during
> enumeration,
> but it also uses LFPS signalling, and connected device isn't visible
> to
> driver until link is successfully trained.
For xhci-mtk, roothub can't detect device until root hub set PortPower,
seems also the same for other xhci controllers that support Port Power
Control.
> 
> So the original 120ms delay patch might as a positive side effect
> ensure
> driver doesn't suspend host mid device enumeration.
this is in resume?

> 
> Could be looked into more, but I don't think we should this patch by
> Chunfeng
> 
> Thanks
> Mathias
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH] usb: xhci: skip re-check pending port event if hibernated
@ 2021-12-17  9:40         ` Chunfeng Yun
  0 siblings, 0 replies; 18+ messages in thread
From: Chunfeng Yun @ 2021-12-17  9:40 UTC (permalink / raw)
  To: Mathias Nyman, Jun Li
  Cc: Mathias Nyman, Greg Kroah-Hartman, Matthias Brugger,
	Linux USB List, linux-arm-kernel, linux-mediatek, lkml,
	Eddie Hung, Yun-Chien Yu

On Tue, 2021-12-14 at 12:05 +0200, Mathias Nyman wrote:
> On 14.12.2021 10.00, Jun Li wrote:
> > Mathias Nyman <mathias.nyman@linux.intel.com> 于2021年12月11日周六
> > 01:56写道:
> > > 
> > > On 9.12.2021 9.22, Chunfeng Yun wrote:
> > > > When xHCI controller hibernated, the root hub lost power, if
> > > > controller
> > > > support Port Power Control (PPC), PP is not set at
> > > > xhci_resume() and
> > > > set by hub_reset_resume() later, so no need check pending port
> > > > event.
> > > > If PPC is not supported, device is disconneced, seems do not
> > > > send out
> > > > U3 LFPS wake signal, no need re-check again and drop 120ms
> > > > delay to
> > > > save resume time.
> > > > 
> > > > Reported-by: Yun-Chien Yu <yun-chien.yu@mediatek.com>
> > > > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > > > ---
> > > 
> > > Thanks, adding
> > 
> > Hi Mathias, Chunfeng
> > 
> > I have a question on this, if there is no any usb devices connected
> > before suspend, do we need this 120ms delay to check again?
> > So do we need one more condition to limit this like?
> > if (!pending_portevent && !hibernated && xhci_has_child_device())
> 
> The 120ms delay was added to make sure we catch the second wake
> signal
> from a device in case host missed the first U3 exit LFPS wakeup
> signal.
> 
> Even if no devices are connected this might be helpful if a device is
> connected while host is suspended.
> I haven't checked any timing for the link training during
> enumeration,
> but it also uses LFPS signalling, and connected device isn't visible
> to
> driver until link is successfully trained.
For xhci-mtk, roothub can't detect device until root hub set PortPower,
seems also the same for other xhci controllers that support Port Power
Control.
> 
> So the original 120ms delay patch might as a positive side effect
> ensure
> driver doesn't suspend host mid device enumeration.
this is in resume?

> 
> Could be looked into more, but I don't think we should this patch by
> Chunfeng
> 
> Thanks
> Mathias
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-12-17  9:42 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-09  7:22 [PATCH] usb: xhci: skip re-check pending port event if hibernated Chunfeng Yun
2021-12-09  7:22 ` Chunfeng Yun
2021-12-09  7:22 ` Chunfeng Yun
2021-12-10 13:33 ` Mathias Nyman
2021-12-10 13:33   ` Mathias Nyman
2021-12-10 13:33   ` Mathias Nyman
2021-12-14  8:00   ` Jun Li
2021-12-14  8:00     ` Jun Li
2021-12-14  8:00     ` Jun Li
2021-12-14 10:05     ` Mathias Nyman
2021-12-14 10:05       ` Mathias Nyman
2021-12-14 10:05       ` Mathias Nyman
2021-12-15  2:09       ` Jun Li
2021-12-15  2:09         ` Jun Li
2021-12-15  2:09         ` Jun Li
2021-12-17  9:40       ` Chunfeng Yun
2021-12-17  9:40         ` Chunfeng Yun
2021-12-17  9:40         ` Chunfeng Yun

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.