summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wctdm24xxp/base.c
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2010-02-03 21:37:57 +0000
committerShaun Ruffell <sruffell@digium.com>2010-02-03 21:37:57 +0000
commitc9bcc7d735432abe624785c286dec0ae6e92e31b (patch)
treee0ef76fd42ed115511f81970cf47d9a62856cb47 /drivers/dahdi/wctdm24xxp/base.c
parentea3be9d2f30f991e60a3b5999861f3f7f4dbfb0d (diff)
wctdm24xxp, voicebus: Move sysfs handling from voicebus to wctdm24xxp.
The drv_data attached to the pci_dev is no longer the 'struct voicebus' pointer, but is instead the 'struct wctdm' (or 'struct t1'), so the clients need to manage the sysfs files themselves. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@7983 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wctdm24xxp/base.c')
-rw-r--r--drivers/dahdi/wctdm24xxp/base.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c
index 2fc07b4..512cdd5 100644
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -3710,6 +3710,25 @@ static void free_wc(struct wctdm *wc)
kfree(wc);
}
+#ifdef CONFIG_VOICEBUS_SYSFS
+static ssize_t
+voicebus_current_latency_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ unsigned long flags;
+ struct wctdm *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);
+}
+
+DEVICE_ATTR(voicebus_current_latency, 0400,
+ voicebus_current_latency_show, NULL);
+#endif
+
+
static const struct voicebus_operations voicebus_operations = {
.handle_receive = handle_receive,
.handle_transmit = handle_transmit,
@@ -3753,6 +3772,15 @@ static int __devinit wctdm_init_one(struct pci_dev *pdev, const struct pci_devic
return ret;
}
+#ifdef CONFIG_VOICEBUS_SYSFS
+ dev_dbg(&wc->vb.pdev->dev, "Creating sysfs attributes.\n");
+ 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
if (VOICEBUS_DEFAULT_LATENCY != latency) {
voicebus_set_minlatency(&wc->vb, latency);
}
@@ -3842,6 +3870,11 @@ static void __devexit wctdm_remove_one(struct pci_dev *pdev)
struct wctdm *wc = pci_get_drvdata(pdev);
struct vpmadt032 *vpm = wc->vpmadt032;
+#ifdef CONFIG_VOICEBUS_SYSFS
+ device_remove_file(&wc->vb.pdev->dev,
+ &dev_attr_voicebus_current_latency);
+#endif
+
if (wc) {
if (vpm) {
clear_bit(VPM150M_DTMFDETECT, &vpm->control);
@@ -3930,6 +3963,7 @@ static void __exit wctdm_cleanup(void)
pci_unregister_driver(&wctdm_driver);
}
+
module_param(debug, int, 0600);
module_param(fxovoltage, int, 0600);
module_param(loopcurrent, int, 0600);