diff options
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/adm9240.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c index 0727ad250793..9e234b981b83 100644 --- a/drivers/hwmon/adm9240.c +++ b/drivers/hwmon/adm9240.c | |||
@@ -20,7 +20,7 @@ | |||
20 | * Alarms 16-bit map of active alarms | 20 | * Alarms 16-bit map of active alarms |
21 | * Analog Out 0..1250 mV output | 21 | * Analog Out 0..1250 mV output |
22 | * | 22 | * |
23 | * Chassis Intrusion: clear CI latch with 'echo 1 > chassis_clear' | 23 | * Chassis Intrusion: clear CI latch with 'echo 0 > intrusion0_alarm' |
24 | * | 24 | * |
25 | * Test hardware: Intel SE440BX-2 desktop motherboard --Grant | 25 | * Test hardware: Intel SE440BX-2 desktop motherboard --Grant |
26 | * | 26 | * |
@@ -476,13 +476,16 @@ static ssize_t set_aout(struct device *dev, | |||
476 | static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout); | 476 | static DEVICE_ATTR(aout_output, S_IRUGO | S_IWUSR, show_aout, set_aout); |
477 | 477 | ||
478 | /* chassis_clear */ | 478 | /* chassis_clear */ |
479 | static ssize_t chassis_clear(struct device *dev, | 479 | static ssize_t chassis_clear_legacy(struct device *dev, |
480 | struct device_attribute *attr, | 480 | struct device_attribute *attr, |
481 | const char *buf, size_t count) | 481 | const char *buf, size_t count) |
482 | { | 482 | { |
483 | struct i2c_client *client = to_i2c_client(dev); | 483 | struct i2c_client *client = to_i2c_client(dev); |
484 | unsigned long val = simple_strtol(buf, NULL, 10); | 484 | unsigned long val = simple_strtol(buf, NULL, 10); |
485 | 485 | ||
486 | dev_warn(dev, "Attribute chassis_clear is deprecated, " | ||
487 | "use intrusion0_alarm instead\n"); | ||
488 | |||
486 | if (val == 1) { | 489 | if (val == 1) { |
487 | i2c_smbus_write_byte_data(client, | 490 | i2c_smbus_write_byte_data(client, |
488 | ADM9240_REG_CHASSIS_CLEAR, 0x80); | 491 | ADM9240_REG_CHASSIS_CLEAR, 0x80); |
@@ -490,7 +493,29 @@ static ssize_t chassis_clear(struct device *dev, | |||
490 | } | 493 | } |
491 | return count; | 494 | return count; |
492 | } | 495 | } |
493 | static DEVICE_ATTR(chassis_clear, S_IWUSR, NULL, chassis_clear); | 496 | static DEVICE_ATTR(chassis_clear, S_IWUSR, NULL, chassis_clear_legacy); |
497 | |||
498 | static ssize_t chassis_clear(struct device *dev, | ||
499 | struct device_attribute *attr, | ||
500 | const char *buf, size_t count) | ||
501 | { | ||
502 | struct i2c_client *client = to_i2c_client(dev); | ||
503 | struct adm9240_data *data = i2c_get_clientdata(client); | ||
504 | unsigned long val; | ||
505 | |||
506 | if (strict_strtoul(buf, 10, &val) || val != 0) | ||
507 | return -EINVAL; | ||
508 | |||
509 | mutex_lock(&data->update_lock); | ||
510 | i2c_smbus_write_byte_data(client, ADM9240_REG_CHASSIS_CLEAR, 0x80); | ||
511 | data->valid = 0; /* Force cache refresh */ | ||
512 | mutex_unlock(&data->update_lock); | ||
513 | dev_dbg(&client->dev, "chassis intrusion latch cleared\n"); | ||
514 | |||
515 | return count; | ||
516 | } | ||
517 | static SENSOR_DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR, show_alarm, | ||
518 | chassis_clear, 12); | ||
494 | 519 | ||
495 | static struct attribute *adm9240_attributes[] = { | 520 | static struct attribute *adm9240_attributes[] = { |
496 | &sensor_dev_attr_in0_input.dev_attr.attr, | 521 | &sensor_dev_attr_in0_input.dev_attr.attr, |
@@ -532,6 +557,7 @@ static struct attribute *adm9240_attributes[] = { | |||
532 | &dev_attr_alarms.attr, | 557 | &dev_attr_alarms.attr, |
533 | &dev_attr_aout_output.attr, | 558 | &dev_attr_aout_output.attr, |
534 | &dev_attr_chassis_clear.attr, | 559 | &dev_attr_chassis_clear.attr, |
560 | &sensor_dev_attr_intrusion0_alarm.dev_attr.attr, | ||
535 | &dev_attr_cpu0_vid.attr, | 561 | &dev_attr_cpu0_vid.attr, |
536 | NULL | 562 | NULL |
537 | }; | 563 | }; |