Commit Graph

224 Commits

Author SHA1 Message Date
Shaun Ruffell
34b9c77c9a Use proc_ops on kernels >= 5.6
In commit (d56c0d45f0e27 "proc: decouple proc from VFS with "struct proc_ops"")
[1], proc_create_data no longer takes a file_operations structure, but instead
takes a struct proc_ops in order to conserve memory in the kernel.

This change is necessary for DAHDI to work with kernels >= 5.6

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d56c0d45f0e27f814e87a1676b6bd

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2020-02-23 19:39:24 -06:00
Shaun Ruffell
ffcd08205c xpp: Convert struct timeval -> ktime_t.
`struct timeval` has been removed from the kernel interface in 5.0 as
part of fixing the 2038 problem. ktime_t is the preferred kernel time
interface now.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2019-05-08 11:33:05 -05:00
Shaun Ruffell
02d30ab799 Remove support for kernels older than 2.6.27
There are not any major distributions that are still supporting kernels
older than 2.6.27 so we can remove many typedefs. The primary motivator
for this change is that kernel 5.0 is dropping support for timeval and
it would be ideal if the in-kernel time representation can
standardize on ktime_t, but 2.6.18 did not support the ktime
interface that was needed.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2019-05-08 11:33:05 -05:00
Keith Morgan
40f4f86ffa Revert "Remove support for xpp drivers."
add them back.
This reverts commit a36d266254.
2018-10-04 17:51:54 +00:00
Keith Morgan
a36d266254 Remove support for xpp drivers. 2018-10-03 15:31:08 +00:00
Shaun Ruffell
6667f1c8d8 DAHDI in kernel 4.15: Switch to new timer_setup interface.
Upstream kernel 4.14, in commit (686fef928bba6b "timer: Prepare to change timer
callback argument type") [1], introduced the timer_setup interface to replace
the init_timer/setup_timer interfaces. The primary change is that the timer
callback functions now follow the standard kernel pattern where the structure
the callback sits in is passed to the callback instead of storing a pointer to
an unassociated data type.

The setup_timer functions were removed in upstream kernel v4.15, and therefore
this change is needed in order to compile DAHDI for kernels >= 4.15.

This change follows the same strategy that was done in the kernel to while the
existing users of setup_timer were migrated to the new interface.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=686fef928bba6b
2018-09-03 10:27:18 -05:00
Shaun Ruffell
ea2d67414a xpp: fxs: Do not increment boolean.
This quiets the following warning from gcc 7.3.0:

  drivers/dahdi/xpp/card_fxs.c:1344:17: warning: increment of a boolean
  	expression [-Wbool-operation]
2018-09-03 10:26:29 -05:00
Oron Peled
d3c9e43437 xpp: Support FXS module with 4 ports and no I/O
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2018-05-10 12:18:35 +03:00
Tzafrir Cohen
9a4d2fce48 xpp: init_card: eeprom_release_201 applies to any 20x
* The variable eeprom_release_201 was added in the initialization
  script of the FXS module to add a case where it is different from
  101 mains.
* However, it tests for "201" and it should apply for any 20x.
* Remove the variable from the init script of module type 6 (new FXS)
  as it was not used.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2018-02-20 19:07:50 +02:00
Jean-Denis Girard
d4e232a776 DAHDI in kernel 4.13: dev_attr to dev_groups
dev_attrs was removed from struct bus_type on kernel 4.13, need to
convert to dev_groups, see
http://lkml.iu.edu/hypermail/linux/kernel/1706.0/04578.html.

DAHLIN-356 #close

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2018-01-01 14:25:39 +02:00
Tzafrir Cohen
52f2c19769 xpp: mark init_card_6_30 as executable
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-09-17 08:25:31 +03:00
Dima Stoliarov
960472ed35 xpp: fxs: restore linefeed (for e.g. thermal alarm)
The si32260 chip may enter a state of thermal alarm to avoid
overheating. This disables the channel.

This commit allows automatic restoring of the channel after a certain
timeout (poll_chan_linefeed, by default 30 seconds).

Adds a per-channel counter ("overheats") in
/proc/xpp/XBUS-<n>/XPD-<m>0/fxs_info to count such events.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-09-13 15:37:24 +03:00
Dima Stoliarov
9c9029d0b6 xpp: fxs: reduce loop current to reduce heating 2017-09-13 15:33:31 +03:00
Tzafrir Cohen
39cd184c29 xpp: FPGA_1161.202.hex now alias for 201
We no longer need to maintain a separate firmware type 2.2: newer
versions of firmware types 2.1 will do.
2017-07-17 14:49:02 +03:00
Tzafrir Cohen
e2ee1eb30b xpp: card_pri: fix clocking initialization
Fix PCM synchronization between PRI module and the main board.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-06-26 19:01:34 +03:00
Tzafrir Cohen
d4ac65d0c1 xpp: fxo: update red alarms on span assignment
DAHDI gets notified of changes to battery status and hence to red alarm
on an FXO channel when the status changes. It thus needs to get notified
about it on "startup".

This startup was initially span registration. However following the
separation between device registration and span assignment, the
notification was sent after device registration, whereas it was ignored
if span was not assigned. It happened to work in most cases due to
delays.

This fix moves the startup notifications of battery status to the new
hook that is run on span assignment.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-06-26 17:58:33 +03:00
Tzafrir Cohen
7292c263ef xpp: add xpd method span_assigned
Add an phone device XPD method called 'span_assigned' that gets
called when the XPD's span is assigned.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-06-26 17:58:33 +03:00
Tzafrir Cohen
151853df0d xpp: bug fix in FPGA firmware: 11553
Update FPGA_1161.201.hex to rev. 11553 to fix
'category=2 errorbits=0x01' errors.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-06-26 17:58:33 +03:00
Dima Stoliarov
d9abf02894 xpp: init_card_6_3: parallel calibration
FXS module type 6: Further reduces time of the initialization by writing
to several ports' chips in parallel.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-06-26 17:58:33 +03:00
Dima Stoliarov
24648e6eb3 xpp: init_card_6_3: broadcasts for faster calibration
FXS module type 6: Use broadcast write for a much faster
calibration at init time.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-06-26 17:58:29 +03:00
Shaun Ruffell
0159b0e7ce 'atomic_read()' -> refcount_read()'
The upstream 4.11 kernel, in commit (10383aea2f445bce9b2a2b308def08134b438c8e
"kref: Implement 'struct kref' using refcount_t"), changed refcount type on kref
objects. We now need to use refcount_read to read them.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
2017-06-26 17:49:13 +03:00
Tzafrir Cohen
76ad75fc2a xpp: fxs: demote LED FXS6 messages to debug 2017-04-19 15:51:35 +03:00
Tzafrir Cohen
27b1ad108d xpp: fxs: remove verbose poll_inputs notice
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-04-19 15:51:35 +03:00
Dima Stoliarov
2dc030e61d xpp: bug fix in FPGA firmware: 11551
Update FPGA_1161.201.hex to rev. 11551 to fix the support of module type
6.
2017-04-19 15:51:34 +03:00
Tzafrir Cohen
5b9f520e78 xpp: re-add setting xpd->subunits
The number of subunits per XPD (which is not trivial in BRI) has been
accidentally left out in a previous commit.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-04-19 15:51:34 +03:00
Tzafrir Cohen
8e310fd264 xpp: output of parse_hexbyte() may be negative
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-04-19 15:51:34 +03:00
Tzafrir Cohen
6b119e60f5 xpp: remove useless sanity check of len field
The packet data length field may have other values in some cases (BRI D
channel).  It is also inherently limited to 3 bits.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-04-19 15:51:34 +03:00
Tzafrir Cohen
b8b884d205 xpp: correct size for BRI multibyte packets
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-04-19 15:51:34 +03:00
Tzafrir Cohen
95de230835 xpp: remove independent "Unknown" XPP_VERSION
The xpp drivers were originally developed seperately and thus had their
own version number. For quite some time they no longer have this version
number and report 'Revision: Unknown'.

Get rid of this mechanism.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-04-19 15:51:34 +03:00
Tzafrir Cohen
c05ad2200f xpp: fix chip/ports numbers sanity test
The test originally did not check any input from the hardware.
Fix it to check the actual (and proper) input from the hardware.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-04-19 15:51:34 +03:00
Tzafrir Cohen
55775ab0d2 xpp: FXS: RAM write support is fully implemented 2017-04-19 15:51:34 +03:00
Tzafrir Cohen
6456a027e5 xpp: init_card_6_30: Avoid using new perl features
Centos 5 has perl 5.8.8 . It does not support the '//' operator that was
added in perl 5.10. So sadly we have to avoid using it.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-04-19 15:51:32 +03:00
Tzafrir Cohen
92e4ce9b93 xpp: init_card_6_30: verify patches only on debug
Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-04-19 15:50:55 +03:00
Tzafrir Cohen
fa57fed2df xpp: init_card_6_30: disable debug
* Don't enable debug by default.
* Demote some logging messages to debug.
* Remove a duplicate message about SLIC numbers.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-04-19 15:50:14 +03:00
Tzafrir Cohen
c21a98ebe5 xpp: FXS: Metering tone doesn't yet work on type 6
Generation of metering tone (a feture normally disabled at build time)
is not yet implemented on the new FXS type 6 module.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2017-03-21 15:42:49 +02:00
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