Skip to content

Commit 095d11e

Browse files
[nrf fromlist] power_domain: nrfs_gdpwr: patch init sync
The nrfs_gdpwr driver has a two stage init, which requires tracking an "expected" state of the power domain, to be applied once the ipc service needed to control the power domain is ready. This was tracked with the "off" member of struct domain_data. So, "off" was initialized to false, but, should actually be initialized to true, since by default, if nothing needs the power domain, it should be turned off when ipc service is ready. To fix this, rename "off" member to "on" and adjust logic. Additionally, define the correct struct domain_data in the DOMAIN_DEFINE() macro. Can save 2 bytes. This did not cause any issue since we typecast it anyway, and its size is large enough. Upstream PR #: 94214 Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent 1d64291 commit 095d11e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/power_domain/power_domain_nrfs_gdpwr.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static const struct device *const domains[] = {
2626
};
2727

2828
struct domain_data {
29-
bool off;
29+
bool on;
3030
bool synced;
3131
};
3232

@@ -104,7 +104,7 @@ static int manager_set_domain(const struct device *dev, bool on)
104104
* is ready.
105105
*/
106106
ret = 0;
107-
dev_data->off = !on;
107+
dev_data->on = on;
108108
}
109109

110110
if (ret == 0) {
@@ -134,9 +134,9 @@ static int manager_sync_domain_locked(const struct device *dev)
134134

135135
/*
136136
* Power domains initialize ON so we only need to send a request
137-
* if the expected state of the power domain is OFF.
137+
* if the expected state of the power domain is not ON.
138138
*/
139-
if (dev_data->off) {
139+
if (!dev_data->on) {
140140
return manager_set_domain_locked(dev_config->domain, false);
141141
}
142142

@@ -261,7 +261,7 @@ static int domain_init(const struct device *dev)
261261
_CONCAT(GDPWR_GD_, DT_NODE_FULL_NAME_UPPER_TOKEN(node))
262262

263263
#define DOMAIN_DEFINE(node) \
264-
static struct domain_config DOMAIN_NODE_SYMNAME(node, data); \
264+
static struct domain_data DOMAIN_NODE_SYMNAME(node, data); \
265265
static const struct domain_config DOMAIN_NODE_SYMNAME(node, config) = { \
266266
.domain = DOMAIN_NODE_TO_GDPWR_ENUM(node), \
267267
}; \

0 commit comments

Comments
 (0)