gigaset: add Kernel CAPI interface (v3)

Add a Kernel CAPI interface to the Gigaset driver.

Impact: optional new functionality
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Tilman Schmidt
2009-10-06 12:19:17 +00:00
committed by David S. Miller
parent aaba2b3f82
commit 7bb5fdc2fb
7 changed files with 2355 additions and 28 deletions
+15 -3
View File
@@ -10,20 +10,32 @@ menuconfig ISDN_DRV_GIGASET
If you have one of these devices, say M here and for at least
one of the connection specific parts that follow.
This will build a module called "gigaset".
Note: If you build the ISDN4Linux subsystem (ISDN_I4L)
Note: If you build your ISDN subsystem (ISDN_CAPI or ISDN_I4L)
as a module, you have to build this driver as a module too,
otherwise the Gigaset device won't show up as an ISDN device.
if ISDN_DRV_GIGASET
config GIGASET_CAPI
bool "Gigaset CAPI support (EXPERIMENTAL)"
depends on EXPERIMENTAL
depends on ISDN_CAPI='y'||(ISDN_CAPI='m'&&ISDN_DRV_GIGASET='m')
default ISDN_I4L='n'
help
Build the Gigaset driver as a CAPI 2.0 driver interfacing with
the Kernel CAPI subsystem. To use it with the old ISDN4Linux
subsystem you'll have to enable the capidrv glue driver.
(select ISDN_CAPI_CAPIDRV.)
Say N to build the old native ISDN4Linux variant.
config GIGASET_I4L
bool
depends on ISDN_I4L='y'||(ISDN_I4L='m'&&ISDN_DRV_GIGASET='m')
default y
default !GIGASET_CAPI
config GIGASET_DUMMYLL
bool
default !GIGASET_I4L
default !GIGASET_CAPI&&!GIGASET_I4L
config GIGASET_BASE
tristate "Gigaset base station support"
+1
View File
@@ -1,4 +1,5 @@
gigaset-y := common.o interface.o proc.o ev-layer.o asyncdata.o
gigaset-$(CONFIG_GIGASET_CAPI) += capi.o
gigaset-$(CONFIG_GIGASET_I4L) += i4l.o
gigaset-$(CONFIG_GIGASET_DUMMYLL) += dummyll.o
usb_gigaset-y := usb-gigaset.o
File diff suppressed because it is too large Load Diff
+26
View File
@@ -207,6 +207,32 @@ int gigaset_get_channel(struct bc_state *bcs)
return 1;
}
struct bc_state *gigaset_get_free_channel(struct cardstate *cs)
{
unsigned long flags;
int i;
spin_lock_irqsave(&cs->lock, flags);
if (!try_module_get(cs->driver->owner)) {
gig_dbg(DEBUG_ANY,
"could not get module for allocating channel");
spin_unlock_irqrestore(&cs->lock, flags);
return NULL;
}
for (i = 0; i < cs->channels; ++i)
if (!cs->bcs[i].use_count) {
++cs->bcs[i].use_count;
cs->bcs[i].busy = 1;
spin_unlock_irqrestore(&cs->lock, flags);
gig_dbg(DEBUG_ANY, "allocated channel %d", i);
return cs->bcs + i;
}
module_put(cs->driver->owner);
spin_unlock_irqrestore(&cs->lock, flags);
gig_dbg(DEBUG_ANY, "no free channel");
return NULL;
}
void gigaset_free_channel(struct bc_state *bcs)
{
unsigned long flags;
+13 -11
View File
@@ -291,21 +291,23 @@ struct reply_t gigaset_tab_cid[] =
{RSP_OK, 602,602, -1, 603, 5, {ACT_CMD+AT_PROTO}},
{RSP_OK, 603,603, -1, 604, 5, {ACT_CMD+AT_TYPE}},
{RSP_OK, 604,604, -1, 605, 5, {ACT_CMD+AT_MSN}},
{RSP_OK, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}},
{RSP_NULL, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}},
{RSP_OK, 606,606, -1, 607, 5, {0}, "+VLS=17\r"},
{RSP_OK, 607,607, -1, 608,-1},
{RSP_ZSAU, 608,608,ZSAU_PROCEEDING, 609, 5, {ACT_CMD+AT_DIAL}},
{RSP_OK, 609,609, -1, 650, 0, {ACT_DIALING}},
{RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} },
{RSP_OK, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} },
{RSP_NULL, 606, 606, -1, 607, 5, {ACT_CMD+AT_ISO} },
{RSP_OK, 606, 606, -1, 607, 5, {ACT_CMD+AT_ISO} },
{RSP_OK, 607, 607, -1, 608, 5, {0}, "+VLS=17\r"},
{RSP_OK, 608, 608, -1, 609, -1},
{RSP_ZSAU, 609, 609, ZSAU_PROCEEDING, 610, 5, {ACT_CMD+AT_DIAL} },
{RSP_OK, 610, 610, -1, 650, 0, {ACT_DIALING} },
{RSP_ERROR, 601,609, -1, 0, 0, {ACT_ABORTDIAL}},
{EV_TIMEOUT, 601,609, -1, 0, 0, {ACT_ABORTDIAL}},
{RSP_ERROR, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} },
{EV_TIMEOUT, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} },
/* optional dialing responses */
{EV_BC_OPEN, 650,650, -1, 651,-1},
{RSP_ZVLS, 608,651, 17, -1,-1, {ACT_DEBUG}},
{RSP_ZCTP, 609,651, -1, -1,-1, {ACT_DEBUG}},
{RSP_ZCPN, 609,651, -1, -1,-1, {ACT_DEBUG}},
{RSP_ZVLS, 609, 651, 17, -1, -1, {ACT_DEBUG} },
{RSP_ZCTP, 610, 651, -1, -1, -1, {ACT_DEBUG} },
{RSP_ZCPN, 610, 651, -1, -1, -1, {ACT_DEBUG} },
{RSP_ZSAU, 650,651,ZSAU_CALL_DELIVERED, -1,-1, {ACT_DEBUG}},
/* connect */
+6 -1
View File
@@ -191,7 +191,9 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
#define AT_PROTO 4
#define AT_TYPE 5
#define AT_HLC 6
#define AT_NUM 7
#define AT_CLIP 7
/* total number */
#define AT_NUM 8
/* variables in struct at_state_t */
#define VAR_ZSAU 0
@@ -412,6 +414,8 @@ struct bc_state {
struct usb_bc_state *usb; /* usb hardware driver (m105) */
struct bas_bc_state *bas; /* usb hardware driver (base) */
} hw;
void *ap; /* LL application structure */
};
struct cardstate {
@@ -725,6 +729,7 @@ void gigaset_bcs_reinit(struct bc_state *bcs);
void gigaset_at_init(struct at_state_t *at_state, struct bc_state *bcs,
struct cardstate *cs, int cid);
int gigaset_get_channel(struct bc_state *bcs);
struct bc_state *gigaset_get_free_channel(struct cardstate *cs);
void gigaset_free_channel(struct bc_state *bcs);
int gigaset_get_channels(struct cardstate *cs);
void gigaset_free_channels(struct cardstate *cs);