forked from Minki/linux
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
Pull more hwmon updates from Jean Delvare. * 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: hwmon: (w83627ehf) Use swap() in w82627ehf_swap_tempreg() hwmon: Document which I2C addresses can be probed hwmon: (w83792d) Additional PWM outputs support
This commit is contained in:
commit
9a3c284a6d
@ -81,6 +81,13 @@ increase the chances of your change being accepted.
|
||||
|
||||
* Provide a detect function if and only if a chip can be detected reliably.
|
||||
|
||||
* Only the following I2C addresses shall be probed: 0x18-0x1f, 0x28-0x2f,
|
||||
0x48-0x4f, 0x58, 0x5c, 0x73 and 0x77. Probing other addresses is strongly
|
||||
discouraged as it is known to cause trouble with other (non-hwmon) I2C
|
||||
chips. If your chip lives at an address which can't be probed then the
|
||||
device will have to be instantiated explicitly (which is always better
|
||||
anyway.)
|
||||
|
||||
* Avoid writing to chip registers in the detect function. If you have to write,
|
||||
only do it after you have already gathered enough data to be certain that the
|
||||
detection is going to be successful.
|
||||
|
@ -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)
|
||||
|
@ -1937,27 +1937,11 @@ static inline void w83627ehf_init_device(struct w83627ehf_data *data,
|
||||
static void w82627ehf_swap_tempreg(struct w83627ehf_data *data,
|
||||
int r1, int r2)
|
||||
{
|
||||
u16 tmp;
|
||||
|
||||
tmp = data->temp_src[r1];
|
||||
data->temp_src[r1] = data->temp_src[r2];
|
||||
data->temp_src[r2] = tmp;
|
||||
|
||||
tmp = data->reg_temp[r1];
|
||||
data->reg_temp[r1] = data->reg_temp[r2];
|
||||
data->reg_temp[r2] = tmp;
|
||||
|
||||
tmp = data->reg_temp_over[r1];
|
||||
data->reg_temp_over[r1] = data->reg_temp_over[r2];
|
||||
data->reg_temp_over[r2] = tmp;
|
||||
|
||||
tmp = data->reg_temp_hyst[r1];
|
||||
data->reg_temp_hyst[r1] = data->reg_temp_hyst[r2];
|
||||
data->reg_temp_hyst[r2] = tmp;
|
||||
|
||||
tmp = data->reg_temp_config[r1];
|
||||
data->reg_temp_config[r1] = data->reg_temp_config[r2];
|
||||
data->reg_temp_config[r2] = tmp;
|
||||
swap(data->temp_src[r1], data->temp_src[r2]);
|
||||
swap(data->reg_temp[r1], data->reg_temp[r2]);
|
||||
swap(data->reg_temp_over[r1], data->reg_temp_over[r2]);
|
||||
swap(data->reg_temp_hyst[r1], data->reg_temp_hyst[r2]);
|
||||
swap(data->reg_temp_config[r1], data->reg_temp_config[r2]);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -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
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user