diff options
author | René Rebe <rene@exactcode.de> | 2007-10-16 17:19:20 -0400 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2007-11-08 08:42:46 -0500 |
commit | 8de577095d65e8a51135793bf48c7be6c6c5bc77 (patch) | |
tree | 4b6295457a7a50c73af31ff10ad43cc358a4da04 | |
parent | ff8966acb9d6bacdbb8971762bbd3ba6480f6077 (diff) |
hwmon: (applesmc) Add support for Mac Pro 2 x Quad-Core
At least the 2x Quad-Core Apple Mac Pro appears to have some over-heat
protection which suddenly powers off the whole box under load. This adds
support for the fans and temerature sensors in the Mac Pro - later some
"windwarm" a-like code should probably monitor the values. For now
manually tweaking the fans prevents the sudden shutdown for me.
cd /sys/devices/platform/applesmc.768
for x in fan{1,2,3,4}; do
echo 1 > ${x}_manual
echo 1285 > ${x}_output
done
Two sensors are 0, while four are 129 °C, those might be removed again,
later.
Signed-off-by: René Rebe <rene@exactcode.de>
Cc: Nicolas Boichat <nicolas@boichat.ch>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
-rw-r--r-- | drivers/hwmon/applesmc.c | 107 |
1 files changed, 101 insertions, 6 deletions
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 1001d2e122a2..86c66c345f8b 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -80,7 +80,7 @@ | |||
80 | /* | 80 | /* |
81 | * Temperature sensors keys (sp78 - 2 bytes). | 81 | * Temperature sensors keys (sp78 - 2 bytes). |
82 | */ | 82 | */ |
83 | static const char* temperature_sensors_sets[][13] = { | 83 | static const char* temperature_sensors_sets[][36] = { |
84 | /* Set 0: Macbook Pro */ | 84 | /* Set 0: Macbook Pro */ |
85 | { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H", | 85 | { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H", |
86 | "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL }, | 86 | "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL }, |
@@ -88,7 +88,13 @@ static const char* temperature_sensors_sets[][13] = { | |||
88 | { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S", | 88 | { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S", |
89 | "Th1H", "Ts0P", NULL }, | 89 | "Th1H", "Ts0P", NULL }, |
90 | /* Set 2: Macmini set */ | 90 | /* Set 2: Macmini set */ |
91 | { "TC0D", "TC0P", NULL } | 91 | { "TC0D", "TC0P", NULL }, |
92 | /* Set 3: Mac Pro (2 x Quad-Core) */ | ||
93 | { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", "TC0C", "TC0D", "TC0P", | ||
94 | "TC1C", "TC1D", "TC2C", "TC2D", "TC3C", "TC3D", "THTG", "TH0P", | ||
95 | "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", "TMBS", "TM0P", "TM0S", | ||
96 | "TM1P", "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P", | ||
97 | "TM9S", "TN0H", "TS0C", NULL }, | ||
92 | }; | 98 | }; |
93 | 99 | ||
94 | /* List of keys used to read/write fan speeds */ | 100 | /* List of keys used to read/write fan speeds */ |
@@ -990,14 +996,18 @@ static struct attribute *fan##offset##_attributes[] = { \ | |||
990 | 996 | ||
991 | /* | 997 | /* |
992 | * Create the needed functions for each fan using the macro defined above | 998 | * Create the needed functions for each fan using the macro defined above |
993 | * (2 fans are supported) | 999 | * (4 fans are supported) |
994 | */ | 1000 | */ |
995 | sysfs_fan_speeds_offset(1); | 1001 | sysfs_fan_speeds_offset(1); |
996 | sysfs_fan_speeds_offset(2); | 1002 | sysfs_fan_speeds_offset(2); |
1003 | sysfs_fan_speeds_offset(3); | ||
1004 | sysfs_fan_speeds_offset(4); | ||
997 | 1005 | ||
998 | static const struct attribute_group fan_attribute_groups[] = { | 1006 | static const struct attribute_group fan_attribute_groups[] = { |
999 | { .attrs = fan1_attributes }, | 1007 | { .attrs = fan1_attributes }, |
1000 | { .attrs = fan2_attributes } | 1008 | { .attrs = fan2_attributes }, |
1009 | { .attrs = fan3_attributes }, | ||
1010 | { .attrs = fan4_attributes }, | ||
1001 | }; | 1011 | }; |
1002 | 1012 | ||
1003 | /* | 1013 | /* |
@@ -1027,6 +1037,52 @@ static SENSOR_DEVICE_ATTR(temp11_input, S_IRUGO, | |||
1027 | applesmc_show_temperature, NULL, 10); | 1037 | applesmc_show_temperature, NULL, 10); |
1028 | static SENSOR_DEVICE_ATTR(temp12_input, S_IRUGO, | 1038 | static SENSOR_DEVICE_ATTR(temp12_input, S_IRUGO, |
1029 | applesmc_show_temperature, NULL, 11); | 1039 | applesmc_show_temperature, NULL, 11); |
1040 | static SENSOR_DEVICE_ATTR(temp13_input, S_IRUGO, | ||
1041 | applesmc_show_temperature, NULL, 12); | ||
1042 | static SENSOR_DEVICE_ATTR(temp14_input, S_IRUGO, | ||
1043 | applesmc_show_temperature, NULL, 13); | ||
1044 | static SENSOR_DEVICE_ATTR(temp15_input, S_IRUGO, | ||
1045 | applesmc_show_temperature, NULL, 14); | ||
1046 | static SENSOR_DEVICE_ATTR(temp16_input, S_IRUGO, | ||
1047 | applesmc_show_temperature, NULL, 15); | ||
1048 | static SENSOR_DEVICE_ATTR(temp17_input, S_IRUGO, | ||
1049 | applesmc_show_temperature, NULL, 16); | ||
1050 | static SENSOR_DEVICE_ATTR(temp18_input, S_IRUGO, | ||
1051 | applesmc_show_temperature, NULL, 17); | ||
1052 | static SENSOR_DEVICE_ATTR(temp19_input, S_IRUGO, | ||
1053 | applesmc_show_temperature, NULL, 18); | ||
1054 | static SENSOR_DEVICE_ATTR(temp20_input, S_IRUGO, | ||
1055 | applesmc_show_temperature, NULL, 19); | ||
1056 | static SENSOR_DEVICE_ATTR(temp21_input, S_IRUGO, | ||
1057 | applesmc_show_temperature, NULL, 20); | ||
1058 | static SENSOR_DEVICE_ATTR(temp22_input, S_IRUGO, | ||
1059 | applesmc_show_temperature, NULL, 21); | ||
1060 | static SENSOR_DEVICE_ATTR(temp23_input, S_IRUGO, | ||
1061 | applesmc_show_temperature, NULL, 22); | ||
1062 | static SENSOR_DEVICE_ATTR(temp24_input, S_IRUGO, | ||
1063 | applesmc_show_temperature, NULL, 23); | ||
1064 | static SENSOR_DEVICE_ATTR(temp25_input, S_IRUGO, | ||
1065 | applesmc_show_temperature, NULL, 24); | ||
1066 | static SENSOR_DEVICE_ATTR(temp26_input, S_IRUGO, | ||
1067 | applesmc_show_temperature, NULL, 25); | ||
1068 | static SENSOR_DEVICE_ATTR(temp27_input, S_IRUGO, | ||
1069 | applesmc_show_temperature, NULL, 26); | ||
1070 | static SENSOR_DEVICE_ATTR(temp28_input, S_IRUGO, | ||
1071 | applesmc_show_temperature, NULL, 27); | ||
1072 | static SENSOR_DEVICE_ATTR(temp29_input, S_IRUGO, | ||
1073 | applesmc_show_temperature, NULL, 28); | ||
1074 | static SENSOR_DEVICE_ATTR(temp30_input, S_IRUGO, | ||
1075 | applesmc_show_temperature, NULL, 29); | ||
1076 | static SENSOR_DEVICE_ATTR(temp31_input, S_IRUGO, | ||
1077 | applesmc_show_temperature, NULL, 30); | ||
1078 | static SENSOR_DEVICE_ATTR(temp32_input, S_IRUGO, | ||
1079 | applesmc_show_temperature, NULL, 31); | ||
1080 | static SENSOR_DEVICE_ATTR(temp33_input, S_IRUGO, | ||
1081 | applesmc_show_temperature, NULL, 32); | ||
1082 | static SENSOR_DEVICE_ATTR(temp34_input, S_IRUGO, | ||
1083 | applesmc_show_temperature, NULL, 33); | ||
1084 | static SENSOR_DEVICE_ATTR(temp35_input, S_IRUGO, | ||
1085 | applesmc_show_temperature, NULL, 34); | ||
1030 | 1086 | ||
1031 | static struct attribute *temperature_attributes[] = { | 1087 | static struct attribute *temperature_attributes[] = { |
1032 | &sensor_dev_attr_temp1_input.dev_attr.attr, | 1088 | &sensor_dev_attr_temp1_input.dev_attr.attr, |
@@ -1041,6 +1097,29 @@ static struct attribute *temperature_attributes[] = { | |||
1041 | &sensor_dev_attr_temp10_input.dev_attr.attr, | 1097 | &sensor_dev_attr_temp10_input.dev_attr.attr, |
1042 | &sensor_dev_attr_temp11_input.dev_attr.attr, | 1098 | &sensor_dev_attr_temp11_input.dev_attr.attr, |
1043 | &sensor_dev_attr_temp12_input.dev_attr.attr, | 1099 | &sensor_dev_attr_temp12_input.dev_attr.attr, |
1100 | &sensor_dev_attr_temp13_input.dev_attr.attr, | ||
1101 | &sensor_dev_attr_temp14_input.dev_attr.attr, | ||
1102 | &sensor_dev_attr_temp15_input.dev_attr.attr, | ||
1103 | &sensor_dev_attr_temp16_input.dev_attr.attr, | ||
1104 | &sensor_dev_attr_temp17_input.dev_attr.attr, | ||
1105 | &sensor_dev_attr_temp18_input.dev_attr.attr, | ||
1106 | &sensor_dev_attr_temp19_input.dev_attr.attr, | ||
1107 | &sensor_dev_attr_temp20_input.dev_attr.attr, | ||
1108 | &sensor_dev_attr_temp21_input.dev_attr.attr, | ||
1109 | &sensor_dev_attr_temp22_input.dev_attr.attr, | ||
1110 | &sensor_dev_attr_temp23_input.dev_attr.attr, | ||
1111 | &sensor_dev_attr_temp24_input.dev_attr.attr, | ||
1112 | &sensor_dev_attr_temp25_input.dev_attr.attr, | ||
1113 | &sensor_dev_attr_temp26_input.dev_attr.attr, | ||
1114 | &sensor_dev_attr_temp27_input.dev_attr.attr, | ||
1115 | &sensor_dev_attr_temp28_input.dev_attr.attr, | ||
1116 | &sensor_dev_attr_temp29_input.dev_attr.attr, | ||
1117 | &sensor_dev_attr_temp30_input.dev_attr.attr, | ||
1118 | &sensor_dev_attr_temp31_input.dev_attr.attr, | ||
1119 | &sensor_dev_attr_temp32_input.dev_attr.attr, | ||
1120 | &sensor_dev_attr_temp33_input.dev_attr.attr, | ||
1121 | &sensor_dev_attr_temp34_input.dev_attr.attr, | ||
1122 | &sensor_dev_attr_temp35_input.dev_attr.attr, | ||
1044 | NULL | 1123 | NULL |
1045 | }; | 1124 | }; |
1046 | 1125 | ||
@@ -1137,6 +1216,8 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = { | |||
1137 | { .accelerometer = 1, .light = 0, .temperature_set = 1 }, | 1216 | { .accelerometer = 1, .light = 0, .temperature_set = 1 }, |
1138 | /* MacMini: temperature set 2 */ | 1217 | /* MacMini: temperature set 2 */ |
1139 | { .accelerometer = 0, .light = 0, .temperature_set = 2 }, | 1218 | { .accelerometer = 0, .light = 0, .temperature_set = 2 }, |
1219 | /* MacPro: temperature set 3 */ | ||
1220 | { .accelerometer = 0, .light = 0, .temperature_set = 3 }, | ||
1140 | }; | 1221 | }; |
1141 | 1222 | ||
1142 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". | 1223 | /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". |
@@ -1154,6 +1235,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = { | |||
1154 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | 1235 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), |
1155 | DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") }, | 1236 | DMI_MATCH(DMI_PRODUCT_NAME,"Macmini") }, |
1156 | (void*)&applesmc_dmi_data[2]}, | 1237 | (void*)&applesmc_dmi_data[2]}, |
1238 | { applesmc_dmi_match, "Apple MacPro2", { | ||
1239 | DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), | ||
1240 | DMI_MATCH(DMI_PRODUCT_NAME,"MacPro2") }, | ||
1241 | (void*)&applesmc_dmi_data[3]}, | ||
1157 | { .ident = NULL } | 1242 | { .ident = NULL } |
1158 | }; | 1243 | }; |
1159 | 1244 | ||
@@ -1204,9 +1289,19 @@ static int __init applesmc_init(void) | |||
1204 | 1289 | ||
1205 | switch (count) { | 1290 | switch (count) { |
1206 | default: | 1291 | default: |
1207 | printk(KERN_WARNING "applesmc: More than 2 fans found," | 1292 | printk(KERN_WARNING "applesmc: More than 4 fans found," |
1208 | " but at most 2 fans are supported" | 1293 | " but at most 4 fans are supported" |
1209 | " by the driver.\n"); | 1294 | " by the driver.\n"); |
1295 | case 4: | ||
1296 | ret = sysfs_create_group(&pdev->dev.kobj, | ||
1297 | &fan_attribute_groups[3]); | ||
1298 | if (ret) | ||
1299 | goto out_key_enumeration; | ||
1300 | case 3: | ||
1301 | ret = sysfs_create_group(&pdev->dev.kobj, | ||
1302 | &fan_attribute_groups[2]); | ||
1303 | if (ret) | ||
1304 | goto out_key_enumeration; | ||
1210 | case 2: | 1305 | case 2: |
1211 | ret = sysfs_create_group(&pdev->dev.kobj, | 1306 | ret = sysfs_create_group(&pdev->dev.kobj, |
1212 | &fan_attribute_groups[1]); | 1307 | &fan_attribute_groups[1]); |