All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lan Tianyu <tianyu.lan@intel.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>,
	"lenb@kernel.org" <lenb@kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [RFC PATCH] usb/acpi: Add support usb port power off mechanism for device fixed on the motherboard
Date: Sun, 13 May 2012 01:47:39 +0800	[thread overview]
Message-ID: <4FAEA23B.1010009@intel.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1205111605560.1865-100000@iolanthe.rowland.org>

On 2012/5/12 4:20, Alan Stern wrote:
> On Fri, 11 May 2012, Lan, Tianyu wrote:
>
>> On 2012/5/12 1:44, Alan Stern wrote:
>>> On Sat, 12 May 2012, Lan Tianyu wrote:
>>>>    From my opinion, ACPI will tell us whether the port is connectable or not.
>>> ACPI will tell you about some ports, not others (for example, ACPI
>>> knows nothing about the ports on hubs that the user plugs in).  On
>>> other systems, a Device Tree database might provide the same
>>> information.
>> I think we can not power off ports on the hubs that the user plugs in.
> You are wrong.  Some hubs do allow ports to be powered off.  Most
> don't, but some do.
Ok. Thanks for correct. So how to control ports' power on those
hub? via set or clear PORT_POWER?
>>> I still don't see what the problem is.  They don't have to be
>>> synchronized; all you need to do is make sure that the port's state
>>> remains set to "off" until the debouncing is finished and you have
>>> turned off the connect-change and enable-change features.
>>      Do you mean during debouncing, the USB_PORT_FEAT_CONNECTION
> USB_PORT_STAT_C_CONNECTION, not USB_PORT_FEAT_CONNECTION.
>> will be clear. So the hub_irq() will not receive connect-change event?
Sorry. I may misunderstand your statement. I try to make it clear. :)

>All you have to do is turn off the connect-change status bit.  In fact,
>the debounce routine does this already.  Just leave the port state set
>to "off" until the connection is debounced.

I have checked hub_port_debounce(). The routine only clear
port feature USB_PORT_FEAT_C_CONNECTION when connect-change event
is detected.

"turn off the connect-change status bit". you mean unmask the
connect and enable change status bit.
just like:
portchange&= ~(USB_PORT_STAT_C_CONNECTION |
		USB_PORT_STAT_C_ENABLE);
right?

> Why is hub_port_connect_change() going to get called?  hub_event()
> doesn't call hub_port_connect_change() when it doesn't need to.
> In this case it won't need to, because debouncing turns off the
> connect-change status.
in the hub_event(), the routine will get port's status and
port change status every time. How does hub_port_debounce()
turn off the the value of port change status in the hub_event?

hub_event() {
	...
	connect_change = test_bit(i, hub->change_bits);
	if (!test_and_clear_bit(i, hub->event_bits)&&
					!connect_change)
				continue;

	ret = hub_port_status(hub, i,
		&portstatus,&portchange);
	if (ret<  0)
		continue;

	/*
	 * if we unmask the portchange here,
	 * the hub_port_connect_change() will not be
	 * invoked.
	 * portchange&= ~(USB_PORT_STAT_C_CONNECTION |
	 * USB_PORT_STAT_C_ENABLE);
	 */

	if (portchange&  USB_PORT_STAT_C_CONNECTION) {
		clear_port_feature(hdev, i,
			USB_PORT_FEAT_C_CONNECTION);
		connect_change = 1;
	}
	...
}

Is there a way to forbid connect-change or enable-change bits
to be on when these events take place?

> Do you know what a "reset-resume" is? See Documentation/usb/persist.txt.
I know reset-resume. But if hub_port_connect_change() is invoked.
It just like unplug and plug device.

My main question is that how does usb_port_debounce() prevent the
connect-change and enable-change bits to be off.
-- 
Best Regards
Tianyu Lan
linux kernel enabling team


  reply	other threads:[~2012-05-12 17:47 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10  8:33 [RFC PATCH] usb/acpi: Add support usb port power off mechanism for device fixed on the motherboard Lan Tianyu
2012-05-10 15:54 ` Alan Stern
     [not found]   ` <Pine.LNX.4.44L0.1205101136470.1831-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-05-10 16:35     ` Sarah Sharp
2012-05-10 17:44       ` Alan Stern
2012-05-11 16:12         ` Lan Tianyu
2012-05-11 16:16           ` Lan Tianyu
2012-05-11 17:44           ` Alan Stern
2012-05-11 18:12             ` Sarah Sharp
2012-05-12 12:47               ` Sergei Shtylyov
2012-05-12 14:04                 ` Greg KH
2012-05-12 18:00               ` Lan Tianyu
2012-05-11 18:18             ` Lan Tianyu
     [not found]             ` <Pine.LNX.4.44L0.1205111302080.1865-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-05-11 18:35               ` Greg KH
2012-05-11 19:32                 ` Alan Stern
2012-05-11 20:11                 ` Sarah Sharp
2012-05-11 21:09                   ` Peter Stuge
2012-05-15  1:47                     ` Sarah Sharp
2012-05-15  4:57                       ` Peter Stuge
2012-05-11 19:54               ` Lan, Tianyu
2012-05-11 20:15                 ` Sarah Sharp
2012-05-11 20:26                   ` Alan Stern
2012-05-11 20:20                 ` Alan Stern
2012-05-12 17:47                   ` Lan Tianyu [this message]
2012-05-12 18:04                     ` Lan Tianyu
2012-05-13  2:50                     ` Alan Stern
2012-05-10 19:19     ` Dan Williams
     [not found]       ` <1336677578.6463.5.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
2012-05-10 21:11         ` Sarah Sharp
2012-05-11  4:13           ` Peter Stuge
2012-05-11 14:20             ` Alan Stern
     [not found]               ` <Pine.LNX.4.44L0.1205111019000.1865-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-05-11 14:30                 ` Peter Stuge
2012-05-11 14:08           ` Alan Stern
2012-05-11 18:03             ` Sarah Sharp
2012-05-11 19:14               ` Alan Stern
2012-05-11 20:21                 ` Sarah Sharp
2012-05-11 20:36                   ` Alan Stern
2012-05-11 23:59                     ` Sarah Sharp
2012-05-12  0:17                       ` Greg KH
2012-05-12 13:54                         ` Alan Stern
2012-05-14 23:21                         ` Sarah Sharp
2012-05-15 14:31                           ` Lan Tianyu
     [not found]                             ` <4FB268CA.9060304-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2012-05-15 15:18                               ` Greg KH
2012-05-15 20:00                                 ` Sarah Sharp
2012-05-16  6:26                                   ` Lan Tianyu
2012-05-16 14:36                                     ` Alan Stern
2012-05-16 14:39                                       ` Greg KH
2012-05-16 14:54                                         ` Lan Tianyu
2012-05-16 15:08                                           ` Greg KH
2012-05-16 15:32                                             ` Lan Tianyu
     [not found]                                             ` <20120516150846.GB3293-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-05-16 15:57                                               ` Sarah Sharp
2012-05-16 15:12                                           ` Alan Stern
     [not found]                                         ` <20120516143958.GA612-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2012-05-17 11:42                                           ` Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FAEA23B.1010009@intel.com \
    --to=tianyu.lan@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sarah.a.sharp@linux.intel.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.