aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2015-03-26 11:49:18 -0400
committerGuenter Roeck <linux@roeck-us.net>2015-04-05 09:00:52 -0400
commit7f5726c39ad469447545233f41a13d202a233d6b (patch)
tree79da8a8355b9692ec9b8e670d2fddb6e2a88fd04
parentfaf392fb843007ade20720f18920f8444660cd8b (diff)
hwmon: (it87) Introduce feature flag to reflect internal in7 sensor
On some chips, in7 is always an internal voltage sensor. Introduce feature flag to reflect this condition to simplify adding support for new chips. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/it87.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 915d206c79eb..9f4c662c5905 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -258,6 +258,7 @@ struct it87_devices {
258#define FEAT_FAN16_CONFIG (1 << 7) /* Need to enable 16-bit fans */ 258#define FEAT_FAN16_CONFIG (1 << 7) /* Need to enable 16-bit fans */
259#define FEAT_FIVE_FANS (1 << 8) /* Supports five fans */ 259#define FEAT_FIVE_FANS (1 << 8) /* Supports five fans */
260#define FEAT_VID (1 << 9) /* Set if chip supports VID */ 260#define FEAT_VID (1 << 9) /* Set if chip supports VID */
261#define FEAT_IN7_INTERNAL (1 << 10) /* Set if in7 is internal */
261 262
262static const struct it87_devices it87_devices[] = { 263static const struct it87_devices it87_devices[] = {
263 [it87] = { 264 [it87] = {
@@ -296,7 +297,7 @@ static const struct it87_devices it87_devices[] = {
296 .suffix = "F", 297 .suffix = "F",
297 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS 298 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
298 | FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_TEMP_PECI 299 | FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_TEMP_PECI
299 | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS, 300 | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS | FEAT_IN7_INTERNAL,
300 .peci_mask = 0x05, 301 .peci_mask = 0x05,
301 .old_peci_mask = 0x02, /* Actually reports PCH */ 302 .old_peci_mask = 0x02, /* Actually reports PCH */
302 }, 303 },
@@ -304,14 +305,15 @@ static const struct it87_devices it87_devices[] = {
304 .name = "it8728", 305 .name = "it8728",
305 .suffix = "F", 306 .suffix = "F",
306 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS 307 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
307 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_FIVE_FANS, 308 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_FIVE_FANS
309 | FEAT_IN7_INTERNAL,
308 .peci_mask = 0x07, 310 .peci_mask = 0x07,
309 }, 311 },
310 [it8771] = { 312 [it8771] = {
311 .name = "it8771", 313 .name = "it8771",
312 .suffix = "E", 314 .suffix = "E",
313 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS 315 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
314 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI, 316 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_IN7_INTERNAL,
315 /* PECI: guesswork */ 317 /* PECI: guesswork */
316 /* 12mV ADC (OHM) */ 318 /* 12mV ADC (OHM) */
317 /* 16 bit fans (OHM) */ 319 /* 16 bit fans (OHM) */
@@ -322,7 +324,7 @@ static const struct it87_devices it87_devices[] = {
322 .name = "it8772", 324 .name = "it8772",
323 .suffix = "E", 325 .suffix = "E",
324 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS 326 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
325 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI, 327 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_IN7_INTERNAL,
326 /* PECI (coreboot) */ 328 /* PECI (coreboot) */
327 /* 12mV ADC (HWSensors4, OHM) */ 329 /* 12mV ADC (HWSensors4, OHM) */
328 /* 16 bit fans (HWSensors4, OHM) */ 330 /* 16 bit fans (HWSensors4, OHM) */
@@ -354,14 +356,14 @@ static const struct it87_devices it87_devices[] = {
354 .name = "it8786", 356 .name = "it8786",
355 .suffix = "E", 357 .suffix = "E",
356 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS 358 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
357 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI, 359 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_IN7_INTERNAL,
358 .peci_mask = 0x07, 360 .peci_mask = 0x07,
359 }, 361 },
360 [it8603] = { 362 [it8603] = {
361 .name = "it8603", 363 .name = "it8603",
362 .suffix = "E", 364 .suffix = "E",
363 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS 365 .features = FEAT_NEWER_AUTOPWM | FEAT_12MV_ADC | FEAT_16BIT_FANS
364 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI, 366 | FEAT_TEMP_OFFSET | FEAT_TEMP_PECI | FEAT_IN7_INTERNAL,
365 .peci_mask = 0x07, 367 .peci_mask = 0x07,
366 }, 368 },
367}; 369};
@@ -379,6 +381,7 @@ static const struct it87_devices it87_devices[] = {
379#define has_fan16_config(data) ((data)->features & FEAT_FAN16_CONFIG) 381#define has_fan16_config(data) ((data)->features & FEAT_FAN16_CONFIG)
380#define has_five_fans(data) ((data)->features & FEAT_FIVE_FANS) 382#define has_five_fans(data) ((data)->features & FEAT_FIVE_FANS)
381#define has_vid(data) ((data)->features & FEAT_VID) 383#define has_vid(data) ((data)->features & FEAT_VID)
384#define has_in7_internal(data) ((data)->features & FEAT_IN7_INTERNAL)
382 385
383struct it87_sio_data { 386struct it87_sio_data {
384 enum chips type; 387 enum chips type;
@@ -1860,8 +1863,13 @@ static int __init it87_find(unsigned short *address,
1860 it87_devices[sio_data->type].suffix, 1863 it87_devices[sio_data->type].suffix,
1861 *address, sio_data->revision); 1864 *address, sio_data->revision);
1862 1865
1866 /* in7 (VSB or VCCH5V) is always internal on some chips */
1867 if (it87_devices[sio_data->type].features & FEAT_IN7_INTERNAL)
1868 sio_data->internal |= (1 << 1);
1869
1863 /* in8 (Vbat) is always internal */ 1870 /* in8 (Vbat) is always internal */
1864 sio_data->internal = (1 << 2); 1871 sio_data->internal |= (1 << 2);
1872
1865 /* Only the IT8603E has in9 */ 1873 /* Only the IT8603E has in9 */
1866 if (sio_data->type != it8603) 1874 if (sio_data->type != it8603)
1867 sio_data->skip_in |= (1 << 9); 1875 sio_data->skip_in |= (1 << 9);
@@ -1962,7 +1970,6 @@ static int __init it87_find(unsigned short *address,
1962 sio_data->skip_in |= (1 << 5); /* No VIN5 */ 1970 sio_data->skip_in |= (1 << 5); /* No VIN5 */
1963 sio_data->skip_in |= (1 << 6); /* No VIN6 */ 1971 sio_data->skip_in |= (1 << 6); /* No VIN6 */
1964 1972
1965 sio_data->internal |= (1 << 1); /* in7 is VSB */
1966 sio_data->internal |= (1 << 3); /* in9 is AVCC */ 1973 sio_data->internal |= (1 << 3); /* in9 is AVCC */
1967 1974
1968 sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f; 1975 sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
@@ -2023,9 +2030,7 @@ static int __init it87_find(unsigned short *address,
2023 } 2030 }
2024 if (reg & (1 << 0)) 2031 if (reg & (1 << 0))
2025 sio_data->internal |= (1 << 0); 2032 sio_data->internal |= (1 << 0);
2026 if ((reg & (1 << 1)) || sio_data->type == it8721 || 2033 if (reg & (1 << 1))
2027 sio_data->type == it8728 || sio_data->type == it8771 ||
2028 sio_data->type == it8772 || sio_data->type == it8786)
2029 sio_data->internal |= (1 << 1); 2034 sio_data->internal |= (1 << 1);
2030 2035
2031 /* 2036 /*