aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorVDR User <user.vdr@gmail.com>2010-10-30 14:49:49 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-29 05:16:38 -0500
commit9e21ccaa69674e1b0aa887722801258f7de842db (patch)
tree00d7173c5f465e70b14a91007353f314bf7c1176 /drivers/media
parent141bb0dc2d0ad03202aef7c070555cd970ca6bf9 (diff)
[media] dvb-usb-gp8psk: get firmware and fpga versions
This patch adds retrieval of firmware and FPGA versions of Genpix devices. That information is useful for users who experience performance differences with the various firmware versions, and may want to use a specific firmware that best suits their needs. Example dmesg output: gp8psk: FW Version = 2.09.4 (0x20904) Build 2009/04/02 gp8psk: FPGA Version = 1 Signed-off-by: Derek Kelly <user.vdr@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-usb/gp8psk.c28
-rw-r--r--drivers/media/dvb/dvb-usb/gp8psk.h8
2 files changed, 35 insertions, 1 deletions
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.c b/drivers/media/dvb/dvb-usb/gp8psk.c
index c821293dbc22..1cb3d9a66e02 100644
--- a/drivers/media/dvb/dvb-usb/gp8psk.c
+++ b/drivers/media/dvb/dvb-usb/gp8psk.c
@@ -24,6 +24,33 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DV
24 24
25DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 25DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
26 26
27static int gp8psk_get_fw_version(struct dvb_usb_device *d, u8 *fw_vers)
28{
29 return (gp8psk_usb_in_op(d, GET_FW_VERS, 0, 0, fw_vers, 6));
30}
31
32static int gp8psk_get_fpga_version(struct dvb_usb_device *d, u8 *fpga_vers)
33{
34 return (gp8psk_usb_in_op(d, GET_FPGA_VERS, 0, 0, fpga_vers, 1));
35}
36
37static void gp8psk_info(struct dvb_usb_device *d)
38{
39 u8 fpga_vers, fw_vers[6];
40
41 if (!gp8psk_get_fw_version(d, fw_vers))
42 info("FW Version = %i.%02i.%i (0x%x) Build %4i/%02i/%02i",
43 fw_vers[2], fw_vers[1], fw_vers[0], GP8PSK_FW_VERS(fw_vers),
44 2000 + fw_vers[5], fw_vers[4], fw_vers[3]);
45 else
46 info("failed to get FW version");
47
48 if (!gp8psk_get_fpga_version(d, &fpga_vers))
49 info("FPGA Version = %i", fpga_vers);
50 else
51 info("failed to get FPGA version");
52}
53
27int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) 54int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen)
28{ 55{
29 int ret = 0,try = 0; 56 int ret = 0,try = 0;
@@ -146,6 +173,7 @@ static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff)
146 gp8psk_usb_out_op(d, CW3K_INIT, 1, 0, NULL, 0); 173 gp8psk_usb_out_op(d, CW3K_INIT, 1, 0, NULL, 0);
147 if (gp8psk_usb_in_op(d, BOOT_8PSK, 1, 0, &buf, 1)) 174 if (gp8psk_usb_in_op(d, BOOT_8PSK, 1, 0, &buf, 1))
148 return -EINVAL; 175 return -EINVAL;
176 gp8psk_info(d);
149 } 177 }
150 178
151 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) 179 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM)
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.h b/drivers/media/dvb/dvb-usb/gp8psk.h
index e83a57506cfa..831749a518cb 100644
--- a/drivers/media/dvb/dvb-usb/gp8psk.h
+++ b/drivers/media/dvb/dvb-usb/gp8psk.h
@@ -25,7 +25,6 @@ extern int dvb_usb_gp8psk_debug;
25#define deb_xfer(args...) dprintk(dvb_usb_gp8psk_debug,0x02,args) 25#define deb_xfer(args...) dprintk(dvb_usb_gp8psk_debug,0x02,args)
26#define deb_rc(args...) dprintk(dvb_usb_gp8psk_debug,0x04,args) 26#define deb_rc(args...) dprintk(dvb_usb_gp8psk_debug,0x04,args)
27#define deb_fe(args...) dprintk(dvb_usb_gp8psk_debug,0x08,args) 27#define deb_fe(args...) dprintk(dvb_usb_gp8psk_debug,0x08,args)
28/* gp8psk commands */
29 28
30/* Twinhan Vendor requests */ 29/* Twinhan Vendor requests */
31#define TH_COMMAND_IN 0xC0 30#define TH_COMMAND_IN 0xC0
@@ -49,8 +48,10 @@ extern int dvb_usb_gp8psk_debug;
49#define SET_DVB_MODE 0x8E 48#define SET_DVB_MODE 0x8E
50#define SET_DN_SWITCH 0x8F 49#define SET_DN_SWITCH 0x8F
51#define GET_SIGNAL_LOCK 0x90 /* in */ 50#define GET_SIGNAL_LOCK 0x90 /* in */
51#define GET_FW_VERS 0x92
52#define GET_SERIAL_NUMBER 0x93 /* in */ 52#define GET_SERIAL_NUMBER 0x93 /* in */
53#define USE_EXTRA_VOLT 0x94 53#define USE_EXTRA_VOLT 0x94
54#define GET_FPGA_VERS 0x95
54#define CW3K_INIT 0x9d 55#define CW3K_INIT 0x9d
55 56
56/* PSK_configuration bits */ 57/* PSK_configuration bits */
@@ -88,6 +89,11 @@ extern int dvb_usb_gp8psk_debug;
88#define PRODUCT_STRING_READ 0x0D 89#define PRODUCT_STRING_READ 0x0D
89#define FW_BCD_VERSION_READ 0x14 90#define FW_BCD_VERSION_READ 0x14
90 91
92/* firmware revision id's */
93#define GP8PSK_FW_REV1 0x020604
94#define GP8PSK_FW_REV2 0x020704
95#define GP8PSK_FW_VERS(_fw_vers) ((_fw_vers)[2]<<0x10 | (_fw_vers)[1]<<0x08 | (_fw_vers)[0])
96
91extern struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d); 97extern struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d);
92extern int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); 98extern int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen);
93extern int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, 99extern int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,