Debian Codegraph @

drivers/dahdi/xpp/xpp_dahdi.c

raw symbols SCIP
1 /*
2 * Written by Oron Peled <[email protected]>
3 * Copyright (C) 2004, Xorcom
4 *
5 * Derived from ztdummy
6 *
7 * Copyright (C) 2002, Hermes Softlab
8 * Copyright (C) 2004, Digium, Inc.
9 *
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 */
27 #include <linux/version.h>
28 #include <linux/kernel.h>
29 #include <linux/sched.h>
30 #include <linux/errno.h>
31 #include <linux/module.h>
32 #include <linux/device.h>
33 #include <linux/init.h>
34 #include <linux/delay.h> /* for udelay */
35 #include <linux/interrupt.h>
36 #include <linux/proc_fs.h>
37 #include <linux/seq_file.h>
38 #include <dahdi/kernel.h>
39 #include "xbus-core.h"
40 #include "xproto.h"
41 #include "xpp_dahdi.h"
42 #include "parport_debug.h"
43
44 static const char rcsid[] = "$Id$";
45
46 #ifdef CONFIG_PROC_FS
47 struct proc_dir_entry *xpp_proc_toplevel = NULL;
48 #define PROC_DIR "xpp"
49 #define PROC_XPD_SUMMARY "summary"
50 #endif
51
52 #define MAX_QUEUE_LEN 10000
53 #define DELAY_UNTIL_DIALTONE 3000
54
55 DEF_PARM(int, debug, 0, 0644, "Print DBG statements");
56 EXPORT_SYMBOL(debug);
57 static DEF_PARM_BOOL(prefmaster, 0, 0644,
58 "Do we want to be dahdi preferred sync master");
59 // DEF_ARRAY(int, pcmtx, 4, 0, "Forced PCM values to transmit");
60
61 #include "dahdi_debug.h"
62
63 static void phonedev_cleanup(xpd_t *xpd);
64
65 #ifdef DEBUG_SYNC_PARPORT
66 /*
67 * Use parallel port to sample our PCM sync and diagnose quality and
68 * potential problems. A logic analizer or a scope should be connected
69 * to the data bits of the parallel port.
70 *
71 * Array parameter: Choose the two xbuses Id's to sample.
72 * This can be changed on runtime as well. Example:
73 * echo "3,5" > /sys/module/xpp/parameters/parport_xbuses
74 */
75 static int parport_xbuses[2] = { 0, 1 };
76
77 unsigned int parport_xbuses_num_values;
78 module_param_array(parport_xbuses, int, &parport_xbuses_num_values, 0577);
79 MODULE_PARM_DESC(parport_xbuses, "Id's of xbuses to sample (1-2)");
80
81 /*
82 * Flip a single bit in the parallel port:
83 * - The bit number is either bitnum0 or bitnum1
84 * - Bit is selected by xbus number from parport_xbuses[]
85 */
86 void xbus_flip_bit(xbus_t *xbus, unsigned int bitnum0, unsigned int bitnum1)
87 {
88 int num = xbus->num;
89
90 if (num == parport_xbuses[0])
91 flip_parport_bit(bitnum0);
92 if (num == parport_xbuses[1])
93 flip_parport_bit(bitnum1);
94 }
95 EXPORT_SYMBOL(xbus_flip_bit);
96 #endif
97
98 static atomic_t num_registered_spans = ATOMIC_INIT(0);
99
100 int total_registered_spans(void)
101 {
102 return atomic_read(&num_registered_spans);
103 }
104
105 #ifdef CONFIG_PROC_FS
106 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
107 static const struct proc_ops xpd_read_proc_ops;
108 #else
109 static const struct file_operations xpd_read_proc_ops;
110 #endif
111 #endif
112
113 /*------------------------- XPD Management -------------------------*/
114
115 /*
116 * Called by put_xpd() when XPD has no more references.
117 */
118 static void xpd_destroy(struct kref *kref)
119 {
120 xpd_t *xpd;
121
122 xpd = kref_to_xpd(kref);
123 XPD_DBG(DEVICES, xpd, "%s\n", __func__);
124 xpd_device_unregister(xpd);
125 }
126
127 int refcount_xpd(xpd_t *xpd)
128 {
129 struct kref *kref = &xpd->kref;
130
131 return refcount_read(&kref->refcount);
132 }
133
134 xpd_t *get_xpd(const char *msg, xpd_t *xpd)
135 {
136 XPD_DBG(DEVICES, xpd, "%s: refcount_xpd=%d\n", msg, refcount_xpd(xpd));
137 kref_get(&xpd->kref);
138 return xpd;
139 }
140 EXPORT_SYMBOL(get_xpd);
141
142 void put_xpd(const char *msg, xpd_t *xpd)
143 {
144 XPD_DBG(DEVICES, xpd, "%s: refcount_xpd=%d\n", msg, refcount_xpd(xpd));
145 kref_put(&xpd->kref, xpd_destroy);
146 }
147 EXPORT_SYMBOL(put_xpd);
148
149 static void xpd_proc_remove(xbus_t *xbus, xpd_t *xpd)
150 {
151 #ifdef CONFIG_PROC_FS
152 if (xpd->proc_xpd_dir) {
153 if (xpd->proc_xpd_summary) {
154 XPD_DBG(PROC, xpd, "Removing proc '%s'\n",
155 PROC_XPD_SUMMARY);
156 remove_proc_entry(PROC_XPD_SUMMARY, xpd->proc_xpd_dir);
157 xpd->proc_xpd_summary = NULL;
158 }
159 XPD_DBG(PROC, xpd, "Removing %s/%s proc directory\n",
160 xbus->busname, xpd->xpdname);
161 remove_proc_entry(xpd->xpdname, xbus->proc_xbus_dir);
162 xpd->proc_xpd_dir = NULL;
163 }
164 #endif
165 }
166
167 static int xpd_proc_create(xbus_t *xbus, xpd_t *xpd)
168 {
169 #ifdef CONFIG_PROC_FS
170 XPD_DBG(PROC, xpd, "Creating proc directory\n");
171 xpd->proc_xpd_dir = proc_mkdir(xpd->xpdname, xbus->proc_xbus_dir);
172 if (!xpd->proc_xpd_dir) {
173 XPD_ERR(xpd, "Failed to create proc directory\n");
174 goto err;
175 }
176 xpd->proc_xpd_summary = proc_create_data(PROC_XPD_SUMMARY, 0444,
177 xpd->proc_xpd_dir,
178 &xpd_read_proc_ops, xpd);
179 if (!xpd->proc_xpd_summary) {
180 XPD_ERR(xpd, "Failed to create proc file '%s'\n",
181 PROC_XPD_SUMMARY);
182 goto err;
183 }
184 SET_PROC_DIRENTRY_OWNER(xpd->proc_xpd_summary);
185 #endif
186 return 0;
187 #ifdef CONFIG_PROC_FS
188 err:
189 xpd_proc_remove(xbus, xpd);
190 return -EFAULT;
191 #endif
192 }
193
194 void xpd_free(xpd_t *xpd)
195 {
196 xbus_t *xbus = NULL;
197
198 if (!xpd)
199 return;
200 if (xpd->xproto)
201 xproto_put(xpd->xproto); /* was taken in xpd_alloc() */
202 xpd->xproto = NULL;
203 xbus = xpd->xbus;
204 if (!xbus)
205 return;
206 XPD_DBG(DEVICES, xpd, "\n");
207 xpd_proc_remove(xbus, xpd);
208 xbus_xpd_unbind(xbus, xpd);
209 phonedev_cleanup(xpd);
210 KZFREE(xpd);
211 DBG(DEVICES, "refcount_xbus=%d\n", refcount_xbus(xbus));
212 /*
213 * This must be last, so the xbus cannot be released before the xpd
214 */
215 put_xbus(__func__, xbus); /* was taken in xpd_alloc() */
216 }
217 EXPORT_SYMBOL(xpd_free);
218
219 /*
220 * Synchronous part of XPD detection.
221 * Called from new_card()
222 */
223 int create_xpd(xbus_t *xbus, const xproto_table_t *proto_table,
224 const struct unit_descriptor *unit_descriptor,
225 int unit,
226 int subunit, __u8 type)
227 {
228 xpd_t *xpd = NULL;
229 bool to_phone;
230
231 BUG_ON(type == XPD_TYPE_NOMODULE);
232 to_phone = BIT(subunit) & unit_descriptor->port_dir;
233 BUG_ON(!xbus);
234 xpd = xpd_byaddr(xbus, unit, subunit);
235 if (xpd) {
236 XPD_NOTICE(xpd, "XPD at %d%d already exists\n", unit, subunit);
237 return 0;
238 }
239 INFO("%s: [%d.%d] type=%d subtype=%d numchips=%d ports_per_chip=%d ports_dir=%d\n",
240 __func__,
241 unit_descriptor->addr.unit,
242 unit_descriptor->addr.subunit,
243 unit_descriptor->type,
244 unit_descriptor->subtype,
245 unit_descriptor->numchips,
246 unit_descriptor->ports_per_chip,
247 unit_descriptor->port_dir);
248 if (unit_descriptor->ports_per_chip <= 0 || unit_descriptor->ports_per_chip > CHANNELS_PERXPD) {
249 XBUS_NOTICE(xbus, "Illegal number of ports %d for XPD %d%d\n",
250 unit_descriptor->ports_per_chip, unit, subunit);
251 return 0;
252 }
253 xpd =
254 proto_table->xops->card_new(xbus, unit, subunit, proto_table,
255 unit_descriptor,
256 to_phone);
257 if (!xpd) {
258 XBUS_NOTICE(xbus, "card_new(%d,%d,%d,%d) failed. Ignored.\n",
259 unit, subunit, proto_table->type,
260 to_phone);
261 return -EINVAL;
262 }
263 return 0;
264 }
265 EXPORT_SYMBOL(create_xpd);
266
267 #ifdef CONFIG_PROC_FS
268
269 /**
270 * Prints a general procfs entry for the bus, under xpp/BUSNAME/summary
271 */
272 static int xpd_read_proc_show(struct seq_file *sfile, void *data)
273 {
274 int len = 0;
275 xpd_t *xpd = sfile->private;
276 int i;
277
278 if (!xpd)
279 return -EINVAL;
280
281 seq_printf(sfile,
282 "%s (%s, card %s, span %d)\n" "timing_priority: %d\n"
283 "timer_count: %d span->mainttimer=%d\n", xpd->xpdname,
284 xpd->type_name, (xpd->card_present) ? "present" : "missing",
285 (SPAN_REGISTERED(xpd)) ? PHONEDEV(xpd).span.spanno : 0,
286 PHONEDEV(xpd).timing_priority, xpd->timer_count,
287 PHONEDEV(xpd).span.mainttimer);
288 seq_printf(sfile, "xpd_state: %s (%d)\n",
289 xpd_statename(xpd->xpd_state), xpd->xpd_state);
290 seq_printf(sfile, "open_counter=%d refcount=%d\n",
291 atomic_read(&PHONEDEV(xpd).open_counter),
292 refcount_xpd(xpd));
293 seq_printf(sfile, "Address: U=%d S=%d\n", xpd->addr.unit,
294 xpd->addr.subunit);
295 seq_printf(sfile, "Subunits: %d\n", xpd->subunits);
296 seq_printf(sfile, "Type: %d.%d\n", xpd->xpd_type, XPD_HW(xpd).subtype);
297 seq_printf(sfile, "Hardware type: %d.%d\nn", XPD_HW(xpd).type, XPD_HW(xpd).subtype);
298 seq_printf(sfile, "pcm_len=%d\n\n", PHONEDEV(xpd).pcm_len);
299 seq_printf(sfile, "wanted_pcm_mask=0x%04X\n\n",
300 PHONEDEV(xpd).wanted_pcm_mask);
301 seq_printf(sfile, "mute_dtmf=0x%04X\n\n",
302 PHONEDEV(xpd).mute_dtmf);
303 seq_printf(sfile, "STATES:");
304 seq_printf(sfile, "\n\t%-17s: ", "output_relays");
305 for_each_line(xpd, i) {
306 seq_printf(sfile, "%d ",
307 IS_SET(PHONEDEV(xpd).digital_outputs, i));
308 }
309 seq_printf(sfile, "\n\t%-17s: ", "input_relays");
310 for_each_line(xpd, i) {
311 seq_printf(sfile, "%d ",
312 IS_SET(PHONEDEV(xpd).digital_inputs, i));
313 }
314 seq_printf(sfile, "\n\t%-17s: ", "offhook");
315 for_each_line(xpd, i) {
316 seq_printf(sfile, "%d ", IS_OFFHOOK(xpd, i));
317 }
318 seq_printf(sfile, "\n\t%-17s: ", "oht_pcm_pass");
319 for_each_line(xpd, i) {
320 seq_printf(sfile, "%d ",
321 IS_SET(PHONEDEV(xpd).oht_pcm_pass, i));
322 }
323 seq_printf(sfile, "\n\t%-17s: ", "msg_waiting");
324 for_each_line(xpd, i) {
325 seq_printf(sfile, "%d ", PHONEDEV(xpd).msg_waiting[i]);
326 }
327 seq_printf(sfile, "\n\t%-17s: ", "ringing");
328 for_each_line(xpd, i) {
329 seq_printf(sfile, "%d ", PHONEDEV(xpd).ringing[i]);
330 }
331 seq_printf(sfile, "\n\t%-17s: ", "no_pcm");
332 for_each_line(xpd, i) {
333 seq_printf(sfile, "%d ", IS_SET(PHONEDEV(xpd).no_pcm, i));
334 }
335 #if 1
336 if (SPAN_REGISTERED(xpd)) {
337 seq_printf(sfile,
338 "\nPCM:\n |"
339 " [readchunk] |"
340 " [writechunk] | W D");
341 for_each_line(xpd, i) {
342 struct dahdi_chan *chan = XPD_CHAN(xpd, i);
343 __u8 rchunk[DAHDI_CHUNKSIZE];
344 __u8 wchunk[DAHDI_CHUNKSIZE];
345 __u8 *rp;
346 __u8 *wp;
347 int j;
348
349 if (IS_SET(PHONEDEV(xpd).digital_outputs, i))
350 continue;
351 if (IS_SET(PHONEDEV(xpd).digital_inputs, i))
352 continue;
353 if (IS_SET(PHONEDEV(xpd).digital_signalling, i))
354 continue;
355 rp = chan->readchunk;
356 wp = chan->writechunk;
357 memcpy(rchunk, rp, DAHDI_CHUNKSIZE);
358 memcpy(wchunk, wp, DAHDI_CHUNKSIZE);
359 seq_printf(sfile, "\n port %2d> | ", i);
360 for (j = 0; j < DAHDI_CHUNKSIZE; j++)
361 seq_printf(sfile, "%02X ", rchunk[j]);
362 seq_printf(sfile, " | ");
363 for (j = 0; j < DAHDI_CHUNKSIZE; j++)
364 seq_printf(sfile, "%02X ", wchunk[j]);
365 seq_printf(sfile, " | %c",
366 (IS_SET(PHONEDEV(xpd).wanted_pcm_mask, i))
367 ? '+' : ' ');
368 seq_printf(sfile, " %c",
369 (IS_SET(PHONEDEV(xpd).mute_dtmf, i))
370 ? '-' : ' ');
371 }
372 }
373 #endif
374 #if 0
375 if (SPAN_REGISTERED(xpd)) {
376 seq_printf(sfile, "\nSignalling:\n");
377 for_each_line(xpd, i) {
378 struct dahdi_chan *chan = XPD_CHAN(xpd, i);
379 seq_printf(sfile,
380 "\t%2d> sigcap=0x%04X sig=0x%04X\n", i,
381 chan->sigcap, chan->sig);
382 }
383 }
384 #endif
385 seq_printf(sfile, "\nCOUNTERS:\n");
386 for (i = 0; i < XPD_COUNTER_MAX; i++) {
387 seq_printf(sfile, "\t\t%-20s = %d\n",
388 xpd_counters[i].name, xpd->counters[i]);
389 }
390 seq_printf(sfile, "<-- len=%d\n", len);
391 return 0;
392 }
393
394 static int xpd_read_proc_open(struct inode *inode, struct file *file)
395 {
396 return single_open(file, xpd_read_proc_show, PDE_DATA(inode));
397 }
398
399 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
400 static const struct proc_ops xpd_read_proc_ops = {
401 .proc_open = xpd_read_proc_open,
402 .proc_read = seq_read,
403 .proc_lseek = seq_lseek,
404 .proc_release = single_release,
405 };
406 #else
407 static const struct file_operations xpd_read_proc_ops = {
408 .owner = THIS_MODULE,
409 .open = xpd_read_proc_open,
410 .read = seq_read,
411 .llseek = seq_lseek,
412 .release = single_release,
413 };
414 #endif
415
416 #endif
417
418 const char *xpd_statename(enum xpd_state st)
419 {
420 switch (st) {
421 case XPD_STATE_START:
422 return "START";
423 case XPD_STATE_INIT_REGS:
424 return "INIT_REGS";
425 case XPD_STATE_READY:
426 return "READY";
427 case XPD_STATE_NOHW:
428 return "NOHW";
429 }
430 return NULL;
431 }
432
433 bool xpd_setstate(xpd_t *xpd, enum xpd_state newstate)
434 {
435 BUG_ON(!xpd);
436 XPD_DBG(DEVICES, xpd, "%s: %s (%d) -> %s (%d)\n", __func__,
437 xpd_statename(xpd->xpd_state), xpd->xpd_state,
438 xpd_statename(newstate), newstate);
439 switch (newstate) {
440 case XPD_STATE_START:
441 goto badstate;
442 case XPD_STATE_INIT_REGS:
443 if (xpd->xpd_state != XPD_STATE_START)
444 goto badstate;
445 if (xpd->addr.subunit != 0) {
446 XPD_NOTICE(xpd,
447 "%s: Moving to %s allowed only for subunit 0\n",
448 __func__, xpd_statename(newstate));
449 goto badstate;
450 }
451 break;
452 case XPD_STATE_READY:
453 if (xpd->addr.subunit == 0) {
454 /* Unit 0 script initialize registers of all subunits */
455 if (xpd->xpd_state != XPD_STATE_INIT_REGS)
456 goto badstate;
457 } else {
458 if (xpd->xpd_state != XPD_STATE_START)
459 goto badstate;
460 }
461 break;
462 case XPD_STATE_NOHW:
463 break;
464 default:
465 XPD_ERR(xpd, "%s: Unknown newstate=%d\n", __func__, newstate);
466 }
467 xpd->xpd_state = newstate;
468 return 1;
469 badstate:
470 XPD_NOTICE(xpd, "%s: cannot transition: %s (%d) -> %s (%d)\n", __func__,
471 xpd_statename(xpd->xpd_state), xpd->xpd_state,
472 xpd_statename(newstate), newstate);
473 return 0;
474 }
475
476 /*
477 * Cleanup/initialize phonedev
478 */
479 static void phonedev_cleanup(xpd_t *xpd)
480 {
481 struct phonedev *phonedev = &PHONEDEV(xpd);
482 unsigned int x;
483
484 for (x = 0; x < phonedev->channels; x++) {
485 if (phonedev->chans[x]) {
486 KZFREE(phonedev->chans[x]);
487 phonedev->chans[x] = NULL;
488 }
489 if (phonedev->ec[x]) {
490 KZFREE(phonedev->ec[x]);
491 phonedev->ec[x] = NULL;
492 }
493 }
494 phonedev->channels = 0;
495 }
496
497 int phonedev_alloc_channels(xpd_t *xpd, int channels)
498 {
499 struct phonedev *phonedev = &PHONEDEV(xpd);
500 int old_channels = phonedev->channels;
501 unsigned int x;
502
503 XPD_DBG(DEVICES, xpd, "Reallocating channels: %d -> %d\n",
504 old_channels, channels);
505 phonedev_cleanup(xpd);
506 phonedev->channels = channels;
507 for (x = 0; x < phonedev->channels; x++) {
508 if (!
509 (phonedev->chans[x] =
510 KZALLOC(sizeof(*(phonedev->chans[x])), GFP_KERNEL))) {
511 ERR("%s: Unable to allocate channel %d\n", __func__, x);
512 goto err;
513 }
514 phonedev->ec[x] =
515 KZALLOC(sizeof(*(phonedev->ec[x])), GFP_KERNEL);
516 if (!phonedev->ec[x]) {
517 ERR("%s: Unable to allocate ec state %d\n", __func__,
518 x);
519 goto err;
520 }
521 }
522 return 0;
523 err:
524 phonedev_cleanup(xpd);
525 return -ENOMEM;
526 }
527 EXPORT_SYMBOL(phonedev_alloc_channels);
528
529 __must_check static int phonedev_init(xpd_t *xpd,
530 const xproto_table_t *proto_table,
531 int channels, xpp_line_t no_pcm)
532 {
533 struct phonedev *phonedev = &PHONEDEV(xpd);
534
535 spin_lock_init(&phonedev->lock_recompute_pcm);
536 phonedev->no_pcm = no_pcm;
537 phonedev->offhook_state = 0x0; /* ONHOOK */
538 phonedev->phoneops = proto_table->phoneops;
539 phonedev->digital_outputs = 0;
540 phonedev->digital_inputs = 0;
541 atomic_set(&phonedev->dahdi_registered, 0);
542 atomic_set(&phonedev->open_counter, 0);
543 if (phonedev_alloc_channels(xpd, channels) < 0)
544 goto err;
545 return 0;
546 err:
547 return -ENOMEM;
548 }
549
550
551 /*
552 * xpd_alloc - Allocator for new XPD's
553 *
554 */
555 __must_check xpd_t *xpd_alloc(xbus_t *xbus, int unit, int subunit,
556 size_t privsize,
557 const xproto_table_t *proto_table,
558 const struct unit_descriptor *unit_descriptor,
559 int channels)
560 {
561 xpd_t *xpd = NULL;
562 size_t alloc_size = sizeof(xpd_t) + privsize;
563 int type = proto_table->type;
564 xpp_line_t no_pcm = 0;
565
566 BUG_ON(!proto_table);
567 XBUS_DBG(DEVICES, xbus, "type=%d channels=%d (alloc_size=%zd)\n", type,
568 channels, alloc_size);
569 if (channels > CHANNELS_PERXPD) {
570 XBUS_ERR(xbus, "%s: type=%d: too many channels %d\n", __func__,
571 type, channels);
572 goto err;
573 }
574
575 if ((xpd = KZALLOC(alloc_size, GFP_KERNEL)) == NULL) {
576 XBUS_ERR(xbus, "%s: type=%d: Unable to allocate memory\n",
577 __func__, type);
578 goto err;
579 }
580 xpd->priv = (__u8 *)xpd + sizeof(xpd_t);
581 spin_lock_init(&xpd->lock);
582 xpd->card_present = 0;
583 xpd->xpd_type = proto_table->type;
584 xpd->xproto = proto_table;
585 xpd->unit_descriptor = *unit_descriptor;
586 xpd->xops = proto_table->xops;
587 xpd->xpd_state = XPD_STATE_START;
588 xpd->subunits = subunits_of_xpd(unit_descriptor, proto_table);
589 kref_init(&xpd->kref);
590
591 /* For USB-1 disable some channels */
592 if (MAX_SEND_SIZE(xbus) < RPACKET_SIZE(GLOBAL, PCM_WRITE)) {
593 no_pcm =
594 0x7F | PHONEDEV(xpd).digital_outputs | PHONEDEV(xpd).
595 digital_inputs;
596 XBUS_NOTICE(xbus,
597 "max xframe size = %d, disabling some PCM channels. "
598 "no_pcm=0x%04X\n",
599 MAX_SEND_SIZE(xbus), PHONEDEV(xpd).no_pcm);
600 }
601 if (phonedev_init(xpd, proto_table, channels, no_pcm) < 0)
602 goto err;
603 xbus_xpd_bind(xbus, xpd, unit, subunit);
604 if (xpd_proc_create(xbus, xpd) < 0)
605 goto err;
606 /*
607 * This makes sure the xbus cannot be removed before this xpd
608 * is removed in xpd_free()
609 */
610 xbus = get_xbus(__func__, xbus->num); /* returned in xpd_free() */
611 xproto_get(type); /* will be returned in xpd_free() */
612 return xpd;
613 err:
614 if (xpd) {
615 xpd_proc_remove(xbus, xpd);
616 phonedev_cleanup(xpd);
617 KZFREE(xpd);
618 }
619 return NULL;
620 }
621 EXPORT_SYMBOL(xpd_alloc);
622
623 /*
624 * The xpd isn't open by anyone, we can unregister it and free it
625 */
626 void xpd_remove(xpd_t *xpd)
627 {
628 BUG_ON(!xpd);
629 XPD_INFO(xpd, "Remove\n");
630 CALL_XMETHOD(card_remove, xpd);
631 xpd_free(xpd);
632 }
633
634 void update_xpd_status(xpd_t *xpd, int alarm_flag)
635 {
636 struct dahdi_span *span = &PHONEDEV(xpd).span;
637
638 if (!SPAN_REGISTERED(xpd)) {
639 #if 0
640 XPD_NOTICE(xpd,
641 "%s: XPD is not registered. Skipping.\n",
642 __func__);
643 #endif
644 return;
645 }
646 switch (alarm_flag) {
647 case DAHDI_ALARM_NONE:
648 xpd->last_response = jiffies;
649 break;
650 default:
651 // Nothing
652 break;
653 }
654 if (span->alarms == alarm_flag)
655 return;
656 XPD_DBG(GENERAL, xpd, "Update XPD alarms: %s -> %02X\n",
657 PHONEDEV(xpd).span.name, alarm_flag);
658 span->alarms = alarm_flag;
659 dahdi_alarm_notify(span);
660 }
661 EXPORT_SYMBOL(update_xpd_status);
662
663 /*
664 * Used to block/pass PCM during onhook-transfers. E.g:
665 * - Playing FSK after FXS ONHOOK for MWI (non-neon style)
666 * - Playing DTFM/FSK for FXO Caller-ID detection.
667 */
668 void oht_pcm(xpd_t *xpd, int pos, bool pass)
669 {
670 if (pass) {
671 LINE_DBG(SIGNAL, xpd, pos, "OHT PCM: pass\n");
672 BIT_SET(PHONEDEV(xpd).oht_pcm_pass, pos);
673 } else {
674 LINE_DBG(SIGNAL, xpd, pos, "OHT PCM: block\n");
675 BIT_CLR(PHONEDEV(xpd).oht_pcm_pass, pos);
676 }
677 CALL_PHONE_METHOD(card_pcm_recompute, xpd, 0);
678 }
679 EXPORT_SYMBOL(oht_pcm);
680
681 /*
682 * Update our hookstate -- for PCM block/pass
683 */
684 void mark_offhook(xpd_t *xpd, int pos, bool to_offhook)
685 {
686 if (to_offhook) {
687 LINE_DBG(SIGNAL, xpd, pos, "OFFHOOK\n");
688 BIT_SET(PHONEDEV(xpd).offhook_state, pos);
689 } else {
690 LINE_DBG(SIGNAL, xpd, pos, "ONHOOK\n");
691 BIT_CLR(PHONEDEV(xpd).offhook_state, pos);
692 }
693 CALL_PHONE_METHOD(card_pcm_recompute, xpd, 0);
694 }
695 EXPORT_SYMBOL(mark_offhook);
696
697 /*
698 * Send a signalling notification to Asterisk
699 */
700 void notify_rxsig(xpd_t *xpd, int pos, enum dahdi_rxsig rxsig)
701 {
702 /*
703 * We should not spinlock before calling dahdi_hooksig() as
704 * it may call back into our xpp_hooksig() and cause
705 * a nested spinlock scenario
706 */
707 LINE_DBG(SIGNAL, xpd, pos, "rxsig=%s\n", rxsig2str(rxsig));
708 if (SPAN_REGISTERED(xpd))
709 dahdi_hooksig(XPD_CHAN(xpd, pos), rxsig);
710 }
711 EXPORT_SYMBOL(notify_rxsig);
712
713 /*
714 * Called when hardware state changed:
715 * - FXS -- the phone was picked up or hanged-up.
716 * - FXO -- we answered the phone or handed-up.
717 */
718 void hookstate_changed(xpd_t *xpd, int pos, bool to_offhook)
719 {
720 BUG_ON(!xpd);
721 mark_offhook(xpd, pos, to_offhook);
722 if (!to_offhook) {
723 oht_pcm(xpd, pos, 0);
724 /*
725 * To prevent latest PCM to stay in buffers
726 * indefinitely, mark this channel for a
727 * single silence transmittion.
728 *
729 * This bit will be cleared on the next tick.
730 */
731 BIT_SET(PHONEDEV(xpd).silence_pcm, pos);
732 }
733 notify_rxsig(xpd, pos,
734 (to_offhook) ? DAHDI_RXSIG_OFFHOOK : DAHDI_RXSIG_ONHOOK);
735 }
736 EXPORT_SYMBOL(hookstate_changed);
737
738 #define XPP_MAX_LEN 512
739
740 /*------------------------- Dahdi Interfaces -----------------------*/
741
742 /*
743 * Called with spinlock held on chan. Must not call back
744 * dahdi functions.
745 */
746 static int _xpp_open(struct dahdi_chan *chan)
747 {
748 xpd_t *xpd;
749 xbus_t *xbus;
750 int pos;
751 int open_counter;
752
753 if (!chan) {
754 NOTICE("open called on a null chan\n");
755 return -EINVAL;
756 }
757 xpd = chan->pvt;
758 if (!xpd) {
759 NOTICE("open called on a chan with no pvt (xpd)\n");
760 BUG();
761 }
762 xbus = xpd->xbus;
763 if (!xbus) {
764 NOTICE("open called on a chan with no xbus\n");
765 BUG();
766 }
767 pos = chan->chanpos - 1;
768 if (!xpd->card_present) {
769 LINE_NOTICE(xpd, pos, "Cannot open -- device not ready\n");
770 return -ENODEV;
771 }
772 open_counter = atomic_inc_return(&PHONEDEV(xpd).open_counter);
773 LINE_DBG(DEVICES, xpd, pos, "%s[%d]: open_counter=%d\n", current->comm,
774 current->pid, open_counter);
775 if (PHONE_METHOD(card_open, xpd))
776 CALL_PHONE_METHOD(card_open, xpd, pos);
777 return 0;
778 }
779
780 int xpp_open(struct dahdi_chan *chan)
781 {
782 unsigned long flags;
783 int res;
784 spin_lock_irqsave(&chan->lock, flags);
785 res = _xpp_open(chan);
786 spin_unlock_irqrestore(&chan->lock, flags);
787 return res;
788 }
789 EXPORT_SYMBOL(xpp_open);
790
791 int xpp_close(struct dahdi_chan *chan)
792 {
793 xpd_t *xpd = chan->pvt;
794 int pos = chan->chanpos - 1;
795 int open_counter;
796
797 if (PHONE_METHOD(card_close, xpd))
798 CALL_PHONE_METHOD(card_close, xpd, pos);
799 /* from xpp_open(): */
800 open_counter = atomic_dec_return(&PHONEDEV(xpd).open_counter);
801 LINE_DBG(DEVICES, xpd, pos, "%s[%d]: open_counter=%d\n", current->comm,
802 current->pid, open_counter);
803 return 0;
804 }
805 EXPORT_SYMBOL(xpp_close);
806
807 void report_bad_ioctl(const char *msg, xpd_t *xpd, int pos, unsigned int cmd)
808 {
809 char *extra_msg = "";
810
811 if (_IOC_TYPE(cmd) == 'J')
812 extra_msg = " (for old ZAPTEL)";
813 XPD_NOTICE(xpd, "%s: Bad ioctl%s\n", msg, extra_msg);
814 XPD_NOTICE(xpd, "ENOTTY: chan=%d cmd=0x%x\n", pos, cmd);
815 XPD_NOTICE(xpd, " IOC_TYPE=0x%02X\n", _IOC_TYPE(cmd));
816 XPD_NOTICE(xpd, " IOC_DIR=0x%02X\n", _IOC_DIR(cmd));
817 XPD_NOTICE(xpd, " IOC_NR=%d\n", _IOC_NR(cmd));
818 XPD_NOTICE(xpd, " IOC_SIZE=0x%02X\n", _IOC_SIZE(cmd));
819 }
820 EXPORT_SYMBOL(report_bad_ioctl);
821
822 int xpp_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long arg)
823 {
824 xpd_t *xpd = chan->pvt;
825 int pos = chan->chanpos - 1;
826
827 if (!xpd) {
828 ERR("%s: channel in pos %d, was already closed. Ignore.\n",
829 __func__, pos);
830 return -ENODEV;
831 }
832 switch (cmd) {
833 default:
834 /* Some span-specific commands before we give up: */
835 if (PHONE_METHOD(card_ioctl, xpd)) {
836 return CALL_PHONE_METHOD(card_ioctl, xpd, pos, cmd,
837 arg);
838 }
839 report_bad_ioctl(THIS_MODULE->name, xpd, pos, cmd);
840 return -ENOTTY;
841 }
842 return 0;
843 }
844 EXPORT_SYMBOL(xpp_ioctl);
845
846 int xpp_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
847 {
848 xpd_t *xpd = chan->pvt;
849 xbus_t *xbus;
850 int pos = chan->chanpos - 1;
851
852 if (!xpd) {
853 ERR("%s: channel in pos %d, was already closed. Ignore.\n",
854 __func__, pos);
855 return -ENODEV;
856 }
857 if (!PHONE_METHOD(card_hooksig, xpd)) {
858 LINE_ERR(xpd, pos,
859 "%s: No hooksig method for this channel. Ignore.\n",
860 __func__);
861 return -ENODEV;
862 }
863 xbus = xpd->xbus;
864 BUG_ON(!xbus);
865 DBG(SIGNAL, "Setting %s to %s (%d)\n", chan->name, txsig2str(txsig),
866 txsig);
867 return CALL_PHONE_METHOD(card_hooksig, xpd, pos, txsig);
868 }
869 EXPORT_SYMBOL(xpp_hooksig);
870
871 /* Req: Set the requested chunk size. This is the unit in which you must
872 report results for conferencing, etc */
873 int xpp_setchunksize(struct dahdi_span *span, int chunksize);
874
875 /* Enable maintenance modes */
876 int xpp_maint(struct dahdi_span *span, int cmd)
877 {
878 struct phonedev *phonedev = container_of(span, struct phonedev, span);
879 xpd_t *xpd = container_of(phonedev, struct xpd, phonedev);
880 int ret = 0;
881 #if 0
882 char loopback_data[] = "THE-QUICK-BROWN-FOX-JUMPED-OVER-THE-LAZY-DOG";
883 #endif
884
885 DBG(GENERAL, "span->mainttimer=%d\n", span->mainttimer);
886 switch (cmd) {
887 case DAHDI_MAINT_NONE:
888 INFO("XXX Turn off local and remote loops XXX\n");
889 break;
890 case DAHDI_MAINT_LOCALLOOP:
891 INFO("XXX Turn on local loopback XXX\n");
892 break;
893 case DAHDI_MAINT_REMOTELOOP:
894 INFO("XXX Turn on remote loopback XXX\n");
895 break;
896 case DAHDI_MAINT_LOOPUP:
897 INFO("XXX Send loopup code XXX\n");
898 break;
899 case DAHDI_MAINT_LOOPDOWN:
900 INFO("XXX Send loopdown code XXX\n");
901 break;
902 default:
903 ERR("XPP: Unknown maint command: %d\n", cmd);
904 ret = -EINVAL;
905 break;
906 }
907 if (span->mainttimer || span->maintstat)
908 update_xpd_status(xpd, DAHDI_ALARM_LOOPBACK);
909 return ret;
910 }
911 EXPORT_SYMBOL(xpp_maint);
912
913 #ifdef CONFIG_DAHDI_WATCHDOG
914 /*
915 * If the watchdog detects no received data, it will call the
916 * watchdog routine
917 */
918 int xpp_watchdog(struct dahdi_span *span, int cause)
919 {
920 static int rate_limit;
921
922 if ((rate_limit++ % 1000) == 0)
923 DBG(GENERAL, "\n");
924 return 0;
925 }
926 EXPORT_SYMBOL(xpp_watchdog);
927 #endif
928
929 /*
930 * Hardware Echo Canceller management
931 */
932 static void echocan_free(struct dahdi_chan *chan,
933 struct dahdi_echocan_state *ec)
934 {
935 xpd_t *xpd;
936 xbus_t *xbus;
937 int pos = chan->chanpos - 1;
938 const struct echoops *echoops;
939
940 xpd = chan->pvt;
941 xbus = xpd->xbus;
942 echoops = ECHOOPS(xbus);
943 if (!echoops)
944 return;
945 LINE_DBG(GENERAL, xpd, pos, "mode=0x%X\n", ec->status.mode);
946 CALL_EC_METHOD(ec_set, xbus, xpd, pos, 0);
947 CALL_EC_METHOD(ec_update, xbus, xbus);
948 put_xpd(__func__, xpd); /* aquired in xpp_echocan_create() */
949 }
950
951 static const struct dahdi_echocan_features xpp_ec_features = {
952 };
953
954 static const struct dahdi_echocan_ops xpp_ec_ops = {
955 .echocan_free = echocan_free,
956 };
957
958 const char *xpp_echocan_name(const struct dahdi_chan *chan)
959 {
960 xpd_t *xpd;
961 xbus_t *xbus;
962 int pos;
963
964 if (!chan) {
965 NOTICE("%s(NULL)\n", __func__);
966 return "XPP";
967 }
968 xpd = chan->pvt;
969 xbus = xpd->xbus;
970 pos = chan->chanpos - 1;
971 LINE_DBG(GENERAL, xpd, pos, "\n");
972 if (!ECHOOPS(xbus))
973 return NULL;
974 /*
975 * quirks and limitations
976 */
977 if (xbus->quirks.has_fxo) {
978 if (xbus->quirks.has_digital_span && xpd->xpd_type == XPD_TYPE_FXO) {
979 LINE_NOTICE(xpd, pos,
980 "quirk: give up HWEC on FXO: "
981 "AB has digital span\n");
982 return NULL;
983 } else if (xbus->sync_mode != SYNC_MODE_AB
984 && xpd->xpd_type == XPD_TYPE_FXS) {
985 LINE_NOTICE(xpd, pos,
986 "quirk: give up HWEC on FXS: "
987 "AB has FXO and is sync slave\n");
988 return NULL;
989 }
990 }
991 return "XPP";
992 }
993 EXPORT_SYMBOL(xpp_echocan_name);
994
995 int xpp_echocan_create(struct dahdi_chan *chan,
996 struct dahdi_echocanparams *ecp,
997 struct dahdi_echocanparam *p,
998 struct dahdi_echocan_state **ec)
999 {
1000 xpd_t *xpd;
1001 xbus_t *xbus;
1002 int pos;
1003 struct phonedev *phonedev;
1004 const struct echoops *echoops;
1005 int ret;
1006
1007 xpd = chan->pvt;
1008 xbus = xpd->xbus;
1009 pos = chan->chanpos - 1;
1010 echoops = ECHOOPS(xbus);
1011 if (!echoops)
1012 return -ENODEV;
1013 phonedev = &PHONEDEV(xpd);
1014 *ec = phonedev->ec[pos];
1015 (*ec)->ops = &xpp_ec_ops;
1016 (*ec)->features = xpp_ec_features;
1017 xpd = get_xpd(__func__, xpd); /* Returned in echocan_free() */
1018 LINE_DBG(GENERAL, xpd, pos, "(tap=%d, param_count=%d)\n",
1019 ecp->tap_length, ecp->param_count);
1020 ret = CALL_EC_METHOD(ec_set, xbus, xpd, pos, 1);
1021 CALL_EC_METHOD(ec_update, xbus, xbus);
1022 return ret;
1023 }
1024 EXPORT_SYMBOL(xpp_echocan_create);
1025
1026 void xpp_span_assigned(struct dahdi_span *span)
1027 {
1028 struct phonedev *phonedev = container_of(span, struct phonedev, span);
1029 xpd_t *xpd = container_of(phonedev, struct xpd, phonedev);
1030
1031 XPD_INFO(xpd, "Span assigned: %d\n", span->spanno);
1032 if (xpd->card_present) {
1033 span->alarms &= ~DAHDI_ALARM_NOTOPEN;
1034 dahdi_alarm_notify(&phonedev->span);
1035 }
1036 if (PHONE_METHOD(span_assigned, xpd))
1037 CALL_PHONE_METHOD(span_assigned, xpd);
1038 }
1039 EXPORT_SYMBOL(xpp_span_assigned);
1040
1041 static const struct dahdi_span_ops xpp_span_ops = {
1042 .owner = THIS_MODULE,
1043 .open = xpp_open,
1044 .close = xpp_close,
1045 .ioctl = xpp_ioctl,
1046 .maint = xpp_maint,
1047 .echocan_create = xpp_echocan_create,
1048 .echocan_name = xpp_echocan_name,
1049 .assigned = xpp_span_assigned,
1050 };
1051
1052 static const struct dahdi_span_ops xpp_rbs_span_ops = {
1053 .owner = THIS_MODULE,
1054 .hooksig = xpp_hooksig,
1055 .open = xpp_open,
1056 .close = xpp_close,
1057 .ioctl = xpp_ioctl,
1058 .maint = xpp_maint,
1059 .echocan_create = xpp_echocan_create,
1060 .echocan_name = xpp_echocan_name,
1061 .assigned = xpp_span_assigned,
1062 };
1063
1064 void xpd_set_spanname(xpd_t *xpd)
1065 {
1066 struct dahdi_span *span = &PHONEDEV(xpd).span;
1067
1068 snprintf(span->name, MAX_SPANNAME, "%s/%s", xpd->xbus->busname,
1069 xpd->xpdname);
1070 /*
1071 * The "Xorcom XPD" is a prefix in one of the regexes we
1072 * use in our dahdi_genconf to match for PRI cards.
1073 * FIXME: After moving completely to sysfs, we can remove
1074 * this horseshit.
1075 */
1076 snprintf(span->desc, MAX_SPANDESC, "Xorcom XPD [%s].%d: %s",
1077 xpd->xbus->label, span->offset + 1, xpd->type_name);
1078 }
1079 EXPORT_SYMBOL(xpd_set_spanname);
1080
1081 static void xpd_init_span(xpd_t *xpd, unsigned offset, int cn)
1082 {
1083 struct dahdi_span *span;
1084
1085 memset(&PHONEDEV(xpd).span, 0, sizeof(struct dahdi_span));
1086 phonedev_alloc_channels(xpd, cn);
1087 span = &PHONEDEV(xpd).span;
1088 span->deflaw = DAHDI_LAW_MULAW; /* card_* drivers may override */
1089 span->channels = cn;
1090 span->chans = PHONEDEV(xpd).chans;
1091
1092 span->flags = DAHDI_FLAG_RBS;
1093 span->offset = offset;
1094 if (PHONEDEV(xpd).phoneops->card_hooksig)
1095 span->ops = &xpp_rbs_span_ops; /* Only with RBS bits */
1096 else
1097 span->ops = &xpp_span_ops;
1098 xpd_set_spanname(xpd);
1099 list_add_tail(&span->device_node, &xpd->xbus->ddev->spans);
1100 }
1101
1102 int xpd_dahdi_preregister(xpd_t *xpd, unsigned offset)
1103 {
1104 xbus_t *xbus;
1105 int cn;
1106 struct phonedev *phonedev;
1107
1108 BUG_ON(!xpd);
1109
1110 xbus = xpd->xbus;
1111
1112 if (!IS_PHONEDEV(xpd)) {
1113 XPD_ERR(xpd, "Not a telephony device\n");
1114 return -EBADF;
1115 }
1116
1117 phonedev = &PHONEDEV(xpd);
1118
1119 if (SPAN_REGISTERED(xpd)) {
1120 XPD_ERR(xpd, "Already registered\n");
1121 return -EEXIST;
1122 }
1123
1124 cn = PHONEDEV(xpd).channels;
1125 xpd_init_span(xpd, offset, cn);
1126 XPD_DBG(DEVICES, xpd, "Preregister local span %d: %d channels.\n",
1127 offset + 1, cn);
1128 CALL_PHONE_METHOD(card_dahdi_preregistration, xpd, 1);
1129 return 0;
1130 }
1131
1132 int xpd_dahdi_postregister(xpd_t *xpd)
1133 {
1134 int cn;
1135
1136 atomic_inc(&num_registered_spans);
1137 atomic_inc(&PHONEDEV(xpd).dahdi_registered);
1138 CALL_PHONE_METHOD(card_dahdi_postregistration, xpd, 1);
1139 /*
1140 * Update dahdi about our state:
1141 * - Since asterisk didn't open the channel yet,
1142 * the report is discarded anyway.
1143 * - Our FXS driver have another notification mechanism that
1144 * is triggered (indirectly) by the open() of the channe.
1145 * - The real fix should be in Asterisk (to get the correct state
1146 * after open).
1147 */
1148 for_each_line(xpd, cn) {
1149 if (IS_OFFHOOK(xpd, cn))
1150 notify_rxsig(xpd, cn, DAHDI_RXSIG_OFFHOOK);
1151 }
1152 return 0;
1153 }
1154
1155 /*
1156 * Try our best to make asterisk close all channels related to
1157 * this Astribank:
1158 * - Set span state to DAHDI_ALARM_NOTOPEN in all relevant spans.
1159 * - Notify dahdi afterwards about spans
1160 * (so it can see all changes at once).
1161 * - Also send DAHDI_EVENT_REMOVED on all channels.
1162 */
1163 void xpd_dahdi_preunregister(xpd_t *xpd)
1164 {
1165 if (!xpd || !IS_PHONEDEV(xpd))
1166 return;
1167 XPD_DBG(DEVICES, xpd, "\n");
1168 update_xpd_status(xpd, DAHDI_ALARM_NOTOPEN);
1169 if (xpd->card_present)
1170 CALL_PHONE_METHOD(card_dahdi_preregistration, xpd, 0);
1171 /* Now notify dahdi */
1172 if (SPAN_REGISTERED(xpd)) {
1173 int j;
1174
1175 dahdi_alarm_notify(&PHONEDEV(xpd).span);
1176 XPD_DBG(DEVICES, xpd,
1177 "Queuing DAHDI_EVENT_REMOVED on all channels "
1178 "to ask user to release them\n");
1179 for (j = 0; j < PHONEDEV(xpd).span.channels; j++) {
1180 dahdi_qevent_lock(XPD_CHAN(xpd, j),
1181 DAHDI_EVENT_REMOVED);
1182 }
1183 }
1184 }
1185
1186 void xpd_dahdi_postunregister(xpd_t *xpd)
1187 {
1188 if (!xpd || !IS_PHONEDEV(xpd))
1189 return;
1190 atomic_dec(&PHONEDEV(xpd).dahdi_registered);
1191 atomic_dec(&num_registered_spans);
1192 if (xpd->card_present)
1193 CALL_PHONE_METHOD(card_dahdi_postregistration, xpd, 0);
1194 }
1195
1196 /*------------------------- Initialization -------------------------*/
1197
1198 static void do_cleanup(void)
1199 {
1200 #ifdef CONFIG_PROC_FS
1201 if (xpp_proc_toplevel) {
1202 DBG(GENERAL, "Removing '%s' from proc\n", PROC_DIR);
1203 remove_proc_entry(PROC_DIR, NULL);
1204 xpp_proc_toplevel = NULL;
1205 }
1206 #endif
1207 }
1208
1209 static int __init xpp_dahdi_init(void)
1210 {
1211 int ret = 0;
1212 void *top = NULL;
1213
1214 INFO("MAX_XPDS=%d (%d*%d)\n", MAX_XPDS, MAX_UNIT, MAX_SUBUNIT);
1215 #ifdef CONFIG_PROC_FS
1216 xpp_proc_toplevel = proc_mkdir(PROC_DIR, NULL);
1217 if (!xpp_proc_toplevel) {
1218 ret = -EIO;
1219 goto err;
1220 }
1221 top = xpp_proc_toplevel;
1222 #endif
1223 ret = xbus_core_init();
1224 if (ret) {
1225 ERR("xbus_core_init failed (%d)\n", ret);
1226 goto err;
1227 }
1228 ret = xbus_pcm_init(top);
1229 if (ret) {
1230 ERR("xbus_pcm_init failed (%d)\n", ret);
1231 xbus_core_shutdown();
1232 goto err;
1233 }
1234 return 0;
1235 err:
1236 do_cleanup();
1237 return ret;
1238 }
1239
1240 static void __exit xpp_dahdi_cleanup(void)
1241 {
1242 xbus_pcm_shutdown();
1243 xbus_core_shutdown();
1244 do_cleanup();
1245 }
1246
1247 MODULE_DESCRIPTION("XPP Dahdi Driver");
1248 MODULE_AUTHOR("Oron Peled <[email protected]>");
1249 MODULE_LICENSE("GPL");
1250
1251 module_init(xpp_dahdi_init);
1252 module_exit(xpp_dahdi_cleanup);