[svn-commits] rmeyerriecks: linux/trunk r10719 - /linux/trunk/drivers/dahdi/wctdm24xxp/base.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Sep 21 13:16:38 CDT 2012


Author: rmeyerriecks
Date: Fri Sep 21 13:16:35 2012
New Revision: 10719

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10719
Log:
wctdm24xxp: Only two polarity reversals are needed to validate RING on FXO ports.

This fixes a regression introduced in commit r10186 "wctdm24xxp: Use time
interval for debouncing FXO ring detect." [1] which was first released in
DAHDI-Linux 2.6.0. This only affects users with analog trunks whose providers do
not present 4 polarity reversals on the ring signals. The reporter of this issue
is based in South Africa.

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=10168

In prior versions, the ring detector did not check for polarity reversals, only
the presence of ringing voltage unless fwringdetect or neonmwi_monitor mode was
set, and even when one of those modes were set, the driver only needed two
reversals to validate a ring. This commit allows the driver to always stay in
fwringdetect mode but restores the requirement for only two reversals.

Also included in this commit is a change to ensure that ringing is not reported
when debouncing lost battery which can happen when voltage is swinging through
0.

Reported-and-Tested-by: Jaco Kroon <jaco at uls.co.za>
Internal-Issue-ID: DAHLIN-298
Signed-off-by: Shaun Ruffell <sruffell at digium.com>

Modified:
    linux/trunk/drivers/dahdi/wctdm24xxp/base.c

Modified: linux/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=10719&r1=10718&r2=10719
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Fri Sep 21 13:16:35 2012
@@ -1833,19 +1833,22 @@
 static inline bool is_fxo_ringing(const struct fxo *const fxo)
 {
 	return ((fxo->hook_ring_shadow & 0x60) &&
-		(fxo->battery_state == BATTERY_PRESENT));
+		((fxo->battery_state == BATTERY_PRESENT) ||
+		 (fxo->battery_state == BATTERY_DEBOUNCING_LOST)));
 }
 
 static inline bool is_fxo_ringing_positive(const struct fxo *const fxo)
 {
 	return (((fxo->hook_ring_shadow & 0x60) == 0x20) &&
-		(fxo->battery_state == BATTERY_PRESENT));
+		((fxo->battery_state == BATTERY_PRESENT) ||
+		 (fxo->battery_state == BATTERY_DEBOUNCING_LOST)));
 }
 
 static inline bool is_fxo_ringing_negative(const struct fxo *const fxo)
 {
 	return (((fxo->hook_ring_shadow & 0x60) == 0x40) &&
-		(fxo->battery_state == BATTERY_PRESENT));
+		((fxo->battery_state == BATTERY_PRESENT) ||
+		 (fxo->battery_state == BATTERY_DEBOUNCING_LOST)));
 }
 
 static inline void set_ring(struct fxo *fxo, enum ring_detector_state new)
@@ -1856,19 +1859,21 @@
 static void wctdm_fxo_ring_detect(struct wctdm *wc, struct wctdm_module *mod)
 {
 	struct fxo *const fxo = &mod->mod.fxo;
+	static const unsigned int POLARITY_CHANGES_NEEDED = 2;
 
 	/* Look for ring status bits (Ring Detect Signal Negative and Ring
-	 * Detect Signal Positive) to transition back and forth some number of
-	 * times to indicate that a ring is occurring.  Provide some number of
-	 * samples to allow for the transitions to occur before giving up.
-	 * NOTE: neon mwi voltages will trigger one of these bits to go active
-	 * but not to have transitions between the two bits (i.e. no negative
-	 * to positive or positive to negative traversals) */
+	 * Detect Signal Positive) to transition back and forth
+	 * POLARITY_CHANGES_NEEDED times to indicate that a ring is occurring.
+	 * Provide some number of samples to allow for the transitions to occur
+	 * before giving up.  NOTE: neon mwi voltages will trigger one of these
+	 * bits to go active but not to have transitions between the two bits
+	 * (i.e. no negative to positive or positive to negative traversals) */
 
 	switch (fxo->ring_state) {
 	case DEBOUNCING_RINGING_POSITIVE:
 		if (is_fxo_ringing_negative(fxo)) {
-			if (++fxo->ring_polarity_change_count > 4) {
+			if (++fxo->ring_polarity_change_count >
+						POLARITY_CHANGES_NEEDED) {
 				mod_hooksig(wc, mod, DAHDI_RXSIG_RING);
 				set_ring(fxo, RINGING);
 				if (debug) {
@@ -1886,7 +1891,8 @@
 		break;
 	case DEBOUNCING_RINGING_NEGATIVE:
 		if (is_fxo_ringing_positive(fxo)) {
-			if (++fxo->ring_polarity_change_count > 4) {
+			if (++fxo->ring_polarity_change_count >
+						POLARITY_CHANGES_NEEDED) {
 				mod_hooksig(wc, mod, DAHDI_RXSIG_RING);
 				set_ring(fxo, RINGING);
 				if (debug) {




More information about the svn-commits mailing list