summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoe Rubinstein <nrubinstein@proformatique.com>2011-01-06 16:40:21 +0100
committerNoe Rubinstein <nrubinstein@proformatique.com>2011-01-06 16:40:21 +0100
commitd3319b733d4f59b75d03299358ac68fc702d6274 (patch)
treecb7a06f4e0c3def2a60a6088b96fe9b2e1ca19fb
parentcee91eb231da1af9298a103e93b11ead669f35cb (diff)
polrev MWI, others
-rw-r--r--xhfc/xhfc_st_state.c1
-rw-r--r--xivovp/Kbuild2
-rw-r--r--xivovp/base.c68
3 files changed, 58 insertions, 13 deletions
diff --git a/xhfc/xhfc_st_state.c b/xhfc/xhfc_st_state.c
index c8dbaa9..56084e7 100644
--- a/xhfc/xhfc_st_state.c
+++ b/xhfc/xhfc_st_state.c
@@ -99,7 +99,6 @@ void activate_request(struct xhfc_span* s)
printk(KERN_DEBUG DRIVER_NAME
": activate on port %d\n",
portno(s));
-
SET_V_SU_ACT(a_su_wr_sta, V_SU_ACT_ACTIVATE);
diff --git a/xivovp/Kbuild b/xivovp/Kbuild
index a964926..be1c00e 100644
--- a/xivovp/Kbuild
+++ b/xivovp/Kbuild
@@ -2,7 +2,7 @@ VP_API ?= /bad__vp_api__not_set
KSRC ?= /bad__ksrc__not_set
DAHDI_INCLUDE ?= /bad__dahdi_include__not_set
-CFLAGS_MODULE += -I$(DAHDI_INCLUDE) -I$(abspath $(src)/../)
+CFLAGS_MODULE += -I$(DAHDI_INCLUDE) -I$(abspath $(src)/../) -DAUDIO
EXTRA_CFLAGS := -I$(VP_API)/arch/lkm \
-I$(VP_API)/api_lib/vp890_api/ \
diff --git a/xivovp/base.c b/xivovp/base.c
index afe2084..9036cc8 100644
--- a/xivovp/base.c
+++ b/xivovp/base.c
@@ -38,9 +38,11 @@
#define TS_MASK ((1u << FXS_TIMESLOT) | (1u << FXO_TIMESLOT))
#endif
-#define REVERSE_POLARITY(line) (!( \
- (!reverse_polarity) ^ \
- (!(line)->reverse_polarity) ^ \
+#define REVERSE_POLARITY(line) (!( \
+ (!reverse_polarity) ^ \
+ (!(line)->reverse_polarity && \
+ (line)->vmwi_info.vmwi_type & \
+ DAHDI_VMWI_LREV) ^ \
(!(line)->message_waiting)))
#define POL(line, sig) (REVERSE_POLARITY(line) ? sig ## _POLREV : sig)
@@ -81,8 +83,10 @@ struct xivovp_line {
spinlock_t lock;
+ struct dahdi_vmwi_info vmwi_info;
+
bool reverse_polarity;
- bool message_waiting;
+ int message_waiting;
bool previous_polarity;
};
@@ -150,12 +154,13 @@ static int xivovp_hooksig(struct dahdi_chan *chan, enum dahdi_txsig txsig)
return 0;
}
-#define HOOKSIG_TRACE(line, txsig, vpsig) \
- printk(KERN_DEBUG DRV_NAME "(chan %d): " \
- "transmitting %s on %s, setting to %s%s.\n", \
- chanpos, txsig, \
- (line->type == FXO_LINE ? "FXO" : "FXS"), vpsig, \
- (REVERSE_POLARITY(line) && line->type == FXS_LINE ? \
+#define HOOKSIG_TRACE(line, txsig, vpsig) \
+ printk(KERN_DEBUG DRV_NAME "(chan %d): " \
+ "transmitting %s on %s, setting to %s%s.\n", \
+ chanpos, txsig, \
+ (line->type == FXO_LINE ? "FXO" : "FXS"), vpsig,\
+ (REVERSE_POLARITY(line) && \
+ line->type == FXS_LINE ? \
"_POLREV" : ""));
/*
@@ -545,10 +550,52 @@ static void vp_tick(const unsigned long data)
mod_timer(&xivovp.vp_tick_timer, jiffies + VP_TICK_JIFFIES);
}
+static int xivovp_ioctl(struct dahdi_chan *chan, unsigned int cmd,
+ unsigned long data)
+{
+ struct xivovp_line* line = chan->pvt;
+ int x;
+
+ switch (cmd) {
+ case DAHDI_VMWI_CONFIG:
+ if (line->type != FXS_LINE)
+ return -EINVAL;
+ if (copy_from_user(&line->vmwi_info, (__user void *) data,
+ sizeof(line->vmwi_info)))
+ return -EFAULT;
+ if (!(line->vmwi_info.vmwi_type & DAHDI_VMWI_LREV))
+ printk(KERN_WARNING DRV_NAME "(chan %d): "
+ "Only lrev VMWI is supported\n",
+ chan->chanpos);
+ break;
+
+ case DAHDI_VMWI:
+ if (line->type != FXS_LINE)
+ return -EINVAL;
+ if (get_user(x, (__user int *) data))
+ return -EFAULT;
+ line->message_waiting = x;
+ break;
+
+ case DAHDI_SETPOLARITY:
+ if (line->type != FXS_LINE)
+ return -EINVAL;
+ if (get_user(x, (__user int *) data))
+ return -EFAULT;
+ line->reverse_polarity = !!x;
+ break;
+
+ default:
+ return -ENOTTY;
+ }
+ return 0;
+}
+
static const struct dahdi_span_ops xivovp_span_ops = {
.owner = THIS_MODULE,
.hooksig = xivovp_hooksig,
+ .ioctl = xivovp_ioctl,
};
static int span_init(void)
@@ -675,7 +722,6 @@ vp_init(void)
goto err_vp_make_line_object;
}
-#if 1
vpst = VpMakeLineObject(
VP_TERM_FXO_GENERIC,
FXO_LINE,