From 990af593a595a796d9f0e88ba857183a4b03b413 Mon Sep 17 00:00:00 2001 From: Oron Peled Date: Wed, 7 Dec 2011 19:34:37 +0000 Subject: [PATCH] xpp: BRI: fix timing priority calculation Use similar caculation as in the PRI module: * Save timing_priority from spanconfig and elect syncer when spanconfig is called. * Create custom timing_priority() function that returns the value or error if span is disconnected. Signed-off-by: Oron Peled Acked-by: : Tzafrir Cohen git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10373 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/xpp/card_bri.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/dahdi/xpp/card_bri.c b/drivers/dahdi/xpp/card_bri.c index 1f32eb4..d38df26 100644 --- a/drivers/dahdi/xpp/card_bri.c +++ b/drivers/dahdi/xpp/card_bri.c @@ -1202,6 +1202,8 @@ static int bri_spanconfig(struct file *file, struct dahdi_span *span, framingstr, codingstr, crcstr, lc->lineconfig, lc->sync); + PHONEDEV(xpd).timing_priority = lc->sync; + elect_syncer("BRI-spanconfig"); /* * FIXME: validate */ @@ -1429,6 +1431,18 @@ static void BRI_card_pcm_tospan(xpd_t *xpd, xpacket_t *pack) } } +static int BRI_timing_priority(xpd_t *xpd) +{ + struct BRI_priv_data *priv; + + priv = xpd->priv; + BUG_ON(!priv); + if (priv->layer1_up) + return PHONEDEV(xpd).timing_priority; + XPD_DBG(SYNC, xpd, "No timing priority (no layer1)\n"); + return -ENOENT; +} + int BRI_echocancel_timeslot(xpd_t *xpd, int pos) { return xpd->addr.subunit * 4 + pos; @@ -1696,7 +1710,7 @@ static const struct phoneops bri_phoneops = { .card_pcm_recompute = BRI_card_pcm_recompute, .card_pcm_fromspan = BRI_card_pcm_fromspan, .card_pcm_tospan = BRI_card_pcm_tospan, - .card_timing_priority = generic_timing_priority, + .card_timing_priority = BRI_timing_priority, .echocancel_timeslot = BRI_echocancel_timeslot, .echocancel_setmask = BRI_echocancel_setmask, .card_ioctl = BRI_card_ioctl,