diff options
author | Yuval Peress <peress@chromium.org> | 2021-04-27 23:33:05 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-05-02 05:57:30 +0000 |
commit | b58e2cba26f06702838f2965003927b678e1859a (patch) | |
tree | 6aaea10a6bc7c17405a3309bf63feb0ed017e205 /zephyr | |
parent | 8c438c712b7d4113874addc52a88ab9508e3ee44 (diff) | |
download | chrome-ec-b58e2cba26f06702838f2965003927b678e1859a.tar.gz |
zephyr: pwm: fix init priority
Currently, the Zephyr pwm drivers were initialized at
<PRE_KERNEL_1, KERNEL_INIT_PRIORITY_DEVICE (50)> which is the same
priority as the shimmed pwm module. Zephyr does not guarantee any
ordering if there's a tie in the priority. I believe that this may
be the cause for the black screen after software sync (or at the
very least error prone).
BRANCH=none
BUG=b:186458444
TEST=zmake testall
Signed-off-by: Yuval Peress <peress@chromium.org>
Change-Id: I63758c6e11bc7b158fa27dd637f88dddd5d162cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2855993
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr')
-rw-r--r-- | zephyr/Kconfig.init_priority | 9 | ||||
-rw-r--r-- | zephyr/shim/src/pwm.c | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/zephyr/Kconfig.init_priority b/zephyr/Kconfig.init_priority index b8b3ab7195..af858a5296 100644 --- a/zephyr/Kconfig.init_priority +++ b/zephyr/Kconfig.init_priority @@ -15,3 +15,12 @@ config PLATFORM_EC_GPIO_INIT_PRIORITY help The initialization priority of the GPIO module. This should always happen after the gpio drivers are initialized. + +config PLATFORM_EC_PWM_INIT_PRIORITY + int "Initialization priority of the PWM module" + depends on PLATFORM_EC_PWM + default 51 + help + Sets the initialization priority of the PWM module. This MUST be a + value greater than the PWM driver's initialization priority which + currently defaults to KERNEL_INIT_PRIORITY_DEVICE. diff --git a/zephyr/shim/src/pwm.c b/zephyr/shim/src/pwm.c index a9466684d6..0446fd47ce 100644 --- a/zephyr/shim/src/pwm.c +++ b/zephyr/shim/src/pwm.c @@ -85,7 +85,10 @@ static int init_pwms(const struct device *unused) return rv; } -SYS_INIT(init_pwms, PRE_KERNEL_1, 50); +#if CONFIG_PLATFORM_EC_PWM_INIT_PRIORITY <= CONFIG_KERNEL_INIT_PRIORITY_DEVICE +#error "PWM init priority must be > KERNEL_INIT_PRIORITY_DEVICE" +#endif +SYS_INIT(init_pwms, PRE_KERNEL_1, CONFIG_PLATFORM_EC_PWM_INIT_PRIORITY); static struct pwm_config* pwm_lookup(enum pwm_channel ch) { |