aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/f71882fg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/f71882fg.c')
-rw-r--r--drivers/hwmon/f71882fg.c83
1 files changed, 8 insertions, 75 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 6207120dcd4d..537841ef44b9 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -45,7 +45,6 @@
45#define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */ 45#define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */
46 46
47#define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */ 47#define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */
48#define SIO_F71808_ID 0x0901 /* Chipset ID */
49#define SIO_F71858_ID 0x0507 /* Chipset ID */ 48#define SIO_F71858_ID 0x0507 /* Chipset ID */
50#define SIO_F71862_ID 0x0601 /* Chipset ID */ 49#define SIO_F71862_ID 0x0601 /* Chipset ID */
51#define SIO_F71882_ID 0x0541 /* Chipset ID */ 50#define SIO_F71882_ID 0x0541 /* Chipset ID */
@@ -97,10 +96,9 @@ static unsigned short force_id;
97module_param(force_id, ushort, 0); 96module_param(force_id, ushort, 0);
98MODULE_PARM_DESC(force_id, "Override the detected device ID"); 97MODULE_PARM_DESC(force_id, "Override the detected device ID");
99 98
100enum chips { f71808fg, f71858fg, f71862fg, f71882fg, f71889fg, f8000 }; 99enum chips { f71858fg, f71862fg, f71882fg, f71889fg, f8000 };
101 100
102static const char *f71882fg_names[] = { 101static const char *f71882fg_names[] = {
103 "f71808fg",
104 "f71858fg", 102 "f71858fg",
105 "f71862fg", 103 "f71862fg",
106 "f71882fg", 104 "f71882fg",
@@ -308,8 +306,8 @@ static struct sensor_device_attribute_2 f71858fg_in_temp_attr[] = {
308 SENSOR_ATTR_2(temp3_fault, S_IRUGO, show_temp_fault, NULL, 0, 2), 306 SENSOR_ATTR_2(temp3_fault, S_IRUGO, show_temp_fault, NULL, 0, 2),
309}; 307};
310 308
311/* In attr common to the f71862fg, f71882fg and f71889fg */ 309/* Temp and in attr common to the f71862fg, f71882fg and f71889fg */
312static struct sensor_device_attribute_2 fxxxx_in_attr[] = { 310static struct sensor_device_attribute_2 fxxxx_in_temp_attr[] = {
313 SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0), 311 SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0),
314 SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1), 312 SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1),
315 SENSOR_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 0, 2), 313 SENSOR_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 0, 2),
@@ -319,22 +317,6 @@ static struct sensor_device_attribute_2 fxxxx_in_attr[] = {
319 SENSOR_ATTR_2(in6_input, S_IRUGO, show_in, NULL, 0, 6), 317 SENSOR_ATTR_2(in6_input, S_IRUGO, show_in, NULL, 0, 6),
320 SENSOR_ATTR_2(in7_input, S_IRUGO, show_in, NULL, 0, 7), 318 SENSOR_ATTR_2(in7_input, S_IRUGO, show_in, NULL, 0, 7),
321 SENSOR_ATTR_2(in8_input, S_IRUGO, show_in, NULL, 0, 8), 319 SENSOR_ATTR_2(in8_input, S_IRUGO, show_in, NULL, 0, 8),
322};
323
324/* In attr for the f71808fg */
325static 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 */
337static struct sensor_device_attribute_2 fxxxx_temp_attr[] = {
338 SENSOR_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, 1), 320 SENSOR_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, 1),
339 SENSOR_ATTR_2(temp1_max, S_IRUGO|S_IWUSR, show_temp_max, 321 SENSOR_ATTR_2(temp1_max, S_IRUGO|S_IWUSR, show_temp_max,
340 store_temp_max, 0, 1), 322 store_temp_max, 0, 1),
@@ -373,10 +355,6 @@ static struct sensor_device_attribute_2 fxxxx_temp_attr[] = {
373 store_temp_beep, 0, 6), 355 store_temp_beep, 0, 6),
374 SENSOR_ATTR_2(temp2_type, S_IRUGO, show_temp_type, NULL, 0, 2), 356 SENSOR_ATTR_2(temp2_type, S_IRUGO, show_temp_type, NULL, 0, 2),
375 SENSOR_ATTR_2(temp2_fault, S_IRUGO, show_temp_fault, NULL, 0, 2), 357 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 */
379static struct sensor_device_attribute_2 f71862_temp_attr[] = {
380 SENSOR_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0, 3), 358 SENSOR_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0, 3),
381 SENSOR_ATTR_2(temp3_max, S_IRUGO|S_IWUSR, show_temp_max, 359 SENSOR_ATTR_2(temp3_max, S_IRUGO|S_IWUSR, show_temp_max,
382 store_temp_max, 0, 3), 360 store_temp_max, 0, 3),
@@ -1011,11 +989,6 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev)
1011 data->temp_type[1] = 6; 989 data->temp_type[1] = 6;
1012 break; 990 break;
1013 } 991 }
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
1019 } else { 992 } else {
1020 reg2 = f71882fg_read8(data, F71882FG_REG_PECI); 993 reg2 = f71882fg_read8(data, F71882FG_REG_PECI);
1021 if ((reg2 & 0x03) == 0x01) 994 if ((reg2 & 0x03) == 0x01)
@@ -1898,8 +1871,7 @@ static ssize_t store_pwm_auto_point_temp(struct device *dev,
1898 1871
1899 val /= 1000; 1872 val /= 1000;
1900 1873
1901 if (data->type == f71889fg 1874 if (data->type == f71889fg)
1902 || data->type == f71808fg)
1903 val = SENSORS_LIMIT(val, -128, 127); 1875 val = SENSORS_LIMIT(val, -128, 127);
1904 else 1876 else
1905 val = SENSORS_LIMIT(val, 0, 127); 1877 val = SENSORS_LIMIT(val, 0, 127);
@@ -2002,28 +1974,8 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
2002 /* fall through! */ 1974 /* fall through! */
2003 case f71862fg: 1975 case f71862fg:
2004 err = f71882fg_create_sysfs_files(pdev, 1976 err = f71882fg_create_sysfs_files(pdev,
2005 f71862_temp_attr, 1977 fxxxx_in_temp_attr,
2006 ARRAY_SIZE(f71862_temp_attr)); 1978 ARRAY_SIZE(fxxxx_in_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));
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; 1979 break;
2028 case f8000: 1980 case f8000:
2029 err = f71882fg_create_sysfs_files(pdev, 1981 err = f71882fg_create_sysfs_files(pdev,
@@ -2050,7 +2002,6 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
2050 case f71862fg: 2002 case f71862fg:
2051 err = (data->pwm_enable & 0x15) != 0x15; 2003 err = (data->pwm_enable & 0x15) != 0x15;
2052 break; 2004 break;
2053 case f71808fg:
2054 case f71882fg: 2005 case f71882fg:
2055 case f71889fg: 2006 case f71889fg:
2056 err = 0; 2007 err = 0;
@@ -2096,7 +2047,6 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
2096 f8000_auto_pwm_attr, 2047 f8000_auto_pwm_attr,
2097 ARRAY_SIZE(f8000_auto_pwm_attr)); 2048 ARRAY_SIZE(f8000_auto_pwm_attr));
2098 break; 2049 break;
2099 case f71808fg:
2100 case f71889fg: 2050 case f71889fg:
2101 for (i = 0; i < nr_fans; i++) { 2051 for (i = 0; i < nr_fans; i++) {
2102 data->pwm_auto_point_mapping[i] = 2052 data->pwm_auto_point_mapping[i] =
@@ -2176,22 +2126,8 @@ static int f71882fg_remove(struct platform_device *pdev)
2176 /* fall through! */ 2126 /* fall through! */
2177 case f71862fg: 2127 case f71862fg:
2178 f71882fg_remove_sysfs_files(pdev, 2128 f71882fg_remove_sysfs_files(pdev,
2179 f71862_temp_attr, 2129 fxxxx_in_temp_attr,
2180 ARRAY_SIZE(f71862_temp_attr)); 2130 ARRAY_SIZE(fxxxx_in_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));
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; 2131 break;
2196 case f8000: 2132 case f8000:
2197 f71882fg_remove_sysfs_files(pdev, 2133 f71882fg_remove_sysfs_files(pdev,
@@ -2259,9 +2195,6 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address,
2259 2195
2260 devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID); 2196 devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID);
2261 switch (devid) { 2197 switch (devid) {
2262 case SIO_F71808_ID:
2263 sio_data->type = f71808fg;
2264 break;
2265 case SIO_F71858_ID: 2198 case SIO_F71858_ID:
2266 sio_data->type = f71858fg; 2199 sio_data->type = f71858fg;
2267 break; 2200 break;