summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2010-02-26 16:40:43 +0000
committerShaun Ruffell <sruffell@digium.com>2010-02-26 16:40:43 +0000
commitd06583abaa40a5183296e97b1d0e25d06684f765 (patch)
tree75bcefa96649ccd8f6eb0ac83bea243edcc46995
parent19399c505226dcae9cfaec0ab53889481f3ab819 (diff)
wctdm24xxp, wcte12xp: Updating the interface for the VPMADT032.
This description needs to be filled in more. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8121 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/voicebus/GpakCust.c61
-rw-r--r--drivers/dahdi/voicebus/GpakCust.h7
-rw-r--r--drivers/dahdi/wctdm24xxp/base.c16
-rw-r--r--drivers/dahdi/wcte12xp/base.c12
4 files changed, 62 insertions, 34 deletions
diff --git a/drivers/dahdi/voicebus/GpakCust.c b/drivers/dahdi/voicebus/GpakCust.c
index 0609f19..2804d27 100644
--- a/drivers/dahdi/voicebus/GpakCust.c
+++ b/drivers/dahdi/voicebus/GpakCust.c
@@ -240,6 +240,25 @@ static void free_change_order(struct change_order *order)
kfree(order);
}
+static int vpmadt032_control(struct vpmadt032 *vpm, unsigned short int channel,
+ GpakAlgCtrl_t control_code,
+ GPAK_AlgControlStat_t *pstatus)
+{
+ gpakAlgControlStat_t stat;
+ int retry = 4;
+ while (retry--) {
+ stat = gpakAlgControl(vpm->dspid, channel,
+ control_code, pstatus);
+
+ if (AcDspCommFailure == stat)
+ msleep(5);
+ else
+ break;
+ }
+
+ return stat;
+}
+
static int vpmadt032_enable_ec(struct vpmadt032 *vpm, int channel,
enum adt_companding companding)
{
@@ -250,18 +269,18 @@ static int vpmadt032_enable_ec(struct vpmadt032 *vpm, int channel,
control = (ADT_COMP_ALAW == companding) ? EnableALawSwCompanding :
EnableMuLawSwCompanding;
- if (vpm->options.debug & DEBUG_ECHOCAN) {
+ if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN) {
const char *law;
law = (control == EnableMuLawSwCompanding) ? "MuLaw" : "ALaw";
vpm_info(vpm, "Enabling ecan on channel: %d (%s)\n",
channel, law);
}
- res = gpakAlgControl(vpm->dspid, channel, control, &pstatus);
+ res = vpmadt032_control(vpm, channel, control, &pstatus);
if (res) {
vpm_info(vpm, "Unable to set SW Companding on "
"channel %d (reason %d)\n", channel, res);
}
- res = gpakAlgControl(vpm->dspid, channel, EnableEcanA, &pstatus);
+ res = vpmadt032_control(vpm, channel, EnableEcanA, &pstatus);
return res;
}
@@ -270,16 +289,16 @@ static int vpmadt032_disable_ec(struct vpmadt032 *vpm, int channel)
int res;
GPAK_AlgControlStat_t pstatus;
- if (vpm->options.debug & DEBUG_ECHOCAN)
+ if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
vpm_info(vpm, "Disabling ecan on channel: %d\n", channel);
- res = gpakAlgControl(vpm->dspid, channel, BypassSwCompanding, &pstatus);
+ res = vpmadt032_control(vpm, channel, BypassSwCompanding, &pstatus);
if (res) {
vpm_info(vpm, "Unable to disable sw companding on "
"echo cancellation channel %d (reason %d)\n",
channel, res);
}
- res = gpakAlgControl(vpm->dspid, channel, BypassEcanA, &pstatus);
+ res = vpmadt032_control(vpm, channel, BypassEcanA, &pstatus);
return res;
}
@@ -331,7 +350,7 @@ static void update_channel_config(struct vpmadt032 *vpm, unsigned int channel,
GPAK_TearDownChanStat_t tstatus;
GpakChannelConfig_t chanconfig;
- if (vpm->options.debug & DEBUG_ECHOCAN) {
+ if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN) {
vpm_info(vpm, "Reconfiguring chan %d for nlp %d, "
"nlp_thresh %d, and max_supp %d\n", channel + 1,
desired->nlp_type, desired->nlp_threshold,
@@ -350,14 +369,14 @@ static void update_channel_config(struct vpmadt032 *vpm, unsigned int channel,
return;
if (!desired->tap_length) {
- res = gpakAlgControl(vpm->dspid, channel,
+ res = vpmadt032_control(vpm, channel,
BypassSwCompanding, &pstatus);
if (res) {
vpm_info(vpm, "Unable to disable sw companding on "
"echo cancellation channel %d (reason %d)\n",
channel, res);
}
- gpakAlgControl(vpm->dspid, channel, BypassEcanA, &pstatus);
+ vpmadt032_control(vpm, channel, BypassEcanA, &pstatus);
}
return;
@@ -428,7 +447,9 @@ static void vpmadt032_check_and_schedule_update(struct vpmadt032 *vpm,
queue_work(vpm->wq, &vpm->work);
}
int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo,
- struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
+ enum adt_companding companding,
+ struct dahdi_echocanparams *ecp,
+ struct dahdi_echocanparam *p)
{
unsigned int ret;
struct change_order *order = alloc_change_order();
@@ -442,7 +463,7 @@ int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo,
return ret;
}
- if (vpm->options.debug & DEBUG_ECHOCAN) {
+ if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN) {
vpm_info(vpm, "Channel is %d length %d\n",
channo, ecp->tap_length);
}
@@ -451,7 +472,7 @@ int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo,
* module. Instead, it uses tap_length to enable or disable the echo
* cancellation. */
order->params.tap_length = (ecp->tap_length) ? 1 : 0;
- order->params.companding = vpm->companding;
+ order->params.companding = companding;
order->channel = channo;
vpmadt032_check_and_schedule_update(vpm, order);
@@ -474,7 +495,7 @@ void vpmadt032_echocan_free(struct vpmadt032 *vpm, int channo,
order->params.nlp_max_suppress = vpm->options.vpmnlpmaxsupp;
order->channel = channo;
- if (vpm->options.debug & DEBUG_ECHOCAN)
+ if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
vpm_info(vpm, "Channel is %d length 0\n", channo);
vpmadt032_check_and_schedule_update(vpm, order);
@@ -566,7 +587,7 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb)
might_sleep();
- if (vpm->options.debug & DEBUG_ECHOCAN)
+ if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
dev_info(&vpm->vb->pdev->dev, "VPMADT032 Testing page access: ");
for (i = 0; i < 0xf; i++) {
@@ -575,7 +596,7 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb)
vpmadt032_setpage(vpm, i);
reg = vpmadt032_getpage(vpm);
if (reg != i) {
- if (vpm->options.debug & DEBUG_ECHOCAN)
+ if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
dev_info(&vpm->vb->pdev->dev, "Failed: Sent %x != %x VPMADT032 Failed HI page test\n", i, reg);
res = -ENODEV;
goto failed_exit;
@@ -583,7 +604,7 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb)
}
}
- if (vpm->options.debug & DEBUG_ECHOCAN)
+ if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
dev_info(&vpm->vb->pdev->dev, "Passed\n");
set_bit(VPM150M_HPIRESET, &vpm->control);
@@ -593,7 +614,7 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb)
/* Set us up to page 0 */
vpmadt032_setpage(vpm, 0);
- if (vpm->options.debug & DEBUG_ECHOCAN)
+ if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
dev_info(&vpm->vb->pdev->dev, "VPMADT032 now doing address test: ");
for (i = 0; i < 16; i++) {
@@ -609,7 +630,7 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb)
}
}
- if (vpm->options.debug & DEBUG_ECHOCAN)
+ if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
printk(KERN_CONT "Passed\n");
set_bit(VPM150M_HPIRESET, &vpm->control);
@@ -631,8 +652,8 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb)
pingstatus = gpakPingDsp(vpm->dspid, &vpm->version);
if (!pingstatus) {
- if (vpm->options.debug & DEBUG_ECHOCAN)
- dev_info(&vpm->vb->pdev->dev, "Version of DSP is %x\n", vpm->version);
+ dev_info(&vpm->vb->pdev->dev,
+ "Version of DSP is %x\n", vpm->version);
} else {
dev_notice(&vpm->vb->pdev->dev, "VPMADT032 Failed! Unable to ping the DSP (%d)!\n", pingstatus);
res = -1;
diff --git a/drivers/dahdi/voicebus/GpakCust.h b/drivers/dahdi/voicebus/GpakCust.h
index 3a493e1..b4b523e 100644
--- a/drivers/dahdi/voicebus/GpakCust.h
+++ b/drivers/dahdi/voicebus/GpakCust.h
@@ -43,7 +43,7 @@
#include "gpakenum.h"
#include "adt_lec.h"
-#define DEBUG_ECHOCAN (1 << 1)
+#define DEBUG_VPMADT032_ECHOCAN (1 << 4)
/* Host and DSP system dependent related definitions. */
#define MAX_DSP_CORES 128 /* maximum number of DSP cores */
@@ -114,7 +114,6 @@ struct vpmadt032 {
unsigned long control;
unsigned char curpage;
unsigned short version;
- enum adt_companding companding;
struct adt_lec_params curecstate[MAX_CHANNELS];
spinlock_t change_list_lock;
struct list_head change_list;
@@ -143,7 +142,9 @@ struct vpmadt032 *vpmadt032_alloc(struct vpmadt032_options *options,
const char *board_name);
void vpmadt032_free(struct vpmadt032 *vpm);
int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo,
- struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p);
+ enum adt_companding companding,
+ struct dahdi_echocanparams *ecp,
+ struct dahdi_echocanparam *p);
void vpmadt032_echocan_free(struct vpmadt032 *vpm, int channo,
struct dahdi_echocan_state *ec);
diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c
index 3b6078a..ce6799e 100644
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -326,8 +326,10 @@ setchanconfig_from_state(struct vpmadt032 *vpm, int channel,
chanconfig->MuteToneB = Disabled;
chanconfig->FaxCngDetB = Disabled;
- chanconfig->SoftwareCompand = (ADT_COMP_ALAW == vpm->companding) ?
- cmpPCMA : cmpPCMU;
+ /* The software companding will be overridden on a channel by channel
+ * basis when the channel is enabled. */
+ chanconfig->SoftwareCompand = cmpPCMU;
+
chanconfig->FrameRate = rate2ms;
p = &chanconfig->EcanParametersA;
@@ -431,9 +433,6 @@ static int config_vpmadt032(struct vpmadt032 *vpm, struct wctdm *wc)
return -1;
}
- vpm->companding = (wc->span.deflaw == DAHDI_LAW_MULAW) ?
- ADT_COMP_ULAW : ADT_COMP_ALAW;
-
for (i = 0; i < vpm->options.channels; ++i) {
vpm->curecstate[i].tap_length = 0;
vpm->curecstate[i].nlp_type = vpm->options.vpmnlptype;
@@ -1830,8 +1829,13 @@ static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *e
wctdm_vpm_out(wc, unit, channel, 0x3e);
return 0;
} else if (wc->vpmadt032) {
+ enum adt_companding comp;
+
+ comp = (DAHDI_LAW_ALAW == chan->span->deflaw) ?
+ ADT_COMP_ALAW : ADT_COMP_ULAW;
+
return vpmadt032_echocan_create(wc->vpmadt032,
- chan->chanpos-1, ecp, p);
+ chan->chanpos-1, comp, ecp, p);
} else {
return -ENODEV;
}
diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c
index 7d0a8c7..38efdfa 100644
--- a/drivers/dahdi/wcte12xp/base.c
+++ b/drivers/dahdi/wcte12xp/base.c
@@ -344,7 +344,7 @@ static int config_vpmadt032(struct vpmadt032 *vpm, struct t1 *wc)
configportstatus);
return -1;
} else {
- if (vpm->options.debug & DEBUG_ECHOCAN)
+ if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
t1_info(wc, "Configured McBSP ports successfully\n");
}
@@ -353,14 +353,11 @@ static int config_vpmadt032(struct vpmadt032 *vpm, struct t1 *wc)
return -1;
}
- vpm->companding = (TYPE_T1 == wc->spantype) ?
- ADT_COMP_ULAW : ADT_COMP_ALAW;
for (channel = 0; channel < ARRAY_SIZE(vpm->curecstate); ++channel) {
vpm->curecstate[channel].tap_length = 0;
vpm->curecstate[channel].nlp_type = vpm->options.vpmnlptype;
vpm->curecstate[channel].nlp_threshold = vpm->options.vpmnlpthresh;
vpm->curecstate[channel].nlp_max_suppress = vpm->options.vpmnlpmaxsupp;
- vpm->curecstate[channel].companding = vpm->companding;
vpm->setchanconfig_from_state(vpm, channel, &chanconfig);
if ((res = gpakConfigureChannel(vpm->dspid, channel, tdmToTdm, &chanconfig, &cstatus))) {
@@ -1198,6 +1195,8 @@ static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *e
struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
{
struct t1 *wc = chan->pvt;
+ enum adt_companding comp;
+
if (!wc->vpmadt032) {
return -ENODEV;
}
@@ -1206,8 +1205,11 @@ static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *e
(*ec)->ops = &vpm150m_ec_ops;
(*ec)->features = vpm150m_ec_features;
+ comp = (DAHDI_LAW_ALAW == chan->span->deflaw) ?
+ ADT_COMP_ALAW : ADT_COMP_ULAW;
+
return vpmadt032_echocan_create(wc->vpmadt032, chan->chanpos - 1,
- ecp, p);
+ comp, ecp, p);
}
static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)