Commit 7721fea3d0fd93fb4d000eb737b444369358d6d3
Committed by
Linus Torvalds
1 parent
6b8e828261
Exists in
master
and in
7 other branches
hwmon: f71882fg: add support for the Fintek F71808E
Allow device probing to recognise the Fintek F71808E. Sysfs interface: * Fan/pwm control is the same as for F71889FG * Temperature and voltage sensor handling is largely the same as for the F71889FG - Has one temperature sensor less (doesn't have temp3) - Misses one voltage sensor (doesn't have V6, thus in6_input refers to what in7_input refers for F71889FG) For the purpose of the sysfs interface fxxxx_in_temp_attr[] is split up such that it can largely be reused. Signed-off-by: Giel van Schijndel <me@mortis.eu> Cc: Jean Delvare <khali@linux-fr.org> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 3 changed files with 82 additions and 11 deletions Side-by-side Diff
Documentation/hwmon/f71882fg
... | ... | @@ -2,6 +2,10 @@ |
2 | 2 | ====================== |
3 | 3 | |
4 | 4 | Supported chips: |
5 | + * Fintek F71808E | |
6 | + Prefix: 'f71808fg' | |
7 | + Addresses scanned: none, address read from Super I/O config space | |
8 | + Datasheet: Not public | |
5 | 9 | * Fintek F71858FG |
6 | 10 | Prefix: 'f71858fg' |
7 | 11 | Addresses scanned: none, address read from Super I/O config space |
drivers/hwmon/Kconfig
... | ... | @@ -332,11 +332,11 @@ |
332 | 332 | will be called f71805f. |
333 | 333 | |
334 | 334 | config SENSORS_F71882FG |
335 | - tristate "Fintek F71858FG, F71862FG, F71882FG, F71889FG and F8000" | |
335 | + tristate "Fintek F71808E, F71858FG, F71862FG, F71882FG, F71889FG and F8000" | |
336 | 336 | depends on EXPERIMENTAL |
337 | 337 | help |
338 | - If you say yes here you get support for hardware monitoring | |
339 | - features of the Fintek F71858FG, F71862FG/71863FG, F71882FG/F71883FG, | |
338 | + If you say yes here you get support for hardware monitoring features | |
339 | + of the Fintek F71808E, F71858FG, F71862FG/71863FG, F71882FG/F71883FG, | |
340 | 340 | F71889FG and F8000 Super-I/O chips. |
341 | 341 | |
342 | 342 | This driver can also be built as a module. If so, the module |
drivers/hwmon/f71882fg.c
... | ... | @@ -45,6 +45,7 @@ |
45 | 45 | #define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */ |
46 | 46 | |
47 | 47 | #define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */ |
48 | +#define SIO_F71808_ID 0x0901 /* Chipset ID */ | |
48 | 49 | #define SIO_F71858_ID 0x0507 /* Chipset ID */ |
49 | 50 | #define SIO_F71862_ID 0x0601 /* Chipset ID */ |
50 | 51 | #define SIO_F71882_ID 0x0541 /* Chipset ID */ |
51 | 52 | |
... | ... | @@ -96,9 +97,10 @@ |
96 | 97 | module_param(force_id, ushort, 0); |
97 | 98 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); |
98 | 99 | |
99 | -enum chips { f71858fg, f71862fg, f71882fg, f71889fg, f8000 }; | |
100 | +enum chips { f71808fg, f71858fg, f71862fg, f71882fg, f71889fg, f8000 }; | |
100 | 101 | |
101 | 102 | static const char *f71882fg_names[] = { |
103 | + "f71808fg", | |
102 | 104 | "f71858fg", |
103 | 105 | "f71862fg", |
104 | 106 | "f71882fg", |
... | ... | @@ -306,8 +308,8 @@ |
306 | 308 | SENSOR_ATTR_2(temp3_fault, S_IRUGO, show_temp_fault, NULL, 0, 2), |
307 | 309 | }; |
308 | 310 | |
309 | -/* Temp and in attr common to the f71862fg, f71882fg and f71889fg */ | |
310 | -static struct sensor_device_attribute_2 fxxxx_in_temp_attr[] = { | |
311 | +/* In attr common to the f71862fg, f71882fg and f71889fg */ | |
312 | +static struct sensor_device_attribute_2 fxxxx_in_attr[] = { | |
311 | 313 | SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0), |
312 | 314 | SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1), |
313 | 315 | SENSOR_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 0, 2), |
... | ... | @@ -317,6 +319,22 @@ |
317 | 319 | SENSOR_ATTR_2(in6_input, S_IRUGO, show_in, NULL, 0, 6), |
318 | 320 | SENSOR_ATTR_2(in7_input, S_IRUGO, show_in, NULL, 0, 7), |
319 | 321 | SENSOR_ATTR_2(in8_input, S_IRUGO, show_in, NULL, 0, 8), |
322 | +}; | |
323 | + | |
324 | +/* In attr for the f71808fg */ | |
325 | +static struct sensor_device_attribute_2 f71808_in_attr[] = { | |
326 | + SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0), | |
327 | + SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1), | |
328 | + SENSOR_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 0, 2), | |
329 | + SENSOR_ATTR_2(in3_input, S_IRUGO, show_in, NULL, 0, 3), | |
330 | + SENSOR_ATTR_2(in4_input, S_IRUGO, show_in, NULL, 0, 4), | |
331 | + SENSOR_ATTR_2(in5_input, S_IRUGO, show_in, NULL, 0, 5), | |
332 | + SENSOR_ATTR_2(in6_input, S_IRUGO, show_in, NULL, 0, 7), | |
333 | + SENSOR_ATTR_2(in7_input, S_IRUGO, show_in, NULL, 0, 8), | |
334 | +}; | |
335 | + | |
336 | +/* Temp attr common to the f71808fg, f71862fg, f71882fg and f71889fg */ | |
337 | +static struct sensor_device_attribute_2 fxxxx_temp_attr[] = { | |
320 | 338 | SENSOR_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, 1), |
321 | 339 | SENSOR_ATTR_2(temp1_max, S_IRUGO|S_IWUSR, show_temp_max, |
322 | 340 | store_temp_max, 0, 1), |
... | ... | @@ -355,6 +373,10 @@ |
355 | 373 | store_temp_beep, 0, 6), |
356 | 374 | SENSOR_ATTR_2(temp2_type, S_IRUGO, show_temp_type, NULL, 0, 2), |
357 | 375 | SENSOR_ATTR_2(temp2_fault, S_IRUGO, show_temp_fault, NULL, 0, 2), |
376 | +}; | |
377 | + | |
378 | +/* Temp and in attr common to the f71862fg, f71882fg and f71889fg */ | |
379 | +static struct sensor_device_attribute_2 f71862_temp_attr[] = { | |
358 | 380 | SENSOR_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0, 3), |
359 | 381 | SENSOR_ATTR_2(temp3_max, S_IRUGO|S_IWUSR, show_temp_max, |
360 | 382 | store_temp_max, 0, 3), |
... | ... | @@ -989,6 +1011,11 @@ |
989 | 1011 | data->temp_type[1] = 6; |
990 | 1012 | break; |
991 | 1013 | } |
1014 | + } else if (data->type == f71808fg) { | |
1015 | + reg = f71882fg_read8(data, F71882FG_REG_TEMP_TYPE); | |
1016 | + data->temp_type[1] = (reg & 0x02) ? 2 : 4; | |
1017 | + data->temp_type[2] = (reg & 0x04) ? 2 : 4; | |
1018 | + | |
992 | 1019 | } else { |
993 | 1020 | reg2 = f71882fg_read8(data, F71882FG_REG_PECI); |
994 | 1021 | if ((reg2 & 0x03) == 0x01) |
... | ... | @@ -1871,7 +1898,8 @@ |
1871 | 1898 | |
1872 | 1899 | val /= 1000; |
1873 | 1900 | |
1874 | - if (data->type == f71889fg) | |
1901 | + if (data->type == f71889fg | |
1902 | + || data->type == f71808fg) | |
1875 | 1903 | val = SENSORS_LIMIT(val, -128, 127); |
1876 | 1904 | else |
1877 | 1905 | val = SENSORS_LIMIT(val, 0, 127); |
1878 | 1906 | |
... | ... | @@ -1974,9 +2002,29 @@ |
1974 | 2002 | /* fall through! */ |
1975 | 2003 | case f71862fg: |
1976 | 2004 | err = f71882fg_create_sysfs_files(pdev, |
1977 | - fxxxx_in_temp_attr, | |
1978 | - ARRAY_SIZE(fxxxx_in_temp_attr)); | |
2005 | + f71862_temp_attr, | |
2006 | + ARRAY_SIZE(f71862_temp_attr)); | |
2007 | + if (err) | |
2008 | + goto exit_unregister_sysfs; | |
2009 | + err = f71882fg_create_sysfs_files(pdev, | |
2010 | + fxxxx_in_attr, | |
2011 | + ARRAY_SIZE(fxxxx_in_attr)); | |
2012 | + if (err) | |
2013 | + goto exit_unregister_sysfs; | |
2014 | + err = f71882fg_create_sysfs_files(pdev, | |
2015 | + fxxxx_temp_attr, | |
2016 | + ARRAY_SIZE(fxxxx_temp_attr)); | |
1979 | 2017 | break; |
2018 | + case f71808fg: | |
2019 | + err = f71882fg_create_sysfs_files(pdev, | |
2020 | + f71808_in_attr, | |
2021 | + ARRAY_SIZE(f71808_in_attr)); | |
2022 | + if (err) | |
2023 | + goto exit_unregister_sysfs; | |
2024 | + err = f71882fg_create_sysfs_files(pdev, | |
2025 | + fxxxx_temp_attr, | |
2026 | + ARRAY_SIZE(fxxxx_temp_attr)); | |
2027 | + break; | |
1980 | 2028 | case f8000: |
1981 | 2029 | err = f71882fg_create_sysfs_files(pdev, |
1982 | 2030 | f8000_in_temp_attr, |
... | ... | @@ -2002,6 +2050,7 @@ |
2002 | 2050 | case f71862fg: |
2003 | 2051 | err = (data->pwm_enable & 0x15) != 0x15; |
2004 | 2052 | break; |
2053 | + case f71808fg: | |
2005 | 2054 | case f71882fg: |
2006 | 2055 | case f71889fg: |
2007 | 2056 | err = 0; |
... | ... | @@ -2047,6 +2096,7 @@ |
2047 | 2096 | f8000_auto_pwm_attr, |
2048 | 2097 | ARRAY_SIZE(f8000_auto_pwm_attr)); |
2049 | 2098 | break; |
2099 | + case f71808fg: | |
2050 | 2100 | case f71889fg: |
2051 | 2101 | for (i = 0; i < nr_fans; i++) { |
2052 | 2102 | data->pwm_auto_point_mapping[i] = |
2053 | 2103 | |
... | ... | @@ -2126,9 +2176,23 @@ |
2126 | 2176 | /* fall through! */ |
2127 | 2177 | case f71862fg: |
2128 | 2178 | f71882fg_remove_sysfs_files(pdev, |
2129 | - fxxxx_in_temp_attr, | |
2130 | - ARRAY_SIZE(fxxxx_in_temp_attr)); | |
2179 | + f71862_temp_attr, | |
2180 | + ARRAY_SIZE(f71862_temp_attr)); | |
2181 | + f71882fg_remove_sysfs_files(pdev, | |
2182 | + fxxxx_in_attr, | |
2183 | + ARRAY_SIZE(fxxxx_in_attr)); | |
2184 | + f71882fg_remove_sysfs_files(pdev, | |
2185 | + fxxxx_temp_attr, | |
2186 | + ARRAY_SIZE(fxxxx_temp_attr)); | |
2131 | 2187 | break; |
2188 | + case f71808fg: | |
2189 | + f71882fg_remove_sysfs_files(pdev, | |
2190 | + f71808_in_attr, | |
2191 | + ARRAY_SIZE(f71808_in_attr)); | |
2192 | + f71882fg_remove_sysfs_files(pdev, | |
2193 | + fxxxx_temp_attr, | |
2194 | + ARRAY_SIZE(fxxxx_temp_attr)); | |
2195 | + break; | |
2132 | 2196 | case f8000: |
2133 | 2197 | f71882fg_remove_sysfs_files(pdev, |
2134 | 2198 | f8000_in_temp_attr, |
... | ... | @@ -2195,6 +2259,9 @@ |
2195 | 2259 | |
2196 | 2260 | devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID); |
2197 | 2261 | switch (devid) { |
2262 | + case SIO_F71808_ID: | |
2263 | + sio_data->type = f71808fg; | |
2264 | + break; | |
2198 | 2265 | case SIO_F71858_ID: |
2199 | 2266 | sio_data->type = f71858fg; |
2200 | 2267 | break; |