@@ -104,6 +104,7 @@ struct brcmstb_pm_control {
u32 phy_b_standby_ctrl_offs;
bool needs_ddr_pad;
struct platform_device *pdev;
+ suspend_state_t pm_state;
};
enum bsp_initiate_command {
@@ -533,9 +534,30 @@ static int brcmstb_pm_valid(suspend_state_t state)
}
}
+static int brcmstb_pm_begin(suspend_state_t state)
+{
+ ctrl.pm_state = state;
+
+ return 0;
+}
+
+static enum platform_target_state brcmstb_target_state(void)
+{
+ switch (ctrl.pm_state) {
+ case PM_SUSPEND_STANDBY:
+ return PLATFORM_STATE_WORKING;
+ case PM_SUSPEND_MEM:
+ return PLATFORM_STATE_BRCMSTB_S3MEM;
+ default:
+ return PLATFORM_STATE_UNKNOWN;
+ }
+}
+
static const struct platform_suspend_ops brcmstb_pm_ops = {
+ .begin = brcmstb_pm_begin,
.enter = brcmstb_pm_enter,
.valid = brcmstb_pm_valid,
+ .target_state = brcmstb_target_state,
};
static const struct of_device_id aon_ctrl_dt_ids[] = {
@@ -58,6 +58,7 @@ enum platform_target_state {
PLATFORM_STATE_ACPI_S3,
PLATFORM_STATE_ACPI_S4,
/* Add platform specific states here */
+ PLATFORM_STATE_BRCMSTB_S3MEM,
};
struct suspend_stats {
Provide a target_state callback implementation which just returns the suspend_state_t the system is about to enter. Broadcom STB drivers can utilize platform_suspend_target_state() to retrieve that and take appropriate actions (e.g: full vs. partial re-initialization). Two states are implemented: PLATFORM_STATE_WORKING and PLATFORM_STATE_BRCMSTB_S3MEM to that end. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> --- drivers/soc/bcm/brcmstb/pm/pm-arm.c | 22 ++++++++++++++++++++++ include/linux/suspend.h | 1 + 2 files changed, 23 insertions(+)