~xnox/debian/sid/dahdi-linux/nmu-659818

« back to all changes in this revision

Viewing changes to drivers/dahdi/wcb4xxp/base.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell, Tzafrir Cohen, Victor Seva
  • Date: 2009-05-20 07:22:46 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090520072246-y1ba8ofc81ykgf8z
Tags: 1:2.2.0~dfsg~rc4-1
* New upstream release

[ Tzafrir Cohen ]
* NOT RELEASED YET
* Dropped qozap as wcb4xxp provides that functionality.
* New upstream RC.
* Actually build OpenVox drivers.
* opvxa1200.c: rev. 1.4.12.4 (battery fixes and such)
* Fix '${match}' in udev rules file (hardwire).
* no_firmware_download: Disable downloading a binary kernel module at 
  build time.

[ Victor Seva ]
* fix debian/watch. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
static int milliwatt = 0;
83
83
static int pedanticpci = 0;
84
84
static int teignorered = 0;
85
 
static int alarmdebounce = 0;
 
85
static int alarmdebounce = 500;
86
86
static int vpmsupport = 1;
87
87
static int timer_1_ms = 2000;
88
88
static int timer_3_ms = 30000;
89
89
 
 
90
#if !defined(mmiowb)
 
91
#define mmiowb() barrier()
 
92
#endif
 
93
 
90
94
#define MAX_B4_CARDS 64
91
95
static struct b4xxp *cards[MAX_B4_CARDS];
92
96
 
114
118
 
115
119
static struct devtype wcb4xxp = { "Wildcard B410P", 0 };
116
120
 
 
121
static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
 
122
                           struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
 
123
static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
 
124
 
 
125
static const struct dahdi_echocan_features my_ec_features = {
 
126
        .NLP_automatic = 1,
 
127
        .CED_tx_detect = 1,
 
128
        .CED_rx_detect = 1,
 
129
};
 
130
 
 
131
static const struct dahdi_echocan_ops my_ec_ops = {
 
132
        .name = "HWEC",
 
133
        .echocan_free = echocan_free,
 
134
};
117
135
 
118
136
#if 0
119
 
static const char *wcb4xxp_rcsdata = "$RCSfile: base.c,v $ $Revision: 5576 $";
 
137
static const char *wcb4xxp_rcsdata = "$RCSfile: base.c,v $ $Revision: 6552 $";
120
138
static const char *build_stamp = "" __DATE__ " " __TIME__ "";
121
139
#endif
122
140
 
1209
1227
                if (s->newalarm != s->span.alarms && time_after_eq(b4->ticks, s->alarmtimer)) {
1210
1228
                        if (!s->te_mode || !teignorered) {
1211
1229
                                s->span.alarms = s->newalarm;
 
1230
                                dahdi_alarm_notify(&s->span);
1212
1231
                                if (DBG_ALARM)
1213
1232
                                        dev_info(b4->dev, "span %d: alarm %d debounced\n", i + 1, s->newalarm);
1214
1233
                                if (!s->te_mode)
1883
1902
        }
1884
1903
}
1885
1904
 
1886
 
static int b4xxp_echocan(struct dahdi_chan *chan, int eclen)
 
1905
static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
 
1906
                          struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
1887
1907
{
1888
 
        struct b4xxp *b4 = chan->pvt;
 
1908
        struct b4xxp_span *bspan = chan->span->pvt;
1889
1909
        int channel;
1890
 
        int unit; 
1891
 
        
1892
 
        if (chan->chanpos != 3) 
1893
 
                unit = chan->chanpos - 1;
1894
 
        else
1895
 
                return 0;
1896
 
        
 
1910
 
 
1911
        if (chan->chanpos == 3) {
 
1912
                printk(KERN_WARNING "Cannot enable echo canceller on D channel of span %d; failing request\n", chan->span->offset);
 
1913
                return -EINVAL;
 
1914
        }
 
1915
 
 
1916
        if (ecp->param_count > 0) {
 
1917
                printk(KERN_WARNING "wcb4xxp echo canceller does not support parameters; failing request\n");
 
1918
                return -EINVAL;
 
1919
        }
 
1920
 
 
1921
        *ec = &bspan->ec[chan->chanpos];
 
1922
        (*ec)->ops = &my_ec_ops;
 
1923
        (*ec)->features = my_ec_features;
 
1924
 
 
1925
        if (DBG_EC)
 
1926
                printk("Enabling echo cancellation on chan %d span %d\n", chan->chanpos, chan->span->offset);
 
1927
 
1897
1928
        channel = (chan->span->offset * 8) + ((chan->chanpos - 1) * 4) + 1;
1898
1929
        
1899
 
        if (eclen) { /* Enable */
1900
 
                if (DBG_EC)
1901
 
                        printk("Enabling echo cancellation on chan %d span %d\n", chan->chanpos, chan->span->offset);
1902
 
                ec_write(b4, unit, channel, 0x7e);
1903
 
        } else { /* Disable */
1904
 
                if (DBG_EC)
1905
 
                        printk("Disabling echo cancellation on chan %d span %d\n", chan->chanpos, chan->span->offset);
1906
 
                ec_write(b4, unit, channel, 0x01);
1907
 
        }
1908
 
        
 
1930
        ec_write(bspan->parent, chan->chanpos - 1, channel, 0x7e);
 
1931
 
1909
1932
        return 0;
1910
 
 
1911
 
}
1912
 
 
 
1933
}
 
1934
 
 
1935
static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)
 
1936
{
 
1937
        struct b4xxp_span *bspan = chan->span->pvt;
 
1938
        int channel;
 
1939
 
 
1940
        memset(ec, 0, sizeof(*ec));
 
1941
 
 
1942
        if (DBG_EC)
 
1943
                printk("Disabling echo cancellation on chan %d span %d\n", chan->chanpos, chan->span->offset);
 
1944
 
 
1945
        channel = (chan->span->offset * 8) + ((chan->chanpos - 1) * 4) + 1;
 
1946
 
 
1947
        ec_write(bspan->parent, chan->chanpos - 1, channel, 0x01);
 
1948
}
1913
1949
 
1914
1950
/*
1915
1951
 * Filesystem and DAHDI interfaces
2139
2175
                bspan->span.ioctl = b4xxp_ioctl;
2140
2176
                bspan->span.hdlc_hard_xmit = b4xxp_hdlc_hard_xmit;
2141
2177
                if (vpmsupport)
2142
 
                        bspan->span.echocan = b4xxp_echocan;
 
2178
                        bspan->span.echocan_create = echocan_create;
2143
2179
 
2144
2180
/* HDLC stuff */
2145
2181
                bspan->sigchan = NULL;
2700
2736
#endif
2701
2737
module_param(milliwatt, int, S_IRUGO | S_IWUSR);
2702
2738
module_param(pedanticpci, int, S_IRUGO);
 
2739
module_param(teignorered, int, S_IRUGO | S_IWUSR);
2703
2740
module_param(alarmdebounce, int, S_IRUGO | S_IWUSR);
2704
2741
module_param(vpmsupport, int, S_IRUGO);
2705
2742
module_param(timer_1_ms, int, S_IRUGO | S_IWUSR);