From patchwork Sun Mar 21 11:14:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Castet X-Patchwork-Id: 87243 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2LBNqlj007815 for ; Sun, 21 Mar 2010 11:23:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751386Ab0CULXv (ORCPT ); Sun, 21 Mar 2010 07:23:51 -0400 Received: from smtpfb1-g21.free.fr ([212.27.42.9]:43302 "EHLO smtpfb1-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751329Ab0CULXu (ORCPT ); Sun, 21 Mar 2010 07:23:50 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 21 Mar 2010 11:23:52 +0000 (UTC) X-Greylist: delayed 535 seconds by postgrey-1.27 at vger.kernel.org; Sun, 21 Mar 2010 07:23:48 EDT Received: from smtp2-g21.free.fr (smtp2-g21.free.fr [212.27.42.2]) by smtpfb1-g21.free.fr (Postfix) with ESMTP id 9742F794407 for ; Sun, 21 Mar 2010 12:15:34 +0100 (CET) Received: from smtp2-g21.free.fr (localhost [127.0.0.1]) by smtp2-g21.free.fr (Postfix) with ESMTP id 150B74B0078; Sun, 21 Mar 2010 12:14:48 +0100 (CET) Received: from [192.168.1.234] (cac94-1-81-57-151-96.fbx.proxad.net [81.57.151.96]) by smtp2-g21.free.fr (Postfix) with ESMTP id 229394B01E2; Sun, 21 Mar 2010 12:14:46 +0100 (CET) Message-ID: <4BA5FFA5.7030800@free.fr> Date: Sun, 21 Mar 2010 12:14:45 +0100 From: matthieu castet User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1.23) Gecko/20090823 SeaMonkey/1.1.18 MIME-Version: 1.0 To: linux-media@vger.kernel.org CC: Antti Palosaari Subject: [PATCH] af9015 : more robust eeprom parsing Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index d797538..f93767e 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c @@ -493,7 +493,7 @@ static int af9015_copy_firmware(struct dvb_usb_device *d) /* wait 2nd demodulator ready */ msleep(100); - ret = af9015_read_reg_i2c(d, 0x3a, 0x98be, &val); + ret = af9015_read_reg_i2c(d, af9015_af9013_config[1].demod_address, 0x98be, &val); if (ret) goto error; else @@ -913,8 +913,13 @@ static int af9015_read_config(struct usb_device *udev) ret = af9015_rw_udev(udev, &req); if (ret) goto error; - af9015_af9013_config[1].demod_address = val; + if (val != AF9015_I2C_DEMOD) + af9015_af9013_config[1].demod_address = val; + else + af9015_config.dual_mode = 0; + } + if (af9015_config.dual_mode) { /* enable 2nd adapter */ for (i = 0; i < af9015_properties_count; i++) af9015_properties[i].num_adapters = 2; @@ -1023,11 +1028,6 @@ error: if (le16_to_cpu(udev->descriptor.idVendor) == USB_VID_AVERMEDIA && le16_to_cpu(udev->descriptor.idProduct) == USB_PID_AVERMEDIA_A850) { deb_info("%s: AverMedia A850: overriding config\n", __func__); - /* disable dual mode */ - af9015_config.dual_mode = 0; - /* disable 2nd adapter */ - for (i = 0; i < af9015_properties_count; i++) - af9015_properties[i].num_adapters = 1; /* set correct IF */ af9015_af9013_config[0].tuner_if = 4570;