aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFanming Kong <fmkong@mobvoi.com>2018-05-16 17:17:35 +0800
committerFanming Kong <fmkong@mobvoi.com>2018-05-16 17:17:35 +0800
commit54adf6198ab79192d9e133f777fd30df890a2ef7 (patch)
tree3c48ebd5bf70f31ac99e333ede28982eac4707e4
parent4f278d0719ce01b6b1a2d4091c91425d6a0794d7 (diff)
drivers: nanohub: disable dump resume reason for nanohub.android-wear-8.0.0_r0.24
Other changes: 1. change default fuel gauge capacity to 50%. 2. use timed out wake up request in function firmware query. 3. enlarge wake up timeout. Change-Id: I51809c7ff285fad69b193ec4897aa7eba9e824ea Signed-off-by: Fanming Kong <fmkong@mobvoi.com>
-rw-r--r--drivers/staging/nanohub/bq27xxx_fuelgauge.c4
-rw-r--r--drivers/staging/nanohub/main.c19
-rw-r--r--drivers/staging/nanohub/main.h3
3 files changed, 17 insertions, 9 deletions
diff --git a/drivers/staging/nanohub/bq27xxx_fuelgauge.c b/drivers/staging/nanohub/bq27xxx_fuelgauge.c
index 58b3ed917913..19d84e70fe65 100644
--- a/drivers/staging/nanohub/bq27xxx_fuelgauge.c
+++ b/drivers/staging/nanohub/bq27xxx_fuelgauge.c
@@ -29,7 +29,7 @@
int device_is_charging = 0;
#define DBG_ENABLE 1
-#define WAKEUP_TIMEOUT_MS 1000
+#define WAKEUP_TIMEOUT_MS 2000
#define BQ27XXX_FLAG_DSC BIT(0)
#define BQ27XXX_FLAG_SOCF BIT(1) /*State-of-Charge threshold final*/
@@ -617,7 +617,7 @@ int bq27x00_powersupply_init(struct device *dev,
struct Nanohub_FuelGauge_Info *fg_info;
struct bq27x00_reg_cache default_cache_data = {
2, 1, 8330, 365, 3710, 136, 380, 300, 402, 0,
- 263, 291, 292, 77, 29100, 75, 0, 1, 415, 26800};
+ 263, 291, 292, 77, 29100, 50, 0, 1, 415, 26800};
struct power_supply *usb_psy;
usb_psy = power_supply_get_by_name("usb");
diff --git a/drivers/staging/nanohub/main.c b/drivers/staging/nanohub/main.c
index 1f917f8d4c0f..c799ecb8b743 100644
--- a/drivers/staging/nanohub/main.c
+++ b/drivers/staging/nanohub/main.c
@@ -59,8 +59,8 @@ enum APP_TO_HOST_EVENT_SUBID {
#define OS_LOG_EVENTID 0x3B474F4C
#define WAKEUP_INTERRUPT 1
-#define WAKEUP_TIMEOUT_MS 1000
-#define SUSPEND_TIMEOUT_MS 100
+#define WAKEUP_TIMEOUT_MS 2000
+#define SUSPEND_TIMEOUT_MS 200
#define KTHREAD_ERR_TIME_NS (60LL * NSEC_PER_SEC)
#define KTHREAD_ERR_CNT 70
#define KTHREAD_WARN_CNT 10
@@ -589,7 +589,7 @@ static ssize_t nanohub_firmware_query(struct device *dev,
struct nanohub_data *data = dev_get_nanohub_data(dev);
uint16_t buffer[6];
- if (request_wakeup(data))
+ if (request_wakeup_timeout(data, WAKEUP_TIMEOUT_MS))
return -ERESTARTSYS;
if (nanohub_comms_tx_rx_retrans
@@ -874,8 +874,14 @@ static ssize_t nanohub_download_bl(struct device *dev,
uint8_t status = CMD_ACK;
ret = nanohub_wakeup_lock(data, LOCK_MODE_IO);
- if (ret < 0)
+ if (ret < 0) {
+ atomic_set(&data->download_bl_status,
+ DOWNLOAD_BL_TIMEOUT);
return ret;
+ }
+
+ atomic_set(&data->download_bl_status,
+ DOWNLOAD_BL_RUNNING);
__nanohub_hw_reset(data, 1);
@@ -906,6 +912,7 @@ static ssize_t nanohub_download_bl_status(struct device *dev,
{
struct nanohub_data *data = dev_get_nanohub_data(dev);
char status[][10] = {"Not Start",
+ "Running",
"Success",
"Failed",
"Time Out"};
@@ -1666,8 +1673,8 @@ static int nanohub_kthread(void *arg)
"%s: failed to reset nanohub: ret=%d\n",
__func__, ret);
}
- } else {
- atomic_set(&data->download_bl_status,
+ if (DOWNLOAD_BL_SUCCESS == atomic_read(&data->download_bl_status))
+ atomic_set(&data->download_bl_status,
DOWNLOAD_BL_FAILED);
}
msleep_interruptible(WAKEUP_TIMEOUT_MS);
diff --git a/drivers/staging/nanohub/main.h b/drivers/staging/nanohub/main.h
index 8f8a38cb8b53..19032852593c 100644
--- a/drivers/staging/nanohub/main.h
+++ b/drivers/staging/nanohub/main.h
@@ -28,7 +28,7 @@
#define NANOHUB_NAME "nanohub"
-#define NANOHUB_WAKEUP_TRACE_ENABLE (1)
+#define NANOHUB_WAKEUP_TRACE_ENABLE (0)
struct nanohub_buf {
struct list_head list;
@@ -179,6 +179,7 @@ enum AP_GPIO_CMD {
enum DOWNLOAD_BL_STATUS {
DOWNLOAD_BL_NOT_START = 0,
+ DOWNLOAD_BL_RUNNING,
DOWNLOAD_BL_SUCCESS,
DOWNLOAD_BL_FAILED,
DOWNLOAD_BL_TIMEOUT,