From patchwork Mon Jun 6 16:00:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "istvan_v@mailbox.hu" X-Patchwork-Id: 852482 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 p56G0WUv002834 for ; Mon, 6 Jun 2011 16:00:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757812Ab1FFQAZ (ORCPT ); Mon, 6 Jun 2011 12:00:25 -0400 Received: from mail.juropnet.hu ([212.24.188.131]:52836 "EHLO mail.juropnet.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757800Ab1FFQAX (ORCPT ); Mon, 6 Jun 2011 12:00:23 -0400 Received: from [94.248.228.122] (helo=linux-mrjj.localnet) by mail.juropnet.hu with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1QTcDy-00053f-1A for linux-media@vger.kernel.org; Mon, 06 Jun 2011 18:00:22 +0200 From: Istvan Varga To: linux-media@vger.kernel.org Subject: [PATCH 3/4] XC4000: check firmware version User-Agent: KMail/1.12.2 (Linux/2.6.31.5-0.1-desktop; KDE/4.3.1; x86_64; ; ) MIME-Version: 1.0 Date: Mon, 6 Jun 2011 18:00:17 +0200 Message-Id: <201106061800.17374.istvan_v@mailbox.hu> X-Host-Lookup-Failed: Reverse DNS lookup failed for 94.248.228.122 (failed) X-Spam-Score: -4.2 (----) X-Scan-Signature: d6101bde71bd3e353607e2d6e3bdf40e 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.6 (demeter1.kernel.org [140.211.167.41]); Mon, 06 Jun 2011 16:00:33 +0000 (UTC) Enabled code to check if the version of the firmware reported by the hardware is correct after uploading it. Signed-off-by: Istvan Varga --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -uNr xc4000_orig/drivers/media/common/tuners/xc4000.c xc4000/drivers/media/common/tuners/xc4000.c --- xc4000_orig/drivers/media/common/tuners/xc4000.c 2011-06-06 14:40:53.000000000 +0200 +++ xc4000/drivers/media/common/tuners/xc4000.c 2011-06-06 15:01:25.000000000 +0200 @@ -919,7 +919,7 @@ struct xc4000_priv *priv = fe->tuner_priv; struct firmware_properties new_fw; int rc = 0, is_retry = 0; - u16 version = 0, hwmodel; + u16 hwmodel; v4l2_std_id std0; u8 hw_major, hw_minor, fw_major, fw_minor; @@ -1032,23 +1032,23 @@ hwmodel, hw_major, hw_minor, fw_major, fw_minor); /* Check firmware version against what we downloaded. */ -#ifdef DJH_DEBUG - if (priv->firm_version != ((version & 0xf0) << 4 | (version & 0x0f))) { - printk("Incorrect readback of firmware version %x.\n", - (version & 0xff)); + if (priv->firm_version != ((fw_major << 8) | fw_minor)) { + printk(KERN_WARNING + "Incorrect readback of firmware version %d.%d.\n", + fw_major, fw_minor); goto fail; } -#endif /* Check that the tuner hardware model remains consistent over time. */ if (priv->hwmodel == 0 && (hwmodel == XC_PRODUCT_ID_XC4000 || hwmodel == XC_PRODUCT_ID_XC4100)) { priv->hwmodel = hwmodel; - priv->hwvers = version & 0xff00; + priv->hwvers = (hw_major << 8) | hw_minor; } else if (priv->hwmodel == 0 || priv->hwmodel != hwmodel || - priv->hwvers != (version & 0xff00)) { - printk("Read invalid device hardware information - tuner " + priv->hwvers != ((hw_major << 8) | hw_minor)) { + printk(KERN_WARNING + "Read invalid device hardware information - tuner " "hung?\n"); goto fail; }