[svn-commits] sruffell: branch linux/sruffell/dahdi-linux-debugfs r7547 - in /linux/team/sr...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Nov 10 09:30:13 CST 2009


Author: sruffell
Date: Tue Nov 10 09:30:05 2009
New Revision: 7547

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7547
Log:
wip: create dahdi/boards/wctexxp?/vpm_current_state in debugfs

Modified:
    linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/dahdi-base.c
    linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/voicebus/GpakCust.c
    linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/voicebus/GpakCust.h
    linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wctdm24xxp/base.c
    linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wcte12xp/base.c
    linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wcte12xp/wcte12xp.h
    linux/team/sruffell/dahdi-linux-debugfs/include/dahdi/kernel.h

Modified: linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/dahdi-base.c?view=diff&rev=7547&r1=7546&r2=7547
==============================================================================
--- linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/dahdi-base.c Tue Nov 10 09:30:05 2009
@@ -8411,9 +8411,33 @@
 	return 0;
 }
 
+#if defined(CONFIG_DEBUG_FS)
+#include <linux/debugfs.h>
+struct dentry *dahdi_debugfs_root;
+struct dentry *dahdi_debugfs_boards;
+EXPORT_SYMBOL(dahdi_debugfs_root);
+EXPORT_SYMBOL(dahdi_debugfs_boards);
+#endif
+
 static int __init dahdi_init(void)
 {
 	int res = 0;
+
+#if defined(CONFIG_DEBUG_FS)
+	dahdi_debugfs_root = debugfs_create_dir(THIS_MODULE->name, NULL);
+	if (IS_ERR(dahdi_debugfs_root) || (NULL == dahdi_debugfs_root)) {
+		pr_info("Failed to create debugfs root entry.\n");
+		dahdi_debugfs_root = NULL;
+	} else {
+		dahdi_debugfs_boards = debugfs_create_dir("boards", dahdi_debugfs_root);
+		if (IS_ERR(dahdi_debugfs_boards) ||
+		    (NULL == dahdi_debugfs_boards)) {
+			pr_info("Failed to create debugfs boards entry.\n");
+			dahdi_debugfs_boards = NULL;
+		}
+			
+	}
+#endif
 
 #ifdef CONFIG_PROC_FS
 	proc_entries[0] = proc_mkdir("dahdi", NULL);
@@ -8469,6 +8493,10 @@
 #ifdef CONFIG_DAHDI_WATCHDOG
 	watchdog_cleanup();
 #endif
+
+#if defined(CONFIG_DEBUG_FS)
+	debugfs_remove_recursive(dahdi_debugfs_root);
+#endif
 }
 
 module_init(dahdi_init);

Modified: linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/voicebus/GpakCust.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/voicebus/GpakCust.c?view=diff&rev=7547&r1=7546&r2=7547
==============================================================================
--- linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/voicebus/GpakCust.c (original)
+++ linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/voicebus/GpakCust.c Tue Nov 10 09:30:05 2009
@@ -29,6 +29,8 @@
  * Free Software Foundation. See the LICENSE file included with
  * this program for more details.
  */
+
+#define HERE() do {printk(KERN_DEBUG "HERE: %s:%d\n", __FILE__, __LINE__); } while(0)
 
 #include <linux/version.h>
 #include <linux/types.h>
@@ -43,6 +45,11 @@
 #include <dahdi/kernel.h>
 #include <dahdi/user.h>
 
+#if defined(CONFIG_DAHDI_DEBUGFS)
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+#endif
+
 #include "GpakCust.h"
 #include "GpakApi.h"
 
@@ -52,6 +59,46 @@
 
 static rwlock_t ifacelock;
 static struct vpmadt032 *ifaces[MAX_DSP_CORES];
