summaryrefslogtreecommitdiff
path: root/drivers/dahdi/xpp/xbus-pcm.c
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-03-01 13:56:23 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2009-03-01 13:56:23 +0000
commit7e6e55bbdcd0224bf07de8dd47e4f7a92e7d097f (patch)
tree34c04ea112c9587bbad7e0593119c09a53c43466 /drivers/dahdi/xpp/xbus-pcm.c
parentac9297570200f1f21dff01043baabdba90516722 (diff)
New XPP code: xpp rev 6795:
* Fix cases where the command_queue overflowed during initialization. - Also add a 'command_queue_length' parameter to xpp.ko * More migrations to sysfs: - Add a 'transport' attribute to our astribank devices which points to the usb device we use. E.g: /sys/bus/astribanks/devices/xbus-00/transport is symlinked to ../../../../../../devices/pci0000:00/0000:00:10.4/usb5/5-4 - Move /proc/xpp/XBUS-??/XPD-??/span to /sys/bus/xpds/devices/??:?:?/span - Migrate from /proc/xpp/sync to: /sys/bus/astribanks/drivers/xppdrv/sync - New 'offhook' attribute in: /sys/bus/xpds/devices/??:?:?/offhook * PRI: change the "timing" priority to match the convention used by other PRI cards -- I.e: lower numbers (not 0) have higher priority. * FXO: - Power denial: create two module parameters instead of hard-coded constants (power_denial_safezone, power_denial_minlen). For sites that get non-standard power-denial signals from central office on offhook. - Don't hangup on power-denial, just notify Dahdi and wait for - Fix caller-id detection for the case central office sends it before first ring without any indication before. Asterisk's desicion. * USB_FW.hex: - Fixes cases where firmware loading would fail. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@6046 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/xpp/xbus-pcm.c')
-rw-r--r--drivers/dahdi/xpp/xbus-pcm.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/dahdi/xpp/xbus-pcm.c b/drivers/dahdi/xpp/xbus-pcm.c
index ef1d5e3..2d98dc5 100644
--- a/drivers/dahdi/xpp/xbus-pcm.c
+++ b/drivers/dahdi/xpp/xbus-pcm.c
@@ -177,7 +177,7 @@ static void xpp_drift_step(xbus_t *xbus, const struct timeval *tv)
spin_lock_irqsave(&driftinfo->lock, flags);
cycled = xpp_ticker_step(&xbus->ticker, tv);
- if(ref_ticker && syncer && xbus->sync_mode == SYNC_MODE_PLL) {
+ if(ref_ticker && ref_ticker != &xbus->ticker && syncer && xbus->sync_mode == SYNC_MODE_PLL) {
int new_delta_tick = ticker->count - ref_ticker->count;
int lost_ticks = new_delta_tick - driftinfo->delta_tick;
@@ -342,6 +342,7 @@ void xbus_set_command_timer(xbus_t *xbus, bool on)
XBUS_DBG(SYNC, xbus, "del_timer\n");
del_timer(&xbus->command_timer);
}
+ xbus->self_ticking = ! on;
}
/*
@@ -363,21 +364,18 @@ void got_new_syncer(xbus_t *xbus, enum sync_mode mode, int drift)
case SYNC_MODE_AB:
xbus->sync_mode = mode;
xbus_set_command_timer(xbus, 0);
- xbus->self_ticking = 1;
xpp_set_syncer(xbus, 1);
global_ticker = xbus;
break;
case SYNC_MODE_PLL:
xbus->sync_mode = mode;
xbus_set_command_timer(xbus, 0);
- xbus->self_ticking = 1;
xpp_set_syncer(xbus, 0);
global_ticker = xbus;
break;
case SYNC_MODE_NONE: /* lost sync source */
xbus->sync_mode = mode;
xbus_set_command_timer(xbus, 1);
- xbus->self_ticking = 0;
xpp_set_syncer(xbus, 0);
break;
case SYNC_MODE_QUERY: /* ignore */
@@ -395,7 +393,6 @@ void xbus_request_sync(xbus_t *xbus, enum sync_mode mode)
XBUS_DBG(SYNC, xbus, "sent request (mode=%d)\n", mode);
CALL_PROTO(GLOBAL, SYNC_SOURCE, xbus, NULL, mode, 0);
if(mode == SYNC_MODE_NONE) {
- xbus->self_ticking = 0;
xbus_set_command_timer(xbus, 1);
}
}
@@ -528,6 +525,12 @@ static void update_sync_master(xbus_t *new_syncer, bool force_dahdi)
* This global locking protects:
* - The ref_ticker so it won't be used while we change it.
* - The xbus_drift_clear() from corrupting driftinfo data.
+ * It's important to set ref_ticker now:
+ * - We cannot make the new xbus a syncer yet (until we get
+ * a reply from AB). Maybe it's still not self_ticking, so
+ * we must keep the timer for the command_queue to function.
+ * - However, we must not send drift commands to it, because
+ * they'll revert it to PLL instead of AB.
*/
spin_lock_irqsave(&ref_ticker_lock, flags);
if(syncer)
@@ -564,7 +567,7 @@ void elect_syncer(const char *msg)
{
int i;
int j;
- uint timing_priority = 0;
+ uint timing_priority = INT_MAX;
xpd_t *best_xpd = NULL;
xbus_t *the_xbus = NULL;
@@ -580,7 +583,7 @@ void elect_syncer(const char *msg)
if(!xpd || !xpd->card_present)
continue;
- if(xpd->timing_priority > timing_priority) {
+ if(xpd->timing_priority > 0 && xpd->timing_priority < timing_priority) {
timing_priority = xpd->timing_priority;
best_xpd = xpd;
}
@@ -595,6 +598,7 @@ void elect_syncer(const char *msg)
} else {
DBG(SYNC, "%s: No more syncers\n", msg);
xpp_set_syncer(NULL, 0);
+ the_xbus = NULL;
}
if(the_xbus != syncer)
update_sync_master(the_xbus, force_dahdi_sync);