Commit Graph

189 Commits

Author SHA1 Message Date
Oron Peled
d7e77a3e61 xpp: FXS type 6: ring and neon MWI support
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-21 15:42:48 +02:00
Dima Stoliarov
020735e3a7 xpp: FXS type 6: support digital outputs
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-21 15:42:48 +02:00
Dima Stoliarov
aaa1080a7c xpp: FXS type 6: support digital inputs
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-21 15:42:48 +02:00
Dima Stoliarov
7fcb793cd9 xpp: FXS type 6: hardware DTMF detection
Adapt the hardware DTMF detection for the SI32260 module.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-21 15:42:48 +02:00
Oron Peled
28a2cd068d xpp: FXS type 6: basic hookstate detection
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-21 15:42:48 +02:00
Oron Peled
a380b84545 xpp: FXS type 6: define registers
Add definitions of REG_TYPE6 for various SI32260 registers.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-21 15:42:48 +02:00
Dima Stoliarov
e47c096b73 xpp: FXS type 6: firmwares support
Firmware support for the type 6 FXS Astribank module.

FPGA_1161.201.hex rev. 11527
PIC_TYPE_6.hex rev. 11526
USB_FW.201.hex rev. 11502

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-21 15:42:46 +02:00
Dima Stoliarov
99ccfa35bb xpp: FXS type 6: init script (init_card_6_30)
Add init_card_6_30: an init script for new FXS based on Si32260 chip.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-21 14:09:11 +02:00
Dima Stoliarov
609114c0a9 xpp: FXS: support of I/O Expander.
Added do_expander field to SPI commands, in order to support an I/O
Expander on FXS.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-19 15:31:38 +02:00
Oron Peled
14d9a53162 xpp: support for RAM type register commands
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-16 16:55:35 +02:00
Oron Peled
2dd077cc53 xpp: FXS: rename all REG_* macros to REG_TYPE1_*
This is preparation for REG_TYPE6_* macros

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-16 16:55:29 +02:00
Dima Stoliarov
41279a8dcc xpp: added hwid attribute
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-16 16:11:50 +02:00
Oron Peled
d3a28c50cf xpp: a separate unit_descriptor
The new FXS chip supports two ports for each chip and hence we once
again need to look at hardware differently.

Struct unit_description includes information about all chips/port in a
specific module.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-16 13:46:15 +02:00
Oron Peled
17ac18d675 xpp: Remove unused "datalen" field from xframe
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-16 13:46:15 +02:00
Oron Peled
3d8d7995d7 xpp: XFRAME_NEW_REG_CMD
Prepare for different types of commands: replace XFRAME_NEW_CMD with
XFRAME_NEW_REG_CMD in some places.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-16 13:44:56 +02:00
Oron Peled
9dfc02a38c xpp: Check command type by length
Prepare for different types of commands: Don't assume a constant size.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-16 13:41:20 +02:00
Oron Peled
1c68f2ec73 xpp: refactor struct reg_cmd
Currently we only have REG (register) commands. Refactor it to allow
MEM (memory) commands.

* A common header
* Don't assume a constant size.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-15 12:01:39 +02:00
Oron Peled
d9aa82b025 xpp: rename xpd->type to xpd->xpd_type
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-14 20:37:45 +02:00
Oron Peled
a0434a8af5 xpp: remove unused #defines 2017-03-14 14:43:22 +02:00
Tzafrir Cohen
ffdfdfb66b xpp_usb: Fix potential corruption on clock rewind
The xpp modules use time differences for various statistics. In one case
xpp_usb creates a histogram of the time it took the system to send USB
packets (URBs). The time difference is used (after adjustments) as an
index to that array.

However if the clock happens to go back at that exact point in time, we
get to write to an arbitrary negative index in this array.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2016-03-16 18:20:44 +02:00
Oron Peled
404a67d089 xpp: improve handling of USB sluggishness
* Drop PCM during sluggish events:
  - Drop both rx/tx (was only tx)
  - Drop almost all pcm until sluggishness stops (used to drop only
    single pcm each time).
  - Renamed: "drop_next_pcm" -> "drop_pcm" (to match new semantics)
  - Still allow "keep alive" PCM so Astribank will not reset FXS high-voltage.
    The "sluggish_pcm_keepalive" parameter set the rate (1/50 by default)
  - Added rx/tx drop statistics counters
  - Removed "pcm_tx_drops" (replaced by new statistics counters)

