[Balloon-svn] r1858 - balloon/branches/menuconfig2/package/k…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: subversion@balloonboard.org
Date:  
To: balloon-svn
Subject: [Balloon-svn] r1858 - balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4
Author: nick
Date: 2012-04-17 13:44:14 +0100 (Tue, 17 Apr 2012)
New Revision: 1858

Added:
balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/usb_gadget_vbus.patch
Modified:
balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/battery-tt.patch
balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/series-balloon3-bubble-tt
Log:
add vbusDraw module parameter for composite gadgets with automatic fast charging on TT. Reduce vbus draw on module disconnection

Modified: balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/battery-tt.patch
===================================================================
--- balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/battery-tt.patch    2012-04-17 09:06:22 UTC (rev 1857)
+++ balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/battery-tt.patch    2012-04-17 12:44:14 UTC (rev 1858)
@@ -1,7 +1,7 @@
 Index: linux-2.6.39.4/drivers/power/Kconfig
 ===================================================================
---- linux-2.6.39.4.orig/drivers/power/Kconfig    2012-03-22 11:34:20.000000000 +0000
-+++ linux-2.6.39.4/drivers/power/Kconfig    2012-03-22 11:34:51.000000000 +0000
+--- linux-2.6.39.4.orig/drivers/power/Kconfig    2011-08-03 20:43:28.000000000 +0100
++++ linux-2.6.39.4/drivers/power/Kconfig    2012-04-16 16:04:54.000000000 +0100
 @@ -219,4 +219,17 @@
        This driver can be build as a module. If so, the module will be
        called gpio-charger.
@@ -22,8 +22,8 @@
  endif # POWER_SUPPLY
 Index: linux-2.6.39.4/drivers/power/Makefile
 ===================================================================
---- linux-2.6.39.4.orig/drivers/power/Makefile    2012-03-22 11:34:20.000000000 +0000
-+++ linux-2.6.39.4/drivers/power/Makefile    2012-03-22 11:34:51.000000000 +0000
+--- linux-2.6.39.4.orig/drivers/power/Makefile    2011-08-03 20:43:28.000000000 +0100
++++ linux-2.6.39.4/drivers/power/Makefile    2012-04-16 16:04:54.000000000 +0100
 @@ -34,3 +34,4 @@
  obj-$(CONFIG_CHARGER_ISP1704)    += isp1704_charger.o
  obj-$(CONFIG_CHARGER_TWL4030)    += twl4030_charger.o
@@ -32,8 +32,8 @@
 Index: linux-2.6.39.4/drivers/power/tt_battery.c
 ===================================================================
 --- /dev/null    1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.39.4/drivers/power/tt_battery.c    2012-03-22 11:52:49.000000000 +0000
-@@ -0,0 +1,414 @@
++++ linux-2.6.39.4/drivers/power/tt_battery.c    2012-04-17 10:34:48.000000000 +0100
+@@ -0,0 +1,441 @@
 +/*
 + * Battery and Power Management code for the Bubble TT device
 + * Copyright (c) 2011 Nick Bane
@@ -112,12 +112,39 @@
 +    return sprintf(buf, "raw %ld computed %ld\n", raw, computed);
 +}
 +
++static ssize_t
++show_fastcharge(struct device *dev, struct device_attribute *attr, char *buf)
++{
++    u8 bat_status = samosa_read8(SAMOSA_ADDR_USB_CHG_REG_STATUS);
++    int charge_fast = bat_status & (1 << USB_CHARGE_FAST_BIT);
++    return sprintf(buf, "%s\n", charge_fast ? "1":"0");
++}
++
++/*
++static
++ssize_t set_fastcharge(struct device *dev,
++        struct device_attribute *attr, const char *buf, size_t count)
++{
++    unsigned long fast;
++    int ret = strict_strtoul(buf, 10, &fast);
++    if (ret)
++        return -EINVAL;
++
++    samosa_write8(fast ? SAMOSA_ADDR_USB_CHG_REG_SET : SAMOSA_ADDR_USB_CHG_REG_CLR, 1 << USB_CONFIGURED_BIT);
++
++    return count;
++}
++*/
++
 +static DEVICE_ATTR(vbus, S_IRUGO, show_vbus, NULL);
 +static DEVICE_ATTR(adc, S_IRUGO, show_adc, NULL);
++//static DEVICE_ATTR(fastcharge, S_IRUGO | S_IWUSR, show_fastcharge, set_fastcharge);
++static DEVICE_ATTR(fastcharge, S_IRUGO | S_IWUSR, show_fastcharge, NULL);
 +
 +static struct attribute *tt_bat_sysfs_entries[] = {
 +    &dev_attr_vbus.attr,
 +    &dev_attr_adc.attr,
++    &dev_attr_fastcharge.attr,
 +    NULL,
 +};
 +


