From owner-freebsd-current@FreeBSD.ORG Mon Jun 16 19:41:31 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 EC05B1FC for ; Mon, 16 Jun 2014 19:41:30 +0000 (UTC) Received: from mail-qa0-x22c.google.com (mail-qa0-x22c.google.com [IPv6:2607:f8b0:400d:c00::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 AB7A626B6 for ; Mon, 16 Jun 2014 19:41:30 +0000 (UTC) Received: by mail-qa0-f44.google.com with SMTP id hw13so6785024qab.17 for ; Mon, 16 Jun 2014 12:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=asxZMWBhG9dVP2fV258GvHczwAC9nhSf8c5c0rtJh2E=; b=AdLrL56LlbfBhnuxrKIPYun80FU5GL1+yUJzzPAo7wDWmarOUfs7r54aqOoSMHzSa8 27CQHLkU3PYA0RD4IgUzXTNXBbnju0Kte3/peOUVsPJ26UjOrkOg2sUNVpk2UJodF/Xo ryYQ9lXCwBcYOY7LmCMfqzokhiMJclFnzxTT4flpbe0ooO1ysSWRgJfCrKudv7keAk4k y193RBFZhQIOEnXXyQDOLUBYQG5evrJJjnAFuYXxoO0TFuxB9qKasOM9tB/cE/JBPYBO 7fSd0L/85+eUBEbVaa95x5n+byuMQ1uwDdcjf7ie/kHy2s20QaF9o1l+zfB8Mja6sB7c VV/g== MIME-Version: 1.0 X-Received: by 10.224.223.135 with SMTP id ik7mr29537865qab.26.1402947689834; Mon, 16 Jun 2014 12:41:29 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.224.43.134 with HTTP; Mon, 16 Jun 2014 12:41:29 -0700 (PDT) In-Reply-To: <20140616192155.GE13481@brick.home> References: <20140616192155.GE13481@brick.home> Date: Mon, 16 Jun 2014 12:41:29 -0700 X-Google-Sender-Auth: P1Uqmm_Dnn-ZlzgtU0xezIcrT74 Message-ID: Subject: Re: [patch] USB after second suspend/resume on ThinkPads. From: Adrian Chadd To: freebsd-current Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: Mon, 16 Jun 2014 19:41:31 -0000 Hey cool! I'll go test this out soon. Would you mind throwing it in a bugzilla ticket? -a On 16 June 2014 12:21, Edward Tomasz Napiera=C5=82a wro= te: > 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 > =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 > --- 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 =3D 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 sys= tem > + * may, for instance, resume from S3 with usb(4) powered down. > + */ > + status =3D AcpiGetHandle(sc->handle, "\\_SB.PCI0.LPC.EC.PUBS", &s= c->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 =3D 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 !=3D NULL) { > + status =3D 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); > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org= "