diff options
author | Noe Rubinstein <nrubinstein@proformatique.com> | 2011-01-13 12:15:50 +0100 |
---|---|---|
committer | Noe Rubinstein <nrubinstein@proformatique.com> | 2011-01-20 18:33:00 +0100 |
commit | a23ecd92a42a4b378e2d53d6c69dccb4b180392f (patch) | |
tree | 07bc0234c9a9a4e20442d88d29e53383d74a05c7 /xivovp | |
parent | d3319b733d4f59b75d03299358ac68fc702d6274 (diff) |
misc
Diffstat (limited to 'xivovp')
-rw-r--r-- | xivovp/base.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/xivovp/base.c b/xivovp/base.c index 9036cc8..684639f 100644 --- a/xivovp/base.c +++ b/xivovp/base.c @@ -1,12 +1,15 @@ #include <linux/kernel.h> #include <linux/module.h> #include <linux/errno.h> +#include <linux/delay.h> #include <linux/timer.h> #include <linux/compiler.h> #include <linux/stringify.h> #include <dahdi/kernel.h> +#include <gpio/gpio.h> + #ifdef AUDIO #include <tdm/xivo_tdm_api.h> @@ -53,9 +56,13 @@ static int alawoverride = 1; /* It's named like that in every DAHDI driver except I prefer it to be 1 so the name doesn't make much sense. */ static int reverse_polarity = false; +static int wait_port0 = false; +static uint reset_gpio = 21; module_param(init_dbg, uint, 0444); +module_param(reset_gpio, uint, 0444); module_param(traces_vanish, int, 0444); +module_param(wait_port0, int, 0444); module_param(alawoverride, int, 0600); module_param(reverse_polarity, int, 0600); @@ -116,6 +123,17 @@ static void xivovp_txrx(void *data) } #endif +void reset_ve890(void) +{ + gpio_set_direction(reset_gpio, GPIO_OUTPUT); + gpio_set_to_gpio(reset_gpio); + gpio_set_level(reset_gpio, GPIO_HIGH); + msleep(1); + gpio_set_level(reset_gpio, GPIO_LOW); + msleep(1); + gpio_set_level(reset_gpio, GPIO_HIGH); +} + /* Returns the xivovp_line which line is the same as the VpLineCtxType */ static struct xivovp_line* xivovp_line_from_ctx(VpLineCtxType* line_ctx) { @@ -736,7 +754,6 @@ vp_init(void) } else { printk(KERN_INFO DRV_NAME ": VpMakeLineObject (FXO) done.\n"); } -#endif vpst = VpInitDevice( &xivovp.dev_ctx, @@ -779,6 +796,8 @@ test_evb_ve890_init(void) int rc; printk(KERN_INFO DRV_NAME ": entering %s\n", __func__); + reset_ve890(); + rc = tlp_spidev_init(); if (rc < 0) { printk(KERN_ERR DRV_NAME ": tlp_spidev_init failed (%d)\n", rc); @@ -796,11 +815,16 @@ test_evb_ve890_init(void) } #ifdef AUDIO - /* UGLY EVIL HACK -1 */ - xivo_tdm_register_port0_configured( - xivovp.tdm_port, - xivovp_port0_configured_cb, - NULL); + if(wait_port0) + /* UGLY EVIL HACK -1 */ + xivo_tdm_register_port0_configured( + xivovp.tdm_port, + xivovp_port0_configured_cb, + NULL); + else { + xivovp_port0_configured_cb(NULL); + xivovp_port0_started_cb(NULL); + } return 0; #else @@ -832,9 +856,11 @@ xivovp_port0_configured_cb(void *data) printk(KERN_ERR "%s START\n", __func__); if ((rc = xivo_tdm_config_port(xivovp.tdm_port, - LE89316_MEGREZ_PROTO_XIVO_CONFIG)) < 0) { + LE89316_ASYNC_MEGREZ_PROTO_XIVO_CONFIG)) + < 0) { printk(KERN_CRIT "%s: xivo_tdm_config_port returned %d\n", __func__, rc); + msleep(999); goto err_config_port; } |