2 * linux/drivers/net/irda/sa1100_ir.c
4 * Copyright (C) 2000-2001 Russell King
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * Infra-red driver for the StrongARM SA1100 embedded microprocessor
12 * Note that we don't have to worry about the SA1111's DMA bugs in here,
13 * so we use the straight forward dma_map_* functions with a null pointer.
15 * This driver takes one kernel command line parameter, sa1100ir=, with
16 * the following options:
17 * max_rate:baudrate - set the maximum baud rate
18 * power_leve:level - set the transmitter power level
19 * tx_lpm:0|1 - set transmit low power mode
21 #include <linux/config.h>
22 #include <linux/module.h>
23 #include <linux/moduleparam.h>
24 #include <linux/types.h>
25 #include <linux/init.h>
26 #include <linux/errno.h>
27 #include <linux/netdevice.h>
28 #include <linux/slab.h>
29 #include <linux/rtnetlink.h>
30 #include <linux/interrupt.h>
31 #include <linux/delay.h>
32 #include <linux/device.h>
33 #include <linux/dma-mapping.h>
35 #include <net/irda/irda.h>
36 #include <net/irda/wrapper.h>
37 #include <net/irda/irda_device.h>
41 #include <asm/hardware.h>
42 #include <asm/mach-types.h>
44 #include <asm/arch/assabet.h>
45 #include <asm/arch/h3600.h>
46 #include <asm/arch/yopy.h>
49 #define GPIO_IRDA_FIR (0)
52 #ifndef GPIO_IRDA_POWER
53 #define GPIO_IRDA_POWER (0)
56 static int power_level = 3;
58 static int max_rate = 4000000;
69 struct sk_buff *txskb;
70 struct sk_buff *rxskb;
76 struct net_device_stats stats;
78 struct irlap_cb *irlap;
85 #define IS_FIR(si) ((si)->speed >= 4000000)
87 #define HPSIR_MAX_RXLEN 2047
90 * Allocate and map the receive buffer, unless it is already allocated.
92 static int sa1100_irda_rx_alloc(struct sa1100_irda *si)
97 si->rxskb = alloc_skb(HPSIR_MAX_RXLEN + 1, GFP_ATOMIC);
100 printk(KERN_ERR "sa1100_ir: out of memory for RX SKB\n");
105 * Align any IP headers that may be contained
108 skb_reserve(si->rxskb, 1);
110 si->rxbuf_dma = dma_map_single(si->dev, si->rxskb->data,
117 * We want to get here as soon as possible, and get the receiver setup.
118 * We use the existing buffer.
120 static void sa1100_irda_rx_dma_start(struct sa1100_irda *si)
123 printk(KERN_ERR "sa1100_ir: rx buffer went missing\n");
128 * First empty receive FIFO
130 Ser2HSCR0 = si->hscr0 | HSCR0_HSSP;
133 * Enable the DMA, receiver and receive interrupt.
135 sa1100_clear_dma(si->rxdma);
136 sa1100_start_dma(si->rxdma, si->rxbuf_dma, HPSIR_MAX_RXLEN);
137 Ser2HSCR0 = si->hscr0 | HSCR0_HSSP | HSCR0_RXE;
141 * Set the IrDA communications speed.
143 static int sa1100_irda_set_speed(struct sa1100_irda *si, int speed)
146 int brd, ret = -EINVAL;
149 case 9600: case 19200: case 38400:
150 case 57600: case 115200:
151 brd = 3686400 / (16 * speed) - 1;
154 * Stop the receive DMA.
157 sa1100_stop_dma(si->rxdma);
159 local_irq_save(flags);
162 Ser2HSCR0 = HSCR0_UART;
164 Ser2UTCR1 = brd >> 8;
168 * Clear status register
170 Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID;
171 Ser2UTCR3 = UTCR3_RIE | UTCR3_RXE | UTCR3_TXE;
173 if (machine_is_assabet())
174 ASSABET_BCR_clear(ASSABET_BCR_IRDA_FSEL);
175 if (machine_is_h3xxx())
176 clr_h3600_egpio(IPAQ_EGPIO_IR_FSEL);
177 if (machine_is_yopy())
178 PPSR &= ~GPIO_IRDA_FIR;
182 local_irq_restore(flags);
187 local_irq_save(flags);
192 Ser2HSCR0 = si->hscr0 | HSCR0_HSSP;
197 if (machine_is_assabet())
198 ASSABET_BCR_set(ASSABET_BCR_IRDA_FSEL);
199 if (machine_is_h3xxx())
200 set_h3600_egpio(IPAQ_EGPIO_IR_FSEL);
201 if (machine_is_yopy())
202 PPSR |= GPIO_IRDA_FIR;
204 sa1100_irda_rx_alloc(si);
205 sa1100_irda_rx_dma_start(si);
207 local_irq_restore(flags);
219 * This sets the IRDA power level on the Assabet.
222 sa1100_irda_set_power_assabet(struct sa1100_irda *si, unsigned int state)
224 static unsigned int bcr_state[4] = {
225 ASSABET_BCR_IRDA_MD0,
226 ASSABET_BCR_IRDA_MD1|ASSABET_BCR_IRDA_MD0,
227 ASSABET_BCR_IRDA_MD1,
232 state = bcr_state[state];
233 ASSABET_BCR_clear(state ^ (ASSABET_BCR_IRDA_MD1|
234 ASSABET_BCR_IRDA_MD0));
235 ASSABET_BCR_set(state);
241 * This turns the IRDA power on or off on the Compaq H3600
244 sa1100_irda_set_power_h3600(struct sa1100_irda *si, unsigned int state)
246 assign_h3600_egpio( IPAQ_EGPIO_IR_ON, state );
251 * This turns the IRDA power on or off on the Yopy
254 sa1100_irda_set_power_yopy(struct sa1100_irda *si, unsigned int state)
257 PPSR &= ~GPIO_IRDA_POWER;
259 PPSR |= GPIO_IRDA_POWER;
264 * Control the power state of the IrDA transmitter.
267 * 1 - short range, lowest power
268 * 2 - medium range, medium power
269 * 3 - maximum range, high power
271 * Currently, only assabet is known to support this.
274 __sa1100_irda_set_power(struct sa1100_irda *si, unsigned int state)
278 if (machine_is_assabet())
279 ret = sa1100_irda_set_power_assabet(si, state);
280 if (machine_is_h3xxx())
281 ret = sa1100_irda_set_power_h3600(si, state);
282 if (machine_is_yopy())
283 ret = sa1100_irda_set_power_yopy(si, state);
289 sa1100_set_power(struct sa1100_irda *si, unsigned int state)
293 ret = __sa1100_irda_set_power(si, state);
300 static int sa1100_irda_startup(struct sa1100_irda *si)
305 * Ensure that the ports for this device are setup correctly.
307 if (machine_is_yopy()) {
308 PPDR |= GPIO_IRDA_POWER | GPIO_IRDA_FIR;
309 PPSR |= GPIO_IRDA_POWER | GPIO_IRDA_FIR;
310 PSDR |= GPIO_IRDA_POWER | GPIO_IRDA_FIR;
314 * Configure PPC for IRDA - we want to drive TXD2 low.
315 * We also want to drive this pin low during sleep.
322 * Enable HP-SIR modulation, and ensure that the port is disabled.
325 Ser2HSCR0 = HSCR0_UART;
326 Ser2UTCR4 = si->utcr4;
327 Ser2UTCR0 = UTCR0_8BitData;
328 Ser2HSCR2 = HSCR2_TrDataH | HSCR2_RcDataL;
331 * Clear status register
333 Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID;
335 ret = sa1100_irda_set_speed(si, si->speed = 9600);
342 static void sa1100_irda_shutdown(struct sa1100_irda *si)
345 * Stop all DMA activity.
347 sa1100_stop_dma(si->rxdma);
348 sa1100_stop_dma(si->txdma);
350 /* Disable the port. */
357 * Suspend the IrDA interface.
359 static int sa1100_irda_suspend(struct device *_dev, u32 state, u32 level)
361 struct net_device *dev = dev_get_drvdata(_dev);
362 struct sa1100_irda *si;
364 if (!dev || level != SUSPEND_DISABLE)
370 * Stop the transmit queue
372 netif_device_detach(dev);
373 disable_irq(dev->irq);
374 sa1100_irda_shutdown(si);
375 __sa1100_irda_set_power(si, 0);
382 * Resume the IrDA interface.
384 static int sa1100_irda_resume(struct device *_dev, u32 level)
386 struct net_device *dev = dev_get_drvdata(_dev);
387 struct sa1100_irda *si;
389 if (!dev || level != RESUME_ENABLE)
395 * If we missed a speed change, initialise at the new speed
396 * directly. It is debatable whether this is actually
397 * required, but in the interests of continuing from where
398 * we left off it is desireable. The converse argument is
399 * that we should re-negotiate at 9600 baud again.
402 si->speed = si->newspeed;
406 sa1100_irda_startup(si);
407 __sa1100_irda_set_power(si, si->power);
408 enable_irq(dev->irq);
411 * This automatically wakes up the queue
413 netif_device_attach(dev);
419 #define sa1100_irda_suspend NULL
420 #define sa1100_irda_resume NULL
424 * HP-SIR format interrupt service routines.
426 static void sa1100_irda_hpsir_irq(struct net_device *dev)
428 struct sa1100_irda *si = dev->priv;
434 * Deal with any receive errors first. The bytes in error may be
435 * the only bytes in the receive FIFO, so we do this first.
437 while (status & UTSR0_EIF) {
443 if (stat & (UTSR1_FRE | UTSR1_ROR)) {
444 si->stats.rx_errors++;
445 if (stat & UTSR1_FRE)
446 si->stats.rx_frame_errors++;
447 if (stat & UTSR1_ROR)
448 si->stats.rx_fifo_errors++;
450 async_unwrap_char(dev, &si->stats, &si->rx_buff, data);
456 * We must clear certain bits.
458 Ser2UTSR0 = status & (UTSR0_RID | UTSR0_RBB | UTSR0_REB);
460 if (status & UTSR0_RFS) {
462 * There are at least 4 bytes in the FIFO. Read 3 bytes
463 * and leave the rest to the block below.
465 async_unwrap_char(dev, &si->stats, &si->rx_buff, Ser2UTDR);
466 async_unwrap_char(dev, &si->stats, &si->rx_buff, Ser2UTDR);
467 async_unwrap_char(dev, &si->stats, &si->rx_buff, Ser2UTDR);
470 if (status & (UTSR0_RFS | UTSR0_RID)) {
472 * Fifo contains more than 1 character.
475 async_unwrap_char(dev, &si->stats, &si->rx_buff,
477 } while (Ser2UTSR1 & UTSR1_RNE);
479 dev->last_rx = jiffies;
482 if (status & UTSR0_TFS && si->tx_buff.len) {
484 * Transmitter FIFO is not full
487 Ser2UTDR = *si->tx_buff.data++;
488 si->tx_buff.len -= 1;
489 } while (Ser2UTSR1 & UTSR1_TNF && si->tx_buff.len);
491 if (si->tx_buff.len == 0) {
492 si->stats.tx_packets++;
493 si->stats.tx_bytes += si->tx_buff.data -
497 * We need to ensure that the transmitter has
502 while (Ser2UTSR1 & UTSR1_TBY);
505 * Ok, we've finished transmitting. Now enable
506 * the receiver. Sometimes we get a receive IRQ
507 * immediately after a transmit...
509 Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID;
510 Ser2UTCR3 = UTCR3_RIE | UTCR3_RXE | UTCR3_TXE;
513 sa1100_irda_set_speed(si, si->newspeed);
518 netif_wake_queue(dev);
523 static void sa1100_irda_fir_error(struct sa1100_irda *si, struct net_device *dev)
525 struct sk_buff *skb = si->rxskb;
527 unsigned int len, stat, data;
530 printk(KERN_ERR "sa1100_ir: SKB is NULL!\n");
535 * Get the current data position.
537 dma_addr = sa1100_get_dma_pos(si->rxdma);
538 len = dma_addr - si->rxbuf_dma;
539 if (len > HPSIR_MAX_RXLEN)
540 len = HPSIR_MAX_RXLEN;
541 dma_unmap_single(si->dev, si->rxbuf_dma, len, DMA_FROM_DEVICE);
545 * Read Status, and then Data.
551 if (stat & (HSSR1_CRE | HSSR1_ROR)) {
552 si->stats.rx_errors++;
553 if (stat & HSSR1_CRE)
554 si->stats.rx_crc_errors++;
555 if (stat & HSSR1_ROR)
556 si->stats.rx_frame_errors++;
558 skb->data[len++] = data;
561 * If we hit the end of frame, there's
562 * no point in continuing.
564 if (stat & HSSR1_EOF)
566 } while (Ser2HSSR0 & HSSR0_EIF);
568 if (stat & HSSR1_EOF) {
573 skb->mac.raw = skb->data;
574 skb->protocol = htons(ETH_P_IRDA);
575 si->stats.rx_packets++;
576 si->stats.rx_bytes += len;
579 * Before we pass the buffer up, allocate a new one.
581 sa1100_irda_rx_alloc(si);
584 dev->last_rx = jiffies;
589 si->rxbuf_dma = dma_map_single(si->dev, si->rxskb->data,
596 * FIR format interrupt service routine. We only have to
597 * handle RX events; transmit events go via the TX DMA handler.
599 * No matter what, we disable RX, process, and the restart RX.
601 static void sa1100_irda_fir_irq(struct net_device *dev)
603 struct sa1100_irda *si = dev->priv;
608 sa1100_stop_dma(si->rxdma);
611 * Framing error - we throw away the packet completely.
612 * Clearing RXE flushes the error conditions and data
615 if (Ser2HSSR0 & (HSSR0_FRE | HSSR0_RAB)) {
616 si->stats.rx_errors++;
618 if (Ser2HSSR0 & HSSR0_FRE)
619 si->stats.rx_frame_errors++;
622 * Clear out the DMA...
624 Ser2HSCR0 = si->hscr0 | HSCR0_HSSP;
627 * Clear selected status bits now, so we
628 * don't miss them next time around.
630 Ser2HSSR0 = HSSR0_FRE | HSSR0_RAB;
634 * Deal with any receive errors. The any of the lowest
635 * 8 bytes in the FIFO may contain an error. We must read
636 * them one by one. The "error" could even be the end of
639 if (Ser2HSSR0 & HSSR0_EIF)
640 sa1100_irda_fir_error(si, dev);
643 * No matter what happens, we must restart reception.
645 sa1100_irda_rx_dma_start(si);
648 static irqreturn_t sa1100_irda_irq(int irq, void *dev_id, struct pt_regs *regs)
650 struct net_device *dev = dev_id;
651 if (IS_FIR(((struct sa1100_irda *)dev->priv)))
652 sa1100_irda_fir_irq(dev);
654 sa1100_irda_hpsir_irq(dev);
659 * TX DMA completion handler.
661 static void sa1100_irda_txdma_irq(void *id)
663 struct net_device *dev = id;
664 struct sa1100_irda *si = dev->priv;
665 struct sk_buff *skb = si->txskb;
670 * Wait for the transmission to complete. Unfortunately,
671 * the hardware doesn't give us an interrupt to indicate
676 while (!(Ser2HSSR0 & HSSR0_TUR) || Ser2HSSR1 & HSSR1_TBY);
679 * Clear the transmit underrun bit.
681 Ser2HSSR0 = HSSR0_TUR;
684 * Do we need to change speed? Note that we're lazy
685 * here - we don't free the old rxskb. We don't need
686 * to allocate a buffer either.
689 sa1100_irda_set_speed(si, si->newspeed);
694 * Start reception. This disables the transmitter for
695 * us. This will be using the existing RX buffer.
697 sa1100_irda_rx_dma_start(si);
700 * Account and free the packet.
703 dma_unmap_single(si->dev, si->txbuf_dma, skb->len, DMA_TO_DEVICE);
704 si->stats.tx_packets ++;
705 si->stats.tx_bytes += skb->len;
706 dev_kfree_skb_irq(skb);
710 * Make sure that the TX queue is available for sending
711 * (for retries). TX has priority over RX at all times.
713 netif_wake_queue(dev);
716 static int sa1100_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev)
718 struct sa1100_irda *si = dev->priv;
719 int speed = irda_get_next_speed(skb);
722 * Does this packet contain a request to change the interface
723 * speed? If so, remember it until we complete the transmission
726 if (speed != si->speed && speed != -1)
727 si->newspeed = speed;
730 * If this is an empty frame, we can bypass a lot.
735 sa1100_irda_set_speed(si, speed);
742 netif_stop_queue(dev);
744 si->tx_buff.data = si->tx_buff.head;
745 si->tx_buff.len = async_wrap_skb(skb, si->tx_buff.data,
746 si->tx_buff.truesize);
749 * Set the transmit interrupt enable. This will fire
750 * off an interrupt immediately. Note that we disable
751 * the receiver so we won't get spurious characteres
754 Ser2UTCR3 = UTCR3_TIE | UTCR3_TXE;
758 int mtt = irda_get_mtt(skb);
761 * We must not be transmitting...
766 netif_stop_queue(dev);
769 si->txbuf_dma = dma_map_single(si->dev, skb->data,
770 skb->len, DMA_TO_DEVICE);
772 sa1100_start_dma(si->txdma, si->txbuf_dma, skb->len);
775 * If we have a mean turn-around time, impose the specified
776 * specified delay. We could shorten this by timing from
777 * the point we received the packet.
782 Ser2HSCR0 = si->hscr0 | HSCR0_HSSP | HSCR0_TXE;
785 dev->trans_start = jiffies;
791 sa1100_irda_ioctl(struct net_device *dev, struct ifreq *ifreq, int cmd)
793 struct if_irda_req *rq = (struct if_irda_req *)ifreq;
794 struct sa1100_irda *si = dev->priv;
795 int ret = -EOPNOTSUPP;
799 if (capable(CAP_NET_ADMIN)) {
801 * We are unable to set the speed if the
802 * device is not running.
805 ret = sa1100_irda_set_speed(si,
808 printk("sa1100_irda_ioctl: SIOCSBANDWIDTH: !netif_running\n");
816 if (capable(CAP_NET_ADMIN)) {
817 irda_device_set_media_busy(dev, TRUE);
823 rq->ifr_receiving = IS_FIR(si) ? 0
824 : si->rx_buff.state != OUTSIDE_FRAME;
834 static struct net_device_stats *sa1100_irda_stats(struct net_device *dev)
836 struct sa1100_irda *si = dev->priv;
840 static int sa1100_irda_start(struct net_device *dev)
842 struct sa1100_irda *si = dev->priv;
847 err = request_irq(dev->irq, sa1100_irda_irq, 0, dev->name, dev);
851 err = sa1100_request_dma(DMA_Ser2HSSPRd, "IrDA receive",
852 NULL, NULL, &si->rxdma);
856 err = sa1100_request_dma(DMA_Ser2HSSPWr, "IrDA transmit",
857 sa1100_irda_txdma_irq, dev, &si->txdma);
862 * The interrupt must remain disabled for now.
864 disable_irq(dev->irq);
867 * Setup the serial port for the specified speed.
869 err = sa1100_irda_startup(si);
874 * Open a new IrLAP layer instance.
876 si->irlap = irlap_open(dev, &si->qos, "sa1100");
882 * Now enable the interrupt and start the queue
885 sa1100_set_power(si, power_level); /* low power mode */
886 enable_irq(dev->irq);
887 netif_start_queue(dev);
892 sa1100_irda_shutdown(si);
894 sa1100_free_dma(si->txdma);
896 sa1100_free_dma(si->rxdma);
898 free_irq(dev->irq, dev);
903 static int sa1100_irda_stop(struct net_device *dev)
905 struct sa1100_irda *si = dev->priv;
907 disable_irq(dev->irq);
908 sa1100_irda_shutdown(si);
911 * If we have been doing DMA receive, make sure we
912 * tidy that up cleanly.
915 dma_unmap_single(si->dev, si->rxbuf_dma, HPSIR_MAX_RXLEN,
917 dev_kfree_skb(si->rxskb);
923 irlap_close(si->irlap);
927 netif_stop_queue(dev);
933 sa1100_free_dma(si->txdma);
934 sa1100_free_dma(si->rxdma);
935 free_irq(dev->irq, dev);
937 sa1100_set_power(si, 0);
942 static int sa1100_irda_init_iobuf(iobuff_t *io, int size)
944 io->head = kmalloc(size, GFP_KERNEL | GFP_DMA);
945 if (io->head != NULL) {
947 io->in_frame = FALSE;
948 io->state = OUTSIDE_FRAME;
951 return io->head ? 0 : -ENOMEM;
954 static int sa1100_irda_probe(struct device *_dev)
956 struct platform_device *pdev = to_platform_device(_dev);
957 struct net_device *dev;
958 struct sa1100_irda *si;
959 unsigned int baudrate_mask;
962 err = request_mem_region(__PREG(Ser2UTCR0), 0x24, "IrDA") ? 0 : -EBUSY;
965 err = request_mem_region(__PREG(Ser2HSCR0), 0x1c, "IrDA") ? 0 : -EBUSY;
968 err = request_mem_region(__PREG(Ser2HSCR2), 0x04, "IrDA") ? 0 : -EBUSY;
972 dev = alloc_irdadev(sizeof(struct sa1100_irda));
977 si->dev = &pdev->dev;
980 * Initialise the HP-SIR buffers
982 err = sa1100_irda_init_iobuf(&si->rx_buff, 14384);
985 err = sa1100_irda_init_iobuf(&si->tx_buff, 4000);
989 dev->hard_start_xmit = sa1100_irda_hard_xmit;
990 dev->open = sa1100_irda_start;
991 dev->stop = sa1100_irda_stop;
992 dev->do_ioctl = sa1100_irda_ioctl;
993 dev->get_stats = sa1100_irda_stats;
994 dev->irq = IRQ_Ser2ICP;
996 irda_init_max_qos_capabilies(&si->qos);
999 * We support original IRDA up to 115k2. (we don't currently
1000 * support 4Mbps). Min Turn Time set to 1ms or greater.
1002 baudrate_mask = IR_9600;
1005 case 4000000: baudrate_mask |= IR_4000000 << 8;
1006 case 115200: baudrate_mask |= IR_115200;
1007 case 57600: baudrate_mask |= IR_57600;
1008 case 38400: baudrate_mask |= IR_38400;
1009 case 19200: baudrate_mask |= IR_19200;
1012 si->qos.baud_rate.bits &= baudrate_mask;
1013 si->qos.min_turn_time.bits = 7;
1015 irda_qos_bits_to_value(&si->qos);
1017 si->utcr4 = UTCR4_HPSIR;
1019 si->utcr4 |= UTCR4_Z1_6us;
1022 * Initially enable HP-SIR modulation, and ensure that the port
1026 Ser2UTCR4 = si->utcr4;
1027 Ser2HSCR0 = HSCR0_UART;
1029 err = register_netdev(dev);
1031 dev_set_drvdata(&pdev->dev, si);
1035 kfree(si->tx_buff.head);
1036 kfree(si->rx_buff.head);
1039 release_mem_region(__PREG(Ser2HSCR2), 0x04);
1041 release_mem_region(__PREG(Ser2HSCR0), 0x1c);
1043 release_mem_region(__PREG(Ser2UTCR0), 0x24);
1049 static int sa1100_irda_remove(struct device *_dev)
1051 struct net_device *dev = dev_get_drvdata(_dev);
1054 struct sa1100_irda *si = dev->priv;
1055 unregister_netdev(dev);
1056 kfree(si->tx_buff.head);
1057 kfree(si->rx_buff.head);
1061 release_mem_region(__PREG(Ser2HSCR2), 0x04);
1062 release_mem_region(__PREG(Ser2HSCR0), 0x1c);
1063 release_mem_region(__PREG(Ser2UTCR0), 0x24);
1068 static struct device_driver sa1100ir_driver = {
1069 .name = "sa11x0-ir",
1070 .bus = &platform_bus_type,
1071 .probe = sa1100_irda_probe,
1072 .remove = sa1100_irda_remove,
1073 .suspend = sa1100_irda_suspend,
1074 .resume = sa1100_irda_resume,
1077 static struct platform_device sa1100ir_device = {
1078 .name = "sa11x0-ir",
1082 static int __init sa1100_irda_init(void)
1087 * Limit power level a sensible range.
1089 if (power_level < 1)
1091 if (power_level > 3)
1094 ret = driver_register(&sa1100ir_driver);
1096 ret = platform_device_register(&sa1100ir_device);
1098 driver_unregister(&sa1100ir_driver);
1103 static void __exit sa1100_irda_exit(void)
1105 driver_unregister(&sa1100ir_driver);
1106 platform_device_unregister(&sa1100ir_device);
1109 module_init(sa1100_irda_init);
1110 module_exit(sa1100_irda_exit);
1111 module_param(power_level, int, 0);
1112 module_param(tx_lpm, int, 0);
1113 module_param(max_rate, int, 0);
1115 MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>");
1116 MODULE_DESCRIPTION("StrongARM SA1100 IrDA driver");
1117 MODULE_LICENSE("GPL");
1118 MODULE_PARM_DESC(power_level, "IrDA power level, 1 (low) to 3 (high)");
1119 MODULE_PARM_DESC(tx_lpm, "Enable transmitter low power (1.6us) mode");
1120 MODULE_PARM_DESC(max_rate, "Maximum baud rate (4000000, 115200, 57600, 38400, 19200, 9600)");