i5k_amb.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. /*
  2. * A hwmon driver for the Intel 5000 series chipset FB-DIMM AMB
  3. * temperature sensors
  4. * Copyright (C) 2007 IBM
  5. *
  6. * Author: Darrick J. Wong <djwong@us.ibm.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. #include <linux/module.h>
  23. #include <linux/jiffies.h>
  24. #include <linux/hwmon.h>
  25. #include <linux/hwmon-sysfs.h>
  26. #include <linux/err.h>
  27. #include <linux/mutex.h>
  28. #include <linux/delay.h>
  29. #include <linux/log2.h>
  30. #include <linux/pci.h>
  31. #include <linux/platform_device.h>
  32. #include <linux/slab.h>
  33. #define DRVNAME "i5k_amb"
  34. #define I5K_REG_AMB_BASE_ADDR 0x48
  35. #define I5K_REG_AMB_LEN_ADDR 0x50
  36. #define I5K_REG_CHAN0_PRESENCE_ADDR 0x64
  37. #define I5K_REG_CHAN1_PRESENCE_ADDR 0x66
  38. #define AMB_REG_TEMP_MIN_ADDR 0x80
  39. #define AMB_REG_TEMP_MID_ADDR 0x81
  40. #define AMB_REG_TEMP_MAX_ADDR 0x82
  41. #define AMB_REG_TEMP_STATUS_ADDR 0x84
  42. #define AMB_REG_TEMP_ADDR 0x85
  43. #define AMB_CONFIG_SIZE 2048
  44. #define AMB_FUNC_3_OFFSET 768
  45. static unsigned long amb_reg_temp_status(unsigned int amb)
  46. {
  47. return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_STATUS_ADDR +
  48. AMB_CONFIG_SIZE * amb;
  49. }
  50. static unsigned long amb_reg_temp_min(unsigned int amb)
  51. {
  52. return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MIN_ADDR +
  53. AMB_CONFIG_SIZE * amb;
  54. }
  55. static unsigned long amb_reg_temp_mid(unsigned int amb)
  56. {
  57. return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MID_ADDR +
  58. AMB_CONFIG_SIZE * amb;
  59. }
  60. static unsigned long amb_reg_temp_max(unsigned int amb)
  61. {
  62. return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_MAX_ADDR +
  63. AMB_CONFIG_SIZE * amb;
  64. }
  65. static unsigned long amb_reg_temp(unsigned int amb)
  66. {
  67. return AMB_FUNC_3_OFFSET + AMB_REG_TEMP_ADDR +
  68. AMB_CONFIG_SIZE * amb;
  69. }
  70. #define MAX_MEM_CHANNELS 4
  71. #define MAX_AMBS_PER_CHANNEL 16
  72. #define MAX_AMBS (MAX_MEM_CHANNELS * \
  73. MAX_AMBS_PER_CHANNEL)
  74. #define CHANNEL_SHIFT 4
  75. #define DIMM_MASK 0xF
  76. /*
  77. * Ugly hack: For some reason the highest bit is set if there
  78. * are _any_ DIMMs in the channel. Attempting to read from
  79. * this "high-order" AMB results in a memory bus error, so
  80. * for now we'll just ignore that top bit, even though that
  81. * might prevent us from seeing the 16th DIMM in the channel.
  82. */
  83. #define REAL_MAX_AMBS_PER_CHANNEL 15
  84. #define KNOBS_PER_AMB 6
  85. static unsigned long amb_num_from_reg(unsigned int byte_num, unsigned int bit)
  86. {
  87. return byte_num * MAX_AMBS_PER_CHANNEL + bit;
  88. }
  89. #define AMB_SYSFS_NAME_LEN 16
  90. struct i5k_device_attribute {
  91. struct sensor_device_attribute s_attr;
  92. char name[AMB_SYSFS_NAME_LEN];
  93. };
  94. struct i5k_amb_data {
  95. struct device *hwmon_dev;
  96. unsigned long amb_base;
  97. unsigned long amb_len;
  98. u16 amb_present[MAX_MEM_CHANNELS];
  99. void __iomem *amb_mmio;
  100. struct i5k_device_attribute *attrs;
  101. unsigned int num_attrs;
  102. };
  103. static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
  104. char *buf)
  105. {
  106. return sprintf(buf, "%s\n", DRVNAME);
  107. }
  108. static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
  109. static struct platform_device *amb_pdev;
  110. static u8 amb_read_byte(struct i5k_amb_data *data, unsigned long offset)
  111. {
  112. return ioread8(data->amb_mmio + offset);
  113. }
  114. static void amb_write_byte(struct i5k_amb_data *data, unsigned long offset,
  115. u8 val)
  116. {
  117. iowrite8(val, data->amb_mmio + offset);
  118. }
  119. static ssize_t show_amb_alarm(struct device *dev,
  120. struct device_attribute *devattr,
  121. char *buf)
  122. {
  123. struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
  124. struct i5k_amb_data *data = dev_get_drvdata(dev);
  125. if (!(amb_read_byte(data, amb_reg_temp_status(attr->index)) & 0x20) &&
  126. (amb_read_byte(data, amb_reg_temp_status(attr->index)) & 0x8))
  127. return sprintf(buf, "1\n");
  128. else
  129. return sprintf(buf, "0\n");
  130. }
  131. static ssize_t store_amb_min(struct device *dev,
  132. struct device_attribute *devattr,
  133. const char *buf,
  134. size_t count)
  135. {
  136. struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
  137. struct i5k_amb_data *data = dev_get_drvdata(dev);
  138. unsigned long temp;
  139. int ret = kstrtoul(buf, 10, &temp);
  140. if (ret < 0)
  141. return ret;
  142. temp = temp / 500;
  143. if (temp > 255)
  144. temp = 255;
  145. amb_write_byte(data, amb_reg_temp_min(attr->index), temp);
  146. return count;
  147. }
  148. static ssize_t store_amb_mid(struct device *dev,
  149. struct device_attribute *devattr,
  150. const char *buf,
  151. size_t count)
  152. {
  153. struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
  154. struct i5k_amb_data *data = dev_get_drvdata(dev);
  155. unsigned long temp;
  156. int ret = kstrtoul(buf, 10, &temp);
  157. if (ret < 0)
  158. return ret;
  159. temp = temp / 500;
  160. if (temp > 255)
  161. temp = 255;
  162. amb_write_byte(data, amb_reg_temp_mid(attr->index), temp);
  163. return count;
  164. }
  165. static ssize_t store_amb_max(struct device *dev,
  166. struct device_attribute *devattr,
  167. const char *buf,
  168. size_t count)
  169. {
  170. struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
  171. struct i5k_amb_data *data = dev_get_drvdata(dev);
  172. unsigned long temp;
  173. int ret = kstrtoul(buf, 10, &temp);
  174. if (ret < 0)
  175. return ret;
  176. temp = temp / 500;
  177. if (temp > 255)
  178. temp = 255;
  179. amb_write_byte(data, amb_reg_temp_max(attr->index), temp);
  180. return count;
  181. }
  182. static ssize_t show_amb_min(struct device *dev,
  183. struct device_attribute *devattr,
  184. char *buf)
  185. {
  186. struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
  187. struct i5k_amb_data *data = dev_get_drvdata(dev);
  188. return sprintf(buf, "%d\n",
  189. 500 * amb_read_byte(data, amb_reg_temp_min(attr->index)));
  190. }
  191. static ssize_t show_amb_mid(struct device *dev,
  192. struct device_attribute *devattr,
  193. char *buf)
  194. {
  195. struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
  196. struct i5k_amb_data *data = dev_get_drvdata(dev);
  197. return sprintf(buf, "%d\n",
  198. 500 * amb_read_byte(data, amb_reg_temp_mid(attr->index)));
  199. }
  200. static ssize_t show_amb_max(struct device *dev,
  201. struct device_attribute *devattr,
  202. char *buf)
  203. {
  204. struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
  205. struct i5k_amb_data *data = dev_get_drvdata(dev);
  206. return sprintf(buf, "%d\n",
  207. 500 * amb_read_byte(data, amb_reg_temp_max(attr->index)));
  208. }
  209. static ssize_t show_amb_temp(struct device *dev,
  210. struct device_attribute *devattr,
  211. char *buf)
  212. {
  213. struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
  214. struct i5k_amb_data *data = dev_get_drvdata(dev);
  215. return sprintf(buf, "%d\n",
  216. 500 * amb_read_byte(data, amb_reg_temp(attr->index)));
  217. }
  218. static ssize_t show_label(struct device *dev,
  219. struct device_attribute *devattr,
  220. char *buf)
  221. {
  222. struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
  223. return sprintf(buf, "Ch. %d DIMM %d\n", attr->index >> CHANNEL_SHIFT,
  224. attr->index & DIMM_MASK);
  225. }
  226. static int __devinit i5k_amb_hwmon_init(struct platform_device *pdev)
  227. {
  228. int i, j, k, d = 0;
  229. u16 c;
  230. int res = 0;
  231. int num_ambs = 0;
  232. struct i5k_amb_data *data = platform_get_drvdata(pdev);
  233. /* Count the number of AMBs found */
  234. /* ignore the high-order bit, see "Ugly hack" comment above */
  235. for (i = 0; i < MAX_MEM_CHANNELS; i++)
  236. num_ambs += hweight16(data->amb_present[i] & 0x7fff);
  237. /* Set up sysfs stuff */
  238. data->attrs = kzalloc(sizeof(*data->attrs) * num_ambs * KNOBS_PER_AMB,
  239. GFP_KERNEL);
  240. if (!data->attrs)
  241. return -ENOMEM;
  242. data->num_attrs = 0;
  243. for (i = 0; i < MAX_MEM_CHANNELS; i++) {
  244. c = data->amb_present[i];
  245. for (j = 0; j < REAL_MAX_AMBS_PER_CHANNEL; j++, c >>= 1) {
  246. struct i5k_device_attribute *iattr;
  247. k = amb_num_from_reg(i, j);
  248. if (!(c & 0x1))
  249. continue;
  250. d++;
  251. /* sysfs label */
  252. iattr = data->attrs + data->num_attrs;
  253. snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
  254. "temp%d_label", d);
  255. iattr->s_attr.dev_attr.attr.name = iattr->name;
  256. iattr->s_attr.dev_attr.attr.mode = S_IRUGO;
  257. iattr->s_attr.dev_attr.show = show_label;
  258. iattr->s_attr.index = k;
  259. sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
  260. res = device_create_file(&pdev->dev,
  261. &iattr->s_attr.dev_attr);
  262. if (res)
  263. goto exit_remove;
  264. data->num_attrs++;
  265. /* Temperature sysfs knob */
  266. iattr = data->attrs + data->num_attrs;
  267. snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
  268. "temp%d_input", d);
  269. iattr->s_attr.dev_attr.attr.name = iattr->name;
  270. iattr->s_attr.dev_attr.attr.mode = S_IRUGO;
  271. iattr->s_attr.dev_attr.show = show_amb_temp;
  272. iattr->s_attr.index = k;
  273. sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
  274. res = device_create_file(&pdev->dev,
  275. &iattr->s_attr.dev_attr);
  276. if (res)
  277. goto exit_remove;
  278. data->num_attrs++;
  279. /* Temperature min sysfs knob */
  280. iattr = data->attrs + data->num_attrs;
  281. snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
  282. "temp%d_min", d);
  283. iattr->s_attr.dev_attr.attr.name = iattr->name;
  284. iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO;
  285. iattr->s_attr.dev_attr.show = show_amb_min;
  286. iattr->s_attr.dev_attr.store = store_amb_min;
  287. iattr->s_attr.index = k;
  288. sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
  289. res = device_create_file(&pdev->dev,
  290. &iattr->s_attr.dev_attr);
  291. if (res)
  292. goto exit_remove;
  293. data->num_attrs++;
  294. /* Temperature mid sysfs knob */
  295. iattr = data->attrs + data->num_attrs;
  296. snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
  297. "temp%d_mid", d);
  298. iattr->s_attr.dev_attr.attr.name = iattr->name;
  299. iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO;
  300. iattr->s_attr.dev_attr.show = show_amb_mid;
  301. iattr->s_attr.dev_attr.store = store_amb_mid;
  302. iattr->s_attr.index = k;
  303. sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
  304. res = device_create_file(&pdev->dev,
  305. &iattr->s_attr.dev_attr);
  306. if (res)
  307. goto exit_remove;
  308. data->num_attrs++;
  309. /* Temperature max sysfs knob */
  310. iattr = data->attrs + data->num_attrs;
  311. snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
  312. "temp%d_max", d);
  313. iattr->s_attr.dev_attr.attr.name = iattr->name;
  314. iattr->s_attr.dev_attr.attr.mode = S_IWUSR | S_IRUGO;
  315. iattr->s_attr.dev_attr.show = show_amb_max;
  316. iattr->s_attr.dev_attr.store = store_amb_max;
  317. iattr->s_attr.index = k;
  318. sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
  319. res = device_create_file(&pdev->dev,
  320. &iattr->s_attr.dev_attr);
  321. if (res)
  322. goto exit_remove;
  323. data->num_attrs++;
  324. /* Temperature alarm sysfs knob */
  325. iattr = data->attrs + data->num_attrs;
  326. snprintf(iattr->name, AMB_SYSFS_NAME_LEN,
  327. "temp%d_alarm", d);
  328. iattr->s_attr.dev_attr.attr.name = iattr->name;
  329. iattr->s_attr.dev_attr.attr.mode = S_IRUGO;
  330. iattr->s_attr.dev_attr.show = show_amb_alarm;
  331. iattr->s_attr.index = k;
  332. sysfs_attr_init(&iattr->s_attr.dev_attr.attr);
  333. res = device_create_file(&pdev->dev,
  334. &iattr->s_attr.dev_attr);
  335. if (res)
  336. goto exit_remove;
  337. data->num_attrs++;
  338. }
  339. }
  340. res = device_create_file(&pdev->dev, &dev_attr_name);
  341. if (res)
  342. goto exit_remove;
  343. data->hwmon_dev = hwmon_device_register(&pdev->dev);
  344. if (IS_ERR(data->hwmon_dev)) {
  345. res = PTR_ERR(data->hwmon_dev);
  346. goto exit_remove;
  347. }
  348. return res;
  349. exit_remove:
  350. device_remove_file(&pdev->dev, &dev_attr_name);
  351. for (i = 0; i < data->num_attrs; i++)
  352. device_remove_file(&pdev->dev, &data->attrs[i].s_attr.dev_attr);
  353. kfree(data->attrs);
  354. return res;
  355. }
  356. static int __devinit i5k_amb_add(void)
  357. {
  358. int res = -ENODEV;
  359. /* only ever going to be one of these */
  360. amb_pdev = platform_device_alloc(DRVNAME, 0);
  361. if (!amb_pdev)
  362. return -ENOMEM;
  363. res = platform_device_add(amb_pdev);
  364. if (res)
  365. goto err;
  366. return 0;
  367. err:
  368. platform_device_put(amb_pdev);
  369. return res;
  370. }
  371. static int __devinit i5k_find_amb_registers(struct i5k_amb_data *data,
  372. unsigned long devid)
  373. {
  374. struct pci_dev *pcidev;
  375. u32 val32;
  376. int res = -ENODEV;
  377. /* Find AMB register memory space */
  378. pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,
  379. devid,
  380. NULL);
  381. if (!pcidev)
  382. return -ENODEV;
  383. if (pci_read_config_dword(pcidev, I5K_REG_AMB_BASE_ADDR, &val32))
  384. goto out;
  385. data->amb_base = val32;
  386. if (pci_read_config_dword(pcidev, I5K_REG_AMB_LEN_ADDR, &val32))
  387. goto out;
  388. data->amb_len = val32;
  389. /* Is it big enough? */
  390. if (data->amb_len < AMB_CONFIG_SIZE * MAX_AMBS) {
  391. dev_err(&pcidev->dev, "AMB region too small!\n");
  392. goto out;
  393. }
  394. res = 0;
  395. out:
  396. pci_dev_put(pcidev);
  397. return res;
  398. }
  399. static int __devinit i5k_channel_probe(u16 *amb_present, unsigned long dev_id)
  400. {
  401. struct pci_dev *pcidev;
  402. u16 val16;
  403. int res = -ENODEV;
  404. /* Copy the DIMM presence map for these two channels */
  405. pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, dev_id, NULL);
  406. if (!pcidev)
  407. return -ENODEV;
  408. if (pci_read_config_word(pcidev, I5K_REG_CHAN0_PRESENCE_ADDR, &val16))
  409. goto out;
  410. amb_present[0] = val16;
  411. if (pci_read_config_word(pcidev, I5K_REG_CHAN1_PRESENCE_ADDR, &val16))
  412. goto out;
  413. amb_present[1] = val16;
  414. res = 0;
  415. out:
  416. pci_dev_put(pcidev);
  417. return res;
  418. }
  419. static struct {
  420. unsigned long err;
  421. unsigned long fbd0;
  422. } chipset_ids[] __devinitdata = {
  423. { PCI_DEVICE_ID_INTEL_5000_ERR, PCI_DEVICE_ID_INTEL_5000_FBD0 },
  424. { PCI_DEVICE_ID_INTEL_5400_ERR, PCI_DEVICE_ID_INTEL_5400_FBD0 },
  425. { 0, 0 }
  426. };
  427. #ifdef MODULE
  428. static struct pci_device_id i5k_amb_ids[] __devinitdata = {
  429. { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
  430. { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5400_ERR) },
  431. { 0, }
  432. };
  433. MODULE_DEVICE_TABLE(pci, i5k_amb_ids);
  434. #endif
  435. static int __devinit i5k_amb_probe(struct platform_device *pdev)
  436. {
  437. struct i5k_amb_data *data;
  438. struct resource *reso;
  439. int i, res;
  440. data = kzalloc(sizeof(*data), GFP_KERNEL);
  441. if (!data)
  442. return -ENOMEM;
  443. /* Figure out where the AMB registers live */
  444. i = 0;
  445. do {
  446. res = i5k_find_amb_registers(data, chipset_ids[i].err);
  447. if (res == 0)
  448. break;
  449. i++;
  450. } while (chipset_ids[i].err);
  451. if (res)
  452. goto err;
  453. /* Copy the DIMM presence map for the first two channels */
  454. res = i5k_channel_probe(&data->amb_present[0], chipset_ids[i].fbd0);
  455. if (res)
  456. goto err;
  457. /* Copy the DIMM presence map for the optional second two channels */
  458. i5k_channel_probe(&data->amb_present[2], chipset_ids[i].fbd0 + 1);
  459. /* Set up resource regions */
  460. reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME);
  461. if (!reso) {
  462. res = -EBUSY;
  463. goto err;
  464. }
  465. data->amb_mmio = ioremap_nocache(data->amb_base, data->amb_len);
  466. if (!data->amb_mmio) {
  467. res = -EBUSY;
  468. goto err_map_failed;
  469. }
  470. platform_set_drvdata(pdev, data);
  471. res = i5k_amb_hwmon_init(pdev);
  472. if (res)
  473. goto err_init_failed;
  474. return res;
  475. err_init_failed:
  476. iounmap(data->amb_mmio);
  477. platform_set_drvdata(pdev, NULL);
  478. err_map_failed:
  479. release_mem_region(data->amb_base, data->amb_len);
  480. err:
  481. kfree(data);
  482. return res;
  483. }
  484. static int __devexit i5k_amb_remove(struct platform_device *pdev)
  485. {
  486. int i;
  487. struct i5k_amb_data *data = platform_get_drvdata(pdev);
  488. hwmon_device_unregister(data->hwmon_dev);
  489. device_remove_file(&pdev->dev, &dev_attr_name);
  490. for (i = 0; i < data->num_attrs; i++)
  491. device_remove_file(&pdev->dev, &data->attrs[i].s_attr.dev_attr);
  492. kfree(data->attrs);
  493. iounmap(data->amb_mmio);
  494. release_mem_region(data->amb_base, data->amb_len);
  495. platform_set_drvdata(pdev, NULL);
  496. kfree(data);
  497. return 0;
  498. }
  499. static struct platform_driver i5k_amb_driver = {
  500. .driver = {
  501. .owner = THIS_MODULE,
  502. .name = DRVNAME,
  503. },
  504. .probe = i5k_amb_probe,
  505. .remove = __devexit_p(i5k_amb_remove),
  506. };
  507. static int __init i5k_amb_init(void)
  508. {
  509. int res;
  510. res = platform_driver_register(&i5k_amb_driver);
  511. if (res)
  512. return res;
  513. res = i5k_amb_add();
  514. if (res)
  515. platform_driver_unregister(&i5k_amb_driver);
  516. return res;
  517. }
  518. static void __exit i5k_amb_exit(void)
  519. {
  520. platform_device_unregister(amb_pdev);
  521. platform_driver_unregister(&i5k_amb_driver);
  522. }
  523. MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>");
  524. MODULE_DESCRIPTION("Intel 5000 chipset FB-DIMM AMB temperature sensor");
  525. MODULE_LICENSE("GPL");
  526. module_init(i5k_amb_init);
  527. module_exit(i5k_amb_exit);