Google
  Web www.spinics.net

Re: PXA27x UDC Power

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Justin Clacherty wrote:
> Given that it won't likely change over the lifetime of the product is it 
> better to implement this as a compile time kernel configuration option 
> rather than a command line option?
>   
How's this?

diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index d80b1e4..68f150e 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -468,6 +468,17 @@ config USB_ETH_RNDIS
        XP, you'll need to download drivers from Microsoft's website; a URL
        is given in comments found in that info file.
 
+config USB_ETH_HIGH_POWER
+    bool "High power device support"
+    depends on USB_ETH
+    default n
+    help
+       Some devices need to use a higher powered port to make it easier
+       to recharge batteries.
+
+       If you say "y" here, the ethernet device configurations will be
+       changed to require a 500 mA port.
+
 config USB_GADGETFS
     tristate "Gadget Filesystem (EXPERIMENTAL)"
     depends on EXPERIMENTAL
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 7d4fb96..3583a20 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -443,8 +443,6 @@ static inline int BITRATE(struct usb_gadget *g)
  * NOTE:  Controllers like superh_udc should probably be able to use
  * an RNDIS-only configuration.
  *
- * FIXME define some higher-powered configurations to make it easier
- * to recharge batteries ...
  */
 
 #define DEV_CONFIG_VALUE    1    /* cdc or subset */
@@ -486,7 +484,12 @@ eth_config = {
     .bConfigurationValue =    DEV_CONFIG_VALUE,
     .iConfiguration =    STRING_CDC,
     .bmAttributes =        USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
+
+#ifdef  CONFIG_USB_ETH_HIGH_POWER
+    .bMaxPower =        250,
+#else
     .bMaxPower =        50,
+#endif
 };
 
 #ifdef    CONFIG_USB_ETH_RNDIS
@@ -500,7 +503,12 @@ rndis_config = {
     .bConfigurationValue =  DEV_RNDIS_CONFIG_VALUE,
     .iConfiguration =       STRING_RNDIS,
     .bmAttributes =        USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER,
-    .bMaxPower =            50,
+
+#ifdef  CONFIG_USB_ETH_HIGH_POWER
+    .bMaxPower =        250,
+#else
+    .bMaxPower =        50,
+#endif
 };
 #endif


-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
linux-usb-devel@xxxxxxxxxxxxxxxxxxxxx
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

[Home]     [Video for Linux]     [Photo]     [Yosemite Forum]     [Yosemite Photos]    [Video Projectors]     [PDAs]     [Hacking TiVo]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Devices]     [Big List of Linux Books]     [Free Dating]

  Powered by Linux