-
Notifications
You must be signed in to change notification settings - Fork 8.1k
drivers: modem: cellular: Close down CMUX before shut down #97571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Refactor internal event bits to use state enum values and define set_state() and wait_state() so we don't need two set of variables to maintain. Signed-off-by: Seppo Takalo <[email protected]>
Instead of dropping all responses, handle the CLD. Signed-off-by: Seppo Takalo <[email protected]>
If we immediately send disconnected event when CLD is received, we might close the UART pipe before the response is actually send. Also, shutdown_handler should not retry indefinitely. Signed-off-by: Seppo Takalo <[email protected]>
Properly close down the CMUX channel before shutting down the modem. The CMUX Close-Down command should indicate the remote end to clean up, even if we don't have shutdown script or power-key GPIO. Signed-off-by: Seppo Takalo <[email protected]>
|
case MODEM_CMUX_COMMAND_CLD: | ||
modem_cmux_on_cld_command(cmux, command); | ||
break; | ||
default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reviewers: In case you are wondering why switch-case with only one case, see the PR #97362 there is PSC command handler coming.
This is just split into its own PR.
set_state(cmux, MODEM_CMUX_STATE_DISCONNECTED); | ||
k_mutex_lock(&cmux->transmit_rb_lock, K_FOREVER); | ||
cmux->flow_control_on = false; | ||
k_mutex_unlock(&cmux->transmit_rb_lock); | ||
modem_cmux_raise_event(cmux, MODEM_CMUX_EVENT_DISCONNECTED); | ||
} else { | ||
set_state(cmux, MODEM_CMUX_STATE_DISCONNECTING); | ||
k_work_schedule(&cmux->disconnect_work, MODEM_CMUX_T1_TIMEOUT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is duplicated in two spots. Maybe make it a function?
drivers: modem: cellular: Close down CMUX before shut down
Properly close down the CMUX channel before shutting down
the modem.
The CMUX Close-Down command should indicate the remote end
to clean up, even if we don't have shutdown script or power-key GPIO.
Requires also minor fix to CMUX so we send disconnect event only after responding to CLD (Multiplexer Close Down).
If we immediately send disconnected event when CLD is received,
we might close the UART pipe before the response is actually send.
Contains changes from PR #97570