Lines Matching refs:ix
73 #define VT1211_REG_IN(ix) (0x21 + (ix)) argument
74 #define VT1211_REG_IN_MIN(ix) ((ix) == 0 ? 0x3e : 0x2a + 2 * (ix)) argument
75 #define VT1211_REG_IN_MAX(ix) ((ix) == 0 ? 0x3d : 0x29 + 2 * (ix)) argument
83 #define VT1211_REG_FAN(ix) (0x29 + (ix)) argument
84 #define VT1211_REG_FAN_MIN(ix) (0x3b + (ix)) argument
89 #define VT1211_REG_PWM(ix) (0x60 + (ix)) argument
93 #define VT1211_REG_PWM_AUTO_PWM(ix, ap) (0x58 + 2 * (ix) - (ap)) argument
145 #define ISVOLT(ix, uch_config) ((ix) > 4 ? 1 : \ argument
146 !(((uch_config) >> ((ix) + 2)) & 1))
149 #define ISTEMP(ix, uch_config) ((ix) < 2 ? 1 : \ argument
150 ((uch_config) >> (ix)) & 1)
154 #define IN_FROM_REG(ix, reg) ((reg) < 3 ? 0 : (ix) == 5 ? \ argument
157 #define IN_TO_REG(ix, val) (SENSORS_LIMIT((ix) == 5 ? \ argument
166 #define TEMP_FROM_REG(ix, reg) ((ix) == 0 ? (reg) * 1000 : \ argument
167 (ix) == 1 ? (reg) < 51 ? 0 : \
170 #define TEMP_TO_REG(ix, val) SENSORS_LIMIT( \ argument
171 ((ix) == 0 ? ((val) + 500) / 1000 : \
172 (ix) == 1 ? ((val) + 500) / 1000 + 51 : \
249 int ix, val; in vt1211_update_device() local
259 for (ix = 0; ix < ARRAY_SIZE(data->in); ix++) { in vt1211_update_device()
260 if (ISVOLT(ix, data->uch_config)) { in vt1211_update_device()
261 data->in[ix] = vt1211_read8(data, in vt1211_update_device()
262 VT1211_REG_IN(ix)); in vt1211_update_device()
263 data->in_min[ix] = vt1211_read8(data, in vt1211_update_device()
264 VT1211_REG_IN_MIN(ix)); in vt1211_update_device()
265 data->in_max[ix] = vt1211_read8(data, in vt1211_update_device()
266 VT1211_REG_IN_MAX(ix)); in vt1211_update_device()
271 for (ix = 0; ix < ARRAY_SIZE(data->temp); ix++) { in vt1211_update_device()
272 if (ISTEMP(ix, data->uch_config)) { in vt1211_update_device()
273 data->temp[ix] = vt1211_read8(data, in vt1211_update_device()
274 regtemp[ix]); in vt1211_update_device()
275 data->temp_max[ix] = vt1211_read8(data, in vt1211_update_device()
276 regtempmax[ix]); in vt1211_update_device()
277 data->temp_hyst[ix] = vt1211_read8(data, in vt1211_update_device()
278 regtemphyst[ix]); in vt1211_update_device()
283 for (ix = 0; ix < ARRAY_SIZE(data->fan); ix++) { in vt1211_update_device()
284 data->fan[ix] = vt1211_read8(data, in vt1211_update_device()
285 VT1211_REG_FAN(ix)); in vt1211_update_device()
286 data->fan_min[ix] = vt1211_read8(data, in vt1211_update_device()
287 VT1211_REG_FAN_MIN(ix)); in vt1211_update_device()
288 data->pwm[ix] = vt1211_read8(data, in vt1211_update_device()
289 VT1211_REG_PWM(ix)); in vt1211_update_device()
311 for (ix = 0; ix < ARRAY_SIZE(data->pwm_auto_temp); ix++) { in vt1211_update_device()
312 data->pwm_auto_temp[ix] = vt1211_read8(data, in vt1211_update_device()
313 VT1211_REG_PWM_AUTO_TEMP(ix)); in vt1211_update_device()
345 int ix = sensor_attr_2->index; in show_in() local
351 res = IN_FROM_REG(ix, data->in[ix]); in show_in()
354 res = IN_FROM_REG(ix, data->in_min[ix]); in show_in()
357 res = IN_FROM_REG(ix, data->in_max[ix]); in show_in()
360 res = (data->alarms >> bitalarmin[ix]) & 1; in show_in()
376 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
452 data->temp_max[ix] = TEMP_TO_REG(ix, val); in set_temp()
453 vt1211_write8(data, regtempmax[ix], in set_temp()
454 data->temp_max[ix]); in set_temp()
457 data->temp_hyst[ix] = TEMP_TO_REG(ix, val); in set_temp()
458 vt1211_write8(data, regtemphyst[ix], in set_temp()
459 data->temp_hyst[ix]); in set_temp()
485 int ix = sensor_attr_2->index; in show_fan() local
491 res = RPM_FROM_REG(data->fan[ix], data->fan_div[ix]); in show_fan()
494 res = RPM_FROM_REG(data->fan_min[ix], data->fan_div[ix]); in show_fan()
497 res = DIV_FROM_REG(data->fan_div[ix]); in show_fan()
500 res = (data->alarms >> bitalarmfan[ix]) & 1; in show_fan()
516 int ix = sensor_attr_2->index; in set_fan() local
531 data->fan_min[ix] = RPM_TO_REG(val, data->fan_div[ix]); in set_fan()
532 vt1211_write8(data, VT1211_REG_FAN_MIN(ix), in set_fan()
533 data->fan_min[ix]); in set_fan()
537 case 1: data->fan_div[ix] = 0; break; in set_fan()
538 case 2: data->fan_div[ix] = 1; break; in set_fan()
539 case 4: data->fan_div[ix] = 2; break; in set_fan()
540 case 8: data->fan_div[ix] = 3; break; in set_fan()
578 int ix = sensor_attr_2->index; in show_pwm() local
584 res = data->pwm[ix]; in show_pwm()
587 res = ((data->pwm_ctl[ix] >> 3) & 1) ? 2 : 0; in show_pwm()
593 res = (data->pwm_ctl[ix] & 7) + 1; in show_pwm()
609 int ix = sensor_attr_2->index; in set_pwm() local
628 data->pwm_ctl[ix] &= 7; in set_pwm()
631 if ((data->pwm_ctl[ix ^ 1] & 1) == 0) { in set_pwm()
636 data->pwm_ctl[ix] |= 8; in set_pwm()
682 data->pwm_ctl[ix] = (data->pwm_ctl[ix] & 8) | (val - 1); in set_pwm()
726 int ix = sensor_attr_2->index; in show_pwm_auto_point_temp() local
729 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->pwm_ctl[ix] & 7, in show_pwm_auto_point_temp()
740 int ix = sensor_attr_2->index; in set_pwm_auto_point_temp() local
752 data->pwm_auto_temp[ap] = TEMP_TO_REG(data->pwm_ctl[ix] & 7, val); in set_pwm_auto_point_temp()
784 int ix = sensor_attr_2->index; in show_pwm_auto_point_pwm() local
787 return sprintf(buf, "%d\n", data->pwm_auto_pwm[ix][ap]); in show_pwm_auto_point_pwm()
797 int ix = sensor_attr_2->index; in set_pwm_auto_point_pwm() local
808 data->pwm_auto_pwm[ix][ap] = val; in set_pwm_auto_point_pwm()
809 vt1211_write8(data, VT1211_REG_PWM_AUTO_PWM(ix, ap), in set_pwm_auto_point_pwm()
810 data->pwm_auto_pwm[ix][ap]); in set_pwm_auto_point_pwm()
867 #define SENSOR_ATTR_IN_INPUT(ix) \ argument
868 SENSOR_ATTR_2(in##ix##_input, S_IRUGO, \
869 show_in, NULL, SHOW_IN_INPUT, ix)
880 #define SENSOR_ATTR_IN_MIN(ix) \ argument
881 SENSOR_ATTR_2(in##ix##_min, S_IRUGO | S_IWUSR, \
882 show_in, set_in, SHOW_SET_IN_MIN, ix)
893 #define SENSOR_ATTR_IN_MAX(ix) \ argument
894 SENSOR_ATTR_2(in##ix##_max, S_IRUGO | S_IWUSR, \
895 show_in, set_in, SHOW_SET_IN_MAX, ix)
906 #define SENSOR_ATTR_IN_ALARM(ix) \ argument
907 SENSOR_ATTR_2(in##ix##_alarm, S_IRUGO, \
908 show_in, NULL, SHOW_IN_ALARM, ix)
919 #define SENSOR_ATTR_TEMP_INPUT(ix) \ argument
920 SENSOR_ATTR_2(temp##ix##_input, S_IRUGO, \
921 show_temp, NULL, SHOW_TEMP_INPUT, ix-1)
933 #define SENSOR_ATTR_TEMP_MAX(ix) \ argument
934 SENSOR_ATTR_2(temp##ix##_max, S_IRUGO | S_IWUSR, \
935 show_temp, set_temp, SHOW_SET_TEMP_MAX, ix-1)
947 #define SENSOR_ATTR_TEMP_MAX_HYST(ix) \ argument
948 SENSOR_ATTR_2(temp##ix##_max_hyst, S_IRUGO | S_IWUSR, \
949 show_temp, set_temp, SHOW_SET_TEMP_MAX_HYST, ix-1)
961 #define SENSOR_ATTR_TEMP_ALARM(ix) \ argument
962 SENSOR_ATTR_2(temp##ix##_alarm, S_IRUGO, \
963 show_temp, NULL, SHOW_TEMP_ALARM, ix-1)
975 #define SENSOR_ATTR_FAN(ix) \ argument
976 SENSOR_ATTR_2(fan##ix##_input, S_IRUGO, \
977 show_fan, NULL, SHOW_FAN_INPUT, ix-1), \
978 SENSOR_ATTR_2(fan##ix##_min, S_IRUGO | S_IWUSR, \
979 show_fan, set_fan, SHOW_SET_FAN_MIN, ix-1), \
980 SENSOR_ATTR_2(fan##ix##_div, S_IRUGO | S_IWUSR, \
981 show_fan, set_fan, SHOW_SET_FAN_DIV, ix-1), \
982 SENSOR_ATTR_2(fan##ix##_alarm, S_IRUGO, \
983 show_fan, NULL, SHOW_FAN_ALARM, ix-1)
985 #define SENSOR_ATTR_PWM(ix) \ argument
986 SENSOR_ATTR_2(pwm##ix, S_IRUGO, \
987 show_pwm, NULL, SHOW_PWM, ix-1), \
988 SENSOR_ATTR_2(pwm##ix##_enable, S_IRUGO | S_IWUSR, \
989 show_pwm, set_pwm, SHOW_SET_PWM_ENABLE, ix-1), \
990 SENSOR_ATTR_2(pwm##ix##_auto_channels_temp, S_IRUGO | S_IWUSR, \
991 show_pwm, set_pwm, SHOW_SET_PWM_AUTO_CHANNELS_TEMP, ix-1)
993 #define SENSOR_ATTR_PWM_FREQ(ix) \ argument
994 SENSOR_ATTR_2(pwm##ix##_freq, S_IRUGO | S_IWUSR, \
995 show_pwm, set_pwm, SHOW_SET_PWM_FREQ, ix-1)
997 #define SENSOR_ATTR_PWM_FREQ_RO(ix) \ argument
998 SENSOR_ATTR_2(pwm##ix##_freq, S_IRUGO, \
999 show_pwm, NULL, SHOW_SET_PWM_FREQ, ix-1)
1001 #define SENSOR_ATTR_PWM_AUTO_POINT_TEMP(ix, ap) \ argument
1002 SENSOR_ATTR_2(pwm##ix##_auto_point##ap##_temp, S_IRUGO | S_IWUSR, \
1004 ap-1, ix-1)
1006 #define SENSOR_ATTR_PWM_AUTO_POINT_TEMP_RO(ix, ap) \ argument
1007 SENSOR_ATTR_2(pwm##ix##_auto_point##ap##_temp, S_IRUGO, \
1009 ap-1, ix-1)
1011 #define SENSOR_ATTR_PWM_AUTO_POINT_PWM(ix, ap) \ argument
1012 SENSOR_ATTR_2(pwm##ix##_auto_point##ap##_pwm, S_IRUGO | S_IWUSR, \
1014 ap-1, ix-1)
1016 #define SENSOR_ATTR_PWM_AUTO_POINT_PWM_RO(ix, ap) \ argument
1017 SENSOR_ATTR_2(pwm##ix##_auto_point##ap##_pwm, S_IRUGO, \
1019 ap-1, ix-1)