rack-meter.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. /*
  2. * RackMac vu-meter driver
  3. *
  4. * (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
  5. * <benh@kernel.crashing.org>
  6. *
  7. * Released under the term of the GNU GPL v2.
  8. *
  9. * Support the CPU-meter LEDs of the Xserve G5
  10. *
  11. * TODO: Implement PWM to do variable intensity and provide userland
  12. * interface for fun. Also, the CPU-meter could be made nicer by being
  13. * a bit less "immediate" but giving instead a more average load over
  14. * time. Patches welcome :-)
  15. *
  16. */
  17. #undef DEBUG
  18. #include <linux/types.h>
  19. #include <linux/kernel.h>
  20. #include <linux/slab.h>
  21. #include <linux/device.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/module.h>
  24. #include <linux/pci.h>
  25. #include <linux/dma-mapping.h>
  26. #include <linux/kernel_stat.h>
  27. #include <linux/of_address.h>
  28. #include <linux/of_irq.h>
  29. #include <asm/io.h>
  30. #include <asm/prom.h>
  31. #include <asm/machdep.h>
  32. #include <asm/pmac_feature.h>
  33. #include <asm/dbdma.h>
  34. #include <asm/macio.h>
  35. #include <asm/keylargo.h>
  36. /* Number of samples in a sample buffer */
  37. #define SAMPLE_COUNT 256
  38. /* CPU meter sampling rate in ms */
  39. #define CPU_SAMPLING_RATE 250
  40. struct rackmeter_dma {
  41. struct dbdma_cmd cmd[4] ____cacheline_aligned;
  42. u32 mark ____cacheline_aligned;
  43. u32 buf1[SAMPLE_COUNT] ____cacheline_aligned;
  44. u32 buf2[SAMPLE_COUNT] ____cacheline_aligned;
  45. } ____cacheline_aligned;
  46. struct rackmeter_cpu {
  47. struct delayed_work sniffer;
  48. struct rackmeter *rm;
  49. cputime64_t prev_wall;
  50. cputime64_t prev_idle;
  51. int zero;
  52. } ____cacheline_aligned;
  53. struct rackmeter {
  54. struct macio_dev *mdev;
  55. unsigned int irq;
  56. struct device_node *i2s;
  57. u8 *ubuf;
  58. struct dbdma_regs __iomem *dma_regs;
  59. void __iomem *i2s_regs;
  60. dma_addr_t dma_buf_p;
  61. struct rackmeter_dma *dma_buf_v;
  62. int stale_irq;
  63. struct rackmeter_cpu cpu[2];
  64. int paused;
  65. struct mutex sem;
  66. };
  67. /* To be set as a tunable */
  68. static int rackmeter_ignore_nice;
  69. /* This GPIO is whacked by the OS X driver when initializing */
  70. #define RACKMETER_MAGIC_GPIO 0x78
  71. /* This is copied from cpufreq_ondemand, maybe we should put it in
  72. * a common header somewhere
  73. */
  74. static inline cputime64_t get_cpu_idle_time(unsigned int cpu)
  75. {
  76. u64 retval;
  77. retval = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE] +
  78. kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
  79. if (rackmeter_ignore_nice)
  80. retval += kcpustat_cpu(cpu).cpustat[CPUTIME_NICE];
  81. return retval;
  82. }
  83. static void rackmeter_setup_i2s(struct rackmeter *rm)
  84. {
  85. struct macio_chip *macio = rm->mdev->bus->chip;
  86. /* First whack magic GPIO */
  87. pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, RACKMETER_MAGIC_GPIO, 5);
  88. /* Call feature code to enable the sound channel and the proper
  89. * clock sources
  90. */
  91. pmac_call_feature(PMAC_FTR_SOUND_CHIP_ENABLE, rm->i2s, 0, 1);
  92. /* Power i2s and stop i2s clock. We whack MacIO FCRs directly for now.
  93. * This is a bit racy, thus we should add new platform functions to
  94. * handle that. snd-aoa needs that too
  95. */
  96. MACIO_BIS(KEYLARGO_FCR1, KL1_I2S0_ENABLE);
  97. MACIO_BIC(KEYLARGO_FCR1, KL1_I2S0_CLK_ENABLE_BIT);
  98. (void)MACIO_IN32(KEYLARGO_FCR1);
  99. udelay(10);
  100. /* Then setup i2s. For now, we use the same magic value that
  101. * the OS X driver seems to use. We might want to play around
  102. * with the clock divisors later
  103. */
  104. out_le32(rm->i2s_regs + 0x10, 0x01fa0000);
  105. (void)in_le32(rm->i2s_regs + 0x10);
  106. udelay(10);
  107. /* Fully restart i2s*/
  108. MACIO_BIS(KEYLARGO_FCR1, KL1_I2S0_CELL_ENABLE |
  109. KL1_I2S0_CLK_ENABLE_BIT);
  110. (void)MACIO_IN32(KEYLARGO_FCR1);
  111. udelay(10);
  112. }
  113. static void rackmeter_set_default_pattern(struct rackmeter *rm)
  114. {
  115. int i;
  116. for (i = 0; i < 16; i++) {
  117. if (i < 8)
  118. rm->ubuf[i] = (i & 1) * 255;
  119. else
  120. rm->ubuf[i] = ((~i) & 1) * 255;
  121. }
  122. }
  123. static void rackmeter_do_pause(struct rackmeter *rm, int pause)
  124. {
  125. struct rackmeter_dma *rdma = rm->dma_buf_v;
  126. pr_debug("rackmeter: %s\n", pause ? "paused" : "started");
  127. rm->paused = pause;
  128. if (pause) {
  129. DBDMA_DO_STOP(rm->dma_regs);
  130. return;
  131. }
  132. memset(rdma->buf1, 0, sizeof(rdma->buf1));
  133. memset(rdma->buf2, 0, sizeof(rdma->buf2));
  134. rm->dma_buf_v->mark = 0;
  135. mb();
  136. out_le32(&rm->dma_regs->cmdptr_hi, 0);
  137. out_le32(&rm->dma_regs->cmdptr, rm->dma_buf_p);
  138. out_le32(&rm->dma_regs->control, (RUN << 16) | RUN);
  139. }
  140. static void rackmeter_setup_dbdma(struct rackmeter *rm)
  141. {
  142. struct rackmeter_dma *db = rm->dma_buf_v;
  143. struct dbdma_cmd *cmd = db->cmd;
  144. /* Make sure dbdma is reset */
  145. DBDMA_DO_RESET(rm->dma_regs);
  146. pr_debug("rackmeter: mark offset=0x%zx\n",
  147. offsetof(struct rackmeter_dma, mark));
  148. pr_debug("rackmeter: buf1 offset=0x%zx\n",
  149. offsetof(struct rackmeter_dma, buf1));
  150. pr_debug("rackmeter: buf2 offset=0x%zx\n",
  151. offsetof(struct rackmeter_dma, buf2));
  152. /* Prepare 4 dbdma commands for the 2 buffers */
  153. memset(cmd, 0, 4 * sizeof(struct dbdma_cmd));
  154. cmd->req_count = cpu_to_le16(4);
  155. cmd->command = cpu_to_le16(STORE_WORD | INTR_ALWAYS | KEY_SYSTEM);
  156. cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
  157. offsetof(struct rackmeter_dma, mark));
  158. cmd->cmd_dep = cpu_to_le32(0x02000000);
  159. cmd++;
  160. cmd->req_count = cpu_to_le16(SAMPLE_COUNT * 4);
  161. cmd->command = cpu_to_le16(OUTPUT_MORE);
  162. cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
  163. offsetof(struct rackmeter_dma, buf1));
  164. cmd++;
  165. cmd->req_count = cpu_to_le16(4);
  166. cmd->command = cpu_to_le16(STORE_WORD | INTR_ALWAYS | KEY_SYSTEM);
  167. cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
  168. offsetof(struct rackmeter_dma, mark));
  169. cmd->cmd_dep = cpu_to_le32(0x01000000);
  170. cmd++;
  171. cmd->req_count = cpu_to_le16(SAMPLE_COUNT * 4);
  172. cmd->command = cpu_to_le16(OUTPUT_MORE | BR_ALWAYS);
  173. cmd->phy_addr = cpu_to_le32(rm->dma_buf_p +
  174. offsetof(struct rackmeter_dma, buf2));
  175. cmd->cmd_dep = cpu_to_le32(rm->dma_buf_p);
  176. rackmeter_do_pause(rm, 0);
  177. }
  178. static void rackmeter_do_timer(struct work_struct *work)
  179. {
  180. struct rackmeter_cpu *rcpu =
  181. container_of(work, struct rackmeter_cpu, sniffer.work);
  182. struct rackmeter *rm = rcpu->rm;
  183. unsigned int cpu = smp_processor_id();
  184. cputime64_t cur_jiffies, total_idle_ticks;
  185. unsigned int total_ticks, idle_ticks;
  186. int i, offset, load, cumm, pause;
  187. cur_jiffies = jiffies64_to_cputime64(get_jiffies_64());
  188. total_ticks = (unsigned int) (cur_jiffies - rcpu->prev_wall);
  189. rcpu->prev_wall = cur_jiffies;
  190. total_idle_ticks = get_cpu_idle_time(cpu);
  191. idle_ticks = (unsigned int) (total_idle_ticks - rcpu->prev_idle);
  192. idle_ticks = min(idle_ticks, total_ticks);
  193. rcpu->prev_idle = total_idle_ticks;
  194. /* We do a very dumb calculation to update the LEDs for now,
  195. * we'll do better once we have actual PWM implemented
  196. */
  197. load = (9 * (total_ticks - idle_ticks)) / total_ticks;
  198. offset = cpu << 3;
  199. cumm = 0;
  200. for (i = 0; i < 8; i++) {
  201. u8 ub = (load > i) ? 0xff : 0;
  202. rm->ubuf[i + offset] = ub;
  203. cumm |= ub;
  204. }
  205. rcpu->zero = (cumm == 0);
  206. /* Now check if LEDs are all 0, we can stop DMA */
  207. pause = (rm->cpu[0].zero && rm->cpu[1].zero);
  208. if (pause != rm->paused) {
  209. mutex_lock(&rm->sem);
  210. pause = (rm->cpu[0].zero && rm->cpu[1].zero);
  211. rackmeter_do_pause(rm, pause);
  212. mutex_unlock(&rm->sem);
  213. }
  214. schedule_delayed_work_on(cpu, &rcpu->sniffer,
  215. msecs_to_jiffies(CPU_SAMPLING_RATE));
  216. }
  217. static void rackmeter_init_cpu_sniffer(struct rackmeter *rm)
  218. {
  219. unsigned int cpu;
  220. /* This driver works only with 1 or 2 CPUs numbered 0 and 1,
  221. * but that's really all we have on Apple Xserve. It doesn't
  222. * play very nice with CPU hotplug neither but we don't do that
  223. * on those machines yet
  224. */
  225. rm->cpu[0].rm = rm;
  226. INIT_DELAYED_WORK(&rm->cpu[0].sniffer, rackmeter_do_timer);
  227. rm->cpu[1].rm = rm;
  228. INIT_DELAYED_WORK(&rm->cpu[1].sniffer, rackmeter_do_timer);
  229. for_each_online_cpu(cpu) {
  230. struct rackmeter_cpu *rcpu;
  231. if (cpu > 1)
  232. continue;
  233. rcpu = &rm->cpu[cpu];
  234. rcpu->prev_idle = get_cpu_idle_time(cpu);
  235. rcpu->prev_wall = jiffies64_to_cputime64(get_jiffies_64());
  236. schedule_delayed_work_on(cpu, &rm->cpu[cpu].sniffer,
  237. msecs_to_jiffies(CPU_SAMPLING_RATE));
  238. }
  239. }
  240. static void rackmeter_stop_cpu_sniffer(struct rackmeter *rm)
  241. {
  242. cancel_delayed_work_sync(&rm->cpu[0].sniffer);
  243. cancel_delayed_work_sync(&rm->cpu[1].sniffer);
  244. }
  245. static int rackmeter_setup(struct rackmeter *rm)
  246. {
  247. pr_debug("rackmeter: setting up i2s..\n");
  248. rackmeter_setup_i2s(rm);
  249. pr_debug("rackmeter: setting up default pattern..\n");
  250. rackmeter_set_default_pattern(rm);
  251. pr_debug("rackmeter: setting up dbdma..\n");
  252. rackmeter_setup_dbdma(rm);
  253. pr_debug("rackmeter: start CPU measurements..\n");
  254. rackmeter_init_cpu_sniffer(rm);
  255. printk(KERN_INFO "RackMeter initialized\n");
  256. return 0;
  257. }
  258. /* XXX FIXME: No PWM yet, this is 0/1 */
  259. static u32 rackmeter_calc_sample(struct rackmeter *rm, unsigned int index)
  260. {
  261. int led;
  262. u32 sample = 0;
  263. for (led = 0; led < 16; led++) {
  264. sample >>= 1;
  265. sample |= ((rm->ubuf[led] >= 0x80) << 15);
  266. }
  267. return (sample << 17) | (sample >> 15);
  268. }
  269. static irqreturn_t rackmeter_irq(int irq, void *arg)
  270. {
  271. struct rackmeter *rm = arg;
  272. struct rackmeter_dma *db = rm->dma_buf_v;
  273. unsigned int mark, i;
  274. u32 *buf;
  275. /* Flush PCI buffers with an MMIO read. Maybe we could actually
  276. * check the status one day ... in case things go wrong, though
  277. * this never happened to me
  278. */
  279. (void)in_le32(&rm->dma_regs->status);
  280. /* Make sure the CPU gets us in order */
  281. rmb();
  282. /* Read mark */
  283. mark = db->mark;
  284. if (mark != 1 && mark != 2) {
  285. printk(KERN_WARNING "rackmeter: Incorrect DMA mark 0x%08x\n",
  286. mark);
  287. /* We allow for 3 errors like that (stale DBDMA irqs) */
  288. if (++rm->stale_irq > 3) {
  289. printk(KERN_ERR "rackmeter: Too many errors,"
  290. " stopping DMA\n");
  291. DBDMA_DO_RESET(rm->dma_regs);
  292. }
  293. return IRQ_HANDLED;
  294. }
  295. /* Next buffer we need to fill is mark value */
  296. buf = mark == 1 ? db->buf1 : db->buf2;
  297. /* Fill it now. This routine converts the 8 bits depth sample array
  298. * into the PWM bitmap for each LED.
  299. */
  300. for (i = 0; i < SAMPLE_COUNT; i++)
  301. buf[i] = rackmeter_calc_sample(rm, i);
  302. return IRQ_HANDLED;
  303. }
  304. static int rackmeter_probe(struct macio_dev* mdev,
  305. const struct of_device_id *match)
  306. {
  307. struct device_node *i2s = NULL, *np = NULL;
  308. struct rackmeter *rm = NULL;
  309. struct resource ri2s, rdma;
  310. int rc = -ENODEV;
  311. pr_debug("rackmeter_probe()\n");
  312. /* Get i2s-a node */
  313. while ((i2s = of_get_next_child(mdev->ofdev.dev.of_node, i2s)) != NULL)
  314. if (strcmp(i2s->name, "i2s-a") == 0)
  315. break;
  316. if (i2s == NULL) {
  317. pr_debug(" i2s-a child not found\n");
  318. goto bail;
  319. }
  320. /* Get lightshow or virtual sound */
  321. while ((np = of_get_next_child(i2s, np)) != NULL) {
  322. if (strcmp(np->name, "lightshow") == 0)
  323. break;
  324. if ((strcmp(np->name, "sound") == 0) &&
  325. of_get_property(np, "virtual", NULL) != NULL)
  326. break;
  327. }
  328. if (np == NULL) {
  329. pr_debug(" lightshow or sound+virtual child not found\n");
  330. goto bail;
  331. }
  332. /* Create and initialize our instance data */
  333. rm = kzalloc(sizeof(struct rackmeter), GFP_KERNEL);
  334. if (rm == NULL) {
  335. printk(KERN_ERR "rackmeter: failed to allocate memory !\n");
  336. rc = -ENOMEM;
  337. goto bail_release;
  338. }
  339. rm->mdev = mdev;
  340. rm->i2s = i2s;
  341. mutex_init(&rm->sem);
  342. dev_set_drvdata(&mdev->ofdev.dev, rm);
  343. /* Check resources availability. We need at least resource 0 and 1 */
  344. #if 0 /* Use that when i2s-a is finally an mdev per-se */
  345. if (macio_resource_count(mdev) < 2 || macio_irq_count(mdev) < 2) {
  346. printk(KERN_ERR
  347. "rackmeter: found match but lacks resources: %s"
  348. " (%d resources, %d interrupts)\n",
  349. mdev->ofdev.node->full_name);
  350. rc = -ENXIO;
  351. goto bail_free;
  352. }
  353. if (macio_request_resources(mdev, "rackmeter")) {
  354. printk(KERN_ERR
  355. "rackmeter: failed to request resources: %s\n",
  356. mdev->ofdev.node->full_name);
  357. rc = -EBUSY;
  358. goto bail_free;
  359. }
  360. rm->irq = macio_irq(mdev, 1);
  361. #else
  362. rm->irq = irq_of_parse_and_map(i2s, 1);
  363. if (!rm->irq ||
  364. of_address_to_resource(i2s, 0, &ri2s) ||
  365. of_address_to_resource(i2s, 1, &rdma)) {
  366. printk(KERN_ERR
  367. "rackmeter: found match but lacks resources: %s",
  368. mdev->ofdev.dev.of_node->full_name);
  369. rc = -ENXIO;
  370. goto bail_free;
  371. }
  372. #endif
  373. pr_debug(" i2s @0x%08x\n", (unsigned int)ri2s.start);
  374. pr_debug(" dma @0x%08x\n", (unsigned int)rdma.start);
  375. pr_debug(" irq %d\n", rm->irq);
  376. rm->ubuf = (u8 *)__get_free_page(GFP_KERNEL);
  377. if (rm->ubuf == NULL) {
  378. printk(KERN_ERR
  379. "rackmeter: failed to allocate samples page !\n");
  380. rc = -ENOMEM;
  381. goto bail_release;
  382. }
  383. rm->dma_buf_v = dma_alloc_coherent(&macio_get_pci_dev(mdev)->dev,
  384. sizeof(struct rackmeter_dma),
  385. &rm->dma_buf_p, GFP_KERNEL);
  386. if (rm->dma_buf_v == NULL) {
  387. printk(KERN_ERR
  388. "rackmeter: failed to allocate dma buffer !\n");
  389. rc = -ENOMEM;
  390. goto bail_free_samples;
  391. }
  392. #if 0
  393. rm->i2s_regs = ioremap(macio_resource_start(mdev, 0), 0x1000);
  394. #else
  395. rm->i2s_regs = ioremap(ri2s.start, 0x1000);
  396. #endif
  397. if (rm->i2s_regs == NULL) {
  398. printk(KERN_ERR
  399. "rackmeter: failed to map i2s registers !\n");
  400. rc = -ENXIO;
  401. goto bail_free_dma;
  402. }
  403. #if 0
  404. rm->dma_regs = ioremap(macio_resource_start(mdev, 1), 0x100);
  405. #else
  406. rm->dma_regs = ioremap(rdma.start, 0x100);
  407. #endif
  408. if (rm->dma_regs == NULL) {
  409. printk(KERN_ERR
  410. "rackmeter: failed to map dma registers !\n");
  411. rc = -ENXIO;
  412. goto bail_unmap_i2s;
  413. }
  414. rc = rackmeter_setup(rm);
  415. if (rc) {
  416. printk(KERN_ERR
  417. "rackmeter: failed to initialize !\n");
  418. rc = -ENXIO;
  419. goto bail_unmap_dma;
  420. }
  421. rc = request_irq(rm->irq, rackmeter_irq, 0, "rackmeter", rm);
  422. if (rc != 0) {
  423. printk(KERN_ERR
  424. "rackmeter: failed to request interrupt !\n");
  425. goto bail_stop_dma;
  426. }
  427. of_node_put(np);
  428. return 0;
  429. bail_stop_dma:
  430. DBDMA_DO_RESET(rm->dma_regs);
  431. bail_unmap_dma:
  432. iounmap(rm->dma_regs);
  433. bail_unmap_i2s:
  434. iounmap(rm->i2s_regs);
  435. bail_free_dma:
  436. dma_free_coherent(&macio_get_pci_dev(mdev)->dev,
  437. sizeof(struct rackmeter_dma),
  438. rm->dma_buf_v, rm->dma_buf_p);
  439. bail_free_samples:
  440. free_page((unsigned long)rm->ubuf);
  441. bail_release:
  442. #if 0
  443. macio_release_resources(mdev);
  444. #endif
  445. bail_free:
  446. kfree(rm);
  447. bail:
  448. of_node_put(i2s);
  449. of_node_put(np);
  450. dev_set_drvdata(&mdev->ofdev.dev, NULL);
  451. return rc;
  452. }
  453. static int rackmeter_remove(struct macio_dev* mdev)
  454. {
  455. struct rackmeter *rm = dev_get_drvdata(&mdev->ofdev.dev);
  456. /* Stop CPU sniffer timer & work queues */
  457. rackmeter_stop_cpu_sniffer(rm);
  458. /* Clear reference to private data */
  459. dev_set_drvdata(&mdev->ofdev.dev, NULL);
  460. /* Stop/reset dbdma */
  461. DBDMA_DO_RESET(rm->dma_regs);
  462. /* Release the IRQ */
  463. free_irq(rm->irq, rm);
  464. /* Unmap registers */
  465. iounmap(rm->dma_regs);
  466. iounmap(rm->i2s_regs);
  467. /* Free DMA */
  468. dma_free_coherent(&macio_get_pci_dev(mdev)->dev,
  469. sizeof(struct rackmeter_dma),
  470. rm->dma_buf_v, rm->dma_buf_p);
  471. /* Free samples */
  472. free_page((unsigned long)rm->ubuf);
  473. #if 0
  474. /* Release resources */
  475. macio_release_resources(mdev);
  476. #endif
  477. /* Get rid of me */
  478. kfree(rm);
  479. return 0;
  480. }
  481. static int rackmeter_shutdown(struct macio_dev* mdev)
  482. {
  483. struct rackmeter *rm = dev_get_drvdata(&mdev->ofdev.dev);
  484. if (rm == NULL)
  485. return -ENODEV;
  486. /* Stop CPU sniffer timer & work queues */
  487. rackmeter_stop_cpu_sniffer(rm);
  488. /* Stop/reset dbdma */
  489. DBDMA_DO_RESET(rm->dma_regs);
  490. return 0;
  491. }
  492. static struct of_device_id rackmeter_match[] = {
  493. { .name = "i2s" },
  494. { }
  495. };
  496. MODULE_DEVICE_TABLE(of, rackmeter_match);
  497. static struct macio_driver rackmeter_driver = {
  498. .driver = {
  499. .name = "rackmeter",
  500. .owner = THIS_MODULE,
  501. .of_match_table = rackmeter_match,
  502. },
  503. .probe = rackmeter_probe,
  504. .remove = rackmeter_remove,
  505. .shutdown = rackmeter_shutdown,
  506. };
  507. static int __init rackmeter_init(void)
  508. {
  509. pr_debug("rackmeter_init()\n");
  510. return macio_register_driver(&rackmeter_driver);
  511. }
  512. static void __exit rackmeter_exit(void)
  513. {
  514. pr_debug("rackmeter_exit()\n");
  515. macio_unregister_driver(&rackmeter_driver);
  516. }
  517. module_init(rackmeter_init);
  518. module_exit(rackmeter_exit);
  519. MODULE_LICENSE("GPL");
  520. MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
  521. MODULE_DESCRIPTION("RackMeter: Support vu-meter on XServe front panel");