Lines Matching refs:ix
81 /* Voltages (in) numbered 0-6 (ix) */
82 #define DME1737_REG_IN(ix) ((ix) < 5 ? 0x20 + (ix) \
83 : 0x94 + (ix))
84 #define DME1737_REG_IN_MIN(ix) ((ix) < 5 ? 0x44 + (ix) * 2 \
85 : 0x91 + (ix) * 2)
86 #define DME1737_REG_IN_MAX(ix) ((ix) < 5 ? 0x45 + (ix) * 2 \
87 : 0x92 + (ix) * 2)
89 /* Temperatures (temp) numbered 0-2 (ix) */
90 #define DME1737_REG_TEMP(ix) (0x25 + (ix))
91 #define DME1737_REG_TEMP_MIN(ix) (0x4e + (ix) * 2)
92 #define DME1737_REG_TEMP_MAX(ix) (0x4f + (ix) * 2)
93 #define DME1737_REG_TEMP_OFFSET(ix) ((ix) == 0 ? 0x1f \
94 : 0x1c + (ix))
103 #define DME1737_REG_IN_TEMP_LSB(ix) (0x84 + (ix))
109 /* Fans numbered 0-5 (ix) */
110 #define DME1737_REG_FAN(ix) ((ix) < 4 ? 0x28 + (ix) * 2 \
111 : 0xa1 + (ix) * 2)
112 #define DME1737_REG_FAN_MIN(ix) ((ix) < 4 ? 0x54 + (ix) * 2 \
113 : 0xa5 + (ix) * 2)
114 #define DME1737_REG_FAN_OPT(ix) ((ix) < 4 ? 0x90 + (ix) \
115 : 0xb2 + (ix))
116 #define DME1737_REG_FAN_MAX(ix) (0xb4 + (ix)) /* only for fan[4-5] */
118 /* PWMs numbered 0-2, 4-5 (ix) */
119 #define DME1737_REG_PWM(ix) ((ix) < 3 ? 0x30 + (ix) \
120 : 0xa1 + (ix))
121 #define DME1737_REG_PWM_CONFIG(ix) (0x5c + (ix)) /* only for pwm[0-2] */
122 #define DME1737_REG_PWM_MIN(ix) (0x64 + (ix)) /* only for pwm[0-2] */
123 #define DME1737_REG_PWM_FREQ(ix) ((ix) < 3 ? 0x5f + (ix) \
124 : 0xa3 + (ix))
129 #define DME1737_REG_PWM_RR(ix) (0x62 + (ix)) /* only for pwm[0-2] */
132 #define DME1737_REG_ZONE_LOW(ix) (0x67 + (ix))
133 #define DME1737_REG_ZONE_ABS(ix) (0x6a + (ix))
138 #define DME1737_REG_ZONE_HYST(ix) (0x6d + (ix))
189 #define HAS_FAN(ix) (1 << ((ix) + 5)) /* bits 5-10 */
190 #define HAS_PWM(ix) (1 << ((ix) + 11)) /* bits 11-16 */
305 static inline int TEMP_HYST_FROM_REG(int reg, int ix)
307 return (((ix == 1) ? reg : reg >> 4) & 0x0f) * 1000;
310 static inline int TEMP_HYST_TO_REG(int val, int ix, int reg)
314 return (ix == 1) ? (reg & 0xf0) | hyst : (reg & 0x0f) | (hyst << 4);
476 static inline int PWM_RR_FROM_REG(int reg, int ix)
478 int rr = (ix == 1) ? reg >> 4 : reg;
483 static int PWM_RR_TO_REG(int val, int ix, int reg)
493 return (ix == 1) ? (reg & 0x8f) | (i << 4) : (reg & 0xf8) | i;
497 static inline int PWM_RR_EN_FROM_REG(int reg, int ix)
499 return PWM_RR_FROM_REG(reg, ix) ? 1 : 0;
502 static inline int PWM_RR_EN_TO_REG(int val, int ix, int reg)
504 int en = (ix == 1) ? 0x80 : 0x08;
512 static inline int PWM_OFF_FROM_REG(int reg, int ix)
514 return (reg >> (ix + 5)) & 0x01;
517 static inline int PWM_OFF_TO_REG(int val, int ix, int reg)
519 return (reg & ~(1 << (ix + 5))) | ((val & 0x01) << (ix + 5));
576 int ix;
596 for (ix = 0; ix < ARRAY_SIZE(data->in); ix++) {
600 data->in[ix] = dme1737_read(data,
601 DME1737_REG_IN(ix)) << 8;
602 data->in_min[ix] = dme1737_read(data,
603 DME1737_REG_IN_MIN(ix));
604 data->in_max[ix] = dme1737_read(data,
605 DME1737_REG_IN_MAX(ix));
609 for (ix = 0; ix < ARRAY_SIZE(data->temp); ix++) {
615 data->temp[ix] = dme1737_read(data,
616 DME1737_REG_TEMP(ix)) << 8;
617 data->temp_min[ix] = dme1737_read(data,
618 DME1737_REG_TEMP_MIN(ix));
619 data->temp_max[ix] = dme1737_read(data,
620 DME1737_REG_TEMP_MAX(ix));
622 data->temp_offset[ix] = dme1737_read(data,
623 DME1737_REG_TEMP_OFFSET(ix));
631 for (ix = 0; ix < ARRAY_SIZE(lsb); ix++) {
632 lsb[ix] = dme1737_read(data,
633 DME1737_REG_IN_TEMP_LSB(ix));
635 for (ix = 0; ix < ARRAY_SIZE(data->in); ix++) {
636 data->in[ix] |= (lsb[DME1737_REG_IN_LSB[ix]] <<
637 DME1737_REG_IN_LSB_SHL[ix]) & 0xf0;
639 for (ix = 0; ix < ARRAY_SIZE(data->temp); ix++) {
640 data->temp[ix] |= (lsb[DME1737_REG_TEMP_LSB[ix]] <<
641 DME1737_REG_TEMP_LSB_SHL[ix]) & 0xf0;
645 for (ix = 0; ix < ARRAY_SIZE(data->fan); ix++) {
648 if (!(data->has_features & HAS_FAN(ix))) {
651 data->fan[ix] = dme1737_read(data,
652 DME1737_REG_FAN(ix));
653 data->fan[ix] |= dme1737_read(data,
654 DME1737_REG_FAN(ix) + 1) << 8;
655 data->fan_min[ix] = dme1737_read(data,
656 DME1737_REG_FAN_MIN(ix));
657 data->fan_min[ix] |= dme1737_read(data,
658 DME1737_REG_FAN_MIN(ix) + 1) << 8;
659 data->fan_opt[ix] = dme1737_read(data,
660 DME1737_REG_FAN_OPT(ix));
662 if (ix > 3) {
663 data->fan_max[ix - 4] = dme1737_read(data,
664 DME1737_REG_FAN_MAX(ix));
669 for (ix = 0; ix < ARRAY_SIZE(data->pwm); ix++) {
672 if (!(data->has_features & HAS_PWM(ix))) {
675 data->pwm[ix] = dme1737_read(data,
676 DME1737_REG_PWM(ix));
677 data->pwm_freq[ix] = dme1737_read(data,
678 DME1737_REG_PWM_FREQ(ix));
680 if (ix < 3) {
681 data->pwm_config[ix] = dme1737_read(data,
682 DME1737_REG_PWM_CONFIG(ix));
683 data->pwm_min[ix] = dme1737_read(data,
684 DME1737_REG_PWM_MIN(ix));
687 for (ix = 0; ix < ARRAY_SIZE(data->pwm_rr); ix++) {
688 data->pwm_rr[ix] = dme1737_read(data,
689 DME1737_REG_PWM_RR(ix));
693 for (ix = 0; ix < ARRAY_SIZE(data->zone_low); ix++) {
695 if ((ix == 2) && !(data->has_features & HAS_ZONE3)) {
699 if ((ix == 1) && (data->type == sch5127)) {
705 data->zone_low[ix] = dme1737_read(data,
706 DME1737_REG_ZONE_LOW(ix));
707 data->zone_abs[ix] = dme1737_read(data,
708 DME1737_REG_ZONE_ABS(ix));
712 for (ix = 0; ix < ARRAY_SIZE(data->zone_hyst); ix++) {
713 data->zone_hyst[ix] = dme1737_read(data,
714 DME1737_REG_ZONE_HYST(ix));
759 * ix = [0-5]
773 int ix = sensor_attr_2->index;
779 res = IN_FROM_REG(data->in[ix], data->in_nominal[ix], 16);
782 res = IN_FROM_REG(data->in_min[ix], data->in_nominal[ix], 8);
785 res = IN_FROM_REG(data->in_max[ix], data->in_nominal[ix], 8);
788 res = (data->alarms >> DME1737_BIT_ALARM_IN[ix]) & 0x01;
804 int ix = sensor_attr_2->index;
811 data->in_min[ix] = IN_TO_REG(val, data->in_nominal[ix]);
812 dme1737_write(data, DME1737_REG_IN_MIN(ix),
813 data->in_min[ix]);
816 data->in_max[ix] = IN_TO_REG(val, data->in_nominal[ix]);
817 dme1737_write(data, DME1737_REG_IN_MAX(ix),
818 data->in_max[ix]);
830 * ix = [0-2]
846 int ix = sensor_attr_2->index;
852 res = TEMP_FROM_REG(data->temp[ix], 16);
855 res = TEMP_FROM_REG(data->temp_min[ix], 8);
858 res = TEMP_FROM_REG(data->temp_max[ix], 8);
861 res = TEMP_FROM_REG(data->temp_offset[ix], 8);
864 res = (data->alarms >> DME1737_BIT_ALARM_TEMP[ix]) & 0x01;
867 res = (((u16)data->temp[ix] & 0xff00) == 0x8000);
883 int ix = sensor_attr_2->index;
890 data->temp_min[ix] = TEMP_TO_REG(val);
891 dme1737_write(data, DME1737_REG_TEMP_MIN(ix),
892 data->temp_min[ix]);
895 data->temp_max[ix] = TEMP_TO_REG(val);
896 dme1737_write(data, DME1737_REG_TEMP_MAX(ix),
897 data->temp_max[ix]);
900 data->temp_offset[ix] = TEMP_TO_REG(val);
901 dme1737_write(data, DME1737_REG_TEMP_OFFSET(ix),
902 data->temp_offset[ix]);
914 * ix = [0-2]
929 int ix = sensor_attr_2->index;
936 if ((ix == 1) && (data->config2 & 0x02)) {
939 res = 1 << ix;
943 res = TEMP_FROM_REG(data->zone_low[ix], 8) -
944 TEMP_HYST_FROM_REG(data->zone_hyst[ix == 2], ix);
947 res = TEMP_FROM_REG(data->zone_low[ix], 8);
951 res = TEMP_FROM_REG(data->zone_low[ix], 8) +
952 TEMP_RANGE_FROM_REG(data->pwm_freq[ix]);
955 res = TEMP_FROM_REG(data->zone_abs[ix], 8);
971 int ix = sensor_attr_2->index;
979 data->zone_low[ix] = dme1737_read(data,
980 DME1737_REG_ZONE_LOW(ix));
982 data->zone_hyst[ix == 2] = TEMP_HYST_TO_REG(
983 TEMP_FROM_REG(data->zone_low[ix], 8) -
984 val, ix, dme1737_read(data,
985 DME1737_REG_ZONE_HYST(ix == 2)));
986 dme1737_write(data, DME1737_REG_ZONE_HYST(ix == 2),
987 data->zone_hyst[ix == 2]);
990 data->zone_low[ix] = TEMP_TO_REG(val);
991 dme1737_write(data, DME1737_REG_ZONE_LOW(ix),
992 data->zone_low[ix]);
996 data->zone_low[ix] = dme1737_read(data,
997 DME1737_REG_ZONE_LOW(ix));
1000 data->pwm_freq[ix] = TEMP_RANGE_TO_REG(val -
1001 TEMP_FROM_REG(data->zone_low[ix], 8),
1003 DME1737_REG_PWM_FREQ(ix)));
1004 dme1737_write(data, DME1737_REG_PWM_FREQ(ix),
1005 data->pwm_freq[ix]);
1008 data->zone_abs[ix] = TEMP_TO_REG(val);
1009 dme1737_write(data, DME1737_REG_ZONE_ABS(ix),
1010 data->zone_abs[ix]);
1022 * ix = [0-5]
1037 int ix = sensor_attr_2->index;
1043 res = FAN_FROM_REG(data->fan[ix],
1044 ix < 4 ? 0 :
1045 FAN_TPC_FROM_REG(data->fan_opt[ix]));
1048 res = FAN_FROM_REG(data->fan_min[ix],
1049 ix < 4 ? 0 :
1050 FAN_TPC_FROM_REG(data->fan_opt[ix]));
1054 res = FAN_MAX_FROM_REG(data->fan_max[ix - 4]);
1057 res = (data->alarms >> DME1737_BIT_ALARM_FAN[ix]) & 0x01;
1061 res = FAN_TYPE_FROM_REG(data->fan_opt[ix]);
1077 int ix = sensor_attr_2->index;
1084 if (ix < 4) {
1085 data->fan_min[ix] = FAN_TO_REG(val, 0);
1088 data->fan_opt[ix] = dme1737_read(data,
1089 DME1737_REG_FAN_OPT(ix));
1091 data->fan_min[ix] = FAN_TO_REG(val,
1092 FAN_TPC_FROM_REG(data->fan_opt[ix]));
1094 dme1737_write(data, DME1737_REG_FAN_MIN(ix),
1095 data->fan_min[ix] & 0xff);
1096 dme1737_write(data, DME1737_REG_FAN_MIN(ix) + 1,
1097 data->fan_min[ix] >> 8);
1101 data->fan_max[ix - 4] = FAN_MAX_TO_REG(val);
1102 dme1737_write(data, DME1737_REG_FAN_MAX(ix),
1103 data->fan_max[ix - 4]);
1114 data->fan_opt[ix] = FAN_TYPE_TO_REG(val, dme1737_read(data,
1115 DME1737_REG_FAN_OPT(ix)));
1116 dme1737_write(data, DME1737_REG_FAN_OPT(ix),
1117 data->fan_opt[ix]);
1130 * ix = [0-4]
1148 int ix = sensor_attr_2->index;
1154 if (PWM_EN_FROM_REG(data->pwm_config[ix]) == 0) {
1157 res = data->pwm[ix];
1161 res = PWM_FREQ_FROM_REG(data->pwm_freq[ix]);
1164 if (ix >= 3) {
1167 res = PWM_EN_FROM_REG(data->pwm_config[ix]);
1172 res = PWM_RR_FROM_REG(data->pwm_rr[ix > 0], ix);
1176 if (PWM_EN_FROM_REG(data->pwm_config[ix]) == 2) {
1177 res = PWM_ACZ_FROM_REG(data->pwm_config[ix]);
1179 res = data->pwm_acz[ix];
1184 if (PWM_OFF_FROM_REG(data->pwm_rr[0], ix)) {
1185 res = data->pwm_min[ix];
1192 res = data->pwm_min[ix];
1215 int ix = sensor_attr_2->index;
1222 data->pwm[ix] = SENSORS_LIMIT(val, 0, 255);
1223 dme1737_write(data, DME1737_REG_PWM(ix), data->pwm[ix]);
1226 data->pwm_freq[ix] = PWM_FREQ_TO_REG(val, dme1737_read(data,
1227 DME1737_REG_PWM_FREQ(ix)));
1228 dme1737_write(data, DME1737_REG_PWM_FREQ(ix),
1229 data->pwm_freq[ix]);
1241 data->pwm_config[ix] = dme1737_read(data,
1242 DME1737_REG_PWM_CONFIG(ix));
1243 if (val == PWM_EN_FROM_REG(data->pwm_config[ix])) {
1248 if (PWM_EN_FROM_REG(data->pwm_config[ix]) == 2) {
1250 data->pwm_acz[ix] = PWM_ACZ_FROM_REG(
1251 data->pwm_config[ix]);
1253 data->pwm_rr[ix > 0] = dme1737_read(data,
1254 DME1737_REG_PWM_RR(ix > 0));
1255 data->pwm_rr_en &= ~(1 << ix);
1256 if (PWM_RR_EN_FROM_REG(data->pwm_rr[ix > 0], ix)) {
1257 data->pwm_rr_en |= (1 << ix);
1258 data->pwm_rr[ix > 0] = PWM_RR_EN_TO_REG(0, ix,
1259 data->pwm_rr[ix > 0]);
1261 DME1737_REG_PWM_RR(ix > 0),
1262 data->pwm_rr[ix > 0]);
1268 /* Change permissions of pwm[ix] to read-only */
1269 dme1737_chmod_file(dev, dme1737_pwm_chmod_attr[ix],
1272 data->pwm_config[ix] = PWM_EN_TO_REG(0,
1273 data->pwm_config[ix]);
1274 dme1737_write(data, DME1737_REG_PWM_CONFIG(ix),
1275 data->pwm_config[ix]);
1279 data->pwm_config[ix] = PWM_EN_TO_REG(1,
1280 data->pwm_config[ix]);
1281 dme1737_write(data, DME1737_REG_PWM_CONFIG(ix),
1282 data->pwm_config[ix]);
1283 /* Change permissions of pwm[ix] to read-writeable */
1284 dme1737_chmod_file(dev, dme1737_pwm_chmod_attr[ix],
1288 /* Change permissions of pwm[ix] to read-only */
1289 dme1737_chmod_file(dev, dme1737_pwm_chmod_attr[ix],
1293 data->pwm_config[ix] = PWM_ACZ_TO_REG(
1294 data->pwm_acz[ix],
1295 data->pwm_config[ix]);
1296 dme1737_write(data, DME1737_REG_PWM_CONFIG(ix),
1297 data->pwm_config[ix]);
1299 if (data->pwm_rr_en & (1 << ix)) {
1300 data->pwm_rr[ix > 0] = PWM_RR_EN_TO_REG(1, ix,
1302 DME1737_REG_PWM_RR(ix > 0)));
1304 DME1737_REG_PWM_RR(ix > 0),
1305 data->pwm_rr[ix > 0]);
1313 data->pwm_config[ix] = dme1737_read(data,
1314 DME1737_REG_PWM_CONFIG(ix));
1315 data->pwm_rr[ix > 0] = dme1737_read(data,
1316 DME1737_REG_PWM_RR(ix > 0));
1319 data->pwm_rr[ix > 0] = PWM_RR_TO_REG(val, ix,
1320 data->pwm_rr[ix > 0]);
1324 if (PWM_EN_FROM_REG(data->pwm_config[ix]) == 2) {
1325 data->pwm_rr[ix > 0] = PWM_RR_EN_TO_REG(val > 0, ix,
1326 data->pwm_rr[ix > 0]);
1328 dme1737_write(data, DME1737_REG_PWM_RR(ix > 0),
1329 data->pwm_rr[ix > 0]);
1342 data->pwm_config[ix] = dme1737_read(data,
1343 DME1737_REG_PWM_CONFIG(ix));
1344 if (PWM_EN_FROM_REG(data->pwm_config[ix]) == 2) {
1347 data->pwm_config[ix] = PWM_ACZ_TO_REG(val,
1348 data->pwm_config[ix]);
1349 dme1737_write(data, DME1737_REG_PWM_CONFIG(ix),
1350 data->pwm_config[ix]);
1354 data->pwm_acz[ix] = val;
1360 data->pwm_min[ix] = dme1737_read(data,
1361 DME1737_REG_PWM_MIN(ix));
1366 if (val > ((data->pwm_min[ix] + 1) / 2)) {
1367 data->pwm_rr[0] = PWM_OFF_TO_REG(1, ix,
1371 data->pwm_rr[0] = PWM_OFF_TO_REG(0, ix,
1380 data->pwm_min[ix] = SENSORS_LIMIT(val, 0, 255);
1381 dme1737_write(data, DME1737_REG_PWM_MIN(ix),
1382 data->pwm_min[ix]);
1438 #define SENSOR_DEVICE_ATTR_IN(ix) \
1439 static SENSOR_DEVICE_ATTR_2(in##ix##_input, S_IRUGO, \
1440 show_in, NULL, SYS_IN_INPUT, ix); \
1441 static SENSOR_DEVICE_ATTR_2(in##ix##_min, S_IRUGO | S_IWUSR, \
1442 show_in, set_in, SYS_IN_MIN, ix); \
1443 static SENSOR_DEVICE_ATTR_2(in##ix##_max, S_IRUGO | S_IWUSR, \
1444 show_in, set_in, SYS_IN_MAX, ix); \
1445 static SENSOR_DEVICE_ATTR_2(in##ix##_alarm, S_IRUGO, \
1446 show_in, NULL, SYS_IN_ALARM, ix)
1458 #define SENSOR_DEVICE_ATTR_TEMP(ix) \
1459 static SENSOR_DEVICE_ATTR_2(temp##ix##_input, S_IRUGO, \
1460 show_temp, NULL, SYS_TEMP_INPUT, ix-1); \
1461 static SENSOR_DEVICE_ATTR_2(temp##ix##_min, S_IRUGO | S_IWUSR, \
1462 show_temp, set_temp, SYS_TEMP_MIN, ix-1); \
1463 static SENSOR_DEVICE_ATTR_2(temp##ix##_max, S_IRUGO | S_IWUSR, \
1464 show_temp, set_temp, SYS_TEMP_MAX, ix-1); \
1465 static SENSOR_DEVICE_ATTR_2(temp##ix##_offset, S_IRUGO, \
1466 show_temp, set_temp, SYS_TEMP_OFFSET, ix-1); \
1467 static SENSOR_DEVICE_ATTR_2(temp##ix##_alarm, S_IRUGO, \
1468 show_temp, NULL, SYS_TEMP_ALARM, ix-1); \
1469 static SENSOR_DEVICE_ATTR_2(temp##ix##_fault, S_IRUGO, \
1470 show_temp, NULL, SYS_TEMP_FAULT, ix-1)
1478 #define SENSOR_DEVICE_ATTR_ZONE(ix) \
1479 static SENSOR_DEVICE_ATTR_2(zone##ix##_auto_channels_temp, S_IRUGO, \
1480 show_zone, NULL, SYS_ZONE_AUTO_CHANNELS_TEMP, ix-1); \
1481 static SENSOR_DEVICE_ATTR_2(zone##ix##_auto_point1_temp_hyst, S_IRUGO, \
1482 show_zone, set_zone, SYS_ZONE_AUTO_POINT1_TEMP_HYST, ix-1); \
1483 static SENSOR_DEVICE_ATTR_2(zone##ix##_auto_point1_temp, S_IRUGO, \
1484 show_zone, set_zone, SYS_ZONE_AUTO_POINT1_TEMP, ix-1); \
1485 static SENSOR_DEVICE_ATTR_2(zone##ix##_auto_point2_temp, S_IRUGO, \
1486 show_zone, set_zone, SYS_ZONE_AUTO_POINT2_TEMP, ix-1); \
1487 static SENSOR_DEVICE_ATTR_2(zone##ix##_auto_point3_temp, S_IRUGO, \
1488 show_zone, set_zone, SYS_ZONE_AUTO_POINT3_TEMP, ix-1)
1496 #define SENSOR_DEVICE_ATTR_FAN_1TO4(ix) \
1497 static SENSOR_DEVICE_ATTR_2(fan##ix##_input, S_IRUGO, \
1498 show_fan, NULL, SYS_FAN_INPUT, ix-1); \
1499 static SENSOR_DEVICE_ATTR_2(fan##ix##_min, S_IRUGO | S_IWUSR, \
1500 show_fan, set_fan, SYS_FAN_MIN, ix-1); \
1501 static SENSOR_DEVICE_ATTR_2(fan##ix##_alarm, S_IRUGO, \
1502 show_fan, NULL, SYS_FAN_ALARM, ix-1); \
1503 static SENSOR_DEVICE_ATTR_2(fan##ix##_type, S_IRUGO | S_IWUSR, \
1504 show_fan, set_fan, SYS_FAN_TYPE, ix-1)
1513 #define SENSOR_DEVICE_ATTR_FAN_5TO6(ix) \
1514 static SENSOR_DEVICE_ATTR_2(fan##ix##_input, S_IRUGO, \
1515 show_fan, NULL, SYS_FAN_INPUT, ix-1); \
1516 static SENSOR_DEVICE_ATTR_2(fan##ix##_min, S_IRUGO | S_IWUSR, \
1517 show_fan, set_fan, SYS_FAN_MIN, ix-1); \
1518 static SENSOR_DEVICE_ATTR_2(fan##ix##_alarm, S_IRUGO, \
1519 show_fan, NULL, SYS_FAN_ALARM, ix-1); \
1520 static SENSOR_DEVICE_ATTR_2(fan##ix##_max, S_IRUGO | S_IWUSR, \
1521 show_fan, set_fan, SYS_FAN_MAX, ix-1)
1528 #define SENSOR_DEVICE_ATTR_PWM_1TO3(ix) \
1529 static SENSOR_DEVICE_ATTR_2(pwm##ix, S_IRUGO, \
1530 show_pwm, set_pwm, SYS_PWM, ix-1); \
1531 static SENSOR_DEVICE_ATTR_2(pwm##ix##_freq, S_IRUGO, \
1532 show_pwm, set_pwm, SYS_PWM_FREQ, ix-1); \
1533 static SENSOR_DEVICE_ATTR_2(pwm##ix##_enable, S_IRUGO, \
1534 show_pwm, set_pwm, SYS_PWM_ENABLE, ix-1); \
1535 static SENSOR_DEVICE_ATTR_2(pwm##ix##_ramp_rate, S_IRUGO, \
1536 show_pwm, set_pwm, SYS_PWM_RAMP_RATE, ix-1); \
1537 static SENSOR_DEVICE_ATTR_2(pwm##ix##_auto_channels_zone, S_IRUGO, \
1538 show_pwm, set_pwm, SYS_PWM_AUTO_CHANNELS_ZONE, ix-1); \
1539 static SENSOR_DEVICE_ATTR_2(pwm##ix##_auto_pwm_min, S_IRUGO, \
1540 show_pwm, set_pwm, SYS_PWM_AUTO_PWM_MIN, ix-1); \
1541 static SENSOR_DEVICE_ATTR_2(pwm##ix##_auto_point1_pwm, S_IRUGO, \
1542 show_pwm, set_pwm, SYS_PWM_AUTO_POINT1_PWM, ix-1); \
1543 static SENSOR_DEVICE_ATTR_2(pwm##ix##_auto_point2_pwm, S_IRUGO, \
1544 show_pwm, NULL, SYS_PWM_AUTO_POINT2_PWM, ix-1)
1552 #define SENSOR_DEVICE_ATTR_PWM_5TO6(ix) \
1553 static SENSOR_DEVICE_ATTR_2(pwm##ix, S_IRUGO, \
1554 show_pwm, set_pwm, SYS_PWM, ix-1); \
1555 static SENSOR_DEVICE_ATTR_2(pwm##ix##_freq, S_IRUGO, \
1556 show_pwm, set_pwm, SYS_PWM_FREQ, ix-1); \
1557 static SENSOR_DEVICE_ATTR_2(pwm##ix##_enable, S_IRUGO, \
1558 show_pwm, NULL, SYS_PWM_ENABLE, ix-1)
1951 int ix;
1953 for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) {
1954 if (data->has_features & HAS_FAN(ix)) {
1956 &dme1737_fan_group[ix]);
1960 for (ix = 0; ix < ARRAY_SIZE(dme1737_pwm_group); ix++) {
1961 if (data->has_features & HAS_PWM(ix)) {
1963 &dme1737_pwm_group[ix]);
1964 if ((data->has_features & HAS_PWM_MIN) && ix < 3) {
1966 dme1737_auto_pwm_min_attr[ix]);
1993 int err, ix;
2029 for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) {
2030 if (data->has_features & HAS_FAN(ix)) {
2032 &dme1737_fan_group[ix]))) {
2039 for (ix = 0; ix < ARRAY_SIZE(dme1737_pwm_group); ix++) {
2040 if (data->has_features & HAS_PWM(ix)) {
2042 &dme1737_pwm_group[ix]))) {
2045 if ((data->has_features & HAS_PWM_MIN) && ix < 3 &&
2047 dme1737_auto_pwm_min_attr[ix]))) {
2078 for (ix = 0; ix < ARRAY_SIZE(dme1737_pwm_chmod_group); ix++) {
2079 if (data->has_features & HAS_PWM(ix)) {
2081 &dme1737_pwm_chmod_group[ix],
2084 ix < 3) {
2086 dme1737_auto_pwm_min_attr[ix],
2093 for (ix = 0; ix < 3; ix++) {
2094 if ((data->has_features & HAS_PWM(ix)) &&
2095 (PWM_EN_FROM_REG(data->pwm_config[ix]) == 1)) {
2097 dme1737_pwm_chmod_attr[ix],
2115 int ix;
2222 for (ix = 0; ix < 3; ix++) {
2223 data->pwm_config[ix] = dme1737_read(data,
2224 DME1737_REG_PWM_CONFIG(ix));
2225 if ((data->has_features & HAS_PWM(ix)) &&
2226 (PWM_EN_FROM_REG(data->pwm_config[ix]) == -1)) {
2228 "manual mode.\n", ix + 1);
2229 data->pwm_config[ix] = PWM_EN_TO_REG(1,
2230 data->pwm_config[ix]);
2231 dme1737_write(data, DME1737_REG_PWM(ix), 0);
2233 DME1737_REG_PWM_CONFIG(ix),
2234 data->pwm_config[ix]);