summaryrefslogtreecommitdiff
Diffstat
-rw-r--r--Android.mk49
-rw-r--r--conf/asus/grouper/Android.mk14
-rw-r--r--conf/asus/grouper/bt_vendor.conf5
-rw-r--r--conf/meson/Android.mk14
-rw-r--r--conf/meson/bt_vendor.conf5
-rw-r--r--conf/moto/wingray/Android.mk14
-rw-r--r--conf/moto/wingray/bt_vendor.conf5
-rw-r--r--conf/samsung/crespo/Android.mk14
-rw-r--r--conf/samsung/crespo/bt_vendor.conf5
-rw-r--r--conf/samsung/crespo4g/Android.mk14
-rw-r--r--conf/samsung/crespo4g/bt_vendor.conf5
-rw-r--r--conf/samsung/maguro/Android.mk14
-rw-r--r--conf/samsung/maguro/bt_vendor.conf5
-rwxr-xr-xgen-buildcfg.sh25
-rwxr-xr-xinclude/bt_vendor_brcm.h103
-rw-r--r--[-rwxr-xr-x]include/vnd_40183_lpm.txt0
-rw-r--r--include/vnd_angler.txt17
-rw-r--r--include/vnd_anthias.txt10
-rw-r--r--include/vnd_bass.txt16
-rw-r--r--include/vnd_carp.txt14
-rw-r--r--include/vnd_crespo.txt8
-rw-r--r--include/vnd_crespo4g.txt8
-rw-r--r--include/vnd_dory.txt14
-rw-r--r--include/vnd_dragon.txt9
-rw-r--r--include/vnd_flounder.txt10
-rw-r--r--include/vnd_flounder64.txt10
-rw-r--r--include/vnd_flounder_lte.txt10
-rw-r--r--include/vnd_fugu.txt11
-rw-r--r--[-rwxr-xr-x]include/vnd_generic.txt1
-rw-r--r--[-rwxr-xr-x]include/vnd_generic_x86.txt1
-rw-r--r--include/vnd_grouper.txt10
-rw-r--r--include/vnd_hammerhead.txt15
-rw-r--r--include/vnd_lenok.txt16
-rw-r--r--include/vnd_maguro.txt8
-rw-r--r--include/vnd_mako.txt8
-rw-r--r--include/vnd_manta.txt10
-rw-r--r--[-rwxr-xr-x]include/vnd_meson6.txt0
-rw-r--r--[-rwxr-xr-x]include/vnd_meson6_lpm.txt0
-rw-r--r--[-rwxr-xr-x]include/vnd_meson8.txt0
-rw-r--r--[-rwxr-xr-x]include/vnd_meson8_lpm.txt0
-rw-r--r--include/vnd_nemo.txt16
-rw-r--r--include/vnd_phantasm.txt8
-rw-r--r--include/vnd_puffer.txt15
-rw-r--r--include/vnd_shamu.txt14
-rw-r--r--include/vnd_smelt.txt14
-rw-r--r--include/vnd_sparrow.txt10
-rw-r--r--include/vnd_sprat.txt21
-rw-r--r--include/vnd_stingray.txt8
-rw-r--r--include/vnd_sturgeon.txt14
-rw-r--r--include/vnd_tetra.txt15
-rw-r--r--include/vnd_tilapia.txt10
-rw-r--r--include/vnd_toro.txt9
-rw-r--r--include/vnd_tuna.txt9
-rw-r--r--include/vnd_wingray.txt8
-rw-r--r--include/vnd_wren.txt10
-rwxr-xr-xsrc/bt_vendor_brcm.c23
-rwxr-xr-xsrc/hardware.c543
-rwxr-xr-xsrc/upio.c93
-rwxr-xr-xsrc/userial_vendor.c29
-rwxr-xr-xvnd_buildcfg.mk4
60 files changed, 1223 insertions, 147 deletions
diff --git a/src/upio.c b/src/upio.c
index 4940f8e..3f73482 100755
--- a/src/upio.c
+++ b/src/upio.c
@@ -31,6 +31,7 @@
#include <utils/Log.h>
#include <fcntl.h>
#include <errno.h>
+#include <string.h>
#include <cutils/properties.h>
#include "bt_vendor_brcm.h"
#include "upio.h"
@@ -194,6 +195,40 @@ static void proc_btwrite_timeout(union sigval arg)
{
UPIODBG("..%s..", __FUNCTION__);
lpm_proc_cb.btwrite_active = FALSE;
+ /* drive LPM down; this timer should fire only when BT is awake; */
+ upio_set(UPIO_BT_WAKE, UPIO_DEASSERT, 1);
+}
+
+/******************************************************************************
+ **
+ ** Function upio_start_stop_timer
+ **
+ ** Description Arm user space timer in case lpm is left asserted
+ **
+ ** Returns None
+ **
+ *****************************************************************************/
+void upio_start_stop_timer(int action) {
+ struct itimerspec ts;
+
+ if (action == UPIO_ASSERT) {
+ lpm_proc_cb.btwrite_active = TRUE;
+ if (lpm_proc_cb.timer_created == TRUE) {
+ ts.it_value.tv_sec = PROC_BTWRITE_TIMER_TIMEOUT_MS/1000;
+ ts.it_value.tv_nsec = 1000000*(PROC_BTWRITE_TIMER_TIMEOUT_MS%1000);
+ ts.it_interval.tv_sec = 0;
+ ts.it_interval.tv_nsec = 0;
+ }
+ } else {
+ /* unarm timer if writing 0 to lpm; reduce unnecessary user space wakeup */
+ memset(&ts, 0, sizeof(ts));
+ }
+
+ if (timer_settime(lpm_proc_cb.timer_id, 0, &ts, 0) == 0) {
+ UPIODBG("%s : timer_settime success", __FUNCTION__);
+ } else {
+ UPIODBG("%s : timer_settime failed", __FUNCTION__);
+ }
}
#endif
@@ -330,6 +365,8 @@ void upio_set(uint8_t pio, uint8_t action, uint8_t polarity)
char buffer;
#endif
+ UPIODBG("%s : pio %d action %d, polarity %d", __FUNCTION__, pio, action, polarity);
+
switch (pio)
{
case UPIO_LPM_MODE:
@@ -353,12 +390,10 @@ void upio_set(uint8_t pio, uint8_t action, uint8_t polarity)
if (action == UPIO_ASSERT)
{
- UPIODBG("LPM asserted");
buffer = '1';
}
else
{
- UPIODBG("LPM deasserted");
buffer = '0';
// delete btwrite assertion holding timer
@@ -374,6 +409,7 @@ void upio_set(uint8_t pio, uint8_t action, uint8_t polarity)
ALOGE("upio_set : write(%s) failed: %s (%d)",
VENDOR_LPM_PROC_NODE, strerror(errno),errno);
}
+#if (PROC_BTWRITE_TIMER_TIMEOUT_MS != 0)
else
{
if (action == UPIO_ASSERT)
@@ -397,6 +433,7 @@ void upio_set(uint8_t pio, uint8_t action, uint8_t polarity)
}
}
}
+#endif
if (fd >= 0)
close(fd);
@@ -404,7 +441,6 @@ void upio_set(uint8_t pio, uint8_t action, uint8_t polarity)
break;
case UPIO_BT_WAKE:
-
if (upio_state[UPIO_BT_WAKE] == action)
{
UPIODBG("BT_WAKE is %s already", lpm_state[action]);
@@ -420,22 +456,16 @@ void upio_set(uint8_t pio, uint8_t action, uint8_t polarity)
* a 10sec internal in-activity timeout timer before it
* attempts to deassert BT_WAKE line.
*/
-#endif
+ return;
+#else
return;
+#endif
}
upio_state[UPIO_BT_WAKE] = action;
- /****************************************
- * !!! TODO !!!
- *
- * === Custom Porting Required ===
- *
- * Platform dependent user-to-kernel
- * interface is required to set output
- * state of physical BT_WAKE pin.
- ****************************************/
#if (BT_WAKE_VIA_USERIAL_IOCTL == TRUE)
+
userial_vendor_ioctl( ( (action==UPIO_ASSERT) ? \
USERIAL_OP_ASSERT_BT_WAKE : USERIAL_OP_DEASSERT_BT_WAKE),\
NULL);
@@ -445,12 +475,10 @@ void upio_set(uint8_t pio, uint8_t action, uint8_t polarity)
/*
* Kick proc btwrite node only at UPIO_ASSERT
*/
+#if (BT_WAKE_VIA_PROC_NOTIFY_DEASSERT == FALSE)
if (action == UPIO_DEASSERT)
- {
- UPIODBG("btwake deassertion");
return;
- }
-
+#endif
fd = open(VENDOR_BTWRITE_PROC_NODE, O_WRONLY);
if (fd < 0)
@@ -459,36 +487,33 @@ void upio_set(uint8_t pio, uint8_t action, uint8_t polarity)
VENDOR_BTWRITE_PROC_NODE, strerror(errno), errno);
return;
}
-
- buffer = '1';
+#if (BT_WAKE_VIA_PROC_NOTIFY_DEASSERT == TRUE)
+ if (action == UPIO_DEASSERT)
+ buffer = '0';
+ else
+#endif
+ buffer = '1';
if (write(fd, &buffer, 1) < 0)
{
ALOGE("upio_set : write(%s) failed: %s (%d)",
VENDOR_BTWRITE_PROC_NODE, strerror(errno),errno);
}
+#if (PROC_BTWRITE_TIMER_TIMEOUT_MS != 0)
else
{
- lpm_proc_cb.btwrite_active = TRUE;
-
- if (lpm_proc_cb.timer_created == TRUE)
- {
- struct itimerspec ts;
-
- ts.it_value.tv_sec = PROC_BTWRITE_TIMER_TIMEOUT_MS/1000;
- ts.it_value.tv_nsec = 1000*(PROC_BTWRITE_TIMER_TIMEOUT_MS%1000);
- ts.it_interval.tv_sec = 0;
- ts.it_interval.tv_nsec = 0;
-
- timer_settime(lpm_proc_cb.timer_id, 0, &ts, 0);
- }
+ /* arm user space timer based on action */
+ upio_start_stop_timer(action);
}
- //ms_delay(10);
- UPIODBG("proc btwrite assertion");
+#endif
+
+ UPIODBG("%s: proc btwrite assertion, buffer: %c, timer_armed %d %d",
+ __FUNCTION__, buffer, lpm_proc_cb.btwrite_active, lpm_proc_cb.timer_created);
if (fd >= 0)
close(fd);
#endif
+
break;
case UPIO_HOST_WAKE: