Commit bc6389e4 authored by Martin Peres's avatar Martin Peres Committed by Ben Skeggs

drm/nouveau/pm: restore fan speed after suspend

Signed-off-by: default avatarMartin Peres <martin.peres@labri.fr>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent ddb20055
...@@ -519,6 +519,7 @@ struct nouveau_pm_memtimings { ...@@ -519,6 +519,7 @@ struct nouveau_pm_memtimings {
}; };
struct nouveau_pm_fan { struct nouveau_pm_fan {
u32 percent;
u32 min_duty; u32 min_duty;
u32 max_duty; u32 max_duty;
u32 pwm_freq; u32 pwm_freq;
......
...@@ -89,7 +89,10 @@ nouveau_pwmfan_set(struct drm_device *dev, int percent) ...@@ -89,7 +89,10 @@ nouveau_pwmfan_set(struct drm_device *dev, int percent)
if (dev_priv->card_type <= NV_40 || (gpio.log[0] & 1)) if (dev_priv->card_type <= NV_40 || (gpio.log[0] & 1))
duty = divs - duty; duty = divs - duty;
return pm->pwm_set(dev, gpio.line, divs, duty); ret = pm->pwm_set(dev, gpio.line, divs, duty);
if (!ret)
pm->fan.percent = percent;
return ret;
} }
return -ENODEV; return -ENODEV;
...@@ -800,6 +803,9 @@ nouveau_pm_init(struct drm_device *dev) ...@@ -800,6 +803,9 @@ nouveau_pm_init(struct drm_device *dev)
} }
} }
/* determine the current fan speed */
pm->fan.percent = nouveau_pwmfan_get(dev);
nouveau_sysfs_init(dev); nouveau_sysfs_init(dev);
nouveau_hwmon_init(dev); nouveau_hwmon_init(dev);
#if defined(CONFIG_ACPI) && defined(CONFIG_POWER_SUPPLY) #if defined(CONFIG_ACPI) && defined(CONFIG_POWER_SUPPLY)
...@@ -844,4 +850,5 @@ nouveau_pm_resume(struct drm_device *dev) ...@@ -844,4 +850,5 @@ nouveau_pm_resume(struct drm_device *dev)
perflvl = pm->cur; perflvl = pm->cur;
pm->cur = &pm->boot; pm->cur = &pm->boot;
nouveau_pm_perflvl_set(dev, perflvl); nouveau_pm_perflvl_set(dev, perflvl);
nouveau_pwmfan_set(dev, pm->fan.percent);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment