usb: gadget: Add remote wakeup support to f_rmnet BAM-BAM

On USB suspend, f_rmnet with BAM-BAM transport will register for BAM
wakeup notification. Upon wakeup event from the BAM, the u_bam will
trigger a USB remote wakeup.

Change-Id: I1d1be987f225c0b2edf5bf9af75e2dd15f8c045a
Signed-off-by: Amit Blay <ablay@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-9615.c b/arch/arm/mach-msm/board-9615.c
index b128223..7e9833b 100644
--- a/arch/arm/mach-msm/board-9615.c
+++ b/arch/arm/mach-msm/board-9615.c
@@ -43,10 +43,11 @@
 #include <mach/dma.h>
 #include <mach/ion.h>
 #include <mach/msm_memtypes.h>
+#include <mach/cpuidle.h>
+#include <mach/usb_bam.h>
 #include "timer.h"
 #include "devices.h"
 #include "board-9615.h"
-#include <mach/cpuidle.h>
 #include "pm.h"
 #include "acpuclock.h"
 #include "pm-boot.h"
diff --git a/arch/arm/mach-msm/include/mach/usb_bam.h b/arch/arm/mach-msm/include/mach/usb_bam.h
index 4caa71b..ec135a3 100644
--- a/arch/arm/mach-msm/include/mach/usb_bam.h
+++ b/arch/arm/mach-msm/include/mach/usb_bam.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -14,6 +14,20 @@
 #define _USB_BAM_H_
 
 /**
+ * SPS Pipes direction.
+ *
+ * USB_TO_PEER_PERIPHERAL	USB (as Producer) to other
+ *                          peer peripheral.
+ * PEER_PERIPHERAL_TO_USB	Other Peripheral to
+ *                          USB (as consumer).
+ */
+enum usb_bam_pipe_dir {
+	USB_TO_PEER_PERIPHERAL,
+	PEER_PERIPHERAL_TO_USB,
+};
+
+#ifdef CONFIG_USB_BAM
+/**
  * Connect USB-to-Periperal SPS connection.
  *
  * This function returns the allocated pipes number.
@@ -29,12 +43,31 @@
  * @return 0 on success, negative value on error
  *
  */
-#ifdef CONFIG_USB_BAM
 int usb_bam_connect(u8 idx, u8 *src_pipe_idx, u8 *dst_pipe_idx);
+
+/**
+ * Register a wakeup callback from peer BAM.
+ *
+ * @idx - Connection index.
+ *
+ * @callback - the callback function
+ *
+ * @return 0 on success, negative value on error
+ *
+ */
+int usb_bam_register_wake_cb(u8 idx,
+	 int (*callback)(void *), void* param);
 #else
-int usb_bam_connect(u8 idx, u8 *src_pipe_idx, u8 *dst_pipe_idx)
+static inline int usb_bam_connect(u8 idx, u8 *src_pipe_idx, u8 *dst_pipe_idx)
+{
+	return -ENODEV;
+}
+
+static inline int usb_bam_register_wake_cb(u8 idx,
+	int (*callback)(void *), void* param)
 {
 	return -ENODEV;
 }
 #endif
 #endif				/* _USB_BAM_H_ */
+