diff options
author | Martin Peres <martin.peres@labri.fr> | 2012-08-18 16:33:53 +0200 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-10-03 13:13:13 +1000 |
commit | 32334cc03a12c51f64613608a8b261738406e1e2 (patch) | |
tree | 7532a8c9141dc50ee4a135c2af4855ac125b9906 /drivers/gpu/drm/nouveau/nouveau_temp.c | |
parent | 7d70e9c1c69a5d22588ff5977249ac944d7cdfb0 (diff) | |
download | op-kernel-dev-32334cc03a12c51f64613608a8b261738406e1e2.zip op-kernel-dev-32334cc03a12c51f64613608a8b261738406e1e2.tar.gz |
drm/nouveau/therm: use the EXTDEV table to detect i2c monitoring devices
This commit also adds a static list of all known devices and their possible
i2c addresses.
v2: use the common table parsing technique as suggested by darktama
Signed-off-by: Martin Peres <martin.peres@labri.fr>
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.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_temp.c b/drivers/gpu/drm/nouveau/nouveau_temp.c index 5465abf..6d2b957 100644 --- a/drivers/gpu/drm/nouveau/nouveau_temp.c +++ b/drivers/gpu/drm/nouveau/nouveau_temp.c @@ -31,6 +31,7 @@ #include <subdev/i2c.h> #include <subdev/bios/therm.h> +#include <subdev/bios/extdev.h> static int nv40_sensor_setup(struct drm_device *dev) @@ -132,16 +133,58 @@ static void nouveau_temp_probe_i2c(struct drm_device *dev) { struct nouveau_device *device = nouveau_dev(dev); + struct nouveau_bios *bios = nouveau_bios(device); struct nouveau_i2c *i2c = nouveau_i2c(device); + struct nvbios_extdev_func extdev_entry; struct i2c_board_info info[] = { { I2C_BOARD_INFO("w83l785ts", 0x2d) }, { I2C_BOARD_INFO("w83781d", 0x2d) }, { I2C_BOARD_INFO("adt7473", 0x2e) }, + { I2C_BOARD_INFO("adt7473", 0x2d) }, + { I2C_BOARD_INFO("adt7473", 0x2c) }, { I2C_BOARD_INFO("f75375", 0x2e) }, { I2C_BOARD_INFO("lm99", 0x4c) }, + { I2C_BOARD_INFO("lm90", 0x4c) }, + { I2C_BOARD_INFO("lm90", 0x4d) }, + { I2C_BOARD_INFO("adm1021", 0x18) }, + { I2C_BOARD_INFO("adm1021", 0x19) }, + { I2C_BOARD_INFO("adm1021", 0x1a) }, + { I2C_BOARD_INFO("adm1021", 0x29) }, + { I2C_BOARD_INFO("adm1021", 0x2a) }, + { I2C_BOARD_INFO("adm1021", 0x2b) }, + { I2C_BOARD_INFO("adm1021", 0x4c) }, + { I2C_BOARD_INFO("adm1021", 0x4d) }, + { I2C_BOARD_INFO("adm1021", 0x4e) }, + { I2C_BOARD_INFO("lm63", 0x18) }, + { I2C_BOARD_INFO("lm63", 0x4e) }, { } }; + if (!nvbios_extdev_find(bios, NVBIOS_EXTDEV_LM89, &extdev_entry)) { + struct i2c_board_info board[] = { + { I2C_BOARD_INFO("lm90", extdev_entry.addr >> 1) }, + { } + }; + + if (i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device", + board, probe_monitoring_device)) + return; + } + + if (!nvbios_extdev_find(bios, NVBIOS_EXTDEV_ADT7473, &extdev_entry)) { + struct i2c_board_info board[] = { + { I2C_BOARD_INFO("adt7473", extdev_entry.addr >> 1) }, + { } + }; + + if (i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device", + board, probe_monitoring_device)) + return; + } + + /* The vbios doesn't provide the address of an exisiting monitoring + device. Let's try our static list. + */ i2c->identify(i2c, NV_I2C_DEFAULT(0), "monitoring device", info, probe_monitoring_device); } |