Skip to content

Commit

Permalink
drivers/modem/alt1250: Add LTE_CMDID_RESTARTAPI command
Browse files Browse the repository at this point in the history
ALT1250 driver sends an event named LTE_CMDID_RESTARTAPI
to ALT1250 daemon when state is PM_NOARMAL in the function
of prepare registered by pm_register.
  • Loading branch information
SPRESENSE authored and xiaoxiang781216 committed Feb 8, 2024
1 parent cb32e6d commit eaba1be
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
14 changes: 14 additions & 0 deletions drivers/modem/alt1250/alt1250.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ static int alt1250_power_control(FAR struct alt1250_dev_s *dev,

#ifdef CONFIG_PM
case LTE_CMDID_STOPAPI:
case LTE_CMDID_RESTARTAPI:
case LTE_CMDID_SUSPEND:
alt1250_receive_daemon_response(req);
break;
Expand Down Expand Up @@ -1380,6 +1381,19 @@ static int alt1250_pm_prepare(struct pm_callback_s *cb, int domain,

ret = alt1250_send_daemon_request(ALT1250_EVTBIT_STOPAPI);

if (ret)
{
return ERROR;
}
else
{
return OK;
}
}
else if (pmstate == PM_NORMAL)
{
ret = alt1250_send_daemon_request(ALT1250_EVTBIT_RESTARTAPI);

if (ret)
{
return ERROR;
Expand Down
9 changes: 5 additions & 4 deletions include/nuttx/modem/alt1250.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@
#define ALT1250_IOC_SETEVTBUFF _MODEMIOC(3)
#define ALT1250_IOC_EXCHGCONTAINER _MODEMIOC(4)

#define ALT1250_EVTBIT_RESET (1ULL << 63)
#define ALT1250_EVTBIT_REPLY (1ULL << 62)
#define ALT1250_EVTBIT_STOPAPI (1ULL << 61)
#define ALT1250_EVTBIT_SUSPEND (1ULL << 60)
#define ALT1250_EVTBIT_RESET (1ULL << 63)
#define ALT1250_EVTBIT_REPLY (1ULL << 62)
#define ALT1250_EVTBIT_STOPAPI (1ULL << 61)
#define ALT1250_EVTBIT_SUSPEND (1ULL << 60)
#define ALT1250_EVTBIT_RESTARTAPI (1ULL << 59)

/* Number of sockets */

Expand Down
1 change: 1 addition & 0 deletions include/nuttx/wireless/lte/lte_ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
#define LTE_CMDID_SETCTXCB _CMDGRP_NOMDM(0x40)
#define LTE_CMDID_COUNTWLOCK _CMDGRP_POWER(0x41)
#define LTE_CMDID_REPEVT_DUMMY _CMDGRP_EVENT(0x42)
#define LTE_CMDID_RESTARTAPI _CMDGRP_NORMAL(0x43)

#define LTE_CMDID_ACCEPT _CMDGRP_NORMAL(0x50)
#define LTE_CMDID_BIND _CMDGRP_NORMAL(0x51)
Expand Down

0 comments on commit eaba1be

Please sign in to comment.