-
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
Conversation
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.
subsys/modem/modem_cmux.c
Outdated
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?
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.
Thanks. Fixed
@SeppoTakalo - needs a rebase |
Instead of dropping all responses, handle the CLD. Signed-off-by: Seppo Takalo <[email protected]>
0639885
67e74f1
to
0639885
Compare
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]>
0639885
to
8d80036
Compare
|
Rebased and fixed the duplicated code as @rerickson1 suggested. @tomi-font and @bjarki-andreasen please review again. |
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