summaryrefslogtreecommitdiff
path: root/drivers/dahdi/voicebus
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dahdi/voicebus')
-rw-r--r--drivers/dahdi/voicebus/GpakCust.c47
-rw-r--r--drivers/dahdi/voicebus/GpakCust.h6
2 files changed, 38 insertions, 15 deletions
diff --git a/drivers/dahdi/voicebus/GpakCust.c b/drivers/dahdi/voicebus/GpakCust.c
index 386c916..ccd880c 100644
--- a/drivers/dahdi/voicebus/GpakCust.c
+++ b/drivers/dahdi/voicebus/GpakCust.c
@@ -293,21 +293,9 @@ vpm_bh_out:
return;
}
#include "adt_lec.c"
-int vpmadt032_echocan_with_params(struct vpmadt032 *vpm, int channo,
- struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
+static void vpmadt032_check_and_schedule_update(struct vpmadt032 *vpm, int channo)
{
int update;
- unsigned int ret;
-
- ret = adt_lec_parse_params(&vpm->desiredecstate[channo], ecp, p);
- if (ret)
- return ret;
-
- /* The driver cannot control the number of taps on the VPMADT032
- * module. Instead, it uses tap_length to enable or disable the echo
- * cancellation. */
- vpm->desiredecstate[channo].tap_length = (ecp->tap_length) ? 1 : 0;
-
/* Only update the parameters if the new state of the echo canceller
* is different than the current state. */
update = memcmp(&vpm->curecstate[channo],
@@ -322,10 +310,41 @@ int vpmadt032_echocan_with_params(struct vpmadt032 *vpm, int channo,
*/
schedule_work(&vpm->work);
}
+}
+int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo,
+ struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
+{
+ unsigned int ret;
+ ret = adt_lec_parse_params(&vpm->desiredecstate[channo], ecp, p);
+ if (ret)
+ return ret;
+
+ if (vpm->options.debug & DEBUG_ECHOCAN)
+ printk(KERN_DEBUG "echocan: Channel is %d length %d\n", channo, ecp->tap_length);
+
+ /* The driver cannot control the number of taps on the VPMADT032
+ * module. Instead, it uses tap_length to enable or disable the echo
+ * cancellation. */
+ vpm->desiredecstate[channo].tap_length = (ecp->tap_length) ? 1 : 0;
+
+ vpmadt032_check_and_schedule_update(vpm, channo);
return 0;
}
-EXPORT_SYMBOL(vpmadt032_echocan_with_params);
+EXPORT_SYMBOL(vpmadt032_echocan_create);
+
+void vpmadt032_echocan_free(struct vpmadt032 *vpm, struct dahdi_chan *chan,
+ struct dahdi_echocan_state *ec)
+{
+ int channo = chan->chanpos - 1;
+ adt_lec_init_defaults(&vpm->desiredecstate[channo], 0);
+
+ if (vpm->options.debug & DEBUG_ECHOCAN)
+ printk(KERN_DEBUG "echocan: Channel is %d length 0\n", channo);
+
+ vpmadt032_check_and_schedule_update(vpm, channo);
+}
+EXPORT_SYMBOL(vpmadt032_echocan_free);
struct vpmadt032 *vpmadt032_alloc(struct vpmadt032_options *options)
{
diff --git a/drivers/dahdi/voicebus/GpakCust.h b/drivers/dahdi/voicebus/GpakCust.h
index befdabc..db5fbdd 100644
--- a/drivers/dahdi/voicebus/GpakCust.h
+++ b/drivers/dahdi/voicebus/GpakCust.h
@@ -118,15 +118,19 @@ struct vpmadt032 {
};
struct voicebus;
+struct dahdi_chan;
struct dahdi_echocanparams;
struct dahdi_echocanparam;
+struct dahdi_echocan_state;
char vpmadt032tone_to_zaptone(GpakToneCodes_t tone);
int vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb);
struct vpmadt032 *vpmadt032_alloc(struct vpmadt032_options *options);
void vpmadt032_free(struct vpmadt032 *vpm);
-int vpmadt032_echocan_with_params(struct vpmadt032 *vpm, int channo,
+int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo,
struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p);
+void vpmadt032_echocan_free(struct vpmadt032 *vpm, struct dahdi_chan *chan,
+ struct dahdi_echocan_state *ec);
/* If there is a command ready to go to the VPMADT032, return it, otherwise NULL */
static inline struct vpmadt032_cmd *vpmadt032_get_ready_cmd(struct vpmadt032 *vpm)