[aadk-commits] dbailey: uClinux/trunk r463 - /uClinux/trunk/uClinux-dist/linux-2.6.x/drivers...

aadk-commits at lists.digium.com aadk-commits at lists.digium.com
Fri Jun 1 08:15:41 MST 2007


Author: dbailey
Date: Fri Jun  1 10:15:41 2007
New Revision: 463

URL: http://svn.digium.com/view/aadk?view=rev&rev=463
Log:
Added the ability to set fxo tx/rx gain at the daa IC. 
Cleaned up type caste to echo regs

Modified:
    uClinux/trunk/uClinux-dist/linux-2.6.x/drivers/zaptel/sx00i.c

Modified: uClinux/trunk/uClinux-dist/linux-2.6.x/drivers/zaptel/sx00i.c
URL: http://svn.digium.com/view/aadk/uClinux/trunk/uClinux-dist/linux-2.6.x/drivers/zaptel/sx00i.c?view=diff&rev=463&r1=462&r2=463
==============================================================================
--- uClinux/trunk/uClinux-dist/linux-2.6.x/drivers/zaptel/sx00i.c (original)
+++ uClinux/trunk/uClinux-dist/linux-2.6.x/drivers/zaptel/sx00i.c Fri Jun  1 10:15:41 2007
@@ -393,6 +393,8 @@
 static int fxshonormode = 0;
 static int alawoverride = 0;
 static int fxo_addrs[4] = { 0x00, 0x08, 0x04, 0x0c };
+static int fxotxgain = -45;	/* -4.5 dB to satsify the VPM */
+static int fxorxgain = -45;
 /* static int csmap[4] = { 0x0400, 0x0040, 0x0020, 0x0010 }; */
 static int csmap[4] = { 0x0100, 0x0040, 0x0020, 0x0010 };
 #ifdef VPM_SUPPORT
@@ -1727,13 +1729,24 @@
 	/* Enable on-hook line monitor */
 	sx00_setreg(wc, card, 5, 0x08);
 
-	/* Apply negative Tx gain of 4.5db to DAA */
-	sx00_setreg(wc, card, 38, 0x14);	/* 4db */
-	sx00_setreg(wc, card, 40, 0x15);	/* 0.5db */
-
-	/* Apply negative Rx gain of 4.5db to DAA */
-	sx00_setreg(wc, card, 39, 0x14);	/* 4db */
-	sx00_setreg(wc, card, 41, 0x15);	/* 0.5db */
+	/* Take values for fxotxgain and fxorxgain and apply them to module */
+	if (fxotxgain >=  -150 && fxotxgain < 0) {
+		sx00_setreg(wc, card, 38, 16 + (fxotxgain/-10));
+		sx00_setreg(wc, card, 40, 16 + (-fxotxgain%10));
+	}
+	else if (fxotxgain <= 120 && fxotxgain >= 0) {
+		sx00_setreg(wc, card, 38, fxotxgain/10);
+		sx00_setreg(wc, card, 40, (fxotxgain%10));
+	}
+	if (fxorxgain >=  -150 && fxorxgain < 0) {
+		sx00_setreg(wc, card, 39, 16+ (fxorxgain/-10));
+		sx00_setreg(wc, card, 41, 16 + (-fxorxgain%10));
+	}
+	else if (fxorxgain <= 120 && fxorxgain >= 0) {
+		sx00_setreg(wc, card, 39, fxorxgain/10);
+		sx00_setreg(wc, card, 41, (fxorxgain%10));
+	}
+
 	return 0;
 		
 }
@@ -2042,8 +2055,9 @@
 		}
 		break;
 	case WCTDM_SET_ECHOTUNE:
-		printk("-- Setting echo registers: \n");
-		if (copy_from_user(&echoregs, (struct sx00_echo_coefs*)data, sizeof(echoregs)))
+		if (debug)
+			printk("-- Setting echo registers: (Channel position %d)\n", chan->chanpos);
+		if (copy_from_user(&echoregs, (struct wctdm_echo_coefs *)data, sizeof(echoregs)))
 			return -EFAULT;
 
 		if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXO) {
@@ -2060,12 +2074,12 @@
 			sx00_setreg(wc, chan->chanpos - 1, 51, echoregs.coef7);
 			sx00_setreg(wc, chan->chanpos - 1, 52, echoregs.coef8);
 
-			printk("-- Set echo registers successfully\n");
+			if (debug)
+				printk("-- Set echo registers successfully\n");
 
 			break;
 		} else {
 			return -EINVAL;
-
 		}
 		break;
 #ifdef VPM_SUPPORT
@@ -2804,6 +2818,8 @@
 module_param(battdebounce, int, 0600);
 module_param(battthresh, int, 0600);
 module_param(alawoverride, int, 0600);
+module_param(fxotxgain, int, 0600);
+module_param(fxorxgain, int, 0600);
 #ifdef VPM_SUPPORT
 module_param(vpmsupport, int, 0600);
 module_param(vpmdtmfsupport, int, 0600);
@@ -2824,6 +2840,8 @@
 MODULE_PARM(battdebounce, "i");
 MODULE_PARM(battthresh, "i");
 MODULE_PARM(alawoverride, "i");
+MODULE_PARM(fxotxgain, "i");
+MODULE_PARM(fxorxgain, "i");
 #ifdef VPM_SUPPORT
 MODULE_PARM(vpmsupport, "i");
 MODULE_PARM(vpmdtmfsupport, "i");



More information about the aadk-commits mailing list