Hawao: Fix NFC power consumption in sleep mode.

[Cause of problem]
Logic of NFC HAL: after sending the commands, HAL will pull down NFC
GPIO0 and notify NFC chip that it can sleep after wait for 1 second.

If power key is pressed, AP will sleeps quickly, so that the 1 second timeout processing of NFC
HAL can not be executed, so the NFC chip cannot sleep.
But there is no issue if enter sleep is by screen auto time-out

[Solution]
In the NFc driver suspend call, check whether the hal has pulled down
NFC GPIO0. If not, prevent the system go to sleep 1 second.

[Side-effect]
None (The time to prevent go to sleep is 1 second, this can be ignored
in power consumption)

Change-Id: If344d4510b02fef66bb23bfe05942c20280b9e02
Reviewed-on: https://gerrit.mot.com/2229464
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Wang Wang <wangwang1@mt.com>
Reviewed-by: Zhenghai Pan <panzh2@mt.com>
Reviewed-by: <tinno18@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
tinno18 2022-03-30 16:20:19 +08:00
parent cf67f8c238
commit d8fcc11066

View file

@ -810,13 +810,20 @@ static const struct file_operations sec_nfc_fops = {
static int sec_nfc_suspend(struct device *dev)
{
struct sec_nfc_info *info = SEC_NFC_GET_INFO(dev);
struct sec_nfc_platform_data *pdata = info->pdata;
int ret = 0;
int value = 0;
mutex_lock(&info->mutex);
if (info->mode == SEC_NFC_MODE_BOOTLOADER)
ret = -EPERM;
value = gpio_get_value(pdata->wake);
if(value > 0){
pr_info("%s: hal is still active, block suspend.\n", __func__);
ret = -EPERM;
}
mutex_unlock(&info->mutex);
return ret;