From d8562c778088ff6ab3383df5ceead41eff4bf124 Mon Sep 17 00:00:00 2001 From: tzafrir Date: Thu, 19 Mar 2009 20:08:29 +0000 Subject: xpp: a massive backport from DAHDI. From Xorcom branch-rel-6839-r6908 . Sun Mar 1 2009 Oron Peled - xpp.r6795 * Fix cases where the command_queue overflowed during initialization. - Also add a 'command_queue_length' parameter to xpp.ko * More migrations to sysfs: - Add a 'transport' attribute to our astribank devices which points to the usb device we use. E.g: /sys/bus/astribanks/devices/xbus-00/transport is symlinked to ../../../../../../devices/pci0000:00/0000:00:10.4/usb5/5-4 - Move /proc/xpp/XBUS-??/XPD-??/span to /sys/bus/xpds/devices/??:?:?/span - Migrate from /proc/xpp/sync to: /sys/bus/astribanks/drivers/xppdrv/sync - New 'offhook' attribute in: /sys/bus/xpds/devices/??:?:?/offhook * PRI: change the "timing" priority to match the convention used by other PRI cards -- I.e: lower numbers (not 0) have higher priority. * FXO: - Power denial: create two module parameters instead of hard-coded constants (power_denial_safezone, power_denial_minlen). For sites that get non-standard power-denial signals from central office on offhook. - Don't hangup on power-denial, just notify Dahdi and wait for - Fix caller-id detection for the case central office sends it before first ring without any indication before. Asterisk's desicion. Mon, Dec 8 2008 Oron Peled - xpp.r6430 * PRI: - Match our span clocking priorities (in system.conf) to Digium -- this is a reversal of the previous state. Now lower numbers (greater than 0) are better. - Synchronization fixes for PRI ports other than 0. - Fix T1 CRC for some countries (e.g: China). * FXS: fix bug in VMWI detection if using old asterisk which does not provide ZT_VMWI ioctl(). * FXO: - Improve caller_id_style module parameter. This provide a workaround for countries that send this information without any notification (reverse polarity, ring, etc.) - Don't force on-hook upon power-denial. So, loopstart devices would ignore these as expected. * Implement a flow-control to prevent user space (init_card_* scripts) from pressuring our command queue. git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@4631 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- kernel/xpp/card_fxs.c | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) (limited to 'kernel/xpp/card_fxs.c') diff --git a/kernel/xpp/card_fxs.c b/kernel/xpp/card_fxs.c index 7068bf7..47688ef 100644 --- a/kernel/xpp/card_fxs.c +++ b/kernel/xpp/card_fxs.c @@ -397,7 +397,7 @@ static xpd_t *FXS_card_new(xbus_t *xbus, int unit, int subunit, const xproto_tab channels = regular_channels; if(unit == 0) channels += 6; /* 2 DIGITAL OUTPUTS, 4 DIGITAL INPUTS */ - xpd = xpd_alloc(sizeof(struct FXS_priv_data), proto_table, channels); + xpd = xpd_alloc(xbus, unit, subunit, subtype, subunits, sizeof(struct FXS_priv_data), proto_table, channels); if(!xpd) return NULL; if(unit == 0) { @@ -407,8 +407,6 @@ static xpd_t *FXS_card_new(xbus_t *xbus, int unit, int subunit, const xproto_tab } xpd->direction = TO_PHONE; xpd->type_name = "FXS"; - if(xpd_common_init(xbus, xpd, unit, subunit, subtype, subunits) < 0) - goto err; if(fxs_proc_create(xbus, xpd) < 0) goto err; priv = xpd->priv; @@ -778,7 +776,7 @@ static int FXS_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long a BUG_ON(!priv); xbus = xpd->xbus; BUG_ON(!xbus); - if(!TRANSPORT_RUNNING(xbus)) + if(!XBUS_IS(xbus, READY)) return -ENODEV; if (pos < 0 || pos >= xpd->channels) { XPD_NOTICE(xpd, "Bad channel number %d in %s(), cmd=%u\n", @@ -1486,8 +1484,49 @@ static int proc_xpd_metering_write(struct file *file, const char __user *buffer, } #endif +static int fxs_xpd_probe(struct device *dev) +{ + xpd_t *xpd; + + xpd = dev_to_xpd(dev); + /* Is it our device? */ + if(xpd->type != XPD_TYPE_FXS) { + XPD_ERR(xpd, "drop suggestion for %s (%d)\n", + dev->bus_id, xpd->type); + return -EINVAL; + } + XPD_DBG(DEVICES, xpd, "SYSFS\n"); + return 0; +} + +static int fxs_xpd_remove(struct device *dev) +{ + xpd_t *xpd; + + xpd = dev_to_xpd(dev); + XPD_DBG(DEVICES, xpd, "SYSFS\n"); + return 0; +} + +static struct xpd_driver fxs_driver = { + .type = XPD_TYPE_FXS, + .driver = { + .name = "fxs", +#ifndef OLD_HOTPLUG_SUPPORT + .owner = THIS_MODULE, +#endif + .probe = fxs_xpd_probe, + .remove = fxs_xpd_remove + } +}; + static int __init card_fxs_startup(void) { + int ret; + + if((ret = xpd_driver_register(&fxs_driver.driver)) < 0) + return ret; + INFO("revision %s\n", XPP_VERSION); #ifdef POLL_DIGITAL_INPUTS INFO("FEATURE: with DIGITAL INPUTS support (polled every %d msec)\n", @@ -1512,6 +1551,7 @@ static int __init card_fxs_startup(void) static void __exit card_fxs_cleanup(void) { xproto_unregister(&PROTO_TABLE(FXS)); + xpd_driver_unregister(&fxs_driver.driver); } MODULE_DESCRIPTION("XPP FXS Card Driver"); -- cgit v1.2.3