Lines Matching +full:0 +full:x255
24 * w83627ehf 10 5 4 3 0x8850 0x88 0x5ca3
25 * 0x8860 0xa1
26 * w83627dhg 9 5 4 3 0xa020 0xc1 0x5ca3
27 * w83627dhg-p 9 5 4 3 0xb070 0xc1 0x5ca3
28 * w83627uhg 8 2 2 3 0xa230 0xc1 0x5ca3
29 * w83667hg 9 5 3 3 0xa510 0xc1 0x5ca3
30 * w83667hg-b 9 5 3 4 0xb350 0xc1 0x5ca3
65 module_param(force_id, ushort, 0);
74 #define W83627EHF_LD_HWM 0x0b
75 #define W83667HG_LD_VID 0x0d
77 #define SIO_REG_LDSEL 0x07 /* Logical device select */
78 #define SIO_REG_DEVID 0x20 /* Device ID (2 bytes) */
79 #define SIO_REG_EN_VRM10 0x2C /* GPIO3, GPIO4 selection */
80 #define SIO_REG_ENABLE 0x30 /* Logical device enable */
81 #define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */
82 #define SIO_REG_VID_CTRL 0xF0 /* VID control */
83 #define SIO_REG_VID_DATA 0xF1 /* VID data */
85 #define SIO_W83627EHF_ID 0x8850
86 #define SIO_W83627EHG_ID 0x8860
87 #define SIO_W83627DHG_ID 0xa020
88 #define SIO_W83627DHG_P_ID 0xb070
89 #define SIO_W83627UHG_ID 0xa230
90 #define SIO_W83667HG_ID 0xa510
91 #define SIO_W83667HG_B_ID 0xb350
92 #define SIO_ID_MASK 0xFFF0
121 outb(0x87, ioreg); in superio_enter()
122 outb(0x87, ioreg); in superio_enter()
124 return 0; in superio_enter()
130 outb(0xaa, ioreg); in superio_exit()
131 outb(0x02, ioreg); in superio_exit()
132 outb(0x02, ioreg + 1); in superio_exit()
143 #define ADDR_REG_OFFSET 0
146 #define W83627EHF_REG_BANK 0x4E
147 #define W83627EHF_REG_CONFIG 0x40
151 * REG_MAN_ID has the value 0x5ca3 for all supported chips.
152 * REG_CHIP_ID == 0x88/0xa1/0xc1 depending on chip model.
153 * REG_MAN_ID is at port 0x4f
154 * REG_CHIP_ID is at port 0x58
157 static const u16 W83627EHF_REG_FAN[] = { 0x28, 0x29, 0x2a, 0x3f, 0x553 };
158 static const u16 W83627EHF_REG_FAN_MIN[] = { 0x3b, 0x3c, 0x3d, 0x3e, 0x55c };
161 #define W83627EHF_REG_IN_MAX(nr) ((nr < 7) ? (0x2b + (nr) * 2) : \
162 (0x554 + (((nr) - 7) * 2)))
163 #define W83627EHF_REG_IN_MIN(nr) ((nr < 7) ? (0x2c + (nr) * 2) : \
164 (0x555 + (((nr) - 7) * 2)))
165 #define W83627EHF_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \
166 (0x550 + (nr) - 7))
168 static const u16 W83627EHF_REG_TEMP[] = { 0x27, 0x150, 0x250, 0x7e };
169 static const u16 W83627EHF_REG_TEMP_HYST[] = { 0x3a, 0x153, 0x253, 0 };
170 static const u16 W83627EHF_REG_TEMP_OVER[] = { 0x39, 0x155, 0x255, 0 };
171 static const u16 W83627EHF_REG_TEMP_CONFIG[] = { 0, 0x152, 0x252, 0 };
174 #define W83627EHF_REG_FANDIV1 0x47
175 #define W83627EHF_REG_FANDIV2 0x4B
176 #define W83627EHF_REG_VBAT 0x5D
177 #define W83627EHF_REG_DIODE 0x59
178 #define W83627EHF_REG_SMI_OVT 0x4C
180 #define W83627EHF_REG_ALARM1 0x459
181 #define W83627EHF_REG_ALARM2 0x45A
182 #define W83627EHF_REG_ALARM3 0x45B
184 #define W83627EHF_REG_CASEOPEN_DET 0x42 /* SMI STATUS #2 */
185 #define W83627EHF_REG_CASEOPEN_CLR 0x46 /* SMI MASK #3 */
188 #define W83627EHF_REG_FAN_STEPUP_TIME 0x0f
189 #define W83627EHF_REG_FAN_STEPDOWN_TIME 0x0e
193 0x04, /* SYS FAN0 output mode and PWM mode */
194 0x04, /* CPU FAN0 output mode and PWM mode */
195 0x12, /* AUX FAN mode */
196 0x62, /* CPU FAN1 mode */
199 static const u8 W83627EHF_PWM_MODE_SHIFT[] = { 0, 1, 0, 6 };
203 static const u16 W83627EHF_REG_PWM[] = { 0x01, 0x03, 0x11, 0x61 };
204 static const u16 W83627EHF_REG_TARGET[] = { 0x05, 0x06, 0x13, 0x63 };
205 static const u8 W83627EHF_REG_TOLERANCE[] = { 0x07, 0x07, 0x14, 0x62 };
208 static const u16 W83627EHF_REG_FAN_START_OUTPUT[] = { 0x0a, 0x0b, 0x16, 0x65 };
209 static const u16 W83627EHF_REG_FAN_STOP_OUTPUT[] = { 0x08, 0x09, 0x15, 0x64 };
210 static const u16 W83627EHF_REG_FAN_STOP_TIME[] = { 0x0c, 0x0d, 0x17, 0x66 };
213 = { 0xff, 0x67, 0xff, 0x69 };
215 = { 0xff, 0x68, 0xff, 0x6a };
217 static const u16 W83627EHF_REG_FAN_MAX_OUTPUT_W83667_B[] = { 0x67, 0x69, 0x6b };
219 = { 0x68, 0x6a, 0x6c };
221 static const u16 W83627EHF_REG_TEMP_OFFSET[] = { 0x454, 0x455, 0x456 };
238 return ((((reg & 0xff00) == 0x100 in is_word_sized()
239 || (reg & 0xff00) == 0x200) in is_word_sized()
240 && ((reg & 0x00ff) == 0x50 in is_word_sized()
241 || (reg & 0x00ff) == 0x53 in is_word_sized()
242 || (reg & 0x00ff) == 0x55)) in is_word_sized()
243 || (reg & 0xfff0) == 0x630 in is_word_sized()
244 || reg == 0x640 || reg == 0x642 in is_word_sized()
245 || ((reg & 0xfff0) == 0x650 in is_word_sized()
246 && (reg & 0x000f) >= 0x06) in is_word_sized()
247 || reg == 0x73 || reg == 0x75 || reg == 0x77 in is_word_sized()
269 if (reg == 0 || reg == 255) in fan_from_reg8()
270 return 0; in fan_from_reg8()
288 800, 800, 3328, 3424, 800, 800, 0, 3328, 3400
298 return clamp_val(DIV_ROUND_CLOSEST(val * 100, scale_in[nr]), 0, 255); in in_to_reg()
345 u8 pwm_mode[4]; /* 0->DC variable voltage, 1->PWM variable duty cycle */
387 * On older chips, only registers 0x50-0x5f are banked.
409 outb_p(reg & 0xff, data->addr + ADDR_REG_OFFSET); in w83627ehf_read_value()
412 outb_p((reg & 0xff) + 1, in w83627ehf_read_value()
429 outb_p(reg & 0xff, data->addr + ADDR_REG_OFFSET); in w83627ehf_write_value()
432 outb_p((reg & 0xff) + 1, in w83627ehf_write_value()
435 outb_p(value & 0xff, data->addr + DATA_REG_OFFSET); in w83627ehf_write_value()
438 return 0; in w83627ehf_write_value()
467 case 0: in w83627ehf_write_fan_div()
468 reg = (w83627ehf_read_value(data, W83627EHF_REG_FANDIV1) & 0xcf) in w83627ehf_write_fan_div()
469 | ((data->fan_div[0] & 0x03) << 4); in w83627ehf_write_fan_div()
471 reg |= (data->has_fan & (1 << 4)) ? 1 : 0; in w83627ehf_write_fan_div()
473 reg = (w83627ehf_read_value(data, W83627EHF_REG_VBAT) & 0xdf) in w83627ehf_write_fan_div()
474 | ((data->fan_div[0] & 0x04) << 3); in w83627ehf_write_fan_div()
478 reg = (w83627ehf_read_value(data, W83627EHF_REG_FANDIV1) & 0x3f) in w83627ehf_write_fan_div()
479 | ((data->fan_div[1] & 0x03) << 6); in w83627ehf_write_fan_div()
481 reg |= (data->has_fan & (1 << 4)) ? 1 : 0; in w83627ehf_write_fan_div()
483 reg = (w83627ehf_read_value(data, W83627EHF_REG_VBAT) & 0xbf) in w83627ehf_write_fan_div()
484 | ((data->fan_div[1] & 0x04) << 4); in w83627ehf_write_fan_div()
488 reg = (w83627ehf_read_value(data, W83627EHF_REG_FANDIV2) & 0x3f) in w83627ehf_write_fan_div()
489 | ((data->fan_div[2] & 0x03) << 6); in w83627ehf_write_fan_div()
491 reg = (w83627ehf_read_value(data, W83627EHF_REG_VBAT) & 0x7f) in w83627ehf_write_fan_div()
492 | ((data->fan_div[2] & 0x04) << 5); in w83627ehf_write_fan_div()
496 reg = (w83627ehf_read_value(data, W83627EHF_REG_DIODE) & 0xfc) in w83627ehf_write_fan_div()
497 | (data->fan_div[3] & 0x03); in w83627ehf_write_fan_div()
499 reg = (w83627ehf_read_value(data, W83627EHF_REG_SMI_OVT) & 0x7f) in w83627ehf_write_fan_div()
500 | ((data->fan_div[3] & 0x04) << 5); in w83627ehf_write_fan_div()
504 reg = (w83627ehf_read_value(data, W83627EHF_REG_DIODE) & 0x73) in w83627ehf_write_fan_div()
505 | ((data->fan_div[4] & 0x03) << 2) in w83627ehf_write_fan_div()
506 | ((data->fan_div[4] & 0x04) << 5); in w83627ehf_write_fan_div()
517 data->fan_div[0] = (i >> 4) & 0x03; in w83627ehf_update_fan_div()
518 data->fan_div[1] = (i >> 6) & 0x03; in w83627ehf_update_fan_div()
520 data->fan_div[2] = (i >> 6) & 0x03; in w83627ehf_update_fan_div()
522 data->fan_div[0] |= (i >> 3) & 0x04; in w83627ehf_update_fan_div()
523 data->fan_div[1] |= (i >> 4) & 0x04; in w83627ehf_update_fan_div()
524 data->fan_div[2] |= (i >> 5) & 0x04; in w83627ehf_update_fan_div()
527 data->fan_div[3] = i & 0x03; in w83627ehf_update_fan_div()
528 data->fan_div[4] = ((i >> 2) & 0x03) in w83627ehf_update_fan_div()
529 | ((i >> 5) & 0x04); in w83627ehf_update_fan_div()
533 data->fan_div[3] |= (i >> 5) & 0x04; in w83627ehf_update_fan_div()
540 int pwmcfg = 0, tolerance = 0; /* shut up the compiler */ in w83627ehf_update_pwm()
542 for (i = 0; i < data->pwm_num; i++) { in w83627ehf_update_pwm()
546 /* pwmcfg, tolerance mapped for i=0, i=1 to same reg */ in w83627ehf_update_pwm()
554 ((pwmcfg >> W83627EHF_PWM_MODE_SHIFT[i]) & 1) ? 0 : 1; in w83627ehf_update_pwm()
559 data->tolerance[i] = (tolerance >> (i == 1 ? 4 : 0)) & 0x0f; in w83627ehf_update_pwm()
576 for (i = 0; i < data->in_num; i++) { in w83627ehf_update_device()
589 for (i = 0; i < 5; i++) { in w83627ehf_update_device()
607 if (reg >= 0xff && data->fan_div[i] < 0x07) { in w83627ehf_update_device()
626 for (i = 0; i < data->pwm_num; i++) { in w83627ehf_update_device()
641 data->REG_FAN_MAX_OUTPUT[i] != 0xff) in w83627ehf_update_device()
647 data->REG_FAN_STEP_OUTPUT[i] != 0xff) in w83627ehf_update_device()
655 (data->pwm_mode[i] == 1 ? 0x7f : 0xff); in w83627ehf_update_device()
659 for (i = 0; i < NUM_REG_TEMP; i++) { in w83627ehf_update_device()
703 if (val < 0) \
710 return 0; \
723 if (val < 0) in store_in_reg()
749 new_div = 0; /* 1 == (1 << 0) */ in store_in_reg()
752 channel + 1, val, fan_from_reg8(1, 0)); in store_in_reg()
759 new_div = 0; in store_in_reg()
785 return 0; in store_in_reg()
797 return 0; \
812 return 0; in store_temp_offset()
821 if (val < 0 || val > 1) in store_pwm_mode()
832 return 0; in store_pwm_mode()
839 val = clamp_val(val, 0, 255); in store_pwm()
845 return 0; in store_pwm()
854 if (!val || val < 0 || in store_pwm_enable()
862 reg &= ~(0x03 << W83627EHF_PWM_ENABLE_SHIFT[channel]); in store_pwm_enable()
867 return 0; in store_pwm_enable()
895 if (err < 0) in show_tol_temp()
898 val = DIV_ROUND_CLOSEST(clamp_val(val, 0, 127000), 1000); in show_tol_temp()
919 if (err < 0) in store_tolerance()
922 /* Limit the temp to 0C - 15C */ in store_tolerance()
923 val = DIV_ROUND_CLOSEST(clamp_val(val, 0, 15000), 1000); in store_tolerance()
928 reg = (reg & 0x0f) | (val << 4); in store_tolerance()
930 reg = (reg & 0xf0) | val; in store_tolerance()
938 store_target_temp, 0);
947 store_tolerance, 0);
978 if (err < 0) \
1017 if (err < 0) \
1048 store_fan_stop_time, 0);
1052 store_fan_start_output, 0);
1056 store_fan_stop_output, 0);
1066 store_fan_max_output, 0);
1068 store_fan_step_output, 0);
1092 const u16 mask = 0x80; in clear_caseopen()
1095 if (val != 0 || channel != 0) in clear_caseopen()
1105 return 0; in clear_caseopen()
1134 data->REG_FAN_STEP_OUTPUT[sda->index] != 0xff) in w83627ehf_attrs_visible()
1160 return 0; in w83627ehf_attrs_visible()
1225 if (!(tmp & 0x01)) in w83627ehf_init_device()
1227 tmp | 0x01); in w83627ehf_init_device()
1230 for (i = 0; i < NUM_REG_TEMP; i++) { in w83627ehf_init_device()
1237 if (tmp & 0x01) in w83627ehf_init_device()
1240 tmp & 0xfe); in w83627ehf_init_device()
1245 if (!(tmp & 0x01)) in w83627ehf_init_device()
1246 w83627ehf_write_value(data, W83627EHF_REG_VBAT, tmp | 0x01); in w83627ehf_init_device()
1254 diode = 0x00; in w83627ehf_init_device()
1257 diode = 0x70; in w83627ehf_init_device()
1259 for (i = 0; i < 3; i++) { in w83627ehf_init_device()
1266 if (label && strncmp(label, "PECI", 4) == 0) in w83627ehf_init_device()
1268 else if (label && strncmp(label, "AMD", 3) == 0) in w83627ehf_init_device()
1270 else if ((tmp & (0x02 << i))) in w83627ehf_init_device()
1271 data->temp_type[i] = (diode & (0x10 << i)) ? 1 : 3; in w83627ehf_init_device()
1282 for (i = 0; i < n_temp; i++) { in w83627ehf_set_temp_reg_ehf()
1298 data->has_fan = 0x03; /* fan1 and fan2 */ in w83627ehf_check_fan_inputs()
1299 data->has_fan_min = 0x03; in w83627ehf_check_fan_inputs()
1306 fan4pin = superio_inb(sio_data->sioreg, 0x27) & 0x40; in w83627ehf_check_fan_inputs()
1307 fan5pin = superio_inb(sio_data->sioreg, 0x27) & 0x20; in w83627ehf_check_fan_inputs()
1310 fan4pin = !(superio_inb(sio_data->sioreg, 0x29) & 0x06); in w83627ehf_check_fan_inputs()
1311 fan5pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x02); in w83627ehf_check_fan_inputs()
1314 data->has_fan = data->has_fan_min = 0x03; /* fan1 and fan2 */ in w83627ehf_check_fan_inputs()
1344 /* channel 0.., name 1.. */ in w83627ehf_is_visible()
1346 return 0; in w83627ehf_is_visible()
1352 return 0; in w83627ehf_is_visible()
1355 return 0; in w83627ehf_is_visible()
1360 return 0; in w83627ehf_is_visible()
1366 return 0; in w83627ehf_is_visible()
1369 return 0; in w83627ehf_is_visible()
1376 return 0; in w83627ehf_is_visible()
1381 /* channel 0.., name 1.. */ in w83627ehf_is_visible()
1383 return 0; in w83627ehf_is_visible()
1393 return 0; in w83627ehf_is_visible()
1398 /* channel 0.., name 0.. */ in w83627ehf_is_visible()
1400 return 0; in w83627ehf_is_visible()
1402 return 0; in w83627ehf_is_visible()
1410 /* channel 0.., name 1.. */ in w83627ehf_is_visible()
1413 return 0; in w83627ehf_is_visible()
1423 return 0; in w83627ehf_is_visible()
1426 return 0; /* Shouldn't happen */ in w83627ehf_is_visible()
1436 return 0; in w83627ehf_do_read_temp()
1439 return 0; in w83627ehf_do_read_temp()
1442 return 0; in w83627ehf_do_read_temp()
1445 return 0; in w83627ehf_do_read_temp()
1448 return 0; in w83627ehf_do_read_temp()
1453 return 0; in w83627ehf_do_read_temp()
1471 return 0; in w83627ehf_do_read_in()
1475 return 0; in w83627ehf_do_read_in()
1479 return 0; in w83627ehf_do_read_in()
1482 int bit[] = { 0, 1, 2, 3, 8, 21, 20, 16, 17, 19 }; in w83627ehf_do_read_in()
1484 return 0; in w83627ehf_do_read_in()
1500 return 0; in w83627ehf_do_read_fan()
1504 return 0; in w83627ehf_do_read_fan()
1507 return 0; in w83627ehf_do_read_fan()
1512 return 0; in w83627ehf_do_read_fan()
1528 return 0; in w83627ehf_do_read_pwm()
1531 return 0; in w83627ehf_do_read_pwm()
1534 return 0; in w83627ehf_do_read_pwm()
1545 if (attr != hwmon_intrusion_alarm || channel != 0) in w83627ehf_do_read_intrusion()
1548 *val = !!(data->caseopen & 0x10); in w83627ehf_do_read_intrusion()
1549 return 0; in w83627ehf_do_read_intrusion()
1591 return 0; in w83627ehf_read_string()
1702 int i, err = 0; in w83627ehf_probe()
1705 res = platform_get_resource(pdev, IORESOURCE_IO, 0); in w83627ehf_probe()
1717 data->bank = 0xff; /* Force initial bank selection */ in w83627ehf_probe()
1737 data->have_temp = 0x07; in w83627ehf_probe()
1746 * Temperature sources are selected with bank 0, registers 0x49 in w83627ehf_probe()
1747 * and 0x4a. in w83627ehf_probe()
1749 reg = w83627ehf_read_value(data, 0x4a); in w83627ehf_probe()
1750 data->temp_src[0] = reg >> 5; in w83627ehf_probe()
1751 reg = w83627ehf_read_value(data, 0x49); in w83627ehf_probe()
1752 data->temp_src[1] = reg & 0x07; in w83627ehf_probe()
1753 data->temp_src[2] = (reg >> 4) & 0x07; in w83627ehf_probe()
1756 * W83667HG-B has another temperature register at 0x7e. in w83627ehf_probe()
1757 * The temperature source is selected with register 0x7d. in w83627ehf_probe()
1761 reg = w83627ehf_read_value(data, 0x7d); in w83627ehf_probe()
1762 reg &= 0x07; in w83627ehf_probe()
1763 if (reg != data->temp_src[0] && reg != data->temp_src[1] in w83627ehf_probe()
1774 if (data->temp_src[2] == 2 && (reg & 0x01)) in w83627ehf_probe()
1782 data->have_temp_offset = data->have_temp & 0x07; in w83627ehf_probe()
1783 for (i = 0; i < 3; i++) { in w83627ehf_probe()
1794 * bank 0, registers 0x49 and 0x4a. in w83627ehf_probe()
1796 data->temp_src[0] = 0; /* SYSTIN */ in w83627ehf_probe()
1797 reg = w83627ehf_read_value(data, 0x49) & 0x07; in w83627ehf_probe()
1799 if (reg == 0) in w83627ehf_probe()
1805 reg = w83627ehf_read_value(data, 0x4a); in w83627ehf_probe()
1813 data->temp_src[2] == data->temp_src[0] || in w83627ehf_probe()
1823 data->have_temp_offset = data->have_temp & 0x03; in w83627ehf_probe()
1824 for (i = 0; i < 3; i++) { in w83627ehf_probe()
1842 if (reg & 0x01) in w83627ehf_probe()
1847 data->have_temp_offset = data->have_temp & 0x07; in w83627ehf_probe()
1882 * 0xe3. in w83627ehf_probe()
1885 data->vid = superio_inb(sio_data->sioreg, 0xe3); in w83627ehf_probe()
1889 if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80) { in w83627ehf_probe()
1900 if ((en_vrm10 & 0x08) && data->vrm == 90) { in w83627ehf_probe()
1905 en_vrm10 & ~0x08); in w83627ehf_probe()
1906 } else if (!(en_vrm10 & 0x08) in w83627ehf_probe()
1912 en_vrm10 | 0x08); in w83627ehf_probe()
1919 data->vid &= 0x3f; in w83627ehf_probe()
1936 for (i = 0; i < data->pwm_num; i++) in w83627ehf_probe()
1955 return 0; in w83627ehf_suspend()
1964 data->bank = 0xff; /* Force initial bank selection */ in w83627ehf_resume()
1967 for (i = 0; i < data->in_num; i++) { in w83627ehf_resume()
1977 for (i = 0; i < 5; i++) { in w83627ehf_resume()
1985 for (i = 0; i < NUM_REG_TEMP; i++) { in w83627ehf_resume()
2010 return 0; in w83627ehf_resume()
2077 if (val != 0xffff) in w83627ehf_find()
2078 pr_debug("unsupported chip ID: 0x%04x\n", val); in w83627ehf_find()
2088 if (*addr == 0) { in w83627ehf_find()
2089 pr_err("Refusing to enable a Super-I/O device with a base I/O port 0\n"); in w83627ehf_find()
2096 if (!(val & 0x01)) { in w83627ehf_find()
2098 superio_outb(sioaddr, SIO_REG_ENABLE, val | 0x01); in w83627ehf_find()
2105 return 0; in w83627ehf_find()
2129 * driver will probe 0x2e and 0x4e and auto-detect the presence of a in sensors_w83627ehf_init()
2132 if (w83627ehf_find(0x2e, &address, &sio_data) && in sensors_w83627ehf_init()
2133 w83627ehf_find(0x4e, &address, &sio_data)) in sensors_w83627ehf_init()