--- dahdi-linux-2.6.1/drivers/dahdi/wcb4xxp/base.c.orig 2012-04-05 18:22:41.000000000 +0200 +++ dahdi-linux-2.6.1/drivers/dahdi/wcb4xxp/base.c 2013-02-06 18:44:08.184863522 +0100 @@ -108,6 +108,9 @@ static int led_fader_table[] = { 20, 18, 16, 13, 11, 9, 8, 6, 4, 3, 2, 1, 0, 0, }; +static int card_modes[MAX_B4_CARDS]; +static int card_modes_count; + // #define CREATE_WCB4XXP_PROCFS_ENTRY #ifdef CREATE_WCB4XXP_PROCFS_ENTRY #define PROCFS_NAME "wcb4xxp" @@ -1576,15 +1579,19 @@ static void hfc_init_all_st(struct b4xxp s->parent = b4; s->port = i; - /* The way the Digium B410P card reads the NT/TE mode - * jumper is the oposite of how other HFC-4S cards do: - * - In B410P: GPIO=0: NT - * - In Junghanns: GPIO=0: TE - */ - if (b4->card_type == B410P) - nt = ((gpio & (1 << (i + 4))) == 0); - else - nt = ((gpio & (1 << (i + 4))) != 0); + if ((b4->cardno < card_modes_count) && (card_modes[b4->cardno] >= 0) && (card_modes[b4->cardno] < (1 << MAX_SPANS_PER_CARD))) { + nt = ((card_modes[b4->cardno] >> i) & 1); + } else { + /* The way the Digium B410P card reads the NT/TE mode + * jumper is the opposite of how other HFC-4S cards do: + * - In B410P: GPIO=0: NT + * - In Junghanns: GPIO=0: TE + */ + if (b4->card_type == B410P) + nt = ((gpio & (1 << (i + 4))) == 0); + else + nt = ((gpio & (1 << (i + 4))) != 0); + } s->te_mode = !nt; @@ -3118,6 +3125,7 @@ module_param(vpmsupport, int, S_IRUGO); module_param(timer_1_ms, int, S_IRUGO | S_IWUSR); module_param(timer_3_ms, int, S_IRUGO | S_IWUSR); module_param(companding, charp, S_IRUGO); +module_param_array(card_modes, int, &card_modes_count, S_IRUGO); MODULE_PARM_DESC(debug, "bitmap: 1=general 2=dtmf 4=regops 8=fops 16=ec 32=st state 64=hdlc 128=alarm"); MODULE_PARM_DESC(spanfilter, "debug filter for spans. bitmap: 1=port 1, 2=port 2, 4=port 3, 8=port 4"); @@ -3133,6 +3141,8 @@ MODULE_PARM_DESC(timer_1_ms, "NT: msec t MODULE_PARM_DESC(timer_3_ms, "TE: msec to wait for link activation, NT: unused."); MODULE_PARM_DESC(companding, "Change the companding to \"alaw\" or \"ulaw\""\ "(alaw by default)"); +MODULE_PARM_DESC(card_modes, "Comma-separated list of per card bit-masks to configure spans for TE/NT mode. "\ + "bit-mask<0: use jumper modes, span bit=0: TE, span bit=1: NT"); MODULE_AUTHOR("Digium Incorporated "); MODULE_DESCRIPTION("B410P & Similars multi-port BRI module driver.");