Skip to content

Commit

Permalink
lte/alt1250: Check wakelock status when STOPAPI command process
Browse files Browse the repository at this point in the history
If wakelock is aquired, modem driver cannot change to sleep mode.
So, check wakelock status when sleep request is comming.
  • Loading branch information
SPRESENSE committed Jan 26, 2023
1 parent f15092c commit da36353
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lte/alt1250/alt1250_devevent.c
Expand Up @@ -190,6 +190,7 @@ static int perform_alt1250_resetevt(FAR struct alt1250_s *dev,
static void perform_alt1250_apistopevt(FAR struct alt1250_s *dev)
{
int ret = OK;
int w_cnt = 0;

/* All LTE API/Socket requests must be stopped to enter Suspend mode. */

Expand Down Expand Up @@ -251,10 +252,26 @@ static void perform_alt1250_apistopevt(FAR struct alt1250_s *dev)
goto exit;
}

/* TODO: When Wakelock is acquired, Suspend mode is rejected because
/* When Wakelock is acquired, Suspend mode is rejected because
* it is not possible to enter Suspend mode.
*/

w_cnt = altdevice_powercontrol(dev->altfd, LTE_CMDID_COUNTWLOCK);
if (w_cnt == 0)
{
ret = OK;
}
else if (w_cnt > 0)
{
dbg_alt1250("Cannot enter hibernation due to wakelock is aquired.\n");
ret = -EBUSY;
}
else
{
dbg_alt1250("Failed to get wakelock count.\n");
ret = w_cnt;
}

exit:

if (ret < 0)
Expand Down

0 comments on commit da36353

Please sign in to comment.