Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp11045628ybl; Fri, 27 Dec 2019 06:48:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyOgFBZdoLwzbMCrEsHvsh1UVcFU2QAWoZW0fmRHpQ/vByRkf+6FStRG3w7np7jDCUpm1Qx X-Received: by 2002:a05:6830:18e9:: with SMTP id d9mr47958855otf.332.1577458130375; Fri, 27 Dec 2019 06:48:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577458130; cv=none; d=google.com; s=arc-20160816; b=vuIKjnV8c35TJsZFDD7V9T/pFNkCvCPIn/sSW5rJeBRetNryfhKEm1RC3j8bSxnDSw rugfNHXoqz7Q8u1mFNKTNv89p6zRAmWYjO+OuWfrlQbAuK7TSR5AvKNGEmrAknpnvsl3 hbNaEWRHNJievwhKwnCvgGy1nhX0cgQ/RTDmKHqs2XHq6oKufGAn+iKsOE0xJ1H3UxGq 5oRRnAJJ3E+tfIRsmt9vTtA/m43nMCg4F/s5pxLmBnd7u6teSDr0Kx1xrPabsHYMN7FA PHkgnHzuhcrPis3G17wIFLh5DeMKEaa/EyRVDXtCzt4ebY+OHO5mWpJPwQED4V4aFJiy /Ozw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=smcvYOnXK6LPiCeqb7dw4z0DlqPaTsJgTC4SqdP8ZsA=; b=BfnZFhatflBhXhFWnH69DcQbz8XvGeW2E4UAn1ypNFvUYTano2rm6GoP9NoKgXxgFs XsWEXUSwfJMkKEnkOyufA8fRIe/U1+hFZdBoVpuIEI2obInTNTZzYBJzVh7pbtnW/pTt zHhnwe/qNCREaWEbI80inZTQlXDSsCNvN4zwqadiAHuLn3kka1O1hTHIzZDDl6b5xAp8 j6vuDZn1USp83mbPuIJEnJCKBcOo/pVPH78BGeVkdhdt49WndCscjRoS5sCg6/stK91h Nsn/IjJAy7I5ax3m8L/wSxHqrvOq3e7bX4dloEYZtF0bp8Aqhe8YN7NiBhBdLV9ref2m ZvZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12si17205384otq.156.2019.12.27.06.48.36; Fri, 27 Dec 2019 06:48:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727005AbfL0Or0 (ORCPT + 99 others); Fri, 27 Dec 2019 09:47:26 -0500 Received: from netrider.rowland.org ([192.131.102.5]:44793 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726935AbfL0Or0 (ORCPT ); Fri, 27 Dec 2019 09:47:26 -0500 Received: (qmail 5815 invoked by uid 500); 27 Dec 2019 09:47:25 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 27 Dec 2019 09:47:25 -0500 Date: Fri, 27 Dec 2019 09:47:25 -0500 (EST) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: Peter Chen cc: Guenter Roeck , Peter Chen , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Michael Grzeschik , "stable@vger.kernel.org" Subject: Re: [PATCH] usb: chipidea: host: Disable port power only if previously enabled In-Reply-To: <20191227014459.GA5283@b29397-desktop> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 27 Dec 2019, Peter Chen wrote: > On 19-12-26 14:46:15, Alan Stern wrote: > > On Thu, 26 Dec 2019, Guenter Roeck wrote: > > > > > On shutdown, ehci_power_off() is called unconditionally to power off > > > each port, even if it was never called to power on the port. > > > For chipidea, this results in a call to ehci_ci_portpower() with a request > > > to power off ports even if the port was never powered on. > > > This results in the following warning from the regulator code. > > > > That's weird -- we should always power-on every port during hub > > initialization. > > > > It looks like there's a bug in hub.c:hub_activate(): The line under > > HUB_INIT which calls hub_power_on() should call > > usb_hub_set_port_power() instead. In fact, the comment near the start > > of hub_power_on() is wrong. It says "Enable power on each port", but > > in fact it only enables power for ports that had been powered-on > > previously (i.e., the port's bit in hub->power_bits was set). > > Apparently this got messed up in commit ad493e5e5805 ("usb: add usb > > port auto power off mechanism"). > > > > Now, the chipidea driver may still need to be updated, because > > ehci_turn_off_all_ports() will still be called during shutdown and it > > will try to power-down all ports, even those which are already powered > > down (for example, because the port is suspended). > > > > Hi Alan, > > When the port is suspended, why it was turned off? If it was turned > off, how could respond wakeup event? You're right; if a port is powered off then it can't respond to wakeup events. But if the power/wakeup attribute is set to "disabled" then the port doesn't need to respond to wakeup events. In that situation, usbcore may decide to power-down the port. Alan Stern