aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hwmon/w83792d.c58
1 files changed, 2 insertions, 56 deletions
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index 0ba5a2bd562e..06d6f56d4f69 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -296,7 +296,6 @@ struct w83792d_data {
296 u8 pwmenable[3]; 296 u8 pwmenable[3];
297 u32 alarms; /* realtime status register encoding,combined */ 297 u32 alarms; /* realtime status register encoding,combined */
298 u8 chassis; /* Chassis status */ 298 u8 chassis; /* Chassis status */
299 u8 chassis_clear; /* CLR_CHS, clear chassis intrusion detection */
300 u8 thermal_cruise[3]; /* Smart FanI: Fan1,2,3 target value */ 299 u8 thermal_cruise[3]; /* Smart FanI: Fan1,2,3 target value */
301 u8 tolerance[3]; /* Fan1,2,3 tolerance(Smart Fan I/II) */ 300 u8 tolerance[3]; /* Fan1,2,3 tolerance(Smart Fan I/II) */
302 u8 sf2_points[3][4]; /* Smart FanII: Fan1,2,3 temperature points */ 301 u8 sf2_points[3][4]; /* Smart FanII: Fan1,2,3 temperature points */
@@ -739,7 +738,7 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr,
739} 738}
740 739
741static ssize_t 740static ssize_t
742show_chassis(struct device *dev, struct device_attribute *attr, 741show_chassis_clear(struct device *dev, struct device_attribute *attr,
743 char *buf) 742 char *buf)
744{ 743{
745 struct w83792d_data *data = w83792d_update_device(dev); 744 struct w83792d_data *data = w83792d_update_device(dev);
@@ -747,52 +746,6 @@ show_chassis(struct device *dev, struct device_attribute *attr,
747} 746}
748 747
749static ssize_t 748static ssize_t
750show_regs_chassis(struct device *dev, struct device_attribute *attr,
751 char *buf)
752{
753 dev_warn(dev,
754 "Attribute %s is deprecated, use intrusion0_alarm instead\n",
755 "chassis");
756 return show_chassis(dev, attr, buf);
757}
758
759static ssize_t
760show_chassis_clear(struct device *dev, struct device_attribute *attr, char *buf)
761{
762 struct w83792d_data *data = w83792d_update_device(dev);
763 return sprintf(buf, "%d\n", data->chassis_clear);
764}
765
766static ssize_t
767store_chassis_clear_legacy(struct device *dev, struct device_attribute *attr,
768 const char *buf, size_t count)
769{
770 struct i2c_client *client = to_i2c_client(dev);
771 struct w83792d_data *data = i2c_get_clientdata(client);
772 unsigned long val;
773 int err;
774 u8 temp1 = 0, temp2 = 0;
775
776 dev_warn(dev,
777 "Attribute %s is deprecated, use intrusion0_alarm instead\n",
778 "chassis_clear");
779
780 err = kstrtoul(buf, 10, &val);
781 if (err)
782 return err;
783
784 mutex_lock(&data->update_lock);
785 data->chassis_clear = SENSORS_LIMIT(val, 0, 1);
786 temp1 = ((data->chassis_clear) << 7) & 0x80;
787 temp2 = w83792d_read_value(client,
788 W83792D_REG_CHASSIS_CLR) & 0x7f;
789 w83792d_write_value(client, W83792D_REG_CHASSIS_CLR, temp1 | temp2);
790 mutex_unlock(&data->update_lock);
791
792 return count;
793}
794
795static ssize_t
796store_chassis_clear(struct device *dev, struct device_attribute *attr, 749store_chassis_clear(struct device *dev, struct device_attribute *attr,
797 const char *buf, size_t count) 750 const char *buf, size_t count)
798{ 751{
@@ -1116,11 +1069,8 @@ static SENSOR_DEVICE_ATTR(in8_alarm, S_IRUGO, show_alarm, NULL, 20);
1116static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL, 21); 1069static SENSOR_DEVICE_ATTR(fan4_alarm, S_IRUGO, show_alarm, NULL, 21);
1117static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 22); 1070static SENSOR_DEVICE_ATTR(fan5_alarm, S_IRUGO, show_alarm, NULL, 22);
1118static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_alarm, NULL, 23); 1071static SENSOR_DEVICE_ATTR(fan6_alarm, S_IRUGO, show_alarm, NULL, 23);
1119static DEVICE_ATTR(chassis, S_IRUGO, show_regs_chassis, NULL);
1120static DEVICE_ATTR(chassis_clear, S_IRUGO | S_IWUSR,
1121 show_chassis_clear, store_chassis_clear_legacy);
1122static DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR, 1072static DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR,
1123 show_chassis, store_chassis_clear); 1073 show_chassis_clear, store_chassis_clear);
1124static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 0); 1074static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 0);
1125static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 1); 1075static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 1);
1126static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 2); 1076static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 2);
@@ -1320,8 +1270,6 @@ static struct attribute *w83792d_attributes[] = {
1320 &sensor_dev_attr_pwm3_mode.dev_attr.attr, 1270 &sensor_dev_attr_pwm3_mode.dev_attr.attr,
1321 &sensor_dev_attr_pwm3_enable.dev_attr.attr, 1271 &sensor_dev_attr_pwm3_enable.dev_attr.attr,
1322 &dev_attr_alarms.attr, 1272 &dev_attr_alarms.attr,
1323 &dev_attr_chassis.attr,
1324 &dev_attr_chassis_clear.attr,
1325 &dev_attr_intrusion0_alarm.attr, 1273 &dev_attr_intrusion0_alarm.attr,
1326 &sensor_dev_attr_tolerance1.dev_attr.attr, 1274 &sensor_dev_attr_tolerance1.dev_attr.attr,
1327 &sensor_dev_attr_thermal_cruise1.dev_attr.attr, 1275 &sensor_dev_attr_thermal_cruise1.dev_attr.attr,
@@ -1627,8 +1575,6 @@ static struct w83792d_data *w83792d_update_device(struct device *dev)
1627 /* Update CaseOpen status and it's CLR_CHS. */ 1575 /* Update CaseOpen status and it's CLR_CHS. */
1628 data->chassis = (w83792d_read_value(client, 1576 data->chassis = (w83792d_read_value(client,
1629 W83792D_REG_CHASSIS) >> 5) & 0x01; 1577 W83792D_REG_CHASSIS) >> 5) & 0x01;
1630 data->chassis_clear = (w83792d_read_value(client,
1631 W83792D_REG_CHASSIS_CLR) >> 7) & 0x01;
1632 1578
1633 /* Update Thermal Cruise/Smart Fan I target value */ 1579 /* Update Thermal Cruise/Smart Fan I target value */
1634 for (i = 0; i < 3; i++) { 1580 for (i = 0; i < 3; i++) {