summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-01-21 05:28:42 +0000
committerShaun Ruffell <sruffell@digium.com>2011-01-21 05:28:42 +0000
commitb7bfe2596bff3d80a1132777c1af67d3e72a1215 (patch)
tree2334f2627d899b83fd70700016c503d41c9bd4fb
parent3896c2af9b2d8f6de9c7ac84f434658f8bb3f295 (diff)
wctdm24xxp: Add optional FXO digital loopback if DEBUG is defined.
This module parameter will allow patgen/pattest to be used only on FXO ports. *ALL* FXO ports will be placed in digital loopback mode when set. The current intent is for this to be removed as an optional module parameter when there is a channel by channel representation in sysfs. Otherwise, a new IOCTL would have to be defined and a tool written in order to support this. DAHDI-696. Signed-off-by: Shaun Ruffell <sruffell@digium.com> Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=9391 git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/branches/2.4@9663 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/wctdm24xxp/base.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c
index 59c667f..bec01bb 100644
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -218,6 +218,7 @@ static unsigned int battthresh;
static int debug = 0;
#ifdef DEBUG
static int robust = 0;
+static int digitalloopback;
#endif
static int lowpower = 0;
static int boostringer = 0;
@@ -2708,6 +2709,15 @@ static int wctdm_init_voicedaa(struct wctdm *wc, int card, int fast, int manual,
wctdm_set_hwgain(wc, card, fxotxgain, 1);
wctdm_set_hwgain(wc, card, fxorxgain, 0);
+#ifdef DEBUG
+ if (digitalloopback) {
+ dev_info(&wc->vb.pdev->dev,
+ "Turning on digital loopback for port %d.\n",
+ card + 1);
+ wctdm_setreg(wc, card, 10, 0x01);
+ }
+#endif
+
if (debug)
dev_info(&wc->vb.pdev->dev, "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));
@@ -3890,9 +3900,13 @@ static void wctdm_fixup_analog_span(struct wctdm *wc, int spanno)
y, s->chans[y]);
}
if (wc->modtype[x] == MOD_TYPE_FXO) {
+ int val;
s->chans[y++]->sigcap = DAHDI_SIG_FXSKS | DAHDI_SIG_FXSLS | DAHDI_SIG_SF | DAHDI_SIG_CLEAR;
- wctdm_setreg(wc, x, 33,
- (should_set_alaw(wc) ? 0x20 : 0x28));
+ val = should_set_alaw(wc) ? 0x20 : 0x28;
+#ifdef DEBUG
+ val = (digitalloopback) ? 0x30 : val;
+#endif
+ wctdm_setreg(wc, x, 33, val);
} else if (wc->modtype[x] == MOD_TYPE_FXS) {
s->chans[y++]->sigcap = DAHDI_SIG_FXOKS | DAHDI_SIG_FXOLS | DAHDI_SIG_FXOGS | DAHDI_SIG_SF | DAHDI_SIG_EM | DAHDI_SIG_CLEAR;
wctdm_setreg(wc, x, 1,
@@ -5316,6 +5330,9 @@ module_param(loopcurrent, int, 0600);
module_param(reversepolarity, int, 0600);
#ifdef DEBUG
module_param(robust, int, 0600);
+module_param(digitalloopback, int, 0400);
+MODULE_PARM_DESC(digitalloopback, "Set to 1 to place FXO modules into " \
+ "loopback mode for troubleshooting.");
#endif
module_param(opermode, charp, 0600);
module_param(lowpower, int, 0600);