Modified: balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/series-balloon3-bubble-tt
===================================================================
--- balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/series-balloon3-bubble-tt    2012-04-17 09:06:22 UTC (rev 1857)
+++ balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/series-balloon3-bubble-tt    2012-04-17 12:44:14 UTC (rev 1858)
@@ -23,3 +23,4 @@
 battery-tt.patch
 pxafb_internal_ram.patch
 spi_tt.patch
+usb_gadget_vbus.patch


Added: balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/usb_gadget_vbus.patch
===================================================================
--- balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/usb_gadget_vbus.patch                            (rev 0)
+++ balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/usb_gadget_vbus.patch    2012-04-17 12:44:14 UTC (rev 1858)
@@ -0,0 +1,78 @@
+Index: linux-2.6.39.4/drivers/usb/gadget/composite.c
+===================================================================
+--- linux-2.6.39.4.orig/drivers/usb/gadget/composite.c    2012-04-16 16:12:16.000000000 +0100
++++ linux-2.6.39.4/drivers/usb/gadget/composite.c    2012-04-17 13:03:49.000000000 +0100
+@@ -71,6 +71,10 @@
+ module_param(iSerialNumber, charp, 0);
+ MODULE_PARM_DESC(iSerialNumber, "SerialNumber string");
+ 
++static ushort vbusDraw = CONFIG_USB_GADGET_VBUS_DRAW;
++module_param(vbusDraw, ushort, 0);
++MODULE_PARM_DESC(vbusDraw, "Max Vbus Draw (2..500)");
++
+ static char composite_manufacturer[50];
+ 
+ /*-------------------------------------------------------------------------*/
+@@ -250,7 +254,7 @@
+     c->bConfigurationValue = config->bConfigurationValue;
+     c->iConfiguration = config->iConfiguration;
+     c->bmAttributes = USB_CONFIG_ATT_ONE | config->bmAttributes;
+-    c->bMaxPower = config->bMaxPower ? : (CONFIG_USB_GADGET_VBUS_DRAW / 2);
++    c->bMaxPower = config->bMaxPower ? : (vbusDraw / 2);
+ 
+     /* There may be e.g. OTG descriptors */
+     if (config->descriptors) {
+@@ -464,7 +468,7 @@
+     }
+ 
+     /* when we return, be sure our power usage is valid */
+-    power = c->bMaxPower ? (2 * c->bMaxPower) : CONFIG_USB_GADGET_VBUS_DRAW;
++    power = c->bMaxPower ? (2 * c->bMaxPower) : vbusDraw;
+ done:
+     usb_gadget_vbus_draw(gadget, power);
+     return result;
+@@ -979,6 +983,8 @@
+     struct usb_composite_dev    *cdev = get_gadget_data(gadget);
+     unsigned long            flags;
+ 
++    usb_gadget_vbus_draw(gadget, 2);
++
+     /* REVISIT:  should we have config and device level
+      * disconnect callbacks?
+      */
+@@ -1215,7 +1221,7 @@
+         maxpower = cdev->config->bMaxPower;
+ 
+         usb_gadget_vbus_draw(gadget, maxpower ?
+-            (2 * maxpower) : CONFIG_USB_GADGET_VBUS_DRAW);
++            (2 * maxpower) : vbusDraw);
+     }
+ 
+     cdev->suspended = 0;
+Index: linux-2.6.39.4/drivers/usb/gadget/pxa27x_udc.c
+===================================================================
+--- linux-2.6.39.4.orig/drivers/usb/gadget/pxa27x_udc.c    2012-04-17 10:27:14.000000000 +0100
++++ linux-2.6.39.4/drivers/usb/gadget/pxa27x_udc.c    2012-04-17 10:35:27.000000000 +0100
+@@ -42,7 +42,10 @@
+ #include <mach/udc.h>
+ 
+ #include "pxa27x_udc.h"
+-
++#ifdef CONFIG_BALLOON3_TT
++#include "linux/samosa_device.h"
++#include "linux/spi/spi_tt.h"
++#endif
+ /*
+  * This driver handles the USB Device Controller (UDC) in Intel's PXA 27x
+  * series processors.
+@@ -1691,6 +1694,10 @@
+     struct pxa_udc *udc;
+ 
+     udc = to_gadget_udc(_gadget);
++#ifdef CONFIG_BALLOON3_TT
++    pr_info("%s: drawing %dma\n", __func__, mA);
++    samosa_write8((mA >= 500) ? SAMOSA_ADDR_USB_CHG_REG_SET : SAMOSA_ADDR_USB_CHG_REG_CLR, 1 << USB_CONFIGURED_BIT);
++#endif
+     if (udc->transceiver)
+         return otg_set_power(udc->transceiver, mA);
+     return -EOPNOTSUPP;