diff options
author | Andrew McRae <amcrae@google.com> | 2022-02-08 13:51:28 +1100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-02-10 02:48:00 +0000 |
commit | c1aa7b9a40779795101dcf2a698f70333999aa4b (patch) | |
tree | 297ccf5b642fb9add9fd362a10cbcd70c021ce39 /zephyr/shim/src/fan.c | |
parent | c19829dcc0d033c18932707ea7c157755df6a45e (diff) | |
download | chrome-ec-c1aa7b9a40779795101dcf2a698f70333999aa4b.tar.gz |
zephyr: Convert fan GPIO access to use Zephyr API
Convert fan shim to use Zephyr GPIO API.
It would be best to use a struct gpio_dt_spec * instead
of a GPIO enum signal, but there is a large chunk
of common fan code shimmed in that relies on this.
BUG=b:216466985
TEST=zmake testall
BRANCH=none
Signed-off-by: Andrew McRae <amcrae@google.com>
Change-Id: I1fc94a6bfe61ddd5961de86ba00219c03c641d36
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3445981
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr/shim/src/fan.c')
-rw-r--r-- | zephyr/shim/src/fan.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/zephyr/shim/src/fan.c b/zephyr/shim/src/fan.c index 932688fc9c..91f6b388f3 100644 --- a/zephyr/shim/src/fan.c +++ b/zephyr/shim/src/fan.c @@ -371,9 +371,11 @@ void fan_set_rpm_target(int ch, int rpm) int fan_is_stalled(int ch) { int is_pgood = 1; + const struct gpio_dt_spec *gp = + gpio_get_dt_spec(fans[ch].conf->enable_gpio); - if (gpio_is_implemented(fans[ch].conf->enable_gpio)) - is_pgood = gpio_get_level(fans[ch].conf->enable_gpio); + if (gp != NULL) + is_pgood = gpio_pin_get_dt(gp); return fan_get_enabled(ch) && fan_get_duty(ch) && !fan_get_rpm_actual(ch) && is_pgood; |