+
+#if defined(CONFIG_DAHDI_DEBUGFS)
+static int vpm_status_show(struct seq_file *file, void *data)
+{
+	int i;
+	struct vpmadt032 *vpm = file->private;
+	const struct adt_lec_params *cur;
+	const struct adt_lec_params *desired;
+
+	WARN_ON(!vpm);
+	seq_printf(file, "current: ");
+	for (i = 0; i < MAX_CHANNELS_PER_SPAN; ++i) {
+		cur = &vpm->curecstate[i];
+		seq_printf(file, "%01x", cur->tap_length);
+	}
+	seq_printf(file, "\n");
+	seq_printf(file, "desired: ");
+	for (i = 0; i < MAX_CHANNELS_PER_SPAN; ++i) {
+		desired = &vpm->desiredecstate[i];
+		seq_printf(file, "%01x", desired->tap_length);
+	}
+	seq_printf(file, "\n");
+	return 0;
+}
+
+static int vpm_status_open(struct inode *inode, struct file *file)
+{
+	struct vpmadt032 *vpm = (struct vpmadt032 *)(inode->i_private);
+	WARN_ON(!vpm);
+	return single_open(file, vpm_status_show, vpm);
+}
+
+static const struct file_operations vpm_state_operations = {
+	.owner = THIS_MODULE,
+	.open = vpm_status_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
+};
+#endif
 
 static inline struct vpmadt032 *find_iface(const unsigned short dspid)
 {
@@ -135,8 +182,7 @@
 	wait_for_completion(&cmd->complete);
 	if (cmd->desc & __VPM150M_FIN) {
 		*outbuf = cmd->data;
-		cmd->desc = 0;
-		ret = 0;
+		cmd->desc = 0; ret = 0;
 	}
 
 	/* Just throw this command back on the ready list. */
@@ -335,15 +381,13 @@
 	update = memcmp(&vpm->curecstate[channo],
 			&vpm->desiredecstate[channo],
 			sizeof(vpm->curecstate[channo]));
-	if (update && test_bit(VPM150M_ACTIVE, &vpm->control)) {
-		/* Since updating the parameters can take a bit of time while
-		 * the driver sends messages to the VPMADT032 and waits for
-		 * their responses, we'll push the work of updating the
-		 * parameters to a work queue so the caller can continue to
-		 * proceed with setting up the call.
-		 */
+
+	/* Since updating the parameters can take a bit of time while the driver
+	 * sends messages to the VPMADT032 and waits for their responses, we'll
+	 * push the work of updating the parameters to a work queue so the
+	 * caller can continue to proceed with setting up the call. */
+	if (update && test_bit(VPM150M_ACTIVE, &vpm->control))
 		queue_work(vpm->wq, &vpm->work);
-	}
 }
 int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo,
 	struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
@@ -383,7 +427,7 @@
 EXPORT_SYMBOL(vpmadt032_echocan_free);
 
 struct vpmadt032 *
-vpmadt032_alloc(struct vpmadt032_options *options, const char *board_name)
+vpmadt032_alloc(struct vpmadt032_options *options, const char *board_name, struct dentry *parent)
 {
 	struct vpmadt032 *vpm;
 	int i;
@@ -398,6 +442,11 @@
 	vpm = kzalloc(sizeof(*vpm) + length, GFP_KERNEL);
 	if (!vpm)
 		return NULL;
+
+#if defined(CONFIG_DAHDI_DEBUGFS)
+	if (parent)
+		vpm->debugfs_dir = parent;
+#endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
 	/* There is a limit on the length of the name of the workqueue. */
@@ -447,6 +496,10 @@
 		printk(KERN_DEBUG "Setting VPMADT032 DSP ID to %d\n", vpm->dspid);
 	}
 
+#if defined(CONFIG_DAHDI_DEBUGFS)
+	if (vpm->debugfs_dir)
+		debugfs_create_file("vpm_current_state", 0444, vpm->debugfs_dir, vpm, &vpm_state_operations);
+#endif
 	return vpm;
 }
 EXPORT_SYMBOL(vpmadt032_alloc);
@@ -604,6 +657,7 @@
 	write_lock(&ifacelock);
 	ifaces[vpm->dspid] = NULL;
 	write_unlock(&ifacelock);
+
 	kfree(vpm);
 }
 EXPORT_SYMBOL(vpmadt032_free);

Modified: linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/voicebus/GpakCust.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/voicebus/GpakCust.h?view=diff&rev=7547&r1=7546&r2=7547
==============================================================================
--- linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/voicebus/GpakCust.h (original)
+++ linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/voicebus/GpakCust.h Tue Nov 10 09:30:05 2009
@@ -127,6 +127,9 @@
 	unsigned char curtone[MAX_CHANNELS_PER_SPAN];
 	struct vpmadt032_options options;
 	void (*setchanconfig_from_state)(struct vpmadt032 *vpm, int channel, struct GpakChannelConfig *chanconfig);
+#if defined(CONFIG_DAHDI_DEBUGFS)
+	struct dentry *debugfs_dir;
+#endif
 	/* This must be last */
 	char wq_name[0];
 };
@@ -136,11 +139,13 @@
 struct dahdi_echocanparams;
 struct dahdi_echocanparam;
 struct dahdi_echocan_state;
+struct dentry;
 
 char vpmadt032tone_to_zaptone(GpakToneCodes_t tone);
 int vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb);
 struct vpmadt032 *vpmadt032_alloc(struct vpmadt032_options *options,
-					const char *board_name);
+					const char *board_name,
+					struct dentry *parent);
 void vpmadt032_free(struct vpmadt032 *vpm);
 int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo,
 	struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p);

