From owner-freebsd-current@FreeBSD.ORG Wed Jun 18 18:46:16 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EA884739; Wed, 18 Jun 2014 18:46:15 +0000 (UTC) Received: from mail-wi0-x22c.google.com (mail-wi0-x22c.google.com [IPv6:2a00:1450:400c:c05::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 35A4E2406; Wed, 18 Jun 2014 18:46:15 +0000 (UTC) Received: by mail-wi0-f172.google.com with SMTP id hi2so8167037wib.11 for ; Wed, 18 Jun 2014 11:46:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=kkk0XT6mWFk1BQ+66T8A7RjtNYSOsFz6ot0PW440i2g=; b=yb7/w6HeGE17PoPTzBAJkHOb1ggaK1hmr/e8r/yi1i3GWDQfdya0HIzGArplLFcD0a bvR83eTD/cSJDB1xYs9thkHa+MaY+ZKqecVS4cdrw0bzOcJyTWbLC+xCSlQc/j1+RkcM 2CXgsDSr+3/ThkvOYLDj5uTbx8SH1X/DTi/ADXz01ZnF5cTOZgh6sbm/Cayl4N1hyBtu /bn0Yhb3F/7gZeKaI1pZHyTtZBDdqb2NaysjNB8J6Piz0Ang93KLseHpzCZFNBROzwMs YMBxUaSdv1OaPBBkbhll92U58389cN14WkPzwVaTgvRBGM4L7cjyKzfs/CHkEE81vAqB Fy9Q== X-Received: by 10.180.75.212 with SMTP id e20mr7669285wiw.5.1403117173453; Wed, 18 Jun 2014 11:46:13 -0700 (PDT) Received: from brick.home (aeaw214.neoplus.adsl.tpnet.pl. [79.186.22.214]) by mx.google.com with ESMTPSA id l49sm6973129eef.27.2014.06.18.11.46.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jun 2014 11:46:12 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Wed, 18 Jun 2014 20:46:09 +0200 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: John Baldwin Subject: Re: [patch] USB after second suspend/resume on ThinkPads. Message-ID: <20140618184609.GA1297@brick.home> Mail-Followup-To: John Baldwin , freebsd-current@freebsd.org, jhibbits@freebsd.org References: <20140616192155.GE13481@brick.home> <201406180947.53141.jhb@freebsd.org> <20140618161315.GA3496@brick.home> <201406181303.09834.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <201406181303.09834.jhb@freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) 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 18:46:16 -0000 On 0618T1303, John Baldwin wrote: > On Wednesday, June 18, 2014 12:13:15 pm Edward Tomasz Napierała wrote: > > On 0618T0947, John Baldwin wrote: > > > On Monday, June 16, 2014 3:21:55 pm Edward Tomasz Napierała 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. > > > > > > Good find. Have you thought about a more generic fix for this wherein you > > > track power resources and flip them on during resume in ACPI before doing > > > DEVICE_RESUME() on the root bus? > > > > 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 > =================================================================== > --- 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; > - } else if (rp->ap_state == ACPI_PWR_UNK) > + } else > rp->ap_state = cur; > > /* > @@ -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; > - } else if (rp->ap_state == ACPI_PWR_UNK) > + } else > rp->ap_state = cur; > > /* > > (We were ignoring what _STA told us and believed it was ON because we had > cached that state previously.) Works!