* Re: Question about regulators [not found] <20190403101343.718c156d@xps13> @ 2019-04-09 7:26 ` Miquel Raynal 2019-04-09 7:38 ` Hans de Goede 0 siblings, 1 reply; 4+ messages in thread From: Miquel Raynal @ 2019-04-09 7:26 UTC (permalink / raw) To: linux-usb; +Cc: Thomas Petazzoni, Greg Kroah-Hartman, Hans de Goede Hello, Adding Greg & Hans just in case they have an idea, or someone else to ping in mind. Miquel Raynal <miquel.raynal@bootlin.com> wrote on Wed, 3 Apr 2019 10:13:43 +0200: > Hello, > > I am reading the document named "xHCI interoperability testing v0.94" > available on usb.org. There is this paragraph: > > Devices operating at Enhanced SuperSpeed GenX are allowed to > draw a maximum configured current of 900mA and unconfigured > current of 150mA. Devices operating at High-Speed or below may > draw a maximum configured current of 500mA and unconfigured > current of 100mA*. Devices must report their maximum configured > current draw and their power configuration as self or bus > powered to the host and must operate within the regions > reported. Additionally any device that is in the suspended > state may draw no more than 2.5 mA. > > My understanding is that the current limitation on Vbus should be tuned > dynamically between 100, 150, 500 and 900mA depending on the type of > device and if has been configured or not. > > Despite some researches in the USB core I can't find any mechanism > handling this in Linux implementation. > > Behind this remark, I actually have boards (Armada 7040/8040 DB) with a > regulator on Vbus to limit the current to either 500 or 900mA. I > checked the xhci-platform driver which is used with these SoCs and I > don't find any mean to tweak this value depending on the inserted > device. > > Should I actually care? Is it enough to limit to 900mA whenever the > xHCI driver is probed? > > Thanks for your guidance, > Miquèl Thanks, Miquèl ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Question about regulators 2019-04-09 7:26 ` Question about regulators Miquel Raynal @ 2019-04-09 7:38 ` Hans de Goede 2019-04-09 7:41 ` Miquel Raynal 0 siblings, 1 reply; 4+ messages in thread From: Hans de Goede @ 2019-04-09 7:38 UTC (permalink / raw) To: Miquel Raynal, linux-usb; +Cc: Thomas Petazzoni, Greg Kroah-Hartman Hi, On 09-04-19 09:26, Miquel Raynal wrote: > Hello, > > Adding Greg & Hans just in case they have an idea, or someone else to > ping in mind. > > Miquel Raynal <miquel.raynal@bootlin.com> wrote on Wed, 3 Apr 2019 > 10:13:43 +0200: > >> Hello, >> >> I am reading the document named "xHCI interoperability testing v0.94" >> available on usb.org. There is this paragraph: >> >> Devices operating at Enhanced SuperSpeed GenX are allowed to >> draw a maximum configured current of 900mA and unconfigured >> current of 150mA. Devices operating at High-Speed or below may >> draw a maximum configured current of 500mA and unconfigured >> current of 100mA*. Devices must report their maximum configured >> current draw and their power configuration as self or bus >> powered to the host and must operate within the regions >> reported. Additionally any device that is in the suspended >> state may draw no more than 2.5 mA. >> >> My understanding is that the current limitation on Vbus should be tuned >> dynamically between 100, 150, 500 and 900mA depending on the type of >> device and if has been configured or not. >> >> Despite some researches in the USB core I can't find any mechanism >> handling this in Linux implementation. >> >> Behind this remark, I actually have boards (Armada 7040/8040 DB) with a >> regulator on Vbus to limit the current to either 500 or 900mA. I >> checked the xhci-platform driver which is used with these SoCs and I >> don't find any mean to tweak this value depending on the inserted >> device. >> >> Should I actually care? Is it enough to limit to 900mA whenever the >> xHCI driver is probed? To be clear you are talking about a regulator producing Vbus for device plugged into the system, right ? In that case just configuring th current-limit at 900mA is fine, it really is up to the device to not consume more then it may and even if it does since the port is capable of delivering 900mA anyways that is not a problem. There is code in various places in the kernel for Linux devices to not consume too much energy (mostly in charger ic drivers) when the Linux device itself is an USB device drawing power. Regards, Hans ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Question about regulators 2019-04-09 7:38 ` Hans de Goede @ 2019-04-09 7:41 ` Miquel Raynal 2019-04-09 14:14 ` Alan Stern 0 siblings, 1 reply; 4+ messages in thread From: Miquel Raynal @ 2019-04-09 7:41 UTC (permalink / raw) To: Hans de Goede; +Cc: linux-usb, Thomas Petazzoni, Greg Kroah-Hartman Hi Hans, Hans de Goede <hdegoede@redhat.com> wrote on Tue, 9 Apr 2019 09:38:01 +0200: > Hi, > > On 09-04-19 09:26, Miquel Raynal wrote: > > Hello, > > > > Adding Greg & Hans just in case they have an idea, or someone else to > > ping in mind. > > > > Miquel Raynal <miquel.raynal@bootlin.com> wrote on Wed, 3 Apr 2019 > > 10:13:43 +0200: > > > >> Hello, > >> > >> I am reading the document named "xHCI interoperability testing v0.94" > >> available on usb.org. There is this paragraph: > >> > >> Devices operating at Enhanced SuperSpeed GenX are allowed to > >> draw a maximum configured current of 900mA and unconfigured > >> current of 150mA. Devices operating at High-Speed or below may > >> draw a maximum configured current of 500mA and unconfigured > >> current of 100mA*. Devices must report their maximum configured > >> current draw and their power configuration as self or bus > >> powered to the host and must operate within the regions > >> reported. Additionally any device that is in the suspended > >> state may draw no more than 2.5 mA. > >> > >> My understanding is that the current limitation on Vbus should be tuned > >> dynamically between 100, 150, 500 and 900mA depending on the type of > >> device and if has been configured or not. > >> > >> Despite some researches in the USB core I can't find any mechanism > >> handling this in Linux implementation. > >> > >> Behind this remark, I actually have boards (Armada 7040/8040 DB) with a > >> regulator on Vbus to limit the current to either 500 or 900mA. I > >> checked the xhci-platform driver which is used with these SoCs and I > >> don't find any mean to tweak this value depending on the inserted > >> device. > >> > >> Should I actually care? Is it enough to limit to 900mA whenever the > >> xHCI driver is probed? > > To be clear you are talking about a regulator producing Vbus for device > plugged into the system, right ? > > In that case just configuring th current-limit at 900mA is fine, it really > is up to the device to not consume more then it may and even if it does since > the port is capable of delivering 900mA anyways that is not a problem. > > There is code in various places in the kernel for Linux devices to not > consume too much energy (mostly in charger ic drivers) when the Linux > device itself is an USB device drawing power. > > Regards, > > Hans > Thank you very much for answering my questions. I'll just stick to a 900mA limitation in all cases then. Thanks, Miquèl ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Question about regulators 2019-04-09 7:41 ` Miquel Raynal @ 2019-04-09 14:14 ` Alan Stern 0 siblings, 0 replies; 4+ messages in thread From: Alan Stern @ 2019-04-09 14:14 UTC (permalink / raw) To: Miquel Raynal Cc: Hans de Goede, linux-usb, Thomas Petazzoni, Greg Kroah-Hartman On Tue, 9 Apr 2019, Miquel Raynal wrote: > Hi Hans, > > Hans de Goede <hdegoede@redhat.com> wrote on Tue, 9 Apr 2019 09:38:01 > +0200: > > > Hi, > > > > On 09-04-19 09:26, Miquel Raynal wrote: > > > Hello, > > > > > > Adding Greg & Hans just in case they have an idea, or someone else to > > > ping in mind. > > > > > > Miquel Raynal <miquel.raynal@bootlin.com> wrote on Wed, 3 Apr 2019 > > > 10:13:43 +0200: > > > > > >> Hello, > > >> > > >> I am reading the document named "xHCI interoperability testing v0.94" > > >> available on usb.org. There is this paragraph: > > >> > > >> Devices operating at Enhanced SuperSpeed GenX are allowed to > > >> draw a maximum configured current of 900mA and unconfigured > > >> current of 150mA. Devices operating at High-Speed or below may > > >> draw a maximum configured current of 500mA and unconfigured > > >> current of 100mA*. Devices must report their maximum configured > > >> current draw and their power configuration as self or bus > > >> powered to the host and must operate within the regions > > >> reported. Additionally any device that is in the suspended > > >> state may draw no more than 2.5 mA. > > >> > > >> My understanding is that the current limitation on Vbus should be tuned > > >> dynamically between 100, 150, 500 and 900mA depending on the type of > > >> device and if has been configured or not. > > >> > > >> Despite some researches in the USB core I can't find any mechanism > > >> handling this in Linux implementation. > > >> > > >> Behind this remark, I actually have boards (Armada 7040/8040 DB) with a > > >> regulator on Vbus to limit the current to either 500 or 900mA. I > > >> checked the xhci-platform driver which is used with these SoCs and I > > >> don't find any mean to tweak this value depending on the inserted > > >> device. > > >> > > >> Should I actually care? Is it enough to limit to 900mA whenever the > > >> xHCI driver is probed? > > > > To be clear you are talking about a regulator producing Vbus for device > > plugged into the system, right ? > > > > In that case just configuring th current-limit at 900mA is fine, it really > > is up to the device to not consume more then it may and even if it does since > > the port is capable of delivering 900mA anyways that is not a problem. > > > > There is code in various places in the kernel for Linux devices to not > > consume too much energy (mostly in charger ic drivers) when the Linux > > device itself is an USB device drawing power. > > > > Regards, > > > > Hans > > > > Thank you very much for answering my questions. I'll just stick to a > 900mA limitation in all cases then. If you want to be more strict about it, in theory you could enforce the lower current limits. We do know when they are supposed to take effect, although that knowledge is currently not used. The Linux USB core has no mechanism for informing regulators about maximum current limits, but some such mechanism certainly could be added. For example, one relatively simple thing you could do is set the limit to 900 mA when the device connection is SuperSpeed or faster, and 500 mA when the device connection is High speed or slower. (And 2.5 mA when the device is suspended.) But you would have to write the code to do this and insert it in the correct place in the xhci-hcd driver. Alan Stern ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-09 14:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190403101343.718c156d@xps13>
2019-04-09 7:26 ` Question about regulators Miquel Raynal
2019-04-09 7:38 ` Hans de Goede
2019-04-09 7:41 ` Miquel Raynal
2019-04-09 14:14 ` Alan Stern
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).