Lines Matching +full:0 +full:x255
15 * as99127f 7 3 0 3 0x31 0x12c3 yes no
16 * as99127f rev.2 (type_name = as99127f) 0x31 0x5ca3 yes no
17 * w83781d 7 3 0 3 0x10-1 0x5ca3 yes yes
18 * w83782d 9 3 2-4 3 0x30 0x5ca3 yes yes
19 * w83783s 5-6 3 2 1-2 0x40 0x5ca3 yes no
46 static const unsigned short normal_i2c[] = { 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
47 0x2e, 0x2f, I2C_CLIENT_END };
53 module_param_array(force_subclients, short, NULL, 0);
58 module_param(reset, bool, 0);
62 module_param(init, bool, 0);
75 /* in nr from 0 to 8 */
76 #define W83781D_REG_IN_MAX(nr) ((nr < 7) ? (0x2b + (nr) * 2) : \
77 (0x554 + (((nr) - 7) * 2)))
78 #define W83781D_REG_IN_MIN(nr) ((nr < 7) ? (0x2c + (nr) * 2) : \
79 (0x555 + (((nr) - 7) * 2)))
80 #define W83781D_REG_IN(nr) ((nr < 7) ? (0x20 + (nr)) : \
81 (0x550 + (nr) - 7))
83 /* fan nr from 0 to 2 */
84 #define W83781D_REG_FAN_MIN(nr) (0x3b + (nr))
85 #define W83781D_REG_FAN(nr) (0x28 + (nr))
87 #define W83781D_REG_BANK 0x4E
88 #define W83781D_REG_TEMP2_CONFIG 0x152
89 #define W83781D_REG_TEMP3_CONFIG 0x252
91 #define W83781D_REG_TEMP(nr) ((nr == 3) ? (0x0250) : \
92 ((nr == 2) ? (0x0150) : \
93 (0x27)))
94 #define W83781D_REG_TEMP_HYST(nr) ((nr == 3) ? (0x253) : \
95 ((nr == 2) ? (0x153) : \
96 (0x3A)))
97 #define W83781D_REG_TEMP_OVER(nr) ((nr == 3) ? (0x255) : \
98 ((nr == 2) ? (0x155) : \
99 (0x39)))
101 #define W83781D_REG_CONFIG 0x40
104 #define W83781D_REG_ALARM1 0x41
105 #define W83781D_REG_ALARM2 0x42
108 #define W83782D_REG_ALARM1 0x459
109 #define W83782D_REG_ALARM2 0x45A
110 #define W83782D_REG_ALARM3 0x45B
112 #define W83781D_REG_BEEP_CONFIG 0x4D
113 #define W83781D_REG_BEEP_INTS1 0x56
114 #define W83781D_REG_BEEP_INTS2 0x57
115 #define W83781D_REG_BEEP_INTS3 0x453 /* not on W83781D */
117 #define W83781D_REG_VID_FANDIV 0x47
119 #define W83781D_REG_CHIPID 0x49
120 #define W83781D_REG_WCHIPID 0x58
121 #define W83781D_REG_CHIPMAN 0x4F
122 #define W83781D_REG_PIN 0x4B
125 #define W83781D_REG_VBAT 0x5D
128 static const u8 W83781D_REG_PWM[] = { 0x5B, 0x5A, 0x5E, 0x5F };
129 #define W83781D_REG_PWMCLK12 0x5C
130 #define W83781D_REG_PWMCLK34 0x45C
132 #define W83781D_REG_I2C_ADDR 0x48
133 #define W83781D_REG_I2C_SUBADDR 0x4A
140 #define W83781D_REG_SCFG1 0x5D
141 static const u8 BIT_SCFG1[] = { 0x02, 0x04, 0x08 };
143 #define W83781D_REG_SCFG2 0x59
144 static const u8 BIT_SCFG2[] = { 0x10, 0x20, 0x40 };
149 #define IN_TO_REG(val) clamp_val(((val) + 8) / 16, 0, 255)
155 if (rpm == 0) in FAN_TO_REG()
164 if (val == 0) in FAN_FROM_REG()
167 return 0; in FAN_FROM_REG()
175 (~(val)) & 0x7fff : (val) & 0xff7fff)
177 (~(val)) & 0x7fff : (val) & 0xff7fff)
187 for (i = 0; i < 7; i++) { in DIV_TO_REG()
188 if (val == 0) in DIV_TO_REG()
289 sysfs_in_offsets(0);
336 static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0);
338 show_fan_min, store_fan_min, 0);
432 data->vrm = clamp_val(val, 0, 255); in vrm_store()
465 static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0);
479 static SENSOR_DEVICE_ATTR(temp3_alarm, S_IRUGO, show_temp3_alarm, NULL, 0);
502 data->beep_mask &= 0x8000; /* preserve beep enable */ in beep_mask_store()
505 data->beep_mask & 0xff); in beep_mask_store()
507 (data->beep_mask >> 8) & 0xff); in beep_mask_store()
510 ((data->beep_mask) >> 16) & 0xff); in beep_mask_store()
587 show_beep, store_beep, 0);
660 & (nr == 0 ? 0xcf : 0x3f)) in store_fan_div()
661 | ((data->fan_div[nr] & 0x03) << (nr == 0 ? 4 : 6)); in store_fan_div()
669 | ((data->fan_div[nr] & 0x04) << (3 + nr)); in store_fan_div()
682 show_fan_div, store_fan_div, 0);
718 data->pwm[nr] = clamp_val(val, 0, 255); in store_pwm()
740 case 0: in pwm2_enable_store()
744 (reg & 0xf7) | (val << 3)); in pwm2_enable_store()
748 (reg & 0xef) | (!val << 4)); in pwm2_enable_store()
762 static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm, store_pwm, 0);
835 show_sensor, store_sensor, 0);
848 int i, val1 = 0, id; in w83781d_detect_subclients()
859 if (force_subclients[0] == id && force_subclients[1] == address) { in w83781d_detect_subclients()
861 if (force_subclients[i] < 0x48 || in w83781d_detect_subclients()
862 force_subclients[i] > 0x4f) { in w83781d_detect_subclients()
864 "Invalid subclient address %d; must be 0x48-0x4f\n", in w83781d_detect_subclients()
871 (force_subclients[2] & 0x07) | in w83781d_detect_subclients()
872 ((force_subclients[3] & 0x07) << 4)); in w83781d_detect_subclients()
873 sc_addr[0] = force_subclients[2]; in w83781d_detect_subclients()
876 sc_addr[0] = 0x48 + (val1 & 0x07); in w83781d_detect_subclients()
881 if (force_subclients[0] == id && in w83781d_detect_subclients()
885 sc_addr[1] = 0x48 + ((val1 >> 4) & 0x07); in w83781d_detect_subclients()
887 if (sc_addr[0] == sc_addr[1]) { in w83781d_detect_subclients()
889 "Duplicate addresses 0x%x for subclients.\n", in w83781d_detect_subclients()
890 sc_addr[0]); in w83781d_detect_subclients()
896 for (i = 0; i < num_sc; i++) { in w83781d_detect_subclients()
900 "Subclient %d registration at address 0x%x failed.\n", in w83781d_detect_subclients()
909 return 0; in w83781d_detect_subclients()
913 i2c_unregister_device(data->lm75[0]); in w83781d_detect_subclients()
941 IN_UNIT_ATTRS(0),
1079 return 0; in w83781d_create_files()
1082 /* Return 0 if detection is successful, -ENODEV otherwise */
1104 if (i2c_smbus_read_byte_data(client, W83781D_REG_CONFIG) & 0x80) { in w83781d_detect()
1112 /* Check for Winbond or Asus ID if in bank 0 */ in w83781d_detect()
1113 if (!(val1 & 0x07) && in w83781d_detect()
1114 ((!(val1 & 0x80) && val2 != 0xa3 && val2 != 0xc3) || in w83781d_detect()
1115 ((val1 & 0x80) && val2 != 0x5c && val2 != 0x12))) { in w83781d_detect()
1121 * If Winbond SMBus, check address at 0x48. in w83781d_detect()
1124 if ((!(val1 & 0x80) && val2 == 0xa3) || in w83781d_detect()
1125 ((val1 & 0x80) && val2 == 0x5c)) { in w83781d_detect()
1134 /* Put it now into bank 0 and Vendor ID High Byte */ in w83781d_detect()
1137 & 0x78) | 0x80); in w83781d_detect()
1141 if (val2 == 0x5c) in w83781d_detect()
1143 else if (val2 == 0x12) in w83781d_detect()
1153 if ((val1 == 0x10 || val1 == 0x11) && vendid == winbond) in w83781d_detect()
1155 else if (val1 == 0x30 && vendid == winbond) in w83781d_detect()
1157 else if (val1 == 0x40 && vendid == winbond && address == 0x2d) in w83781d_detect()
1159 else if (val1 == 0x31) in w83781d_detect()
1164 if (val1 <= 0x30 && w83781d_alias_detect(client, val1)) { in w83781d_detect()
1166 "Device at 0x%02x appears to be the same as ISA device\n", in w83781d_detect()
1176 return 0; in w83781d_detect()
1221 err = w83781d_create_files(dev, data->type, 0); in w83781d_probe()
1231 return 0; in w83781d_probe()
1235 i2c_unregister_device(data->lm75[0]); in w83781d_probe()
1249 i2c_unregister_device(data->lm75[0]); in w83781d_remove()
1260 bank = (reg >> 8) & 0x0f; in w83781d_read_value_i2c()
1265 if (bank == 0 || bank > 2) { in w83781d_read_value_i2c()
1266 res = i2c_smbus_read_byte_data(client, reg & 0xff); in w83781d_read_value_i2c()
1271 switch (reg & 0xff) { in w83781d_read_value_i2c()
1272 case 0x50: /* TEMP */ in w83781d_read_value_i2c()
1273 res = i2c_smbus_read_word_swapped(cl, 0); in w83781d_read_value_i2c()
1275 case 0x52: /* CONFIG */ in w83781d_read_value_i2c()
1278 case 0x53: /* HYST */ in w83781d_read_value_i2c()
1281 case 0x55: /* OVER */ in w83781d_read_value_i2c()
1288 i2c_smbus_write_byte_data(client, W83781D_REG_BANK, 0); in w83781d_read_value_i2c()
1300 bank = (reg >> 8) & 0x0f; in w83781d_write_value_i2c()
1305 if (bank == 0 || bank > 2) { in w83781d_write_value_i2c()
1306 i2c_smbus_write_byte_data(client, reg & 0xff, in w83781d_write_value_i2c()
1307 value & 0xff); in w83781d_write_value_i2c()
1312 switch (reg & 0xff) { in w83781d_write_value_i2c()
1313 case 0x52: /* CONFIG */ in w83781d_write_value_i2c()
1314 i2c_smbus_write_byte_data(cl, 1, value & 0xff); in w83781d_write_value_i2c()
1316 case 0x53: /* HYST */ in w83781d_write_value_i2c()
1319 case 0x55: /* OVER */ in w83781d_write_value_i2c()
1325 i2c_smbus_write_byte_data(client, W83781D_REG_BANK, 0); in w83781d_write_value_i2c()
1327 return 0; in w83781d_write_value_i2c()
1360 w83781d_write_value(data, W83781D_REG_CONFIG, 0x80); in w83781d_init_device()
1365 w83781d_write_value(data, W83781D_REG_BEEP_CONFIG, i | 0x80); in w83781d_init_device()
1372 w83781d_write_value(data, W83781D_REG_BEEP_INTS2, 0); in w83781d_init_device()
1381 w83781d_write_value(data, W83781D_REG_BEEP_CONFIG, i | 0x80); in w83781d_init_device()
1407 if (tmp & 0x01) { in w83781d_init_device()
1411 tmp & 0xfe); in w83781d_init_device()
1418 if (tmp & 0x01) { in w83781d_init_device()
1422 W83781D_REG_TEMP3_CONFIG, tmp & 0xfe); in w83781d_init_device()
1430 W83781D_REG_CONFIG) & 0xf7) in w83781d_init_device()
1431 | 0x01); in w83781d_init_device()
1434 for (i = 0; i < 3; i++) { in w83781d_init_device()
1454 for (i = 0; i <= 8; i++) { in w83781d_update_device()
1466 for (i = 0; i < 3; i++) { in w83781d_update_device()
1473 for (i = 0; i < 4; i++) { in w83781d_update_device()
1484 W83781D_REG_PWMCLK12) & 0x08) >> 3; in w83781d_update_device()
1492 data->temp_add[0] = in w83781d_update_device()
1494 data->temp_max_add[0] = in w83781d_update_device()
1496 data->temp_max_hyst_add[0] = in w83781d_update_device()
1509 data->vid = i & 0x0f; in w83781d_update_device()
1511 W83781D_REG_CHIPID) & 0x01) << 4; in w83781d_update_device()
1512 data->fan_div[0] = (i >> 4) & 0x03; in w83781d_update_device()
1513 data->fan_div[1] = (i >> 6) & 0x03; in w83781d_update_device()
1515 W83781D_REG_PIN) >> 6) & 0x03; in w83781d_update_device()
1518 data->fan_div[0] |= (i >> 3) & 0x04; in w83781d_update_device()
1519 data->fan_div[1] |= (i >> 4) & 0x04; in w83781d_update_device()
1520 data->fan_div[2] |= (i >> 5) & 0x04; in w83781d_update_device()
1601 static unsigned short isa_address = 0x290;
1627 return 0; in w83781d_alias_detect()
1632 return 0; /* Address doesn't match */ in w83781d_alias_detect()
1634 return 0; /* Chip type doesn't match */ in w83781d_alias_detect()
1640 for (i = 0x2b; i <= 0x3d; i++) { in w83781d_alias_detect()
1643 return 0; in w83781d_alias_detect()
1647 return 0; in w83781d_alias_detect()
1648 for (i = 0x43; i <= 0x46; i++) { in w83781d_alias_detect()
1651 return 0; in w83781d_alias_detect()
1662 word_sized = (((reg & 0xff00) == 0x100) in w83781d_read_value_isa()
1663 || ((reg & 0xff00) == 0x200)) in w83781d_read_value_isa()
1664 && (((reg & 0x00ff) == 0x50) in w83781d_read_value_isa()
1665 || ((reg & 0x00ff) == 0x53) in w83781d_read_value_isa()
1666 || ((reg & 0x00ff) == 0x55)); in w83781d_read_value_isa()
1667 if (reg & 0xff00) { in w83781d_read_value_isa()
1673 outb_p(reg & 0xff, data->isa_addr + W83781D_ADDR_REG_OFFSET); in w83781d_read_value_isa()
1676 outb_p((reg & 0xff) + 1, in w83781d_read_value_isa()
1682 if (reg & 0xff00) { in w83781d_read_value_isa()
1685 outb_p(0, data->isa_addr + W83781D_DATA_REG_OFFSET); in w83781d_read_value_isa()
1695 word_sized = (((reg & 0xff00) == 0x100) in w83781d_write_value_isa()
1696 || ((reg & 0xff00) == 0x200)) in w83781d_write_value_isa()
1697 && (((reg & 0x00ff) == 0x53) in w83781d_write_value_isa()
1698 || ((reg & 0x00ff) == 0x55)); in w83781d_write_value_isa()
1699 if (reg & 0xff00) { in w83781d_write_value_isa()
1705 outb_p(reg & 0xff, data->isa_addr + W83781D_ADDR_REG_OFFSET); in w83781d_write_value_isa()
1709 outb_p((reg & 0xff) + 1, in w83781d_write_value_isa()
1712 outb_p(value & 0xff, data->isa_addr + W83781D_DATA_REG_OFFSET); in w83781d_write_value_isa()
1713 if (reg & 0xff00) { in w83781d_write_value_isa()
1716 outb_p(0, data->isa_addr + W83781D_DATA_REG_OFFSET); in w83781d_write_value_isa()
1754 return 0; in w83781d_write_value()
1765 res = platform_get_resource(pdev, IORESOURCE_IO, 0); in w83781d_isa_probe()
1782 case 0x30: in w83781d_isa_probe()
1809 return 0; in w83781d_isa_probe()
1834 /* return 1 if a supported chip is found, 0 otherwise */
1838 int val, save, found = 0; in w83781d_isa_found()
1842 * Some boards declare base+0 to base+7 as a PNP device, some base+4 in w83781d_isa_found()
1848 pr_debug("Failed to request port 0x%x\n", port); in w83781d_isa_found()
1872 if (save & 0x80) { in w83781d_isa_found()
1876 val = ~save & 0x7f; in w83781d_isa_found()
1878 if (inb_p(address + W83781D_ADDR_REG_OFFSET) != (val | 0x80)) { in w83781d_isa_found()
1887 if (val & 0x80) { in w83781d_isa_found()
1895 if ((!(save & 0x80) && (val != 0xa3)) in w83781d_isa_found()
1896 || ((save & 0x80) && (val != 0x5c))) { in w83781d_isa_found()
1902 if (val < 0x03 || val > 0x77) { /* Not a valid I2C address */ in w83781d_isa_found()
1908 if (inb_p(address + W83781D_ADDR_REG_OFFSET) & 0x80) { in w83781d_isa_found()
1916 outb_p(save & 0xf8, address + W83781D_DATA_REG_OFFSET); in w83781d_isa_found()
1919 if ((val & 0xfe) == 0x10 /* W83781D */ in w83781d_isa_found()
1920 || val == 0x30) /* W83782D */ in w83781d_isa_found()
1925 val == 0x30 ? "W83782D" : "W83781D", (int)address); in w83781d_isa_found()
1963 return 0; in w83781d_isa_device_add()
1988 return 0; in w83781d_isa_register()
2014 return 0; in w83781d_alias_detect()
2036 return 0; in w83781d_write_value()
2042 return 0; in w83781d_isa_register()
2068 return 0; in sensors_w83781d_init()