]> git.sur5r.net Git - groeck-it87/commitdiff
Add feature flag for VID support
authorGuenter Roeck <linux@roeck-us.net>
Thu, 12 Feb 2015 18:44:26 +0000 (10:44 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 12 Feb 2015 18:44:26 +0000 (10:44 -0800)
Newer chips don't typically support VID inputs or control.
Add a feature flag for VID support to simplify adding support
for new chips.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
it87.c

diff --git a/it87.c b/it87.c
index ce689ae7698debe468a41f9f0402655db35d07b4..7b0a7a6f1976497c48bb9468898cec5cb004ade8 100644 (file)
--- a/it87.c
+++ b/it87.c
@@ -255,6 +255,7 @@ struct it87_devices {
 #define FEAT_TEMP_OLD_PECI     (1 << 6)
 #define FEAT_FAN16_CONFIG      (1 << 7)        /* Need to enable 16-bit fans */
 #define FEAT_FIVE_FANS         (1 << 8)        /* Supports five fans */
+#define FEAT_VID               (1 << 9)        /* Set if chip supports VID */
 
 static const struct it87_devices it87_devices[] = {
        [it87] = {
@@ -264,23 +265,23 @@ static const struct it87_devices it87_devices[] = {
        },
        [it8712] = {
                .name = "it8712",
-               .features = FEAT_OLD_AUTOPWM | FEAT_FAN16_CONFIG,
+               .features = FEAT_OLD_AUTOPWM | FEAT_FAN16_CONFIG | FEAT_VID,
                                                /* may need to overwrite */
        },
        [it8716] = {
                .name = "it8716",
-               .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET
+               .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_VID
                  | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS,
        },
        [it8718] = {
                .name = "it8718",
-               .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET
+               .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_VID
                  | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS,
                .old_peci_mask = 0x4,
        },
        [it8720] = {
                .name = "it8720",
-               .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET
+               .features = FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_VID
                  | FEAT_TEMP_OLD_PECI | FEAT_FAN16_CONFIG | FEAT_FIVE_FANS,
                .old_peci_mask = 0x4,
        },
@@ -357,6 +358,7 @@ static const struct it87_devices it87_devices[] = {
 #define has_fan16_config(data) (has_16bit_fans(data) && \
                                 ((data)->features & FEAT_FAN16_CONFIG))
 #define has_five_fans(data)    ((data)->features & FEAT_FIVE_FANS)
+#define has_vid(data)          ((data)->features & FEAT_VID)
 
 struct it87_sio_data {
        enum chips type;
@@ -1826,19 +1828,17 @@ static int __init it87_find(unsigned short *address,
        if (sio_data->type != it8603)
                sio_data->skip_in |= (1 << 9);
 
-       /* Read GPIO config and VID value from LDN 7 (GPIO) */
-       if (sio_data->type == it87) {
-               /* The IT8705F doesn't have VID pins at all */
+       if (!(it87_devices[sio_data->type].features & FEAT_VID))
                sio_data->skip_vid = 1;
 
+       /* Read GPIO config and VID value from LDN 7 (GPIO) */
+       if (sio_data->type == it87) {
                /* The IT8705F has a different LD number for GPIO */
                superio_select(5);
                sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
        } else if (sio_data->type == it8783) {
                int reg25, reg27, reg2a, reg2c, regef;
 
-               sio_data->skip_vid = 1; /* No VID */
-
                superio_select(GPIO);
 
                reg25 = superio_inb(IT87_SIO_GPIO1_REG);
@@ -1904,7 +1904,6 @@ static int __init it87_find(unsigned short *address,
        } else if (sio_data->type == it8603) {
                int reg27, reg29;
 
-               sio_data->skip_vid = 1; /* No VID */
                superio_select(GPIO);
 
                reg27 = superio_inb(IT87_SIO_GPIO3_REG);
@@ -1940,16 +1939,7 @@ static int __init it87_find(unsigned short *address,
                superio_select(GPIO);
 
                reg = superio_inb(IT87_SIO_GPIO3_REG);
-               if (sio_data->type == it8721 || sio_data->type == it8728 ||
-                   sio_data->type == it8771 || sio_data->type == it8772 ||
-                   sio_data->type == it8781 || sio_data->type == it8782) {
-                       /*
-                        * IT8721F/IT8758E, IT8728F, IT8772F, IT8781F, and
-                        * IT8782F don't have VID pins at all, not sure about
-                        * the IT8771F.
-                        */
-                       sio_data->skip_vid = 1;
-               } else {
+               if (!sio_data->skip_vid) {
                        /* We need at least 4 VID pins */
                        if (reg & 0x0f) {
                                pr_info("VID is disabled (pins used for GPIO)\n");
@@ -1970,8 +1960,7 @@ static int __init it87_find(unsigned short *address,
                if (reg & (1 << 2))
                        sio_data->skip_fan |= (1 << 1);
 
-               if ((sio_data->type == it8718 || sio_data->type == it8720)
-                && !(sio_data->skip_vid))
+               if (!sio_data->skip_vid)
                        sio_data->vid_value = superio_inb(IT87_SIO_VID_REG);
 
                reg = superio_inb(IT87_SIO_PINX2_REG);