5/25/2012

How does Proximity Sensor Data get measured and reported by DSPS?

On the 8960-based design, the DSPS streams the Proximity sensor data @ 5Hz and in parallel does the Proximity threshold detection (Near Vs. Far). Only when the state changes (Near-Far and vice-versa) does DSPS respond back to the Application which would have registered for such a callback earlier. This allows for better power optimization in that the Application does not need to be monitoring the streaming Proximity data as its being read/processed by DSPS so the AP can be power-collapsed during that time. DSPS currently does not support proximity sensor interrupt.


Reference Source Code File: sns_dd_alsprx.c


For more detailed description of the scenario, here is a call flow sequence for Proximity sensor data processing:


Assume the device has received a phone call.


1. Phone call is active
2. Android Power Manager requests proximity data through HAL
3. Sensor HAL (AP) sends proximity threshold detect request to DSPS (SAM)
4. SAM (DSPS) receives proximity threshold detect request and sends 5Hz proximity data request message to SMGR (also on DSPS)
5. SMGR (DSPS) receives proximity data request, starts reading proximity data at 5Hz, and returns data to SAM (DSPS)
6. SAM (DSPS) calculates near / far based on proximity threshold
7. If distance changes from near to far or vice versa, SAM (DSPS) sends proximity change indication message back to HAL (AP)
Note: If there's no change in distance, no proximity change indication message is sent  from DSPS to AP


8. When Sensor HAL (AP) receives proximity change indication message, it returns near / far indication to Android Power Manager
9. Android Power Manager will turn off screen if proximity indicates near and AP will go into power collapse
10. Go to step 5

No comments:

Post a Comment