From 93c5086e1cc9edabbc78cd10081d724cb6091048 Mon Sep 17 00:00:00 2001 From: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com> Date: Mon, 28 Nov 2022 16:49:30 +0900 Subject: [PATCH] modem/alt1250: Add lowerhalf I/F to set power manager Add new interface to set power manager for resuming LTE function from sleep mode. --- boards/arm/cxd56xx/common/src/cxd56_alt1250.c | 27 +++++++++++++++++++ include/nuttx/modem/alt1250.h | 1 + 2 files changed, 28 insertions(+) diff --git a/boards/arm/cxd56xx/common/src/cxd56_alt1250.c b/boards/arm/cxd56xx/common/src/cxd56_alt1250.c index c8165c07f83a6..df1460d18acbf 100644 --- a/boards/arm/cxd56xx/common/src/cxd56_alt1250.c +++ b/boards/arm/cxd56xx/common/src/cxd56_alt1250.c @@ -38,6 +38,7 @@ #include #include +#include #include "cxd56_spi.h" #include "cxd56_dmac.h" @@ -80,6 +81,7 @@ static struct spi_dev_s *alt1250_poweron(void); static void alt1250_poweroff(void); static bool alt1250_powerstatus(void); +static int alt1250_hibernation_mode(bool enable); static void alt1250_reset(void); static void alt1250_irqattach(xcpt_t handler); static void alt1250_irqenable(bool enable); @@ -97,6 +99,7 @@ static const struct alt1250_lower_s g_alt1250_lower = .poweron = alt1250_poweron, .poweroff = alt1250_poweroff, .powerstatus = alt1250_powerstatus, + .hiber_mode = alt1250_hibernation_mode, .reset = alt1250_reset, .irqattach = alt1250_irqattach, .irqenable = alt1250_irqenable, @@ -307,6 +310,30 @@ static bool alt1250_powerstatus(void) return board_alt1250_powerstatus(); } +/**************************************************************************** + * Name: alt1250_hibernation_mode + * + * Description: + * Set power manager for entering hibernation mode. + * + ****************************************************************************/ + +static int alt1250_hibernation_mode(bool enable) +{ + uint32_t bootmask = 0; + + if (enable) + { + /* Set GPIO interrupt for wake-up */ + + bootmask = up_pm_get_bootmask(); + bootmask |= PM_BOOT_COLD_GPIO; + up_pm_set_bootmask(bootmask); + } + + return board_alt1250_powerkeep(enable); +} + /**************************************************************************** * Name: alt1250_reset * diff --git a/include/nuttx/modem/alt1250.h b/include/nuttx/modem/alt1250.h index 2351b85457c1c..fd7b7dcaaff16 100644 --- a/include/nuttx/modem/alt1250.h +++ b/include/nuttx/modem/alt1250.h @@ -306,6 +306,7 @@ struct alt1250_lower_s FAR struct spi_dev_s * (*poweron)(void); void (*poweroff)(void); bool (*powerstatus)(void); + int (*hiber_mode)(bool); void (*reset)(void); void (*irqattach)(xcpt_t handler); void (*irqenable)(bool enable);