From patchwork Sat Oct 30 18:49:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: VDRU VDRU X-Patchwork-Id: 292402 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9UInxKn011356 for ; Sat, 30 Oct 2010 18:49:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753090Ab0J3St5 (ORCPT ); Sat, 30 Oct 2010 14:49:57 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:56805 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752174Ab0J3St4 (ORCPT ); Sat, 30 Oct 2010 14:49:56 -0400 Received: by pzk3 with SMTP id 3so263310pzk.19 for ; Sat, 30 Oct 2010 11:49:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type; bh=MG9gic8+wHWKKRibL+8g5Da5GIN5/h5S1C98xuDezpM=; b=Ma8RMRXYlWCHxpTfJtAnRlfokXNJdcQp13IQzoulsp9qrIXDjX3lqWqzA/alwE4LEc HK+cOl8tTWbWw2dAappL2ZHlOCQu+ueKuWwHA5TJS1T2sOfhrPSEE/Mbz/yx9+Vp4Ops V3xHmYxCVSL0X314NOKPme+UHX8aCXTWeTTSI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=nuh72WNgRV5btgrCXMKWVllcrv8Xkl5FheLHEc2qWPD/UM1s/AhMGHbDhPYB1y66dA SJM2uLU4xUwheinjddVy/wKLlc157+lZCkYTrup5GnryBe1vuyvxf0tyskrcUy4SDU3G Qi4EBYzXyxheYinkeUMsUHBCX5xQ4J/tc26l0= Received: by 10.142.217.18 with SMTP id p18mr2663938wfg.38.1288464595990; Sat, 30 Oct 2010 11:49:55 -0700 (PDT) Received: from [192.168.0.4] (174-24-169-223.tukw.qwest.net [174.24.169.223]) by mx.google.com with ESMTPS id y42sm4592763wfd.22.2010.10.30.11.49.54 (version=SSLv3 cipher=RC4-MD5); Sat, 30 Oct 2010 11:49:55 -0700 (PDT) Message-ID: <4CCC68CD.50409@gmail.com> Date: Sat, 30 Oct 2010 11:49:49 -0700 From: "D. K." User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: linux-media@vger.kernel.org Subject: [PATCH] dvb-usb-gp8psk: get firmware and fpga versions Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 30 Oct 2010 18:49:59 +0000 (UTC) diff -pruN v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/gp8psk.c v4l-dvb/linux/drivers/media/dvb/dvb-usb/gp8psk.c --- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/gp8psk.c 2010-10-30 11:20:46.000000000 -0700 +++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/gp8psk.c 2010-10-30 11:21:36.000000000 -0700 @@ -24,6 +24,33 @@ MODULE_PARM_DESC(debug, "set debugging l DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); +static int gp8psk_get_fw_version(struct dvb_usb_device *d, u8 *fw_vers) +{ + return (gp8psk_usb_in_op(d, GET_FW_VERS, 0, 0, fw_vers, 6)); +} + +static int gp8psk_get_fpga_version(struct dvb_usb_device *d, u8 *fpga_vers) +{ + return (gp8psk_usb_in_op(d, GET_FPGA_VERS, 0, 0, fpga_vers, 1)); +} + +static void gp8psk_info(struct dvb_usb_device *d) +{ + u8 fpga_vers, fw_vers[6]; + + if (!gp8psk_get_fw_version(d, fw_vers)) + info("FW Version = %i.%02i.%i (0x%x) Build %4i/%02i/%02i", + fw_vers[2], fw_vers[1], fw_vers[0], GP8PSK_FW_VERS(fw_vers), + 2000 + fw_vers[5], fw_vers[4], fw_vers[3]); + else + info("failed to get FW version"); + + if (!gp8psk_get_fpga_version(d, &fpga_vers)) + info("FPGA Version = %i", fpga_vers); + else + info("failed to get FPGA version"); +} + int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) { int ret = 0,try = 0; @@ -146,6 +173,7 @@ static int gp8psk_power_ctrl(struct dvb_ gp8psk_usb_out_op(d, CW3K_INIT, 1, 0, NULL, 0); if (gp8psk_usb_in_op(d, BOOT_8PSK, 1, 0, &buf, 1)) return -EINVAL; + gp8psk_info(d); } if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) diff -pruN v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/gp8psk.h v4l-dvb/linux/drivers/media/dvb/dvb-usb/gp8psk.h --- v4l-dvb.orig/linux/drivers/media/dvb/dvb-usb/gp8psk.h 2010-10-30 11:20:46.000000000 -0700 +++ v4l-dvb/linux/drivers/media/dvb/dvb-usb/gp8psk.h 2010-10-30 11:24:30.000000000 -0700 @@ -25,7 +25,6 @@ extern int dvb_usb_gp8psk_debug; #define deb_xfer(args...) dprintk(dvb_usb_gp8psk_debug,0x02,args) #define deb_rc(args...) dprintk(dvb_usb_gp8psk_debug,0x04,args) #define deb_fe(args...) dprintk(dvb_usb_gp8psk_debug,0x08,args) -/* gp8psk commands */ /* Twinhan Vendor requests */ #define TH_COMMAND_IN 0xC0 @@ -49,8 +48,10 @@ extern int dvb_usb_gp8psk_debug; #define SET_DVB_MODE 0x8E #define SET_DN_SWITCH 0x8F #define GET_SIGNAL_LOCK 0x90 /* in */ +#define GET_FW_VERS 0x92 #define GET_SERIAL_NUMBER 0x93 /* in */ #define USE_EXTRA_VOLT 0x94 +#define GET_FPGA_VERS 0x95 #define CW3K_INIT 0x9d /* PSK_configuration bits */ @@ -88,6 +89,11 @@ extern int dvb_usb_gp8psk_debug; #define PRODUCT_STRING_READ 0x0D #define FW_BCD_VERSION_READ 0x14 +/* firmware revision id's */ +#define GP8PSK_FW_REV1 0x020604 +#define GP8PSK_FW_REV2 0x020704 +#define GP8PSK_FW_VERS(_fw_vers) ((_fw_vers)[2]<<0x10 | (_fw_vers)[1]<<0x08 | (_fw_vers)[0]) + extern struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d); extern int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); extern int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,