diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/net/irda/old_belkin.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/net/irda/old_belkin.c')
-rw-r--r-- | drivers/net/irda/old_belkin.c | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/drivers/net/irda/old_belkin.c b/drivers/net/irda/old_belkin.c new file mode 100644 index 000000000000..26f81fd28371 --- /dev/null +++ b/drivers/net/irda/old_belkin.c | |||
@@ -0,0 +1,164 @@ | |||
1 | /********************************************************************* | ||
2 | * | ||
3 | * Filename: old_belkin.c | ||
4 | * Version: 1.1 | ||
5 | * Description: Driver for the Belkin (old) SmartBeam dongle | ||
6 | * Status: Experimental... | ||
7 | * Author: Jean Tourrilhes <jt@hpl.hp.com> | ||
8 | * Created at: 22/11/99 | ||
9 | * Modified at: Fri Dec 17 09:13:32 1999 | ||
10 | * Modified by: Dag Brattli <dagb@cs.uit.no> | ||
11 | * | ||
12 | * Copyright (c) 1999 Jean Tourrilhes, All Rights Reserved. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License as | ||
16 | * published by the Free Software Foundation; either version 2 of | ||
17 | * the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | * GNU General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, write to the Free Software | ||
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
27 | * MA 02111-1307 USA | ||
28 | * | ||
29 | ********************************************************************/ | ||
30 | |||
31 | #include <linux/module.h> | ||
32 | #include <linux/delay.h> | ||
33 | #include <linux/tty.h> | ||
34 | #include <linux/init.h> | ||
35 | |||
36 | #include <net/irda/irda.h> | ||
37 | #include <net/irda/irda_device.h> | ||
38 | |||
39 | /* | ||
40 | * Belkin is selling a dongle called the SmartBeam. | ||
41 | * In fact, there is two hardware version of this dongle, of course with | ||
42 | * the same name and looking the exactly same (grrr...). | ||
43 | * I guess that I've got the old one, because inside I don't have | ||
44 | * a jumper for IrDA/ASK... | ||
45 | * | ||
46 | * As far as I can make it from info on their web site, the old dongle | ||
47 | * support only 9600 b/s, which make our life much simpler as far as | ||
48 | * the driver is concerned, but you might not like it very much ;-) | ||
49 | * The new SmartBeam does 115 kb/s, and I've not tested it... | ||
50 | * | ||
51 | * Belkin claim that the correct driver for the old dongle (in Windows) | ||
52 | * is the generic Parallax 9500a driver, but the Linux LiteLink driver | ||
53 | * fails for me (probably because Linux-IrDA doesn't rate fallback), | ||
54 | * so I created this really dumb driver... | ||
55 | * | ||
56 | * In fact, this driver doesn't do much. The only thing it does is to | ||
57 | * prevent Linux-IrDA to use any other speed than 9600 b/s ;-) This | ||
58 | * driver is called "old_belkin" so that when the new SmartBeam is supported | ||
59 | * its driver can be called "belkin" instead of "new_belkin". | ||
60 | * | ||
61 | * Note : this driver was written without any info/help from Belkin, | ||
62 | * so a lot of info here might be totally wrong. Blame me ;-) | ||
63 | */ | ||
64 | |||
65 | /* Let's guess */ | ||
66 | #define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */ | ||
67 | |||
68 | static void old_belkin_open(dongle_t *self, struct qos_info *qos); | ||
69 | static void old_belkin_close(dongle_t *self); | ||
70 | static int old_belkin_change_speed(struct irda_task *task); | ||
71 | static int old_belkin_reset(struct irda_task *task); | ||
72 | |||
73 | /* These are the baudrates supported */ | ||
74 | /* static __u32 baud_rates[] = { 9600 }; */ | ||
75 | |||
76 | static struct dongle_reg dongle = { | ||
77 | .type = IRDA_OLD_BELKIN_DONGLE, | ||
78 | .open = old_belkin_open, | ||
79 | .close = old_belkin_close, | ||
80 | .reset = old_belkin_reset, | ||
81 | .change_speed = old_belkin_change_speed, | ||
82 | .owner = THIS_MODULE, | ||
83 | }; | ||
84 | |||
85 | static int __init old_belkin_init(void) | ||
86 | { | ||
87 | return irda_device_register_dongle(&dongle); | ||
88 | } | ||
89 | |||
90 | static void __exit old_belkin_cleanup(void) | ||
91 | { | ||
92 | irda_device_unregister_dongle(&dongle); | ||
93 | } | ||
94 | |||
95 | static void old_belkin_open(dongle_t *self, struct qos_info *qos) | ||
96 | { | ||
97 | /* Not too fast, please... */ | ||
98 | qos->baud_rate.bits &= IR_9600; | ||
99 | /* Needs at least 10 ms (totally wild guess, can do probably better) */ | ||
100 | qos->min_turn_time.bits = 0x01; | ||
101 | } | ||
102 | |||
103 | static void old_belkin_close(dongle_t *self) | ||
104 | { | ||
105 | /* Power off dongle */ | ||
106 | self->set_dtr_rts(self->dev, FALSE, FALSE); | ||
107 | } | ||
108 | |||
109 | /* | ||
110 | * Function old_belkin_change_speed (task) | ||
111 | * | ||
112 | * With only one speed available, not much to do... | ||
113 | */ | ||
114 | static int old_belkin_change_speed(struct irda_task *task) | ||
115 | { | ||
116 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * Function old_belkin_reset (task) | ||
123 | * | ||
124 | * Reset the Old-Belkin type dongle. | ||
125 | * | ||
126 | */ | ||
127 | static int old_belkin_reset(struct irda_task *task) | ||
128 | { | ||
129 | dongle_t *self = (dongle_t *) task->instance; | ||
130 | |||
131 | /* Power on dongle */ | ||
132 | self->set_dtr_rts(self->dev, TRUE, TRUE); | ||
133 | |||
134 | /* Sleep a minimum of 15 us */ | ||
135 | udelay(MIN_DELAY); | ||
136 | |||
137 | /* This dongles speed "defaults" to 9600 bps ;-) */ | ||
138 | self->speed = 9600; | ||
139 | |||
140 | irda_task_next_state(task, IRDA_TASK_DONE); | ||
141 | |||
142 | return 0; | ||
143 | } | ||
144 | |||
145 | MODULE_AUTHOR("Jean Tourrilhes <jt@hpl.hp.com>"); | ||
146 | MODULE_DESCRIPTION("Belkin (old) SmartBeam dongle driver"); | ||
147 | MODULE_LICENSE("GPL"); | ||
148 | MODULE_ALIAS("irda-dongle-7"); /* IRDA_OLD_BELKIN_DONGLE */ | ||
149 | |||
150 | /* | ||
151 | * Function init_module (void) | ||
152 | * | ||
153 | * Initialize Old-Belkin module | ||
154 | * | ||
155 | */ | ||
156 | module_init(old_belkin_init); | ||
157 | |||
158 | /* | ||
159 | * Function cleanup_module (void) | ||
160 | * | ||
161 | * Cleanup Old-Belkin module | ||
162 | * | ||
163 | */ | ||
164 | module_exit(old_belkin_cleanup); | ||