hwmon: (w83792d) Additional PWM outputs support
authorRoger Lucas <vt8231@hiddenengine.co.uk>
Tue, 12 May 2015 21:01:37 +0000 (22:01 +0100)
committerJean Delvare <jdelvare@suse.de>
Fri, 3 Jul 2015 12:39:05 +0000 (14:39 +0200)
Add pwm[4-7] and the associated pwm[4-7]_mode attributes.

Signed-off-by: Roger Lucas <vt8231@hiddenengine.co.uk>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Documentation/hwmon/w83792d
drivers/hwmon/w83792d.c

index 53f7b6866fec4d51c4049ba6c700d58e1950a046..f2ffc402ea4519b6d9ba140ebfe72f88d1f67f4f 100644 (file)
@@ -8,6 +8,7 @@ Supported chips:
     Datasheet: http://www.winbond.com.tw
 
 Author: Shane Huang (Winbond)
+Updated: Roger Lucas
 
 
 Module Parameters
@@ -38,9 +39,16 @@ parameter; this will put it into a more well-behaved state first.
 The driver implements three temperature sensors, seven fan rotation speed
 sensors, nine voltage sensors, and two automatic fan regulation
 strategies called: Smart Fan I (Thermal Cruise mode) and Smart Fan II.
-Automatic fan control mode is possible only for fan1-fan3. Fan4-fan7 can run
-synchronized with selected fan (fan1-fan3). This functionality and manual PWM
-control for fan4-fan7 is not yet implemented.
+
+The driver also implements up to seven fan control outputs: pwm1-7.  Pwm1-7
+can be configured to PWM output or Analogue DC output via their associated
+pwmX_mode. Outputs pwm4 through pwm7 may or may not be present depending on
+how the W83792AD/D was configured by the BIOS.
+
+Automatic fan control mode is possible only for fan1-fan3.
+
+For all pwmX outputs, a value of 0 means minimum fan speed and a value of
+255 means maximum fan speed.
 
 Temperatures are measured in degrees Celsius and measurement resolution is 1
 degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when
@@ -157,14 +165,14 @@ for each fan.
 /sys files
 ----------
 
-pwm[1-3] - this file stores PWM duty cycle or DC value (fan speed) in range:
+pwm[1-7] - this file stores PWM duty cycle or DC value (fan speed) in range:
        0 (stop) to 255 (full)
 pwm[1-3]_enable - this file controls mode of fan/temperature control:
             * 0 Disabled
             * 1 Manual mode
             * 2 Smart Fan II
             * 3 Thermal Cruise
-pwm[1-3]_mode - Select PWM of DC mode
+pwm[1-7]_mode - Select PWM or DC mode
             * 0 DC
             * 1 PWM
 thermal_cruise[1-3] - Selects the desired temperature for cruise (degC)
index 4068db4d9580b538c70ffccc7db71d29c5515967..0a8bce726b4b037797126ea8b8b5cf8d229bb253 100644 (file)
@@ -289,10 +289,7 @@ struct w83792d_data {
        u8 temp1[3];            /* current, over, thyst */
        u8 temp_add[2][6];      /* Register value */
        u8 fan_div[7];          /* Register encoding, shifted right */
-       u8 pwm[7];              /*
-                                * We only consider the first 3 set of pwm,
-                                * although 792 chip has 7 set of pwm.
-                                */
+       u8 pwm[7];              /* The 7 PWM outputs */
        u8 pwmenable[3];
        u32 alarms;             /* realtime status register encoding,combined */
        u8 chassis;             /* Chassis status */
@@ -1075,6 +1072,10 @@ static DEVICE_ATTR(intrusion0_alarm, S_IRUGO | S_IWUSR,
 static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 0);
 static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 1);
 static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 2);
