diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-05-15 22:19:51 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2004-05-15 22:19:51 +0000 |
commit | 67818eaf00deb068f7250d4f853c7cb4c83c12a1 (patch) | |
tree | af08650865a86256967df34e112713ed90bc4a6b | |
parent | bfe1d465365fbbead0b36b747daaffa47bc76dc3 (diff) |
Save calibration registers, add "lowpower" option
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@392 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-x | wcfxs.c | 20 | ||||
-rwxr-xr-x | wctdm.c | 20 |
2 files changed, 36 insertions, 4 deletions
@@ -150,6 +150,11 @@ static alpha indirect_regs[] = #define PEGTIME 50 * 8 /* 50ms peak to peak gets us rings of 10 Hz or more */ #define PEGCOUNT 5 /* 5 cycles of pegging means RING */ +#define NUM_CAL_REGS 12 + +struct calregs { + unsigned char vals[NUM_CAL_REGS]; +}; struct wcfxs { struct pci_dev *dev; @@ -194,6 +199,7 @@ struct wcfxs { int idletxhookstate[NUM_CARDS]; /* IDLE changing hook state */ int lasttxhook[NUM_CARDS]; int palarms[NUM_CARDS]; + struct calregs calregs[NUM_CARDS]; } fxs; } mod; @@ -224,6 +230,7 @@ static void wcfxs_release(struct wcfxs *wc); static int debug = 0; static int robust = 0; static int timingonly = 0; +static int lowpower = 0; static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast , int manual, int sane); @@ -1101,8 +1108,15 @@ static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast, int manual, printk("Proslic Passed Auto Calibration on Second Attempt\n"); } } + /* Save calibration vectors */ + for (x=0;x<NUM_CAL_REGS;x++) + wc->mod.fxs.calregs[card].vals[x] = wcfxs_getreg(wc, card, 96 + x); #endif + } else { + /* Restore calibration registers */ + for (x=0;x<NUM_CAL_REGS;x++) + wcfxs_setreg(wc, card, 96 + x, wc->mod.fxs.calregs[card].vals[x]); } /* Calibration complete, restore original values */ for (x=0;x<5;x++) { @@ -1138,12 +1152,13 @@ static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast, int manual, wcfxs_setreg(wc, card, 19, 0xff); wcfxs_setreg(wc, card, 20, 0xff); wcfxs_setreg(wc, card, 73, 0x04); + if (lowpower) + wcfxs_setreg(wc, card, 72, 0x10); #if 0 wcfxs_setreg(wc, card, 21, 0x00); // enable interrupt wcfxs_setreg(wc, card, 22, 0x02); // Loop detection interrupt wcfxs_setreg(wc, card, 23, 0x01); // DTMF detection interrupt - wcfxs_setreg(wc, card, 72, 0x20); #endif #if 0 @@ -1888,7 +1903,8 @@ static void __exit wcfxs_cleanup(void) MODULE_PARM(debug, "i"); MODULE_PARM(robust, "i"); MODULE_PARM(timingonly, "i"); -MODULE_DESCRIPTION("Wildcard S100P Zaptel Driver"); +MODULE_PARM(lowpower, "i"); +MODULE_DESCRIPTION("Wildcard TDM400P Zaptel Driver"); MODULE_AUTHOR("Mark Spencer <markster@linux-support.net>"); #ifdef MODULE_LICENSE MODULE_LICENSE("GPL"); @@ -150,6 +150,11 @@ static alpha indirect_regs[] = #define PEGTIME 50 * 8 /* 50ms peak to peak gets us rings of 10 Hz or more */ #define PEGCOUNT 5 /* 5 cycles of pegging means RING */ +#define NUM_CAL_REGS 12 + +struct calregs { + unsigned char vals[NUM_CAL_REGS]; +}; struct wcfxs { struct pci_dev *dev; @@ -194,6 +199,7 @@ struct wcfxs { int idletxhookstate[NUM_CARDS]; /* IDLE changing hook state */ int lasttxhook[NUM_CARDS]; int palarms[NUM_CARDS]; + struct calregs calregs[NUM_CARDS]; } fxs; } mod; @@ -224,6 +230,7 @@ static void wcfxs_release(struct wcfxs *wc); static int debug = 0; static int robust = 0; static int timingonly = 0; +static int lowpower = 0; static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast , int manual, int sane); @@ -1101,8 +1108,15 @@ static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast, int manual, printk("Proslic Passed Auto Calibration on Second Attempt\n"); } } + /* Save calibration vectors */ + for (x=0;x<NUM_CAL_REGS;x++) + wc->mod.fxs.calregs[card].vals[x] = wcfxs_getreg(wc, card, 96 + x); #endif + } else { + /* Restore calibration registers */ + for (x=0;x<NUM_CAL_REGS;x++) + wcfxs_setreg(wc, card, 96 + x, wc->mod.fxs.calregs[card].vals[x]); } /* Calibration complete, restore original values */ for (x=0;x<5;x++) { @@ -1138,12 +1152,13 @@ static int wcfxs_init_proslic(struct wcfxs *wc, int card, int fast, int manual, wcfxs_setreg(wc, card, 19, 0xff); wcfxs_setreg(wc, card, 20, 0xff); wcfxs_setreg(wc, card, 73, 0x04); + if (lowpower) + wcfxs_setreg(wc, card, 72, 0x10); #if 0 wcfxs_setreg(wc, card, 21, 0x00); // enable interrupt wcfxs_setreg(wc, card, 22, 0x02); // Loop detection interrupt wcfxs_setreg(wc, card, 23, 0x01); // DTMF detection interrupt - wcfxs_setreg(wc, card, 72, 0x20); #endif #if 0 @@ -1888,7 +1903,8 @@ static void __exit wcfxs_cleanup(void) MODULE_PARM(debug, "i"); MODULE_PARM(robust, "i"); MODULE_PARM(timingonly, "i"); -MODULE_DESCRIPTION("Wildcard S100P Zaptel Driver"); +MODULE_PARM(lowpower, "i"); +MODULE_DESCRIPTION("Wildcard TDM400P Zaptel Driver"); MODULE_AUTHOR("Mark Spencer <markster@linux-support.net>"); #ifdef MODULE_LICENSE MODULE_LICENSE("GPL"); |