--- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c @@ -46,6 +46,10 @@ MODULE_PARM_DESC(perflvl_wr, "Allow perf static int nouveau_perflvl_wr; module_param_named(perflvl_wr, nouveau_perflvl_wr, int, 0400); +MODULE_PARM_DESC(therm_fan_mode_auto, "Allow thermal fan mode changes (warning: dangerous!)"); +static int nouveau_therm_fan_mode_auto; +module_param_named(therm_fan_mode_auto, nouveau_therm_fan_mode_auto, int, 0400); + static int nouveau_pm_perflvl_aux(struct drm_device *dev, struct nouveau_pm_level *perflvl, struct nouveau_pm_level *a, struct nouveau_pm_level *b) @@ -1032,6 +1036,7 @@ nouveau_pm_init(struct drm_device *dev) { struct nouveau_device *device = nouveau_dev(dev); struct nouveau_drm *drm = nouveau_drm(dev); + struct nouveau_therm *therm = nouveau_therm(drm->device); struct nouveau_pm *pm; char info[256]; int ret, i; @@ -1129,6 +1134,15 @@ nouveau_pm_init(struct drm_device *dev) register_acpi_notifier(&pm->acpi_nb); #endif + if (nouveau_therm_fan_mode_auto) { + if (nouveau_perflvl_wr != 7777) + return -EPERM; + + ret = therm->attr_set(therm, NOUVEAU_THERM_ATTR_FAN_MODE, + NOUVEAU_THERM_CTRL_AUTO); + if (ret) + return ret; + } return 0; }