mirror of
https://gitlab.com/mobian1/eg25-manager.git
synced 2025-08-30 15:52:11 +02:00
at: wake only when sending AT commands
Allow the modem to enter soft sleep when we don't talk to the modem using AT commands. This was already the case in suspend, but not during runtime. By only waking the modem from soft sleep when we need to send an AT command, we can save some power.
This commit is contained in:
24
src/gpio.c
24
src/gpio.c
@@ -6,6 +6,8 @@
|
||||
|
||||
#include "gpio.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#define GPIO_CHIP1_LABEL "1c20800.pinctrl"
|
||||
#define GPIO_CHIP2_LABEL "1f02c00.pinctrl"
|
||||
|
||||
@@ -52,7 +54,6 @@ int gpio_sequence_shutdown(struct EG25Manager *manager)
|
||||
int gpio_sequence_suspend(struct EG25Manager *manager)
|
||||
{
|
||||
gpiod_line_set_value(manager->gpio_out[GPIO_OUT_APREADY], 1);
|
||||
gpiod_line_set_value(manager->gpio_out[GPIO_OUT_DTR], 1);
|
||||
|
||||
g_message("Executed suspend sequence");
|
||||
|
||||
@@ -62,13 +63,32 @@ int gpio_sequence_suspend(struct EG25Manager *manager)
|
||||
int gpio_sequence_resume(struct EG25Manager *manager)
|
||||
{
|
||||
gpiod_line_set_value(manager->gpio_out[GPIO_OUT_APREADY], 0);
|
||||
gpiod_line_set_value(manager->gpio_out[GPIO_OUT_DTR], 0);
|
||||
|
||||
g_message("Executed resume sequence");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gpio_sequence_wake(struct EG25Manager *manager)
|
||||
{
|
||||
gpiod_line_set_value(manager->gpio_out[GPIO_OUT_DTR], 0);
|
||||
|
||||
/* Give the modem 5ms to wake from soft sleep */
|
||||
usleep(5000);
|
||||
|
||||
g_message("Executed soft wake sequence");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gpio_sequence_sleep(struct EG25Manager *manager)
|
||||
{
|
||||
gpiod_line_set_value(manager->gpio_out[GPIO_OUT_DTR], 1);
|
||||
g_message("Executed soft sleep sequence");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static guint get_config_gpio(toml_table_t *config, const char *id)
|
||||
{
|
||||
toml_datum_t value = toml_int_in(config, id);
|
||||
|
Reference in New Issue
Block a user