diff options
author | Hans de Goede <hdegoede@redhat.com> | 2011-03-10 02:54:02 -0500 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-03-15 01:39:26 -0400 |
commit | e5e713cbe812e8b9ef2099694be7c587c51438c4 (patch) | |
tree | 0bb4caa38e6f24ad43a82cb6eab32ee304818a67 /drivers/hwmon/f71882fg.c | |
parent | c11bb993629078264f72f8de8d48d7c3286c4c3e (diff) |
hwmon/f71882fg: Add support for f71808e
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Jonathan Michalon <johndescs@gmail.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon/f71882fg.c')
-rw-r--r-- | drivers/hwmon/f71882fg.c | 61 |
1 files changed, 40 insertions, 21 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index eea697757891..a4d430ee7e20 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */ | 47 | #define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */ |
48 | 48 | ||
49 | #define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */ | 49 | #define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */ |
50 | #define SIO_F71808E_ID 0x0901 /* Chipset ID */ | ||
50 | #define SIO_F71858_ID 0x0507 /* Chipset ID */ | 51 | #define SIO_F71858_ID 0x0507 /* Chipset ID */ |
51 | #define SIO_F71862_ID 0x0601 /* Chipset ID */ | 52 | #define SIO_F71862_ID 0x0601 /* Chipset ID */ |
52 | #define SIO_F71869_ID 0x0814 /* Chipset ID */ | 53 | #define SIO_F71869_ID 0x0814 /* Chipset ID */ |
@@ -104,9 +105,11 @@ static unsigned short force_id; | |||
104 | module_param(force_id, ushort, 0); | 105 | module_param(force_id, ushort, 0); |
105 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); | 106 | MODULE_PARM_DESC(force_id, "Override the detected device ID"); |
106 | 107 | ||
107 | enum chips { f71858fg, f71862fg, f71869, f71882fg, f71889fg, f71889ed, f8000 }; | 108 | enum chips { f71808e, f71858fg, f71862fg, f71869, f71882fg, f71889fg, |
109 | f71889ed, f8000 }; | ||
108 | 110 | ||
109 | static const char *f71882fg_names[] = { | 111 | static const char *f71882fg_names[] = { |
112 | "f71808e", | ||
110 | "f71858fg", | 113 | "f71858fg", |
111 | "f71862fg", | 114 | "f71862fg", |
112 | "f71869", /* Both f71869f and f71869e, reg. compatible and same id */ | 115 | "f71869", /* Both f71869f and f71869e, reg. compatible and same id */ |
@@ -116,7 +119,8 @@ static const char *f71882fg_names[] = { | |||
116 | "f8000", | 119 | "f8000", |
117 | }; | 120 | }; |
118 | 121 | ||
119 | static const char f71882fg_has_in[7][F71882FG_MAX_INS] = { | 122 | static const char f71882fg_has_in[8][F71882FG_MAX_INS] = { |
123 | { 1, 1, 1, 1, 1, 1, 0, 1, 1 }, /* f71808e */ | ||
120 | { 1, 1, 1, 0, 0, 0, 0, 0, 0 }, /* f71858fg */ | 124 | { 1, 1, 1, 0, 0, 0, 0, 0, 0 }, /* f71858fg */ |
121 | { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* f71862fg */ | 125 | { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* f71862fg */ |
122 | { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* f71869 */ | 126 | { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* f71869 */ |
@@ -126,7 +130,8 @@ static const char f71882fg_has_in[7][F71882FG_MAX_INS] = { | |||
126 | { 1, 1, 1, 0, 0, 0, 0, 0, 0 }, /* f8000 */ | 130 | { 1, 1, 1, 0, 0, 0, 0, 0, 0 }, /* f8000 */ |
127 | }; | 131 | }; |
128 | 132 | ||
129 | static const char f71882fg_has_in1_alarm[7] = { | 133 | static const char f71882fg_has_in1_alarm[8] = { |
134 | 0, /* f71808e */ | ||
130 | 0, /* f71858fg */ | 135 | 0, /* f71858fg */ |
131 | 0, /* f71862fg */ | 136 | 0, /* f71862fg */ |
132 | 0, /* f71869 */ | 137 | 0, /* f71869 */ |
@@ -136,7 +141,8 @@ static const char f71882fg_has_in1_alarm[7] = { | |||
136 | 0, /* f8000 */ | 141 | 0, /* f8000 */ |
137 | }; | 142 | }; |
138 | 143 | ||
139 | static const char f71882fg_has_beep[7] = { | 144 | static const char f71882fg_has_beep[8] = { |
145 | 0, /* f71808e */ | ||
140 | 0, /* f71858fg */ | 146 | 0, /* f71858fg */ |
141 | 1, /* f71862fg */ | 147 | 1, /* f71862fg */ |
142 | 1, /* f71869 */ | 148 | 1, /* f71869 */ |
@@ -181,7 +187,7 @@ struct f71882fg_data { | |||
181 | u16 fan_full_speed[4]; | 187 | u16 fan_full_speed[4]; |
182 | u8 fan_status; | 188 | u8 fan_status; |
183 | u8 fan_beep; | 189 | u8 fan_beep; |
184 | /* Note: all models have only 3 temperature channels, but on some | 190 | /* Note: all models have max 3 temperature channels, but on some |
185 | they are addressed as 0-2 and on others as 1-3, so for coding | 191 | they are addressed as 0-2 and on others as 1-3, so for coding |
186 | convenience we reserve space for 4 channels */ | 192 | convenience we reserve space for 4 channels */ |
187 | u16 temp[4]; | 193 | u16 temp[4]; |
@@ -590,7 +596,7 @@ static struct sensor_device_attribute_2 f71862fg_auto_pwm_attr[] = { | |||
590 | show_pwm_auto_point_temp_hyst, NULL, 3, 2), | 596 | show_pwm_auto_point_temp_hyst, NULL, 3, 2), |
591 | }; | 597 | }; |
592 | 598 | ||
593 | /* PWM attr for the f71869, almost identical to the f71862fg, but the | 599 | /* PWM attr for the f71808e/f71869, almost identical to the f71862fg, but the |
594 | pwm setting when the temperature is above the pwmX_auto_point1_temp can be | 600 | pwm setting when the temperature is above the pwmX_auto_point1_temp can be |
595 | programmed instead of being hardcoded to 0xff */ | 601 | programmed instead of being hardcoded to 0xff */ |
596 | static struct sensor_device_attribute_2 f71869_auto_pwm_attr[] = { | 602 | static struct sensor_device_attribute_2 f71869_auto_pwm_attr[] = { |
@@ -1065,8 +1071,9 @@ static u16 f71882fg_read_temp(struct f71882fg_data *data, int nr) | |||
1065 | static struct f71882fg_data *f71882fg_update_device(struct device *dev) | 1071 | static struct f71882fg_data *f71882fg_update_device(struct device *dev) |
1066 | { | 1072 | { |
1067 | struct f71882fg_data *data = dev_get_drvdata(dev); | 1073 | struct f71882fg_data *data = dev_get_drvdata(dev); |
1068 | int nr, reg; | 1074 | int nr, reg, point; |
1069 | int nr_fans = (data->type == f71882fg) ? 4 : 3; | 1075 | int nr_fans = (data->type == f71882fg) ? 4 : 3; |
1076 | int nr_temps = (data->type == f71808e) ? 2 : 3; | ||
1070 | 1077 | ||
1071 | mutex_lock(&data->update_lock); | 1078 | mutex_lock(&data->update_lock); |
1072 | 1079 | ||
@@ -1081,7 +1088,8 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev) | |||
1081 | } | 1088 | } |
1082 | 1089 | ||
1083 | /* Get High & boundary temps*/ | 1090 | /* Get High & boundary temps*/ |
1084 | for (nr = data->temp_start; nr < 3 + data->temp_start; nr++) { | 1091 | for (nr = data->temp_start; nr < nr_temps + data->temp_start; |
1092 | nr++) { | ||
1085 | data->temp_ovt[nr] = f71882fg_read8(data, | 1093 | data->temp_ovt[nr] = f71882fg_read8(data, |
1086 | F71882FG_REG_TEMP_OVT(nr)); | 1094 | F71882FG_REG_TEMP_OVT(nr)); |
1087 | data->temp_high[nr] = f71882fg_read8(data, | 1095 | data->temp_high[nr] = f71882fg_read8(data, |
@@ -1121,8 +1129,8 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev) | |||
1121 | f71882fg_read8(data, | 1129 | f71882fg_read8(data, |
1122 | F71882FG_REG_POINT_MAPPING(nr)); | 1130 | F71882FG_REG_POINT_MAPPING(nr)); |
1123 | 1131 | ||
1124 | if (data->type != f71862fg && data->type != f71869) { | 1132 | switch (data->type) { |
1125 | int point; | 1133 | default: |
1126 | for (point = 0; point < 5; point++) { | 1134 | for (point = 0; point < 5; point++) { |
1127 | data->pwm_auto_point_pwm[nr][point] = | 1135 | data->pwm_auto_point_pwm[nr][point] = |
1128 | f71882fg_read8(data, | 1136 | f71882fg_read8(data, |
@@ -1135,13 +1143,14 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev) | |||
1135 | F71882FG_REG_POINT_TEMP | 1143 | F71882FG_REG_POINT_TEMP |
1136 | (nr, point)); | 1144 | (nr, point)); |
1137 | } | 1145 | } |
1138 | } else { | 1146 | break; |
1139 | if (data->type == f71869) { | 1147 | case f71808e: |
1140 | data->pwm_auto_point_pwm[nr][0] = | 1148 | case f71869: |
1141 | f71882fg_read8(data, | 1149 | data->pwm_auto_point_pwm[nr][0] = |
1142 | F71882FG_REG_POINT_PWM | 1150 | f71882fg_read8(data, |
1143 | (nr, 0)); | 1151 | F71882FG_REG_POINT_PWM(nr, 0)); |
1144 | } | 1152 | /* Fall through */ |
1153 | case f71862fg: | ||
1145 | data->pwm_auto_point_pwm[nr][1] = | 1154 | data->pwm_auto_point_pwm[nr][1] = |
1146 | f71882fg_read8(data, | 1155 | f71882fg_read8(data, |
1147 | F71882FG_REG_POINT_PWM | 1156 | F71882FG_REG_POINT_PWM |
@@ -1158,6 +1167,7 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev) | |||
1158 | f71882fg_read8(data, | 1167 | f71882fg_read8(data, |
1159 | F71882FG_REG_POINT_TEMP | 1168 | F71882FG_REG_POINT_TEMP |
1160 | (nr, 3)); | 1169 | (nr, 3)); |
1170 | break; | ||
1161 | } | 1171 | } |
1162 | } | 1172 | } |
1163 | data->last_limits = jiffies; | 1173 | data->last_limits = jiffies; |
@@ -1169,7 +1179,8 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev) | |||
1169 | F71882FG_REG_TEMP_STATUS); | 1179 | F71882FG_REG_TEMP_STATUS); |
1170 | data->temp_diode_open = f71882fg_read8(data, | 1180 | data->temp_diode_open = f71882fg_read8(data, |
1171 | F71882FG_REG_TEMP_DIODE_OPEN); | 1181 | F71882FG_REG_TEMP_DIODE_OPEN); |
1172 | for (nr = data->temp_start; nr < 3 + data->temp_start; nr++) | 1182 | for (nr = data->temp_start; nr < nr_temps + data->temp_start; |
1183 | nr++) | ||
1173 | data->temp[nr] = f71882fg_read_temp(data, nr); | 1184 | data->temp[nr] = f71882fg_read_temp(data, nr); |
1174 | 1185 | ||
1175 | data->fan_status = f71882fg_read8(data, | 1186 | data->fan_status = f71882fg_read8(data, |
@@ -2032,7 +2043,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2032 | struct f71882fg_data *data; | 2043 | struct f71882fg_data *data; |
2033 | struct f71882fg_sio_data *sio_data = pdev->dev.platform_data; | 2044 | struct f71882fg_sio_data *sio_data = pdev->dev.platform_data; |
2034 | int err, i, nr_fans = (sio_data->type == f71882fg) ? 4 : 3; | 2045 | int err, i, nr_fans = (sio_data->type == f71882fg) ? 4 : 3; |
2035 | int nr_temps = 3; | 2046 | int nr_temps = (sio_data->type == f71808e) ? 2 : 3; |
2036 | u8 start_reg, reg; | 2047 | u8 start_reg, reg; |
2037 | 2048 | ||
2038 | data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL); | 2049 | data = kzalloc(sizeof(struct f71882fg_data), GFP_KERNEL); |
@@ -2120,8 +2131,9 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2120 | 2131 | ||
2121 | if (start_reg & 0x02) { | 2132 | if (start_reg & 0x02) { |
2122 | switch (data->type) { | 2133 | switch (data->type) { |
2134 | case f71808e: | ||
2123 | case f71869: | 2135 | case f71869: |
2124 | /* The f71869 always has signed auto point temps */ | 2136 | /* These always have signed auto point temps */ |
2125 | data->auto_point_temp_signed = 1; | 2137 | data->auto_point_temp_signed = 1; |
2126 | /* Fall through to select correct fan/pwm reg bank! */ | 2138 | /* Fall through to select correct fan/pwm reg bank! */ |
2127 | case f71889fg: | 2139 | case f71889fg: |
@@ -2151,6 +2163,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2151 | case f71862fg: | 2163 | case f71862fg: |
2152 | err = (data->pwm_enable & 0x15) != 0x15; | 2164 | err = (data->pwm_enable & 0x15) != 0x15; |
2153 | break; | 2165 | break; |
2166 | case f71808e: | ||
2154 | case f71869: | 2167 | case f71869: |
2155 | case f71882fg: | 2168 | case f71882fg: |
2156 | case f71889fg: | 2169 | case f71889fg: |
@@ -2182,6 +2195,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2182 | } | 2195 | } |
2183 | 2196 | ||
2184 | switch (data->type) { | 2197 | switch (data->type) { |
2198 | case f71808e: | ||
2185 | case f71869: | 2199 | case f71869: |
2186 | case f71889fg: | 2200 | case f71889fg: |
2187 | case f71889ed: | 2201 | case f71889ed: |
@@ -2211,6 +2225,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev) | |||
2211 | f71862fg_auto_pwm_attr, | 2225 | f71862fg_auto_pwm_attr, |
2212 | ARRAY_SIZE(f71862fg_auto_pwm_attr)); | 2226 | ARRAY_SIZE(f71862fg_auto_pwm_attr)); |
2213 | break; | 2227 | break; |
2228 | case f71808e: | ||
2214 | case f71869: | 2229 | case f71869: |
2215 | err = f71882fg_create_sysfs_files(pdev, | 2230 | err = f71882fg_create_sysfs_files(pdev, |
2216 | f71869_auto_pwm_attr, | 2231 | f71869_auto_pwm_attr, |
@@ -2262,7 +2277,7 @@ static int f71882fg_remove(struct platform_device *pdev) | |||
2262 | { | 2277 | { |
2263 | struct f71882fg_data *data = platform_get_drvdata(pdev); | 2278 | struct f71882fg_data *data = platform_get_drvdata(pdev); |
2264 | int i, nr_fans = (data->type == f71882fg) ? 4 : 3; | 2279 | int i, nr_fans = (data->type == f71882fg) ? 4 : 3; |
2265 | int nr_temps = 3; | 2280 | int nr_temps = (data->type == f71808e) ? 2 : 3; |
2266 | u8 start_reg = f71882fg_read8(data, F71882FG_REG_START); | 2281 | u8 start_reg = f71882fg_read8(data, F71882FG_REG_START); |
2267 | 2282 | ||
2268 | if (data->hwmon_dev) | 2283 | if (data->hwmon_dev) |
@@ -2326,6 +2341,7 @@ static int f71882fg_remove(struct platform_device *pdev) | |||
2326 | f71862fg_auto_pwm_attr, | 2341 | f71862fg_auto_pwm_attr, |
2327 | ARRAY_SIZE(f71862fg_auto_pwm_attr)); | 2342 | ARRAY_SIZE(f71862fg_auto_pwm_attr)); |
2328 | break; | 2343 | break; |
2344 | case f71808e: | ||
2329 | case f71869: | 2345 | case f71869: |
2330 | f71882fg_remove_sysfs_files(pdev, | 2346 | f71882fg_remove_sysfs_files(pdev, |
2331 | f71869_auto_pwm_attr, | 2347 | f71869_auto_pwm_attr, |
@@ -2369,6 +2385,9 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address, | |||
2369 | 2385 | ||
2370 | devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID); | 2386 | devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID); |
2371 | switch (devid) { | 2387 | switch (devid) { |
2388 | case SIO_F71808E_ID: | ||
2389 | sio_data->type = f71808e; | ||
2390 | break; | ||
2372 | case SIO_F71858_ID: | 2391 | case SIO_F71858_ID: |
2373 | sio_data->type = f71858fg; | 2392 | sio_data->type = f71858fg; |
2374 | break; | 2393 | break; |