Commit Graph

912 Commits

Author SHA1 Message Date
Russ Meyerriecks
3efa9d8cd1 wcte13xp: wcxb: Add delayed reset firmware feature
Allow certain older firmwares to delay the hard reset until a full power cycle.
This way we can "preload" newer firmware images, without requiring the user to
physically power off/on their machine.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>
2014-01-24 13:14:14 -06:00
Shaun Ruffell
4cd09feb54 wcte43x, wcte13xp, wcaxx: Bump irqmisses counter when there are DMA underruns.
This makes the behavior of IRQ misses for these drivers behave the same as the
wcte12xp, wctdm24xxp, and wct4xxp drivers.

Previously irqmisses would never increase. The presence of underruns would still
show up in dmesg as latency bumps.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-22 18:04:47 -06:00
Shaun Ruffell
1f024713ed wct4xxp: Trivial drop of unnecessary local variables.
These were left over from when the VPM callbacks depended on the different VPM
installed. On the wcte43x this is unnecessary.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-22 18:04:47 -06:00
Shaun Ruffell
0b499d9566 wcte43x: Trivial drop of unnecessary local variables.
These were left over from when the VPM callbacks depended on the different VPM
installed. On the wcte43x this is unnecessary.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-22 18:04:47 -06:00
Russ Meyerriecks
438b2a36b3 wcte13xp: wcaxx: wcte43x: Remove VPM_SUPPORT compile option.
This was a legacy compile time option that is no longer necessary with the new
series of cards.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-22 13:40:27 -06:00
Russ Meyerriecks
be94aa11bb Revert "dahdi: Change auto_assign_spans default from 1 to 0."
This reverts commit c49a56c954.

Delaying this feature until after v2.9 release.
2014-01-21 16:36:44 -06:00
Russ Meyerriecks
1add33efe7 wcte13xp: Add support for te131 and te132 products
These are similar to te133 and te134 but without integrated echo cancel.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-17 15:43:06 -06:00
Russ Meyerriecks
094e30483d wcte13xp: Update firmware to 0x780017
This firmware adds support for the te131 and te132 products.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-17 15:33:25 -06:00
Russ Meyerriecks
e4ea886ee0 wcte13xp: wcaxx: Fix broken devicetype attributes
struct dahdi_device.devicetype was set incorrectly in both drivers. This caused
the vpm module to not show up after the device name when reading this field
from a spanstat.

Reported-by: Charles Moye <cmoye@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-17 15:30:38 -06:00
Shaun Ruffell
860eb4ab48 dahdi: Do not access invalid memory if invalid local span number is passed to spantype attribute.
This fixes potential kernel panic due to accessing invalid memory if passing
invalid local span number to 'spantype' attribute via sysfs.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2014-01-14 16:03:18 -06:00
Shaun Ruffell
47dcc9377c wcte43x, wcte13xp: Use MSI interrupts if possible.
It was an oversight to prevent the wcte43x and wcte13xp drivers from using
Message Signaled interrupts during the switch to the wcxb library.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-08 12:21:10 -06:00
Shaun Ruffell
f10eb3f547 wcte13xp: Export max_latency module parameter.
wcte13xp now has a max_latency module parameter like the wcaxx and wcte43x
drivers.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-08 12:21:10 -06:00
Shaun Ruffell
99de304d84 wcaxx, wcte13xp, wcte43x: Honor max_latency module parameter.
The wcxb library did not do actually use the max_latency member to limit the
maximum latency of the DMA engine.

Now it does.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-08 12:21:10 -06:00
Shaun Ruffell
c49a56c954 dahdi: Change auto_assign_spans default from 1 to 0.
The infrastructure has been put in place in 2.8.0 for fully dynamic device and
span configuration. This will be the default mode in DAHDI-Linux 2.9.0.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Oron Peled <oron.peled@xorcom.com>
2014-01-06 13:24:28 -06:00
Shaun Ruffell
e6b16eace1 dahdi: Move clearing of DAHDI_ALARM_NOTOPEN to __dahdi_assign_span().
Previously this was in __dahdi_init_span(). The problem was that
__dahdi_init_span() was only called when a spans' line mode was being changed.
Therefore it was possible to unassign and resassign an analog span and leave it
stuck in the 'NOP' alarm state.

It also make the setting / clearing of DAHDI_ALARM_NOTOPEN symetrical about span
unassignment / assignment in addition to updating the alarm states on all the
channels on the span via the dahdi_alarm_notify() function.

This is a better version of commit 496f817773.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-26 17:04:29 -06:00
Shaun Ruffell
3933ffd350 wctdm24xxp: Reset module specific type information on probe.
This fixes an issue that affects TDM410 modules when there is not a module
installed in the first port, but there is an FXO module installed in the third
port.

When scaning for QRV modules in the first port, the 3rd port will have the
'hook' struct.qrv set to 0xff. When a QRV module is  not detected, that value
will be left, which then maps to an invalid state for both fxo.ring_state and
fxo.battery_state.

The result would be that FXO ports would fail to run the ring detector state
machine since it did not know what the current state was.

Now we'll just reset all the values in struct fxo or struct fxs to the expected
init state.

Internal-Issue-ID: DAHLIN-332
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-20 14:15:26 -06:00
Russ Meyerriecks
05bf6ac601 wcte13xp: Fix bug preventing recover timing from ever being set
A bug introduced in v2.8.0 prevented the recover timing configuration from
being set properly on the hardware. This caused the card to never go into
recovered timing mode.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-18 18:15:21 -06:00
Shaun Ruffell
2e7acd212e xpp: Replace drv_attrs with drv_groups on kernels > 3.12
drv_attrs was fully removed from the bus structure in upstream commit
e18945b159a1cdbc031f1d3b0b7e515a33bdcbf7 which was merged into 3.13.

This is necessary to compile against linux kernel version 3.13.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-12-06 15:42:46 -06:00
Shaun Ruffell
3707ee713e Revert "wcaxx: Use startup/shutdown callbacks to protect access to channel registers."
This reverts commit 1cf7d9b08c.

It turns out this change was not necessary.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-02 16:23:58 -06:00
Shaun Ruffell
f5d3b35d7b dahdi: Replace drv_attr with drv_groups on kernels > 3.12.
drv_attrs was fully removed from the bus structure in upstream commit
e18945b159a1cdbc031f1d3b0b7e515a33bdcbf7 which was merged into 3.13.

This is necessary to compile dahdi against linux version 3.13.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-02 15:47:56 -06:00
Shaun Ruffell
6bcc70a421 wcte43x: Update firmware to version e0017.
This resolves issues where, when using internal timing, the first channel of
span 3 has occassional corrupted data in transmit stream.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-02 15:46:39 -06:00
Shaun Ruffell
d389f9f743 wcaxx: Add extra dummy read when checking for single fxs modules.
This extra read eliminates some problems with detecting certain S100M modules.
It is unclear at this time why it is necessary.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-02 15:46:39 -06:00
Shaun Ruffell
0faac26dde wcxb: Do not access cur_transfer/cur_msg outside of lock.
The spi master cur_transfer and cur_msg should only be changed under the
spin_lock for the master. The result is that if running user space tools, like
fxstest, that check registers on the modules, it's possible to have a message
that was not yet complete flagged as completed which would result in a bad read.

This does not affect "normal" operation of the wcaxx driver since interrupts are
not enabled during module detection, and during normal operation all access to
the resgisters is done in the context of the interrupt handler. This would only
be an issue if the interrupt handler was running and register accesses are tried
in user space context on an SMP system.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-02 15:46:39 -06:00
Shaun Ruffell
acfec5dfbb wcxb: is_pcie -> pci_is_pcie()
is_pcie attribute was finally dropped from struct pci_dev in
upstream commit 115e3bc5e23e7ec3c85a2014bfa96c0ddd036083.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-12-01 22:44:09 -06:00
Shaun Ruffell
4bfdd8bea5 dahdi: Remove "ddev" symlink before unregistering the span device.
This makes the order of operations for device removal symmetrical with those for
device addition. This change also eliminates the following warning when
unloading dahdi after dynamic spans have been created:

  ------------[ cut here ]------------
  WARNING: at /build/buildd/linux-3.2.0/fs/sysfs/inode.c:324 sysfs_hash_and_remove+0x92/0xa0()
  Hardware name: VirtualBox
  sysfs: can not remove 'ddev', no directory
  Modules linked in: dahdi_dynamic_loc(O-) dahdi_dynamic(O) dahdi(O) crc_ccitt
     hdlc_cisco hdlc vboxvideo(O) drm vboxsf(O) vesafb ppdev psmouse parport_pc
     serio_raw mac_hid vboxguest(O) nfsd nfs i2c_piix4 lockd fscache auth_rpcgss
     nfs_acl sunrpc ext2 lp parport e1000 [last unloaded: dahdi]
  Pid: 3533, comm: rmmod Tainted: G        W  O 3.2.0-56-generic-pae #86-Ubuntu
  Call Trace:
   [<c105ab42>] warn_slowpath_common+0x72/0xa0
   [<c11a7992>] ? sysfs_hash_and_remove+0x92/0xa0
   [<c11a7992>] ? sysfs_hash_and_remove+0x92/0xa0
   [<c105ac13>] warn_slowpath_fmt+0x33/0x40
   [<c11a7992>] sysfs_hash_and_remove+0x92/0xa0
   [<c1385427>] ? device_del+0x127/0x150
   [<c11a9bd0>] sysfs_remove_link+0x20/0x30
   [<d8a03fa3>] span_sysfs_remove+0xa3/0x170 [dahdi]
   [<c1036a88>] ? default_spin_lock_flags+0x8/0x10
   [<d89f7e5e>] _dahdi_unassign_span+0xae/0x210 [dahdi]
   [<c1053f6b>] ? __cond_resched+0x1b/0x30
   [<c15a9859>] ? _cond_resched+0x29/0x30
   [<d89f80a3>] dahdi_unregister_device+0xe3/0x190 [dahdi]
   [<d8936464>] dahdi_dynamic_unregister_driver+0x84/0x130 [dahdi_dynamic]
   [<d89284ed>] dahdi_dynamic_local_exit+0xd/0xb20 [dahdi_dynamic_loc]
   [<c1095995>] sys_delete_module+0x135/0x230
   [<c1110063>] ? pagetypeinfo_show.part.8+0x33/0x100
   [<c15b295f>] sysenter_do_call+0x12/0x28
  ---[ end trace b818e326720c8385 ]---

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-29 15:42:07 -06:00
Shaun Ruffell
c0d52a04cb wctdm24xxp: Remove assigned callback.
For the spans exported by the wctdm24xxp, the channels are not going to change
after they are already registered.

This eliminates a problem when analog spans are unassigned/reassigned and the
not_ready goes negative, thereby causing many warnings in the kernel.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-26 10:49:58 -06:00
Shaun Ruffell
1cf7d9b08c wcaxx: Use startup/shutdown callbacks to protect access to channel registers.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-25 16:19:28 -06:00
Shaun Ruffell
3a0905b1ec dahdi_dynamic: Create a span type for dynamic spans.
Fixes the following warning when loading the driver:

  dahdi: Warning: Span DYN/eth/eth1/00:50:c2:97:92:1d/1 didn't specify a spantype. Please fix driver!

The spantype is intended to be used by the auto configuration tools
(dahdi_genconf, pinned spans, etc..) but dynamic spans, since they are created
directly by dahdi_cfg, never take part in the pre-registration auto
configuration, therefore the span type was never used.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-24 10:09:33 -06:00
Shaun Ruffell
4a75f58156 oct612x: Make dependent on dahdi.ko
This change will ensure that the oct612x module is unloaded automatically when
/etc/init.d/dahdi stop is run.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-24 10:09:33 -06:00
Oron Peled
dd944f3362 sysfs: new driver attribute: master_span
* This changeset adds master_span as an attribute of the span's driver:
  /sys/bus/dahdi_spans/drivers/generic_lowlevel/master_span
* This is mainly used for debugging.
* Reading from it the master span number (or 0 if there is no master
  span).
