From 1b703bb6f024014f56b3afb1aaade39c4c8e45f8 Mon Sep 17 00:00:00 2001 From: Russ Meyerriecks Date: Thu, 4 Oct 2012 20:24:29 +0000 Subject: wct4xxp: Ensure all spans are configured by default. Not configuring all the spans on an octal card can result in some of the spans not working in clear channel modes. Now ensure that all spans receive a default configuration regardless how they are configured from user space. Internal-Issue-ID: DAHLIN-289 Signed-off-by: Shaun Ruffell Signed-off-by: Russ Meyerriecks git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10728 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/wct4xxp/base.c | 45 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/drivers/dahdi/wct4xxp/base.c b/drivers/dahdi/wct4xxp/base.c index 1e1b5f6..7891c61 100644 --- a/drivers/dahdi/wct4xxp/base.c +++ b/drivers/dahdi/wct4xxp/base.c @@ -436,6 +436,7 @@ static const struct dahdi_echocan_ops vpm_ec_ops = { #endif static void __set_clear(struct t4 *wc, int span); +static int _t4_startup(struct file *file, struct dahdi_span *span); static int t4_startup(struct file *file, struct dahdi_span *span); static int t4_shutdown(struct dahdi_span *span); static int t4_rbsbits(struct dahdi_chan *chan, int bits); @@ -1693,7 +1694,7 @@ static void t4_chan_set_sigcap(struct dahdi_span *span, int x) } static int -t4_spanconfig(struct file *file, struct dahdi_span *span, +_t4_spanconfig(struct file *file, struct dahdi_span *span, struct dahdi_lineconfig *lc) { int i; @@ -1733,13 +1734,36 @@ t4_spanconfig(struct file *file, struct dahdi_span *span, /* If we're already running, then go ahead and apply the changes */ if (span->flags & DAHDI_FLAG_RUNNING) - return t4_startup(file, span); + return _t4_startup(file, span); if (debug) dev_info(&wc->dev->dev, "Done with spanconfig!\n"); return 0; } +static int +t4_spanconfig(struct file *file, struct dahdi_span *span, + struct dahdi_lineconfig *lc) +{ + int ret; + struct dahdi_device *const ddev = span->parent; + struct dahdi_span *s; + + ret = _t4_spanconfig(file, span, lc); + + /* Make sure all the spans have a basic configuration in case they are + * not all specified in the configuration files. */ + lc->sync = 0; + list_for_each_entry(s, &ddev->spans, device_node) { + WARN_ON(!s->channels); + if (!s->channels) + continue; + if (!s->chans[0]->sigcap) + _t4_spanconfig(file, s, lc); + } + return ret; +} + static int t4_chanconfig(struct file *file, struct dahdi_chan *chan, int sigtype) { @@ -2833,7 +2857,7 @@ static int t4_check_for_interrupts(struct t4 *wc) return 0; } -static int t4_startup(struct file *file, struct dahdi_span *span) +static int _t4_startup(struct file *file, struct dahdi_span *span) { #ifdef SUPPORT_GEN1 int i; @@ -2966,6 +2990,21 @@ static int t4_startup(struct file *file, struct dahdi_span *span) return 0; } +static int t4_startup(struct file *file, struct dahdi_span *span) +{ + int ret; + struct dahdi_device *const ddev = span->parent; + struct dahdi_span *s; + + ret = _t4_startup(file, span); + list_for_each_entry(s, &ddev->spans, device_node) { + if (!test_bit(DAHDI_FLAGBIT_RUNNING, &s->flags)) { + _t4_startup(file, s); + } + } + return ret; +} + #ifdef SUPPORT_GEN1 static inline void e1_check(struct t4 *wc, int span, int val) { -- cgit v1.2.3