summaryrefslogtreecommitdiff
path: root/wcfxs.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-05-15 22:19:51 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-05-15 22:19:51 +0000
commit67818eaf00deb068f7250d4f853c7cb4c83c12a1 (patch)
treeaf08650865a86256967df34e112713ed90bc4a6b /wcfxs.c
parentbfe1d465365fbbead0b36b747daaffa47bc76dc3 (diff)
Save calibration registers, add "lowpower" option
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@392 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wcfxs.c')
-rwxr-xr-xwcfxs.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/wcfxs.c b/wcfxs.c
index 10adbc5..80ff08a 100755
--- a/wcfxs.c
+++ b/wcfxs.c
@@ -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");