diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-09-08 03:48:56 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-09-08 03:48:56 +0000 |
commit | 79ad56bfa29cf2f90c167ea1b0ca86405a5e987b (patch) | |
tree | a322292f79ff52aeece22d39a4f80828c494261e | |
parent | 9e50b34e243523ae378d4a71edfa1c1ea38ddd8a (diff) |
Make loop current settable (bug #1200)
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@453 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-x | wcfxs.c | 42 | ||||
-rwxr-xr-x | wctdm.c | 42 |
2 files changed, 82 insertions, 2 deletions
@@ -40,6 +40,22 @@ */ /* #define AUDIO_RINGCHECK */ +/* + Experimental max loop current limit for the proslic + Loop current limit is from 20 mA to 41 mA in steps of 3 + (according to datasheet) + So set the value below to: + 0x00 : 20mA (default) + 0x01 : 23mA + 0x02 : 26mA + 0x03 : 29mA + 0x04 : 32mA + 0x05 : 35mA + 0x06 : 37mA + 0x07 : 41mA +*/ +static int loopcurrent = 20; + static alpha indirect_regs[] = { {0,"DTMF_ROW_0_PEAK",0x55C2}, @@ -941,6 +957,19 @@ static int wcfxs_powerup_proslic(struct wcfxs *wc, int card, int fast) card, vbat * 376 / 1000, vbat, (int)(((jiffies - origjiffies) * 1000 / HZ))); } + /* Proslic max allowed loop current, reg 71 LOOP_I_LIMIT */ + /* If out of range, just set it to the default value */ + int lim; + lim = (loopcurrent - 20) / 3; + if ( loopcurrent > 41 ) { + lim = 0; + if (debug) + printk("Loop current out of range! Setting to default 20mA!\n"); + } + else if (debug) + printk("Loop current set to %dmA!\n",(lim*3)+20); + wcfxs_setreg(wc,card,LOOP_I_LIMIT,lim); + /* Engage DC-DC converter */ wcfxs_setreg(wc, card, 93, 0x19 /* was 0x19 */); #if 0 @@ -1846,11 +1875,16 @@ static int wcfxs_hardware_init(struct wcfxs *wc) wait_just_a_bit(HZ/4); for (x=0;x<wc->cards;x++) { - int sane=0,ret=0; + int sane=0,ret=0,readi=0; #if 1 /* Init with Auto Calibration */ if (!(ret=wcfxs_init_proslic(wc, x, 0, 0, sane))) { wc->cardflag |= (1 << x); + if (debug) { + readi = wcfxs_getreg(wc,x,LOOP_I_LIMIT); + printk("Proslic module %d loop current is %dmA\n",x, + ((readi*3)+20)); + } printk("Module %d: Installed -- AUTO FXS/DPO\n",x); } else { if(ret!=-2) { @@ -1858,6 +1892,11 @@ static int wcfxs_hardware_init(struct wcfxs *wc) /* Init with Manual Calibration */ if (!wcfxs_init_proslic(wc, x, 0, 1, sane)) { wc->cardflag |= (1 << x); + if (debug) { + readi = wcfxs_getreg(wc,x,LOOP_I_LIMIT); + printk("Proslic module %d loop current is %dmA\n",x, + ((readi*3)+20)); + } printk("Module %d: Installed -- MANUAL FXS\n",x); } else { printk("Module %d: FAILED FXS (%s)\n", x, fxshonormode ? fxo_modes[_opermode].name : "FCC"); @@ -2126,6 +2165,7 @@ static void __exit wcfxs_cleanup(void) } MODULE_PARM(debug, "i"); +MODULE_PARM(loopcurrent, "i"); MODULE_PARM(robust, "i"); MODULE_PARM(_opermode, "i"); MODULE_PARM(opermode, "s"); @@ -40,6 +40,22 @@ */ /* #define AUDIO_RINGCHECK */ +/* + Experimental max loop current limit for the proslic + Loop current limit is from 20 mA to 41 mA in steps of 3 + (according to datasheet) + So set the value below to: + 0x00 : 20mA (default) + 0x01 : 23mA + 0x02 : 26mA + 0x03 : 29mA + 0x04 : 32mA + 0x05 : 35mA + 0x06 : 37mA + 0x07 : 41mA +*/ +static int loopcurrent = 20; + static alpha indirect_regs[] = { {0,"DTMF_ROW_0_PEAK",0x55C2}, @@ -941,6 +957,19 @@ static int wcfxs_powerup_proslic(struct wcfxs *wc, int card, int fast) card, vbat * 376 / 1000, vbat, (int)(((jiffies - origjiffies) * 1000 / HZ))); } + /* Proslic max allowed loop current, reg 71 LOOP_I_LIMIT */ + /* If out of range, just set it to the default value */ + int lim; + lim = (loopcurrent - 20) / 3; + if ( loopcurrent > 41 ) { + lim = 0; + if (debug) + printk("Loop current out of range! Setting to default 20mA!\n"); + } + else if (debug) + printk("Loop current set to %dmA!\n",(lim*3)+20); + wcfxs_setreg(wc,card,LOOP_I_LIMIT,lim); + /* Engage DC-DC converter */ wcfxs_setreg(wc, card, 93, 0x19 /* was 0x19 */); #if 0 @@ -1846,11 +1875,16 @@ static int wcfxs_hardware_init(struct wcfxs *wc) wait_just_a_bit(HZ/4); for (x=0;x<wc->cards;x++) { - int sane=0,ret=0; + int sane=0,ret=0,readi=0; #if 1 /* Init with Auto Calibration */ if (!(ret=wcfxs_init_proslic(wc, x, 0, 0, sane))) { wc->cardflag |= (1 << x); + if (debug) { + readi = wcfxs_getreg(wc,x,LOOP_I_LIMIT); + printk("Proslic module %d loop current is %dmA\n",x, + ((readi*3)+20)); + } printk("Module %d: Installed -- AUTO FXS/DPO\n",x); } else { if(ret!=-2) { @@ -1858,6 +1892,11 @@ static int wcfxs_hardware_init(struct wcfxs *wc) /* Init with Manual Calibration */ if (!wcfxs_init_proslic(wc, x, 0, 1, sane)) { wc->cardflag |= (1 << x); + if (debug) { + readi = wcfxs_getreg(wc,x,LOOP_I_LIMIT); + printk("Proslic module %d loop current is %dmA\n",x, + ((readi*3)+20)); + } printk("Module %d: Installed -- MANUAL FXS\n",x); } else { printk("Module %d: FAILED FXS (%s)\n", x, fxshonormode ? fxo_modes[_opermode].name : "FCC"); @@ -2126,6 +2165,7 @@ static void __exit wcfxs_cleanup(void) } MODULE_PARM(debug, "i"); +MODULE_PARM(loopcurrent, "i"); MODULE_PARM(robust, "i"); MODULE_PARM(_opermode, "i"); MODULE_PARM(opermode, "s"); |