152
static struct of_device * of_dev;
151
static struct platform_device * of_dev;
153
152
static struct i2c_adapter * u3_0;
154
153
static struct i2c_adapter * u3_1;
155
154
static struct i2c_adapter * k2;
948
947
printk(KERN_WARNING "Warning ! Temperature way above maximum (%d) !\n",
949
948
temp_combi >> 16);
950
949
state0->overtemp += CPU_MAX_OVERTEMP / 4;
951
} else if (temp_combi > (state0->mpu.tmax << 16))
950
} else if (temp_combi > (state0->mpu.tmax << 16)) {
952
951
state0->overtemp++;
952
printk(KERN_WARNING "Temperature %d above max %d. overtemp %d\n",
953
temp_combi >> 16, state0->mpu.tmax, state0->overtemp);
955
if (state0->overtemp)
956
printk(KERN_WARNING "Temperature back down to %d\n",
954
958
state0->overtemp = 0;
955
960
if (state0->overtemp >= CPU_MAX_OVERTEMP)
956
961
critical_state = 1;
957
962
if (state0->overtemp > 0) {
1024
1029
state->index, temp >> 16);
1025
1030
state->overtemp += CPU_MAX_OVERTEMP / 4;
1026
} else if (temp > (state->mpu.tmax << 16))
1031
} else if (temp > (state->mpu.tmax << 16)) {
1027
1032
state->overtemp++;
1033
printk(KERN_WARNING "CPU %d temperature %d above max %d. overtemp %d\n",
1034
state->index, temp >> 16, state->mpu.tmax, state->overtemp);
1036
if (state->overtemp)
1037
printk(KERN_WARNING "CPU %d temperature back down to %d\n",
1038
state->index, temp >> 16);
1029
1039
state->overtemp = 0;
1030
1041
if (state->overtemp >= CPU_MAX_OVERTEMP)
1031
1042
critical_state = 1;
1032
1043
if (state->overtemp > 0) {
1086
1097
state->index, temp >> 16);
1087
1098
state->overtemp = CPU_MAX_OVERTEMP / 4;
1088
} else if (temp > (state->mpu.tmax << 16))
1099
} else if (temp > (state->mpu.tmax << 16)) {
1089
1100
state->overtemp++;
1101
printk(KERN_WARNING "CPU %d temperature %d above max %d. overtemp %d\n",
1102
state->index, temp >> 16, state->mpu.tmax, state->overtemp);
1104
if (state->overtemp)
1105
printk(KERN_WARNING "CPU %d temperature back down to %d\n",
1106
state->index, temp >> 16);
1091
1107
state->overtemp = 0;
1092
1109
if (state->overtemp >= CPU_MAX_OVERTEMP)
1093
1110
critical_state = 1;
1094
1111
if (state->overtemp > 0) {
1901
1918
cpu_pid_type = CPU_PID_TYPE_RACKMAC;
1902
else if (machine_is_compatible("PowerMac7,3")
1919
else if (of_machine_is_compatible("PowerMac7,3")
1903
1920
&& (cpu_count > 1)
1904
1921
&& fcu_fans[CPUA_PUMP_RPM_INDEX].id != FCU_FAN_ABSENT_ID
1905
1922
&& fcu_fans[CPUB_PUMP_RPM_INDEX].id != FCU_FAN_ABSENT_ID) {
2196
static int fcu_of_probe(struct of_device* dev, const struct of_device_id *match)
2213
static int fcu_of_probe(struct platform_device* dev, const struct of_device_id *match)
2198
2215
state = state_detached;
2218
dev_info(&dev->dev, "PowerMac G5 Thermal control driver %s\n", VERSION);
2200
2220
/* Lookup the fans in the device tree */
2201
fcu_lookup_fans(dev->node);
2221
fcu_lookup_fans(dev->dev.of_node);
2203
2223
/* Add the driver */
2204
2224
return i2c_add_driver(&therm_pm72_driver);
2207
static int fcu_of_remove(struct of_device* dev)
2227
static int fcu_of_remove(struct platform_device* dev)
2209
2229
i2c_del_driver(&therm_pm72_driver);
2214
static struct of_device_id fcu_match[] =
2234
static const struct of_device_id fcu_match[] =
2241
MODULE_DEVICE_TABLE(of, fcu_match);
2222
2243
static struct of_platform_driver fcu_of_platform_driver =
2224
.name = "temperature",
2225
.match_table = fcu_match,
2246
.name = "temperature",
2247
.owner = THIS_MODULE,
2248
.of_match_table = fcu_match,
2226
2250
.probe = fcu_of_probe,
2227
2251
.remove = fcu_of_remove
2233
2257
static int __init therm_pm72_init(void)
2235
struct device_node *np;
2237
rackmac = machine_is_compatible("RackMac3,1");
2239
if (!machine_is_compatible("PowerMac7,2") &&
2240
!machine_is_compatible("PowerMac7,3") &&
2259
rackmac = of_machine_is_compatible("RackMac3,1");
2261
if (!of_machine_is_compatible("PowerMac7,2") &&
2262
!of_machine_is_compatible("PowerMac7,3") &&
2242
2264
return -ENODEV;
2244
printk(KERN_INFO "PowerMac G5 Thermal control driver %s\n", VERSION);
2246
np = of_find_node_by_type(NULL, "fcu");
2248
/* Some machines have strangely broken device-tree */
2249
np = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/fan@15e");
2251
printk(KERN_ERR "Can't find FCU in device-tree !\n");
2255
of_dev = of_platform_device_create(np, "temperature", NULL);
2256
if (of_dev == NULL) {
2257
printk(KERN_ERR "Can't register FCU platform device !\n");
2261
of_register_platform_driver(&fcu_of_platform_driver);
2266
return of_register_platform_driver(&fcu_of_platform_driver);
2266
2269
static void __exit therm_pm72_exit(void)
2268
2271
of_unregister_platform_driver(&fcu_of_platform_driver);
2271
of_device_unregister(of_dev);
2274
2274
module_init(therm_pm72_init);