aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_temp.c
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2010-09-23 15:00:40 -0400
committerBen Skeggs <bskeggs@redhat.com>2010-09-24 02:29:36 -0400
commit66146da06643d8ee89bc5255fb0254006e3d0e79 (patch)
tree7cc84d257544047bacb3aa618dd39ab7fc20180c /drivers/gpu/drm/nouveau/nouveau_temp.c
parent8155cac489eb8cc6fd96b9bdefacdf5a56e6ea32 (diff)
drm/nouveau: Add support for I2C hardware monitoring devices.
Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_temp.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_temp.c48
1 files changed, 45 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_temp.c b/drivers/gpu/drm/nouveau/nouveau_temp.c
index 2f7785ca4e48..f9eda87d1773 100644
--- a/drivers/gpu/drm/nouveau/nouveau_temp.c
+++ b/drivers/gpu/drm/nouveau/nouveau_temp.c
@@ -235,6 +235,48 @@ nouveau_temp_safety_checks(struct drm_device *dev)
235 temps->fan_boost = 40; 235 temps->fan_boost = 40;
236} 236}
237 237
238static bool
239probe_monitoring_device(struct nouveau_i2c_chan *i2c,
240 struct i2c_board_info *info)
241{
242 char modalias[16] = "i2c:";
243 struct i2c_client *client;
244
245 strlcat(modalias, info->type, sizeof(modalias));
246 request_module(modalias);
247
248 client = i2c_new_device(&i2c->adapter, info);
249 if (!client)
250 return false;
251
252 if (!client->driver || client->driver->detect(client, info)) {
253 i2c_unregister_device(client);
254 return false;
255 }
256
257 return true;
258}
259
260static void
261nouveau_temp_probe_i2c(struct drm_device *dev)
262{
263 struct drm_nouveau_private *dev_priv = dev->dev_private;
264 struct dcb_table *dcb = &dev_priv->vbios.dcb;
265 struct i2c_board_info info[] = {
266 { I2C_BOARD_INFO("w83l785ts", 0x2d) },
267 { I2C_BOARD_INFO("w83781d", 0x2d) },
268 { I2C_BOARD_INFO("f75375", 0x2e) },
269 { I2C_BOARD_INFO("adt7473", 0x2e) },
270 { I2C_BOARD_INFO("lm99", 0x4c) },
271 { }
272 };
273 int idx = (dcb->version >= 0x40 ?
274 dcb->i2c_default_indices & 0xf : 2);
275
276 nouveau_i2c_identify(dev, "monitoring device", info,
277 probe_monitoring_device, idx);
278}
279
238void 280void
239nouveau_temp_init(struct drm_device *dev) 281nouveau_temp_init(struct drm_device *dev)
240{ 282{
@@ -253,11 +295,11 @@ nouveau_temp_init(struct drm_device *dev)
253 temp = ROMPTR(bios, P.data[16]); 295 temp = ROMPTR(bios, P.data[16]);
254 else 296 else
255 NV_WARN(dev, "unknown temp for BIT P %d\n", P.version); 297 NV_WARN(dev, "unknown temp for BIT P %d\n", P.version);
256 } else { 298
257 NV_WARN(dev, "BMP entry unknown for temperature table.\n"); 299 nouveau_temp_vbios_parse(dev, temp);
258 } 300 }
259 301
260 nouveau_temp_vbios_parse(dev, temp); 302 nouveau_temp_probe_i2c(dev);
261} 303}
262 304
263void 305void