* Also improved format of /proc/xpp/XBUS-*/xpp_usb:
  - Show cummulative number of sluggish events.
  - Clearly show range (in usec) of usb_tx_delay[]

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2015-11-02 10:49:42 +02:00
Tzafrir Cohen
6287954087 xpp: USB_FW*: fix incorrect chan num with 2FXS6FXO
New USB firmware that fix mis-reporting of the number of channels (or
rather: licenses) in the Astribank when a 2FXS6FXO module is used in
conjunction with another module.

USB_FW.hex: rev. 11452
USB_FW.201.hex: rev. 11453

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2015-03-30 16:02:48 +03:00
Tzafrir Cohen
5c072d5bce xpp: module_refcount is back to int on 3.19
Commit d5db139ab3764640e0882a1746e7b9fdee33fd87 "module: make
module_refcount() a signed integer." included in 3.19 makes this
condition slightly more complex.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2015-03-02 21:11:57 +02:00
Shaun Ruffell
1559db9d1a dahdi: strnicmp() -> strncasecmp()
With commit (af3cd13501 "lib/string.c: remove strnicmp()") [1] dahdi can no
longer call strnicmp directly. strncasecmp was added into lib/string.c in kernel
version 2.6.22 so we'll map calls to strncasecmp to strnicmp for any kernel
before that.

