diff options
author | mogorman <mogorman@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-10-02 23:50:44 +0000 |
---|---|---|
committer | mogorman <mogorman@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-10-02 23:50:44 +0000 |
commit | a943648b54a7b3aec315bb64857718244db0b422 (patch) | |
tree | 0af57a46e1fd673d54a6565dbe5f8d93a871922e /wctdm24xxp.c | |
parent | 076bfa11b992cd293a91a0d77d5b0f3996fb46a7 (diff) |
add support for setting gain registers on the fxo and fxs modules.
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@1490 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wctdm24xxp.c')
-rw-r--r-- | wctdm24xxp.c | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/wctdm24xxp.c b/wctdm24xxp.c index 0d01117..3cc4767 100644 --- a/wctdm24xxp.c +++ b/wctdm24xxp.c @@ -432,6 +432,10 @@ static char *opermode = "FCC"; static int fxshonormode = 0; static int alawoverride = 0; static int fxo_addrs[4] = { 0x00, 0x08, 0x04, 0x0c }; +static int fxotxgain = 0; +static int fxorxgain = 0; +static int fxstxgain = 0; +static int fxsrxgain = 0; static int nativebridge = 1; #ifdef VPM_SUPPORT static int vpmsupport = 1; @@ -1955,6 +1959,40 @@ static int wctdm_init_voicedaa(struct wctdm *wc, int card, int fast, int manual, /* Apply negative Rx gain of 4.5db to DAA */ wctdm_setreg(wc, card, 39, 0x14); /* 4db */ wctdm_setreg(wc, card, 41, 0x15); /* 0.5db */ + + + /* Take values for fxotxgain and fxorxgain and apply them to module */ + if (fxotxgain) { + if (fxotxgain >= -150 && fxotxgain < 0) { + wctdm_setreg(wc, card, 38, 16 + (fxotxgain/-10)); + if(fxotxgain % 10) { + wctdm_setreg(wc, card, 40, 16 + (-fxotxgain%10)); + } + } + else if (fxotxgain <= 120 && fxotxgain > 0) { + wctdm_setreg(wc, card, 38, fxotxgain/10); + if(fxotxgain % 10) { + wctdm_setreg(wc, card, 40, (fxotxgain%10)); + } + } + } + if (fxorxgain) { + if (fxorxgain >= -150 && fxorxgain < 0) { + wctdm_setreg(wc, card, 39, 16+ (fxorxgain/-10)); + if(fxotxgain % 10) { + wctdm_setreg(wc, card, 41, 16 + (-fxorxgain%10)); + } + } + else if (fxorxgain <= 120 && fxorxgain > 0) { + wctdm_setreg(wc, card, 39, fxorxgain/10); + if(fxorxgain % 10) { + wctdm_setreg(wc, card, 41, (fxorxgain%10)); + } + } + } + + if(debug) + printk("DEBUG fxotxgain:%i.%i fxorxgain:%i.%i\n", (wctdm_getreg(wc, card, 38)/16) ? -(wctdm_getreg(wc, card, 38) - 16) : wctdm_getreg(wc, card, 38), (wctdm_getreg(wc, card, 40)/16) ? -(wctdm_getreg(wc, card, 40) - 16) : wctdm_getreg(wc, card, 40), (wctdm_getreg(wc, card, 39)/16) ? -(wctdm_getreg(wc, card, 39) - 16): wctdm_getreg(wc, card, 39), (wctdm_getreg(wc, card, 41)/16)?-(wctdm_getreg(wc, card, 41) - 16) : wctdm_getreg(wc, card, 41)); return 0; @@ -1964,7 +2002,7 @@ static int wctdm_init_proslic(struct wctdm *wc, int card, int fast, int manual, { unsigned short tmp[5]; - unsigned char r19; + unsigned char r19,r9; int x; int fxsmode=0; @@ -2159,6 +2197,38 @@ static int wctdm_init_proslic(struct wctdm *wc, int card, int fast, int manual, printk("Reducing ring power on slot %d (50V peak)\n", card + 1); } } + + if(fxstxgain || fxsrxgain) { + r9 = wctdm_getreg(wc, card, 9); + switch (fxstxgain) { + + case 35: + r9+=8; + break; + case -35: + r9+=4; + break; + case 0: + break; + } + + switch (fxsrxgain) { + + case 35: + r9+=2; + break; + case -35: + r9+=1; + break; + case 0: + break; + } + wctdm_setreg(wc,card,9,r9); + } + + if(debug) + printk("DEBUG: fxstxgain:%s fxsrxgain:%s\n",((wctdm_getreg(wc, card, 9)/8) == 1)?"3.5":(((wctdm_getreg(wc,card,9)/4) == 1)?"-3.5":"0.0"),((wctdm_getreg(wc, card, 9)/2) == 1)?"3.5":((wctdm_getreg(wc,card,9)%2)?"-3.5":"0.0")); + wctdm_setreg(wc, card, 64, 0x01); wc->mods[card].fxs.lasttxhook = 1; return 0; @@ -3443,6 +3513,10 @@ module_param(battdebounce, int, 0600); module_param(battthresh, int, 0600); module_param(alawoverride, int, 0600); module_param(nativebridge, int, 0600); +module_param(fxotxgain, int, 0600); +module_param(fxorxgain, int, 0600); +module_param(fxstxgain, int, 0600); +module_param(fxsrxgain, int, 0600); #ifdef VPM_SUPPORT module_param(vpmsupport, int, 0600); module_param(vpmdtmfsupport, int, 0600); @@ -3464,6 +3538,10 @@ MODULE_PARM(battdebounce, "i"); MODULE_PARM(battthresh, "i"); MODULE_PARM(alawoverride, "i"); MODULE_PARM(nativebridge, "i"); +MODULE_PARM(fxotxgain, "i"); +MODULE_PARM(fxorxgain, "i"); +MODULE_PARM(fxstxgain, "i"); +MODULE_PARM(fxsrxgain, "i"); #ifdef VPM_SUPPORT MODULE_PARM(vpmsupport, "i"); MODULE_PARM(vpmdtmfsupport, "i"); |