aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeandro Belli <leandro.belli@arm.com>2020-10-15 17:11:38 +0100
committertarek-arm <56722698+tarek-arm@users.noreply.github.com>2020-10-21 16:01:36 +0100
commit0882bb4d644d8e119a9a2cd0e3661b2726bcea8c (patch)
tree436201a23613468c7467cfc8c65c107f462fe5f7
parent2c4f3af270024b85e1b38fd963050c58f6e9b865 (diff)
scmi_system_power/boards: Add default timer_id and add extra check
When SCMI notifications are supported a timer is required to handle graceful request. If this feature is not used timer_id must be set to FWK_ID_NONE. This patch also adds check for FWK_ID_NONE to prevent a binding with no configuration set. Change-Id: I25f982c2e8d686ac80dd0ebc2d9e64eac1522f3c Signed-off-by: Leandro Belli <leandro.belli@arm.com>
-rw-r--r--module/scmi_system_power/include/mod_scmi_system_power.h3
-rw-r--r--module/scmi_system_power/src/mod_scmi_system_power.c35
-rw-r--r--product/morello/scp_ramfw_fvp/config_scmi_system_power.c2
-rw-r--r--product/n1sdp/scp_ramfw/config_scmi_system_power.c6
-rw-r--r--product/rddaniel/scp_ramfw/config_scmi_system_power.c6
-rw-r--r--product/rddanielxlr/scp_ramfw/config_scmi_system_power.c6
-rw-r--r--product/rdn1e1/scp_ramfw/config_scmi_system_power.c6
-rw-r--r--product/sgi575/scp_ramfw/config_scmi_system_power.c6
-rw-r--r--product/sgm775/scp_ramfw/config_scmi_system_power.c3
-rw-r--r--product/sgm776/scp_ramfw/config_scmi_system_power.c3
-rw-r--r--product/synquacer/scp_ramfw/config_scmi_system_power.c3
-rw-r--r--product/tc0/scp_ramfw/config_scmi_system_power.c4
12 files changed, 48 insertions, 35 deletions
diff --git a/module/scmi_system_power/include/mod_scmi_system_power.h b/module/scmi_system_power/include/mod_scmi_system_power.h
index ec0cdeaf..8c042682 100644
--- a/module/scmi_system_power/include/mod_scmi_system_power.h
+++ b/module/scmi_system_power/include/mod_scmi_system_power.h
@@ -63,6 +63,9 @@ struct mod_scmi_system_power_config {
/*!
* \brief Identifier of the alarm for graceful request timeout.
+ *
+ * \note This alarm is optional, if it is not used it must be set to
+ * FWK_ID_NONE
*/
fwk_id_t alarm_id;
diff --git a/module/scmi_system_power/src/mod_scmi_system_power.c b/module/scmi_system_power/src/mod_scmi_system_power.c
index 74e2f760..7b13e3b7 100644
--- a/module/scmi_system_power/src/mod_scmi_system_power.c
+++ b/module/scmi_system_power/src/mod_scmi_system_power.c
@@ -516,12 +516,16 @@ FWK_WEAK int scmi_sys_power_state_set_policy(
#ifdef BUILD_HAS_SCMI_NOTIFICATIONS
scmi_sys_power_state_notify(service_id, *state, false);
#endif
- scmi_sys_power_ctx.alarm_api->start(
- scmi_sys_power_ctx.config->alarm_id,
- scmi_sys_power_ctx.config->graceful_timeout,
- MOD_TIMER_ALARM_TYPE_ONCE,
- graceful_timer_callback,
- *state);
+
+ if (scmi_sys_power_ctx.alarm_api)
+ scmi_sys_power_ctx.alarm_api->start(
+ scmi_sys_power_ctx.config->alarm_id,
+ scmi_sys_power_ctx.config->graceful_timeout,
+ MOD_TIMER_ALARM_TYPE_ONCE,
+ graceful_timer_callback,
+ *state);
+ else
+ graceful_timer_callback(*state);
}
}
@@ -704,16 +708,17 @@ static int scmi_sys_power_bind(fwk_id_t id, unsigned int round)
* If notifications is supported a timer is required to handle graceful
* requests.
*/
- status = fwk_module_bind(
- scmi_sys_power_ctx.config->alarm_id,
- MOD_TIMER_API_ID_ALARM,
- &scmi_sys_power_ctx.alarm_api);
- if (status != FWK_SUCCESS)
- return status;
- return scmi_sys_power_init_notifications();
-#else
- return FWK_SUCCESS;
+ if (!fwk_id_is_equal(scmi_sys_power_ctx.config->alarm_id, FWK_ID_NONE)) {
+ status = fwk_module_bind(
+ scmi_sys_power_ctx.config->alarm_id,
+ MOD_TIMER_API_ID_ALARM,
+ &scmi_sys_power_ctx.alarm_api);
+ if (status != FWK_SUCCESS)
+ return status;
+ return scmi_sys_power_init_notifications();
+ }
#endif
+ return FWK_SUCCESS;
}
static int scmi_sys_power_process_bind_request(fwk_id_t source_id,
diff --git a/product/morello/scp_ramfw_fvp/config_scmi_system_power.c b/product/morello/scp_ramfw_fvp/config_scmi_system_power.c
index 31bb20d1..f969afda 100644
--- a/product/morello/scp_ramfw_fvp/config_scmi_system_power.c
+++ b/product/morello/scp_ramfw_fvp/config_scmi_system_power.c
@@ -15,5 +15,5 @@ const struct fwk_module_config config_scmi_system_power = {
&(struct mod_scmi_system_power_config){
.system_view = MOD_SCMI_SYSTEM_VIEW_FULL,
.system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0,
- },
+ .alarm_id = FWK_ID_NONE_INIT },
};
diff --git a/product/n1sdp/scp_ramfw/config_scmi_system_power.c b/product/n1sdp/scp_ramfw/config_scmi_system_power.c
index 821cb7d2..1ba43921 100644
--- a/product/n1sdp/scp_ramfw/config_scmi_system_power.c
+++ b/product/n1sdp/scp_ramfw/config_scmi_system_power.c
@@ -11,8 +11,8 @@
#include <fwk_module.h>
const struct fwk_module_config config_scmi_system_power = {
- .data = &((struct mod_scmi_system_power_config) {
+ .data = &((struct mod_scmi_system_power_config){
.system_view = MOD_SCMI_SYSTEM_VIEW_FULL,
- .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0
- }),
+ .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0,
+ .alarm_id = FWK_ID_NONE_INIT }),
};
diff --git a/product/rddaniel/scp_ramfw/config_scmi_system_power.c b/product/rddaniel/scp_ramfw/config_scmi_system_power.c
index 20b22582..abccf3f6 100644
--- a/product/rddaniel/scp_ramfw/config_scmi_system_power.c
+++ b/product/rddaniel/scp_ramfw/config_scmi_system_power.c
@@ -11,8 +11,8 @@
#include <fwk_module.h>
const struct fwk_module_config config_scmi_system_power = {
- .data = &((struct mod_scmi_system_power_config) {
+ .data = &((struct mod_scmi_system_power_config){
.system_view = MOD_SCMI_SYSTEM_VIEW_FULL,
- .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0
- }),
+ .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0,
+ .alarm_id = FWK_ID_NONE_INIT }),
};
diff --git a/product/rddanielxlr/scp_ramfw/config_scmi_system_power.c b/product/rddanielxlr/scp_ramfw/config_scmi_system_power.c
index 20b22582..abccf3f6 100644
--- a/product/rddanielxlr/scp_ramfw/config_scmi_system_power.c
+++ b/product/rddanielxlr/scp_ramfw/config_scmi_system_power.c
@@ -11,8 +11,8 @@
#include <fwk_module.h>
const struct fwk_module_config config_scmi_system_power = {
- .data = &((struct mod_scmi_system_power_config) {
+ .data = &((struct mod_scmi_system_power_config){
.system_view = MOD_SCMI_SYSTEM_VIEW_FULL,
- .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0
- }),
+ .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0,
+ .alarm_id = FWK_ID_NONE_INIT }),
};
diff --git a/product/rdn1e1/scp_ramfw/config_scmi_system_power.c b/product/rdn1e1/scp_ramfw/config_scmi_system_power.c
index 32714d2e..f1767fe2 100644
--- a/product/rdn1e1/scp_ramfw/config_scmi_system_power.c
+++ b/product/rdn1e1/scp_ramfw/config_scmi_system_power.c
@@ -11,8 +11,8 @@
#include <fwk_module.h>
const struct fwk_module_config config_scmi_system_power = {
- .data = &((struct mod_scmi_system_power_config) {
+ .data = &((struct mod_scmi_system_power_config){
.system_view = MOD_SCMI_SYSTEM_VIEW_FULL,
- .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0
- }),
+ .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0,
+ .alarm_id = FWK_ID_NONE_INIT }),
};
diff --git a/product/sgi575/scp_ramfw/config_scmi_system_power.c b/product/sgi575/scp_ramfw/config_scmi_system_power.c
index 821cb7d2..1ba43921 100644
--- a/product/sgi575/scp_ramfw/config_scmi_system_power.c
+++ b/product/sgi575/scp_ramfw/config_scmi_system_power.c
@@ -11,8 +11,8 @@
#include <fwk_module.h>
const struct fwk_module_config config_scmi_system_power = {
- .data = &((struct mod_scmi_system_power_config) {
+ .data = &((struct mod_scmi_system_power_config){
.system_view = MOD_SCMI_SYSTEM_VIEW_FULL,
- .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0
- }),
+ .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0,
+ .alarm_id = FWK_ID_NONE_INIT }),
};
diff --git a/product/sgm775/scp_ramfw/config_scmi_system_power.c b/product/sgm775/scp_ramfw/config_scmi_system_power.c
index 3a44bf60..47681867 100644
--- a/product/sgm775/scp_ramfw/config_scmi_system_power.c
+++ b/product/sgm775/scp_ramfw/config_scmi_system_power.c
@@ -15,5 +15,6 @@
struct fwk_module_config config_scmi_system_power = {
.data = &((struct mod_scmi_system_power_config){
.system_view = MOD_SCMI_SYSTEM_VIEW_FULL,
- .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0 }),
+ .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0,
+ .alarm_id = FWK_ID_NONE_INIT }),
};
diff --git a/product/sgm776/scp_ramfw/config_scmi_system_power.c b/product/sgm776/scp_ramfw/config_scmi_system_power.c
index 3a44bf60..47681867 100644
--- a/product/sgm776/scp_ramfw/config_scmi_system_power.c
+++ b/product/sgm776/scp_ramfw/config_scmi_system_power.c
@@ -15,5 +15,6 @@
struct fwk_module_config config_scmi_system_power = {
.data = &((struct mod_scmi_system_power_config){
.system_view = MOD_SCMI_SYSTEM_VIEW_FULL,
- .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0 }),
+ .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0,
+ .alarm_id = FWK_ID_NONE_INIT }),
};
diff --git a/product/synquacer/scp_ramfw/config_scmi_system_power.c b/product/synquacer/scp_ramfw/config_scmi_system_power.c
index 1b9720fa..1ba43921 100644
--- a/product/synquacer/scp_ramfw/config_scmi_system_power.c
+++ b/product/synquacer/scp_ramfw/config_scmi_system_power.c
@@ -13,5 +13,6 @@
const struct fwk_module_config config_scmi_system_power = {
.data = &((struct mod_scmi_system_power_config){
.system_view = MOD_SCMI_SYSTEM_VIEW_FULL,
- .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0 }),
+ .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0,
+ .alarm_id = FWK_ID_NONE_INIT }),
};
diff --git a/product/tc0/scp_ramfw/config_scmi_system_power.c b/product/tc0/scp_ramfw/config_scmi_system_power.c
index e5a491ae..167f213c 100644
--- a/product/tc0/scp_ramfw/config_scmi_system_power.c
+++ b/product/tc0/scp_ramfw/config_scmi_system_power.c
@@ -13,5 +13,7 @@
const struct fwk_module_config config_scmi_system_power = {
.data = &((struct mod_scmi_system_power_config){
.system_view = MOD_SCMI_SYSTEM_VIEW_FULL,
- .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0 }),
+ .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0,
+ .alarm_id = FWK_ID_NONE_INIT }),
+
};