* Writing a number to it, force specified span to be master
* Existing Alternatives:
  - grep "MASTER" from /proc/dahdi/*
  - cat /sys/bus/dahdi_spans/devices/span-*/is_sync_master

(Note: commit d8fe2af23d is also Acked-By
Tzafrir Cohen <tzafrir.cohen@xorcom.com>)

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 17:20:04 +02:00
Oron Peled
d8fe2af23d xpp: automatic dahdi_registration by default
* Now with pinned-spans, we can assure reliable ordering
2013-11-24 15:34:57 +02:00
Oron Peled
35e9924b3c Rename "pinned spans" to "assigned spans"
Rename as terminology has changed. No change in kernel interface.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 15:03:35 +02:00
Oron Peled
7a822db82c dahdi: Rename span 'master' as 'master_span'
* No functional changes.
* Rename the span 'master' to 'master_span' to avoid ambiguity with the
  'master' channel.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 14:54:27 +02:00
Oron Peled
007ff90025 sysfs: create symlink "ddev" to device of span
Create a "ddev" symlink from span's sysfs node to the one of its dahdi
device.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 14:54:03 +02:00
Oron Peled
be25fdb6fa remove udev rules: moved to dahdi-tools
* Removed xpp.rules
* Removed generation of dahdi.rules

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 14:53:20 +02:00
Oron Peled
1672e07deb Also send DAHDI_TOOLS_ROOTDIR with device events
Send the new DAHDI_TOOLS_ROOTDIR and existing DAHDI_INIT_DIR with udev
device events as well.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 14:51:24 +02:00
Oron Peled
7b578b83b9 dahdi: add "tools_rootdir" module parameter
* Passed to udev as DAHDI_TOOLS_ROOTDIR environment variable
* Default is "/"
* Deprecates the parameter initdir:
  - Defaults to $DAHDI_TOOLS_ROOTDIR/usr/share/dahdi
  - If specified: taken relative to $DAHDI_TOOLS_ROOTDIR
  - Setting both parameters explicitly is prohibited.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-11-24 14:51:14 +02:00
Shaun Ruffell
1ab5723b85 wcte43x: Remove 'dcxo' debug attribute.
Removes another bit of debugging instrumentation that I let slip through.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-20 09:39:12 -06:00
Shaun Ruffell
cbad5a7ae1 wcte43x: Do not grab reglock in handle_transmit/handle_receive.
If the driver is loaded with vpmsupport=0, then it was possible to create a
deadlock situation since the call into __dahdi_ec_chunk might then try to grab
the channel lock while already holding the reglock.

The purpose of grabbing reglock in the DMA routines was to protect the channel
array, which can be changed when linemode is changing. So instead, we'll
completely mask off that interrupt line from all CPUs when potentially changing
the channel array.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-20 09:33:07 -06:00
Shaun RuffellL
b3c6320374 wcaxx: Remove some left over debugging trace statements.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-17 02:36:29 -06:00
Shaun Ruffell
69a716af1a wcxb: Update the firmware meta block during flash update.
The meta block contains specific version and checksum information and allows the
test tools to validate the image in the flash.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-16 16:03:19 -06:00
Shaun Ruffell
eed2e4e00b wcaxx: Update A4B firmware to version 0b0017
Resolves some sporadic issues with invalid underruns.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-16 16:02:00 -06:00
Wendell Thompson
466acea7e0 wcte43x: Add driver for TE435/TE235 digital cards.
From: Wendell Thompson <wthompson@digium.com>

These new cards are based on a common architecture with the TE133/TE134 as well
as the new analog cards, A4A/A4B/A8A/A8B.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Russ Meyerriecks
3134b36d7e wcte13xp: Improve maintenance functions and error counters
From: Rus Meyerriecks <rmeyerriecks@digium.com>

* Removed work queue for maint interface as it is not needed in this driver
* Error counters are now accessible through the maint interface
* Consolidated and revised the big maint switch case
* Added loopup/loopdown code transmit logic to E1
* Now supports error/defect insersion

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Russ Meyerriecks
4707e19654 wcte13xp: Hold framer in reset to stop xmit on modprobe -r
From: Russ Meyerriecks <rmeyerriecks@digium.com>

The framer appears to continue transmitting a signal after modprobe -r. This
patch will leave the physical framer reset pin asserted to force the chip to
stop transmitting a signal when there is no driver attached.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Russ Meyerriecks
e42548f2c5 wcte13xp: Migrate to wcxb library
From: Russ Meyerriecks <rmeyerriecks@digium.com>

Removed all the custom logic and replaced with the common platform wcxb stuff.

There are also changes in here to standardize the function prefix in this
driver to t13x_.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Wendell Thompson
abe35059bc wcte13xp: Use interrupts for Falc alarms and signaling
From: Wendell Thompson <wthompson@digium.com>

Now uses framer interrupt vector polling (in the FPGA interrupt) for
alarm, loopcode, and signaling events eliminating continuous polling.
Now uses timer function for alarm and loopcode debouce, which only
executes during exception conditions.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Shaun Ruffell
348f6ab030 wcaxx: New driver for A4A/A4B/A8A/A8B analog cards.
This is a driver for the new line of analog cards that shares a common interface
with the TE133/TE134 and the TE435.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Shaun Ruffell
26efcf6902 wct4xxp, wcte13xp: Move the octasic DSP code into separate module.
The octasic library is relatively large and is currently separately linked into
both the wcte13xp and wct4xxp libraries. This change moves it out into a
separate loadable module.

The bigest change from the drivers perspectives is that they must provide a
table of callbacks instead of using statically linked Oct6100UserXxxxx functions
to allow the library to communicate with actual parts on the cards.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Shaun Ruffell
a648cef0f6 wct4xxp: If linemode changed via sysfs, reset the complete part.
This works around some issues with older versions of the firmware not
working properly after the linemode is changed via sysfs. Basically the
intent is to simulate redoing a complete driver reload with a new
linemode.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Shaun Ruffell
a5a52dbe94 wct4xxp: VPM companding switch print is now debug only.
This print happened when the linemode was changed via sysfs, but it didn't
really add much extra information that a user could act on.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Shaun Ruffell
43ad3eeb65 wct4xxp: Fix bipolar error insertion test mode.
This change wouldn't affect most people since it's only used by the error
injection code.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Shaun Ruffell
706dc43483 wct4xxp: Print warning in dmesg if span priority is not set correctly.
dahdi_genconf currently does not take into account the number of spans
configured for a particular board. Therefore if you have two dual span cards
installed in the system, it could be possible to have something like this in
/etc/dahdi/system.conf:

  spans=1,1,...
  spans=2,2,...
  spans=3,3,...
  spans=4,4,...

When what you really want is something like this:

  spans=1,1,...
  spans=2,2,...
  spans=3,1,...
  spans=4,2,...

Otherwise, spans 3 and 4 will be configured to not recover the clock from the
span which is most likely NOT what you want.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:19 -06:00
Shaun Ruffell
7405dd6038 dahdi: Fix placement of '/' in output of /proc/dahdi/x
Fixes strings that look like:
  Span 1: TE2/0/1 "T2XXP (PCI) Card 0 Span 1" CCSHDB3//CRC4 RED

To look like:
  Span 1: TE2/0/1 "T2XXP (PCI) Card 0 Span 1" CCS/HDB3/CRC4 RED

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:18 -06:00
Shaun Ruffell
496f817773 dahdi: Clear DAHDI_ALARM_NOTOPEN when spans are re-initialized.
This eliminates the need for board drivers to always re-report their alarm
states when spans are unassigned and then reassigned.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-11-11 14:39:18 -06:00
Tzafrir Cohen
bd0366287e xpp: Fail loading if no module on first slot
The driver assumes that the first slot is not empty. If this is not the
case, synchronization will not work.

Fail loading if this assertion does not hold.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-11-10 16:39:36 +02:00
Tzafrir Cohen
f287c0af7f xpp: mark an AB as failed if it gives bad desc
If we fail at handling the device descriptor from the Astribank, mark it
as in state "failed".

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-11-10 16:39:36 +02:00
Tzafrir Cohen
7adc74512e xpp: USB_FW.202.hex: provide as a symlink
Provide USB_FW.202.hex as a (install-time) symlink to USB_FW.201.hex.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-11-07 17:08:45 +02:00
Tzafrir Cohen
b993d25c5a xpp: Firmware for Astribanks 2.02: Makefile
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-11-06 16:57:48 +02:00
Tzafrir Cohen
41ae90a8a3 xpp: Firmware for Astribanks 2.02
Astribank 2.02: a newer model: slight variation of 2.01 (both use E-Main
4). Uses the same USB firmware, has to use a different FPGA firmware as
newer devices cannot be made to work with older 2.01 firmware.

FPGA rev. 11307.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-21 16:51:30 +03:00
Oron Peled
d4c8eb47ac add a 'location' attribute to sysfs (dahdi_device):
* Our user-space previously used the implicit location from the sysfs
  device path of the "dahdi_device".
* However:
  - Sysfs paths are very limited in length.
  - Low-level driver need more control on the location field.
  - For example, it need to be persistant for span_assignments.
* We now export explicitly the 'location' field which is managed by
  low-level drivers.
* We will use this field as the location in span_assignments.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-01 23:42:21 +03:00
Oron Peled
2bd36a3307 xpp: ring/mwi settings: add to FXS init script
init_card_1_30 (FXS modules init script) can now use the new sysfs
interface to set ring settings.

Currently it only overwrite a single register

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-01 15:25:42 +03:00
Oron Peled
600dd03e30 xpp: FXS: ring/mwi settings: a sysfs interface
A new SysFS interface for FXS modules (XPDs):
* In /sys/bus/xpds/devices/<ll>:<m>:<n>/fxs_ring_registers
* Reading show current register values for NEON/TRAPEZ/NORMAL
* Modify the table via writing: "<column> <reg> <byte> [<byte>]"
* Example:
	echo "NEON 0x33 0x12" > \
		'/sys/bus/xpds/devices/00:0:0/fxs_ring_registers'

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-01 15:23:56 +03:00
Oron Peled
3d1d87e526 xpp: refactor FXS ring settings
xpp: refactor the FXS module ring settings into separate data structure:

* Update High VBAT initialization in init_card_1_30:
  - Take the value used in set_vm_led_mode() (0x34)
  - Now we don't need to set it over and over again in set_vm_led_mode()
* Create a unified ring_parameters[] array for all ring registers:
  - Columns for 3 ring types (NEON, TRAPEZ, NORMAL)
  - Used by new send_ring_parameters() function
* Now the set_vm_led_mode() simply calls send_ring_parameters()
* This cleanup would allow us to change ring parameters at runtime (by
  updating the values in these tables).

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-10-01 15:22:32 +03:00
Oron Peled
745118acb9 xpp: Serialize dahdi registration
xpp: Serialize dahdi registration: Cause races under highly-parallel
workloads (with dahdi_autoreg=0).

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-09-29 19:13:26 +03:00
Russ Meyerriecks
ce3f1f2650 wcte13xp: Workaround rare nmi on modprobe on select systems
With certain pci controllers that support pci hotplug, during the reset
sequence of the fpga, the host controller can get confused about the state of
the card and throw an nmi.

Known affected systems:
 HP proliant DL160 & DL360p
 Dell poweredge R520
 Super Micro X7SPA-HF

This patch attempts to work around that by removing the fpga reset sequence
from the driver startup, then setting various control registers to known
starting state values.

This patch removes the field upgradeable firmware logic temporarily for the
te133 card to prevent fpga reset.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-08-16 15:28:24 -05:00
Oron Peled
2ad4dc555f xpp: fix waitfor_xpds race at startup
* If userspace would run
    modprobe xpp_usb && cat /sys/bus/astribanks/devices/xbus-00/waitfor_xpds
  it would return immediately rather than wait for the Astribank to
  initialize.
* We sometimes managed to read before getting the reply from the
  astribank.
* Now we don't trust unit count at such an early stage.
* Instread we wait for the Astribank to reach a stable state (READY or FAIL)
  before finish waiting for this astribank.

