diff options
author | Guenter Roeck <linux@roeck-us.net> | 2013-02-26 12:43:50 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2013-04-08 00:16:39 -0400 |
commit | 0fc1f8fc614ca0fef78011b34ef8da638eb9acea (patch) | |
tree | 0b2d445ac896a8b21a34c262ce637a7a9410ffee | |
parent | 8e9285b0bb2ab48924032147baa29699c0bbee7c (diff) |
hwmon: (nct6775) Only report VID if supported and enabled
VID is not always enabled (NCT6775, NCT6776) or supported (NCT6779).
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/nct6775.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c index 6d5859718113..752fbd7efb32 100644 --- a/drivers/hwmon/nct6775.c +++ b/drivers/hwmon/nct6775.c | |||
@@ -3401,6 +3401,8 @@ static int nct6775_probe(struct platform_device *pdev) | |||
3401 | const u16 *reg_temp, *reg_temp_over, *reg_temp_hyst, *reg_temp_config; | 3401 | const u16 *reg_temp, *reg_temp_over, *reg_temp_hyst, *reg_temp_config; |
3402 | const u16 *reg_temp_alternate, *reg_temp_crit; | 3402 | const u16 *reg_temp_alternate, *reg_temp_crit; |
3403 | int num_reg_temp; | 3403 | int num_reg_temp; |
3404 | bool have_vid = false; | ||
3405 | u8 cr2a; | ||
3404 | 3406 | ||
3405 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 3407 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
3406 | if (!devm_request_region(&pdev->dev, res->start, IOREGION_LENGTH, | 3408 | if (!devm_request_region(&pdev->dev, res->start, IOREGION_LENGTH, |
@@ -3769,17 +3771,31 @@ static int nct6775_probe(struct platform_device *pdev) | |||
3769 | /* Initialize the chip */ | 3771 | /* Initialize the chip */ |
3770 | nct6775_init_device(data); | 3772 | nct6775_init_device(data); |
3771 | 3773 | ||
3772 | data->vrm = vid_which_vrm(); | ||
3773 | err = superio_enter(sio_data->sioreg); | 3774 | err = superio_enter(sio_data->sioreg); |
3774 | if (err) | 3775 | if (err) |
3775 | return err; | 3776 | return err; |
3776 | 3777 | ||
3778 | cr2a = superio_inb(sio_data->sioreg, 0x2a); | ||
3779 | switch (data->kind) { | ||
3780 | case nct6775: | ||
3781 | have_vid = (cr2a & 0x40); | ||
3782 | break; | ||
3783 | case nct6776: | ||
3784 | have_vid = (cr2a & 0x60) == 0x40; | ||
3785 | break; | ||
3786 | case nct6779: | ||
3787 | break; | ||
3788 | } | ||
3789 | |||
3777 | /* | 3790 | /* |
3778 | * Read VID value | 3791 | * Read VID value |
3779 | * We can get the VID input values directly at logical device D 0xe3. | 3792 | * We can get the VID input values directly at logical device D 0xe3. |
3780 | */ | 3793 | */ |
3781 | superio_select(sio_data->sioreg, NCT6775_LD_VID); | 3794 | if (have_vid) { |
3782 | data->vid = superio_inb(sio_data->sioreg, 0xe3); | 3795 | superio_select(sio_data->sioreg, NCT6775_LD_VID); |
3796 | data->vid = superio_inb(sio_data->sioreg, 0xe3); | ||
3797 | data->vrm = vid_which_vrm(); | ||
3798 | } | ||
3783 | 3799 | ||
3784 | if (fan_debounce) { | 3800 | if (fan_debounce) { |
3785 | u8 tmp; | 3801 | u8 tmp; |
@@ -3804,9 +3820,11 @@ static int nct6775_probe(struct platform_device *pdev) | |||
3804 | 3820 | ||
3805 | superio_exit(sio_data->sioreg); | 3821 | superio_exit(sio_data->sioreg); |
3806 | 3822 | ||
3807 | err = device_create_file(dev, &dev_attr_cpu0_vid); | 3823 | if (have_vid) { |
3808 | if (err) | 3824 | err = device_create_file(dev, &dev_attr_cpu0_vid); |
3809 | return err; | 3825 | if (err) |
3826 | return err; | ||
3827 | } | ||
3810 | 3828 | ||
3811 | err = nct6775_check_fan_inputs(sio_data, data); | 3829 | err = nct6775_check_fan_inputs(sio_data, data); |
3812 | if (err) | 3830 | if (err) |