From owner-freebsd-current@FreeBSD.ORG Wed Jun 18 16:13:20 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 E1B84D33; Wed, 18 Jun 2014 16:13:20 +0000 (UTC) Received: from mail-wg0-x22d.google.com (mail-wg0-x22d.google.com [IPv6:2a00:1450:400c:c00::22d]) (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 2CD3D2483; Wed, 18 Jun 2014 16:13:20 +0000 (UTC) Received: by mail-wg0-f45.google.com with SMTP id l18so1109249wgh.16 for ; Wed, 18 Jun 2014 09:13:18 -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=GTGmusrEdE6vu1aRAC8HVoY2y3Pb+ca2YJQxZhnJjog=; b=0asW+3QeKpbTGg3Sw6ecqj69vLvhxZ1+6Wb5anMQRDymZLSe7vl0lRzwqhmiXrNL21 kqlz7Jcf2xf3kehSVRc9YMLfbA1PUqqxG9MF8G7a3s/Xr/a2xIZir7+yF34GO9hQVE8Y kOnZWO62Xk3i3qsijrWB3eLiSF3msRrazRRvJIA+PZnSF+S+JFVlqzTwhRU5MMh1AAA/ i5fAgsfw+1OUolQ9cIAigm+bJLjhuqksrNImYaJLdfnUfI7N+9LIMlM15kws+pT6MST9 tNfU/kre6K9lJaO9iu0kpT5TdSmqGMLLUvHLdA5tMJGMZh9o19Sxr61kAMD2g2f4JpUD wuZA== X-Received: by 10.194.110.10 with SMTP id hw10mr24724920wjb.81.1403107998466; Wed, 18 Jun 2014 09:13:18 -0700 (PDT) Received: from brick.home (adhc141.neoplus.adsl.tpnet.pl. [79.184.158.141]) by mx.google.com with ESMTPSA id v45sm6121169eeg.29.2014.06.18.09.13.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jun 2014 09:13:17 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Wed, 18 Jun 2014 18:13:15 +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: <20140618161315.GA3496@brick.home> Mail-Followup-To: John Baldwin , freebsd-current@freebsd.org, jhibbits@freebsd.org References: <20140616192155.GE13481@brick.home> <201406180947.53141.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <201406180947.53141.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 16:13:21 -0000 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: Index: sys/dev/acpica/acpi_powerres.c =================================================================== --- sys/dev/acpica/acpi_powerres.c (revision 267417) +++ sys/dev/acpica/acpi_powerres.c (working copy) @@ -653,7 +653,7 @@ acpi_pwr_switch_power(void) * effort; we don't know what to do if it fails, so checking wouldn't * help much. */ - if (rp->ap_state != ACPI_PWR_ON) { + if (rp->ap_state != ACPI_PWR_ON || 1) { status = AcpiEvaluateObject(rp->ap_resource, "_ON", NULL, NULL); if (ACPI_FAILURE(status)) { ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS,