summaryrefslogtreecommitdiff
path: root/zephyr/projects/corsola/src/krabby
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2022-03-24 13:04:49 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-03-29 18:06:20 +0000
commit020d5f25e593847ec16142d77795d94a73f1ea87 (patch)
tree4e4f42b01cc672974f8a172dd1a0c5cccb9af972 /zephyr/projects/corsola/src/krabby
parent5a66d11d0f0170752805223642a627904ba52573 (diff)
downloadchrome-ec-020d5f25e593847ec16142d77795d94a73f1ea87.tar.gz
corsola: convert HOOK_INIT to SYS_INIT
Convert all HOOK_INIT calls to the equivalent SYS_INIT. BUG=b:226434387 BRANCH=none TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ib63d32bf88bbbcc74f1dc417c9e4b7ebd5ac5027 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3553843 Reviewed-by: Al Semjonovs <asemjonovs@google.com>
Diffstat (limited to 'zephyr/projects/corsola/src/krabby')
-rw-r--r--zephyr/projects/corsola/src/krabby/charger_workaround.c10
-rw-r--r--zephyr/projects/corsola/src/krabby/hooks.c3
-rw-r--r--zephyr/projects/corsola/src/krabby/led.c9
-rw-r--r--zephyr/projects/corsola/src/krabby/usbc_config.c14
4 files changed, 26 insertions, 10 deletions
diff --git a/zephyr/projects/corsola/src/krabby/charger_workaround.c b/zephyr/projects/corsola/src/krabby/charger_workaround.c
index 440bf609e2..62bedb4c1f 100644
--- a/zephyr/projects/corsola/src/krabby/charger_workaround.c
+++ b/zephyr/projects/corsola/src/krabby/charger_workaround.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include <toolchain.h>
+
#include "charger.h"
#include "driver/charger/rt9490.h"
#include "hooks.h"
@@ -10,10 +12,11 @@
#include "system.h"
/* work around for IBUS ADC unstable issue */
-void board_rt9490_workaround(void)
+static int board_rt9490_workaround(const struct device *unused)
{
+ ARG_UNUSED(unused);
if (system_get_board_version() != 0)
- return;
+ return 0;
i2c_update8(chg_chips[CHARGER_SOLO].i2c_port,
chg_chips[CHARGER_SOLO].i2c_addr_flags,
@@ -37,5 +40,6 @@ void board_rt9490_workaround(void)
RT9490_REG_ADC_CHANNEL0,
RT9490_VSYS_ADC_DIS,
MASK_CLR);
+ return 0;
}
-DECLARE_HOOK(HOOK_INIT, board_rt9490_workaround, HOOK_PRIO_DEFAULT);
+SYS_INIT(board_rt9490_workaround, APPLICATION, HOOK_PRIO_DEFAULT);
diff --git a/zephyr/projects/corsola/src/krabby/hooks.c b/zephyr/projects/corsola/src/krabby/hooks.c
index 70f3efe8e1..9ce46e90f7 100644
--- a/zephyr/projects/corsola/src/krabby/hooks.c
+++ b/zephyr/projects/corsola/src/krabby/hooks.c
@@ -5,6 +5,7 @@
#include <init.h>
#include <drivers/gpio.h>
+#include <toolchain.h>
#include <ap_power/ap_power.h>
#include "gpio.h"
@@ -63,6 +64,7 @@ static void board_suspend_handler(struct ap_power_ev_callback *cb,
static int install_suspend_handler(const struct device *unused)
{
+ ARG_UNUSED(unused);
static struct ap_power_ev_callback cb;
/*
@@ -73,5 +75,4 @@ static int install_suspend_handler(const struct device *unused)
ap_power_ev_add_callback(&cb);
return 0;
}
-
SYS_INIT(install_suspend_handler, APPLICATION, 1);
diff --git a/zephyr/projects/corsola/src/krabby/led.c b/zephyr/projects/corsola/src/krabby/led.c
index 43832d7485..38f0ddf0b6 100644
--- a/zephyr/projects/corsola/src/krabby/led.c
+++ b/zephyr/projects/corsola/src/krabby/led.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include <toolchain.h>
+
#include "chipset.h"
#include "ec_commands.h"
#include "hooks.h"
@@ -91,10 +93,13 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
return EC_SUCCESS;
}
-void board_led_init(void)
+static int board_led_init(const struct device *unused)
{
+ ARG_UNUSED(unused);
pwm_set_duty(LED_POWER_WHITE, 100);
pwm_set_duty(LED_BATTERY_AMBER, 100);
pwm_set_duty(LED_BATTERY_WHITE, 100);
+
+ return 0;
}
-DECLARE_HOOK(HOOK_INIT, board_led_init, HOOK_PRIO_DEFAULT);
+SYS_INIT(board_led_init, APPLICATION, HOOK_PRIO_DEFAULT);
diff --git a/zephyr/projects/corsola/src/krabby/usbc_config.c b/zephyr/projects/corsola/src/krabby/usbc_config.c
index b46a9edf8f..36a721a7ee 100644
--- a/zephyr/projects/corsola/src/krabby/usbc_config.c
+++ b/zephyr/projects/corsola/src/krabby/usbc_config.c
@@ -4,6 +4,7 @@
*/
/* Krabby board-specific USB-C configuration */
+#include <toolchain.h>
#include "adc.h"
#include "baseboard_usbc_config.h"
@@ -47,23 +48,28 @@ void c1_bc12_interrupt(enum gpio_signal signal)
}
-static void board_sub_bc12_init(void)
+static int board_sub_bc12_init(const struct device *unused)
{
+ ARG_UNUSED(unused);
if (corsola_get_db_type() == CORSOLA_DB_TYPEC)
gpio_enable_dt_interrupt(
GPIO_INT_FROM_NODELABEL(int_usb_c1_bc12_charger));
else
/* If this is not a Type-C subboard, disable the task. */
task_disable_task(TASK_ID_USB_CHG_P1);
+
+ return 0;
}
/* Must be done after I2C and subboard */
-DECLARE_HOOK(HOOK_INIT, board_sub_bc12_init, HOOK_PRIO_POST_I2C);
+SYS_INIT(board_sub_bc12_init, APPLICATION, HOOK_PRIO_POST_I2C);
-static void board_usbc_init(void)
+static int board_usbc_init(const struct device *unused)
{
+ ARG_UNUSED(unused);
gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c0_ppc_bc12));
+ return 0;
}
-DECLARE_HOOK(HOOK_INIT, board_usbc_init, HOOK_PRIO_POST_DEFAULT);
+SYS_INIT(board_usbc_init, APPLICATION, HOOK_PRIO_POST_DEFAULT);
void ppc_interrupt(enum gpio_signal signal)
{