aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2015-02-12 10:40:23 -0500
committerGuenter Roeck <linux@roeck-us.net>2015-03-09 12:59:36 -0400
commit32dd7c409d52655c4ab68be8e0cdd0985c3fa138 (patch)
treec20a5ecd826275cf3d14a508848636e3cba11866 /drivers/hwmon
parent9faf28ca4beb24cd5a01f38c5655f5ae92d834ba (diff)
hwmon: (it87) Add feature flag for VID support
Newer chips don't typically support VID inputs or control. Add a feature flag for VID support to simplify adding support for new chips. Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/it87.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 48b48939d893..9ca10a73aee8 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -254,6 +254,7 @@ struct it87_devices {
254#define FEAT_TEMP_OLD_PECI (1 << 6) 254#define FEAT_TEMP_OLD_PECI (1 << 6)
255#define FEAT_FAN16_CONFIG (1 << 7) /* Need to enable 16-bit fans */ 255#define FEAT_FAN16_CONFIG (1 << 7) /* Need to enable 16-bit fans */
256#define FEAT_FIVE_FANS (1 << 8) /* Supports five fans */ 256#define FEAT_FIVE_FANS (1 << 8) /* Supports five fans */
257#define FEAT_VID (1 << 9) /* Set if chip supports VID */
257 258
258static const struct it87_devices it87_devices[] = { 259static const struct it87_devices it87_devices[] = {
259 [it87] = { 260 [it87] = {
@@ -262,22 +263,23 @@ static const struct it87_devices it87_devices[] = {
262 }, 263 },
263 [it8712] = { 264 [it8712] = {
264 .name = "it8712", 265 .name = "it8712",
265 .features = FEAT_OLD_AUTOPWM, /* may need to overwrite */ 266 .features = FEAT_OLD_AUTOPWM | FEAT_VID,
267 /* may need to overwrite */
266 }, 268 },
267 [it8716] = { 269 [it8716] = {
268 .name = "it8716", 270 .name = "it8716",
269 .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET 271 .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_VID
270 | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS, 272 | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS,
271 }, 273 },
272 [it8718] = { 274 [it8718] = {
273 .name = "it8718", 275 .name = "it8718",
274 .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET 276 .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_VID
275 | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS, 277 | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS,
276 .old_peci_mask = 0x4, 278 .old_peci_mask = 0x4,
277 }, 279 },
278 [it8720] = { 280 [it8720] = {
279 .name = "it8720", 281 .name = "it8720",
280 .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET 282 .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_VID
281 | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS, 283 | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS,
282 .old_peci_mask = 0x4, 284 .old_peci_mask = 0x4,
283 }, 285 },
@@ -353,6 +355,7 @@ static const struct it87_devices it87_devices[] = {
353 ((data)->old_peci_mask & (1 << nr))) 355 ((data)->old_peci_mask & (1 << nr)))
354#define has_fan16_config(data) ((data)->features & FEAT_FAN16_CONFIG) 356#define has_fan16_config(data) ((data)->features & FEAT_FAN16_CONFIG)
355#define has_five_fans(data) ((data)->features & FEAT_FIVE_FANS) 357#define has_five_fans(data) ((data)->features & FEAT_FIVE_FANS)
358#define has_vid(data) ((data)->features & FEAT_VID)
356 359
357struct it87_sio_data { 360struct it87_sio_data {
358 enum chips type; 361 enum chips type;
@@ -1822,19 +1825,17 @@ static int __init it87_find(unsigned short *address,
1822 if (sio_data->type != it8603) 1825 if (sio_data->type != it8603)
1823 sio_data->skip_in |= (1 << 9); 1826 sio_data->skip_in |= (1 << 9);
1824 1827
1825 /* Read GPIO config and VID value from LDN 7 (GPIO) */ 1828 if (!(it87_devices[sio_data->type].features & FEAT_VID))
1826 if (sio_data->type == it87) {
1827 /* The IT8705F doesn't have VID pins at all */
1828 sio_data->skip_vid = 1; 1829 sio_data->skip_vid = 1;
1829 1830
1831 /* Read GPIO config and VID value from LDN 7 (GPIO) */
1832 if (sio_data->type == it87) {
1830 /* The IT8705F has a different LD number for GPIO */ 1833 /* The IT8705F has a different LD number for GPIO */
1831 superio_select(5); 1834 superio_select(5);
1832 sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f; 1835 sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
1833 } else if (sio_data->type == it8783) { 1836 } else if (sio_data->type == it8783) {
1834 int reg25, reg27, reg2a, reg2c, regef; 1837 int reg25, reg27, reg2a, reg2c, regef;
1835 1838
1836 sio_data->skip_vid = 1; /* No VID */
1837
1838 superio_select(GPIO); 1839 superio_select(GPIO);
1839 1840
1840 reg25 = superio_inb(IT87_SIO_GPIO1_REG); 1841 reg25 = superio_inb(IT87_SIO_GPIO1_REG);
@@ -1900,7 +1901,6 @@ static int __init it87_find(unsigned short *address,
1900 } else if (sio_data->type == it8603) { 1901 } else if (sio_data->type == it8603) {
1901 int reg27, reg29; 1902 int reg27, reg29;
1902 1903
1903 sio_data->skip_vid = 1; /* No VID */
1904 superio_select(GPIO); 1904 superio_select(GPIO);
1905 1905
1906 reg27 = superio_inb(IT87_SIO_GPIO3_REG); 1906 reg27 = superio_inb(IT87_SIO_GPIO3_REG);
@@ -1936,16 +1936,7 @@ static int __init it87_find(unsigned short *address,
1936 superio_select(GPIO); 1936 superio_select(GPIO);
1937 1937
1938 reg = superio_inb(IT87_SIO_GPIO3_REG); 1938 reg = superio_inb(IT87_SIO_GPIO3_REG);
1939 if (sio_data->type == it8721 || sio_data->type == it8728 || 1939 if (!sio_data->skip_vid) {
1940 sio_data->type == it8771 || sio_data->type == it8772 ||
1941 sio_data->type == it8781 || sio_data->type == it8782) {
1942 /*
1943 * IT8721F/IT8758E, IT8728F, IT8772F, IT8781F, and
1944 * IT8782F don't have VID pins at all, not sure about
1945 * the IT8771F.
1946 */
1947 sio_data->skip_vid = 1;
1948 } else {
1949 /* We need at least 4 VID pins */ 1940 /* We need at least 4 VID pins */
1950 if (reg & 0x0f) { 1941 if (reg & 0x0f) {
1951 pr_info("VID is disabled (pins used for GPIO)\n"); 1942 pr_info("VID is disabled (pins used for GPIO)\n");