aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/gigaset/ev-layer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/gigaset/ev-layer.c')
-rw-r--r--drivers/isdn/gigaset/ev-layer.c64
1 files changed, 36 insertions, 28 deletions
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index cc768caa38f5..cb25d2b834b9 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -127,7 +127,6 @@
127#define ACT_NOTIFY_BC_UP 39 127#define ACT_NOTIFY_BC_UP 39
128#define ACT_DIAL 40 128#define ACT_DIAL 40
129#define ACT_ACCEPT 41 129#define ACT_ACCEPT 41
130#define ACT_PROTO_L2 42
131#define ACT_HUP 43 130#define ACT_HUP 43
132#define ACT_IF_LOCK 44 131#define ACT_IF_LOCK 44
133#define ACT_START 45 132#define ACT_START 45
@@ -365,8 +364,6 @@ struct reply_t gigaset_tab_cid[] =
365 {EV_BC_CLOSED, -1, -1, -1, -1,-1, {ACT_NOTIFY_BC_DOWN}}, //FIXME 364 {EV_BC_CLOSED, -1, -1, -1, -1,-1, {ACT_NOTIFY_BC_DOWN}}, //FIXME
366 365
367 /* misc. */ 366 /* misc. */
368 {EV_PROTO_L2, -1, -1, -1, -1,-1, {ACT_PROTO_L2}}, //FIXME
369
370 {RSP_ZCON, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME 367 {RSP_ZCON, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME
371 {RSP_ZCCR, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME 368 {RSP_ZCCR, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME
372 {RSP_ZAOC, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME 369 {RSP_ZAOC, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME
@@ -714,7 +711,7 @@ static void disconnect(struct at_state_t **at_state_p)
714 /* notify LL */ 711 /* notify LL */
715 if (bcs->chstate & (CHS_D_UP | CHS_NOTIFY_LL)) { 712 if (bcs->chstate & (CHS_D_UP | CHS_NOTIFY_LL)) {
716 bcs->chstate &= ~(CHS_D_UP | CHS_NOTIFY_LL); 713 bcs->chstate &= ~(CHS_D_UP | CHS_NOTIFY_LL);
717 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DHUP); 714 gigaset_isdn_hupD(bcs);
718 } 715 }
719 } else { 716 } else {
720 /* no B channel assigned: just deallocate */ 717 /* no B channel assigned: just deallocate */
@@ -872,12 +869,12 @@ static void bchannel_down(struct bc_state *bcs)
872{ 869{
873 if (bcs->chstate & CHS_B_UP) { 870 if (bcs->chstate & CHS_B_UP) {
874 bcs->chstate &= ~CHS_B_UP; 871 bcs->chstate &= ~CHS_B_UP;
875 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_BHUP); 872 gigaset_isdn_hupB(bcs);
876 } 873 }
877 874
878 if (bcs->chstate & (CHS_D_UP | CHS_NOTIFY_LL)) { 875 if (bcs->chstate & (CHS_D_UP | CHS_NOTIFY_LL)) {
879 bcs->chstate &= ~(CHS_D_UP | CHS_NOTIFY_LL); 876 bcs->chstate &= ~(CHS_D_UP | CHS_NOTIFY_LL);
880 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DHUP); 877 gigaset_isdn_hupD(bcs);
881 } 878 }
882 879
883 gigaset_free_channel(bcs); 880 gigaset_free_channel(bcs);
@@ -894,15 +891,16 @@ static void bchannel_up(struct bc_state *bcs)
894 } 891 }
895 892
896 bcs->chstate |= CHS_B_UP; 893 bcs->chstate |= CHS_B_UP;
897 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_BCONN); 894 gigaset_isdn_connB(bcs);
898} 895}
899 896
900static void start_dial(struct at_state_t *at_state, void *data, unsigned seq_index) 897static void start_dial(struct at_state_t *at_state, void *data, unsigned seq_index)
901{ 898{
902 struct bc_state *bcs = at_state->bcs; 899 struct bc_state *bcs = at_state->bcs;
903 struct cardstate *cs = at_state->cs; 900 struct cardstate *cs = at_state->cs;
904 int retval; 901 char **commands = data;
905 unsigned long flags; 902 unsigned long flags;
903 int i;
906 904
907 bcs->chstate |= CHS_NOTIFY_LL; 905 bcs->chstate |= CHS_NOTIFY_LL;
908 906
@@ -913,10 +911,10 @@ static void start_dial(struct at_state_t *at_state, void *data, unsigned seq_ind
913 } 911 }
914 spin_unlock_irqrestore(&cs->lock, flags); 912 spin_unlock_irqrestore(&cs->lock, flags);
915 913
916 retval = gigaset_isdn_setup_dial(at_state, data); 914 for (i = 0; i < AT_NUM; ++i) {
917 if (retval != 0) 915 kfree(bcs->commands[i]);
918 goto error; 916 bcs->commands[i] = commands[i];
919 917 }
920 918
921 at_state->pending_commands |= PC_CID; 919 at_state->pending_commands |= PC_CID;
922 gig_dbg(DEBUG_CMD, "Scheduling PC_CID"); 920 gig_dbg(DEBUG_CMD, "Scheduling PC_CID");
@@ -924,6 +922,10 @@ static void start_dial(struct at_state_t *at_state, void *data, unsigned seq_ind
924 return; 922 return;
925 923
926error: 924error:
925 for (i = 0; i < AT_NUM; ++i) {
926 kfree(commands[i]);
927 commands[i] = NULL;
928 }
927 at_state->pending_commands |= PC_NOCID; 929 at_state->pending_commands |= PC_NOCID;
928 gig_dbg(DEBUG_CMD, "Scheduling PC_NOCID"); 930 gig_dbg(DEBUG_CMD, "Scheduling PC_NOCID");
929 cs->commands_pending = 1; 931 cs->commands_pending = 1;
@@ -933,20 +935,31 @@ error:
933static void start_accept(struct at_state_t *at_state) 935static void start_accept(struct at_state_t *at_state)
934{ 936{
935 struct cardstate *cs = at_state->cs; 937 struct cardstate *cs = at_state->cs;
936 int retval; 938 struct bc_state *bcs = at_state->bcs;
939 int i;
937 940
938 retval = gigaset_isdn_setup_accept(at_state); 941 for (i = 0; i < AT_NUM; ++i) {
942 kfree(bcs->commands[i]);
943 bcs->commands[i] = NULL;
944 }
939 945
940 if (retval == 0) { 946 bcs->commands[AT_PROTO] = kmalloc(9, GFP_ATOMIC);
941 at_state->pending_commands |= PC_ACCEPT; 947 bcs->commands[AT_ISO] = kmalloc(9, GFP_ATOMIC);
942 gig_dbg(DEBUG_CMD, "Scheduling PC_ACCEPT"); 948 if (!bcs->commands[AT_PROTO] || !bcs->commands[AT_ISO]) {
943 cs->commands_pending = 1; 949 dev_err(at_state->cs->dev, "out of memory\n");
944 } else {
945 /* error reset */ 950 /* error reset */
946 at_state->pending_commands |= PC_HUP; 951 at_state->pending_commands |= PC_HUP;
947 gig_dbg(DEBUG_CMD, "Scheduling PC_HUP"); 952 gig_dbg(DEBUG_CMD, "Scheduling PC_HUP");
948 cs->commands_pending = 1; 953 cs->commands_pending = 1;
954 return;
949 } 955 }
956
957 snprintf(bcs->commands[AT_PROTO], 9, "^SBPR=%u\r", bcs->proto2);
958 snprintf(bcs->commands[AT_ISO], 9, "^SISO=%u\r", bcs->channel + 1);
959
960 at_state->pending_commands |= PC_ACCEPT;
961 gig_dbg(DEBUG_CMD, "Scheduling PC_ACCEPT");
962 cs->commands_pending = 1;
950} 963}
951 964
952static void do_start(struct cardstate *cs) 965static void do_start(struct cardstate *cs)
@@ -957,7 +970,7 @@ static void do_start(struct cardstate *cs)
957 schedule_init(cs, MS_INIT); 970 schedule_init(cs, MS_INIT);
958 971
959 cs->isdn_up = 1; 972 cs->isdn_up = 1;
960 gigaset_i4l_cmd(cs, ISDN_STAT_RUN); 973 gigaset_isdn_start(cs);
961 // FIXME: not in locked mode 974 // FIXME: not in locked mode
962 // FIXME 2: only after init sequence 975 // FIXME 2: only after init sequence
963 976
@@ -975,7 +988,7 @@ static void finish_shutdown(struct cardstate *cs)
975 /* Tell the LL that the device is not available .. */ 988 /* Tell the LL that the device is not available .. */
976 if (cs->isdn_up) { 989 if (cs->isdn_up) {
977 cs->isdn_up = 0; 990 cs->isdn_up = 0;
978 gigaset_i4l_cmd(cs, ISDN_STAT_STOP); 991 gigaset_isdn_stop(cs);
979 } 992 }
980 993
981 /* The rest is done by cleanup_cs () in user mode. */ 994 /* The rest is done by cleanup_cs () in user mode. */
@@ -1276,7 +1289,7 @@ static void do_action(int action, struct cardstate *cs,
1276 break; 1289 break;
1277 } 1290 }
1278 bcs->chstate |= CHS_D_UP; 1291 bcs->chstate |= CHS_D_UP;
1279 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DCONN); 1292 gigaset_isdn_connD(bcs);
1280 cs->ops->init_bchannel(bcs); 1293 cs->ops->init_bchannel(bcs);
1281 break; 1294 break;
1282 case ACT_DLE1: 1295 case ACT_DLE1:
@@ -1284,7 +1297,7 @@ static void do_action(int action, struct cardstate *cs,
1284 bcs = cs->bcs + cs->curchannel; 1297 bcs = cs->bcs + cs->curchannel;
1285 1298
1286 bcs->chstate |= CHS_D_UP; 1299 bcs->chstate |= CHS_D_UP;
1287 gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DCONN); 1300 gigaset_isdn_connD(bcs);
1288 cs->ops->init_bchannel(bcs); 1301 cs->ops->init_bchannel(bcs);
1289 break; 1302 break;
1290 case ACT_FAKEHUP: 1303 case ACT_FAKEHUP:
@@ -1474,11 +1487,6 @@ static void do_action(int action, struct cardstate *cs,
1474 case ACT_ACCEPT: 1487 case ACT_ACCEPT:
1475 start_accept(at_state); 1488 start_accept(at_state);
1476 break; 1489 break;
1477 case ACT_PROTO_L2:
1478 gig_dbg(DEBUG_CMD, "set protocol to %u",
1479 (unsigned) ev->parameter);
1480 at_state->bcs->proto2 = ev->parameter;
1481 break;
1482 case ACT_HUP: 1490 case ACT_HUP:
1483 at_state->pending_commands |= PC_HUP; 1491 at_state->pending_commands |= PC_HUP;
1484 cs->commands_pending = 1; 1492 cs->commands_pending = 1;