aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorMartin Peres <martin.peres@labri.fr>2014-02-18 19:04:56 -0500
committerBen Skeggs <bskeggs@redhat.com>2014-03-26 00:08:25 -0400
commit0e994d645627bb67088ae4860e9a0295b123f7b0 (patch)
treed5a71622d95557e7fe8f84ca4b461a6b0c09a909 /drivers/gpu
parent9c9191aaf844e237c025ef574e13d3e1c174c765 (diff)
drm/nouveau/therm: let the vbios decide on the automatic fan management mode
This should fix automatic fan management on fermi cards who do not have 0x46 entries in the thermal table. On my nve6, the blob sets the default linear range from 40°C to 100°C but my nvcf's default values are 40°C to 85°C. Let's keep 85 as a default for everyone. Signed-off-by: Martin Peres <martin.peres@labri.fr> Tested-by: Timothée Ravier <tim@siosm.fr> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/therm.h7
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/therm.c11
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/therm/base.c12
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/therm/fan.c3
4 files changed, 25 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/therm.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/therm.h
index 083541dbe9c8..8dc5051df55d 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/therm.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/therm.h
@@ -31,6 +31,12 @@ struct nouveau_therm_trip_point {
31 int hysteresis; 31 int hysteresis;
32}; 32};
33 33
34enum nvbios_therm_fan_mode {
35 NVBIOS_THERM_FAN_TRIP = 0,
36 NVBIOS_THERM_FAN_LINEAR = 1,
37 NVBIOS_THERM_FAN_OTHER = 2,
38};
39
34struct nvbios_therm_fan { 40struct nvbios_therm_fan {
35 u16 pwm_freq; 41 u16 pwm_freq;
36 42
@@ -40,6 +46,7 @@ struct nvbios_therm_fan {
40 u16 bump_period; 46 u16 bump_period;
41 u16 slow_down_period; 47 u16 slow_down_period;
42 48
49 enum nvbios_therm_fan_mode fan_mode;
43 struct nouveau_therm_trip_point trip[NOUVEAU_TEMP_FAN_TRIP_MAX]; 50 struct nouveau_therm_trip_point trip[NOUVEAU_TEMP_FAN_TRIP_MAX];
44 u8 nr_fan_trip; 51 u8 nr_fan_trip;
45 u8 linear_min_temp; 52 u8 linear_min_temp;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/therm.c b/drivers/gpu/drm/nouveau/core/subdev/bios/therm.c
index 22ac6dbd6c8f..d15854094078 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/therm.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/therm.c
@@ -164,6 +164,7 @@ nvbios_therm_fan_parse(struct nouveau_bios *bios,
164 164
165 i = 0; 165 i = 0;
166 fan->nr_fan_trip = 0; 166 fan->nr_fan_trip = 0;
167 fan->fan_mode = NVBIOS_THERM_FAN_OTHER;
167 while ((entry = nvbios_therm_entry(bios, i++, &ver, &len))) { 168 while ((entry = nvbios_therm_entry(bios, i++, &ver, &len))) {
168 s16 value = nv_ro16(bios, entry + 1); 169 s16 value = nv_ro16(bios, entry + 1);
169 170
@@ -174,6 +175,8 @@ nvbios_therm_fan_parse(struct nouveau_bios *bios,
174 break; 175 break;
175 case 0x24: 176 case 0x24:
176 fan->nr_fan_trip++; 177 fan->nr_fan_trip++;
178 if (fan->fan_mode > NVBIOS_THERM_FAN_TRIP)
179 fan->fan_mode = NVBIOS_THERM_FAN_TRIP;
177 cur_trip = &fan->trip[fan->nr_fan_trip - 1]; 180 cur_trip = &fan->trip[fan->nr_fan_trip - 1];
178 cur_trip->hysteresis = value & 0xf; 181 cur_trip->hysteresis = value & 0xf;
179 cur_trip->temp = (value & 0xff0) >> 4; 182 cur_trip->temp = (value & 0xff0) >> 4;
@@ -194,11 +197,19 @@ nvbios_therm_fan_parse(struct nouveau_bios *bios,
194 fan->slow_down_period = value; 197 fan->slow_down_period = value;
195 break; 198 break;
196 case 0x46: 199 case 0x46:
200 if (fan->fan_mode > NVBIOS_THERM_FAN_LINEAR)
201 fan->fan_mode = NVBIOS_THERM_FAN_LINEAR;
197 fan->linear_min_temp = nv_ro08(bios, entry + 1); 202 fan->linear_min_temp = nv_ro08(bios, entry + 1);
198 fan->linear_max_temp = nv_ro08(bios, entry + 2); 203 fan->linear_max_temp = nv_ro08(bios, entry + 2);
199 break; 204 break;
200 } 205 }
201 } 206 }
202 207
208 /* starting from fermi, fan management is always linear */
209 if (nv_device(bios)->card_type >= NV_C0 &&
210 fan->fan_mode == NVBIOS_THERM_FAN_OTHER) {
211 fan->fan_mode = NVBIOS_THERM_FAN_LINEAR;
212 }
213
203 return 0; 214 return 0;
204} 215}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/base.c b/drivers/gpu/drm/nouveau/core/subdev/therm/base.c
index fd1b4606e22b..9ad01da6eacb 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/base.c
@@ -110,16 +110,18 @@ nouveau_therm_update(struct nouveau_therm *therm, int mode)
110 poll = false; 110 poll = false;
111 break; 111 break;
112 case NOUVEAU_THERM_CTRL_AUTO: 112 case NOUVEAU_THERM_CTRL_AUTO:
113 if (priv->fan->bios.nr_fan_trip) { 113 switch(priv->fan->bios.fan_mode) {
114 case NVBIOS_THERM_FAN_TRIP:
114 duty = nouveau_therm_update_trip(therm); 115 duty = nouveau_therm_update_trip(therm);
115 } else 116 break;
116 if (priv->fan->bios.linear_min_temp || 117 case NVBIOS_THERM_FAN_LINEAR:
117 priv->fan->bios.linear_max_temp) {
118 duty = nouveau_therm_update_linear(therm); 118 duty = nouveau_therm_update_linear(therm);
119 } else { 119 break;
120 case NVBIOS_THERM_FAN_OTHER:
120 if (priv->cstate) 121 if (priv->cstate)
121 duty = priv->cstate; 122 duty = priv->cstate;
122 poll = false; 123 poll = false;
124 break;
123 } 125 }
124 immd = false; 126 immd = false;
125 break; 127 break;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c b/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c
index ceb85281cbe9..016990a8252c 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/therm/fan.c
@@ -192,11 +192,8 @@ nouveau_therm_fan_set_defaults(struct nouveau_therm *therm)
192 priv->fan->bios.max_duty = 100; 192 priv->fan->bios.max_duty = 100;
193 priv->fan->bios.bump_period = 500; 193 priv->fan->bios.bump_period = 500;
194 priv->fan->bios.slow_down_period = 2000; 194 priv->fan->bios.slow_down_period = 2000;
195/*XXX: talk to mupuf */
196#if 0
197 priv->fan->bios.linear_min_temp = 40; 195 priv->fan->bios.linear_min_temp = 40;
198 priv->fan->bios.linear_max_temp = 85; 196 priv->fan->bios.linear_max_temp = 85;
199#endif
200} 197}
201 198
202static void 199static void