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.c120
1 files changed, 115 insertions, 5 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 49cf19621c0c..eea697757891 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -49,6 +49,7 @@
49#define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */ 49#define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */
50#define SIO_F71858_ID 0x0507 /* Chipset ID */ 50#define SIO_F71858_ID 0x0507 /* Chipset ID */
51#define SIO_F71862_ID 0x0601 /* Chipset ID */ 51#define SIO_F71862_ID 0x0601 /* Chipset ID */
52#define SIO_F71869_ID 0x0814 /* Chipset ID */
52#define SIO_F71882_ID 0x0541 /* Chipset ID */ 53#define SIO_F71882_ID 0x0541 /* Chipset ID */
53#define SIO_F71889_ID 0x0723 /* Chipset ID */ 54#define SIO_F71889_ID 0x0723 /* Chipset ID */
54#define SIO_F71889E_ID 0x0909 /* Chipset ID */ 55#define SIO_F71889E_ID 0x0909 /* Chipset ID */
@@ -103,38 +104,42 @@ static unsigned short force_id;
103module_param(force_id, ushort, 0); 104module_param(force_id, ushort, 0);
104MODULE_PARM_DESC(force_id, "Override the detected device ID"); 105MODULE_PARM_DESC(force_id, "Override the detected device ID");
105 106
106enum chips { f71858fg, f71862fg, f71882fg, f71889fg, f71889ed, f8000 }; 107enum chips { f71858fg, f71862fg, f71869, f71882fg, f71889fg, f71889ed, f8000 };
107 108
108static const char *f71882fg_names[] = { 109static const char *f71882fg_names[] = {
109 "f71858fg", 110 "f71858fg",
110 "f71862fg", 111 "f71862fg",
112 "f71869", /* Both f71869f and f71869e, reg. compatible and same id */
111 "f71882fg", 113 "f71882fg",
112 "f71889fg", 114 "f71889fg",
113 "f71889ed", 115 "f71889ed",
114 "f8000", 116 "f8000",
115}; 117};
116 118
117static const char f71882fg_has_in[6][F71882FG_MAX_INS] = { 119static const char f71882fg_has_in[7][F71882FG_MAX_INS] = {
118 { 1, 1, 1, 0, 0, 0, 0, 0, 0 }, /* f71858fg */ 120 { 1, 1, 1, 0, 0, 0, 0, 0, 0 }, /* f71858fg */
119 { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* f71862fg */ 121 { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* f71862fg */
122 { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* f71869 */
120 { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* f71882fg */ 123 { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* f71882fg */
121 { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* f71889fg */ 124 { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* f71889fg */
122 { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* f71889ed */ 125 { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* f71889ed */
123 { 1, 1, 1, 0, 0, 0, 0, 0, 0 }, /* f8000 */ 126 { 1, 1, 1, 0, 0, 0, 0, 0, 0 }, /* f8000 */
124}; 127};
125 128
126static const char f71882fg_has_in1_alarm[6] = { 129static const char f71882fg_has_in1_alarm[7] = {
127 0, /* f71858fg */ 130 0, /* f71858fg */
128 0, /* f71862fg */ 131 0, /* f71862fg */
132 0, /* f71869 */
129 1, /* f71882fg */ 133 1, /* f71882fg */
130 1, /* f71889fg */ 134 1, /* f71889fg */
131 1, /* f71889ed */ 135 1, /* f71889ed */
132 0, /* f8000 */ 136 0, /* f8000 */
133}; 137};
134 138
135static const char f71882fg_has_beep[6] = { 139static const char f71882fg_has_beep[7] = {
136 0, /* f71858fg */ 140 0, /* f71858fg */
137 1, /* f71862fg */ 141 1, /* f71862fg */
142 1, /* f71869 */
138 1, /* f71882fg */ 143 1, /* f71882fg */
139 1, /* f71889fg */ 144 1, /* f71889fg */
140 1, /* f71889ed */ 145 1, /* f71889ed */
@@ -585,6 +590,86 @@ static struct sensor_device_attribute_2 f71862fg_auto_pwm_attr[] = {
585 show_pwm_auto_point_temp_hyst, NULL, 3, 2), 590 show_pwm_auto_point_temp_hyst, NULL, 3, 2),
586}; 591};
587 592
593/* PWM attr for the f71869, almost identical to the f71862fg, but the
594 pwm setting when the temperature is above the pwmX_auto_point1_temp can be
595 programmed instead of being hardcoded to 0xff */
596static struct sensor_device_attribute_2 f71869_auto_pwm_attr[] = {
597 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR,
598 show_pwm_auto_point_channel,
599 store_pwm_auto_point_channel, 0, 0),
600 SENSOR_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO|S_IWUSR,
601 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
602 0, 0),
603 SENSOR_ATTR_2(pwm1_auto_point2_pwm, S_IRUGO|S_IWUSR,
604 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
605 1, 0),
606 SENSOR_ATTR_2(pwm1_auto_point3_pwm, S_IRUGO|S_IWUSR,
607 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
608 4, 0),
609 SENSOR_ATTR_2(pwm1_auto_point1_temp, S_IRUGO|S_IWUSR,
610 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
611 0, 0),
612 SENSOR_ATTR_2(pwm1_auto_point2_temp, S_IRUGO|S_IWUSR,
613 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
614 3, 0),
615 SENSOR_ATTR_2(pwm1_auto_point1_temp_hyst, S_IRUGO|S_IWUSR,
616 show_pwm_auto_point_temp_hyst,
617 store_pwm_auto_point_temp_hyst,
618 0, 0),
619 SENSOR_ATTR_2(pwm1_auto_point2_temp_hyst, S_IRUGO,
620 show_pwm_auto_point_temp_hyst, NULL, 3, 0),
621
622 SENSOR_ATTR_2(pwm2_auto_channels_temp, S_IRUGO|S_IWUSR,
623 show_pwm_auto_point_channel,
624 store_pwm_auto_point_channel, 0, 1),
625 SENSOR_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO|S_IWUSR,
626 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
627 0, 1),
628 SENSOR_ATTR_2(pwm2_auto_point2_pwm, S_IRUGO|S_IWUSR,
629 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
630 1, 1),
631 SENSOR_ATTR_2(pwm2_auto_point3_pwm, S_IRUGO|S_IWUSR,
632 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
633 4, 1),
634 SENSOR_ATTR_2(pwm2_auto_point1_temp, S_IRUGO|S_IWUSR,
635 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
636 0, 1),
637 SENSOR_ATTR_2(pwm2_auto_point2_temp, S_IRUGO|S_IWUSR,
638 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
639 3, 1),
640 SENSOR_ATTR_2(pwm2_auto_point1_temp_hyst, S_IRUGO|S_IWUSR,
641 show_pwm_auto_point_temp_hyst,
642 store_pwm_auto_point_temp_hyst,
643 0, 1),
644 SENSOR_ATTR_2(pwm2_auto_point2_temp_hyst, S_IRUGO,
645 show_pwm_auto_point_temp_hyst, NULL, 3, 1),
646
647 SENSOR_ATTR_2(pwm3_auto_channels_temp, S_IRUGO|S_IWUSR,
648 show_pwm_auto_point_channel,
649 store_pwm_auto_point_channel, 0, 2),
650 SENSOR_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO|S_IWUSR,
651 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
652 0, 2),
653 SENSOR_ATTR_2(pwm3_auto_point2_pwm, S_IRUGO|S_IWUSR,
654 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
655 1, 2),
656 SENSOR_ATTR_2(pwm3_auto_point3_pwm, S_IRUGO|S_IWUSR,
657 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
658 4, 2),
659 SENSOR_ATTR_2(pwm3_auto_point1_temp, S_IRUGO|S_IWUSR,
660 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
661 0, 2),
662 SENSOR_ATTR_2(pwm3_auto_point2_temp, S_IRUGO|S_IWUSR,
663 show_pwm_auto_point_temp, store_pwm_auto_point_temp,
664 3, 2),
665 SENSOR_ATTR_2(pwm3_auto_point1_temp_hyst, S_IRUGO|S_IWUSR,
666 show_pwm_auto_point_temp_hyst,
667 store_pwm_auto_point_temp_hyst,
668 0, 2),
669 SENSOR_ATTR_2(pwm3_auto_point2_temp_hyst, S_IRUGO,
670 show_pwm_auto_point_temp_hyst, NULL, 3, 2),
671};
672
588/* PWM attr for the standard models */ 673/* PWM attr for the standard models */
589static struct sensor_device_attribute_2 fxxxx_auto_pwm_attr[4][14] = { { 674static struct sensor_device_attribute_2 fxxxx_auto_pwm_attr[4][14] = { {
590 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR, 675 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR,
@@ -1036,7 +1121,7 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev)
1036 f71882fg_read8(data, 1121 f71882fg_read8(data,
1037 F71882FG_REG_POINT_MAPPING(nr)); 1122 F71882FG_REG_POINT_MAPPING(nr));
1038 1123
1039 if (data->type != f71862fg) { 1124 if (data->type != f71862fg && data->type != f71869) {
1040 int point; 1125 int point;
1041 for (point = 0; point < 5; point++) { 1126 for (point = 0; point < 5; point++) {
1042 data->pwm_auto_point_pwm[nr][point] = 1127 data->pwm_auto_point_pwm[nr][point] =
@@ -1051,6 +1136,12 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev)
1051 (nr, point)); 1136 (nr, point));
1052 } 1137 }
1053 } else { 1138 } else {
1139 if (data->type == f71869) {
1140 data->pwm_auto_point_pwm[nr][0] =
1141 f71882fg_read8(data,
1142 F71882FG_REG_POINT_PWM
1143 (nr, 0));
1144 }
1054 data->pwm_auto_point_pwm[nr][1] = 1145 data->pwm_auto_point_pwm[nr][1] =
1055 f71882fg_read8(data, 1146 f71882fg_read8(data,
1056 F71882FG_REG_POINT_PWM 1147 F71882FG_REG_POINT_PWM
@@ -2029,6 +2120,10 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
2029 2120
2030 if (start_reg & 0x02) { 2121 if (start_reg & 0x02) {
2031 switch (data->type) { 2122 switch (data->type) {
2123 case f71869:
2124 /* The f71869 always has signed auto point temps */
2125 data->auto_point_temp_signed = 1;
2126 /* Fall through to select correct fan/pwm reg bank! */
2032 case f71889fg: 2127 case f71889fg:
2033 case f71889ed: 2128 case f71889ed:
2034 reg = f71882fg_read8(data, F71882FG_REG_FAN_FAULT_T); 2129 reg = f71882fg_read8(data, F71882FG_REG_FAN_FAULT_T);
@@ -2056,6 +2151,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
2056 case f71862fg: 2151 case f71862fg:
2057 err = (data->pwm_enable & 0x15) != 0x15; 2152 err = (data->pwm_enable & 0x15) != 0x15;
2058 break; 2153 break;
2154 case f71869:
2059 case f71882fg: 2155 case f71882fg:
2060 case f71889fg: 2156 case f71889fg:
2061 case f71889ed: 2157 case f71889ed:
@@ -2086,6 +2182,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
2086 } 2182 }
2087 2183
2088 switch (data->type) { 2184 switch (data->type) {
2185 case f71869:
2089 case f71889fg: 2186 case f71889fg:
2090 case f71889ed: 2187 case f71889ed:
2091 for (i = 0; i < nr_fans; i++) { 2188 for (i = 0; i < nr_fans; i++) {
@@ -2114,6 +2211,11 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
2114 f71862fg_auto_pwm_attr, 2211 f71862fg_auto_pwm_attr,
2115 ARRAY_SIZE(f71862fg_auto_pwm_attr)); 2212 ARRAY_SIZE(f71862fg_auto_pwm_attr));
2116 break; 2213 break;
2214 case f71869:
2215 err = f71882fg_create_sysfs_files(pdev,
2216 f71869_auto_pwm_attr,
2217 ARRAY_SIZE(f71869_auto_pwm_attr));
2218 break;
2117 case f8000: 2219 case f8000:
2118 err = f71882fg_create_sysfs_files(pdev, 2220 err = f71882fg_create_sysfs_files(pdev,
2119 f8000_fan_attr, 2221 f8000_fan_attr,
@@ -2224,6 +2326,11 @@ static int f71882fg_remove(struct platform_device *pdev)
2224 f71862fg_auto_pwm_attr, 2326 f71862fg_auto_pwm_attr,
2225 ARRAY_SIZE(f71862fg_auto_pwm_attr)); 2327 ARRAY_SIZE(f71862fg_auto_pwm_attr));
2226 break; 2328 break;
2329 case f71869:
2330 f71882fg_remove_sysfs_files(pdev,
2331 f71869_auto_pwm_attr,
2332 ARRAY_SIZE(f71869_auto_pwm_attr));
2333 break;
2227 case f8000: 2334 case f8000:
2228 f71882fg_remove_sysfs_files(pdev, 2335 f71882fg_remove_sysfs_files(pdev,
2229 f8000_fan_attr, 2336 f8000_fan_attr,
@@ -2268,6 +2375,9 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address,
2268 case SIO_F71862_ID: 2375 case SIO_F71862_ID:
2269 sio_data->type = f71862fg; 2376 sio_data->type = f71862fg;
2270 break; 2377 break;
2378 case SIO_F71869_ID:
2379 sio_data->type = f71869;
2380 break;
2271 case SIO_F71882_ID: 2381 case SIO_F71882_ID:
2272 sio_data->type = f71882fg; 2382 sio_data->type = f71882fg;
2273 break; 2383 break;