thermal.c 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282
  1. /*
  2. * acpi_thermal.c - ACPI Thermal Zone Driver ($Revision: 41 $)
  3. *
  4. * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
  5. * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
  6. *
  7. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or (at
  12. * your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write to the Free Software Foundation, Inc.,
  21. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  22. *
  23. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  24. *
  25. * This driver fully implements the ACPI thermal policy as described in the
  26. * ACPI 2.0 Specification.
  27. *
  28. * TBD: 1. Implement passive cooling hysteresis.
  29. * 2. Enhance passive cooling (CPU) states/limit interface to support
  30. * concepts of 'multiple limiters', upper/lower limits, etc.
  31. *
  32. */
  33. #include <linux/kernel.h>
  34. #include <linux/module.h>
  35. #include <linux/dmi.h>
  36. #include <linux/init.h>
  37. #include <linux/slab.h>
  38. #include <linux/types.h>
  39. #include <linux/jiffies.h>
  40. #include <linux/kmod.h>
  41. #include <linux/reboot.h>
  42. #include <linux/device.h>
  43. #include <asm/uaccess.h>
  44. #include <linux/thermal.h>
  45. #include <acpi/acpi_bus.h>
  46. #include <acpi/acpi_drivers.h>
  47. #define PREFIX "ACPI: "
  48. #define ACPI_THERMAL_CLASS "thermal_zone"
  49. #define ACPI_THERMAL_DEVICE_NAME "Thermal Zone"
  50. #define ACPI_THERMAL_FILE_STATE "state"
  51. #define ACPI_THERMAL_FILE_TEMPERATURE "temperature"
  52. #define ACPI_THERMAL_FILE_TRIP_POINTS "trip_points"
  53. #define ACPI_THERMAL_FILE_COOLING_MODE "cooling_mode"
  54. #define ACPI_THERMAL_FILE_POLLING_FREQ "polling_frequency"
  55. #define ACPI_THERMAL_NOTIFY_TEMPERATURE 0x80
  56. #define ACPI_THERMAL_NOTIFY_THRESHOLDS 0x81
  57. #define ACPI_THERMAL_NOTIFY_DEVICES 0x82
  58. #define ACPI_THERMAL_NOTIFY_CRITICAL 0xF0
  59. #define ACPI_THERMAL_NOTIFY_HOT 0xF1
  60. #define ACPI_THERMAL_MODE_ACTIVE 0x00
  61. #define ACPI_THERMAL_MAX_ACTIVE 10
  62. #define ACPI_THERMAL_MAX_LIMIT_STR_LEN 65
  63. #define _COMPONENT ACPI_THERMAL_COMPONENT
  64. ACPI_MODULE_NAME("thermal");
  65. MODULE_AUTHOR("Paul Diefenbaugh");
  66. MODULE_DESCRIPTION("ACPI Thermal Zone Driver");
  67. MODULE_LICENSE("GPL");
  68. static int act;
  69. module_param(act, int, 0644);
  70. MODULE_PARM_DESC(act, "Disable or override all lowest active trip points.");
  71. static int crt;
  72. module_param(crt, int, 0644);
  73. MODULE_PARM_DESC(crt, "Disable or lower all critical trip points.");
  74. static int tzp;
  75. module_param(tzp, int, 0444);
  76. MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.");
  77. static int nocrt;
  78. module_param(nocrt, int, 0);
  79. MODULE_PARM_DESC(nocrt, "Set to take no action upon ACPI thermal zone critical trips points.");
  80. static int off;
  81. module_param(off, int, 0);
  82. MODULE_PARM_DESC(off, "Set to disable ACPI thermal support.");
  83. static int psv;
  84. module_param(psv, int, 0644);
  85. MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
  86. static int acpi_thermal_add(struct acpi_device *device);
  87. static int acpi_thermal_remove(struct acpi_device *device);
  88. static void acpi_thermal_notify(struct acpi_device *device, u32 event);
  89. static const struct acpi_device_id thermal_device_ids[] = {
  90. {ACPI_THERMAL_HID, 0},
  91. {"", 0},
  92. };
  93. MODULE_DEVICE_TABLE(acpi, thermal_device_ids);
  94. #ifdef CONFIG_PM_SLEEP
  95. static int acpi_thermal_resume(struct device *dev);
  96. #endif
  97. static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, NULL, acpi_thermal_resume);
  98. static struct acpi_driver acpi_thermal_driver = {
  99. .name = "thermal",
  100. .class = ACPI_THERMAL_CLASS,
  101. .ids = thermal_device_ids,
  102. .ops = {
  103. .add = acpi_thermal_add,
  104. .remove = acpi_thermal_remove,
  105. .notify = acpi_thermal_notify,
  106. },
  107. .drv.pm = &acpi_thermal_pm,
  108. };
  109. struct acpi_thermal_state {
  110. u8 critical:1;
  111. u8 hot:1;
  112. u8 passive:1;
  113. u8 active:1;
  114. u8 reserved:4;
  115. int active_index;
  116. };
  117. struct acpi_thermal_state_flags {
  118. u8 valid:1;
  119. u8 enabled:1;
  120. u8 reserved:6;
  121. };
  122. struct acpi_thermal_critical {
  123. struct acpi_thermal_state_flags flags;
  124. unsigned long temperature;
  125. };
  126. struct acpi_thermal_hot {
  127. struct acpi_thermal_state_flags flags;
  128. unsigned long temperature;
  129. };
  130. struct acpi_thermal_passive {
  131. struct acpi_thermal_state_flags flags;
  132. unsigned long temperature;
  133. unsigned long tc1;
  134. unsigned long tc2;
  135. unsigned long tsp;
  136. struct acpi_handle_list devices;
  137. };
  138. struct acpi_thermal_active {
  139. struct acpi_thermal_state_flags flags;
  140. unsigned long temperature;
  141. struct acpi_handle_list devices;
  142. };
  143. struct acpi_thermal_trips {
  144. struct acpi_thermal_critical critical;
  145. struct acpi_thermal_hot hot;
  146. struct acpi_thermal_passive passive;
  147. struct acpi_thermal_active active[ACPI_THERMAL_MAX_ACTIVE];
  148. };
  149. struct acpi_thermal_flags {
  150. u8 cooling_mode:1; /* _SCP */
  151. u8 devices:1; /* _TZD */
  152. u8 reserved:6;
  153. };
  154. struct acpi_thermal {
  155. struct acpi_device * device;
  156. acpi_bus_id name;
  157. unsigned long temperature;
  158. unsigned long last_temperature;
  159. unsigned long polling_frequency;
  160. volatile u8 zombie;
  161. struct acpi_thermal_flags flags;
  162. struct acpi_thermal_state state;
  163. struct acpi_thermal_trips trips;
  164. struct acpi_handle_list devices;
  165. struct thermal_zone_device *thermal_zone;
  166. int tz_enabled;
  167. int kelvin_offset;
  168. struct mutex lock;
  169. };
  170. /* --------------------------------------------------------------------------
  171. Thermal Zone Management
  172. -------------------------------------------------------------------------- */
  173. static int acpi_thermal_get_temperature(struct acpi_thermal *tz)
  174. {
  175. acpi_status status = AE_OK;
  176. unsigned long long tmp;
  177. if (!tz)
  178. return -EINVAL;
  179. tz->last_temperature = tz->temperature;
  180. status = acpi_evaluate_integer(tz->device->handle, "_TMP", NULL, &tmp);
  181. if (ACPI_FAILURE(status))
  182. return -ENODEV;
  183. tz->temperature = tmp;
  184. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Temperature is %lu dK\n",
  185. tz->temperature));
  186. return 0;
  187. }
  188. static int acpi_thermal_get_polling_frequency(struct acpi_thermal *tz)
  189. {
  190. acpi_status status = AE_OK;
  191. unsigned long long tmp;
  192. if (!tz)
  193. return -EINVAL;
  194. status = acpi_evaluate_integer(tz->device->handle, "_TZP", NULL, &tmp);
  195. if (ACPI_FAILURE(status))
  196. return -ENODEV;
  197. tz->polling_frequency = tmp;
  198. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Polling frequency is %lu dS\n",
  199. tz->polling_frequency));
  200. return 0;
  201. }
  202. static int acpi_thermal_set_cooling_mode(struct acpi_thermal *tz, int mode)
  203. {
  204. acpi_status status = AE_OK;
  205. union acpi_object arg0 = { ACPI_TYPE_INTEGER };
  206. struct acpi_object_list arg_list = { 1, &arg0 };
  207. acpi_handle handle = NULL;
  208. if (!tz)
  209. return -EINVAL;
  210. status = acpi_get_handle(tz->device->handle, "_SCP", &handle);
  211. if (ACPI_FAILURE(status)) {
  212. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "_SCP not present\n"));
  213. return -ENODEV;
  214. }
  215. arg0.integer.value = mode;
  216. status = acpi_evaluate_object(handle, NULL, &arg_list, NULL);
  217. if (ACPI_FAILURE(status))
  218. return -ENODEV;
  219. return 0;
  220. }
  221. #define ACPI_TRIPS_CRITICAL 0x01
  222. #define ACPI_TRIPS_HOT 0x02
  223. #define ACPI_TRIPS_PASSIVE 0x04
  224. #define ACPI_TRIPS_ACTIVE 0x08
  225. #define ACPI_TRIPS_DEVICES 0x10
  226. #define ACPI_TRIPS_REFRESH_THRESHOLDS (ACPI_TRIPS_PASSIVE | ACPI_TRIPS_ACTIVE)
  227. #define ACPI_TRIPS_REFRESH_DEVICES ACPI_TRIPS_DEVICES
  228. #define ACPI_TRIPS_INIT (ACPI_TRIPS_CRITICAL | ACPI_TRIPS_HOT | \
  229. ACPI_TRIPS_PASSIVE | ACPI_TRIPS_ACTIVE | \
  230. ACPI_TRIPS_DEVICES)
  231. /*
  232. * This exception is thrown out in two cases:
  233. * 1.An invalid trip point becomes invalid or a valid trip point becomes invalid
  234. * when re-evaluating the AML code.
  235. * 2.TODO: Devices listed in _PSL, _ALx, _TZD may change.
  236. * We need to re-bind the cooling devices of a thermal zone when this occurs.
  237. */
  238. #define ACPI_THERMAL_TRIPS_EXCEPTION(flags, str) \
  239. do { \
  240. if (flags != ACPI_TRIPS_INIT) \
  241. ACPI_EXCEPTION((AE_INFO, AE_ERROR, \
  242. "ACPI thermal trip point %s changed\n" \
  243. "Please send acpidump to linux-acpi@vger.kernel.org", str)); \
  244. } while (0)
  245. static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
  246. {
  247. acpi_status status = AE_OK;
  248. unsigned long long tmp;
  249. struct acpi_handle_list devices;
  250. int valid = 0;
  251. int i;
  252. /* Critical Shutdown */
  253. if (flag & ACPI_TRIPS_CRITICAL) {
  254. status = acpi_evaluate_integer(tz->device->handle,
  255. "_CRT", NULL, &tmp);
  256. tz->trips.critical.temperature = tmp;
  257. /*
  258. * Treat freezing temperatures as invalid as well; some
  259. * BIOSes return really low values and cause reboots at startup.
  260. * Below zero (Celsius) values clearly aren't right for sure..
  261. * ... so lets discard those as invalid.
  262. */
  263. if (ACPI_FAILURE(status)) {
  264. tz->trips.critical.flags.valid = 0;
  265. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  266. "No critical threshold\n"));
  267. } else if (tmp <= 2732) {
  268. printk(KERN_WARNING FW_BUG "Invalid critical threshold "
  269. "(%llu)\n", tmp);
  270. tz->trips.critical.flags.valid = 0;
  271. } else {
  272. tz->trips.critical.flags.valid = 1;
  273. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  274. "Found critical threshold [%lu]\n",
  275. tz->trips.critical.temperature));
  276. }
  277. if (tz->trips.critical.flags.valid == 1) {
  278. if (crt == -1) {
  279. tz->trips.critical.flags.valid = 0;
  280. } else if (crt > 0) {
  281. unsigned long crt_k = CELSIUS_TO_KELVIN(crt);
  282. /*
  283. * Allow override critical threshold
  284. */
  285. if (crt_k > tz->trips.critical.temperature)
  286. printk(KERN_WARNING PREFIX
  287. "Critical threshold %d C\n", crt);
  288. tz->trips.critical.temperature = crt_k;
  289. }
  290. }
  291. }
  292. /* Critical Sleep (optional) */
  293. if (flag & ACPI_TRIPS_HOT) {
  294. status = acpi_evaluate_integer(tz->device->handle,
  295. "_HOT", NULL, &tmp);
  296. if (ACPI_FAILURE(status)) {
  297. tz->trips.hot.flags.valid = 0;
  298. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  299. "No hot threshold\n"));
  300. } else {
  301. tz->trips.hot.temperature = tmp;
  302. tz->trips.hot.flags.valid = 1;
  303. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  304. "Found hot threshold [%lu]\n",
  305. tz->trips.critical.temperature));
  306. }
  307. }
  308. /* Passive (optional) */
  309. if (((flag & ACPI_TRIPS_PASSIVE) && tz->trips.passive.flags.valid) ||
  310. (flag == ACPI_TRIPS_INIT)) {
  311. valid = tz->trips.passive.flags.valid;
  312. if (psv == -1) {
  313. status = AE_SUPPORT;
  314. } else if (psv > 0) {
  315. tmp = CELSIUS_TO_KELVIN(psv);
  316. status = AE_OK;
  317. } else {
  318. status = acpi_evaluate_integer(tz->device->handle,
  319. "_PSV", NULL, &tmp);
  320. }
  321. if (ACPI_FAILURE(status))
  322. tz->trips.passive.flags.valid = 0;
  323. else {
  324. tz->trips.passive.temperature = tmp;
  325. tz->trips.passive.flags.valid = 1;
  326. if (flag == ACPI_TRIPS_INIT) {
  327. status = acpi_evaluate_integer(
  328. tz->device->handle, "_TC1",
  329. NULL, &tmp);
  330. if (ACPI_FAILURE(status))
  331. tz->trips.passive.flags.valid = 0;
  332. else
  333. tz->trips.passive.tc1 = tmp;
  334. status = acpi_evaluate_integer(
  335. tz->device->handle, "_TC2",
  336. NULL, &tmp);
  337. if (ACPI_FAILURE(status))
  338. tz->trips.passive.flags.valid = 0;
  339. else
  340. tz->trips.passive.tc2 = tmp;
  341. status = acpi_evaluate_integer(
  342. tz->device->handle, "_TSP",
  343. NULL, &tmp);
  344. if (ACPI_FAILURE(status))
  345. tz->trips.passive.flags.valid = 0;
  346. else
  347. tz->trips.passive.tsp = tmp;
  348. }
  349. }
  350. }
  351. if ((flag & ACPI_TRIPS_DEVICES) && tz->trips.passive.flags.valid) {
  352. memset(&devices, 0, sizeof(struct acpi_handle_list));
  353. status = acpi_evaluate_reference(tz->device->handle, "_PSL",
  354. NULL, &devices);
  355. if (ACPI_FAILURE(status)) {
  356. printk(KERN_WARNING PREFIX
  357. "Invalid passive threshold\n");
  358. tz->trips.passive.flags.valid = 0;
  359. }
  360. else
  361. tz->trips.passive.flags.valid = 1;
  362. if (memcmp(&tz->trips.passive.devices, &devices,
  363. sizeof(struct acpi_handle_list))) {
  364. memcpy(&tz->trips.passive.devices, &devices,
  365. sizeof(struct acpi_handle_list));
  366. ACPI_THERMAL_TRIPS_EXCEPTION(flag, "device");
  367. }
  368. }
  369. if ((flag & ACPI_TRIPS_PASSIVE) || (flag & ACPI_TRIPS_DEVICES)) {
  370. if (valid != tz->trips.passive.flags.valid)
  371. ACPI_THERMAL_TRIPS_EXCEPTION(flag, "state");
  372. }
  373. /* Active (optional) */
  374. for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
  375. char name[5] = { '_', 'A', 'C', ('0' + i), '\0' };
  376. valid = tz->trips.active[i].flags.valid;
  377. if (act == -1)
  378. break; /* disable all active trip points */
  379. if ((flag == ACPI_TRIPS_INIT) || ((flag & ACPI_TRIPS_ACTIVE) &&
  380. tz->trips.active[i].flags.valid)) {
  381. status = acpi_evaluate_integer(tz->device->handle,
  382. name, NULL, &tmp);
  383. if (ACPI_FAILURE(status)) {
  384. tz->trips.active[i].flags.valid = 0;
  385. if (i == 0)
  386. break;
  387. if (act <= 0)
  388. break;
  389. if (i == 1)
  390. tz->trips.active[0].temperature =
  391. CELSIUS_TO_KELVIN(act);
  392. else
  393. /*
  394. * Don't allow override higher than
  395. * the next higher trip point
  396. */
  397. tz->trips.active[i - 1].temperature =
  398. (tz->trips.active[i - 2].temperature <
  399. CELSIUS_TO_KELVIN(act) ?
  400. tz->trips.active[i - 2].temperature :
  401. CELSIUS_TO_KELVIN(act));
  402. break;
  403. } else {
  404. tz->trips.active[i].temperature = tmp;
  405. tz->trips.active[i].flags.valid = 1;
  406. }
  407. }
  408. name[2] = 'L';
  409. if ((flag & ACPI_TRIPS_DEVICES) && tz->trips.active[i].flags.valid ) {
  410. memset(&devices, 0, sizeof(struct acpi_handle_list));
  411. status = acpi_evaluate_reference(tz->device->handle,
  412. name, NULL, &devices);
  413. if (ACPI_FAILURE(status)) {
  414. printk(KERN_WARNING PREFIX
  415. "Invalid active%d threshold\n", i);
  416. tz->trips.active[i].flags.valid = 0;
  417. }
  418. else
  419. tz->trips.active[i].flags.valid = 1;
  420. if (memcmp(&tz->trips.active[i].devices, &devices,
  421. sizeof(struct acpi_handle_list))) {
  422. memcpy(&tz->trips.active[i].devices, &devices,
  423. sizeof(struct acpi_handle_list));
  424. ACPI_THERMAL_TRIPS_EXCEPTION(flag, "device");
  425. }
  426. }
  427. if ((flag & ACPI_TRIPS_ACTIVE) || (flag & ACPI_TRIPS_DEVICES))
  428. if (valid != tz->trips.active[i].flags.valid)
  429. ACPI_THERMAL_TRIPS_EXCEPTION(flag, "state");
  430. if (!tz->trips.active[i].flags.valid)
  431. break;
  432. }
  433. if (flag & ACPI_TRIPS_DEVICES) {
  434. memset(&devices, 0, sizeof(struct acpi_handle_list));
  435. status = acpi_evaluate_reference(tz->device->handle, "_TZD",
  436. NULL, &devices);
  437. if (memcmp(&tz->devices, &devices,
  438. sizeof(struct acpi_handle_list))) {
  439. memcpy(&tz->devices, &devices,
  440. sizeof(struct acpi_handle_list));
  441. ACPI_THERMAL_TRIPS_EXCEPTION(flag, "device");
  442. }
  443. }
  444. return 0;
  445. }
  446. static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
  447. {
  448. int i, valid, ret = acpi_thermal_trips_update(tz, ACPI_TRIPS_INIT);
  449. if (ret)
  450. return ret;
  451. valid = tz->trips.critical.flags.valid |
  452. tz->trips.hot.flags.valid |
  453. tz->trips.passive.flags.valid;
  454. for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++)
  455. valid |= tz->trips.active[i].flags.valid;
  456. if (!valid) {
  457. printk(KERN_WARNING FW_BUG "No valid trip found\n");
  458. return -ENODEV;
  459. }
  460. return 0;
  461. }
  462. static void acpi_thermal_check(void *data)
  463. {
  464. struct acpi_thermal *tz = data;
  465. if (!tz->tz_enabled) {
  466. pr_warn("thermal zone is disabled \n");
  467. return;
  468. }
  469. thermal_zone_device_update(tz->thermal_zone);
  470. }
  471. /* sys I/F for generic thermal sysfs support */
  472. #define KELVIN_TO_MILLICELSIUS(t, off) (((t) - (off)) * 100)
  473. static int thermal_get_temp(struct thermal_zone_device *thermal,
  474. unsigned long *temp)
  475. {
  476. struct acpi_thermal *tz = thermal->devdata;
  477. int result;
  478. if (!tz)
  479. return -EINVAL;
  480. result = acpi_thermal_get_temperature(tz);
  481. if (result)
  482. return result;
  483. *temp = KELVIN_TO_MILLICELSIUS(tz->temperature, tz->kelvin_offset);
  484. return 0;
  485. }
  486. static int thermal_get_mode(struct thermal_zone_device *thermal,
  487. enum thermal_device_mode *mode)
  488. {
  489. struct acpi_thermal *tz = thermal->devdata;
  490. if (!tz)
  491. return -EINVAL;
  492. *mode = tz->tz_enabled ? THERMAL_DEVICE_ENABLED :
  493. THERMAL_DEVICE_DISABLED;
  494. return 0;
  495. }
  496. static int thermal_set_mode(struct thermal_zone_device *thermal,
  497. enum thermal_device_mode mode)
  498. {
  499. struct acpi_thermal *tz = thermal->devdata;
  500. int enable;
  501. if (!tz)
  502. return -EINVAL;
  503. /*
  504. * enable/disable thermal management from ACPI thermal driver
  505. */
  506. if (mode == THERMAL_DEVICE_ENABLED)
  507. enable = 1;
  508. else if (mode == THERMAL_DEVICE_DISABLED)
  509. enable = 0;
  510. else
  511. return -EINVAL;
  512. if (enable != tz->tz_enabled) {
  513. tz->tz_enabled = enable;
  514. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  515. "%s kernel ACPI thermal control\n",
  516. tz->tz_enabled ? "Enable" : "Disable"));
  517. acpi_thermal_check(tz);
  518. }
  519. return 0;
  520. }
  521. static int thermal_get_trip_type(struct thermal_zone_device *thermal,
  522. int trip, enum thermal_trip_type *type)
  523. {
  524. struct acpi_thermal *tz = thermal->devdata;
  525. int i;
  526. if (!tz || trip < 0)
  527. return -EINVAL;
  528. if (tz->trips.critical.flags.valid) {
  529. if (!trip) {
  530. *type = THERMAL_TRIP_CRITICAL;
  531. return 0;
  532. }
  533. trip--;
  534. }
  535. if (tz->trips.hot.flags.valid) {
  536. if (!trip) {
  537. *type = THERMAL_TRIP_HOT;
  538. return 0;
  539. }
  540. trip--;
  541. }
  542. if (tz->trips.passive.flags.valid) {
  543. if (!trip) {
  544. *type = THERMAL_TRIP_PASSIVE;
  545. return 0;
  546. }
  547. trip--;
  548. }
  549. for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE &&
  550. tz->trips.active[i].flags.valid; i++) {
  551. if (!trip) {
  552. *type = THERMAL_TRIP_ACTIVE;
  553. return 0;
  554. }
  555. trip--;
  556. }
  557. return -EINVAL;
  558. }
  559. static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
  560. int trip, unsigned long *temp)
  561. {
  562. struct acpi_thermal *tz = thermal->devdata;
  563. int i;
  564. if (!tz || trip < 0)
  565. return -EINVAL;
  566. if (tz->trips.critical.flags.valid) {
  567. if (!trip) {
  568. *temp = KELVIN_TO_MILLICELSIUS(
  569. tz->trips.critical.temperature,
  570. tz->kelvin_offset);
  571. return 0;
  572. }
  573. trip--;
  574. }
  575. if (tz->trips.hot.flags.valid) {
  576. if (!trip) {
  577. *temp = KELVIN_TO_MILLICELSIUS(
  578. tz->trips.hot.temperature,
  579. tz->kelvin_offset);
  580. return 0;
  581. }
  582. trip--;
  583. }
  584. if (tz->trips.passive.flags.valid) {
  585. if (!trip) {
  586. *temp = KELVIN_TO_MILLICELSIUS(
  587. tz->trips.passive.temperature,
  588. tz->kelvin_offset);
  589. return 0;
  590. }
  591. trip--;
  592. }
  593. for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE &&
  594. tz->trips.active[i].flags.valid; i++) {
  595. if (!trip) {
  596. *temp = KELVIN_TO_MILLICELSIUS(
  597. tz->trips.active[i].temperature,
  598. tz->kelvin_offset);
  599. return 0;
  600. }
  601. trip--;
  602. }
  603. return -EINVAL;
  604. }
  605. static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
  606. unsigned long *temperature) {
  607. struct acpi_thermal *tz = thermal->devdata;
  608. if (tz->trips.critical.flags.valid) {
  609. *temperature = KELVIN_TO_MILLICELSIUS(
  610. tz->trips.critical.temperature,
  611. tz->kelvin_offset);
  612. return 0;
  613. } else
  614. return -EINVAL;
  615. }
  616. static int thermal_get_trend(struct thermal_zone_device *thermal,
  617. int trip, enum thermal_trend *trend)
  618. {
  619. struct acpi_thermal *tz = thermal->devdata;
  620. enum thermal_trip_type type;
  621. int i;
  622. if (thermal_get_trip_type(thermal, trip, &type))
  623. return -EINVAL;
  624. if (type == THERMAL_TRIP_ACTIVE) {
  625. unsigned long trip_temp;
  626. unsigned long temp = KELVIN_TO_MILLICELSIUS(tz->temperature,
  627. tz->kelvin_offset);
  628. if (thermal_get_trip_temp(thermal, trip, &trip_temp))
  629. return -EINVAL;
  630. if (temp > trip_temp) {
  631. *trend = THERMAL_TREND_RAISING;
  632. return 0;
  633. } else {
  634. /* Fall back on default trend */
  635. return -EINVAL;
  636. }
  637. }
  638. /*
  639. * tz->temperature has already been updated by generic thermal layer,
  640. * before this callback being invoked
  641. */
  642. i = (tz->trips.passive.tc1 * (tz->temperature - tz->last_temperature))
  643. + (tz->trips.passive.tc2
  644. * (tz->temperature - tz->trips.passive.temperature));
  645. if (i > 0)
  646. *trend = THERMAL_TREND_RAISING;
  647. else if (i < 0)
  648. *trend = THERMAL_TREND_DROPPING;
  649. else
  650. *trend = THERMAL_TREND_STABLE;
  651. return 0;
  652. }
  653. static int thermal_notify(struct thermal_zone_device *thermal, int trip,
  654. enum thermal_trip_type trip_type)
  655. {
  656. u8 type = 0;
  657. struct acpi_thermal *tz = thermal->devdata;
  658. if (trip_type == THERMAL_TRIP_CRITICAL)
  659. type = ACPI_THERMAL_NOTIFY_CRITICAL;
  660. else if (trip_type == THERMAL_TRIP_HOT)
  661. type = ACPI_THERMAL_NOTIFY_HOT;
  662. else
  663. return 0;
  664. acpi_bus_generate_proc_event(tz->device, type, 1);
  665. acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
  666. dev_name(&tz->device->dev), type, 1);
  667. if (trip_type == THERMAL_TRIP_CRITICAL && nocrt)
  668. return 1;
  669. return 0;
  670. }
  671. static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
  672. struct thermal_cooling_device *cdev,
  673. bool bind)
  674. {
  675. struct acpi_device *device = cdev->devdata;
  676. struct acpi_thermal *tz = thermal->devdata;
  677. struct acpi_device *dev;
  678. acpi_status status;
  679. acpi_handle handle;
  680. int i;
  681. int j;
  682. int trip = -1;
  683. int result = 0;
  684. if (tz->trips.critical.flags.valid)
  685. trip++;
  686. if (tz->trips.hot.flags.valid)
  687. trip++;
  688. if (tz->trips.passive.flags.valid) {
  689. trip++;
  690. for (i = 0; i < tz->trips.passive.devices.count;
  691. i++) {
  692. handle = tz->trips.passive.devices.handles[i];
  693. status = acpi_bus_get_device(handle, &dev);
  694. if (ACPI_FAILURE(status) || dev != device)
  695. continue;
  696. if (bind)
  697. result =
  698. thermal_zone_bind_cooling_device
  699. (thermal, trip, cdev,
  700. THERMAL_NO_LIMIT, THERMAL_NO_LIMIT);
  701. else
  702. result =
  703. thermal_zone_unbind_cooling_device
  704. (thermal, trip, cdev);
  705. if (result)
  706. goto failed;
  707. }
  708. }
  709. for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
  710. if (!tz->trips.active[i].flags.valid)
  711. break;
  712. trip++;
  713. for (j = 0;
  714. j < tz->trips.active[i].devices.count;
  715. j++) {
  716. handle = tz->trips.active[i].devices.handles[j];
  717. status = acpi_bus_get_device(handle, &dev);
  718. if (ACPI_FAILURE(status) || dev != device)
  719. continue;
  720. if (bind)
  721. result = thermal_zone_bind_cooling_device
  722. (thermal, trip, cdev,
  723. THERMAL_NO_LIMIT, THERMAL_NO_LIMIT);
  724. else
  725. result = thermal_zone_unbind_cooling_device
  726. (thermal, trip, cdev);
  727. if (result)
  728. goto failed;
  729. }
  730. }
  731. for (i = 0; i < tz->devices.count; i++) {
  732. handle = tz->devices.handles[i];
  733. status = acpi_bus_get_device(handle, &dev);
  734. if (ACPI_SUCCESS(status) && (dev == device)) {
  735. if (bind)
  736. result = thermal_zone_bind_cooling_device
  737. (thermal, -1, cdev,
  738. THERMAL_NO_LIMIT,
  739. THERMAL_NO_LIMIT);
  740. else
  741. result = thermal_zone_unbind_cooling_device
  742. (thermal, -1, cdev);
  743. if (result)
  744. goto failed;
  745. }
  746. }
  747. failed:
  748. return result;
  749. }
  750. static int
  751. acpi_thermal_bind_cooling_device(struct thermal_zone_device *thermal,
  752. struct thermal_cooling_device *cdev)
  753. {
  754. return acpi_thermal_cooling_device_cb(thermal, cdev, true);
  755. }
  756. static int
  757. acpi_thermal_unbind_cooling_device(struct thermal_zone_device *thermal,
  758. struct thermal_cooling_device *cdev)
  759. {
  760. return acpi_thermal_cooling_device_cb(thermal, cdev, false);
  761. }
  762. static const struct thermal_zone_device_ops acpi_thermal_zone_ops = {
  763. .bind = acpi_thermal_bind_cooling_device,
  764. .unbind = acpi_thermal_unbind_cooling_device,
  765. .get_temp = thermal_get_temp,
  766. .get_mode = thermal_get_mode,
  767. .set_mode = thermal_set_mode,
  768. .get_trip_type = thermal_get_trip_type,
  769. .get_trip_temp = thermal_get_trip_temp,
  770. .get_crit_temp = thermal_get_crit_temp,
  771. .get_trend = thermal_get_trend,
  772. .notify = thermal_notify,
  773. };
  774. static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
  775. {
  776. int trips = 0;
  777. int result;
  778. acpi_status status;
  779. int i;
  780. if (tz->trips.critical.flags.valid)
  781. trips++;
  782. if (tz->trips.hot.flags.valid)
  783. trips++;
  784. if (tz->trips.passive.flags.valid)
  785. trips++;
  786. for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE &&
  787. tz->trips.active[i].flags.valid; i++, trips++);
  788. if (tz->trips.passive.flags.valid)
  789. tz->thermal_zone =
  790. thermal_zone_device_register("acpitz", trips, 0, tz,
  791. &acpi_thermal_zone_ops, NULL,
  792. tz->trips.passive.tsp*100,
  793. tz->polling_frequency*100);
  794. else
  795. tz->thermal_zone =
  796. thermal_zone_device_register("acpitz", trips, 0, tz,
  797. &acpi_thermal_zone_ops, NULL,
  798. 0, tz->polling_frequency*100);
  799. if (IS_ERR(tz->thermal_zone))
  800. return -ENODEV;
  801. result = sysfs_create_link(&tz->device->dev.kobj,
  802. &tz->thermal_zone->device.kobj, "thermal_zone");
  803. if (result)
  804. return result;
  805. result = sysfs_create_link(&tz->thermal_zone->device.kobj,
  806. &tz->device->dev.kobj, "device");
  807. if (result)
  808. return result;
  809. status = acpi_attach_data(tz->device->handle,
  810. acpi_bus_private_data_handler,
  811. tz->thermal_zone);
  812. if (ACPI_FAILURE(status)) {
  813. printk(KERN_ERR PREFIX
  814. "Error attaching device data\n");
  815. return -ENODEV;
  816. }
  817. tz->tz_enabled = 1;
  818. dev_info(&tz->device->dev, "registered as thermal_zone%d\n",
  819. tz->thermal_zone->id);
  820. return 0;
  821. }
  822. static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz)
  823. {
  824. sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
  825. sysfs_remove_link(&tz->thermal_zone->device.kobj, "device");
  826. thermal_zone_device_unregister(tz->thermal_zone);
  827. tz->thermal_zone = NULL;
  828. acpi_detach_data(tz->device->handle, acpi_bus_private_data_handler);
  829. }
  830. /* --------------------------------------------------------------------------
  831. Driver Interface
  832. -------------------------------------------------------------------------- */
  833. static void acpi_thermal_notify(struct acpi_device *device, u32 event)
  834. {
  835. struct acpi_thermal *tz = acpi_driver_data(device);
  836. if (!tz)
  837. return;
  838. switch (event) {
  839. case ACPI_THERMAL_NOTIFY_TEMPERATURE:
  840. acpi_thermal_check(tz);
  841. break;
  842. case ACPI_THERMAL_NOTIFY_THRESHOLDS:
  843. acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_THRESHOLDS);
  844. acpi_thermal_check(tz);
  845. acpi_bus_generate_proc_event(device, event, 0);
  846. acpi_bus_generate_netlink_event(device->pnp.device_class,
  847. dev_name(&device->dev), event, 0);
  848. break;
  849. case ACPI_THERMAL_NOTIFY_DEVICES:
  850. acpi_thermal_trips_update(tz, ACPI_TRIPS_REFRESH_DEVICES);
  851. acpi_thermal_check(tz);
  852. acpi_bus_generate_proc_event(device, event, 0);
  853. acpi_bus_generate_netlink_event(device->pnp.device_class,
  854. dev_name(&device->dev), event, 0);
  855. break;
  856. default:
  857. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  858. "Unsupported event [0x%x]\n", event));
  859. break;
  860. }
  861. }
  862. /*
  863. * On some platforms, the AML code has dependency about
  864. * the evaluating order of _TMP and _CRT/_HOT/_PSV/_ACx.
  865. * 1. On HP Pavilion G4-1016tx, _TMP must be invoked after
  866. * /_CRT/_HOT/_PSV/_ACx, or else system will be power off.
  867. * 2. On HP Compaq 6715b/6715s, the return value of _PSV is 0
  868. * if _TMP has never been evaluated.
  869. *
  870. * As this dependency is totally transparent to OS, evaluate
  871. * all of them once, in the order of _CRT/_HOT/_PSV/_ACx,
  872. * _TMP, before they are actually used.
  873. */
  874. static void acpi_thermal_aml_dependency_fix(struct acpi_thermal *tz)
  875. {
  876. acpi_handle handle = tz->device->handle;
  877. unsigned long long value;
  878. int i;
  879. acpi_evaluate_integer(handle, "_CRT", NULL, &value);
  880. acpi_evaluate_integer(handle, "_HOT", NULL, &value);
  881. acpi_evaluate_integer(handle, "_PSV", NULL, &value);
  882. for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
  883. char name[5] = { '_', 'A', 'C', ('0' + i), '\0' };
  884. acpi_status status;
  885. status = acpi_evaluate_integer(handle, name, NULL, &value);
  886. if (status == AE_NOT_FOUND)
  887. break;
  888. }
  889. acpi_evaluate_integer(handle, "_TMP", NULL, &value);
  890. }
  891. static int acpi_thermal_get_info(struct acpi_thermal *tz)
  892. {
  893. int result = 0;
  894. if (!tz)
  895. return -EINVAL;
  896. acpi_thermal_aml_dependency_fix(tz);
  897. /* Get trip points [_CRT, _PSV, etc.] (required) */
  898. result = acpi_thermal_get_trip_points(tz);
  899. if (result)
  900. return result;
  901. /* Get temperature [_TMP] (required) */
  902. result = acpi_thermal_get_temperature(tz);
  903. if (result)
  904. return result;
  905. /* Set the cooling mode [_SCP] to active cooling (default) */
  906. result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE);
  907. if (!result)
  908. tz->flags.cooling_mode = 1;
  909. /* Get default polling frequency [_TZP] (optional) */
  910. if (tzp)
  911. tz->polling_frequency = tzp;
  912. else
  913. acpi_thermal_get_polling_frequency(tz);
  914. return 0;
  915. }
  916. /*
  917. * The exact offset between Kelvin and degree Celsius is 273.15. However ACPI
  918. * handles temperature values with a single decimal place. As a consequence,
  919. * some implementations use an offset of 273.1 and others use an offset of
  920. * 273.2. Try to find out which one is being used, to present the most
  921. * accurate and visually appealing number.
  922. *
  923. * The heuristic below should work for all ACPI thermal zones which have a
  924. * critical trip point with a value being a multiple of 0.5 degree Celsius.
  925. */
  926. static void acpi_thermal_guess_offset(struct acpi_thermal *tz)
  927. {
  928. if (tz->trips.critical.flags.valid &&
  929. (tz->trips.critical.temperature % 5) == 1)
  930. tz->kelvin_offset = 2731;
  931. else
  932. tz->kelvin_offset = 2732;
  933. }
  934. static int acpi_thermal_add(struct acpi_device *device)
  935. {
  936. int result = 0;
  937. struct acpi_thermal *tz = NULL;
  938. if (!device)
  939. return -EINVAL;
  940. tz = kzalloc(sizeof(struct acpi_thermal), GFP_KERNEL);
  941. if (!tz)
  942. return -ENOMEM;
  943. tz->device = device;
  944. strcpy(tz->name, device->pnp.bus_id);
  945. strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME);
  946. strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
  947. device->driver_data = tz;
  948. mutex_init(&tz->lock);
  949. result = acpi_thermal_get_info(tz);
  950. if (result)
  951. goto free_memory;
  952. acpi_thermal_guess_offset(tz);
  953. result = acpi_thermal_register_thermal_zone(tz);
  954. if (result)
  955. goto free_memory;
  956. printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n",
  957. acpi_device_name(device), acpi_device_bid(device),
  958. KELVIN_TO_CELSIUS(tz->temperature));
  959. goto end;
  960. free_memory:
  961. kfree(tz);
  962. end:
  963. return result;
  964. }
  965. static int acpi_thermal_remove(struct acpi_device *device)
  966. {
  967. struct acpi_thermal *tz = NULL;
  968. if (!device || !acpi_driver_data(device))
  969. return -EINVAL;
  970. tz = acpi_driver_data(device);
  971. acpi_thermal_unregister_thermal_zone(tz);
  972. mutex_destroy(&tz->lock);
  973. kfree(tz);
  974. return 0;
  975. }
  976. #ifdef CONFIG_PM_SLEEP
  977. static int acpi_thermal_resume(struct device *dev)
  978. {
  979. struct acpi_thermal *tz;
  980. int i, j, power_state, result;
  981. if (!dev)
  982. return -EINVAL;
  983. tz = acpi_driver_data(to_acpi_device(dev));
  984. if (!tz)
  985. return -EINVAL;
  986. for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
  987. if (!(&tz->trips.active[i]))
  988. break;
  989. if (!tz->trips.active[i].flags.valid)
  990. break;
  991. tz->trips.active[i].flags.enabled = 1;
  992. for (j = 0; j < tz->trips.active[i].devices.count; j++) {
  993. result = acpi_bus_update_power(
  994. tz->trips.active[i].devices.handles[j],
  995. &power_state);
  996. if (result || (power_state != ACPI_STATE_D0)) {
  997. tz->trips.active[i].flags.enabled = 0;
  998. break;
  999. }
  1000. }
  1001. tz->state.active |= tz->trips.active[i].flags.enabled;
  1002. }
  1003. acpi_thermal_check(tz);
  1004. return AE_OK;
  1005. }
  1006. #endif
  1007. static int thermal_act(const struct dmi_system_id *d) {
  1008. if (act == 0) {
  1009. printk(KERN_NOTICE "ACPI: %s detected: "
  1010. "disabling all active thermal trip points\n", d->ident);
  1011. act = -1;
  1012. }
  1013. return 0;
  1014. }
  1015. static int thermal_nocrt(const struct dmi_system_id *d) {
  1016. printk(KERN_NOTICE "ACPI: %s detected: "
  1017. "disabling all critical thermal trip point actions.\n", d->ident);
  1018. nocrt = 1;
  1019. return 0;
  1020. }
  1021. static int thermal_tzp(const struct dmi_system_id *d) {
  1022. if (tzp == 0) {
  1023. printk(KERN_NOTICE "ACPI: %s detected: "
  1024. "enabling thermal zone polling\n", d->ident);
  1025. tzp = 300; /* 300 dS = 30 Seconds */
  1026. }
  1027. return 0;
  1028. }
  1029. static int thermal_psv(const struct dmi_system_id *d) {
  1030. if (psv == 0) {
  1031. printk(KERN_NOTICE "ACPI: %s detected: "
  1032. "disabling all passive thermal trip points\n", d->ident);
  1033. psv = -1;
  1034. }
  1035. return 0;
  1036. }
  1037. static struct dmi_system_id thermal_dmi_table[] __initdata = {
  1038. /*
  1039. * Award BIOS on this AOpen makes thermal control almost worthless.
  1040. * http://bugzilla.kernel.org/show_bug.cgi?id=8842
  1041. */
  1042. {
  1043. .callback = thermal_act,
  1044. .ident = "AOpen i915GMm-HFS",
  1045. .matches = {
  1046. DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
  1047. DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
  1048. },
  1049. },
  1050. {
  1051. .callback = thermal_psv,
  1052. .ident = "AOpen i915GMm-HFS",
  1053. .matches = {
  1054. DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
  1055. DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
  1056. },
  1057. },
  1058. {
  1059. .callback = thermal_tzp,
  1060. .ident = "AOpen i915GMm-HFS",
  1061. .matches = {
  1062. DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
  1063. DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
  1064. },
  1065. },
  1066. {
  1067. .callback = thermal_nocrt,
  1068. .ident = "Gigabyte GA-7ZX",
  1069. .matches = {
  1070. DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."),
  1071. DMI_MATCH(DMI_BOARD_NAME, "7ZX"),
  1072. },
  1073. },
  1074. {}
  1075. };
  1076. static int __init acpi_thermal_init(void)
  1077. {
  1078. int result = 0;
  1079. dmi_check_system(thermal_dmi_table);
  1080. if (off) {
  1081. printk(KERN_NOTICE "ACPI: thermal control disabled\n");
  1082. return -ENODEV;
  1083. }
  1084. result = acpi_bus_register_driver(&acpi_thermal_driver);
  1085. if (result < 0)
  1086. return -ENODEV;
  1087. return 0;
  1088. }
  1089. static void __exit acpi_thermal_exit(void)
  1090. {
  1091. acpi_bus_unregister_driver(&acpi_thermal_driver);
  1092. return;
  1093. }
  1094. module_init(acpi_thermal_init);
  1095. module_exit(acpi_thermal_exit);