Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4524c0ed authored by Lina Iyer's avatar Lina Iyer
Browse files

drivers: qcom: system_pm: allow idle drivers to query system state



cpuidle drivers may only allow system low power modes if the system
state is quiesced. Check the TCS controller state to ensure there are no
pending transactions.

Change-Id: Ia47049dcb6f2f35d437569bfb2eacaa610f1e03a
Signed-off-by: default avatarLina Iyer <ilina@codeaurora.org>
parent 4a8655fb
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include <linux/platform_device.h>

#include <soc/qcom/rpmh.h>
#include <soc/qcom/system_pm.h>

#define ARCH_TIMER_HZ		(19200000UL)
#define PDC_TIME_VALID_SHIFT	31
@@ -33,6 +34,15 @@ static int setup_wakeup(uint64_t sleep_val)
	return rpmh_write_control(rpmh_client, cmd, ARRAY_SIZE(cmd));
}

/**
 * system_sleep_allowed() - Returns if its okay to enter system low power modes
 */
bool system_sleep_allowed(void)
{
	return (rpmh_ctrlr_idle(rpmh_client) == 0);
}
EXPORT_SYMBOL(system_sleep_allowed);

/**
 * system_sleep_enter() - Activties done when entering system low power modes
 *
+7 −1
Original line number Diff line number Diff line
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -17,12 +17,18 @@
int system_sleep_enter(uint64_t sleep_val);

void system_sleep_exit(void);

bool system_sleep_allowed(void);
#else
static inline int system_sleep_enter(uint64_t sleep_val)
{ return -ENODEV; }

static inline void system_sleep_exit(void)
{ }

static inline bool system_sleep_allowed(void)
{ return false; }

#endif /* CONFIG_QTI_SYSTEM_PM */

#endif /* __SOC_QCOM_SYS_PM_H__ */