Update Android USB Gadgets to latest from the Legend tree
/drivers/usb/gadget/f_serial.c
blob:158f7870969523f30c6efa5ef60c6c430ae67dd2 -> blob:795978d5afb3b6f738e53decac596ae54c746ff8
--- drivers/usb/gadget/f_serial.c
+++ drivers/usb/gadget/f_serial.c
@@ -16,8 +16,12 @@
#include "u_serial.h"
#include "gadget_chips.h"
+#include <linux/wakelock.h>
#include <mach/perflock.h>
+static struct wake_lock vbus_idle_wake_lock;
+static struct perf_lock usb_perf_lock;
+
#define CONFIG_MODEM_SUPPORT
/*
* This function packages a simple "generic serial" port with no real
@@ -248,9 +252,6 @@ static struct usb_gadget_strings *serial
&serial_string_table,
NULL,
};
-
-static struct perf_lock usb_perf_lock;
-
#ifdef CONFIG_MODEM_SUPPORT
static void gser_complete_set_line_coding(struct usb_ep *ep,
struct usb_request *req)
@@ -795,14 +796,17 @@ static int modem_set_enabled(const char
if (!gser)
return 0;
if (enabled) {
+ wake_lock(&vbus_idle_wake_lock);
if (!is_perf_lock_active(&usb_perf_lock))
perf_lock(&usb_perf_lock);
- } else {
+ }
+ else {
+ wake_unlock(&vbus_idle_wake_lock);
if (is_perf_lock_active(&usb_perf_lock))
perf_unlock(&usb_perf_lock);
}
gser->disabled = !enabled;
- android_enable_function(modem_function, enabled, false);
+ android_enable_function(modem_function, enabled);
return 0;
}
@@ -823,14 +827,14 @@ static int serial_set_enabled(const char
if (!gser)
return 0;
gser->disabled = !enabled;
- android_enable_function(serial_function, enabled, true);
+ android_enable_function(serial_function, enabled);
return 0;
}
static int serial_get_enabled(char *buffer, struct kernel_param *kp)
{
buffer[0] = '0' + !serial_function->hidden;
- printk(KERN_INFO "%s: %d\n", __func__, buffer[0] - '0');
+ /*printk(KERN_INFO "%s: %d\n", __func__, buffer[0] - '0');*/
return 1;
}
module_param_call(serial_enabled, serial_set_enabled, serial_get_enabled, NULL, 0664);
@@ -857,7 +861,9 @@ static struct android_usb_function andro
static int __init init(void)
{
printk(KERN_INFO "serial init\n");
+ wake_lock_init(&vbus_idle_wake_lock, WAKE_LOCK_IDLE, "modem_idle_lock");
perf_lock_init(&usb_perf_lock, PERF_LOCK_HIGHEST, "usb");
+
android_register_function(&android_serial_function);
return 0;
}