Re: [RFC PATCH] usb/acpi: Add support usb port power off mechanism for device fixed on the motherboard

Sarah Sharp
2012-05-16T15:57:23Z

On Wed, May 16, 2012 at 08:08:46AM -0700, Greg KH wrote:
> On Wed, May 16, 2012 at 10:54:13PM +0800, Lan Tianyu wrote:
> > On 2012/5/16 22:39, Greg KH wrote:
> > >On Wed, May 16, 2012 at 10:36:02AM -0400, Alan Stern wrote:
> > >>On Wed, 16 May 2012, Lan Tianyu wrote:
> > >>
> > >>>Ok. Let me reconfirm the meaning of these opinions.
> > >>>
> > >>>"auto"
> > >>> if port without device, turn off power directly.
> > >>> if port with device, turn off power when the device is suspended.
> > >>>
> > >>>"on" the port's power must be on.
> > >>>
> > >>>"off" the port's power must be off.
> > >>>
> > >>>Right?
> > >>Maybe the "auto" setting should be renamed "active". Then "auto" can
> > >>be used for:
> > >>
> > >> If the port has a device, turn the power on.
> > >> If the port doesn't have a device, turn the power off.
> > >And plugging a new device into a port that was powered off is going to
> > >cause the power to come back on, right?
> > When the port was powered off, the connect-change event will not be
> > detected and
> > we don't know a device was plugged in. :(
>
> Then that doesn't seem like a very good thing to ever do, right?

When the port is powered off, VBUS is removed. That means we don't get
connect, disconnect, or remote wakeup events. The most useful case for
this is if we know there's a USB port that's internal (say inside a
laptop) that either is empty, or has a USB device that's suspended
without remote wakeup enabled. Then we know we can safely power off the
port, because we shouldn't ever see a connect, disconnect, or remote
wakeup.

We can use ACPI tables to figure out whether a USB port is physically
connectable (e.g. internal) or not. Of course, the ACPI tables may well
lie to us, so we need to export the sysfs interface so that userspace
can override any kernel defaults WRT powering off internal ports.

Sarah Sharp
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html