[celestica]: update dx010 fan driver to support fault alarm

Signed-off-by: Guohan Lu <gulv@microsoft.com>
This commit is contained in:
Guohan Lu 2018-08-05 06:21:23 +00:00
parent b8a01dc3b4
commit 8e0f1f526f

View File

@ -448,6 +448,14 @@ show_fan_div(struct device *dev, struct device_attribute *da, char *buf)
return sprintf(buf, "%d\n", fan_div);
}
static ssize_t
show_fan_alarm(struct device *dev, struct device_attribute *da, char *buf)
{
struct emc2305_fan_data *fan = emc2305_update_device_fan(dev, da);
bool fault = ((fan->tach & 0x1fe0) == 0x1fe0);
return sprintf(buf, "%d\n", fault ? 1 : 0);
}
static ssize_t
set_fan_div(struct device *dev, struct device_attribute *da,
const char *buf, size_t count)
@ -577,6 +585,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *da,
EMC2305_ATTR_RO(fan, input, _num), \
EMC2305_ATTR_RO(fan, fault, _num), \
EMC2305_ATTR_RW(fan, div, _num), \
EMC2305_ATTR_RO(fan, alarm, _num), \
EMC2305_ATTR_RW(fan, target, _num), \
EMC2305_ATTR_RW(pwm, enable, _num), \
EMC2305_ATTR_RW2(pwm, _num) \