summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorDivya Sasidharan <divya.s.sasidharan@intel.com>2016-07-08 10:03:58 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-07-21 13:13:41 -0700
commit5df351f63cbe3834ae8f2df401f70cd04c99b5fe (patch)
tree14a7f869903407e3e9ab63c69eb28e4737c4fd89 /util
parent14dbcb829e2c676cb2325445f7e3b9f352833050 (diff)
downloadchrome-ec-5df351f63cbe3834ae8f2df401f70cd04c99b5fe.tar.gz
ectool: Fix incorrect fan numbers from ectool
Return 0 if the board does not need fan indicated by EC_FEATURE_PWM_FAN. BRANCH=None BUG=chrome-os-partner:55090 TEST=make buildall -j; in reef command "ectool pwmgetnumfans" returns 0 Change-Id: I7b59d266532622607c61fe3e7dd1bd0cc8ea9766 Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/359069 Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com> Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/ectool.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c
index bc6353640a..d42c6941f3 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -1688,6 +1688,14 @@ int cmd_thermal_set_threshold(int argc, char *argv[])
static int get_num_fans(void)
{
int idx, rv;
+ struct ec_response_get_features r;
+
+ rv = ec_command(EC_CMD_GET_FEATURES, 0, NULL, 0, &r, sizeof(r));
+ if (rv < 0)
+ return rv;
+
+ if (!(r.flags[0] & (1 << EC_FEATURE_PWM_FAN)))
+ return 0;
for (idx = 0; idx < EC_FAN_SPEED_ENTRIES; idx++) {
rv = read_mapped_mem16(EC_MEMMAP_FAN + 2 * idx);