[PATCH] sched: reduce task_struct size
[linux-2.6/kmemtrace.git] / drivers / net / irda / ep7211_ir.c
blob4cba38f7e4a85ceb73516bd4b56f4144950731ed
1 /*
2 * IR port driver for the Cirrus Logic EP7211 processor.
4 * Copyright 2001, Blue Mug Inc. All rights reserved.
5 */
7 #include <linux/module.h>
8 #include <linux/delay.h>
9 #include <linux/tty.h>
10 #include <linux/init.h>
11 #include <linux/spinlock.h>
13 #include <net/irda/irda.h>
14 #include <net/irda/irda_device.h>
16 #include <asm/io.h>
17 #include <asm/hardware.h>
19 #define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */
20 #define MAX_DELAY 10000 /* 1 ms */
22 static void ep7211_ir_open(dongle_t *self, struct qos_info *qos);
23 static void ep7211_ir_close(dongle_t *self);
24 static int ep7211_ir_change_speed(struct irda_task *task);
25 static int ep7211_ir_reset(struct irda_task *task);
27 static DEFINE_SPINLOCK(ep7211_lock);
29 static struct dongle_reg dongle = {
30 .type = IRDA_EP7211_IR,
31 .open = ep7211_ir_open,
32 .close = ep7211_ir_close,
33 .reset = ep7211_ir_reset,
34 .change_speed = ep7211_ir_change_speed,
35 .owner = THIS_MODULE,
38 static void ep7211_ir_open(dongle_t *self, struct qos_info *qos)
40 unsigned int syscon1, flags;
42 spin_lock_irqsave(&ep7211_lock, flags);
44 /* Turn on the SIR encoder. */
45 syscon1 = clps_readl(SYSCON1);
46 syscon1 |= SYSCON1_SIREN;
47 clps_writel(syscon1, SYSCON1);
49 /* XXX: We should disable modem status interrupts on the first
50 UART (interrupt #14). */
52 spin_unlock_irqrestore(&ep7211_lock, flags);
55 static void ep7211_ir_close(dongle_t *self)
57 unsigned int syscon1, flags;
59 spin_lock_irqsave(&ep7211_lock, flags);
61 /* Turn off the SIR encoder. */
62 syscon1 = clps_readl(SYSCON1);
63 syscon1 &= ~SYSCON1_SIREN;
64 clps_writel(syscon1, SYSCON1);
66 /* XXX: If we've disabled the modem status interrupts, we should
67 reset them back to their original state. */
69 spin_unlock_irqrestore(&ep7211_lock, flags);
73 * Function ep7211_ir_change_speed (task)
75 * Change speed of the EP7211 I/R port. We don't really have to do anything
76 * for the EP7211 as long as the rate is being changed at the serial port
77 * level.
79 static int ep7211_ir_change_speed(struct irda_task *task)
81 irda_task_next_state(task, IRDA_TASK_DONE);
82 return 0;
86 * Function ep7211_ir_reset (task)
88 * Reset the EP7211 I/R. We don't really have to do anything.
91 static int ep7211_ir_reset(struct irda_task *task)
93 irda_task_next_state(task, IRDA_TASK_DONE);
94 return 0;
98 * Function ep7211_ir_init(void)
100 * Initialize EP7211 I/R module
103 static int __init ep7211_ir_init(void)
105 return irda_device_register_dongle(&dongle);
109 * Function ep7211_ir_cleanup(void)
111 * Cleanup EP7211 I/R module
114 static void __exit ep7211_ir_cleanup(void)
116 irda_device_unregister_dongle(&dongle);
119 MODULE_AUTHOR("Jon McClintock <jonm@bluemug.com>");
120 MODULE_DESCRIPTION("EP7211 I/R driver");
121 MODULE_LICENSE("GPL");
122 MODULE_ALIAS("irda-dongle-8"); /* IRDA_EP7211_IR */
124 module_init(ep7211_ir_init);
125 module_exit(ep7211_ir_cleanup);