Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
- index e305ab5..4f65a22 100644
- --- a/drivers/platform/x86/thinkpad_acpi.c
- +++ b/drivers/platform/x86/thinkpad_acpi.c
- @@ -324,6 +324,8 @@ static struct {
- u32 has_adaptive_kbd:1;
- } tp_features;
- +static u8 active_fan;
- +
- static struct {
- u16 hotkey_mask_ff:1;
- u16 volume_ctrl_forbidden:1;
- @@ -7907,6 +7909,14 @@ static bool fan_select_fan2(void)
- return true;
- }
- +static void fan_select_fan(void)
- +{
- + if(active_fan == 1)
- + fan_select_fan1();
- + else
- + fan_select_fan2();
- +}
- +
- /*
- * Call with fan_mutex held
- */
- @@ -8059,6 +8069,7 @@ static int fan_set_level(int level)
- else if (level & TP_EC_FAN_AUTO)
- level |= 4; /* safety min speed 4 */
- + fan_select_fan();
- if (!acpi_ec_write(fan_status_offset, level))
- return -EIO;
- else
- @@ -8403,6 +8414,54 @@ static ssize_t fan_pwm1_store(struct device *dev,
- static DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, fan_pwm1_show, fan_pwm1_store);
- +static ssize_t fan_pwm2_enable_show(struct device *dev,
- + struct device_attribute *attr,
- + char *buf)
- +{
- + ssize_t result;
- + active_fan = 2;
- + result = fan_pwm1_enable_show(dev,attr,buf);
- + active_fan = 1;
- + return result;
- +}
- +
- +static ssize_t fan_pwm2_enable_store(struct device *dev,
- + struct device_attribute *attr,
- + const char *buf, size_t count)
- +{
- + ssize_t result;
- + active_fan = 2;
- + result = fan_pwm1_enable_store(dev,attr,buf,count);
- + active_fan = 1;
- + return result;
- +}
- +
- +static ssize_t fan_pwm2_show(struct device *dev,
- + struct device_attribute *attr,
- + char *buf)
- +{
- + ssize_t result;
- + active_fan = 2;
- + result = fan_pwm1_show(dev,attr,buf);
- + active_fan = 1;
- + return result;
- +}
- +
- +static ssize_t fan_pwm2_store(struct device *dev,
- + struct device_attribute *attr,
- + const char *buf, size_t count)
- +{
- + ssize_t result;
- + active_fan = 2;
- + result = fan_pwm1_store(dev,attr,buf,count);
- + active_fan = 1;
- + return result;
- +}
- +
- +static DEVICE_ATTR(pwm2_enable, S_IWUSR | S_IRUGO,
- + fan_pwm2_enable_show, fan_pwm2_enable_store);
- +static DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, fan_pwm2_show, fan_pwm2_store);
- +
- /* sysfs fan fan1_input ------------------------------------------------ */
- static ssize_t fan_fan1_input_show(struct device *dev,
- struct device_attribute *attr,
- @@ -8470,6 +8529,7 @@ static DRIVER_ATTR(fan_watchdog, S_IWUSR | S_IRUGO,
- static struct attribute *fan_attributes[] = {
- &dev_attr_pwm1_enable.attr, &dev_attr_pwm1.attr,
- &dev_attr_fan1_input.attr,
- + &dev_attr_pwm2_enable.attr, &dev_attr_pwm2.attr,
- NULL, /* for fan2_input */
- NULL
- };
- @@ -8518,7 +8578,7 @@ static int __init fan_init(struct ibm_init_struct *iibm)
- fan_control_commands = 0;
- fan_watchdog_maxinterval = 0;
- tp_features.fan_ctrl_status_undef = 0;
- - tp_features.second_fan = 0;
- + tp_features.second_fan = 1;
- fan_control_desired_level = 7;
- if (tpacpi_is_ibm()) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement