Lines Matching +full:0 +full:x255

23  * asb100	7	3	1	4	0x31	0x0694	yes	no
41 static const unsigned short normal_i2c[] = { 0x2d, I2C_CLIENT_END };
44 module_param_array(force_subclients, short, NULL, 0);
48 /* Voltage IN registers 0-6 */
49 #define ASB100_REG_IN(nr) (0x20 + (nr))
50 #define ASB100_REG_IN_MAX(nr) (0x2b + (nr * 2))
51 #define ASB100_REG_IN_MIN(nr) (0x2c + (nr * 2))
54 #define ASB100_REG_FAN(nr) (0x28 + (nr))
55 #define ASB100_REG_FAN_MIN(nr) (0x3b + (nr))
58 static const u16 asb100_reg_temp[] = {0, 0x27, 0x150, 0x250, 0x17};
59 static const u16 asb100_reg_temp_max[] = {0, 0x39, 0x155, 0x255, 0x18};
60 static const u16 asb100_reg_temp_hyst[] = {0, 0x3a, 0x153, 0x253, 0x19};
66 #define ASB100_REG_TEMP2_CONFIG 0x0152
67 #define ASB100_REG_TEMP3_CONFIG 0x0252
70 #define ASB100_REG_CONFIG 0x40
71 #define ASB100_REG_ALARM1 0x41
72 #define ASB100_REG_ALARM2 0x42
73 #define ASB100_REG_SMIM1 0x43
74 #define ASB100_REG_SMIM2 0x44
75 #define ASB100_REG_VID_FANDIV 0x47
76 #define ASB100_REG_I2C_ADDR 0x48
77 #define ASB100_REG_CHIPID 0x49
78 #define ASB100_REG_I2C_SUBADDR 0x4a
79 #define ASB100_REG_PIN 0x4b
80 #define ASB100_REG_IRQ 0x4c
81 #define ASB100_REG_BANK 0x4e
82 #define ASB100_REG_CHIPMAN 0x4f
84 #define ASB100_REG_WCHIPID 0x58
86 /* bit 7 -> enable, bits 0-3 -> duty cycle */
87 #define ASB100_REG_PWM1 0x59
95 #define ASB100_IN_MIN 0
99 * IN: 1/1000 V (0V to 4.08V)
116 return 0; in FAN_TO_REG()
117 if (rpm == 0) in FAN_TO_REG()
125 return val == 0 ? -1 : val == 255 ? 0 : 1350000 / (val * div); in FAN_FROM_REG()
139 ntemp += (ntemp < 0 ? -500 : 500); in TEMP_TO_REG()
149 * PWM: 0 - 255 per sensors documentation
154 pwm = clamp_val(pwm, 0, 255); in ASB100_PWM_TO_REG()
167 * REG: 0, 1, 2, or 3 (respectively) (defaults to 1)
171 return val == 8 ? 3 : val == 4 ? 2 : val == 1 ? 0 : 1; in DIV_TO_REG()
195 u16 temp[4]; /* Register value (0 and 3 are u8 only) */
196 u16 temp_max[4]; /* Register value (0 and 3 are u8 only) */
197 u16 temp_hyst[4]; /* Register value (0 and 3 are u8 only) */
277 sysfs_in(0);
360 case 0: /* fan 1 */ in set_fan_div()
362 reg = (reg & 0xcf) | (data->fan_div[0] << 4); in set_fan_div()
368 reg = (reg & 0x3f) | (data->fan_div[1] << 6); in set_fan_div()
374 reg = (reg & 0x3f) | (data->fan_div[2] << 6); in set_fan_div()
403 int ret = 0; in sprintf_temp_from_reg()
409 case 0: case 3: default: in sprintf_temp_from_reg()
445 case 0: case 3: default: \
526 static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, show_alarm, NULL, 0);
543 return sprintf(buf, "%d\n", ASB100_PWM_FROM_REG(data->pwm & 0x0f)); in pwm1_show()
559 data->pwm &= 0x80; /* keep the enable bit */ in pwm1_store()
560 data->pwm |= (0x0f & ASB100_PWM_TO_REG(val)); in pwm1_store()
570 return sprintf(buf, "%d\n", (data->pwm & 0x80) ? 1 : 0); in pwm1_enable_show()
587 data->pwm &= 0x0f; /* keep the duty cycle bits */ in pwm1_enable_store()
588 data->pwm |= (val ? 0x80 : 0x00); in pwm1_enable_store()
678 if (force_subclients[0] == id && force_subclients[1] == address) { in asb100_detect_subclients()
680 if (force_subclients[i] < 0x48 || in asb100_detect_subclients()
681 force_subclients[i] > 0x4f) { in asb100_detect_subclients()
683 "invalid subclient address %d; must be 0x48-0x4f\n", in asb100_detect_subclients()
690 (force_subclients[2] & 0x07) | in asb100_detect_subclients()
691 ((force_subclients[3] & 0x07) << 4)); in asb100_detect_subclients()
692 sc_addr[0] = force_subclients[2]; in asb100_detect_subclients()
696 sc_addr[0] = 0x48 + (val & 0x07); in asb100_detect_subclients()
697 sc_addr[1] = 0x48 + ((val >> 4) & 0x07); in asb100_detect_subclients()
700 if (sc_addr[0] == sc_addr[1]) { in asb100_detect_subclients()
702 "duplicate addresses 0x%x for subclients\n", in asb100_detect_subclients()
703 sc_addr[0]); in asb100_detect_subclients()
708 data->lm75[0] = i2c_new_dummy_device(adapter, sc_addr[0]); in asb100_detect_subclients()
709 if (IS_ERR(data->lm75[0])) { in asb100_detect_subclients()
711 "subclient %d registration at address 0x%x failed.\n", in asb100_detect_subclients()
712 1, sc_addr[0]); in asb100_detect_subclients()
713 err = PTR_ERR(data->lm75[0]); in asb100_detect_subclients()
720 "subclient %d registration at address 0x%x failed.\n", in asb100_detect_subclients()
726 return 0; in asb100_detect_subclients()
730 i2c_unregister_device(data->lm75[0]); in asb100_detect_subclients()
735 /* Return 0 if detection is successful, -ENODEV otherwise */
750 /* If we're in bank 0 */ in asb100_detect()
751 if ((!(val1 & 0x07)) && in asb100_detect()
753 (((!(val1 & 0x80)) && (val2 != 0x94)) || in asb100_detect()
755 ((val1 & 0x80) && (val2 != 0x06)))) { in asb100_detect()
756 pr_debug("detect failed, bad chip id 0x%02x!\n", val2); in asb100_detect()
760 /* Put it now into bank 0 and Vendor ID High Byte */ in asb100_detect()
762 (i2c_smbus_read_byte_data(client, ASB100_REG_BANK) & 0x78) in asb100_detect()
763 | 0x80); in asb100_detect()
769 if (val1 != 0x31 || val2 != 0x06) in asb100_detect()
774 return 0; in asb100_detect()
800 data->fan_min[0] = asb100_read_value(client, ASB100_REG_FAN_MIN(0)); in asb100_probe()
815 return 0; in asb100_probe()
821 i2c_unregister_device(data->lm75[0]); in asb100_probe()
833 i2c_unregister_device(data->lm75[0]); in asb100_remove()
848 bank = (reg >> 8) & 0x0f; in asb100_read_value()
853 if (bank == 0 || bank > 2) { in asb100_read_value()
854 res = i2c_smbus_read_byte_data(client, reg & 0xff); in asb100_read_value()
860 switch (reg & 0xff) { in asb100_read_value()
861 case 0x50: /* TEMP */ in asb100_read_value()
862 res = i2c_smbus_read_word_swapped(cl, 0); in asb100_read_value()
864 case 0x52: /* CONFIG */ in asb100_read_value()
867 case 0x53: /* HYST */ in asb100_read_value()
870 case 0x55: /* MAX */ in asb100_read_value()
878 i2c_smbus_write_byte_data(client, ASB100_REG_BANK, 0); in asb100_read_value()
893 bank = (reg >> 8) & 0x0f; in asb100_write_value()
898 if (bank == 0 || bank > 2) { in asb100_write_value()
899 i2c_smbus_write_byte_data(client, reg & 0xff, value & 0xff); in asb100_write_value()
905 switch (reg & 0xff) { in asb100_write_value()
906 case 0x52: /* CONFIG */ in asb100_write_value()
907 i2c_smbus_write_byte_data(cl, 1, value & 0xff); in asb100_write_value()
909 case 0x53: /* HYST */ in asb100_write_value()
912 case 0x55: /* MAX */ in asb100_write_value()
919 i2c_smbus_write_byte_data(client, ASB100_REG_BANK, 0); in asb100_write_value()
932 (asb100_read_value(client, ASB100_REG_CONFIG) & 0xf7) | 0x01); in asb100_init_client()
949 for (i = 0; i < 7; i++) { in asb100_update_device()
959 for (i = 0; i < 3; i++) { in asb100_update_device()
978 data->vid = i & 0x0f; in asb100_update_device()
980 ASB100_REG_CHIPID) & 0x01) << 4; in asb100_update_device()
981 data->fan_div[0] = (i >> 4) & 0x03; in asb100_update_device()
982 data->fan_div[1] = (i >> 6) & 0x03; in asb100_update_device()
984 ASB100_REG_PIN) >> 6) & 0x03; in asb100_update_device()