Comment 3 for bug 1359530

Revision history for this message
landua (shutao-lan) wrote :

Actually in Android the system will try to invoke the early_suspend during a phone call. but it can not go to the deep sleep because of the wakelock. so I suggest that the psensor driver should be added the wakelock to prevent the issue.
Please add and check the follows:

--- a/mediatek/custom/common/kernel/alsps/tmd2772_auto/tmd2772.c
+++ b/mediatek/custom/common/kernel/alsps/tmd2772_auto/tmd2772.c
@@ -64,6 +64,7 @@ static u8 offset_data=0;
 #define PRO_OFFSET 1
 static u16 tmp_data=0;
 #define OFFDATA_DEFAULT 1
+struct wake_lock psensor_lock;
 //end
 /******************************************************************************
  * extern functions
@@ -2417,6 +2418,7 @@ int TMD2772_ps_operate(void* self, uint32_t command, void* buff_in, int size_in,
      tmd2772_ps_calibrate_call(obj->client);
      TMD2772_init_client(obj->client);
      #endif
+ wake_lock(&psensor_lock);
      if((err = TMD2772_enable_ps(obj->client, 1)))
      {
       APS_ERR("enable ps fail: %d\n", err);
@@ -2437,6 +2439,7 @@ int TMD2772_ps_operate(void* self, uint32_t command, void* buff_in, int size_in,
     }
     else
     {
+ wake_unlock(&psensor_lock);
      if((err = TMD2772_enable_ps(obj->client, 0)))
      {
       APS_ERR("disable ps fail: %d\n", err);
@@ -2819,7 +2822,7 @@ static int TMD2772_i2c_probe(struct i2c_client *client, const struct i2c_device_

  mutex_init(&mutex);
  TMD2772_i2c_client = client;
-
+ wake_lock_init(&psensor_lock,WAKE_LOCK_SUSPEND,"psensor wakelock");
  if(1 == obj->hw->polling_mode_ps)
   //if (1)
   {