Skip to content

Commit 431778c

Browse files
committed
modem: cmux: Implement Power Saving Control message
Signal powersaving mode for the remote end using PSC command. Wakes up the remote end from powersaving mode by sending flag characters. This method is defined in 3GPP TS 27.010. Sections 5.4.6.3.2 Power Saving Control (PSC) and 5.4.7 Power Control and Wake-up Mechanisms. Essentially it is one PSC command to indicate a sleep state, and then repeated flag characters to wake up the remote end or indicate that we are woken up. As we now have so many state transitions, I refactored the internal event bits to use set_state() and wait_state() so we don't need two set of variables to maintain. Signed-off-by: Seppo Takalo <[email protected]>
1 parent 38f0e6a commit 431778c

File tree

3 files changed

+208
-46
lines changed

3 files changed

+208
-46
lines changed

include/zephyr/modem/cmux.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ enum modem_cmux_state {
7272
MODEM_CMUX_STATE_DISCONNECTED = 0,
7373
MODEM_CMUX_STATE_CONNECTING,
7474
MODEM_CMUX_STATE_CONNECTED,
75+
MODEM_CMUX_STATE_ENTER_POWERSAVE,
76+
MODEM_CMUX_STATE_POWERSAVE,
77+
MODEM_CMUX_STATE_CONFIRM_POWERSAVE,
78+
MODEM_CMUX_STATE_WAKEUP,
7579
MODEM_CMUX_STATE_DISCONNECTING,
7680
};
7781

@@ -187,6 +191,7 @@ struct modem_cmux {
187191

188192
/* Synchronize actions */
189193
struct k_event event;
194+
k_timepoint_t t3_timepoint;
190195

191196
/* Statistics */
192197
#if CONFIG_MODEM_STATS

subsys/modem/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ config MODEM_CMUX_WORK_BUFFER_SIZE_EXTRA
6464
Extra bytes to add to the work buffers used by the CMUX module.
6565
The default size of these buffers is MODEM_CMUX_MTU + 7 (CMUX header size).
6666

67+
config MODEM_CMUX_T3_TIMEOUT
68+
int "CMUX T3 timeout in seconds"
69+
range 1 255
70+
default 10
71+
help
72+
Response Timer for wake-up procedure(T3).
73+
Time in seconds before the link is considered dead.
74+
6775
module = MODEM_CMUX
6876
module-str = modem_cmux
6977
source "subsys/logging/Kconfig.template.log_config"

0 commit comments

Comments
 (0)