From owner-freebsd-current@FreeBSD.ORG Wed Jun 18 08:29:10 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 E8CD2A95 for ; Wed, 18 Jun 2014 08:29:09 +0000 (UTC) Received: from graal.it-profi.org.ua (graal.shurik.kiev.ua [193.239.74.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3BCD2626 for ; Wed, 18 Jun 2014 08:29:08 +0000 (UTC) Received: from [217.76.201.82] (helo=thinkpad.it-profi.org.ua) by graal.it-profi.org.ua with esmtpa (Exim 4.82 (FreeBSD)) (envelope-from ) id 1WxAvO-000AxE-0F for freebsd-current@freebsd.org; Wed, 18 Jun 2014 11:08:54 +0300 Message-ID: <53A14910.2090303@shurik.kiev.ua> Date: Wed, 18 Jun 2014 11:08:48 +0300 From: Alexandr Krivulya User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: freebsd-current@freebsd.org Subject: Re: [patch] USB after second suspend/resume on ThinkPads. References: <20140616192155.GE13481@brick.home> In-Reply-To: <20140616192155.GE13481@brick.home> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 217.76.201.82 X-SA-Exim-Mail-From: shuriku@shurik.kiev.ua X-SA-Exim-Scanned: No (on graal.it-profi.org.ua); SAEximRunCond expanded to false 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 08:29:10 -0000 16.06.2014 22:21, Edward Tomasz Napierała пишет: > 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. > > (Btw, has anyone encountered the problem on hardware other than ThinkPads?) > > > Index: sys/dev/acpi_support/acpi_ibm.c > =================================================================== > --- sys/dev/acpi_support/acpi_ibm.c (revision 267417) > +++ sys/dev/acpi_support/acpi_ibm.c (working copy) > @@ -169,6 +169,9 @@ struct acpi_ibm_softc { > int light_get_supported; > int light_set_supported; > > + /* USB power workaround */ > + ACPI_HANDLE power_handle; > + > /* led(4) interface */ > struct cdev *led_dev; > int led_busy; > @@ -365,6 +368,7 @@ acpi_ibm_attach(device_t dev) > { > struct acpi_ibm_softc *sc; > devclass_t ec_devclass; > + ACPI_STATUS status; > > ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); > > @@ -448,6 +452,17 @@ acpi_ibm_attach(device_t dev) > if (sc->light_set_supported) > sc->led_dev = led_create_state(ibm_led, sc, "thinklight", sc->light_val); > > + /* > + * Obtain a handle to the power resource available on many models. > + * This must be turned on manually upon resume. Otherwise the system > + * may, for instance, resume from S3 with usb(4) powered down. > + */ > + status = AcpiGetHandle(sc->handle, "\\_SB.PCI0.LPC.EC.PUBS", &sc->power_handle); > + if (ACPI_FAILURE(status)) { > + device_printf(dev, "Failed to get power handle\n"); > + return (status); > + } > + > return (0); > } > > @@ -476,6 +491,7 @@ static int > acpi_ibm_resume(device_t dev) > { > struct acpi_ibm_softc *sc = device_get_softc(dev); > + ACPI_STATUS status; > > ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); > > @@ -495,6 +511,15 @@ acpi_ibm_resume(device_t dev) > > acpi_ibm_sysctl_set(sc, i, val); > } > + if (sc->power_handle != NULL) { > + status = AcpiEvaluateObject(sc->power_handle, > + "_ON", NULL, NULL); > + if (ACPI_FAILURE(status)) { > + device_printf(dev, "failed to switch %s on - %s\n", > + acpi_name(sc->power_handle), > + AcpiFormatException(status)); > + } > + } > ACPI_SERIAL_END(ibm); > > return (0); Hi. I've never seen this problem before on my ThinkPad E530. However, I have applied this patch and after reboot all sysctl oids related to acpi_ibm disappeared. root@thinkpad:/home/shurik # kldstat|grep ibm 9 1 0xffffffff82190000 77e8 acpi_ibm.ko root@thinkpad:/home/shurik # sysctl dev.acpi_ibm root@thinkpad:/home/shurik # And in dmesg I see this errors: root@thinkpad:/home/shurik # dmesg -a|grep ibm acpi_ibm0: on acpi0 acpi_ibm0: Failed to get power handle device_attach: acpi_ibm0 attach returned 5 sysctl: unknown oid 'dev.acpi_ibm.0.events' at line 22: No such file or directory sysctl: unknown oid 'dev.acpi_ibm.0.fan' at line 23: No such file or directory sysctl: unknown oid 'dev.acpi_ibm.0.bluetooth' at line 24: No such file or directory acpi_ibm0: on acpi0 #5 0xffffffff8260766c at acpi_ibm_attach+0x5bc acpi_ibm0: on acpi0 acpi_ibm0: Failed to get power handle device_attach: acpi_ibm0 attach returned 5 All Fn keys and usb ports still work fine before/after suspend/resume.