summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2021-09-22 12:25:47 -0700
committerCommit Bot <commit-bot@chromium.org>2021-10-05 21:11:51 +0000
commit1737e04d766b5d6be543960271b5e781cb9c9235 (patch)
treeec47e3270dfebbee1eb09a87843ad46e40b82dce
parent6dc0328da93692f25e7de35243b0ca62691e2559 (diff)
downloadchrome-ec-factory-ambassador-14265.B-main.tar.gz
ioex: Skip initializing IOEXes if already initializedfactory-ambassador-14265.B-main
Some of the IOEXes are needed early than the task is initialized, those IOEXes will be initialized at the board level. This CL skips re-initializing the IOEXes from HOOK function if already initialized. BUG=none BRANCH=none TEST=Tested on ADL RVP, re-initialization of IOEX is skipped Change-Id: I3062c46992a5578bf8f0f0bc2613b6815c28a616 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3183330 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r--common/ioexpander.c10
-rw-r--r--include/ioexpander.h2
2 files changed, 10 insertions, 2 deletions
diff --git a/common/ioexpander.c b/common/ioexpander.c
index ccf3cc7c4a..d3e713a243 100644
--- a/common/ioexpander.c
+++ b/common/ioexpander.c
@@ -195,6 +195,8 @@ int ioex_init(int ioex)
}
}
+ ioex_config[ioex].flags |= IOEX_FLAGS_INITIALIZED;
+
return EC_SUCCESS;
}
@@ -202,8 +204,13 @@ static void ioex_init_default(void)
{
int i;
- for (i = 0; i < CONFIG_IO_EXPANDER_PORT_COUNT; i++)
+ for (i = 0; i < CONFIG_IO_EXPANDER_PORT_COUNT; i++) {
+ /* IO Expander has been initialized, skip re-initializing */
+ if (ioex_config[i].flags & IOEX_FLAGS_INITIALIZED)
+ continue;
+
ioex_init(i);
+ }
}
DECLARE_HOOK(HOOK_INIT, ioex_init_default, HOOK_PRIO_INIT_I2C + 1);
@@ -335,4 +342,3 @@ static int command_ioex_get(int argc, char **argv)
DECLARE_SAFE_CONSOLE_COMMAND(ioexget, command_ioex_get,
"[name]",
"Read level of IO expander pin(s)");
-
diff --git a/include/ioexpander.h b/include/ioexpander.h
index 4cd1930385..be70346d81 100644
--- a/include/ioexpander.h
+++ b/include/ioexpander.h
@@ -56,6 +56,8 @@ struct ioexpander_drv {
/* IO expander chip disabled. No I2C communication will be attempted. */
#define IOEX_FLAGS_DISABLED BIT(0)
+/* IO Expander has been initialized */
+#define IOEX_FLAGS_INITIALIZED BIT(1)
struct ioexpander_config_t {
/* Physical I2C port connects to the IO expander chip. */