Loading drivers/cpuidle/lpm-levels.c +5 −1 Original line number Diff line number Diff line Loading @@ -980,6 +980,9 @@ static int cluster_select(struct lpm_cluster *cluster, bool from_idle, if (suspend_in_progress && from_idle && level->notify_rpm) continue; if (level->is_reset && !system_sleep_allowed()) continue; best_level = i; if (from_idle && Loading Loading @@ -1042,7 +1045,8 @@ static int cluster_configure(struct lpm_cluster *cluster, int idx, clear_predict_history(); clear_cl_predict_history(); system_sleep_enter(us); if (system_sleep_enter(us)) return -EBUSY; } /* Notify cluster enter event after successfully config completion */ cluster_notify(cluster, level, true); Loading drivers/soc/qcom/rpmh.c +22 −0 Original line number Diff line number Diff line Loading @@ -845,6 +845,28 @@ int rpmh_read(struct rpmh_client *rc, u32 addr, u32 *resp) } EXPORT_SYMBOL(rpmh_read); /** * rpmh_ctrlr_idle: Check if the controller is idle * * @rc: The RPMH handle got from rpmh_get_dev_channel * * Returns if the controller is idle or not. */ int rpmh_ctrlr_idle(struct rpmh_client *rc) { if (IS_ERR_OR_NULL(rc)) return -EINVAL; if (rpmh_standalone) return 0; if (!mbox_controller_is_idle(rc->chan)) return -EBUSY; return 0; } EXPORT_SYMBOL(rpmh_ctrlr_idle); static inline int is_req_valid(struct rpmh_req *req) { return (req->sleep_val != UINT_MAX && req->wake_val != UINT_MAX Loading drivers/soc/qcom/system_pm.c +10 −0 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 * Loading include/soc/qcom/rpmh.h +5 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ int rpmh_write_control(struct rpmh_client *rc, struct tcs_cmd *cmd, int n); int rpmh_invalidate(struct rpmh_client *rc); int rpmh_ctrlr_idle(struct rpmh_client *rc); int rpmh_flush(struct rpmh_client *rc); int rpmh_read(struct rpmh_client *rc, u32 addr, u32 *resp); Loading Loading @@ -82,6 +84,9 @@ static inline int rpmh_write_control(struct rpmh_client *rc, static inline int rpmh_invalidate(struct rpmh_client *rc) { return -ENODEV; } static inline int rpmh_ctrlr_idle(struct rpmh_client *rc) { return -ENODEV; } static inline int rpmh_flush(struct rpmh_client *rc) { return -ENODEV; } Loading include/soc/qcom/system_pm.h +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 Loading @@ -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__ */ Loading
drivers/cpuidle/lpm-levels.c +5 −1 Original line number Diff line number Diff line Loading @@ -980,6 +980,9 @@ static int cluster_select(struct lpm_cluster *cluster, bool from_idle, if (suspend_in_progress && from_idle && level->notify_rpm) continue; if (level->is_reset && !system_sleep_allowed()) continue; best_level = i; if (from_idle && Loading Loading @@ -1042,7 +1045,8 @@ static int cluster_configure(struct lpm_cluster *cluster, int idx, clear_predict_history(); clear_cl_predict_history(); system_sleep_enter(us); if (system_sleep_enter(us)) return -EBUSY; } /* Notify cluster enter event after successfully config completion */ cluster_notify(cluster, level, true); Loading
drivers/soc/qcom/rpmh.c +22 −0 Original line number Diff line number Diff line Loading @@ -845,6 +845,28 @@ int rpmh_read(struct rpmh_client *rc, u32 addr, u32 *resp) } EXPORT_SYMBOL(rpmh_read); /** * rpmh_ctrlr_idle: Check if the controller is idle * * @rc: The RPMH handle got from rpmh_get_dev_channel * * Returns if the controller is idle or not. */ int rpmh_ctrlr_idle(struct rpmh_client *rc) { if (IS_ERR_OR_NULL(rc)) return -EINVAL; if (rpmh_standalone) return 0; if (!mbox_controller_is_idle(rc->chan)) return -EBUSY; return 0; } EXPORT_SYMBOL(rpmh_ctrlr_idle); static inline int is_req_valid(struct rpmh_req *req) { return (req->sleep_val != UINT_MAX && req->wake_val != UINT_MAX Loading
drivers/soc/qcom/system_pm.c +10 −0 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 * Loading
include/soc/qcom/rpmh.h +5 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ int rpmh_write_control(struct rpmh_client *rc, struct tcs_cmd *cmd, int n); int rpmh_invalidate(struct rpmh_client *rc); int rpmh_ctrlr_idle(struct rpmh_client *rc); int rpmh_flush(struct rpmh_client *rc); int rpmh_read(struct rpmh_client *rc, u32 addr, u32 *resp); Loading Loading @@ -82,6 +84,9 @@ static inline int rpmh_write_control(struct rpmh_client *rc, static inline int rpmh_invalidate(struct rpmh_client *rc) { return -ENODEV; } static inline int rpmh_ctrlr_idle(struct rpmh_client *rc) { return -ENODEV; } static inline int rpmh_flush(struct rpmh_client *rc) { return -ENODEV; } Loading
include/soc/qcom/system_pm.h +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 Loading @@ -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__ */