+static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 3);
+static SENSOR_DEVICE_ATTR(pwm5, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 4);
+static SENSOR_DEVICE_ATTR(pwm6, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 5);
+static SENSOR_DEVICE_ATTR(pwm7, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 6);
 static SENSOR_DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO,
                        show_pwmenable, store_pwmenable, 1);
 static SENSOR_DEVICE_ATTR(pwm2_enable, S_IWUSR | S_IRUGO,
@@ -1087,6 +1088,14 @@ static SENSOR_DEVICE_ATTR(pwm2_mode, S_IWUSR | S_IRUGO,
                        show_pwm_mode, store_pwm_mode, 1);
 static SENSOR_DEVICE_ATTR(pwm3_mode, S_IWUSR | S_IRUGO,
                        show_pwm_mode, store_pwm_mode, 2);
+static SENSOR_DEVICE_ATTR(pwm4_mode, S_IWUSR | S_IRUGO,
+                       show_pwm_mode, store_pwm_mode, 3);
+static SENSOR_DEVICE_ATTR(pwm5_mode, S_IWUSR | S_IRUGO,
+                       show_pwm_mode, store_pwm_mode, 4);
+static SENSOR_DEVICE_ATTR(pwm6_mode, S_IWUSR | S_IRUGO,
+                       show_pwm_mode, store_pwm_mode, 5);
+static SENSOR_DEVICE_ATTR(pwm7_mode, S_IWUSR | S_IRUGO,
+                       show_pwm_mode, store_pwm_mode, 6);
 static SENSOR_DEVICE_ATTR(tolerance1, S_IWUSR | S_IRUGO,
                        show_tolerance, store_tolerance, 1);
 static SENSOR_DEVICE_ATTR(tolerance2, S_IWUSR | S_IRUGO,
@@ -1177,30 +1186,38 @@ static SENSOR_DEVICE_ATTR(fan6_div, S_IWUSR | S_IRUGO,
 static SENSOR_DEVICE_ATTR(fan7_div, S_IWUSR | S_IRUGO,
                        show_fan_div, store_fan_div, 7);
 
-static struct attribute *w83792d_attributes_fan[4][5] = {
+static struct attribute *w83792d_attributes_fan[4][7] = {
        {
                &sensor_dev_attr_fan4_input.dev_attr.attr,
                &sensor_dev_attr_fan4_min.dev_attr.attr,
                &sensor_dev_attr_fan4_div.dev_attr.attr,
                &sensor_dev_attr_fan4_alarm.dev_attr.attr,
+               &sensor_dev_attr_pwm4.dev_attr.attr,
+               &sensor_dev_attr_pwm4_mode.dev_attr.attr,
                NULL
        }, {
                &sensor_dev_attr_fan5_input.dev_attr.attr,
                &sensor_dev_attr_fan5_min.dev_attr.attr,
                &sensor_dev_attr_fan5_div.dev_attr.attr,
                &sensor_dev_attr_fan5_alarm.dev_attr.attr,
+               &sensor_dev_attr_pwm5.dev_attr.attr,
+               &sensor_dev_attr_pwm5_mode.dev_attr.attr,
                NULL
        }, {
                &sensor_dev_attr_fan6_input.dev_attr.attr,
                &sensor_dev_attr_fan6_min.dev_attr.attr,
                &sensor_dev_attr_fan6_div.dev_attr.attr,
                &sensor_dev_attr_fan6_alarm.dev_attr.attr,
+               &sensor_dev_attr_pwm6.dev_attr.attr,
+               &sensor_dev_attr_pwm6_mode.dev_attr.attr,
                NULL
        }, {
                &sensor_dev_attr_fan7_input.dev_attr.attr,
                &sensor_dev_attr_fan7_min.dev_attr.attr,
                &sensor_dev_attr_fan7_div.dev_attr.attr,
                &sensor_dev_attr_fan7_alarm.dev_attr.attr,
+               &sensor_dev_attr_pwm7.dev_attr.attr,
+               &sensor_dev_attr_pwm7_mode.dev_attr.attr,
                NULL
        }
 };