Add fan control support to sysmgr for GFHD254.
Change-Id: Ibcffdfcebe74fb3b3591c9dcd7655eded7bb184f
diff --git a/sysmgr/peripheral/fan_control_params.tbl b/sysmgr/peripheral/fan_control_params.tbl
index 7566499..912de26 100644
--- a/sysmgr/peripheral/fan_control_params.tbl
+++ b/sysmgr/peripheral/fan_control_params.tbl
@@ -6,3 +6,6 @@
GFMS100_HDD 57 60 2 25 100 2
GFHD100_SOC 90 100 2 12 40 1
+
+# TODO(jnewlin): Need to update with new values after characterization.
+GFHD254_SOC 90 100 2 12 40 1
diff --git a/sysmgr/peripheral/fancontrol.cc b/sysmgr/peripheral/fancontrol.cc
index d427307..ca72805 100644
--- a/sysmgr/peripheral/fancontrol.cc
+++ b/sysmgr/peripheral/fancontrol.cc
@@ -150,6 +150,16 @@
temp_overheat : 120,
};
+const FanControlParams FanControl::kGFHD254FanCtrlSocDefaults = {
+ temp_setpt : 90,
+ temp_max : 100,
+ temp_step : 2,
+ duty_cycle_min: 12,
+ duty_cycle_max: 40,
+ pwm_step : 1,
+ temp_overheat : 120,
+ };
+
const FanControlParams FanControl::kGFLT110FanCtrlSocDefaults = {
temp_setpt : 0, /* No fan */
temp_max : 0,
@@ -233,6 +243,10 @@
pfan_ctrl_params_[BRUNO_SOC] = kGFHD200FanCtrlSocDefaults;
max = BRUNO_SOC;
break;
+ case BRUNO_GFHD254:
+ pfan_ctrl_params_[BRUNO_SOC] = kGFHD254FanCtrlSocDefaults;
+ max = BRUNO_SOC;
+ break;
case BRUNO_GFRG200:
/* Set thermal fan policy parameters of GFRG200 */
pfan_ctrl_params_[BRUNO_SOC] = kGFRG200FanCtrlSocDefaults;
diff --git a/sysmgr/peripheral/fancontrol.h b/sysmgr/peripheral/fancontrol.h
index 7cdcabe..d8fa5b5 100644
--- a/sysmgr/peripheral/fancontrol.h
+++ b/sysmgr/peripheral/fancontrol.h
@@ -71,6 +71,7 @@
static const FanControlParams kGFHD100FanCtrlSocDefaults;
static const FanControlParams kGFHD200FanCtrlSocDefaults;
+ static const FanControlParams kGFHD254FanCtrlSocDefaults;
static const FanControlParams kGFLT110FanCtrlSocDefaults;
diff --git a/sysmgr/peripheral/platform.cc b/sysmgr/peripheral/platform.cc
index 5daf474..f82ec8f 100644
--- a/sysmgr/peripheral/platform.cc
+++ b/sysmgr/peripheral/platform.cc
@@ -21,6 +21,7 @@
Platform("GFSC100", BRUNO_GFSC100, true, true),
Platform("GFLT110", BRUNO_GFLT110, false, false),
Platform("GFLT120", BRUNO_GFLT110, false, false),
+ Platform("GFHD254", BRUNO_GFHD254, false, true),
Platform("UNKNOWN PLATFORM", BRUNO_UNKNOWN, false, false),
};
@@ -33,19 +34,20 @@
GetPlatformType();
}
+#define ARRAYSIZE(a) \
+ ((sizeof(a) / sizeof(*(a))) / \
+ static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
+
void Platform::GetPlatformType(void) {
std::string result = GetLine((char *)PLATFORM_FILE, NULL);
- if (result.empty() == false) {
- for (int i = BRUNO_PLATFORM_FIRST; i < BRUNO_PLATFORM_MAX; i++) {
- if ((result.size() == kPlatformTable[i].name_.size()) &&
- (result.compare(0, kPlatformTable[i].name_.size(), kPlatformTable[i].name_) == 0)) {
- name_ = kPlatformTable[i].name_;
- type_ = kPlatformTable[i].type_;
- has_hdd_ = kPlatformTable[i].has_hdd_;
- has_fan_ = kPlatformTable[i].has_fan_;
- break;
- }
+ for (int i = 0; i < ARRAYSIZE(Platform::kPlatformTable); i++) {
+ if (result == kPlatformTable[i].name_) {
+ name_ = kPlatformTable[i].name_;
+ type_ = kPlatformTable[i].type_;
+ has_hdd_ = kPlatformTable[i].has_hdd_;
+ has_fan_ = kPlatformTable[i].has_fan_;
+ break;
}
}
diff --git a/sysmgr/peripheral/platform.h b/sysmgr/peripheral/platform.h
index 9f6ae1b..c5057b0 100644
--- a/sysmgr/peripheral/platform.h
+++ b/sysmgr/peripheral/platform.h
@@ -24,11 +24,11 @@
BRUNO_GFSC100, /* Spacecast */
BRUNO_GFHD200, /* Camaro */
BRUNO_GFLT110, /* Fiber Jack */
- BRUNO_PLATFORM_MAX
+ BRUNO_GFLT120, /* Fiber Jack */
+ BRUNO_GFHD254, /* Lockdown */
+ BRUNO_UNKNOWN
};
-#define BRUNO_UNKNOWN BRUNO_PLATFORM_MAX
-
class Platform {
public: