]> git.sur5r.net Git - groeck-nct6775/commitdiff
Re-enable logical device mapping for NCT6791 after restore
authorGuenter Roeck <linux@roeck-us.net>
Mon, 23 Dec 2013 12:42:20 +0000 (04:42 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 23 Dec 2013 12:43:30 +0000 (04:43 -0800)
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
nct6775.c

index ee3ba04318fc2bdc42f312de2179a71a31060398..caa972d7ff16d408b393cc5e5c136b6efde26ad1 100644 (file)
--- a/nct6775.c
+++ b/nct6775.c
@@ -4016,11 +4016,29 @@ static int nct6775_suspend(struct device *dev)
 static int nct6775_resume(struct device *dev)
 {
        struct nct6775_data *data = dev_get_drvdata(dev);
-       int i, j;
+       int i, j, err = 0;
 
        mutex_lock(&data->update_lock);
        data->bank = 0xff;              /* Force initial bank selection */
 
+       if (data->kind == nct6791) {
+               int val;
+
+               err = superio_enter(data->sioreg);
+               if (err)
+                       goto abort;
+
+               val = superio_inb(data->sioreg,
+                                 NCT6791_REG_HM_IO_SPACE_LOCK_ENABLE);
+               if (val & 0x10) {
+                       pr_info("Re-enabling hardware monitor logical device mappings.\n");
+                       superio_outb(data->sioreg,
+                                    NCT6791_REG_HM_IO_SPACE_LOCK_ENABLE,
+                                    val & ~0x10);
+               }
+               superio_exit(data->sioreg);
+       }
+
        /* Restore limits */
        for (i = 0; i < data->in_num; i++) {
                if (!(data->have_in & (1 << i)))
@@ -4057,6 +4075,7 @@ static int nct6775_resume(struct device *dev)
                nct6775_write_value(data, NCT6775_REG_FANDIV2, data->fandiv2);
        }
 
+abort:
        /* Force re-reading all values */
        data->valid = false;
        mutex_unlock(&data->update_lock);