From patchwork Tue Oct 19 21:24:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 266501 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 o9JLOjBj006950 for ; Tue, 19 Oct 2010 21:24:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757913Ab0JSVYn (ORCPT ); Tue, 19 Oct 2010 17:24:43 -0400 Received: from mtaout02-winn.ispmail.ntl.com ([81.103.221.48]:10662 "EHLO mtaout02-winn.ispmail.ntl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757786Ab0JSVYm (ORCPT ); Tue, 19 Oct 2010 17:24:42 -0400 Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20101019212441.NYIM7723.mtaout02-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com>; Tue, 19 Oct 2010 22:24:41 +0100 Received: from zog.reactivated.net ([86.14.215.141]) by aamtaout01-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20101019212441.PCAW20122.aamtaout01-winn.ispmail.ntl.com@zog.reactivated.net>; Tue, 19 Oct 2010 22:24:41 +0100 Received: by zog.reactivated.net (Postfix, from userid 1000) id 15C339D401B; Tue, 19 Oct 2010 22:24:39 +0100 (BST) From: Daniel Drake To: corbet@lwn.net To: mchehab@infradead.org Cc: linux-media@vger.kernel.org Subject: [PATCH 2/2] cafe_ccic: Configure ov7670 correctly Message-Id: <20101019212439.15C339D401B@zog.reactivated.net> Date: Tue, 19 Oct 2010 22:24:38 +0100 (BST) X-Cloudmark-Analysis: v=1.1 cv=4QByPj+6Iq2k/6L54d+eVKTdgQxdscpRskJJReCfdXo= c=1 sm=0 a=vJamE4Ug0P8A:10 a=Op-mwl0xAAAA:8 a=GN-lLRZDKl8O-g9qNhEA:9 a=0KCYbFTXh2JvH1GFTkYA:7 a=lFAKOAkpnEIe0nIxhygbVjASZVwA:4 a=d4CUUju0HPYA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 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, 19 Oct 2010 21:24:45 +0000 (UTC) diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index b4f5b3b..4378597 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,7 @@ #include #include +#include "ov7670.h" #include "cafe_ccic-regs.h" #define CAFE_VERSION 0x000002 @@ -1974,11 +1976,33 @@ static irqreturn_t cafe_irq(int irq, void *data) * PCI interface stuff. */ +static const struct dmi_system_id olpc_xo1_dmi[] = { + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "OLPC"), + DMI_MATCH(DMI_PRODUCT_NAME, "XO"), + DMI_MATCH(DMI_PRODUCT_VERSION, "1"), + }, + }, + { } +}; + static int cafe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { int ret; struct cafe_camera *cam; + struct ov7670_config sensor_cfg = { + /* This controller only does SMBUS */ + .use_smbus = true, + + /* + * Exclude QCIF mode, because it only captures a tiny portion + * of the sensor FOV + */ + .min_width = 320, + .min_height = 240, + }; /* * Start putting together one of our big camera structures. @@ -2036,13 +2060,18 @@ static int cafe_pci_probe(struct pci_dev *pdev, if (ret) goto out_freeirq; + /* Apply XO-1 clock speed */ + if (dmi_check_system(olpc_xo1_dmi)) + sensor_cfg.clock_speed = 45; + cam->sensor_addr = 0x42; - cam->sensor = v4l2_i2c_new_subdev(&cam->v4l2_dev, &cam->i2c_adapter, - "ov7670", "ov7670", cam->sensor_addr, NULL); + cam->sensor = v4l2_i2c_new_subdev_cfg(&cam->v4l2_dev, &cam->i2c_adapter, + "ov7670", "ov7670", 0, &sensor_cfg, cam->sensor_addr, NULL); if (cam->sensor == NULL) { ret = -ENODEV; goto out_smbus; } + ret = cafe_cam_init(cam); if (ret) goto out_smbus;