Source
75
75
static uint i8k_fan_mult = I8K_FAN_MULT;
76
76
static uint i8k_pwm_mult;
77
77
static uint i8k_fan_max = I8K_FAN_HIGH;
78
78
static bool disallow_fan_type_call;
79
79
static bool disallow_fan_support;
80
80
81
81
#define I8K_HWMON_HAVE_TEMP1 (1 << 0)
82
82
#define I8K_HWMON_HAVE_TEMP2 (1 << 1)
83
83
#define I8K_HWMON_HAVE_TEMP3 (1 << 2)
84
84
#define I8K_HWMON_HAVE_TEMP4 (1 << 3)
85
-
#define I8K_HWMON_HAVE_FAN1 (1 << 4)
86
-
#define I8K_HWMON_HAVE_FAN2 (1 << 5)
87
-
#define I8K_HWMON_HAVE_FAN3 (1 << 6)
85
+
#define I8K_HWMON_HAVE_TEMP5 (1 << 4)
86
+
#define I8K_HWMON_HAVE_TEMP6 (1 << 5)
87
+
#define I8K_HWMON_HAVE_TEMP7 (1 << 6)
88
+
#define I8K_HWMON_HAVE_TEMP8 (1 << 7)
89
+
#define I8K_HWMON_HAVE_TEMP9 (1 << 8)
90
+
#define I8K_HWMON_HAVE_TEMP10 (1 << 9)
91
+
#define I8K_HWMON_HAVE_FAN1 (1 << 10)
92
+
#define I8K_HWMON_HAVE_FAN2 (1 << 11)
93
+
#define I8K_HWMON_HAVE_FAN3 (1 << 12)
88
94
89
95
MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)");
90
96
MODULE_AUTHOR("Pali Rohár <pali.rohar@gmail.com>");
91
97
MODULE_DESCRIPTION("Dell laptop SMM BIOS hwmon driver");
92
98
MODULE_LICENSE("GPL");
93
99
MODULE_ALIAS("i8k");
94
100
95
101
static bool force;
96
102
module_param(force, bool, 0);
97
103
MODULE_PARM_DESC(force, "Force loading without checking for supported models");
730
736
}
731
737
732
738
static SENSOR_DEVICE_ATTR_RO(temp1_input, i8k_hwmon_temp, 0);
733
739
static SENSOR_DEVICE_ATTR_RO(temp1_label, i8k_hwmon_temp_label, 0);
734
740
static SENSOR_DEVICE_ATTR_RO(temp2_input, i8k_hwmon_temp, 1);
735
741
static SENSOR_DEVICE_ATTR_RO(temp2_label, i8k_hwmon_temp_label, 1);
736
742
static SENSOR_DEVICE_ATTR_RO(temp3_input, i8k_hwmon_temp, 2);
737
743
static SENSOR_DEVICE_ATTR_RO(temp3_label, i8k_hwmon_temp_label, 2);
738
744
static SENSOR_DEVICE_ATTR_RO(temp4_input, i8k_hwmon_temp, 3);
739
745
static SENSOR_DEVICE_ATTR_RO(temp4_label, i8k_hwmon_temp_label, 3);
746
+
static SENSOR_DEVICE_ATTR_RO(temp5_input, i8k_hwmon_temp, 4);
747
+
static SENSOR_DEVICE_ATTR_RO(temp5_label, i8k_hwmon_temp_label, 4);
748
+
static SENSOR_DEVICE_ATTR_RO(temp6_input, i8k_hwmon_temp, 5);
749
+
static SENSOR_DEVICE_ATTR_RO(temp6_label, i8k_hwmon_temp_label, 5);
750
+
static SENSOR_DEVICE_ATTR_RO(temp7_input, i8k_hwmon_temp, 6);
751
+
static SENSOR_DEVICE_ATTR_RO(temp7_label, i8k_hwmon_temp_label, 6);
752
+
static SENSOR_DEVICE_ATTR_RO(temp8_input, i8k_hwmon_temp, 7);
753
+
static SENSOR_DEVICE_ATTR_RO(temp8_label, i8k_hwmon_temp_label, 7);
754
+
static SENSOR_DEVICE_ATTR_RO(temp9_input, i8k_hwmon_temp, 8);
755
+
static SENSOR_DEVICE_ATTR_RO(temp9_label, i8k_hwmon_temp_label, 8);
756
+
static SENSOR_DEVICE_ATTR_RO(temp10_input, i8k_hwmon_temp, 9);
757
+
static SENSOR_DEVICE_ATTR_RO(temp10_label, i8k_hwmon_temp_label, 9);
740
758
static SENSOR_DEVICE_ATTR_RO(fan1_input, i8k_hwmon_fan, 0);
741
759
static SENSOR_DEVICE_ATTR_RO(fan1_label, i8k_hwmon_fan_label, 0);
742
760
static SENSOR_DEVICE_ATTR_RW(pwm1, i8k_hwmon_pwm, 0);
743
761
static SENSOR_DEVICE_ATTR_RO(fan2_input, i8k_hwmon_fan, 1);
744
762
static SENSOR_DEVICE_ATTR_RO(fan2_label, i8k_hwmon_fan_label, 1);
745
763
static SENSOR_DEVICE_ATTR_RW(pwm2, i8k_hwmon_pwm, 1);
746
764
static SENSOR_DEVICE_ATTR_RO(fan3_input, i8k_hwmon_fan, 2);
747
765
static SENSOR_DEVICE_ATTR_RO(fan3_label, i8k_hwmon_fan_label, 2);
748
766
static SENSOR_DEVICE_ATTR_RW(pwm3, i8k_hwmon_pwm, 2);
749
767
750
768
static struct attribute *i8k_attrs[] = {
751
769
&sensor_dev_attr_temp1_input.dev_attr.attr, /* 0 */
752
770
&sensor_dev_attr_temp1_label.dev_attr.attr, /* 1 */
753
771
&sensor_dev_attr_temp2_input.dev_attr.attr, /* 2 */
754
772
&sensor_dev_attr_temp2_label.dev_attr.attr, /* 3 */
755
773
&sensor_dev_attr_temp3_input.dev_attr.attr, /* 4 */
756
774
&sensor_dev_attr_temp3_label.dev_attr.attr, /* 5 */
757
775
&sensor_dev_attr_temp4_input.dev_attr.attr, /* 6 */
758
776
&sensor_dev_attr_temp4_label.dev_attr.attr, /* 7 */
759
-
&sensor_dev_attr_fan1_input.dev_attr.attr, /* 8 */
760
-
&sensor_dev_attr_fan1_label.dev_attr.attr, /* 9 */
761
-
&sensor_dev_attr_pwm1.dev_attr.attr, /* 10 */
762
-
&sensor_dev_attr_fan2_input.dev_attr.attr, /* 11 */
763
-
&sensor_dev_attr_fan2_label.dev_attr.attr, /* 12 */
764
-
&sensor_dev_attr_pwm2.dev_attr.attr, /* 13 */
765
-
&sensor_dev_attr_fan3_input.dev_attr.attr, /* 14 */
766
-
&sensor_dev_attr_fan3_label.dev_attr.attr, /* 15 */
767
-
&sensor_dev_attr_pwm3.dev_attr.attr, /* 16 */
777
+
&sensor_dev_attr_temp5_input.dev_attr.attr, /* 8 */
778
+
&sensor_dev_attr_temp5_label.dev_attr.attr, /* 9 */
779
+
&sensor_dev_attr_temp6_input.dev_attr.attr, /* 10 */
780
+
&sensor_dev_attr_temp6_label.dev_attr.attr, /* 11 */
781
+
&sensor_dev_attr_temp7_input.dev_attr.attr, /* 12 */
782
+
&sensor_dev_attr_temp7_label.dev_attr.attr, /* 13 */
783
+
&sensor_dev_attr_temp8_input.dev_attr.attr, /* 14 */
784
+
&sensor_dev_attr_temp8_label.dev_attr.attr, /* 15 */
785
+
&sensor_dev_attr_temp9_input.dev_attr.attr, /* 16 */
786
+
&sensor_dev_attr_temp9_label.dev_attr.attr, /* 17 */
787
+
&sensor_dev_attr_temp10_input.dev_attr.attr, /* 18 */
788
+
&sensor_dev_attr_temp10_label.dev_attr.attr, /* 19 */
789
+
&sensor_dev_attr_fan1_input.dev_attr.attr, /* 20 */
790
+
&sensor_dev_attr_fan1_label.dev_attr.attr, /* 21 */
791
+
&sensor_dev_attr_pwm1.dev_attr.attr, /* 22 */
792
+
&sensor_dev_attr_fan2_input.dev_attr.attr, /* 23 */
793
+
&sensor_dev_attr_fan2_label.dev_attr.attr, /* 24 */
794
+
&sensor_dev_attr_pwm2.dev_attr.attr, /* 25 */
795
+
&sensor_dev_attr_fan3_input.dev_attr.attr, /* 26 */
796
+
&sensor_dev_attr_fan3_label.dev_attr.attr, /* 27 */
797
+
&sensor_dev_attr_pwm3.dev_attr.attr, /* 28 */
768
798
NULL
769
799
};
770
800
771
801
static umode_t i8k_is_visible(struct kobject *kobj, struct attribute *attr,
772
802
int index)
773
803
{
774
804
if (disallow_fan_support && index >= 8)
775
805
return 0;
776
806
if (disallow_fan_type_call &&
777
807
(index == 9 || index == 12 || index == 15))
781
811
return 0;
782
812
if (index >= 2 && index <= 3 &&
783
813
!(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP2))
784
814
return 0;
785
815
if (index >= 4 && index <= 5 &&
786
816
!(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP3))
787
817
return 0;
788
818
if (index >= 6 && index <= 7 &&
789
819
!(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP4))
790
820
return 0;
791
-
if (index >= 8 && index <= 10 &&
821
+
if (index >= 8 && index <= 9 &&
822
+
!(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP5))
823
+
return 0;
824
+
if (index >= 10 && index <= 11 &&
825
+
!(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP6))
826
+
return 0;
827
+
if (index >= 12 && index <= 13 &&
828
+
!(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP7))
829
+
return 0;
830
+
if (index >= 14 && index <= 15 &&
831
+
!(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP8))
832
+
return 0;
833
+
if (index >= 16 && index <= 17 &&
834
+
!(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP9))
835
+
return 0;
836
+
if (index >= 18 && index <= 19 &&
837
+
!(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP10))
838
+
return 0;
839
+
840
+
if (index >= 20 && index <= 22 &&
792
841
!(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN1))
793
842
return 0;
794
-
if (index >= 11 && index <= 13 &&
843
+
if (index >= 23 && index <= 25 &&
795
844
!(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN2))
796
845
return 0;
797
-
if (index >= 14 && index <= 16 &&
846
+
if (index >= 26 && index <= 28 &&
798
847
!(i8k_hwmon_flags & I8K_HWMON_HAVE_FAN3))
799
848
return 0;
800
849
801
850
return attr->mode;
802
851
}
803
852
804
853
static const struct attribute_group i8k_group = {
805
854
.attrs = i8k_attrs,
806
855
.is_visible = i8k_is_visible,
807
856
};
820
869
/* check for additional temperature sensors */
821
870
err = i8k_get_temp_type(1);
822
871
if (err >= 0)
823
872
i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP2;
824
873
err = i8k_get_temp_type(2);
825
874
if (err >= 0)
826
875
i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP3;
827
876
err = i8k_get_temp_type(3);
828
877
if (err >= 0)
829
878
i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP4;
879
+
err = i8k_get_temp_type(4);
880
+
if (err >= 0)
881
+
i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP5;
882
+
err = i8k_get_temp_type(5);
883
+
if (err >= 0)
884
+
i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP6;
885
+
err = i8k_get_temp_type(6);
886
+
if (err >= 0)
887
+
i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP7;
888
+
err = i8k_get_temp_type(7);
889
+
if (err >= 0)
890
+
i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP8;
891
+
err = i8k_get_temp_type(8);
892
+
if (err >= 0)
893
+
i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP9;
894
+
err = i8k_get_temp_type(9);
895
+
if (err >= 0)
896
+
i8k_hwmon_flags |= I8K_HWMON_HAVE_TEMP10;
830
897
831
898
/* First fan attributes, if fan status or type is OK */
832
899
err = i8k_get_fan_status(0);
833
900
if (err < 0)
834
901
err = i8k_get_fan_type(0);
835
902
if (err >= 0)
836
903
i8k_hwmon_flags |= I8K_HWMON_HAVE_FAN1;
837
904
838
905
/* Second fan attributes, if fan status or type is OK */
839
906
err = i8k_get_fan_status(1);