From owner-freebsd-current@FreeBSD.ORG Wed Jun 18 17:04:07 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 12183EE3; Wed, 18 Jun 2014 17:04:07 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DBBC829E9; Wed, 18 Jun 2014 17:04:06 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 67711B922; Wed, 18 Jun 2014 13:04:05 -0400 (EDT) From: John Baldwin To: Edward Tomasz =?utf-8?q?Napiera=C5=82a?= Subject: Re: [patch] USB after second suspend/resume on ThinkPads. Date: Wed, 18 Jun 2014 13:03:09 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <20140616192155.GE13481@brick.home> <201406180947.53141.jhb@freebsd.org> <20140618161315.GA3496@brick.home> In-Reply-To: <20140618161315.GA3496@brick.home> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201406181303.09834.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 18 Jun 2014 13:04:05 -0400 (EDT) Cc: jhibbits@freebsd.org, freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jun 2014 17:04:07 -0000 On Wednesday, June 18, 2014 12:13:15 pm Edward Tomasz Napiera=C5=82a wrote: > On 0618T0947, John Baldwin wrote: > > On Monday, June 16, 2014 3:21:55 pm Edward Tomasz Napiera=C5=82a wrote: > > > Hi. Patch below should fix a problem where USB stops working after > > > _second_ suspend/resume, which happens on various ThinkPad models. > > > Please test, and report both success stories and failures. If nothing > > > comes up, I'll commit it in a week or so. > >=20 > > Good find. Have you thought about a more generic fix for this wherein = you=20 > > track power resources and flip them on during resume in ACPI before doi= ng > > DEVICE_RESUME() on the root bus? >=20 > Thing is, after resume this device claims to be on already. The following > simple hack was enough to make it work: Ahh, I think I see. Try this instead: Index: sys/dev/acpica/acpi_powerres.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =2D-- acpi_powerres.c (revision 267550) +++ acpi_powerres.c (working copy) @@ -645,7 +645,7 @@ acpi_pwr_switch_power(void) acpi_name(rp->ap_resource), status)); /* XXX is this correct? Always switch if in doubt? */ continue; =2D } else if (rp->ap_state =3D=3D ACPI_PWR_UNK) + } else rp->ap_state =3D cur; =20 /* @@ -689,7 +689,7 @@ acpi_pwr_switch_power(void) acpi_name(rp->ap_resource), status)); /* XXX is this correct? Always switch if in doubt? */ continue; =2D } else if (rp->ap_state =3D=3D ACPI_PWR_UNK) + } else rp->ap_state =3D cur; =20 /* (We were ignoring what _STA told us and believed it was ON because we had cached that state previously.) =2D-=20 John Baldwin