[dahdi-commits] sruffell: branch linux/sruffell/dahdi-linux-wctc4xxp r8688 - in /linux/team/s...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Mon May 24 15:01:11 CDT 2010


Author: sruffell
Date: Mon May 24 15:01:09 2010
New Revision: 8688

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8688
Log:
delete:  Merge in changes on trunk between 8539..8680

typos, mostly unkown


missing #include: fixes building with 2.6.34-rc5

With kernel 2.6.34-rc5 an explicit '#include <slab.h>' is required for using
kzalloc() and friends.


Configurable debounce to support old rotary phones

(closes issue #16339)
Reported by: alecdavis
Patches:
      20091129__issue16339.diff.txt uploaded by tilghman (license 14)


wcte12xp, wctdm24xxp: Ensure writes to I/O registers are flushed.

In revision 8176 I changed register access from I/O space to memory mapped
registers.  Unfortunately, when I made that change, I didn't account for
posted writes.  This change makes sure all the registers are read back to
ensure that they are posted through any intermediate bridges.

The most readily observable symptom were cards that were taking 2000
interrupts/second. The card reported that it handled an interrupt but the
write to silence the card wasn't flushed through until the second time the
interrupt handler run. DAHDI-602.


dahdi-base: wcte12xp: Fixed Clear/RBS channel mode issue

Fixes DAHDI-449 where chanconfig was failing on the first call. It needed
to be called twice in a row. This was due to the channel configuration using
a non-relative channel number in its loop.

Also re-added the register dumping ioctl for inspecting the framer's state.


dahdi-base: Reverted a change from last patch

Removed a change to dahdi-base from last patch which might have caused
compatibility with drivers other than the wcte12xp.

wcte12xp: The channel clear/rbs function no longer reads the register first.
It now uses the span's channel flags to determine each channels clear state.
Also added various minor readability improvements.


wcte12xp: Add the voicebus_current_latency sysfs node.

'voicebus_current_latency' is only exported when CONFIG_VOICEBUS_SYSFS is
defined in voicebus.h.  This is a debugging aide which enables determing the
board specific latency without parsing through the kernel logs.


wcte12xp, wctdm24xxp: Add vpm_firmware_version sysfs attribute.

Currently only exported if CONFIG_VOICEBUS_SYSFS is defined in
drivers/dahdi/voicebus.h. Reading from the 'vpm_firmware_version' attribute
will poll the firmware on the VPMADT032 for it's current version.


wcte12xp, wctdm24xxp: Do not allow interruptible sleep on VPM lock.

If the sleep is ever interrupted, 'up' will still be called in the GpakApi,
essentially making the lock useless after that point.


wcte12xp, wctdm24xxp: Retry if the VPMADT032 reports not ready.

CheckDspReset can return -1 if the DSP is not ready to process any new
commands. In this case we should retry a few times to give the DSP a chance
to become ready.  While I'm not ready to say this definitely fixes recently
reported cases when the wcte12xp driver constantly resets, it eliminated
communication failures to the DSP module when under stress (via the
vpm_firmware_version sysfs attribute).  However, I haven't let it run long
enough to say that the issue is resolved.  DAHDI-603.


fix kernel-cp download test

'wc -c <f$ile' returns the name of the file as well.


wcte12xp: Fixes RBS/Clear mode not set correctly bug

(part 3) Fixes DAHDI-449 where dahdi_cfg would need to be run multiple times
in order to properly set the rbs or clear mode of a channel. The prior
logic was calling set_clear in the context of setting all channels to
clear mode, even if the channel was intended to be in bit robbed mode.


wcte12xp: Removed unnecessary instrumentation

Over-verbose instrumentation snuck in, on commit r8594


dahdi: Check if wait_for_completion_timeout is backported.

CentOS4 has this backported in their 2.6.9 kernel.


wctdm24xxp: dev_notice -> dev_info

Modules that aren't installed should show at the same level as
modules that are installed.  It could be confusing if the console
log level is set to 3 and only messages about which ports do not
have any modules installed show up on the console.


Merge in pulse mask improvement patch for B410P.


A typo (lintian)


missing #include: fixes building with 2.6.34-rc5

Fix the same issue as in r8550 , for dahdi_echocan_oslec.c:

With kernel 2.6.34-rc5 an explicit '#include <slab.h>' is required for using
kzalloc() and friends.


hpec: #include <linux/slab.h>

Fix the same issue as in r8550 , for dahdi_echocan_hpec.c:

With kernel 2.6.34 an explicit '#include <slab.h>' is required for
using kzalloc() and friends.

Modified:
    linux/team/sruffell/dahdi-linux-wctc4xxp/build_tools/kernel-cp
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/Kbuild
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi-base.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_echocan_jpah.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_echocan_oslec.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_transcode.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/hpec/dahdi_echocan_hpec.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakApi.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakCust.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakCust.h
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/voicebus.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcb4xxp/base.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wctdm.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wctdm24xxp/base.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcte12xp/base.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcte12xp/wcte12xp.h
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_bri.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_global.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_pri.c
    linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/xpp_debug
    linux/team/sruffell/dahdi-linux-wctc4xxp/include/dahdi/kernel.h

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/build_tools/kernel-cp
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/build_tools/kernel-cp?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/build_tools/kernel-cp (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/build_tools/kernel-cp Mon May 24 15:01:09 2010
@@ -26,7 +26,7 @@
 	fi
 	
 	wget -O "$check_patch" "$URL"
-	if [ `wc -c "$check_patch"` -lt 1000 ]; then
+	if [ `wc -c <"$check_patch"` -lt 1000 ]; then
 		# already downloaded
 		# FIXME: redirection fails on downloading and you get a
 		# short HTML file as your "script".

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/Kbuild
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/Kbuild?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/Kbuild (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/Kbuild Mon May 24 15:01:09 2010
@@ -62,6 +62,10 @@
 # as part of an ALSA backport. TODO: Any better way to detect that?
 ifeq (1,$(shell fgrep -q ' hrtimer_set_expires' include/linux/hrtimer.h 2>/dev/null && echo 1))
 EXTRA_CFLAGS+=-DHAVE_HRTIMER_ACCESSORS=1
+endif
+
+ifeq (1,$(shell fgrep -q 'wait_for_completion_timeout' include/linux/completion.h 2>/dev/null && echo 1))
+CFLAGS_MODULE+=-DHAVE_WAIT_FOR_COMPLETION_TIMEOUT=1
 endif
 
 # In 2.6.18 skb_linearize changed; however, some distros backported the change

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi-base.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi-base.c Mon May 24 15:01:09 2010
@@ -4119,7 +4119,7 @@
 				 * Set the rxhooksig back to
 				 * DAHDI_RXSIG_INITIAL so that new events are
 				 * queued on the channel with the actual
-				 * recieved hook state.
+				 * received hook state.
 				 * 
 				 */
 				spans[j]->chans[x]->rxhooksig = DAHDI_RXSIG_INITIAL;
@@ -6944,7 +6944,7 @@
  * @chan:	the DAHDI channel
  * @cursig:	the bits to set
  *
- * Set the channel's rxsig (recieved: from device to userspace) and act
+ * Set the channel's rxsig (received: from device to userspace) and act
  * accordingly.
  */
 void dahdi_rbsbits(struct dahdi_chan *chan, int cursig)
@@ -7125,7 +7125,7 @@
  * @rxchunk:	chunk of audio on which to cancel echo
  * @txchunk:	reference chunk from the other direction
  *
- * The echo canceller function fixes recieved (from device to userspace)
+ * The echo canceller function fixes received (from device to userspace)
  * audio. In order to fix it it uses the transmitted audio as a
  * reference. This call updates the echo canceller for a single chunk (8
  * bytes).

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_echocan_jpah.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_echocan_jpah.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_echocan_jpah.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_echocan_jpah.c Mon May 24 15:01:09 2010
@@ -27,6 +27,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/init.h>

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_echocan_oslec.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_echocan_oslec.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_echocan_oslec.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_echocan_oslec.c Mon May 24 15:01:09 2010
@@ -23,6 +23,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/init.h>

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_transcode.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_transcode.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_transcode.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/dahdi_transcode.c Mon May 24 15:01:09 2010
@@ -126,7 +126,7 @@
 	if (!is_on_list(&tc->registration_list_node, &registration_list)) {
 		spin_unlock(&translock);
 		printk(KERN_WARNING "%s: Failed to unregister %s, which is " \
-		       "not currently registerd.\n", THIS_MODULE->name, tc->name);
+		       "not currently registered.\n", THIS_MODULE->name, tc->name);
 		return -EINVAL;
 	}
 	list_del_init(&tc->registration_list_node);

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/hpec/dahdi_echocan_hpec.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/hpec/dahdi_echocan_hpec.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/hpec/dahdi_echocan_hpec.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/hpec/dahdi_echocan_hpec.c Mon May 24 15:01:09 2010
@@ -20,6 +20,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/init.h>

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakApi.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakApi.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakApi.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakApi.c Mon May 24 15:01:09 2010
@@ -102,7 +102,6 @@
 static unsigned char DlByteBufr[DOWNLOAD_BLOCK_SIZE * 2]; /* Dowload byte buf */
 static DSP_WORD DlWordBufr[DOWNLOAD_BLOCK_SIZE];      /* Dowload word buffer */
 
-
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  * CheckDspReset - Check if the DSP was reset.
  *
@@ -116,7 +115,7 @@
  *   1 = Reset occurred.
  *
  */
-static int CheckDspReset(
+static int __CheckDspReset(
     int DspId               /* DSP Identifier (0 to MaxDSPCores-1) */
     )
 {
@@ -179,6 +178,20 @@
     return (0);
 }
 
+static int CheckDspReset(
+    int DspId               /* DSP Identifier (0 to MaxDSPCores-1) */
+    )
+{
+	int ret;
+	int retries = 20;
+	while (--retries) {
+		ret = __CheckDspReset(DspId);
+		if (-1 != ret)
+			return ret;
+		msleep(5);
+	}
+	return ret;
+}
 
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  * WriteDspCmdMessage - Write a Host Command/Request message to DSP.

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakCust.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakCust.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakCust.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakCust.c Mon May 24 15:01:09 2010
@@ -32,7 +32,6 @@
 
 #include <linux/version.h>
 #include <linux/types.h>
-#include <linux/delay.h>
 #include <linux/pci.h>
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
 #include <linux/semaphore.h>
@@ -900,11 +899,11 @@
 
 	vpm = find_iface(DspId);
 
-	if (vpm) {
-		if (down_interruptible(&vpm->sem)) {
-			return;
-		}
-	}
+	if (!vpm)
+		return;
+
+	down(&vpm->sem);
+	return;
 }
 
 

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakCust.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakCust.h?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakCust.h (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/GpakCust.h Mon May 24 15:01:09 2010
@@ -39,6 +39,7 @@
 #include <linux/device.h>
 #include <linux/completion.h>
 #include <linux/workqueue.h>
+#include <linux/delay.h>
 
 #include "gpakenum.h"
 #include "adt_lec.h"

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/voicebus.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/voicebus.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/voicebus.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/voicebus/voicebus.c Mon May 24 15:01:09 2010
@@ -433,6 +433,7 @@
 {
 	wmb();
 	writel(val, vb->iobase + addr);
+	readl(vb->iobase + addr);
 }
 
 /*!

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcb4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcb4xxp/base.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcb4xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcb4xxp/base.c Mon May 24 15:01:09 2010
@@ -1874,6 +1874,9 @@
 	b4xxp_setreg8(b4, R_PCM_MD0, V_PCM_MD | V_PCM_IDX_MD1);
 	flush_pci();
 	b4xxp_setreg8(b4, R_PCM_MD1, V_PLL_ADJ_00 | V_PCM_DR_2048);
+
+	b4xxp_setreg8(b4, R_PWM_MD, 0xa0);
+	b4xxp_setreg8(b4, R_PWM0, 0x1b);
 
 /*
  * set up the flow controller.

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wctdm.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wctdm.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wctdm.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wctdm.c Mon May 24 15:01:09 2010
@@ -295,6 +295,8 @@
 static unsigned int battalarm;
 static unsigned int battthresh;
 static int ringdebounce = DEFAULT_RING_DEBOUNCE;
+/* times 4, because must be a multiple of 4ms: */
+static int dialdebounce = 8 * 8;
 static int fwringdetect = 0;
 static int debug = 0;
 static int robust = 0;
@@ -1015,7 +1017,7 @@
 	hook = (res & 1);
 	if (hook != fxs->lastrxhook) {
 		/* Reset the debounce (must be multiple of 4ms) */
-		fxs->debounce = 8 * (4 * 8);
+		fxs->debounce = dialdebounce * 4;
 #if 0
 		printk(KERN_DEBUG "Resetting debounce card %d hook %d, %d\n",
 		       card, hook, fxs->debounce);
@@ -2812,6 +2814,7 @@
 module_param(battalarm, uint, 0600);
 module_param(battthresh, uint, 0600);
 module_param(ringdebounce, int, 0600);
+module_param(dialdebounce, int, 0600);
 module_param(fwringdetect, int, 0600);
 module_param(alawoverride, int, 0600);
 module_param(fastpickup, int, 0600);

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wctdm24xxp/base.c Mon May 24 15:01:09 2010
@@ -4113,7 +4113,9 @@
 					goto retry;
 
 				} else {
-					dev_notice(&wc->vb.pdev->dev, "Port %d: Not installed\n", x + 1);
+					dev_info(&wc->vb.pdev->dev,
+						 "Port %d: Not installed\n",
+						 x + 1);
 					wc->modtype[x] = MOD_TYPE_NONE;
 				}
 			}
@@ -4594,8 +4596,62 @@
 
 static DEVICE_ATTR(voicebus_current_latency, 0400,
 		   voicebus_current_latency_show, NULL);
-#endif
-
+
+static ssize_t vpm_firmware_version_show(struct device *dev,
+				struct device_attribute *attr,
+				char *buf)
+{
+	int res;
+	u16 version = 0;
+	struct wctdm *wc = dev_get_drvdata(dev);
+
+	if (wc->vpmadt032) {
+		res = gpakPingDsp(wc->vpmadt032->dspid, &version);
+		if (res) {
+			dev_info(&wc->vb.pdev->dev, "Failed gpakPingDsp %d\n", res);
+			version = -1;
+		}
+	}
+
+	return sprintf(buf, "%x.%02x\n", (version & 0xff00) >> 8, (version & 0xff));
+}
+
+static DEVICE_ATTR(vpm_firmware_version, 0400,
+		   vpm_firmware_version_show, NULL);
+
+static void create_sysfs_files(struct wctdm *wc)
+{
+	int ret;
+	ret = device_create_file(&wc->vb.pdev->dev,
+				 &dev_attr_voicebus_current_latency);
+	if (ret) {
+		dev_info(&wc->vb.pdev->dev,
+			"Failed to create device attributes.\n");
+	}
+
+	ret = device_create_file(&wc->vb.pdev->dev,
+				 &dev_attr_vpm_firmware_version);
+	if (ret) {
+		dev_info(&wc->vb.pdev->dev,
+			"Failed to create device attributes.\n");
+	}
+}
+
+static void remove_sysfs_files(struct wctdm *wc)
+{
+	device_remove_file(&wc->vb.pdev->dev,
+			   &dev_attr_vpm_firmware_version);
+
+	device_remove_file(&wc->vb.pdev->dev,
+			   &dev_attr_voicebus_current_latency);
+}
+
+#else
+
+static inline void create_sysfs_files(struct wctdm *wc) { return; }
+static inline void remove_sysfs_files(struct wctdm *wc) { return; }
+
+#endif /* CONFIG_VOICEBUS_SYSFS */
 
 #ifdef USE_ASYNC_INIT
 struct async_data {
@@ -4661,14 +4717,9 @@
 		return ret;
 	}
 
-#ifdef CONFIG_VOICEBUS_SYSFS
-	ret = device_create_file(&wc->vb.pdev->dev,
-				 &dev_attr_voicebus_current_latency);
-	if (ret) {
-		dev_info(&wc->vb.pdev->dev,
-			"Failed to create device attributes.\n");
-	}
-#endif
+
+	create_sysfs_files(wc);
+
 	voicebus_lock_latency(&wc->vb);
 
 	init_waitqueue_head(&wc->regq);
@@ -4890,12 +4941,11 @@
 	struct vpmadt032 *vpm = wc->vpmadt032;
 	int i;
 
-#ifdef CONFIG_VOICEBUS_SYSFS
-	device_remove_file(&wc->vb.pdev->dev,
-			   &dev_attr_voicebus_current_latency);
-#endif
 
 	if (wc) {
+
+		remove_sysfs_files(wc);
+
 		if (vpm) {
 			clear_bit(VPM150M_DTMFDETECT, &vpm->control);
 			clear_bit(VPM150M_ACTIVE, &vpm->control);

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcte12xp/base.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcte12xp/base.c Mon May 24 15:01:09 2010
@@ -656,27 +656,34 @@
 	return ret;
 }
 
-static void __t1xxp_set_clear(struct t1 *wc, int channo)
-{
-	int i,j;
+static void __t1xxp_set_clear(struct t1 *wc)
+{
+	int i,offset;
 	int ret;
-	unsigned short val=0;
-	
+	unsigned short reg[3] = {0, 0, 0};
+
+	/* Calculate all states on all 24 channels using the channel
+	   flags, then write all 3 clear channel registers at once */
+
 	for (i = 0; i < 24; i++) {
-		j = (i / 8);
-		if (wc->span.chans[i]->flags & DAHDI_FLAG_CLEAR) 
-			val |= 1 << (7 - (i % 8));
-		if (((i % 8)==7) &&  /* write byte every 8 channels */
-		    ((channo < 0) ||    /* channo=-1 means all channels */ 
-		     (j == (channo-1)/8) )) { /* only the register for this channo */    
-			ret = t1_setreg(wc, 0x2f + j, val);
-			if (ret < 0) {
-				t1_info(wc, "set_clear failed for chan %d!\n",
-					i);
-			}
-			val = 0;
-		}
-	}
+		offset = i/8;
+		if (wc->span.chans[i]->flags & DAHDI_FLAG_CLEAR)
+			reg[offset] |= 1 << (7 - (i % 8));
+		else
+			reg[offset] &= ~(1 << (7 - (i % 8)));
+	}
+
+	ret = t1_setreg(wc, CCB1, reg[0]);
+	if (ret < 0)
+		t1_info(wc, "Unable to set clear/rbs mode!\n");
+
+	ret = t1_setreg(wc, CCB2, reg[1]);
+	if (ret < 0)
+		t1_info(wc, "Unable to set clear/rbs mode!\n");
+
+	ret = t1_setreg(wc, CCB3, reg[2]);
+	if (ret < 0)
+		t1_info(wc, "Unable to set clear/rbs mode!\n");
 }
 
 static void free_wc(struct t1 *wc)
@@ -925,7 +932,7 @@
 		t1_configure_e1(wc, span->lineconfig);
 	} else { /* is a T1 card */
 		t1_configure_t1(wc, span->lineconfig, span->txlevel);
-		__t1xxp_set_clear(wc, -1);
+		__t1xxp_set_clear(wc);
 	}
 
 	set_bit(DAHDI_FLAGBIT_RUNNING, &wc->span.flags);
@@ -978,7 +985,7 @@
 	struct t1 *wc = chan->pvt;
 	if (test_bit(DAHDI_FLAGBIT_RUNNING, &chan->span->flags) &&
 		(wc->spantype != TYPE_E1)) {
-		__t1xxp_set_clear(wc, chan->channo);
+		__t1xxp_set_clear(wc);
 	}
 	return 0;
 }
@@ -1300,14 +1307,18 @@
 
 static int t1xxp_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data)
 {
+	struct t4_regs regs;
+	unsigned int x;
+	struct t1 *wc;
+	
 	switch (cmd) {
 	case WCT4_GET_REGS:
-		/* Since all register access was moved into the voicebus
-		 * module....this was removed.  Although...why does the client
-		 * library need access to the registers (debugging)? \todo ..
-		 */
-		WARN_ON(1);
-		return -ENOSYS;
+		wc = chan->pvt;
+		for (x = 0; x < sizeof(regs.regs) / sizeof(regs.regs[0]); x++)
+			regs.regs[x] = t1_getreg(wc, x);
+		
+		if (copy_to_user((struct t4_regs *) data, &regs, sizeof(regs)))
+			return -EFAULT;
 		break;
 	default:
 		return -ENOTTY;
@@ -2076,6 +2087,81 @@
 	.handle_error = t1_handle_error,
 };
 
+#ifdef CONFIG_VOICEBUS_SYSFS
+static ssize_t voicebus_current_latency_show(struct device *dev,
+					     struct device_attribute *attr,
+					     char *buf)
+{
+	unsigned long flags;
+	struct t1 *wc = dev_get_drvdata(dev);
+	unsigned int current_latency;
+	spin_lock_irqsave(&wc->vb.lock, flags);
+	current_latency = wc->vb.min_tx_buffer_count;
+	spin_unlock_irqrestore(&wc->vb.lock, flags);
+	return sprintf(buf, "%d\n", current_latency);
+}
+
+static DEVICE_ATTR(voicebus_current_latency, 0400,
+		   voicebus_current_latency_show, NULL);
+
+
+static ssize_t vpm_firmware_version_show(struct device *dev,
+				struct device_attribute *attr,
+				char *buf)
+{
+	int res;
+	u16 version = 0;
+	struct t1 *wc = dev_get_drvdata(dev);
+
+	if (wc->vpmadt032) {
+		res = gpakPingDsp(wc->vpmadt032->dspid, &version);
+		if (res) {
+			t1_info(wc, "Failed gpakPingDsp %d\n", res);
+			version = -1;
+		}
+	}
+
+	return sprintf(buf, "%x.%02x\n", (version & 0xff00) >> 8, (version & 0xff));
+}
+
+static DEVICE_ATTR(vpm_firmware_version, 0400,
+		   vpm_firmware_version_show, NULL);
+
+static void create_sysfs_files(struct t1 *wc)
+{
+	int ret;
+	ret = device_create_file(&wc->vb.pdev->dev,
+				 &dev_attr_voicebus_current_latency);
+	if (ret) {
+		dev_info(&wc->vb.pdev->dev,
+			"Failed to create device attributes.\n");
+	}
+
+	ret = device_create_file(&wc->vb.pdev->dev,
+				 &dev_attr_vpm_firmware_version);
+	if (ret) {
+		dev_info(&wc->vb.pdev->dev,
+			"Failed to create device attributes.\n");
+	}
+}
+
+static void remove_sysfs_files(struct t1 *wc)
+{
+	device_remove_file(&wc->vb.pdev->dev,
+			   &dev_attr_vpm_firmware_version);
+
+	device_remove_file(&wc->vb.pdev->dev,
+			   &dev_attr_voicebus_current_latency);
+}
+
+#else
+
+static inline void create_sysfs_files(struct t1 *wc) { return; }
+static inline void remove_sysfs_files(struct t1 *wc) { return; }
+
+#endif /* CONFIG_VOICEBUS_SYSFS */
+
+
 static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	struct t1 *wc;
@@ -2154,6 +2240,8 @@
 	voicebus_set_maxlatency(&wc->vb, max_latency);
 	max_latency = wc->vb.max_latency;
 
+	create_sysfs_files(wc);
+
 	voicebus_lock_latency(&wc->vb);
 	if (voicebus_start(&wc->vb)) {
 		voicebus_release(&wc->vb);
@@ -2192,6 +2280,8 @@
 #endif
 	if (!wc)
 		return;
+
+	remove_sysfs_files(wc);
 
 	clear_bit(INITIALIZED, &wc->bit_flags);
 

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcte12xp/wcte12xp.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcte12xp/wcte12xp.h?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcte12xp/wcte12xp.h (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/wcte12xp/wcte12xp.h Mon May 24 15:01:09 2010
@@ -150,4 +150,9 @@
 #define LIM1_RL 	(1<<1)
 #define LIM1_JATT	(1<<2)
 
+/* Clear Channel Registers */
+#define CCB1		0x2f
+#define CCB2		0x30
+#define CCB3		0x31
+
 #endif

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_bri.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_bri.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_bri.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_bri.c Mon May 24 15:01:09 2010
@@ -1719,7 +1719,7 @@
 					priv->state_register.bits.v_su_info0,
 					priv->state_register.bits.v_g2_g3);
 	} else
-		len += sprintf(page + len, "Unkown\n");
+		len += sprintf(page + len, "Unknown\n");
 	if(IS_NT(xpd)) {
 		len += sprintf(page + len, "T1 Timer: %d\n", priv->t1);
 	} else {

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_global.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_global.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_global.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_global.c Mon May 24 15:01:09 2010
@@ -158,7 +158,7 @@
 			//XPD_DBG(REGS, xpd, "READING\n");
 			break;
 		default:
-			XPD_ERR(xpd, "Unkown operation type '%c'\n", op);
+			XPD_ERR(xpd, "Unknown operation type '%c'\n", op);
 			goto out;
 	}
 	addr_mode = argv[argno][1];
@@ -187,7 +187,7 @@
 			//XPD_DBG(REGS, xpd, "Multibyte (%c)\n", addr_mode);
 			break;
 		default:
-			XPD_ERR(xpd, "Unkown addressing type '%c'\n", addr_mode);
+			XPD_ERR(xpd, "Unknown addressing type '%c'\n", addr_mode);
 			goto out;
 	}
 	if(argv[argno][2] != '\0') {

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_pri.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_pri.c?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_pri.c (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/card_pri.c Mon May 24 15:01:09 2010
@@ -101,7 +101,7 @@
 static const char *pri_protocol_name(enum pri_protocol pri_protocol)
 {
 	static const char *protocol_names[] = {
-		[PRI_PROTO_0] = "??",	/* unkown */
+		[PRI_PROTO_0] = "??",	/* unknown */
 		[PRI_PROTO_E1] = "E1",
 		[PRI_PROTO_T1] = "T1",
 		[PRI_PROTO_J1] = "J1"
@@ -1766,7 +1766,7 @@
 	spin_unlock_irqrestore(&xpd->lock, flags);
 }
 
-/*! Copy PCM chunks from the packet we recieved to the xpd struct.
+/*! Copy PCM chunks from the packet we received to the xpd struct.
  * \param xbus	xbus of target xpd.
  * \param xpd	target xpd.
  * \param pack	Source packet.

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/xpp_debug
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/xpp_debug?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/xpp_debug (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/drivers/dahdi/xpp/xpp_debug Mon May 24 15:01:09 2010
@@ -82,7 +82,7 @@
 			let j++
 		done
 		if [ "$found" -eq 0 ]; then
-			echo >&2 "$0: Unkown debug flag '$wanted'"
+			echo >&2 "$0: Unknown debug flag '$wanted'"
 			exit 1
 		fi
 	done
@@ -98,7 +98,7 @@
 shift
 
 if ! echo "$modules" | grep -w "$module" > /dev/null; then
-	echo >&2 "$0: Unkown module $module"
+	echo >&2 "$0: Unknown module $module"
 	exit 1
 fi
 

Modified: linux/team/sruffell/dahdi-linux-wctc4xxp/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wctc4xxp/include/dahdi/kernel.h?view=diff&rev=8688&r1=8687&r2=8688
==============================================================================
--- linux/team/sruffell/dahdi-linux-wctc4xxp/include/dahdi/kernel.h (original)
+++ linux/team/sruffell/dahdi-linux-wctc4xxp/include/dahdi/kernel.h Mon May 24 15:01:09 2010
@@ -1209,6 +1209,7 @@
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
 #define synchronize_rcu() synchronize_kernel()
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11)
+#if !defined(HAVE_WAIT_FOR_COMPLETION_TIMEOUT)
 static inline unsigned long
 wait_for_completion_timeout(struct completion *x, unsigned long timeout)
 {
@@ -1221,6 +1222,7 @@
 
 	return timeout;
 }
+#endif
 #endif /* 2.6.11 */
 #endif /* 2.6.12 */
 #endif /* 2.6.14 */




More information about the dahdi-commits mailing list