capsensor:optimize suspend and resume process of sx9311 chip

-suspend,let capsensor enter sleep state
-resume,let capsensor enter active state

Change-Id: I34fa8a320def5e8a45c194f367ecd0ce5744a48b
Signed-off-by: wunan3 <wunan3@lenovo.com>
Reviewed-on: https://gerrit.mot.com/1289270
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wen Xie <xiewen3@motorola.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
wunan3 2019-01-03 15:30:36 +08:00 • committed by Nan Wu
commit 12edbc9f14
2 changed files with 13 additions and 4 deletions

View file

@ -1660,6 +1660,10 @@ void sx93XX_suspend(psx93XX_t this)
if (sx9310_debug_enable)
LOG_INFO("sx9310 suspend: disable irq!\n");
disable_irq(this->irq);
/* if upper layer don't disable capsensor, */
/* we should let it enter sleep in suspend. */
if (mEnabled)
write_register(this, SX9310_CPS_CTRL0_REG, 0x20);
}
}
void sx93XX_resume(psx93XX_t this)
@ -1675,6 +1679,9 @@ void sx93XX_resume(psx93XX_t this)
#else
sx93XX_schedule_work(this, 0);
#endif
/* we should let capsensor enter active in resume*/
if (mEnabled)
write_register(this, SX9310_CPS_CTRL0_REG, 0x2f);
enable_irq(this->irq);
write_register(this,0x41,0x01);
}

View file

@ -1578,8 +1578,9 @@ static void sx93XX_worker_func(struct work_struct *work)
void sx93XX_suspend(psx93XX_t this)
{
if (this) {
write_register(this, SX932x_CTRL1_REG,
this->board->cust_prox_ctrl0&0xdf);
if (mEnabled)
write_register(this, SX932x_CTRL1_REG,
this->board->cust_prox_ctrl0&0x20);
if (sx9325_debug_enable)
LOG_INFO("sx9325 suspend: disable irq!\n");
disable_irq(this->irq);
@ -1599,8 +1600,9 @@ void sx93XX_resume(psx93XX_t this)
sx93XX_schedule_work(this, 0);
#endif
enable_irq(this->irq);
write_register(this, SX932x_CTRL1_REG,
this->board->cust_prox_ctrl0|0x20);
if (mEnabled)
write_register(this, SX932x_CTRL1_REG,
this->board->cust_prox_ctrl0);
}
}