Lines Matching refs:index
118 #define IN_LSB_REG(index, type) \
119 (((type) == 1) ? W83795_REG_IN_HL_LSB[(index)] \
120 : (W83795_REG_IN_HL_LSB[(index)] + 1))
150 #define W83795_REG_FAN(index) (0x2E + (index))
151 #define W83795_REG_FAN_MIN_HL(index) (0xB6 + (index))
152 #define W83795_REG_FAN_MIN_LSB(index) (0xC4 + (index) / 2)
153 #define W83795_REG_FAN_MIN_LSB_SHIFT(index) \
154 (((index) & 1) ? 4 : 0)
160 #define W83795_REG_ALARM(index) (0x41 + (index))
162 #define W83795_REG_BEEP(index) (0x50 + (index))
170 #define W83795_REG_TFMR(index) (0x202 + (index))
173 #define W83795_REG_TSS(index) (0x209 + (index))
188 #define W83795_REG_PWM(index, nr) (0x210 + (nr) * 8 + (index))
190 #define W83795_REG_FTSH(index) (0x240 + (index) * 2)
191 #define W83795_REG_FTSL(index) (0x241 + (index) * 2)
198 #define W83795_REG_TTTI(index) (0x260 + (index))
199 #define W83795_REG_CTFS(index) (0x268 + (index))
200 #define W83795_REG_HT(index) (0x270 + (index))
204 #define W83795_REG_SF4_TEMP(temp_num, index) \
205 (0x280 + 0x10 * (temp_num) + (index))
206 #define W83795_REG_SF4_PWM(temp_num, index) \
207 (0x288 + 0x10 * (temp_num) + (index))
211 #define W83795_REG_DTS(index) (0x26 + (index))
212 #define W83795_REG_PECI_TBASE(index) (0x320 + (index))
218 #define W83795_REG_DTS_EXT(index) (0xB2 + (index))
223 #define W83795_REG_SETUP_PWM(index) (0x20C + (index))
225 static inline u16 in_from_reg(u8 index, u16 val)
228 if (index >= 12 && index <= 14)
234 static inline u16 in_to_reg(u8 index, u16 val)
236 if (index >= 12 && index <= 14)
707 int index = sensor_attr->index >> 3;
708 int bit = sensor_attr->index & 0x07;
712 val = (data->alarms[index] >> bit) & 1;
714 val = (data->beeps[index] >> bit) & 1;
727 int index = sensor_attr->index >> 3;
728 int shift = sensor_attr->index & 0x07;
738 data->beeps[index] = w83795_read(client, W83795_REG_BEEP(index));
739 data->beeps[index] &= ~beep_bit;
740 data->beeps[index] |= val << shift;
741 w83795_write(client, W83795_REG_BEEP(index), data->beeps[index]);
780 int index = sensor_attr->index;
785 val = data->fan[index] & 0x0fff;
787 val = data->fan_min[index] & 0x0fff;
798 int index = sensor_attr->index;
808 data->fan_min[index] = val;
809 w83795_write(client, W83795_REG_FAN_MIN_HL(index), (val >> 4) & 0xff);
811 if (index & 1) {
813 val |= w83795_read(client, W83795_REG_FAN_MIN_LSB(index))
816 val |= w83795_read(client, W83795_REG_FAN_MIN_LSB(index))
819 w83795_write(client, W83795_REG_FAN_MIN_LSB(index), val & 0xff);
832 int index = sensor_attr->index;
840 val = time_from_reg(data->pwm[index][nr]);
843 val = pwm_freq_from_reg(data->pwm[index][nr], data->clkin);
846 val = data->pwm[index][nr];
862 int index = sensor_attr->index;
880 w83795_write(client, W83795_REG_PWM(index, nr), val);
881 data->pwm[index][nr] = val;
892 int index = sensor_attr->index;
896 if (data->pwm_fcms[0] & (1 << index)) {
902 if (data->pwm_tfmr[tmp] & (1 << index)) {
922 int index = sensor_attr->index;
943 data->pwm_fcms[0] &= ~(1 << index);
947 data->pwm_tfmr[i] &= ~(1 << index);
953 data->pwm_fcms[0] |= (1 << index);
965 int index = to_sensor_dev_attr_2(attr)->index;
968 if (data->pwm_fomc & (1 << index))
1003 int index = sensor_attr->index;
1004 u8 tmp = data->temp_src[index / 2];
1006 if (index & 1)
1012 if (tmp >= 4 || tss_map[tmp][index] == TSS_MAP_RESERVED)
1015 return sprintf(buf, "%u\n", (unsigned int)tss_map[tmp][index] + 1);
1026 int index = sensor_attr->index;
1029 u8 val = index / 2;
1037 if (tss_map[tmp][index] == channel - 1)
1044 if (index & 1) {
1067 int index = sensor_attr->index;
1072 tmp = (data->pwm_fcms[1] >> index) & 1;
1079 tmp = data->pwm_tfmr[index];
1095 int index = sensor_attr->index;
1107 data->pwm_fcms[1] &= ~(1 << index);
1108 data->pwm_fcms[1] |= tmp << index;
1115 w83795_write(client, W83795_REG_TFMR(index), tmp);
1116 data->pwm_tfmr[index] = tmp;
1132 int index = sensor_attr->index;
1137 tmp = fan_from_reg(data->target_speed[index]);
1156 int index = sensor_attr->index;
1166 w83795_write(client, W83795_REG_FTSH(index), val >> 4);
1167 w83795_write(client, W83795_REG_FTSL(index), (val << 4) & 0xf0);
1168 data->target_speed[index] = val;
1189 int index = sensor_attr->index;
1190 long tmp = temp_from_reg(data->pwm_temp[index][nr]);
1204 int index = sensor_attr->index;
1216 w83795_write(client, W83795_REG_TTTI(index), val);
1220 w83795_write(client, W83795_REG_CTFS(index), val);
1224 tmp = w83795_read(client, W83795_REG_HT(index));
1227 w83795_write(client, W83795_REG_HT(index), tmp);
1231 tmp = w83795_read(client, W83795_REG_HT(index));
1234 w83795_write(client, W83795_REG_HT(index), tmp);
1237 data->pwm_temp[index][nr] = val;
1250 int index = sensor_attr->index;
1252 return sprintf(buf, "%u\n", data->sf4_reg[index][SF4_PWM][nr]);
1264 int index = sensor_attr->index;
1271 w83795_write(client, W83795_REG_SF4_PWM(index, nr), val);
1272 data->sf4_reg[index][SF4_PWM][nr] = val;
1285 int index = sensor_attr->index;
1288 (data->sf4_reg[index][SF4_TEMP][nr]) * 1000);
1300 int index = sensor_attr->index;
1308 w83795_write(client, W83795_REG_SF4_TEMP(index, nr), val);
1309 data->sf4_reg[index][SF4_TEMP][nr] = val;
1322 int index = sensor_attr->index;
1324 long temp = temp_from_reg(data->temp[index][nr]);
1327 temp += (data->temp_read_vrlsb[index] >> 6) * 250;
1338 int index = sensor_attr->index;
1347 data->temp[index][nr] = temp_to_reg(tmp, -128, 127);
1348 w83795_write(client, W83795_REG_TEMP[index][nr], data->temp[index][nr]);
1373 int index = sensor_attr->index;
1375 long temp = temp_from_reg(data->dts[index]);
1377 temp += (data->dts_read_vrlsb[index] >> 6) * 250;
1421 int index = sensor_attr->index;
1424 if (data->temp_mode & (1 << index))
1441 int index = sensor_attr->index;
1455 data->temp_mode |= 1 << index;
1459 data->temp_mode &= ~(1 << index);
1462 reg_shift = 2 * index;
1480 int index = sensor_attr->index;
1482 u16 val = data->in[index][nr];
1488 if ((index >= 17) &&
1489 !((data->has_gain >> (index - 17)) & 1))
1494 lsb_idx = IN_LSB_SHIFT_IDX[index][IN_LSB_IDX];
1497 IN_LSB_SHIFT_IDX[index][IN_LSB_SHIFT]) & 0x03;
1498 if ((index >= 17) &&
1499 !((data->has_gain >> (index - 17)) & 1))
1503 val = in_from_reg(index, val);
1515 int index = sensor_attr->index;
1524 val = in_to_reg(index, val);
1526 if ((index >= 17) &&
1527 !((data->has_gain >> (index - 17)) & 1))
1532 lsb_idx = IN_LSB_SHIFT_IDX[index][IN_LSB_IDX];
1534 tmp &= ~(0x03 << IN_LSB_SHIFT_IDX[index][IN_LSB_SHIFT]);
1535 tmp |= (val & 0x03) << IN_LSB_SHIFT_IDX[index][IN_LSB_SHIFT];
1540 w83795_write(client, W83795_REG_IN[index][nr], tmp);
1541 data->in[index][nr] = tmp;
1606 * Don't change the attribute order, _max, _min and _beep are accessed by index
1609 #define SENSOR_ATTR_IN(index) { \
1610 SENSOR_ATTR_2(in##index##_input, S_IRUGO, show_in, NULL, \
1611 IN_READ, index), \
1612 SENSOR_ATTR_2(in##index##_max, S_IRUGO | S_IWUSR, show_in, \
1613 store_in, IN_MAX, index), \
1614 SENSOR_ATTR_2(in##index##_min, S_IRUGO | S_IWUSR, show_in, \
1615 store_in, IN_LOW, index), \
1616 SENSOR_ATTR_2(in##index##_alarm, S_IRUGO, show_alarm_beep, \
1617 NULL, ALARM_STATUS, index + ((index > 14) ? 1 : 0)), \
1618 SENSOR_ATTR_2(in##index##_beep, S_IWUSR | S_IRUGO, \
1620 index + ((index > 14) ? 1 : 0)) }
1623 * Don't change the attribute order, _beep is accessed by index
1626 #define SENSOR_ATTR_FAN(index) { \
1627 SENSOR_ATTR_2(fan##index##_input, S_IRUGO, show_fan, \
1628 NULL, FAN_INPUT, index - 1), \
1629 SENSOR_ATTR_2(fan##index##_min, S_IWUSR | S_IRUGO, \
1630 show_fan, store_fan_min, FAN_MIN, index - 1), \
1631 SENSOR_ATTR_2(fan##index##_alarm, S_IRUGO, show_alarm_beep, \
1632 NULL, ALARM_STATUS, index + 31), \
1633 SENSOR_ATTR_2(fan##index##_beep, S_IWUSR | S_IRUGO, \
1634 show_alarm_beep, store_beep, BEEP_ENABLE, index + 31) }
1636 #define SENSOR_ATTR_PWM(index) { \
1637 SENSOR_ATTR_2(pwm##index, S_IWUSR | S_IRUGO, show_pwm, \
1638 store_pwm, PWM_OUTPUT, index - 1), \
1639 SENSOR_ATTR_2(pwm##index##_enable, S_IWUSR | S_IRUGO, \
1640 show_pwm_enable, store_pwm_enable, NOT_USED, index - 1), \
1641 SENSOR_ATTR_2(pwm##index##_mode, S_IRUGO, \
1642 show_pwm_mode, NULL, NOT_USED, index - 1), \
1643 SENSOR_ATTR_2(pwm##index##_freq, S_IWUSR | S_IRUGO, \
1644 show_pwm, store_pwm, PWM_FREQ, index - 1), \
1645 SENSOR_ATTR_2(pwm##index##_nonstop, S_IWUSR | S_IRUGO, \
1646 show_pwm, store_pwm, PWM_NONSTOP, index - 1), \
1647 SENSOR_ATTR_2(pwm##index##_start, S_IWUSR | S_IRUGO, \
1648 show_pwm, store_pwm, PWM_START, index - 1), \
1649 SENSOR_ATTR_2(pwm##index##_stop_time, S_IWUSR | S_IRUGO, \
1650 show_pwm, store_pwm, PWM_STOP_TIME, index - 1), \
1651 SENSOR_ATTR_2(fan##index##_target, S_IWUSR | S_IRUGO, \
1652 show_fanin, store_fanin, FANIN_TARGET, index - 1) }
1655 * Don't change the attribute order, _beep is accessed by index
1658 #define SENSOR_ATTR_DTS(index) { \
1659 SENSOR_ATTR_2(temp##index##_type, S_IRUGO , \
1660 show_dts_mode, NULL, NOT_USED, index - 7), \
1661 SENSOR_ATTR_2(temp##index##_input, S_IRUGO, show_dts, \
1662 NULL, NOT_USED, index - 7), \
1663 SENSOR_ATTR_2(temp##index##_crit, S_IRUGO | S_IWUSR, show_dts_ext, \
1665 SENSOR_ATTR_2(temp##index##_crit_hyst, S_IRUGO | S_IWUSR, \
1667 SENSOR_ATTR_2(temp##index##_max, S_IRUGO | S_IWUSR, show_dts_ext, \
1669 SENSOR_ATTR_2(temp##index##_max_hyst, S_IRUGO | S_IWUSR, \
1671 SENSOR_ATTR_2(temp##index##_alarm, S_IRUGO, \
1672 show_alarm_beep, NULL, ALARM_STATUS, index + 17), \
1673 SENSOR_ATTR_2(temp##index##_beep, S_IWUSR | S_IRUGO, \
1674 show_alarm_beep, store_beep, BEEP_ENABLE, index + 17) }
1677 * Don't change the attribute order, _beep is accessed by index
1680 #define SENSOR_ATTR_TEMP(index) { \
1681 SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 5 ? S_IWUSR : 0), \
1682 show_temp_mode, store_temp_mode, NOT_USED, index - 1), \
1683 SENSOR_ATTR_2(temp##index##_input, S_IRUGO, show_temp, \
1684 NULL, TEMP_READ, index - 1), \
1685 SENSOR_ATTR_2(temp##index##_crit, S_IRUGO | S_IWUSR, show_temp, \
1686 store_temp, TEMP_CRIT, index - 1), \
1687 SENSOR_ATTR_2(temp##index##_crit_hyst, S_IRUGO | S_IWUSR, \
1688 show_temp, store_temp, TEMP_CRIT_HYST, index - 1), \
1689 SENSOR_ATTR_2(temp##index##_max, S_IRUGO | S_IWUSR, show_temp, \
1690 store_temp, TEMP_WARN, index - 1), \
1691 SENSOR_ATTR_2(temp##index##_max_hyst, S_IRUGO | S_IWUSR, \
1692 show_temp, store_temp, TEMP_WARN_HYST, index - 1), \
1693 SENSOR_ATTR_2(temp##index##_alarm, S_IRUGO, \
1695 index + (index > 4 ? 11 : 17)), \
1696 SENSOR_ATTR_2(temp##index##_beep, S_IWUSR | S_IRUGO, \
1698 index + (index > 4 ? 11 : 17)), \
1699 SENSOR_ATTR_2(temp##index##_pwm_enable, S_IWUSR | S_IRUGO, \
1701 TEMP_PWM_ENABLE, index - 1), \
1702 SENSOR_ATTR_2(temp##index##_auto_channels_pwm, S_IWUSR | S_IRUGO, \
1704 TEMP_PWM_FAN_MAP, index - 1), \
1705 SENSOR_ATTR_2(thermal_cruise##index, S_IWUSR | S_IRUGO, \
1706 show_temp_pwm, store_temp_pwm, TEMP_PWM_TTTI, index - 1), \
1707 SENSOR_ATTR_2(temp##index##_warn, S_IWUSR | S_IRUGO, \
1708 show_temp_pwm, store_temp_pwm, TEMP_PWM_CTFS, index - 1), \
1709 SENSOR_ATTR_2(temp##index##_warn_hyst, S_IWUSR | S_IRUGO, \
1710 show_temp_pwm, store_temp_pwm, TEMP_PWM_HCT, index - 1), \
1711 SENSOR_ATTR_2(temp##index##_operation_hyst, S_IWUSR | S_IRUGO, \
1712 show_temp_pwm, store_temp_pwm, TEMP_PWM_HOT, index - 1), \
1713 SENSOR_ATTR_2(temp##index##_auto_point1_pwm, S_IRUGO | S_IWUSR, \
1714 show_sf4_pwm, store_sf4_pwm, 0, index - 1), \
1715 SENSOR_ATTR_2(temp##index##_auto_point2_pwm, S_IRUGO | S_IWUSR, \
1716 show_sf4_pwm, store_sf4_pwm, 1, index - 1), \
1717 SENSOR_ATTR_2(temp##index##_auto_point3_pwm, S_IRUGO | S_IWUSR, \
1718 show_sf4_pwm, store_sf4_pwm, 2, index - 1), \
1719 SENSOR_ATTR_2(temp##index##_auto_point4_pwm, S_IRUGO | S_IWUSR, \
1720 show_sf4_pwm, store_sf4_pwm, 3, index - 1), \
1721 SENSOR_ATTR_2(temp##index##_auto_point5_pwm, S_IRUGO | S_IWUSR, \
1722 show_sf4_pwm, store_sf4_pwm, 4, index - 1), \
1723 SENSOR_ATTR_2(temp##index##_auto_point6_pwm, S_IRUGO | S_IWUSR, \
1724 show_sf4_pwm, store_sf4_pwm, 5, index - 1), \
1725 SENSOR_ATTR_2(temp##index##_auto_point7_pwm, S_IRUGO | S_IWUSR, \
1726 show_sf4_pwm, store_sf4_pwm, 6, index - 1), \
1727 SENSOR_ATTR_2(temp##index##_auto_point1_temp, S_IRUGO | S_IWUSR,\
1728 show_sf4_temp, store_sf4_temp, 0, index - 1), \
1729 SENSOR_ATTR_2(temp##index##_auto_point2_temp, S_IRUGO | S_IWUSR,\
1730 show_sf4_temp, store_sf4_temp, 1, index - 1), \
1731 SENSOR_ATTR_2(temp##index##_auto_point3_temp, S_IRUGO | S_IWUSR,\
1732 show_sf4_temp, store_sf4_temp, 2, index - 1), \
1733 SENSOR_ATTR_2(temp##index##_auto_point4_temp, S_IRUGO | S_IWUSR,\
1734 show_sf4_temp, store_sf4_temp, 3, index - 1), \
1735 SENSOR_ATTR_2(temp##index##_auto_point5_temp, S_IRUGO | S_IWUSR,\
1736 show_sf4_temp, store_sf4_temp, 4, index - 1), \
1737 SENSOR_ATTR_2(temp##index##_auto_point6_temp, S_IRUGO | S_IWUSR,\
1738 show_sf4_temp, store_sf4_temp, 5, index - 1), \
1739 SENSOR_ATTR_2(temp##index##_auto_point7_temp, S_IRUGO | S_IWUSR,\
1740 show_sf4_temp, store_sf4_temp, 6, index - 1) }