Modified: linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=7547&r1=7546&r2=7547
==============================================================================
--- linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wctdm24xxp/base.c Tue Nov 10 09:30:05 2009
@@ -3653,7 +3653,7 @@
 		options.vpmnlpthresh = vpmnlpthresh;
 		options.vpmnlpmaxsupp = vpmnlpmaxsupp;
 
-		wc->vpmadt032 = vpmadt032_alloc(&options, wc->board_name);
+		wc->vpmadt032 = vpmadt032_alloc(&options, wc->board_name, NULL);
 		if (!wc->vpmadt032)
 			return -ENOMEM;
 

Modified: linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wcte12xp/base.c?view=diff&rev=7547&r1=7546&r2=7547
==============================================================================
--- linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wcte12xp/base.c Tue Nov 10 09:30:05 2009
@@ -40,6 +40,10 @@
 #include <linux/delay.h>
 
 #include <dahdi/kernel.h>
+
+#if defined(CONFIG_DAHDI_DEBUGFS)
+#include <linux/debugfs.h>
+#endif
 
 #include "wct4xxp/wct4xxp.h"	/* For certain definitions */
 
@@ -1363,7 +1367,7 @@
 		options.vpmnlpmaxsupp = vpmnlpmaxsupp;
 		options.channels = (wc->spantype == TYPE_T1) ? 24 : 32;
 
-		wc->vpmadt032 = vpmadt032_alloc(&options, wc->name);
+		wc->vpmadt032 = vpmadt032_alloc(&options, wc->name, wc->debugfs_dir);
 		if (!wc->vpmadt032)
 			return -ENOMEM;
 
@@ -1756,6 +1760,7 @@
 
 	ifaces[index] = wc;
 	memset(wc, 0, sizeof(*wc));
+
 	wc->ledstate = -1;
 	spin_lock_init(&wc->reglock);
 	spin_lock_init(&wc->cmd_list_lock);
@@ -1780,6 +1785,15 @@
 #	endif
 
 	snprintf(wc->name, sizeof(wc->name)-1, "wcte12xp%d", index);
+
+#if defined(CONFIG_DAHDI_DEBUGFS)
+	wc->debugfs_dir = debugfs_create_dir(wc->name, dahdi_debugfs_boards);
+	if (IS_ERR(wc->debugfs_dir)) {
+		t1_info(wc, "Failed to create debugfs entry\n");
+		wc->debugfs_dir = NULL;
+	}
+#endif
+
 	if ((res = voicebus_init(pdev, SFRAME_SIZE, wc->name,
 				 t1_handle_receive, t1_handle_transmit, wc,
 				 debug, &wc->vb))) {
@@ -1828,6 +1842,10 @@
 #endif
 	if (!wc)
 		return;
+
+#if defined(CONFIG_DAHDI_DEBUGFS)
+	debugfs_remove_recursive(wc->debugfs_dir);
+#endif
 
 #ifdef VPM_SUPPORT
 	if(vpm) {

Modified: linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wcte12xp/wcte12xp.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wcte12xp/wcte12xp.h?view=diff&rev=7547&r1=7546&r2=7547
==============================================================================
--- linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wcte12xp/wcte12xp.h (original)
+++ linux/team/sruffell/dahdi-linux-debugfs/drivers/dahdi/wcte12xp/wcte12xp.h Tue Nov 10 09:30:05 2009
@@ -137,6 +137,9 @@
 	struct list_head active_cmds;
 	struct timer_list timer;
 	struct work_struct timer_work;
+#if defined(CONFIG_DEBUG_FS)
+	struct dentry *debugfs_dir;
+#endif
 };
 
 #define t1_info(t1, format, arg...)         \

Modified: linux/team/sruffell/dahdi-linux-debugfs/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-debugfs/include/dahdi/kernel.h?view=diff&rev=7547&r1=7546&r2=7547
==============================================================================
--- linux/team/sruffell/dahdi-linux-debugfs/include/dahdi/kernel.h (original)
+++ linux/team/sruffell/dahdi-linux-debugfs/include/dahdi/kernel.h Tue Nov 10 09:30:05 2009
@@ -1177,4 +1177,9 @@
 #define DMA_BIT_MASK(n)	(((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
 #endif
 
+#if defined(CONFIG_DEBUG_FS)
+extern struct dentry *dahdi_debugfs_boards;
+#define CONFIG_DAHDI_DEBUGFS
+#include <linux/debugfs.h>
+#endif
 #endif /* _DAHDI_KERNEL_H */




More information about the svn-commits mailing list