From patchwork Tue Dec 7 20:37:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 384032 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 oB7KdZro019301 for ; Tue, 7 Dec 2010 20:39:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754233Ab0LGUjd (ORCPT ); Tue, 7 Dec 2010 15:39:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59386 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753428Ab0LGUjd (ORCPT ); Tue, 7 Dec 2010 15:39:33 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oB7KdUFH016467 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 7 Dec 2010 15:39:30 -0500 Received: from pedra (vpn-231-36.phx2.redhat.com [10.3.231.36]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oB7KbOpl018149; Tue, 7 Dec 2010 15:39:28 -0500 Date: Tue, 7 Dec 2010 18:37:13 -0200 From: Mauro Carvalho Chehab To: Jean-Francois Moine , Brian Johnson , Linux Media Mailing List Subject: [PATCH 1/3] [media] gspca/sn9c20x: Test if sensor is really a ov9650 Message-ID: <20101207183713.45572acb@pedra> In-Reply-To: References: Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 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]); Tue, 07 Dec 2010 20:39:36 +0000 (UTC) diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index 6b155ae..1e0f219 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c @@ -1224,8 +1224,17 @@ static int i2c_r2(struct gspca_dev *gspca_dev, u8 reg, u16 *val) static int ov9650_init_sensor(struct gspca_dev *gspca_dev) { int i; + u16 id; struct sd *sd = (struct sd *) gspca_dev; + if (i2c_r2(gspca_dev, 0x1c, &id) < 0) + return -EINVAL; + + if (id != 0x7fa2) { + err("sensor id for ov9650 doesn't match (0x%04x)", id); + return -ENODEV; + } + for (i = 0; i < ARRAY_SIZE(ov9650_init); i++) { if (i2c_w1(gspca_dev, ov9650_init[i].reg, ov9650_init[i].val) < 0) {