Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / net / irda / old_belkin.c
blob26f81fd283713b3d784376dd498ec152c87fa878
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>
12 * Copyright (c) 1999 Jean Tourrilhes, All Rights Reserved.
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.
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.
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
29 ********************************************************************/
31 #include <linux/module.h>
32 #include <linux/delay.h>
33 #include <linux/tty.h>
34 #include <linux/init.h>
36 #include <net/irda/irda.h>
37 #include <net/irda/irda_device.h>
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...
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...
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...
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".
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 ;-)
65 /* Let's guess */
66 #define MIN_DELAY 25 /* 15 us, but wait a little more to be sure */
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);
73 /* These are the baudrates supported */
74 /* static __u32 baud_rates[] = { 9600 }; */
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,
85 static int __init old_belkin_init(void)
87 return irda_device_register_dongle(&dongle);
90 static void __exit old_belkin_cleanup(void)
92 irda_device_unregister_dongle(&dongle);
95 static void old_belkin_open(dongle_t *self, struct qos_info *qos)
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;
103 static void old_belkin_close(dongle_t *self)
105 /* Power off dongle */
106 self->set_dtr_rts(self->dev, FALSE, FALSE);
110 * Function old_belkin_change_speed (task)
112 * With only one speed available, not much to do...
114 static int old_belkin_change_speed(struct irda_task *task)
116 irda_task_next_state(task, IRDA_TASK_DONE);
118 return 0;
122 * Function old_belkin_reset (task)
124 * Reset the Old-Belkin type dongle.
127 static int old_belkin_reset(struct irda_task *task)
129 dongle_t *self = (dongle_t *) task->instance;
131 /* Power on dongle */
132 self->set_dtr_rts(self->dev, TRUE, TRUE);
134 /* Sleep a minimum of 15 us */
135 udelay(MIN_DELAY);
137 /* This dongles speed "defaults" to 9600 bps ;-) */
138 self->speed = 9600;
140 irda_task_next_state(task, IRDA_TASK_DONE);
142 return 0;
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 */
151 * Function init_module (void)
153 * Initialize Old-Belkin module
156 module_init(old_belkin_init);
159 * Function cleanup_module (void)
161 * Cleanup Old-Belkin module
164 module_exit(old_belkin_cleanup);