aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_temp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_temp.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_temp.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_temp.c b/drivers/gpu/drm/nouveau/nouveau_temp.c
index 5a46446dd5a..0f5a3016055 100644
--- a/drivers/gpu/drm/nouveau/nouveau_temp.c
+++ b/drivers/gpu/drm/nouveau/nouveau_temp.c
@@ -55,6 +55,10 @@ nouveau_temp_vbios_parse(struct drm_device *dev, u8 *temp)
55 temps->down_clock = 100; 55 temps->down_clock = 100;
56 temps->fan_boost = 90; 56 temps->fan_boost = 90;
57 57
58 /* Set the default range for the pwm fan */
59 pm->fan.min_duty = 30;
60 pm->fan.max_duty = 100;
61
58 /* Set the known default values to setup the temperature sensor */ 62 /* Set the known default values to setup the temperature sensor */
59 if (dev_priv->card_type >= NV_40) { 63 if (dev_priv->card_type >= NV_40) {
60 switch (dev_priv->chipset) { 64 switch (dev_priv->chipset) {
@@ -156,11 +160,26 @@ nouveau_temp_vbios_parse(struct drm_device *dev, u8 *temp)
156 case 0x13: 160 case 0x13:
157 sensor->slope_div = value; 161 sensor->slope_div = value;
158 break; 162 break;
163 case 0x22:
164 pm->fan.min_duty = value & 0xff;
165 pm->fan.max_duty = (value & 0xff00) >> 8;
166 break;
167 case 0x26:
168 pm->fan.pwm_freq = value;
169 break;
159 } 170 }
160 temp += recordlen; 171 temp += recordlen;
161 } 172 }
162 173
163 nouveau_temp_safety_checks(dev); 174 nouveau_temp_safety_checks(dev);
175
176 /* check the fan min/max settings */
177 if (pm->fan.min_duty < 10)
178 pm->fan.min_duty = 10;
179 if (pm->fan.max_duty > 100)
180 pm->fan.max_duty = 100;
181 if (pm->fan.max_duty < pm->fan.min_duty)
182 pm->fan.max_duty = pm->fan.min_duty;
164} 183}
165 184
166static int 185static int
@@ -267,8 +286,6 @@ probe_monitoring_device(struct nouveau_i2c_chan *i2c,
267static void 286static void
268nouveau_temp_probe_i2c(struct drm_device *dev) 287nouveau_temp_probe_i2c(struct drm_device *dev)
269{ 288{
270 struct drm_nouveau_private *dev_priv = dev->dev_private;
271 struct dcb_table *dcb = &dev_priv->vbios.dcb;
272 struct i2c_board_info info[] = { 289 struct i2c_board_info info[] = {
273 { I2C_BOARD_INFO("w83l785ts", 0x2d) }, 290 { I2C_BOARD_INFO("w83l785ts", 0x2d) },
274 { I2C_BOARD_INFO("w83781d", 0x2d) }, 291 { I2C_BOARD_INFO("w83781d", 0x2d) },
@@ -277,11 +294,9 @@ nouveau_temp_probe_i2c(struct drm_device *dev)
277 { I2C_BOARD_INFO("lm99", 0x4c) }, 294 { I2C_BOARD_INFO("lm99", 0x4c) },
278 { } 295 { }
279 }; 296 };
280 int idx = (dcb->version >= 0x40 ?
281 dcb->i2c_default_indices & 0xf : 2);
282 297
283 nouveau_i2c_identify(dev, "monitoring device", info, 298 nouveau_i2c_identify(dev, "monitoring device", info,
284 probe_monitoring_device, idx); 299 probe_monitoring_device, NV_I2C_DEFAULT(0));
285} 300}
286 301
287void 302void
@@ -297,9 +312,9 @@ nouveau_temp_init(struct drm_device *dev)
297 return; 312 return;
298 313
299 if (P.version == 1) 314 if (P.version == 1)
300 temp = ROMPTR(bios, P.data[12]); 315 temp = ROMPTR(dev, P.data[12]);
301 else if (P.version == 2) 316 else if (P.version == 2)
302 temp = ROMPTR(bios, P.data[16]); 317 temp = ROMPTR(dev, P.data[16]);
303 else 318 else
304 NV_WARN(dev, "unknown temp for BIT P %d\n", P.version); 319 NV_WARN(dev, "unknown temp for BIT P %d\n", P.version);
305 320