Lines Matching full:index
118 #define IN_LSB_REG(index, type) \ argument
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)) argument
151 #define W83795_REG_FAN_MIN_HL(index) (0xB6 + (index)) argument
152 #define W83795_REG_FAN_MIN_LSB(index) (0xC4 + (index) / 2) argument
153 #define W83795_REG_FAN_MIN_LSB_SHIFT(index) \ argument
154 (((index) & 1) ? 4 : 0)
160 #define W83795_REG_ALARM(index) (0x41 + (index)) argument
162 #define W83795_REG_BEEP(index) (0x50 + (index)) argument
170 #define W83795_REG_TFMR(index) (0x202 + (index)) argument
173 #define W83795_REG_TSS(index) (0x209 + (index)) argument
188 #define W83795_REG_PWM(index, nr) (0x210 + (nr) * 8 + (index)) argument
190 #define W83795_REG_FTSH(index) (0x240 + (index) * 2) argument
191 #define W83795_REG_FTSL(index) (0x241 + (index) * 2) argument
198 #define W83795_REG_TTTI(index) (0x260 + (index)) argument
199 #define W83795_REG_CTFS(index) (0x268 + (index)) argument
200 #define W83795_REG_HT(index) (0x270 + (index)) argument
204 #define W83795_REG_SF4_TEMP(temp_num, index) \ argument
205 (0x280 + 0x10 * (temp_num) + (index))
206 #define W83795_REG_SF4_PWM(temp_num, index) \ argument
207 (0x288 + 0x10 * (temp_num) + (index))
211 #define W83795_REG_DTS(index) (0x26 + (index)) argument
212 #define W83795_REG_PECI_TBASE(index) (0x320 + (index)) argument
218 #define W83795_REG_DTS_EXT(index) (0xB2 + (index)) argument
223 #define W83795_REG_SETUP_PWM(index) (0x20C + (index)) argument
225 static inline u16 in_from_reg(u8 index, u16 val) in in_from_reg() argument
228 if (index >= 12 && index <= 14) in in_from_reg()
234 static inline u16 in_to_reg(u8 index, u16 val) in in_to_reg() argument
236 if (index >= 12 && index <= 14) in in_to_reg()
707 int index = sensor_attr->index >> 3; in show_alarm_beep() local
708 int bit = sensor_attr->index & 0x07; in show_alarm_beep()
712 val = (data->alarms[index] >> bit) & 1; in show_alarm_beep()
714 val = (data->beeps[index] >> bit) & 1; in show_alarm_beep()
727 int index = sensor_attr->index >> 3; in store_beep() local
728 int shift = sensor_attr->index & 0x07; in store_beep()
738 data->beeps[index] = w83795_read(client, W83795_REG_BEEP(index)); in store_beep()
739 data->beeps[index] &= ~beep_bit; in store_beep()
740 data->beeps[index] |= val << shift; in store_beep()
741 w83795_write(client, W83795_REG_BEEP(index), data->beeps[index]); in store_beep()
780 int index = sensor_attr->index; in show_fan() local
785 val = data->fan[index] & 0x0fff; in show_fan()
787 val = data->fan_min[index] & 0x0fff; in show_fan()
798 int index = sensor_attr->index; in store_fan_min() local
808 data->fan_min[index] = val; in store_fan_min()
809 w83795_write(client, W83795_REG_FAN_MIN_HL(index), (val >> 4) & 0xff); in store_fan_min()
811 if (index & 1) { in store_fan_min()
813 val |= w83795_read(client, W83795_REG_FAN_MIN_LSB(index)) in store_fan_min()
816 val |= w83795_read(client, W83795_REG_FAN_MIN_LSB(index)) in store_fan_min()
819 w83795_write(client, W83795_REG_FAN_MIN_LSB(index), val & 0xff); in store_fan_min()
832 int index = sensor_attr->index; in show_pwm() local
840 val = time_from_reg(data->pwm[index][nr]); in show_pwm()
843 val = pwm_freq_from_reg(data->pwm[index][nr], data->clkin); in show_pwm()
846 val = data->pwm[index][nr]; in show_pwm()
862 int index = sensor_attr->index; in store_pwm() local
880 w83795_write(client, W83795_REG_PWM(index, nr), val); in store_pwm()
881 data->pwm[index][nr] = val; in store_pwm()
892 int index = sensor_attr->index; in show_pwm_enable() local
896 if (data->pwm_fcms[0] & (1 << index)) { in show_pwm_enable()
902 if (data->pwm_tfmr[tmp] & (1 << index)) { in show_pwm_enable()
922 int index = sensor_attr->index; in store_pwm_enable() local
943 data->pwm_fcms[0] &= ~(1 << index); in store_pwm_enable()
947 data->pwm_tfmr[i] &= ~(1 << index); in store_pwm_enable()
953 data->pwm_fcms[0] |= (1 << index); in store_pwm_enable()
965 int index = to_sensor_dev_attr_2(attr)->index; in show_pwm_mode() local
968 if (data->pwm_fomc & (1 << index)) in show_pwm_mode()
1003 int index = sensor_attr->index; in show_temp_src() local
1004 u8 tmp = data->temp_src[index / 2]; in show_temp_src()
1006 if (index & 1) in show_temp_src()
1012 if (tmp >= 4 || tss_map[tmp][index] == TSS_MAP_RESERVED) in show_temp_src()
1015 return sprintf(buf, "%u\n", (unsigned int)tss_map[tmp][index] + 1); in show_temp_src()
1026 int index = sensor_attr->index; in store_temp_src() local
1029 u8 val = index / 2; in store_temp_src()
1037 if (tss_map[tmp][index] == channel - 1) in store_temp_src()
1044 if (index & 1) { in store_temp_src()
1067 int index = sensor_attr->index; in show_temp_pwm_enable() local
1072 tmp = (data->pwm_fcms[1] >> index) & 1; in show_temp_pwm_enable()
1079 tmp = data->pwm_tfmr[index]; in show_temp_pwm_enable()
1095 int index = sensor_attr->index; in store_temp_pwm_enable() local
1107 data->pwm_fcms[1] &= ~(1 << index); in store_temp_pwm_enable()
1108 data->pwm_fcms[1] |= tmp << index; in store_temp_pwm_enable()
1115 w83795_write(client, W83795_REG_TFMR(index), tmp); in store_temp_pwm_enable()
1116 data->pwm_tfmr[index] = tmp; in store_temp_pwm_enable()
1132 int index = sensor_attr->index; in show_fanin() local
1137 tmp = fan_from_reg(data->target_speed[index]); in show_fanin()
1156 int index = sensor_attr->index; in store_fanin() local
1166 w83795_write(client, W83795_REG_FTSH(index), val >> 4); in store_fanin()
1167 w83795_write(client, W83795_REG_FTSL(index), (val << 4) & 0xf0); in store_fanin()
1168 data->target_speed[index] = val; in store_fanin()
1189 int index = sensor_attr->index; in show_temp_pwm() local
1190 long tmp = temp_from_reg(data->pwm_temp[index][nr]); in show_temp_pwm()
1204 int index = sensor_attr->index; in store_temp_pwm() local
1216 w83795_write(client, W83795_REG_TTTI(index), val); in store_temp_pwm()
1220 w83795_write(client, W83795_REG_CTFS(index), val); in store_temp_pwm()
1224 tmp = w83795_read(client, W83795_REG_HT(index)); in store_temp_pwm()
1227 w83795_write(client, W83795_REG_HT(index), tmp); in store_temp_pwm()
1231 tmp = w83795_read(client, W83795_REG_HT(index)); in store_temp_pwm()
1234 w83795_write(client, W83795_REG_HT(index), tmp); in store_temp_pwm()
1237 data->pwm_temp[index][nr] = val; in store_temp_pwm()
1250 int index = sensor_attr->index; in show_sf4_pwm() local
1252 return sprintf(buf, "%u\n", data->sf4_reg[index][SF4_PWM][nr]); in show_sf4_pwm()
1264 int index = sensor_attr->index; in store_sf4_pwm() local
1271 w83795_write(client, W83795_REG_SF4_PWM(index, nr), val); in store_sf4_pwm()
1272 data->sf4_reg[index][SF4_PWM][nr] = val; in store_sf4_pwm()
1285 int index = sensor_attr->index; in show_sf4_temp() local
1288 (data->sf4_reg[index][SF4_TEMP][nr]) * 1000); in show_sf4_temp()
1300 int index = sensor_attr->index; in store_sf4_temp() local
1308 w83795_write(client, W83795_REG_SF4_TEMP(index, nr), val); in store_sf4_temp()
1309 data->sf4_reg[index][SF4_TEMP][nr] = val; in store_sf4_temp()
1322 int index = sensor_attr->index; in show_temp() local
1324 long temp = temp_from_reg(data->temp[index][nr]); in show_temp()
1327 temp += (data->temp_read_vrlsb[index] >> 6) * 250; in show_temp()
1338 int index = sensor_attr->index; in store_temp() local
1347 data->temp[index][nr] = temp_to_reg(tmp, -128, 127); in store_temp()
1348 w83795_write(client, W83795_REG_TEMP[index][nr], data->temp[index][nr]); in store_temp()
1373 int index = sensor_attr->index; in show_dts() local
1375 long temp = temp_from_reg(data->dts[index]); in show_dts()
1377 temp += (data->dts_read_vrlsb[index] >> 6) * 250; in show_dts()
1421 int index = sensor_attr->index; in show_temp_mode() local
1424 if (data->temp_mode & (1 << index)) in show_temp_mode()
1441 int index = sensor_attr->index; in store_temp_mode() local
1455 data->temp_mode |= 1 << index; in store_temp_mode()
1459 data->temp_mode &= ~(1 << index); in store_temp_mode()
1462 reg_shift = 2 * index; in store_temp_mode()
1480 int index = sensor_attr->index; in show_in() local
1482 u16 val = data->in[index][nr]; in show_in()
1488 if ((index >= 17) && in show_in()
1489 !((data->has_gain >> (index - 17)) & 1)) in show_in()
1494 lsb_idx = IN_LSB_SHIFT_IDX[index][IN_LSB_IDX]; in show_in()
1497 IN_LSB_SHIFT_IDX[index][IN_LSB_SHIFT]) & 0x03; in show_in()
1498 if ((index >= 17) && in show_in()
1499 !((data->has_gain >> (index - 17)) & 1)) in show_in()
1503 val = in_from_reg(index, val); in show_in()
1515 int index = sensor_attr->index; in store_in() local
1524 val = in_to_reg(index, val); in store_in()
1526 if ((index >= 17) && in store_in()
1527 !((data->has_gain >> (index - 17)) & 1)) in store_in()
1532 lsb_idx = IN_LSB_SHIFT_IDX[index][IN_LSB_IDX]; in store_in()
1534 tmp &= ~(0x03 << IN_LSB_SHIFT_IDX[index][IN_LSB_SHIFT]); in store_in()
1535 tmp |= (val & 0x03) << IN_LSB_SHIFT_IDX[index][IN_LSB_SHIFT]; in store_in()
1540 w83795_write(client, W83795_REG_IN[index][nr], tmp); in store_in()
1541 data->in[index][nr] = tmp; in store_in()
1606 * Don't change the attribute order, _max, _min and _beep are accessed by index
1609 #define SENSOR_ATTR_IN(index) { \ argument
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) { \ argument
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) { \ argument
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) { \ argument
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) { \ argument
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) }