Device trying to suspend when screen is turned off by proximity sensor (during a call)

Bug #1359530 reported by Ricardo Salveti on 2014-08-21
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Unity System Compositor
Undecided
Unassigned
powerd
Undecided
Alberto Aguirre
powerd (Ubuntu)
Undecided
Unassigned
unity-system-compositor (Ubuntu)
High
Alberto Aguirre

Bug Description

phablet@ubuntu-phablet:~$ system-image-cli -i
current build number: 202
device name: krillin
channel: ubuntu-touch/utopic-proposed
last update: 2014-08-21 03:59:43
version version: 202
version ubuntu: 20140821
version device: 20140811.1

Device tries to suspend when the screen is turned off by the proximity sensor (when a voicecall is in place).

Looking at powerd, there's no active suspend blocker when the proximity sensor disables the screen, forcing powerd to go in suspend state.

The device shouldn't try to suspend when a voicecall is active (or when the proximity sensor is the one turning the screen off).

When the call starts:
powerd-cli: Running as user is not fully supported.
System State Requests:
  Name: com.canonical.Unity.Screen, Owner: :1.18, State: 1

After putting my hand on top of the device (to trigger the proximity sensor):
phablet@ubuntu-phablet:~$ powerd-cli list
powerd-cli: Running as user is not fully supported.
System State Requests:
  None

Related branches

affects: powerd (Ubuntu) → unity-system-compositor (Ubuntu)
Changed in unity-system-compositor (Ubuntu):
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Alberto Aguirre (albaguirre)
tags: added: rtm14
description: updated
description: updated
Changed in unity-system-compositor:
status: New → Invalid
Changed in unity-system-compositor (Ubuntu):
status: Confirmed → Invalid
Changed in powerd:
assignee: nobody → Alberto Aguirre (albaguirre)
status: New → In Progress
Seth Forshee (sforshee) wrote :

Why isn't it valid for the system CPU to suspend during a phone call? Does android enforce such a restriction?

Ricardo Salveti (rsalveti) wrote :

Yeah, checking android this is actually an expected behavior (the phone will not suspend anyway because of a wakelock).

The question I had initially was actually regarding the proximity sensor, and how would that work when an app decides to use it without any general suspend blocker. Not sure if the hardware will trigger the cpu in order for the device to not be suspended when the proximity sensor is active.

But at least for voicecall, you're right, we can mark this bug as invalid.

Changed in powerd:
status: In Progress → Invalid
Changed in powerd (Ubuntu):
status: New → Invalid
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)
   {

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers