Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (it87) Add support for IT8732F

Add support for the IT8732F. This chip is pretty similar to IT8721F,
with the main difference being that the ADC LSB is 10.9 mV instead of
12 mV.

Signed-off-by: Justin Maggard <jmaggard@netgear.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Justin Maggard and committed by
Guenter Roeck
ead80803 1c6e8f6b

+59 -21
+21 -12
Documentation/hwmon/it87
··· 38 38 Prefix: 'it8728' 39 39 Addresses scanned: from Super I/O config space (8 I/O ports) 40 40 Datasheet: Not publicly available 41 + * IT8732F 42 + Prefix: 'it8732' 43 + Addresses scanned: from Super I/O config space (8 I/O ports) 44 + Datasheet: Not publicly available 41 45 * IT8771E 42 46 Prefix: 'it8771' 43 47 Addresses scanned: from Super I/O config space (8 I/O ports) ··· 115 111 ----------- 116 112 117 113 This driver implements support for the IT8603E, IT8620E, IT8623E, IT8705F, 118 - IT8712F, IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E, 119 - IT8771E, IT8772E, IT8781F, IT8782F, IT8783E/F, IT8786E, IT8790E, and SiS950 120 - chips. 114 + IT8712F, IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8732F, 115 + IT8758E, IT8771E, IT8772E, IT8781F, IT8782F, IT8783E/F, IT8786E, IT8790E, and 116 + SiS950 chips. 121 117 122 118 These chips are 'Super I/O chips', supporting floppy disks, infrared ports, 123 119 joysticks and other miscellaneous stuff. For hardware monitoring, they ··· 141 137 have support for 2 additional fans. The additional fans are supported by the 142 138 driver. 143 139 144 - The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E, IT8781F, IT8782F, IT8783E/F, 145 - and late IT8712F and IT8705F also have optional 16-bit tachometer counters 146 - for fans 1 to 3. This is better (no more fan clock divider mess) but not 147 - compatible with the older chips and revisions. The 16-bit tachometer mode 140 + The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E, IT8732F, IT8781F, IT8782F, 141 + IT8783E/F, and late IT8712F and IT8705F also have optional 16-bit tachometer 142 + counters for fans 1 to 3. This is better (no more fan clock divider mess) but 143 + not compatible with the older chips and revisions. The 16-bit tachometer mode 148 144 is enabled by the driver when one of the above chips is detected. 149 145 150 146 The IT8726F is just bit enhanced IT8716F with additional hardware ··· 163 159 164 160 The IT8790E supports up to 3 fans. 16-bit fan mode is always enabled. 165 161 162 + The IT8732F supports a closed-loop mode for fan control, but this is not 163 + currently implemented by the driver. 164 + 166 165 Temperatures are measured in degrees Celsius. An alarm is triggered once 167 166 when the Overtemperature Shutdown limit is crossed. 168 167 ··· 180 173 Voltage sensors (also known as IN sensors) report their values in volts. An 181 174 alarm is triggered if the voltage has crossed a programmable minimum or 182 175 maximum limit. Note that minimum in this case always means 'closest to 183 - zero'; this is important for negative voltage measurements. All voltage 184 - inputs can measure voltages between 0 and 4.08 volts, with a resolution of 185 - 0.016 volt (except IT8603E, IT8721F/IT8758E and IT8728F: 0.012 volt.) The 186 - battery voltage in8 does not have limit registers. 176 + zero'; this is important for negative voltage measurements. On most chips, all 177 + voltage inputs can measure voltages between 0 and 4.08 volts, with a resolution 178 + of 0.016 volt. IT8603E, IT8721F/IT8758E and IT8728F can measure between 0 and 179 + 3.06 volts, with a resolution of 0.012 volt. IT8732F can measure between 0 and 180 + 2.8 volts with a resolution of 0.0109 volt. The battery voltage in8 does not 181 + have limit registers. 187 182 188 - On the IT8603E, IT8721F/IT8758E, IT8781F, IT8782F, and IT8783E/F, some 183 + On the IT8603E, IT8721F/IT8758E, IT8732F, IT8781F, IT8782F, and IT8783E/F, some 189 184 voltage inputs are internal and scaled inside the chip: 190 185 * in3 (optional) 191 186 * in7 (optional for IT8781F, IT8782F, and IT8783E/F)
+2 -2
drivers/hwmon/Kconfig
··· 609 609 depends on !PPC 610 610 select HWMON_VID 611 611 help 612 - If you say yes here you get support for ITE IT8705F, IT8712F, 613 - IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E, 612 + If you say yes here you get support for ITE IT8705F, IT8712F, IT8716F, 613 + IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8732F, IT8758E, 614 614 IT8771E, IT8772E, IT8781F, IT8782F, IT8783E/F, IT8786E, IT8790E, 615 615 IT8603E, IT8620E, and IT8623E sensor chips, and the SiS950 clone. 616 616
+36 -7
drivers/hwmon/it87.c
··· 21 21 * IT8721F Super I/O chip w/LPC interface 22 22 * IT8726F Super I/O chip w/LPC interface 23 23 * IT8728F Super I/O chip w/LPC interface 24 + * IT8732F Super I/O chip w/LPC interface 24 25 * IT8758E Super I/O chip w/LPC interface 25 26 * IT8771E Super I/O chip w/LPC interface 26 27 * IT8772E Super I/O chip w/LPC interface ··· 70 69 71 70 #define DRVNAME "it87" 72 71 73 - enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728, it8771, 74 - it8772, it8781, it8782, it8783, it8786, it8790, it8603, it8620 }; 72 + enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728, it8732, 73 + it8771, it8772, it8781, it8782, it8783, it8786, it8790, it8603, 74 + it8620 }; 75 75 76 76 static unsigned short force_id; 77 77 module_param(force_id, ushort, 0); ··· 150 148 #define IT8721F_DEVID 0x8721 151 149 #define IT8726F_DEVID 0x8726 152 150 #define IT8728F_DEVID 0x8728 151 + #define IT8732F_DEVID 0x8732 153 152 #define IT8771E_DEVID 0x8771 154 153 #define IT8772E_DEVID 0x8772 155 154 #define IT8781F_DEVID 0x8781 ··· 268 265 #define FEAT_VID (1 << 9) /* Set if chip supports VID */ 269 266 #define FEAT_IN7_INTERNAL (1 << 10) /* Set if in7 is internal */ 270 267 #define FEAT_SIX_FANS (1 << 11) /* Supports six fans */ 268 + #define FEAT_10_9MV_ADC (1 << 12) 271 269 272 270 static const struct it87_devices it87_devices[] = { 273 271 [it87] = { ··· 318 314 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_FIVE_FANS 319 315 | FEAT_IN7_INTERNAL, 320 316 .peci_mask = 0x07, 317 + }, 318 + [it8732] = { 319 + .name = "it8732", 320 + .suffix = "F", 321 + .features = FEAT_NEWER_AUTOPWM | FEAT_16BIT_FANS 322 + | FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_TEMP_PECI 323 + | FEAT_10_9MV_ADC | FEAT_IN7_INTERNAL, 324 + .peci_mask = 0x07, 325 + .old_peci_mask = 0x02, /* Actually reports PCH */ 321 326 }, 322 327 [it8771] = { 323 328 .name = "it8771", ··· 404 391 405 392 #define has_16bit_fans(data) ((data)->features & FEAT_16BIT_FANS) 406 393 #define has_12mv_adc(data) ((data)->features & FEAT_12MV_ADC) 394 + #define has_10_9mv_adc(data) ((data)->features & FEAT_10_9MV_ADC) 407 395 #define has_newer_autopwm(data) ((data)->features & FEAT_NEWER_AUTOPWM) 408 396 #define has_old_autopwm(data) ((data)->features & FEAT_OLD_AUTOPWM) 409 397 #define has_temp_offset(data) ((data)->features & FEAT_TEMP_OFFSET) ··· 489 475 490 476 static int adc_lsb(const struct it87_data *data, int nr) 491 477 { 492 - int lsb = has_12mv_adc(data) ? 12 : 16; 478 + int lsb; 479 + 480 + if (has_12mv_adc(data)) 481 + lsb = 120; 482 + else if (has_10_9mv_adc(data)) 483 + lsb = 109; 484 + else 485 + lsb = 160; 493 486 if (data->in_scaled & (1 << nr)) 494 487 lsb <<= 1; 495 488 return lsb; ··· 504 483 505 484 static u8 in_to_reg(const struct it87_data *data, int nr, long val) 506 485 { 507 - val = DIV_ROUND_CLOSEST(val, adc_lsb(data, nr)); 486 + val = DIV_ROUND_CLOSEST(val * 10, adc_lsb(data, nr)); 508 487 return clamp_val(val, 0, 255); 509 488 } 510 489 511 490 static int in_from_reg(const struct it87_data *data, int nr, int val) 512 491 { 513 - return val * adc_lsb(data, nr); 492 + return DIV_ROUND_CLOSEST(val * adc_lsb(data, nr), 10); 514 493 } 515 494 516 495 static inline u8 FAN_TO_REG(long rpm, int div) ··· 1536 1515 }; 1537 1516 struct it87_data *data = dev_get_drvdata(dev); 1538 1517 int nr = to_sensor_dev_attr(attr)->index; 1518 + const char *label; 1539 1519 1540 - return sprintf(buf, "%s\n", has_12mv_adc(data) ? labels_it8721[nr] 1541 - : labels[nr]); 1520 + if (has_12mv_adc(data) || has_10_9mv_adc(data)) 1521 + label = labels_it8721[nr]; 1522 + else 1523 + label = labels[nr]; 1524 + 1525 + return sprintf(buf, "%s\n", label); 1542 1526 } 1543 1527 static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 0); 1544 1528 static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 1); ··· 1878 1852 break; 1879 1853 case IT8728F_DEVID: 1880 1854 sio_data->type = it8728; 1855 + break; 1856 + case IT8732F_DEVID: 1857 + sio_data->type = it8732; 1881 1858 break; 1882 1859 case IT8771E_DEVID: 1883 1860 sio_data->type = it8771;