]> git.sur5r.net Git - groeck-nct6775/commitdiff
nct6775: Don't report VID if not supported
authorGuenter Roeck <linux@roeck-us.net>
Tue, 26 Feb 2013 07:18:12 +0000 (23:18 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 26 Feb 2013 07:18:12 +0000 (23:18 -0800)
VID support is configured with CR2a on NCT6775 and NCT6776, so we can detect
if it is enabled. NCT6779 does not support VID at all.

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

index 955c7fbdb1bc960481f74b86bf223b3cae581120..8ac2477b7943b3f75d21f81afd3318a76436e79f 100644 (file)
--- a/nct6775.c
+++ b/nct6775.c
@@ -3401,6 +3401,8 @@ static int nct6775_probe(struct platform_device *pdev)
        const u16 *reg_temp, *reg_temp_over, *reg_temp_hyst, *reg_temp_config;
        const u16 *reg_temp_alternate, *reg_temp_crit;
        int num_reg_temp;
        const u16 *reg_temp, *reg_temp_over, *reg_temp_hyst, *reg_temp_config;
        const u16 *reg_temp_alternate, *reg_temp_crit;
        int num_reg_temp;
+       bool have_vid = false;
+       u8 cr2a;
 
        res = platform_get_resource(pdev, IORESOURCE_IO, 0);
        if (!devm_request_region(&pdev->dev, res->start, IOREGION_LENGTH,
 
        res = platform_get_resource(pdev, IORESOURCE_IO, 0);
        if (!devm_request_region(&pdev->dev, res->start, IOREGION_LENGTH,
@@ -3769,17 +3771,31 @@ static int nct6775_probe(struct platform_device *pdev)
        /* Initialize the chip */
        nct6775_init_device(data);
 
        /* Initialize the chip */
        nct6775_init_device(data);
 
-       data->vrm = vid_which_vrm();
        err = superio_enter(sio_data->sioreg);
        if (err)
                return err;
 
        err = superio_enter(sio_data->sioreg);
        if (err)
                return err;
 
+       cr2a = superio_inb(sio_data->sioreg, 0x2a);
+       switch (data->kind) {
+       case nct6775:
+               have_vid = (cr2a & 0x40);
+               break;
+       case nct6776:
+               have_vid = (cr2a & 0x60) == 0x40;
+               break;
+       case nct6779:
+               break;
+       }
+
        /*
         * Read VID value
         * We can get the VID input values directly at logical device D 0xe3.
         */
        /*
         * Read VID value
         * We can get the VID input values directly at logical device D 0xe3.
         */
-       superio_select(sio_data->sioreg, NCT6775_LD_VID);
-       data->vid = superio_inb(sio_data->sioreg, 0xe3);
+       if (have_vid) {
+               superio_select(sio_data->sioreg, NCT6775_LD_VID);
+               data->vid = superio_inb(sio_data->sioreg, 0xe3);
+               data->vrm = vid_which_vrm();
+       }
 
        if (fan_debounce) {
                u8 tmp;
 
        if (fan_debounce) {
                u8 tmp;
@@ -3804,9 +3820,11 @@ static int nct6775_probe(struct platform_device *pdev)
 
        superio_exit(sio_data->sioreg);
 
 
        superio_exit(sio_data->sioreg);
 
-       err = device_create_file(dev, &dev_attr_cpu0_vid);
-       if (err)
-               return err;
+       if (have_vid) {
+               err = device_create_file(dev, &dev_attr_cpu0_vid);
+               if (err)
+                       return err;
+       }
 
        err = nct6775_check_fan_inputs(sio_data, data);
        if (err)
 
        err = nct6775_check_fan_inputs(sio_data, data);
        if (err)