Lines Matching refs:ix

62 #define VT1211_REG_IN(ix)		(0x21 + (ix))  argument
63 #define VT1211_REG_IN_MIN(ix) ((ix) == 0 ? 0x3e : 0x2a + 2 * (ix)) argument
64 #define VT1211_REG_IN_MAX(ix) ((ix) == 0 ? 0x3d : 0x29 + 2 * (ix)) argument
72 #define VT1211_REG_FAN(ix) (0x29 + (ix)) argument
73 #define VT1211_REG_FAN_MIN(ix) (0x3b + (ix)) argument
78 #define VT1211_REG_PWM(ix) (0x60 + (ix)) argument
82 #define VT1211_REG_PWM_AUTO_PWM(ix, ap) (0x58 + 2 * (ix) - (ap)) argument
134 #define ISVOLT(ix, uch_config) ((ix) > 4 ? 1 : \ argument
135 !(((uch_config) >> ((ix) + 2)) & 1))
138 #define ISTEMP(ix, uch_config) ((ix) < 2 ? 1 : \ argument
139 ((uch_config) >> (ix)) & 1)
145 #define IN_FROM_REG(ix, reg) ((reg) < 3 ? 0 : (ix) == 5 ? \ argument
148 #define IN_TO_REG(ix, val) (clamp_val((ix) == 5 ? \ argument
159 #define TEMP_FROM_REG(ix, reg) ((ix) == 0 ? (reg) * 1000 : \ argument
160 (ix) == 1 ? (reg) < 51 ? 0 : \
163 #define TEMP_TO_REG(ix, val) clamp_val( \ argument
164 ((ix) == 0 ? ((val) + 500) / 1000 : \
165 (ix) == 1 ? ((val) + 500) / 1000 + 51 : \
244 int ix, val; in vt1211_update_device() local
254 for (ix = 0; ix < ARRAY_SIZE(data->in); ix++) { in vt1211_update_device()
255 if (ISVOLT(ix, data->uch_config)) { in vt1211_update_device()
256 data->in[ix] = vt1211_read8(data, in vt1211_update_device()
257 VT1211_REG_IN(ix)); in vt1211_update_device()
258 data->in_min[ix] = vt1211_read8(data, in vt1211_update_device()
259 VT1211_REG_IN_MIN(ix)); in vt1211_update_device()
260 data->in_max[ix] = vt1211_read8(data, in vt1211_update_device()
261 VT1211_REG_IN_MAX(ix)); in vt1211_update_device()
266 for (ix = 0; ix < ARRAY_SIZE(data->temp); ix++) { in vt1211_update_device()
267 if (ISTEMP(ix, data->uch_config)) { in vt1211_update_device()
268 data->temp[ix] = vt1211_read8(data, in vt1211_update_device()
269 regtemp[ix]); in vt1211_update_device()
270 data->temp_max[ix] = vt1211_read8(data, in vt1211_update_device()
271 regtempmax[ix]); in vt1211_update_device()
272 data->temp_hyst[ix] = vt1211_read8(data, in vt1211_update_device()
273 regtemphyst[ix]); in vt1211_update_device()
278 for (ix = 0; ix < ARRAY_SIZE(data->fan); ix++) { in vt1211_update_device()
279 data->fan[ix] = vt1211_read8(data, in vt1211_update_device()
280 VT1211_REG_FAN(ix)); in vt1211_update_device()
281 data->fan_min[ix] = vt1211_read8(data, in vt1211_update_device()
282 VT1211_REG_FAN_MIN(ix)); in vt1211_update_device()
283 data->pwm[ix] = vt1211_read8(data, in vt1211_update_device()
284 VT1211_REG_PWM(ix)); in vt1211_update_device()
306 for (ix = 0; ix < ARRAY_SIZE(data->pwm_auto_temp); ix++) { in vt1211_update_device()
307 data->pwm_auto_temp[ix] = vt1211_read8(data, in vt1211_update_device()
308 VT1211_REG_PWM_AUTO_TEMP(ix)); in vt1211_update_device()
340 int ix = sensor_attr_2->index; in show_in() local
346 res = IN_FROM_REG(ix, data->in[ix]); in show_in()
349 res = IN_FROM_REG(ix, data->in_min[ix]); in show_in()
352 res = IN_FROM_REG(ix, data->in_max[ix]); in show_in()
355 res = (data->alarms >> bitalarmin[ix]) & 1; in show_in()
371 int ix = sensor_attr_2->index; in set_in() local
383 data->in_min[ix] = IN_TO_REG(ix, val); in set_in()
384 vt1211_write8(data, VT1211_REG_IN_MIN(ix), data->in_min[ix]); in set_in()
387 data->in_max[ix] = IN_TO_REG(ix, val); in set_in()
388 vt1211_write8(data, VT1211_REG_IN_MAX(ix), data->in_max[ix]); in set_in()
414 int ix = sensor_attr_2->index; in show_temp() local
420 res = TEMP_FROM_REG(ix, data->temp[ix]); in show_temp()
423 res = TEMP_FROM_REG(ix, data->temp_max[ix]); in show_temp()
426 res = TEMP_FROM_REG(ix, data->temp_hyst[ix]); in show_temp()
429 res = (data->alarms >> bitalarmtemp[ix]) & 1; in show_temp()
445 int ix = sensor_attr_2->index; in set_temp() local
457 data->temp_max[ix] = TEMP_TO_REG(ix, val); in set_temp()
458 vt1211_write8(data, regtempmax[ix], in set_temp()
459 data->temp_max[ix]); in set_temp()
462 data->temp_hyst[ix] = TEMP_TO_REG(ix, val); in set_temp()
463 vt1211_write8(data, regtemphyst[ix], in set_temp()
464 data->temp_hyst[ix]); in set_temp()
490 int ix = sensor_attr_2->index; in show_fan() local
496 res = RPM_FROM_REG(data->fan[ix], data->fan_div[ix]); in show_fan()
499 res = RPM_FROM_REG(data->fan_min[ix], data->fan_div[ix]); in show_fan()
502 res = DIV_FROM_REG(data->fan_div[ix]); in show_fan()
505 res = (data->alarms >> bitalarmfan[ix]) & 1; in show_fan()
521 int ix = sensor_attr_2->index; in set_fan() local
541 data->fan_min[ix] = RPM_TO_REG(val, data->fan_div[ix]); in set_fan()
542 vt1211_write8(data, VT1211_REG_FAN_MIN(ix), in set_fan()
543 data->fan_min[ix]); in set_fan()
548 data->fan_div[ix] = 0; in set_fan()
551 data->fan_div[ix] = 1; in set_fan()
554 data->fan_div[ix] = 2; in set_fan()
557 data->fan_div[ix] = 3; in set_fan()
596 int ix = sensor_attr_2->index; in show_pwm() local
602 res = data->pwm[ix]; in show_pwm()
605 res = ((data->pwm_ctl[ix] >> 3) & 1) ? 2 : 0; in show_pwm()
611 res = (data->pwm_ctl[ix] & 7) + 1; in show_pwm()
627 int ix = sensor_attr_2->index; in set_pwm() local
651 data->pwm_ctl[ix] &= 7; in set_pwm()
656 if ((data->pwm_ctl[ix ^ 1] & 1) == 0) in set_pwm()
660 data->pwm_ctl[ix] |= 8; in set_pwm()
707 data->pwm_ctl[ix] = (data->pwm_ctl[ix] & 8) | (val - 1); in set_pwm()
751 int ix = sensor_attr_2->index; in show_pwm_auto_point_temp() local
754 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->pwm_ctl[ix] & 7, in show_pwm_auto_point_temp()
765 int ix = sensor_attr_2->index; in set_pwm_auto_point_temp() local
783 data->pwm_auto_temp[ap] = TEMP_TO_REG(data->pwm_ctl[ix] & 7, val); in set_pwm_auto_point_temp()
815 int ix = sensor_attr_2->index; in show_pwm_auto_point_pwm() local
818 return sprintf(buf, "%d\n", data->pwm_auto_pwm[ix][ap]); in show_pwm_auto_point_pwm()
828 int ix = sensor_attr_2->index; in set_pwm_auto_point_pwm() local
838 data->pwm_auto_pwm[ix][ap] = clamp_val(val, 0, 255); in set_pwm_auto_point_pwm()
839 vt1211_write8(data, VT1211_REG_PWM_AUTO_PWM(ix, ap), in set_pwm_auto_point_pwm()
840 data->pwm_auto_pwm[ix][ap]); in set_pwm_auto_point_pwm()
905 #define SENSOR_ATTR_IN(ix) \ argument
906 { SENSOR_ATTR_2(in##ix##_input, S_IRUGO, \
907 show_in, NULL, SHOW_IN_INPUT, ix), \
908 SENSOR_ATTR_2(in##ix##_min, S_IRUGO | S_IWUSR, \
909 show_in, set_in, SHOW_SET_IN_MIN, ix), \
910 SENSOR_ATTR_2(in##ix##_max, S_IRUGO | S_IWUSR, \
911 show_in, set_in, SHOW_SET_IN_MAX, ix), \
912 SENSOR_ATTR_2(in##ix##_alarm, S_IRUGO, \
913 show_in, NULL, SHOW_IN_ALARM, ix) \
951 #define SENSOR_ATTR_TEMP(ix) \ argument
952 { SENSOR_ATTR_2(temp##ix##_input, S_IRUGO, \
953 show_temp, NULL, SHOW_TEMP_INPUT, ix-1), \
954 SENSOR_ATTR_2(temp##ix##_max, S_IRUGO | S_IWUSR, \
955 show_temp, set_temp, SHOW_SET_TEMP_MAX, ix-1), \
956 SENSOR_ATTR_2(temp##ix##_max_hyst, S_IRUGO | S_IWUSR, \
957 show_temp, set_temp, SHOW_SET_TEMP_MAX_HYST, ix-1), \
958 SENSOR_ATTR_2(temp##ix##_alarm, S_IRUGO, \
959 show_temp, NULL, SHOW_TEMP_ALARM, ix-1) \
1000 #define SENSOR_ATTR_FAN(ix) \ argument
1001 SENSOR_ATTR_2(fan##ix##_input, S_IRUGO, \
1002 show_fan, NULL, SHOW_FAN_INPUT, ix-1), \
1003 SENSOR_ATTR_2(fan##ix##_min, S_IRUGO | S_IWUSR, \
1004 show_fan, set_fan, SHOW_SET_FAN_MIN, ix-1), \
1005 SENSOR_ATTR_2(fan##ix##_div, S_IRUGO | S_IWUSR, \
1006 show_fan, set_fan, SHOW_SET_FAN_DIV, ix-1), \
1007 SENSOR_ATTR_2(fan##ix##_alarm, S_IRUGO, \
1008 show_fan, NULL, SHOW_FAN_ALARM, ix-1)
1010 #define SENSOR_ATTR_PWM(ix) \ argument
1011 SENSOR_ATTR_2(pwm##ix, S_IRUGO, \
1012 show_pwm, NULL, SHOW_PWM, ix-1), \
1013 SENSOR_ATTR_2(pwm##ix##_enable, S_IRUGO | S_IWUSR, \
1014 show_pwm, set_pwm, SHOW_SET_PWM_ENABLE, ix-1), \
1015 SENSOR_ATTR_2(pwm##ix##_auto_channels_temp, S_IRUGO | S_IWUSR, \
1016 show_pwm, set_pwm, SHOW_SET_PWM_AUTO_CHANNELS_TEMP, ix-1)
1018 #define SENSOR_ATTR_PWM_FREQ(ix) \ argument
1019 SENSOR_ATTR_2(pwm##ix##_freq, S_IRUGO | S_IWUSR, \
1020 show_pwm, set_pwm, SHOW_SET_PWM_FREQ, ix-1)
1022 #define SENSOR_ATTR_PWM_FREQ_RO(ix) \ argument
1023 SENSOR_ATTR_2(pwm##ix##_freq, S_IRUGO, \
1024 show_pwm, NULL, SHOW_SET_PWM_FREQ, ix-1)
1026 #define SENSOR_ATTR_PWM_AUTO_POINT_TEMP(ix, ap) \ argument
1027 SENSOR_ATTR_2(pwm##ix##_auto_point##ap##_temp, S_IRUGO | S_IWUSR, \
1029 ap-1, ix-1)
1031 #define SENSOR_ATTR_PWM_AUTO_POINT_TEMP_RO(ix, ap) \ argument
1032 SENSOR_ATTR_2(pwm##ix##_auto_point##ap##_temp, S_IRUGO, \
1034 ap-1, ix-1)
1036 #define SENSOR_ATTR_PWM_AUTO_POINT_PWM(ix, ap) \ argument
1037 SENSOR_ATTR_2(pwm##ix##_auto_point##ap##_pwm, S_IRUGO | S_IWUSR, \
1039 ap-1, ix-1)
1041 #define SENSOR_ATTR_PWM_AUTO_POINT_PWM_RO(ix, ap) \ argument
1042 SENSOR_ATTR_2(pwm##ix##_auto_point##ap##_pwm, S_IRUGO, \
1044 ap-1, ix-1)