Internal-Issue-ID: Xorcom-1502
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-07-30 15:04:00 +03:00
Oron Peled
8ea23535dc sysfs: bugfix: shorten too long file names
* In old kernels (e.g: 2.6.18) sysfs file names must be shorter
  then KOBJ_NAME_LEN.

* Longer names are truncated and this leads to duplicate names
  which fails device_register()
  Examples: "dahdi!channels!10!10" is truncated to "dahdi!channels!10!1"

* The fix shorten the names and make them fixed length. Example:
            "dahdi!chan!010!010"

* It seems no current userspace tools rely on that name or on
  /dev/dahdi/channels .

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-06-23 22:12:33 +03:00
Russ Meyerriecks
431571b5fc wcte13xp: Start the span in unconfigured, instead of red state
This was causing inconsistancies with dahdi_scan showing an "UNCONFIGURED" span
in the "RED" state.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-06-14 14:55:37 -05:00
Shaun Ruffell
ab927f796b dahdi: Do not set rxbufpolicy when opening dahdi net device.
This fixes a regression introduced in 2.7.0 in commit
(da8b96d725 "dahdi: Remove unused 'rxbufpolicy'
and 'rxdisable' from dahdi_chan.") when CONFIG_DAHDI_NET is defined in
include/dahdi/dahdi_config.h.

rxbufpolicy was always hardcoded to immediate policy and was removed from the
channel structure. There is no longer any need to set it in dahdi_net_open.

Reported-by: Dave Fullerton <dfullertasterisk@shorelinecontainer.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-06-11 10:25:10 -05:00
Shaun Ruffell
040ba6f43a wctc4xxp: Ensure the descriptors are zeroed out on start.
If system conditions prevent the card from loading the firmware without
touching all the descriptors in the ring, it's possible for
wctc4xxp_cleanup_descriptor_ring to attempt cleanup of a command that was never
submitted resulting in the following BUG.

  wctc4xxp 0000:02:0a.0: Failed to load firmware.
  BUG: unable to handle kernel paging request at c109556c
  IP: [<f9faa83e>] wctc4xxp_cleanup_descriptor_ring+0x8c/0x148 [wctc4xxp]

Reported-by: Xavier Carcelle <xcarcelle@avencall.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-05-31 12:10:49 -05:00
Russ Meyerriecks
e2f492595c wcte13xp: New driver for digium's te13x product range
This patch adds support for Digium's new single span T1/E1 cards with built-in
octasic echo canceler.

PCI IDs:
d161:800a te133 - pci express
d161:800b te134 - pci

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-28 16:53:38 -05:00
Shaun Ruffell
1f20b5f8fa xpp: Don't use create_proc_read_entry()
Don't use create_proc_read_entry() as that is deprecated, but rather use
proc_create_data() and seq_file instead.

This is needed to compile against Linux 3.10.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
[tzafrir.cohen@xorcom.com: fixed passing /proc/xpp/XPD/summary xbus number]
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Cc: Russ Meyerriecks <rmeyerriecks@digium.com>
Cc: Oron Peled <oron.peled@xorcom.com>
2013-05-24 00:30:33 +03:00
Shaun Ruffell
ba2fdf2dac dahdi_dynamic_ethmf: Don't use create_proc_read_entry()
Don't use create_proc_read_entry() as that is deprecated, but rather use
proc_create_data() and seq_file instead.

This is needed to compile against Linux 3.10.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Cc: Russ Meyerriecks <rmeyerriecks@digium.com>
Cc: Oron Peled <oron.peled@xorcom.com>
2013-05-24 00:30:33 +03:00
Shaun Ruffell
84ccc652b6 dahdi: Replace create_proc_entry() with proc_create_data()
create_proc_entry() was deprecated and replace with proc_create_data() since
it's open to a race condition where the proc entry is visible before the file
operations have been set for it.

The PDE() macro also is no longer available as of Linux 3.10 and is replaced
with PDE_DATA() to get the data member from a proc entry. This is due to the
fact that 'struct proc_dir_entry' is now private to the proc_fs.

This commit changes the core of DAHDI and also introduces proc_create_data() and
PDE_DATA() for older kernels.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Cc: Russ Meyerriecks <rmeyerriecks@digium.com>
Cc: Oron Peled <oron.peled@xorcom.com>
2013-05-24 00:30:33 +03:00
Tzafrir Cohen
40da50faed xpp: FXO: fix firmware pol-rev detection
PIC_TYPE_2 rev. 11078 fixes the polarity reversal detection support added
in rev. 11039 (949aa4958f).

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-05-23 14:50:31 +03:00
Oron Peled
ef71ce476c xpp: FXO: add a "squelch_polrev" parameter
* This will prevent *ANY* polarity reversal reporting to DAHDI.
* False by default.
* Used in some rare sites with really bad line quality.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-05-23 14:50:30 +03:00
Oron Peled
e3e35d031d xpp: FXO: common function for POLREV reporting
Refactor the XPP FXO POLREV reporting into a common function.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-05-23 14:50:30 +03:00
Shaun Ruffell
96652d88c6 wcte12xp: Reset all the framer registers when switching linemodes.
If a span was fully configured before unassigning and reassigning to a new span
type it was possible for stale values to be present in the register. When
switching from T1 to E1 via the spantype sysfs attribute this could result in a
test pattern being written.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-20 17:11:21 -05:00
Shaun Ruffell
c4a17f9442 wcte12xp: Allow non-interrupting cards to unload faster.
If a card stops generating interrupts for any reason, it can take awhile to
unload the driver while waiting for the commands to timeout. Now if there is a
problem, immediately set a bit that the card is failed so that no new commands
will be submitted.

Also, do not free and commands in submit since all commands are freed in get
results now. This prevents list/memory corruption when commands time out.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-20 17:11:21 -05:00
Shaun Ruffell
9b11847aee dahdi: Completely stop spans when unassigning.
When spans are unassigned, dahdi_span_ops.shutdown was called, but the RUNNING
flag was never cleared. Now make sure all calls to the shutdown span ops
callback are the same.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-20 17:11:21 -05:00
Shaun Ruffell
a3ad32c370 dahdi: Prevent potential error when only switching spantype of single span.
If you have a multiple span system configured for t1 mode, and you try to change
only the first span from t1 to e1 via sysfs, you could get an error in the
kernel log about trying to create duplicate channel.

The problem is that the check for whether there was enough room for the all the
channels of the switched span was wrong.

Reported-by: James Brown <jbrown@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-13 14:34:49 -05:00
Shaun Ruffell
9a7db0943b wcte12xp: Look for multiple loopup codes before setting looping up the framer.
This brings the wcte12xp driver in line with the wct4xxp driver. It also
eliminates the chance that the local side will errouneously go into loopup when
switched from E1 to T1 mode via the spantype sysfs attribute.

Internal-Issue-ID: DAHDI-1038
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-13 14:34:49 -05:00
Shaun Ruffell
db040e5cd7 wct4xxp: Allow vpm450m.c to compile against vanilla 2.6.18.
This adds definitions for bool and pr_fmt which are needed when compiling
against vanilla 2.6.18.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-09 12:53:21 -05:00
Shaun Ruffell
244f621eb1 wctdm24xxp: Fix FXO failure to detect battery CO disconnects.
In 2.6.2 I introduced an error in (41639330a "wctdm24xxp: Eliminate chance for
channel to be stuck in RED alarm.") which would get an FXO stuck in detecting an
ONHOOK event from the remote side.  An FXO port could go into the
BATTERY_DEBOUNCING_LOST_ALARM state and then back to the BATTERY_PRESENT state
without sending the dahdi_hooksig up to Asterisk.  Therefore, Asterisk would
never detect the state changes needed for a remote side disconnect.

This change adds two more states, BATTERY_DEBOUNCING_PRESENT_FROM_LOST_ALARM and
BATTERY_DEBOUNCING_LOST_FROM_PRESENT_ALARM so that the state machine does not
miss any needed transitions when going back to BATTERY_PRESENT or BATTERY_LOST
regardless of why the debounce was started.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-09 11:35:04 -05:00
Shaun Ruffell
bb5eeccef3 dahdi: Prevent memory corruption on device unload.
The channels now have embedded 'struct devices' that contain a device_private
pointer in which to store the device private data. When a device is
unregistered in the system the device privata data is freed by the device core,
even though the chan_release function doesn't free the memory
associated with the device, So when dev_set_drvdata() is called,
it's writing into freed memory.

We also need zero out the embedded struct device before registration,
since we do not have any guarantee that it points to valid memory (or, if a
channel was unregisterd with sysfs, and then reregistered without being cleared
out).  Otherwise the core could try to use the previously freed private
data again.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-08 11:48:28 -05:00
Shaun Ruffell
4641d5b396 wct4xxp: Companding on VPM needs to be changed when switching linemodes.
If a user switches linemode with sysfs, the VPM would never switch the
companding mode to alaw, and the result would be extreme static on all channels
of the span when the VPM is enabeld.

Now if the deflaw of the span has changed when an echocan is created, the
companding mode of the VPM channel is changed.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-05-06 15:42:33 -05:00
Shaun Ruffell
f65299e8b2 oct612x: Break the oct612x out into a separate library.
Soon there will be more than one driver in the source tree that will want to use
these files. Compiling it as a library speeds the build since it won't have to
be built for each driver that wants to link it in.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-05-06 15:42:33 -05:00
Shaun Ruffell
f4d9cbbfb1 dahdi: Save the current maintstat in the span before calling into the drivers.
Some of the card callbacks needed maintstat set when processing loopup codes
from the remote side. This change is a modification of commit: (6c02c3c
"dahdi-base: Minor maint mode error")

Without this change cetain cards would not properly process the loopup /
loopdown codes (I know I should have more specific information here but the
details escape me at the moment).

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-05-06 15:42:33 -05:00
Oron Peled
300446b1a1 xpp: FXO: new CID style -- passthrough
Adds support for setting a value of 3 to the module parameter
caller_id_style: passthrough - always pass and don't try to emulate
DTMFs.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-03-28 21:06:47 +02:00
Oron Peled
949aa4958f xpp: FXO: in-firmware polarity-reversal detection
PIC_TYPE_2 rev.11039 adds support for polarity reversal detection. Support
those messages.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-03-28 21:06:34 +02:00
Russ Meyerriecks
a34b846f61 dahdi: Fix unused variable compile warning
An unset conditional compile flag was triggering the unused variable compile
warning. Added the condition around the variable define.

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-03-13 16:52:03 -05:00
Russ Meyerriecks
f09daed735 Kbuild: Fix OSLEC build error
Fixes up the kbuild to work with compiling OSLEC from the kernel source. See
HOWTO here: http://forums.digium.com/viewtopic.php?t=67164

Internal-Issue-ID: DAHLIN-317
Reported-By: Vladimir Mikhelson
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2013-03-13 16:51:53 -05:00
Shaun Ruffell
d5e5b19a02 dahdi: Tear down conference links when conferences are emptied out.
Otherwise, it's possible for a link to remain in use if a process quits without
unlinking the conferences. Now when all the channels are removed from the
conference, any links are also cleaned up.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-03-07 16:19:05 -06:00
Shaun Ruffell
a4feafc124 dahdi: Restore DAHDI_CONFLINK functionality as compile time option.
This is mostly a revert of commit r9463. If you need to use DAHDI_CONFLINK
ioctl, make sure to define CONFIG_DAHDI_CONFLINK in
include/dahdi/dahdi_config.h. Apparently there were some users of CONFLINK out
there still.

It's a compile time option now since most users won't need to run the test for
conflinks in the hot-path that is the process_masterspan function.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Tested-by: Ted Gerold <ted@twg.org>
2013-03-07 16:19:05 -06:00
Shaun Ruffell
0498450db0 dahdi: Give timers their own file_operations
Trades the memory of a file_operations structure to eliminate some tests in the
timer operations.

Internal-Issue-ID: ABE-2904
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-03-07 16:19:05 -06:00
Shaun Ruffell
b6f6232441 dahdi: Decrease dahdi_timer_lock contention.
On SMP systems there isn't a need for all dahdi timers to
synchronize on dahdi_timer_lock. Instead give each timer it's own
lock to synchronize with process_timers and use dahdi_timer_lock to
protect the global list of locks.

Also, the dahdi_timers list now only contains timers that are set to
fire. This eliminates a test for each timer in the hot path of the
process_masterspan context.

Reduces system load on many-core systems which are heavy users of
DAHDI timers.

Internal-Issue-ID: ABE-2904
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-03-07 16:19:05 -06:00
Shaun Ruffell
37a783b0fe dahdi: Remove call to lock_kernel when calling unlocked_ioctl.
The Big Kernel Lock removal is no longer experimental so we can eliminate the
call to lock_kernel when calling unlock_ioctl.

Internal-Issue-ID: ABE-2904
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-03-07 16:19:05 -06:00
Shaun Ruffell
8bf0434896 wctdm24xxp: Eliminate chance for channel to be stuck in RED alarm.
There was a code patch where it was possible to get stuck in RED ALARM on a
channel when debouncing the battery states. The state transitions would look
like this:

BATTERY_PRESENT -> BATTERY_DEBOUNCING_LOST -> BATTERY_DEBOUNCING_LOST_ALARM --
(send alarm up to asterisk) --> BATTERY_LOST -> BATTERY_DEBOUNCING_PRESENT ->
BATTERY_DEBOUNCING_PRESENT_ALARM -> BATTERY_DEBOUNCING_LOST -> BATTERY_PRESENT

In the above sequence there was never any transition from
BATTERY_DEBOUNCING_PRESENT_ALARM to BATTERY_PRESENT so the alarm to Asterisk was
never cleared and the channel stayed stuck.

Now when you loose battery when in the BATTERY_DEBOUNCING_PRESENT_ALARM go all
the way back to the BATTERY_LOST state instead of the BATTERY_DEBOUNCING_LOST
state so that all the events are properly sent up.

This fixes a regression introduced in 2.6.0 with commit (r10169 "wctdm24xxp: Use
interval for debouncing FXO battery." 874b76bd22).

Internal-Issue-ID: DAHDI-1019
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-01-25 11:43:54 -06:00
Shaun Ruffell
a6be603590 wctdm24xxp: Use framecount and not jiffies when looking for battery present.
The logic to check for battery lost and battery present were using different
time bases. One was using jiffies and the other was using framecount. Since
framecount is always in milliseconds, let's use that to stay consistent.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-01-25 11:43:52 -06:00
Shaun Ruffell
85e6cdde83 wcb4xxp: Allocate memory in hfc_decode_st_state() with GFP_ATOMIC.
hfc_decode_st_state() will be called from interrupt context when the debug flag
is set to 32. Therefore, must use GFP_ATOMIC when allocating memory.

Only affects the wcb4xxp driver when called with particular debug flags set.

Internal-Issue-ID: DAHLIN-314
Reported-by: Gerald Schnabel
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-01-23 16:14:07 -06:00
Shaun Ruffell
69fb09d011 dahdi: Initialize the channels cdev structure.
This is necessary to prevent a crash when opening files by the new
device files, which do not have a valid file_operations structure.
This fixes a problem does not exist in any releases of DAHDI.

Since none of the existing tools or applications open files from the
new location of /dev/dahdi/channels/<span>/<offset>, this wasn't
seen until just recently.

Reported-by: Ted Gerold <ted@twg.org>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2013-01-22 10:08:02 -06:00
Shaun Ruffell
da0aa6f231 xpp: Do not typedef bool on RHEL 5.2 or later.
Without digging into the specifics, it looks like Red Hat Linux 5.9
removed the hex_asc definition that was previously used to determine
if the bool definition was backported.

We can simply use the RHEL_RELEASE_CODE now since we do not support any
releases before the 5 series now.

Reported-By: Vladimir Mikhelson
Internal-Issue-ID: DAHLIN-312
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2013-01-22 10:05:23 -06:00
Tzafrir Cohen
a46f906a0d Only use bus and no class for channel devices
It's wrong (and explicit oops with kernel >= 2.6.19) to set both
bus and class for the same device. But setting the class is not needed
in order to create a device. So just remove our dynamic devices from the
dahdi_class. It will only contain the fixed-named devices.

This fixes regression from cb4e4d0068.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2012-12-21 13:36:51 -06:00
Shaun Ruffell
9de213b104 wct4xxp: t4_serial_setup() was called more often than necessary.
The driver iterates through all the spans on a given device during assignment,
checking for unassigned spans, but it was erroneously testing the span on which
assigned was called.

This just removes some unexpected behavior and provides a slight performance
increase on load and does not impact the functionality of the driver as far as
I'm aware.

Reported-by: Doug Bailey <dbailey@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2012-12-21 13:22:37 -06:00
Shaun Ruffell
19cef998bd sysfs: Remove signed one-bit fields.
Eliminates the following warning from sparse:
  drivers/dahdi/dahdi-sysfs-chan.c:50:29: error: dubious one-bit signed bitfield

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2012-12-21 13:22:37 -06:00
Shaun Ruffell
f916f1e91f dahdi: Move 'timingslips' in with the other maintenance counters.
This allows timingslips to be reset along with the other counters and clarifies
the intended use.

This came up when Doug Bailey asked why he couldn't use dahdi_maint to clear
timing slips in addition to the other counters.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2012-12-21 13:22:37 -06:00
Oron Peled
00221e8bfd sysfs: new channel attr (ec_factory, ec_state)
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
2012-12-12 00:18:49 +02:00
Oron Peled
4da324d4df sysfs: stringify channels 'sigcap' attribute
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2012-12-12 00:18:49 +02:00
Oron Peled
d863af110f dahdi: sysfs: add channel attributes
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
2012-12-12 00:18:49 +02:00
Oron Peled
cb4e4d0068 dahdi: sysfs: use dynamically allocated chrdev's
* Channels have their own dynamically allocated major number
* No arbitrary limit of minor < 250 (no collision with /dev/timer, etc)
* We still have arbitrary limit of channo < DAHDI_MAX_CHANNELS
  (should be raised?)
* FIXME: need to check to FIXME's

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
2012-12-12 00:18:49 +02:00
Oron Peled
3a94ac322d dahdi: sysfs: chrdev region (not usefull yet)
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
2012-12-12 00:18:49 +02:00
Oron Peled
53219879c8 dahdi: sysfs: a channel bus (not usefull yet)
* Added minimal infrastructure:
  - A 'chan_device' member to struct dahdi_chan
  - An empty 'device_attribute' array
  - A 'bus_type' with its methods
  - A 'device_driver' with its methods
  - Initialization/Cleanup code

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
2012-12-12 00:18:49 +02:00
Shaun Ruffell
5f7ebe98da dahdi: Only watch transitions of ABIT when using E&M signalling.
This resolves an issue with a Glenayre GL3000 Paging Terminal with v8.000
software. The Glenayre would change both A and B bits to signal on/off hook
states, but there were a couple of milliseconds between when those bits changed.
This resulted in DAHDI generating an on-hook event to Asterisk before generating
the off-hook event and therefore Asterisk terminated the call prematurely.

Looking the A and B bits before this patch:

Asterisk (AB)   Glenayre (AB)
00              00                 Both sides on-hook
11              00                 Asterisk goes off hook to sieze line.
11              01                 Glenayre starts going-offhook. On-hook event
                                     sent to Asterisk from drivers since bits
                                     changed but ABIT was still 0.
11              11                 Glenayre finishes going off-hook. Off-hook
                                     event sent to Asterisk since ABIT changed
                                     from 0 to 1.
00              11                 Asterisk, processes on-hook event and goes
                                     on-hook itself to release line.
00              00                 Glenayre releases line. Call fails.

After this patch:

Asterisk (AB)   Glenayre (AB)
00              00                 Both sides on-hook
11              00                 Asterisk initiates call
11              01                 Glenayre starts handling call. No event is
                                     sent to Asterisk since only ABIT is checked.
11              11                 Glanayre finishes going off-hook. Call
                                     proceeds normally.

Internal-Issue-ID: DAHDI-1009
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2012-12-11 10:27:57 -06:00
Shaun Ruffell
ef065a5e2a Revert "dahdi_dynamic_eth: Move tx packet flushing to process context."
dahdi_dynamic now always calls the flush function in softirq context so packet
flushing no longer needs to be pushed off to process context since interrupts
are enabled.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2012-12-11 10:27:56 -06:00
Shaun Ruffell
f44b252472 dahdi_dynamic: Use a tasklet for flushing dynamic drivers.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2012-12-11 10:27:56 -06:00
Tzafrir Cohen
6a3163e05c xpp: pre/post_unregister: not for the EC
Don't run the pre- and post-unregister hooks on a non-phone XPD
(practically: the echo canceller). This fixes a panic with manual
'dahdi_registertion off' as it is now called for the whole device
(regression of 2.6.x).

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10735 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-11-15 13:40:56 +00:00
Shaun Ruffell
abad4b4479 wct4xxp: EC channel calculation in TONEDETECT assumes TE820.
Since r10290 "wct4xxp: Add support for TE820 and VPMOCT256." [1],
the TONEDETECT ioctl was not calculating the VPM channel correctly
on non TE820 cards. This fixes a regression first introduced in
2.6.0.

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=10290

Internal-Issue-ID: DAHLIN-302
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10733 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-10-04 20:24:55 +00:00
Shaun Ruffell
dea3d51b24 dahdi: Running without the Big Kernel Lock (BKL) is no longer experimental.
The warning was originally added in r9721 "dahdi: Experimentally
remove dependency on the Big Kernel Lock." [1].

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=9721

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10732 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-10-04 20:24:46 +00:00
Russ Meyerriecks
b73e870a3a dahdi: Remove 'getlin_lastchunk' from struct dahdi_chan.
'getlin_lastchunk' has not been used since r65 "Version 0.1.6 from FTP" [1]

One less thing to think about...

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=65

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10731 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-10-04 20:24:42 +00:00
Shaun Ruffell
da8b96d725 dahdi: Remove unused 'rxbufpolicy' and 'rxdisable' from dahdi_chan.
Since r5021 [1], first released in DAHDI-Linux 2.2.0, it's been impossible for
user space to change the rxbufpolicy. This hasn't caused any problems and it's
safe to remove a few more of the vestiges of the rxbufpolicy from the driver.

This streamlines the code path in a few places and saves 8 bytes from the size
of struct dahdi_chan.

The user visible parts are maintained and will indicate
DAHDI_POLICY_IMMEDIATE, like it has since 2.2.0.

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=5021

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10730 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-10-04 20:24:37 +00:00
Shaun Ruffell
d349fe62fe wctdm24xxp: Set dahdi_span.spantype to SPANTYPE_ANALOG_MIXED.
Since r10683 "convert span->spantype to enumerated type" [1] the spantype was
changed from a string provided by the board drivers to an enumerated type that
is handled by the core of DAHDI. This was done to simplify the task of
dahdi_genconf since there is only one place to look for the valid strings that
can be exported in sysfs.

This eliminates the following warning on driver load:
  Warning: Span %s didn't specify a spantype. Please fix driver!

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=10683

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10729 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-10-04 20:24:33 +00:00
Shaun Ruffell
ba595821ce 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 <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10728 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-10-04 20:24:29 +00:00
Shaun Ruffell
25ce85e770 dahdi: Filter 'HWEC' from DAHDI_GETVERSION results if hwec is really not present.
Internally in DAHDI there is always a hardware echocan factory registered and
available. Having this factory always registered allows for DAHDI to work in a
backward compatible fashion. Namely, by default DAHDI will always use a hardware
echocan if one is available unless 'hwec_overrides_swec' dahdi module parameter
is set to 0 on load. However, if there were no real hardware echocans available
in the system dahdi would still report "Echo Canceller(s): HWEC" in the
dahdi_cfg -v output since the hwec factory is always there.

After this change dahdi_cfg will no longer report HWEC as one of the available
echocans if there isn't a physical span present that actually has a hardware
echocan.

Internal-Issue-ID: DAHLIN-300
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10727 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-10-04 20:24:24 +00:00
Shaun Ruffell
84e70cdac5 wctdm24xxp: Only two polarity reversals are needed to validate RING on FXO ports.
This fixes a regression introduced in commit r10186 "wctdm24xxp: Use time
interval for debouncing FXO ring detect." [1] which was first released in
DAHDI-Linux 2.6.0. This only affects users with analog trunks whose providers do
not present 4 polarity reversals on the ring signals. The reporter of this issue
is based in South Africa.

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=10168

In prior versions, the ring detector did not check for polarity reversals, only
the presence of ringing voltage unless fwringdetect or neonmwi_monitor mode was
set, and even when one of those modes were set, the driver only needed two
reversals to validate a ring. This commit allows the driver to always stay in
fwringdetect mode but restores the requirement for only two reversals.

Also included in this commit is a change to ensure that ringing is not reported
when debouncing lost battery which can happen when voltage is swinging through
0.

Reported-and-Tested-by: Jaco Kroon <jaco@uls.co.za>
Internal-Issue-ID: DAHLIN-298
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10719 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-09-21 18:16:35 +00:00
Russ Meyerriecks
6c02c3c156 dahdi-base: Minor maint mode error
The previous maint state was saved regardless if the base driver returned an
error or not. This caused strange behavior in dahdi tools. Moved the maint
state save to after the switch case to reflect this.

https://issues.asterisk.org/jira/browse/DAHDI-984

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10718 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-09-21 18:16:30 +00:00
Shaun Ruffell
7e614f4d29 wcte12xp: Fix stack corruption when checking T1 RBS states.
This fixes an (embarrassing) error in t1_check_sigbits in the previous commit
where I was writing pass the end of an array on the stack.

Now instead of using an array on the stack, of which all elements were not used,
the pending commands are now stored on a list. I also removed the automatic free
of commands from __t1_getresults and now the function that allocated the command
now frees them.

I believe this will be less error-prone going forward.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10700 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-07-11 16:13:22 +00:00
Shaun Ruffell
24ed250673 wcte12xp: Fix pulse digit detection when set for FXO signalling modes.
The frequency that the RBS registers were polled was too slow to catch the pulse
dialing digits. The result was that often times dahdi would generate WINK events
instead of PULSEDIGIT events.

This speeds up the rate at which the registers are checked from 100ms to 33ms
and also makes the process of checking the registers quicker by queing up all
the reads at once.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10699 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-06-26 17:10:54 +00:00
Shaun Ruffell
3d89ef975c wcte12xp: Allow default_linemode to be set to j1.
To enable J1 mode previously one would configure the card in T1 mode and then
set the j1mode module parameter. Now "modprobe wcte12xp default_linemode=j1"
will work like the other linemodes globally for all cards manged by this driver.
J1 can also be set on a card-by-card basis in sysfs.

Also move pr_fmt to top of file so pr_xxx macros print the module name as
intended.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10696 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-06-22 17:59:37 +00:00
Shaun Ruffell
eecf45cf5f wcte12xp: Destroy the cache if the linemode is not recognized.
Fixes the following errors when running:
  # modprobe wcte12xp default_linemode=blah; modprobe wcte12xp default_linemode=blah

'blah' is an unknown span type.kmem_cache_create: duplicate cache wcte12xp

Call Trace:
 [<ffffffff800394cf>] kmem_cache_create+0x572/0x5ac
 [<ffffffff800a926e>] __link_module+0x0/0x18
 [<ffffffff80064624>] __down_read+0x12/0x92
 [<ffffffff8002224d>] __up_read+0x19/0x7f
 [<ffffffff8818b01f>] :wcte12xp:te12xp_init+0x1f/0xde
 [<ffffffff800a9e37>] sys_init_module+0xbd/0x206
 [<ffffffff8005d28d>] tracesys+0xd5/0xe0

Reported-by: James Brown <jbrown@digium.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10695 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-06-22 17:59:34 +00:00
Oron Peled
76ce8d5951 xpp: usermode_helper() bugfix for kernels >= 3.3.0
* UMH_WAIT_PROC semantics (and value) was changed from enum to
  a bitmask (via #define)
* This constant was missing from kernels older than 2.6.23

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10692 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-06-21 17:34:09 +00:00
Shaun Ruffell
e903273e3c dahdi_ioctl_spanstat() backward compat hack
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10686 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-05-23 12:39:07 +00:00
Shaun Ruffell
1058502286 sysfs: refactor lineconfig string representation
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10685 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-05-23 12:36:42 +00:00
Shaun Ruffell
bb2c15c103 sysfs: add a linecompat span attribute
This way, dahdi_genconf may gather needed information without issuing
ioctl()'s

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10684 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-05-23 12:35:56 +00:00
Shaun Ruffell
579132bb89 convert span->spantype to enumerated type
* This is a minimal convertion -- everything compiles and looks OK.
* We print a warning for spans registering without a spantype.
* Low-level drivers may later want (but not required)
  to fold their internal representations to this canonical
  representation -- it will save code and make it more readable.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10683 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-05-23 12:20:23 +00:00
Doug Bailey
b7081c2b45 Assign NULL values to pointers to insure that future kfree calls do not cause errors.
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10678 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-27 19:36:55 +00:00
Shaun Ruffell
e8e460af8a wcb4xxp: Fix typo in last commit that broke compilation.
I failed to compile test r10661 and introduced a typo when fixing a
checkpatch.pl warning.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10662 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-18 00:17:15 +00:00
Matthew Fredrickson
d6c9c4c9da wcb4xxp: Support for when network side deactivates layer1.
This is a port of the functionality in the wctdm24xxp driver to support power
savings modes. Specifically, if the the network side of a BRI spans deactivates
the span to save power, the B410P  previously automatically activated it again.
Now, if persistentlayer1=0 module parameter is set, the span will be allowed to
stay deactivated until layer two has a message to send on the dchannel.

This patch does not change any of the default behavior of the B410P driver and
the defaults for the persistentlayer1 option is inconsistent with that of the
B400M modules in the wctdm24xxp driver.

Internal-Issue-ID: ABE-2845
From: Matthew Fredrickson <creslin@digium.com>

[ Minor formatting, exposed the persistentlayer1 as module parameter, changed
defaults for teignorered, alarmdebounce, and persistentlayer1 to match current
defaults in wcb4xxp driver ]

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10661 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-18 00:12:06 +00:00
Shaun Ruffell
5cbf189ec4 xpp: Fix compilation when CONFIG_DAHDI_WATCHDOG is defined.
Looks like a hold over from when dahdi_span_ops was first implemented in r8985
"dahdi: Move the callbacks in dahdi_span into its own structure" [1].

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=8985
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10658 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-11 20:09:44 +00:00
Mike Sinkovsky
d70f59d6e0 dahdi: Fix compilation when CONFIG_DAHDI_WATCHDOG is defined.
From: Mike Sinkovsky <msink@trikom.ru>

Internal-Issue-ID: DAHLIN-288
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10655 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-11 17:39:31 +00:00
Tzafrir Cohen
199cd70d2c FPGA_1161.201.hex rev 10545: fix reset of XR1000
Previous commit (r10649) included an incorrect version. Including full message
from that commit for the description.

rev. 10502 of the FPGA firmware for the new E-Main rev. 4 fixes a potential
issue when used on Xorcom XR1000 systems: an issue with the power supply may
cause the unit to reset.

Note that there is no issue with previous models, with a normal setup of an
Astribank, or other XRx000 systems.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10652 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-11 09:06:29 +00:00
Tzafrir Cohen
432e83165c FPGA_1161.201.hex rev 10532: fix reset of XR1000
rev. 10502 of the FPGA firmware for the new E-Main rev. 4 fixes a potential
issue when used on Xorcom XR1000 systems: an issue with the power supply may
cause the unit to reset.

Note that there is no issue with previous models, with a normal setup of an
Astribank, or other XRx000 systems.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10649 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-10 21:36:43 +00:00
Shaun Ruffell
a1c4dfb99c wcte12xp, wctdm24xxp, wct4xxp: Print warning about potential GPL violation w/HOTPLUG_FIRMWARE=no.
Print a warning message that it may be a GPL violation to redistribute these
binaries if the firmware for the VPMOCT032/64/128/256 is compiled in.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10646 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-05 20:32:37 +00:00
Shaun Ruffell
b0801b23e8 wcb4xxp: Remove asm/system.h include.
Not needed anymore and will break compilation on Kernel versions >= 3.4 since
commit 0195c00244dc2e [1]

[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=0195c00244dc2e

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10641 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-05 16:15:27 +00:00
Shaun Ruffell
3d52bdd52f dahdi_dummy: Include timer.h instead of time.h
It appears that some kernel configurations do not include timer.h in any of
the include files that are included by dahdi_dummy. The timer_structs are
defined in timer.h and not time.h, so this change is correct even though I
never could find a configuation myself that actually failed to compile.

This has negligible impact since dahdi_dummy is not compiled by default.

Internal-Issue-ID: DAHLIN-185
Reported-by: Steve Murphy
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10640 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-05 16:15:22 +00:00
Shaun Ruffell
f800ac611f dahdi: Fix compilation when CONFIG_DAHDI_NET is defined.
'irq' field was removed from dahdi_span in r10276 "dahdi: Remove
dahdi_span.irq and move dahdi_span.irqmisses into dahdi_device." [1]
which was first released in dahdi-linux 2.6.0.

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=10276

Reported-by: Pavel Selivanov
Internal-Issue-ID: DAHLIN-278
Patches: hdlc.patch by Pavel Selivanov (license #5420)
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10634 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-03 21:54:34 +00:00
Shaun Ruffell
8b3870e6a7 dahdi: Fix compilation when CONFIG_DAHDI_ECHOCAN_PROCESS_TX is defined.
'ec_state' was renamed to 'dahdi_echocan_state' in r6529 [1] but support for
CONFIG_DAHDI_ECHOCAN_PROCESS_TX was first committed in r9442 [2]. So it
appears that I never compiled tested this exact commit when it went in for the
2.5.0 release.

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=6529
[2] http://svnview.digium.com/svn/dahdi?view=revision&revision=9442

Reported-by: Pavel Selivanov
Internal-Issue-ID: DAHLIN-279
Patches: ec.patch uploaded by Pavel Selivanov (License #5420)
[ edited the patch slightly for minor formatting ]
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10633 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-03 21:54:29 +00:00
Shaun Ruffell
347fe2b225 dahdi_dynamic_loc: Change and check the dyn->pvt pointer under lock.
Fixes a crash on unload if the sync_tick callback was running at the same time
the dynamic local span was destroyed. It was possible for
dahdi_dynamic_local_transmit to dereference a pointer that may have already
been freed.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10627 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-03 19:44:45 +00:00
Shaun Ruffell
034818dd81 dahdi_dynamic_eth: Make ztdeth_exit() symetrical with ztdeth_init() and fix race on unload.
Minor change to follow generally recommended practice. Prevents new packets
from being queued up for devices when they are about to be cleaned up. Also
clean up any skbs that may still be on the queue after unloading.

Also closes anoter potential kernel oops on module unload. It was possible to
delete the private structure while the master span process was running. The
result was an attempt to page memory from interrupt context.

Make sure that the pvt function is set and cleared under the zlock. Also do
not assume that the pvt pointer is valid in ztdeth_transmit.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10626 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-03 19:44:41 +00:00
Shaun Ruffell
9c0bb57efb dahdi_dynamic: Close race on unload if red alarm timer was running when unloaded.
I saw a kernel oops that was the result of the timer running after the
dahdi_dynamic module was unloaded. Now we wait for the timer to complete, and
then delete it again in case it reactivated itself.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10625 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-03 19:44:37 +00:00
Shaun Ruffell
d46ad9bca1 dahdi_dynamic: Remove calls to __module_get().
The board drivers are the ones calling the unregister function, and
therefore we do not need to worry about them unloading while calling the
destroy callback.

When destroying spans with the ioctl, replace __module_get() with
try_module_get. This avoids hitting a BUG in module_get on kernel versions <
2.6.29.

ALSO move the call to try_module_get out of the dahdi_dynamic_release function
and into destroy. This way if the destroy callback isn't called because the
dynamic driver is unloading the dynamic device can be left on the list to be
cleaned up by the dahdi_dynamic_unregister_driver function().

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10624 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-03 19:44:33 +00:00
Shaun Ruffell
4ee22f19d1 dahdi_dynamic: Do not call into dahdi_dynamic without holding reference.
Instead of registering a function pointer, register a dahdi_dynamic_ops
structure that contains the owner as well as the ioctl callback. This way
dahdi.ko can bump up the reference count on dahdi_dynamic.ko before calling
the ioctl callback.

Also, use the registration mutex to guard against the module being unloaded
between the time the structure pointer was checked, and the module reference
is taken.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10623 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-03 19:44:27 +00:00
Shaun Ruffell
7e9491bce1 wctdm24xxp, wcte12xp: Allow VPMOCT032 firmware to be compiled into driver.
Enables the driver to update firmware on systems that do not have the firmware
loader configured / enabled (Linux config option CONFIG_FW_LOADER). Compiling
the firmware into the driver increase the memory footprint by around ~440K.

Internal-Issue-ID: DAHDI-963
Reported-and-Tested-by: Guenther Kelleter
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10618 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-02 13:58:11 +00:00
Shaun Ruffell
eab20e05cb Remove Makefiles that are only needed on kernels < 2.6.9
Newer versions of kernel build system do not require these Makefiles and
support for kernels older than 2.6.9 are no longer supported by DAHDI.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10617 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-04-02 13:58:03 +00:00
Shaun Ruffell
0cd7f34201 wctdm24xxp: Remove forward declaration of inline for GCC 3.4.4
GCC 3.4.4 does not allow forward declaration of inline functions.

Internal-Issue-ID: DAHLIN-286
Reported-by: Guenther Kelleter
Patches: wctdm24xxp-inline.patch uploaded by Guenther Kelleter (License #6372)
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10613 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-29 15:25:23 +00:00
Shaun Ruffell
ed60a36854 wct4xxp: Trivial formatting changes around request_irq.
Quiet some checkpatch warnings introduced by the last patch. I kept this
separate since it may have obscured the real change made in the previous
commit if combined.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10590 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-22 18:31:22 +00:00
Shaun Ruffell
2b60d3b8e0 wct4xxp: Disable all interrupts explicitly in interrupt handler.
The driver makes the assumption that interrupts are disabled but this cannot
be guaranteed. We'll explicity disable interrupts on the local processor while
the interrupt handler is running.

This eliminates the "IRQF_DISABLED is not guaranteed on shared IRQs" warning
when loading the driver.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10589 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-22 18:31:17 +00:00
Shaun Ruffell
b69830b3d3 dahdi_dynamic_eth: Fix compilation on kernels < 2.6.22.
Resolves the follwing build error:
  drivers/dahdi/dahdi_dynamic_eth.c: In function ‘ztdeth_exit’:
  drivers/dahdi/dahdi_dynamic_eth.c:448: error: implicit declaration of function ‘cancel_work_sync’

RHEL kernel versions 2.6.18-238 (5.6) and greater had cancel_work_sync()
backported which is what I did my original smoke test on.

Reported-by: Oron Peled <oron.peled@xorcom.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10588 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-22 18:31:13 +00:00
Shaun Ruffell
e54f0189a7 dahdi_dynamic_eth: Prevent crash is packet arrives before span is fully configured.
It was possible after a dynamic ethernet span was created for a packet to come
in before the dahdi_span was fully initialized. The result would be a NULL
pointer dereference. Now just discard any packets that might come in during
this time window.

Internal-Issue-ID: DAHLIN-280
Reported-by: Pavel Selivanov
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10587 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-22 18:31:08 +00:00
Oron Peled
59caf11dbe xpp: FXS: added a 'lower_ringing_noise' parameter
* Adds a new parameter, 'lower_ringing_noise', to module xpd_fxs.

* Makes the "power-down" behaviour that was added
  in upstream svn r10478, switchable in runtime.

* By default (false), makes the vbat_h behave like it did
  before the power-down change.
  - I.e: vbat_h is held throughout the ringing period (during
    both ring-up/ring-down)
  - So this patch revert part of r10478

* When switched to true, activate the "power-down" behaviour.
  - I.e: vbat_h follows the ring-up/ring-down.
  - This behaviour lowers the noise caused by group ringing of
    FXS channels in the same unit, but causes problems with CallerID.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10574 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-21 20:18:26 +00:00
Oron Peled
8aad29e4de xpp: FXS: atomic vbat_h power handling
* In do_chan_power() make vbat_h changes atomic.
* As a result we can ignore duplicate requests.
  This will allow cleaner logic in the next commit.
* Added proper debug messages.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10573 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-21 20:17:14 +00:00
Shaun Ruffell
3e1c317323 dahdi_dynamic: Since dynamic devices are 'parentless' we must name them.
This in conjunction with r10449 "A parent-less device should not crash dahdi",
this allows dahdi_dynamic spans to work post the dahdi_devices changes in
2.6.0.

The full address of the device is not used since kernels prior to 2.6.31 limit
the length of a devicename to 20 characters.  The full address of the device
can be pulled out of the "hardware_id" and "type" fields of the span.

This patch is just to get things working again. dahdi_dynamic devices *may*
still have issues if the auto_assign_spans module parameter is 0.

Internal-Issue-ID: DAHLIN-280
Reported-by: Pavel Selivanov
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10563 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-21 18:56:21 +00:00
Shaun Ruffell
4769ee67cd dahdi_dynamic_eth: Move tx packet flushing to process context.
The masterspan can be, and often is, called with interrupts disabled but
dev_queue_xmit() needs to be called with interrupts enabled. This potentially
fixes a deadlock.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10562 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-21 18:56:16 +00:00
Shaun Ruffell
bf4919e46b Update Digium copyright on files changed since beginning of the year.
In addition to updating the year, this also adds some boilerplate to
dahdi-sysfs.c and dahdi-sysfs-chan.c that wasn't there previously.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10560 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-21 18:56:05 +00:00
Shaun Ruffell
aa8bd2f546 wct4xxp: __t4_frame_in and __t4_framer_out slowdowns.
This is a partial revert of r10234 "wct4xxp: __t4_framer_in and
__t4_framer_out speedups."

There were some platform + firmware version combinations that would fail to
properly configure the framer with the aforementioned speedups. The originally
reported sympton was that interrupts would fail to start and while
troubleshooting I also saw cases where one of the spans would stay in alarm
after starting. By adding in additional reads to the version register, the
overall process of writing / reading from the framer control registers is
slowed down which increases reliability.

This change does *not* affect the main path of TDM data which is DMAed
directly into buffers in host memory and are not read / written to / from
framer registers directly.

Reported-and-Tested-by: Vahan Yerkanian <vahan@arminco.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10559 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-21 16:34:06 +00:00
Shaun Ruffell
0f61ab172d wct4xxp: Add compile-time option to disable ASPM for PCIe devices.
Certain BIOSes appear to enable ASPM even though it is not fully supported by
the platform. Also, since the PCIe links for TDM cards are always in use it
does not make sense to allow them to transition to the disabled state.

Just turn off power management on the PCIe links completely. For more
information see http://lwn.net/Articles/449448/.

Internal-Issue-ID: DAHLIN-283
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10558 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-21 16:34:02 +00:00
Shaun Ruffell
2c97dd21bd wcte12xp, wctdm24xxp: Add compile-time option to disable ASPM for PCIe devices.
Certain BIOSes appear to enable ASPM even though it is not fully supported by
the platform. Also, since the PCIe links for TDM cards are always in use it
does not make sense to allow them to transition to the disabled state.

Just turn off power management on the PCIe links completely. For more
information see http://lwn.net/Articles/449448/.

Internal-Issue-ID: DAHLIN-283
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10557 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-21 16:33:57 +00:00
Shaun Ruffell
da11ba2f0f dahdi: Add dahdi_pci_disable_link_state for kernel < 2.6.25.
Will allow the ASPM (Active State Power Management) state to be disabled on
PCIe devices before kernel version 2.6.25.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10556 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-21 16:33:51 +00:00
Tzafrir Cohen
b278ce23b5 xpp: firmwares: useless 0x1A at EOF
Remove a mostly harmless 0x1A (^Z) at the end of the file. If you
add a NL after it, it breaks the firmware loading.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10550 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-20 10:53:39 +00:00
Tzafrir Cohen
857801bd37 xpp: also install the new .201 fixrmware files
The Makefile changes needed to install the two new files.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10536 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-18 15:35:11 +00:00
Tzafrir Cohen
f26bd63c6c xpp: firmwares to support E-Main 4
USB firmware (USB_FW.201.hex 10402) and FPGA firmware
(FPGA_1161.201.hex 10480) with support of the new E-Main 4 Astribank
mainboard.

(This was accidentally labeled as 'E-Main 3' in some previous commit
messages)

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10535 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-18 14:49:58 +00:00
Tzafrir Cohen
e2bf7013ef xpp: USB_FW rev 10401: minor 6FXS/2FXO caps issue
Fixes an issues with the 6FXS/2FXO module: if an extra FXS or FXO module
is added to a system with such a module, an excessive number of port
licenses was accidentally required (as if the 6FXS/2FXO module required
8FXS/8FXO licenses).

Internal-Issue-ID: #1371
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10534 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-18 14:46:57 +00:00
Shaun Ruffell
92e2020fd2 dahdi_dummy: Fix compilation since dahdi-linux 2.6.0.
Even though dahdi_dummy is no longer built by default, the adoption of
dahdi_devices in 2.6 broke the ability to compile. This was not intended as
there are some packagers who still patch the Kbuild file to enable
dahdi_dummy.

Internal-Issue-ID: DAHLIN-274
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10486 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-15 16:01:22 +00:00
Shaun Ruffell
d1be14acf2 xpp: '%d' -> '%lu' when displaying module_refcount on kernel versions >= 3.3
Upstream commit bd77c047 "module: struct module_ref should contains long
fields" changed the return of module_refcount from int to unsigned long. This
change eliminates a warning from the string format specifier.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10485 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-15 15:41:40 +00:00
Shaun Ruffell
59197c5112 xpp: Use 'bool' type for boolean module parameters on kernel versions >= 2.6.31.
Eliminates warnings that are a result of upstream commit 72db395ffa
"module_param: check that bool parameters really are bool."

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10484 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-15 15:41:36 +00:00
Shaun Ruffell
07c9bcecf2 dahdi: Remove __exit annotation from dahdi_sysfs_exit().
This removes the following warning:

Section mismatch in reference from the function init_module() to the function .exit.text:dahdi_sysfs_exit()
The function __init init_module() references a function __exit
dahdi_sysfs_exit(). This is often seen when error handling in the init
function uses functionality in the exit path.  The fix is often to remove the
__exit annotation of dahdi_sysfs_exit() so it may be used outside an exit
section.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10483 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-15 15:41:32 +00:00
Shaun Ruffell
2da38234d6 dahdi: Use monotonic clock for coretimer.
DAHDI internal timing currently uses the "wall clock" to determine how much
time is passing for mixing and timers. When the wall time changes, like when
the system time is set via ntp or date, DAHDI currently will display a
"Detected time shift" message since it believes there is too much audio to
mix. There may also be audio problems if the wall time is shifting
occasionally due to slewing of the clock.

Now use a monotonic clock to determine how much real-time has passed for
timing purposes. This makes DAHDI insensitive to any changes in the wall time
on the system.

This only applies when using DAHDI's internal timer like when there are not
any telphony cards installed. There are still potential audio problems if the
platform is unable to accurately determine the passage of time.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10482 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-15 15:41:27 +00:00
Oron Peled
791a701524 xpp: FXS: improve fxs_info output layout
* Rotate the channels table in /proc/xpp/XBUS-*/XPD-*/fxs_info
  - This way we don't overflow 80 columns
  - Can also add more info items per-channel
* Linearize LED output for easier grep'ping

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10479 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-15 12:53:07 +00:00
Oron Peled
12e2626351 xpp: FXS: better power-down to lower noise
* Now every linefeed control command which is not RING'ing
  powers-down the SLIC. This reduce audible noise when
  several channels are ringing.

* Simplify code by removing redundant calls to do_chan_power()
  before linefeed_control()

* Manage vbat_h state so we skip do_chan_power() calls when
  there isn't a state change

* Export vbat_h state to /proc/.../fxs_info

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10478 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-15 12:52:32 +00:00
Oron Peled
1fbf6d8562 xpp: BRI: make it always SYNC_MODE_AB (like PRI)
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10477 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-15 12:52:07 +00:00
Oron Peled
bb63d03bba xpp: PRI/BRI: fix channels opening/closing:
* If a DAHDI_AUDIO_NOTIFY is issued, offhook the channel
   (added to BRI).

 * If D-channel is closed, onhook all channels (added to PRI)

 * If a clear channel is closed and the D-Channel is not
   open (e.g: with patgen/pattest), onhook this channel
   (added to both BRI and PRI)

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10476 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-15 12:51:22 +00:00
Oron Peled
40d3c42686 xpp: init_card: better variable naming
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10475 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-15 12:50:49 +00:00
Oron Peled
ee8bc184da xpp: reset Astribank SPI busses
* A driver reload should reset Astribank hardware
* This patch send an SPI reset after we get AB_DESCRIPTION reply from Astribank

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10474 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-15 12:49:55 +00:00
Shaun Ruffell
e07a70f403 wctdm24xxp: Shorten RINGOFF debounce interval from 512ms to 128ms.
In commit r10168 "wctdm24xxp: Use time interval for debouncing FXO ring
detect" [1], I inadvertently changed the debounce interval of the RINGOFF
event from 128ms to 512ms. The result was a potential failure to detect CID,
depending on line conditions, since Asterisk would bump the rx gains on the
channel in the middle of the CID spill as opposed to before the CID spill.

This fixes a regression first introduced in DAHDI-Linux 2.6.0.

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=10168

Internal-Issue-ID: DAHDI-951
Reported-and-Tested-by: Jack Wilson <ljwilson@digitalav.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10473 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-13 22:12:37 +00:00
Oron Peled
fc1824fd3c Remove support for kernels < 2.6.18
This patch removes support for kernel versions < 2.6.18, as those are
not actively supported in any major Linux distribution (except RHEL4,
which is in the "extended" support level of the product life cycle).

This removes much of the more #ifdef-rich parts of the code.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Acked-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10472 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-03-13 20:09:12 +00:00
Oron Peled
308a773fb2 sysfs channels: cleanup device files handling
* Shortcut CLASS_DEV_CREATE/CLASS_DEV_DESTROY. No need to pass repetitive
  data (and NULL) on every call.

* Create/remove fixed device files (ctl, timer, channel, pseudo) via
  generic code (fixed_devfiles_create()/fixed_devfiles_remove()) instead
  of repetitive code and flags.

* Try to make all removal/cleanup functions idempotent, so we can
  safely call them on any failure without the need for multiple goto
  destinations.

* Rename 'device_state_flags' to 'should_cleanup' and its member
  flags to a better/consistent naming.

* Rename dahdi_sysfs_exit() to dahdi_sysfs_cleanup() and call it from
  a new proper dahdi_sysfs_exit()

* In dahdi_sysfs_init(), handle dahdi_sysfs_chan_init() failures

* Add dahdi_dbg() message before creating/removing all DEVICES
  objects.

* Also move two KERN_INFO messages to a more correct locations:
  - The version reporting should be first (in dahdi-base.c)
  - The "Telephony... on major" reporting should be at the end
    of dahdi_sysfs_init()

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10464 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-02-22 12:12:10 +00:00
Oron Peled
56a3c35273 sysfs channels: dahdi-sysfs-chan.c
* Move sysfs class and device files management into dahdi-sysfs-chan.c
* This does not change functionality, just a preparation for later
  code cleanups and improvements.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10463 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-02-22 12:11:48 +00:00
Oron Peled
6b59211b3d sysfs channels: refactor compat macros
* Refactor all kernel version compatibility macros that relate
  to sysfs and device files to new header: dahdi-sysfs.h
* No functional change.
* Preparing for a refactor channel device file handling into a new
  source file.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10462 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-02-22 12:11:23 +00:00
Oron Peled
3df0b7aedc sysfs: add 'lineconfig' attribute to span
This patch exposes the span 'lineconfig' via sysfs: textual representation
of the framing and coding of the span.

This is needed in order for the Dahdi perl classes (in tools) to get
the inforamtion for e.g. dahdi_genconf to work without the guesswork of
parsing /proc/dahdi .

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10461 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-02-22 12:10:59 +00:00
Oron Peled
84b9b4c84a dahdi: build fix for Kernels < 2.6.16
* Fixes building for kernels < 2.6.16 (and some older Centos 4 ones).
* Broken by http://svn.asterisk.org/svn/dahdi/linux/trunk@9721
  (Jan-2011)

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10460 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-02-09 15:25:33 +00:00
Oron Peled
1c6d3ad23c code cleanup: remove unused debug_printk()
The dahdi_echocan_* modules had an unused debug_printk() macro. Remove
them because:

* They were unused
* There were multiple definitions
* They were unsafe. Someone doing an
    if(foo)
      debug_printk(...);
    else
      do_something();
  may be surprised ;-)
* They used 'debug' as a debug level, while the rest of DAHDI debug
  macros treat it as a bit-field.

Leave only a single definition in wcte12xp/base.c which is safe.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10459 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-02-09 15:25:03 +00:00
Oron Peled
9f37999c19 code cleanup - refactor module_printk()
* Remove multiple definitions
* Move canonical one to include/dahdi/kernel.h

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10458 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-02-09 15:24:40 +00:00
Tzafrir Cohen
4762177be0 USB_RECOV.hex: recovering from xpp hardware issues
USB_RECOV.hex, rev. 9760. It may be used to recover from certain
issues of the USB controller of the Astribank (when an Astribank
is not detected as such) by Support staff.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10455 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-02-07 21:50:04 +00:00
Oron Peled
8e22110bfd fix class_create() return value test
In case of error class_create check IS_ERR()/PTR_ERR() and not for NULL.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10453 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-25 22:02:37 +00:00
Oron Peled
3cf9003a26 xpp: FXO: improve ring debounce notice
* Less jargon.
* Fixes calculation: shows time passed rather than remaining time.
* Closes xorcom #1398.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10452 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-25 22:02:08 +00:00
Oron Peled
7c8586d4f1 show Master change to/from core timer
show Master change to/from core timer if DEBUG_MAIN (GENERAL) flag is on.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10451 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-25 21:19:45 +00:00
Oron Peled
ed6def895b A channel-less span should not crash dahdi
* Always check span->channels before accessing span->chans[0]
* Clean one dev_notice() text that accessed span->chans[0]
* Check channels in basechan_show() sysfs attribute

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10450 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-25 21:18:25 +00:00
Oron Peled
b8b7b86332 A parent-less device should not crash dahdi
* A parent-less device should not crash dahdi:
  - Access span->parent->dev instead of span->parent-dev.parent
    in soem cases.
  - Access span->parent->dev via new inline span_device()
  - Use span_device() in all dahdi_dev_{dbg,info}()

* Allow low-level drivers to set their device name.
  - Drivers that don't use this feature get the default name
    based on the parent device name
  - Parent-less devices which don't set their name, fails
    to register with -EINVAL

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10449 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-25 21:18:00 +00:00
Oron Peled
57e827b2f4 remove a duplicate dev_set_name()
Remove duplicate definition from dahdi-sysfs.c

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10447 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-25 21:17:10 +00:00
Tzafrir Cohen
b79e172d23 Astribank I firmwares rev. 7107
A slightly newer firmware (Xorcom rev. 7107) for older (non Astribank
II) Astribank modules. Was accidentally left uncommited. Includes minor
bug fixes.

No change for any relatively recent (Astribank II) Astribank.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10443 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-25 18:34:43 +00:00
Tzafrir Cohen
f76ebe2d75 Build OSLEC EC if in the tree
Build the OSLEC echo canceller (drivers/staging/echo and
dahdi_echocan_oslec) if the code of oslec is present in the tree.

Also closing another issue regarding documentation of building OSLEC,
as it is now even clearer than before.

Patch has been used in the Debian package for quite some time.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

(closes issue DAHLIN-110)
Reported by: biohumanoid (Pavel Selivanov)
Patches:
     oslec_auto.diff uploaded by tzafrir (license 5035)

(closes issue DAHLIN-261)

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10440 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-17 14:26:25 +00:00
Oron Peled
ad60b833e8 dahdi: style - checkpatch clean dahdi-sysfs.c
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10439 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-12 18:40:15 +00:00
Oron Peled
8228de4d11 xpp: style - remove extra braces
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10438 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-12 17:14:15 +00:00
Oron Peled
2f03aa8bcb xpp: style - kfree() is NULL safe
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10437 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-12 17:13:41 +00:00
Oron Peled
9e541045d9 xpp: style - add const to file_operations
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10436 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-12 17:13:15 +00:00
Oron Peled
a28ffb3af5 xpp: style - manual whitespace/line-breaks cleanup
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10435 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-12 17:12:48 +00:00
Oron Peled
0244106553 xpp: style - one macro cleanup
* Wrap in do {} while(0)
* Move closer to its use (it's #undef'ed anyway after this section)
* Also re-organize line-breaking in the same code section

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10434 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-12 17:12:15 +00:00
Oron Peled
f9fb9622ec xpp: style - no more typedef byte
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10433 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-12 17:11:46 +00:00
Tzafrir Cohen
bb5b3a6de4 xpp: style: fix an improper line break.
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10432 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-11 20:33:03 +00:00
Oron Peled
cc083d440f xpp: style - place EXPORT_SYMBOL() (manually)
Manually place EXPORT_SYMBOL() after symbols (or at end of functions).

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10431 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-11 20:01:32 +00:00
Oron Peled
dbf3f017d9 xpp: style - clean many long lines (manually)
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10430 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-11 19:56:35 +00:00
Tzafrir Cohen
4ff781c2ba xpp: fix "non-const" index, right header, indent
Synchronize some changes from out internal tree:
* Fix a few of the places where indent did a lousy job.
* sparse did not like using the const MAX_ARGS as an index. Make it a define.
* Incorrect header included in card_fxs.c (doh!).
* One more funciton to statify.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10429 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-11 17:04:36 +00:00
Oron Peled
a2a695c742 xpp: style - Run Lindent
* Here it is:
  KERNEL_STYLE="-npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1"
  TYPEDEFS='
	-T gfp_t
	-T __user
	-T u_char
	-T __u8
	-T byte
	-T bool
	-T charp
	-T xusb_t
	-T xbus_t
	-T xpd_t
	-T xproto_table_t
	-T xproto_entry_t
	-T xframe_t
	-T xpacket_t
	-T reg_cmd_t
	'

  indent $TYPEDEFS $KERNEL_STYLE \
	--ignore-newlines	\
	--indent-label0	\
	--no-space-after-function-call-names	\
	"$@"

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10428 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-11 15:22:46 +00:00
Oron Peled
97ad9f8d03 xpp: style - convert typedef of byte to __u8
* Applied via:
  perl -pi \
	-e '/"/ and next;' \
	-e '/^\s*\*/ and next;' \
	-e '/\/\*.*byte/ and next;' \
	-e '/typedef.*byte/ and next;' \
	-e 's/\bbyte\b/__u8/g' "$@"

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10427 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-11 15:21:54 +00:00
Oron Peled
f84d579847 xpp: style - add space after comma
* Applied via:
  sed -i -e '/"/!s/,\([^ \t]\)/, \1/g' "$@"

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10426 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-11 15:21:13 +00:00
Oron Peled
6caa62da4a xpp: style - insert space afer if/while/for/switch
* Applied via:
  perl -pi -e 's/\b(if|while|for|switch)\b\(/$1 (/g' "$@"

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10425 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-11 15:20:05 +00:00
Oron Peled
8ed4c4a1ee xpp: style - Remove space before tabs
* Applied via:
  perl -pi -e 's/ +\t/\t/g;' "$@"

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10424 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-11 15:19:01 +00:00
Oron Peled
c7946df16e xpp: style - Remove 0/NULL static initializers
* Applied via:
  perl -pi -e 's/(\bstatic\b[^=]*?)\s*=\s*(0|NULL)\s*;/$1;/' "$@"

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10423 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-11 15:17:42 +00:00
Oron Peled
535ef8086c xpp: style: convert __FUNCTION__ to __func__
* Applied via:
  perl -pi -e 's/\b__FUNCTION__\b/__func__/g' "$@"

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10422 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-11 15:17:09 +00:00
Oron Peled
647212c45f xpp: style - remove eolspace
* Applied via:
  perl -pi -e 's/[ \t]+$//' "$@"

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10421 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-11 15:16:34 +00:00
Shaun Ruffell
5475f33f3d wct4xxp: VPM module creates noise on alternate channels on E1 spans.
The VPMOCT128 module was using the VPMOCT256 timeslots assigments which would
mean that channels that should be marked alaw were being set in ulaw. This
only affected E1 spans since by default all spans are configured for ulaw by
default.

This fixes a regression introduced in r10290 [1] "wct4xxp: Add support for
TE820 and VPMOCT256", first released in 2.6.0, that only affects E1 spans on a
quad and dual-span card when used with the hardware echocanceler.

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=10290

Internal-Issue-ID: DAHDI-945, DAHLIN-275
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10414 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-10 20:45:35 +00:00
Shaun Ruffell
6485e9b0ba wctdm24xxp: FXS on-hook transmission timer incorrect.
The DAHDI_ONHOOKTRANSFER ioctl was incorrectly setting the ohttimer to 0. The
result was that an FXS port was leaving the on-hook transfer state before
finishing the transmission.

This was discovered while looking at why ./fxstest dtmfcid  was not able to
pass the DTMF callerid digits to an attached FXO port properly.

Fixes a regression introduced in r10167 "wctdm24xxp: Use interval for checking
FXS on hook transfer timer." [1], first released in 2.6.0.

[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=10167

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10413 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-10 20:45:30 +00:00
Oron Peled
a01b9aaf14 xpp: handle failures during dahdi_register_device()
* If dahdi_register_device() failed, not all resources were freed.
  When dahdi_unregister_device() was called later (during driver
  removal) a panic was caused.

* Add proper error handling for possible failures in
  xbus_register_dahdi_device():
  - new xbus_free_ddev() safely free an xbus->ddev
  - This is called from all failures points.
  - It is also called from xbus_unregister_dahdi_device()

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10410 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-05 17:35:17 +00:00
Oron Peled
9c642364a7 xpp: Don't deactivate XPDs on unregistration
* A bug was introduced during migration to dahdi_device code:
    http://svnview.digium.com/svn/dahdi?view=rev&rev=10273
* Marking XPDs as non-functional (card_present=0, XPD_STATE_NOHW)
  was moved from xbus_request_removal() into xpd_dahdi_preunregister()
* As a result, unregistering an Astribank, made it non-functional
  so trying to re-register it later caused errors (e.g: "Cannot open"
  error message from xpp_open())
* This fix move XPD deactivation into the proper location (during
  xbus_deactivate()

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10409 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-05 17:34:16 +00:00
Oron Peled
0f619852d8 xpp: bugfix: fix bad refcount
Code path called in error condition contained an superflous put_xpd() call

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10408 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-05 17:33:47 +00:00
Tzafrir Cohen
6f2a52b764 Avoid building PCI devices if kernel has no PCI
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10397 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-03 22:44:43 +00:00
Shaun Ruffell
b91ec305be wctdm24xxp: Fix bug if hook state on FXS changes before channel configuration.
If the hook state on an FXS port changes before the channel is
configured with dahdi_cfg it is possible to erroneously force the line
feed register open without setting a timer to clear it.

The result would be a "dead" channel that cannot be cleared unless the
driver is reloaded and warning in the kernel log that "0 is an invalid
signaling state for an FXS module".

This change makes the OFF_HOOK to ON_HOOK change behave just as the
ON_HOOK to OFF_HOOK change has.

Internal-Issue-ID: DAHLIN-272
Reported-and-Tested-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10396 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-03 19:25:46 +00:00
Shaun Ruffell
afe3702873 wct4xxp: Reduce time spent waiting for auth done bit on TE820.
It is not necessary to wait a full second for the donebit.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10395 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-03 19:25:42 +00:00
Oron Peled
892e49c356 xpp: BRI: batch D-Channel packets to fix frag.
* We need to split the BRI D-Channel (HDLC) frames to smaller packets,
  limitation of the FPGA.
* This changes batches BRI D-channel packets of the same HDLC frame to a
  single XPP frame.
* Avoids an accidental fragmantion in case we were delayed for a few ms-s.
* Also improves efficiency.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10390 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-02 14:07:14 +00:00
Oron Peled
9fd76d93c9 xpp: BRI: split multibyte functionality
* The zero lenth case (Magic request) was split into
  send_magic_request() function. It was not possible
  to move it into card_bri.c, because it is called
  directly from the general interface we provide for
  register read/write via sysfs/proc.

* The normal case (send_multibyte_request) was moved from
  card_global.c into card_bri.c

* This sets the stage to enable bundling of multibyte
  packets into frames (like we do for PCM).

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10389 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-02 14:06:50 +00:00
Oron Peled
6706b03d9d xpp: BRI: remove trivial BRISTUFF wrappers
Now that legacy BRISTUFF code is gone, some wrapper
functions became trivial. Removed these wrappers
and inlined their contents.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10388 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-02 14:06:25 +00:00
Oron Peled
2ae396112a xpp: BRI: remove legacy BRISTUFF code
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10387 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2012-01-02 14:05:58 +00:00
Tzafrir Cohen
b6f3466607 xpp: Allow up to 128 Astribanks on a system
This is also a work around the bug fixed in the previous commit.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10384 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-21 18:10:44 +00:00
Oron Peled
9ce15dc967 xpp: bad module_put() when too many Astribanks
module_put() that was added while developing the sysfs code. The real
module_get()/module_put() pair were already removed at the time of
developing code for this branch. It was only triggered when using a
system with more than 32 (MAX_BUSES) Astribanks.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10383 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-21 18:10:15 +00:00
Oron Peled
2b11667c47 DAHDI-linux: Fix "surprise removal" problems
* Added a nodev_*() file_operations that handle system calls
  from user-space after surprise device removal.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10381 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-14 19:27:27 +00:00
Shaun Ruffell
6b6d047241 wct4xxp: Fail startup if not generating interrupts.
I've seen some platforms that do not properly route the interrupt from the
card to the host CPU. In these cases the card potentially could appear to be
greened up even though no data is flowing over the spans.

This change allows dahdi_cfg to return an error when this occurs, and also
ensures that all the spans are in RED alarm.

For example, dahdi_cfg output when the card is not generating interrupts:
  # dahdi_cfg
  DAHDI startup failed: Input/output error

And the kernel log will contain a string like:
  wct4xxp 0000:02:08.0: Interrupts not detected.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10380 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-14 19:02:53 +00:00
Shaun Ruffell
2983075256 dahdi: Return dahdi_span_ops.startup callback errors to userspace.
Allows dahdi_cfg to return an error code if a board driver fails it's startup
call for any reason.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10379 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-14 19:02:48 +00:00
Shaun Ruffell
b43c7f02a0 wctdm24xxp: Do not call voicebus_release() before wctdm_back_out_gracefully()
voicebus_release is already called as part of the wctdm_back_out_gracefully()
call. If an Hx8 card fails to initialize, this will eliminate warnings from
the kernel such as:

  WARNING: at kernel/irq/manage.c:904 __free_irq+0x94/0x173()
  Trying to free already-free IRQ 18

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10377 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-12 18:18:14 +00:00
Oron Peled
990af593a5 xpp: BRI: fix timing priority calculation
Use similar caculation as in the PRI module:
* Save timing_priority from spanconfig and
  elect syncer when spanconfig is called.
* Create custom timing_priority() function that returns
  the value or error if span is disconnected.

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: : Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10373 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-07 19:34:37 +00:00
Oron Peled
654486dc24 xpp: FXS: mwi and search_fsk fixes
* We must not block PCM during from 'search_fsk_pattern' channels.
* We must vmwi_search() not only on FXS_LINE_POL_ACTIVE, but also during
  'neon_blinking' -- so we notice the message to turn it off.
* Also added 'search_fsk_pattern' and neon_blinking to /proc/.../fxs_info

Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: : Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10372 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-07 19:22:04 +00:00
Russ Meyerriecks
6d1713c2c0 wct4xxp: Revise vpm struct due to product name changes
Renamed most of the "vpm450m" references to just "vpm".

Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10365 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-02 22:48:44 +00:00
Russ Meyerriecks
da149b0d4d wct4xxp: Handle incorrect vpm module/card pairings
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
Acked-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10364 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-02 22:48:39 +00:00
Shaun Ruffell
06961f8605 dahdi: #include <linux/module.h> in dahdi/kernel.h and GpakCust.h
Commit de47725, first released in 3.2-rc1 removed module.h from some
kernel headers. Include it explicitly now.

Resolves compilation errors like:
error: implicit declaration of function 'try_module_get'
error: 'THIS_MODULE' undeclared (first use in this function)
error: implicit declaration of function 'module_put'

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10361 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-02 19:56:11 +00:00
Shaun Ruffell
2a3a074f33 wctc4xxp: Replace 'ndo_set_multicast_list' with 'set_rx_mode'
The ndo_set_multicast_list callback was removed in b81693d9, which was
first released in Linux Kernel 3.2-rc1

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10360 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-12-02 19:56:07 +00:00
Oron Peled
c4616c6c86 xpp: PRI: restore pri_protocol to R/W:
Restores the pri_protocol attribute of the XPD node in SysFS to be
writable. Fixes a minor regression from the pinned-spans fix, similar to
r10334.

* This attribute was made R/O in digium r10280 as part of the
  pinned-spans changes:
  - The E1/T1 settings were changed via new set_spantype() method
    which was called from dahdi when the 'spantype' dahdi attribute
    was written to.

  - This fails our init_card_4_* trying to write E1/T1 into our private
    attribute.

* Restored our old code (with minor modifications) so we
  can set E1/T1 the old way (writing to our 'pri_protocol' attribute)
  as well as the new way (when it will be used eventually).

Signed-off-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10347 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-29 23:38:30 +00:00
Oron Peled
244c9bd254 xpp: pri: fix RS1 init in E1 CAS mode
Force some reserved bits to really be 1 in E1 mode (otherwise
terrorists will win).

(Closes issue DAHLIN-264)

Signed-off-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10346 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-29 23:37:33 +00:00
Oron Peled
cc7c73c4d8 xpp: fxs: demote SETPOLARITY message to DBG()
Signed-off-by: Oron Peled <oron.peled@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10345 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-29 23:36:17 +00:00
Tzafrir Cohen
66eb65dda7 xpp: increase command queue length to 1500
A length of 1000 commands is not enough is some cases with CAS.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10341 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-16 12:10:51 +00:00
Tzafrir Cohen
1372573e68 xpp: USB_FW rev 10085: fix regression from r10013
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10339 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-13 15:04:16 +00:00
Tzafrir Cohen
1e22667c31 xpp: PIC_TYPE_1 rev 9841: followup to r10013
An extra fix that was accidentally not included in r10013. Minor bug fixes.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10337 a0bf4364-ded3-4de4-8d8a-66a801d63aff
2011-11-13 13:23:10 +00:00