Lines Matching refs:index

130 #define IN_LSB_REG(index, type) \
131 (((type) == 1) ? W83795_REG_IN_HL_LSB[(index)] \
132 : (W83795_REG_IN_HL_LSB[(index)] + 1))
162 #define W83795_REG_FAN(index) (0x2E + (index))
163 #define W83795_REG_FAN_MIN_HL(index) (0xB6 + (index))
164 #define W83795_REG_FAN_MIN_LSB(index) (0xC4 + (index) / 2)
165 #define W83795_REG_FAN_MIN_LSB_SHIFT(index) \
166 (((index) & 1) ? 4 : 0)
172 #define W83795_REG_ALARM(index) (0x41 + (index))
174 #define W83795_REG_BEEP(index) (0x50 + (index))
182 #define W83795_REG_TFMR(index) (0x202 + (index))
185 #define W83795_REG_TSS(index) (0x209 + (index))
200 #define W83795_REG_PWM(index, nr) (0x210 + (nr) * 8 + (index))
202 #define W83795_REG_FTSH(index) (0x240 + (index) * 2)
203 #define W83795_REG_FTSL(index) (0x241 + (index) * 2)
210 #define W83795_REG_TTTI(index) (0x260 + (index))
211 #define W83795_REG_CTFS(index) (0x268 + (index))
212 #define W83795_REG_HT(index) (0x270 + (index))
216 #define W83795_REG_SF4_TEMP(temp_num, index) \
217 (0x280 + 0x10 * (temp_num) + (index))
218 #define W83795_REG_SF4_PWM(temp_num, index) \
219 (0x288 + 0x10 * (temp_num) + (index))
223 #define W83795_REG_DTS(index) (0x26 + (index))
224 #define W83795_REG_PECI_TBASE(index) (0x320 + (index))
230 #define W83795_REG_DTS_EXT(index) (0xB2 + (index))
235 #define W83795_REG_SETUP_PWM(index) (0x20C + (index))
237 static inline u16 in_from_reg(u8 index, u16 val)
240 if (index >= 12 && index <= 14)
246 static inline u16 in_to_reg(u8 index, u16 val)
248 if (index >= 12 && index <= 14)
722 int index = sensor_attr->index >> 3;
723 int bit = sensor_attr->index & 0x07;
727 val = (data->alarms[index] >> bit) & 1;
729 val = (data->beeps[index] >> bit) & 1;
742 int index = sensor_attr->index >> 3;
743 int shift = sensor_attr->index & 0x07;
753 data->beeps[index] = w83795_read(client, W83795_REG_BEEP(index));
754 data->beeps[index] &= ~beep_bit;
755 data->beeps[index] |= val << shift;
756 w83795_write(client, W83795_REG_BEEP(index), data->beeps[index]);
795 int index = sensor_attr->index;
800 val = data->fan[index] & 0x0fff;
802 val = data->fan_min[index] & 0x0fff;
813 int index = sensor_attr->index;
823 data->fan_min[index] = val;
824 w83795_write(client, W83795_REG_FAN_MIN_HL(index), (val >> 4) & 0xff);
826 if (index & 1) {
828 val |= w83795_read(client, W83795_REG_FAN_MIN_LSB(index))
831 val |= w83795_read(client, W83795_REG_FAN_MIN_LSB(index))
834 w83795_write(client, W83795_REG_FAN_MIN_LSB(index), val & 0xff);
847 int index = sensor_attr->index;
855 val = time_from_reg(data->pwm[index][nr]);
858 val = pwm_freq_from_reg(data->pwm[index][nr], data->clkin);
861 val = data->pwm[index][nr];
877 int index = sensor_attr->index;
895 w83795_write(client, W83795_REG_PWM(index, nr), val);
896 data->pwm[index][nr] = val;
907 int index = sensor_attr->index;
911 if (data->pwm_fcms[0] & (1 << index)) {
917 if (data->pwm_tfmr[tmp] & (1 << index)) {
937 int index = sensor_attr->index;
958 data->pwm_fcms[0] &= ~(1 << index);
962 data->pwm_tfmr[i] &= ~(1 << index);
968 data->pwm_fcms[0] |= (1 << index);
980 int index = to_sensor_dev_attr_2(attr)->index;
983 if (data->pwm_fomc & (1 << index))
1018 int index = sensor_attr->index;
1019 u8 tmp = data->temp_src[index / 2];
1021 if (index & 1)
1027 if (tmp >= 4 || tss_map[tmp][index] == TSS_MAP_RESERVED)
1030 return sprintf(buf, "%u\n", (unsigned int)tss_map[tmp][index] + 1);
1041 int index = sensor_attr->index;
1044 u8 val = index / 2;
1052 if (tss_map[tmp][index] == channel - 1)
1059 if (index & 1) {
1082 int index = sensor_attr->index;
1087 tmp = (data->pwm_fcms[1] >> index) & 1;
1094 tmp = data->pwm_tfmr[index];
1110 int index = sensor_attr->index;
1122 data->pwm_fcms[1] &= ~(1 << index);
1123 data->pwm_fcms[1] |= tmp << index;
1130 w83795_write(client, W83795_REG_TFMR(index), tmp);
1131 data->pwm_tfmr[index] = tmp;
1147 int index = sensor_attr->index;
1152 tmp = fan_from_reg(data->target_speed[index]);
1171 int index = sensor_attr->index;
1181 w83795_write(client, W83795_REG_FTSH(index), val >> 4);
1182 w83795_write(client, W83795_REG_FTSL(index), (val << 4) & 0xf0);
1183 data->target_speed[index] = val;
1204 int index = sensor_attr->index;
1205 long tmp = temp_from_reg(data->pwm_temp[index][nr]);
1219 int index = sensor_attr->index;
1231 w83795_write(client, W83795_REG_TTTI(index), val);
1235 w83795_write(client, W83795_REG_CTFS(index), val);
1239 tmp = w83795_read(client, W83795_REG_HT(index));
1242 w83795_write(client, W83795_REG_HT(index), tmp);
1246 tmp = w83795_read(client, W83795_REG_HT(index));
1249 w83795_write(client, W83795_REG_HT(index), tmp);
1252 data->pwm_temp[index][nr] = val;
1265 int index = sensor_attr->index;
1267 return sprintf(buf, "%u\n", data->sf4_reg[index][SF4_PWM][nr]);
1279 int index = sensor_attr->index;
1286 w83795_write(client, W83795_REG_SF4_PWM(index, nr), val);
1287 data->sf4_reg[index][SF4_PWM][nr] = val;
1300 int index = sensor_attr->index;
1303 (data->sf4_reg[index][SF4_TEMP][nr]) * 1000);
1315 int index = sensor_attr->index;
1323 w83795_write(client, W83795_REG_SF4_TEMP(index, nr), val);
1324 data->sf4_reg[index][SF4_TEMP][nr] = val;
1337 int index = sensor_attr->index;
1339 long temp = temp_from_reg(data->temp[index][nr]);
1342 temp += (data->temp_read_vrlsb[index] >> 6) * 250;
1353 int index = sensor_attr->index;
1362 data->temp[index][nr] = temp_to_reg(tmp, -128, 127);
1363 w83795_write(client, W83795_REG_TEMP[index][nr], data->temp[index][nr]);
1388 int index = sensor_attr->index;
1390 long temp = temp_from_reg(data->dts[index]);
1392 temp += (data->dts_read_vrlsb[index] >> 6) * 250;
1436 int index = sensor_attr->index;
1439 if (data->temp_mode & (1 << index))
1456 int index = sensor_attr->index;
1470 data->temp_mode |= 1 << index;
1474 data->temp_mode &= ~(1 << index);
1477 reg_shift = 2 * index;
1495 int index = sensor_attr->index;
1497 u16 val = data->in[index][nr];
1503 if ((index >= 17) &&
1504 !((data->has_gain >> (index - 17)) & 1))
1509 lsb_idx = IN_LSB_SHIFT_IDX[index][IN_LSB_IDX];
1512 IN_LSB_SHIFT_IDX[index][IN_LSB_SHIFT]) & 0x03;
1513 if ((index >= 17) &&
1514 !((data->has_gain >> (index - 17)) & 1))
1518 val = in_from_reg(index, val);
1530 int index = sensor_attr->index;
1539 val = in_to_reg(index, val);
1541 if ((index >= 17) &&
1542 !((data->has_gain >> (index - 17)) & 1))
1547 lsb_idx = IN_LSB_SHIFT_IDX[index][IN_LSB_IDX];
1549 tmp &= ~(0x03 << IN_LSB_SHIFT_IDX[index][IN_LSB_SHIFT]);
1550 tmp |= (val & 0x03) << IN_LSB_SHIFT_IDX[index][IN_LSB_SHIFT];
1555 w83795_write(client, W83795_REG_IN[index][nr], tmp);
1556 data->in[index][nr] = tmp;
1621 * Don't change the attribute order, _max, _min and _beep are accessed by index
1624 #define SENSOR_ATTR_IN(index) { \
1625 SENSOR_ATTR_2(in##index##_input, S_IRUGO, show_in, NULL, \
1626 IN_READ, index), \
1627 SENSOR_ATTR_2(in##index##_max, S_IRUGO | S_IWUSR, show_in, \
1628 store_in, IN_MAX, index), \
1629 SENSOR_ATTR_2(in##index##_min, S_IRUGO | S_IWUSR, show_in, \
1630 store_in, IN_LOW, index), \
1631 SENSOR_ATTR_2(in##index##_alarm, S_IRUGO, show_alarm_beep, \
1632 NULL, ALARM_STATUS, index + ((index > 14) ? 1 : 0)), \
1633 SENSOR_ATTR_2(in##index##_beep, S_IWUSR | S_IRUGO, \
1635 index + ((index > 14) ? 1 : 0)) }
1638 * Don't change the attribute order, _beep is accessed by index
1641 #define SENSOR_ATTR_FAN(index) { \
1642 SENSOR_ATTR_2(fan##index##_input, S_IRUGO, show_fan, \
1643 NULL, FAN_INPUT, index - 1), \
1644 SENSOR_ATTR_2(fan##index##_min, S_IWUSR | S_IRUGO, \
1645 show_fan, store_fan_min, FAN_MIN, index - 1), \
1646 SENSOR_ATTR_2(fan##index##_alarm, S_IRUGO, show_alarm_beep, \
1647 NULL, ALARM_STATUS, index + 31), \
1648 SENSOR_ATTR_2(fan##index##_beep, S_IWUSR | S_IRUGO, \
1649 show_alarm_beep, store_beep, BEEP_ENABLE, index + 31) }
1651 #define SENSOR_ATTR_PWM(index) { \
1652 SENSOR_ATTR_2(pwm##index, S_IWUSR | S_IRUGO, show_pwm, \
1653 store_pwm, PWM_OUTPUT, index - 1), \
1654 SENSOR_ATTR_2(pwm##index##_enable, S_IWUSR | S_IRUGO, \
1655 show_pwm_enable, store_pwm_enable, NOT_USED, index - 1), \
1656 SENSOR_ATTR_2(pwm##index##_mode, S_IRUGO, \
1657 show_pwm_mode, NULL, NOT_USED, index - 1), \
1658 SENSOR_ATTR_2(pwm##index##_freq, S_IWUSR | S_IRUGO, \
1659 show_pwm, store_pwm, PWM_FREQ, index - 1), \
1660 SENSOR_ATTR_2(pwm##index##_nonstop, S_IWUSR | S_IRUGO, \
1661 show_pwm, store_pwm, PWM_NONSTOP, index - 1), \
1662 SENSOR_ATTR_2(pwm##index##_start, S_IWUSR | S_IRUGO, \
1663 show_pwm, store_pwm, PWM_START, index - 1), \
1664 SENSOR_ATTR_2(pwm##index##_stop_time, S_IWUSR | S_IRUGO, \
1665 show_pwm, store_pwm, PWM_STOP_TIME, index - 1), \
1666 SENSOR_ATTR_2(fan##index##_target, S_IWUSR | S_IRUGO, \
1667 show_fanin, store_fanin, FANIN_TARGET, index - 1) }
1670 * Don't change the attribute order, _beep is accessed by index
1673 #define SENSOR_ATTR_DTS(index) { \
1674 SENSOR_ATTR_2(temp##index##_type, S_IRUGO , \
1675 show_dts_mode, NULL, NOT_USED, index - 7), \
1676 SENSOR_ATTR_2(temp##index##_input, S_IRUGO, show_dts, \
1677 NULL, NOT_USED, index - 7), \
1678 SENSOR_ATTR_2(temp##index##_crit, S_IRUGO | S_IWUSR, show_dts_ext, \
1680 SENSOR_ATTR_2(temp##index##_crit_hyst, S_IRUGO | S_IWUSR, \
1682 SENSOR_ATTR_2(temp##index##_max, S_IRUGO | S_IWUSR, show_dts_ext, \
1684 SENSOR_ATTR_2(temp##index##_max_hyst, S_IRUGO | S_IWUSR, \
1686 SENSOR_ATTR_2(temp##index##_alarm, S_IRUGO, \
1687 show_alarm_beep, NULL, ALARM_STATUS, index + 17), \
1688 SENSOR_ATTR_2(temp##index##_beep, S_IWUSR | S_IRUGO, \
1689 show_alarm_beep, store_beep, BEEP_ENABLE, index + 17) }
1692 * Don't change the attribute order, _beep is accessed by index
1695 #define SENSOR_ATTR_TEMP(index) { \
1696 SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 4 ? S_IWUSR : 0), \
1697 show_temp_mode, store_temp_mode, NOT_USED, index - 1), \
1698 SENSOR_ATTR_2(temp##index##_input, S_IRUGO, show_temp, \
1699 NULL, TEMP_READ, index - 1), \
1700 SENSOR_ATTR_2(temp##index##_crit, S_IRUGO | S_IWUSR, show_temp, \
1701 store_temp, TEMP_CRIT, index - 1), \
1702 SENSOR_ATTR_2(temp##index##_crit_hyst, S_IRUGO | S_IWUSR, \
1703 show_temp, store_temp, TEMP_CRIT_HYST, index - 1), \
1704 SENSOR_ATTR_2(temp##index##_max, S_IRUGO | S_IWUSR, show_temp, \
1705 store_temp, TEMP_WARN, index - 1), \
1706 SENSOR_ATTR_2(temp##index##_max_hyst, S_IRUGO | S_IWUSR, \
1707 show_temp, store_temp, TEMP_WARN_HYST, index - 1), \
1708 SENSOR_ATTR_2(temp##index##_alarm, S_IRUGO, \
1710 index + (index > 4 ? 11 : 17)), \
1711 SENSOR_ATTR_2(temp##index##_beep, S_IWUSR | S_IRUGO, \
1713 index + (index > 4 ? 11 : 17)), \
1714 SENSOR_ATTR_2(temp##index##_pwm_enable, S_IWUSR | S_IRUGO, \
1716 TEMP_PWM_ENABLE, index - 1), \
1717 SENSOR_ATTR_2(temp##index##_auto_channels_pwm, S_IWUSR | S_IRUGO, \
1719 TEMP_PWM_FAN_MAP, index - 1), \
1720 SENSOR_ATTR_2(thermal_cruise##index, S_IWUSR | S_IRUGO, \
1721 show_temp_pwm, store_temp_pwm, TEMP_PWM_TTTI, index - 1), \
1722 SENSOR_ATTR_2(temp##index##_warn, S_IWUSR | S_IRUGO, \
1723 show_temp_pwm, store_temp_pwm, TEMP_PWM_CTFS, index - 1), \
1724 SENSOR_ATTR_2(temp##index##_warn_hyst, S_IWUSR | S_IRUGO, \
1725 show_temp_pwm, store_temp_pwm, TEMP_PWM_HCT, index - 1), \
1726 SENSOR_ATTR_2(temp##index##_operation_hyst, S_IWUSR | S_IRUGO, \
1727 show_temp_pwm, store_temp_pwm, TEMP_PWM_HOT, index - 1), \
1728 SENSOR_ATTR_2(temp##index##_auto_point1_pwm, S_IRUGO | S_IWUSR, \
1729 show_sf4_pwm, store_sf4_pwm, 0, index - 1), \
1730 SENSOR_ATTR_2(temp##index##_auto_point2_pwm, S_IRUGO | S_IWUSR, \
1731 show_sf4_pwm, store_sf4_pwm, 1, index - 1), \
1732 SENSOR_ATTR_2(temp##index##_auto_point3_pwm, S_IRUGO | S_IWUSR, \
1733 show_sf4_pwm, store_sf4_pwm, 2, index - 1), \
1734 SENSOR_ATTR_2(temp##index##_auto_point4_pwm, S_IRUGO | S_IWUSR, \
1735 show_sf4_pwm, store_sf4_pwm, 3, index - 1), \
1736 SENSOR_ATTR_2(temp##index##_auto_point5_pwm, S_IRUGO | S_IWUSR, \
1737 show_sf4_pwm, store_sf4_pwm, 4, index - 1), \
1738 SENSOR_ATTR_2(temp##index##_auto_point6_pwm, S_IRUGO | S_IWUSR, \
1739 show_sf4_pwm, store_sf4_pwm, 5, index - 1), \
1740 SENSOR_ATTR_2(temp##index##_auto_point7_pwm, S_IRUGO | S_IWUSR, \
1741 show_sf4_pwm, store_sf4_pwm, 6, index - 1), \
1742 SENSOR_ATTR_2(temp##index##_auto_point1_temp, S_IRUGO | S_IWUSR,\
1743 show_sf4_temp, store_sf4_temp, 0, index - 1), \
1744 SENSOR_ATTR_2(temp##index##_auto_point2_temp, S_IRUGO | S_IWUSR,\
1745 show_sf4_temp, store_sf4_temp, 1, index - 1), \
1746 SENSOR_ATTR_2(temp##index##_auto_point3_temp, S_IRUGO | S_IWUSR,\
1747 show_sf4_temp, store_sf4_temp, 2, index - 1), \
1748 SENSOR_ATTR_2(temp##index##_auto_point4_temp, S_IRUGO | S_IWUSR,\
1749 show_sf4_temp, store_sf4_temp, 3, index - 1), \
1750 SENSOR_ATTR_2(temp##index##_auto_point5_temp, S_IRUGO | S_IWUSR,\
1751 show_sf4_temp, store_sf4_temp, 4, index - 1), \
1752 SENSOR_ATTR_2(temp##index##_auto_point6_temp, S_IRUGO | S_IWUSR,\
1753 show_sf4_temp, store_sf4_temp, 5, index - 1), \
1754 SENSOR_ATTR_2(temp##index##_auto_point7_temp, S_IRUGO | S_IWUSR,\
1755 show_sf4_temp, store_sf4_temp, 6, index - 1) }