[dahdi-commits] tzafrir: linux/trunk r10300 - /linux/trunk/drivers/dahdi/xpp/
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Wed Nov 2 09:08:15 CDT 2011
Author: tzafrir
Date: Wed Nov 2 09:08:12 2011
New Revision: 10300
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10300
Log:
xpp: Adaptations for E-Main-3
* An xbus transport now have a "model_string" member
* The xpp_usb driver fills this with "usb:<idVendor>/<idProduct>/<bcdDevice>"
* It is passed via environment to the "init_card_<type>_<protocol>" scripts
* The FXS script uses this to condition two registers according to
the power supply model.
Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
Modified:
linux/trunk/drivers/dahdi/xpp/card_global.c
linux/trunk/drivers/dahdi/xpp/init_card_1_30
linux/trunk/drivers/dahdi/xpp/xbus-core.h
linux/trunk/drivers/dahdi/xpp/xpp_usb.c
Modified: linux/trunk/drivers/dahdi/xpp/card_global.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/card_global.c?view=diff&rev=10300&r1=10299&r2=10300
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/card_global.c (original)
+++ linux/trunk/drivers/dahdi/xpp/card_global.c Wed Nov 2 09:08:12 2011
@@ -642,7 +642,6 @@
DBG(GENERAL, "%s\n", msg);
}
-#define MAX_ENV_STR 40
#define MAX_PATH_STR 128
int run_initialize_registers(xpd_t *xpd)
@@ -651,6 +650,7 @@
xbus_t *xbus;
char busstr[MAX_ENV_STR];
char busnumstr[MAX_ENV_STR];
+ char modelstr[MAX_ENV_STR];
char unitstr[MAX_ENV_STR];
char subunitsstr[MAX_ENV_STR];
char typestr[MAX_ENV_STR];
@@ -668,6 +668,7 @@
char *envp[] = {
busstr,
busnumstr,
+ modelstr,
unitstr,
subunitsstr,
typestr,
@@ -703,6 +704,7 @@
}
snprintf(busstr, MAX_ENV_STR, "XBUS_NAME=%s", xbus->busname);
snprintf(busnumstr, MAX_ENV_STR, "XBUS_NUMBER=%d", xbus->num);
+ snprintf(modelstr, MAX_ENV_STR, "XBUS_MODEL_STRING=%s", xbus->transport.model_string);
snprintf(unitstr, MAX_ENV_STR, "UNIT_NUMBER=%d", xpd->addr.unit);
snprintf(typestr, MAX_ENV_STR, "UNIT_TYPE=%d", xpd->type);
snprintf(subunitsstr, MAX_ENV_STR, "UNIT_SUBUNITS=%d", xpd->subunits);
Modified: linux/trunk/drivers/dahdi/xpp/init_card_1_30
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/init_card_1_30?view=diff&rev=10300&r1=10299&r2=10300
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/init_card_1_30 (original)
+++ linux/trunk/drivers/dahdi/xpp/init_card_1_30 Wed Nov 2 09:08:12 2011
@@ -51,6 +51,7 @@
use XppConfig $init_dir;
my $unit_id;
my %opts;
+my $vbat_48 = 0;
getopts('o:', \%opts);
@@ -78,6 +79,7 @@
foreach my $k (qw(
XBUS_NAME
XBUS_NUMBER
+ XBUS_MODEL_STRING
UNIT_NUMBER
UNIT_TYPE
UNIT_SUBUNITS
@@ -89,6 +91,10 @@
logit "Missing ENV{$k}\n";
die;
}
+ }
+ logit "XBUS_MODEL_STRING='$ENV{XBUS_MODEL_STRING}'";
+ if ($ENV{XBUS_MODEL_STRING} =~ m{.*/.*/201}) {
+ $vbat_48 = 1;
}
$chipregs = sprintf "/sys/bus/xpds/devices/%02d:%1d:0/chipregs",
$ENV{XBUS_NUMBER}, $ENV{UNIT_NUMBER};
@@ -286,11 +292,15 @@
}
sub init_early_direct_regs() {
+ my $lbv = ($vbat_48) ? "20" : "10";
+ my $vcm = ($vbat_48) ? "02" : "03";
+
return write_to_slic_file("#
* WD 08 00 # Audio Path Loopback Control
* WD 6C 01
* WD 4A 3F # High Battery Voltage
-* WD 4B 10 # Low Battery Voltage
+* WD 4B $lbv # Low Battery Voltage
+* WD 49 $vcm # Common Mode Voltage (VCM)
* WD 40 00 # Line Feed Control
#")
}
@@ -578,9 +588,6 @@
# On-Hook Line Voltage (VOC)
* WD 48 20
-# Common Mode Voltage (VCM)
-* WD 49 03
-
* WS 1E 23 00 80
* WS 1E 24 20 03
* WS 1E 25 8C 00
Modified: linux/trunk/drivers/dahdi/xpp/xbus-core.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/xbus-core.h?view=diff&rev=10300&r1=10299&r2=10300
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xbus-core.h (original)
+++ linux/trunk/drivers/dahdi/xpp/xbus-core.h Wed Nov 2 09:08:12 2011
@@ -29,8 +29,9 @@
#include "xframe_queue.h"
#include "xbus-pcm.h"
-#define MAX_BUSES 32
-#define XFRAME_DATASIZE 512
+#define MAX_BUSES 32
+#define XFRAME_DATASIZE 512
+#define MAX_ENV_STR 40
/* forward declarations */
struct xbus_workqueue;
@@ -108,6 +109,7 @@
atomic_t transport_refcount;
wait_queue_head_t transport_unused;
spinlock_t lock;
+ char model_string[MAX_ENV_STR];
};
#define MAX_SEND_SIZE(xbus) ((xbus)->transport.max_send_size)
Modified: linux/trunk/drivers/dahdi/xpp/xpp_usb.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/xpp/xpp_usb.c?view=diff&rev=10300&r1=10299&r2=10300
==============================================================================
--- linux/trunk/drivers/dahdi/xpp/xpp_usb.c (original)
+++ linux/trunk/drivers/dahdi/xpp/xpp_usb.c Wed Nov 2 09:08:12 2011
@@ -737,6 +737,12 @@
retval = -ENOMEM;
goto probe_failed;
}
+ snprintf(xbus->transport.model_string,
+ ARRAY_SIZE(xbus->transport.model_string),
+ "usb:%04x/%04x/%x",
+ udev->descriptor.idVendor,
+ udev->descriptor.idProduct,
+ udev->descriptor.bcdDevice);
spin_lock_irqsave(&xusb_lock, flags);
for(i = 0; i < MAX_BUSES; i++) {
if(xusb_array[i] == NULL)
More information about the dahdi-commits
mailing list