[PATCH] aic7xxx_osm build fix
[cris-mirror.git] / drivers / net / irda / esi.c
blobd3a61af6402d917557f6065b6262d9653145a5d9
1 /*********************************************************************
2 *
3 * Filename: esi.c
4 * Version: 1.5
5 * Description: Driver for the Extended Systems JetEye PC dongle
6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Sat Feb 21 18:54:38 1998
9 * Modified at: Fri Dec 17 09:14:04 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
12 * Copyright (c) 1999 Dag Brattli, <dagb@cs.uit.no>,
13 * Copyright (c) 1998 Thomas Davis, <ratbert@radiks.net>,
14 * All Rights Reserved.
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
31 ********************************************************************/
33 #include <linux/module.h>
34 #include <linux/delay.h>
35 #include <linux/tty.h>
36 #include <linux/init.h>
38 #include <net/irda/irda.h>
39 #include <net/irda/irda_device.h>
41 static void esi_open(dongle_t *self, struct qos_info *qos);
42 static void esi_close(dongle_t *self);
43 static int esi_change_speed(struct irda_task *task);
44 static int esi_reset(struct irda_task *task);
46 static struct dongle_reg dongle = {
47 .type = IRDA_ESI_DONGLE,
48 .open = esi_open,
49 .close = esi_close,
50 .reset = esi_reset,
51 .change_speed = esi_change_speed,
52 .owner = THIS_MODULE,
55 static int __init esi_init(void)
57 return irda_device_register_dongle(&dongle);
60 static void __exit esi_cleanup(void)
62 irda_device_unregister_dongle(&dongle);
65 static void esi_open(dongle_t *self, struct qos_info *qos)
67 qos->baud_rate.bits &= IR_9600|IR_19200|IR_115200;
68 qos->min_turn_time.bits = 0x01; /* Needs at least 10 ms */
71 static void esi_close(dongle_t *dongle)
73 /* Power off dongle */
74 dongle->set_dtr_rts(dongle->dev, FALSE, FALSE);
78 * Function esi_change_speed (task)
80 * Set the speed for the Extended Systems JetEye PC ESI-9680 type dongle
83 static int esi_change_speed(struct irda_task *task)
85 dongle_t *self = (dongle_t *) task->instance;
86 __u32 speed = (__u32) task->param;
87 int dtr, rts;
89 switch (speed) {
90 case 19200:
91 dtr = TRUE;
92 rts = FALSE;
93 break;
94 case 115200:
95 dtr = rts = TRUE;
96 break;
97 case 9600:
98 default:
99 dtr = FALSE;
100 rts = TRUE;
101 break;
104 /* Change speed of dongle */
105 self->set_dtr_rts(self->dev, dtr, rts);
106 self->speed = speed;
108 irda_task_next_state(task, IRDA_TASK_DONE);
110 return 0;
114 * Function esi_reset (task)
116 * Reset dongle;
119 static int esi_reset(struct irda_task *task)
121 dongle_t *self = (dongle_t *) task->instance;
123 self->set_dtr_rts(self->dev, FALSE, FALSE);
124 irda_task_next_state(task, IRDA_TASK_DONE);
126 return 0;
129 MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
130 MODULE_DESCRIPTION("Extended Systems JetEye PC dongle driver");
131 MODULE_LICENSE("GPL");
132 MODULE_ALIAS("irda-dongle-1"); /* IRDA_ESI_DONGLE */
135 * Function init_module (void)
137 * Initialize ESI module
140 module_init(esi_init);
143 * Function cleanup_module (void)
145 * Cleanup ESI module
148 module_exit(esi_cleanup);