+static SENSOR_DEVICE_ATTR_2(temp6_min, S_IRUGO | S_IWUSR, show_temp, set_temp,
+ 5, 1);
+static SENSOR_DEVICE_ATTR_2(temp6_max, S_IRUGO | S_IWUSR, show_temp, set_temp,
+ 5, 2);
+static SENSOR_DEVICE_ATTR_2(temp6_offset, S_IRUGO | S_IWUSR, show_temp,
+ set_temp, 5, 3);
+
+static int get_temp_type(struct it87_data *data, int index)
+{
+ u8 reg, extra;
+ int type = 0;
+
+ if (has_bank_sel(data)) {
+ int s1reg = IT87_REG_TEMP_SRC1[index/2] >> ((index % 2) * 4);
+ u8 src1, src2;
+
+ src1 = (it87_read_value(data, s1reg) >> ((index % 2) * 4)) & 0x0f;
+ src2 = it87_read_value(data, IT87_REG_TEMP_SRC2);
+
+ switch (data->type) {
+ case it8686:
+ switch (src1) {
+ case 0:
+ if (index >= 3)
+ return 4;
+ break;
+ case 1:
+ if (index == 1 || index == 2 ||
+ index == 4 || index == 5)
+ return 6;
+ break;
+ case 2:
+ if (index == 2 || index == 6)
+ return 5;
+ break;
+ default:
+ break;
+ }
+ break;
+ case it8625:
+ if (index < 3)
+ break;
+ case it8655:
+ case it8665:
+ if (src1 < 3) {
+ index = src1;
+ break;
+ }
+ switch(src1) {
+ case 3:
+ type = (src2 & BIT(index)) ? 6 : 5;
+ break;
+ case 4 ... 8:
+ type = (src2 & BIT(index)) ? 4 : 6;
+ break;
+ case 9:
+ type = (src2 & BIT(index)) ? 5 : 0;
+ break;
+ default:
+ break;
+ }
+ return type;
+ default:
+ return 0;
+ }
+ }
+ if (index >= 3)
+ return 0;
+
+ reg = it87_read_value(data, IT87_REG_TEMP_ENABLE);
+ extra = it87_read_value(data, IT87_REG_TEMP_EXTRA);
+
+ if ((has_temp_peci(data, index) && (reg >> 6 == index + 1)) ||
+ (has_temp_old_peci(data, index) && (extra & 0x80)))
+ type = 6; /* Intel PECI */
+ if (reg & BIT(index))
+ type = 3; /* thermal diode */
+ else if (reg & BIT(index + 3))
+ type = 4; /* thermistor */
+
+ return type;
+}