This source file includes following definitions.
- probe_monitoring_device
- nvkm_therm_ic_ctor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include "priv.h"
25
26 #include <subdev/bios/extdev.h>
27 #include <subdev/i2c.h>
28
29 static bool
30 probe_monitoring_device(struct nvkm_i2c_bus *bus,
31 struct i2c_board_info *info, void *data)
32 {
33 struct nvkm_therm *therm = data;
34 struct nvbios_therm_sensor *sensor = &therm->bios_sensor;
35 struct i2c_client *client;
36
37 request_module("%s%s", I2C_MODULE_PREFIX, info->type);
38
39 client = i2c_new_device(&bus->i2c, info);
40 if (!client)
41 return false;
42
43 if (!client->dev.driver ||
44 to_i2c_driver(client->dev.driver)->detect(client, info)) {
45 i2c_unregister_device(client);
46 return false;
47 }
48
49 nvkm_debug(&therm->subdev,
50 "Found an %s at address 0x%x (controlled by lm_sensors, "
51 "temp offset %+i C)\n",
52 info->type, info->addr, sensor->offset_constant);
53 therm->ic = client;
54 return true;
55 }
56
57 static struct nvkm_i2c_bus_probe
58 nv_board_infos[] = {
59 { { I2C_BOARD_INFO("w83l785ts", 0x2d) }, 0 },
60 { { I2C_BOARD_INFO("w83781d", 0x2d) }, 0 },
61 { { I2C_BOARD_INFO("adt7473", 0x2e) }, 40 },
62 { { I2C_BOARD_INFO("adt7473", 0x2d) }, 40 },
63 { { I2C_BOARD_INFO("adt7473", 0x2c) }, 40 },
64 { { I2C_BOARD_INFO("f75375", 0x2e) }, 0 },
65 { { I2C_BOARD_INFO("lm99", 0x4c) }, 0 },
66 { { I2C_BOARD_INFO("lm90", 0x4c) }, 0 },
67 { { I2C_BOARD_INFO("lm90", 0x4d) }, 0 },
68 { { I2C_BOARD_INFO("adm1021", 0x18) }, 0 },
69 { { I2C_BOARD_INFO("adm1021", 0x19) }, 0 },
70 { { I2C_BOARD_INFO("adm1021", 0x1a) }, 0 },
71 { { I2C_BOARD_INFO("adm1021", 0x29) }, 0 },
72 { { I2C_BOARD_INFO("adm1021", 0x2a) }, 0 },
73 { { I2C_BOARD_INFO("adm1021", 0x2b) }, 0 },
74 { { I2C_BOARD_INFO("adm1021", 0x4c) }, 0 },
75 { { I2C_BOARD_INFO("adm1021", 0x4d) }, 0 },
76 { { I2C_BOARD_INFO("adm1021", 0x4e) }, 0 },
77 { { I2C_BOARD_INFO("lm63", 0x18) }, 0 },
78 { { I2C_BOARD_INFO("lm63", 0x4e) }, 0 },
79 { }
80 };
81
82 void
83 nvkm_therm_ic_ctor(struct nvkm_therm *therm)
84 {
85 struct nvkm_device *device = therm->subdev.device;
86 struct nvkm_bios *bios = device->bios;
87 struct nvkm_i2c *i2c = device->i2c;
88 struct nvkm_i2c_bus *bus;
89 struct nvbios_extdev_func extdev_entry;
90
91 bus = nvkm_i2c_bus_find(i2c, NVKM_I2C_BUS_PRI);
92 if (!bus)
93 return;
94
95 if (!nvbios_extdev_find(bios, NVBIOS_EXTDEV_LM89, &extdev_entry)) {
96 struct nvkm_i2c_bus_probe board[] = {
97 { { I2C_BOARD_INFO("lm90", extdev_entry.addr >> 1) }, 0},
98 { }
99 };
100
101 nvkm_i2c_bus_probe(bus, "monitoring device", board,
102 probe_monitoring_device, therm);
103 if (therm->ic)
104 return;
105 }
106
107 if (!nvbios_extdev_find(bios, NVBIOS_EXTDEV_ADT7473, &extdev_entry)) {
108 struct nvkm_i2c_bus_probe board[] = {
109 { { I2C_BOARD_INFO("adt7473", extdev_entry.addr >> 1) }, 20 },
110 { }
111 };
112
113 nvkm_i2c_bus_probe(bus, "monitoring device", board,
114 probe_monitoring_device, therm);
115 if (therm->ic)
116 return;
117 }
118
119 if (nvbios_extdev_skip_probe(bios))
120 return;
121
122
123
124
125 nvkm_i2c_bus_probe(bus, "monitoring device", nv_board_infos,
126 probe_monitoring_device, therm);
127 }