This is necessary to compile against kernels >= 4.0.

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=af3cd13501

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2015-03-02 21:09:19 +02:00
Tzafrir Cohen
ee691c23f4 xpp: firmware: a stray ^Z in FPGA_1161.201.hex 2014-11-17 18:00:51 +02:00
Tzafrir Cohen
9698657f7a xpp: firmware: 203 as alias to (newer) 201
Latest Astribank firmware (as of Rev. 11426 also supports some newer
hardware types, which will have the ID 203. Anyone installing this newer
version will now have 203 as an alias, but older versions will not have
it.
2014-11-17 17:55:47 +02:00
Tzafrir Cohen
79bf41ea8b xpp: FPGA_1161.201.hex: module types detection
New firmware that includes a better way to identify hardware modules
type that does not require multiplexers.

This is firmware file FPGA_1161.201.hex rev. 11426.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-11-05 20:08:47 +02:00
Shaun Ruffell
b3a6b91858 Do not call dahdi_span_ops.open with spinlock held.
This makes the open symmetrical with the close. It is also considered good
practice to not call through callbacks with spinlocks held.

I modified all the drivers where I could not tell whether it was necessary to
hold the chan->lock with interrupts disabled to simply take the lock inside the
callback.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-06-20 13:01:27 -05:00
Oron Peled
cbe92363ea xpp: re-organize calls so worker_reset()
re-organize calls so worker_reset() isn't called twice
(was called from xbus_disconnect() and worker_destroy())

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-05-27 14:04:48 +03:00
Oron Peled
43a3dbb484 xpp: demote some NOTICE() to DBG()
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-05-27 14:04:48 +03:00
Oron Peled
9a00fc6321 xpp: stability -- better xbus shut down
* Maintain a "shutting_down" flag per-xbus
* Use it to prevent xbus dereferencing (via xbus_get()/xbus_put())
  during an xbus shutdown.
* Also, remove xbus from global array earlier.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-05-27 14:04:48 +03:00
Oron Peled
db07e1b74d xpp: stability -- deadlock in waitfor_xpds()
waitfor_xpds xbus sysfs file should not take an xbus refcount:

* It is called from sysfs which maintain its own device refcount.
* If put_xbus() calls xbus_destroy() than down the call chain it will
  try to release an object that is held by sysfs.
* This will create a deadlock.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-05-27 14:04:48 +03:00
Oron Peled
235d530fee xpp: stability -- better debug information
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-05-27 14:04:48 +03:00
Oron Peled
dfa7304f51 xpp: stability -- cleaner xpp_open/close
* No need to use spinlock.
 * Just correctly use the atomic open_counter.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-05-27 14:04:48 +03:00
Oron Peled
08127e14f7 xpp: stability fixes - xusb mutex
* Replace old semaphore with mutex
 * Use this mutex for BOTH usb probe/disconnect

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-05-27 14:04:48 +03:00
Shaun Ruffell
779d62791c Add #include <linux/slab.h> to all files that call kzalloc|kmalloc|kfree.
Some architectures, like arm, do not automatically pull in the definitions for
kzalloc and friends. This allows DAHDI to build on those platforms.

Originally reported to the asterisk-users mailing list here
http://lists.digium.com/pipermail/asterisk-users/2014-February/282338.html

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-05-20 11:36:23 -05:00
Tzafrir Cohen
15ff405dc8 xpp: pri: Fix more than a single CAS/R2 call
Fixes regression from bb63d03bba (before
v2.7.0). This failed to set the PCM mask on a CAS span when
DAHDI_AUDIO_NOTIFY was not set.

As the first channel of each xbus would be enabled (for
synchronization), a single call may still have passed.

This patch sets the PCM mask on any CAS channel explicitly.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-04-30 22:44:46 +03:00
Oron Peled
5e24d501c5 xpp: prevent double dahdi un-registration
* It's currently harmless (just re-run the pre/post XPD registrations)
* But it's cleaner this way (as with xbus_register_dahdi_device())

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-04-30 22:44:46 +03:00
Oron Peled
193c9e59a8 xpp: new xbus attribute: dahdi_registration
XPP devices have implicit support for device registration and
unregistration. Even though it is only used for the legacy (non-hotplug)
configuration case, we still prefer to make it explicit.

This attribute would later allow a simpler implementation of the user
space (xpp-specific) tool dahdi_registration.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-04-30 22:44:46 +03:00
Oron Peled
606dd58a47 xpp: fix failed multi-PRI E1<->T1 transition
In an Astribank with >= 2 PRI ports, switching from E1 to T1 at run-time
may fail at the DAHDI_CHANCONFIG ioctl on the first channel in a span,
That is, on first run of dahdi_cfg, it fails on second span, on second:
it fails on third span, etc.

The code clears the D-channel information on the DAHDI_CHANCONFIG call
for the first channel in the span.

However The code tested for the global "channo" rather than the per-span
"chanpos" to check for the first channel in the span. This the test
failed.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-04-30 22:44:46 +03:00
Oron Peled
6593097586 xpp: fix PANIC for old dahdi_registration
* dahdi_registration writes multiple times to:
     /sys/bus/astribanks/devices/*/*/span
* In some race cases this resulted in corruption and eventual kernel
  panic.
* Until migration to "assigned-spans" is complete:
  - Accept and ignore multiple "dahdi registrations" from user-space.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-03-23 17:25:52 +02:00
Oron Peled
d4868092bf xpp: PRI stability fixes
* We didn't handle proper E1/T1 transitions after device registration.

* Fix SPAN_REGISTERED(xpd):
  It now checks for DAHDI_FLAGBIT_REGISTERED as well, as this flag is
  set/clear by assign/unassign.

* From set_pri_proto():
  - Always free/allocate channels
  - Always call dahdi_init_span()

* Improve phonedev_cleanup() safety:
  - NULL pointers after free.
  - Zero number of channels at the end.

* Refactor channel allocation out of phonedev_init():
  - Into phonedev_alloc_channels()
  - Also called from xpd_init_span() to prevent duplicated logic.
  - And called from set_pri_proto() to prevent our bug.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2014-02-05 20:19:08 +02:00
Tzafrir Cohen
06c45b7cd8 dahdi_get_auto_assigned_spans
Commit 74e949c33a exported the module
variable dahdi.auto_assigned_spans. However this is not a good name.

This commit reverts the export and replaces it with a new function to
get the value of the variable.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-02-05 19:25:20 +02:00
Oron Peled
2ecf700dd8 xpp: continue xpp.dahdi_autoreg deprecation
* Set it to 0 by default (as we use dahdi.auto_assign_spans now)
* Make it readonly (no runtime changes)
* Warn during startup if it was forced to 1

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-28 19:24:27 +02:00
Oron Peled
74e949c33a xpp: deprecate dahdi_autoreg
Instead, use the inverse of dahdi.auto_assign_spans value.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
2014-01-28 19:24:15 +02: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
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
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
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